CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCDQM_EventProcessor_processExaminer.cc
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: EventProcessor.cc
5  *
6  * Description: Process Examiner output
7  *
8  * Version: 1.0
9  * Created: 10/03/2008 10:47:11 AM
10  * Revision: none
11  * Compiler: gcc
12  *
13  * Author: Valdas Rapsevicius (VR), Valdas.Rapsevicius@cern.ch
14  * Company: CERN, CH
15  *
16  * =====================================================================================
17  */
18 
20 
21 namespace cscdqm {
22 
28 
29  bool eventAccepted = true;
30  MonitorObject* mo = 0;
31 
32  uint32_t binErrorStatus = digi.getDDUSummaryErrors();
33 
34  if (getEMUHisto(h::EMU_ALL_DDUS_FORMAT_ERRORS, mo)) {
35 
36  const std::set<DDUIdType> DDUs = digi.getListOfDDUs();
37  for (std::set<DDUIdType>::const_iterator ddu_itr = DDUs.begin(); ddu_itr != DDUs.end(); ++ddu_itr) {
38  ExaminerStatusType errs = digi.getDDUErrors(*ddu_itr);
39  int dduID = (*ddu_itr)&0xFF;
40  if (errs != 0) {
41  for(int i = 0; i < 29; i++) {
42  if ((errs >> i) & 0x1 ) {
43  mo->Fill(dduID, i + 1);
44  }
45  }
46  } else {
47  mo->Fill(dduID, 0);
48  }
49  }
50 
51  }
52 
53  // =VB= We want to use DCC level check mask as in CSCDCCUnpacker and not DDU mask
54  // Otherwise whole DCC event could be skipped because of a single chamber error
55  unsigned long dccBinCheckMask = 0x06080016;
56 // if ((binErrorStatus & config->getDDU_BINCHECK_MASK()) > 0) {
57  if ((binErrorStatus & dccBinCheckMask) > 0) {
58  eventAccepted = false;
59  }
60 
61  if (binErrorStatus != 0) {
63  }
64 
67  {
68  uint32_t i = 0;
69  CSCIdType chamberID = 0;
70  while (digi.nextCSCWithPayload(i, chamberID)) {
71 
72  int crateID = (chamberID >> 4) & 0xFF;
73  int dmbSlot = chamberID & 0xF;
74 
75  if (crateID == 255) { continue; }
76 
77  // Check if in standby!
78  {
79  CSCDetId cid;
80  if (!config->fnGetCSCDetId(crateID, dmbSlot, cid)) {
81  continue;
82  }
83  }
84 
86  config->incChamberCounter(DMB_EVENTS, crateID, dmbSlot);
87  long DMBEvents = config->getChamberCounterValue(DMB_EVENTS, crateID, dmbSlot);
89  cntDMBs++;
90 
91  if (getEMUHisto(h::EMU_DMB_REPORTING, mo)) {
92  mo->Fill(crateID, dmbSlot);
93  }
94 
95  unsigned int cscType = 0;
96  unsigned int cscPosition = 0;
97  if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;
98 
99  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_REPORTING, mo)) {
100  mo->Fill(cscPosition, cscType);
101  }
102 
104  long payload = digi.getCSCPayload(chamberID);
105  int cfeb_dav = (payload >> 7) & 0x1F;
106  int cfeb_active = payload & 0x1F;
107  int alct_dav = (payload >> 5) & 0x1;
108  int tmb_dav = (payload >> 6) & 0x1;
109  int cfeb_dav_num = 0;
110 
111  if (alct_dav == 0) {
112  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_WO_ALCT, mo)) {
113  mo->Fill(cscPosition, cscType);
114  }
115  if (getEMUHisto(h::EMU_DMB_WO_ALCT, mo)) {
116  mo->Fill(crateID, dmbSlot);
117  }
118  }
119 
120  if (tmb_dav == 0) {
121  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_WO_CLCT, mo)) {
122  mo->Fill(cscPosition, cscType);
123  }
124  if (getEMUHisto(h::EMU_DMB_WO_CLCT, mo)) {
125  mo->Fill(crateID, dmbSlot);
126  }
127  }
128 
129  if (cfeb_dav == 0) {
130  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_WO_CFEB, mo)) {
131  mo->Fill(cscPosition, cscType);
132  }
133  if (getEMUHisto(h::EMU_DMB_WO_CFEB, mo)) {
134  mo->Fill(crateID, dmbSlot);
135  }
136  }
137 
139  for (int i=0; i<5;i++) {
140  if ((cfeb_dav>>i) & 0x1) cntCFEBs++;
141  }
142 
143  if (alct_dav > 0) {
144  cntALCTs++;
145  }
146 
147  if (tmb_dav > 0) {
148  cntTMBs++;
149  }
150 
151 
152  MonitorObject *mof = 0, *mo1 = 0, *mo2 = 0;
153  if (getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_RATE, crateID, dmbSlot, mo)
154  && getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_FREQUENCY, crateID, dmbSlot, mof)) {
155  if (getCSCHisto(h::CSC_DMB_CFEB_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mo1)
156  && getCSCHisto(h::CSC_DMB_CFEB_DAV, crateID, dmbSlot, mo2)) {
157  for (int i=1; i<=5; i++) {
158  double actual_dav_num = mo->GetBinContent(i);
159  double unpacked_dav_num = mo2->GetBinContent(i);
160  if (actual_dav_num){
161  mo1->SetBinContent(i,1, 100.*(1-unpacked_dav_num/actual_dav_num));
162  }
163  mo1->SetEntries((int)DMBEvents);
164  }
165  }
166  for (int i=0; i<5;i++) {
167  int cfeb_present = (cfeb_dav>>i) & 0x1;
168  cfeb_dav_num += cfeb_present;
169  if (cfeb_present) {
170  mo->Fill(i);
171  }
172  float cfeb_entries = mo->GetBinContent(i+1);
173  mof->SetBinContent(i+1, ((float)cfeb_entries/(float)(DMBEvents)*100.0));
174  }
175  mof->SetEntries((int)DMBEvents);
176  }
177 
178  if (getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_MULTIPLICITY_RATE, crateID, dmbSlot, mo)
179  && getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_MULTIPLICITY_FREQUENCY, crateID, dmbSlot, mof)) {
180  for (unsigned short i = 1; i < 7; i++) {
181  float cfeb_entries = mo->GetBinContent(i);
182  mof->SetBinContent(i, ((float)cfeb_entries / (float)(DMBEvents) * 100.0));
183  }
184  mof->SetEntries((int)DMBEvents);
185 
186  if (getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mo1)
187  && getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY, crateID, dmbSlot, mo2)) {
188  for (unsigned short i = 1; i < 7; i++) {
189  float actual_dav_num = mo->GetBinContent(i);
190  float unpacked_dav_num = mo2->GetBinContent(i);
191  if (actual_dav_num){
192  mo1->SetBinContent(i, 1, 100. * (1-unpacked_dav_num/actual_dav_num));
193  }
194  mo1->SetEntries((int)DMBEvents);
195  }
196  }
197  mo->Fill(cfeb_dav_num);
198  }
199 
200  if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE_VS_DAV, crateID, dmbSlot, mo)) mo->Fill(cfeb_dav, cfeb_active);
201 
203  if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_DAV_RATE, crateID, dmbSlot, mo)) {
204  if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_DAV_FREQUENCY, crateID, dmbSlot, mo1)) {
205  for (int i = 1; i < 4; i++) {
206  float dav_num = mo->GetBinContent(i);
207  mo1->SetBinContent(i, ((float)dav_num / (float)(DMBEvents) * 100.0));
208  }
209  mo1->SetEntries((int)DMBEvents);
210 
211  if (getCSCHisto(h::CSC_DMB_FEB_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mof)
212  && getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbSlot, mo2)) {
213  for (int i = 1; i < 4; i++) {
214  float actual_dav_num = mo->GetBinContent(i);
215  float unpacked_dav_num = mo2->GetBinContent(i);
216  if (actual_dav_num){
217  mof->SetBinContent(i,1, 100. * (1 - unpacked_dav_num / actual_dav_num));
218  }
219  mof->SetEntries((int)DMBEvents);
220  mof->SetMaximum(100.0);
221  }
222  }
223  }
224 
225  if (alct_dav > 0) {
226  mo->Fill(0.0);
227  }
228  if (tmb_dav > 0) {
229  mo->Fill(1.0);
230  }
231  if (cfeb_dav > 0) {
232  mo->Fill(2.0);
233  }
234  }
235 
236 
237  float feb_combination_dav = -1.0;
239  if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbSlot, mo)) {
240  if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav == 0) feb_combination_dav = 0.0; // Nothing
241  if(alct_dav > 0 && tmb_dav == 0 && cfeb_dav == 0) feb_combination_dav = 1.0; // ALCT Only
242  if(alct_dav == 0 && tmb_dav > 0 && cfeb_dav == 0) feb_combination_dav = 2.0; // TMB Only
243  if(alct_dav == 0 && tmb_dav == 0 && cfeb_dav > 0) feb_combination_dav = 3.0; // CFEB Only
244  if(alct_dav == 0 && tmb_dav > 0 && cfeb_dav > 0) feb_combination_dav = 4.0; // TMB+CFEB
245  if(alct_dav > 0 && tmb_dav > 0 && cfeb_dav == 0) feb_combination_dav = 5.0; // ALCT+TMB
246  if(alct_dav > 0 && tmb_dav == 0 && cfeb_dav > 0) feb_combination_dav = 6.0; // ALCT+CFEB
247  if(alct_dav > 0 && tmb_dav > 0 && cfeb_dav > 0) feb_combination_dav = 7.0; // ALCT+TMB+CFEB
248  // mo->Fill(feb_combination_dav);
249 
250  if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_COMBINATIONS_DAV_FREQUENCY, crateID, dmbSlot, mo1)) {
251  for (int i = 1; i < 9; i++) {
252  float feb_combination_dav_number = mo->GetBinContent(i);
253  mo1->SetBinContent(i, ((float)feb_combination_dav_number / (float)(DMBEvents) * 100.0));
254  }
255  mo1->SetEntries(DMBEvents);
256 
257  if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mof)
258  && getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbSlot, mo2)) {
259  for (int i = 1; i < 9; i++) {
260  float actual_dav_num = mo->GetBinContent(i);
261  float unpacked_dav_num = mo2->GetBinContent(i);
262  if (actual_dav_num){
263  mof->SetBinContent(i, 1, 100. * (1 - unpacked_dav_num / actual_dav_num));
264  }
265  mof->SetEntries((int)DMBEvents);
266  mof->SetMaximum(100.0);
267  }
268  }
269 
270  }
271  mo->Fill(feb_combination_dav);
272  }
273 
274  }
275  }
276 
279  {
280  uint32_t i = 0;
281  CSCIdType chamberID = 0;
282  while (digi.nextCSCWithStatus(i, chamberID)) {
283 
284  unsigned int crateID = (chamberID >> 4) & 0xFF;
285  unsigned int dmbSlot = chamberID & 0xF;
286  ExaminerStatusType chStatus = digi.getCSCStatus(chamberID);
287 
288  if (crateID == 255) { continue; }
289 
290  // Check if in standby!
291  {
292  CSCDetId cid;
293  if (!config->fnGetCSCDetId(crateID, dmbSlot, cid)) {
294  continue;
295  }
296  }
297 
298  unsigned int cscType = 0;
299  unsigned int cscPosition = 0;
300  if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;
301 
302  if (getCSCHisto(h::CSC_BINCHECK_DATAFLOW_PROBLEMS_TABLE, crateID, dmbSlot, mo)) {
303  for (int bit = 0; bit < binChecker.nSTATUSES; bit++) {
304  if (chStatus & (1<<bit) ) {
305  mo->Fill(0., bit);
306  }
307  }
308  mo->SetEntries(config->getChamberCounterValue(DMB_EVENTS, crateID, dmbSlot));
309  }
310 
311 
312  int anyInputFull = chStatus & 0x3F;
313  if (anyInputFull) {
314  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_DMB_INPUT_FIFO_FULL, mo)) {
315  mo->Fill(cscPosition, cscType);
316  }
317  if (getEMUHisto(h::EMU_DMB_INPUT_FIFO_FULL, mo)) {
318  mo->Fill(crateID, dmbSlot);
319  }
320  }
321 
322  int anyInputTO = (chStatus >> 7) & 0x3FFF;
323  if (anyInputTO) {
324  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_DMB_INPUT_TIMEOUT, mo)) {
325  mo->Fill(cscPosition, cscType);
326  }
327  if (getEMUHisto(h::EMU_DMB_INPUT_TIMEOUT, mo)) {
328  mo->Fill(crateID, dmbSlot);
329  }
330  }
331 
332  if (digi.getCSCStatus(chamberID) & (1 << 22)) {
333  if (getEMUHisto(h::EMU_DMB_FORMAT_WARNINGS, mo)) {
334  mo->Fill(crateID, dmbSlot);
335  }
336 
337  if (cscType && cscPosition && getEMUHisto(h::EMU_CSC_FORMAT_WARNINGS, mo)) {
338  mo->Fill(cscPosition, cscType);
339  }
340 
341  }
342  }
343 
344  }
345 
348  {
349  uint32_t i = 0;
350  CSCIdType chamberID = 0;
351  while (digi.nextCSCWithError(i, chamberID)) {
352 
353  const unsigned int crateID = (chamberID >> 4) & 0xFF;
354  const unsigned int dmbSlot = chamberID & 0xF;
355  const ExaminerStatusType chErr = digi.getCSCErrors(chamberID);
356 
357  if ((crateID ==255) || (chErr & 0x80)) { continue; } // = Skip chamber detection if DMB header is missing (Error code 6)
358 
359  if (crateID > 60 || dmbSlot > 10) { continue; }
360 
361  // Check if in standby!
362  {
363  CSCDetId cid;
364  if (!config->fnGetCSCDetId(crateID, dmbSlot, cid)) {
365  continue;
366  }
367  }
368 
369  if ((chErr & config->getBINCHECK_MASK()) != 0) {
370  config->incChamberCounter(BAD_EVENTS, crateID , dmbSlot);
371  }
372 
373  bool isCSCError = false;
374  bool fillBC = getCSCHisto(h::CSC_BINCHECK_ERRORSTAT_TABLE, crateID, dmbSlot, mo);
375 
376  for (int bit = 5; bit < 24; bit++) {
377 
378  if (chErr & (1 << bit) ) {
379  isCSCError = true;
380  if (fillBC) {
381  mo->Fill(0., bit - 5);
382  } else {
383  break;
384  }
385  }
386 
387  if (fillBC) {
388  mo->SetEntries(config->getChamberCounterValue(DMB_EVENTS, crateID , dmbSlot));
389  }
390 
391  }
392 
393  if (isCSCError) {
394 
395  if (getEMUHisto(h::EMU_DMB_FORMAT_ERRORS, mo)) {
396  mo->Fill(crateID, dmbSlot);
397  }
398 
399  if (eventAccepted && getEMUHisto(h::EMU_DMB_UNPACKED_WITH_ERRORS, mo)) {
400  mo->Fill(crateID, dmbSlot);
401  }
402 
403  unsigned int cscType = 0;
404  unsigned int cscPosition = 0;
405  if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition)) continue;
406 
407  if ( cscType && cscPosition && getEMUHisto(h::EMU_CSC_FORMAT_ERRORS, mo)) {
408  mo->Fill(cscPosition, cscType);
409  }
410 
411  if (eventAccepted && cscType && cscPosition && getEMUHisto(h::EMU_CSC_UNPACKED_WITH_ERRORS, mo)) {
412  mo->Fill(cscPosition, cscType);
413  }
414  }
415 
416  }
417  }
418 
419  return eventAccepted;
420 
421  }
422 
423 }
const uint16_t nSTATUSES
const bool getCSCFromMap(const unsigned int &crateId, const unsigned int &dmbId, unsigned int &cscType, unsigned int &cscPosition) const
Get CSC type and position from crate and dmb identifiers.
int i
Definition: DBlmapReader.cc:9
uint32_t cntCFEBs
Total Number of DMBs per event from DDU Header DAV.
void incChamberCounter(const ChamberCounterType counter, const HwId crateId, const HwId dmbId)
Increment Chamber counter by 1.
virtual void SetEntries(const double value)=0
int32_t CSCIdType
virtual void Fill(float x)=0
ExaminerStatusType getDDUSummaryErrors() const
Monitoring Object interface used to cover Root object and provide common interface to EventProcessor ...
std::set< DDUIdType > getListOfDDUs() const
ExaminerStatusType getCSCStatus(const CSCIdType CSCId) const
bool nextCSCWithStatus(uint32_t &iterator, CSCIdType &CSCId) const
CSC with status iteration procedure.
ExaminerStatusType getCSCErrors(const CSCIdType CSCId) const
ExaminerStatusType getDDUErrors(const DDUIdType DDUId) const
bool nextCSCWithError(uint32_t &iterator, CSCIdType &CSCId) const
CSC with error iteration procedure. Usage: unsigned int i = 0; CSCIdType cscId; while (c...
const bool getCSCHisto(const HistoId &histo, const HwId &crateID, const HwId &dmbSlot, MonitorObject *&me)
Get CSC (Chamber) Level Monitoring Object.
uint32_t cntTMBs
Total Number of ALCTs per event from DMB DAV.
uint32_t cntALCTs
Total Number of CFEBs per event from DMB DAV.
virtual void SetBinContent(const int binX, const double value)=0
boost::function< bool(const unsigned int, const unsigned int, CSCDetId &) > fnGetCSCDetId
CSCDetId chamberID(const CSCDetId &cscDetId)
takes layer ID, converts to chamber ID, switching ME1A to ME11
Definition: CSCDigiToRaw.cc:32
bool processExaminer(const CSCDCCExaminer &binChecker)
ExaminerStatusType getCSCPayload(const CSCIdType CSCId) const
uint32_t ExaminerStatusType
const uint32_t getChamberCounterValue(const ChamberCounterType counter, const HwId crateId, const HwId dmbId) const
Get Chamber counter value.
void copyChamberCounterValue(const ChamberCounterType counter_from, const ChamberCounterType counter_to, const HwId crateId, const HwId dmbId)
Copy Chamber counter value from one counter to another.
virtual double GetBinContent(const int binX)=0
CSC Format Status Object.
virtual void SetMaximum(const double d)=0
bool nextCSCWithPayload(uint32_t &iterator, CSCIdType &CSCId) const
CSC with payload iteration procedure.
const bool getEMUHisto(const HistoId &histo, MonitorObject *&me)
Get EMU (Top Level) Monitoring Object.