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  if (makeDiagnostics_)
632  {
633  // fill overflow bin when energy > max threshold
634  if (id.subdet()==HcalBarrel) d_HBenergyVsNeighbor->Fill(1000);
635  else if (id.subdet()==HcalEndcap) d_HEenergyVsNeighbor->Fill(1000);
636  else if (id.subdet()==HcalOuter) d_HOenergyVsNeighbor->Fill(1000);
637  else if (id.subdet()==HcalForward) d_HFenergyVsNeighbor->Fill(1000);
638  }
639  return;
640  }
641 
642  // Case 2: Search keys for neighboring cells
643 
644  neighborsfound=0;
645  enNeighbor=0;
646 
647  int mydeltaphi=params.DeltaIphi;
648  // scale appropriately for larger cells at higher eta values
649  if (abs(ieta)>39) mydeltaphi*=4;
650  else if (abs(ieta)>20) mydeltaphi*=2;
651 
652  for (int nD=-1*params.DeltaDepth;nD<=params.DeltaDepth;++nD)
653  {
654  for (int nP =-1*mydeltaphi;nP<=mydeltaphi;++nP)
655  {
656  for (int nE =-1*params.DeltaIeta;nE<=params.DeltaIeta;++nE)
657  {
658  if (nD==0 && nE==0 && nP==0)
659  continue; // don't count the cell itself
660  int myphi=(nP+iphi)%72;
661  HcalDetId myid((HcalSubdetector)(1), nE+ieta, myphi, nD+depth); // HB
662  RECHIT part=coll.find(myid);
663  if (part==coll.end())
664  continue;
665  if (part->energy()<params.minNeighborEnergy)
666  continue;
667  ++neighborsfound;
668  enNeighbor+=part->energy();
669  } // loop over nE (neighbor eta)
670  } // loop over nP (neighbor phi)
671  } // loop over nD depths
672 
673  // Case 2a: Not enough good neighbors found -- do we want to implement this?
674  //if (neighborsfound==0)
675  // return;
676 
677  // Case 2b: (avg. neighbor energy)/energy too large for cell to be considered hot
678  if (makeDiagnostics_)
679  {
680  int myval=(int)(enNeighbor/en*50);
681  if (myval<0) myval=0;
682  if (myval>499) myval=499;
683  if (enNeighbor/en<0 || enNeighbor/en>=10) return;
684  if (id.subdet()==HcalBarrel) ++hbVsNeighbor[myval];
685  else if (id.subdet()==HcalEndcap) ++heVsNeighbor[myval];
686  else if (id.subdet()==HcalOuter) ++hoVsNeighbor[myval];
687  else if (id.subdet()==HcalForward) ++hfVsNeighbor[myval];
688  }
689  if ((1.*enNeighbor/en)>params.HotEnergyFrac && en>0 && enNeighbor>0)
690  return;
691 
692  // Case 2c: Tests passed; cell marked as hot
693  aboveneighbors[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1]++;
694 
695  return;
696 } // void HcalHotCellMonitor::processEvent_rechitneighbor
697 
698 
699 /* --------------------------------------- */
700 
701 
703 {
704  // Fill Histograms showing rechits with energies > some threshold for N consecutive events
705 
706  if (levt_<minEvents_) return;
707 
708  if (debug_>0)
709  std::cout <<"<HcalHotCellMonitor::fillNevents_persistentenergy> FILLING PERSISTENT ENERGY PLOTS"<<std::endl;
710 
711  if (test_energy_)
712  {
713  for (unsigned int h=0;h<AbovePersistentThresholdCellsByDepth.depth.size();++h)
714  AbovePersistentThresholdCellsByDepth.depth[h]->setBinContent(0,0,ievt_);
715 
716  int ieta=0;
717  int iphi=0;
718  int etabins=0;
719  int phibins=0;
720 
721  for (unsigned int depth=0;depth<AbovePersistentThresholdCellsByDepth.depth.size();++depth)
722  {
723  etabins=AbovePersistentThresholdCellsByDepth.depth[depth]->getNbinsX();
724  phibins=AbovePersistentThresholdCellsByDepth.depth[depth]->getNbinsY();
725 
726  for (int eta=0;eta<etabins;++eta)
727  {
728  for (int phi=0;phi<phibins;++phi)
729  {
730  iphi=phi+1;
731  for (int subdet=1;subdet<=4;++subdet)
732  {
733  ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1); //converts bin to ieta
734  if (ieta==-9999) continue;
735  if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
736  continue;
737  if (subdet==HcalForward) // shift HcalForward ieta by 1 for filling purposes
738  ieta<0 ? ieta-- : ieta++;
739 
740  // MUST BE ABOVE ENERGY THRESHOLD FOR ALL N EVENTS in a luminosity block
741  if (abovepersistent[eta][phi][depth]<levt_)
742  {
743  abovepersistent[eta][phi][depth]=0;
744  continue;
745  }
746  if (debug_>0) std::cout <<"HOT CELL; PERSISTENT ENERGY at subdet = "<<subdet<<", eta = "<<ieta<<", phi = "<<iphi<<" depth = "<<depth<<std::endl;
747  AbovePersistentThresholdCellsByDepth.depth[depth]->Fill(ieta,iphi,abovepersistent[eta][phi][depth]);
748  AbovePersistentThresholdCellsByDepth.depth[depth]->setBinContent(0,0,ievt_);
749  abovepersistent[eta][phi][depth]=0; // reset counter
750  } // for (int subdet=1; subdet<=4;++subdet)
751  } // for (int phi=0;...)
752  } // for (int eta=0;...)
753  } // for (unsigned int depth=0;...)
755  } // if (test_energy_)
756 
757  if (test_et_)
758  {
759  for (unsigned int h=0;h<AbovePersistentETThresholdCellsByDepth.depth.size();++h)
761 
762  int ieta=0;
763  int iphi=0;
764  int etabins=0;
765  int phibins=0;
766 
767  for (unsigned int depth=0;depth<AbovePersistentETThresholdCellsByDepth.depth.size();++depth)
768  {
769  etabins=AbovePersistentETThresholdCellsByDepth.depth[depth]->getNbinsX();
770  phibins=AbovePersistentETThresholdCellsByDepth.depth[depth]->getNbinsY();
771 
772  for (int eta=0;eta<etabins;++eta)
773  {
774  for (int phi=0;phi<phibins;++phi)
775  {
776  iphi=phi+1;
777  for (int subdet=1;subdet<=4;++subdet)
778  {
779  ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1); //converts bin to ieta
780  if (ieta==-9999) continue;
781  if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
782  continue;
783  if (subdet==HcalForward) // shift HcalForward ieta by 1 for filling purposes
784  ieta<0 ? ieta-- : ieta++;
785 
786  // MUST BE ABOVE ET THRESHOLD FOR ALL N EVENTS in a luminosity block
787  if (abovepersistentET[eta][phi][depth]<levt_)
788  {
789  abovepersistentET[eta][phi][depth]=0;
790  continue;
791  }
792  if (debug_>0) std::cout <<"HOT CELL; PERSISTENT ENERGY at subdet = "<<subdet<<", eta = "<<ieta<<", phi = "<<iphi<<" depth = "<<depth<<std::endl;
793  AbovePersistentETThresholdCellsByDepth.depth[depth]->Fill(ieta,iphi,abovepersistentET[eta][phi][depth]);
794  AbovePersistentETThresholdCellsByDepth.depth[depth]->setBinContent(0,0,ievt_);
795  abovepersistentET[eta][phi][depth]=0; // reset counter
796  } // for (int subdet=1; subdet<=4;++subdet)
797  } // for (int phi=0;...)
798  } // for (int eta=0;...)
799  } // for (unsigned int depth=0;...)
801 
802  } // if (test_et_)
803  // Add test_ET
804  return;
805 } // void HcalHotCellMonitor::fillNevents_persistentenergy(void)
806 
807 
808 
809 /* ----------------------------------- */
810 
812 {
813  // Fill Histograms showing rec hits that are above some energy value
814  // (Fill for each instance when cell is above energy; don't require it to be hot for a number of consecutive events)
815 
816  if (debug_>0)
817  std::cout <<"<HcalHotCellMonitor::fillNevents_energy> ABOVE-ENERGY-THRESHOLD PLOTS"<<std::endl;
818 
819  if (test_energy_)
820  {
821  for (unsigned int h=0;h<AboveEnergyThresholdCellsByDepth.depth.size();++h)
822  AboveEnergyThresholdCellsByDepth.depth[h]->setBinContent(0,0,ievt_);
823  }
824  if (test_et_)
825  {
826  for (unsigned int h=0;h<AboveETThresholdCellsByDepth.depth.size();++h)
827  AboveETThresholdCellsByDepth.depth[h]->setBinContent(0,0,ievt_);
828  }
829 
830  int ieta=0;
831  int iphi=0;
832  int etabins=0;
833  int phibins=0;
834  unsigned int maxdepth=0;
835 
836  if (test_energy_)
837  maxdepth = AboveEnergyThresholdCellsByDepth.depth.size();
838  if (maxdepth==0 && test_et_)
839  maxdepth = AboveETThresholdCellsByDepth.depth.size();
840  for (unsigned int depth=0;depth<maxdepth;++depth)
841  {
842  if (test_energy_)
843  {
844  etabins=AboveEnergyThresholdCellsByDepth.depth[depth]->getNbinsX();
845  phibins=AboveEnergyThresholdCellsByDepth.depth[depth]->getNbinsY();
846  }
847  if (test_et_)
848  {
849  etabins=AboveETThresholdCellsByDepth.depth[depth]->getNbinsX();
850  phibins=AboveETThresholdCellsByDepth.depth[depth]->getNbinsY();
851  }
852  for (int eta=0;eta<etabins;++eta)
853  {
854  for (int phi=0;phi<phibins;++phi)
855  {
856  iphi=phi+1;
857  for (int subdet=1;subdet<=4;++subdet)
858  {
859  ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1); //converts bin to ieta
860  if (ieta==-9999) continue;
861  if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
862  continue;
863  if (subdet==HcalForward) // shift HcalForward ieta by 1 for filling purposes
864  ieta<0 ? ieta-- : ieta++;
865 
866  if (test_energy_)
867  {
868  if (aboveenergy[eta][phi][depth]>0)
869  {
870  if (debug_>2)
871  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;
872  AboveEnergyThresholdCellsByDepth.depth[depth]->Fill(ieta,iphi, aboveenergy[eta][phi][depth]);
873  aboveenergy[eta][phi][depth]=0;
874  } // if (aboveenergy[eta][phi][depth])
875  } // if (test_energy_)
876  if (test_et_)
877  {
878  if (aboveet[eta][phi][depth]>0)
879  {
880  if (debug_>2)
881  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;
882  AboveETThresholdCellsByDepth.depth[depth]->Fill(ieta,iphi, aboveet[eta][phi][depth]);
883  aboveet[eta][phi][depth]=0;
884  } // if (aboveet[eta][phi][depth])
885  } // if (test_et_)
886  } // for (int subdet=0)
887  } // for (int phi=0;...)
888  } // for (int eta=0;...)
889  } // for (int depth=0;...)
890 
891  if (test_energy_)
893 
894  if (test_et_)
896 
897  return;
898 
899 
900 } // void HcalHotCellMonitor::fillNevents_energy(void)
901 
902 
903 
904 /* ----------------------------------- */
905 
907 {
908  // Fill Histograms showing rec hits with energy much less than neighbors' average
909 
910  if (debug_>0)
911  std::cout <<"<HcalHotCellMonitor::fillNevents_neighbor> FILLING ABOVE-NEIGHBOR-ENERGY PLOTS"<<std::endl;
912 
913  for (unsigned int h=0;h<AboveNeighborsHotCellsByDepth.depth.size();++h)
914  AboveNeighborsHotCellsByDepth.depth[h]->setBinContent(0,0,ievt_);
915 
916  int ieta=0;
917  int iphi=0;
918  int etabins=0;
919  int phibins=0;
920 
921  for (unsigned int depth=0;depth<AboveNeighborsHotCellsByDepth.depth.size();++depth)
922  {
923  etabins=AboveNeighborsHotCellsByDepth.depth[depth]->getNbinsX();
924  phibins=AboveNeighborsHotCellsByDepth.depth[depth]->getNbinsY();
925 
926  for (int eta=0;eta<etabins;++eta)
927  {
928  for (int phi=0;phi<phibins;++phi)
929  {
930  iphi=phi+1;
931  for (int subdet=1;subdet<=4;++subdet)
932  {
933  ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1); //converts bin to ieta
934  if (ieta==-9999) continue;
935  if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
936  continue;
937  if (subdet==HcalForward) // shift HcalForward ieta by 1 for filling purposes
938  ieta<0 ? ieta-- : ieta++;
939 
940  if (aboveneighbors[eta][phi][depth]>0)
941  {
942  if (debug_>2) std::cout <<"HOT CELL; ABOVE NEIGHBORS at eta = "<<ieta<<", phi = "<<iphi<<" depth = "<<(depth>4 ? depth+1 : depth-3)<<std::endl;
943  AboveNeighborsHotCellsByDepth.depth[depth]->Fill(ieta,iphi,aboveneighbors[eta][phi][depth]);
944  //reset counter
945  aboveneighbors[eta][phi][depth]=0;
946  } // if (aboveneighbors[eta][phi][mydepth]>0)
947  } // for (int subdet=1;...)
948  } // for (int phi=0;...)
949  } // for (int eta=0;...)
950  } // for (unsigned int depth=0;...)
952 
953  if (!makeDiagnostics_) return;
954  for (int i=0;i<500;++i)
955  {
957  hbVsNeighbor[i]=0;
959  heVsNeighbor[i]=0;
961  hoVsNeighbor[i]=0;
963  hfVsNeighbor[i]=0;
964  }
965 
966  return;
967 
968 } // void HcalHotCellMonitor::fillNevents_neighbor(void)
969 
970 
971 
972 
973 
974 
976 {
977  if (debug_>0)
978  std::cout <<"<HcalHotCellMonitor::fillNevents_problemCells> FILLING PROBLEM CELL PLOTS"<<std::endl;
979 
980  if (ievt_==0) return; // no events; no need to bother with this
981 
982  int ieta=0;
983  int etabins=0;
984  int phibins=0;
985  bool problemvalue=false;
986 
987  // Count problem cells in each subdetector
988  int NumBadHB=0;
989  int NumBadHE=0;
990  int NumBadHO=0;
991  int NumBadHF=0;
992  int NumBadHO0=0;
993  int NumBadHO12=0;
994  int NumBadHFLUMI=0;
995 
996  unsigned int DEPTH = 0;
997 
998  if (test_persistent_)
999  {
1000  if (test_energy_)
1002  else if (test_et_)
1004  }
1005  else if (test_energy_ && DEPTH==0) DEPTH = AboveEnergyThresholdCellsByDepth.depth.size();
1006  else if (test_et_ && DEPTH==0) DEPTH = AboveETThresholdCellsByDepth.depth.size();
1007  else if (test_neighbor_ && DEPTH==0) DEPTH = AboveNeighborsHotCellsByDepth.depth.size();
1008 
1009  if (DEPTH==0) return;
1010 
1011  for (unsigned int depth=0;depth<DEPTH;++depth)
1012  {
1013  if (test_persistent_)
1014  {
1015  if (test_energy_)
1016  {
1017  etabins=AbovePersistentThresholdCellsByDepth.depth[depth]->getNbinsX();
1018  phibins=AbovePersistentThresholdCellsByDepth.depth[depth]->getNbinsY();
1019  }
1020  else if (test_et_)
1021  {
1022  etabins=AbovePersistentETThresholdCellsByDepth.depth[depth]->getNbinsX();
1023  phibins=AbovePersistentETThresholdCellsByDepth.depth[depth]->getNbinsY();
1024  }
1025  }
1026 
1027  if (test_neighbor_ && (etabins==0 || phibins==0))
1028  {
1029  etabins=AboveNeighborsHotCellsByDepth.depth[depth]->getNbinsX();
1030  phibins=AboveNeighborsHotCellsByDepth.depth[depth]->getNbinsY();
1031  }
1032 
1033  if (test_energy_ && (etabins==0 || phibins==0))
1034  {
1035  etabins=AboveEnergyThresholdCellsByDepth.depth[depth]->getNbinsX();
1036  phibins=AboveEnergyThresholdCellsByDepth.depth[depth]->getNbinsY();
1037  }
1038 
1039  if (test_et_ && (etabins==0 || phibins==0))
1040  {
1041  etabins=AboveETThresholdCellsByDepth.depth[depth]->getNbinsX();
1042  phibins=AboveETThresholdCellsByDepth.depth[depth]->getNbinsY();
1043  }
1044 
1045  for (int eta=0;eta<etabins;++eta)
1046  {
1047  ieta=CalcIeta(eta,depth+1);
1048  if (ieta==-9999) continue;
1049  for (int phi=0;phi<phibins;++phi)
1050  {
1051  if (abs(ieta)>20 && phi%2==1) continue; //skip non-physical cells
1052  else if (abs(ieta)>39 && (phi+1)%4!=3) continue;
1053  // find problem rate for particular cell
1054  problemvalue=false;
1056  problemvalue=true;
1057  if (test_neighbor_ && AboveNeighborsHotCellsByDepth.depth[depth]->getBinContent(eta+1,phi+1)>minErrorFlag_*ievt_)
1058  problemvalue=true;
1059  if (test_energy_ && AboveEnergyThresholdCellsByDepth.depth[depth]->getBinContent(eta+1,phi+1)>minErrorFlag_*ievt_)
1060  problemvalue=true;
1061  if (test_et_ && AboveETThresholdCellsByDepth.depth[depth]->getBinContent(eta+1,phi+1)>minErrorFlag_*ievt_)
1062  problemvalue=true;
1064  problemvalue=true;
1065  if (problemvalue==false) continue;
1066  if (isHB(eta,depth+1)) ++NumBadHB;
1067  else if (isHE(eta,depth+1))
1068  ++NumBadHE;
1069  else if (isHO(eta,depth+1))
1070  {
1071  ++NumBadHO;
1072  if (abs(ieta)<5) ++NumBadHO0;
1073  else ++NumBadHO12;
1074  }
1075  else if (isHF(eta,depth+1))
1076  {
1077  ++NumBadHF;
1078  if (depth+1==1 && (abs(ieta)==33 || abs(ieta)==34)) ++NumBadHFLUMI;
1079  else if (depth+1==2 && (abs(ieta)==35 || abs(ieta)==36)) ++NumBadHFLUMI;
1080  }
1081  } // for (int phi=0;...)
1082  } //for (int eta=0;...)
1083  } // for (int depth=0;...)
1084 
1085  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;
1086  // Fill number of problem cells
1087  ProblemsVsLB_HB->Fill(currentLS,NumBadHB);
1088  ProblemsVsLB_HE->Fill(currentLS,NumBadHE);
1089  ProblemsVsLB_HO->Fill(currentLS,NumBadHO);
1090  ProblemsVsLB_HF->Fill(currentLS,NumBadHF);
1091  ProblemsVsLB_HBHEHF->Fill(currentLS,NumBadHB+NumBadHE+NumBadHF);
1092  ProblemsVsLB->Fill(currentLS,NumBadHB+NumBadHE+NumBadHO+NumBadHF);
1093 
1094  ProblemsCurrentLB->Fill(-1,-1,levt_);
1095  ProblemsCurrentLB->Fill(0,0,NumBadHB);
1096  ProblemsCurrentLB->Fill(1,0,NumBadHE);
1097  ProblemsCurrentLB->Fill(2,0,NumBadHO);
1098  ProblemsCurrentLB->Fill(3,0,NumBadHF);
1099  ProblemsCurrentLB->Fill(4,0,NumBadHO0);
1100  ProblemsCurrentLB->Fill(5,0,NumBadHO12);
1101  ProblemsCurrentLB->Fill(6,0,NumBadHFLUMI);
1102 
1103 } // void HcalHotCellMonitor::fillNevents_problemCells(void)
1104 
1105 
1107 {
1108 
1109  // zero all counters
1110  for (int i=0;i<85;++i)
1111  {
1112  for (int j=0;j<72;++j)
1113  {
1114  for (int k=0;k<4;++k)
1115  {
1116  abovepersistent[i][j][k]=0;
1117  abovepersistentET[i][j][k]=0;
1118  aboveneighbors[i][j][k]=0;
1119  aboveenergy[i][j][k]=0;
1120  aboveet[i][j][k]=0;
1121  rechit_occupancy_sum[i][j][k]=0;
1122  }
1123  }
1124  }
1125 
1126  for (int i=0;i<500;++i)
1127  {
1128  hbVsNeighbor[i]=0;
1129  heVsNeighbor[i]=0;
1130  hoVsNeighbor[i]=0;
1131  hfVsNeighbor[i]=0;
1132  }
1133  return;
1134 
1135 } // void HcalHotCellMonitor::zeroCounters()
1136 
1138 {
1139  // Anything to do here?
1140 }
1141 
1143 {
1144  if (debug_>0) std::cout <<"HcalHotCellMonitor::endJob()"<<std::endl;
1145  if (enableCleanup_) cleanup(); // when do we force cleanup?
1146 }
1147 
1149 {
1150  if (debug_>0) std::cout <<"HcalHotCellMonitor::cleanup()"<<std::endl;
1151  if (!enableCleanup_) return;
1152  if (dbe_)
1153  {
1154  // removeContents doesn't remove subdirectories
1156  dbe_->removeContents();
1157  dbe_->setCurrentFolder(subdir_+"hot_rechit_above_threshold");
1158  dbe_->removeContents();
1159  dbe_->setCurrentFolder(subdir_+"hot_rechit_always_above_threshold");
1160  dbe_->removeContents();
1161  dbe_->setCurrentFolder(subdir_+"hot_neighbortest");
1162  dbe_->removeContents();
1163  dbe_->setCurrentFolder(subdir_+"LSvalues");
1164  dbe_->removeContents();
1165  }
1166 } // cleanup
1167 
1169 {
1170 
1171  // first reset base class objects
1172  //FIX HcalBaseMonitor::periodicReset();
1173 
1174  // then reset the temporary histograms
1175  zeroCounters();
1176 
1177  // now reset all the MonitorElements
1178 
1179  // resetting eta-phi histograms
1180  if (test_neighbor_)
1184  if (test_et_ || makeDiagnostics_)
1186  if (test_persistent_)
1187  {
1189  if (test_et_)
1191  }
1192  return;
1193 }
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:954
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:891
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:3135
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_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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:1268
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)
JetCorrectorParametersCollection coll
Definition: classes.h:10
static const double theHFEtaBounds[]
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
TString units(TString variable, Char_t axis)
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:861
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:667
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