CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalHotCellMonitor.cc
Go to the documentation of this file.
4 
6 {
7  // Standard information, inherited from base class
8  Online_ = ps.getUntrackedParameter<bool>("online",false);
9  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns",false);
10  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
11  debug_ = ps.getUntrackedParameter<int>("debug",0);
12  makeDiagnostics_ = ps.getUntrackedParameter<bool>("makeDiagnostics",false);
13  prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
14  if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
15  prefixME_.append("/");
16  subdir_ = ps.getUntrackedParameter<std::string>("TaskFolder","HotCellMonitor_Hcal/"); // HotCellMonitor_Hcal
17  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
18  subdir_.append("/");
19  subdir_=prefixME_+subdir_;
20  AllowedCalibTypes_ = ps.getUntrackedParameter<std::vector<int> > ("AllowedCalibTypes");
21  skipOutOfOrderLS_ = ps.getUntrackedParameter<bool>("skipOutOfOrderLS",true);
22  NLumiBlocks_ = ps.getUntrackedParameter<int>("NLumiBlocks",4000);
23 
24  // Collection type info
25  hbheRechitLabel_ = ps.getUntrackedParameter<edm::InputTag>("hbheRechitLabel");
26  hoRechitLabel_ = ps.getUntrackedParameter<edm::InputTag>("hoRechitLabel");
27  hfRechitLabel_ = ps.getUntrackedParameter<edm::InputTag>("hfRechitLabel");
28 
29  // Hot Cell-specific tests
30  minEvents_ = ps.getUntrackedParameter<int>("minEvents");
31  minErrorFlag_ = ps.getUntrackedParameter<double>("minErrorFlag",1);
32 
33  // exclude HO ring 2
34  excludeHORing2_ = ps.getUntrackedParameter<bool>("excludeHORing2",false);
35 
36 
37  // Set which hot cell checks will be performed
38  test_persistent_ = ps.getUntrackedParameter<bool>("test_persistent"); // true by default
39  test_neighbor_ = ps.getUntrackedParameter<bool>("test_neighbor"); // false by default; test disabled
40  test_energy_ = ps.getUntrackedParameter<bool>("test_energy"); // true by default
41  test_et_ = ps.getUntrackedParameter<bool>("test_et"); // true by default
42 
43 
44  // rechit energy test -- cell must be above threshold value for a number of consecutive events to be considered hot
45  energyThreshold_ = ps.getUntrackedParameter<double>("energyThreshold");
46  ETThreshold_ = ps.getUntrackedParameter<double>("ETThreshold");
47 
48  HBenergyThreshold_ = ps.getUntrackedParameter<double>("energyThreshold_HB",energyThreshold_);
49  HEenergyThreshold_ = ps.getUntrackedParameter<double>("energyThreshold_HE",energyThreshold_);
50  HOenergyThreshold_ = ps.getUntrackedParameter<double>("energyThreshold_HO",energyThreshold_);
51  HFenergyThreshold_ = ps.getUntrackedParameter<double>("energyThreshold_HF",energyThreshold_);
52 
53  HBETThreshold_ = ps.getUntrackedParameter<double>("ETThreshold_HB",ETThreshold_);
54  HEETThreshold_ = ps.getUntrackedParameter<double>("ETThreshold_HE",ETThreshold_);
55  HOETThreshold_ = ps.getUntrackedParameter<double>("ETThreshold_HO",ETThreshold_);
56  HFETThreshold_ = ps.getUntrackedParameter<double>("ETThreshold_HF",ETThreshold_);
57 
58  // rechit event-by-event energy test -- cell must be above threshold to be considered hot
59  persistentThreshold_ = ps.getUntrackedParameter<double>("persistentThreshold");
60 
61  HBpersistentThreshold_ = ps.getUntrackedParameter<double>("persistentThreshold_HB",persistentThreshold_);
62  HEpersistentThreshold_ = ps.getUntrackedParameter<double>("persistentThreshold_HE",persistentThreshold_);
63  HOpersistentThreshold_ = ps.getUntrackedParameter<double>("persistentThreshold_HO",persistentThreshold_);
64  HFpersistentThreshold_ = ps.getUntrackedParameter<double>("persistentThreshold_HF",persistentThreshold_);
65 
66  persistentETThreshold_ = ps.getUntrackedParameter<double>("persistentETThreshold");
67 
68  HBpersistentETThreshold_ = ps.getUntrackedParameter<double>("persistentETThreshold_HB",persistentETThreshold_);
69  HEpersistentETThreshold_ = ps.getUntrackedParameter<double>("persistentETThreshold_HE",persistentETThreshold_);
70  HOpersistentETThreshold_ = ps.getUntrackedParameter<double>("persistentETThreshold_HO",persistentETThreshold_);
71  HFpersistentETThreshold_ = ps.getUntrackedParameter<double>("persistentETThreshold_HF",persistentETThreshold_);
72 
73  HFfarfwdScale_ = ps.getUntrackedParameter<double>("HFfwdScale",2.);
74  SiPMscale_ = ps.getUntrackedParameter<double>("HO_SiPMscalefactor",1.); // default scale factor of 4?
75 
76  // neighboring-cell tests
77  HBHENeighborParams_.DeltaIphi = ps.getUntrackedParameter<int>("HBHE_neighbor_deltaIphi", 1);
78  HBHENeighborParams_.DeltaIeta = ps.getUntrackedParameter<int>("HBHE_neighbor_deltaIeta", 1);
79  HBHENeighborParams_.DeltaDepth = ps.getUntrackedParameter<int>("HBHE_neighbor_deltaDepth", 2);
80  HBHENeighborParams_.minCellEnergy = ps.getUntrackedParameter<double>("HBHE_neighbor_minCellEnergy",3.);
81  HBHENeighborParams_.minNeighborEnergy = ps.getUntrackedParameter<double>("HBHE_neighbor_minNeighborEnergy",0.);
82  HBHENeighborParams_.maxEnergy = ps.getUntrackedParameter<double>("HBHE_neighbor_maxEnergy",100);
83  HBHENeighborParams_.HotEnergyFrac = ps.getUntrackedParameter<double>("HBHE_neighbor_HotEnergyFrac",0.05);
84 
85  HONeighborParams_.DeltaIphi = ps.getUntrackedParameter<int>("HO_neighbor_deltaIphi", 1);
86  HONeighborParams_.DeltaIeta = ps.getUntrackedParameter<int>("HO_neighbor_deltaIeta", 1);
87  HONeighborParams_.DeltaDepth = ps.getUntrackedParameter<int>("HO_neighbor_deltaDepth", 0);
88  HONeighborParams_.minCellEnergy = ps.getUntrackedParameter<double>("HO_neighbor_minCellEnergy",10.);
89  HONeighborParams_.minNeighborEnergy = ps.getUntrackedParameter<double>("HO_neighbor_minNeighborEnergy",0.);
90  HONeighborParams_.maxEnergy = ps.getUntrackedParameter<double>("HO_neighbor_maxEnergy",100);
91  HONeighborParams_.HotEnergyFrac = ps.getUntrackedParameter<double>("HO_neighbor_HotEnergyFrac",0.01);
92 
93  HFNeighborParams_.DeltaIphi = ps.getUntrackedParameter<int>("HF_neighbor_deltaIphi", 1);
94  HFNeighborParams_.DeltaIeta = ps.getUntrackedParameter<int>("HF_neighbor_deltaIeta", 1);
95  HFNeighborParams_.DeltaDepth = ps.getUntrackedParameter<int>("HF_neighbor_deltaDepth", 1);
96  HFNeighborParams_.minCellEnergy = ps.getUntrackedParameter<double>("HF_neighbor_minCellEnergy",10.);
97  HFNeighborParams_.minNeighborEnergy = ps.getUntrackedParameter<double>("HF_neighbor_minNeighborEnergy",0.);
98  HFNeighborParams_.maxEnergy = ps.getUntrackedParameter<double>("HF_neighbor_maxEnergy",100);
99  HFNeighborParams_.HotEnergyFrac = ps.getUntrackedParameter<double>("HF_neighbor_HotEnergyFrac",0.01);
100  setupDone_=false;
101 } //constructor
102 
104 {
105 } //destructor
106 
107 
108 /* ------------------------------------ */
109 
111 {
112  if (setupDone_)
113  return;
114  setupDone_ = true;
115  // Call base class setup
117 
118  if (debug_>1)
119  std::cout <<"<HcalHotCellMonitor::setup> Setting up histograms"<<std::endl;
120 
122 
123  MonitorElement* me;
124  me=dbe_->bookFloat("minErrorFractionPerLumiSection");
125  me->Fill(minErrorFlag_);
126  // Create plots of problems vs LB
127 
128  // 1D plots count number of bad cells vs. luminosity block
129  ProblemsVsLB=dbe_->bookProfile("TotalHotCells_HCAL_vs_LS",
130  "Total Number of Hot Hcal Cells vs lumi section",
131  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
132 
133  ProblemsVsLB_HB=dbe_->bookProfile("TotalHotCells_HB_vs_LS",
134  "Total Number of Hot HB Cells vs lumi section",
135  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,3000);
136  ProblemsVsLB_HE=dbe_->bookProfile("TotalHotCells_HE_vs_LS",
137  "Total Number of Hot HE Cells vs lumi section",
138  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,3000);
139  ProblemsVsLB_HO=dbe_->bookProfile("TotalHotCells_HO_vs_LS",
140  "Total Number of Hot HO Cells vs lumi section",
141  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,3000);
142  ProblemsVsLB_HF=dbe_->bookProfile("TotalHotCells_HF_vs_LS",
143  "Total Number of Hot HF Cells vs lumi section",
144  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,2000);
145  ProblemsVsLB_HBHEHF=dbe_->bookProfile("TotalHotCells_HBHEHF_vs_LS",
146  "Total Number of Hot HBHEHF Cells vs lumi section",
147  NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,2000);
148 
149  ProblemsVsLB->getTProfile()->SetMarkerStyle(20);
150  ProblemsVsLB_HB->getTProfile()->SetMarkerStyle(20);
151  ProblemsVsLB_HE->getTProfile()->SetMarkerStyle(20);
152  ProblemsVsLB_HO->getTProfile()->SetMarkerStyle(20);
153  ProblemsVsLB_HF->getTProfile()->SetMarkerStyle(20);
154  ProblemsVsLB_HBHEHF->getTProfile()->SetMarkerStyle(20);
155 
156  // Set up plots for each failure mode of hot cells
157  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)
158 
159  dbe_->setCurrentFolder(subdir_+"hot_rechit_above_threshold");
160  me=dbe_->bookInt("HotCellAboveThresholdTestEnabled");
161  me->Fill(0);
162 
163  if (test_energy_)
164  {
165  me->Fill(1);
167  "Hot Cells Above Energy Threshold","");
168  //setMinMaxHists2D(AboveEnergyThresholdCellsByDepth,0.,1.);
169 
170  // set more descriptive titles for plots
171  units.str("");
172  units<<"Hot Cells: Depth 1 -- HB > "<<HBenergyThreshold_<<" GeV, HE > "<<HEenergyThreshold_<<" GeV, HF > "<<HFenergyThreshold_<<" GeV";
173  AboveEnergyThresholdCellsByDepth.depth[0]->setTitle(units.str().c_str());
174  units.str("");
175  units<<"Hot Cells: Depth 2 -- HB > "<<HBenergyThreshold_<<" GeV, HE > "<<HEenergyThreshold_<<" GeV, HF > "<<HFenergyThreshold_<<" GeV";
176  AboveEnergyThresholdCellsByDepth.depth[1]->setTitle(units.str().c_str());
177  units.str("");
178  units<<"Hot Cells: Depth 3 -- HE > "<<HEenergyThreshold_<<" GeV";
179  AboveEnergyThresholdCellsByDepth.depth[2]->setTitle(units.str().c_str());
180  units.str("");
181  units<<"Hot Cells: HO > "<<HOenergyThreshold_<<" GeV";
182  AboveEnergyThresholdCellsByDepth.depth[3]->setTitle(units.str().c_str());
183  units.str("");
184  }
185  if (test_et_)
186  {
187  me->Fill(1);
189  "Hot Cells Above ET Threshold","");
190  //setMinMaxHists2D(AboveETThresholdCellsByDepth,0.,1.);
191 
192  // set more descriptive titles for plots
193  units.str("");
194  units<<"Hot Cells: Depth 1 -- HB > "<<HBETThreshold_<<" GeV (ET), HE > "<<HEETThreshold_<<" GeV (ET), HF > "<<HFETThreshold_<<" GeV (ET)";
195  AboveETThresholdCellsByDepth.depth[0]->setTitle(units.str().c_str());
196  units.str("");
197  units<<"Hot Cells: Depth 2 -- HB > "<<HBETThreshold_<<" GeV (ET), HE > "<<HEETThreshold_<<" GeV (ET), HF > "<<HFETThreshold_<<" GeV (ET)";
198  AboveETThresholdCellsByDepth.depth[1]->setTitle(units.str().c_str());
199  units.str("");
200  units<<"Hot Cells: Depth 3 -- HE > "<<HEETThreshold_<<" GeV (ET)";
201  AboveETThresholdCellsByDepth.depth[2]->setTitle(units.str().c_str());
202  units.str("");
203  units<<"Hot Cells: HO > "<<HOETThreshold_<<" GeV (ET)";
204  AboveETThresholdCellsByDepth.depth[3]->setTitle(units.str().c_str());
205  units.str("");
206  }
207 
208  dbe_->setCurrentFolder(subdir_+"hot_rechit_always_above_threshold");
209  me=dbe_->bookInt("PersistentHotCellTestEnabled");
210  me->Fill(0);
211  if (test_persistent_)
212  {
213  me->Fill(1);
214  me=dbe_->bookInt("minEventsPerLS");
215  me->Fill(minEvents_);
216 
217  if (test_energy_) {
219  "Hot Cells Persistently Above Energy Threshold","");
220  //setMinMaxHists2D(AbovePersistentThresholdCellsByDepth,0.,1.);
221 
222  // set more descriptive titles for plots
223  units.str("");
224  units<<"Hot Cells: Depth 1 -- HB > "<<HBpersistentThreshold_<<" GeV, HE > "<<HEpersistentThreshold_<<", HF > "<<HFpersistentThreshold_<<" GeV for 1 full Lumi Block";
225  AbovePersistentThresholdCellsByDepth.depth[0]->setTitle(units.str().c_str());
226  units.str("");
227  units<<"Hot Cells: Depth 2 -- HB > "<<HBpersistentThreshold_<<" GeV, HE > "<<HEpersistentThreshold_<<", HF > "<<HFpersistentThreshold_<<" GeV for 1 full Lumi Block";
228  AbovePersistentThresholdCellsByDepth.depth[1]->setTitle(units.str().c_str());
229  units.str("");
230  units<<"Hot Cells: Depth 3 -- HE > "<<HEpersistentThreshold_<<" GeV for 1 full Lumi Block";
231  AbovePersistentThresholdCellsByDepth.depth[2]->setTitle(units.str().c_str());
232  units.str("");
233  units<<"Hot Cells: HO > "<<HOpersistentThreshold_<<" GeV for 1 full Lumi Block";
234  AbovePersistentThresholdCellsByDepth.depth[3]->setTitle(units.str().c_str());
235  units.str("");
236  }
237 
238  if (test_et_) {
240  "Hot Cells Persistently Above ET Threshold","");
241  //setMinMaxHists2D(AbovePersistentThresholdCellsByDepth,0.,1.);
242 
243  // set more descriptive titles for plots
244  units.str("");
245  units<<"Hot Cells: Depth 1 -- HB > "<<HBpersistentETThreshold_<<" GeV (ET), HE > "<<HEpersistentETThreshold_<<" GeV (ET), HF > "<<HFpersistentETThreshold_<<" GeV (ET) for 1 full Lumi Block";
246  AbovePersistentETThresholdCellsByDepth.depth[0]->setTitle(units.str().c_str());
247  units.str("");
248  units<<"Hot Cells: Depth 2 -- HB > "<<HBpersistentETThreshold_<<" GeV (ET), HE > "<<HEpersistentETThreshold_<<" GeV (ET), HF > "<<HFpersistentETThreshold_<<" GeV (ET) for 1 full Lumi Block";
249  AbovePersistentETThresholdCellsByDepth.depth[1]->setTitle(units.str().c_str());
250  units.str("");
251  units<<"Hot Cells: Depth 3 -- HE > "<<HEpersistentETThreshold_<<" GeV (ET) for 1 full Lumi Block";
252  AbovePersistentETThresholdCellsByDepth.depth[2]->setTitle(units.str().c_str());
253  units.str("");
254  units<<"Hot Cells: HO > "<<HOpersistentETThreshold_<<" GeV (ET) for 1 full Lumi Block";
255  AbovePersistentETThresholdCellsByDepth.depth[3]->setTitle(units.str().c_str());
256  units.str("");
257  }
258  }
259 
260  dbe_->setCurrentFolder(subdir_+"hot_neighbortest");
261  me=dbe_->bookInt("NeighborTestEnabled");
262  me->Fill(0);
263  if (test_neighbor_)
264  me->Fill(1);
266  {
267  SetupEtaPhiHists(AboveNeighborsHotCellsByDepth,"Hot Cells Failing Neighbor Test","");
268  if (makeDiagnostics_)
269  {
270  d_HBenergyVsNeighbor=dbe_->book1D("NeighborSumOverEnergyHB","HB Neighbor Sum Energy/Cell Energy;sum(neighbors)/E_cell",500,0,10);
271  d_HEenergyVsNeighbor=dbe_->book1D("NeighborSumOverEnergyHE","HE Neighbor Sum Energy/Cell Energy;sum(neighbors)/E_cell",500,0,10);
272  d_HOenergyVsNeighbor=dbe_->book1D("NeighborSumOverEnergyHO","HO Neighbor Sum Energy/Cell Energy;sum(neighbors)/E_cell",500,0,10);
273  d_HFenergyVsNeighbor=dbe_->book1D("NeighborSumOverEnergyHF","HF Neighbor Sum Energy/Cell Energy;sum(neighbors)/E_cell",500,0,10);
274  }
275  } // if (test_neighbor_ || makeDiagnostics_)
276 
277  this->reset();
278 } // void HcalHotCellMonitor::setup(...)
279 
281 {
282  if (debug_>1) std::cout <<"HcalHotCellMonitor::beginRun"<<std::endl;
284 
285  if (tevt_==0) this->setup(); // set up histograms if they have not been created before
286  if (mergeRuns_==false)
287  this->reset();
288 
289  return;
290 } //void HcalHotCellMonitor::beginRun(...)
291 
292 
293 /* --------------------------- */
294 
296 {
298  zeroCounters();
299 
300  // now reset all the MonitorElements
301 
302  // resetting eta-phi histograms
305 
306  if (test_energy_ )
308 
309  if ( test_et_ )
311 
312  if (test_persistent_)
313  {
316  }
317  if (makeDiagnostics_)
318  {
323  }
324 }
325 
326 
327 
329  const edm::EventSetup& c)
330 {
331  if (LumiInOrder(lumiSeg.luminosityBlock())==false) return;
333  zeroCounters(); // zero hot cell counters at the start of each luminosity block
335  return;
336 } // beginLuminosityBlock(...)
337 
338 
340  const edm::EventSetup& c)
341 {
342  //FIX with check on whether LB already processed
343 
344  if (LumiInOrder(lumiSeg.luminosityBlock())==false) return;
345 
348 
349  if (test_energy_ || test_et_)
351 
352  if (test_persistent_)
354 
356  return;
357 } //endLuminosityBlock(...)
358 
359 
360 
361 /* ------------------------- */
362 
364 {
365  // moved database dumps to client; we want to be able to sum over results in offline
366  return;
367 
368 } // void HcalHotCellMonitor::done()
369 
370 
372 {
373 
374  if (!IsAllowedCalibType()) return;
375  if (LumiInOrder(e.luminosityBlock())==false) return;
376 
377  // try to get rechits
381 
382  if (!(e.getByLabel(hbheRechitLabel_,hbhe_rechit)))
383  {
384  edm::LogWarning("HcalHotCellMonitor")<< hbheRechitLabel_<<" hbhe_rechit not available";
385  return;
386  }
387 
388  if (!(e.getByLabel(hfRechitLabel_,hf_rechit)))
389  {
390  edm::LogWarning("HcalHotCellMonitor")<< hfRechitLabel_<<" hf_rechit not available";
391  return;
392  }
393  if (!(e.getByLabel(hoRechitLabel_,ho_rechit)))
394  {
395  edm::LogWarning("HcalHotCellMonitor")<< hoRechitLabel_<<" ho_rechit not available";
396  return;
397  }
398 
399  // Good event found; increment counter (via base class analyze method)
400 
402  if (debug_>1) std::cout <<"\t<HcalHotCellMonitor::analyze> Processing good event! event # = "<<ievt_<<std::endl;
403 
404  processEvent(*hbhe_rechit, *ho_rechit, *hf_rechit);
405 
406 } // void HcalHotCellMonitor::analyze(...)
407 
408 
409 
410 
411 /* -------------------------------- */
412 
413 
415  const HORecHitCollection& hoHits,
416  const HFRecHitCollection& hfHits
417  )
418 {
419 
420  if (debug_>1) std::cout <<"<HcalHotCellMonitor::processEvent> Processing event..."<<std::endl;
421 
422  // Search for hot cells above a certain energy
424  {
425  processEvent_rechitenergy(hbHits, hoHits,hfHits);
426  }
427 
428  return;
429 } // void HcalHotCellMonitor::processEvent(...)
430 
431 
432 /* --------------------------------------- */
433 
434 
436  const HORecHitCollection& hoHits,
437  const HFRecHitCollection& hfHits)
438 
439 {
440  // Looks at rechits of cells and compares to threshold energies.
441  // Cells above thresholds get marked as hot candidates
442 
443  if (debug_>1) std::cout <<"<HcalHotCellMonitor::processEvent_rechitenergy> Processing rechits..."<<std::endl;
444 
445  // loop over HBHE
446  for (HBHERecHitCollection::const_iterator HBHEiter=hbheHits.begin(); HBHEiter!=hbheHits.end(); ++HBHEiter)
447  { // loop over all hits
448  float en = HBHEiter->energy();
449  //float ti = HBHEiter->time();
450 
451  HcalDetId id(HBHEiter->detid().rawId());
452  int ieta = id.ieta();
453  int iphi = id.iphi();
454  int depth = id.depth();
455  double fEta=fabs(0.5*(theHBHEEtaBounds[abs(ieta)-1]+theHBHEEtaBounds[abs(ieta)]));
456  float et = en/cosh(fEta);
457 
459  {
460  processHit_rechitNeighbors(HBHEiter, hbheHits, HBHENeighborParams_);
461  }
462  if (id.subdet()==HcalBarrel)
463  {
464  if (en>=HBenergyThreshold_)
465  ++aboveenergy[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
466  if (et>=HBETThreshold_)
467  ++aboveet[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
469  ++abovepersistent[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
471  ++abovepersistentET[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
472  }
473  else if (id.subdet()==HcalEndcap)
474  {
475  if (en>=HEenergyThreshold_)
476  ++aboveenergy[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
477  if (et>=HEETThreshold_)
478  ++aboveet[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
479  if (test_energy_)
480  if (en>=HEpersistentThreshold_)
481  ++abovepersistent[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
482  if (test_et_)
483  if (et>=HEpersistentETThreshold_)
484  ++abovepersistentET[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
485  }
486  } //for (HBHERecHitCollection::const_iterator HBHEiter=...)
487 
488  // loop over HO
489  for (HORecHitCollection::const_iterator HOiter=hoHits.begin(); HOiter!=hoHits.end(); ++HOiter)
490  { // loop over all hits
491  float en = HOiter->energy();
492 
493  HcalDetId id(HOiter->detid().rawId());
494  int ieta = id.ieta();
495  int iphi = id.iphi();
496  int depth = id.depth();
497  double fEta=fabs(0.5*(theHBHEEtaBounds[abs(ieta)-1]+theHBHEEtaBounds[abs(ieta)]));
498  float et = en/cosh(fEta);
499 
502 
503  if (isSiPM(ieta,iphi,depth))
504  {
506  ++aboveenergy[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
507  if (et>=HOETThreshold_*SiPMscale_)
508  ++aboveet[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
509  if (test_energy_)
510  if (en>=HOpersistentThreshold_*SiPMscale_)
511  ++abovepersistent[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
512  if (test_et_)
513  if (et>=HOpersistentETThreshold_*SiPMscale_)
514  ++abovepersistentET[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
515  }
516  else
517  {
518  // Skip HO ring 2 when required
519  if (abs(ieta)>10 && excludeHORing2_==true)
520  continue;
521 
522  if (en>=HOenergyThreshold_)
523  ++aboveenergy[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
524  if (et>=HOETThreshold_)
525  ++aboveet[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
526  if (test_energy_)
527  if (en>=HOpersistentThreshold_)
528  ++abovepersistent[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
529  if (test_et_)
530  if (en>=HOpersistentETThreshold_)
531  ++abovepersistentET[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
532  }
533  }
534 
535  // loop over HF
536  for (HFRecHitCollection::const_iterator HFiter=hfHits.begin(); HFiter!=hfHits.end(); ++HFiter)
537  { // loop over all hits
538  float en = HFiter->energy();
540  float threshold_pers = HFpersistentThreshold_;
541  float etthreshold=HFETThreshold_;
542  HcalDetId id(HFiter->detid().rawId());
543  int ieta = id.ieta();
544  int iphi = id.iphi();
545  int depth = id.depth();
546  double fEta=fabs(0.5*(theHFEtaBounds[abs(ieta)-29]+theHFEtaBounds[abs(ieta)-28]));
547  float et = en/cosh(fEta);
548 
551 
552  if (abs(ieta)>39) // increase the thresholds in far-forward part of HF
553  {
554  threshold*=HFfarfwdScale_;
555  threshold_pers*=HFfarfwdScale_;
556  }
557 
558  if (en>=threshold)
559  ++aboveenergy[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
560  if (et>=etthreshold)
561  ++aboveet[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
562  if (test_energy_) {
563  if (en>=threshold_pers)
564  ++abovepersistent[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
565  }
566  if (test_et_) {
567  if (et>=HFpersistentETThreshold_)
568  ++abovepersistentET[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
569  }
570  }
571 
572  // call update every event -- still necessary?
573 
574  for (unsigned int i=0;i<AbovePersistentThresholdCellsByDepth.depth.size();++i)
576  for (unsigned int i=0;i<AboveEnergyThresholdCellsByDepth.depth.size();++i)
578  for (unsigned int i=0;i<AboveETThresholdCellsByDepth.depth.size();++i)
580  for (unsigned int i=0;i<AboveNeighborsHotCellsByDepth.depth.size();++i)
582 
583  return;
584 } // void HcalHotCellMonitor::processEvent_rechitenergy
585 
586 /* --------------------------------------- */
587 
588 
589 template <class RECHIT, class RECHITCOLLECTION>
591  RECHITCOLLECTION& coll,
592  hotNeighborParams& params
593  )
594 {
595  // Compares energy to energy of neighboring cells.
596  // This is a slightly simplified version of D0's NADA algorithm
597  // 17 June 2009 -- this needs major work. I'm not sure I have the [eta][phi][depth] array mapping correct everywhere.
598  // Maybe even tear it apart and start again?
599 
600  int ieta, iphi, depth;
601  float en;
602 
603  int neighborsfound=0;
604  float enNeighbor=0;
605 
606  en = rechit->energy();
607  HcalDetId id(rechit->detid().rawId());
608  ieta = id.ieta();
609  iphi = id.iphi();
610  depth = id.depth();
611 
612  double fEta=0;
613  if (id.subdet()!=HcalForward)
614  fEta=fabs(0.5*(theHBHEEtaBounds[abs(ieta)-1]+theHBHEEtaBounds[abs(ieta)]));
615  else
616  fEta=fabs(0.5*(theHFEtaBounds[abs(ieta)-29]+theHFEtaBounds[abs(ieta)-28]));
617 
618  float et = en/cosh(fEta);
619 
620  // Case 0: ET too low to trigger hot cell check
621  if (et<=params.minCellEnergy) return;
622 
623  // Case 1: above threshold energy; always count as hot
624  if (et>params.maxEnergy)
625  {
626  aboveneighbors[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
627  if (makeDiagnostics_)
628  {
629  // fill overflow bin when energy > max threshold
630  if (id.subdet()==HcalBarrel) d_HBenergyVsNeighbor->Fill(1000);
631  else if (id.subdet()==HcalEndcap) d_HEenergyVsNeighbor->Fill(1000);
632  else if (id.subdet()==HcalOuter) d_HOenergyVsNeighbor->Fill(1000);
633  else if (id.subdet()==HcalForward) d_HFenergyVsNeighbor->Fill(1000);
634  }
635  return;
636  }
637 
638  // Case 2: Search keys for neighboring cells
639 
640  neighborsfound=0;
641  enNeighbor=0;
642 
643  int mydeltaphi=params.DeltaIphi;
644  // scale appropriately for larger cells at higher eta values
645  if (abs(ieta)>39) mydeltaphi*=4;
646  else if (abs(ieta)>20) mydeltaphi*=2;
647 
648  for (int nD=-1*params.DeltaDepth;nD<=params.DeltaDepth;++nD)
649  {
650  for (int nP =-1*mydeltaphi;nP<=mydeltaphi;++nP)
651  {
652  for (int nE =-1*params.DeltaIeta;nE<=params.DeltaIeta;++nE)
653  {
654  if (nD==0 && nE==0 && nP==0)
655  continue; // don't count the cell itself
656  int myphi=(nP+iphi)%72;
657  HcalDetId myid((HcalSubdetector)(1), nE+ieta, myphi, nD+depth); // HB
658  RECHIT part=coll.find(myid);
659  if (part==coll.end())
660  continue;
661  if (part->energy()<params.minNeighborEnergy)
662  continue;
663  ++neighborsfound;
664  enNeighbor+=part->energy();
665  } // loop over nE (neighbor eta)
666  } // loop over nP (neighbor phi)
667  } // loop over nD depths
668 
669  // Case 2a: Not enough good neighbors found -- do we want to implement this?
670  //if (neighborsfound==0)
671  // return;
672 
673  // Case 2b: (avg. neighbor energy)/energy too large for cell to be considered hot
674  if (makeDiagnostics_)
675  {
676  int myval=(int)(enNeighbor/en*50);
677  if (myval<0) myval=0;
678  if (myval>499) myval=499;
679  if (enNeighbor/en<0 || enNeighbor/en>=10) return;
680  if (id.subdet()==HcalBarrel) ++hbVsNeighbor[myval];
681  else if (id.subdet()==HcalEndcap) ++heVsNeighbor[myval];
682  else if (id.subdet()==HcalOuter) ++hoVsNeighbor[myval];
683  else if (id.subdet()==HcalForward) ++hfVsNeighbor[myval];
684  }
685  if ((1.*enNeighbor/en)>params.HotEnergyFrac && en>0 && enNeighbor>0)
686  return;
687 
688  // Case 2c: Tests passed; cell marked as hot
689  aboveneighbors[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1]++;
690 
691  return;
692 } // void HcalHotCellMonitor::processEvent_rechitneighbor
693 
694 
695 /* --------------------------------------- */
696 
697 
699 {
700  // Fill Histograms showing rechits with energies > some threshold for N consecutive events
701 
702  if (levt_<minEvents_) return;
703 
704  if (debug_>0)
705  std::cout <<"<HcalHotCellMonitor::fillNevents_persistentenergy> FILLING PERSISTENT ENERGY PLOTS"<<std::endl;
706 
707  if (test_energy_)
708  {
709  for (unsigned int h=0;h<AbovePersistentThresholdCellsByDepth.depth.size();++h)
710  AbovePersistentThresholdCellsByDepth.depth[h]->setBinContent(0,0,ievt_);
711 
712  int ieta=0;
713  int iphi=0;
714  int etabins=0;
715  int phibins=0;
716 
717  for (unsigned int depth=0;depth<AbovePersistentThresholdCellsByDepth.depth.size();++depth)
718  {
719  etabins=AbovePersistentThresholdCellsByDepth.depth[depth]->getNbinsX();
720  phibins=AbovePersistentThresholdCellsByDepth.depth[depth]->getNbinsY();
721 
722  for (int eta=0;eta<etabins;++eta)
723  {
724  for (int phi=0;phi<phibins;++phi)
725  {
726  iphi=phi+1;
727  for (int subdet=1;subdet<=4;++subdet)
728  {
729  ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1); //converts bin to ieta
730  if (ieta==-9999) continue;
731  if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
732  continue;
733  if (subdet==HcalForward) // shift HcalForward ieta by 1 for filling purposes
734  ieta<0 ? ieta-- : ieta++;
735 
736  // MUST BE ABOVE ENERGY THRESHOLD FOR ALL N EVENTS in a luminosity block
737  if (abovepersistent[eta][phi][depth]<levt_)
738  {
739  abovepersistent[eta][phi][depth]=0;
740  continue;
741  }
742  if (debug_>0) std::cout <<"HOT CELL; PERSISTENT ENERGY at subdet = "<<subdet<<", eta = "<<ieta<<", phi = "<<iphi<<" depth = "<<depth<<std::endl;
743  AbovePersistentThresholdCellsByDepth.depth[depth]->Fill(ieta,iphi,abovepersistent[eta][phi][depth]);
744  AbovePersistentThresholdCellsByDepth.depth[depth]->setBinContent(0,0,ievt_);
745  abovepersistent[eta][phi][depth]=0; // reset counter
746  } // for (int subdet=1; subdet<=4;++subdet)
747  } // for (int phi=0;...)
748  } // for (int eta=0;...)
749  } // for (unsigned int depth=0;...)
751  } // if (test_energy_)
752 
753  if (test_et_)
754  {
755  for (unsigned int h=0;h<AbovePersistentETThresholdCellsByDepth.depth.size();++h)
757 
758  int ieta=0;
759  int iphi=0;
760  int etabins=0;
761  int phibins=0;
762 
763  for (unsigned int depth=0;depth<AbovePersistentETThresholdCellsByDepth.depth.size();++depth)
764  {
765  etabins=AbovePersistentETThresholdCellsByDepth.depth[depth]->getNbinsX();
766  phibins=AbovePersistentETThresholdCellsByDepth.depth[depth]->getNbinsY();
767 
768  for (int eta=0;eta<etabins;++eta)
769  {
770  for (int phi=0;phi<phibins;++phi)
771  {
772  iphi=phi+1;
773  for (int subdet=1;subdet<=4;++subdet)
774  {
775  ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1); //converts bin to ieta
776  if (ieta==-9999) continue;
777  if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
778  continue;
779  if (subdet==HcalForward) // shift HcalForward ieta by 1 for filling purposes
780  ieta<0 ? ieta-- : ieta++;
781 
782  // MUST BE ABOVE ET THRESHOLD FOR ALL N EVENTS in a luminosity block
783  if (abovepersistentET[eta][phi][depth]<levt_)
784  {
785  abovepersistentET[eta][phi][depth]=0;
786  continue;
787  }
788  if (debug_>0) std::cout <<"HOT CELL; PERSISTENT ENERGY at subdet = "<<subdet<<", eta = "<<ieta<<", phi = "<<iphi<<" depth = "<<depth<<std::endl;
789  AbovePersistentETThresholdCellsByDepth.depth[depth]->Fill(ieta,iphi,abovepersistentET[eta][phi][depth]);
790  AbovePersistentETThresholdCellsByDepth.depth[depth]->setBinContent(0,0,ievt_);
791  abovepersistentET[eta][phi][depth]=0; // reset counter
792  } // for (int subdet=1; subdet<=4;++subdet)
793  } // for (int phi=0;...)
794  } // for (int eta=0;...)
795  } // for (unsigned int depth=0;...)
797 
798  } // if (test_et_)
799  // Add test_ET
800  return;
801 } // void HcalHotCellMonitor::fillNevents_persistentenergy(void)
802 
803 
804 
805 /* ----------------------------------- */
806 
808 {
809  // Fill Histograms showing rec hits that are above some energy value
810  // (Fill for each instance when cell is above energy; don't require it to be hot for a number of consecutive events)
811 
812  if (debug_>0)
813  std::cout <<"<HcalHotCellMonitor::fillNevents_energy> ABOVE-ENERGY-THRESHOLD PLOTS"<<std::endl;
814 
815  if (test_energy_)
816  {
817  for (unsigned int h=0;h<AboveEnergyThresholdCellsByDepth.depth.size();++h)
818  AboveEnergyThresholdCellsByDepth.depth[h]->setBinContent(0,0,ievt_);
819  }
820  if (test_et_)
821  {
822  for (unsigned int h=0;h<AboveETThresholdCellsByDepth.depth.size();++h)
823  AboveETThresholdCellsByDepth.depth[h]->setBinContent(0,0,ievt_);
824  }
825 
826  int ieta=0;
827  int iphi=0;
828  int etabins=0;
829  int phibins=0;
830  unsigned int maxdepth=0;
831 
832  if (test_energy_)
833  maxdepth = AboveEnergyThresholdCellsByDepth.depth.size();
834  if (maxdepth==0 && test_et_)
835  maxdepth = AboveETThresholdCellsByDepth.depth.size();
836  for (unsigned int depth=0;depth<maxdepth;++depth)
837  {
838  if (test_energy_)
839  {
840  etabins=AboveEnergyThresholdCellsByDepth.depth[depth]->getNbinsX();
841  phibins=AboveEnergyThresholdCellsByDepth.depth[depth]->getNbinsY();
842  }
843  if (test_et_)
844  {
845  etabins=AboveETThresholdCellsByDepth.depth[depth]->getNbinsX();
846  phibins=AboveETThresholdCellsByDepth.depth[depth]->getNbinsY();
847  }
848  for (int eta=0;eta<etabins;++eta)
849  {
850  for (int phi=0;phi<phibins;++phi)
851  {
852  iphi=phi+1;
853  for (int subdet=1;subdet<=4;++subdet)
854  {
855  ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1); //converts bin to ieta
856  if (ieta==-9999) continue;
857  if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
858  continue;
859  if (subdet==HcalForward) // shift HcalForward ieta by 1 for filling purposes
860  ieta<0 ? ieta-- : ieta++;
861 
862  if (test_energy_)
863  {
864  if (aboveenergy[eta][phi][depth]>0)
865  {
866  if (debug_>2)
867  std::cout <<"HOT CELL; ABOVE ENERGY THRESHOLD at subdet = "<<subdet<<", eta = "<<ieta<<", phi = "<<iphi<<" depth = "<<depth+1<<" ABOVE THRESHOLD IN "<<aboveenergy[eta][phi][depth]<<" EVENTS"<<std::endl;
868  AboveEnergyThresholdCellsByDepth.depth[depth]->Fill(ieta,iphi, aboveenergy[eta][phi][depth]);
869  aboveenergy[eta][phi][depth]=0;
870  } // if (aboveenergy[eta][phi][depth])
871  } // if (test_energy_)
872  if (test_et_)
873  {
874  if (aboveet[eta][phi][depth]>0)
875  {
876  if (debug_>2)
877  std::cout <<"HOT CELL; ABOVE ET THRESHOLD at subdet = "<<subdet<<", eta = "<<ieta<<", phi = "<<iphi<<" depth = "<<depth+1<<" ABOVE THRESHOLD IN "<<aboveet[eta][phi][depth]<<" EVENTS"<<std::endl;
878  AboveETThresholdCellsByDepth.depth[depth]->Fill(ieta,iphi, aboveet[eta][phi][depth]);
879  aboveet[eta][phi][depth]=0;
880  } // if (aboveet[eta][phi][depth])
881  } // if (test_et_)
882  } // for (int subdet=0)
883  } // for (int phi=0;...)
884  } // for (int eta=0;...)
885  } // for (int depth=0;...)
886 
887  if (test_energy_)
889 
890  if (test_et_)
892 
893  return;
894 
895 
896 } // void HcalHotCellMonitor::fillNevents_energy(void)
897 
898 
899 
900 /* ----------------------------------- */
901 
903 {
904  // Fill Histograms showing rec hits with energy much less than neighbors' average
905 
906  if (debug_>0)
907  std::cout <<"<HcalHotCellMonitor::fillNevents_neighbor> FILLING ABOVE-NEIGHBOR-ENERGY PLOTS"<<std::endl;
908 
909  for (unsigned int h=0;h<AboveNeighborsHotCellsByDepth.depth.size();++h)
910  AboveNeighborsHotCellsByDepth.depth[h]->setBinContent(0,0,ievt_);
911 
912  int ieta=0;
913  int iphi=0;
914  int etabins=0;
915  int phibins=0;
916 
917  for (unsigned int depth=0;depth<AboveNeighborsHotCellsByDepth.depth.size();++depth)
918  {
919  etabins=AboveNeighborsHotCellsByDepth.depth[depth]->getNbinsX();
920  phibins=AboveNeighborsHotCellsByDepth.depth[depth]->getNbinsY();
921 
922  for (int eta=0;eta<etabins;++eta)
923  {
924  for (int phi=0;phi<phibins;++phi)
925  {
926  iphi=phi+1;
927  for (int subdet=1;subdet<=4;++subdet)
928  {
929  ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1); //converts bin to ieta
930  if (ieta==-9999) continue;
931  if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
932  continue;
933  if (subdet==HcalForward) // shift HcalForward ieta by 1 for filling purposes
934  ieta<0 ? ieta-- : ieta++;
935 
936  if (aboveneighbors[eta][phi][depth]>0)
937  {
938  if (debug_>2) std::cout <<"HOT CELL; ABOVE NEIGHBORS at eta = "<<ieta<<", phi = "<<iphi<<" depth = "<<(depth>4 ? depth+1 : depth-3)<<std::endl;
939  AboveNeighborsHotCellsByDepth.depth[depth]->Fill(ieta,iphi,aboveneighbors[eta][phi][depth]);
940  //reset counter
941  aboveneighbors[eta][phi][depth]=0;
942  } // if (aboveneighbors[eta][phi][mydepth]>0)
943  } // for (int subdet=1;...)
944  } // for (int phi=0;...)
945  } // for (int eta=0;...)
946  } // for (unsigned int depth=0;...)
948 
949  if (!makeDiagnostics_) return;
950  for (int i=0;i<500;++i)
951  {
953  hbVsNeighbor[i]=0;
955  heVsNeighbor[i]=0;
957  hoVsNeighbor[i]=0;
959  hfVsNeighbor[i]=0;
960  }
961 
962  return;
963 
964 } // void HcalHotCellMonitor::fillNevents_neighbor(void)
965 
966 
967 
968 
969 
970 
972 {
973  if (debug_>0)
974  std::cout <<"<HcalHotCellMonitor::fillNevents_problemCells> FILLING PROBLEM CELL PLOTS"<<std::endl;
975 
976  if (ievt_==0) return; // no events; no need to bother with this
977 
978  int ieta=0;
979  int etabins=0;
980  int phibins=0;
981  bool problemvalue=false;
982 
983  // Count problem cells in each subdetector
984  int NumBadHB=0;
985  int NumBadHE=0;
986  int NumBadHO=0;
987  int NumBadHF=0;
988  int NumBadHO0=0;
989  int NumBadHO12=0;
990  int NumBadHFLUMI=0;
991 
992  unsigned int DEPTH = 0;
993 
994  if (test_persistent_)
995  {
996  if (test_energy_)
998  else if (test_et_)
1000  }
1001  else if (test_energy_ && DEPTH==0) DEPTH = AboveEnergyThresholdCellsByDepth.depth.size();
1002  else if (test_et_ && DEPTH==0) DEPTH = AboveETThresholdCellsByDepth.depth.size();
1003  else if (test_neighbor_ && DEPTH==0) DEPTH = AboveNeighborsHotCellsByDepth.depth.size();
1004 
1005  if (DEPTH==0) return;
1006 
1007  for (unsigned int depth=0;depth<DEPTH;++depth)
1008  {
1009  if (test_persistent_)
1010  {
1011  if (test_energy_)
1012  {
1013  etabins=AbovePersistentThresholdCellsByDepth.depth[depth]->getNbinsX();
1014  phibins=AbovePersistentThresholdCellsByDepth.depth[depth]->getNbinsY();
1015  }
1016  else if (test_et_)
1017  {
1018  etabins=AbovePersistentETThresholdCellsByDepth.depth[depth]->getNbinsX();
1019  phibins=AbovePersistentETThresholdCellsByDepth.depth[depth]->getNbinsY();
1020  }
1021  }
1022 
1023  if (test_neighbor_ && (etabins==0 || phibins==0))
1024  {
1025  etabins=AboveNeighborsHotCellsByDepth.depth[depth]->getNbinsX();
1026  phibins=AboveNeighborsHotCellsByDepth.depth[depth]->getNbinsY();
1027  }
1028 
1029  if (test_energy_ && (etabins==0 || phibins==0))
1030  {
1031  etabins=AboveEnergyThresholdCellsByDepth.depth[depth]->getNbinsX();
1032  phibins=AboveEnergyThresholdCellsByDepth.depth[depth]->getNbinsY();
1033  }
1034 
1035  if (test_et_ && (etabins==0 || phibins==0))
1036  {
1037  etabins=AboveETThresholdCellsByDepth.depth[depth]->getNbinsX();
1038  phibins=AboveETThresholdCellsByDepth.depth[depth]->getNbinsY();
1039  }
1040 
1041  for (int eta=0;eta<etabins;++eta)
1042  {
1043  ieta=CalcIeta(eta,depth+1);
1044  if (ieta==-9999) continue;
1045  for (int phi=0;phi<phibins;++phi)
1046  {
1047  if (abs(ieta)>20 && phi%2==1) continue; //skip non-physical cells
1048  else if (abs(ieta)>39 && (phi+1)%4!=3) continue;
1049  // find problem rate for particular cell
1050  problemvalue=false;
1052  problemvalue=true;
1053  if (test_neighbor_ && AboveNeighborsHotCellsByDepth.depth[depth]->getBinContent(eta+1,phi+1)>minErrorFlag_*ievt_)
1054  problemvalue=true;
1055  if (test_energy_ && AboveEnergyThresholdCellsByDepth.depth[depth]->getBinContent(eta+1,phi+1)>minErrorFlag_*ievt_)
1056  problemvalue=true;
1057  if (test_et_ && AboveETThresholdCellsByDepth.depth[depth]->getBinContent(eta+1,phi+1)>minErrorFlag_*ievt_)
1058  problemvalue=true;
1060  problemvalue=true;
1061  if (problemvalue==false) continue;
1062  if (isHB(eta,depth+1)) ++NumBadHB;
1063  else if (isHE(eta,depth+1))
1064  ++NumBadHE;
1065  else if (isHO(eta,depth+1))
1066  {
1067  ++NumBadHO;
1068  if (abs(ieta)<5) ++NumBadHO0;
1069  else ++NumBadHO12;
1070  }
1071  else if (isHF(eta,depth+1))
1072  {
1073  ++NumBadHF;
1074  if (depth+1==1 && (abs(ieta)==33 || abs(ieta)==34)) ++NumBadHFLUMI;
1075  else if (depth+1==2 && (abs(ieta)==35 || abs(ieta)==36)) ++NumBadHFLUMI;
1076  }
1077  } // for (int phi=0;...)
1078  } //for (int eta=0;...)
1079  } // for (int depth=0;...)
1080 
1081  if (debug_>2) std::cout <<"<HcalHotCellMonitor::fillNevents_problemCells> Num Bad HB = "<<NumBadHB<<" Num Bad HE = "<<NumBadHE<<" Num Bad HO = "<<NumBadHO<<" Num Bad HF = "<<NumBadHF<<" CURRENT LS = "<<currentLS<<std::endl;
1082  // Fill number of problem cells
1083  ProblemsVsLB_HB->Fill(currentLS,NumBadHB);
1084  ProblemsVsLB_HE->Fill(currentLS,NumBadHE);
1085  ProblemsVsLB_HO->Fill(currentLS,NumBadHO);
1086  ProblemsVsLB_HF->Fill(currentLS,NumBadHF);
1087  ProblemsVsLB_HBHEHF->Fill(currentLS,NumBadHB+NumBadHE+NumBadHF);
1088  ProblemsVsLB->Fill(currentLS,NumBadHB+NumBadHE+NumBadHO+NumBadHF);
1089 
1090  ProblemsCurrentLB->Fill(-1,-1,levt_);
1091  ProblemsCurrentLB->Fill(0,0,NumBadHB);
1092  ProblemsCurrentLB->Fill(1,0,NumBadHE);
1093  ProblemsCurrentLB->Fill(2,0,NumBadHO);
1094  ProblemsCurrentLB->Fill(3,0,NumBadHF);
1095  ProblemsCurrentLB->Fill(4,0,NumBadHO0);
1096  ProblemsCurrentLB->Fill(5,0,NumBadHO12);
1097  ProblemsCurrentLB->Fill(6,0,NumBadHFLUMI);
1098 
1099 } // void HcalHotCellMonitor::fillNevents_problemCells(void)
1100 
1101 
1103 {
1104 
1105  // zero all counters
1106  for (int i=0;i<85;++i)
1107  {
1108  for (int j=0;j<72;++j)
1109  {
1110  for (int k=0;k<4;++k)
1111  {
1112  abovepersistent[i][j][k]=0;
1113  abovepersistentET[i][j][k]=0;
1114  aboveneighbors[i][j][k]=0;
1115  aboveenergy[i][j][k]=0;
1116  aboveet[i][j][k]=0;
1117  rechit_occupancy_sum[i][j][k]=0;
1118  }
1119  }
1120  }
1121 
1122  for (int i=0;i<500;++i)
1123  {
1124  hbVsNeighbor[i]=0;
1125  heVsNeighbor[i]=0;
1126  hoVsNeighbor[i]=0;
1127  hfVsNeighbor[i]=0;
1128  }
1129  return;
1130 
1131 } // void HcalHotCellMonitor::zeroCounters()
1132 
1134 {
1135  // Anything to do here?
1136 }
1137 
1139 {
1140  if (debug_>0) std::cout <<"HcalHotCellMonitor::endJob()"<<std::endl;
1141  if (enableCleanup_) cleanup(); // when do we force cleanup?
1142 }
1143 
1145 {
1146  if (debug_>0) std::cout <<"HcalHotCellMonitor::cleanup()"<<std::endl;
1147  if (!enableCleanup_) return;
1148  if (dbe_)
1149  {
1150  // removeContents doesn't remove subdirectories
1152  dbe_->removeContents();
1153  dbe_->setCurrentFolder(subdir_+"hot_rechit_above_threshold");
1154  dbe_->removeContents();
1155  dbe_->setCurrentFolder(subdir_+"hot_rechit_always_above_threshold");
1156  dbe_->removeContents();
1157  dbe_->setCurrentFolder(subdir_+"hot_neighbortest");
1158  dbe_->removeContents();
1159  dbe_->setCurrentFolder(subdir_+"LSvalues");
1160  dbe_->removeContents();
1161  }
1162 } // cleanup
1163 
1165 {
1166 
1167  // first reset base class objects
1168  //FIX HcalBaseMonitor::periodicReset();
1169 
1170  // then reset the temporary histograms
1171  zeroCounters();
1172 
1173  // now reset all the MonitorElements
1174 
1175  // resetting eta-phi histograms
1176  if (test_neighbor_)
1180  if (test_et_ || makeDiagnostics_)
1182  if (test_persistent_)
1183  {
1185  if (test_et_)
1187  }
1188  return;
1189 }
bool isHO(int etabin, int depth)
int abovepersistent[85][72][4]
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
EtaPhiHists AboveEnergyThresholdCellsByDepth
bool LumiInOrder(int lumisec)
void beginRun(const edm::Run &run, const edm::EventSetup &c)
MonitorElement * ProblemsCurrentLB
int aboveneighbors[85][72][4]
edm::InputTag hoRechitLabel_
hotNeighborParams HONeighborParams_
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
void processEvent(const HBHERecHitCollection &hbHits, const HORecHitCollection &hoHits, const HFRecHitCollection &hfHits)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
void processHit_rechitNeighbors(R &rechititer, C &collection, hotNeighborParams &params)
MonitorElement * ProblemsVsLB_HF
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< int > AllowedCalibTypes_
int abovepersistentET[85][72][4]
void Reset(void)
int rechit_occupancy_sum[85][72][4]
std::vector< T >::const_iterator const_iterator
#define abs(x)
Definition: mlp_lapack.h:159
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
EtaPhiHists AbovePersistentThresholdCellsByDepth
int aboveenergy[85][72][4]
EtaPhiHists AbovePersistentETThresholdCellsByDepth
bool isHE(int etabin, int depth)
T eta() const
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:659
void Fill(long long x)
LuminosityBlockNumber_t luminosityBlock() const
HcalHotCellMonitor(const edm::ParameterSet &ps)
bool isSiPM(int ieta, int iphi, int depth)
std::vector< MonitorElement * > depth
MonitorElement * d_HFenergyVsNeighbor
virtual void beginRun(const edm::Run &run, const edm::EventSetup &c)
int CalcIeta(int subdet, int eta, int depth)
void removeContents(void)
erase all monitoring elements in current directory (not including subfolders);
Definition: DQMStore.cc:2569
MonitorElement * ProblemsVsLB_HBHEHF
MonitorElement * ProblemsVsLB_HB
void analyze(edm::Event const &e, edm::EventSetup const &s)
EtaPhiHists AboveETThresholdCellsByDepth
int ieta() const
get the cell ieta
Definition: HcalDetId.h:38
virtual void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
HcalSubdetector
Definition: HcalAssistant.h:32
int j
Definition: DBlmapReader.cc:9
hotNeighborParams HBHENeighborParams_
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:1036
bool isHB(int etabin, int depth)
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
void processEvent_rechitenergy(const HBHERecHitCollection &hbheHits, const HORecHitCollection &hoHits, const HFRecHitCollection &hfHits)
MonitorElement * d_HBenergyVsNeighbor
int k[5][pyjets_maxn]
const_iterator end() const
void endRun(const edm::Run &run, const edm::EventSetup &c)
edm::InputTag hbheRechitLabel_
bool isHF(int etabin, int depth)
JetCorrectorParametersCollection coll
Definition: classes.h:16
static const double theHFEtaBounds[]
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
part
Definition: HCALResponse.h:20
virtual void reset(void)
MonitorElement * ProblemsVsLB_HE
void FillUnphysicalHEHFBins(std::vector< TH2F > &hh)
int aboveet[85][72][4]
int CalcEtaBin(int subdet, int ieta, int depth)
void SetupEtaPhiHists(EtaPhiHists &hh, std::string Name, std::string Units)
edm::InputTag hfRechitLabel_
MonitorElement * d_HOenergyVsNeighbor
EtaPhiHists AboveNeighborsHotCellsByDepth
TProfile * getTProfile(void) const
tuple cout
Definition: gather_cfg.py:121
MonitorElement * ProblemsVsLB_HO
MonitorElement * ProblemsVsLB
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:629
virtual void setup(void)
static const double theHBHEEtaBounds[]
hotNeighborParams HFNeighborParams_
void Reset(void)
reset ME (ie. contents, errors, etc)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
const_iterator begin() const
Definition: Run.h:36
bool validDetId(HcalSubdetector sd, int ies, int ip, int dp)
Definition: DDAxes.h:10
MonitorElement * d_HEenergyVsNeighbor