CMS 3D CMS Logo

EcalSimRawData.h
Go to the documentation of this file.
1 /*
2  */
3 
11 #include <fstream>
12 #include <string>
13 
43 public:
47  explicit EcalSimRawData(const edm::ParameterSet &pset);
48 
51  ~EcalSimRawData() override = default;
52 
56  void analyze(const edm::Event &, const edm::EventSetup &) override;
57 
58 private:
59  enum tokenType { tcp = 0, tp = 1 };
60 
61  int iEvent;
62 
65  static const int nEbEta = 170;
66 
69  static const int nEbPhi = 360;
70 
73  static const int nEeX = 100;
74 
77  static const int nEeY = 100;
78 
81  static const int nEndcaps = 2;
82 
85  static const int scEdge = 5;
86 
89  static const int nScX = 20;
90 
93  static const int nScY = 20;
94 
95  /* Edge size of a barrel TT in num. of crystals
96  */
97  static const int ttEdge = 5;
98 
101  static const int nTtSmPhi = 4;
102 
105  static const int nTtSmEta = 17;
106 
109  static const int nTtPhi = nEbPhi / ttEdge; // 72
110 
113  static const int nEbTtEta = nEbEta / ttEdge; // 34
114 
117  static const int nEeTtEta = 11;
118 
121  static const int nTtEta = nEbTtEta + 2 * nEeTtEta; // 56
122 
125  static const int nDccInPhi = 18;
126 
129  static const int nDccEndcap = 9;
130 
133  static const int ebTccPhiEdge = 20;
134 
137  static const int nTccInPhi = 18;
138 
141  static const int nTccEndcap = 36;
142 
145  static const int ebDccPhiEdge = 20;
146 
149  static const int nTtPhisPerEbDcc = 4;
150 
153  static const int nTtPhisPerEbTcc = 4;
154 
157  static const int nTtTypes = 2;
158 
163  static const int ttType[nEbTtEta];
164 
171  static const int stripCh2Phi[nTtTypes][ttEdge][ttEdge];
172 
178  static const int strip2Eta[nTtTypes][ttEdge];
179 
188 
189 private:
190  /*
191  const EBDigiCollection*
192  getEBDigis(const edm::Event& event) const;
193 
194  const EEDigiCollection*
195  getEEDigis(const edm::Event& event) const;
196 
197  const EcalTrigPrimDigiCollection*
198  getTrigPrims(const edm::Event& event) const;
199  */
200 
205 
211  int iEta2cIndex(int iEta) const { return (iEta < 0) ? iEta + 85 : iEta + 84; }
212 
218  int iPhi2cIndex(int iPhi) const {
219  int iPhi0 = iPhi - 11;
220  if (iPhi0 < 0)
221  iPhi0 += nEbPhi;
222  return iPhi0;
223  }
224 
231  int iTtEta2cIndex(int iTtEta) const { return (iTtEta < 0) ? (iTtEta + 28) : (iTtEta + 27); }
232 
237  int cIndex2iTtEta(int iTtEta0) const { return (iTtEta0 < 28) ? (iTtEta0 - 28) : (iTtEta0 - 27); }
238 
243  int cIndex2TtPhi(int iTtPhi0) const { return iTtPhi0 + 1; }
244 
250  int iTtPhi2cIndex(int iTtPhi) const { return iTtPhi - 1; }
251 
252  /*
253  int iXY2cIndex(int iX) const{
254  return iX-1;
255  }
256  */
257 
267  void elec2GeomNum(int ittEta0, int ittPhi0, int strip1, int ch1, int &iEta0, int &iPhi0) const;
268 
269  /* Set horizontal parity of a 16-bit word of FE data
270  * @param a the word whose parity must be set.
271  */
272  void setHParity(uint16_t &a) const;
273 
280  void genFeData(std::string &basename, int iEvent, const std::vector<uint16_t> adcCount[nEbEta][nEbPhi]) const;
281 
288  void genTccIn(std::string &basename, int iEvent, const int tps[nTtEta][nTtPhi]) const;
289 
296  void genTccOut(std::string &basename, int iEvent, const int tps[nTtEta][nTtPhi]) const;
297 
302  void getEbDigi(const edm::Event &event, std::vector<uint16_t> adc[nEbEta][nEbPhi]) const;
303 
312  void getTp(const edm::Event &event, tokenType type, int tp[nTtEta][nTtPhi]) const;
313 
317  std::string getExt() const;
318 
328  void fwrite(std::ofstream &f, uint16_t data, int &iword, bool hpar = true) const;
329 
335  void getSrfs(const edm::Event &event, int ebSrf[nTtEta][nTtPhi], int eeSrf[nEndcaps][nScX][nScY]) const;
336 
343  void genSrData(std::string &basename, int iEvent, int ttf[nEbTtEta][nTtPhi]) const;
344 
345 private:
349 
353 
357 
361 
365 
369 
373 
377 
381 
385 
389 
393 
397 
400  bool srp2dcc_;
401 
404  bool tcc2dcc_;
405 
408  bool fe2dcc_;
409 
412  bool fe2tcc_;
413 
417 
420  std::unique_ptr<EcalSelectiveReadout> esr_;
421 
424  std::ofstream ttfFile;
425 
428  std::ofstream srfFile;
429 
432  int tccNum_;
433 
436  int dccNum_;
437 
441 
445 
450 };
std::string srDigiProducer_
void analyze(const edm::Event &, const edm::EventSetup &) override
static const int nDccInPhi
writeMode_t writeMode_
static const int nTtPhi
static const int nTccInPhi
static const int nEeTtEta
void genFeData(std::string &basename, int iEvent, const std::vector< uint16_t > adcCount[nEbEta][nEbPhi]) const
static const int nTtSmPhi
static const int nEbEta
static const int nScX
void checkGeometry(const edm::EventSetup &eventSetup)
edm::EDGetTokenT< EBSrFlagCollection > ebSrFlagToken_
static const int scEdge
void elec2GeomNum(int ittEta0, int ittPhi0, int strip1, int ch1, int &iEta0, int &iPhi0) const
void checkTriggerMap(const edm::EventSetup &eventSetup)
static const int nEbPhi
static const int nDccEndcap
edm::EDGetTokenT< EcalTrigPrimDigiCollection > trigPrimDigisToken_[2]
void fwrite(std::ofstream &f, uint16_t data, int &iword, bool hpar=true) const
void setHParity(uint16_t &a) const
std::string digiProducer_
std::string eeSrFlagCollection_
std::string getExt() const
static const int nEndcaps
edm::EDGetTokenT< EESrFlagCollection > eeSrFlagToken_
edm::EDGetTokenT< EBDigiCollection > ebDigisToken_
static const int strip2Eta[nTtTypes][ttEdge]
std::string ebDigiCollection_
void getSrfs(const edm::Event &event, int ebSrf[nTtEta][nTtPhi], int eeSrf[nEndcaps][nScX][nScY]) const
static const int nTtPhisPerEbDcc
static const int nTccEndcap
void genSrData(std::string &basename, int iEvent, int ttf[nEbTtEta][nTtPhi]) const
static const int nEeY
int iEta2cIndex(int iEta) const
std::string ebSrFlagCollection_
static const int nEbTtEta
static const int nScY
double f[11][100]
EcalSimRawData(const edm::ParameterSet &pset)
std::string tcpDigiCollection_
static const int ebTccPhiEdge
std::string basename_
static const int ebDccPhiEdge
~EcalSimRawData() override=default
static const int nTtPhisPerEbTcc
const EcalTrigTowerConstituentsMap * theTriggerTowerMap
int cIndex2TtPhi(int iTtPhi0) const
int iTtPhi2cIndex(int iTtPhi) const
static const int nEeX
std::ofstream ttfFile
std::string eeDigiCollection_
std::string tpDigiCollection_
int iTtEta2cIndex(int iTtEta) const
int cIndex2iTtEta(int iTtEta0) const
void getTp(const edm::Event &event, tokenType type, int tp[nTtEta][nTtPhi]) const
static const int nTtEta
void genTccOut(std::string &basename, int iEvent, const int tps[nTtEta][nTtPhi]) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
double a
Definition: hdecay.h:119
std::string tpProducer_
std::unique_ptr< EcalSelectiveReadout > esr_
int iPhi2cIndex(int iPhi) const
std::ofstream srfFile
static const int stripCh2Phi[nTtTypes][ttEdge][ttEdge]
const CaloGeometry * theGeometry
void getEbDigi(const edm::Event &event, std::vector< uint16_t > adc[nEbEta][nEbPhi]) const
static const int ttEdge
static const int nTtSmEta
Definition: event.py:1
uint16_t *__restrict__ uint16_t const *__restrict__ adc
static const int ttType[nEbTtEta]
void genTccIn(std::string &basename, int iEvent, const int tps[nTtEta][nTtPhi]) const
static const int nTtTypes