CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalDeadCellMonitor.cc
Go to the documentation of this file.
3 
5 {
6  Online_ = ps.getUntrackedParameter<bool>("online",false);
7  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns",false);
8  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
9  debug_ = ps.getUntrackedParameter<int>("debug",0);
10  makeDiagnostics_ = ps.getUntrackedParameter<bool>("makeDiagnostics",false);
11  prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
12  if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
13  prefixME_.append("/");
14  subdir_ = ps.getUntrackedParameter<std::string>("TaskFolder","DeadCellMonitor_Hcal"); // DeadCellMonitor_Hcal
15  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
16  subdir_.append("/");
17  subdir_=prefixME_+subdir_;
18  AllowedCalibTypes_ = ps.getUntrackedParameter<std::vector<int> > ("AllowedCalibTypes");
19  skipOutOfOrderLS_ = ps.getUntrackedParameter<bool>("skipOutOfOrderLS",true);
20  NLumiBlocks_ = ps.getUntrackedParameter<int>("NLumiBlocks",4000);
21 
22  badChannelStatusMask_ = ps.getUntrackedParameter<int>("BadChannelStatusMask",
23  ps.getUntrackedParameter<int>("BadChannelStatusMask",
24  (1<<HcalChannelStatus::HcalCellDead))); // identify channel status values to mask
25  // DeadCell-specific parameters
26 
27  // Collection type info
29  hbheRechitLabel_ = ps.getUntrackedParameter<edm::InputTag>("hbheRechitLabel");
30  hoRechitLabel_ = ps.getUntrackedParameter<edm::InputTag>("hoRechitLabel");
31  hfRechitLabel_ = ps.getUntrackedParameter<edm::InputTag>("hfRechitLabel");
32 
33  // minimum number of events required for lumi section-based dead cell checks
34  minDeadEventCount_ = ps.getUntrackedParameter<int>("minDeadEventCount",1000);
35  excludeHORing2_ = ps.getUntrackedParameter<bool>("excludeHORing2",false);
36 
37  // Set which dead cell checks will be performed
38  /* Dead cells can be defined in the following ways:
39  1) never present digi -- digi is never present in run
40  2) digis -- digi is absent for one or more lumi section
41  3) never present rechit -- rechit > threshold energy never present (NOT redundant, since it requires not just that a rechit be present, but that it be above threshold as well. )
42  4) rechits -- rechit is present, but rechit energy below threshold for one or more lumi sections
43 
44  Of these tests, never-present digis are always checked.
45  Occasional digis are checked only if deadmon_test_digis_ is true,
46  and both rechit tests are made only if deadmon_test_rechits_ is true
47  */
48 
49  deadmon_test_digis_ = ps.getUntrackedParameter<bool>("test_digis",true);
50  deadmon_test_rechits_ = ps.getUntrackedParameter<bool>("test_rechits",false);
51 
52  // rechit energy test -- cell must be below threshold value for a number of consecutive events to be considered dead
53  energyThreshold_ = ps.getUntrackedParameter<double>("MissingRechitEnergyThreshold",0);
54  HBenergyThreshold_ = ps.getUntrackedParameter<double>("HB_energyThreshold",energyThreshold_);
55  HEenergyThreshold_ = ps.getUntrackedParameter<double>("HE_energyThreshold",energyThreshold_);
56  HOenergyThreshold_ = ps.getUntrackedParameter<double>("HO_energyThreshold",energyThreshold_);
57  HFenergyThreshold_ = ps.getUntrackedParameter<double>("HF_energyThreshold",energyThreshold_);
58 
59 } //constructor
60 
62 {
63 } //destructor
64 
65 
66 /* ------------------------------------ */
67 
69 {
71  zeroCounters(1); // make sure arrays are set up
72  if (debug_>0)
73  std::cout <<"<HcalDeadCellMonitor::setup> Setting up histograms"<<std::endl;
74 
75  if (!dbe_) return;
76 
78  MonitorElement* excludeHO2=dbe_->bookInt("ExcludeHOring2");
79  // Fill with 0 if ring is not to be excluded; fill with 1 if it is to be excluded
80  if (excludeHO2) excludeHO2->Fill(excludeHORing2_==true ? 1 : 0);
81 
82  Nevents = dbe_->book1D("NumberOfDeadCellEvents","Number of Events Seen by DeadCellMonitor",2,0,2);
83  Nevents->setBinLabel(1,"allEvents");
84  Nevents->setBinLabel(2,"lumiCheck");
85  // 1D plots count number of bad cells vs. luminosity block
86  ProblemsVsLB=dbe_->bookProfile("TotalDeadCells_HCAL_vs_LS",
87  "Total Number of Dead Hcal Cells (excluding known problems) vs LS;Lumi Section;Dead Cells",
88  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
89  100,0,10000);
90  ProblemsVsLB_HB=dbe_->bookProfile("TotalDeadCells_HB_vs_LS",
91  "Total Number of Dead HB Cells (excluding known problems) vs LS;Lumi Section;Dead Cells",
92  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
93  100,0,10000);
94  ProblemsVsLB_HE=dbe_->bookProfile("TotalDeadCells_HE_vs_LS",
95  "Total Number of Dead HE Cells (excluding known problems) vs LS;Lumi Section;Dead Cells",
96  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
97  ProblemsVsLB_HO=dbe_->bookProfile("TotalDeadCells_HO_vs_LS",
98  "Total Number of Dead HO Cells (excluding known problems) vs LS;Lumi Section;Dead Cells",
99  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
100  ProblemsVsLB_HF=dbe_->bookProfile("TotalDeadCells_HF_vs_LS",
101  "Total Number of Dead HF Cells (excluding known problems) vs LS;Lumi Section;Dead Cells",
102  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
103  ProblemsVsLB_HBHEHF=dbe_->bookProfile("TotalDeadCells_HBHEHF_vs_LS",
104  "Total Number of Dead HBHEHF Cells (excluding known problems) vs LS;Lumi Section;Dead Cells",
105  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
106 
107  (ProblemsVsLB->getTProfile())->SetMarkerStyle(20);
108  (ProblemsVsLB_HB->getTProfile())->SetMarkerStyle(20);
109  (ProblemsVsLB_HE->getTProfile())->SetMarkerStyle(20);
110  (ProblemsVsLB_HO->getTProfile())->SetMarkerStyle(20);
111  (ProblemsVsLB_HF->getTProfile())->SetMarkerStyle(20);
112  (ProblemsVsLB_HBHEHF->getTProfile())->SetMarkerStyle(20);
113 
114  dbe_->setCurrentFolder(subdir_+"dead_cell_parameters");
115  MonitorElement* me=dbe_->bookInt("Test_NeverPresent_Digis");
116  me->Fill(1);
117  me=dbe_->bookInt("Test_DigiMissing_Periodic_Lumi_Check");
119  me->Fill(1);
120  else
121  me->Fill(0);
122  me=dbe_->bookInt("Min_Events_Required_Periodic_Lumi_Check");
124  me=dbe_->bookInt("Test_NeverPresent_RecHits");
125  deadmon_test_rechits_>0 ? me->Fill(1) : me->Fill(0);
126  me=dbe_->bookFloat("HBMinimumRecHitEnergy");
128  me=dbe_->bookFloat("HEMinimumRecHitEnergy");
130  me=dbe_->bookFloat("HOMinimumRecHitEnergy");
132  me=dbe_->bookFloat("HFMinimumRecHitEnergy");
134  me=dbe_->bookInt("Test_RecHitsMissing_Periodic_Lumi_Check");
135  deadmon_test_rechits_>0 ? me->Fill(1) : me->Fill(0);
136 
137  // ProblemCells plots are in HcalDeadCellClient!
138 
139  // Set up plots for each failure mode of dead cells
140  std::stringstream units; // We'll need to set the titles individually, rather than passing units to SetupEtaPhiHists (since this also would affect the name of the histograms)
141  std::stringstream name;
142 
143  // Never-present test will always be called, by definition of dead cell
144 
145  dbe_->setCurrentFolder(subdir_+"dead_digi_never_present");
147  "Digi Present At Least Once","");
148  // 1D plots count number of bad cells
149  NumberOfNeverPresentDigis=dbe_->bookProfile("Problem_NeverPresentDigis_HCAL_vs_LS",
150  "Total Number of Never-Present Hcal Cells vs LS;Lumi Section;Dead Cells",
151  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
152 
153  NumberOfNeverPresentDigisHB=dbe_->bookProfile("Problem_NeverPresentDigis_HB_vs_LS",
154  "Total Number of Never-Present HB Cells vs LS;Lumi Section;Dead Cells",
155  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
156 
157  NumberOfNeverPresentDigisHE=dbe_->bookProfile("Problem_NeverPresentDigis_HE_vs_LS",
158  "Total Number of Never-Present HE Cells vs LS;Lumi Section;Dead Cells",
159  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
160 
161  NumberOfNeverPresentDigisHO=dbe_->bookProfile("Problem_NeverPresentDigis_HO_vs_LS",
162  "Total Number of Never-Present HO Cells vs LS;Lumi Section;Dead Cells",
163  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
164 
165  NumberOfNeverPresentDigisHF=dbe_->bookProfile("Problem_NeverPresentDigis_HF_vs_LS",
166  "Total Number of Never-Present HF Cells vs LS;Lumi Section;Dead Cells",
167  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
168  (NumberOfNeverPresentDigis->getTProfile())->SetMarkerStyle(20);
169  (NumberOfNeverPresentDigisHB->getTProfile())->SetMarkerStyle(20);
170  (NumberOfNeverPresentDigisHE->getTProfile())->SetMarkerStyle(20);
171  (NumberOfNeverPresentDigisHO->getTProfile())->SetMarkerStyle(20);
172  (NumberOfNeverPresentDigisHF->getTProfile())->SetMarkerStyle(20);
173 
175 
177  {
178  dbe_->setCurrentFolder(subdir_+"dead_digi_often_missing");
179  //units<<"("<<deadmon_checkNevents_<<" consec. events)";
180  name<<"Dead Cells with No Digis";
182  name.str(),
183  "");
184  name.str("");
185  name<<"HB HE HF Depth 1 Dead Cells with No Digis for at least 1 Full Luminosity Block";
186  RecentMissingDigisByDepth.depth[0]->setTitle(name.str().c_str());
187 
188  name.str("");
189  name<<"HB HE HF Depth 2 Dead Cells with No Digis for at least 1 Full Luminosity Block";
190  RecentMissingDigisByDepth.depth[1]->setTitle(name.str().c_str());
191 
192  name.str("");
193  name<<"HE Depth 3 Dead Cells with No Digis for at least 1 Full Luminosity Block";
194  RecentMissingDigisByDepth.depth[2]->setTitle(name.str().c_str());
195 
196  name.str("");
197  name<<"HO Depth 4 Dead Cells with No Digis for at least 1 Full Luminosity Block";
198  RecentMissingDigisByDepth.depth[3]->setTitle(name.str().c_str());
199  name.str("");
200 
201  // 1D plots count number of bad cells
202  name<<"Total Number of Hcal Digis Unoccupied for at least 1 Full Luminosity Block";
203  NumberOfRecentMissingDigis=dbe_->bookProfile("Problem_RecentMissingDigis_HCAL_vs_LS",
204  name.str(),
205  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
206  name.str("");
207  name<<"Total Number of HB Digis Unoccupied for at least 1 Full LS vs LS;Lumi Section; Dead Cells";
208  NumberOfRecentMissingDigisHB=dbe_->bookProfile("Problem_RecentMissingDigis_HB_vs_LS",
209  name.str(),
210  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
211  name.str("");
212  name<<"Total Number of HE Digis Unoccupied for at least 1 Full LS vs LS;Lumi Section; Dead Cells";
213  NumberOfRecentMissingDigisHE=dbe_->bookProfile("Problem_RecentMissingDigis_HE_vs_LS",
214  name.str(),
215  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
216  name.str("");
217  name<<"Total Number of HO Digis Unoccupied for at least 1 Full LS vs LS;Lumi Section; Dead Cells";
218  NumberOfRecentMissingDigisHO=dbe_->bookProfile("Problem_RecentMissingDigis_HO_vs_LS",
219  name.str(),
220  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
221  name.str("");
222  name<<"Total Number of HF Digis Unoccupied for at least 1 Full LS vs LS;Lumi Section; Dead Cells";
223  NumberOfRecentMissingDigisHF=dbe_->bookProfile("Problem_RecentMissingDigis_HF_vs_LS",
224  name.str(),
225  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
226  (NumberOfRecentMissingDigis->getTProfile())->SetMarkerStyle(20);
227  (NumberOfRecentMissingDigisHB->getTProfile())->SetMarkerStyle(20);
228  (NumberOfRecentMissingDigisHE->getTProfile())->SetMarkerStyle(20);
229  (NumberOfRecentMissingDigisHO->getTProfile())->SetMarkerStyle(20);
230  (NumberOfRecentMissingDigisHF->getTProfile())->SetMarkerStyle(20);
231 
232  }
233 
235  {
236  // test 1: energy never above threshold
237  dbe_->setCurrentFolder(subdir_+"dead_rechit_neverpresent");
238  SetupEtaPhiHists(RecHitPresentByDepth,"RecHit Above Threshold At Least Once","");
239  // set more descriptive titles for threshold plots
240  units.str("");
241  units<<"Cells Above Energy Threshold At Least Once: Depth 1 -- HB >="<<HBenergyThreshold_<<" GeV, HE >= "<<HEenergyThreshold_<<", HF >="<<HFenergyThreshold_<<" GeV";
242  RecHitPresentByDepth.depth[0]->setTitle(units.str().c_str());
243  units.str("");
244  units<<"Cells Above Energy Threshold At Least Once: Depth 2 -- HB >="<<HBenergyThreshold_<<" GeV, HE >= "<<HEenergyThreshold_<<", HF >="<<HFenergyThreshold_<<" GeV";
245  RecHitPresentByDepth.depth[1]->setTitle(units.str().c_str());
246  units.str("");
247  units<<"Cells Above Energy Threshold At Least Once: Depth 3 -- HE >="<<HEenergyThreshold_<<" GeV";
248  RecHitPresentByDepth.depth[2]->setTitle(units.str().c_str());
249  units.str("");
250  units<<"Cells Above Energy Threshold At Least Once: Depth 4 -- HO >="<<HOenergyThreshold_<<" GeV";
251  RecHitPresentByDepth.depth[3]->setTitle(units.str().c_str());
252  units.str("");
253 
254  // 1D plots count number of bad cells
255  NumberOfNeverPresentRecHits=dbe_->bookProfile("Problem_RecHitsNeverPresent_HCAL_vs_LS",
256  "Total Number of Hcal Rechits with Low Energy;Lumi Section;Dead Cells",
257  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
258  name.str("");
259  name<<"Total Number of HB RecHits with Energy Never >= "<<HBenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
260  NumberOfNeverPresentRecHitsHB=dbe_->bookProfile("Problem_RecHitsNeverPresent_HB_vs_LS",
261  name.str(),
262  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
263  name.str("");
264  name<<"Total Number of HE RecHits with Energy Never >= "<<HEenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
265  NumberOfNeverPresentRecHitsHE=dbe_->bookProfile("Problem_RecHitsNeverPresent_HE_vs_LS",
266  name.str(),
267  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
268  name.str("");
269  name<<"Total Number of HO RecHits with Energy Never >= "<<HOenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
270  NumberOfNeverPresentRecHitsHO=dbe_->bookProfile("Problem_RecHitsNeverPresent_HO_vs_LS",
271  name.str(),
272  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
273  name.str("");
274  name<<"Total Number of HF RecHits with Energy Never >= "<<HFenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
275  NumberOfNeverPresentRecHitsHF=dbe_->bookProfile("Problem_RecHitsNeverPresent_HF_vs_LS",
276  name.str(),
277  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
278  (NumberOfNeverPresentRecHits->getTProfile())->SetMarkerStyle(20);
279  (NumberOfNeverPresentRecHitsHB->getTProfile())->SetMarkerStyle(20);
280  (NumberOfNeverPresentRecHitsHE->getTProfile())->SetMarkerStyle(20);
281  (NumberOfNeverPresentRecHitsHO->getTProfile())->SetMarkerStyle(20);
282  (NumberOfNeverPresentRecHitsHF->getTProfile())->SetMarkerStyle(20);
283 
284  dbe_->setCurrentFolder(subdir_+"dead_rechit_often_missing");
285  SetupEtaPhiHists(RecentMissingRecHitsByDepth,"RecHits Failing Energy Threshold Test","");
286  // set more descriptive titles for threshold plots
287  units.str("");
288  units<<"RecHits with Consistent Low Energy Depth 1 -- HB <"<<HBenergyThreshold_<<" GeV, HE < "<<HEenergyThreshold_<<", HF <"<<HFenergyThreshold_<<" GeV";
289  RecentMissingRecHitsByDepth.depth[0]->setTitle(units.str().c_str());
290  units.str("");
291  units<<"RecHits with Consistent Low Energy Depth 2 -- HB <"<<HBenergyThreshold_<<" GeV, HE < "<<HEenergyThreshold_<<", HF <"<<HFenergyThreshold_<<" GeV";
292  RecentMissingRecHitsByDepth.depth[1]->setTitle(units.str().c_str());
293  units.str("");
294  units<<"RecHits with Consistent Low Energy Depth 3 -- HE <"<<HEenergyThreshold_<<" GeV";
295  RecentMissingRecHitsByDepth.depth[2]->setTitle(units.str().c_str());
296  units.str("");
297  units<<"RecHits with Consistent Low Energy Depth 4 -- HO <"<<HOenergyThreshold_<<" GeV";
298  RecentMissingRecHitsByDepth.depth[3]->setTitle(units.str().c_str());
299  units.str("");
300 
301 
302  // 1D plots count number of bad cells
303  name<<"Total Number of Hcal RecHits with Consistent Low Energy;Lumi Section;Dead Cells";
304  NumberOfRecentMissingRecHits=dbe_->bookProfile("Problem_BelowEnergyRecHits_HCAL_vs_LS",
305  name.str(),
306  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
307  name.str("");
308  name<<"Total Number of HB RecHits with Consistent Low Energy < "<<HBenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
309  NumberOfRecentMissingRecHitsHB=dbe_->bookProfile("Problem_BelowEnergyRecHits_HB_vs_LS",
310  name.str(),
311  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
312  name.str("");
313  name<<"Total Number of HE RecHits with Consistent Low Energy < "<<HEenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
314  NumberOfRecentMissingRecHitsHE=dbe_->bookProfile("Problem_BelowEnergyRecHits_HE_vs_LS",
315  name.str(),
316  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
317  name.str("");
318  name<<"Total Number of HO RecHits with Consistent Low Energy < "<<HOenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
319  NumberOfRecentMissingRecHitsHO=dbe_->bookProfile("Problem_BelowEnergyRecHits_HO_vs_LS",
320  name.str(),
321  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
322  name.str("");
323  name<<"Total Number of HF RecHits with Consistent Low Energy < "<<HFenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
324  NumberOfRecentMissingRecHitsHF=dbe_->bookProfile("Problem_BelowEnergyRecHits_HF_vs_LS",
325  name.str(),
326  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
327  (NumberOfRecentMissingRecHits->getTProfile())->SetMarkerStyle(20);
328  (NumberOfRecentMissingRecHitsHB->getTProfile())->SetMarkerStyle(20);
329  (NumberOfRecentMissingRecHitsHE->getTProfile())->SetMarkerStyle(20);
330  (NumberOfRecentMissingRecHitsHO->getTProfile())->SetMarkerStyle(20);
331  (NumberOfRecentMissingRecHitsHF->getTProfile())->SetMarkerStyle(20);
332 
333  } // if (deadmon_test_rechits)
334 
335 
336  if (makeDiagnostics_)
337  {
338  dbe_->setCurrentFolder(subdir_+"DiagnosticPlots");
339  HBDeadVsEvent=dbe_->book1D("HBDeadVsEvent","HB Total Dead Cells Vs Event", NLumiBlocks_,-0.5,NLumiBlocks_-0.5);
340  HEDeadVsEvent=dbe_->book1D("HEDeadVsEvent","HE Total Dead Cells Vs Event", NLumiBlocks_,-0.5,NLumiBlocks_-0.5);
341  HODeadVsEvent=dbe_->book1D("HODeadVsEvent","HO Total Dead Cells Vs Event", NLumiBlocks_,-0.5,NLumiBlocks_-0.5);
342  HFDeadVsEvent=dbe_->book1D("HFDeadVsEvent","HF Total Dead Cells Vs Event", NLumiBlocks_,-0.5,NLumiBlocks_-0.5);
343  }
344 
345  this->reset();
346  return;
347 
348 } // void HcalDeadCellMonitor::setup(...)
349 
351 {
352  if (debug_>1) std::cout <<"HcalDeadCellMonitor::beginRun"<<std::endl;
354 
355  if (tevt_==0) this->setup(); // set up histograms if they have not been created before
356  if (mergeRuns_==false)
357  this->reset();
358 
359  // Get known dead cells for this run
360  KnownBadCells_.clear();
361  if (badChannelStatusMask_>0)
362  {
364  c.get<HcalChannelQualityRcd>().get(p);
365  HcalChannelQuality* chanquality= new HcalChannelQuality(*p.product());
366  std::vector<DetId> mydetids = chanquality->getAllChannels();
367  for (std::vector<DetId>::const_iterator i = mydetids.begin();
368  i!=mydetids.end();
369  ++i)
370  {
371  if (i->det()!=DetId::Hcal) continue; // not an hcal cell
372  HcalDetId id=HcalDetId(*i);
373  int status=(chanquality->getValues(id))->getValue();
374  if ((status & badChannelStatusMask_))
375  {
376  KnownBadCells_[id.rawId()]=status;
377  }
378  }
379  } // if (badChannelStatusMask_>0)
380  return;
381 } //void HcalDeadCellMonitor::beginRun(...)
382 
384 {
385  if (debug_>1) std::cout <<"HcalDeadCellMonitor::reset()"<<std::endl;
387  zeroCounters();
388  deadevt_=0;
391 
392  for (unsigned int depth=0;depth<DigiPresentByDepth.depth.size();++depth)
393  DigiPresentByDepth.depth[depth]->Reset();
394 
395  // Mark HORing2 channels as present (fill with a 2, rather than a 1, to distinguish between this setting and actual presence)
396  if (excludeHORing2_==true && DigiPresentByDepth.depth.size()>3)
397  {
398  for (int ieta=11;ieta<=15;++ieta)
399  for (int iphi=1;iphi<=72;++iphi)
400  {
401  // Don't fill ring2 SiPMs, since they will still be active even if the rest of HO is excluded.
402  if (isSiPM(ieta,iphi,4)==false)
403  DigiPresentByDepth.depth[3]->Fill(ieta,iphi,2);
404  //std::cout <<" FILLING ("<<-1*ieta<<", "<<iphi<<") with '2'"<<std::endl;
405  DigiPresentByDepth.depth[3]->Fill(-1*ieta,iphi,2);
406  }
407  }
409 
410 
412  {
415  }
417  {
430 
431  // Mark HORing2 channels as present (fill with a 2, rather than a 1, to distinguish between this setting and actual presence)
432  if (excludeHORing2_==true && RecHitPresentByDepth.depth.size()>3)
433  {
434  for (int ieta=11;ieta<=15;++ieta)
435  for (int iphi=1;iphi<=72;++iphi)
436  {
437  RecHitPresentByDepth.depth[3]->Fill(ieta,iphi,2);
438  RecHitPresentByDepth.depth[3]->Fill(-1*ieta,iphi,2);
439  }
440  }
442  }
443 
444  Nevents->Reset();
445 } // reset function is empty for now
446 
447 /* ------------------------------------------------------------------------- */
448 
449 
451 {
452  if (!enableCleanup_) return;
453  if (dbe_)
454  {
456  dbe_->removeContents();
457  dbe_->setCurrentFolder(subdir_+"dead_digi_never_present");
458  dbe_->removeContents();
459  dbe_->setCurrentFolder(subdir_+"dead_digi_often_missing");
460  dbe_->removeContents();
461  dbe_->setCurrentFolder(subdir_+"dead_rechit_neverpresent");
462  dbe_->removeContents();
463  dbe_->setCurrentFolder(subdir_+"dead_rechit_often_missing");
464  dbe_->removeContents();
465  dbe_->setCurrentFolder(subdir_+"dead_cell_parameters");
466  dbe_->removeContents();
467  dbe_->setCurrentFolder(subdir_+"LSvalues");
468  dbe_->removeContents();
469  }
470  return;
471 } // void HcalDeadCellMonitor::cleanup()
472 
473 /* ------------------------------------------------------------------------- */
474 
476  const edm::EventSetup& c)
477 {
478  // skip old lumi sections
479  if (this->LumiInOrder(lumiSeg.luminosityBlock())==false) return;
480 
481  // Reset current LS histogram
482  if (ProblemsCurrentLB)
484 
485  // Here is where we determine whether or not to process an event
486  // Not enough events
488  return;
489  endLumiProcessed_=true;
490  // fillNevents_problemCells checks for never-present cells
494 
495  if (ProblemsCurrentLB)
496  {
497  ProblemsCurrentLB->setBinContent(0,0, levt_); // underflow bin contains number of events
505  }
506  zeroCounters();
507  deadevt_=0;
508  return;
509 } //endLuminosityBlock()
510 
512 {
513  // Always carry out overall occupancy test at endRun, regardless minimum number of events?
514  // Or should we require an absolute lower bound?
515  // We can always run this test; we'll use the summary client to implement a lower bound before calculating reportSummary values
516  if (endLumiProcessed_==false) fillNevents_problemCells(); // always check for never-present cells
517  return;
518 }
519 
521 {
522  if (debug_>0) std::cout <<"HcalDeadCellMonitor::endJob()"<<std::endl;
523  if (enableCleanup_) cleanup(); // when do we force cleanup?
524 }
525 
527 {
528  if (!IsAllowedCalibType()) return;
529  endLumiProcessed_=false;
530  Nevents->Fill(0,1); // count all events of allowed calibration type, even if their lumi block is not in the right order
531  if (LumiInOrder(e.luminosityBlock())==false) return;
532  // try to get rechits and digis
536 
540 
541  if (!(e.getByLabel(digiLabel_,hbhe_digi)))
542  {
543  edm::LogWarning("HcalDeadCellMonitor")<< digiLabel_<<" hbhe_digi not available";
544  return;
545  }
546  if (!(e.getByLabel(digiLabel_,ho_digi)))
547  {
548  edm::LogWarning("HcalDeadCellMonitor")<< digiLabel_<<" ho_digi not available";
549  return;
550  }
551  if (!(e.getByLabel(digiLabel_,hf_digi)))
552  {
553  edm::LogWarning("HcalDeadCellMonitor")<< digiLabel_<<" hf_digi not available";
554  return;
555  }
556 
557  if (!(e.getByLabel(hbheRechitLabel_,hbhe_rechit)))
558  {
559  edm::LogWarning("HcalDeadCellMonitor")<< hbheRechitLabel_<<" hbhe_rechit not available";
560  return;
561  }
562 
563  if (!(e.getByLabel(hfRechitLabel_,hf_rechit)))
564  {
565  edm::LogWarning("HcalDeadCellMonitor")<< hfRechitLabel_<<" hf_rechit not available";
566  return;
567  }
568  if (!(e.getByLabel(hoRechitLabel_,ho_rechit)))
569  {
570  edm::LogWarning("HcalDeadCellMonitor")<< hoRechitLabel_<<" ho_rechit not available";
571  return;
572  }
573  if (debug_>1) std::cout <<"\t<HcalDeadCellMonitor::analyze> Processing good event! event # = "<<ievt_<<std::endl;
574  // Good event found; increment counter (via base class analyze method)
575  // This also runs the allowed calibration /lumi in order tests again; remove?
577 
578  ++deadevt_; //increment local counter
579 
580  processEvent(*hbhe_rechit, *ho_rechit, *hf_rechit, *hbhe_digi, *ho_digi, *hf_digi);
581 
582 } // void HcalDeadCellMonitor::analyze(...)
583 
584 /* --------------------------------------- */
585 
586 
588  const HORecHitCollection& hoHits,
589  const HFRecHitCollection& hfHits,
590  const HBHEDigiCollection& hbhedigi,
591  const HODigiCollection& hodigi,
592  const HFDigiCollection& hfdigi)
593 {
594  if (debug_>1) std::cout <<"<HcalDeadCellMonitor::processEvent> Processing event..."<<std::endl;
595 
596  // Do Digi-Based dead cell searches
597 
598  // Make sure histograms update
599  for (unsigned int i=0;i<DigiPresentByDepth.depth.size();++i)
600  DigiPresentByDepth.depth[i]->update();
601 
607 
609  {
610 
611  for (unsigned int i=0;i<RecentMissingDigisByDepth.depth.size();++i)
612  RecentMissingDigisByDepth.depth[i]->update();
613 
619  }
620 
622  j!=hbhedigi.end(); ++j)
623  {
624  const HBHEDataFrame digi = (const HBHEDataFrame)(*j);
625  processEvent_HBHEdigi(digi);
626  }
627 
629  j!=hodigi.end(); ++j)
630  {
631  const HODataFrame digi = (const HODataFrame)(*j);
632  process_Digi(digi);
633  }
635  j!=hfdigi.end(); ++j)
636  {
637  const HFDataFrame digi = (const HFDataFrame)(*j);
638  process_Digi(digi);
639  }
641 
642  // Search for "dead" cells below a certain energy
644  {
645  // Normalization Fill
646  for (unsigned int i=0;i<RecentMissingRecHitsByDepth.depth.size();++i)
648 
654 
656  j!=hbHits.end(); ++j)
657  process_RecHit(j);
658 
660  k!=hoHits.end(); ++k)
661  process_RecHit(k);
662 
664  j!=hfHits.end(); ++j)
665  process_RecHit(j);
666 
667  } // if (deadmon_test_rechits)
668 
669  if (!makeDiagnostics_) return;
670  if (tevt_>=NLumiBlocks_) return;
671  // Diagnostic plots -- add number of missing channels vs event number
672  int hbpresent=0;
673  int hepresent=0;
674  int hopresent=0;
675  int hfpresent=0;
676  int ieta=0;
677  for (int d=0;d<4;++d)
678  {
679  for (int phi=0;phi<72;++phi)
680  {
681  for (int eta=0;eta<85;++eta)
682  {
683  if (!present_digi[eta][phi][d]) continue;
684  if (d==3) ++hopresent;
685  else if (d==2) ++hepresent;
686  else if (d==1)
687  {
688  ieta=binmapd2[eta];
689  //if (abs(ieta)>29) continue;
690  if (abs(ieta)>29) ++hfpresent;
691  else if (abs(ieta)<17) ++hbpresent; //depths 15&16
692  else ++hepresent;
693  }
694  else if (d==0)
695  {
696  ieta=eta-42;
697  if (abs(ieta)>29) ++hfpresent;
698  else if (abs(ieta)<17) ++hbpresent;
699  else ++hepresent;
700  }
701  }
702  }
703  } // for (int d=0;d<4;++d)
704  HBDeadVsEvent->Fill(tevt_,2592-hbpresent);
705  HEDeadVsEvent->Fill(tevt_,2592-hepresent);
706  HODeadVsEvent->Fill(tevt_,2160-hopresent);
707  HFDeadVsEvent->Fill(tevt_,1728-hfpresent);
708  return;
709 } // void HcalDeadCellMonitor::processEvent(...)
710 
711 /************************************/
712 
713 
714 // Digi-based dead cell checks
715 
717 {
718  // Simply check whether a digi is present. If so, increment occupancy counter.
719  process_Digi(digi);
720  return;
721 } //void HcalDeadCellMonitor::processEvent_HBHEdigi(HBHEDigiCollection::const_iterator j)
722 
723 template<class DIGI>
725 {
726  // Remove the validate check when we figure out how to access bad digis in digi monitor
727  //if (!digi.validate()) return; // digi must be good to be counted
728  int ieta=digi.id().ieta();
729  int iphi=digi.id().iphi();
730  int depth=digi.id().depth();
731 
732  // Fill occupancy counter
733  ++recentoccupancy_digi[CalcEtaBin(digi.id().subdet(),ieta,depth)][iphi-1][depth-1];
734 
735  // If previously-missing digi found, change boolean status and fill histogram
736  if (present_digi[CalcEtaBin(digi.id().subdet(),ieta,depth)][iphi-1][depth-1]==false)
737  {
738  if (DigiPresentByDepth.depth[depth-1])
739  {
740  DigiPresentByDepth.depth[depth-1]->setBinContent(CalcEtaBin(digi.id().subdet(),ieta,depth)+1,iphi,1);
741  }
742  present_digi[CalcEtaBin(digi.id().subdet(),ieta,depth)][iphi-1][depth-1]=true;
743  }
744  return;
745 }
746 
747 //RecHit-based dead cell checks
748 
749 template<class RECHIT>
751 {
752  float en = rechit->energy();
753  HcalDetId id(rechit->detid().rawId());
754  int ieta = id.ieta();
755  int iphi = id.iphi();
756  int depth = id.depth();
757 
758  if (id.subdet()==HcalBarrel)
759  {
760  if (en>=HBenergyThreshold_)
761  {
762  ++recentoccupancy_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
763  present_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1]=true;
764  if (RecHitPresentByDepth.depth[depth-1])
765  RecHitPresentByDepth.depth[depth-1]->setBinContent(CalcEtaBin(id.subdet(),ieta,depth)+1,iphi,1);
766  }
767  }
768  else if (id.subdet()==HcalEndcap)
769  {
770  if (en>=HEenergyThreshold_)
771  {
772  ++recentoccupancy_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
773  present_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1]=true;
774  if (RecHitPresentByDepth.depth[depth-1])
775  RecHitPresentByDepth.depth[depth-1]->setBinContent(CalcEtaBin(id.subdet(),ieta,depth)+1,iphi,1);
776  }
777  }
778  else if (id.subdet()==HcalForward)
779  {
780  if (en>=HFenergyThreshold_)
781  {
782  ++recentoccupancy_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
783 
784  present_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1]=true;
785  if (RecHitPresentByDepth.depth[depth-1])
786  RecHitPresentByDepth.depth[depth-1]->setBinContent(CalcEtaBin(id.subdet(),ieta,depth)+1,iphi,1);
787  }
788  }
789  else if (id.subdet()==HcalOuter)
790  {
791  if (en>=HOenergyThreshold_)
792  {
793  ++recentoccupancy_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
794  present_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1]=true;
795  if (RecHitPresentByDepth.depth[depth-1])
796  RecHitPresentByDepth.depth[depth-1]->setBinContent(CalcEtaBin(id.subdet(),ieta,depth)+1,iphi,1);
797  }
798  }
799 }
800 
802 {
803  // Fill Histograms showing digi cells with no occupancy for the past few lumiblocks
804  if (!deadmon_test_digis_) return; // extra protection here against calling histograms than don't exist
805 
806  if (deadevt_ < minDeadEventCount_) return; // not enough entries to make a determination for this LS
807 
808  if (debug_>0)
809  std::cout <<"<HcalDeadCellMonitor::fillNevents_recentdigis> CHECKING FOR RECENT MISSING DIGIS evtcount = "<<deadevt_<<std::endl;
810 
811  int ieta=0;
812  int iphi=0;
813 
814  int etabins=0;
815  int phibins=0;
816 
817  for (unsigned int depth=0;depth<RecentMissingDigisByDepth.depth.size();++depth)
818  {
819  RecentMissingDigisByDepth.depth[depth]->setBinContent(0,0,ievt_);
820  etabins=RecentMissingDigisByDepth.depth[depth]->getNbinsX();
821  phibins=RecentMissingDigisByDepth.depth[depth]->getNbinsY();
822  for (int eta=0;eta<etabins;++eta)
823  {
824  for (int subdet=1;subdet<=4;++subdet)
825  {
826  ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
827  if (ieta==-9999) continue;
828  for (int phi=0;phi<phibins;++phi)
829  {
830  iphi=phi+1;
831 
832  if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
833  continue;
834 
835  // Ignore subdetectors that weren't in run?
836  /*
837  if ((subdet==HcalBarrel && !HBpresent_) ||
838  (subdet==HcalEndcap &&!HEpresent_) ||
839  (subdet==HcalOuter &&!HOpresent_) ||
840  (subdet==HcalForward &&!HFpresent_)) continue;
841  */
842  int zside=0;
843  if (subdet==HcalForward) // shift HcalForward ieta
844  ieta<0 ? zside=-1 : zside=+1;
845 
846  if (recentoccupancy_digi[eta][phi][depth]==0)
847  {
848  if (debug_>0)
849  {
850  std::cout <<"DEAD CELL; NO RECENT OCCUPANCY: subdet = "<<subdet<<", ieta = "<<ieta<<", iphi = "<<iphi<<" depth = "<<depth+1<<std::endl;
851  std::cout <<"\t RAW COORDINATES: eta = "<<eta<< " phi = "<<phi<<" depth = "<<depth<<std::endl;
852  std::cout <<"\t Present? "<<present_digi[eta][phi][depth]<<std::endl;
853  }
854 
855  // Don't fill HORing2 if boolean enabled
856  if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
857  continue;
858 
859  // no digi was found for the N events; Fill cell as bad for all N events (N = checkN);
860  if (RecentMissingDigisByDepth.depth[depth]) RecentMissingDigisByDepth.depth[depth]->Fill(ieta+zside,iphi,deadevt_);
861  }
862  } // for (int subdet=1;subdet<=4;++subdet)
863  } // for (int phi=0;...)
864  } // for (int eta=0;...)
865  } //for (int depth=1;...)
867 
868  return;
869 
870 } // void HcalDeadCellMonitor::fillNevents_recentdigis()
871 
872 
873 
874 /* ----------------------------------- */
875 
877 {
878  // Fill Histograms showing unoccupied rechits, or rec hits with low energy
879 
880  // This test is a bit pointless, unless the energy threshold is greater than the ZS threshold.
881  // If we require that cells are always < thresh to be flagged by this test, and if
882  // thresh < ZS, then we will never catch any cells, since they'll show up as dead in the
883  // neverpresent/occupancy test plots first.
884  // Only exception is if something strange is going on between ZS ADC value an RecHit energy?
885 
886  if (!deadmon_test_rechits_) return;
888 
889  if (deadevt_ < minDeadEventCount_) return; // not enough entries to make a determination for this LS
890 
891  if (debug_>0)
892  std::cout <<"<HcalDeadCellMonitor::fillNevents_energy> BELOW-ENERGY-THRESHOLD PLOTS"<<std::endl;
893 
894  int ieta=0;
895  int iphi=0;
896 
897  int etabins=0;
898  int phibins=0;
899  for (unsigned int depth=0;depth<RecentMissingRecHitsByDepth.depth.size();++depth)
900  {
901  RecentMissingRecHitsByDepth.depth[depth]->setBinContent(0,0,ievt_);
902  etabins=RecentMissingRecHitsByDepth.depth[depth]->getNbinsX();
903  phibins=RecentMissingRecHitsByDepth.depth[depth]->getNbinsY();
904  for (int eta=0;eta<etabins;++eta)
905  {
906  for (int subdet=1;subdet<=4;++subdet)
907  {
908  ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
909  if (ieta==-9999) continue;
910  for (int phi=0;phi<phibins;++phi)
911  {
912  iphi=phi+1;
913  if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
914  continue;
915  if (recentoccupancy_rechit[eta][phi][depth]>0) continue; // cell exceeded energy at least once, so it's not dead
916 
917  // Ignore subdetectors that weren't in run?
918  /*
919  if ((subdet==HcalBarrel && !HBpresent_) ||
920  (subdet==HcalEndcap &&!HEpresent_) ||
921  (subdet==HcalOuter &&!HOpresent_) ||
922  (subdet==HcalForward &&!HFpresent_)) continue;
923  */
924 
925  int zside=0;
926  if (subdet==HcalForward) // shift HcalForward ieta
927  {
928  ieta<0 ? zside=-1 : zside=+1;
929  }
930 
931  if (debug_>2)
932  std::cout <<"DEAD CELL; BELOW ENERGY THRESHOLD; subdet = "<<subdet<<" ieta = "<<ieta<<", phi = "<<iphi<<" depth = "<<depth+1<<std::endl;
933  if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
934  continue;
935 
936  if (RecentMissingRecHitsByDepth.depth[depth]) RecentMissingRecHitsByDepth.depth[depth]->Fill(ieta+zside,iphi,deadevt_);
937  } // loop on phi bins
938  } // for (unsigned int depth=1;depth<=4;++depth)
939  } // // loop on subdetectors
940  } // for (int eta=0;...)
941 
943 
944  return;
945 } // void HcalDeadCellMonitor::fillNevents_recentrechits()
946 
947 
948 
950 {
951  //fillNevents_problemCells now only performs checks of never-present cells
952 
953  if (debug_>0)
954  std::cout <<"<HcalDeadCellMonitor::fillNevents_problemCells> FILLING PROBLEM CELL PLOTS"<<std::endl;
955 
956  int ieta=0;
957  int iphi=0;
958 
959  // Count problem cells in each subdetector
960 
961  NumBadHB=0;
962  NumBadHE=0;
963  NumBadHO=0;
964  NumBadHF=0;
965  NumBadHFLUMI=0;
966  NumBadHO0=0;
967  NumBadHO12=0;
968 
969  int knownBadHB=0;
970  int knownBadHE=0;
971  int knownBadHF=0;
972  int knownBadHO=0;
973  int knownBadHFLUMI=0;
974  int knownBadHO0=0;
975  int knownBadHO12=0;
976 
977 
978  unsigned int neverpresentHB=0;
979  unsigned int neverpresentHE=0;
980  unsigned int neverpresentHO=0;
981  unsigned int neverpresentHF=0;
982 
983  unsigned int unoccupiedHB=0;
984  unsigned int unoccupiedHE=0;
985  unsigned int unoccupiedHO=0;
986  unsigned int unoccupiedHF=0;
987 
988  unsigned int belowenergyHB=0;
989  unsigned int belowenergyHE=0;
990  unsigned int belowenergyHO=0;
991  unsigned int belowenergyHF=0;
992 
993  unsigned int energyneverpresentHB=0;
994  unsigned int energyneverpresentHE=0;
995  unsigned int energyneverpresentHO=0;
996  unsigned int energyneverpresentHF=0;
997 
999  Nevents->Fill(1,deadevt_);
1000 
1001  int etabins=0;
1002  int phibins=0;
1003 
1004  // Store values for number of bad channels in each lumi section, for plots of ProblemsVsLS.
1005  // This is different than the NumBadHB, etc. values, which must included even known bad channels
1006  // in order to calculate reportSummaryByLS values correctly.
1007 
1008  for (unsigned int depth=0;depth<DigiPresentByDepth.depth.size();++depth)
1009  {
1010  DigiPresentByDepth.depth[depth]->setBinContent(0,0,ievt_);
1011  etabins=DigiPresentByDepth.depth[depth]->getNbinsX();
1012  phibins=DigiPresentByDepth.depth[depth]->getNbinsY();
1013  for (int eta=0;eta<etabins;++eta)
1014  {
1015  for (int phi=0;phi<phibins;++phi)
1016  {
1017  iphi=phi+1;
1018  for (int subdet=1;subdet<=4;++subdet)
1019  {
1020  ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
1021  if (ieta==-9999) continue;
1022  if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
1023  continue;
1024  // Ignore subdetectors that weren't in run?
1025  /*
1026  if ((subdet==HcalBarrel && !HBpresent_) ||
1027  (subdet==HcalEndcap &&!HEpresent_) ||
1028  (subdet==HcalOuter &&!HOpresent_) ||
1029  (subdet==HcalForward &&!HFpresent_)) continue;
1030  */
1031 
1032  /*
1033  if ((!checkHB_ && subdet==HcalBarrel) ||
1034  (!checkHE_ && subdet==HcalEndcap) ||
1035  (!checkHO_ && subdet==HcalOuter) ||
1036  (!checkHF_ && subdet==HcalForward)) continue;
1037  */
1038 
1039  // now check which dead cell tests failed; increment counter if any failed
1040  if ((present_digi[eta][phi][depth]==0) ||
1043  )
1044  {
1045  HcalDetId TempID((HcalSubdetector)subdet, ieta, iphi, (int)depth+1);
1046  if (subdet==HcalBarrel)
1047  {
1048  ++NumBadHB;
1049  if (KnownBadCells_.find(TempID.rawId())!=KnownBadCells_.end())
1050  ++knownBadHB;
1051  }
1052  else if (subdet==HcalEndcap)
1053  {
1054  ++NumBadHE;
1055  if (KnownBadCells_.find(TempID.rawId())!=KnownBadCells_.end())
1056  ++knownBadHE;
1057  }
1058 
1059  else if (subdet==HcalOuter)
1060  {
1061  ++NumBadHO;
1062  if (abs(ieta)<5) ++NumBadHO0;
1063  else ++NumBadHO12;
1064  // Don't include HORing2 if boolean set; subtract away those counters
1065  if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
1066  {
1067  --NumBadHO;
1068  --NumBadHO12;
1069  }
1070  if (KnownBadCells_.find(TempID.rawId())!=KnownBadCells_.end())
1071  {
1072  ++knownBadHO;
1073  if (abs(ieta)<5) ++knownBadHO0;
1074  else ++knownBadHO12;
1075  // Don't include HORing2 if boolean set; subtract away those counters
1076  if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
1077  {
1078  --knownBadHO;
1079  --knownBadHO12;
1080  }
1081  }
1082  }
1083  else if (subdet==HcalForward)
1084  {
1085  ++NumBadHF;
1086  if (depth==1 && (abs(ieta)==33 || abs(ieta)==34))
1087  ++NumBadHFLUMI;
1088  else if (depth==2 && (abs(ieta)==35 || abs(ieta)==36))
1089  ++NumBadHFLUMI;
1090  if (KnownBadCells_.find(TempID.rawId())!=KnownBadCells_.end())
1091  {
1092  ++knownBadHF;
1093  if (depth==1 && (abs(ieta)==33 || abs(ieta)==34))
1094  ++knownBadHFLUMI;
1095  else if (depth==2 && (abs(ieta)==35 || abs(ieta)==36))
1096  ++knownBadHFLUMI;
1097  }
1098  }
1099  }
1100  if (present_digi[eta][phi][depth]==0)
1101  {
1102  if (subdet==HcalBarrel) ++neverpresentHB;
1103  else if (subdet==HcalEndcap) ++neverpresentHE;
1104  else if (subdet==HcalOuter)
1105  {
1106  ++neverpresentHO;
1107  if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
1108  --neverpresentHO;
1109  }
1110  else if (subdet==HcalForward) ++neverpresentHF;
1111  }
1112  // Count recent unoccupied digis if the total events in this lumi section is > minEvents_
1114  {
1115  if (subdet==HcalBarrel) ++unoccupiedHB;
1116  else if (subdet==HcalEndcap) ++unoccupiedHE;
1117  else if (subdet==HcalOuter)
1118  {
1119  ++unoccupiedHO;
1120  if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
1121  --unoccupiedHO;
1122  }
1123  else if (subdet==HcalForward) ++unoccupiedHF;
1124  }
1125  // Look at rechit checks
1127  {
1128  if (present_rechit[eta][phi][depth]==0)
1129  {
1130  if (subdet==HcalBarrel) ++energyneverpresentHB;
1131  else if (subdet==HcalEndcap) ++energyneverpresentHE;
1132  else if (subdet==HcalOuter)
1133  {
1134  ++energyneverpresentHO;
1135  if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
1136  --energyneverpresentHO;
1137  }
1138  else if (subdet==HcalForward) ++energyneverpresentHF;
1139  }
1141  {
1142  if (subdet==HcalBarrel) ++belowenergyHB;
1143  else if (subdet==HcalEndcap) ++belowenergyHE;
1144  else if (subdet==HcalOuter)
1145  {
1146  ++belowenergyHO;
1147  if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
1148  --belowenergyHO;
1149  }
1150  else if (subdet==HcalForward) ++belowenergyHF;
1151  }
1152  }
1153  } // subdet loop
1154  } // phi loop
1155  } //eta loop
1156  } // depth loop
1157 
1158  // Fill with number of problem cells found on this pass
1159 
1160 
1161  NumberOfNeverPresentDigisHB->Fill(currentLS,neverpresentHB);
1162  NumberOfNeverPresentDigisHE->Fill(currentLS,neverpresentHE);
1163  NumberOfNeverPresentDigisHO->Fill(currentLS,neverpresentHO);
1164  NumberOfNeverPresentDigisHF->Fill(currentLS,neverpresentHF);
1165  NumberOfNeverPresentDigis->Fill(currentLS,neverpresentHB+neverpresentHE+neverpresentHO+neverpresentHF);
1166 
1167  ProblemsVsLB_HB->Fill(currentLS,NumBadHB-knownBadHB);
1168  ProblemsVsLB_HE->Fill(currentLS,NumBadHE-knownBadHE);
1169  ProblemsVsLB_HO->Fill(currentLS,NumBadHO-knownBadHO);
1170  ProblemsVsLB_HF->Fill(currentLS,NumBadHF-knownBadHF);
1171  ProblemsVsLB_HBHEHF->Fill(currentLS,NumBadHB+NumBadHE+NumBadHF-knownBadHB-knownBadHE-knownBadHF);
1172  ProblemsVsLB->Fill(currentLS,NumBadHB+NumBadHE+NumBadHO+NumBadHF-knownBadHB-knownBadHE-knownBadHO-knownBadHF);
1173 
1175  return;
1176 
1177  if (deadmon_test_digis_)
1178  {
1183  NumberOfRecentMissingDigis->Fill(currentLS,unoccupiedHB+unoccupiedHE+unoccupiedHO+unoccupiedHF);
1184  }
1185 
1187  {
1188  NumberOfNeverPresentRecHitsHB->Fill(currentLS,energyneverpresentHB);
1189  NumberOfNeverPresentRecHitsHE->Fill(currentLS,energyneverpresentHE);
1190  NumberOfNeverPresentRecHitsHO->Fill(currentLS,energyneverpresentHO);
1191  NumberOfNeverPresentRecHitsHF->Fill(currentLS,energyneverpresentHF);
1192  NumberOfNeverPresentRecHits->Fill(currentLS,energyneverpresentHB+energyneverpresentHE+energyneverpresentHO+energyneverpresentHF);
1193 
1198  NumberOfRecentMissingRecHits->Fill(currentLS,belowenergyHB+belowenergyHE+belowenergyHO+belowenergyHF);
1199  }
1200 
1201  return;
1202 } // void HcalDeadCellMonitor::fillNevents_problemCells(void)
1203 
1204 
1205 void HcalDeadCellMonitor::zeroCounters(bool resetpresent)
1206 {
1207 
1208  // zero all counters
1209 
1210  // 2D histogram counters
1211  for (unsigned int i=0;i<85;++i)
1212  {
1213  for (unsigned int j=0;j<72;++j)
1214  {
1215  for (unsigned int k=0;k<4;++k)
1216  {
1217  if (resetpresent) present_digi[i][j][k]=false; // keeps track of whether digi was ever present
1218  if (resetpresent) present_rechit[i][j][k]=false;
1219  recentoccupancy_digi[i][j][k]=0; // counts occupancy in last (checkNevents) events
1220  recentoccupancy_rechit[i][j][k]=0; // counts instances of cell above threshold energy in last (checkNevents)
1221  }
1222  }
1223  }
1224 
1225  return;
1226 } // void HcalDeadCellMonitor::zeroCounters(bool resetpresent)
1227 
edm::InputTag hfRechitLabel_
void beginRun(const edm::Run &run, const edm::EventSetup &c)
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * NumberOfNeverPresentRecHitsHO
bool LumiInOrder(int lumisec)
MonitorElement * NumberOfRecentMissingRecHitsHF
MonitorElement * NumberOfNeverPresentRecHits
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * ProblemsCurrentLB
MonitorElement * NumberOfNeverPresentDigisHB
const int binmapd2[]
void analyze(edm::Event const &e, edm::EventSetup const &s)
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
MonitorElement * HEDeadVsEvent
MonitorElement * NumberOfRecentMissingRecHits
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:519
void zeroCounters(bool resetpresent=false)
bool present_digi[85][72][4]
edm::InputTag hbheRechitLabel_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::map< unsigned int, int > KnownBadCells_
MonitorElement * NumberOfNeverPresentDigisHE
std::vector< int > AllowedCalibTypes_
void endRun(const edm::Run &run, const edm::EventSetup &c)
void Reset(void)
std::vector< T >::const_iterator const_iterator
HcalDeadCellMonitor(const edm::ParameterSet &ps)
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
MonitorElement * NumberOfRecentMissingDigisHB
void update(void)
Mark the object updated.
void process_RecHit(T &rechit)
MonitorElement * NumberOfRecentMissingDigisHE
bool present_rechit[85][72][4]
T eta() const
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:456
void Fill(long long x)
LuminosityBlockNumber_t luminosityBlock() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
bool isSiPM(int ieta, int iphi, int depth)
EtaPhiHists RecHitPresentByDepth
std::vector< MonitorElement * > depth
virtual void beginRun(const edm::Run &run, const edm::EventSetup &c)
MonitorElement * ProblemsVsLB
void removeContents(void)
erase all monitoring elements in current directory (not including subfolders);
Definition: DQMStore.cc:2330
MonitorElement * NumberOfNeverPresentDigisHF
MonitorElement * ProblemsVsLB_HBHEHF
edm::InputTag hoRechitLabel_
std::vector< DetId > getAllChannels() const
MonitorElement * NumberOfNeverPresentDigisHO
void processEvent_HBHEdigi(const HBHEDataFrame digi)
MonitorElement * NumberOfNeverPresentRecHitsHB
HcalSubdetector
Definition: HcalAssistant.h:32
int j
Definition: DBlmapReader.cc:9
MonitorElement * Nevents
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:833
unsigned int recentoccupancy_rechit[85][72][4]
MonitorElement * NumberOfRecentMissingRecHitsHE
MonitorElement * ProblemsVsLB_HF
MonitorElement * NumberOfRecentMissingDigisHO
MonitorElement * NumberOfNeverPresentRecHitsHF
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
int CalcIeta(int subdet, int eta, int depth)
MonitorElement * ProblemsVsLB_HB
int k[5][pyjets_maxn]
const_iterator end() const
unsigned int recentoccupancy_digi[85][72][4]
void processEvent(const HBHERecHitCollection &hbHits, const HORecHitCollection &hoHits, const HFRecHitCollection &hfHits, const HBHEDigiCollection &hbhedigi, const HODigiCollection &hodigi, const HFDigiCollection &hfdigi)
EtaPhiHists RecentMissingDigisByDepth
MonitorElement * NumberOfRecentMissingRecHitsHO
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
EtaPhiHists DigiPresentByDepth
virtual void reset(void)
void FillUnphysicalHEHFBins(EtaPhiHists &hh)
EtaPhiHists RecentMissingRecHitsByDepth
int CalcEtaBin(int subdet, int ieta, int depth)
void SetupEtaPhiHists(EtaPhiHists &hh, std::string Name, std::string Units)
MonitorElement * HBDeadVsEvent
MonitorElement * NumberOfNeverPresentRecHitsHE
MonitorElement * ProblemsVsLB_HE
TProfile * getTProfile(void) const
MonitorElement * NumberOfNeverPresentDigis
MonitorElement * NumberOfRecentMissingDigis
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
MonitorElement * NumberOfRecentMissingDigisHF
tuple cout
Definition: gather_cfg.py:41
void process_Digi(T &digi)
string s
Definition: asciidump.py:422
tuple status
Definition: ntuplemaker.py:245
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:426
virtual void setup(void)
const Item * getValues(DetId fId) const
MonitorElement * HFDeadVsEvent
void Reset(void)
reset ME (ie. contents, errors, etc)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
MonitorElement * HODeadVsEvent
const_iterator begin() const
Definition: Run.h:31
bool validDetId(HcalSubdetector sd, int ies, int ip, int dp)
MonitorElement * NumberOfRecentMissingRecHitsHB
MonitorElement * ProblemsVsLB_HO
Definition: DDAxes.h:10