CMS 3D CMS Logo

SiPixelRawDataErrorModule.cc
Go to the documentation of this file.
4 // Framework
6 // STL
7 #include <cstdlib>
8 #include <iostream>
9 #include <memory>
10 #include <sstream>
11 #include <string>
12 #include <vector>
13 
14 // Data Formats
21 
22 using namespace std;
23 
30 
37 const int SiPixelRawDataErrorModule::DB1_shift = DB0_shift + DataBit_bits;
38 const int SiPixelRawDataErrorModule::DB2_shift = DB1_shift + DataBit_bits;
39 const int SiPixelRawDataErrorModule::DB3_shift = DB2_shift + DataBit_bits;
40 const int SiPixelRawDataErrorModule::DB4_shift = DB3_shift + DataBit_bits;
41 const int SiPixelRawDataErrorModule::DB5_shift = DB4_shift + DataBit_bits;
42 const int SiPixelRawDataErrorModule::DB6_shift = DB5_shift + DataBit_bits;
43 const int SiPixelRawDataErrorModule::DB7_shift = DB6_shift + DataBit_bits;
44 
45 const uint32_t SiPixelRawDataErrorModule::LINK_mask = ~(~uint32_t(0) << LINK_bits);
46 const uint32_t SiPixelRawDataErrorModule::ROC_mask = ~(~uint32_t(0) << ROC_bits);
47 const uint32_t SiPixelRawDataErrorModule::DCOL_mask = ~(~uint32_t(0) << DCOL_bits);
48 const uint32_t SiPixelRawDataErrorModule::PXID_mask = ~(~uint32_t(0) << PXID_bits);
49 const uint32_t SiPixelRawDataErrorModule::ADC_mask = ~(~uint32_t(0) << ADC_bits);
50 const uint32_t SiPixelRawDataErrorModule::DataBit_mask = ~(~uint32_t(0) << DataBit_bits);
51 
55 
57 const int SiPixelRawDataErrorModule::EVTLGT_shift = TRLRBGN_shift + TRLRBGN_bits;
58 const int SiPixelRawDataErrorModule::TRLREND_shift = EVTLGT_shift + EVTLGT_bits;
59 
60 const unsigned long long SiPixelRawDataErrorModule::TRLREND_mask = ~(~0ULL << TRLREND_bits);
61 const unsigned long long SiPixelRawDataErrorModule::EVTLGT_mask = ~(~0ULL << EVTLGT_bits);
62 const unsigned long long SiPixelRawDataErrorModule::TRLRBGN_mask = ~(~0ULL << TRLRBGN_bits);
63 //
64 // Constructors
65 //
66 SiPixelRawDataErrorModule::SiPixelRawDataErrorModule() : id_(0), ncols_(416), nrows_(160) { _debug_ = false; }
67 //
68 SiPixelRawDataErrorModule::SiPixelRawDataErrorModule(const uint32_t &id) : id_(id), ncols_(416), nrows_(160) {
69  _debug_ = false;
70 }
71 //
72 SiPixelRawDataErrorModule::SiPixelRawDataErrorModule(const uint32_t &id, const int &ncols, const int &nrows)
73  : id_(id), ncols_(ncols), nrows_(nrows) {
74  _debug_ = false;
75 }
76 //
77 // Destructor
78 //
80 //
81 // Book histograms for errors with detId
82 //
84  DQMStore::IBooker &iBooker,
85  int type,
86  bool isUpgrade) {}
87 //
88 // Fill histograms
89 //
91  std::map<std::string, MonitorElement **> *meMapFEDs,
92  bool modon,
93  bool ladon,
94  bool bladeon) {
95  bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
96  bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
97 
98  // Get DQM interface
99 
100  unsigned int numberOfSeriousErrors = 0;
101 
102  edm::DetSetVector<SiPixelRawDataError>::const_iterator isearch = input.find(id_); // search errors of detid
103 
104  if (isearch != input.end()) { // Not at empty iterator
105  // Look at errors now
107  for (di = isearch->data.begin(); di != isearch->data.end(); di++) {
108  int FedId = di->getFedId(); // FED the error came from
109  int chanNmbr = 0;
110  int errorType = di->getType(); // type of error
111  int TBMType = -1;
112  int TBMMessage = -1;
113  int evtSize = -1;
114  int evtNbr = -1;
115  int fullType = -1;
116  bool notReset = true;
117  const int LINK_bits = 6;
118  const int LINK_shift = 26;
119  const uint32_t LINK_mask = ~(~(uint32_t)(0) << LINK_bits);
120 
121  if (modon) {
122  if (errorType == 32 || errorType == 33 || errorType == 34) {
123  long long errorWord = di->getWord64(); // for 64-bit error words
124  chanNmbr = (errorWord >> LINK_shift) & LINK_mask;
125  if (errorType == 34)
126  evtSize = (errorWord >> EVTLGT_shift) & EVTLGT_mask;
127  } else {
128  uint32_t errorWord = di->getWord32(); // for 32-bit error words
129  chanNmbr = (errorWord >> LINK_shift) & LINK_mask; // default way to get channel number. Only
130  // different for case 29 below.
131  switch (errorType) { // fill in the appropriate monitorables based on
132  // the information stored in the error word
133  case (28): {
134  int NFa = (errorWord >> DB0_shift) & DataBit_mask;
135  int NFb = (errorWord >> DB1_shift) & DataBit_mask;
136  int NFc = (errorWord >> DB2_shift) & DataBit_mask;
137  int NFd = (errorWord >> DB3_shift) & DataBit_mask;
138  int NFe = (errorWord >> DB4_shift) & DataBit_mask;
139  int NF2 = (errorWord >> DB6_shift) & DataBit_mask;
140  int L1A = (errorWord >> DB7_shift) & DataBit_mask;
141  if (NFa == 1) {
142  fullType = 1;
143  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
144  }
145  if (NFb == 1) {
146  fullType = 2;
147  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
148  }
149  if (NFc == 1) {
150  fullType = 3;
151  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
152  }
153  if (NFd == 1) {
154  fullType = 4;
155  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
156  }
157  if (NFe == 1) {
158  fullType = 5;
159  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
160  }
161  if (NF2 == 1) {
162  fullType = 6;
163  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
164  }
165  if (L1A == 1) {
166  fullType = 7;
167  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
168  }
169  chanNmbr = 0; // signifies channel not known
170  break;
171  }
172  case (29): {
173  int CH1 = (errorWord >> DB0_shift) & DataBit_mask;
174  int CH2 = (errorWord >> DB1_shift) & DataBit_mask;
175  int CH3 = (errorWord >> DB2_shift) & DataBit_mask;
176  int CH4 = (errorWord >> DB3_shift) & DataBit_mask;
177  int CH5 = (errorWord >> DB4_shift) & DataBit_mask;
178  int BLOCK_bits = 3;
179  int BLOCK_shift = 8;
180  uint32_t BLOCK_mask = ~(~uint32_t(0) << BLOCK_bits);
181  int BLOCK = (errorWord >> BLOCK_shift) & BLOCK_mask;
182  int localCH = 1 * CH1 + 2 * CH2 + 3 * CH3 + 4 * CH4 + 5 * CH5;
183  if (BLOCK % 2 == 0)
184  chanNmbr = (BLOCK / 2) * 9 + localCH;
185  else
186  chanNmbr = ((BLOCK - 1) / 2) * 9 + 4 + localCH;
187  if ((chanNmbr < 1) || (chanNmbr > 36))
188  chanNmbr = 0; // signifies unexpected result
189  break;
190  }
191  case (30): {
192  int T0 = (errorWord >> DB0_shift) & DataBit_mask;
193  int T1 = (errorWord >> DB1_shift) & DataBit_mask;
194  int T2 = (errorWord >> DB2_shift) & DataBit_mask;
195  int T3 = (errorWord >> DB3_shift) & DataBit_mask;
196  int T4 = (errorWord >> DB4_shift) & DataBit_mask;
197  int T5 = (errorWord >> DB5_shift) & DataBit_mask;
198  int T6 = (errorWord >> DB6_shift) & DataBit_mask;
199  int T7 = (errorWord >> DB7_shift) & DataBit_mask;
200  if (T0 == 1)
201  TBMMessage = 0;
202  if (T1 == 1)
203  TBMMessage = 1;
204  if (T2 == 1)
205  TBMMessage = 2;
206  if (T3 == 1)
207  TBMMessage = 3;
208  if (T4 == 1)
209  TBMMessage = 4;
210  if (T5 == 1)
211  TBMMessage = 5;
212  if (T6 == 1)
213  TBMMessage = 6;
214  if (T7 == 1)
215  TBMMessage = 7;
216  if (TBMMessage == 5 || TBMMessage == 6)
217  notReset = false;
218  int StateMach_bits = 4;
219  int StateMach_shift = 8;
220  uint32_t StateMach_mask = ~(~uint32_t(0) << StateMach_bits);
221  int StateMach = (errorWord >> StateMach_shift) & StateMach_mask;
222  switch (StateMach) {
223  case (0): {
224  TBMType = 0;
225  break;
226  }
227  case (1):
228  case (9): {
229  TBMType = 1;
230  break;
231  }
232  case (2):
233  case (4):
234  case (6): {
235  TBMType = 2;
236  break;
237  }
238  case (8): {
239  TBMType = 3;
240  break;
241  }
242  default:
243  TBMType = 4;
244  };
245  break;
246  }
247  case (31): {
248  evtNbr = (errorWord >> ADC_shift) & ADC_mask;
249  break;
250  }
251  case (36): {
252  // ROCId = (errorWord >> ROC_shift) & ROC_mask;
253  break;
254  }
255  case (37): {
256  // DCOLId = (errorWord >> DCOL_shift) & DCOL_mask;
257  // PXId = (errorWord >> PXID_shift) & PXID_mask;
258  break;
259  }
260  case (38): {
261  // ROCNmbr = (errorWord >> ROC_shift) & ROC_mask;
262  break;
263  }
264  default:
265  break;
266  };
267  } // end if not double precision
268  } // end if modon
269 
270  if (ladon && barrel) {
271  if (errorType == 32 || errorType == 33 || errorType == 34) {
272  long long errorWord = di->getWord64(); // for 64-bit error words
273  if (errorType == 34)
274  evtSize = (errorWord >> EVTLGT_shift) & EVTLGT_mask;
275  chanNmbr = (errorWord >> LINK_shift) & LINK_mask;
276  } else {
277  uint32_t errorWord = di->getWord32(); // for 32-bit error words
278  chanNmbr = (errorWord >> LINK_shift) & LINK_mask;
279  switch (errorType) { // fill in the appropriate monitorables based on
280  // the information stored in the error word
281  case (28): {
282  int NFa = (errorWord >> DB0_shift) & DataBit_mask;
283  int NFb = (errorWord >> DB1_shift) & DataBit_mask;
284  int NFc = (errorWord >> DB2_shift) & DataBit_mask;
285  int NFd = (errorWord >> DB3_shift) & DataBit_mask;
286  int NFe = (errorWord >> DB4_shift) & DataBit_mask;
287  int NF2 = (errorWord >> DB6_shift) & DataBit_mask;
288  int L1A = (errorWord >> DB7_shift) & DataBit_mask;
289  if (NFa == 1) {
290  fullType = 1;
291  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
292  }
293  if (NFb == 1) {
294  fullType = 2;
295  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
296  }
297  if (NFc == 1) {
298  fullType = 3;
299  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
300  }
301  if (NFd == 1) {
302  fullType = 4;
303  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
304  }
305  if (NFe == 1) {
306  fullType = 5;
307  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
308  }
309  if (NF2 == 1) {
310  fullType = 6;
311  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
312  }
313  if (L1A == 1) {
314  fullType = 7;
315  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
316  }
317  chanNmbr = 0;
318  break;
319  }
320  case (29): {
321  int CH1 = (errorWord >> DB0_shift) & DataBit_mask;
322  int CH2 = (errorWord >> DB1_shift) & DataBit_mask;
323  int CH3 = (errorWord >> DB2_shift) & DataBit_mask;
324  int CH4 = (errorWord >> DB3_shift) & DataBit_mask;
325  int CH5 = (errorWord >> DB4_shift) & DataBit_mask;
326  int BLOCK_bits = 3;
327  int BLOCK_shift = 8;
328  uint32_t BLOCK_mask = ~(~uint32_t(0) << BLOCK_bits);
329  int BLOCK = (errorWord >> BLOCK_shift) & BLOCK_mask;
330  int localCH = 1 * CH1 + 2 * CH2 + 3 * CH3 + 4 * CH4 + 5 * CH5;
331  if (BLOCK % 2 == 0)
332  chanNmbr = (BLOCK / 2) * 9 + localCH;
333  else
334  chanNmbr = ((BLOCK - 1) / 2) * 9 + 4 + localCH;
335  if ((chanNmbr < 1) || (chanNmbr > 36))
336  chanNmbr = 0; // signifies unexpected result
337  break;
338  }
339  case (30): {
340  int T0 = (errorWord >> DB0_shift) & DataBit_mask;
341  int T1 = (errorWord >> DB1_shift) & DataBit_mask;
342  int T2 = (errorWord >> DB2_shift) & DataBit_mask;
343  int T3 = (errorWord >> DB3_shift) & DataBit_mask;
344  int T4 = (errorWord >> DB4_shift) & DataBit_mask;
345  int T5 = (errorWord >> DB5_shift) & DataBit_mask;
346  int T6 = (errorWord >> DB6_shift) & DataBit_mask;
347  int T7 = (errorWord >> DB7_shift) & DataBit_mask;
348  if (T0 == 1)
349  TBMMessage = 0;
350  if (T1 == 1)
351  TBMMessage = 1;
352  if (T2 == 1)
353  TBMMessage = 2;
354  if (T3 == 1)
355  TBMMessage = 3;
356  if (T4 == 1)
357  TBMMessage = 4;
358  if (T5 == 1)
359  TBMMessage = 5;
360  if (T6 == 1)
361  TBMMessage = 6;
362  if (T7 == 1)
363  TBMMessage = 7;
364  int StateMach_bits = 4;
365  int StateMach_shift = 8;
366  uint32_t StateMach_mask = ~(~uint32_t(0) << StateMach_bits);
367  int StateMach = (errorWord >> StateMach_shift) & StateMach_mask;
368  switch (StateMach) {
369  case (0): {
370  TBMType = 0;
371  break;
372  }
373  case (1):
374  case (9): {
375  TBMType = 1;
376  break;
377  }
378  case (2):
379  case (4):
380  case (6): {
381  TBMType = 2;
382  break;
383  }
384  case (8): {
385  TBMType = 3;
386  break;
387  }
388  default:
389  TBMType = 4;
390  };
391  break;
392  }
393  case (31): {
394  evtNbr = (errorWord >> ADC_shift) & ADC_mask;
395  break;
396  }
397  case (36): {
398  // int ROCId = (errorWord >> ROC_shift) & ROC_mask;
399  break;
400  }
401  case (37): {
402  // int DCOLId = (errorWord >> DCOL_shift) & DCOL_mask;
403  // int PXId = (errorWord >> PXID_shift) & PXID_mask;
404  break;
405  }
406  case (38): {
407  // int ROCNmbr = (errorWord >> ROC_shift) & ROC_mask;
408  break;
409  }
410  default:
411  break;
412  };
413  }
414  } // end if ladderon
415 
416  if (bladeon && endcap) {
417  if (errorType == 32 || errorType == 33 || errorType == 34) {
418  long long errorWord = di->getWord64(); // for 64-bit error words
419  if (errorType == 34)
420  evtSize = (errorWord >> EVTLGT_shift) & EVTLGT_mask;
421  chanNmbr = (errorWord >> LINK_shift) & LINK_mask;
422  } else {
423  uint32_t errorWord = di->getWord32(); // for 32-bit error words
424  chanNmbr = (errorWord >> LINK_shift) & LINK_mask;
425  switch (errorType) { // fill in the appropriate monitorables based on
426  // the information stored in the error word
427  case (28): {
428  int NFa = (errorWord >> DB0_shift) & DataBit_mask;
429  int NFb = (errorWord >> DB1_shift) & DataBit_mask;
430  int NFc = (errorWord >> DB2_shift) & DataBit_mask;
431  int NFd = (errorWord >> DB3_shift) & DataBit_mask;
432  int NFe = (errorWord >> DB4_shift) & DataBit_mask;
433  int NF2 = (errorWord >> DB6_shift) & DataBit_mask;
434  int L1A = (errorWord >> DB7_shift) & DataBit_mask;
435  if (NFa == 1) {
436  fullType = 1;
437  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
438  }
439  if (NFb == 1) {
440  fullType = 2;
441  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
442  }
443  if (NFc == 1) {
444  fullType = 3;
445  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
446  }
447  if (NFd == 1) {
448  fullType = 4;
449  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
450  }
451  if (NFe == 1) {
452  fullType = 5;
453  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
454  }
455  if (NF2 == 1) {
456  fullType = 6;
457  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
458  }
459  if (L1A == 1) {
460  fullType = 7;
461  ((*meMapFEDs)["meFullType_"][FedId])->Fill((int)fullType);
462  }
463  chanNmbr = 0;
464  break;
465  }
466  case (29): {
467  int CH1 = (errorWord >> DB0_shift) & DataBit_mask;
468  int CH2 = (errorWord >> DB1_shift) & DataBit_mask;
469  int CH3 = (errorWord >> DB2_shift) & DataBit_mask;
470  int CH4 = (errorWord >> DB3_shift) & DataBit_mask;
471  int CH5 = (errorWord >> DB4_shift) & DataBit_mask;
472  int BLOCK_bits = 3;
473  int BLOCK_shift = 8;
474  uint32_t BLOCK_mask = ~(~uint32_t(0) << BLOCK_bits);
475  int BLOCK = (errorWord >> BLOCK_shift) & BLOCK_mask;
476  int localCH = 1 * CH1 + 2 * CH2 + 3 * CH3 + 4 * CH4 + 5 * CH5;
477  if (BLOCK % 2 == 0)
478  chanNmbr = (BLOCK / 2) * 9 + localCH;
479  else
480  chanNmbr = ((BLOCK - 1) / 2) * 9 + 4 + localCH;
481  if ((chanNmbr < 1) || (chanNmbr > 36))
482  chanNmbr = 0; // signifies unexpected result
483  break;
484  }
485  case (30): {
486  int T0 = (errorWord >> DB0_shift) & DataBit_mask;
487  int T1 = (errorWord >> DB1_shift) & DataBit_mask;
488  int T2 = (errorWord >> DB2_shift) & DataBit_mask;
489  int T3 = (errorWord >> DB3_shift) & DataBit_mask;
490  int T4 = (errorWord >> DB4_shift) & DataBit_mask;
491  int T5 = (errorWord >> DB5_shift) & DataBit_mask;
492  int T6 = (errorWord >> DB6_shift) & DataBit_mask;
493  int T7 = (errorWord >> DB7_shift) & DataBit_mask;
494  if (T0 == 1)
495  TBMMessage = 0;
496  if (T1 == 1)
497  TBMMessage = 1;
498  if (T2 == 1)
499  TBMMessage = 2;
500  if (T3 == 1)
501  TBMMessage = 3;
502  if (T4 == 1)
503  TBMMessage = 4;
504  if (T5 == 1)
505  TBMMessage = 5;
506  if (T6 == 1)
507  TBMMessage = 6;
508  if (T7 == 1)
509  TBMMessage = 7;
510  int StateMach_bits = 4;
511  int StateMach_shift = 8;
512  uint32_t StateMach_mask = ~(~uint32_t(0) << StateMach_bits);
513  int StateMach = (errorWord >> StateMach_shift) & StateMach_mask;
514  switch (StateMach) {
515  case (0): {
516  TBMType = 0;
517  break;
518  }
519  case (1):
520  case (9): {
521  TBMType = 1;
522  break;
523  }
524  case (2):
525  case (4):
526  case (6): {
527  TBMType = 2;
528  break;
529  }
530  case (8): {
531  TBMType = 3;
532  break;
533  }
534  default:
535  TBMType = 4;
536  };
537  break;
538  }
539  case (31): {
540  evtNbr = (errorWord >> ADC_shift) & ADC_mask;
541  break;
542  }
543  case (36): {
544  // int ROCId = (errorWord >> ROC_shift) & ROC_mask;
545  break;
546  }
547  case (37): {
548  // int DCOLId = (errorWord >> DCOL_shift) & DCOL_mask;
549  // int PXId = (errorWord >> PXID_shift) & PXID_mask;
550  break;
551  }
552  case (38): {
553  // int ROCNmbr = (errorWord >> ROC_shift) & ROC_mask;
554  break;
555  }
556  default:
557  break;
558  };
559  }
560  } // end if bladeon
561 
562  // Example to mask a specific bad channel -->
563  // if(!(FedId==38&&chanNmbr==7)){
564  if (!(errorType == 30) || notReset) {
565  std::string hid;
566  static const char chNfmt[] = "Pixel/AdditionalPixelErrors/FED_%d/FedChNErr_%d";
567  char chNbuf[sizeof(chNfmt) + 2 * 32]; // 32 digits is enough for up to 2^105 + sign.
568  sprintf(chNbuf, chNfmt, FedId, chanNmbr);
569  hid = chNbuf;
570  if ((*meMapFEDs)["meFedChNErr_"][FedId])
571  (*meMapFEDs)["meFedChNErr_"][FedId]->Fill(chanNmbr);
572 
573  static const char chLfmt[] = "Pixel/AdditionalPixelErrors/FED_%d/FedChLErr_%d";
574  char chLbuf[sizeof(chLfmt) + 2 * 32]; // 32 digits is enough for up to 2^105 + sign.
575  sprintf(chLbuf, chLfmt, FedId, chanNmbr);
576  hid = chLbuf;
577  if ((*meMapFEDs)["meFedChLErr_"][FedId])
578  (*meMapFEDs)["meFedChLErr_"][FedId]->setBinContent(chanNmbr + 1, errorType);
579 
580  numberOfSeriousErrors++;
581  int messageType = 99;
582  if (errorType < 30)
583  messageType = errorType - 25;
584  else if (errorType > 30)
585  messageType = errorType - 19;
586  else if (errorType == 30 && TBMMessage == 0)
587  messageType = errorType - 25;
588  else if (errorType == 30 && TBMMessage == 1)
589  messageType = errorType - 24;
590  else if (errorType == 30 && (TBMMessage == 2 || TBMMessage == 3 || TBMMessage == 4))
591  messageType = errorType - 23;
592  else if (errorType == 30 && TBMMessage == 7)
593  messageType = errorType - 22;
594  else if (errorType == 30 && TBMType == 1)
595  messageType = errorType - 21;
596  else if (errorType == 30 && TBMType == 2)
597  messageType = errorType - 20;
598  else if (errorType == 30 && TBMType == 3)
599  messageType = errorType - 19;
600  if (messageType <= 20) {
601  static const char fmt[] = "Pixel/AdditionalPixelErrors/FED_%d/FedETypeNErr_%d";
602  char buf[sizeof(fmt) + 2 * 32]; // 32 digits is enough for up to 2^105 + sign.
603  sprintf(buf, fmt, FedId, messageType);
604  hid = buf;
605  if ((*meMapFEDs)["meFedETypeNErr_"][FedId])
606  (*meMapFEDs)["meFedETypeNErr_"][FedId]->Fill(messageType);
607  }
608  }
609 
610  (*meMapFEDs)["meNErrors_"][FedId]->Fill((int)numberOfSeriousErrors);
611  (*meMapFEDs)["meTBMMessage_"][FedId]->Fill((int)TBMMessage);
612  (*meMapFEDs)["meTBMType_"][FedId]->Fill((int)TBMType);
613  (*meMapFEDs)["meErrorType_"][FedId]->Fill((int)errorType);
614  (*meMapFEDs)["meFullType_"][FedId]->Fill((int)fullType);
615  (*meMapFEDs)["meEvtNbr_"][FedId]->setBinContent(1, (int)evtNbr);
616  (*meMapFEDs)["meEvtSize_"][FedId]->setBinContent(1, (int)evtSize);
617  }
618  } // end if not an empty iterator
619  return numberOfSeriousErrors;
620 }
621 
623  std::map<std::string, MonitorElement **> *meMapFEDs) {
624  unsigned int numberOfSeriousErrors = 0;
625 
626  edm::DetSetVector<SiPixelRawDataError>::const_iterator isearch = input.find(0xffffffff); // search errors of detid
627  if (isearch != input.end()) { // Not an empty iterator
628  // Look at FED errors now
630  for (di = isearch->data.begin(); di != isearch->data.end(); di++) {
631  int FedId = di->getFedId(); // FED the error came from
632  int chanNmbr = -1;
633  int errorType = 0; // type of error
634  if (FedId == static_cast<int>(id_)) {
635  errorType = di->getType(); // type of error
636  ((*meMapFEDs)["meErrorType_"][id_])->Fill((int)errorType);
637  bool notReset = true;
638  int TBMType = -1;
639  int TBMMessage = -1;
640  int evtSize = -1;
641  int fullType = -1;
642  const int LINK_bits = 6;
643  const int LINK_shift = 26;
644  const uint32_t LINK_mask = ~(~(uint32_t)(0) << LINK_bits);
645  if ((errorType == 32) || (errorType == 33) || (errorType == 34)) {
646  long long errorWord = di->getWord64(); // for 64-bit error words
647  chanNmbr = 0;
648  switch (errorType) { // fill in the appropriate monitorables based on
649  // the information stored in the error word
650  case (32): {
651  break;
652  }
653  case (33): {
654  break;
655  }
656  case (34): {
657  evtSize = (errorWord >> EVTLGT_shift) & EVTLGT_mask;
658  ((*meMapFEDs)["meEvtSize_"][id_])->setBinContent(1, (int)evtSize);
659  break;
660  }
661  default:
662  break;
663  };
664  } else {
665  uint32_t errorWord = di->getWord32(); // for 32-bit error words
666  switch (errorType) { // fill in the appropriate monitorables based on
667  // the information stored in the error word
668  case (25):
669  case (39): {
670  chanNmbr = 0;
671  break;
672  }
673  case (28): {
674  int NFa = (errorWord >> DB0_shift) & DataBit_mask;
675  int NFb = (errorWord >> DB1_shift) & DataBit_mask;
676  int NFc = (errorWord >> DB2_shift) & DataBit_mask;
677  int NFd = (errorWord >> DB3_shift) & DataBit_mask;
678  int NFe = (errorWord >> DB4_shift) & DataBit_mask;
679  int NF2 = (errorWord >> DB6_shift) & DataBit_mask;
680  int L1A = (errorWord >> DB7_shift) & DataBit_mask;
681  if (NFa == 1) {
682  fullType = 1;
683  ((*meMapFEDs)["meFullType_"][id_])->Fill((int)fullType);
684  }
685  if (NFb == 1) {
686  fullType = 2;
687  ((*meMapFEDs)["meFullType_"][id_])->Fill((int)fullType);
688  }
689  if (NFc == 1) {
690  fullType = 3;
691  ((*meMapFEDs)["meFullType_"][id_])->Fill((int)fullType);
692  }
693  if (NFd == 1) {
694  fullType = 4;
695  ((*meMapFEDs)["meFullType_"][id_])->Fill((int)fullType);
696  }
697  if (NFe == 1) {
698  fullType = 5;
699  ((*meMapFEDs)["meFullType_"][id_])->Fill((int)fullType);
700  }
701  if (NF2 == 1) {
702  fullType = 6;
703  ((*meMapFEDs)["meFullType_"][id_])->Fill((int)fullType);
704  }
705  if (L1A == 1) {
706  fullType = 7;
707  ((*meMapFEDs)["meFullType_"][id_])->Fill((int)fullType);
708  }
709  chanNmbr = 0;
710  break;
711  }
712  case (29): {
713  int CH1 = (errorWord >> DB0_shift) & DataBit_mask;
714  int CH2 = (errorWord >> DB1_shift) & DataBit_mask;
715  int CH3 = (errorWord >> DB2_shift) & DataBit_mask;
716  int CH4 = (errorWord >> DB3_shift) & DataBit_mask;
717  int CH5 = (errorWord >> DB4_shift) & DataBit_mask;
718  int BLOCK_bits = 3;
719  int BLOCK_shift = 8;
720  uint32_t BLOCK_mask = ~(~uint32_t(0) << BLOCK_bits);
721  int BLOCK = (errorWord >> BLOCK_shift) & BLOCK_mask;
722  int localCH = 1 * CH1 + 2 * CH2 + 3 * CH3 + 4 * CH4 + 5 * CH5;
723  if (BLOCK % 2 == 0)
724  chanNmbr = (BLOCK / 2) * 9 + localCH;
725  else
726  chanNmbr = ((BLOCK - 1) / 2) * 9 + 4 + localCH;
727  if ((chanNmbr < 1) || (chanNmbr > 36))
728  chanNmbr = 0; // signifies unexpected result
729  break;
730  }
731  case (30): {
732  int T0 = (errorWord >> DB0_shift) & DataBit_mask;
733  int T1 = (errorWord >> DB1_shift) & DataBit_mask;
734  int T2 = (errorWord >> DB2_shift) & DataBit_mask;
735  int T3 = (errorWord >> DB3_shift) & DataBit_mask;
736  int T4 = (errorWord >> DB4_shift) & DataBit_mask;
737  int T5 = (errorWord >> DB5_shift) & DataBit_mask;
738  int T6 = (errorWord >> DB6_shift) & DataBit_mask;
739  int T7 = (errorWord >> DB7_shift) & DataBit_mask;
740  if (!(FedId == 38 && chanNmbr == 7)) {
741  if (T0 == 1) {
742  TBMMessage = 0;
743  ((*meMapFEDs)["meTBMMessage_"][id_])->Fill((int)TBMMessage);
744  }
745  if (T1 == 1) {
746  TBMMessage = 1;
747  ((*meMapFEDs)["meTBMMessage_"][id_])->Fill((int)TBMMessage);
748  }
749  if (T2 == 1) {
750  TBMMessage = 2;
751  ((*meMapFEDs)["meTBMMessage_"][id_])->Fill((int)TBMMessage);
752  }
753  if (T3 == 1) {
754  TBMMessage = 3;
755  ((*meMapFEDs)["meTBMMessage_"][id_])->Fill((int)TBMMessage);
756  }
757  if (T4 == 1) {
758  TBMMessage = 4;
759  ((*meMapFEDs)["meTBMMessage_"][id_])->Fill((int)TBMMessage);
760  }
761  if (T5 == 1) {
762  TBMMessage = 5;
763  ((*meMapFEDs)["meTBMMessage_"][id_])->Fill((int)TBMMessage);
764  }
765  if (T6 == 1) {
766  TBMMessage = 6;
767  ((*meMapFEDs)["meTBMMessage_"][id_])->Fill((int)TBMMessage);
768  }
769  if (T7 == 1) {
770  TBMMessage = 7;
771  ((*meMapFEDs)["meTBMMessage_"][id_])->Fill((int)TBMMessage);
772  }
773  }
774  if (TBMMessage == 5 || TBMMessage == 6)
775  notReset = false;
776  int StateMach_bits = 4;
777  int StateMach_shift = 8;
778  uint32_t StateMach_mask = ~(~uint32_t(0) << StateMach_bits);
779  int StateMach = (errorWord >> StateMach_shift) & StateMach_mask;
780  switch (StateMach) {
781  case (0): {
782  TBMType = 0;
783  break;
784  }
785  case (1):
786  case (9): {
787  TBMType = 1;
788  break;
789  }
790  case (2):
791  case (4):
792  case (6): {
793  TBMType = 2;
794  break;
795  }
796  case (8): {
797  TBMType = 3;
798  break;
799  }
800  default:
801  TBMType = 4;
802  };
803  if (!(FedId == 38 && chanNmbr == 7))
804  ((*meMapFEDs)["meTBMType_"][id_])->Fill((int)TBMType);
805  chanNmbr = (errorWord >> LINK_shift) & LINK_mask;
806  break;
807  }
808  case (31): {
809  int evtNbr = (errorWord >> ADC_shift) & ADC_mask;
810  if (!(FedId == 38 && chanNmbr == 7))
811  ((*meMapFEDs)["meEvtNbr_"][id_])->setBinContent(1, (int)evtNbr);
812  chanNmbr = (errorWord >> LINK_shift) & LINK_mask;
813  break;
814  }
815  case (35):
816  case (36):
817  case (37):
818  case (38): {
819  chanNmbr = (errorWord >> LINK_shift) & LINK_mask;
820  break;
821  }
822  default:
823  break;
824  };
825  } // end if errorType
826 
827  if (!(errorType == 30) || notReset) {
828  std::string hid;
829  static const char chNfmt[] = "Pixel/AdditionalPixelErrors/FED_%d/FedChNErr_%d";
830  char chNbuf[sizeof(chNfmt) + 2 * 32]; // 32 digits is enough for up to 2^105 + sign.
831  sprintf(chNbuf, chNfmt, FedId, chanNmbr);
832  hid = chNbuf;
833  if ((*meMapFEDs)["meFedChNErr_"][id_])
834  (*meMapFEDs)["meFedChNErr_"][id_]->Fill(chanNmbr);
835 
836  static const char chLfmt[] = "Pixel/AdditionalPixelErrors/FED_%d/FedChLErr_%d";
837  char chLbuf[sizeof(chLfmt) + 2 * 32]; // 32 digits is enough for up to 2^105 + sign.
838  sprintf(chLbuf, chLfmt, FedId, chanNmbr);
839  hid = chLbuf;
840  if ((*meMapFEDs)["meFedChLErr_"][id_])
841  (*meMapFEDs)["meFedChLErr_"][id_]->setBinContent(chanNmbr + 1, errorType);
842 
843  numberOfSeriousErrors++;
844  int messageType = 99;
845  if (errorType < 30)
846  messageType = errorType - 25;
847  else if (errorType > 30)
848  messageType = errorType - 19;
849  else if (errorType == 30 && TBMMessage == 0)
850  messageType = errorType - 25;
851  else if (errorType == 30 && TBMMessage == 1)
852  messageType = errorType - 24;
853  else if (errorType == 30 && (TBMMessage == 2 || TBMMessage == 3 || TBMMessage == 4))
854  messageType = errorType - 23;
855  else if (errorType == 30 && TBMMessage == 7)
856  messageType = errorType - 22;
857  else if (errorType == 30 && TBMType == 1)
858  messageType = errorType - 21;
859  else if (errorType == 30 && TBMType == 2)
860  messageType = errorType - 20;
861  else if (errorType == 30 && TBMType == 3)
862  messageType = errorType - 19;
863  if (messageType <= 20) {
864  static const char fmt[] = "Pixel/AdditionalPixelErrors/FED_%d/FedETypeNErr_%d";
865  char buf[sizeof(fmt) + 2 * 32]; // 32 digits is enough for up to 2^105 + sign.
866  sprintf(buf, fmt, FedId, messageType);
867  hid = buf;
868  if ((*meMapFEDs)["meFedETypeNErr_"][id_])
869  (*meMapFEDs)["meFedETypeNErr_"][id_]->Fill(messageType);
870  }
871  } // end if not 30 || notReset
872  } // end if
873  } // end for
874  if (numberOfSeriousErrors > 0)
875  ((*meMapFEDs)["meNErrors_"][id_])->Fill((float)numberOfSeriousErrors);
876  } // end if not an empty iterator
877  return numberOfSeriousErrors;
878 }
SiPixelRawDataErrorModule::DataBit_bits
static const int DataBit_bits
Definition: SiPixelRawDataErrorModule.h:80
edm::DetSetVector
Definition: DetSetVector.h:61
hgcalPlots.ncols
ncols
Definition: hgcalPlots.py:105
PixelSubdetector.h
input
static const std::string input
Definition: EdmProvDump.cc:48
PixelBarrelName.h
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
SiPixelRawDataErrorModule::LINK_mask
static const uint32_t LINK_mask
Definition: SiPixelRawDataErrorModule.h:84
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
SiPixelRawDataErrorModule::book
void book(const edm::ParameterSet &iConfig, DQMStore::IBooker &, int type=0, bool isUpgrade=false)
Book histograms.
Definition: SiPixelRawDataErrorModule.cc:83
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
SiPixelRawDataErrorModule::ROC_shift
static const int ROC_shift
Definition: SiPixelRawDataErrorModule.h:82
edm::DetSetVector::end
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
SiPixelRawDataErrorModule::DB5_shift
static const int DB5_shift
Definition: SiPixelRawDataErrorModule.h:82
SiPixelRawDataErrorModule::SiPixelRawDataErrorModule
SiPixelRawDataErrorModule()
Default constructor.
Definition: SiPixelRawDataErrorModule.cc:66
pixelgpudetails::LINK_bits
const uint32_t LINK_bits
Definition: SiPixelRawToClusterGPUKernel.h:41
SiPixelRawDataErrorModule::DCOL_shift
static const int DCOL_shift
Definition: SiPixelRawDataErrorModule.h:82
SiPixelRawDataErrorModule::LINK_shift
static const int LINK_shift
Definition: SiPixelRawDataErrorModule.h:82
edm::DetSetVector::begin
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
DQMStore.h
SiPixelHistogramId.h
bmtfStage2Raw_cfi.FedId
FedId
Definition: bmtfStage2Raw_cfi.py:10
SiPixelRawDataErrorModule::DB6_shift
static const int DB6_shift
Definition: SiPixelRawDataErrorModule.h:82
SiPixelRawDataErrorModule::TRLRBGN_bits
static const int TRLRBGN_bits
Definition: SiPixelRawDataErrorModule.h:80
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
pixelgpudetails::DCOL_bits
const uint32_t DCOL_bits
Definition: SiPixelRawToClusterGPUKernel.h:43
SiPixelRawDataErrorModule::DCOL_mask
static const uint32_t DCOL_mask
Definition: SiPixelRawDataErrorModule.h:84
SiPixelRawDataErrorModule::EVTLGT_mask
static const unsigned long long EVTLGT_mask
Definition: SiPixelRawDataErrorModule.h:85
SiPixelRawDataErrorModule::PXID_shift
static const int PXID_shift
Definition: SiPixelRawDataErrorModule.h:82
DetId
Definition: DetId.h:17
SiPixelRawDataErrorModule::EVTLGT_shift
static const int EVTLGT_shift
Definition: SiPixelRawDataErrorModule.h:82
SiPixelRawDataErrorModule::DB4_shift
static const int DB4_shift
Definition: SiPixelRawDataErrorModule.h:82
Service.h
pixelgpudetails::PXID_bits
const uint32_t PXID_bits
Definition: SiPixelRawToClusterGPUKernel.h:44
SiPixelRawDataErrorModule::_debug_
bool _debug_
Definition: SiPixelRawDataErrorModule.h:60
SiPixelRawDataErrorModule::ROC_bits
static const int ROC_bits
Definition: SiPixelRawDataErrorModule.h:80
SiPixelRawDataErrorModule::fill
int fill(const edm::DetSetVector< SiPixelRawDataError > &input, std::map< std::string, MonitorElement ** > *meMapFEDs, bool modon=true, bool ladon=false, bool bladeon=false)
Fill histograms.
Definition: SiPixelRawDataErrorModule.cc:90
SiPixelRawDataErrorModule::ADC_shift
static const int ADC_shift
Definition: SiPixelRawDataErrorModule.h:82
SiPixelRawDataErrorModule::fillFED
int fillFED(const edm::DetSetVector< SiPixelRawDataError > &input, std::map< std::string, MonitorElement ** > *meMapFEDs)
Fill FED histograms.
Definition: SiPixelRawDataErrorModule.cc:622
SiPixelRawDataErrorModule::DCOL_bits
static const int DCOL_bits
Definition: SiPixelRawDataErrorModule.h:80
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiPixelRawDataErrorModule::DB3_shift
static const int DB3_shift
Definition: SiPixelRawDataErrorModule.h:82
pixelgpudetails::ADC_shift
const uint32_t ADC_shift
Definition: SiPixelRawToClusterGPUKernel.h:60
edm::ParameterSet
Definition: ParameterSet.h:47
pixelgpudetails::PXID_shift
const uint32_t PXID_shift
Definition: SiPixelRawToClusterGPUKernel.h:61
SiPixelRawDataErrorModule::TRLREND_bits
static const int TRLREND_bits
Definition: SiPixelRawDataErrorModule.h:80
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
SiPixelRawDataErrorModule::PXID_bits
static const int PXID_bits
Definition: SiPixelRawDataErrorModule.h:80
SiPixelRawDataErrorModule::ROC_mask
static const uint32_t ROC_mask
Definition: SiPixelRawDataErrorModule.h:84
pixelgpudetails::ROC_bits
const uint32_t ROC_bits
Definition: SiPixelRawToClusterGPUKernel.h:42
SiPixelRawDataErrorModule::DB1_shift
static const int DB1_shift
Definition: SiPixelRawDataErrorModule.h:82
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
SiPixelRawDataErrorModule.h
SiPixelRawDataErrorModule::LINK_bits
static const int LINK_bits
Definition: SiPixelRawDataErrorModule.h:80
SiPixelRawDataErrorModule::ADC_mask
static const uint32_t ADC_mask
Definition: SiPixelRawDataErrorModule.h:84
std
Definition: JetResolutionObject.h:76
SiPixelRawDataErrorModule::~SiPixelRawDataErrorModule
~SiPixelRawDataErrorModule()
Destructor.
Definition: SiPixelRawDataErrorModule.cc:79
DetId.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
pixelgpudetails::ADC_bits
const uint32_t ADC_bits
Definition: SiPixelRawToClusterGPUKernel.h:45
pixelgpudetails::DCOL_shift
const uint32_t DCOL_shift
Definition: SiPixelRawToClusterGPUKernel.h:62
PixelEndcapNameUpgrade.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
SiPixelRawDataErrorModule::id_
uint32_t id_
Definition: SiPixelRawDataErrorModule.h:57
SiPixelRawDataErrorModule::PXID_mask
static const uint32_t PXID_mask
Definition: SiPixelRawDataErrorModule.h:84
SiPixelRawDataErrorModule::DB2_shift
static const int DB2_shift
Definition: SiPixelRawDataErrorModule.h:82
SiPixelRawDataErrorModule::EVTLGT_bits
static const int EVTLGT_bits
Definition: SiPixelRawDataErrorModule.h:80
SiPixelOfflineDQM_client_cff.isUpgrade
isUpgrade
Definition: SiPixelOfflineDQM_client_cff.py:19
pixelgpudetails::ROC_shift
const uint32_t ROC_shift
Definition: SiPixelRawToClusterGPUKernel.h:63
PixelBarrelNameUpgrade.h
SiPixelRawDataErrorModule::TRLRBGN_mask
static const unsigned long long TRLRBGN_mask
Definition: SiPixelRawDataErrorModule.h:85
SiPixelRawDataErrorModule::DB0_shift
static const int DB0_shift
Definition: SiPixelRawDataErrorModule.h:82
SiPixelRawDataErrorModule::DataBit_mask
static const uint32_t DataBit_mask
Definition: SiPixelRawDataErrorModule.h:84
SiPixelRawDataErrorModule::TRLREND_shift
static const int TRLREND_shift
Definition: SiPixelRawDataErrorModule.h:82
SiPixelRawDataErrorModule::DB7_shift
static const int DB7_shift
Definition: SiPixelRawDataErrorModule.h:82
SiPixelRawDataErrorModule::TRLREND_mask
static const unsigned long long TRLREND_mask
Definition: SiPixelRawDataErrorModule.h:85
SiPixelRawDataErrorModule::TRLRBGN_shift
static const int TRLRBGN_shift
Definition: SiPixelRawDataErrorModule.h:82
PixelEndcapName.h
SiPixelRawDataErrorModule::ADC_bits
static const int ADC_bits
Definition: SiPixelRawDataErrorModule.h:80
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31