CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <inttypes.h>
15 //#include "pgras/PGUtilities/interface/PGHisto.h"
16 
20 
32 class EcalDumpRaw : public edm::EDAnalyzer {
33  //ctors
34 public:
35  explicit EcalDumpRaw(const edm::ParameterSet&);
36  ~EcalDumpRaw();
37 
38 
39  virtual void analyze(const edm::Event&, const edm::EventSetup&);
40 
41  void analyzeEB(const edm::Event&, const edm::EventSetup&) const;
42  void analyzeEE(const edm::Event&, const edm::EventSetup&) const;
43  void endJob();
44  //methods
45 public:
46 private:
47  void analyzeFed(int fedId);
48  void analyzeApd();
49  std::string toNth(int n);
50  bool decode(const uint32_t* data, int iWord32, std::ostream& out);
51  double max(const std::vector<double>& a, unsigned& pos){
52  pos = 0;
53  double m = a[pos];
54  for(unsigned i = 1; i < a.size(); ++i){
55  if(a[i]>m){ m = a[i]; pos = i;}
56  }
57  return m;
58  }
59  double min(const std::vector<double>& a){
60  double m = a[0];
61  for(unsigned i = 1; i < a.size(); ++i){
62  if(a[i]<m) m = a[i];
63  }
64  return m;
65  }
66  //static int lme(int dccId1, int side);
67 
68  template<class T>
70  std::stringstream s;
71  s << val;
72  return s.str();
73  }
74 
75  static int sideOfRu(int ru1);
76 
77  static int modOfRu(int ru1);
78 
79  static int lmodOfRu(int ru1);
80 
81  std::string srRange(int offset) const;
82 
83  std::string ttfTag(int tccType, unsigned iSeq) const;
84 
85  std::string tpgTag(int tccType, unsigned iSeq) const;
86 
87  //fields
88 private:
90  bool writeDcc_;
96  int iEvent_;
97 
98  unsigned iTowerWord64_;
99  unsigned iSrWord64_;
100  unsigned iTccWord64_;
102  decodeState_;
104 
105  std::vector<double> adc_;
106 
107  static const int nSamples = 10;
108  double amplCut_;
109  bool dump_;
110  bool dumpAdc_;
112  // bool doHisto_;
113  int maxEvt_;
116  int l1aMinX_;
117  int l1aMaxX_;
118  int dccCh_;
119  std::vector<uint32_t> lastOrbit_;
120  static const unsigned nDccs_ = 54;
121  static const unsigned fedStart_ = 601;
122  static const int maxTpgsPerTcc_ = 68;
123  static const int maxTccsPerDcc_ = 4;
124 
125 
127 
129  static const int ebmTcc_ = 0;
130  static const int ebpTcc_ = 1;
131  static const int eeInnerTcc_ = 2;
132  static const int eeOuterTcc_ = 3;
133  static const int nTccTypes_ = 4;
135 
138  static const int ttId_[nTccTypes_][maxTpgsPerTcc_];
139 
140  unsigned fedId_;
141  unsigned dccId_;
142  unsigned side_;
143  unsigned eventId_;
144  std::vector<unsigned> eventList_;
145  unsigned minEventId_;
146  unsigned maxEventId_;
147  unsigned orbit0_;
148  uint32_t orbit_;
150  int bx_;
151  int l1a_;
152  int l1amin_;
153  int l1amax_;
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_;
187 };
188 
189 #endif //ECALDUMPRAW_H not defined
virtual void analyze(const edm::Event &, const edm::EventSetup &)
Definition: EcalDumpRaw.cc:210
int tccBlockLen64_
Definition: EcalDumpRaw.h:168
static int sideOfRu(int ru1)
Definition: EcalDumpRaw.cc:884
int i
Definition: DBlmapReader.cc:9
std::string toNth(int n)
Definition: EcalDumpRaw.cc:457
std::string tpgTag(int tccType, unsigned iSeq) const
Definition: EcalDumpRaw.cc:949
int end_fed_id_
Definition: EcalDumpRaw.h:92
bool pulsePerLme_
Definition: EcalDumpRaw.h:181
unsigned iTowerWord64_
Definition: EcalDumpRaw.h:98
static const int nRu_
Definition: EcalDumpRaw.h:169
static const unsigned fedStart_
Definition: EcalDumpRaw.h:121
bool orbit0Set_
Definition: EcalDumpRaw.h:149
size_t towerBlockLength_
Definition: EcalDumpRaw.h:103
static const int nTccTypes_
Definition: EcalDumpRaw.h:133
std::string ttfTag(int tccType, unsigned iSeq) const
Definition: EcalDumpRaw.cc:932
int detailedTrigType_
Definition: EcalDumpRaw.h:155
double min(const std::vector< double > &a)
Definition: EcalDumpRaw.h:59
std::vector< double > adc_
Definition: EcalDumpRaw.h:105
void analyzeApd()
bool l1aHistory_
Definition: EcalDumpRaw.h:111
int first_event_
Definition: EcalDumpRaw.h:93
double amplCut_
Definition: EcalDumpRaw.h:108
static int modOfRu(int ru1)
Definition: EcalDumpRaw.cc:893
unsigned minEventId_
Definition: EcalDumpRaw.h:145
bool writeDcc_
Definition: EcalDumpRaw.h:90
std::vector< uint32_t > lastOrbit_
Definition: EcalDumpRaw.h:119
bool pulsePerLmod_
Definition: EcalDumpRaw.h:180
bool decode(const uint32_t *data, int iWord32, std::ostream &out)
Definition: EcalDumpRaw.cc:481
std::vector< unsigned > eventList_
Definition: EcalDumpRaw.h:144
static int lmodOfRu(int ru1)
Definition: EcalDumpRaw.cc:902
unsigned side_
Definition: EcalDumpRaw.h:142
std::vector< int > feL1a_
Definition: EcalDumpRaw.h:170
std::vector< std::vector< uint32_t > > orbits_
Definition: EcalDumpRaw.h:158
static const int eeOuterTcc_
Definition: EcalDumpRaw.h:132
uint32_t orbit_
Definition: EcalDumpRaw.h:148
std::vector< int > feBx_
Definition: EcalDumpRaw.h:175
static const int ttId_[nTccTypes_][maxTpgsPerTcc_]
Definition: EcalDumpRaw.h:138
void endJob()
Definition: EcalDumpRaw.cc:202
static const int ebmTcc_
Definition: EcalDumpRaw.h:129
unsigned maxEventId_
Definition: EcalDumpRaw.h:146
int profileRuId_
Definition: EcalDumpRaw.h:115
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:100
std::string filename_
Definition: EcalDumpRaw.h:95
std::vector< int > nTpgs_
Definition: EcalDumpRaw.h:160
EcalDumpRaw(const edm::ParameterSet &)
Definition: EcalDumpRaw.cc:128
static const int nSamples
Definition: EcalDumpRaw.h:107
std::string toString(T val)
Definition: EcalDumpRaw.h:69
void analyzeEE(const edm::Event &, const edm::EventSetup &) const
unsigned iSrWord64_
Definition: EcalDumpRaw.h:99
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:140
std::string srRange(int offset) const
Definition: EcalDumpRaw.cc:915
enum EcalDumpRaw::@319 decodeState_
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:131
std::vector< int > feRuId_
Definition: EcalDumpRaw.h:176
int profileFedId_
Definition: EcalDumpRaw.h:114
std::vector< std::vector< uint32_t > > l1as_
Definition: EcalDumpRaw.h:157
static const int maxTpgsPerTcc_
Definition: EcalDumpRaw.h:122
edm::InputTag l1AcceptBunchCrossingCollectionTag_
Definition: EcalDumpRaw.h:186
double a
Definition: hdecay.h:121
unsigned eventId_
Definition: EcalDumpRaw.h:143
unsigned orbit0_
Definition: EcalDumpRaw.h:147
int beg_fed_id_
Definition: EcalDumpRaw.h:91
static const unsigned nDccs_
Definition: EcalDumpRaw.h:120
long double T
static const int maxTccsPerDcc_
Definition: EcalDumpRaw.h:123
int verbosity_
Definition: EcalDumpRaw.h:89
double max(const std::vector< double > &a, unsigned &pos)
Definition: EcalDumpRaw.h:51
unsigned dccId_
Definition: EcalDumpRaw.h:141
int last_event_
Definition: EcalDumpRaw.h:94
static const int ebpTcc_
Definition: EcalDumpRaw.h:130