CMS 3D CMS Logo

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

#include <CSCDCCExaminer.h>

Classes

class  OStream
 

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)
 
OStreamoutput1 (void)
 
OStreamoutput2 (void)
 
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
 
OStream cerr
 
uint32_t CFEB_BSampleCount
 
uint32_t CFEB_CRC
 
uint32_t CFEB_SampleCount
 
uint32_t CFEB_SampleWordCount
 
bool checkCrcALCT
 
bool checkCrcCFEB
 
bool checkCrcTMB
 
OStream cout
 
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 43 of file CSCDCCExaminer.cc.

References ALCT_CRC, ALCT_ZSE, buf0, buf1, buf2, buf_1, dtNoiseDBValidation_cfg::cerr, cerr, CFEB_CRC, checkCrcALCT, checkCrcCFEB, checkCrcTMB, clear(), cntCHAMB_Headers, cntCHAMB_Trailers, cntDDU_Headers, cntDDU_Trailers, cout, gather_cfg::cout, 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, CSCDCCExaminer::OStream::redirect(), sDMBEventStaus, sDMBExpectedPayload, sERROR, sERROR_, sourceID, sWARNING, sWARNING_, TMB_CRC, TMB_Firmware_Revision, TMB_WordsRPC, tmpbuf, and zeroCounts().

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

Definition at line 242 of file CSCDCCExaminer.h.

242 {}

Member Function Documentation

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

Definition at line 171 of file CSCDCCExaminer.h.

References fCHAMB_ERR, and nERRORS.

171 { if(num>=0&&num<nERRORS) return fCHAMB_ERR[num]; else return std::set<int>(); }
std::set< CSCIdType > fCHAMB_ERR[29]
const uint16_t nERRORS
long long int num
Definition: procUtils.cc:71
std::set<CSCIdType> CSCDCCExaminer::chambersWithWarning ( int  num) const
inline

Definition at line 172 of file CSCDCCExaminer.h.

References fCHAMB_WRN, and nWARNINGS.

172 { if(num>=0&&num<nWARNINGS) return fCHAMB_WRN[num]; else return std::set<int>(); }
const uint16_t nWARNINGS
std::set< CSCIdType > fCHAMB_WRN[5]
long long int num
Definition: procUtils.cc:71
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:

std::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 211 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, pos, scanbuf(), sERROR, sourceID, sWARNING, sync_stats(), lumiQTWidget::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().

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

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

Referenced by check().

1395 {
1396  if( DAV_ALCT ){
1397  fERROR[21] = true;
1398  bERROR |= 0x200000;
1399  fCHAMB_ERR[21].insert(currentChamber);
1400  bCHAMB_ERR[currentChamber] |= 0x200000;
1401  DAV_ALCT = false;
1402  }
1403  if( DAV_TMB ){
1404  fERROR[22] = true;
1405  bERROR |= 0x400000;
1406  fCHAMB_ERR[22].insert(currentChamber);
1407  bCHAMB_ERR[currentChamber] |= 0x400000;
1408  DAV_TMB = false;
1409  }
1410  if( DAV_CFEB && DAV_CFEB!=-16){
1411  fERROR[23] = true;
1412  bERROR |= 0x800000;
1413  fCHAMB_ERR[23].insert(currentChamber);
1414  bCHAMB_ERR[currentChamber] |= 0x800000;
1415  DAV_CFEB = 0;
1416  }
1417 }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_ERR
std::set< CSCIdType > fCHAMB_ERR[29]
CSCIdType currentChamber
ExaminerStatusType bERROR
void CSCDCCExaminer::checkTriggerHeadersAndTrailers ( )
private

Definition at line 1420 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().

1421 { /*
1422  std::cout << " Ex-ALCT-Word-count " << std::endl;
1423  std::cout << " ALCT Words Since Last Header: " << ALCT_WordsSinceLastHeader << std::endl;
1424  std::cout << " ALCT Word Count: " << ALCT_WordCount << std::endl;
1425  std::cout << " ALCT Words Expected: " << ALCT_WordsExpected << std::endl;
1426  */
1428  && ALCT_ZSE==0 ){
1429  fERROR[9] = true;
1430  bERROR |= 0x200;
1431  fCHAMB_ERR[9].insert(currentChamber);
1432  bCHAMB_ERR[currentChamber] |= 0x200;
1434  ALCT_WordCount = 0;
1436  ALCT_WordsExpected = 0;
1437  } // ALCT Word Count Error
1438 
1441  fERROR[9] = true;
1442  bERROR |= 0x200;
1443  fCHAMB_ERR[9].insert(currentChamber);
1444  bCHAMB_ERR[currentChamber] |= 0x200;
1447  ALCT_WordCount = 0;
1449  ALCT_WordsExpected = 0;
1450  } // ALCT Word Count Error With zero suppression
1451 
1453  fERROR[14] = true;
1454  bERROR |= 0x4000;
1455  fCHAMB_ERR[14].insert(currentChamber);
1456  bCHAMB_ERR[currentChamber] |= 0x4000;
1458  TMB_WordCount = 0;
1460  TMB_WordsExpected = 0;
1461  } // TMB Word Count Error
1462 
1463  if( (CFEB_SampleCount%8)!=0 ){
1464  fERROR[17] = true;
1465  bERROR |= 0x20000;
1466  fCHAMB_ERR[17].insert(currentChamber);
1467  bCHAMB_ERR[currentChamber] |= 0x20000;
1468  CFEB_SampleCount = 0;
1469  } // Number of CFEB samples != 8*n
1470 
1471  if(fALCT_Header) {
1472  fERROR[7] = true; // ALCT Trailer is missing
1473  bERROR |= 0x80;
1474  fCHAMB_ERR[7].insert(currentChamber);
1475  bCHAMB_ERR[currentChamber] |= 0x80;
1478  ALCT_WordsExpected = 0;
1479  fALCT_Header = 0;
1480  }
1481 
1482  if(fTMB_Header) {
1483  fERROR[12]=true; // TMB Trailer is missing
1484  bERROR |= 0x1000;
1485  fCHAMB_ERR[12].insert(currentChamber);
1486  bCHAMB_ERR[currentChamber] |= 0x1000;
1488  TMB_WordsExpected = 0;
1489  fTMB_Header = false;
1490  }
1491 }
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 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 1350 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().

1351 {
1352  bzero(fERROR, sizeof(bool)*nERRORS);
1353  bzero(fWARNING, sizeof(bool)*nWARNINGS);
1354  bzero(fSUM_ERROR, sizeof(bool)*nERRORS);
1355  bzero(fSUM_WARNING, sizeof(bool)*nWARNINGS);
1356  bERROR = 0;
1357  bWARNING = 0;
1358  bSUM_ERROR = 0;
1359  bSUM_WARNING = 0;
1360  for(int err=0; err<nERRORS; ++err) fCHAMB_ERR[err].clear();
1361  for(int wrn=0; wrn<nWARNINGS; ++wrn) fCHAMB_WRN[wrn].clear();
1362  bCHAMB_ERR.clear();
1363  bCHAMB_WRN.clear();
1364  bCHAMB_PAYLOAD.clear();
1365  bCHAMB_STATUS.clear();
1366  bDDU_ERR.clear();
1367  bDDU_WRN.clear();
1368  dduBuffers.clear();
1369  dduOffsets.clear();
1370  dmbBuffers.clear();
1371  dmbOffsets.clear();
1372  dduSize.clear();
1373  dmbSize.clear();
1374 }
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 6 of file CSCDCCExaminer.cc.

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

6  {
7  checkCrcALCT = enable;
8  if( checkCrcALCT )
9  sERROR[10] = "ALCT CRC Error ";
10  else
11  sERROR[10] = "ALCT CRC Error ( disabled ) ";
12 }
std::vector< const char * > sERROR
void CSCDCCExaminer::crcCFEB ( bool  enable)

Definition at line 22 of file CSCDCCExaminer.cc.

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

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

Definition at line 14 of file CSCDCCExaminer.cc.

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

14  {
15  checkCrcTMB = enable;
16  if( checkCrcTMB )
17  sERROR[15] = "TMB CRC Error ";
18  else
19  sERROR[15] = "TMB CRC Error ( disabled ) ";
20 }
std::vector< const char * > sERROR
std::map<DDUIdType,const uint16_t*> CSCDCCExaminer::DDU_block ( void  ) const
inline

Definition at line 232 of file CSCDCCExaminer.h.

References dduBuffers.

Referenced by CSCDDUEventData::unpack_data().

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

Definition at line 235 of file CSCDCCExaminer.h.

References dduOffsets.

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

Definition at line 238 of file CSCDCCExaminer.h.

References dduSize.

Referenced by CSCDDUEventData::unpack_data().

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

Definition at line 230 of file CSCDCCExaminer.h.

References sourceID.

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

Definition at line 233 of file CSCDCCExaminer.h.

References dmbBuffers.

Referenced by CSCDDUEventData::unpack_data().

233 { 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 236 of file CSCDCCExaminer.h.

References dmbOffsets.

236 { 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 239 of file CSCDCCExaminer.h.

References dmbSize.

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

Definition at line 159 of file CSCDCCExaminer.h.

References nERRORS, and sERROR.

Referenced by CSCDCCUnpacker::produce().

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

Definition at line 162 of file CSCDCCExaminer.h.

References nERRORS, and sERROR_.

162 { if(num>=0&&num<nERRORS) return sERROR_[num]; else return ""; }
const uint16_t nERRORS
long long int num
Definition: procUtils.cc:71
std::vector< const char * > sERROR_
ExaminerStatusType CSCDCCExaminer::errors ( void  ) const
inline

Definition at line 156 of file CSCDCCExaminer.h.

References bSUM_ERROR.

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

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

Definition at line 217 of file CSCDCCExaminer.h.

References bCHAMB_ERR.

Referenced by CSCDCCUnpacker::produce().

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

Definition at line 215 of file CSCDCCExaminer.h.

References bDDU_ERR.

Referenced by CSCDCCUnpacker::produce().

215 { 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 184 of file CSCDCCExaminer.h.

References bCHAMB_ERR.

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

184  {
185  std::map<CSCIdType,ExaminerStatusType>::const_iterator item = bCHAMB_ERR.find(chamber);
187 
188  // for(item =bCHAMB_ERR.begin() ; item !=bCHAMB_ERR.end() ; item++)
189  //std::cout << " Ex-errors: " << std::hex << (*item).second << std::dec << std::endl;
190 
191  item = bCHAMB_ERR.find(chamber);
192  if( item != bCHAMB_ERR.end() ) return item->second; else return 0;
193  }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_ERR
ExaminerStatusType CSCDCCExaminer::errorsForDDU ( DDUIdType  dduSourceID) const
inline

Definition at line 200 of file CSCDCCExaminer.h.

References bDDU_ERR.

200  {
201  std::map<DDUIdType,ExaminerStatusType>::const_iterator item = bDDU_ERR.find(dduSourceID);
202  if( item != bDDU_ERR.end() ) return item->second; else return 0;
203  }
DDUIdType dduSourceID(void)
std::map< DDUIdType, ExaminerStatusType > bDDU_ERR
ExaminerMaskType CSCDCCExaminer::getMask ( ) const
inline

Definition at line 154 of file CSCDCCExaminer.h.

References examinerMask.

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

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

Definition at line 208 of file CSCDCCExaminer.h.

References bDDU_ERR.

208  {
209  std::vector<DDUIdType> DDUs;
210  std::map<DDUIdType,ExaminerStatusType>::const_iterator item = bDDU_ERR.begin();
211  while( item != bDDU_ERR.end() ){ DDUs.push_back(item->first); item++; }
212  return DDUs;
213  }
std::map< DDUIdType, ExaminerStatusType > bDDU_ERR
void CSCDCCExaminer::modeDDU ( bool  enable)

Definition at line 30 of file CSCDCCExaminer.cc.

30  {
31  modeDDUonly = enable;
32  if( modeDDUonly) {
33  sERROR[25] = "DCC Trailer Missing ";
34  sERROR[26] = "DCC Header Missing ";
35  } else {
36  sERROR[25] = "DCC Trailer Missing (disabled) ";
37  sERROR[26] = "DCC Header Missing (disabled) ";
38  }
39 
40 }
std::vector< const char * > sERROR
OStream& CSCDCCExaminer::output1 ( void  )
inline

Definition at line 148 of file CSCDCCExaminer.h.

References cout.

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

148 { return cout; }
OStream& CSCDCCExaminer::output2 ( void  )
inline

Definition at line 149 of file CSCDCCExaminer.h.

References cerr.

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

149 { return cerr; }
std::map<CSCIdType,ExaminerStatusType> CSCDCCExaminer::payloadDetailed ( void  ) const
inline

Definition at line 219 of file CSCDCCExaminer.h.

References bCHAMB_PAYLOAD.

Referenced by CSCDCCUnpacker::produce().

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

Definition at line 174 of file CSCDCCExaminer.h.

References bCHAMB_PAYLOAD.

174  {
175  std::map<CSCIdType,ExaminerStatusType>::const_iterator item = bCHAMB_PAYLOAD.find(chamber);
176  if( item != bCHAMB_PAYLOAD.end() ) return item->second; else return 0;
177  }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_PAYLOAD
const char* CSCDCCExaminer::payloadName ( int  num) const
inline

Definition at line 165 of file CSCDCCExaminer.h.

References nPAYLOADS, and sDMBExpectedPayload.

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

Definition at line 1503 of file CSCDCCExaminer.cc.

References i.

Referenced by check().

1504 {
1505  for (int i=0; i<length; i++)
1506  {
1507  if ( (buffer[i]&mask) == sig) {
1508  return i;
1509  }
1510  }
1511  return -1;
1512 }
int i
Definition: DBlmapReader.cc:9
void CSCDCCExaminer::setMask ( ExaminerMaskType  mask)
inline

Definition at line 153 of file CSCDCCExaminer.h.

References examinerMask.

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

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

Definition at line 220 of file CSCDCCExaminer.h.

References bCHAMB_STATUS.

Referenced by CSCDCCUnpacker::produce().

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

Definition at line 179 of file CSCDCCExaminer.h.

References bCHAMB_STATUS.

179  {
180  std::map<CSCIdType,ExaminerStatusType>::const_iterator item = bCHAMB_STATUS.find(chamber);
181  if( item != bCHAMB_STATUS.end() ) return item->second; else return 0;
182  }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_STATUS
const char* CSCDCCExaminer::statusName ( int  num) const
inline

Definition at line 166 of file CSCDCCExaminer.h.

References nSTATUSES, and sDMBEventStaus.

166 { if(num>=0&&num<nSTATUSES) return sDMBEventStaus [num]; else return ""; }
const uint16_t nSTATUSES
long long int num
Definition: procUtils.cc:71
std::vector< const char * > sDMBEventStaus
void CSCDCCExaminer::sync_stats ( )
inlineprivate

Definition at line 1493 of file CSCDCCExaminer.cc.

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

Referenced by check().

1494 {
1495  for (int err=0; err<nERRORS; ++err)
1496  fSUM_ERROR[err] |= fERROR[err];
1497  for (int wrn=0; wrn<nWARNINGS; ++wrn)
1498  fSUM_WARNING[wrn] |= fWARNING[wrn];
1499  bSUM_ERROR |= bERROR;
1501 }
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 169 of file CSCDCCExaminer.h.

References fSUM_WARNING, and nWARNINGS.

169 { if(num>=0&&num<nWARNINGS) return fSUM_WARNING[num]; else return 0; }
const uint16_t nWARNINGS
bool fSUM_WARNING[5]
long long int num
Definition: procUtils.cc:71
const char* CSCDCCExaminer::warningName ( int  num) const
inline

Definition at line 163 of file CSCDCCExaminer.h.

References nWARNINGS, and sWARNING_.

163 { if(num>=0&&num<nWARNINGS) return sWARNING_[num]; else return ""; }
const uint16_t nWARNINGS
std::vector< const char * > sWARNING_
long long int num
Definition: procUtils.cc:71
ExaminerStatusType CSCDCCExaminer::warnings ( void  ) const
inline

Definition at line 157 of file CSCDCCExaminer.h.

References bSUM_WARNING.

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

Definition at line 218 of file CSCDCCExaminer.h.

References bCHAMB_WRN.

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

Definition at line 195 of file CSCDCCExaminer.h.

References bCHAMB_WRN.

195  {
196  std::map<CSCIdType,ExaminerStatusType>::const_iterator item = bCHAMB_WRN.find(chamber);
197  if( item != bCHAMB_WRN.end() ) return item->second; else return 0;
198  }
std::map< CSCIdType, ExaminerStatusType > bCHAMB_WRN
ExaminerStatusType CSCDCCExaminer::warningsForDDU ( DDUIdType  dduSourceID) const
inline

Definition at line 204 of file CSCDCCExaminer.h.

References bDDU_WRN.

204  {
205  std::map<DDUIdType,ExaminerStatusType>::const_iterator item = bDDU_WRN.find(dduSourceID);
206  if( item != bDDU_WRN.end() ) return item->second; else return 0;
207  }
DDUIdType dduSourceID(void)
std::map< DDUIdType, ExaminerStatusType > bDDU_WRN
const char* CSCDCCExaminer::wrnName ( int  num) const
inline

Definition at line 160 of file CSCDCCExaminer.h.

References nWARNINGS, and sWARNING.

160 { if(num>=0&&num<nWARNINGS) return sWARNING[num]; else return ""; }
const uint16_t nWARNINGS
std::vector< const char * > sWARNING
long long int num
Definition: procUtils.cc:71
void CSCDCCExaminer::zeroCounts ( )
private

Definition at line 1377 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().

1378 {
1381  ALCT_WordCount = 0;
1382  ALCT_WordsExpected = 0;
1383  ALCT_ZSE = 0;
1385  TMB_WordCount = 0;
1386  TMB_WordsExpected = 0;
1387  TMB_Tbins = 0;
1389  CFEB_SampleCount = 0;
1390  CFEB_BSampleCount = 0;
1391 }
uint32_t TMB_WordCount
uint32_t CFEB_SampleWordCount
uint32_t ALCT_WordsSinceLastHeader
uint32_t ALCT_WordCount
uint32_t ALCT_WordsExpected
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 126 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::ALCT_WordCount
private

Definition at line 109 of file CSCDCCExaminer.h.

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

uint32_t CSCDCCExaminer::ALCT_WordsExpected
private

Definition at line 110 of file CSCDCCExaminer.h.

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

uint32_t CSCDCCExaminer::ALCT_WordsSinceLastHeader
private

Definition at line 107 of file CSCDCCExaminer.h.

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

uint32_t CSCDCCExaminer::ALCT_WordsSinceLastHeaderZeroSuppressed
private

Definition at line 108 of file CSCDCCExaminer.h.

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

uint32_t CSCDCCExaminer::ALCT_ZSE
private
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 64 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

const uint16_t * CSCDCCExaminer::buf1
private

Definition at line 64 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

const uint16_t * CSCDCCExaminer::buf2
private

Definition at line 64 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

const uint16_t * CSCDCCExaminer::buf_1
private

Definition at line 64 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

const uint16_t* CSCDCCExaminer::buf_2
private

Definition at line 64 of file CSCDCCExaminer.h.

Referenced by check().

const uint16_t* CSCDCCExaminer::buffer_start
private

Definition at line 145 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().

OStream CSCDCCExaminer::cerr
private

Definition at line 60 of file CSCDCCExaminer.h.

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

uint32_t CSCDCCExaminer::CFEB_BSampleCount
private

Definition at line 123 of file CSCDCCExaminer.h.

Referenced by check(), and zeroCounts().

uint32_t CSCDCCExaminer::CFEB_CRC
private

Definition at line 130 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::CFEB_SampleCount
private

Definition at line 122 of file CSCDCCExaminer.h.

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

uint32_t CSCDCCExaminer::CFEB_SampleWordCount
private

Definition at line 121 of file CSCDCCExaminer.h.

Referenced by check(), and zeroCounts().

bool CSCDCCExaminer::checkCrcALCT
private

Definition at line 125 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::checkCrcCFEB
private

Definition at line 129 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::checkCrcTMB
private

Definition at line 127 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

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

Definition at line 89 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

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

Definition at line 90 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::cntDDU_Headers

Definition at line 87 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::cntDDU_Trailers

Definition at line 88 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

OStream CSCDCCExaminer::cout
private

Definition at line 60 of file CSCDCCExaminer.h.

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

CSCIdType CSCDCCExaminer::currentChamber
private

Definition at line 62 of file CSCDCCExaminer.h.

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

bool CSCDCCExaminer::DAV_ALCT
private

Definition at line 80 of file CSCDCCExaminer.h.

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

int CSCDCCExaminer::DAV_CFEB
private

Definition at line 82 of file CSCDCCExaminer.h.

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

int CSCDCCExaminer::DAV_DMB
private

Definition at line 83 of file CSCDCCExaminer.h.

Referenced by check().

bool CSCDCCExaminer::DAV_TMB
private

Definition at line 81 of file CSCDCCExaminer.h.

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

uint32_t CSCDCCExaminer::DDU_WordCount
private

Definition at line 103 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::DDU_WordMismatch_Occurrences
private

Definition at line 104 of file CSCDCCExaminer.h.

Referenced by CSCDCCExaminer().

uint32_t CSCDCCExaminer::DDU_WordsSinceLastHeader
private

Definition at line 102 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::DDU_WordsSinceLastTrailer
private

Definition at line 105 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

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

Definition at line 139 of file CSCDCCExaminer.h.

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

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

Definition at line 141 of file CSCDCCExaminer.h.

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

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

Definition at line 143 of file CSCDCCExaminer.h.

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

int CSCDCCExaminer::DMB_Active
private

Definition at line 84 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

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

Definition at line 140 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 142 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 144 of file CSCDCCExaminer.h.

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

ExaminerMaskType CSCDCCExaminer::examinerMask
private

Definition at line 134 of file CSCDCCExaminer.h.

Referenced by getMask(), and setMask().

bool CSCDCCExaminer::fALCT_Format2007
private

Definition at line 76 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fALCT_Header
private

Definition at line 73 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 67 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fDCC_Trailer
private

Definition at line 68 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fDDU_Header
private

Definition at line 69 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fDDU_Trailer
private

Definition at line 70 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fDMB_Header
private

Definition at line 71 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fDMB_Trailer
private

Definition at line 72 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 75 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::fTMB_Header
private

Definition at line 74 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 132 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

int CSCDCCExaminer::nDMBs
private

Definition at line 84 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 112 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 133 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 128 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::TMB_Firmware_Revision
private

Definition at line 119 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::TMB_Tbins
private

Definition at line 117 of file CSCDCCExaminer.h.

Referenced by check(), and zeroCounts().

uint32_t CSCDCCExaminer::TMB_WordCount
private

Definition at line 115 of file CSCDCCExaminer.h.

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

uint32_t CSCDCCExaminer::TMB_WordsExpected
private

Definition at line 116 of file CSCDCCExaminer.h.

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

uint32_t CSCDCCExaminer::TMB_WordsRPC
private

Definition at line 118 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

uint32_t CSCDCCExaminer::TMB_WordsSinceLastHeader
private

to decode if zero suppression enabled

Definition at line 114 of file CSCDCCExaminer.h.

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

uint16_t CSCDCCExaminer::tmpbuf[16]
private

Definition at line 65 of file CSCDCCExaminer.h.

Referenced by check(), and CSCDCCExaminer().

bool CSCDCCExaminer::uniqueALCT
private

Definition at line 78 of file CSCDCCExaminer.h.

Referenced by check().

bool CSCDCCExaminer::uniqueTMB
private

Definition at line 78 of file CSCDCCExaminer.h.

Referenced by check().