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