CMS 3D CMS Logo

EcalDumpRaw.h
Go to the documentation of this file.
1 /*
2  *
3  * Author: Ph Gras. CEA/IRFU - Saclay
4  */
5 
6 #ifndef ECALDUMPRAW_H
7 #define ECALDUMPRAW_H
8 
9 #include <vector>
10 #include <iostream>
11 #include <fstream>
12 #include <sstream>
13 #include <string>
14 #include <cinttypes>
15 //#include "pgras/PGUtilities/interface/PGHisto.h"
16 
22 
35  //ctors
36 public:
37  explicit EcalDumpRaw(const edm::ParameterSet&);
38  ~EcalDumpRaw() override;
39 
40 
41  void analyze(const edm::Event&, const edm::EventSetup&) override;
42 
43  void analyzeEB(const edm::Event&, const edm::EventSetup&) const;
44  void analyzeEE(const edm::Event&, const edm::EventSetup&) const;
45  void endJob();
46  //methods
47 public:
48 private:
49  void analyzeFed(int fedId);
50  void analyzeApd();
51  std::string toNth(int n);
52  bool decode(const uint32_t* data, int iWord32, std::ostream& out);
53  double max(const std::vector<double>& a, unsigned& pos){
54  pos = 0;
55  double m = a[pos];
56  for(unsigned i = 1; i < a.size(); ++i){
57  if(a[i]>m){ m = a[i]; pos = i;}
58  }
59  return m;
60  }
61  double min(const std::vector<double>& a){
62  double m = a[0];
63  for(unsigned i = 1; i < a.size(); ++i){
64  if(a[i]<m) m = a[i];
65  }
66  return m;
67  }
68  //static int lme(int dccId1, int side);
69 
70  template<class T>
72  std::stringstream s;
73  s << val;
74  return s.str();
75  }
76 
77  static int sideOfRu(int ru1);
78 
79  static int modOfRu(int ru1);
80 
81  static int lmodOfRu(int ru1);
82 
83  std::string srRange(int offset) const;
84 
85  std::string ttfTag(int tccType, unsigned iSeq) const;
86 
87  std::string tpgTag(int tccType, unsigned iSeq) const;
88 
89  //fields
90 private:
92  bool writeDcc_;
98  int iEvent_;
99 
100  unsigned iTowerWord64_;
101  unsigned iSrWord64_;
102  unsigned iTccWord64_;
104  decodeState_;
106 
107  std::vector<double> adc_;
108 
109  static const int nSamples = 10;
110  double amplCut_;
111  bool dump_;
112  bool dumpAdc_;
114  // bool doHisto_;
115  int maxEvt_;
118  int l1aMinX_;
119  int l1aMaxX_;
120  int dccCh_;
121  std::vector<uint32_t> lastOrbit_;
122  static const unsigned nDccs_ = 54;
123  static const unsigned fedStart_ = 601;
124  static const int maxTpgsPerTcc_ = 68;
125  static const int maxTccsPerDcc_ = 4;
126 
127 
129 
131  static const int ebmTcc_ = 0;
132  static const int ebpTcc_ = 1;
133  static const int eeInnerTcc_ = 2;
134  static const int eeOuterTcc_ = 3;
135  static const int nTccTypes_ = 4;
137 
140  static const int ttId_[nTccTypes_][maxTpgsPerTcc_];
141 
142  unsigned fedId_;
143  unsigned dccId_;
144  unsigned side_;
145  unsigned eventId_;
146  std::vector<unsigned> eventList_;
147  unsigned minEventId_;
148  unsigned maxEventId_;
149  unsigned orbit0_;
150  uint32_t orbit_;
152  int bx_;
153  int l1a_;
156  // PGHisto histo_;
157  std::vector<std::vector<uint32_t> > l1as_;
158  std::vector<std::vector<uint32_t> > orbits_;
159  std::vector<std::vector<int> > tpg_;
160  std::vector<int> nTpgs_;
161  std::vector<int> dccChStatus_;
162  int iRu_;
163  int srpL1a_;
164  int tccL1a_;
165  //Number of TPGs in TCC block currently parsed:
166  int nTts_;
167  //Length of TCC block currently parsed:
169  static const int nRu_ = 70;
170  std::vector<int> feL1a_;
171  int srpBx_;
172  int tccBx_;
174  int tccType_;
175  std::vector<int> feBx_;
176  std::vector<int> feRuId_;
177  int iTow_;
178  std::ofstream dumpFile_;
182  int tccId_;
183  //tcc sequence number of currenlty parsed tower block of one DCC
184  int iTcc_;
189 };
190 
191 #endif //ECALDUMPRAW_H not defined
int tccBlockLen64_
Definition: EcalDumpRaw.h:168
static int sideOfRu(int ru1)
Definition: EcalDumpRaw.cc:882
std::string toNth(int n)
Definition: EcalDumpRaw.cc:455
std::string tpgTag(int tccType, unsigned iSeq) const
Definition: EcalDumpRaw.cc:947
edm::EDGetTokenT< FEDRawDataCollection > fedRawDataCollectionToken_
Definition: EcalDumpRaw.h:187
int end_fed_id_
Definition: EcalDumpRaw.h:94
bool pulsePerLme_
Definition: EcalDumpRaw.h:181
unsigned iTowerWord64_
Definition: EcalDumpRaw.h:100
static const int nRu_
Definition: EcalDumpRaw.h:169
static const unsigned fedStart_
Definition: EcalDumpRaw.h:123
bool orbit0Set_
Definition: EcalDumpRaw.h:151
size_t towerBlockLength_
Definition: EcalDumpRaw.h:105
static const int nTccTypes_
Definition: EcalDumpRaw.h:135
std::string ttfTag(int tccType, unsigned iSeq) const
Definition: EcalDumpRaw.cc:930
int detailedTrigType_
Definition: EcalDumpRaw.h:155
double min(const std::vector< double > &a)
Definition: EcalDumpRaw.h:61
std::vector< double > adc_
Definition: EcalDumpRaw.h:107
void analyzeApd()
bool l1aHistory_
Definition: EcalDumpRaw.h:113
int first_event_
Definition: EcalDumpRaw.h:95
double amplCut_
Definition: EcalDumpRaw.h:110
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: EcalDumpRaw.cc:212
static int modOfRu(int ru1)
Definition: EcalDumpRaw.cc:891
unsigned minEventId_
Definition: EcalDumpRaw.h:147
bool writeDcc_
Definition: EcalDumpRaw.h:92
std::vector< uint32_t > lastOrbit_
Definition: EcalDumpRaw.h:121
bool pulsePerLmod_
Definition: EcalDumpRaw.h:180
bool decode(const uint32_t *data, int iWord32, std::ostream &out)
Definition: EcalDumpRaw.cc:479
std::vector< unsigned > eventList_
Definition: EcalDumpRaw.h:146
static int lmodOfRu(int ru1)
Definition: EcalDumpRaw.cc:900
unsigned side_
Definition: EcalDumpRaw.h:144
std::vector< int > feL1a_
Definition: EcalDumpRaw.h:170
~EcalDumpRaw() override
Definition: EcalDumpRaw.cc:207
std::vector< std::vector< uint32_t > > orbits_
Definition: EcalDumpRaw.h:158
static const int eeOuterTcc_
Definition: EcalDumpRaw.h:134
uint32_t orbit_
Definition: EcalDumpRaw.h:150
std::vector< int > feBx_
Definition: EcalDumpRaw.h:175
static const int ttId_[nTccTypes_][maxTpgsPerTcc_]
Definition: EcalDumpRaw.h:140
void endJob()
Definition: EcalDumpRaw.cc:204
static const int ebmTcc_
Definition: EcalDumpRaw.h:131
unsigned maxEventId_
Definition: EcalDumpRaw.h:148
int profileRuId_
Definition: EcalDumpRaw.h:117
std::ofstream dumpFile_
Definition: EcalDumpRaw.h:178
edm::InputTag fedRawDataCollectionTag_
Definition: EcalDumpRaw.h:185
void analyzeEB(const edm::Event &, const edm::EventSetup &) const
unsigned iTccWord64_
Definition: EcalDumpRaw.h:102
std::string filename_
Definition: EcalDumpRaw.h:97
std::vector< int > nTpgs_
Definition: EcalDumpRaw.h:160
EcalDumpRaw(const edm::ParameterSet &)
Definition: EcalDumpRaw.cc:128
static const int nSamples
Definition: EcalDumpRaw.h:109
std::string toString(T val)
Definition: EcalDumpRaw.h:71
void analyzeEE(const edm::Event &, const edm::EventSetup &) const
unsigned iSrWord64_
Definition: EcalDumpRaw.h:101
void analyzeFed(int fedId)
std::vector< std::vector< int > > tpg_
Definition: EcalDumpRaw.h:159
bool pulsePerRu_
Definition: EcalDumpRaw.h:179
unsigned fedId_
Definition: EcalDumpRaw.h:142
std::string srRange(int offset) const
Definition: EcalDumpRaw.cc:913
edm::EDGetTokenT< L1AcceptBunchCrossingCollection > l1AcceptBunchCrossingCollectionToken_
Definition: EcalDumpRaw.h:188
int tccType_
type of TCC currently parsed
Definition: EcalDumpRaw.h:174
int simpleTrigType_
Definition: EcalDumpRaw.h:154
std::vector< int > dccChStatus_
Definition: EcalDumpRaw.h:161
static const int eeInnerTcc_
Definition: EcalDumpRaw.h:133
std::vector< int > feRuId_
Definition: EcalDumpRaw.h:176
int profileFedId_
Definition: EcalDumpRaw.h:116
std::vector< std::vector< uint32_t > > l1as_
Definition: EcalDumpRaw.h:157
static const int maxTpgsPerTcc_
Definition: EcalDumpRaw.h:124
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
enum EcalDumpRaw::@389 decodeState_
edm::InputTag l1AcceptBunchCrossingCollectionTag_
Definition: EcalDumpRaw.h:186
double a
Definition: hdecay.h:121
unsigned eventId_
Definition: EcalDumpRaw.h:145
unsigned orbit0_
Definition: EcalDumpRaw.h:149
int beg_fed_id_
Definition: EcalDumpRaw.h:93
static const unsigned nDccs_
Definition: EcalDumpRaw.h:122
long double T
static const int maxTccsPerDcc_
Definition: EcalDumpRaw.h:125
int verbosity_
Definition: EcalDumpRaw.h:91
double max(const std::vector< double > &a, unsigned &pos)
Definition: EcalDumpRaw.h:53
unsigned dccId_
Definition: EcalDumpRaw.h:143
int last_event_
Definition: EcalDumpRaw.h:96
static const int ebpTcc_
Definition: EcalDumpRaw.h:132