CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalRawDataMonitor.cc
Go to the documentation of this file.
5 
6 
8  Online_ = ps.getParameter<bool>("online");
9  mergeRuns_ = ps.getParameter<bool>("mergeRuns");
10  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup");
11  debug_ = ps.getUntrackedParameter<int>("debug",0);
12  prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder", "Hcal/"); // Hcal
13  if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
14  prefixME_.append("/");
15  subdir_ = ps.getUntrackedParameter<std::string>("TaskFolder", "RawDataMonitor_Hcal/"); // RawDataMonitor_Hcal
16  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
17  subdir_.append("/");
18  subdir_=prefixME_+subdir_;
19  AllowedCalibTypes_ = ps.getUntrackedParameter<std::vector<int> > ("AllowedCalibTypes");
20  skipOutOfOrderLS_ = ps.getUntrackedParameter<bool>("skipOutOfOrderLS",true);
21  NLumiBlocks_ = ps.getUntrackedParameter<int>("NLumiBlocks",-1);
22  makeDiagnostics_ = ps.getUntrackedParameter<bool>("makeDiagnostics",false);
23 
24  FEDRawDataCollection_ = ps.getUntrackedParameter<edm::InputTag>("FEDRawDataCollection");
26 
27  excludeHORing2_ = ps.getUntrackedParameter<bool>("excludeHORing2",false);
28 
29  //inputLabelReport_ = ps.getUntrackedParameter<edm::InputTag>("UnpackerReport");
30 
31  // Initialize an array of MonitorElements
33  meChann_DataIntegrityCheck_[1] =meCh_DataIntegrityFED01_;
34  meChann_DataIntegrityCheck_[2] =meCh_DataIntegrityFED02_;
35  meChann_DataIntegrityCheck_[3] =meCh_DataIntegrityFED03_;
36  meChann_DataIntegrityCheck_[4] =meCh_DataIntegrityFED04_;
37  meChann_DataIntegrityCheck_[5] =meCh_DataIntegrityFED05_;
38  meChann_DataIntegrityCheck_[6] =meCh_DataIntegrityFED06_;
39  meChann_DataIntegrityCheck_[7] =meCh_DataIntegrityFED07_;
40  meChann_DataIntegrityCheck_[8] =meCh_DataIntegrityFED08_;
41  meChann_DataIntegrityCheck_[9] =meCh_DataIntegrityFED09_;
42  meChann_DataIntegrityCheck_[10]=meCh_DataIntegrityFED10_;
43  meChann_DataIntegrityCheck_[11]=meCh_DataIntegrityFED11_;
44  meChann_DataIntegrityCheck_[12]=meCh_DataIntegrityFED12_;
45  meChann_DataIntegrityCheck_[13]=meCh_DataIntegrityFED13_;
46  meChann_DataIntegrityCheck_[14]=meCh_DataIntegrityFED14_;
47  meChann_DataIntegrityCheck_[15]=meCh_DataIntegrityFED15_;
48  meChann_DataIntegrityCheck_[16]=meCh_DataIntegrityFED16_;
49  meChann_DataIntegrityCheck_[17]=meCh_DataIntegrityFED17_;
50  meChann_DataIntegrityCheck_[18]=meCh_DataIntegrityFED18_;
51  meChann_DataIntegrityCheck_[19]=meCh_DataIntegrityFED19_;
52  meChann_DataIntegrityCheck_[20]=meCh_DataIntegrityFED20_;
53  meChann_DataIntegrityCheck_[21]=meCh_DataIntegrityFED21_;
54  meChann_DataIntegrityCheck_[22]=meCh_DataIntegrityFED22_;
55  meChann_DataIntegrityCheck_[23]=meCh_DataIntegrityFED23_;
56  meChann_DataIntegrityCheck_[24]=meCh_DataIntegrityFED24_;
57  meChann_DataIntegrityCheck_[25]=meCh_DataIntegrityFED25_;
58  meChann_DataIntegrityCheck_[26]=meCh_DataIntegrityFED26_;
59  meChann_DataIntegrityCheck_[27]=meCh_DataIntegrityFED27_;
60  meChann_DataIntegrityCheck_[28]=meCh_DataIntegrityFED28_;
61  meChann_DataIntegrityCheck_[29]=meCh_DataIntegrityFED29_;
62  meChann_DataIntegrityCheck_[30]=meCh_DataIntegrityFED30_;
63  meChann_DataIntegrityCheck_[31]=meCh_DataIntegrityFED31_;
64 
65  for (int f=0; f<NUMDCCS; f++) {
66  for (int s=0; s<15; s++) {
67  UScount[f][s]=0;}}
68 
69  for (int x=0; x<THREE_FED; x++)
70  for (int y=0; y<THREE_SPG; y++)
72 
73  for (int x=0; x<THREE_FED; x++)
74  for (int y=0; y<THREE_SPG; y++)
76 
77  for (int x=0; x<TWO___FED; x++)
78  for (int y=0; y<TWO__SPGT; y++)
80 
81  for (int x=0; x<TWO___FED; x++)
82  for (int y=0; y<THREE_SPG; y++)
83  DataFlowInd_[x][y]=0;
84 
85  for (int f=0; f<NUMDCCS; f++)
86  for (int x=0; x< TWO_CHANN; x++)
87  for (int y=0; y<TWO__SPGT; y++)
89 
90  for (int i=0; i<(NUMDCCS * NUMSPIGS * HTRCHANMAX); i++)
92 
93  for (int d=0; d<DEPTHBINS; d++) {
94  for (int eta=0; eta<ETABINS; eta++) {
95  for (int phi=0; phi<PHIBINS; phi++){
96  problemcount[eta][phi][d] = 0.0;
97  problemfound[eta][phi][d] = false;
98  }
99  }
100  }
101 
102 
103 } // HcalRawDataMonitor::HcalRawDataMonitor()
104 
105 // destructor
107 
108 // BeginRun
112  c.get<HcalDbRecord>().get( pSetup );
113 
114  readoutMap_=pSetup->getHcalMapping();
115  DetId detid_;
116  HcalDetId hcaldetid_;
117 
118  // Build a map of readout hardware unit to calorimeter channel
119  std::vector <HcalElectronicsId> AllElIds = readoutMap_->allElectronicsIdPrecision();
120  uint32_t itsdcc =0;
121  uint32_t itsspigot =0;
122  uint32_t itshtrchan=0;
123 
124  // by looping over all precision (non-trigger) items.
125  for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin();
126  eid != AllElIds.end();
127  eid++) {
128 
129  //Get the HcalDetId from the HcalElectronicsId
130  detid_ = readoutMap_->lookup(*eid);
131  // NULL if illegal; ignore
132  if (!detid_.null()) {
133  if (detid_.det()!=4) continue; //not Hcal
134  if (detid_.subdetId()!=HcalBarrel &&
135  detid_.subdetId()!=HcalEndcap &&
136  detid_.subdetId()!=HcalOuter &&
137  detid_.subdetId()!=HcalForward) continue;
138 
139  itsdcc =(uint32_t) eid->dccid();
140  itsspigot =(uint32_t) eid->spigot();
141  itshtrchan=(uint32_t) eid->htrChanId();
142  hcaldetid_ = HcalDetId(detid_);
143  stashHDI(hashup(itsdcc,itsspigot,itshtrchan),
144  hcaldetid_);
145  } // if (!detid_.null())
146  }
147 }
148 
149 // Begin LumiBlock
151  const edm::EventSetup& c) {}
152 // Setup
154  // Call base class setup
156  if (!dbe_) {
157  if (debug_>1)
158  std::cout <<"<HcalRawDataMonitor::setup> No DQMStore instance available. Bailing out."<<std::endl;
159  return;}
160 
161  /******* Set up all histograms ********/
162  if (debug_>1)
163  std::cout <<"<HcalRawDataMonitor::beginRun> Setting up histograms"<<std::endl;
164 
166 
167  MonitorElement* excludeHO2=dbe_->bookInt("ExcludeHOring2");
168  // Fill with 0 if ring is not to be excluded; fill with 1 if it is to be excluded
169  if (excludeHO2) excludeHO2->Fill(excludeHORing2_==true ? 1 : 0);
170 
171 
172  // Already done in base class:
173  //dbe_->setCurrentFolder(subdir_);
174  //meIevt_ = dbe_->bookInt("EventsProcessed");
175  //if (meIevt_) meIevt_->Fill(-1);
176  //meLevt_ = dbe_->bookInt("EventsProcessed_currentLS");
177  //if (meLevt_) meLevt_->Fill(-1);
178  //meTevt_ = dbe_->bookInt("EventsProcessed_All");
179  //if (meTevt_) meTevt_->Fill(-1);
180  //meTevtHist_=dbe_->book1D("EventsProcessed_AllHists","Counter of Events Processed By This Task",1,0.5,1.5);
181  //if (meTevtHist_) meTevtHist_->Reset();
182 
183  std::string type;
184 
185  dbe_->setCurrentFolder(subdir_ + "Corruption");
186  type = "01 Common Data Format violations";
187  meCDFErrorFound_ = dbe_->book2D(type,type,32,699.5,731.5,9,0.5,9.5);
188  meCDFErrorFound_->setAxisTitle("HCAL FED ID", 1);
189  meCDFErrorFound_->setBinLabel(1, "Hdr1BitUnset", 2);
190  meCDFErrorFound_->setBinLabel(2, "FmtNumChange", 2);
191  meCDFErrorFound_->setBinLabel(3, "BOE not '0x5'", 2);
192  meCDFErrorFound_->setBinLabel(4, "Hdr2Bit Set", 2);
193  meCDFErrorFound_->setBinLabel(5, "Hdr1 36-55", 2);
194  meCDFErrorFound_->setBinLabel(6, "BOE not 0", 2);
195  meCDFErrorFound_->setBinLabel(7, "Trlr1Bit Set", 2);
196  meCDFErrorFound_->setBinLabel(8, "Size Error", 2);
197  meCDFErrorFound_->setBinLabel(9, "TrailerBad", 2);
198 
199  type = "02 DCC Event Format violation";
200  meDCCEventFormatError_ = dbe_->book2D(type,type,32,699.5,731.5,6,0.5,6.5);
201  meDCCEventFormatError_->setAxisTitle("HCAL FED ID", 1);
202  meDCCEventFormatError_->setBinLabel(1, "FmtVers Changed", 2);
203  meDCCEventFormatError_->setBinLabel(2, "StrayBits Changed", 2);
204  meDCCEventFormatError_->setBinLabel(3, "HTRStatusPad", 2);
205  meDCCEventFormatError_->setBinLabel(4, "32bitPadErr", 2);
206  meDCCEventFormatError_->setBinLabel(5, "Number Mismatch Bit Miscalc", 2);
207  meDCCEventFormatError_->setBinLabel(6, "Low 8 HTR Status Bits Miscopy", 2);
208 
209  type = "04 HTR BCN when OrN Diff";
210  meBCNwhenOrNDiff_ = dbe_->book1D(type,type,3564,-0.5,3563.5);
212  meBCNwhenOrNDiff_->setAxisTitle("# of Entries",2);
213 
214  type = "03 OrN NonZero Difference HTR - DCC";
215  meOrNCheck_ = dbe_->book1D(type,type,65,-32.5,32.5);
216  meOrNCheck_->setAxisTitle("htr OrN - dcc OrN",1);
217 
218  type = "03 OrN Inconsistent - HTR vs DCC";
219  meOrNSynch_= dbe_->book2D(type,type,32,700,732, 15,0,15);
220  meOrNSynch_->setAxisTitle("FED #",1);
221  meOrNSynch_->setAxisTitle("Spigot #",2);
222 
223  type = "05 BCN NonZero Difference HTR - DCC";
224  meBCNCheck_ = dbe_->book1D(type,type,501,-250.5,250.5);
225  meBCNCheck_->setAxisTitle("htr BCN - dcc BCN",1);
226 
227  type = "05 BCN Inconsistent - HTR vs DCC";
228  meBCNSynch_= dbe_->book2D(type,type,32,700,732, 15,0,15);
229  meBCNSynch_->setAxisTitle("FED #",1);
230  meBCNSynch_->setAxisTitle("Slot #",2);
231 
232  type = "06 EvN NonZero Difference HTR - DCC";
233  meEvtNCheck_ = dbe_->book1D(type,type,601,-300.5,300.5);
234  meEvtNCheck_->setAxisTitle("htr Evt # - dcc Evt #",1);
235 
236  type = "06 EvN Inconsistent - HTR vs DCC";
237  meEvtNumberSynch_= dbe_->book2D(type,type,32,700,732, 15,0,15);
238  meEvtNumberSynch_->setAxisTitle("FED #",1);
239  meEvtNumberSynch_->setAxisTitle("Slot #",2);
240 
241  // ----------------
242  // | E!P | UE | TR |
243  // ----| ND | OV | ID |
244  // | T | CRC | ST | ODD|
245  // --------------------
246  type="07 LRB Data Corruption Indicators";
249  THREE_SPG,0,THREE_SPG);
250  label_xFEDs (meLRBDataCorruptionIndicators_, 4); // 3 bins + 1 margin per ch.
251  label_ySpigots(meLRBDataCorruptionIndicators_, 4); // 3 bins + 1 margin each spgt
252 
253  // ----------------
254  // | CT | BE | |
255  // | HM | 15 | WW | (Wrong Wordcount)
256  // | TM | CK | IW | (Illegal Wordcount)
257  // ----------------
258  type="08 Half-HTR Data Corruption Indicators";
261  THREE_SPG,0,THREE_SPG);
262  label_xFEDs (meHalfHTRDataCorruptionIndicators_, 4); // 3 bins + 1 margin per ch.
263  label_ySpigots(meHalfHTRDataCorruptionIndicators_, 4); // 3 bins + 1 margin each spgt
264 
265  // ------------
266  // | !DV | Er |
267  // | NTS | Cap |
268  // ------------
269  type = "09 Channel Integrity Summarized by Spigot";
272  TWO__SPGT,0,TWO__SPGT);
273  label_xFEDs (meChannSumm_DataIntegrityCheck_, 3); // 2 bins + 1 margin per ch.
274  label_ySpigots(meChannSumm_DataIntegrityCheck_, 3); // 2 bins + 1 margin per spgt
275 
276  dbe_->setCurrentFolder(subdir_ + "Corruption/Channel Data Integrity");
277  char label[256];
278  for (int f=0; f<NUMDCCS; f++){
279  snprintf(label, 256, "FED %03d Channel Integrity", f+700);
280  meChann_DataIntegrityCheck_[f] = dbe_->book2D(label,label,
282  TWO__SPGT,0,TWO__SPGT);
283  label_xChanns (meChann_DataIntegrityCheck_[f], 3); // 2 bins + 1 margin per ch.
284  label_ySpigots(meChann_DataIntegrityCheck_[f], 3); // 2 bins + 1 margin per spgt
285  ;}
286 
287  dbe_->setCurrentFolder(subdir_ + "Data Flow");
288  type="DCC Event Counts";
289  mefedEntries_ = dbe_->book1D(type,type,32,699.5,731.5);
290 
291  type = "BCN from DCCs";
292  medccBCN_ = dbe_->book1D(type,type,3564,-0.5,3563.5);
293  medccBCN_->setAxisTitle("BCN",1);
294  medccBCN_->setAxisTitle("# of Entries",2);
295 
296  type = "BCN from HTRs";
297  meBCN_ = dbe_->book1D(type,type,3564,-0.5,3563.5);
298  meBCN_->setAxisTitle("BCN",1);
299  meBCN_->setAxisTitle("# of Entries",2);
300 
301  type = "DCC Data Block Size Distribution";
302  meFEDRawDataSizes_=dbe_->book1D(type,type,1200,-0.5,12000.5);
303  meFEDRawDataSizes_->setAxisTitle("# of bytes",1);
304  meFEDRawDataSizes_->setAxisTitle("# of Data Blocks",2);
305 
306  type = "DCC Data Block Size Profile";
307  meEvFragSize_ = dbe_->bookProfile(type,type,32,699.5,731.5,100,-1000.0,12000.0,"");
308  type = "DCC Data Block Size Each FED";
309  meEvFragSize2_ = dbe_->book2D(type,type,64,699.5,731.5, 240,0,12000);
310 
311  // ------------
312  // | OW | OFW | "Two Caps HTR; Three Caps FED."
313  // | BZ | BSY |
314  // | EE | RL |
315  // ----------------
316  // | CE | (corrected error, Hamming code)
317  // ------
318  type = "01 Data Flow Indicators";
319  meDataFlowInd_= dbe_->book2D(type,type,
321  THREE_SPG,0,THREE_SPG);
322  label_xFEDs (meDataFlowInd_, 3); // 2 bins + 1 margin per ch.
323  label_ySpigots(meDataFlowInd_, 4); // 3 bins + 1 margin each spgt
324 
325  dbe_->setCurrentFolder(subdir_ + "Diagnostics");
326 
327  type = "DCC Firmware Version";
328  meDCCVersion_ = dbe_->bookProfile(type,type, 32, 699.5, 731.5, 256, -0.5, 255.5);
329  meDCCVersion_ ->setAxisTitle("FED ID", 1);
330 
331  type = "HTR Status Word HBHE";
332  HTR_StatusWd_HBHE = dbe_->book1D(type,type,16,-0.5,15.5);
334 
335  type = "HTR Status Word HF";
336  HTR_StatusWd_HF = dbe_->book1D(type,type,16,-0.5,15.5);
338 
339  type = "HTR Status Word HO";
340  HTR_StatusWd_HO = dbe_->book1D(type,type,16,-0.5,15.5);
342 
343  int maxbits = 16;//Look at all 16 bits of the Error Words
344  type = "HTR Status Word by Crate";
345  meStatusWdCrate_ = dbe_->book2D(type,type,18,-0.5,17.5,maxbits,-0.5,maxbits-0.5);
346  meStatusWdCrate_ -> setAxisTitle("Crate #",1);
348 
349  type = "Unpacking - HcalHTRData check failures";
350  meInvHTRData_= dbe_->book2D(type,type,16,-0.5,15.5,32,699.5,731.5);
351  meInvHTRData_->setAxisTitle("Spigot #",1);
352  meInvHTRData_->setAxisTitle("DCC #",2);
353 
354  type = "HTR Fiber Orbit Message BCN";
355  meFibBCN_ = dbe_->book1D(type,type,3564,-0.5,3563.5);
356  meFibBCN_->setAxisTitle("BCN of Fib Orb Msg",1);
357 
358  type = "HTR Status Word - Crate 0";
359  meCrate0HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
360  meCrate0HTRStatus_ ->setAxisTitle("Slot #",1);
362 
363  type = "HTR Status Word - Crate 1";
364  meCrate1HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
365  meCrate1HTRStatus_ ->setAxisTitle("Slot #",1);
367 
368  type = "HTR Status Word - Crate 2";
369  meCrate2HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
370  meCrate2HTRStatus_ ->setAxisTitle("Slot #",1);
372 
373  type = "HTR Status Word - Crate 3";
374  meCrate3HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
375  meCrate3HTRStatus_ ->setAxisTitle("Slot #",1);
377 
378  type = "HTR Status Word - Crate 4";
379  meCrate4HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
380  meCrate4HTRStatus_ ->setAxisTitle("Slot #",1);
382 
383  type = "HTR Status Word - Crate 5";
384  meCrate5HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
385  meCrate5HTRStatus_ ->setAxisTitle("Slot #",1);
387 
388  type = "HTR Status Word - Crate 6";
389  meCrate6HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
390  meCrate6HTRStatus_ ->setAxisTitle("Slot #",1);
392 
393  type = "HTR Status Word - Crate 7";
394  meCrate7HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
395  meCrate7HTRStatus_ ->setAxisTitle("Slot #",1);
397 
398  type = "HTR Status Word - Crate 9";
399  meCrate9HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
400  meCrate9HTRStatus_ ->setAxisTitle("Slot #",1);
402 
403  type = "HTR Status Word - Crate 10";
404  meCrate10HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
405  meCrate10HTRStatus_ ->setAxisTitle("Slot #",1);
407 
408  type = "HTR Status Word - Crate 11";
409  meCrate11HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
410  meCrate11HTRStatus_ ->setAxisTitle("Slot #",1);
412 
413  type = "HTR Status Word - Crate 12";
414  meCrate12HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
415  meCrate12HTRStatus_ ->setAxisTitle("Slot #",1);
417 
418  type = "HTR Status Word - Crate 13";
419  meCrate13HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
420  meCrate13HTRStatus_ ->setAxisTitle("Slot #",1);
422 
423  type = "HTR Status Word - Crate 14";
424  meCrate14HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
425  meCrate14HTRStatus_ ->setAxisTitle("Slot #",1);
427 
428  type = "HTR Status Word - Crate 15";
429  meCrate15HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
430  meCrate15HTRStatus_ ->setAxisTitle("Slot #",1);
432 
433  type = "HTR Status Word - Crate 17";
434  meCrate17HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
435  meCrate17HTRStatus_ ->setAxisTitle("Slot #",1);
437 
438  type = "HTR UnSuppressed Event Fractions";
439  meUSFractSpigs_ = dbe_->book1D(type,type,481,0,481);
440  for(int f=0; f<NUMDCCS; f++) {
441  snprintf(label, 256, "FED 7%02d", f);
443  for(int s=1; s<HcalDCCHeader::SPIGOT_COUNT; s++) {
444  snprintf(label, 256, "sp%02d", s);
445  meUSFractSpigs_->setBinLabel(1+(HcalDCCHeader::SPIGOT_COUNT*f)+s, label);}}
446 
447  // Firmware version
448  type = "HTR Firmware Version";
449  // Maybe change to Profile histo eventually
450  //meHTRFWVersion_ = dbe_->bookProfile(type,type,18,-0.5,17.5,245,10.0,255.0,"");
451  meHTRFWVersion_ = dbe_->book2D(type,type ,18,-0.5,17.5,180,75.5,255.5);
452  meHTRFWVersion_->setAxisTitle("Crate #",1);
453  meHTRFWVersion_->setAxisTitle("HTR Firmware Version",2);
454 
455  type = "HTR Fiber 1 Orbit Message BCNs";
456  meFib1OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
457  type = "HTR Fiber 2 Orbit Message BCNs";
458  meFib2OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
459  type = "HTR Fiber 3 Orbit Message BCNs";
460  meFib3OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
461  type = "HTR Fiber 4 Orbit Message BCNs";
462  meFib4OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
463  type = "HTR Fiber 5 Orbit Message BCNs";
464  meFib5OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
465  type = "HTR Fiber 6 Orbit Message BCNs";
466  meFib6OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
467  type = "HTR Fiber 7 Orbit Message BCNs";
468  meFib7OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
469  type = "HTR Fiber 8 Orbit Message BCNs";
470  meFib8OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
471 
472 }
473 
474 // Analyze
476  if (!IsAllowedCalibType()) return;
477  if (LumiInOrder(e.luminosityBlock())==false) return;
478 
479  HcalBaseDQMonitor::analyze(e,s); // base class increments ievt_, etc. counters
480 
481  // try to get die Data
483  if (!(e.getByLabel(FEDRawDataCollection_,rawraw)))
484  {
485  edm::LogWarning("HcalRawDataMonitor")<<" raw data with label "<<FEDRawDataCollection_ <<" not available";
486  return;
487  }
489  if (!(e.getByLabel(digiLabel_,report)))
490  {
491  edm::LogWarning("HcalRawDataMonitor")<<" Unpacker Report "<<digiLabel_<<" not available";
492  return;
493  }
494 
495  // all objects grabbed; event is good
496  if (debug_>1) std::cout <<"\t<HcalRawDataMonitor::analyze> Processing good event! event # = "<<ievt_<<std::endl;
497 
498  // Raw Data collection was grabbed successfully; process the Event
499  processEvent(*rawraw, *report);
500 
501  //Loop over all cells, tallying problem counts before resetting
502  //Extract the subdetector region given the location
503  for (int d=0; d<DEPTHBINS; d++) {
504  for (int eta=0; eta<ETABINS; eta++) {
505  int ieta=CalcIeta(eta,d+1);
506  if (ieta==-9999) continue;
507  for (int phi=0; phi<PHIBINS; phi++){
508  if (problemcount[eta][phi][d]) {
509  // std::cout<<" "<<eta<<","<<phi<<","<<d<<" count:"<<problemcount[eta][phi][d]<<std::endl;
510  HcalSubdetector subdet=HcalEmpty;
511  if (isHB(eta,d+1))subdet=HcalBarrel;
512  else if (isHE(eta,d+1)) subdet=HcalEndcap;
513  else if (isHF(eta,d+1)) subdet=HcalForward;
514  else if (isHO(eta,d+1)) subdet=HcalOuter;
515  if (subdet!=HcalEmpty){
516  if (subdet==HcalBarrel) NumBadHB+= problemcount[eta][phi][d];
517  else if (subdet==HcalEndcap) NumBadHE+= problemcount[eta][phi][d];
518  else if (subdet==HcalOuter)
519  {
520  NumBadHO += problemcount[eta][phi][d];
521  if (abs(ieta)<5) NumBadHO0+= problemcount[eta][phi][d];
522  else NumBadHO12+= problemcount[eta][phi][d];
523  }
524  else if (subdet==HcalForward)
525  {
526  NumBadHF+= problemcount[eta][phi][d];
527  if (d==1 && (abs(ieta)==33 || abs(ieta)==34))
529  else if (d==2 && (abs(ieta)==35 || abs(ieta)==36))
531  }
532  }
533  problemcount[eta][phi][d]=0;
534  }
535  }
536  }
537  }
538 }
539 
541  const HcalUnpackerReport& report){
542  if(!dbe_) {
543  if (debug_>1)
544  printf("HcalRawDataMonitor::processEvent DQMStore not instantiated!\n");
545  return;}
546 
547  // Fill event counters (underflow bins of histograms)
551  for (int f=0; f<NUMDCCS; f++)
554 
555  // Loop over all FEDs reporting the event, unpacking if good.
557  const FEDRawData& fed = rawraw.FEDData(i);
558  if (fed.size()<12) continue; //At least the size of headers and trailers of a DCC.
559  unpack(fed); //Interpret data, fill histograms, everything.
560  }
561 
562  //increment problemcount[] where problemfound[], and clear problemfound[]
563  for (int x=0; x<ETABINS; x++)
564  for (int y=0; y<PHIBINS; y++)
565  for (int z=0; z<DEPTHBINS; z++)
566  if (problemfound[x][y][z]) {
567  problemcount[x][y][z]++;
568  problemfound[x][y][z]=false;
569  }
570  return;
571 } //void HcalRawDataMonitor::processEvent()
572 
573 // Process one FED's worth (one DCC's worth) of the event data.
575 
576  // get the DCC header & trailer (or bail out)
577  const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(raw.data());
578  if(!dccHeader) return;
579  unsigned char* trailer_ptr = (unsigned char*) (raw.data()+raw.size()-sizeof(uint64_t));
580  FEDTrailer trailer = FEDTrailer(trailer_ptr);
581 
582  // FED id declared in the header
583  int dccid=dccHeader->getSourceId();
584  //Force 0<= dcc_ <= 31
585  int dcc_=std::max(0,dccid-700);
586  dcc_ = std::min(dcc_,31);
587  if(debug_>1) std::cout << "DCC " << dccid << std::endl;
588  uint64_t* dccfw= (uint64_t*) (raw.data()+(sizeof(uint64_t)*2)); //64-bit DAQ word number 2 (from 0)
589  int dcc_fw = ( ((*dccfw)>>(6*8))&0x00000000000000FF ); //Shift right 6 bytes, get that low byte.
590  meDCCVersion_ -> Fill(dccid,dcc_fw);
591 
592  //Before all else, how much data are we dealing with here?
593  uint64_t* lastDataWord = (uint64_t*) ( raw.data()+(raw.size())-(1*sizeof(uint64_t)) );
594  int EvFragLength = (int) (*lastDataWord>>(4*8)) & 0x0000000000FFFFFF ; //Shift right 4 bytes, get low 3 bytes.
595  meFEDRawDataSizes_->Fill(EvFragLength*8); //# 64-bit DAQ words *8 = # bytes.
596  meEvFragSize_ ->Fill(dccid, EvFragLength*8); //# 64-bit DAQ words *8 = # bytes.
597  meEvFragSize2_ ->Fill(dccid, EvFragLength*8); //# 64-bit DAQ words *8 = # bytes.
598 
599  //Orbit, BunchCount, and Event Numbers
600  unsigned long dccEvtNum = dccHeader->getDCCEventNumber();
601  int dccBCN = dccHeader->getBunchId();
602  //Mask down to 5 bits, since only used for comparison to HTR's five bit number...
603  unsigned int dccOrN = (unsigned int) (dccHeader->getOrbitNumber() & 0x0000001F);
604  medccBCN_ -> Fill(dccBCN);
605 
607  bool CDFProbThisDCC = false;
608  /* 1 */ //There should always be a second CDF header word indicated.
609  if (!dccHeader->thereIsASecondCDFHeaderWord()
610  //TESTME_HCALRAWDATA//
611  //|| ((dccid==702)&&(tevt_%2==0))
612  ) {
613  meCDFErrorFound_->Fill(dccid, 1);
614  CDFProbThisDCC = true;
615  }
616  /* 2 */ //Make sure a reference CDF Version value has been recorded for this dccid
617  CDFvers_it = CDFversionNumber_list.find(dccid);
618  if (CDFvers_it == CDFversionNumber_list.end()) {
619  CDFversionNumber_list.insert(std::pair<int,short>
620  (dccid,dccHeader->getCDFversionNumber() ) );
621  CDFvers_it = CDFversionNumber_list.find(dccid);
622  } // then check against it.
623  if (dccHeader->getCDFversionNumber()!= CDFvers_it->second) {
624  meCDFErrorFound_->Fill(dccid,2);
625  CDFProbThisDCC = true;
626  }
627  /* 3 */ //There should always be a '5' in CDF Header word 0, bits [63:60]
628  if (dccHeader->BOEshouldBe5Always()!=5) {
629  meCDFErrorFound_->Fill(dccid, 3);
630  CDFProbThisDCC = true;
631  }
632  /* 4 */ //There should never be a third CDF Header word indicated.
633  if (dccHeader->thereIsAThirdCDFHeaderWord()) {
634  meCDFErrorFound_->Fill(dccid, 4);
635  CDFProbThisDCC = true;
636  }
637  /* 5 */ //Make sure a reference value of Reserved Bits has been recorded for this dccid
640  CDFReservedBits_list.insert(std::pair<int,short>
641  (dccid,dccHeader->getSlink64ReservedBits() & 0x0000FFFF ) );
643  } // then check against it.
644  if (((int) dccHeader->getSlink64ReservedBits() & 0x0000FFFF ) != CDFReservedBits_it->second) {
645  meCDFErrorFound_->Fill(dccid,5);
646  //CDFProbThisDCC = true;
647  }
648  /* 6 */ //There should always be 0x0 in CDF Header word 1, bits [63:60]
649  if (dccHeader->BOEshouldBeZeroAlways() !=0) {
650  meCDFErrorFound_->Fill(dccid, 6);
651  CDFProbThisDCC = true;
652  }
653  /* 7 */ //There should only be one trailer
654  if (trailer.moreTrailers()) {
655  meCDFErrorFound_->Fill(dccid, 7);
656  CDFProbThisDCC = true;
657  }
658  // if trailer.
659  /* 8 */ //CDF Trailer [55:30] should be the # 64-bit words in the EvFragment
660  if ((uint64_t) raw.size() != ( (uint64_t) trailer.lenght()*sizeof(uint64_t)) ) //The function name is a typo! Awesome.
661  {
662  meCDFErrorFound_->Fill(dccid, 8);
663  CDFProbThisDCC = true;
664  }
665  /* 9 */ //There is a rudimentary sanity check built into the FEDTrailer class
666  if (!trailer.check()) {
667  meCDFErrorFound_->Fill(dccid, 9);
668  CDFProbThisDCC = true;
669  }
670  if (CDFProbThisDCC) {
671  //Set the problem flag for the ieta, iphi of any channel in this DCC
672  mapDCCproblem(dcc_);
673  if (debug_>0) std::cout <<"CDFProbThisDCC"<<std::endl;
674  }
675 
676  mefedEntries_->Fill(dccid);
677 
678  CDFProbThisDCC = false; // reset for the next go-round.
679 
680  char CRC_err;
681  for(int i=0; i<HcalDCCHeader::SPIGOT_COUNT; i++) {
682  CRC_err = ((dccHeader->getSpigotSummary(i) >> 10) & 0x00000001);
683  if (CRC_err) {
684  mapDCCproblem(dcc_);
685  //Set the problem flag for the ieta, iphi of any channel in this DCC
686  if (debug_>0) std::cout <<"HTR Problem: CRC_err"<<std::endl;
687  }
688  }
689 
690  // The DCC TTS state at event-sending time
691  char TTS_state = (char)trailer.ttsBits();
692  // The DCC TTS state at time L1A received (event enqueued to be built)
693  char L1AtimeTTS_state=(char) dccHeader->getAcceptTimeTTS();
694  if (TTS_state==L1AtimeTTS_state) ;//party
695 
697  /* 1 */ //Make sure a reference value of the DCC Event Format version has been noted for this dcc.
698  DCCEvtFormat_it = DCCEvtFormat_list.find(dccid);
699  if (DCCEvtFormat_it == DCCEvtFormat_list.end()) {
700  DCCEvtFormat_list.insert(std::pair<int,short>
701  (dccid,dccHeader->getDCCDataFormatVersion() ) );
702  DCCEvtFormat_it = DCCEvtFormat_list.find(dccid);
703  } // then check against it.
704  if (dccHeader->getDCCDataFormatVersion()!= DCCEvtFormat_it->second) {
705  meDCCEventFormatError_->Fill(dccid,1);
706  mapDCCproblem(dcc_);
707  if (debug_>0)std::cout <<"DCC Error Type 1"<<std::endl;
708  }
709  /* 2 */ //Check for ones where there should always be zeros
710  if (false) //dccHeader->getByte1Zeroes() || dccHeader->getByte3Zeroes() || dccHeader->getByte567Zeroes())
711  {
712  meDCCEventFormatError_->Fill(dccid,2);
713  mapDCCproblem(dcc_);
714  if (debug_>0)std::cout <<"DCC Error Type 2"<<std::endl;
715  }
716  /* 3 */ //Check that there are zeros following the HTR Status words.
717  int SpigotPad = HcalDCCHeader::SPIGOT_COUNT;
718  if ( (((uint64_t) dccHeader->getSpigotSummary(SpigotPad) )
719  | ((uint64_t) dccHeader->getSpigotSummary(SpigotPad+1))
720  | ((uint64_t) dccHeader->getSpigotSummary(SpigotPad+2))) != 0){
721  meDCCEventFormatError_->Fill(dccid,3);
722  mapDCCproblem(dcc_);
723  if (debug_>0)std::cout <<"DCC Error Type 3"<<std::endl;
724  }
725  /* 4 */ //Check that there are zeros following the HTR Payloads, if needed.
726  int nHTR32BitWords=0;
727  // add up all the declared HTR Payload lengths
728  for(int i=0; i<HcalDCCHeader::SPIGOT_COUNT; i++) {
729  nHTR32BitWords += dccHeader->getSpigotDataLength(i); }
730  // if it's an odd number, check for the padding zeroes
731  if (( nHTR32BitWords % 2) == 1) {
732  uint64_t* lastDataWord = (uint64_t*) ( raw.data()+raw.size()-(2*sizeof(uint64_t)) );
733  if ((*lastDataWord>>32) != 0x00000000){
734  meDCCEventFormatError_->Fill(dccid, 4);
735  mapDCCproblem(dcc_);
736  if (debug_>0)std::cout <<"DCC Error Type 4"<<std::endl;
737  }
738  }
739 
740  unsigned char HTRErrorList=0;
741  for(int j=0; j<HcalDCCHeader::SPIGOT_COUNT; j++) {
742  HTRErrorList=dccHeader->getSpigotErrorBits(j);
743  }
744 
745  // These will be used in FED-vs-spigot 2D Histograms
746  const int fed3offset = 1 + (4*dcc_); //3 bins, plus one of margin, each DCC
747  const int fed2offset = 1 + (3*dcc_); //2 bins, plus one of margin, each DCC
748  if (TTS_state & 0x8) /*RDY*/
749  ;
750  if (TTS_state & 0x2) /*SYN*/
751  {
752  mapDCCproblem(dcc_);
753  if (debug_>0)std::cout <<"TTS_state Error:sync"<<std::endl;
754  }
755  //Histogram per-Spigot bits from the DCC Header
756  int WholeErrorList=0;
757  for(int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) {
758  if (!( dccHeader->getSpigotEnabled((unsigned int) spigot)) )
759  continue; //skip when not enabled
760  // This will be used in FED-vs-spigot 2D Histograms
761  const int spg3offset = 1 + (4*spigot); //3 bins, plus one of margin, each spigot
762 
763  if (TTS_state & 0x4) /*BSY*/
764  ++DataFlowInd_[fed2offset+1][spg3offset+1];
765  if (TTS_state & 0x1) /*OFW*/
766  ++DataFlowInd_[fed2offset+1][spg3offset+2];
767 
768  WholeErrorList=dccHeader->getLRBErrorBits((unsigned int) spigot);
769  if (WholeErrorList!=0) {
770  if ((WholeErrorList>>0)&0x01) //HammingCode Corrected -- Not data corruption!
771  DataFlowInd_[fed2offset-1][spg3offset-1]++;
772  if (((WholeErrorList>>1)&0x01)!=0) {//HammingCode Uncorrected Error
773  LRBDataCorruptionIndicators_[fed3offset+1][spg3offset+2]++;
774  mapHTRproblem(dcc_,spigot);
775  }
776  if (((WholeErrorList>>2)&0x01)!=0) {//Truncated data coming into LRB
777  LRBDataCorruptionIndicators_[fed3offset+2][spg3offset+2]++;
778  mapHTRproblem(dcc_,spigot);
779  }
780  if (((WholeErrorList>>3)&0x01)!=0) {//FIFO Overflow
781  LRBDataCorruptionIndicators_[fed3offset+1][spg3offset+1]++;
782  mapHTRproblem(dcc_,spigot);
783  }
784  if (((WholeErrorList>>4)&0x01)!=0) {//ID (EvN Mismatch), htr payload metadeta
785  LRBDataCorruptionIndicators_[fed3offset+2][spg3offset+1]++;
786  mapHTRproblem(dcc_,spigot);
787  }
788  if (((WholeErrorList>>5)&0x01)!=0) {//STatus: hdr/data/trlr error
789  LRBDataCorruptionIndicators_[fed3offset+1][spg3offset+0]++;
790  mapHTRproblem(dcc_,spigot);
791  }
792  if (((WholeErrorList>>6)&0x01)!=0) {//ODD 16-bit word count from HTR
793  LRBDataCorruptionIndicators_[fed3offset+2][spg3offset+0]++;
794  mapHTRproblem(dcc_,spigot);
795  }
796  }
797  if (!dccHeader->getSpigotPresent((unsigned int) spigot)){
798  LRBDataCorruptionIndicators_[fed3offset+0][spg3offset+2]++; //Enabled, but data not present!
799  mapHTRproblem(dcc_,spigot);
800  if (debug_>0)std::cout <<"HTR Problem: Spigot Not Present"<<std::endl;
801  } else {
802  if ( dccHeader->getSpigotDataTruncated((unsigned int) spigot)) {
803  LRBDataCorruptionIndicators_[fed3offset-1][spg3offset+0]++; // EventBuilder truncated babbling LRB
804  mapHTRproblem(dcc_,spigot);
805  if (debug_>0)std::cout <<"HTR Problem: Spigot Data Truncated"<<std::endl;
806  }
807  if ( dccHeader->getSpigotCRCError((unsigned int) spigot)) {
808  LRBDataCorruptionIndicators_[fed3offset+0][spg3offset+0]++;
809  mapHTRproblem(dcc_,spigot);
810  }
811  } //else spigot marked "Present"
812  if (dccHeader->getSpigotDataLength(spigot) <(unsigned long)4) {
813  LRBDataCorruptionIndicators_[fed3offset+0][spg3offset+1]++; //Lost HTR Data for sure.
814  mapHTRproblem(dcc_,spigot);
815  if (debug_>0)std::cout <<"HTR Problem: Spigot Data Length too small"<<std::endl;
816  }
817  }
818 
819  // Walk through the HTR data...
820  HcalHTRData htr;
821  for (int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) {
822  const int spg3offset = 1 + (4*spigot); //3 bins, plus one of margin, each spigot
823  const int spg2offset = 1 + (3*spigot); //3 bins, plus one of margin, each spigot
824  if (!dccHeader->getSpigotPresent(spigot)) continue;
825 
826  // Load the given decoder with the pointer and length from this spigot.
827  // i.e. initialize htr, within dcc raw data size.
828  dccHeader->getSpigotData(spigot,htr, raw.size());
829  const unsigned short* HTRraw = htr.getRawData();
830 
831  // check min length, correct wordcount, empty event, or total length if histo event.
832  if (!htr.check()) {
833  meInvHTRData_ -> Fill(spigot,dccid);
834  mapHTRproblem(dcc_,spigot);
835  if (debug_>0)std::cout <<"HTR Problem: HTR check fails"<<std::endl;
836  }
837 
838  unsigned short HTRwdcount = htr.getRawLength();
839 
840  // Size checks for internal consistency
841  // getNTP(), get NDD() seems to be mismatched with format. Manually:
842  int NTP = ((htr.getExtHdr6() >> 8) & 0x00FF);
843  int NDAQ = (HTRraw[htr.getRawLength() - 4] & 0x7FF);
844 
845  if ( ! ((HTRwdcount != 8) ||
846  (HTRwdcount != 12 + NTP + NDAQ) ||
847  (HTRwdcount != 20 + NTP + NDAQ) )) {
848  ++HalfHTRDataCorruptionIndicators_[fed3offset+2][spg3offset+0];
849  mapHTRproblem(dcc_,spigot);
850  if (debug_>0)std::cout <<"HTR Problem: NTP+NDAQ size consistency check fails"<<std::endl;
851  //incompatible Sizes declared. Skip it.
852  continue; }
853  bool EE = ((dccHeader->getSpigotErrorBits(spigot) >> 2) & 0x01);
854  if (EE) {
855  if (HTRwdcount != 8) { //incompatible Sizes declared. Skip it.
856  ++HalfHTRDataCorruptionIndicators_[fed3offset+2][spg3offset+1];
857  if (debug_>0)std::cout <<"HTR Problem: HTRwdcount !=8"<<std::endl;
858  }
859  DataFlowInd_[fed2offset+0][spg3offset+0]++;
860  continue;}
861  else{ //For non-EE, both CompactMode and !CompactMode
862  bool CM = (htr.getExtHdr7() >> 14)&0x0001;
863  if (( CM && ( (HTRwdcount-NDAQ-NTP) != 12) )
864  ||
865  (!CM && ( (HTRwdcount-NDAQ-NTP) != 20) ) ) { //incompatible Sizes declared. Skip it.
866  ++HalfHTRDataCorruptionIndicators_[fed3offset+2][spg3offset+1];
867  mapHTRproblem(dcc_,spigot);
868  continue;} }
869 
870  if (htr.isHistogramEvent()) continue;
871 
872  //We trust the data now. Finish with the check against DCCHeader
873  unsigned int htrOrN = htr.getOrbitNumber();
874  unsigned int htrBCN = htr.getBunchNumber();
875  unsigned int htrEvtN = htr.getL1ANumber();
876  meBCN_->Fill(htrBCN); //The only periodic number for whole events.
877 
878  if (( (htrOrN == dccOrN ) &&
879  (htrBCN == (unsigned int) dccBCN) )
880  != (dccHeader->getBxMismatchWithDCC(spigot)) ){
881  meDCCEventFormatError_->Fill(dccid,5);
882  mapHTRproblem(dcc_,spigot);
883  if (debug_>0)std::cout <<"Orbit or BCN HTR/DCC mismatch"<<std::endl;
884  }
885  if ( (htrEvtN == dccEvtNum) !=
886  dccHeader->getSpigotValid(spigot) ) {
887  meDCCEventFormatError_->Fill(dccid,5);
888  mapHTRproblem(dcc_,spigot);
889  if (debug_>0)std::cout <<"DCC invalid spigot"<<std::endl;
890  }
891  int cratenum = htr.readoutVMECrateId();
892  float slotnum = htr.htrSlot() + 0.5*htr.htrTopBottom();
893  if (debug_ > 0) HTRPrint(htr,debug_);
894  unsigned int htrFWVer = htr.getFirmwareRevision() & 0xFF;
895  meHTRFWVersion_->Fill(cratenum,htrFWVer);
896 
898  int EvtNdiff = htrEvtN - dccEvtNum;
899  if (EvtNdiff!=0) {
900  meEvtNumberSynch_->Fill(dccid,spigot);
901  mapHTRproblem(dcc_,spigot);
902  meEvtNCheck_->Fill(EvtNdiff);
903  if (debug_ == 1)std::cout << "++++ Evt # out of sync, ref, this HTR: "<< dccEvtNum << " "<<htrEvtN <<std::endl;
904  }
905 
907  int BCNdiff = htrBCN-dccBCN;
908  if ((BCNdiff!=0)
909  //TESTME_HCALRAWDATA//
910  //|| ((dccid==727) && (spigot==8) && (dccEvtNum%3==0))
911  ){
912  meBCNSynch_->Fill(dccid,spigot);
913  mapHTRproblem(dcc_,spigot);
914  meBCNCheck_->Fill(BCNdiff);
915  if (debug_==1)std::cout << "++++ BCN # out of sync, ref, this HTR: "<< dccBCN << " "<<htrBCN <<std::endl;
916  }
917 
919  int OrNdiff = htrOrN-dccOrN;
920  if (OrNdiff!=0) {
921  meOrNSynch_->Fill(dccid,spigot);
922  mapHTRproblem(dcc_,spigot);
923  meOrNCheck_->Fill(OrNdiff);
924  meBCNwhenOrNDiff_->Fill(htrBCN); // Are there special BCN where OrN mismatched occur? Let's see.
925  if (debug_==1)std::cout << "++++ OrN # out of sync, ref, this HTR: "<< dccOrN << " "<<htrOrN <<std::endl;
926  }
927 
928  bool htrUnSuppressed=(HTRraw[6]>>15 & 0x0001);
929  if (htrUnSuppressed) {
930  UScount[dcc_][spigot]++;
931  int here=1+(HcalDCCHeader::SPIGOT_COUNT*(dcc_))+spigot;
933  ((double)UScount[dcc_][spigot])/(double)ievt_);}
934 
935  MonitorElement* tmpErr = 0;
936  HcalDetId HDI = hashedHcalDetId_[hashup(dcc_,spigot)];
937  if (HDI != HcalDetId::Undefined) {
938  switch (HDI.subdetId()) {
939  case (HcalBarrel): {
940  tmpErr = HTR_StatusWd_HBHE;
941  } break;
942  case (HcalEndcap): {
943  tmpErr = HTR_StatusWd_HBHE;
944  } break;
945  case (HcalOuter): {
946  tmpErr = HTR_StatusWd_HO;
947  } break;
948  case (HcalForward): {
949  tmpErr = HTR_StatusWd_HF;
950  } break;
951  default: break;
952  }
953  }
954 
955  int errWord = htr.getErrorsWord() & 0xFFFF;
956  if ( (((dccHeader->getSpigotSummary( spigot))>>24)&0x00FF)
957  != (errWord&0x00FF) ){
958  meDCCEventFormatError_->Fill(dccid,6);//Low 8 bits miscopied into DCCHeader
959  mapHTRproblem(dcc_,spigot);
960  if (debug_>0)std::cout <<"DCC spigot summary error or HTR error word"<<std::endl;
961  //What other problems may lurk? Spooky.
962  }
963  if(tmpErr!=NULL){
964  for(int i=0; i<16; i++){
965  int errbit = errWord&(0x01<<i);
966  // Bit 15 should always be 1; consider it an error if it isn't.
967  if (i==15) errbit = errbit - 0x8000;
968  if (errbit !=0) {
969  tmpErr->Fill(i);
970  //Only certain bits indicate corrupted data:
971  switch (i) {
972  case (14): //CT (obsolete Calibration Trigger scheme used)
973  HalfHTRDataCorruptionIndicators_[fed3offset+0][spg3offset+2]++;
974  mapHTRproblem(dcc_,spigot);
975  if (debug_>0)std::cout <<"HTR Problem: Case 14"<<std::endl;
976  break;
977  case (13): //HM
978  HalfHTRDataCorruptionIndicators_[fed3offset+0][spg3offset+1]++;
979  mapHTRproblem(dcc_,spigot);
980  if (debug_>0)std::cout <<"HTR Problem: Case 13"<<std::endl;
981  break;
982  case (12): //TM
983  HalfHTRDataCorruptionIndicators_[fed3offset+0][spg3offset+0]++;
984  mapHTRproblem(dcc_,spigot);
985  if (debug_>0)std::cout <<"HTR Problem: Case 12"<<std::endl;
986  break;
987  case ( 8): //BE
988  HalfHTRDataCorruptionIndicators_[fed3offset+1][spg3offset+2]++;
989  mapHTRproblem(dcc_,spigot);
990  if (debug_>0)std::cout <<"HTR Problem: Case 8"<<std::endl;
991  break;
992  case (15): //b15
993  HalfHTRDataCorruptionIndicators_[fed3offset+1][spg3offset+1]++;
994  mapHTRproblem(dcc_,spigot);
995  break;
996  case ( 7): //CK
997  HalfHTRDataCorruptionIndicators_[fed3offset+1][spg3offset+0]++;
998  mapHTRproblem(dcc_,spigot);
999  if (debug_>0)std::cout <<"HTR Problem: Case 7"<<std::endl;
1000  break;
1001  //\\case ( 5): //LW removed 2010.02.16
1002  //\\ HalfHTRDataCorruptionIndicators_[fed3offset+2][spg3offset+2]++;
1003  //\\ //Sometimes set spuriously at startup, per-fiber, .: Leniency: 8
1004  //\\ if (HalfHTRDataCorruptionIndicators_[fed3offset+2][spg3offset+2] > 8) {
1005  //\\ if (debug_>0)std::cout <<"HTR Problem: Case 5"<<std::endl;
1006  //\\ break;
1007  //\\ }
1008  case ( 3): //L1 (previous L1A violated trigger rules)
1009  DataFlowInd_[fed2offset+1][spg3offset+0]++; break;
1010  case ( 1): //BZ
1011  DataFlowInd_[fed2offset+0][spg3offset+1]++; break;
1012  case ( 0): //OW
1013  DataFlowInd_[fed2offset+0][spg3offset+2]++;
1014  default: break;
1015  }
1016  meStatusWdCrate_->Fill(cratenum,i);
1017  if (cratenum == 0) meCrate0HTRStatus_ -> Fill(slotnum,i);
1018  else if (cratenum == 1) meCrate1HTRStatus_ -> Fill(slotnum,i);
1019  else if (cratenum == 2) meCrate2HTRStatus_ -> Fill(slotnum,i);
1020  else if (cratenum == 3) meCrate3HTRStatus_ -> Fill(slotnum,i);
1021  else if (cratenum == 4) meCrate4HTRStatus_ -> Fill(slotnum,i);
1022  else if (cratenum == 5) meCrate5HTRStatus_ -> Fill(slotnum,i);
1023  else if (cratenum == 6) meCrate6HTRStatus_ -> Fill(slotnum,i);
1024  else if (cratenum == 7) meCrate7HTRStatus_ -> Fill(slotnum,i);
1025  else if (cratenum == 9) meCrate9HTRStatus_ -> Fill(slotnum,i);
1026  else if (cratenum ==10)meCrate10HTRStatus_ -> Fill(slotnum,i);
1027  else if (cratenum ==11)meCrate11HTRStatus_ -> Fill(slotnum,i);
1028  else if (cratenum ==12)meCrate12HTRStatus_ -> Fill(slotnum,i);
1029  else if (cratenum ==13)meCrate13HTRStatus_ -> Fill(slotnum,i);
1030  else if (cratenum ==14)meCrate14HTRStatus_ -> Fill(slotnum,i);
1031  else if (cratenum ==15)meCrate15HTRStatus_ -> Fill(slotnum,i);
1032  else if (cratenum ==17)meCrate17HTRStatus_ -> Fill(slotnum,i);
1033  }
1034  }
1035  }
1036 
1037  // Fish out Front-End Errors from the precision channels
1038  const short unsigned int* daq_first, *daq_last, *tp_first, *tp_last;
1039  const HcalQIESample* qie_begin, *qie_end, *qie_work;
1040 
1041  // get pointers
1042  htr.dataPointers(&daq_first,&daq_last,&tp_first,&tp_last);
1043  qie_begin=(HcalQIESample*)daq_first;
1044  qie_end=(HcalQIESample*)(daq_last+1); // one beyond last..
1045 
1046  //TESTME_HCALRAWDATA//if (dccid==715 && spigot==5 && tevt_%3==0)
1047  //TESTME_HCALRAWDATA// Chann_DataIntegrityCheck_[dcc_][16][spg2offset]++;
1048 
1049  int lastcapid=-1;
1050  int samplecounter=-1;
1051  int htrchan=-1; // Valid: [1,24]
1052  int chn2offset=0;
1053  int NTS = htr.getNDD(); //number time slices, in precision channels
1054 
1055  ChannSumm_DataIntegrityCheck_ [fed2offset-1][spg2offset+0]=-NTS;//For normalization by client - NB! negative!
1056  // Run over DAQ words for this spigot
1057  for (qie_work=qie_begin; qie_work!=qie_end; qie_work++) {
1058  if (qie_work->raw()==0xFFFF) // filler word
1059  continue;
1060  //Beginning a channel's samples?
1061  if (( 1 + ( 3* (qie_work->fiber()-1) ) + qie_work->fiberChan() ) != htrchan) { //new channel starting
1062  // A fiber [1..8] carries three fiber channels, each is [0..2]. Make htrchan [1..24]
1063  htrchan= (3* (qie_work->fiber()-1) ) + qie_work->fiberChan();
1064  chn2offset = (htrchan*3)+1;
1065  --ChannSumm_DataIntegrityCheck_ [fed2offset-1][spg2offset-1];//event tally -- NB! negative!
1066  --Chann_DataIntegrityCheck_[dcc_][chn2offset-1][spg2offset-1];//event tally -- NB! negative!
1067  if (samplecounter !=-1) { //Wrap up the previous channel if there is one
1068  //Check the previous digi for number of timeslices
1069  if (((samplecounter != NTS) &&
1070  (samplecounter != 1) )
1071  //||
1072  //((htrchan==5) && (spigot==5) && (dcc_==5))
1073  )
1074  { //Wrong DigiSize
1075  ++ChannSumm_DataIntegrityCheck_ [fed2offset+0][spg2offset+0];
1076  ++Chann_DataIntegrityCheck_[dcc_][chn2offset+0][spg2offset+0];
1077  mapChannproblem(dcc_,spigot,htrchan);
1078  if (debug_)std::cout <<"mapChannelProblem: Wrong Digi Size"<<std::endl;
1079  }
1080  }
1081  //set up for this new channel
1082  lastcapid=qie_work->capid();
1083  samplecounter=1;} // fi (qie_work->fiberAndChan() != lastfibchan)
1084  else { //precision samples not the first timeslice
1085  int hope = lastcapid +1;// What capid would we hope for here?
1086  if (hope==4) hope = 0; // What capid would we hope for here?
1087  if (qie_work->capid() != hope){
1088  ++ChannSumm_DataIntegrityCheck_ [fed2offset+1][spg2offset+0];
1089  ++Chann_DataIntegrityCheck_[dcc_][chn2offset+1][spg2offset+0];
1090  mapChannproblem(dcc_,spigot,htrchan);
1091  if (debug_)std::cout <<"mapChannelProblem: Wrong Cap ID"<<std::endl;
1092  }
1093  lastcapid=qie_work->capid();
1094  samplecounter++;}
1095  //For every sample, whether the first of the channel or not, !DV, Er
1096  if (!(qie_work->dv())){
1097  ++ChannSumm_DataIntegrityCheck_ [fed2offset+0][spg2offset+1];
1098  ++Chann_DataIntegrityCheck_[dcc_][chn2offset+0][spg2offset+1];
1099  }
1100  if (qie_work->er()) { // FEE - Front End Error
1101  ++ChannSumm_DataIntegrityCheck_ [fed2offset+1][spg2offset+1];
1102  ++Chann_DataIntegrityCheck_[dcc_][chn2offset+1][spg2offset+1];
1103  mapChannproblem(dcc_,spigot,htrchan);
1104  if (debug_)std::cout <<"mapChannelProblem: FE Error"<<std::endl;
1105  }
1106  } // for (qie_work = qie_begin;...) end loop over all timesamples in this spigot
1107  //Wrap up the last channel
1108  //Check the last digi for number of timeslices
1109  if ((samplecounter != NTS) &&
1110  (samplecounter != 1) &&
1111  (samplecounter !=-1) ) { //Wrong DigiSize (unexpected num. timesamples)
1112  ++ChannSumm_DataIntegrityCheck_ [fed2offset+0][spg2offset+0];
1113  ++Chann_DataIntegrityCheck_[dcc_][chn2offset+0][spg2offset+0];
1114  mapChannproblem(dcc_,spigot,htrchan);
1115  if (debug_)std::cout <<"mapChannelProblem: Wrong Digi Size (last digi)"<<std::endl;
1116  }
1117  unsigned int fib1BCN = htr.getFib1OrbMsgBCN();
1118  unsigned int fib2BCN = htr.getFib2OrbMsgBCN();
1119  unsigned int fib3BCN = htr.getFib3OrbMsgBCN();
1120  unsigned int fib4BCN = htr.getFib4OrbMsgBCN();
1121  unsigned int fib5BCN = htr.getFib5OrbMsgBCN();
1122  unsigned int fib6BCN = htr.getFib6OrbMsgBCN();
1123  unsigned int fib7BCN = htr.getFib7OrbMsgBCN();
1124  unsigned int fib8BCN = htr.getFib8OrbMsgBCN();
1125  meFibBCN_->Fill(fib1BCN);
1126  meFibBCN_->Fill(fib2BCN);
1127  meFibBCN_->Fill(fib3BCN);
1128  meFibBCN_->Fill(fib4BCN);
1129  meFibBCN_->Fill(fib5BCN);
1130  meFibBCN_->Fill(fib6BCN);
1131  meFibBCN_->Fill(fib7BCN);
1132  meFibBCN_->Fill(fib8BCN);
1133  // Disable for now?
1134  meFib1OrbMsgBCN_->Fill(slotnum, cratenum, fib1BCN);
1135  meFib2OrbMsgBCN_->Fill(slotnum, cratenum, fib2BCN);
1136  meFib3OrbMsgBCN_->Fill(slotnum, cratenum, fib3BCN);
1137  meFib4OrbMsgBCN_->Fill(slotnum, cratenum, fib4BCN);
1138  meFib5OrbMsgBCN_->Fill(slotnum, cratenum, fib5BCN);
1139  meFib6OrbMsgBCN_->Fill(slotnum, cratenum, fib6BCN);
1140  meFib7OrbMsgBCN_->Fill(slotnum, cratenum, fib7BCN);
1141  meFib8OrbMsgBCN_->Fill(slotnum, cratenum, fib8BCN);
1142  } // loop over spigots
1143  return;
1144 } // loop over DCCs void HcalRawDataMonitor::unpack(
1145 
1146 
1147 // End LumiBlock
1149  const edm::EventSetup& c){
1150  // Reset current LS histogram, if it exists
1151  if (ProblemsCurrentLB)
1153  if (ProblemsCurrentLB)
1154  {
1155  ProblemsCurrentLB->setBinContent(0,0, levt_); // underflow bin contains number of events
1163  }
1164 
1165  UpdateMEs();
1166 }
1167 // EndRun -- Anything to do here?
1169 
1170 // EndJob
1172  if (debug_>0) std::cout <<"HcalRawDataMonitor::endJob()"<<std::endl;
1173  if (enableCleanup_) cleanup(); // when do we force cleanup?
1174 }
1175 
1176 //No size checking; better have enough y-axis bins!
1178  char label[32];
1179  for (int spig=0; spig<HcalDCCHeader::SPIGOT_COUNT; spig++) {
1180  snprintf(label, 32, "Spgt %02d", spig);
1181  me_ptr->setBinLabel((2+(spig*ybins)), label, 2); //margin of 1 at low value
1182  }
1183 }
1184 
1185 //No size checking; better have enough x-axis bins!
1187  char label[32];
1188  for (int ch=0; ch<HcalHTRData::CHANNELS_PER_SPIGOT; ch++) {
1189  snprintf(label, 32, "Ch %02d", ch+1);
1190  me_ptr->setBinLabel((2+(ch*xbins)), label, 1); //margin of 3 at low value
1191  }
1192 }
1193 
1194 //No size checking; better have enough x-axis bins!
1196  char label[32];
1197  for (int thfed=0; thfed<NUMDCCS; thfed++) {
1198  snprintf(label, 32, "%03d", thfed+700);
1199  me_ptr->setBinLabel((2+(thfed*xbins)), label, 1); //margin of 1 at low value
1200  }
1201 }
1202 
1203 void HcalRawDataMonitor::labelHTRBits(MonitorElement* mePlot,unsigned int axisType) {
1204 
1205  if (axisType !=1 && axisType != 2) return;
1206 
1207  mePlot -> setBinLabel(1,"Overflow Warn",axisType);
1208  mePlot -> setBinLabel(2,"Buffer Busy",axisType);
1209  mePlot -> setBinLabel(3,"Empty Event",axisType);
1210  mePlot -> setBinLabel(4,"Rejected L1A",axisType);
1211  mePlot -> setBinLabel(5,"Invalid Stream",axisType);
1212  mePlot -> setBinLabel(6,"Latency Warn",axisType);
1213  mePlot -> setBinLabel(7,"OptDat Err",axisType);
1214  mePlot -> setBinLabel(8,"Clock Err",axisType);
1215  mePlot -> setBinLabel(9,"Bunch Err",axisType);
1216  mePlot -> setBinLabel(10,"b9",axisType);
1217  mePlot -> setBinLabel(11,"b10",axisType);
1218  mePlot -> setBinLabel(12,"b11",axisType);
1219  mePlot -> setBinLabel(13,"Test Mode",axisType);
1220  mePlot -> setBinLabel(14,"Histo Mode",axisType);
1221  mePlot -> setBinLabel(15,"Calib Trig",axisType);
1222  mePlot -> setBinLabel(16,"Bit15 Err",axisType);
1223 
1224  return;
1225 }
1226 
1227 void HcalRawDataMonitor::stashHDI(int thehash, HcalDetId thehcaldetid) {
1228  //Let's not allow indexing off the array...
1229  if ((thehash<0)||(thehash>(NUMDCCS*NUMSPIGS*HTRCHANMAX)))return;
1230  //...but still do the job requested.
1231  hashedHcalDetId_[thehash] = thehcaldetid;
1232 }
1233 
1234 //Debugging output for single half-HTRs (single spigot)
1235 //-->Class member debug_ usually passed for prtlvl argument.<--
1236 void HcalRawDataMonitor::HTRPrint(const HcalHTRData& htr,int prtlvl){
1237  if (prtlvl == 1){
1238  int cratenum = htr.readoutVMECrateId();
1239  float slotnum = htr.htrSlot() + 0.5*htr.htrTopBottom();
1240  printf("Crate,Slot,ErrWord,Evt#,BCN: %3i %4.1f %6X %7i %4X \n", cratenum,slotnum,htr.getErrorsWord(),htr.getL1ANumber(),htr.getBunchNumber());
1241  // printf(" DLLunlk,TTCrdy:%2i %2i \n",htr.getDLLunlock(),htr.getTTCready());
1242  }
1243  // This one needs new version of HcalHTRData.h to activate
1244  else if (prtlvl == 2){
1245  int cratenum = htr.readoutVMECrateId();
1246  float slotnum = htr.htrSlot() + 0.5*htr.htrTopBottom();
1247  printf("Crate, Slot:%3i %4.1f \n", cratenum,slotnum);
1248  // printf(" Ext Hdr: %4X %4X %4X %4X %4X %4X %4X %4X \n",htr.getExtHdr1(),htr.getExtHdr2(),htr.getExtHdr3(),htr.getExtHdr4(),htr.getExtHdr5(),htr.getExtHdr6(),htr.getExtHdr7(),htr.getExtHdr8());
1249  }
1250 
1251  else if (prtlvl == 3){
1252  int cratenum = htr.readoutVMECrateId();
1253  float slotnum = htr.htrSlot() + 0.5*htr.htrTopBottom();
1254  printf("Crate, Slot:%3i %4.1f", cratenum,slotnum);
1255  printf(" FibOrbMsgBCNs: %4X %4X %4X %4X %4X %4X %4X %4X \n",htr.getFib1OrbMsgBCN(),htr.getFib2OrbMsgBCN(),htr.getFib3OrbMsgBCN(),htr.getFib4OrbMsgBCN(),htr.getFib5OrbMsgBCN(),htr.getFib6OrbMsgBCN(),htr.getFib7OrbMsgBCN(),htr.getFib8OrbMsgBCN());
1256  }
1257 
1258  return;
1259 }
1260 
1261 
1263  tevt_=0;
1264  if (meTevtHist_) tevt_= (int)meTevtHist_->getBinContent(1);
1265  NumBadHB=0;
1266  NumBadHE=0;
1267  NumBadHO=0;
1268  NumBadHF=0;
1269  NumBadHFLUMI=0;
1270  NumBadHO0=0;
1271  NumBadHO12=0;
1272 
1273 
1275  for (int x=0; x<THREE_FED; x++)
1276  for (int y=0; y<THREE_SPG; y++)
1279 
1281  for (int x=0; x<THREE_FED; x++)
1282  for (int y=0; y<THREE_SPG; y++)
1285 
1287  for (int x=0; x<TWO___FED; x++)
1288  for (int y=0; y<TWO__SPGT; y++)
1291 
1292  for (int f=0; f<NUMDCCS; f++){
1294  for (int x=0; x<TWO_CHANN; x++)
1295  for (int y=0; y<TWO__SPGT; y++)
1296  if (Chann_DataIntegrityCheck_[f][x][y])
1298  }
1299 
1301  for (int x=0; x<TWO___FED; x++)
1302  for (int y=0; y<THREE_SPG; y++)
1303  if (DataFlowInd_[x][y])
1305 } //UpdateMEs
1306 
1307 //Increment the NumBad counter for this LS, for this Hcal subdet
1309 // if (subdet==HcalBarrel) ++NumBadHB;
1310 // else if (subdet==HcalEndcap) ++NumBadHE;
1311 // else if (subdet==HcalOuter)
1312 // {
1313 // ++NumBadHO;
1314 // if (abs(ieta)<5) ++NumBadHO0;
1315 // else ++NumBadHO12;
1316 // }
1317 // else if (subdet==HcalForward)
1318 // {
1319 // ++NumBadHF;
1320 // if (depth==1 && (abs(ieta)==33 || abs(ieta)==34))
1321 // ++NumBadHFLUMI;
1322 // else if (depth==2 && (abs(ieta)==35 || abs(ieta)==36))
1323 // ++NumBadHFLUMI;
1324 // }
1325 }
1326 
1328  int myeta = 0;
1329  int myphi =-1;
1330  int mydepth = 0;
1331  HcalDetId HDI;
1332  //Light up all affected cells.
1333  for (int i=hashup(dcc);
1334  i<hashup(dcc)+(NUMSPIGS*HTRCHANMAX);
1335  i++) {
1336  HDI = hashedHcalDetId_[i];
1337  if (HDI==HcalDetId::Undefined)
1338  continue;
1339  mydepth = HDI.depth();
1340  myphi = HDI.iphi();
1341  myeta = CalcEtaBin(HDI.subdet(),
1342  HDI.ieta(),
1343  mydepth);
1344  //Protect against indexing off array
1345  if (myeta>=0 && myeta<85 &&
1346  (myphi-1)>=0 && (myphi-1)<72 &&
1347  (mydepth-1)>=0 && (mydepth-1)<4){
1348  problemfound[myeta][myphi-1][mydepth-1] = true;
1349 
1350  //exlcude the decommissioned HO ring2, except SiPMs
1351  if(mydepth==4 && excludeHORing2_==true)
1352  if (abs(HDI.ieta())>=11 && abs(HDI.ieta())<=15 && !isSiPM(HDI.ieta(),HDI.iphi(),mydepth))
1353  problemfound[myeta][myphi-1][mydepth-1] = false;
1354 
1355  if (debug_>0)
1356  std::cout<<" mapDCCproblem found error! "<<HDI.subdet()<<"("<<HDI.ieta()<<", "<<HDI.iphi()<<", "<<HDI.depth()<<")"<<std::endl;
1357  }
1358  }
1359 }
1360 void HcalRawDataMonitor::mapHTRproblem(int dcc, int spigot) {
1361  int myeta = 0;
1362  int myphi =-1;
1363  int mydepth = 0;
1364  HcalDetId HDI;
1365  //Light up all affected cells.
1366  for (int i=hashup(dcc,spigot);
1367  i<hashup(dcc,spigot)+(HTRCHANMAX); //nice, linear hash....
1368  i++) {
1369  HDI = hashedHcalDetId_[i];
1370  if (HDI==HcalDetId::Undefined) {
1371  continue;
1372  }
1373  mydepth = HDI.depth();
1374  myphi = HDI.iphi();
1375  myeta = CalcEtaBin(HDI.subdet(),
1376  HDI.ieta(),
1377  mydepth);
1378  //Protect against indexing off array
1379  if (myeta>=0 && myeta<85 &&
1380  (myphi-1)>=0 && (myphi-1)<72 &&
1381  (mydepth-1)>=0 && (mydepth-1)<4){
1382  problemfound[myeta][myphi-1][mydepth-1] = true;
1383 
1384  //exlcude the decommissioned HO ring2, except SiPMs
1385  if(mydepth==4 && excludeHORing2_==true)
1386  if (abs(HDI.ieta())>=11 && abs(HDI.ieta())<=15 && !isSiPM(HDI.ieta(),HDI.iphi(),mydepth))
1387  problemfound[myeta][myphi-1][mydepth-1] = false;
1388 
1389  if (debug_>0)
1390  std::cout<<" mapDCCproblem found error! "<<HDI.subdet()<<"("<<HDI.ieta()<<", "<<HDI.iphi()<<", "<<HDI.depth()<<")"<<std::endl;
1391  }
1392 
1393  }
1394 } // void HcalRawDataMonitor::mapHTRproblem(...)
1395 
1396 void HcalRawDataMonitor::mapChannproblem(int dcc, int spigot, int htrchan) {
1397  int myeta = 0;
1398  int myphi =-1;
1399  int mydepth = 0;
1400  HcalDetId HDI;
1401  //Light up the affected cell.
1402  int i=hashup(dcc,spigot,htrchan);
1403  HDI = HashToHDI(i);
1404  if (HDI==HcalDetId::Undefined) {
1405  return; // Do nothing at all, instead.
1406  }
1407  mydepth = HDI.depth();
1408  myphi = HDI.iphi();
1409  myeta = CalcEtaBin(HDI.subdet(),
1410  HDI.ieta(),
1411  mydepth);
1412  //Protect against indexing off array
1413  if (myeta>=0 && myeta<85 &&
1414  (myphi-1)>=0 && (myphi-1)<72 &&
1415  (mydepth-1)>=0 && (mydepth-1)<4){
1416  problemfound[myeta][myphi-1][mydepth-1] = true;
1417 
1418  //exlcude the decommissioned HO ring2, except SiPMs
1419  if(mydepth==4 && excludeHORing2_==true)
1420  if (abs(HDI.ieta())>=11 && abs(HDI.ieta())<=15 && !isSiPM(HDI.ieta(),HDI.iphi(),mydepth))
1421  problemfound[myeta][myphi-1][mydepth-1] = false;
1422 
1423  if (debug_>0)
1424  std::cout<<" mapDCCproblem found error! "<<HDI.subdet()<<"("<<HDI.ieta()<<", "<<HDI.iphi()<<", "<<HDI.depth()<<")"<<std::endl;
1425  }
1426 } // void HcalRawDataMonitor::mapChannproblem(...)
1427 
1428 
1430 
MonitorElement * meCh_DataIntegrityFED04_
bool isHO(int etabin, int depth)
type
Definition: HCALResponse.h:22
MonitorElement * meCh_DataIntegrityFED27_
T getParameter(std::string const &) const
float ChannSumm_DataIntegrityCheck_[TWO___FED][TWO__SPGT]
unsigned int getFib6OrbMsgBCN() const
Definition: HcalHTRData.h:189
static const HcalDetId Undefined
Definition: HcalDetId.h:66
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meUSFractSpigs_
MonitorElement * meCh_DataIntegrityFED23_
int i
Definition: DBlmapReader.cc:9
MonitorElement * meBCN_
bool LumiInOrder(int lumisec)
int getSpigotSummary(int nspigot) const
Definition: HcalDCCHeader.h:84
MonitorElement * meCDFErrorFound_
int getNDD() const
Get the number of daq data samples per channel when not zero-suppressed.
Definition: HcalHTRData.cc:363
unsigned int getFib1OrbMsgBCN() const
Get the BCN of the Fiber Orbit Messages.
Definition: HcalHTRData.h:170
MonitorElement * meCrate7HTRStatus_
void label_xFEDs(MonitorElement *me_ptr, int xbins)
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * meCrate4HTRStatus_
bool check()
Definition: FEDTrailer.cc:66
unsigned int getSlink64ReservedBits() const
Definition: HcalDCCHeader.h:50
MonitorElement * ProblemsCurrentLB
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
unsigned char getSpigotErrorBits(unsigned int nspigot) const
Access the HTR error bits (decoding tbd)
MonitorElement * meCh_DataIntegrityFED25_
MonitorElement * meCh_DataIntegrityFED13_
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
unsigned int getSpigotDataLength(int nspigot) const
Definition: HcalDCCHeader.h:98
void whosebad(int subdet)
uint16_t raw() const
get the raw word
Definition: HcalQIESample.h:22
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:32
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event...
Definition: HcalHTRData.cc:62
const std::string & label
Definition: MVAComputer.cc:186
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
const double xbins[]
MonitorElement * meEvtNumberSynch_
#define TWO_CHANN
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:519
MonitorElement * meCrate3HTRStatus_
unsigned int htrTopBottom() const
HcalElectronicsId-style HTR top/bottom (1=top/0=bottom)
Definition: HcalHTRData.cc:317
MonitorElement * meCh_DataIntegrityFED02_
MonitorElement * meCh_DataIntegrityFED05_
MonitorElement * meFib5OrbMsgBCN_
#define THREE_FED
MonitorElement * meCh_DataIntegrityFED09_
int getAcceptTimeTTS() const
Definition: HcalDCCHeader.h:60
#define HTRCHANMAX
int fiberChan() const
get the fiber channel number
Definition: HcalQIESample.h:36
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
MonitorElement * meBCNCheck_
#define NUMDCCS
std::vector< int > AllowedCalibTypes_
MonitorElement * meCrate17HTRStatus_
bool getSpigotCRCError(unsigned int nspigot) const
Read the &quot;CRC-Mismatch&quot; bit for this spigot.
MonitorElement * meChannSumm_DataIntegrityCheck_
void stashHDI(int thehash, HcalDetId thehcaldetid)
virtual void cleanup(void)
void processEvent(const FEDRawDataCollection &rawraw, const HcalUnpackerReport &report)
bool moreTrailers()
Definition: FEDTrailer.cc:39
MonitorElement * meCrate13HTRStatus_
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
bool dv() const
is the Data Valid bit set?
Definition: HcalQIESample.h:30
#define abs(x)
Definition: mlp_lapack.h:159
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
std::map< int, short > CDFversionNumber_list
MonitorElement * meOrNCheck_
HcalDetId hashedHcalDetId_[NUMDCCS *NUMSPIGS *HTRCHANMAX]
unsigned int getExtHdr6() const
Definition: HcalHTRData.h:214
#define NULL
Definition: scimark2.h:8
unsigned int getFib8OrbMsgBCN() const
Definition: HcalHTRData.h:197
#define min(a, b)
Definition: mlp_lapack.h:161
MonitorElement * meCrate2HTRStatus_
std::map< int, short > CDFReservedBits_list
void label_xChanns(MonitorElement *me_ptr, int xbins)
void update(void)
Mark the object updated.
MonitorElement * meBCNSynch_
bool isHE(int etabin, int depth)
static const int CHANNELS_PER_SPIGOT
Definition: HcalHTRData.h:20
bool thereIsAThirdCDFHeaderWord() const
Definition: HcalDCCHeader.h:46
uint64_t problemcount[ETABINS][PHIBINS][DEPTHBINS]
MonitorElement * meCrate14HTRStatus_
int getSpigotData(int nspigot, HcalHTRData &decodeTool, int validSize) const
MonitorElement * meCh_DataIntegrityFED03_
void analyze(const edm::Event &e, const edm::EventSetup &c)
unsigned char getLRBErrorBits(unsigned int nspigot) const
Access the Link Receiver Board error bits (decoding tbd)
#define NUMSPIGS
unsigned int getOrbitNumber() const
Get the HTR orbit number.
Definition: HcalHTRData.cc:299
void labelHTRBits(MonitorElement *mePlot, unsigned int axisType)
T eta() const
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
MonitorElement * meCrate15HTRStatus_
void beginRun(const edm::Run &run, const edm::EventSetup &c)
MonitorElement * meDataFlowInd_
void Fill(long long x)
MonitorElement * meCh_DataIntegrityFED14_
std::map< int, short >::iterator CDFReservedBits_it
tuple report
Definition: zeeHLT_cff.py:9
unsigned int getOrbitNumber() const
Definition: HcalDCCHeader.h:48
float LRBDataCorruptionIndicators_[THREE_FED][THREE_SPG]
#define TWO__SPGT
int getBunchId() const
Definition: HcalDCCHeader.h:36
bool isSiPM(int ieta, int iphi, int depth)
unsigned int htrSlot() const
HcalElectronicsId-style HTR slot.
Definition: HcalHTRData.cc:313
int depth() const
get the tower depth
Definition: HcalDetId.h:42
MonitorElement * meCrate6HTRStatus_
virtual void beginRun(const edm::Run &run, const edm::EventSetup &c)
MonitorElement * meTevtHist_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
edm::InputTag FEDRawDataCollection_
MonitorElement * meCh_DataIntegrityFED24_
std::map< int, short >::iterator DCCEvtFormat_it
Definition: DDAxes.h:10
MonitorElement * meCh_DataIntegrityFED06_
bool getBxMismatchWithDCC(unsigned int nspigot) const
Read the &quot;BxID FAILS TO MATCH WITH DCC&quot; bit for this spigot.
const T & max(const T &a, const T &b)
unsigned int getFib7OrbMsgBCN() const
Definition: HcalHTRData.h:193
const HcalElectronicsMap * readoutMap_
MonitorElement * HTR_StatusWd_HO
MonitorElement * meCrate5HTRStatus_
void unpack(const FEDRawData &raw)
MonitorElement * meCrate0HTRStatus_
MonitorElement * meChann_DataIntegrityCheck_[NUMDCCS]
const int getRawLength() const
Get the length of the raw data.
Definition: HcalHTRData.h:40
int ieta() const
get the cell ieta
Definition: HcalDetId.h:38
HcalSubdetector
Definition: HcalAssistant.h:32
MonitorElement * meOrNSynch_
int j
Definition: DBlmapReader.cc:9
void endRun(const edm::Run &run, const edm::EventSetup &c)
double f[11][100]
bool problemfound[ETABINS][PHIBINS][DEPTHBINS]
void label_ySpigots(MonitorElement *me_ptr, int ybins)
int fiber() const
get the fiber number
Definition: HcalQIESample.h:34
bool getSpigotPresent(unsigned int nspigot) const
Read the &quot;PRESENT&quot; bit for this spigot.
MonitorElement * meCh_DataIntegrityFED11_
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:833
MonitorElement * meCrate12HTRStatus_
std::map< int, short >::iterator CDFvers_it
MonitorElement * meCh_DataIntegrityFED17_
bool isHB(int etabin, int depth)
MonitorElement * meFibBCN_
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
MonitorElement * meDCCEventFormatError_
MonitorElement * meCh_DataIntegrityFED30_
MonitorElement * medccBCN_
MonitorElement * meCh_DataIntegrityFED12_
int CalcIeta(int subdet, int eta, int depth)
unsigned int getFib3OrbMsgBCN() const
Definition: HcalHTRData.h:177
#define TWO___FED
MonitorElement * HTR_StatusWd_HBHE
bool getSpigotEnabled(unsigned int nspigot) const
Read the &quot;ENABLED&quot; bit for this spigot.
MonitorElement * meCh_DataIntegrityFED10_
MonitorElement * meFib4OrbMsgBCN_
int ttsBits()
Current value of the Trigger Throttling System bitsAQ).
Definition: FEDTrailer.cc:34
MonitorElement * meInvHTRData_
int getSourceId() const
Definition: HcalDCCHeader.h:34
MonitorElement * meCh_DataIntegrityFED19_
int iphi() const
get the cell iphi
Definition: HcalDetId.h:40
void mapHTRproblem(int dcc, int spigot)
Definition: DetId.h:20
MonitorElement * meEvtNCheck_
MonitorElement * meBCNwhenOrNDiff_
bool isHF(int etabin, int depth)
MonitorElement * meFib1OrbMsgBCN_
void HTRPrint(const HcalHTRData &htr, int prtlvl)
unsigned long long uint64_t
Definition: Time.h:15
MonitorElement * meCrate11HTRStatus_
int capid() const
get the Capacitor id
Definition: HcalQIESample.h:28
MonitorElement * meFib8OrbMsgBCN_
unsigned int getFib5OrbMsgBCN() const
Definition: HcalHTRData.h:185
const unsigned short * getRawData() const
Get a pointer to the raw data.
Definition: HcalHTRData.h:37
int lenght()
The length of the event fragment counted in 64-bit words including header and trailer.
Definition: FEDTrailer.cc:19
MonitorElement * meLRBDataCorruptionIndicators_
void dataPointers(const unsigned short **daq_first, const unsigned short **daq_last, const unsigned short **tp_first, const unsigned short **tp_last) const
Obtain the starting and ending pointers for external unpacking of the data.
Definition: HcalHTRData.cc:128
MonitorElement * meCh_DataIntegrityFED08_
#define DEPTHBINS
unsigned int getErrorsWord() const
Get the errors word.
Definition: HcalHTRData.h:144
MonitorElement * meCh_DataIntegrityFED29_
MonitorElement * meCh_DataIntegrityFED00_
const T & get() const
Definition: EventSetup.h:55
#define ETABINS
bool null() const
is this a null id ?
Definition: DetId.h:47
MonitorElement * meCh_DataIntegrityFED26_
float HalfHTRDataCorruptionIndicators_[THREE_FED][THREE_SPG]
MonitorElement * meCrate1HTRStatus_
unsigned int getExtHdr7() const
Definition: HcalHTRData.h:216
MonitorElement * meStatusWdCrate_
MonitorElement * meFib7OrbMsgBCN_
short BOEshouldBeZeroAlways() const
Definition: HcalDCCHeader.h:52
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
void mapChannproblem(int dcc, int spigot, int htrchan)
int CalcEtaBin(int subdet, int ieta, int depth)
unsigned int readoutVMECrateId() const
HcalElectronicsId-style VME crate number.
Definition: HcalHTRData.cc:321
bool getSpigotValid(unsigned int nspigot) const
Read the &quot;VALID&quot; bit for this spigot; TTC EvN matched HTR EvN.
MonitorElement * meCh_DataIntegrityFED16_
#define THREE_SPG
unsigned int getFib4OrbMsgBCN() const
Definition: HcalHTRData.h:181
MonitorElement * meCh_DataIntegrityFED07_
static const int SPIGOT_COUNT
Definition: HcalDCCHeader.h:21
double getBinContent(int binx) const
get content of bin (1-D)
uint64_t UScount[NUMDCCS][NUMSPIGS]
MonitorElement * meEvFragSize_
MonitorElement * HTR_StatusWd_HF
MonitorElement * meCh_DataIntegrityFED28_
#define update(a, b)
unsigned int getBunchNumber() const
Get the HTR bunch number.
Definition: HcalHTRData.h:102
unsigned int getFib2OrbMsgBCN() const
Definition: HcalHTRData.h:173
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
MonitorElement * meFib2OrbMsgBCN_
#define PHIBINS
float Chann_DataIntegrityCheck_[NUMDCCS][TWO_CHANN][TWO__SPGT]
MonitorElement * meEvFragSize2_
bool getSpigotDataTruncated(unsigned int nspigot) const
Read the &quot;TRUNCATED&quot; bit for this spigot; LRB truncated data (took too long)
tuple cout
Definition: gather_cfg.py:41
short getCDFversionNumber() const
Definition: HcalDCCHeader.h:32
short getDCCDataFormatVersion() const
Definition: HcalDCCHeader.h:59
MonitorElement * meDCCVersion_
MonitorElement * meCh_DataIntegrityFED20_
std::map< int, short > DCCEvtFormat_list
MonitorElement * meCrate10HTRStatus_
string s
Definition: asciidump.py:422
unsigned int getFirmwareRevision() const
Get the HTR firmware version.
Definition: HcalHTRData.cc:381
MonitorElement * meHTRFWVersion_
MonitorElement * meFEDRawDataSizes_
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:426
unsigned short BOEshouldBe5Always() const
Definition: HcalDCCHeader.h:42
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:647
MonitorElement * meCh_DataIntegrityFED01_
MonitorElement * mefedEntries_
virtual void setup(void)
MonitorElement * meCh_DataIntegrityFED15_
float DataFlowInd_[TWO___FED][THREE_SPG]
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
unsigned int getL1ANumber() const
Get the HTR event number.
Definition: HcalHTRData.h:98
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * meCh_DataIntegrityFED31_
bool thereIsASecondCDFHeaderWord() const
Definition: HcalDCCHeader.h:30
HcalDetId HashToHDI(int thehash)
void Reset(void)
reset ME (ie. contents, errors, etc)
unsigned long getDCCEventNumber() const
Definition: HcalDCCHeader.h:38
MonitorElement * meHalfHTRDataCorruptionIndicators_
edm::InputTag digiLabel_
int hashup(uint32_t d=0, uint32_t s=0, uint32_t c=1)
MonitorElement * meFib3OrbMsgBCN_
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
bool er() const
is the error bit set?
Definition: HcalQIESample.h:32
MonitorElement * meCh_DataIntegrityFED21_
MonitorElement * meFib6OrbMsgBCN_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:360
Definition: Run.h:31
MonitorElement * meCh_DataIntegrityFED18_
MonitorElement * meCrate9HTRStatus_
MonitorElement * meCh_DataIntegrityFED22_
Definition: DDAxes.h:10