CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
CSCDCCExaminer Class Reference

#include <CSCDCCExaminer.h>

Public Member Functions

std::set< CSCIdTypechambersWithError (int num) const
 
std::set< CSCIdTypechambersWithWarning (int num) const
 
int32_t check (const uint16_t *&buffer, int32_t length)
 
void crcALCT (bool enable)
 
void crcCFEB (bool enable)
 
void crcTMB (bool enable)
 
 CSCDCCExaminer (ExaminerMaskType mask=0x1)
 
std::map< DDUIdType, const
uint16_t * > 
DDU_block (void) const
 
std::map< DDUIdType, uint32_t > DDU_ptrOffsets (void) const
 
std::map< DDUIdType, uint32_t > DDU_size (void) const
 
DDUIdType dduSourceID (void)
 
std::map< DDUIdType, std::map
< CSCIdType, const uint16_t * > > 
DMB_block (void) const
 
std::map< DDUIdType, std::map
< CSCIdType, uint32_t > > 
DMB_ptrOffsets (void) const
 
std::map< DDUIdType, std::map
< CSCIdType, uint32_t > > 
DMB_size (void) const
 
const char * errName (int num) const
 
bool error (int num) const
 
const char * errorName (int num) const
 
ExaminerStatusType errors (void) const
 
std::map< CSCIdType,
ExaminerStatusType
errorsDetailed (void) const
 
std::map< DDUIdType,
ExaminerStatusType
errorsDetailedDDU (void) const
 
ExaminerStatusType errorsForChamber (CSCIdType chamber) const
 
ExaminerStatusType errorsForDDU (DDUIdType dduSourceID) const
 
ExaminerMaskType getMask () const
 
std::vector< DDUIdTypelistOfDDUs (void) const
 
void modeDDU (bool enable)
 
std::map< CSCIdType,
ExaminerStatusType
payloadDetailed (void) const
 
ExaminerStatusType payloadForChamber (CSCIdType chamber) const
 
const char * payloadName (int num) const
 
void setMask (ExaminerMaskType mask)
 
std::map< CSCIdType,
ExaminerStatusType
statusDetailed (void) const
 
ExaminerStatusType statusForChamber (CSCIdType chamber) const
 
const char * statusName (int num) const
 
bool warning (int num) const
 
const char * warningName (int num) const
 
ExaminerStatusType warnings (void) const
 
std::map< CSCIdType,
ExaminerStatusType
warningsDetailed (void) const
 
ExaminerStatusType warningsForChamber (CSCIdType chamber) const
 
ExaminerStatusType warningsForDDU (DDUIdType dduSourceID) const
 
const char * wrnName (int num) const
 
 ~CSCDCCExaminer (void)
 

Public Attributes

std::map< CSCIdType, uint32_t > cntCHAMB_Headers
 
std::map< CSCIdType, uint32_t > cntCHAMB_Trailers
 
uint32_t cntDDU_Headers
 
uint32_t cntDDU_Trailers
 
const uint16_t nERRORS
 
const uint16_t nPAYLOADS
 
const uint16_t nSTATUSES
 
const uint16_t nWARNINGS
 

Private Member Functions

void checkDAVs ()
 checks DAV_ALCT, DAV_TMB, and DAV_CFEB More...
 
void checkTriggerHeadersAndTrailers ()
 
void clear ()
 
int scanbuf (const uint16_t *&buf, int32_t length, uint16_t sig, uint16_t mask=0xFFFF)
 
void sync_stats ()
 
void zeroCounts ()
 

Private Attributes

uint32_t ALCT_CRC
 
uint32_t ALCT_WordCount
 
uint32_t ALCT_WordsExpected
 
uint32_t ALCT_WordsSinceLastHeader
 
uint32_t ALCT_WordsSinceLastHeaderZeroSuppressed
 
uint32_t ALCT_ZSE
 
std::map< CSCIdType,
ExaminerStatusType
bCHAMB_ERR
 
std::map< CSCIdType,
ExaminerStatusType
bCHAMB_PAYLOAD
 
std::map< CSCIdType,
ExaminerStatusType
bCHAMB_STATUS
 
std::map< CSCIdType,
ExaminerStatusType
bCHAMB_WRN
 
std::map< DDUIdType,
ExaminerStatusType
bDDU_ERR
 
std::map< DDUIdType,
ExaminerStatusType
bDDU_WRN
 
ExaminerStatusType bERROR
 
ExaminerStatusType bSUM_ERROR
 
ExaminerStatusType bSUM_WARNING
 
const uint16_t * buf0
 
const uint16_t * buf1
 
const uint16_t * buf2
 
const uint16_t * buf_1
 
const uint16_t * buf_2
 
const uint16_t * buffer_start
 
ExaminerStatusType bWARNING
 
uint32_t CFEB_BSampleCount
 
uint32_t CFEB_CRC
 
uint32_t CFEB_SampleCount
 
uint32_t CFEB_SampleWordCount
 
bool checkCrcALCT
 
bool checkCrcCFEB
 
bool checkCrcTMB
 
CSCIdType currentChamber
 
bool DAV_ALCT
 
int DAV_CFEB
 
int DAV_DMB
 
bool DAV_TMB
 
uint32_t DDU_WordCount
 
uint32_t DDU_WordMismatch_Occurrences
 
uint32_t DDU_WordsSinceLastHeader
 
uint32_t DDU_WordsSinceLastTrailer
 
std::map< DDUIdType, const
uint16_t * > 
dduBuffers
 
std::map< DDUIdType, uint32_t > dduOffsets
 
std::map< DDUIdType, uint32_t > dduSize
 
int DMB_Active
 
std::map< DDUIdType, std::map
< CSCIdType, const uint16_t * > > 
dmbBuffers
 
std::map< DDUIdType, std::map
< CSCIdType, uint32_t > > 
dmbOffsets
 
std::map< DDUIdType, std::map
< CSCIdType, uint32_t > > 
dmbSize
 
ExaminerMaskType examinerMask
 
bool fALCT_Format2007
 
bool fALCT_Header
 
std::set< CSCIdTypefCHAMB_ERR [29]
 
std::set< CSCIdTypefCHAMB_WRN [5]
 
bool fDCC_Header
 
bool fDCC_Trailer
 
bool fDDU_Header
 
bool fDDU_Trailer
 
bool fDMB_Header
 
bool fDMB_Trailer
 
bool fERROR [29]
 
bool fSUM_ERROR [29]
 
bool fSUM_WARNING [5]
 
bool fTMB_Format2007
 
bool fTMB_Header
 
bool fWARNING [5]
 
bool modeDDUonly
 
int nDMBs
 
uint32_t nWG_round_up
 check zero suppression mode More...
 
std::vector< const char * > sDMBEventStaus
 
std::vector< const char * > sDMBExpectedPayload
 
std::vector< const char * > sERROR
 
std::vector< const char * > sERROR_
 
DDUIdType sourceID
 
std::vector< const char * > sWARNING
 
std::vector< const char * > sWARNING_
 
uint32_t TMB_CRC
 
uint32_t TMB_Firmware_Revision
 
uint32_t TMB_Tbins
 
uint32_t TMB_WordCount
 
uint32_t TMB_WordsExpected
 
uint32_t TMB_WordsRPC
 
uint32_t TMB_WordsSinceLastHeader
 to decode if zero suppression enabled More...
 
uint16_t tmpbuf [16]
 
bool uniqueALCT
 
bool uniqueTMB
 

Detailed Description

Definition at line 11 of file CSCDCCExaminer.h.

Constructor & Destructor Documentation

CSCDCCExaminer::CSCDCCExaminer ( ExaminerMaskType  mask = 0x1)

Definition at line 59 of file CSCDCCExaminer.cc.

References ALCT_CRC, ALCT_ZSE, buf0, buf1, buf2, buf_1, CFEB_CRC, checkCrcALCT, checkCrcCFEB, checkCrcTMB, clear(), cntCHAMB_Headers, cntCHAMB_Trailers, cntDDU_Headers, cntDDU_Trailers, currentChamber, DAV_ALCT, DAV_CFEB, DAV_TMB, DDU_WordCount, DDU_WordMismatch_Occurrences, DDU_WordsSinceLastHeader, DDU_WordsSinceLastTrailer, DMB_Active, fALCT_Format2007, fALCT_Header, fDCC_Header, fDCC_Trailer, fDDU_Header, fDDU_Trailer, fDMB_Header, fDMB_Trailer, fTMB_Format2007, fTMB_Header, modeDDUonly, nDMBs, nWG_round_up, sDMBEventStaus, sDMBExpectedPayload, sERROR, sERROR_, sourceID, sWARNING, sWARNING_, TMB_CRC, TMB_Firmware_Revision, TMB_WordsRPC, tmpbuf, and zeroCounts().

61 
62  sERROR[0] = " Any errors ";
63  sERROR[1] = " DDU Trailer Missing ";
64  sERROR[2] = " DDU Header Missing ";
65  sERROR[3] = " DDU CRC Error (not yet implemented) ";
66  sERROR[4] = " DDU Word Count Error ";
67  sERROR[5] = " DMB Trailer Missing ";
68  sERROR[6] = " DMB Header Missing ";
69  sERROR[7] = " ALCT Trailer Missing ";
70  sERROR[8] = " ALCT Header Missing ";
71  sERROR[9] = " ALCT Word Count Error ";
72  sERROR[10] = "ALCT CRC Error ";
73  sERROR[11] = "ALCT Trailer Bit Error ";
74  // ^^^ This is due to seeing many events in ddu293 (also, some in ddu294)
75  // with some bits in the 1st ALCT D-Header being lost. This causes a chain of errors:
76  // - TMB Trailer is not identified and TMB word count mismatch occur when Trailer is found
77  // - CFEB sample count is not reset on ALCT Trailer.
78  // To merge all these errors in one,
79  // the D-signature in the 1st ALCT Trailer will not be required for identifying the ALCT Trailer;
80  // However, if these bits are found to be missing, ERROR[11] will be flagged.
81  // This is just a temporary patch to make the output look less clattered.
82  sERROR[12] = "TMB Trailer Missing ";
83  sERROR[13] = "TMB Header Missing ";
84  sERROR[14] = "TMB Word Count Error ";
85  sERROR[15] = "TMB CRC Error ";
86  sERROR[16] = "CFEB Word Count Per Sample Error ";
87  sERROR[17] = "CFEB Sample Count Error ";
88  sERROR[18] = "CFEB CRC Error ";
89  sERROR[19] = "DDU Event Size Limit Error ";
90  sERROR[20] = "C-Words ";
91  sERROR[21] = "ALCT DAV Error ";
92  sERROR[22] = "TMB DAV Error ";
93  sERROR[23] = "CFEB DAV Error ";
94  sERROR[24] = "DMB Active Error ";
95  sERROR[25] = "DCC Trailer Missing ";
96  sERROR[26] = "DCC Header Missing ";
97  sERROR[27] = "DMB DAV vs. DMB Active mismatch Error ";
98  sERROR[28] = "Extra words between DDU Header and first DMB header";
99 
100  // sERROR[21] = "DDU Header vs. Trailer mismatch for DAV or Avtive"; // oboslete since 16.09.05
101 
102  sWARNING[0] = " Extra words between DDU Trailer and DDU Header ";
103  sWARNING[1] = " DDU Header Incomplete ";
104 
105  sDMBExpectedPayload[0] = "CFEB1_ACTIVE";
106  sDMBExpectedPayload[1] = "CFEB2_ACTIVE";
107  sDMBExpectedPayload[2] = "CFEB3_ACTIVE";
108  sDMBExpectedPayload[3] = "CFEB4_ACTIVE";
109  sDMBExpectedPayload[4] = "CFEB5_ACTIVE";
110  sDMBExpectedPayload[5] = "ALCT_DAV";
111  sDMBExpectedPayload[6] = "TMB_DAV";
112  sDMBExpectedPayload[7] = "CFEB1_DAV";
113  sDMBExpectedPayload[8] = "CFEB2_DAV";
114  sDMBExpectedPayload[9] = "CFEB3_DAV";
115  sDMBExpectedPayload[10] = "CFEB4_DAV";
116  sDMBExpectedPayload[11] = "CFEB5_DAV";
117 
118  sDMBEventStaus[0] = "ALCT_FIFO_FULL";
119  sDMBEventStaus[1] = "TMB_FIFO_FULL";
120  sDMBEventStaus[2] = "CFEB1_FIFO_FULL";
121  sDMBEventStaus[3] = "CFEB2_FIFO_FULL";
122  sDMBEventStaus[4] = "CFEB3_FIFO_FULL";
123  sDMBEventStaus[5] = "CFEB4_FIFO_FULL";
124  sDMBEventStaus[6] = "CFEB5_FIFO_FULL";
125  sDMBEventStaus[7] = "ALCT_START_TIMEOUT";
126  sDMBEventStaus[8] = "TMB_START_TIMEOUT";
127  sDMBEventStaus[9] = "CFEB1_START_TIMEOUT";
128  sDMBEventStaus[10] = "CFEB2_START_TIMEOUT";
129  sDMBEventStaus[11] = "CFEB3_START_TIMEOUT";
130  sDMBEventStaus[12] = "CFEB4_START_TIMEOUT";
131  sDMBEventStaus[13] = "CFEB5_START_TIMEOUT";
132  sDMBEventStaus[14] = "ALCT_END_TIMEOUT";
133  sDMBEventStaus[15] = "TMB_END_TIMEOUT";
134  sDMBEventStaus[16] = "CFEB1_END_TIMEOUT";
135  sDMBEventStaus[17] = "CFEB2_END_TIMEOUT";
136  sDMBEventStaus[18] = "CFEB3_END_TIMEOUT";
137  sDMBEventStaus[19] = "CFEB4_END_TIMEOUT";
138  sDMBEventStaus[20] = "CFEB5_END_TIMEOUT";
139  sDMBEventStaus[21] = "CFEB Active-DAV mismatch";
140  sDMBEventStaus[22] = "B-words found";
141 
142  sERROR_[0] = " Any errors: 00";
143  sERROR_[1] = " DDU Trailer Missing: 01";
144  sERROR_[2] = " DDU Header Missing: 02";
145  sERROR_[3] = " DDU CRC Error (not yet implemented): 03";
146  sERROR_[4] = " DDU Word Count Error: 04";
147  sERROR_[5] = " DMB Trailer Missing: 05";
148  sERROR_[6] = " DMB Header Missing: 06";
149  sERROR_[7] = " ALCT Trailer Missing: 07";
150  sERROR_[8] = " ALCT Header Missing: 08";
151  sERROR_[9] = " ALCT Word Count Error: 09";
152  sERROR_[10] = "ALCT CRC Error: 10";
153  sERROR_[11] = "ALCT Trailer Bit Error: 11";
154  sERROR_[12] = "TMB Trailer Missing: 12";
155  sERROR_[13] = "TMB Header Missing: 13";
156  sERROR_[14] = "TMB Word Count Error: 14";
157  sERROR_[15] = "TMB CRC Error: 15";
158  sERROR_[16] = "CFEB Word Count Per Sample Error: 16";
159  sERROR_[17] = "CFEB Sample Count Error: 17";
160  sERROR_[18] = "CFEB CRC Error: 18";
161  sERROR_[19] = "DDU Event Size Limit Error: 19";
162  sERROR_[20] = "C-Words: 20";
163  sERROR_[21] = "ALCT DAV Error: 21";
164  sERROR_[22] = "TMB DAV Error: 22";
165  sERROR_[23] = "CFEB DAV Error: 23";
166  sERROR_[24] = "DMB Active Error: 24";
167  sERROR_[25] = "DCC Trailer Missing: 25";
168  sERROR_[26] = "DCC Header Missing: 26";
169  sERROR_[27] = "DMB DAV vs. DMB Active mismatch Error: 27";
170  sERROR_[28] = "Extra words between DDU Header and first DMB header: 28";
171  // sERROR_[21] = "DDU Header vs. Trailer mismatch for DAV or Avtive: 21"; // oboslete since 16.09.05
172 
173  sWARNING_[0] = " Extra words between DDU Trailer and DDU Header: 00";
174  sWARNING_[1] = " DDU Header Incomplete: 02";
175 
176  fDCC_Header = false;
177  fDCC_Trailer = false;
178  fDDU_Header = false;
179  fDDU_Trailer = false;
180  fDMB_Header = false;
181  fDMB_Trailer = false;
182  fALCT_Header = false;
183  fTMB_Header = false;
184  fALCT_Format2007 = true;
185  fTMB_Format2007 = true;
186 
187  cntDDU_Headers = 0;
188  cntDDU_Trailers = 0;
189  cntCHAMB_Headers.clear();
190  cntCHAMB_Trailers.clear();
191 
192  DAV_ALCT = false;
193  DAV_TMB = false;
194  DAV_CFEB = 0;
195  DMB_Active = 0;
196  nDMBs = 0;
198  DDU_WordCount = 0;
201  ALCT_ZSE = 0;
202  nWG_round_up = 0;
203 
204  TMB_WordsRPC = 0;
206  zeroCounts();
207 
208  checkCrcALCT = false; ALCT_CRC=0;
209  checkCrcTMB = false; TMB_CRC=0;
210  checkCrcCFEB = false; CFEB_CRC=0;
211 
212  modeDDUonly = false;
213  sourceID = 0xFFF;
214  currentChamber = -1;
215 
216  //headerDAV_Active = -1; // Trailer vs. Header check // Obsolete since 16.09.05
217 
218  clear();
219  buf_1 = &(tmpbuf[0]);
220  buf0 = &(tmpbuf[4]);
221  buf1 = &(tmpbuf[8]);
222  buf2 = &(tmpbuf[12]);
223 
224  bzero(tmpbuf, sizeof(uint16_t)*16);
225 }
uint32_t DDU_WordsSinceLastHeader
const uint16_t nSTATUSES
const uint16_t * buf0
const uint16_t * buf2
const uint16_t * buf1
const uint16_t nERRORS
uint32_t DDU_WordsSinceLastTrailer
uint32_t cntDDU_Headers
std::map< CSCIdType, uint32_t > cntCHAMB_Trailers
std::vector< const char * > sERROR
uint32_t TMB_Firmware_Revision
CSCIdType currentChamber
std::map< CSCIdType, uint32_t > cntCHAMB_Headers
uint32_t nWG_round_up
check zero suppression mode
const uint16_t nWARNINGS
std::vector< const char * > sDMBExpectedPayload
std::vector< const char * > sWARNING_
uint32_t ALCT_ZSE
uint32_t DDU_WordMismatch_Occurrences
uint32_t TMB_WordsRPC
const uint16_t * buf_1
const uint16_t nPAYLOADS
uint16_t tmpbuf[16]
std::vector< const char * > sWARNING
DDUIdType sourceID
uint32_t ALCT_CRC
uint32_t DDU_WordCount
ExaminerMaskType examinerMask
std::vector< const char * > sDMBEventStaus
std::vector< const char * > sERROR_
uint32_t cntDDU_Trailers
CSCDCCExaminer::~CSCDCCExaminer ( void  )
inline

Definition at line 212 of file CSCDCCExaminer.h.

212 {}

Member Function Documentation

std::set<CSCIdType> CSCDCCExaminer::chambersWithError ( int  num) const
inline

Definition at line 141 of file CSCDCCExaminer.h.

References fCHAMB_ERR, nERRORS, and pileupDistInMC::num.

141 { if(num>=0&&num<nERRORS) return fCHAMB_ERR[num]; else return std::set<int>(); }
std::set< CSCIdType > fCHAMB_ERR[29]
const uint16_t nERRORS
std::set<CSCIdType> CSCDCCExaminer::chambersWithWarning ( int  num) const
inline

Definition at line 142 of file CSCDCCExaminer.h.

References fCHAMB_WRN, pileupDistInMC::num, and nWARNINGS.

142 { if(num>=0&&num<nWARNINGS) return fCHAMB_WRN[num]; else return std::set<int>(); }
const uint16_t nWARNINGS
std::set< CSCIdType > fCHAMB_WRN[5]
int32_t CSCDCCExaminer::check ( const uint16_t *&  buffer,
int32_t  length 
)

'buffer' is a sliding pointer; keep track of the true buffer

Check for presence of data blocks inside TMB data

increment counter of 16-bit words since last DMB*ALCT Header match this counter is reset if ALCT Header is found right after DMB Header

decode the actual counting if zero suppression enabled

increment counter of 16-bit words without zero suppression decoding

Check if ALCT zero suppression enable:

COUT << " ALCT_ZSE: " << ALCT_ZSE << std::endl;

Print Out ALCT word counting

Check calculated CRC sum against reported

w = buf0[j] & 0x7fff;

w = buf0[j] & 0x7fff;

Definition at line 227 of file CSCDCCExaminer.cc.

References ALCT_CRC, ALCT_WordCount, ALCT_WordsExpected, ALCT_WordsSinceLastHeader, ALCT_WordsSinceLastHeaderZeroSuppressed, ALCT_ZSE, bCHAMB_ERR, bCHAMB_PAYLOAD, bCHAMB_STATUS, bCHAMB_WRN, bDDU_ERR, bDDU_WRN, bERROR, buf0, buf1, buf2, buf_1, buf_2, buffer_start, bWARNING, CERR, CFEB_BSampleCount, CFEB_CRC, CFEB_SampleCount, CFEB_SampleWordCount, checkCrcALCT, checkCrcCFEB, checkCrcTMB, checkDAVs(), checkTriggerHeadersAndTrailers(), clear(), cntCHAMB_Headers, cntCHAMB_Trailers, cntDDU_Headers, cntDDU_Trailers, COUT, currentChamber, DAV_ALCT, DAV_CFEB, DAV_DMB, DAV_TMB, DDU_WordCount, DDU_WordsSinceLastHeader, DDU_WordsSinceLastTrailer, dduBuffers, dduOffsets, dduSize, DMB_Active, dmbBuffers, dmbOffsets, dmbSize, end, fALCT_Format2007, fALCT_Header, fCHAMB_ERR, fDCC_Header, fDCC_Trailer, fDDU_Header, fDDU_Trailer, fDMB_Header, fDMB_Trailer, fERROR, spr::find(), fTMB_Format2007, fTMB_Header, fWARNING, g, i, j, modeDDUonly, nDMBs, nERRORS, nWARNINGS, nWG_round_up, scanbuf(), sERROR, sourceID, sWARNING, sync_stats(), edmStreamStallGrapher::t, TMB_CRC, TMB_Firmware_Revision, TMB_Tbins, TMB_WordCount, TMB_WordsExpected, TMB_WordsRPC, TMB_WordsSinceLastHeader, tmpbuf, uniqueALCT, uniqueTMB, w(), and zeroCounts().

Referenced by CSCOfflineMonitor::doBXMonitor(), CSCValidation::doTimeMonitoring(), and CSCDCCUnpacker::produce().

227  {
228  if( length<=0 ) return -1;
229 
231  buffer_start = buffer;
232 
233 
235  bool fTMB_Scope_Start = false;
236  bool fTMB_MiniScope_Start = false;
237  bool fTMB_RPC_Start = false;
238  bool fTMB_BlockedCFEBs_Start = false;
239 
240  bool fTMB_Scope = false;
241  bool fTMB_MiniScope = false;
242  bool fTMB_RPC = false;
243  bool fTMB_BlockedCFEBs = false;
244 
245  fTMB_Scope = fTMB_Scope && true; // WARNING in 5_0_X
246 
247  while( length>0 ){
248  // == Store last 4 read buffers in pipeline-like memory (note that memcpy works quite slower!)
249  buf_2 = buf_1; // This bufer was not needed so far
250  buf_1 = buf0;
251  buf0 = buf1;
252  buf1 = buf2;
253  buf2 = buffer;
254 
255  // check for too long event
256  if(!fERROR[19] && DDU_WordsSinceLastHeader>100000 ){
257  fERROR[19] = true;
258  bERROR |= 0x80000;
259  }
260 
261  // increment counter of 64-bit words since last DDU Header
262  // this counter is reset if DDU Header is found
264 
265  // increment counter of 64-bit words since last DDU Trailer
266  // this counter is reset if DDU Trailer is found
268 
271  if ( fALCT_Header ) {
273  if(ALCT_ZSE){
274  for(int g=0; g<4; g++){
275  if(buf0[g]==0x1000){
277  }
279  }
280  }
284  }
285 
286  // increment counter of 16-bit words since last DMB*TMB Header match
287  // this counter is reset if TMB Header is found right after DMB Header or ALCT Trailer
289 
290  // increment counter of 16-bit words since last of DMB Header, ALCT Trailer, TMB Trailer,
291  // CFEB Sample Trailer, CFEB B-word; this counter is reset by all these conditions
293 
294  // If DDU header is missing we set unphysical 0xFFF value for DDU id
295  if( !fDDU_Header ){ sourceID=0xFFF; }
296 
297 
298  if (!modeDDUonly) {
299  // DCC Header 1 && DCC Header 2
300  // =VB= Added support for Sep. 2008 CMS DAQ DCC format
301  if ( ( ( (buf0[3]&0xF000) == 0x5000 && (buf0[0]&0x00FF) == 0x005F )
302  ||
303  ( (buf0[3]&0xF000) == 0x5000 && (buf0[0]&0x000F) == 0x0008 ) )
304  &&
305  // =VB= Why 0xD900 signature word if only 0xD part is constant???
306  // (buf1[3]&0xFF00) == 0xD900 )
307  (buf1[3]&0xF000) == 0xD000 )
308  {
309  if( fDCC_Header ){
310  // == Another DCC Header before encountering DCC Trailer!
311  fERROR[25]=true;
312  bERROR|=0x2000000;
313  fERROR[0]=true;
314  bERROR|=0x1;
315  CERR<<"\n\nDCC Header Occurrence ";
316  CERR<<" ERROR 25 "<<sERROR[25]<<endl;
317  fDDU_Header = false;
318 
319  // go backward for 3 DDU words ( buf2, buf1, and buf0 )
320  buffer-=12;
321  buf_1 = &(tmpbuf[0]); // Just for safety
322  buf0 = &(tmpbuf[4]); // Just for safety
323  buf1 = &(tmpbuf[8]); // Just for safety
324  buf2 = &(tmpbuf[12]); // Just for safety
325  bzero(tmpbuf,sizeof(uint16_t)*16);
326  sync_stats();
327  return length+12;
328  }
329 
330  fDCC_Header = true;
331  clear();
332  }
333  }
334  // == Check for Format Control Words, set proper flags, perform self-consistency checks
335 
336  // C-words anywhere besides DDU Header
337  if( fDDU_Header && ( (buf0[0]&0xF000)==0xC000 || (buf0[1]&0xF000)==0xC000 || (buf0[2]&0xF000)==0xC000 || (buf0[3]&0xF000)==0xC000 ) &&
338  ( /*buf_1[0]!=0x8000 ||*/ buf_1[1]!=0x8000 || buf_1[2]!=0x0001 || buf_1[3]!=0x8000 ) ){
339  fERROR[0] = true;
340  bERROR |= 0x1;
341  fERROR[20] = true;
342  bERROR |= 0x100000;
343  // fCHAMB_ERR[20].insert(currentChamber);
344  // bCHAMB_ERR[currentChamber] |= 0x100000;
345  CERR<<"\nDDU Header Occurrence = "<<cntDDU_Headers;
346  CERR<<" ERROR 20 "<<sERROR[20]<<endl;
347  }
348 
349  // == DDU Header found
350  if( /*buf0[0]==0x8000 &&*/ buf0[1]==0x8000 && buf0[2]==0x0001 && buf0[3]==0x8000 ){
351  // headerDAV_Active = (buf1[1]<<16) | buf1[0]; // Obsolete since 16.09.05
353  checkDAVs();
356 
357  if( fDDU_Header ){
358  // == Another DDU Header before encountering DDU Trailer!
359  fERROR[1]=true;
360  bERROR|=0x2;
361  fERROR[0] = true;
362  bERROR|=0x1;
363  CERR<<"\n\nDDU Header Occurrence = "<<cntDDU_Headers;
364  CERR<<" ERROR 1 "<<sERROR[1]<<endl;
365  fDDU_Header = false;
366 
367  // Part of work for chambers that hasn't been done in absent trailer
368  if( fDMB_Header || fDMB_Trailer ){
369  fERROR[5] = true;
370  bERROR |= 0x20;
371  // Since here there are no chances to know what this chamber was, force it to be -2
372  if( currentChamber == -1 ) currentChamber = -2;
373  fCHAMB_ERR[5].insert(currentChamber);
374  bCHAMB_ERR[currentChamber] |= 0x20;
375  fCHAMB_ERR[0].insert(currentChamber);
376  bCHAMB_ERR[currentChamber] |= 0x1;
377  CERR<<"\n\nDDU Header Occurrence = "<<cntDDU_Headers;
378  CERR<<" ERROR 5 "<<sERROR[5]<<endl;
379  } // One of DMB Trailers is missing ( or both )
380  fDMB_Header = false;
381  fDMB_Trailer = false;
382 
383  if( DMB_Active!=nDMBs ){
384  fERROR[24] = true;
385  bERROR |= 0x1000000;
386  }
387  DMB_Active = 0;
388  nDMBs = 0;
389 
390  // Unknown chamber denoted as -2
391  // If it still remains in any of errors - put it in error 0
392  for(int err=1; err<nERRORS; ++err)
393  if( fCHAMB_ERR[err].find(-2) != fCHAMB_ERR[err].end() ){
394  fCHAMB_ERR[0].insert(-2);
395  bCHAMB_ERR[-2] |= 0x1;
396  }
397 
400 
401  // go backward for 3 DDU words ( buf2, buf1, and buf0 )
402  buffer-=12;
403  buf_1 = &(tmpbuf[0]); // Just for safety
404  buf0 = &(tmpbuf[4]); // Just for safety
405  buf1 = &(tmpbuf[8]); // Just for safety
406  buf2 = &(tmpbuf[12]); // Just for safety
407  bzero(tmpbuf,sizeof(uint16_t)*16);
408  sync_stats();
409  return length+12;
410  }
411 
412 
413  currentChamber = -1; // Unknown yet
414 
416  // == Counted extraneous words between last DDU Trailer and this DDU Header
417  fWARNING[0]=true;
418  bWARNING|=0x1;
419  CERR<<"\nDDU Header Occurrence = "<<cntDDU_Headers;
420  CERR<<" WARNING 0 "<<sWARNING[0]<<" "<<DDU_WordsSinceLastTrailer<<" extra 64-bit words"<<endl;
421  }
422 
423  sourceID = ((buf_1[1]&0xF)<<8) | ((buf_1[0]&0xFF00)>>8);
424  fDDU_Header = true;
425  fDDU_Trailer = false;
426  DDU_WordCount = 0;
427  fDMB_Header = false;
428  fDMB_Trailer = false;
429  fALCT_Header = false;
430  fALCT_Format2007= true;
431  fTMB_Header = false;
432  fTMB_Format2007= true;
433  uniqueALCT = true;
434  uniqueTMB = true;
435  zeroCounts();
436 
437  if (modeDDUonly) {
438  fDCC_Header = true;
439  clear();
440  }
441 
444  dduSize [sourceID] = 0;
445  dmbBuffers[sourceID].clear();
446  dmbOffsets[sourceID].clear();
447  dmbSize [sourceID].clear();
448 
449  // Reset all Error and Warning flags to be false
450  bDDU_ERR[sourceID] = 0;
451  bDDU_WRN[sourceID] = 0;
452  bERROR = 0;
453  bWARNING = 0;
454  bzero(fERROR, sizeof(bool)*nERRORS);
455  bzero(fWARNING, sizeof(bool)*nWARNINGS);
456 
457  nDMBs = 0;
458  DMB_Active = buf1[0]&0xF;
459  DAV_DMB = buf1[1]&0x7FFF;
460 
461  int nDAV_DMBs=0;
462  for(int bit=0; bit<15; bit++) if( DAV_DMB&(1<<bit) ) nDAV_DMBs++;
463  if(DMB_Active!=nDAV_DMBs){
464  fERROR[27] = true;
465  bERROR |= 0x8000000;
466  }
467 
468  if( (buf_1[3]&0xF000)!=0x5000 ){
469  fWARNING[1]=true;
470  bWARNING|=0x2;
471  CERR<<"\nDDU Header Occurrence = "<<cntDDU_Headers;
472  CERR<<" WARNING 1 "<<sWARNING[1]<<". What must have been Header 1: 0x"<<std::hex<<buf_1[0]<<" 0x"<<buf_1[1]<<" 0x"<<buf_1[2]<<" 0x"<<buf_1[3]<<std::dec<<endl;
473  }
474 
475  ++cntDDU_Headers;
476  DDU_WordsSinceLastHeader=0; // Reset counter of DDU Words since last DDU Header
477  COUT<<"\n----------------------------------------------------------"<<endl;
478  COUT<<"DDU Header Occurrence "<<cntDDU_Headers<< " L1A = " << ( ((buf_1[2]&0xFFFF) + ((buf_1[3]&0x00FF) << 16)) ) <<endl;
479  }
480 
481  // == DMB Header found
482  if( (buf0[0]&0xF000)==0xA000 && (buf0[1]&0xF000)==0xA000 && (buf0[2]&0xF000)==0xA000 && (buf0[3]&0xF000)==0xA000 ){
484  checkDAVs();
487 
489  fERROR[28]=true;
490  bERROR|=0x10000000;;
491  }
492 
493  if( fDMB_Header || fDMB_Trailer ){ // F or E DMB Trailer is missed
494  fERROR[5]=true;
495  bERROR|=0x20;
496  fCHAMB_ERR[5].insert(currentChamber);
497  bCHAMB_ERR[currentChamber] |= 0x20;
498  fCHAMB_ERR[0].insert(currentChamber);
499  bCHAMB_ERR[currentChamber] |= 0x1;
500  }
501  fDMB_Header = true;
502  fDMB_Trailer = false;
503 
504  // If previous DMB record was not assigned to any chamber ( it still has -1 indentificator )
505  // let's free -1 identificator for current use and call undefined chamber from previous record -2
506  // ( -2 may already exists in this sets but we have nothing to do with it )
507  for(int err=0; err<nERRORS; ++err)
508  if( fCHAMB_ERR[err].find(-1) != fCHAMB_ERR[err].end() ){
509  fCHAMB_ERR[err].erase(-1);
510  fCHAMB_ERR[err].insert(-2);
511  }
512 // Two lines below are commented out because payloads never get filled if 0xA header is missing
513 // bCHAMB_PAYLOAD[-2] |= bCHAMB_PAYLOAD[-1];
514 // fCHAMB_PAYLOAD[-1] = 0;
515  bCHAMB_STATUS[-2] |= bCHAMB_STATUS[-1];
516  bCHAMB_STATUS[-1] = 0;
517  bCHAMB_ERR[-2] |= bCHAMB_ERR[-1];
518  bCHAMB_ERR[-1] = 0;
519  bCHAMB_WRN[-2] |= bCHAMB_WRN[-1];
520  bCHAMB_WRN[-1] = 0;
521 
522  // Chamber id ( DMB_ID + (DMB_CRATE<<4) ) from header
523  currentChamber = buf0[1]&0x0FFF;
525  bCHAMB_ERR[currentChamber] |= 0; //Victor's line
526 
527  fALCT_Header = false;
528  fALCT_Format2007= true;
529  fTMB_Header = false;
530  fTMB_Format2007= true;
531  uniqueALCT = true;
532  uniqueTMB = true;
533 
534  fTMB_Scope_Start = false;
535  fTMB_MiniScope_Start = false;
536  fTMB_RPC_Start = false;
537  fTMB_BlockedCFEBs_Start = false;
538 
539  fTMB_Scope = false;
540  fTMB_MiniScope = false;
541  fTMB_RPC = false;
542  fTMB_BlockedCFEBs = false;
543 
544 
545  zeroCounts();
546  CFEB_CRC = 0;
547 
548  nDMBs++;
549 
553 
554  // Print DMB_ID from DMB Header
555  COUT<< "Crate=" << setw(3) << setfill('0') << ((buf0[1]>>4)&0x00FF) << " DMB="<<setw(2)<<setfill('0')<<(buf0[1]&0x000F)<<" ";
556  // Print ALCT_DAV and TMB_DAV from DMB Header
557  //COUT<<setw(1)<<((buf0[0]&0x0020)>>5)<<" "<<((buf0[0]&0x0040)>>6)<<" ";
558  COUT<<setw(1)<<((buf0[0]&0x0200)>>9)<<" "<<((buf0[0]&0x0800)>>11)<<" "; //change of format 16.09.05
559  // Print CFEB_DAV from DMB Header
560  COUT<<setw(1)<<((buf0[0]&0x0010)>>4)<<((buf0[0]&0x0008)>>3)<<((buf0[0]&0x0004)>>2)<<((buf0[0]&0x0002)>>1)<<(buf0[0]&0x0001);
561  // Print DMB Header Tag
562  COUT << " {";
563 
564  // Set variables if we are waiting ALCT, TMB and CFEB records to be present in event
565  DAV_ALCT = (buf0[0]&0x0200)>>9;
566  DAV_TMB = (buf0[0]&0x0800)>>11;
567  DAV_CFEB = 0;
568  if( buf0[0]&0x0001 ) ++DAV_CFEB;
569  if( buf0[0]&0x0002 ) ++DAV_CFEB;
570  if( buf0[0]&0x0004 ) ++DAV_CFEB;
571  if( buf0[0]&0x0008 ) ++DAV_CFEB;
572  if( buf0[0]&0x0010 ) ++DAV_CFEB;
573  if( DAV_ALCT ) bCHAMB_PAYLOAD[currentChamber] |= 0x20;
574  if( DAV_TMB ) bCHAMB_PAYLOAD[currentChamber] |= 0x40;
575  bCHAMB_PAYLOAD[currentChamber] |= (buf0[0]&0x001f)<<7;
576  bCHAMB_PAYLOAD[currentChamber] |=((buf_1[2]>>5)&0x001f);
577  bCHAMB_STATUS [currentChamber] |= (buf0[0]&0x0040)<<16;
578  }
579 
580 
581  // New ALCT data format:
582  if( ( buf0[0]==0xDB0A && (buf0[1]&0xF000)==0xD000 && (buf0[2]&0xF000)==0xD000 && (buf0[3]&0xF000)==0xD000)
583  &&
584  ( (buf_1[0]&0xF000)==0xA000 && (buf_1[1]&0xF000)==0xA000 && (buf_1[2]&0xF000)==0xA000 && (buf_1[3]&0xF000)==0xA000 ) ){
585  fALCT_Header = true;
586  fALCT_Format2007 = true;
587  ALCT_CRC = 0;
590 
591  // Calculate expected number of ALCT words
592  ALCT_WordsExpected = 12; // header and trailer always exists
593 
594  // Aauxilary variables
595  // number of wire groups per layer:
596  int nWGs_per_layer = ( (buf1[2]&0x0007) + 1 ) * 16 ;
597  // words in the layer
598  nWG_round_up = int(nWGs_per_layer/12)+(nWGs_per_layer%3?1:0);
599  // configuration present:
600  bool config_present = buf1[0]&0x4000;
601  // lct overflow:
602  bool lct_overflow = buf1[0]&0x2000;
603  // raw overflow:
604  bool raw_overflow = buf1[0]&0x1000;
605  // l1a_window:
606  int lct_tbins = (buf1[3]&0x01E0)>>5;
607  // fifo_tbins:
608  int raw_tbins = (buf1[3]&0x001F);
609 
611  ALCT_ZSE = (buf1[1]&0x1000)>>12;
612 
613  if (ALCT_ZSE)
614  {
615  for (int g=0; g<4; g++)
616  {
617  if (buf1[g]==0x1000) ALCT_WordsSinceLastHeader -= (nWG_round_up - 1);
618  }
619  }
620 
621 // COUT << " Number of Wire Groups: " << nWG_round_up << std::endl;
623 // COUT << " raw_tbins: " << std::dec << raw_tbins << std::endl;
624 // COUT << " LCT Tbins: " << lct_tbins << std::endl;
625 
626  // Data block sizes:
627  // 3 words of Vertex ID register + 5 words of config. register bits:
628  int config_size = ( config_present ? 3 + 5 : 0 );
629  // collision mask register:
630  int colreg_size = ( config_present ? nWGs_per_layer/4 : 0 );
631  // hot channel mask:
632  int hot_ch_size = ( config_present ? nWG_round_up*6 : 0 );
633  // ALCT0,1 (best tracks):
634  int alct_0_1_size = ( !lct_overflow ? 2*lct_tbins : 0 );
635  // raw hit dump size:
636  int raw_hit_dump_size=(!raw_overflow ? nWG_round_up*6*raw_tbins : 0 );
637 
638  //COUT << " Raw Hit Dump: " << std::dec << raw_hit_dump_size << std::endl;
639 
640  ALCT_WordsExpected += config_size + colreg_size + hot_ch_size + alct_0_1_size + raw_hit_dump_size;
641 
642  COUT<<" <A";
643  } else {
644  // Old ALCT data format
645 
646  // == ALCT Header found right after DMB Header
647  // (check for all currently reserved/fixed bits in ALCT first 4 words)
648  // if( ( (buf0 [0]&0xF800)==0x6000 && (buf0 [1]&0xFF80)==0x0080 && (buf0 [2]&0xF000)==0x0000 && (buf0 [3]&0xc000)==0x0000 )
649  if( ( (buf0 [0]&0xF800)==0x6000 && (buf0 [1]&0x8F80)==0x0080 && (buf0 [2]&0x8000)==0x0000 && (buf0 [3]&0xc000)==0x0000 )
650  &&
651  ( (buf_1[0]&0xF000)==0xA000 && (buf_1[1]&0xF000)==0xA000 && (buf_1[2]&0xF000)==0xA000 && (buf_1[3]&0xF000)==0xA000 ) ){
652  fALCT_Header = true;
653  fALCT_Format2007 = false;
654  ALCT_CRC = 0;
656 
657  // Calculate expected number of ALCT words
658  if( (buf0[3]&0x0003)==0 ){ ALCT_WordsExpected = 12; } // Short Readout
659 
660  if( (buf0[1]&0x0003)==1 ){ // Full Readout
661  ALCT_WordsExpected = ((buf0[1]&0x007c) >> 2) *
662  ( ((buf0[3]&0x0001) )+((buf0[3]&0x0002)>>1)+
663  ((buf0[3]&0x0004)>>2)+((buf0[3]&0x0008)>>3)+
664  ((buf0[3]&0x0010)>>4)+((buf0[3]&0x0020)>>5)+
665  ((buf0[3]&0x0040)>>6) ) * 12 + 12;
666  }
667  COUT<<" <A";
668  }
669  }
670  //COUT << " ALCT Word Expected: " << ALCT_WordsExpected << std::endl;
671 
672  if( (buf0[0]&0xFFFF)==0xDB0C ){
673  fTMB_Header = true;
674  fTMB_Format2007 = true;
675  TMB_CRC = 0;
677  TMB_WordsExpected = 0;
678 
679  // Calculate expected number of TMB words (whether RPC included will be known later)
680  if ( (buf1[1]&0x3000) == 0x3000) { TMB_WordsExpected = 12; } // Short Header Only
681  if ( (buf1[1]&0x3000) == 0x0000) { TMB_WordsExpected = 48; } // Long Header Only
682 
683  COUT << " <T";
684  } else {
685  // == TMB Header found right after DMB Header or right after ALCT Trailer
686  if( (buf0 [0]&0xFFFF)==0x6B0C && (
687  ( (buf_1[0]&0xF000)==0xA000 && (buf_1[1]&0xF000)==0xA000 && (buf_1[2]&0xF000)==0xA000 && (buf_1[3]&0xF000)==0xA000 )
688  ||
689  ( (buf_1[0]&0x0800)==0x0000 && (buf_1[1]&0xF800)==0xD000 && (buf_1[2]&0xFFFF)==0xDE0D && (buf_1[3]&0xF000)==0xD000 )
690  // should've been (buf_1[0]&0xF800)==0xD000 - see comments for sERROR[11]
691  ) )
692  {
693  //if( (buf_1[2]&0xFFFF)==0xDE0D && (buf_1[3]&0xFC00)!=0xD000 && summer2004 ) ???
694 
695  fTMB_Header = true;
696  fTMB_Format2007 = false;
697  TMB_CRC = 0;
699 
700  // Calculate expected number of TMB words (whether RPC included will be known later)
701  if ( (buf0[1]&0x3000) == 0x3000) { TMB_WordsExpected = 8; } // Short Header Only
702  if ( (buf0[1]&0x3000) == 0x0000) { TMB_WordsExpected = 32; } // Long Header Only
703 
704  if ( (buf0[1]&0x3000) == 0x1000) {
705  // Full Readout = 28 + (#Tbins * #CFEBs * 6)
706  TMB_Tbins=(buf0[1]&0x001F);
707  TMB_WordsExpected = 28 + TMB_Tbins * ((buf1[0]&0x00E0)>>5) * 6;
708  }
709 
710  COUT << " <T";
711  }
712  }
713  // New TMB format => very long header Find Firmware revision
716  }
717 
718  // New TMB format => very long header
720  // Full Readout = 44 + (#Tbins * #CFEBs * 6)
721  TMB_Tbins=(buf0[3]&0x00F8)>>3;
722  TMB_WordsExpected = 44 + TMB_Tbins * (buf0[3]&0x0007) * 6;
723  }
724 
725  // == ALCT Trailer found
726  if(
727  // New ALCT data format:
728  ( buf0[0]==0xDE0D && (buf0[1]&0xF800)==0xD000 && (buf0[2]&0xF800)==0xD000 && (buf0[3]&0xF000)==0xD000 && fALCT_Format2007 ) ||
729  // Old ALCT data format; last check is added to avoid confusion with new TMB header (may not be needed):
730  ( (buf0[0]&0x0800)==0x0000 && (buf0[1]&0xF800)==0xD000 && (buf0[2]&0xFFFF)==0xDE0D && (buf0[3]&0xF000)==0xD000 && !fALCT_Format2007 && !(fTMB_Header&&fTMB_Format2007) )
731  ){
732  // should've been (buf0[0]&0xF800)==0xD000 - see comments for sERROR[11]
733 
734  // Second ALCT -> Lost both previous DMB Trailer and current DMB Header
735  if( !uniqueALCT ) currentChamber = -1;
736  // Check if this ALCT record have to exist according to DMB Header
737  if( DAV_ALCT ) DAV_ALCT = false; else DAV_ALCT = true;
738 
739  if( !fALCT_Header ){
740  fERROR[8] = true;
741  bERROR |= 0x100;
742  fCHAMB_ERR[8].insert(currentChamber);
743  bCHAMB_ERR[currentChamber] |= 0x100;
744  fCHAMB_ERR[0].insert(currentChamber);
745  bCHAMB_ERR[currentChamber] |= 0x1;
746  } // ALCT Header is missing
747 
748  if( !fALCT_Format2007 && (buf0[0]&0xF800)!=0xD000 ){
749  fERROR[11] = true;
750  bERROR |= 0x800;
751  fCHAMB_ERR[11].insert(currentChamber);
752  bCHAMB_ERR[currentChamber] |= 0x800;
753  fCHAMB_ERR[0].insert(currentChamber);
754  bCHAMB_ERR[currentChamber] |= 0x1;
755  } // some bits in 1st D-Trailer are lost
756 
758 /*
759  COUT << " ALCT Word Since Last Header: " << ALCT_WordsSinceLastHeader << std::endl;
760  COUT << " ALCT Word Expected: " << ALCT_WordsExpected << std::endl;
761  COUT << " ALCT Word Since Last Header Zero Supressed: " << ALCT_WordsSinceLastHeaderZeroSuppressed <<
762  std::endl;
763 */
765  if( checkCrcALCT ){
766  uint32_t crc = ( fALCT_Format2007 ? buf0[1] : buf0[0] ) & 0x7ff;
767  crc |= ((uint32_t)( ( fALCT_Format2007 ? buf0[2] : buf0[1] ) & 0x7ff)) << 11;
768  if( ALCT_CRC != crc ){
769  fERROR[10] = true;
770  bERROR |= 0x400;
771  fCHAMB_ERR[10].insert(currentChamber);
772  bCHAMB_ERR[currentChamber] |= 0x400;
773  fCHAMB_ERR[0].insert(currentChamber);
774  bCHAMB_ERR[currentChamber] |= 0x1;
775  }
776  }
777 
778  fALCT_Header = false;
779  uniqueALCT = false;
780  CFEB_CRC = 0;
781  //ALCT_WordCount = (buf0[3]&0x03FF);
782  ALCT_WordCount = (buf0[3]&0x07FF);
783  //ALCT_WordCount = (buf0[3]&0x0FFF);
785  COUT << "A> ";
786  }
787 
788  // Calculation of CRC sum ( algorithm is written by Madorsky )
789  if( fALCT_Header && checkCrcALCT ){
790  for(uint16_t j=0, w=0; j<4; ++j){
792  w = buf0[j] & (fALCT_Format2007 ? 0xffff : 0x7fff);
793  for(uint32_t i=15, t=0, ncrc=0; i<16; i--){
794  t = ((w >> i) & 1) ^ ((ALCT_CRC >> 21) & 1);
795  ncrc = (ALCT_CRC << 1) & 0x3ffffc;
796  ncrc |= (t ^ (ALCT_CRC & 1)) << 1;
797  ncrc |= t;
798  ALCT_CRC = ncrc;
799  }
800  }
801  }
802 
803  // == Find Correction for TMB_WordsExpected due to RPC raw hits,
804  // should it turn out to be the new RPC-aware format
805  if( fTMB_Header && ((buf0[2]&0xFFFF)==0x6E0B) ) {
806  if (fTMB_Format2007) {
807  if (TMB_Firmware_Revision >= 0x50c3) { // TMB2007 rev.0x50c3
808  // On/off * nRPCs * nTimebins * 2 words/RPC/bin
809  TMB_WordsRPC = ((buf_1[0]&0x0010)>>4) * ((buf_1[0]&0x000c)>>2) * ((buf_1[0]>>5) & 0x1F) * 2;
810  }
811  else { // TMB2007 (may not work since TMB_Tbins != RPC_Tbins)
812  TMB_WordsRPC = ((buf_1[0]&0x0040)>>6) * ((buf_1[0]&0x0030)>>4) * TMB_Tbins * 2;
813  }
814  }
815  else { // Old format
816  TMB_WordsRPC = ((buf_1[2]&0x0040)>>6) * ((buf_1[2]&0x0030)>>4) * TMB_Tbins * 2;
817  }
818  TMB_WordsRPC += 2; // add header/trailer for block of RPC raw hits
819  }
820 
821 
822 
823  // Check for RPC data
824  if ( fTMB_Header && (scanbuf(buf0,4, 0x6B04)>=0) ) {
825  fTMB_RPC_Start = true;
826  }
827 
828  // Check for Scope data
829  if ( fTMB_Header && (scanbuf(buf0,4, 0x6B05)>=0) ) {
830  fTMB_Scope_Start = true;
831  }
832 
833  // Check for Mini-Scope data
834  if ( fTMB_Header && (scanbuf(buf0,4, 0x6B07)>=0) ) {
835  fTMB_MiniScope_Start = true;
836  }
837 
838  // Check for Blocked CFEBs data
839  if ( fTMB_Header && (scanbuf(buf0,4, 0x6BCB)>=0) ) {
840  fTMB_BlockedCFEBs_Start = true;
841  }
842 
843 
844  // Check for end of RPC data
845  if ( fTMB_Header && fTMB_RPC_Start
846  && (scanbuf(buf0,4, 0x6E04)>=0) ) {
847  fTMB_RPC = true;
848  }
849 
850  // Check for end of Scope data
851  if ( fTMB_Header && fTMB_Scope_Start
852  && (scanbuf(buf0,4, 0x6E05)>=0) ) {
853  fTMB_Scope = true;
854  }
855 
856  // Check for end of Mini-Scope data
857  if ( fTMB_Header && fTMB_MiniScope_Start
858  && (scanbuf(buf0,4, 0x6E07)>=0) ) {
859  fTMB_MiniScope = true;
860  }
861 
862  // Check for end of Blocked CFEBs data
863  if ( fTMB_Header && fTMB_BlockedCFEBs_Start
864  && (scanbuf(buf0,4, 0x6ECB)>=0) ) {
865  fTMB_BlockedCFEBs = true;
866  }
867 
868  /*
869  if ( fTMB_Header && (scanbuf(buf0,4, 0x6E04)>=0) ) {
870  TMB_WordsExpected += TMB_WordsRPC;
871  }
872 */
873 
874  // == TMB Trailer found
875  if(
876  // Old TMB data format; last condition in needed not to confuse if with new ALCT data header
877  ((buf0[0]&0xF000)==0xD000 && (buf0[1]&0xF000)==0xD000 && (buf0[2]&0xFFFF)==0xDE0F && (buf0[3]&0xF000)==0xD000 && !fTMB_Format2007 && !(fALCT_Header&&fALCT_Format2007)) ||
878  // New TMB data format
879  ( buf0[0]== 0xDE0F && (buf0[1]&0xF000)==0xD000 && (buf0[2]&0xF000)==0xD000 && (buf0[3]&0xF000)==0xD000 && fTMB_Format2007 )
880  ){
881 
882  // Second TMB -> Lost both previous DMB Trailer and current DMB Header
883  if( !uniqueTMB ) currentChamber = -1;
884  // Check if this TMB record have to exist according to DMB Header
885  if( DAV_TMB ) DAV_TMB = false; else DAV_TMB = true;
886 
887  if(!fTMB_Header){
888  fERROR[13] = true;
889  bERROR |= 0x2000;
890  fCHAMB_ERR[13].insert(currentChamber);
891  bCHAMB_ERR[currentChamber] |= 0x2000;
892  fCHAMB_ERR[0].insert(currentChamber);
893  bCHAMB_ERR[currentChamber] |= 0x1;
894  } // TMB Header is missing
895 
896  // Check calculated CRC sum against reported
897  if( checkCrcTMB ){
898  uint32_t crc = ( fTMB_Format2007 ? buf0[1]&0x7ff : buf0[0]&0x7ff );
899  crc |= ((uint32_t)( ( fTMB_Format2007 ? buf0[2]&0x7ff : buf0[1] & 0x7ff ) )) << 11;
900  if( TMB_CRC != crc ){
901  fERROR[15] = true;
902  bERROR |= 0x8000;
903  fCHAMB_ERR[15].insert(currentChamber);
904  bCHAMB_ERR[currentChamber] |= 0x8000;
905  fCHAMB_ERR[0].insert(currentChamber);
906  bCHAMB_ERR[currentChamber] |= 0x1;
907  }
908  }
909 
910  fTMB_Header = false;
911  uniqueTMB = false;
912  CFEB_CRC = 0;
913  TMB_WordCount = (buf0[3]&0x07FF);
914 
915  // == Correct TMB_WordsExpected
916  // 1) for 2 optional 0x2AAA and 0x5555 Words in the Trailer
917  // 2) for extra 4 frames in the new TMB trailer and
918  // for RPC raw hit data, if present
919  //
920  // If the scope data was enabled in readout, scope data markers (0x6B05
921  // and 0x6E05) appear before 0x6E0C, and the optional 0x2AAA and 0x5555
922  // trailer words are suppressed. So far, we only have data with the
923  // empty scope content, so more corrections will be needed once
924  // non-empty scope data is available. -SV, 5 Nov 2008.
925  //
926  // If word count is not multiple of 4, add 2 optional words and
927  // 4 trailer words.
928 
929  int pos = scanbuf(buf_1,4,0x6E0C);
930  if (pos==1) {
931  TMB_WordsExpected += 6;
932  }
933  // If word count is multiple of 4, add 4 trailer words.
934  else if (pos==3) {
935  TMB_WordsExpected += 4;
936  }
937 
938  // Correct expected wordcount by RPC data size
939  if (fTMB_RPC)
941 
942  // Correct expected wordcount by MiniScope data size (22 words + 2 signature words)
943  if (fTMB_MiniScope)
944  TMB_WordsExpected += 24;
945 
946  // Correct expected wordcount by BlockedCFEBs data size (20 words + 2 signature words)
947  if (fTMB_BlockedCFEBs)
948  TMB_WordsExpected += 22;
949 
951  COUT << "T> ";
952  }
953 
954  if( fTMB_Header && checkCrcTMB ){
955  for(uint16_t j=0, w=0; j<4; ++j){
957  w = buf0[j] & (fTMB_Format2007 ? 0xffff : 0x7fff);
958  for(uint32_t i=15, t=0, ncrc=0; i<16; i--){
959  t = ((w >> i) & 1) ^ ((TMB_CRC >> 21) & 1);
960  ncrc = (TMB_CRC << 1) & 0x3ffffc;
961  ncrc |= (t ^ (TMB_CRC & 1)) << 1;
962  ncrc |= t;
963  TMB_CRC = ncrc;
964  }
965  }
966  }
967 
968 
969  // == CFEB Sample Trailer found
970 
971  if( ((buf0[1]&0xF000)==0x7000) &&
972  ((buf0[2]&0xF000)==0x7000) &&
973  ((buf0[1]!=0x7FFF) || (buf0[2]!=0x7FFF)) &&
974  ( ((buf0[3]&0xFFFF)==0x7FFF) || // old format
975  ( (buf0[3]&buf0[0])==0x0000 && (buf0[3]+buf0[0])==0x7FFF ) // 2007 format
976  ) ){
977 
978  if((CFEB_SampleCount%8) == 0 ){ COUT<<" <"; }
979  if( CFEB_SampleWordCount == 100 ){ COUT<<"+"; }
980  if( CFEB_SampleWordCount != 100 ){ COUT<<"-";
981  fERROR[16] = true;
982  bERROR |= 0x10000;
983  fCHAMB_ERR[16].insert(currentChamber);
984  bCHAMB_ERR[currentChamber] |= 0x10000;
985  fCHAMB_ERR[0].insert(currentChamber);
986  bCHAMB_ERR[currentChamber] |= 0x1;
987  }
988 
990 
991  if( (CFEB_SampleCount%8)==0 ){
992  COUT<<">";
994  // Count CFEBs
995  DAV_CFEB--;
996  }
997 
998  // Check calculated CRC sum against reported
999  if( checkCrcCFEB && CFEB_CRC!=buf0[0] ){
1000  fERROR[18] = true;
1001  bERROR |= 0x40000;
1002  fCHAMB_ERR[18].insert(currentChamber);
1003  bCHAMB_ERR[currentChamber] |= 0x40000;
1004  fCHAMB_ERR[0].insert(currentChamber);
1005  bCHAMB_ERR[currentChamber] |= 0x1;
1006  }
1007 
1008  CFEB_CRC = 0;
1010  }
1011 
1012 
1013  // == CFEB B-word found
1014  if( (buf0[0]&0xF000)==0xB000 && (buf0[1]&0xF000)==0xB000 && (buf0[2]&0xF000)==0xB000 && (buf0[3]&0xF000)==0xB000 ){
1015  bCHAMB_STATUS[currentChamber] |= 0x400000;
1016 
1017  if( (CFEB_SampleCount%8)==0 ){ COUT<<" <"; }
1018  COUT<<"B";
1019 
1020  ++CFEB_SampleCount;
1022 
1023  if( (CFEB_SampleCount%8)==0 ){
1024  COUT << ">";
1026  DAV_CFEB--;
1027  }
1028 
1030  }
1031 
1032  // == If it is neither ALCT record nor TMB - probably it is CFEB record and we try to count CRC sum.
1033  // It very few words of CFEB occasionaly will be misinterpreted as ALCT or TMB header the result
1034  // for the CRC sum will be wrong, but other errors of Trailers counting will appear as well
1036  for(int pos=0; pos<4; ++pos)
1037  CFEB_CRC=(buf0[pos]&0x1fff)^((buf0[pos]&0x1fff)<<1)^(((CFEB_CRC&0x7ffc)>>2)|((0x0003&CFEB_CRC)<<13))^((CFEB_CRC&0x7ffc)>>1);
1038 
1039 
1040  // == DMB F-Trailer found
1041  if( (buf0[0]&0xF000)==0xF000 && (buf0[1]&0xF000)==0xF000 && (buf0[2]&0xF000)==0xF000 && (buf0[3]&0xF000)==0xF000 ){
1042  if(!fDMB_Header){
1043  currentChamber = buf0[3]&0x0FFF;
1044  fERROR[6] = true;
1045  bERROR |= 0x40;
1046  fCHAMB_ERR[6].insert(currentChamber);
1047  bCHAMB_ERR[currentChamber] |= 0x40;
1048  nDMBs++;
1049  // Set variables if we are waiting ALCT, TMB and CFEB records to be present in event
1050  if( buf0[0]&0x0400 ) bCHAMB_PAYLOAD[currentChamber] |= 0x20;
1051  if( buf0[0]&0x0800 ) bCHAMB_PAYLOAD[currentChamber] |= 0x40;
1052  bCHAMB_PAYLOAD[currentChamber] |= (buf0[0]&0x001f)<<7;
1053  bCHAMB_PAYLOAD[currentChamber] |=((buf0[0]>>5)&0x1f);
1054 
1055  } // DMB Header is missing
1056  fDMB_Header = false;
1057  fDMB_Trailer = true;
1058  uniqueALCT = true;
1059  uniqueTMB = true;
1060 
1062 
1063  // Finally check if DAVs were correct
1064  checkDAVs();
1065 
1066  // If F-Trailer is lost then do necessary work here
1067  if( (buf1[0]&0xF000)!=0xE000 || (buf1[1]&0xF000)!=0xE000 || (buf1[2]&0xF000)!=0xE000 || (buf1[3]&0xF000)!=0xE000 ){
1068  for(int err=1; err<nERRORS; ++err)
1069  if( fCHAMB_ERR[err].find(currentChamber) != fCHAMB_ERR[err].end() ){
1070  fCHAMB_ERR[0].insert(currentChamber);
1071  bCHAMB_ERR[currentChamber] |= 0x1;
1072  }
1073  // Reset chamber id
1074  currentChamber=-1;
1075  /*
1076  for(int err=0; err<nERRORS; err++)
1077  if( fCHAMB_ERR[err].find(-1) != fCHAMB_ERR[err].end() )
1078  fCHAMB_ERR[err].erase(-1);
1079  bCHAMB_ERR[-1] = 0;
1080  bCHAMB_WRN[-1] = 0;
1081  */
1082  }
1083 
1084  // Print DMB F-Trailer marker
1085  COUT << " }";
1086  }
1087 
1088  // == DMB E-Trailer found
1089  if( (buf0[0]&0xF000)==0xE000 && (buf0[1]&0xF000)==0xE000 && (buf0[2]&0xF000)==0xE000 && (buf0[3]&0xF000)==0xE000 ){
1090  if( !fDMB_Header && !fDMB_Trailer ) nDMBs++; // both DMB Header and DMB F-Trailer were missing
1091 
1092  bCHAMB_STATUS[currentChamber] |= (buf0[0]&0x0800)>>11;
1093  bCHAMB_STATUS[currentChamber] |= (buf0[0]&0x0400)>>9;
1094  bCHAMB_STATUS[currentChamber] |= (buf0[0]&0x03E0)>>3;
1095  if( fDMB_Trailer ){ // F-Trailer exists
1096  bCHAMB_STATUS[currentChamber] |= (buf_1[2]&0x0002)<<6;
1097  bCHAMB_STATUS[currentChamber] |= (buf_1[2]&0x0001)<<8;
1098  bCHAMB_STATUS[currentChamber] |= (buf_1[3]&0x001f)<<9;
1099  bCHAMB_STATUS[currentChamber] |= (buf_1[3]&0x0040)<<8;
1100  bCHAMB_STATUS[currentChamber] |= (buf_1[3]&0x0020)<<10;
1101  bCHAMB_STATUS[currentChamber] |= (buf_1[3]&0x0f80)<<9;
1102  }
1103  fDMB_Header = false;
1104 
1105  // If chamber id is unknown it is time to find it out
1106  if( currentChamber==-1 ){
1107  currentChamber = buf0[1]&0x0FFF;
1108  for(int err=0; err<nERRORS; ++err)
1109  if( fCHAMB_ERR[err].find(-1) != fCHAMB_ERR[err].end() ){
1110  fCHAMB_ERR[err].insert(currentChamber);
1111  fCHAMB_ERR[err].erase(-1);
1112  }
1114  bCHAMB_STATUS[-1] = 0;
1116  bCHAMB_ERR[-1] = 0;
1118  bCHAMB_WRN[-1] = 0;
1119  }
1120  ++cntCHAMB_Trailers[buf0[1]&0x0FFF];
1121 
1122  dmbSize[sourceID][currentChamber] = buf0 - dmbBuffers[sourceID][currentChamber];
1123 
1124  // Lost DMB F-Trailer before
1125  if( !fDMB_Trailer ){
1126  fERROR[6] = true;
1127  bERROR |= 0x40;
1128  fCHAMB_ERR[6].insert(currentChamber);
1129  bCHAMB_ERR[currentChamber] |= 0x40;
1130  fCHAMB_ERR[0].insert(currentChamber);
1131  bCHAMB_ERR[currentChamber] |= 0x1;
1132  // Check if DAVs were correct here
1133  checkDAVs();
1134  }
1135  fDMB_Trailer = false;
1136 
1137  // Print DMB E-Trailer marker
1138  COUT<<" DMB="<<(buf0[1]&0x000F);
1139  COUT << "; "
1140  << ALCT_WordsSinceLastHeader << "-"
1141  << ALCT_WordCount << "-"
1143  << " "
1144  << TMB_WordsSinceLastHeader << "-"
1145  << TMB_WordCount << "-"
1147  << endl;
1148 
1150 
1151  //
1152  for(int err=0; err<nERRORS; ++err)
1153  if( fCHAMB_ERR[err].find(-1) != fCHAMB_ERR[err].end() ){
1154  fCHAMB_ERR[err].erase(-1);
1155  fCHAMB_ERR[err].insert(-2);
1156  }
1157  bCHAMB_STATUS[-2] |= bCHAMB_STATUS[-1];
1158  bCHAMB_STATUS[-1] = 0;
1159  bCHAMB_ERR[-2] |= bCHAMB_ERR[-1];
1160  bCHAMB_ERR[-1] = 0;
1161  bCHAMB_WRN[-2] |= bCHAMB_WRN[-1];
1162  bCHAMB_WRN[-1] = 0;
1163 
1164  if( currentChamber != -1 )
1165  for(int err=1; err<nERRORS; ++err)
1166  if( fCHAMB_ERR[err].find(currentChamber) != fCHAMB_ERR[err].end() ){
1167  fCHAMB_ERR[0].insert(currentChamber);
1168  bCHAMB_ERR[currentChamber] |= 0x1;
1169  }
1170 
1171  currentChamber=-1;
1172 /*
1173  // Print DMB E-Trailer marker
1174  COUT<<" DMB="<<(buf0[1]&0x000F);
1175  COUT << "; "
1176  << ALCT_WordsSinceLastHeader << "-"
1177  << ALCT_WordCount << "-"
1178  << ALCT_WordsExpected
1179  << " "
1180  << TMB_WordsSinceLastHeader << "-"
1181  << TMB_WordCount << "-"
1182  << TMB_WordsExpected
1183  << endl;
1184 */
1185 
1186  }
1187 
1188  // == DDU Trailer found
1189  if( buf0[0]==0x8000 && buf0[1]==0x8000 && buf0[2]==0xFFFF && buf0[3]==0x8000 ){
1190  // Obsolete since 16.09.05
1191  // if( headerDAV_Active != ((buf1[1]<<16) | buf1[0]) ){
1192  // fERROR[0] = true;
1193  // fERROR[21] = true;
1194  // bERROR|=0x200000;
1195  // //CERR<<" ERROR 21 "<<sERROR[21]<<endl;
1196  // }
1197  // headerDAV_Active = -1;
1199  checkDAVs();
1200 
1202 
1204 
1205  if( DDU_WordsSinceLastHeader>3 && !nDMBs ){
1206  fERROR[28]=true;
1207  bERROR|=0x10000000;;
1208  }
1209 
1210  if(fDDU_Trailer){
1211  fERROR[2] = true;
1212  bERROR |= 0x4;
1213  } // DDU Header is missing
1214  fDDU_Trailer=true;
1215  fDDU_Header=false;
1216 
1217  if( fDMB_Header || fDMB_Trailer ){
1218  // COUT << " Ex-Err: DMB (Header, Trailer) " << std::endl;
1219  fERROR[5] = true;
1220  bERROR |= 0x20;
1221  fCHAMB_ERR[5].insert(currentChamber);
1222  bCHAMB_ERR[currentChamber] |= 0x20;
1223  fCHAMB_ERR[0].insert(currentChamber);
1224  bCHAMB_ERR[currentChamber] |= 0x20;
1225  } // DMB Trailer is missing
1226  fDMB_Header = false;
1227  fDMB_Trailer = false;
1228 
1229  currentChamber=-1;
1230 
1231  for(int err=0; err<nERRORS; ++err)
1232  if( fCHAMB_ERR[err].find(-1) != fCHAMB_ERR[err].end() ){
1233  fCHAMB_ERR[err].erase(-1);
1234  fCHAMB_ERR[err].insert(-2);
1235  }
1236  bCHAMB_STATUS[-2] |= bCHAMB_STATUS[-1];
1237  bCHAMB_STATUS[-1] = 0;
1238  bCHAMB_ERR[-2] |= bCHAMB_ERR[-1];
1239  bCHAMB_ERR[-1] = 0;
1240  bCHAMB_WRN[-2] |= bCHAMB_WRN[-1];
1241  bCHAMB_WRN[-1] = 0;
1242 
1243  for(int err=1; err<nERRORS; ++err)
1244  if( fCHAMB_ERR[err].find(-2) != fCHAMB_ERR[err].end() ){
1245  fCHAMB_ERR[0].insert(-2);
1246  bCHAMB_ERR[-2] |= 0x1;
1247  }
1248 
1250 
1251  ++cntDDU_Trailers; // Increment DDUTrailer counter
1252 
1253  // == Combining 2 words into 24bit value
1254  DDU_WordCount = buf2[2] | ((buf2[3] & 0xFF) <<16) ;
1255 
1257  fERROR[4] = true;
1258  bERROR |= 0x10;
1259  }
1260 
1261  if( DMB_Active!=nDMBs ){
1262  fERROR[24] = true;
1263  bERROR |= 0x1000000;
1264  }
1265 
1266  COUT<<"DDU Trailer Occurrence "<<cntDDU_Trailers<<endl;
1267  COUT<<"----------------------------------------------------------"<<endl;
1268  COUT<<"DDU 64-bit words = Actual - DDUcounted ="<<DDU_WordsSinceLastHeader+4<<"-"<<DDU_WordCount<<endl;
1269 
1270  // increment statistics Errors and Warnings (i=0 case is handled in DDU Header)
1271  for(int err=1; err<nERRORS; ++err){
1272  if( fERROR[err] ){
1273  fERROR[0] = true;
1274  bERROR |= 0x1;
1275  CERR<<"\nDDU Header Occurrence = "<<cntDDU_Headers;
1276  CERR<<" ERROR "<<err<<" " <<sERROR[err]<<endl;
1277  }
1278  }
1279  for(int wrn=1; wrn<nWARNINGS; ++wrn){
1280  if( fWARNING[wrn] ){
1281  COUT<<"\nDDU Header Occurrence = "<<cntDDU_Headers;
1282  COUT<<" WARNING "<<wrn<<" "<<sWARNING[wrn]<<endl;
1283  }
1284  }
1285 
1286  bDDU_ERR[sourceID] |= bERROR;
1288  sync_stats();
1289 
1292  if (modeDDUonly) {
1293  buffer+=4;
1294  buf_1 = &(tmpbuf[0]); // Just for safety
1295  buf0 = &(tmpbuf[4]); // Just for safety
1296  buf1 = &(tmpbuf[8]); // Just for safety
1297  buf2 = &(tmpbuf[12]); // Just for safety
1298  bzero(tmpbuf, sizeof(uint16_t)*16);
1299  return length-4;
1300  }
1301  }
1302 
1303  if (!modeDDUonly) {
1304  // DCC Trailer 1 && DCC Trailer 2
1305  // =VB= Added support for Sep. 2008 CMS DAQ DCC format
1306  // =VB= 04.18.09 Removed (buf2[0]&0x0003) == 0x3 check for old DCC format to satisfy older format of simulated data
1307  if( (buf1[3]&0xFF00) == 0xEF00 &&
1308  ( ((buf2[3]&0xFF00) == 0xAF00 )
1309  ||
1310  (( buf2[3]&0xFF00) == 0xA000 && (buf2[0]&0x0003) == 0x0) ) ){
1311  // =VB= Added check that there is no DCCHeader detected to set missing DCC Header error
1312  if(!fDCC_Header || fDCC_Trailer){
1313  fERROR[26] = true;
1314  bERROR|=0x4000000;
1315  fERROR[0] = true;
1316  bERROR|=0x1;
1317  } // DCC Header is missing
1318  fDCC_Trailer=true;
1319  fDCC_Header=false;
1320 
1321  if( fDDU_Header ){
1322  // == DDU Trailer is missing
1323  fERROR[1]=true;
1324  bERROR|=0x2;
1325  fERROR[0] = true;
1326  bERROR|=0x1;
1327  }
1328 
1329  buffer+=4;
1330  buf_1 = &(tmpbuf[0]); // Just for safety
1331  buf0 = &(tmpbuf[4]); // Just for safety
1332  buf1 = &(tmpbuf[8]); // Just for safety
1333  buf2 = &(tmpbuf[12]); // Just for safety
1334  bzero(tmpbuf, sizeof(uint16_t)*16);
1335  sync_stats();
1336  return length-4;
1337  }
1338  }
1339 
1340  length-=4;
1341  buffer+=4;
1342  }
1343  //Store the tail of the buffer
1344  buf_1 = &(tmpbuf[0]);
1345  buf0 = &(tmpbuf[4]);
1346  buf1 = &(tmpbuf[8]);
1347  buf2 = &(tmpbuf[12]);
1348  memcpy((void*)tmpbuf,(void*)(buffer-16),sizeof(short)*16);
1349 
1350  if (!modeDDUonly && !fDCC_Trailer && !fDCC_Header) {
1351  fERROR[26] = true;
1352  bERROR|=0x4000000;
1353  fERROR[25] = true;
1354  bERROR|=0x2000000;
1355  fERROR[0]=true;
1356  bERROR|=0x1;
1357  sync_stats();
1358  return length;
1359 
1360  }
1361 
1362  return -2;
1363 }
uint32_t DDU_WordsSinceLastHeader
uint32_t TMB_WordCount
const uint16_t * buf0
const uint16_t * buffer_start
int i
Definition: DBlmapReader.cc:9
uint32_t CFEB_SampleWordCount
std::map< CSCIdType, ExaminerStatusType > bCHAMB_ERR
std::set< CSCIdType > fCHAMB_ERR[29]
const uint16_t * buf2
int scanbuf(const uint16_t *&buf, int32_t length, uint16_t sig, uint16_t mask=0xFFFF)
uint32_t ALCT_WordsSinceLastHeader
const uint16_t * buf1
uint32_t ALCT_WordCount
const uint16_t nERRORS
std::map< DDUIdType, uint32_t > dduSize
uint32_t DDU_WordsSinceLastTrailer
uint32_t cntDDU_Headers
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
uint32_t ALCT_WordsExpected
std::map< CSCIdType, uint32_t > cntCHAMB_Trailers
std::vector< const char * > sERROR
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
uint32_t TMB_Firmware_Revision
CSCIdType currentChamber
std::map< CSCIdType, ExaminerStatusType > bCHAMB_PAYLOAD
std::map< CSCIdType, uint32_t > cntCHAMB_Headers
uint32_t nWG_round_up
check zero suppression mode
const uint16_t nWARNINGS
std::map< DDUIdType, std::map< CSCIdType, uint32_t > > dmbOffsets
uint32_t ALCT_ZSE
std::map< DDUIdType, ExaminerStatusType > bDDU_ERR
uint32_t CFEB_SampleCount
int j
Definition: DBlmapReader.cc:9
uint32_t TMB_WordsRPC
uint32_t TMB_Tbins
#define end
Definition: vmac.h:37
uint32_t TMB_WordsExpected
const uint16_t * buf_2
const uint16_t * buf_1
uint32_t CFEB_BSampleCount
std::map< CSCIdType, ExaminerStatusType > bCHAMB_WRN
uint32_t TMB_WordsSinceLastHeader
to decode if zero suppression enabled
ExaminerStatusType bERROR
uint16_t tmpbuf[16]
void checkTriggerHeadersAndTrailers()
std::vector< const char * > sWARNING
DDUIdType sourceID
std::map< DDUIdType, std::map< CSCIdType, const uint16_t * > > dmbBuffers
uint32_t ALCT_WordsSinceLastHeaderZeroSuppressed
uint32_t ALCT_CRC
std::map< CSCIdType, ExaminerStatusType > bCHAMB_STATUS
uint32_t DDU_WordCount
#define CERR
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
#define COUT
T w() const
std::map< DDUIdType, uint32_t > dduOffsets
std::map< DDUIdType, ExaminerStatusType > bDDU_WRN
uint32_t cntDDU_Trailers
void CSCDCCExaminer::checkDAVs ( )
private

checks DAV_ALCT, DAV_TMB, and DAV_CFEB

Definition at line 1410 of file CSCDCCExaminer.cc.

References bCHAMB_ERR, bERROR, currentChamber, DAV_ALCT, DAV_CFEB, DAV_TMB, fCHAMB_ERR, and fERROR.

Referenced by check().

1411 {
1412  if( DAV_ALCT ){
1413  fERROR[21] = true;
1414  bERROR |= 0x200000;
1415  fCHAMB_ERR[21].insert(currentChamber);
1416  bCHAMB_ERR[currentChamber] |= 0x200000;
1417  DAV_ALCT = false;
1418  }
1419  if( DAV_TMB ){
1420  fERROR[22] = true;
1421  bERROR |= 0x400000;
1422  fCHAMB_ERR[22].insert(currentChamber);
1423  bCHAMB_ERR[currentChamber] |= 0x400000;
1424  DAV_TMB = false;
1425  }
1426  if( DAV_CFEB && DAV_CFEB!=-16){
1427  fERROR[23] = true;
1428  bERROR |= 0x800000;
1429  fCHAMB_ERR[23].insert(currentChamber);
1430  bCHAMB_ERR[currentChamber] |= 0x800000;
1431  DAV_CFEB = 0;
1432  }
1433 }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_ERR
std::set< CSCIdType > fCHAMB_ERR[29]
CSCIdType currentChamber
ExaminerStatusType bERROR
void CSCDCCExaminer::checkTriggerHeadersAndTrailers ( )
private

Definition at line 1436 of file CSCDCCExaminer.cc.

References ALCT_WordCount, ALCT_WordsExpected, ALCT_WordsSinceLastHeader, ALCT_WordsSinceLastHeaderZeroSuppressed, ALCT_ZSE, bCHAMB_ERR, bERROR, CFEB_SampleCount, currentChamber, fALCT_Header, fCHAMB_ERR, fERROR, fTMB_Header, TMB_WordCount, TMB_WordsExpected, and TMB_WordsSinceLastHeader.

Referenced by check().

1437 { /*
1438  COUT << " Ex-ALCT-Word-count " << std::endl;
1439  COUT << " ALCT Words Since Last Header: " << ALCT_WordsSinceLastHeader << std::endl;
1440  COUT << " ALCT Word Count: " << ALCT_WordCount << std::endl;
1441  COUT << " ALCT Words Expected: " << ALCT_WordsExpected << std::endl;
1442  */
1444  && ALCT_ZSE==0 ){
1445  fERROR[9] = true;
1446  bERROR |= 0x200;
1447  fCHAMB_ERR[9].insert(currentChamber);
1448  bCHAMB_ERR[currentChamber] |= 0x200;
1450  ALCT_WordCount = 0;
1452  ALCT_WordsExpected = 0;
1453  } // ALCT Word Count Error
1454 
1457  fERROR[9] = true;
1458  bERROR |= 0x200;
1459  fCHAMB_ERR[9].insert(currentChamber);
1460  bCHAMB_ERR[currentChamber] |= 0x200;
1463  ALCT_WordCount = 0;
1465  ALCT_WordsExpected = 0;
1466  } // ALCT Word Count Error With zero suppression
1467 
1469  fERROR[14] = true;
1470  bERROR |= 0x4000;
1471  fCHAMB_ERR[14].insert(currentChamber);
1472  bCHAMB_ERR[currentChamber] |= 0x4000;
1474  TMB_WordCount = 0;
1476  TMB_WordsExpected = 0;
1477  } // TMB Word Count Error
1478 
1479  if( (CFEB_SampleCount%8)!=0 ){
1480  fERROR[17] = true;
1481  bERROR |= 0x20000;
1482  fCHAMB_ERR[17].insert(currentChamber);
1483  bCHAMB_ERR[currentChamber] |= 0x20000;
1484  CFEB_SampleCount = 0;
1485  } // Number of CFEB samples != 8*n
1486 
1487  if(fALCT_Header) {
1488  fERROR[7] = true; // ALCT Trailer is missing
1489  bERROR |= 0x80;
1490  fCHAMB_ERR[7].insert(currentChamber);
1491  bCHAMB_ERR[currentChamber] |= 0x80;
1494  ALCT_WordsExpected = 0;
1495  fALCT_Header = 0;
1496  }
1497 
1498  if(fTMB_Header) {
1499  fERROR[12]=true; // TMB Trailer is missing
1500  bERROR |= 0x1000;
1501  fCHAMB_ERR[12].insert(currentChamber);
1502  bCHAMB_ERR[currentChamber] |= 0x1000;
1504  TMB_WordsExpected = 0;
1505  fTMB_Header = false;
1506  }
1507 }
uint32_t TMB_WordCount
std::map< CSCIdType, ExaminerStatusType > bCHAMB_ERR
std::set< CSCIdType > fCHAMB_ERR[29]
uint32_t ALCT_WordsSinceLastHeader
uint32_t ALCT_WordCount
uint32_t ALCT_WordsExpected
CSCIdType currentChamber
uint32_t ALCT_ZSE
uint32_t CFEB_SampleCount
uint32_t TMB_WordsExpected
uint32_t TMB_WordsSinceLastHeader
to decode if zero suppression enabled
ExaminerStatusType bERROR
uint32_t ALCT_WordsSinceLastHeaderZeroSuppressed
void CSCDCCExaminer::clear ( void  )
private

Definition at line 1366 of file CSCDCCExaminer.cc.

References bCHAMB_ERR, bCHAMB_PAYLOAD, bCHAMB_STATUS, bCHAMB_WRN, bDDU_ERR, bDDU_WRN, bERROR, bSUM_ERROR, bSUM_WARNING, bWARNING, dduBuffers, dduOffsets, dduSize, dmbBuffers, dmbOffsets, dmbSize, fCHAMB_ERR, fCHAMB_WRN, fERROR, fSUM_ERROR, fSUM_WARNING, fWARNING, nERRORS, and nWARNINGS.

Referenced by check(), Vispa.Views.WidgetView.WidgetView::closeEvent(), Vispa.Views.BoxDecayView.BoxDecayView::closeEvent(), CSCDCCExaminer(), Vispa.Share.FindAlgorithm.FindAlgorithm::findUsingFindDialog(), Vispa.Views.LineDecayView.LineDecayView::setDataObjects(), Vispa.Views.WidgetView.WidgetView::setDataObjects(), Vispa.Views.TreeView.TreeView::updateContent(), Vispa.Views.TableView.TableView::updateContent(), Vispa.Views.BoxDecayView.BoxDecayView::updateContent(), and Vispa.Views.PropertyView.PropertyView::updateContent().

1367 {
1368  bzero(fERROR, sizeof(bool)*nERRORS);
1369  bzero(fWARNING, sizeof(bool)*nWARNINGS);
1370  bzero(fSUM_ERROR, sizeof(bool)*nERRORS);
1371  bzero(fSUM_WARNING, sizeof(bool)*nWARNINGS);
1372  bERROR = 0;
1373  bWARNING = 0;
1374  bSUM_ERROR = 0;
1375  bSUM_WARNING = 0;
1376  for(int err=0; err<nERRORS; ++err) fCHAMB_ERR[err].clear();
1377  for(int wrn=0; wrn<nWARNINGS; ++wrn) fCHAMB_WRN[wrn].clear();
1378  bCHAMB_ERR.clear();
1379  bCHAMB_WRN.clear();
1380  bCHAMB_PAYLOAD.clear();
1381  bCHAMB_STATUS.clear();
1382  bDDU_ERR.clear();
1383  bDDU_WRN.clear();
1384  dduBuffers.clear();
1385  dduOffsets.clear();
1386  dmbBuffers.clear();
1387  dmbOffsets.clear();
1388  dduSize.clear();
1389  dmbSize.clear();
1390 }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_ERR
std::set< CSCIdType > fCHAMB_ERR[29]
ExaminerStatusType bSUM_WARNING
const uint16_t nERRORS
std::map< DDUIdType, uint32_t > dduSize
std::map< CSCIdType, ExaminerStatusType > bCHAMB_PAYLOAD
const uint16_t nWARNINGS
std::map< DDUIdType, std::map< CSCIdType, uint32_t > > dmbOffsets
std::set< CSCIdType > fCHAMB_WRN[5]
bool fSUM_ERROR[29]
std::map< DDUIdType, ExaminerStatusType > bDDU_ERR
ExaminerStatusType bSUM_ERROR
std::map< CSCIdType, ExaminerStatusType > bCHAMB_WRN
ExaminerStatusType bERROR
bool fSUM_WARNING[5]
std::map< DDUIdType, std::map< CSCIdType, const uint16_t * > > dmbBuffers
std::map< CSCIdType, ExaminerStatusType > bCHAMB_STATUS
std::map< DDUIdType, const uint16_t * > dduBuffers
ExaminerStatusType bWARNING
std::map< DDUIdType, std::map< CSCIdType, uint32_t > > dmbSize
std::map< DDUIdType, uint32_t > dduOffsets
std::map< DDUIdType, ExaminerStatusType > bDDU_WRN
void CSCDCCExaminer::crcALCT ( bool  enable)

Definition at line 22 of file CSCDCCExaminer.cc.

Referenced by CSCOfflineMonitor::doBXMonitor(), CSCValidation::doTimeMonitoring(), and CSCDCCUnpacker::produce().

22  {
23  checkCrcALCT = enable;
24  if( checkCrcALCT )
25  sERROR[10] = "ALCT CRC Error ";
26  else
27  sERROR[10] = "ALCT CRC Error ( disabled ) ";
28 }
std::vector< const char * > sERROR
void CSCDCCExaminer::crcCFEB ( bool  enable)

Definition at line 38 of file CSCDCCExaminer.cc.

Referenced by CSCOfflineMonitor::doBXMonitor(), CSCValidation::doTimeMonitoring(), and CSCDCCUnpacker::produce().

38  {
39  checkCrcCFEB = enable;
40  if( checkCrcCFEB )
41  sERROR[18] = "CFEB CRC Error ";
42  else
43  sERROR[18] = "CFEB CRC Error ( disabled ) ";
44 }
std::vector< const char * > sERROR
void CSCDCCExaminer::crcTMB ( bool  enable)

Definition at line 30 of file CSCDCCExaminer.cc.

Referenced by CSCOfflineMonitor::doBXMonitor(), CSCValidation::doTimeMonitoring(), and CSCDCCUnpacker::produce().

30  {
31  checkCrcTMB = enable;
32  if( checkCrcTMB )
33  sERROR[15] = "TMB CRC Error ";
34  else
35  sERROR[15] = "TMB CRC Error ( disabled ) ";
36 }
std::vector< const char * > sERROR
std::map<DDUIdType,const uint16_t*> CSCDCCExaminer::DDU_block ( void  ) const
inline

Definition at line 202 of file CSCDCCExaminer.h.

References dduBuffers.

Referenced by CSCDDUEventData::unpack_data().

202 { return dduBuffers; }
std::map< DDUIdType, const uint16_t * > dduBuffers
std::map<DDUIdType,uint32_t> CSCDCCExaminer::DDU_ptrOffsets ( void  ) const
inline

Definition at line 205 of file CSCDCCExaminer.h.

References dduOffsets.

205 { return dduOffsets; }
std::map< DDUIdType, uint32_t > dduOffsets
std::map<DDUIdType,uint32_t> CSCDCCExaminer::DDU_size ( void  ) const
inline

Definition at line 208 of file CSCDCCExaminer.h.

References dduSize.

Referenced by CSCDDUEventData::unpack_data().

208 { return dduSize; }
std::map< DDUIdType, uint32_t > dduSize
DDUIdType CSCDCCExaminer::dduSourceID ( void  )
inline

Definition at line 200 of file CSCDCCExaminer.h.

References sourceID.

200 { return sourceID; }
DDUIdType sourceID
std::map<DDUIdType,std::map<CSCIdType,const uint16_t*> > CSCDCCExaminer::DMB_block ( void  ) const
inline

Definition at line 203 of file CSCDCCExaminer.h.

References dmbBuffers.

Referenced by CSCDDUEventData::unpack_data().

203 { return dmbBuffers; }
std::map< DDUIdType, std::map< CSCIdType, const uint16_t * > > dmbBuffers
std::map<DDUIdType,std::map<CSCIdType,uint32_t> > CSCDCCExaminer::DMB_ptrOffsets ( void  ) const
inline

Definition at line 206 of file CSCDCCExaminer.h.

References dmbOffsets.

206 { return dmbOffsets; }
std::map< DDUIdType, std::map< CSCIdType, uint32_t > > dmbOffsets
std::map<DDUIdType,std::map<CSCIdType,uint32_t> > CSCDCCExaminer::DMB_size ( void  ) const
inline

Definition at line 209 of file CSCDCCExaminer.h.

References dmbSize.

209 { return dmbSize; }
std::map< DDUIdType, std::map< CSCIdType, uint32_t > > dmbSize
const char* CSCDCCExaminer::errName ( int  num) const
inline

Definition at line 129 of file CSCDCCExaminer.h.

References nERRORS, pileupDistInMC::num, and sERROR.

Referenced by CSCDCCUnpacker::produce().

129 { if(num>=0&&num<nERRORS) return sERROR[num]; else return ""; }
const uint16_t nERRORS
std::vector< const char * > sERROR
bool CSCDCCExaminer::error ( int  num) const
inline
const char* CSCDCCExaminer::errorName ( int  num) const
inline

Definition at line 132 of file CSCDCCExaminer.h.

References nERRORS, pileupDistInMC::num, and sERROR_.

132 { if(num>=0&&num<nERRORS) return sERROR_[num]; else return ""; }
const uint16_t nERRORS
std::vector< const char * > sERROR_
ExaminerStatusType CSCDCCExaminer::errors ( void  ) const
inline

Definition at line 126 of file CSCDCCExaminer.h.

References bSUM_ERROR.

Referenced by CSCOfflineMonitor::doBXMonitor(), CSCValidation::doTimeMonitoring(), and CSCDCCUnpacker::produce().

126 { return bSUM_ERROR; }
ExaminerStatusType bSUM_ERROR
std::map<CSCIdType,ExaminerStatusType> CSCDCCExaminer::errorsDetailed ( void  ) const
inline

Definition at line 187 of file CSCDCCExaminer.h.

References bCHAMB_ERR.

Referenced by CSCDCCUnpacker::produce().

187 { return bCHAMB_ERR; }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_ERR
std::map<DDUIdType,ExaminerStatusType> CSCDCCExaminer::errorsDetailedDDU ( void  ) const
inline

Definition at line 185 of file CSCDCCExaminer.h.

References bDDU_ERR.

Referenced by CSCDCCUnpacker::produce().

185 { return bDDU_ERR; }
std::map< DDUIdType, ExaminerStatusType > bDDU_ERR
ExaminerStatusType CSCDCCExaminer::errorsForChamber ( CSCIdType  chamber) const
inline

Print (for debugging, to be removed)

Definition at line 154 of file CSCDCCExaminer.h.

References bCHAMB_ERR.

Referenced by cscdqm::EventProcessor::processCSC(), and CSCDDUEventData::unpack_data().

154  {
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  }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_ERR
ExaminerStatusType CSCDCCExaminer::errorsForDDU ( DDUIdType  dduSourceID) const
inline

Definition at line 170 of file CSCDCCExaminer.h.

References bDDU_ERR.

170  {
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  }
DDUIdType dduSourceID(void)
std::map< DDUIdType, ExaminerStatusType > bDDU_ERR
ExaminerMaskType CSCDCCExaminer::getMask ( ) const
inline

Definition at line 124 of file CSCDCCExaminer.h.

References examinerMask.

Referenced by CSCDCCUnpacker::produce(), and CSCDDUEventData::unpack_data().

124 {return examinerMask;}
ExaminerMaskType examinerMask
std::vector<DDUIdType> CSCDCCExaminer::listOfDDUs ( void  ) const
inline

Definition at line 178 of file CSCDCCExaminer.h.

References bDDU_ERR.

178  {
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  }
std::map< DDUIdType, ExaminerStatusType > bDDU_ERR
void CSCDCCExaminer::modeDDU ( bool  enable)

Definition at line 46 of file CSCDCCExaminer.cc.

46  {
47  modeDDUonly = enable;
48  if( modeDDUonly) {
49  sERROR[25] = "DCC Trailer Missing ";
50  sERROR[26] = "DCC Header Missing ";
51  } else {
52  sERROR[25] = "DCC Trailer Missing (disabled) ";
53  sERROR[26] = "DCC Header Missing (disabled) ";
54  }
55 
56 }
std::vector< const char * > sERROR
std::map<CSCIdType,ExaminerStatusType> CSCDCCExaminer::payloadDetailed ( void  ) const
inline

Definition at line 189 of file CSCDCCExaminer.h.

References bCHAMB_PAYLOAD.

Referenced by CSCDCCUnpacker::produce().

189 { return bCHAMB_PAYLOAD; }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_PAYLOAD
ExaminerStatusType CSCDCCExaminer::payloadForChamber ( CSCIdType  chamber) const
inline

Definition at line 144 of file CSCDCCExaminer.h.

References bCHAMB_PAYLOAD.

144  {
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  }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_PAYLOAD
const char* CSCDCCExaminer::payloadName ( int  num) const
inline

Definition at line 135 of file CSCDCCExaminer.h.

References nPAYLOADS, pileupDistInMC::num, and sDMBExpectedPayload.

135 { if(num>=0&&num<nPAYLOADS) return sDMBExpectedPayload[num]; else return ""; }
std::vector< const char * > sDMBExpectedPayload
const uint16_t nPAYLOADS
int CSCDCCExaminer::scanbuf ( const uint16_t *&  buf,
int32_t  length,
uint16_t  sig,
uint16_t  mask = 0xFFFF 
)
inlineprivate

Definition at line 1519 of file CSCDCCExaminer.cc.

References i.

Referenced by check().

1520 {
1521  for (int i=0; i<length; i++)
1522  {
1523  if ( (buffer[i]&mask) == sig) {
1524  return i;
1525  }
1526  }
1527  return -1;
1528 }
int i
Definition: DBlmapReader.cc:9
void CSCDCCExaminer::setMask ( ExaminerMaskType  mask)
inline

Definition at line 123 of file CSCDCCExaminer.h.

References examinerMask.

Referenced by CSCOfflineMonitor::doBXMonitor(), CSCValidation::doTimeMonitoring(), and CSCDCCUnpacker::produce().

123 {examinerMask=mask;}
ExaminerMaskType examinerMask
std::map<CSCIdType,ExaminerStatusType> CSCDCCExaminer::statusDetailed ( void  ) const
inline

Definition at line 190 of file CSCDCCExaminer.h.

References bCHAMB_STATUS.

Referenced by CSCDCCUnpacker::produce().

190 { return bCHAMB_STATUS; }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_STATUS
ExaminerStatusType CSCDCCExaminer::statusForChamber ( CSCIdType  chamber) const
inline

Definition at line 149 of file CSCDCCExaminer.h.

References bCHAMB_STATUS.

149  {
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  }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_STATUS
const char* CSCDCCExaminer::statusName ( int  num) const
inline

Definition at line 136 of file CSCDCCExaminer.h.

References nSTATUSES, pileupDistInMC::num, and sDMBEventStaus.

136 { if(num>=0&&num<nSTATUSES) return sDMBEventStaus [num]; else return ""; }
const uint16_t nSTATUSES
std::vector< const char * > sDMBEventStaus
void CSCDCCExaminer::sync_stats ( )
inlineprivate

Definition at line 1509 of file CSCDCCExaminer.cc.

References bERROR, bSUM_ERROR, bSUM_WARNING, bWARNING, fERROR, fSUM_ERROR, fSUM_WARNING, fWARNING, nERRORS, and nWARNINGS.

Referenced by check().

1510 {
1511  for (int err=0; err<nERRORS; ++err)
1512  fSUM_ERROR[err] |= fERROR[err];
1513  for (int wrn=0; wrn<nWARNINGS; ++wrn)
1514  fSUM_WARNING[wrn] |= fWARNING[wrn];
1515  bSUM_ERROR |= bERROR;
1517 }
ExaminerStatusType bSUM_WARNING
const uint16_t nERRORS
const uint16_t nWARNINGS
bool fSUM_ERROR[29]
ExaminerStatusType bSUM_ERROR
ExaminerStatusType bERROR
bool fSUM_WARNING[5]
ExaminerStatusType bWARNING
bool CSCDCCExaminer::warning ( int  num) const
inline

Definition at line 139 of file CSCDCCExaminer.h.

References fSUM_WARNING, pileupDistInMC::num, and nWARNINGS.

139 { if(num>=0&&num<nWARNINGS) return fSUM_WARNING[num]; else return 0; }
const uint16_t nWARNINGS
bool fSUM_WARNING[5]
const char* CSCDCCExaminer::warningName ( int  num) const
inline

Definition at line 133 of file CSCDCCExaminer.h.

References pileupDistInMC::num, nWARNINGS, and sWARNING_.

133 { if(num>=0&&num<nWARNINGS) return sWARNING_[num]; else return ""; }
const uint16_t nWARNINGS
std::vector< const char * > sWARNING_
ExaminerStatusType CSCDCCExaminer::warnings ( void  ) const
inline

Definition at line 127 of file CSCDCCExaminer.h.

References bSUM_WARNING.

127 { return bSUM_WARNING; }
ExaminerStatusType bSUM_WARNING
std::map<CSCIdType,ExaminerStatusType> CSCDCCExaminer::warningsDetailed ( void  ) const
inline

Definition at line 188 of file CSCDCCExaminer.h.

References bCHAMB_WRN.

188 { return bCHAMB_WRN; }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_WRN
ExaminerStatusType CSCDCCExaminer::warningsForChamber ( CSCIdType  chamber) const
inline

Definition at line 165 of file CSCDCCExaminer.h.

References bCHAMB_WRN.

165  {
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  }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_WRN
ExaminerStatusType CSCDCCExaminer::warningsForDDU ( DDUIdType  dduSourceID) const
inline

Definition at line 174 of file CSCDCCExaminer.h.

References bDDU_WRN.

174  {
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  }
DDUIdType dduSourceID(void)
std::map< DDUIdType, ExaminerStatusType > bDDU_WRN
const char* CSCDCCExaminer::wrnName ( int  num) const
inline

Definition at line 130 of file CSCDCCExaminer.h.

References pileupDistInMC::num, nWARNINGS, and sWARNING.

130 { if(num>=0&&num<nWARNINGS) return sWARNING[num]; else return ""; }
const uint16_t nWARNINGS
std::vector< const char * > sWARNING
void CSCDCCExaminer::zeroCounts ( )
private

Definition at line 1393 of file CSCDCCExaminer.cc.

References ALCT_WordCount, ALCT_WordsExpected, ALCT_WordsSinceLastHeader, ALCT_WordsSinceLastHeaderZeroSuppressed, ALCT_ZSE, CFEB_BSampleCount, CFEB_SampleCount, CFEB_SampleWordCount, TMB_Tbins, TMB_WordCount, TMB_WordsExpected, and TMB_WordsSinceLastHeader.

Referenced by check(), and CSCDCCExaminer().

1394 {
1397  ALCT_WordCount = 0;
1398  ALCT_WordsExpected = 0;
1399  ALCT_ZSE = 0;
1401  TMB_WordCount = 0;
1402  TMB_WordsExpected = 0;
1403  TMB_Tbins = 0;
1405  CFEB_SampleCount = 0;
1406  CFEB_BSampleCount = 0;
1407 }
uint32_t TMB_WordCount
uint32_t CFEB_SampleWordCount
uint32_t ALCT_WordsSinceLastHeader
uint32_t ALCT_WordCount
uint32_t ALCT_WordsExpected
uint32_t ALCT_ZSE
uint32_t CFEB_SampleCount
uint32_t TMB_Tbins
uint32_t TMB_WordsExpected
uint32_t CFEB_BSampleCount
uint32_t TMB_WordsSinceLastHeader
to decode if zero suppression enabled
uint32_t ALCT_WordsSinceLastHeaderZeroSuppressed

Member Data Documentation

uint32_t CSCDCCExaminer::ALCT_CRC
private

Definition at line 98 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::ALCT_WordCount
private

Definition at line 81 of file CSCDCCExaminer.h.

Referenced by check(), checkTriggerHeadersAndTrailers(), and zeroCounts().

uint32_t CSCDCCExaminer::ALCT_WordsExpected
private

Definition at line 82 of file CSCDCCExaminer.h.

Referenced by check(), checkTriggerHeadersAndTrailers(), and zeroCounts().

uint32_t CSCDCCExaminer::ALCT_WordsSinceLastHeader
private

Definition at line 79 of file CSCDCCExaminer.h.

Referenced by check(), checkTriggerHeadersAndTrailers(), and zeroCounts().

uint32_t CSCDCCExaminer::ALCT_WordsSinceLastHeaderZeroSuppressed
private

Definition at line 80 of file CSCDCCExaminer.h.

Referenced by check(), checkTriggerHeadersAndTrailers(), and zeroCounts().

uint32_t CSCDCCExaminer::ALCT_ZSE
private

Definition at line 83 of file CSCDCCExaminer.h.

Referenced by check(), checkTriggerHeadersAndTrailers(), CSCDCCExaminer(), and zeroCounts().

std::map<CSCIdType,ExaminerStatusType> CSCDCCExaminer::bCHAMB_ERR
private
std::map<CSCIdType,ExaminerStatusType> CSCDCCExaminer::bCHAMB_PAYLOAD
private

Definition at line 28 of file CSCDCCExaminer.h.

Referenced by check(), clear(), payloadDetailed(), and payloadForChamber().

std::map<CSCIdType,ExaminerStatusType> CSCDCCExaminer::bCHAMB_STATUS
private

Definition at line 29 of file CSCDCCExaminer.h.

Referenced by check(), clear(), statusDetailed(), and statusForChamber().

std::map<CSCIdType,ExaminerStatusType> CSCDCCExaminer::bCHAMB_WRN
private

Definition at line 27 of file CSCDCCExaminer.h.

Referenced by check(), clear(), warningsDetailed(), and warningsForChamber().

std::map<DDUIdType,ExaminerStatusType> CSCDCCExaminer::bDDU_ERR
private

Definition at line 30 of file CSCDCCExaminer.h.

Referenced by check(), clear(), errorsDetailedDDU(), errorsForDDU(), and listOfDDUs().

std::map<DDUIdType,ExaminerStatusType> CSCDCCExaminer::bDDU_WRN
private

Definition at line 31 of file CSCDCCExaminer.h.

Referenced by check(), clear(), and warningsForDDU().

ExaminerStatusType CSCDCCExaminer::bERROR
private

Definition at line 17 of file CSCDCCExaminer.h.

Referenced by check(), checkDAVs(), checkTriggerHeadersAndTrailers(), clear(), and sync_stats().

ExaminerStatusType CSCDCCExaminer::bSUM_ERROR
private

Definition at line 18 of file CSCDCCExaminer.h.

Referenced by clear(), errors(), and sync_stats().

ExaminerStatusType CSCDCCExaminer::bSUM_WARNING
private

Definition at line 18 of file CSCDCCExaminer.h.

Referenced by clear(), sync_stats(), and warnings().

const uint16_t * CSCDCCExaminer::buf0
private

Definition at line 36 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

const uint16_t * CSCDCCExaminer::buf1
private

Definition at line 36 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

const uint16_t * CSCDCCExaminer::buf2
private

Definition at line 36 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

const uint16_t * CSCDCCExaminer::buf_1
private

Definition at line 36 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

const uint16_t* CSCDCCExaminer::buf_2
private

Definition at line 36 of file CSCDCCExaminer.h.

Referenced by check().

const uint16_t* CSCDCCExaminer::buffer_start
private

Definition at line 117 of file CSCDCCExaminer.h.

Referenced by check().

ExaminerStatusType CSCDCCExaminer::bWARNING
private

Definition at line 17 of file CSCDCCExaminer.h.

Referenced by check(), clear(), and sync_stats().

uint32_t CSCDCCExaminer::CFEB_BSampleCount
private

Definition at line 95 of file CSCDCCExaminer.h.

Referenced by check(), and zeroCounts().

uint32_t CSCDCCExaminer::CFEB_CRC
private

Definition at line 102 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::CFEB_SampleCount
private

Definition at line 94 of file CSCDCCExaminer.h.

Referenced by check(), checkTriggerHeadersAndTrailers(), and zeroCounts().

uint32_t CSCDCCExaminer::CFEB_SampleWordCount
private

Definition at line 93 of file CSCDCCExaminer.h.

Referenced by check(), and zeroCounts().

bool CSCDCCExaminer::checkCrcALCT
private

Definition at line 97 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::checkCrcCFEB
private

Definition at line 101 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::checkCrcTMB
private

Definition at line 99 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

std::map<CSCIdType,uint32_t> CSCDCCExaminer::cntCHAMB_Headers

Definition at line 61 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

std::map<CSCIdType,uint32_t> CSCDCCExaminer::cntCHAMB_Trailers

Definition at line 62 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::cntDDU_Headers

Definition at line 59 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::cntDDU_Trailers

Definition at line 60 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

CSCIdType CSCDCCExaminer::currentChamber
private

Definition at line 34 of file CSCDCCExaminer.h.

Referenced by check(), checkDAVs(), checkTriggerHeadersAndTrailers(), and CSCDCCExaminer().

bool CSCDCCExaminer::DAV_ALCT
private

Definition at line 52 of file CSCDCCExaminer.h.

Referenced by check(), checkDAVs(), and CSCDCCExaminer().

int CSCDCCExaminer::DAV_CFEB
private

Definition at line 54 of file CSCDCCExaminer.h.

Referenced by check(), checkDAVs(), and CSCDCCExaminer().

int CSCDCCExaminer::DAV_DMB
private

Definition at line 55 of file CSCDCCExaminer.h.

Referenced by check().

bool CSCDCCExaminer::DAV_TMB
private

Definition at line 53 of file CSCDCCExaminer.h.

Referenced by check(), checkDAVs(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::DDU_WordCount
private

Definition at line 75 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::DDU_WordMismatch_Occurrences
private

Definition at line 76 of file CSCDCCExaminer.h.

Referenced by CSCDCCExaminer().

uint32_t CSCDCCExaminer::DDU_WordsSinceLastHeader
private

Definition at line 74 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::DDU_WordsSinceLastTrailer
private

Definition at line 77 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

std::map<DDUIdType,const uint16_t*> CSCDCCExaminer::dduBuffers
private

Definition at line 111 of file CSCDCCExaminer.h.

Referenced by check(), clear(), and DDU_block().

std::map<DDUIdType,uint32_t> CSCDCCExaminer::dduOffsets
private

Definition at line 113 of file CSCDCCExaminer.h.

Referenced by check(), clear(), and DDU_ptrOffsets().

std::map<DDUIdType,uint32_t> CSCDCCExaminer::dduSize
private

Definition at line 115 of file CSCDCCExaminer.h.

Referenced by check(), clear(), and DDU_size().

int CSCDCCExaminer::DMB_Active
private

Definition at line 56 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

std::map<DDUIdType,std::map<CSCIdType,const uint16_t*> > CSCDCCExaminer::dmbBuffers
private

Definition at line 112 of file CSCDCCExaminer.h.

Referenced by check(), clear(), and DMB_block().

std::map<DDUIdType,std::map<CSCIdType,uint32_t> > CSCDCCExaminer::dmbOffsets
private

Definition at line 114 of file CSCDCCExaminer.h.

Referenced by check(), clear(), and DMB_ptrOffsets().

std::map<DDUIdType,std::map<CSCIdType,uint32_t> > CSCDCCExaminer::dmbSize
private

Definition at line 116 of file CSCDCCExaminer.h.

Referenced by check(), clear(), and DMB_size().

ExaminerMaskType CSCDCCExaminer::examinerMask
private

Definition at line 106 of file CSCDCCExaminer.h.

Referenced by getMask(), and setMask().

bool CSCDCCExaminer::fALCT_Format2007
private

Definition at line 48 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fALCT_Header
private

Definition at line 45 of file CSCDCCExaminer.h.

Referenced by check(), checkTriggerHeadersAndTrailers(), and CSCDCCExaminer().

std::set<CSCIdType> CSCDCCExaminer::fCHAMB_ERR[29]
private
std::set<CSCIdType> CSCDCCExaminer::fCHAMB_WRN[5]
private

Definition at line 25 of file CSCDCCExaminer.h.

Referenced by chambersWithWarning(), and clear().

bool CSCDCCExaminer::fDCC_Header
private

Definition at line 39 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fDCC_Trailer
private

Definition at line 40 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fDDU_Header
private

Definition at line 41 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fDDU_Trailer
private

Definition at line 42 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fDMB_Header
private

Definition at line 43 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fDMB_Trailer
private

Definition at line 44 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fERROR[29]
private

Definition at line 19 of file CSCDCCExaminer.h.

Referenced by check(), checkDAVs(), checkTriggerHeadersAndTrailers(), clear(), and sync_stats().

bool CSCDCCExaminer::fSUM_ERROR[29]
private

Definition at line 21 of file CSCDCCExaminer.h.

Referenced by clear(), error(), and sync_stats().

bool CSCDCCExaminer::fSUM_WARNING[5]
private

Definition at line 22 of file CSCDCCExaminer.h.

Referenced by clear(), sync_stats(), and warning().

bool CSCDCCExaminer::fTMB_Format2007
private

Definition at line 47 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fTMB_Header
private

Definition at line 46 of file CSCDCCExaminer.h.

Referenced by check(), checkTriggerHeadersAndTrailers(), and CSCDCCExaminer().

bool CSCDCCExaminer::fWARNING[5]
private

Definition at line 20 of file CSCDCCExaminer.h.

Referenced by check(), clear(), and sync_stats().

bool CSCDCCExaminer::modeDDUonly
private

Definition at line 104 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

int CSCDCCExaminer::nDMBs
private

Definition at line 56 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

const uint16_t CSCDCCExaminer::nERRORS
const uint16_t CSCDCCExaminer::nPAYLOADS

Definition at line 13 of file CSCDCCExaminer.h.

Referenced by payloadName().

const uint16_t CSCDCCExaminer::nSTATUSES

Definition at line 13 of file CSCDCCExaminer.h.

Referenced by cscdqm::EventProcessor::processExaminer(), and statusName().

const uint16_t CSCDCCExaminer::nWARNINGS
uint32_t CSCDCCExaminer::nWG_round_up
private

check zero suppression mode

Definition at line 84 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

std::vector<const char*> CSCDCCExaminer::sDMBEventStaus
private

Definition at line 16 of file CSCDCCExaminer.h.

Referenced by CSCDCCExaminer(), and statusName().

std::vector<const char*> CSCDCCExaminer::sDMBExpectedPayload
private

Definition at line 16 of file CSCDCCExaminer.h.

Referenced by CSCDCCExaminer(), and payloadName().

std::vector<const char*> CSCDCCExaminer::sERROR
private

Definition at line 16 of file CSCDCCExaminer.h.

Referenced by check(), CSCDCCExaminer(), and errName().

std::vector<const char*> CSCDCCExaminer::sERROR_
private

Definition at line 16 of file CSCDCCExaminer.h.

Referenced by CSCDCCExaminer(), and errorName().

DDUIdType CSCDCCExaminer::sourceID
private

Definition at line 105 of file CSCDCCExaminer.h.

Referenced by check(), CSCDCCExaminer(), and dduSourceID().

std::vector<const char*> CSCDCCExaminer::sWARNING
private

Definition at line 16 of file CSCDCCExaminer.h.

Referenced by check(), CSCDCCExaminer(), and wrnName().

std::vector<const char*> CSCDCCExaminer::sWARNING_
private

Definition at line 16 of file CSCDCCExaminer.h.

Referenced by CSCDCCExaminer(), and warningName().

uint32_t CSCDCCExaminer::TMB_CRC
private

Definition at line 100 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::TMB_Firmware_Revision
private

Definition at line 91 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::TMB_Tbins
private

Definition at line 89 of file CSCDCCExaminer.h.

Referenced by check(), and zeroCounts().

uint32_t CSCDCCExaminer::TMB_WordCount
private

Definition at line 87 of file CSCDCCExaminer.h.

Referenced by check(), checkTriggerHeadersAndTrailers(), and zeroCounts().

uint32_t CSCDCCExaminer::TMB_WordsExpected
private

Definition at line 88 of file CSCDCCExaminer.h.

Referenced by check(), checkTriggerHeadersAndTrailers(), and zeroCounts().

uint32_t CSCDCCExaminer::TMB_WordsRPC
private

Definition at line 90 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::TMB_WordsSinceLastHeader
private

to decode if zero suppression enabled

Definition at line 86 of file CSCDCCExaminer.h.

Referenced by check(), checkTriggerHeadersAndTrailers(), and zeroCounts().

uint16_t CSCDCCExaminer::tmpbuf[16]
private

Definition at line 37 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::uniqueALCT
private

Definition at line 50 of file CSCDCCExaminer.h.

Referenced by check().

bool CSCDCCExaminer::uniqueTMB
private

Definition at line 50 of file CSCDCCExaminer.h.

Referenced by check().