CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCDCCExaminer.h
Go to the documentation of this file.
1 #ifndef CSCDCCExaminer_h
2 #define CSCDCCExaminer_h
3 #include <set>
4 #include <map>
5 #include <vector>
6 #include <string>
7 #include <ostream>
8 
10 
12 public:
13  const uint16_t nERRORS, nWARNINGS, nPAYLOADS, nSTATUSES;
14 
15 private:
18  ExaminerStatusType bSUM_ERROR, bSUM_WARNING; // Summary flags for errors and warnings
19  bool fERROR [29];//[nERRORS];
20  bool fWARNING[5]; //[nWARNINGS];
21  bool fSUM_ERROR [29];//[nERRORS];
22  bool fSUM_WARNING[5]; //[nWARNINGS];
23 
24  std::set<CSCIdType> fCHAMB_ERR[29]; // Set of chambers which contain particular error
25  std::set<CSCIdType> fCHAMB_WRN[5]; // Set of chambers which contain particular warning
26  std::map<CSCIdType,ExaminerStatusType> bCHAMB_ERR; // chamber <=> errors in bits
27  std::map<CSCIdType,ExaminerStatusType> bCHAMB_WRN; // chamber <=> errors in bits
28  std::map<CSCIdType,ExaminerStatusType> bCHAMB_PAYLOAD; //
29  std::map<CSCIdType,ExaminerStatusType> bCHAMB_STATUS; //
30  std::map<DDUIdType,ExaminerStatusType> bDDU_ERR; // ddu <-> errors in bits
31  std::map<DDUIdType,ExaminerStatusType> bDDU_WRN; // ddu <-> errors in bits
32 
33 
34  CSCIdType currentChamber; // ( (CrateNumber<<4) + DMBslot ) specifies chamber
35 
36  const uint16_t *buf_2, *buf_1, *buf0, *buf1, *buf2;
37  uint16_t tmpbuf[16];
38 
49 
50  bool uniqueALCT, uniqueTMB; // Do not merge two DMBs if Trailer of the first and Header of the second are lost
51 
52  bool DAV_ALCT; // ...
53  bool DAV_TMB; // Check if DAV bits lie
54  int DAV_CFEB; // ...
55  int DAV_DMB; // ...
56  int DMB_Active, nDMBs; // ...
57 
58 public:
59  uint32_t cntDDU_Headers;
60  uint32_t cntDDU_Trailers;
61  std::map<CSCIdType,uint32_t> cntCHAMB_Headers;
62  std::map<CSCIdType,uint32_t> cntCHAMB_Trailers;
63 
64 private:
65  void clear();
66  void zeroCounts();
67  void sync_stats();
69  void checkDAVs();
71 
72  inline int scanbuf(const uint16_t* &buf, int32_t length, uint16_t sig, uint16_t mask=0xFFFF);
73 
75  uint32_t DDU_WordCount;
78 
81  uint32_t ALCT_WordCount;
83  uint32_t ALCT_ZSE;
84  uint32_t nWG_round_up;
85 
87  uint32_t TMB_WordCount;
89  uint32_t TMB_Tbins;
90  uint32_t TMB_WordsRPC;
92 
94  uint32_t CFEB_SampleCount;
96 
98  uint32_t ALCT_CRC;
100  uint32_t TMB_CRC;
102  uint32_t CFEB_CRC;
103 
107 
108  //int headerDAV_Active; // Obsolete since 16.09.05
109 
110  // data blocks:
111  std::map<DDUIdType,const uint16_t*> dduBuffers; // < DDUsourceID, pointer >
112  std::map<DDUIdType,std::map<CSCIdType,const uint16_t*> > dmbBuffers; // < DDUsourceID, < DMBid, pointer > >
113  std::map<DDUIdType,uint32_t> dduOffsets; // < DDUsourceID, pointer_offset >
114  std::map<DDUIdType,std::map<CSCIdType,uint32_t> > dmbOffsets; // < DDUsourceID, < DMBid, pointer_offset > >
115  std::map<DDUIdType,uint32_t> dduSize; // < DDUsourceID, block_size >
116  std::map<DDUIdType,std::map<CSCIdType,uint32_t> > dmbSize; // < DDUsourceID, < DMBid, block_size > >
117  const uint16_t *buffer_start;
118 
119 public:
120 
121  int32_t check(const uint16_t* &buffer, int32_t length);
122 
125 
126  ExaminerStatusType errors (void) const { return bSUM_ERROR; }
127  ExaminerStatusType warnings(void) const { return bSUM_WARNING; }
128 
129  const char* errName(int num) const { if(num>=0&&num<nERRORS) return sERROR[num]; else return ""; }
130  const char* wrnName(int num) const { if(num>=0&&num<nWARNINGS) return sWARNING[num]; else return ""; }
131 
132  const char* errorName (int num) const { if(num>=0&&num<nERRORS) return sERROR_[num]; else return ""; }
133  const char* warningName(int num) const { if(num>=0&&num<nWARNINGS) return sWARNING_[num]; else return ""; }
134 
135  const char* payloadName(int num) const { if(num>=0&&num<nPAYLOADS) return sDMBExpectedPayload[num]; else return ""; }
136  const char* statusName (int num) const { if(num>=0&&num<nSTATUSES) return sDMBEventStaus [num]; else return ""; }
137 
138  bool error (int num) const { if(num>=0&&num<nERRORS) return fSUM_ERROR [num]; else return 0; }
139  bool warning(int num) const { if(num>=0&&num<nWARNINGS) return fSUM_WARNING[num]; else return 0; }
140 
141  std::set<CSCIdType> chambersWithError (int num) const { if(num>=0&&num<nERRORS) return fCHAMB_ERR[num]; else return std::set<int>(); }
142  std::set<CSCIdType> chambersWithWarning(int num) const { if(num>=0&&num<nWARNINGS) return fCHAMB_WRN[num]; else return std::set<int>(); }
143 
145  std::map<CSCIdType,ExaminerStatusType>::const_iterator item = bCHAMB_PAYLOAD.find(chamber);
146  if( item != bCHAMB_PAYLOAD.end() ) return item->second; else return 0;
147  }
148 
150  std::map<CSCIdType,ExaminerStatusType>::const_iterator item = bCHAMB_STATUS.find(chamber);
151  if( item != bCHAMB_STATUS.end() ) return item->second; else return 0;
152  }
153 
155  std::map<CSCIdType,ExaminerStatusType>::const_iterator item = bCHAMB_ERR.find(chamber);
157 
158  // for(item =bCHAMB_ERR.begin() ; item !=bCHAMB_ERR.end() ; item++)
159  //std::cout << " Ex-errors: " << std::hex << (*item).second << std::dec << std::endl;
160 
161  item = bCHAMB_ERR.find(chamber);
162  if( item != bCHAMB_ERR.end() ) return item->second; else return 0;
163  }
164 
166  std::map<CSCIdType,ExaminerStatusType>::const_iterator item = bCHAMB_WRN.find(chamber);
167  if( item != bCHAMB_WRN.end() ) return item->second; else return 0;
168  }
169 
171  std::map<DDUIdType,ExaminerStatusType>::const_iterator item = bDDU_ERR.find(dduSourceID);
172  if( item != bDDU_ERR.end() ) return item->second; else return 0;
173  }
175  std::map<DDUIdType,ExaminerStatusType>::const_iterator item = bDDU_WRN.find(dduSourceID);
176  if( item != bDDU_WRN.end() ) return item->second; else return 0;
177  }
178  std::vector<DDUIdType> listOfDDUs(void) const {
179  std::vector<DDUIdType> DDUs;
180  std::map<DDUIdType,ExaminerStatusType>::const_iterator item = bDDU_ERR.begin();
181  while( item != bDDU_ERR.end() ){ DDUs.push_back(item->first); item++; }
182  return DDUs;
183  }
184 
185  std::map<DDUIdType,ExaminerStatusType> errorsDetailedDDU (void) const { return bDDU_ERR; }
186 
187  std::map<CSCIdType,ExaminerStatusType> errorsDetailed (void) const { return bCHAMB_ERR; }
188  std::map<CSCIdType,ExaminerStatusType> warningsDetailed(void) const { return bCHAMB_WRN; }
189  std::map<CSCIdType,ExaminerStatusType> payloadDetailed (void) const { return bCHAMB_PAYLOAD; }
190  std::map<CSCIdType,ExaminerStatusType> statusDetailed (void) const { return bCHAMB_STATUS; }
191 
192 
193 
194  void crcALCT(bool enable);
195  void crcTMB (bool enable);
196  void crcCFEB(bool enable);
197 
198  void modeDDU(bool enable);
199 
200  DDUIdType dduSourceID(void){ return sourceID; }
201 
202  std::map<DDUIdType,const uint16_t*> DDU_block(void) const { return dduBuffers; }
203  std::map<DDUIdType,std::map<CSCIdType,const uint16_t*> > DMB_block(void) const { return dmbBuffers; }
204 
205  std::map<DDUIdType,uint32_t> DDU_ptrOffsets(void) const { return dduOffsets; }
206  std::map<DDUIdType,std::map<CSCIdType,uint32_t> > DMB_ptrOffsets(void) const { return dmbOffsets; }
207 
208  std::map<DDUIdType,uint32_t> DDU_size(void) const { return dduSize; }
209  std::map<DDUIdType,std::map<CSCIdType,uint32_t> > DMB_size(void) const { return dmbSize; }
210 
211  CSCDCCExaminer(ExaminerMaskType mask=0x1);
213 };
214 
215 #endif
uint32_t DDU_WordsSinceLastHeader
uint32_t TMB_WordCount
const uint16_t nSTATUSES
const uint16_t * buf0
const uint16_t * buffer_start
void crcCFEB(bool enable)
const char * errorName(int num) const
uint32_t CFEB_SampleWordCount
bool warning(int num) const
std::map< CSCIdType, ExaminerStatusType > bCHAMB_ERR
std::set< CSCIdType > fCHAMB_ERR[29]
const uint16_t * buf2
std::vector< DDUIdType > listOfDDUs(void) const
int scanbuf(const uint16_t *&buf, int32_t length, uint16_t sig, uint16_t mask=0xFFFF)
int32_t CSCIdType
void modeDDU(bool enable)
uint32_t ALCT_WordsSinceLastHeader
const uint16_t * buf1
ExaminerStatusType bSUM_WARNING
uint32_t ALCT_WordCount
ExaminerStatusType errorsForChamber(CSCIdType chamber) const
const uint16_t nERRORS
ExaminerStatusType statusForChamber(CSCIdType chamber) const
std::map< DDUIdType, uint32_t > dduSize
uint32_t DDU_WordsSinceLastTrailer
DDUIdType dduSourceID(void)
uint32_t cntDDU_Headers
ExaminerStatusType errors(void) const
void crcALCT(bool enable)
const char * errName(int num) const
uint32_t ALCT_WordsExpected
std::map< CSCIdType, uint32_t > cntCHAMB_Trailers
std::vector< const char * > sERROR
std::map< DDUIdType, std::map< CSCIdType, const uint16_t * > > DMB_block(void) const
std::set< CSCIdType > chambersWithError(int num) const
ExaminerStatusType warnings(void) const
uint32_t TMB_Firmware_Revision
CSCIdType currentChamber
std::map< CSCIdType, ExaminerStatusType > bCHAMB_PAYLOAD
std::map< CSCIdType, uint32_t > cntCHAMB_Headers
std::set< CSCIdType > chambersWithWarning(int num) const
uint32_t nWG_round_up
check zero suppression mode
std::map< DDUIdType, std::map< CSCIdType, uint32_t > > DMB_ptrOffsets(void) const
const uint16_t nWARNINGS
std::map< CSCIdType, ExaminerStatusType > errorsDetailed(void) const
std::map< DDUIdType, std::map< CSCIdType, uint32_t > > dmbOffsets
std::vector< const char * > sDMBExpectedPayload
std::vector< const char * > sWARNING_
ExaminerStatusType payloadForChamber(CSCIdType chamber) const
std::set< CSCIdType > fCHAMB_WRN[5]
uint32_t ALCT_ZSE
bool fSUM_ERROR[29]
uint32_t DDU_WordMismatch_Occurrences
std::map< DDUIdType, ExaminerStatusType > bDDU_ERR
uint32_t CFEB_SampleCount
void crcTMB(bool enable)
ExaminerStatusType bSUM_ERROR
const char * statusName(int num) const
std::map< DDUIdType, std::map< CSCIdType, uint32_t > > DMB_size(void) const
uint32_t TMB_WordsRPC
uint32_t TMB_Tbins
std::map< DDUIdType, uint32_t > DDU_ptrOffsets(void) const
ExaminerStatusType errorsForDDU(DDUIdType dduSourceID) const
uint32_t TMB_WordsExpected
std::map< CSCIdType, ExaminerStatusType > statusDetailed(void) const
std::map< DDUIdType, uint32_t > DDU_size(void) const
const uint16_t * buf_2
const uint16_t * buf_1
std::map< DDUIdType, const uint16_t * > DDU_block(void) const
const uint16_t nPAYLOADS
uint32_t CFEB_BSampleCount
ExaminerMaskType getMask() const
std::map< CSCIdType, ExaminerStatusType > bCHAMB_WRN
uint32_t TMB_WordsSinceLastHeader
to decode if zero suppression enabled
std::map< CSCIdType, ExaminerStatusType > warningsDetailed(void) const
ExaminerStatusType bERROR
CSCDCCExaminer(ExaminerMaskType mask=0x1)
uint16_t tmpbuf[16]
bool fSUM_WARNING[5]
ExaminerStatusType warningsForDDU(DDUIdType dduSourceID) const
void checkTriggerHeadersAndTrailers()
const char * warningName(int num) const
uint32_t ExaminerStatusType
std::vector< const char * > sWARNING
const char * payloadName(int num) const
DDUIdType sourceID
std::map< DDUIdType, std::map< CSCIdType, const uint16_t * > > dmbBuffers
ExaminerStatusType warningsForChamber(CSCIdType chamber) const
uint32_t ALCT_WordsSinceLastHeaderZeroSuppressed
uint32_t ALCT_CRC
std::map< CSCIdType, ExaminerStatusType > bCHAMB_STATUS
int32_t check(const uint16_t *&buffer, int32_t length)
const char * wrnName(int num) const
int16_t DDUIdType
std::map< CSCIdType, ExaminerStatusType > payloadDetailed(void) const
uint32_t DDU_WordCount
ExaminerMaskType examinerMask
std::map< DDUIdType, const uint16_t * > dduBuffers
void checkDAVs()
checks DAV_ALCT, DAV_TMB, and DAV_CFEB
ExaminerStatusType bWARNING
std::map< DDUIdType, std::map< CSCIdType, uint32_t > > dmbSize
std::map< DDUIdType, ExaminerStatusType > errorsDetailedDDU(void) const
std::vector< const char * > sDMBEventStaus
std::map< DDUIdType, uint32_t > dduOffsets
bool error(int num) const
uint32_t ExaminerMaskType
void setMask(ExaminerMaskType mask)
std::vector< const char * > sERROR_
std::map< DDUIdType, ExaminerStatusType > bDDU_WRN
uint32_t cntDDU_Trailers