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