CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalDigiMonitor.cc
Go to the documentation of this file.
3 #include <cmath>
4 
10 
11 // constructor
13 {
14  Online_ = ps.getUntrackedParameter<bool>("online",false);
15  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns",false);
16  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
17  debug_ = ps.getUntrackedParameter<int>("debug",0);
18  prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
19  if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
20  prefixME_.append("/");
21  subdir_ = ps.getUntrackedParameter<std::string>("TaskFolder","DigiMonitor_Hcal");
22  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
23  subdir_.append("/");
24  subdir_=prefixME_+subdir_;
25  AllowedCalibTypes_ = ps.getUntrackedParameter<std::vector<int> > ("AllowedCalibTypes");
26  skipOutOfOrderLS_ = ps.getUntrackedParameter<bool>("skipOutOfOrderLS",true);
27  NLumiBlocks_ = ps.getUntrackedParameter<int>("NLumiBlocks",4000);
28  makeDiagnostics_ = ps.getUntrackedParameter<bool>("makeDiagnostics",false);
30  FEDRawDataCollection_ = ps.getUntrackedParameter<edm::InputTag>("FEDRawDataCollection");
31  shapeThresh_ = ps.getUntrackedParameter<int>("shapeThresh",20);
32  //shapeThresh_ is used for plotting pulse shapes for all digis with pedestal-subtracted ADC sum > shapeThresh_;
33  shapeThreshHB_ = ps.getUntrackedParameter<int>("shapeThreshHB",shapeThresh_);
34  shapeThreshHE_ = ps.getUntrackedParameter<int>("shapeThreshHE",shapeThresh_);
35  shapeThreshHF_ = ps.getUntrackedParameter<int>("shapeThreshHF",shapeThresh_);
36  shapeThreshHO_ = ps.getUntrackedParameter<int>("shapeThreshHO",shapeThresh_);
37 
38  hltresultsLabel_ = ps.getUntrackedParameter<edm::InputTag>("HLTResultsLabel");
39  MinBiasHLTBits_ = ps.getUntrackedParameter<std::vector<std::string> >("MinBiasHLTBits");
40  excludeHORing2_ = ps.getUntrackedParameter<bool>("excludeHORing2",false);
41  excludeHO1P02_ = ps.getUntrackedParameter<bool>("excludeHO1P02",false);
42  excludeBadQPLLs_ = ps.getUntrackedParameter<bool>("excludeBadQPLL",false);
43 
44  if (debug_>0)
45  std::cout <<"<HcalDigiMonitor> Digi shape ADC threshold set to: >" << shapeThresh_ <<" counts above nominal pedestal (3*10)"<< std::endl;
46 
47  // Specify which tests to run when looking for problem digis
48  digi_checkoccupancy_ = ps.getUntrackedParameter<bool>("checkForMissingDigis",false); // off by default -- checked by dead cell monitor
49  digi_checkcapid_ = ps.getUntrackedParameter<bool>("checkCapID",true);
50  digi_checkdigisize_ = ps.getUntrackedParameter<bool>("checkDigiSize",true);
51  digi_checkadcsum_ = ps.getUntrackedParameter<bool>("checkADCsum",true);
52  digi_checkdverr_ = ps.getUntrackedParameter<bool>("checkDVerr",true);
53  mindigisizeHBHE_ = ps.getUntrackedParameter<int>("minDigiSizeHBHE",1);
54  maxdigisizeHBHE_ = ps.getUntrackedParameter<int>("maxDigiSizeHBHE",10);
55  mindigisizeHO_ = ps.getUntrackedParameter<int>("minDigiSizeHO",1);
56  maxdigisizeHO_ = ps.getUntrackedParameter<int>("maxDigiSizeHO",10);
57  mindigisizeHF_ = ps.getUntrackedParameter<int>("minDigiSizeHF",1);
58  maxdigisizeHF_ = ps.getUntrackedParameter<int>("maxDigiSizeHF",10);
59 
60 
61  badChannelStatusMask_ = ps.getUntrackedParameter<int>("BadChannelStatusMask",
62  ps.getUntrackedParameter<int>("BadChannelStatusMask",
63  (1<<HcalChannelStatus::HcalCellDead))); // identify channel status values to mask
64  if (debug_>1)
65  {
66  std::cout <<"<HcalDigiMonitor> Checking for the following problems:"<<std::endl;
67  if (digi_checkcapid_) std::cout <<"\tChecking that cap ID rotation is correct;"<<std::endl;
68  if (digi_checkdigisize_)
69  {
70  std::cout <<"\tChecking that HBHE digi size is between ["<<mindigisizeHBHE_<<" - "<<maxdigisizeHBHE_<<"];"<<std::endl;
71  std::cout <<"\tChecking that HO digi size is between ["<<mindigisizeHO_<<" - "<<maxdigisizeHO_<<"];"<<std::endl;
72  std::cout <<"\tChecking that HF digi size is between ["<<mindigisizeHF_<<" - "<<maxdigisizeHF_<<"];"<<std::endl;
73  }
74  if (digi_checkadcsum_) std::cout <<"\tChecking that ADC sum of digi is greater than 0;"<<std::endl;
75  if (digi_checkdverr_) std::cout <<"\tChecking that data valid bit is true and digi error bit is false;\n"<<std::endl;
76  }
77 
78  shutOffOrbitTest_ = ps.getUntrackedParameter<bool>("shutOffOrbitTest",false);
79  DigiMonitor_ExpectedOrbitMessageTime_=ps.getUntrackedParameter<int>("ExpectedOrbitMessageTime",3559); // -1 means that orbit mismatches won't be checked
80 
84  HFP_shape=0;
85  HFM_shape=0;
86  setupDone_=false;
87 
88  // register for data access
89  tok_raw_ = consumes<FEDRawDataCollection>(FEDRawDataCollection_);
90  tok_hbhe_ = consumes<HBHEDigiCollection>(digiLabel_);
91  tok_ho_ = consumes<HODigiCollection>(digiLabel_);
92  tok_hf_ = consumes<HFDigiCollection>(digiLabel_);
93  tok_unpack_ = consumes<HcalUnpackerReport>(digiLabel_);
94  tok_trigger_ = consumes<edm::TriggerResults>(hltresultsLabel_);
95  tok_hfrec_ = consumes<HFRecHitCollection>(ps.getUntrackedParameter<edm::InputTag>("hfRechitLabel"));
96 
97  //set Token(-s)
98  dcsStatusToken_ = consumes<DcsStatusCollection>(std::string("scalersRawToDigi"));
99  FEDRawDataCollectionToken_ = consumes<FEDRawDataCollection>(FEDRawDataCollection_);
100 }
101 
102 // destructor
104 
105 // Checks capid rotation; returns false if no problems with rotation
106 static bool bitUpset(int last, int now){
107  if(last ==-1) return false;
108  int v = last+1;
109  if(v==4) v=0;
110  if(v==now) return false;
111  return true;
112 } // static bool bitUpset(...)
113 
115 {
116  // Need to add code to clear out subfolders as well?
117  if (debug_>0) std::cout <<"HcalDigiMonitor::cleanup()"<<std::endl;
118  if (!enableCleanup_) return;
119  if (dbe_)
120  {
121  // removeContents doesn't remove subdirectories
123  dbe_->removeContents();
124  dbe_->setCurrentFolder(subdir_+"digi_parameters"); dbe_->removeContents();
125  dbe_->setCurrentFolder(subdir_+"bad_digis/bad_digi_occupancy"); dbe_->removeContents();
126  dbe_->setCurrentFolder(subdir_+"bad_digis/1D_digi_plots"); dbe_->removeContents();
127  dbe_->setCurrentFolder(subdir_+"bad_digis/badcapID"); dbe_->removeContents();
128  dbe_->setCurrentFolder(subdir_+"bad_digis/data_invalid_error"); dbe_->removeContents();
129  dbe_->setCurrentFolder(subdir_+"bad_digis/bad_reportUnpackerErrors"); dbe_->removeContents();
130  dbe_->setCurrentFolder(subdir_+"bad_digis/baddigisize"); dbe_->removeContents();
131  dbe_->setCurrentFolder(subdir_+"digi_info"); dbe_->removeContents();
132  dbe_->setCurrentFolder(subdir_+"bad_digis/badfibBCNoff"); dbe_->removeContents();
133  dbe_->setCurrentFolder(subdir_+"good_digis/1D_digi_plots"); dbe_->removeContents();
134  dbe_->setCurrentFolder(subdir_+"good_digis/digi_occupancy"); dbe_->removeContents();
135  dbe_->setCurrentFolder(subdir_+"bad_digis/bad_digi_occupancy"); dbe_->removeContents();
136  dbe_->setCurrentFolder(subdir_+"bad_digis"); dbe_->removeContents();
137  dbe_->setCurrentFolder(subdir_+"good_digis/"); dbe_->removeContents();
138  dbe_->setCurrentFolder(subdir_+"digi_info/HB"); dbe_->removeContents();
139  dbe_->setCurrentFolder(subdir_+"digi_info/HE"); dbe_->removeContents();
140  dbe_->setCurrentFolder(subdir_+"digi_info/HO"); dbe_->removeContents();
141  dbe_->setCurrentFolder(subdir_+"digi_info/HF"); dbe_->removeContents();
142  dbe_->setCurrentFolder(subdir_+"LSvalues");
143  dbe_->removeContents();
144  } // if(dbe_)
145 
146 } // void HcalDigiMonitor::cleanup();
147 
148 
150 {
151  // Anything to do here?
152 }
153 
155 {
156  if (debug_>0) std::cout <<"HcalDigiMonitor::endJob()"<<std::endl;
157  if (enableCleanup_) cleanup(); // when do we force cleanup?
158 }
159 
160 
162 {
163  if (setupDone_)
164  return;
165  setupDone_=true;
166  // Call base class setup
168  if (!dbe_) return;
169 
170  /******* Set up all histograms ********/
171  if (debug_>1)
172  std::cout <<"<HcalDigiMonitor::beginRun> Setting up histograms"<<std::endl;
173 
174  std::ostringstream name;
176 
177  dbe_->setCurrentFolder(subdir_+"digi_parameters");
178  MonitorElement* ExpectedOrbit = dbe_->bookInt("ExpectedOrbitMessageTime");
180 
181  MonitorElement* shapeT = dbe_->bookInt("DigiShapeThresh");
182  shapeT->Fill(shapeThresh_);
183  MonitorElement* shapeTHB = dbe_->bookInt("DigiShapeThreshHB");
184  shapeTHB->Fill(shapeThreshHB_);
185  MonitorElement* shapeTHE = dbe_->bookInt("DigiShapeThreshHE");
186  shapeTHE->Fill(shapeThreshHE_);
187  MonitorElement* shapeTHO = dbe_->bookInt("DigiShapeThreshHO");
188  shapeTHO->Fill(shapeThreshHO_);
189  MonitorElement* shapeTHF = dbe_->bookInt("DigiShapeThreshHF");
190  shapeTHF->Fill(shapeThreshHF_);
191 
192  dbe_->setCurrentFolder(subdir_+"bad_digis/bad_digi_occupancy");
193  SetupEtaPhiHists(DigiErrorsByDepth,"Bad Digi Map","");
194  dbe_->setCurrentFolder(subdir_+"bad_digis/1D_digi_plots");
195  ProblemsVsLB=dbe_->bookProfile("BadDigisVsLB","Number Bad Digis vs Luminosity block;Lumi block;# of Bad digis",
196  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
197  ProblemsVsLB_HB=dbe_->bookProfile("HB Bad Quality Digis vs LB","HB Bad Quality Digis vs Luminosity Block",
198  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
199  100,0,10000);
200  ProblemsVsLB_HE=dbe_->bookProfile("HE Bad Quality Digis vs LB","HE Bad Quality Digis vs Luminosity Block",
201  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
202  100,0,10000);
203  ProblemsVsLB_HO=dbe_->bookProfile("HO Bad Quality Digis vs LB","HO Bad Quality Digis vs Luminosity Block",
204  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
205  100,0,10000);
206  ProblemsVsLB_HF=dbe_->bookProfile("HF Bad Quality Digis vs LB","HF Bad Quality Digis vs Luminosity Block",
207  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
208  100,0,10000);
209  ProblemsVsLB_HBHEHF=dbe_->bookProfile("HBHEHF Bad Quality Digis vs LB","HBHEHF Bad Quality Digis vs Luminosity Block",
210  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
211  100,0,10000);
212 
213  ProblemDigisInLastNLB_HBHEHF_alarm=dbe_->book1D("ProblemDigisInLastNLB_HBHEHF_alarm",
214  "Total Number of ProblemDigis HBHEHF in last 10 LS. Last bin contains OverFlow",
215  100,0,100);
216 
217 
218  if (makeDiagnostics_)
219  {
220  // by default, unpacked digis won't have these errors
221  dbe_->setCurrentFolder(subdir_+"diagnostics/bad_digis/badcapID");
222  SetupEtaPhiHists(DigiErrorsBadCapID," Digis with Bad Cap ID Rotation", "");
223  dbe_->setCurrentFolder(subdir_+"diagnostics/bad_digis/data_invalid_error");
224  SetupEtaPhiHists(DigiErrorsDVErr," Digis with Data Invalid or Error Bit Set", "");
225  }
226 
227  if (Online_)
228  {
229  // Special histograms for Pawel's timing study
230  dbe_->setCurrentFolder(subdir_+"HFTimingStudy");
231  HFtiming_etaProfile=dbe_->bookProfile("HFTiming_etaProfile","HFTiming Eta Profile;ieta;average time (time slice)",83,-41.5,41.5,200,0,10);
232  HFP_shape=dbe_->book1D("HFP_signal_shape","HFP signal shape",10,-0.5,9.5);
233  HFM_shape=dbe_->book1D("HFM_signal_shape","HFM signal shape",10,-0.5,9.5);
234  dbe_->setCurrentFolder(subdir_+"HFTimingStudy/sumplots");
235  HFtiming_totaltime2D=dbe_->book2D("HFTiming_Total_Time","HFTiming Total Time",83,-41.5,41.5,72,0.5,72.5);
236  HFtiming_occupancy2D=dbe_->book2D("HFTiming_Occupancy","HFTiming Occupancy",83,-41.5,41.5,72,0.5,72.5);
237  }
238 
239  dbe_->setCurrentFolder(subdir_+"bad_digis/bad_reportUnpackerErrors");
240  SetupEtaPhiHists(DigiErrorsUnpacker," Bad Unpacker Digis", "");
241 
242  dbe_->setCurrentFolder(subdir_+"bad_digis/baddigisize");
243  SetupEtaPhiHists(DigiErrorsBadDigiSize," Digis with Bad Size", "");
244 
245  dbe_->setCurrentFolder(subdir_+"digi_info");
246 
247  h_valid_digis=dbe_->book1D("ValidEvents","Events with minimum number of valid digis",2,-0.5,1.5);
248  h_valid_digis->setBinLabel(1,"Valid");
249  h_valid_digis->setBinLabel(2,"Invalid");
250 
251  h_invalid_orbitnumMod103=dbe_->book1D("InvalidDigiEvents_ORN","Orbit Number (mod 103) for Events with Many Unpacker Errors",103,-0.5,102.5);
252  h_invalid_bcn=dbe_->book1D("InvalidDigiEvents_BCN","Bunch Crossing Number fo Events with Many Unpacker Errors",3464,-0.5,3563.5);
253 
254  DigiSize = dbe_->book2D("Digi Size", "Digi Size",4,0,4,20,-0.5,19.5);
255  DigiSize->setBinLabel(1,"HB",1);
256  DigiSize->setBinLabel(2,"HE",1);
257  DigiSize->setBinLabel(3,"HO",1);
258  DigiSize->setBinLabel(4,"HF",1);
259  DigiSize->setAxisTitle("Subdetector",1);
260  DigiSize->setAxisTitle("Digi Size",2);
261 
262  DigiExpectedSize = dbe_->book2D("Digi Expected Size", "Digi Expected Size",3,0,3,20,-0.5,19.5);
263  DigiExpectedSize->setBinLabel(1,"HBHE",1);
264  DigiExpectedSize->setBinLabel(2,"HO",1);
265  DigiExpectedSize->setBinLabel(3,"HF",1);
266  DigiExpectedSize->setAxisTitle("Subdetector",1);
267  DigiExpectedSize->setAxisTitle("Digi Expected Size from HTR",2);
268 
269  dbe_->setCurrentFolder(subdir_+"bad_digis/badfibBCNoff");
270  SetupEtaPhiHists(DigiErrorsBadFibBCNOff," Digis with non-zero Fiber Orbit Msg Idle BCN Offsets", "");
271 
272  dbe_->setCurrentFolder(subdir_+"good_digis/1D_digi_plots");
273  HBocc_vs_LB=dbe_->bookProfile("HBoccVsLB","HB digi occupancy vs Luminosity Block;Lumi block;# of Good digis",
274  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
275  0,2600);
276  HEocc_vs_LB=dbe_->bookProfile("HEoccVsLB","HE digi occupancy vs Luminosity Block;Lumi block;# of Good digis",
277  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
278  0,2600);
279  HOocc_vs_LB=dbe_->bookProfile("HOoccVsLB","HO digi occupancy vs Luminosity Block;Lumi block;# of Good digis",
280  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
281  0,2200);
282  HFocc_vs_LB=dbe_->bookProfile("HFoccVsLB","HF digi occupancy vs Luminosity Block;Lumi block;# of Good digis",
283  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
284  0,1800);
285 
286  dbe_->setCurrentFolder(subdir_+"good_digis/digi_occupancy");
287  SetupEtaPhiHists(DigiOccupancyByDepth," Digi Eta-Phi Occupancy Map","");
288  DigiOccupancyPhi= dbe_->book1D("Digi Phi Occupancy Map",
289  "Digi Phi Occupancy Map;i#phi;# of Events",
290  72,0.5,72.5);
291  DigiOccupancyEta= dbe_->book1D("Digi Eta Occupancy Map",
292  "Digi Eta Occupancy Map;i#eta;# of Events",
293  83,-41.5,41.5);
294  DigiOccupancyVME = dbe_->book2D("Digi VME Occupancy Map",
295  "Digi VME Occupancy Map;HTR Slot;VME Crate Id",
296  40,-0.25,19.75,18,-0.5,17.5);
297 
298  DigiOccupancySpigot = dbe_->book2D("Digi Spigot Occupancy Map",
299  "Digi Spigot Occupancy Map;Spigot;DCC Id",
301  36,-0.5,35.5);
302 
303  dbe_->setCurrentFolder(subdir_+"bad_digis/bad_digi_occupancy");
304  DigiErrorVME = dbe_->book2D("Digi VME Error Map",
305  "Digi VME Error Map;HTR Slot;VME Crate Id",
306  40,-0.25,19.75,18,-0.5,17.5);
307 
308  DigiErrorSpigot = dbe_->book2D("Digi Spigot Error Map",
309  "Digi Spigot Error Map;Spigot;DCC Id",
311  36,-0.5,35.5);
312 
313  dbe_->setCurrentFolder(subdir_+"bad_digis");
314  int nbins = sizeof(bins_cellcount_new)/sizeof(float)-1;
315 
316  DigiBQ = dbe_->book1D("NumBadQualDigis","Number Bad Qual Digis within Digi Collection",nbins, bins_cellcount_new);
317 
318  nbins=sizeof(bins_fraccount_new)/sizeof(float)-1;
319 
320  DigiBQFrac = dbe_->book1D("Bad Digi Fraction","Bad Digi Fraction;Bad Quality Digi Fraction for digis in collection; # of Events",
321  nbins, bins_fraccount_new);
322 
323  nbins = sizeof(bins_cellcount_new)/sizeof(float)-1;
324  DigiUnpackerErrorCount = dbe_->book1D("Unpacker Error Count", "Number of Bad Digis from Unpacker; Bad Unpacker Digis; # of Events",nbins, bins_cellcount_new);
325 
326  nbins=sizeof(bins_fraccount_new)/sizeof(float)-1;
327  DigiUnpackerErrorFrac = dbe_->book1D("Unpacker Bad Digi Fraction",
328  "Bad Digis From Unpacker/ (Bad Digis From Unpacker + Good Digis); Bad Unpacker Fraction; # of Events",
329  nbins,bins_fraccount_new);
330 
331  dbe_->setCurrentFolder(subdir_+"good_digis/");
332  DigiNum = dbe_->book1D("NumGoodDigis","Number of Digis;# of Good Digis;# of Events",DIGI_NUM+1,-0.5,DIGI_NUM+1-0.5);
333 
338 
339  this->reset();
340  return;
341 } // void HcalDigiMonitor::setup()
342 
344 {
346  if (mergeRuns_ && tevt_>0) return; // don't reset counters if merging runs
347 
348  if (debug_>1) std::cout <<"\t<HcalDigiMonitor::setup> Getting conditions from DB!"<<std::endl;
349  c.get<HcalDbRecord>().get(conditions_);
350 
351  // Get all pedestals by Cap ID
353  c.get<HcalChannelQualityRcd>().get(p);
354  HcalChannelQuality *chanquality= new HcalChannelQuality(*p.product());
355  std::vector<DetId> mydetids = chanquality->getAllChannels();
356  PedestalsByCapId_.clear();
357 
358  for (std::vector<DetId>::const_iterator chan = mydetids.begin();chan!=mydetids.end();++chan)
359  {
360  if (chan->det()!=DetId::Hcal) continue; // not hcal
361  std::vector <double> peds; // could be ints, right?
362  peds.clear();
363  HcalCalibrations calibs=conditions_->getHcalCalibrations(*chan);
364  const HcalQIECoder* channelCoder = conditions_->getHcalCoder(*chan);
365  const HcalQIEShape* shape = conditions_->getHcalShape(channelCoder);
366  //double total=0; // use this is we want to calculate average pedestal value
367  for (int capid=0;capid<4;++capid)
368  {
369  // temp_ADC should be an int, right?
370  double temp_ADC=channelCoder->adc(*shape,(float)calibs.pedestal(capid),capid);
371  peds.push_back(temp_ADC);
372  //total=total+temp_ADC;
373  }
374  //for (int capid=0;capid<4;++capid) peds.push_back(total/4.); // use this if we just want to use average value
375  PedestalsByCapId_[*chan]=peds;
376  } // loop on DetIds
377 
378  if (tevt_==0) this->setup(); // create all histograms; not necessary if merging runs together
379  if (mergeRuns_==false) this->reset(); // call reset at start of all runs
380  delete chanquality;
381 
382  // Get known dead cells for this run
383  KnownBadCells_.clear();
384  if (badChannelStatusMask_>0)
385  {
387  c.get<HcalChannelQualityRcd>().get(p);
388  HcalChannelQuality* chanquality= new HcalChannelQuality(*p.product());
389  std::vector<DetId> mydetids = chanquality->getAllChannels();
390  for (std::vector<DetId>::const_iterator i = mydetids.begin();
391  i!=mydetids.end();
392  ++i)
393  {
394  if (i->det()!=DetId::Hcal) continue; // not an hcal cell
395  HcalDetId id=HcalDetId(*i);
396  int status=(chanquality->getValues(id))->getValue();
397  if ((status & badChannelStatusMask_))
398  {
399  KnownBadCells_[id.rawId()]=status;
400  }
401  }
402  delete chanquality;
403  } // if (badChannelStatusMask_>0)
404 
405 } // void HcalDigiMonitor::beginRun()
406 
407 
409 {
410  if (!dbe_) return;
411  std::stringstream name;
412  int nChan=0;
413  if (subdet=="HB" || subdet=="HE") nChan=2592;
414  else if (subdet == "HO") nChan=2160;
415  else if (subdet == "HF") nChan=1728;
416 
417  dbe_->setCurrentFolder(subdir_+"digi_info/"+subdet);
418  hist.shape = dbe_->book1D(subdet+" Digi Shape",subdet+" Digi Shape;Time Slice",10,-0.5,9.5);
419  hist.shapeThresh = dbe_->book1D(subdet+" Digi Shape - over thresh",
420  subdet+" Digi Shape - over thresh passing trigger and HF HT cuts;Time slice",
421  10,-0.5,9.5);
422  hist.ThreshCount = dbe_->book1D(subdet+" Total Digis Over Threshold",
423  subdet+" Total Digis Over Threshold",
424  1,-0.5,0.5);
425  // Create plots of sums of adjacent time slices
426  for (int ts=0;ts<9;++ts)
427  {
428  name<<subdet<<" Plus Time Slices "<<ts<<" and "<<ts+1;
429  hist.TS_sum_plus.push_back(dbe_->book1D(name.str().c_str(),name.str().c_str(),50, 0., 50.));
430  name.str("");
431  name<<subdet<<" Minus Time Slices "<<ts<<" and "<<ts+1;
432  hist.TS_sum_minus.push_back(dbe_->book1D(name.str().c_str(),name.str().c_str(),50, 0., 50.));
433  name.str("");
434  }
435  hist.presample= dbe_->book1D(subdet+" Digi Presamples",subdet+" Digi Presamples",50,-0.5,49.5);
436  hist.BQ = dbe_->book1D(subdet+" Bad Quality Digis",subdet+" Bad Quality Digis",nChan+1,-0.5,nChan+0.5);
437  //(hist.BQ->getTH1F())->LabelsOption("v");
438  hist.BQFrac = dbe_->book1D(subdet+" Bad Quality Digi Fraction",subdet+" Bad Quality Digi Fraction",DIGI_BQ_FRAC_NBINS,(0-0.5/(DIGI_BQ_FRAC_NBINS-1)),1+0.5/(DIGI_BQ_FRAC_NBINS-1));
439  hist.DigiFirstCapID = dbe_->book1D(subdet+" Capid 1st Time Slice",subdet+" Capid for 1st Time Slice;CapId (T0)- 1st CapId (T0);# of Events",7,-3.5,3.5);
440 
441  hist.DVerr = dbe_->book1D(subdet+" Data Valid Err Bits",subdet+" QIE Data Valid Err Bits",4,-0.5,3.5);
442  hist.DVerr ->setBinLabel(1,"Err=0, DV=0",1);
443  hist.DVerr ->setBinLabel(2,"Err=0, DV=1",1);
444  hist.DVerr ->setBinLabel(3,"Err=1, DV=0",1);
445  hist.DVerr ->setBinLabel(4,"Err=1, DV=1",1);
446  hist.CapID = dbe_->book1D(subdet+" CapID",subdet+" CapID",4,-0.5,3.5);
447  hist.ADC = dbe_->book1D(subdet+" ADC count per time slice",subdet+" ADC count per time slice",200,-0.5,199.5);
448  hist.ADCsum = dbe_->book1D(subdet+" ADC sum", subdet+" ADC sum",200,-0.5,199.5);
449  hist.fibBCNOff = dbe_->book1D(subdet+" Fiber Orbit Message Idle BCN Offset", subdet+" Fiber Orbit Message Idle BCN Offset;Offset from Expected",
450  15, -7.5, 7.5);
451 }
452 
454 {
455  if (!IsAllowedCalibType()) return;
456  if (LumiInOrder(e.luminosityBlock())==false) return;
457 
458  // Get HLT trigger information for HF timing study
459  passedMinBiasHLT_=false;
460 
462  // check if detectors whether they were ON
464  e.getByToken(dcsStatusToken_, dcsStatus);
465 
466  if (dcsStatus.isValid() && dcsStatus->size() != 0)
467  {
468  if ((*dcsStatus)[0].ready(DcsStatus::HBHEa) &&
469  (*dcsStatus)[0].ready(DcsStatus::HBHEb) &&
470  (*dcsStatus)[0].ready(DcsStatus::HBHEc))
471  {
472  hbhedcsON = true;
473  if (debug_) std::cout << "hbhe on" << std::endl;
474  }
475  else hbhedcsON = false;
476 
477  if ((*dcsStatus)[0].ready(DcsStatus::HF))
478  {
479  hfdcsON = true;
480  if (debug_) std::cout << "hf on" << std::endl;
481  }
482  else hfdcsON = false;
483  }
485 
487  if (!(e.getByToken(tok_trigger_,hltRes)))
488  {
489  if (debug_>0) edm::LogWarning("HcalDigiMonitor")<<" Could not get HLT results with tag "<<hltresultsLabel_<<std::endl;
490  }
491  else
492  {
493  const edm::TriggerNames & triggerNames = e.triggerNames(*hltRes);
494  const unsigned int nTrig(triggerNames.size());
495  for (unsigned int i=0;i<nTrig;++i){
496  // repeat for minbias triggers
497  for (unsigned int k=0;k<MinBiasHLTBits_.size();++k)
498  {
499  // if (triggerNames.triggerName(i)==MinBiasHLTBits_[k] && hltRes->accept(i))
500  if (triggerNames.triggerName(i).find(MinBiasHLTBits_[k])!=std::string::npos && hltRes->accept(i))
501  {
502  passedMinBiasHLT_=true;
503  break;
504  }
505  }
506  }
507  } //else
508 
509  // Now get collections we need
510  HT_HFP_=0;
511  HT_HFM_=0;
512  // bool rechitsFound=false;
514  if (e.getByToken(tok_hfrec_,hf_rechit))
515  {
516  // rechitsFound=true;
517  for (HFRecHitCollection::const_iterator HF=hf_rechit->begin();HF!=hf_rechit->end();++HF)
518  {
519  float en=HF->energy();
520  int ieta=HF->id().ieta();
521  // ieta for HF starts at 29, so subtract away 29 when computing fEta
522  double fEta=fabs(0.5*(theHFEtaBounds[abs(ieta)-28]+theHFEtaBounds[abs(ieta)-29]));
523  ieta>0 ? HT_HFP_+=en/cosh(fEta) : HT_HFM_+=en/cosh(fEta);
524  }
525  }
526  else
527  {
528  // if no rechits found, form above-threshold plots based only on digi comparison to ADC threshold
529  HT_HFP_=999;
530  HT_HFM_=999;
531  }
532 
533  // try to get digis
537 
538  if (!(e.getByToken(tok_hbhe_,hbhe_digi)))
539  {
540  edm::LogWarning("HcalDigiMonitor")<< digiLabel_<<" hbhe_digi not available";
541  return;
542  }
543 
544  if (!(e.getByToken(tok_hf_,hf_digi)))
545  {
546  edm::LogWarning("HcalDigiMonitor")<< digiLabel_<<" hf_digi not available";
547  return;
548  }
549  if (!(e.getByToken(tok_ho_,ho_digi)))
550  {
551  edm::LogWarning("HcalDigiMonitor")<< digiLabel_<<" ho_digi not available";
552  return;
553  }
555  if (!(e.getByToken(tok_unpack_,report)))
556  {
557  edm::LogWarning("HcalDigiMonitor")<< digiLabel_<<" unpacker report not available";
558  return;
559  }
560  // try to get Raw Data
562  if ( !(e.getByToken(FEDRawDataCollectionToken_, rawraw)))
563  {
564  edm::LogWarning("HcalRawDataMonitor")<<" raw data with label "<<FEDRawDataCollection_<<" not available";
565  return;
566  }
567 
568  // get the DCC header & trailer (or bail out)
569  // this needs to be done better, for now basically getting only one number per HBHE/HO/HF
570  // will create a map (dccid, spigot) -> DetID to be used in process_Digi later
572  const FEDRawData& fed = rawraw->FEDData(i);
573  if (fed.size()<12) continue; //At least the size of headers and trailers of a DCC.
574 
575  const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(fed.data());
576  if(!dccHeader) return;
577 
578  HcalHTRData htr;
579  for (int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) {
580  if (!dccHeader->getSpigotPresent(spigot)) continue;
581 
582  // Load the given decoder with the pointer and length from this spigot.
583  // i.e. initialize htr, within dcc raw data size.
584  dccHeader->getSpigotData(spigot, htr, fed.size());
585 
586  int NTS = htr.getNDD(); //number time slices, in precision channels
587  int dccid=dccHeader->getSourceId();
588 
589  if(dccid==720 && (spigot==12 || spigot==13)) continue; // calibration HTR
590  if(dccid==722 && (spigot==12 || spigot==13)) continue; // ZDC HTR
591 
592  int subdet = -1;
593 
594  if(dccid >= 700 && dccid<=717) { subdet = 0; mindigisizeHBHE_ = NTS; maxdigisizeHBHE_ = NTS; } // HBHE
595  if(dccid >= 718 && dccid<=723) { subdet = 2; mindigisizeHF_ = NTS; maxdigisizeHF_ = NTS; } // HF
596  if(dccid >= 724 && dccid<=731) { subdet = 1; mindigisizeHO_ = NTS; maxdigisizeHO_ = NTS; } // HO
597 
598  DigiExpectedSize->Fill(subdet,int(NTS),1);
599  }
600  }
601 
602  // all objects grabbed; event is good
603  if (debug_>1) std::cout <<"\t<HcalDigiMonitor::analyze> Processing good event! event # = "<<ievt_<<std::endl;
604 
605  HcalBaseDQMonitor::analyze(e,s); // base class increments ievt_, etc. counters
606 
607  // Digi collection was grabbed successfully; process the Event
608  processEvent(*hbhe_digi, *ho_digi, *hf_digi, *conditions_,
609  *report, e.orbitNumber(),e.bunchCrossing());
610 
611 } //void HcalDigiMonitor::analyze(...)
612 
614  const HODigiCollection& ho,
615  const HFDigiCollection& hf,
616  const HcalDbService& cond,
617  const HcalUnpackerReport& report,
618  int orN, int bcN)
619 {
620  if(!dbe_)
621  {
622  if(debug_)
623  std::cout <<"HcalDigiMonitor::processEvent DQMStore not instantiated!!!"<<std::endl;
624  return;
625  }
626 
627  // Skip events in which minimal good digis found -- still getting some strange (calib?) events through DQM
628 
630 
631  unsigned int allgooddigis= hbhe.size()+ho.size()+hf.size();
632 
633  // new data format in HCAL marks idle messages in the abort gap as bad capid.
634  // ignore this events. Also, sometimes there are many corrupted digis left
635  // from the QIE reset: ignore if in abort gap
636  if(bcN>=3446 && bcN<=3564)
637  if( (report.badQualityDigis()>100 && hbhe.size()==0) || (report.badQualityDigis()>1000) )
638  return;
639 
640  // bad threshold: ignore events in which bad outnumber good by more than 100:1
641  // (one RBX in HBHE seems to send valid data occasionally even on QIE resets, which is why we can't just require allgooddigis==0 when looking for events to skip)
642  if ((allgooddigis==0) ||
643  (1.*report.badQualityDigis()>100*allgooddigis))
644  {
645  h_valid_digis->Fill(1);
646  if (bcN>-1)
647  h_invalid_bcn->Fill(bcN);
648  if (orN>-1)
649  h_invalid_orbitnumMod103->Fill(orN%103);
650 
651  return;
652  }
653 
654  h_valid_digis->Fill(0);
655 
656  // hbHists.count_bad=0;
657  // hbHists.count_good=0;
658  // heHists.count_bad=0;
659  // heHists.count_good=0;
660  // hoHists.count_bad=0;
661  // hoHists.count_good=0;
662  // hfHists.count_bad=0;
663  // hfHists.count_good=0;
664 
665  // int HO0bad=0;
666  // int HO12bad=0;
667  // int HFlumibad=0;
668 
669  // Check unpacker report for bad digis
670 
671  typedef std::vector<DetId> DetIdVector;
672 
673  for ( DetIdVector::const_iterator baddigi_iter=report.bad_quality_begin();
674  baddigi_iter != report.bad_quality_end();
675  ++baddigi_iter)
676  {
677  HcalDetId id(baddigi_iter->rawId());
678  int rDepth = id.depth();
679  int rPhi = id.iphi();
680  int rEta = id.ieta();
681  int binEta = CalcEtaBin(id.subdet(), rEta, rDepth); // why is this here?
682 
683  if (binEta < 85 && binEta >= 0
684  && (rPhi-1) >= 0 && (rPhi-1)<72
685  && (rDepth-1) >= 0 && (rDepth-1)<4)
686  if(uniqcounter2[binEta][rPhi-1][rDepth-1]<1)
687  {
688  if (id.subdet()==HcalBarrel) ++hbHists.count_bad;
689  else if (id.subdet()==HcalEndcap) ++heHists.count_bad;
690  else if (id.subdet()==HcalForward)
691  {
692  ++hfHists.count_bad;
693  if (rDepth==1 && (abs(rEta)==33 || abs(rEta)==34)) ++HFlumibad;
694  else if (rDepth==2 && (abs(rEta)==35 || abs(rEta)==36)) ++HFlumibad;
695  }
696  else if (id.subdet()==HcalOuter)
697  {
698  // Mark HORing+/-2 channels as present, HO/YB+/-2 has HV off (at 100V).
699  if (excludeHORing2_==true && rDepth==4)
700  if (abs(rEta)>=11 && abs(rEta)<=15 && !isSiPM(rEta,rPhi,rDepth)) continue;
701 
702  if (excludeHO1P02_==true)
703  if( (rEta>4 && rEta<10) && (rPhi<=10 || rPhi>70) ) continue;
704 
705  if (KnownBadCells_.find(id)!=KnownBadCells_.end()) continue;
706 
707  ++hoHists.count_bad;
708  if (abs(rEta)<5) ++HO0bad;
709  else ++HO12bad;
710  }
711  else
712  continue; // skip anything that isn't HB, HE, HO, HF
713  // extra protection against nonsensical values -- prevents occasional crashes
714 
715  ++badunpackerreport[binEta][rPhi-1][rDepth-1];
716  ++baddigis[binEta][rPhi-1][rDepth-1];
717 
718  // QPLL unlocking channels, have to ignore unpacker errors (fix requires opening CMS)
719  bool HEM15A = true ? (id.subdet()==HcalEndcap && (rPhi>56 && rPhi<59 && rEta<0)) : false;
720  bool HEM15B = true ? (id.subdet()==HcalEndcap && (rPhi>54 && rPhi<57 && rEta<0)) : false;
721  bool HBP14A = true ? (id.subdet()==HcalBarrel && (rPhi>50 && rPhi<53 && rEta>0)) : false;
722 
723  if(excludeBadQPLLs_ && rDepth==1)
724  if( HEM15A || HEM15B || HBP14A )
725  ++knownbadQPLLs;
726 
727  uniqcounter2[binEta][rPhi-1][rDepth-1]++;
728  }
729  }
731 
732  int firsthbcap=-1;
733  int firsthecap=-1;
734  int firsthocap=-1;
735  int firsthfcap=-1;
736 
737  for (HBHEDigiCollection::const_iterator j=hbhe.begin(); j!=hbhe.end(); ++j)
738  {
739  const HBHEDataFrame digi = (const HBHEDataFrame)(*j);
740 
741  if (digi.id().subdet()==HcalBarrel)
742  {
743  if (!HBpresent_) continue;
744  if (KnownBadCells_.find(digi.id())!=KnownBadCells_.end()) continue;
745 
746  process_Digi(digi, hbHists, firsthbcap);
747 
748  }
749  else if (digi.id().subdet()==HcalEndcap)
750  {
751  if (!HEpresent_) continue;
752  process_Digi(digi, heHists,firsthecap);
753  }
754  }
755 
756  // // Fill good digis vs lumi block; also fill bad errors?
759 
760  // Calculate number of bad quality cells and bad quality fraction
762  {
764  if (counter<DIGI_SUBDET_NUM)
767  if (counter2<DIGI_SUBDET_NUM) ++hbHists.count_BQFrac[(int)counter2];
768  }
769 
771  {
773  if (counter<DIGI_SUBDET_NUM)
776  if (counter2<DIGI_SUBDET_NUM) ++heHists.count_BQFrac[int(counter2)];
777  }
778 
780  if (HOpresent_)
781  {
782  for (HODigiCollection::const_iterator j=ho.begin(); j!=ho.end(); ++j)
783  {
784  const HODataFrame digi = (const HODataFrame)(*j);
785  // Mark HORing+/-2 channels as present, HO/YB+/-2 has HV off (at 100V).
786  if (excludeHORing2_==true && digi.id().depth()==4)
787  if (abs(digi.id().ieta())>=11 && abs(digi.id().ieta())<=15 &&
788  !isSiPM(digi.id().ieta(),digi.id().iphi(),digi.id().depth())) continue;
789 
790  if (excludeHO1P02_==true)
791  if( (digi.id().ieta()>4 && digi.id().ieta()<10)
792  && (digi.id().iphi()<=10 || digi.id().iphi()>70) ) continue;
793 
794  if (KnownBadCells_.find(digi.id())!=KnownBadCells_.end()) continue;
795 
796  process_Digi(digi, hoHists, firsthocap);
797  } // for (HODigiCollection)
798 
799  if (hoHists.count_bad>0 || hoHists.count_good>0)
800  {
802  if (counter<DIGI_SUBDET_NUM)
804 
806  if (counter2<DIGI_SUBDET_NUM) ++hoHists.count_BQFrac[int(counter2)];
807  }
809  } // if (HOpresent_)
810 
812  if (HFpresent_)
813  {
814  for (HFDigiCollection::const_iterator j=hf.begin(); j!=hf.end(); ++j)
815  {
816  const HFDataFrame digi = (const HFDataFrame)(*j);
817  process_Digi(digi, hfHists, firsthfcap);
818  } // for (HFDigiCollection)
819 
820  if (hfHists.count_bad>0 || hfHists.count_good>0)
821  {
823  if (counter<DIGI_SUBDET_NUM)
826  if (counter2<DIGI_SUBDET_NUM) ++hfHists.count_BQFrac[int(counter2)];
827  }
829  } // if (HFpresent_)
830 
831  // This only counts digis that are present but bad somehow; it does not count digis that are missing
834 
835  if (count_good<DIGI_NUM)
836  ++diginum[count_good];
837 
838  // Fill bad quality histograms
839  DigiUnpackerErrorFrac->Fill(1.*report.badQualityDigis()/(report.badQualityDigis()+count_good));
840  DigiBQ->Fill(count_bad);
841  if (count_bad>0 || count_good>0)
842  DigiBQFrac->Fill(1.*count_bad/(count_bad+count_good));
843 
844  // Call 'update' on all histograms so that they update in online DQM
849 
850  // Now update global (non-subdetector-specific) histograms
851  DigiNum->update();
852  DigiErrorVME->update();
854  DigiBQ->update();
855  DigiBQFrac->update();
858 
859  // Update eta-phi hists
860  for (unsigned int zz=0;zz<DigiErrorOccupancyByDepth.depth.size();++zz)
861  DigiErrorOccupancyByDepth.depth[zz]->update();
862  for (unsigned int zz=0;zz<DigiErrorsByDepth.depth.size();++zz)
863  DigiErrorsByDepth.depth[zz]->update();
864  for (unsigned int zz=0;zz<DigiErrorsBadCapID.depth.size();++zz)
865  DigiErrorsBadCapID.depth[zz]->update();
866  for (unsigned int zz=0;zz<DigiErrorsDVErr.depth.size();++zz)
867  DigiErrorsDVErr.depth[zz]->update();
868  for (unsigned int zz=0;zz<DigiErrorsBadDigiSize.depth.size();++zz)
869  DigiErrorsBadDigiSize.depth[zz]->update();
870  for (unsigned int zz=0;zz<DigiErrorsBadADCSum.depth.size();++zz)
871  DigiErrorsBadADCSum.depth[zz]->update();
872  for (unsigned int zz=0;zz<DigiErrorsUnpacker.depth.size();++zz)
873  DigiErrorsUnpacker.depth[zz]->update();
874  for (unsigned int zz=0;zz<DigiErrorsBadFibBCNOff.depth.size();++zz)
875  DigiErrorsBadFibBCNOff.depth[zz]->update();
876 
881  DigiSize->update();
883 
884  // // Fill problems vs. lumi block plots
885  // ProblemsVsLB->Fill(currentLS,count_bad);
886  // ProblemsVsLB_HB->Fill(currentLS,hbHists.count_bad);
887  // ProblemsVsLB_HE->Fill(currentLS,heHists.count_bad);
888  // ProblemsVsLB_HO->Fill(currentLS,hoHists.count_bad);
889  // ProblemsVsLB_HF->Fill(currentLS,hfHists.count_bad);
890  // ProblemsVsLB_HBHEHF->Fill(currentLS,hbHists.count_bad+heHists.count_bad+hfHists.count_bad);
891 
892  // // Fill the number of problem digis in each channel
893  // ProblemsCurrentLB->Fill(-1,-1,1); // event counter
894  // ProblemsCurrentLB->Fill(0,0,hbHists.count_bad);
895  // ProblemsCurrentLB->Fill(1,0,heHists.count_bad);
896  // ProblemsCurrentLB->Fill(2,0,hoHists.count_bad);
897  // ProblemsCurrentLB->Fill(3,0,hfHists.count_bad);
898  // ProblemsCurrentLB->Fill(4,0,HO0bad);
899  // ProblemsCurrentLB->Fill(5,0,HO12bad);
900  // ProblemsCurrentLB->Fill(6,0,HFlumibad);
901 
902  // Call fill method every checkNevents
903  //fill_Nevents();
904 
905  return;
906 } // void HcalDigiMonitor::processEvent(...)
907 
908 
909 
910 template <class DIGI>
911 int HcalDigiMonitor::process_Digi(DIGI& digi, DigiHists& h, int& firstcap)
912 {
913  int err=0x0;
914  bool bitUp = false;
915  int ADCcount=0;
916 
917  int shapeThresh=0;
918 
919  int mindigisize=1;
920  int maxdigisize=10;
921 
922  if (digi.id().subdet()==HcalBarrel)
923  {
924  shapeThresh=shapeThreshHB_;
925  mindigisize=mindigisizeHBHE_;
926  maxdigisize=maxdigisizeHBHE_;
927  }
928  else if (digi.id().subdet()==HcalEndcap)
929  {
930  shapeThresh=shapeThreshHE_;
931  mindigisize=mindigisizeHBHE_;
932  maxdigisize=maxdigisizeHBHE_;
933  }
934  else if (digi.id().subdet()==HcalOuter)
935  {
936  shapeThresh=shapeThreshHO_;
937  mindigisize=mindigisizeHO_;
938  maxdigisize=maxdigisizeHO_;
939  }
940  else if (digi.id().subdet()==HcalForward)
941  {
942  shapeThresh=shapeThreshHF_;
943  mindigisize=mindigisizeHF_;
944  maxdigisize=maxdigisizeHF_;
945  }
946  int iEta = digi.id().ieta();
947  int iPhi = digi.id().iphi();
948  int iDepth = digi.id().depth();
949  int calcEta = CalcEtaBin(digi.id().subdet(),iEta,iDepth);
950 
951  // Check that digi size is correct
952  if (digi.size()<mindigisize || digi.size()>maxdigisize)
953  {
954  if (digi_checkdigisize_) err|=0x1;
955  ++baddigisize[calcEta][iPhi-1][iDepth-1];
956  }
957  // Check digi size; if > 20, increment highest bin of digisize array
958  if (digi.size()<20)
959  ++digisize[static_cast<int>(digi.size())][digi.id().subdet()-1];
960  else
961  ++digisize[19][digi.id().subdet()-1];
962 
963  // loop over time slices of digi to check capID and errors
964  ++h.count_presample[digi.presamples()];
965 
966  // Check CapID rotation
967  if (firstcap==-1) firstcap = digi.sample(0).capid();
968  int capdif = digi.sample(0).capid() - firstcap;
969  //capdif = capdif%3 - capdif/3; // unnecessary?
970  // capdif should run from -3 to +3
971  if (capdif >-4 && capdif<4)
972  ++h.capIDdiff[capdif+3];
973  else
974  ++h.capIDdiff[7];
975 
976  int last=-1;
977 
978  int offset = digi.fiberIdleOffset();
979 
980  // Only count BCN offset errors if ExpectedOrbitMessage Time is >-1
981  // For offline (and thus cfg default), this won't be checked, since
982  // we can't keep up to date with changes.
983  if (offset != -1000 && DigiMonitor_ExpectedOrbitMessageTime_>-1)
984  {
985  // increment counters only for non-zero offsets?
986  ++h.fibbcnoff[offset + 7];
987  if (offset != 0)
988  {
989  ++badFibBCNOff[calcEta][iPhi-1][iDepth-1];
990  if (shutOffOrbitTest_ == false) err |= 0xF; // not an error if test turned off
991  }
992  }
993 
994  int tssum=0;
995 
996  bool digi_error=false;
997 
998  const int DigiSize=digi.size();
999  for (int i=0;i<10;++i) pedSubtractedADC_[i]=0;
1000  const int pedSubADCsize=sizeof(pedSubtractedADC_)/sizeof(double);
1001 
1002  std::map<HcalDetId, std::vector<double> >::iterator foundID = PedestalsByCapId_.find(digi.id());
1003  for (int i=0;i<DigiSize;++i)
1004  {
1005  int thisCapid = digi.sample(i).capid();
1006  if (thisCapid>=0 && thisCapid<4) ++h.capid[thisCapid];
1007 
1008  if (makeDiagnostics_)
1009  {
1010  if(bitUpset(last,thisCapid)) bitUp=true; // checking capID rotation
1011  last = thisCapid;
1012  // Check for digi error bits
1013  if (digi_checkdverr_)
1014  {
1015  if(digi.sample(i).er()) err=(err|0x2);
1016  if(!digi.sample(i).dv()) err=(err|0x2);
1017  }
1018  if ((digi_error==false) && (digi.sample(i).er() || !digi.sample(i).dv()))
1019  {
1020  ++digierrorsdverr[calcEta][iPhi-1][iDepth-1];
1021  digi_error=true; // only count 1 error per digi in this plot
1022  }
1023  ++h.dverr[static_cast<int>(2*digi.sample(i).er()+digi.sample(i).dv())];
1024  } // if (makeDiagnostics_)
1025 
1026  h.count_shape[i]+=digi.sample(i).adc();
1027 
1028  // Calculate ADC sum of adjacent samples -- still necessary?
1029  if (i==digi.size()-1) continue;
1030  tssum= digi.sample(i).adc()+digi.sample(i+1).adc();
1031  if (tssum<50 && tssum>=0)
1032  {
1033  if (iEta>0)
1034  ++h.tssumplus[tssum][i];
1035  else
1036  ++h.tssumminus[tssum][i];
1037  }
1038 
1039  if (digi.sample(i).adc()<0) ++h.adc[0];
1040  else if (digi.sample(i).adc()<200) ++h.adc[digi.sample(i).adc()];
1041  else ++h.adc[199];
1042 
1043  if (i>=pedSubADCsize) continue; // don't exceed maximum array length when checking digis
1044 
1045  if (foundID!=PedestalsByCapId_.end())
1046  {
1047  pedSubtractedADC_[i]=digi.sample(i).adc()-(foundID->second)[thisCapid];
1048  ADCcount+=(int)(digi.sample(i).adc()-(foundID->second)[thisCapid]);
1049  }
1050  else
1051  {
1052  pedSubtractedADC_[i]=digi.sample(i).adc()-3;
1053  ADCcount+=digi.sample(i).adc()-3; // default pedestal subtraction of 3 ADC counts
1054  }
1055  } // for (int i=0;i<digi.size();++i)
1056 
1057  // capid error found
1058  if(bitUp)
1059  {
1060  if (digi_checkcapid_) err=(err|0x4);
1061  ++badcapID[calcEta][iPhi-1][iDepth-1];
1062  }
1063 
1064 
1065  // These plots generally don't get filled, unless we turn off the suppression of bad digis
1066  if (err>0)
1067  {
1068  if(uniqcounter[calcEta][iPhi-1][iDepth-1]<1)
1069  {
1070  ++h.count_bad;
1071  ++baddigis[calcEta][iPhi-1][iDepth-1];
1072  ++errorVME[static_cast<int>(2*(digi.elecId().htrSlot()+0.5*digi.elecId().htrTopBottom()))][static_cast<int>(digi.elecId().readoutVMECrateId())];
1073  ++errorSpigot[static_cast<int>(digi.elecId().spigot())][static_cast<int>(digi.elecId().dccid())];
1074  }
1075  uniqcounter[calcEta][iPhi-1][iDepth-1]++;
1076 
1077  return err;
1078  }
1079 
1080  if (ADCcount<0) ADCcount=0;
1081  if (ADCcount<199)
1082  ++h.adcsum[ADCcount];
1083  else
1084  ++h.adcsum[199]; // effective overflow bin
1085 
1086  // require larger threshold to look at pulse shapes
1087 
1088  if (ADCcount>shapeThresh && passedMinBiasHLT_ && HT_HFP_>1 && HT_HFM_>1)
1089  {
1090  h.ThreshCount->Fill(0,1);
1091  if (digi.id().subdet()!=HcalOuter || isSiPM(iEta,iPhi, iDepth)==false)
1092  {
1093  for (int i=0;i<pedSubADCsize;++i)
1095  }
1096  }
1097 
1098  // occupancy plots are only filled for good histograms
1099  ++h.count_good;
1100  ++occupancyEtaPhi[calcEta][iPhi-1][iDepth-1];
1101  ++occupancyEta[iEta+41];
1102  ++occupancyPhi[iPhi-1];
1103  // htr Slots run from 0-20, incremented by 0.5 for top/bottom
1104  ++occupancyVME[static_cast<int>(2*(digi.elecId().htrSlot()+0.5*digi.elecId().htrTopBottom()))][static_cast<int>(digi.elecId().readoutVMECrateId())];
1105  ++occupancySpigot[static_cast<int>(digi.elecId().spigot())][static_cast<int>(digi.elecId().dccid())];
1106 
1107  // Pawel's code for HF timing checks -- run only in online mode for non-calib events
1108  if (digi.id().subdet()==HcalForward
1109  && Online_ //only run online
1110  && currenttype_==0 // require non-calibration event
1111  && passedMinBiasHLT_ // require min bias trigger
1112  )
1113  {
1114  int maxtime=-1;
1115  double maxenergy=-1, fullenergy=0;
1116  int digisize=digi.size();
1117  for (int ff=0;ff<digisize;++ff)
1118  {
1119  fullenergy+=digi.sample(ff).nominal_fC()-2.5;
1120  if (digi.sample(ff).nominal_fC()-2.5>maxenergy)
1121  {
1122  maxenergy=digi.sample(ff).nominal_fC()-2.5;
1123  maxtime=ff;
1124  }
1125  }
1126 
1127  if (maxtime>=2 && maxtime<=5 && maxenergy>20 && maxenergy<100) // only look between time slices 2-5; anything else should be nonsense
1128  {
1129  for (int ff=0;ff<digisize;++ff){
1130  if(fullenergy>0){
1131  if(digi.id().ieta()>0)HFP_shape->Fill(ff,(digi.sample(ff).nominal_fC()-2.5)/fullenergy);
1132  if(digi.id().ieta()<0)HFM_shape->Fill(ff,(digi.sample(ff).nominal_fC()-2.5)/fullenergy);
1133  }
1134  }
1135 
1136  double time_den=0, time_num=0;
1137  // form weighted time sum
1138  int startslice=std::max(0,maxtime-1);
1139  int endslice=std::min(digisize-1,maxtime+1);
1140  for (int ss=startslice;ss<=endslice;++ss)
1141  {
1142  // subtract 'default' pedestal of 2.5 fC
1143  time_num+=ss*(digi.sample(ss).nominal_fC()-2.5);
1144  time_den+=digi.sample(ss).nominal_fC()-2.5;
1145  }
1146 
1147  int myiphi=iPhi;
1148  if (iDepth==2) ++myiphi;
1149  if (HFtiming_etaProfile!=0 && time_den!=0)
1150  HFtiming_etaProfile->Fill(iEta,time_num/time_den);
1151  if (HFtiming_totaltime2D!=0 && time_den!=0)
1152  HFtiming_totaltime2D->Fill(iEta,myiphi,time_num/time_den);
1153  if (HFtiming_occupancy2D!=0 && time_den!=0)
1154  HFtiming_occupancy2D->Fill(iEta,myiphi,1);
1155  } //maxtime>-1
1156  } // if HcalForward
1157 
1158  return err;
1159 } // template <class DIGI> int HcalDigiMonitor::process_Digi
1160 
1162  const edm::EventSetup& c)
1163 {
1166 }
1167 
1169  const edm::EventSetup& c)
1170 {
1171  if (LumiInOrder(lumiSeg.luminosityBlock())==false) return;
1172 
1173  // Reset current LS histogram
1174  if (ProblemsCurrentLB)
1176 
1178 
1179  //increase the number of LS counting, for alarmer. Only make alarms for HBHE
1180  if(hbhedcsON == true && hfdcsON == true && HBpresent_ == 1 && HEpresent_ == 1 && HFpresent_ == 1)
1181  ++alarmer_counter_;
1182  else
1183  alarmer_counter_ = 0;
1184 
1185  fill_Nevents();
1186 
1187  zeroCounters(); // reset counters of good/bad digis
1188 
1189  return;
1190 }
1191 
1193 {
1194  if (debug_>0)
1195  std::cout <<"<HcalDigiMonitor> Calling fill_Nevents for event "<<tevt_<< " (processed events = "<<ievt_<<")"<<std::endl;
1196  int iPhi, iEta, iDepth;
1197  // bool valid=false;
1198 
1199  // Fill problems vs. lumi block plots
1206 
1208  alarmer_counter_ = 0;
1209 
1210  if( alarmer_counter_ >= 5 )
1212 
1213  // Fill the number of problem digis in each channel
1214  if (ProblemsCurrentLB)
1215  {
1216  ProblemsCurrentLB->Fill(-1,-1,1); // event counter
1224  }
1225 
1226  // Fill plots of sums of adjacent digi samples
1227  for (int i=0;i<10;++i)
1228  {
1229  for (int j=0;j<50;++j)
1230  {
1231  if (hbHists.tssumplus[j][i]>0) hbHists.TS_sum_plus[i]->Fill(j, hbHists.tssumplus[j][i]);
1232  if (hbHists.tssumminus[j][i]>0) hbHists.TS_sum_minus[i]->Fill(j, hbHists.tssumminus[j][i]);
1233  if (heHists.tssumplus[j][i]>0) heHists.TS_sum_plus[i]->Fill(j, heHists.tssumplus[j][i]);
1234  if (heHists.tssumminus[j][i]>0) heHists.TS_sum_minus[i]->Fill(j, heHists.tssumminus[j][i]);
1235  if (hoHists.tssumplus[j][i]>0) hoHists.TS_sum_plus[i]->Fill(j, hoHists.tssumplus[j][i]);
1236  if (hoHists.tssumminus[j][i]>0) hoHists.TS_sum_minus[i]->Fill(j, hoHists.tssumminus[j][i]);
1237  if (hfHists.tssumplus[j][i]>0) hfHists.TS_sum_plus[i]->Fill(j, hfHists.tssumplus[j][i]);
1238  if (hfHists.tssumminus[j][i]>0) hfHists.TS_sum_minus[i]->Fill(j, hfHists.tssumminus[j][i]);
1239  }
1240  } // for (int i=0;i<10;++i)
1241 
1242  for (int i=0;i<DIGI_NUM;++i)
1243  {
1244  if (diginum[i]>0) DigiNum->Fill(i, diginum[i]);
1245  if (i>=DIGI_SUBDET_NUM) continue;
1246 
1247  if (hbHists.count_BQ[i]>0) hbHists.BQ->Fill(i, hbHists.count_BQ[i]);
1248  if (heHists.count_BQ[i]>0) heHists.BQ->Fill(i, heHists.count_BQ[i]);
1249  if (hoHists.count_BQ[i]>0) hoHists.BQ->Fill(i, hoHists.count_BQ[i]);
1250  if (hfHists.count_BQ[i]>0) hfHists.BQ->Fill(i, hfHists.count_BQ[i]);
1251  }//for int i=0;i<DIGI_NUM;++i)
1252 
1253 
1254  // Fill data-valid/error plots and capid plots
1255  for (int i=0;i<4;++i)
1256  {
1257  if (hbHists.dverr[i]>0) hbHists.DVerr->Fill(i, hbHists.dverr[i]);
1258  if (heHists.dverr[i]>0) heHists.DVerr->Fill(i, heHists.dverr[i]);
1259  if (hoHists.dverr[i]>0) hoHists.DVerr->Fill(i, hoHists.dverr[i]);
1260  if (hfHists.dverr[i]>0) hfHists.DVerr->Fill(i, hfHists.dverr[i]);
1261 
1262  if (hbHists.capid[i]>0) hbHists.CapID->Fill(i, hbHists.capid[i]);
1263  if (heHists.capid[i]>0) heHists.CapID->Fill(i, heHists.capid[i]);
1264  if (hoHists.capid[i]>0) hoHists.CapID->Fill(i, hoHists.capid[i]);
1265  if (hfHists.capid[i]>0) hfHists.CapID->Fill(i, hfHists.capid[i]);
1266  }
1267 
1268  for (int i=0;i<200;++i)
1269  {
1270  if (hbHists.adc[i]>0) hbHists.ADC->Fill(i, hbHists.adc[i]);
1271 
1272  if (heHists.adc[i]>0) heHists.ADC->Fill(i, heHists.adc[i]);
1273  if (hoHists.adc[i]>0) hoHists.ADC->Fill(i, hoHists.adc[i]);
1274  if (hfHists.adc[i]>0) hfHists.ADC->Fill(i, hfHists.adc[i]);
1275 
1280  }
1281 
1282  for (int i = 0; i < 15; ++i)
1283  {
1284  if (hbHists.fibbcnoff[i]>0) hbHists.fibBCNOff->Fill(i-7,
1285  hbHists.fibbcnoff[i]);
1286  if (heHists.fibbcnoff[i]>0) heHists.fibBCNOff->Fill(i-7,
1287  heHists.fibbcnoff[i]);
1288  if (hfHists.fibbcnoff[i]>0) hfHists.fibBCNOff->Fill(i-7,
1289  hfHists.fibbcnoff[i]);
1290  if (hoHists.fibbcnoff[i]>0) hoHists.fibBCNOff->Fill(i-7,
1291  hoHists.fibbcnoff[i]);
1292  }
1293 
1294  // Fill plots of bad fraction of digis found
1295  for (int i=0;i<DIGI_BQ_FRAC_NBINS;++i)
1296  {
1297  if (DIGI_BQ_FRAC_NBINS==1) break;
1298  if (hbHists.count_BQFrac[i]>0) hbHists.BQFrac->Fill(1.*i/(DIGI_BQ_FRAC_NBINS-1), hbHists.count_BQFrac[i]);
1299  if (heHists.count_BQFrac[i]>0) heHists.BQFrac->Fill(1.*i/(DIGI_BQ_FRAC_NBINS-1), heHists.count_BQFrac[i]);
1300  if (hoHists.count_BQFrac[i]>0)
1301  {
1302  hoHists.BQFrac->Fill(1.*i/(DIGI_BQ_FRAC_NBINS), hoHists.count_BQFrac[i]);
1303  }
1304  if (hfHists.count_BQFrac[i]>0) hfHists.BQFrac->Fill(1.*i/(DIGI_BQ_FRAC_NBINS-1), hfHists.count_BQFrac[i]);
1305  }//for (int i=0;i<DIGI_BQ_FRAC_NBINS;++i)
1306 
1307  // Fill presample plots
1308  for (int i=0;i<50;++i)
1309  {
1314  } //for (int i=0;i<50;++i)
1315 
1316  // Fill shape plots
1317  for (int i=0;i<10;++i)
1318  {
1327  }// for (int i=0;i<10;++i)
1328 
1329  // Fill capID difference plots
1330  for (int i=0;i<8;++i)
1331  {
1336  }
1337 
1338  // Fill VME plots
1339  for (int i=0;i<40;++i)
1340  {
1341  for (int j=0;j<18;++j)
1342  {
1343  if (errorVME[i][j]>0) DigiErrorVME->Fill(i, j,errorVME[i][j]);
1344  if (occupancyVME[i][j]>0) DigiOccupancyVME->Fill(i, j,occupancyVME[i][j]);
1345  }
1346  } //for (int i=0;i<40;++i)
1347 
1348  // Fill SPIGOT plots
1349  for (int i=0;i<HcalDCCHeader::SPIGOT_COUNT;++i)
1350  {
1351  for (int j=0;j<36;++j)
1352  {
1353  if (errorSpigot[i][j]>0) DigiErrorSpigot->Fill(i, j,errorSpigot[i][j]);
1355  }
1356  } //for (int i=0;i<HcalDCCHeader::SPIGOT_COUNT;++i)
1357 
1358  // Loop over subdetectors
1359  for (int sub=0;sub<4;++sub)
1360  {
1361  for (int dsize=0;dsize<20;++dsize)
1362  {
1363  if (digisize[dsize][sub]>0)
1364  DigiSize->Fill(sub,dsize,digisize[dsize][sub]);
1365  }
1366  } // for (int sub=0;sub<4;++sub)
1367 
1368  // Loop over eta, phi, depth
1369  for (int d=0;d<4;++d)
1370  {
1371  iDepth=d+1;
1372  DigiErrorsByDepth.depth[d]->setBinContent(0,0,ievt_); // underflow bin contains event counter
1373  DigiOccupancyByDepth.depth[d]->setBinContent(0,0,ievt_);
1374  DigiErrorsBadDigiSize.depth[d]->setBinContent(0,0,ievt_);
1375  DigiErrorsUnpacker.depth[d]->setBinContent(0,0,ievt_);
1376  DigiErrorsBadFibBCNOff.depth[d]->setBinContent(0,0,ievt_);
1377 
1378  for (int phi=0;phi<72;++phi)
1379  {
1380  iPhi=phi+1;
1382  for (int eta=0;eta<83;++eta)
1383  {
1384  // DigiOccupanyEta uses 'true' ieta (included the overlap at +/- 29)
1385  iEta=eta-41;
1386  if (phi==0)
1388  // valid=false;
1389 
1390  // HB
1391  if (validDetId(HcalBarrel, iEta, iPhi, iDepth))
1392  {
1393  // valid=true;
1394  if (HBpresent_)
1395  {
1396  int calcEta = CalcEtaBin(HcalBarrel,iEta,iDepth);
1397 
1398  DigiOccupancyByDepth.depth[d]->Fill(iEta, iPhi,
1399  occupancyEtaPhi[calcEta][phi][d]);
1400 
1401  if (makeDiagnostics_)
1402  {
1403  DigiErrorsBadCapID.depth[d]->Fill(iEta, iPhi,
1404  badcapID[calcEta][phi][d]);
1405  DigiErrorsDVErr.depth[d]->Fill(iEta, iPhi,
1406  digierrorsdverr[calcEta][phi][d]);
1407  }
1408  DigiErrorsBadDigiSize.depth[d]->Fill(iEta, iPhi,
1409  baddigisize[calcEta][phi][d]);
1410  DigiErrorsBadFibBCNOff.depth[d]->Fill(iEta, iPhi,
1411  badFibBCNOff[calcEta][phi][d]);
1412  DigiErrorsUnpacker.depth[d]->Fill(iEta, iPhi,
1413  badunpackerreport[calcEta][phi][d]);
1414  DigiErrorsByDepth.depth[d]->Fill(iEta, iPhi,
1415  baddigis[calcEta][phi][d]);
1416  // Use this for testing purposes only
1417  //DigiErrorsByDepth[d]->Fill(iEta, iPhi, ievt_);
1418  } // if (HBpresent_)
1419  } // validDetId(HB)
1420  // HE
1421  if (validDetId(HcalEndcap, iEta, iPhi, iDepth))
1422  {
1423  // valid=true;
1424  if (HEpresent_)
1425  {
1426  int calcEta = CalcEtaBin(HcalEndcap,iEta,iDepth);
1427 
1428  DigiOccupancyByDepth.depth[d]->Fill(iEta, iPhi,
1429  occupancyEtaPhi[calcEta][phi][d]);
1430 
1431  if (makeDiagnostics_)
1432  {
1433  DigiErrorsBadCapID.depth[d]->Fill(iEta, iPhi,
1434  badcapID[calcEta][phi][d]);
1435  DigiErrorsDVErr.depth[d]->Fill(iEta, iPhi,
1436  digierrorsdverr[calcEta][phi][d]);
1437  }
1438  DigiErrorsBadDigiSize.depth[d]->Fill(iEta, iPhi,
1439  baddigisize[calcEta][phi][d]);
1440  DigiErrorsBadFibBCNOff.depth[d]->Fill(iEta, iPhi,
1441  badFibBCNOff[calcEta][phi][d]);
1442  DigiErrorsUnpacker.depth[d]->Fill(iEta, iPhi,
1443  badunpackerreport[calcEta][phi][d]);
1444  DigiErrorsByDepth.depth[d]->Fill(iEta, iPhi,
1445  baddigis[calcEta][phi][d]);
1446  } // if (HEpresent_)
1447  } // valid HE found
1448  // HO
1449  if (validDetId(HcalOuter,iEta,iPhi,iDepth))
1450  {
1451  // valid=true;
1452  if (HOpresent_)
1453  {
1454  int calcEta = CalcEtaBin(HcalOuter,iEta,iDepth);
1455  DigiOccupancyByDepth.depth[d]->Fill(iEta, iPhi,
1456  occupancyEtaPhi[calcEta][phi][d]);
1457  if (makeDiagnostics_)
1458  {
1459  DigiErrorsBadCapID.depth[d]->Fill(iEta, iPhi,
1460  badcapID[calcEta][phi][d]);
1461  DigiErrorsDVErr.depth[d]->Fill(iEta, iPhi,
1462  digierrorsdverr[calcEta][phi][d]);
1463  }
1464  DigiErrorsBadDigiSize.depth[d]->Fill(iEta, iPhi,
1465  baddigisize[calcEta][phi][d]);
1466  DigiErrorsBadFibBCNOff.depth[d]->Fill(iEta, iPhi,
1467  badFibBCNOff[calcEta][phi][d]);
1468  DigiErrorsUnpacker.depth[d]->Fill(iEta, iPhi,
1469  badunpackerreport[calcEta][phi][d]);
1470 
1471  DigiErrorsByDepth.depth[d]->Fill(iEta,iPhi,
1472  baddigis[calcEta][phi][d]);
1473  } // if (HOpresent_)
1474  }//validDetId(HO)
1475  // HF
1476  if (validDetId(HcalForward,iEta,iPhi,iDepth))
1477  {
1478  // valid=true;
1479  if (HFpresent_)
1480  {
1481  int calcEta = CalcEtaBin(HcalForward,iEta,iDepth);
1482  int zside = iEta/abs(iEta);
1483  DigiOccupancyByDepth.depth[d]->Fill(iEta+zside, iPhi,
1484  occupancyEtaPhi[calcEta][phi][d]);
1485 
1486  if (makeDiagnostics_)
1487  {
1488  DigiErrorsBadCapID.depth[d]->Fill(iEta+zside, iPhi,
1489  badcapID[calcEta][phi][d]);
1490  DigiErrorsDVErr.depth[d]->Fill(iEta+zside, iPhi,
1491  digierrorsdverr[calcEta][phi][d]);
1492  }
1493  DigiErrorsBadDigiSize.depth[d]->Fill(iEta+zside, iPhi,
1494  baddigisize[calcEta][phi][d]);
1495  DigiErrorsBadFibBCNOff.depth[d]->Fill(iEta+zside, iPhi,
1496  badFibBCNOff[calcEta][phi][d]);
1497  DigiErrorsUnpacker.depth[d]->Fill(iEta+zside, iPhi,
1498  badunpackerreport[calcEta][phi][d]);
1499  DigiErrorsByDepth.depth[d]->Fill(iEta+zside, iPhi,
1500  baddigis[calcEta][phi][d]);
1501 
1502  } // if (HFpresent_)
1503  }
1504  } // for (int eta=0;...)
1505  } // for (int phi=0;...)
1506  } // for (int d=0;...)
1507 
1508  // Now fill all the unphysical cell values
1510  if (makeDiagnostics_)
1511  {
1514  }
1519 
1520  // zeroCounters(); // reset counters of good/bad digis
1521 
1522  return;
1523 } // void HcalDigiMonitor::fill_Nevents()
1524 
1525 
1527 {
1528  // Set all histogram counters back to 0
1529  // Call this after all every N evnets
1530 
1531  /******** Zero all counters *******/
1532  for (int d=0; d<DEPTHBINS; d++) {
1533  for (int eta=0; eta<ETABINS; eta++) {
1534  for (int phi=0; phi<PHIBINS; phi++){
1535  uniqcounter[eta][phi][d] = 0.0;
1536  uniqcounter2[eta][phi][d] = 0.0;
1537  }
1538  }
1539  }
1540 
1541  hbHists.count_bad=0;
1542  hbHists.count_good=0;
1543  heHists.count_bad=0;
1544  heHists.count_good=0;
1545  hoHists.count_bad=0;
1546  hoHists.count_good=0;
1547  hfHists.count_bad=0;
1548  hfHists.count_good=0;
1549 
1550  knownbadQPLLs = 0;
1551 
1552  HO0bad=0;
1553  HO12bad=0;
1554  HFlumibad=0;
1555 
1556  for (int i=0;i<85;++i)
1557  {
1558  occupancyEta[i]=0;
1559  if (i<72)
1560  occupancyPhi[i]=0;
1561  for (int j=0;j<72;++j)
1562  {
1563  for (int k=0;k<4;++k)
1564  {
1565  baddigis[i][j][k]=0;
1566  badcapID[i][j][k]=0;
1567  baddigisize[i][j][k]=0;
1568  occupancyEtaPhi[i][j][k]=0;
1569  digierrorsdverr[i][j][k]=0;
1570  badFibBCNOff[i][j][k]=0;
1571  badunpackerreport[i][j][k]=0;
1572  }
1573  } // for (int j=0;j<72;++i)
1574  } // for (int i=0;i<85;++i)
1575 
1576  for (int i=0;i<40;++i)
1577  {
1578  for (int j=0;j<18;++j)
1579  {
1580  occupancyVME[i][j]=0;
1581  errorVME[i][j]=0;
1582  }
1583  }
1584 
1585  for (int i=0;i<HcalDCCHeader::SPIGOT_COUNT;++i)
1586  {
1587  for (int j=0;j<36;++j)
1588  {
1589  occupancySpigot[i][j]=0;
1590  errorSpigot[i][j]=0;
1591  }
1592  }
1593 
1594 
1595  for (int i=0;i<20;++i)
1596  {
1597  for (int j=0;j<4;++j)
1598  digisize[i][j]=0;
1599  }
1600 
1601  for (int i=0;i<DIGI_NUM;++i)
1602  {
1603  diginum[i]=0;
1604 
1605  // set all DigiHists counters to 0
1606  if (i<4)
1607  {
1608  hbHists.dverr[i]=0;
1609  heHists.dverr[i]=0;
1610  hoHists.dverr[i]=0;
1611  hfHists.dverr[i]=0;
1612  hbHists.capid[i]=0;
1613  heHists.capid[i]=0;
1614  hoHists.capid[i]=0;
1615  hfHists.capid[i]=0;
1616  }
1617  if (i<8)
1618  {
1619  hbHists.capIDdiff[i]=0;
1620  heHists.capIDdiff[i]=0;
1621  hoHists.capIDdiff[i]=0;
1622  hfHists.capIDdiff[i]=0;
1623  }
1624 
1625  if (i<10)
1626  {
1627  hbHists.count_shape[i]=0;
1628  heHists.count_shape[i]=0;
1629  hoHists.count_shape[i]=0;
1630  hfHists.count_shape[i]=0;
1631 
1636  }
1637  if (i<50)
1638  {
1643  for (int j=0;j<10;++j)
1644  {
1645  hbHists.tssumplus[i][j]=0;
1646  heHists.tssumplus[i][j]=0;
1647  hoHists.tssumplus[i][j]=0;
1648  hfHists.tssumplus[i][j]=0;
1649  hbHists.tssumminus[i][j]=0;
1650  heHists.tssumminus[i][j]=0;
1651  hoHists.tssumminus[i][j]=0;
1652  hfHists.tssumminus[i][j]=0;
1653  }
1654  }
1655 
1656  if (i<15)
1657  {
1658  hbHists.fibbcnoff[i]=0;
1659  heHists.fibbcnoff[i]=0;
1660  hoHists.fibbcnoff[i]=0;
1661  hfHists.fibbcnoff[i]=0;
1662  }
1663 
1664  if (i<200)
1665  {
1666  hbHists.adc[i]=0;
1667  heHists.adc[i]=0;
1668  hoHists.adc[i]=0;
1669  hfHists.adc[i]=0;
1670  hbHists.adcsum[i]=0;
1671  heHists.adcsum[i]=0;
1672  hoHists.adcsum[i]=0;
1673  hfHists.adcsum[i]=0;
1674  }
1675  if (i<DIGI_SUBDET_NUM)
1676  {
1677  hbHists.count_BQ[i]=0;
1678  heHists.count_BQ[i]=0;
1679  hoHists.count_BQ[i]=0;
1680  hfHists.count_BQ[i]=0;
1681  }
1682  if (i<DIGI_BQ_FRAC_NBINS)
1683  {
1684  hbHists.count_BQFrac[i]=0;
1685  heHists.count_BQFrac[i]=0;
1686  hoHists.count_BQFrac[i]=0;
1687  hfHists.count_BQFrac[i]=0;
1688  }
1689  } // for (int i=0;i<DIGI_NUM;++i)
1690 
1691 
1692  return;
1693 }
1694 
1696 {
1697  // call update command for all histograms (should make them update when running in online DQM?)
1698  h.shape->update();
1699  h.shapeThresh->update();
1700  h.presample->update();
1701  h.BQ->update();
1702  h.BQFrac->update();
1703  h.DigiFirstCapID->update();
1704  h.DVerr->update();
1705  h.CapID->update();
1706  h.ADC->update();
1707  h.ADCsum->update();
1708  h.fibBCNOff->update();
1709 
1710  for (unsigned int i=0;i<h.TS_sum_plus.size();++i)
1711  h.TS_sum_plus[i]->update();
1712  for (unsigned int i=0;i<h.TS_sum_minus.size();++i)
1713  h.TS_sum_minus[i]->update();
1714 } //void HcalDigiMonitor::UpdateHists(DigiHists& h)
1715 
1716 
1718 {
1719  // reset the temporary histograms
1720  zeroCounters();
1721 
1722  // then reset the MonitorElements
1723 
1725  alarmer_counter_ = 0;
1726  knownbadQPLLs = 0;
1727 
1728  hbhedcsON = true; hfdcsON = true;
1729 
1739 
1744  DigiErrorVME->Reset();
1746 
1747  DigiBQ->Reset();
1748  DigiBQFrac->Reset();
1751 
1752  DigiNum->Reset();
1753 
1754  hbHists.shape->Reset();
1756  hbHists.presample->Reset();
1757  hbHists.BQ->Reset();
1758  hbHists.BQFrac->Reset();
1760  hbHists.DVerr->Reset();
1761  hbHists.CapID->Reset();
1762  hbHists.ADC->Reset();
1763  hbHists.ADCsum->Reset();
1764  hbHists.fibBCNOff->Reset();
1765  for (unsigned int i=0;i<hbHists.TS_sum_plus.size();++i)
1766  hbHists.TS_sum_plus[i]->Reset();
1767  for (unsigned int i=0;i<hbHists.TS_sum_minus.size();++i)
1768  hbHists.TS_sum_minus[i]->Reset();
1769 
1770  heHists.shape->Reset();
1772  heHists.presample->Reset();
1773  heHists.BQ->Reset();
1774  heHists.BQFrac->Reset();
1776  heHists.DVerr->Reset();
1777  heHists.CapID->Reset();
1778  heHists.ADC->Reset();
1779  heHists.ADCsum->Reset();
1780  heHists.fibBCNOff->Reset();
1781  for (unsigned int i=0;i<heHists.TS_sum_plus.size();++i)
1782  heHists.TS_sum_plus[i]->Reset();
1783  for (unsigned int i=0;i<heHists.TS_sum_minus.size();++i)
1784  heHists.TS_sum_minus[i]->Reset();
1785 
1786  hoHists.shape->Reset();
1788  hoHists.presample->Reset();
1789  hoHists.BQ->Reset();
1790  hoHists.BQFrac->Reset();
1792  hoHists.DVerr->Reset();
1793  hoHists.CapID->Reset();
1794  hoHists.ADC->Reset();
1795  hoHists.ADCsum->Reset();
1796  hoHists.fibBCNOff->Reset();
1797  for (unsigned int i=0;i<hoHists.TS_sum_plus.size();++i)
1798  hoHists.TS_sum_plus[i]->Reset();
1799  for (unsigned int i=0;i<hoHists.TS_sum_minus.size();++i)
1800  hoHists.TS_sum_minus[i]->Reset();
1801 
1802  hfHists.shape->Reset();
1804  hfHists.presample->Reset();
1805  hfHists.BQ->Reset();
1806  hfHists.BQFrac->Reset();
1808  hfHists.DVerr->Reset();
1809  hfHists.CapID->Reset();
1810  hfHists.ADC->Reset();
1811  hfHists.ADCsum->Reset();
1812  hfHists.fibBCNOff->Reset();
1813  for (unsigned int i=0;i<hfHists.TS_sum_plus.size();++i)
1814  hfHists.TS_sum_plus[i]->Reset();
1815  for (unsigned int i=0;i<hfHists.TS_sum_minus.size();++i)
1816  hfHists.TS_sum_minus[i]->Reset();
1817 
1818  return;
1819 }
1821 
MonitorElement * h_invalid_bcn
bool passedMinBiasHLT_
Methods, variables accessible only within class code.
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
int capid[4]
bool LumiInOrder(int lumisec)
int count_presample[50]
MonitorElement * DigiBQFrac
edm::EDGetTokenT< DcsStatusCollection > dcsStatusToken_
int getNDD() const
Get the number of daq data samples per channel when not zero-suppressed.
Definition: HcalHTRData.cc:388
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:204
MonitorElement * ProblemsCurrentLB
MonitorElement * HFtiming_occupancy2D
edm::InputTag digiLabel_
MonitorElement * ADC
std::vector< std::string > MinBiasHLTBits_
EtaPhiHists DigiErrorsDVErr
int occupancySpigot[40][36]
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:30
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
int tssumminus[50][10]
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:873
MonitorElement * shape
MonitorElement * DigiSize
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
MonitorElement * HFP_shape
ProductID id() const
Definition: HandleBase.cc:15
int occupancyVME[40][18]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
MonitorElement * BQ
MonitorElement * ProblemsVsLB_HF
int errorVME[40][18]
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::map< unsigned int, int > KnownBadCells_
MonitorElement * HFtiming_totaltime2D
std::vector< int > AllowedCalibTypes_
MonitorElement * shapeThresh
void beginRun(const edm::Run &run, const edm::EventSetup &c)
MonitorElement * HFM_shape
void Reset(void)
int badcapID[85][72][4]
EtaPhiHists DigiErrorOccupancyByDepth
#define DIGI_BQ_FRAC_NBINS
std::vector< HFRecHit >::const_iterator const_iterator
int bunchCrossing() const
Definition: EventBase.h:62
int fibbcnoff[15]
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)
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
HcalDigiMonitor(const edm::ParameterSet &ps)
double pedestal(int fCapId) const
get pedestal for capid=0..3
const Item * getValues(DetId fId, bool throwOnFail=true) const
Strings::size_type size() const
Definition: TriggerNames.cc:39
void update(void)
Mark the object updated.
int badFibBCNOff[85][72][4]
MonitorElement * DigiOccupancyEta
MonitorElement * DigiErrorVME
MonitorElement * DigiOccupancyVME
T eta() const
int getSpigotData(int nspigot, HcalHTRData &decodeTool, int validSize) const
int dverr[4]
MonitorElement * DigiNum
MonitorElement * HOocc_vs_LB
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const HcalDetId & id() const
Definition: HODataFrame.h:23
int baddigis[85][72][4]
MonitorElement * ThreshCount
uint64_t uniqcounter[ETABINS][PHIBINS][DEPTHBINS]
void Fill(long long x)
int adcsum[200]
LuminosityBlockNumber_t luminosityBlock() const
std::map< HcalDetId, std::vector< double > > PedestalsByCapId_
MonitorElement * DigiErrorSpigot
#define DEPTHBINS
tuple report
Definition: zeeHLT_cff.py:9
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
EtaPhiHists DigiErrorsBadFibBCNOff
void UpdateHists(DigiHists &h)
int adc[200]
bool isSiPM(int ieta, int iphi, int depth)
int depth() const
get the tower depth
Definition: HcalDetId.h:40
std::vector< MonitorElement * > depth
virtual void beginRun(const edm::Run &run, const edm::EventSetup &c)
int DigiMonitor_ExpectedOrbitMessageTime_
void removeContents(void)
erase all monitoring elements in current directory (not including subfolders);
Definition: DQMStore.cc:2765
MonitorElement * HBocc_vs_LB
int baddigisize[85][72][4]
#define DIGI_SUBDET_NUM
const T & max(const T &a, const T &b)
MonitorElement * ProblemsVsLB_HBHEHF
MonitorElement * ProblemsVsLB_HB
int digierrorsdverr[85][72][4]
std::vector< DetId > getAllChannels() const
int ieta() const
get the cell ieta
Definition: HcalDetId.h:36
virtual void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
float bins_cellcount_new[]
DetIdVector::const_iterator bad_quality_begin() const
bool getSpigotPresent(unsigned int nspigot) const
Read the &quot;PRESENT&quot; bit for this spigot.
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:1187
int orbitNumber() const
Definition: EventBase.h:63
std::vector< MonitorElement * > TS_sum_minus
MonitorElement * HFocc_vs_LB
unsigned int offset(bool)
bool isValid() const
Definition: HandleBase.h:76
edm::EDGetTokenT< HcalUnpackerReport > tok_unpack_
std::vector< MonitorElement * > TS_sum_plus
int process_Digi(T &digi, DigiHists &hist, int &firstcap)
int k[5][pyjets_maxn]
const_iterator end() const
MonitorElement * DigiBQ
MonitorElement * DigiUnpackerErrorCount
int getSourceId() const
Definition: HcalDCCHeader.h:32
MonitorElement * HEocc_vs_LB
int iphi() const
get the cell iphi
Definition: HcalDetId.h:38
MonitorElement * ADCsum
EtaPhiHists DigiErrorsBadDigiSize
int errorSpigot[15][36]
int diginum[DIGI_NUM]
MonitorElement * fibBCNOff
static const double theHFEtaBounds[]
#define DIGI_NUM
int count_BQFrac[DIGI_BQ_FRAC_NBINS]
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
static bool bitUpset(int last, int now)
MonitorElement * DigiOccupancySpigot
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
EtaPhiHists DigiErrorsBadADCSum
edm::InputTag hltresultsLabel_
int count_BQ[DIGI_SUBDET_NUM]
const T & get() const
Definition: EventSetup.h:55
#define ETABINS
MonitorElement * HFtiming_etaProfile
T const * product() const
Definition: ESHandle.h:62
MonitorElement * ProblemsVsLB_HE
void FillUnphysicalHEHFBins(std::vector< TH2F > &hh)
int CalcEtaBin(int subdet, int ieta, int depth)
void analyze(const edm::Event &e, const edm::EventSetup &c)
MonitorElement * DVerr
edm::EDGetTokenT< HODigiCollection > tok_ho_
edm::InputTag FEDRawDataCollection_
MonitorElement * h_invalid_orbitnumMod103
void SetupEtaPhiHists(EtaPhiHists &hh, std::string Name, std::string Units)
int badQualityDigis() const
int occupancyEtaPhi[85][72][4]
edm::EDGetTokenT< HFDigiCollection > tok_hf_
MonitorElement * CapID
int tssumplus[50][10]
static const int SPIGOT_COUNT
Definition: HcalDCCHeader.h:19
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollectionToken_
float bins_fraccount_new[]
size_type size() const
if(dp >Float(M_PI)) dp-
MonitorElement * h_valid_digis
static std::atomic< unsigned int > counter
double count_shapeThresh[10]
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
edm::EDGetTokenT< edm::TriggerResults > tok_trigger_
unsigned adc(const HcalQIEShape &fShape, float fCharge, unsigned fCapId) const
fC + capid [0..3] -&gt; ADC conversion
Definition: HcalQIECoder.cc:27
#define PHIBINS
int capIDdiff[8]
const HcalDetId & id() const
Definition: HBHEDataFrame.h:22
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
tuple cout
Definition: gather_cfg.py:121
MonitorElement * DigiUnpackerErrorFrac
MonitorElement * DigiFirstCapID
EtaPhiHists DigiErrorsBadCapID
MonitorElement * ProblemsVsLB_HO
void setupSubdetHists(DigiHists &hist, std::string subdet)
EtaPhiHists DigiOccupancyByDepth
MonitorElement * BQFrac
MonitorElement * ProblemsVsLB
tuple status
Definition: ntuplemaker.py:245
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:780
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:1001
virtual void setup(void)
int badunpackerreport[85][72][4]
MonitorElement * presample
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * DigiExpectedSize
void processEvent(const HBHEDigiCollection &hbhe, const HODigiCollection &ho, const HFDigiCollection &hf, const HcalDbService &cond, const HcalUnpackerReport &report, int orN, int bcN)
void Reset(void)
reset ME (ie. contents, errors, etc)
int count_shape[10]
edm::EDGetTokenT< HFRecHitCollection > tok_hfrec_
EtaPhiHists DigiErrorsByDepth
EtaPhiHists DigiErrorsUnpacker
int digisize[20][4]
edm::ESHandle< HcalDbService > conditions_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:585
const_iterator begin() const
Definition: Run.h:41
DetIdVector::const_iterator bad_quality_end() const
MonitorElement * DigiOccupancyPhi
uint64_t uniqcounter2[ETABINS][PHIBINS][DEPTHBINS]
MonitorElement * ProblemDigisInLastNLB_HBHEHF_alarm
double pedSubtractedADC_[10]
bool validDetId(HcalSubdetector sd, int ies, int ip, int dp)
void endRun(const edm::Run &run, const edm::EventSetup &c)
Definition: DDAxes.h:10
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_