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{};
52 
56  void analyze(const edm::Event &, const edm::EventSetup &) override;
57 
58 private:
59  int iEvent;
60 
63  static const int nEbEta = 170;
64 
67  static const int nEbPhi = 360;
68 
71  static const int nEeX = 100;
72 
75  static const int nEeY = 100;
76 
79  static const int nEndcaps = 2;
80 
83  static const int scEdge = 5;
84 
87  static const int nScX = 20;
88 
91  static const int nScY = 20;
92 
93  /* Edge size of a barrel TT in num. of crystals
94  */
95  static const int ttEdge = 5;
96 
99  static const int nTtSmPhi = 4;
100 
103  static const int nTtSmEta = 17;
104 
107  static const int nTtPhi = nEbPhi / ttEdge; // 72
108 
111  static const int nEbTtEta = nEbEta / ttEdge; // 34
112 
115  static const int nEeTtEta = 11;
116 
119  static const int nTtEta = nEbTtEta + 2 * nEeTtEta; // 56
120 
123  static const int nDccInPhi = 18;
124 
127  static const int nDccEndcap = 9;
128 
131  static const int ebTccPhiEdge = 20;
132 
135  static const int nTccInPhi = 18;
136 
139  static const int nTccEndcap = 36;
140 
143  static const int ebDccPhiEdge = 20;
144 
147  static const int nTtPhisPerEbDcc = 4;
148 
151  static const int nTtPhisPerEbTcc = 4;
152 
155  static const int nTtTypes = 2;
156 
161  static const int ttType[nEbTtEta];
162 
169  static const int stripCh2Phi[nTtTypes][ttEdge][ttEdge];
170 
176  static const int strip2Eta[nTtTypes][ttEdge];
177 
186 
187 private:
188  /*
189  const EBDigiCollection*
190  getEBDigis(const edm::Event& event) const;
191 
192  const EEDigiCollection*
193  getEEDigis(const edm::Event& event) const;
194 
195  const EcalTrigPrimDigiCollection*
196  getTrigPrims(const edm::Event& event) const;
197  */
198 
201  void checkGeometry(const edm::EventSetup &eventSetup);
202  void checkTriggerMap(const edm::EventSetup &eventSetup);
203 
209  int iEta2cIndex(int iEta) const { return (iEta < 0) ? iEta + 85 : iEta + 84; }
210 
216  int iPhi2cIndex(int iPhi) const {
217  int iPhi0 = iPhi - 11;
218  if (iPhi0 < 0)
219  iPhi0 += nEbPhi;
220  return iPhi0;
221  }
222 
229  int iTtEta2cIndex(int iTtEta) const { return (iTtEta < 0) ? (iTtEta + 28) : (iTtEta + 27); }
230 
235  int cIndex2iTtEta(int iTtEta0) const { return (iTtEta0 < 28) ? (iTtEta0 - 28) : (iTtEta0 - 27); }
236 
241  int cIndex2TtPhi(int iTtPhi0) const { return iTtPhi0 + 1; }
242 
248  int iTtPhi2cIndex(int iTtPhi) const { return iTtPhi - 1; }
249 
250  /*
251  int iXY2cIndex(int iX) const{
252  return iX-1;
253  }
254  */
255 
265  void elec2GeomNum(int ittEta0, int ittPhi0, int strip1, int ch1, int &iEta0, int &iPhi0) const;
266 
267  /* Set horizontal parity of a 16-bit word of FE data
268  * @param a the word whose parity must be set.
269  */
270  void setHParity(uint16_t &a) const;
271 
278  void genFeData(std::string basename, int iEvent, const std::vector<uint16_t> adcCount[nEbEta][nEbPhi]) const;
279 
286  void genTccIn(std::string basename, int iEvent, const int tps[nTtEta][nTtPhi]) const;
287 
294  void genTccOut(std::string basename, int iEvent, const int tps[nTtEta][nTtPhi]) const;
295 
300  void getEbDigi(const edm::Event &event, std::vector<uint16_t> adc[nEbEta][nEbPhi]) const;
301 
310  void getTp(const edm::Event &event, const std::string &collName, int tp[nTtEta][nTtPhi]) const;
311 
315  std::string getExt() const;
316 
326  void fwrite(std::ofstream &f, uint16_t data, int &iword, bool hpar = true) const;
327 
333  void getSrfs(const edm::Event &event, int ebSrf[nTtEta][nTtPhi], int eeSrf[nEndcaps][nScX][nScY]) const;
334 
341  void genSrData(std::string basename, int iEvent, int ttf[nEbTtEta][nTtPhi]) const;
342 
343 private:
347 
351 
355 
359 
363 
367 
371 
375 
379 
383 
387 
391 
395 
398  bool srp2dcc_;
399 
402  bool tcc2dcc_;
403 
406  bool fe2dcc_;
407 
410  bool fe2tcc_;
411 
415 
418  std::unique_ptr<EcalSelectiveReadout> esr_;
419 
422  std::ofstream ttfFile;
423 
426  std::ofstream srfFile;
427 
430  int tccNum_;
431 
434  int dccNum_;
435 
439 
443 };
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
static const int nTtSmPhi
int iPhi2cIndex(int iPhi) const
static const int nEbEta
static const int nScX
void checkGeometry(const edm::EventSetup &eventSetup)
static const int scEdge
void checkTriggerMap(const edm::EventSetup &eventSetup)
static const int nEbPhi
static const int nDccEndcap
std::string digiProducer_
void getTp(const edm::Event &event, const std::string &collName, int tp[nTtEta][nTtPhi]) const
std::string eeSrFlagCollection_
std::string getExt() const
int cIndex2iTtEta(int iTtEta0) const
static const int nEndcaps
void setHParity(uint16_t &a) const
int iEta2cIndex(int iEta) const
static const int strip2Eta[nTtTypes][ttEdge]
std::string ebDigiCollection_
void genFeData(std::string basename, int iEvent, const std::vector< uint16_t > adcCount[nEbEta][nEbPhi]) const
static const int nTtPhisPerEbDcc
static const int nTccEndcap
void getSrfs(const edm::Event &event, int ebSrf[nTtEta][nTtPhi], int eeSrf[nEndcaps][nScX][nScY]) const
static const int nEeY
std::string ebSrFlagCollection_
static const int nEbTtEta
static const int nScY
~EcalSimRawData() override
double f[11][100]
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
EcalSimRawData(const edm::ParameterSet &pset)
std::string tcpDigiCollection_
static const int ebTccPhiEdge
std::string basename_
static const int ebDccPhiEdge
void fwrite(std::ofstream &f, uint16_t data, int &iword, bool hpar=true) const
static const int nTtPhisPerEbTcc
void genTccOut(std::string basename, int iEvent, const int tps[nTtEta][nTtPhi]) const
const EcalTrigTowerConstituentsMap * theTriggerTowerMap
static const int nEeX
void genSrData(std::string basename, int iEvent, int ttf[nEbTtEta][nTtPhi]) const
std::ofstream ttfFile
std::string eeDigiCollection_
void getEbDigi(const edm::Event &event, std::vector< uint16_t > adc[nEbEta][nEbPhi]) const
std::string tpDigiCollection_
void genTccIn(std::string basename, int iEvent, const int tps[nTtEta][nTtPhi]) const
int cIndex2TtPhi(int iTtPhi0) const
static const int nTtEta
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
double a
Definition: hdecay.h:121
std::string tpProducer_
std::unique_ptr< EcalSelectiveReadout > esr_
std::ofstream srfFile
static const int stripCh2Phi[nTtTypes][ttEdge][ttEdge]
const CaloGeometry * theGeometry
void elec2GeomNum(int ittEta0, int ittPhi0, int strip1, int ch1, int &iEta0, int &iPhi0) const
static const int ttEdge
int iTtPhi2cIndex(int iTtPhi) const
int iTtEta2cIndex(int iTtEta) const
static const int nTtSmEta
Definition: event.py:1
static const int ttType[nEbTtEta]
static const int nTtTypes