CMS 3D CMS Logo

EcalSimRawData.h
Go to the documentation of this file.
1 /*
2  */
3 
12 #include <string>
13 #include <fstream>
14 
42  public:
46  explicit EcalSimRawData(const edm::ParameterSet& pset);
47 
50  ~EcalSimRawData() override{};
51 
55  void analyze(const edm::Event&, const edm::EventSetup&) override;
56 
57 private:
58 
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
202  checkGeometry(const edm::EventSetup& eventSetup);
203  void
204  checkTriggerMap(const edm::EventSetup& eventSetup);
205 
211  int iEta2cIndex(int iEta) const{
212  return (iEta<0)?iEta+85:iEta+84;
213  }
214 
220  int iPhi2cIndex(int iPhi) const{
221  int iPhi0 = iPhi -11;
222  if(iPhi0<0) iPhi0+=nEbPhi;
223  return iPhi0;
224  }
225 
232  int iTtEta2cIndex(int iTtEta) const{
233  return (iTtEta<0)?(iTtEta+28):(iTtEta+27);
234  }
235 
240  int cIndex2iTtEta(int iTtEta0) const{
241  return (iTtEta0<28)?(iTtEta0-28):(iTtEta0-27);
242  }
243 
248  int cIndex2TtPhi(int iTtPhi0) const{
249  return iTtPhi0+1;
250  }
251 
257  int iTtPhi2cIndex(int iTtPhi) const{
258  return iTtPhi-1;
259  }
260 
261  /*
262  int iXY2cIndex(int iX) const{
263  return iX-1;
264  }
265  */
266 
276  void elec2GeomNum(int ittEta0, int ittPhi0, int strip1,
277  int ch1, int& iEta0, int& iPhi0) const;
278 
279  /* Set horizontal parity of a 16-bit word of FE data
280  * @param a the word whose parity must be set.
281  */
282  void setHParity(uint16_t& a) const;
283 
290  void genFeData(std::string basename, int iEvent,
291  const std::vector<uint16_t> adcCount[nEbEta][nEbPhi]) const;
292 
293 
300  void genTccIn(std::string basename, int iEvent,
301  const int tps[nTtEta][nTtPhi]) const;
302 
309  void genTccOut(std::string basename, int iEvent,
310  const int tps[nTtEta][nTtPhi]) const;
311 
312 
313 
318  void getEbDigi(const edm::Event& event,
319  std::vector<uint16_t> adc[nEbEta][nEbPhi]) const;
320 
321 
330  void getTp(const edm::Event& event, const std::string& collName,
331  int tp[nTtEta][nTtPhi]) const;
332 
333 
337  std::string getExt() const;
338 
348  void fwrite(std::ofstream& f, uint16_t data, int& iword,
349  bool hpar = true) const;
350 
351 
357  void getSrfs(const edm::Event& event, int ebSrf[nTtEta][nTtPhi],
358  int eeSrf[nEndcaps][nScX][nScY]) const;
359 
366  void genSrData(std::string basename, int iEvent,
367  int ttf[nEbTtEta][nTtPhi]) const;
368 
369 private:
373 
377 
381 
382 
386 
390 
394 
398 
402 
406 
410 
414 
418 
422 
425  bool srp2dcc_;
426 
429  bool tcc2dcc_;
430 
433  bool fe2dcc_;
434 
437  bool fe2tcc_;
438 
442 
445  std::auto_ptr<EcalSelectiveReadout> esr_;
446 
449  std::ofstream ttfFile;
450 
453  std::ofstream srfFile;
454 
457  int tccNum_;
458 
461  int dccNum_;
462 
466 
470 };
471 
int adc(sample_type sample)
get the ADC sample (12 bits)
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]
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::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
std::auto_ptr< EcalSelectiveReadout > esr_
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