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