00001 #include "Geometry/HcalTowerAlgo/src/HcalHardcodeGeometryData.h"
00002 #include "DQM/HcalMonitorTasks/interface/HcalHotCellMonitor.h"
00003 #include "FWCore/Framework/interface/LuminosityBlock.h"
00004
00005 HcalHotCellMonitor::HcalHotCellMonitor(const edm::ParameterSet& ps)
00006 {
00007
00008 Online_ = ps.getUntrackedParameter<bool>("online",false);
00009 mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns",false);
00010 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
00011 debug_ = ps.getUntrackedParameter<int>("debug",0);
00012 makeDiagnostics_ = ps.getUntrackedParameter<bool>("makeDiagnostics",false);
00013 prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
00014 if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
00015 prefixME_.append("/");
00016 subdir_ = ps.getUntrackedParameter<std::string>("TaskFolder","HotCellMonitor_Hcal/");
00017 if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
00018 subdir_.append("/");
00019 subdir_=prefixME_+subdir_;
00020 AllowedCalibTypes_ = ps.getUntrackedParameter<std::vector<int> > ("AllowedCalibTypes");
00021 skipOutOfOrderLS_ = ps.getUntrackedParameter<bool>("skipOutOfOrderLS",true);
00022 NLumiBlocks_ = ps.getUntrackedParameter<int>("NLumiBlocks",4000);
00023
00024
00025 hbheRechitLabel_ = ps.getUntrackedParameter<edm::InputTag>("hbheRechitLabel");
00026 hoRechitLabel_ = ps.getUntrackedParameter<edm::InputTag>("hoRechitLabel");
00027 hfRechitLabel_ = ps.getUntrackedParameter<edm::InputTag>("hfRechitLabel");
00028
00029
00030 minEvents_ = ps.getUntrackedParameter<int>("minEvents");
00031 minErrorFlag_ = ps.getUntrackedParameter<double>("minErrorFlag",1);
00032
00033
00034 excludeHORing2_ = ps.getUntrackedParameter<bool>("excludeHORing2",false);
00035
00036
00037
00038 test_persistent_ = ps.getUntrackedParameter<bool>("test_persistent");
00039 test_neighbor_ = ps.getUntrackedParameter<bool>("test_neighbor");
00040 test_energy_ = ps.getUntrackedParameter<bool>("test_energy");
00041 test_et_ = ps.getUntrackedParameter<bool>("test_et");
00042
00043
00044
00045 energyThreshold_ = ps.getUntrackedParameter<double>("energyThreshold");
00046 ETThreshold_ = ps.getUntrackedParameter<double>("ETThreshold");
00047
00048 HBenergyThreshold_ = ps.getUntrackedParameter<double>("energyThreshold_HB",energyThreshold_);
00049 HEenergyThreshold_ = ps.getUntrackedParameter<double>("energyThreshold_HE",energyThreshold_);
00050 HOenergyThreshold_ = ps.getUntrackedParameter<double>("energyThreshold_HO",energyThreshold_);
00051 HFenergyThreshold_ = ps.getUntrackedParameter<double>("energyThreshold_HF",energyThreshold_);
00052
00053 HBETThreshold_ = ps.getUntrackedParameter<double>("ETThreshold_HB",ETThreshold_);
00054 HEETThreshold_ = ps.getUntrackedParameter<double>("ETThreshold_HE",ETThreshold_);
00055 HOETThreshold_ = ps.getUntrackedParameter<double>("ETThreshold_HO",ETThreshold_);
00056 HFETThreshold_ = ps.getUntrackedParameter<double>("ETThreshold_HF",ETThreshold_);
00057
00058
00059 persistentThreshold_ = ps.getUntrackedParameter<double>("persistentThreshold");
00060
00061 HBpersistentThreshold_ = ps.getUntrackedParameter<double>("persistentThreshold_HB",persistentThreshold_);
00062 HEpersistentThreshold_ = ps.getUntrackedParameter<double>("persistentThreshold_HE",persistentThreshold_);
00063 HOpersistentThreshold_ = ps.getUntrackedParameter<double>("persistentThreshold_HO",persistentThreshold_);
00064 HFpersistentThreshold_ = ps.getUntrackedParameter<double>("persistentThreshold_HF",persistentThreshold_);
00065
00066 persistentETThreshold_ = ps.getUntrackedParameter<double>("persistentETThreshold");
00067
00068 HBpersistentETThreshold_ = ps.getUntrackedParameter<double>("persistentETThreshold_HB",persistentETThreshold_);
00069 HEpersistentETThreshold_ = ps.getUntrackedParameter<double>("persistentETThreshold_HE",persistentETThreshold_);
00070 HOpersistentETThreshold_ = ps.getUntrackedParameter<double>("persistentETThreshold_HO",persistentETThreshold_);
00071 HFpersistentETThreshold_ = ps.getUntrackedParameter<double>("persistentETThreshold_HF",persistentETThreshold_);
00072
00073 HFfarfwdScale_ = ps.getUntrackedParameter<double>("HFfwdScale",2.);
00074 SiPMscale_ = ps.getUntrackedParameter<double>("HO_SiPMscalefactor",1.);
00075
00076
00077 HBHENeighborParams_.DeltaIphi = ps.getUntrackedParameter<int>("HBHE_neighbor_deltaIphi", 1);
00078 HBHENeighborParams_.DeltaIeta = ps.getUntrackedParameter<int>("HBHE_neighbor_deltaIeta", 1);
00079 HBHENeighborParams_.DeltaDepth = ps.getUntrackedParameter<int>("HBHE_neighbor_deltaDepth", 2);
00080 HBHENeighborParams_.minCellEnergy = ps.getUntrackedParameter<double>("HBHE_neighbor_minCellEnergy",3.);
00081 HBHENeighborParams_.minNeighborEnergy = ps.getUntrackedParameter<double>("HBHE_neighbor_minNeighborEnergy",0.);
00082 HBHENeighborParams_.maxEnergy = ps.getUntrackedParameter<double>("HBHE_neighbor_maxEnergy",100);
00083 HBHENeighborParams_.HotEnergyFrac = ps.getUntrackedParameter<double>("HBHE_neighbor_HotEnergyFrac",0.05);
00084
00085 HONeighborParams_.DeltaIphi = ps.getUntrackedParameter<int>("HO_neighbor_deltaIphi", 1);
00086 HONeighborParams_.DeltaIeta = ps.getUntrackedParameter<int>("HO_neighbor_deltaIeta", 1);
00087 HONeighborParams_.DeltaDepth = ps.getUntrackedParameter<int>("HO_neighbor_deltaDepth", 0);
00088 HONeighborParams_.minCellEnergy = ps.getUntrackedParameter<double>("HO_neighbor_minCellEnergy",10.);
00089 HONeighborParams_.minNeighborEnergy = ps.getUntrackedParameter<double>("HO_neighbor_minNeighborEnergy",0.);
00090 HONeighborParams_.maxEnergy = ps.getUntrackedParameter<double>("HO_neighbor_maxEnergy",100);
00091 HONeighborParams_.HotEnergyFrac = ps.getUntrackedParameter<double>("HO_neighbor_HotEnergyFrac",0.01);
00092
00093 HFNeighborParams_.DeltaIphi = ps.getUntrackedParameter<int>("HF_neighbor_deltaIphi", 1);
00094 HFNeighborParams_.DeltaIeta = ps.getUntrackedParameter<int>("HF_neighbor_deltaIeta", 1);
00095 HFNeighborParams_.DeltaDepth = ps.getUntrackedParameter<int>("HF_neighbor_deltaDepth", 1);
00096 HFNeighborParams_.minCellEnergy = ps.getUntrackedParameter<double>("HF_neighbor_minCellEnergy",10.);
00097 HFNeighborParams_.minNeighborEnergy = ps.getUntrackedParameter<double>("HF_neighbor_minNeighborEnergy",0.);
00098 HFNeighborParams_.maxEnergy = ps.getUntrackedParameter<double>("HF_neighbor_maxEnergy",100);
00099 HFNeighborParams_.HotEnergyFrac = ps.getUntrackedParameter<double>("HF_neighbor_HotEnergyFrac",0.01);
00100 setupDone_=false;
00101 }
00102
00103 HcalHotCellMonitor::~HcalHotCellMonitor()
00104 {
00105 }
00106
00107
00108
00109
00110 void HcalHotCellMonitor::setup()
00111 {
00112 if (setupDone_)
00113 return;
00114 setupDone_ = true;
00115
00116 HcalBaseDQMonitor::setup();
00117
00118 if (debug_>1)
00119 std::cout <<"<HcalHotCellMonitor::setup> Setting up histograms"<<std::endl;
00120
00121 dbe_->setCurrentFolder(subdir_);
00122
00123 MonitorElement* me;
00124 me=dbe_->bookFloat("minErrorFractionPerLumiSection");
00125 me->Fill(minErrorFlag_);
00126
00127
00128
00129 ProblemsVsLB=dbe_->bookProfile("TotalHotCells_HCAL_vs_LS",
00130 "Total Number of Hot Hcal Cells vs lumi section",
00131 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00132
00133 ProblemsVsLB_HB=dbe_->bookProfile("TotalHotCells_HB_vs_LS",
00134 "Total Number of Hot HB Cells vs lumi section",
00135 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,3000);
00136 ProblemsVsLB_HE=dbe_->bookProfile("TotalHotCells_HE_vs_LS",
00137 "Total Number of Hot HE Cells vs lumi section",
00138 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,3000);
00139 ProblemsVsLB_HO=dbe_->bookProfile("TotalHotCells_HO_vs_LS",
00140 "Total Number of Hot HO Cells vs lumi section",
00141 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,3000);
00142 ProblemsVsLB_HF=dbe_->bookProfile("TotalHotCells_HF_vs_LS",
00143 "Total Number of Hot HF Cells vs lumi section",
00144 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,2000);
00145 ProblemsVsLB_HBHEHF=dbe_->bookProfile("TotalHotCells_HBHEHF_vs_LS",
00146 "Total Number of Hot HBHEHF Cells vs lumi section",
00147 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,2000);
00148
00149 ProblemsVsLB->getTProfile()->SetMarkerStyle(20);
00150 ProblemsVsLB_HB->getTProfile()->SetMarkerStyle(20);
00151 ProblemsVsLB_HE->getTProfile()->SetMarkerStyle(20);
00152 ProblemsVsLB_HO->getTProfile()->SetMarkerStyle(20);
00153 ProblemsVsLB_HF->getTProfile()->SetMarkerStyle(20);
00154 ProblemsVsLB_HBHEHF->getTProfile()->SetMarkerStyle(20);
00155
00156
00157 std::stringstream units;
00158
00159 dbe_->setCurrentFolder(subdir_+"hot_rechit_above_threshold");
00160 me=dbe_->bookInt("HotCellAboveThresholdTestEnabled");
00161 me->Fill(0);
00162
00163 if (test_energy_)
00164 {
00165 me->Fill(1);
00166 SetupEtaPhiHists(AboveEnergyThresholdCellsByDepth,
00167 "Hot Cells Above Energy Threshold","");
00168
00169
00170
00171 units.str("");
00172 units<<"Hot Cells: Depth 1 -- HB > "<<HBenergyThreshold_<<" GeV, HE > "<<HEenergyThreshold_<<" GeV, HF > "<<HFenergyThreshold_<<" GeV";
00173 AboveEnergyThresholdCellsByDepth.depth[0]->setTitle(units.str().c_str());
00174 units.str("");
00175 units<<"Hot Cells: Depth 2 -- HB > "<<HBenergyThreshold_<<" GeV, HE > "<<HEenergyThreshold_<<" GeV, HF > "<<HFenergyThreshold_<<" GeV";
00176 AboveEnergyThresholdCellsByDepth.depth[1]->setTitle(units.str().c_str());
00177 units.str("");
00178 units<<"Hot Cells: Depth 3 -- HE > "<<HEenergyThreshold_<<" GeV";
00179 AboveEnergyThresholdCellsByDepth.depth[2]->setTitle(units.str().c_str());
00180 units.str("");
00181 units<<"Hot Cells: HO > "<<HOenergyThreshold_<<" GeV";
00182 AboveEnergyThresholdCellsByDepth.depth[3]->setTitle(units.str().c_str());
00183 units.str("");
00184 }
00185 if (test_et_)
00186 {
00187 me->Fill(1);
00188 SetupEtaPhiHists(AboveETThresholdCellsByDepth,
00189 "Hot Cells Above ET Threshold","");
00190
00191
00192
00193 units.str("");
00194 units<<"Hot Cells: Depth 1 -- HB > "<<HBETThreshold_<<" GeV (ET), HE > "<<HEETThreshold_<<" GeV (ET), HF > "<<HFETThreshold_<<" GeV (ET)";
00195 AboveETThresholdCellsByDepth.depth[0]->setTitle(units.str().c_str());
00196 units.str("");
00197 units<<"Hot Cells: Depth 2 -- HB > "<<HBETThreshold_<<" GeV (ET), HE > "<<HEETThreshold_<<" GeV (ET), HF > "<<HFETThreshold_<<" GeV (ET)";
00198 AboveETThresholdCellsByDepth.depth[1]->setTitle(units.str().c_str());
00199 units.str("");
00200 units<<"Hot Cells: Depth 3 -- HE > "<<HEETThreshold_<<" GeV (ET)";
00201 AboveETThresholdCellsByDepth.depth[2]->setTitle(units.str().c_str());
00202 units.str("");
00203 units<<"Hot Cells: HO > "<<HOETThreshold_<<" GeV (ET)";
00204 AboveETThresholdCellsByDepth.depth[3]->setTitle(units.str().c_str());
00205 units.str("");
00206 }
00207
00208 dbe_->setCurrentFolder(subdir_+"hot_rechit_always_above_threshold");
00209 me=dbe_->bookInt("PersistentHotCellTestEnabled");
00210 me->Fill(0);
00211 if (test_persistent_)
00212 {
00213 me->Fill(1);
00214 me=dbe_->bookInt("minEventsPerLS");
00215 me->Fill(minEvents_);
00216
00217 if (test_energy_) {
00218 SetupEtaPhiHists(AbovePersistentThresholdCellsByDepth,
00219 "Hot Cells Persistently Above Energy Threshold","");
00220
00221
00222
00223 units.str("");
00224 units<<"Hot Cells: Depth 1 -- HB > "<<HBpersistentThreshold_<<" GeV, HE > "<<HEpersistentThreshold_<<", HF > "<<HFpersistentThreshold_<<" GeV for 1 full Lumi Block";
00225 AbovePersistentThresholdCellsByDepth.depth[0]->setTitle(units.str().c_str());
00226 units.str("");
00227 units<<"Hot Cells: Depth 2 -- HB > "<<HBpersistentThreshold_<<" GeV, HE > "<<HEpersistentThreshold_<<", HF > "<<HFpersistentThreshold_<<" GeV for 1 full Lumi Block";
00228 AbovePersistentThresholdCellsByDepth.depth[1]->setTitle(units.str().c_str());
00229 units.str("");
00230 units<<"Hot Cells: Depth 3 -- HE > "<<HEpersistentThreshold_<<" GeV for 1 full Lumi Block";
00231 AbovePersistentThresholdCellsByDepth.depth[2]->setTitle(units.str().c_str());
00232 units.str("");
00233 units<<"Hot Cells: HO > "<<HOpersistentThreshold_<<" GeV for 1 full Lumi Block";
00234 AbovePersistentThresholdCellsByDepth.depth[3]->setTitle(units.str().c_str());
00235 units.str("");
00236 }
00237
00238 if (test_et_) {
00239 SetupEtaPhiHists(AbovePersistentETThresholdCellsByDepth,
00240 "Hot Cells Persistently Above ET Threshold","");
00241
00242
00243
00244 units.str("");
00245 units<<"Hot Cells: Depth 1 -- HB > "<<HBpersistentETThreshold_<<" GeV (ET), HE > "<<HEpersistentETThreshold_<<" GeV (ET), HF > "<<HFpersistentETThreshold_<<" GeV (ET) for 1 full Lumi Block";
00246 AbovePersistentETThresholdCellsByDepth.depth[0]->setTitle(units.str().c_str());
00247 units.str("");
00248 units<<"Hot Cells: Depth 2 -- HB > "<<HBpersistentETThreshold_<<" GeV (ET), HE > "<<HEpersistentETThreshold_<<" GeV (ET), HF > "<<HFpersistentETThreshold_<<" GeV (ET) for 1 full Lumi Block";
00249 AbovePersistentETThresholdCellsByDepth.depth[1]->setTitle(units.str().c_str());
00250 units.str("");
00251 units<<"Hot Cells: Depth 3 -- HE > "<<HEpersistentETThreshold_<<" GeV (ET) for 1 full Lumi Block";
00252 AbovePersistentETThresholdCellsByDepth.depth[2]->setTitle(units.str().c_str());
00253 units.str("");
00254 units<<"Hot Cells: HO > "<<HOpersistentETThreshold_<<" GeV (ET) for 1 full Lumi Block";
00255 AbovePersistentETThresholdCellsByDepth.depth[3]->setTitle(units.str().c_str());
00256 units.str("");
00257 }
00258 }
00259
00260 dbe_->setCurrentFolder(subdir_+"hot_neighbortest");
00261 me=dbe_->bookInt("NeighborTestEnabled");
00262 me->Fill(0);
00263 if (test_neighbor_)
00264 me->Fill(1);
00265 if (test_neighbor_ || makeDiagnostics_)
00266 {
00267 SetupEtaPhiHists(AboveNeighborsHotCellsByDepth,"Hot Cells Failing Neighbor Test","");
00268 if (makeDiagnostics_)
00269 {
00270 d_HBenergyVsNeighbor=dbe_->book1D("NeighborSumOverEnergyHB","HB Neighbor Sum Energy/Cell Energy;sum(neighbors)/E_cell",500,0,10);
00271 d_HEenergyVsNeighbor=dbe_->book1D("NeighborSumOverEnergyHE","HE Neighbor Sum Energy/Cell Energy;sum(neighbors)/E_cell",500,0,10);
00272 d_HOenergyVsNeighbor=dbe_->book1D("NeighborSumOverEnergyHO","HO Neighbor Sum Energy/Cell Energy;sum(neighbors)/E_cell",500,0,10);
00273 d_HFenergyVsNeighbor=dbe_->book1D("NeighborSumOverEnergyHF","HF Neighbor Sum Energy/Cell Energy;sum(neighbors)/E_cell",500,0,10);
00274 }
00275 }
00276
00277 this->reset();
00278 }
00279
00280 void HcalHotCellMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c)
00281 {
00282 if (debug_>1) std::cout <<"HcalHotCellMonitor::beginRun"<<std::endl;
00283 HcalBaseDQMonitor::beginRun(run,c);
00284
00285 if (tevt_==0) this->setup();
00286 if (mergeRuns_==false)
00287 this->reset();
00288
00289 return;
00290 }
00291
00292
00293
00294
00295 void HcalHotCellMonitor::reset()
00296 {
00297 HcalBaseDQMonitor::reset();
00298 zeroCounters();
00299
00300
00301
00302
00303 if (test_neighbor_ || makeDiagnostics_)
00304 AboveNeighborsHotCellsByDepth.Reset();
00305
00306 if (test_energy_ )
00307 AboveEnergyThresholdCellsByDepth.Reset();
00308
00309 if ( test_et_ )
00310 AboveETThresholdCellsByDepth.Reset();
00311
00312 if (test_persistent_)
00313 {
00314 if (test_energy_) AbovePersistentThresholdCellsByDepth.Reset();
00315 if (test_et_) AbovePersistentETThresholdCellsByDepth.Reset();
00316 }
00317 if (makeDiagnostics_)
00318 {
00319 d_HBenergyVsNeighbor->Reset();
00320 d_HEenergyVsNeighbor->Reset();
00321 d_HOenergyVsNeighbor->Reset();
00322 d_HFenergyVsNeighbor->Reset();
00323 }
00324 }
00325
00326
00327
00328 void HcalHotCellMonitor::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
00329 const edm::EventSetup& c)
00330 {
00331 if (LumiInOrder(lumiSeg.luminosityBlock())==false) return;
00332 HcalBaseDQMonitor::beginLuminosityBlock(lumiSeg,c);
00333 zeroCounters();
00334 ProblemsCurrentLB->Reset();
00335 return;
00336 }
00337
00338
00339 void HcalHotCellMonitor::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
00340 const edm::EventSetup& c)
00341 {
00342
00343
00344 if (LumiInOrder(lumiSeg.luminosityBlock())==false) return;
00345
00346 if (test_neighbor_ || makeDiagnostics_)
00347 fillNevents_neighbor();
00348
00349 if (test_energy_ || test_et_)
00350 fillNevents_energy();
00351
00352 if (test_persistent_)
00353 fillNevents_persistentenergy();
00354
00355 fillNevents_problemCells();
00356 return;
00357 }
00358
00359
00360
00361
00362
00363 void HcalHotCellMonitor::done()
00364 {
00365
00366 return;
00367
00368 }
00369
00370
00371 void HcalHotCellMonitor::analyze(edm::Event const&e, edm::EventSetup const&s)
00372 {
00373
00374 if (!IsAllowedCalibType()) return;
00375 if (LumiInOrder(e.luminosityBlock())==false) return;
00376
00377
00378 edm::Handle<HBHERecHitCollection> hbhe_rechit;
00379 edm::Handle<HORecHitCollection> ho_rechit;
00380 edm::Handle<HFRecHitCollection> hf_rechit;
00381
00382 if (!(e.getByLabel(hbheRechitLabel_,hbhe_rechit)))
00383 {
00384 edm::LogWarning("HcalHotCellMonitor")<< hbheRechitLabel_<<" hbhe_rechit not available";
00385 return;
00386 }
00387
00388 if (!(e.getByLabel(hfRechitLabel_,hf_rechit)))
00389 {
00390 edm::LogWarning("HcalHotCellMonitor")<< hfRechitLabel_<<" hf_rechit not available";
00391 return;
00392 }
00393 if (!(e.getByLabel(hoRechitLabel_,ho_rechit)))
00394 {
00395 edm::LogWarning("HcalHotCellMonitor")<< hoRechitLabel_<<" ho_rechit not available";
00396 return;
00397 }
00398
00399
00400
00401 HcalBaseDQMonitor::analyze(e,s);
00402 if (debug_>1) std::cout <<"\t<HcalHotCellMonitor::analyze> Processing good event! event # = "<<ievt_<<std::endl;
00403
00404 processEvent(*hbhe_rechit, *ho_rechit, *hf_rechit);
00405
00406 }
00407
00408
00409
00410
00411
00412
00413
00414 void HcalHotCellMonitor::processEvent(const HBHERecHitCollection& hbHits,
00415 const HORecHitCollection& hoHits,
00416 const HFRecHitCollection& hfHits
00417 )
00418 {
00419
00420 if (debug_>1) std::cout <<"<HcalHotCellMonitor::processEvent> Processing event..."<<std::endl;
00421
00422
00423 if (test_energy_ || test_et_ || test_persistent_)
00424 {
00425 processEvent_rechitenergy(hbHits, hoHits,hfHits);
00426 }
00427
00428 return;
00429 }
00430
00431
00432
00433
00434
00435 void HcalHotCellMonitor::processEvent_rechitenergy( const HBHERecHitCollection& hbheHits,
00436 const HORecHitCollection& hoHits,
00437 const HFRecHitCollection& hfHits)
00438
00439 {
00440
00441
00442
00443 if (debug_>1) std::cout <<"<HcalHotCellMonitor::processEvent_rechitenergy> Processing rechits..."<<std::endl;
00444
00445
00446 for (HBHERecHitCollection::const_iterator HBHEiter=hbheHits.begin(); HBHEiter!=hbheHits.end(); ++HBHEiter)
00447 {
00448 float en = HBHEiter->energy();
00449
00450
00451 HcalDetId id(HBHEiter->detid().rawId());
00452 int ieta = id.ieta();
00453 int iphi = id.iphi();
00454 int depth = id.depth();
00455 double fEta=fabs(0.5*(theHBHEEtaBounds[abs(ieta)-1]+theHBHEEtaBounds[abs(ieta)]));
00456 float et = en/cosh(fEta);
00457
00458 if (test_neighbor_ || makeDiagnostics_)
00459 {
00460 processHit_rechitNeighbors(HBHEiter, hbheHits, HBHENeighborParams_);
00461 }
00462 if (id.subdet()==HcalBarrel)
00463 {
00464 if (en>=HBenergyThreshold_)
00465 ++aboveenergy[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00466 if (et>=HBETThreshold_)
00467 ++aboveet[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00468 if (test_energy_ && en>=HBpersistentThreshold_)
00469 ++abovepersistent[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00470 if (test_et_ && et>=HBpersistentETThreshold_)
00471 ++abovepersistentET[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00472 }
00473 else if (id.subdet()==HcalEndcap)
00474 {
00475 if (en>=HEenergyThreshold_)
00476 ++aboveenergy[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00477 if (et>=HEETThreshold_)
00478 ++aboveet[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00479 if (test_energy_)
00480 if (en>=HEpersistentThreshold_)
00481 ++abovepersistent[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00482 if (test_et_)
00483 if (et>=HEpersistentETThreshold_)
00484 ++abovepersistentET[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00485 }
00486 }
00487
00488
00489 for (HORecHitCollection::const_iterator HOiter=hoHits.begin(); HOiter!=hoHits.end(); ++HOiter)
00490 {
00491 float en = HOiter->energy();
00492
00493 HcalDetId id(HOiter->detid().rawId());
00494 int ieta = id.ieta();
00495 int iphi = id.iphi();
00496 int depth = id.depth();
00497 double fEta=fabs(0.5*(theHBHEEtaBounds[abs(ieta)-1]+theHBHEEtaBounds[abs(ieta)]));
00498 float et = en/cosh(fEta);
00499
00500 if (test_neighbor_ || makeDiagnostics_)
00501 processHit_rechitNeighbors(HOiter, hoHits, HONeighborParams_);
00502
00503 if (isSiPM(ieta,iphi,depth))
00504 {
00505 if (en>=HOenergyThreshold_*SiPMscale_)
00506 ++aboveenergy[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00507 if (et>=HOETThreshold_*SiPMscale_)
00508 ++aboveet[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00509 if (test_energy_)
00510 if (en>=HOpersistentThreshold_*SiPMscale_)
00511 ++abovepersistent[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00512 if (test_et_)
00513 if (et>=HOpersistentETThreshold_*SiPMscale_)
00514 ++abovepersistentET[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00515 }
00516 else
00517 {
00518
00519 if (abs(ieta)>10 && excludeHORing2_==true)
00520 continue;
00521
00522 if (en>=HOenergyThreshold_)
00523 ++aboveenergy[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00524 if (et>=HOETThreshold_)
00525 ++aboveet[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00526 if (test_energy_)
00527 if (en>=HOpersistentThreshold_)
00528 ++abovepersistent[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00529 if (test_et_)
00530 if (en>=HOpersistentETThreshold_)
00531 ++abovepersistentET[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00532 }
00533 }
00534
00535
00536 for (HFRecHitCollection::const_iterator HFiter=hfHits.begin(); HFiter!=hfHits.end(); ++HFiter)
00537 {
00538 float en = HFiter->energy();
00539 float threshold=HFenergyThreshold_;
00540 float threshold_pers = HFpersistentThreshold_;
00541 float etthreshold=HFETThreshold_;
00542 HcalDetId id(HFiter->detid().rawId());
00543 int ieta = id.ieta();
00544 int iphi = id.iphi();
00545 int depth = id.depth();
00546 double fEta=fabs(0.5*(theHFEtaBounds[abs(ieta)-29]+theHFEtaBounds[abs(ieta)-28]));
00547 float et = en/cosh(fEta);
00548
00549 if (test_neighbor_ || makeDiagnostics_)
00550 processHit_rechitNeighbors(HFiter, hfHits, HFNeighborParams_);
00551
00552 if (abs(ieta)>39)
00553 {
00554 threshold*=HFfarfwdScale_;
00555 threshold_pers*=HFfarfwdScale_;
00556 }
00557
00558 if (en>=threshold)
00559 ++aboveenergy[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00560 if (et>=etthreshold)
00561 ++aboveet[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00562 if (test_energy_) {
00563 if (en>=threshold_pers)
00564 ++abovepersistent[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00565 }
00566 if (test_et_) {
00567 if (et>=HFpersistentETThreshold_)
00568 ++abovepersistentET[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00569 }
00570 }
00571
00572
00573
00574 for (unsigned int i=0;i<AbovePersistentThresholdCellsByDepth.depth.size();++i)
00575 AbovePersistentThresholdCellsByDepth.depth[i]->update();
00576 for (unsigned int i=0;i<AboveEnergyThresholdCellsByDepth.depth.size();++i)
00577 AboveEnergyThresholdCellsByDepth.depth[i]->update();
00578 for (unsigned int i=0;i<AboveETThresholdCellsByDepth.depth.size();++i)
00579 AboveETThresholdCellsByDepth.depth[i]->update();
00580 for (unsigned int i=0;i<AboveNeighborsHotCellsByDepth.depth.size();++i)
00581 AboveNeighborsHotCellsByDepth.depth[i]->update();
00582
00583 return;
00584 }
00585
00586
00587
00588
00589 template <class RECHIT, class RECHITCOLLECTION>
00590 void HcalHotCellMonitor::processHit_rechitNeighbors( RECHIT& rechit,
00591 RECHITCOLLECTION& coll,
00592 hotNeighborParams& params
00593 )
00594 {
00595
00596
00597
00598
00599
00600 int ieta, iphi, depth;
00601 float en;
00602
00603 int neighborsfound=0;
00604 float enNeighbor=0;
00605
00606 en = rechit->energy();
00607 HcalDetId id(rechit->detid().rawId());
00608 ieta = id.ieta();
00609 iphi = id.iphi();
00610 depth = id.depth();
00611
00612 double fEta=0;
00613 if (id.subdet()!=HcalForward)
00614 fEta=fabs(0.5*(theHBHEEtaBounds[abs(ieta)-1]+theHBHEEtaBounds[abs(ieta)]));
00615 else
00616 fEta=fabs(0.5*(theHFEtaBounds[abs(ieta)-29]+theHFEtaBounds[abs(ieta)-28]));
00617
00618 float et = en/cosh(fEta);
00619
00620
00621 if (et<=params.minCellEnergy) return;
00622
00623
00624 if (et>params.maxEnergy)
00625 {
00626 aboveneighbors[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00627 if (makeDiagnostics_)
00628 {
00629
00630 if (id.subdet()==HcalBarrel) d_HBenergyVsNeighbor->Fill(1000);
00631 else if (id.subdet()==HcalEndcap) d_HEenergyVsNeighbor->Fill(1000);
00632 else if (id.subdet()==HcalOuter) d_HOenergyVsNeighbor->Fill(1000);
00633 else if (id.subdet()==HcalForward) d_HFenergyVsNeighbor->Fill(1000);
00634 }
00635 return;
00636 }
00637
00638
00639
00640 neighborsfound=0;
00641 enNeighbor=0;
00642
00643 int mydeltaphi=params.DeltaIphi;
00644
00645 if (abs(ieta)>39) mydeltaphi*=4;
00646 else if (abs(ieta)>20) mydeltaphi*=2;
00647
00648 for (int nD=-1*params.DeltaDepth;nD<=params.DeltaDepth;++nD)
00649 {
00650 for (int nP =-1*mydeltaphi;nP<=mydeltaphi;++nP)
00651 {
00652 for (int nE =-1*params.DeltaIeta;nE<=params.DeltaIeta;++nE)
00653 {
00654 if (nD==0 && nE==0 && nP==0)
00655 continue;
00656 int myphi=(nP+iphi)%72;
00657 HcalDetId myid((HcalSubdetector)(1), nE+ieta, myphi, nD+depth);
00658 RECHIT part=coll.find(myid);
00659 if (part==coll.end())
00660 continue;
00661 if (part->energy()<params.minNeighborEnergy)
00662 continue;
00663 ++neighborsfound;
00664 enNeighbor+=part->energy();
00665 }
00666 }
00667 }
00668
00669
00670
00671
00672
00673
00674 if (makeDiagnostics_)
00675 {
00676 int myval=(int)(enNeighbor/en*50);
00677 if (myval<0) myval=0;
00678 if (myval>499) myval=499;
00679 if (enNeighbor/en<0 || enNeighbor/en>=10) return;
00680 if (id.subdet()==HcalBarrel) ++hbVsNeighbor[myval];
00681 else if (id.subdet()==HcalEndcap) ++heVsNeighbor[myval];
00682 else if (id.subdet()==HcalOuter) ++hoVsNeighbor[myval];
00683 else if (id.subdet()==HcalForward) ++hfVsNeighbor[myval];
00684 }
00685 if ((1.*enNeighbor/en)>params.HotEnergyFrac && en>0 && enNeighbor>0)
00686 return;
00687
00688
00689 aboveneighbors[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1]++;
00690
00691 return;
00692 }
00693
00694
00695
00696
00697
00698 void HcalHotCellMonitor::fillNevents_persistentenergy(void)
00699 {
00700
00701
00702 if (levt_<minEvents_) return;
00703
00704 if (debug_>0)
00705 std::cout <<"<HcalHotCellMonitor::fillNevents_persistentenergy> FILLING PERSISTENT ENERGY PLOTS"<<std::endl;
00706
00707 if (test_energy_)
00708 {
00709 for (unsigned int h=0;h<AbovePersistentThresholdCellsByDepth.depth.size();++h)
00710 AbovePersistentThresholdCellsByDepth.depth[h]->setBinContent(0,0,ievt_);
00711
00712 int ieta=0;
00713 int iphi=0;
00714 int etabins=0;
00715 int phibins=0;
00716
00717 for (unsigned int depth=0;depth<AbovePersistentThresholdCellsByDepth.depth.size();++depth)
00718 {
00719 etabins=AbovePersistentThresholdCellsByDepth.depth[depth]->getNbinsX();
00720 phibins=AbovePersistentThresholdCellsByDepth.depth[depth]->getNbinsY();
00721
00722 for (int eta=0;eta<etabins;++eta)
00723 {
00724 for (int phi=0;phi<phibins;++phi)
00725 {
00726 iphi=phi+1;
00727 for (int subdet=1;subdet<=4;++subdet)
00728 {
00729 ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
00730 if (ieta==-9999) continue;
00731 if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
00732 continue;
00733 if (subdet==HcalForward)
00734 ieta<0 ? ieta-- : ieta++;
00735
00736
00737 if (abovepersistent[eta][phi][depth]<levt_)
00738 {
00739 abovepersistent[eta][phi][depth]=0;
00740 continue;
00741 }
00742 if (debug_>0) std::cout <<"HOT CELL; PERSISTENT ENERGY at subdet = "<<subdet<<", eta = "<<ieta<<", phi = "<<iphi<<" depth = "<<depth<<std::endl;
00743 AbovePersistentThresholdCellsByDepth.depth[depth]->Fill(ieta,iphi,abovepersistent[eta][phi][depth]);
00744 AbovePersistentThresholdCellsByDepth.depth[depth]->setBinContent(0,0,ievt_);
00745 abovepersistent[eta][phi][depth]=0;
00746 }
00747 }
00748 }
00749 }
00750 FillUnphysicalHEHFBins(AbovePersistentThresholdCellsByDepth);
00751 }
00752
00753 if (test_et_)
00754 {
00755 for (unsigned int h=0;h<AbovePersistentETThresholdCellsByDepth.depth.size();++h)
00756 AbovePersistentETThresholdCellsByDepth.depth[h]->setBinContent(0,0,ievt_);
00757
00758 int ieta=0;
00759 int iphi=0;
00760 int etabins=0;
00761 int phibins=0;
00762
00763 for (unsigned int depth=0;depth<AbovePersistentETThresholdCellsByDepth.depth.size();++depth)
00764 {
00765 etabins=AbovePersistentETThresholdCellsByDepth.depth[depth]->getNbinsX();
00766 phibins=AbovePersistentETThresholdCellsByDepth.depth[depth]->getNbinsY();
00767
00768 for (int eta=0;eta<etabins;++eta)
00769 {
00770 for (int phi=0;phi<phibins;++phi)
00771 {
00772 iphi=phi+1;
00773 for (int subdet=1;subdet<=4;++subdet)
00774 {
00775 ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
00776 if (ieta==-9999) continue;
00777 if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
00778 continue;
00779 if (subdet==HcalForward)
00780 ieta<0 ? ieta-- : ieta++;
00781
00782
00783 if (abovepersistentET[eta][phi][depth]<levt_)
00784 {
00785 abovepersistentET[eta][phi][depth]=0;
00786 continue;
00787 }
00788 if (debug_>0) std::cout <<"HOT CELL; PERSISTENT ENERGY at subdet = "<<subdet<<", eta = "<<ieta<<", phi = "<<iphi<<" depth = "<<depth<<std::endl;
00789 AbovePersistentETThresholdCellsByDepth.depth[depth]->Fill(ieta,iphi,abovepersistentET[eta][phi][depth]);
00790 AbovePersistentETThresholdCellsByDepth.depth[depth]->setBinContent(0,0,ievt_);
00791 abovepersistentET[eta][phi][depth]=0;
00792 }
00793 }
00794 }
00795 }
00796 FillUnphysicalHEHFBins(AbovePersistentETThresholdCellsByDepth);
00797
00798 }
00799
00800 return;
00801 }
00802
00803
00804
00805
00806
00807 void HcalHotCellMonitor::fillNevents_energy(void)
00808 {
00809
00810
00811
00812 if (debug_>0)
00813 std::cout <<"<HcalHotCellMonitor::fillNevents_energy> ABOVE-ENERGY-THRESHOLD PLOTS"<<std::endl;
00814
00815 if (test_energy_)
00816 {
00817 for (unsigned int h=0;h<AboveEnergyThresholdCellsByDepth.depth.size();++h)
00818 AboveEnergyThresholdCellsByDepth.depth[h]->setBinContent(0,0,ievt_);
00819 }
00820 if (test_et_)
00821 {
00822 for (unsigned int h=0;h<AboveETThresholdCellsByDepth.depth.size();++h)
00823 AboveETThresholdCellsByDepth.depth[h]->setBinContent(0,0,ievt_);
00824 }
00825
00826 int ieta=0;
00827 int iphi=0;
00828 int etabins=0;
00829 int phibins=0;
00830 unsigned int maxdepth=0;
00831
00832 if (test_energy_)
00833 maxdepth = AboveEnergyThresholdCellsByDepth.depth.size();
00834 if (maxdepth==0 && test_et_)
00835 maxdepth = AboveETThresholdCellsByDepth.depth.size();
00836 for (unsigned int depth=0;depth<maxdepth;++depth)
00837 {
00838 if (test_energy_)
00839 {
00840 etabins=AboveEnergyThresholdCellsByDepth.depth[depth]->getNbinsX();
00841 phibins=AboveEnergyThresholdCellsByDepth.depth[depth]->getNbinsY();
00842 }
00843 if (test_et_)
00844 {
00845 etabins=AboveETThresholdCellsByDepth.depth[depth]->getNbinsX();
00846 phibins=AboveETThresholdCellsByDepth.depth[depth]->getNbinsY();
00847 }
00848 for (int eta=0;eta<etabins;++eta)
00849 {
00850 for (int phi=0;phi<phibins;++phi)
00851 {
00852 iphi=phi+1;
00853 for (int subdet=1;subdet<=4;++subdet)
00854 {
00855 ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
00856 if (ieta==-9999) continue;
00857 if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
00858 continue;
00859 if (subdet==HcalForward)
00860 ieta<0 ? ieta-- : ieta++;
00861
00862 if (test_energy_)
00863 {
00864 if (aboveenergy[eta][phi][depth]>0)
00865 {
00866 if (debug_>2)
00867 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;
00868 AboveEnergyThresholdCellsByDepth.depth[depth]->Fill(ieta,iphi, aboveenergy[eta][phi][depth]);
00869 aboveenergy[eta][phi][depth]=0;
00870 }
00871 }
00872 if (test_et_)
00873 {
00874 if (aboveet[eta][phi][depth]>0)
00875 {
00876 if (debug_>2)
00877 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;
00878 AboveETThresholdCellsByDepth.depth[depth]->Fill(ieta,iphi, aboveet[eta][phi][depth]);
00879 aboveet[eta][phi][depth]=0;
00880 }
00881 }
00882 }
00883 }
00884 }
00885 }
00886
00887 if (test_energy_)
00888 FillUnphysicalHEHFBins(AboveEnergyThresholdCellsByDepth);
00889
00890 if (test_et_)
00891 FillUnphysicalHEHFBins(AboveETThresholdCellsByDepth);
00892
00893 return;
00894
00895
00896 }
00897
00898
00899
00900
00901
00902 void HcalHotCellMonitor::fillNevents_neighbor(void)
00903 {
00904
00905
00906 if (debug_>0)
00907 std::cout <<"<HcalHotCellMonitor::fillNevents_neighbor> FILLING ABOVE-NEIGHBOR-ENERGY PLOTS"<<std::endl;
00908
00909 for (unsigned int h=0;h<AboveNeighborsHotCellsByDepth.depth.size();++h)
00910 AboveNeighborsHotCellsByDepth.depth[h]->setBinContent(0,0,ievt_);
00911
00912 int ieta=0;
00913 int iphi=0;
00914 int etabins=0;
00915 int phibins=0;
00916
00917 for (unsigned int depth=0;depth<AboveNeighborsHotCellsByDepth.depth.size();++depth)
00918 {
00919 etabins=AboveNeighborsHotCellsByDepth.depth[depth]->getNbinsX();
00920 phibins=AboveNeighborsHotCellsByDepth.depth[depth]->getNbinsY();
00921
00922 for (int eta=0;eta<etabins;++eta)
00923 {
00924 for (int phi=0;phi<phibins;++phi)
00925 {
00926 iphi=phi+1;
00927 for (int subdet=1;subdet<=4;++subdet)
00928 {
00929 ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
00930 if (ieta==-9999) continue;
00931 if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
00932 continue;
00933 if (subdet==HcalForward)
00934 ieta<0 ? ieta-- : ieta++;
00935
00936 if (aboveneighbors[eta][phi][depth]>0)
00937 {
00938 if (debug_>2) std::cout <<"HOT CELL; ABOVE NEIGHBORS at eta = "<<ieta<<", phi = "<<iphi<<" depth = "<<(depth>4 ? depth+1 : depth-3)<<std::endl;
00939 AboveNeighborsHotCellsByDepth.depth[depth]->Fill(ieta,iphi,aboveneighbors[eta][phi][depth]);
00940
00941 aboveneighbors[eta][phi][depth]=0;
00942 }
00943 }
00944 }
00945 }
00946 }
00947 FillUnphysicalHEHFBins(AboveNeighborsHotCellsByDepth);
00948
00949 if (!makeDiagnostics_) return;
00950 for (int i=0;i<500;++i)
00951 {
00952 d_HBenergyVsNeighbor->Fill(i/50.,hbVsNeighbor[i]);
00953 hbVsNeighbor[i]=0;
00954 d_HEenergyVsNeighbor->Fill(i/50.,heVsNeighbor[i]);
00955 heVsNeighbor[i]=0;
00956 d_HOenergyVsNeighbor->Fill(i/50.,hoVsNeighbor[i]);
00957 hoVsNeighbor[i]=0;
00958 d_HFenergyVsNeighbor->Fill(i/50.,hfVsNeighbor[i]);
00959 hfVsNeighbor[i]=0;
00960 }
00961
00962 return;
00963
00964 }
00965
00966
00967
00968
00969
00970
00971 void HcalHotCellMonitor::fillNevents_problemCells(void)
00972 {
00973 if (debug_>0)
00974 std::cout <<"<HcalHotCellMonitor::fillNevents_problemCells> FILLING PROBLEM CELL PLOTS"<<std::endl;
00975
00976 if (ievt_==0) return;
00977
00978 int ieta=0;
00979 int etabins=0;
00980 int phibins=0;
00981 bool problemvalue=false;
00982
00983
00984 int NumBadHB=0;
00985 int NumBadHE=0;
00986 int NumBadHO=0;
00987 int NumBadHF=0;
00988 int NumBadHO0=0;
00989 int NumBadHO12=0;
00990 int NumBadHFLUMI=0;
00991
00992 unsigned int DEPTH = 0;
00993
00994 if (test_persistent_)
00995 {
00996 if (test_energy_)
00997 DEPTH = AbovePersistentThresholdCellsByDepth.depth.size();
00998 else if (test_et_)
00999 DEPTH = AbovePersistentETThresholdCellsByDepth.depth.size();
01000 }
01001 else if (test_energy_ && DEPTH==0) DEPTH = AboveEnergyThresholdCellsByDepth.depth.size();
01002 else if (test_et_ && DEPTH==0) DEPTH = AboveETThresholdCellsByDepth.depth.size();
01003 else if (test_neighbor_ && DEPTH==0) DEPTH = AboveNeighborsHotCellsByDepth.depth.size();
01004
01005 if (DEPTH==0) return;
01006
01007 for (unsigned int depth=0;depth<DEPTH;++depth)
01008 {
01009 if (test_persistent_)
01010 {
01011 if (test_energy_)
01012 {
01013 etabins=AbovePersistentThresholdCellsByDepth.depth[depth]->getNbinsX();
01014 phibins=AbovePersistentThresholdCellsByDepth.depth[depth]->getNbinsY();
01015 }
01016 else if (test_et_)
01017 {
01018 etabins=AbovePersistentETThresholdCellsByDepth.depth[depth]->getNbinsX();
01019 phibins=AbovePersistentETThresholdCellsByDepth.depth[depth]->getNbinsY();
01020 }
01021 }
01022
01023 if (test_neighbor_ && (etabins==0 || phibins==0))
01024 {
01025 etabins=AboveNeighborsHotCellsByDepth.depth[depth]->getNbinsX();
01026 phibins=AboveNeighborsHotCellsByDepth.depth[depth]->getNbinsY();
01027 }
01028
01029 if (test_energy_ && (etabins==0 || phibins==0))
01030 {
01031 etabins=AboveEnergyThresholdCellsByDepth.depth[depth]->getNbinsX();
01032 phibins=AboveEnergyThresholdCellsByDepth.depth[depth]->getNbinsY();
01033 }
01034
01035 if (test_et_ && (etabins==0 || phibins==0))
01036 {
01037 etabins=AboveETThresholdCellsByDepth.depth[depth]->getNbinsX();
01038 phibins=AboveETThresholdCellsByDepth.depth[depth]->getNbinsY();
01039 }
01040
01041 for (int eta=0;eta<etabins;++eta)
01042 {
01043 ieta=CalcIeta(eta,depth+1);
01044 if (ieta==-9999) continue;
01045 for (int phi=0;phi<phibins;++phi)
01046 {
01047 if (abs(ieta)>20 && phi%2==1) continue;
01048 else if (abs(ieta)>39 && (phi+1)%4!=3) continue;
01049
01050 problemvalue=false;
01051 if (test_energy_ && test_persistent_ && AbovePersistentThresholdCellsByDepth.depth[depth]->getBinContent(eta+1,phi+1)>minErrorFlag_*ievt_)
01052 problemvalue=true;
01053 if (test_neighbor_ && AboveNeighborsHotCellsByDepth.depth[depth]->getBinContent(eta+1,phi+1)>minErrorFlag_*ievt_)
01054 problemvalue=true;
01055 if (test_energy_ && AboveEnergyThresholdCellsByDepth.depth[depth]->getBinContent(eta+1,phi+1)>minErrorFlag_*ievt_)
01056 problemvalue=true;
01057 if (test_et_ && AboveETThresholdCellsByDepth.depth[depth]->getBinContent(eta+1,phi+1)>minErrorFlag_*ievt_)
01058 problemvalue=true;
01059 if (test_et_ && test_persistent_ && AbovePersistentETThresholdCellsByDepth.depth[depth]->getBinContent(eta+1,phi+1)>minErrorFlag_*ievt_)
01060 problemvalue=true;
01061 if (problemvalue==false) continue;
01062 if (isHB(eta,depth+1)) ++NumBadHB;
01063 else if (isHE(eta,depth+1))
01064 ++NumBadHE;
01065 else if (isHO(eta,depth+1))
01066 {
01067 ++NumBadHO;
01068 if (abs(ieta)<5) ++NumBadHO0;
01069 else ++NumBadHO12;
01070 }
01071 else if (isHF(eta,depth+1))
01072 {
01073 ++NumBadHF;
01074 if (depth+1==1 && (abs(ieta)==33 || abs(ieta)==34)) ++NumBadHFLUMI;
01075 else if (depth+1==2 && (abs(ieta)==35 || abs(ieta)==36)) ++NumBadHFLUMI;
01076 }
01077 }
01078 }
01079 }
01080
01081 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;
01082
01083 ProblemsVsLB_HB->Fill(currentLS,NumBadHB);
01084 ProblemsVsLB_HE->Fill(currentLS,NumBadHE);
01085 ProblemsVsLB_HO->Fill(currentLS,NumBadHO);
01086 ProblemsVsLB_HF->Fill(currentLS,NumBadHF);
01087 ProblemsVsLB_HBHEHF->Fill(currentLS,NumBadHB+NumBadHE+NumBadHF);
01088 ProblemsVsLB->Fill(currentLS,NumBadHB+NumBadHE+NumBadHO+NumBadHF);
01089
01090 ProblemsCurrentLB->Fill(-1,-1,levt_);
01091 ProblemsCurrentLB->Fill(0,0,NumBadHB);
01092 ProblemsCurrentLB->Fill(1,0,NumBadHE);
01093 ProblemsCurrentLB->Fill(2,0,NumBadHO);
01094 ProblemsCurrentLB->Fill(3,0,NumBadHF);
01095 ProblemsCurrentLB->Fill(4,0,NumBadHO0);
01096 ProblemsCurrentLB->Fill(5,0,NumBadHO12);
01097 ProblemsCurrentLB->Fill(6,0,NumBadHFLUMI);
01098
01099 }
01100
01101
01102 void HcalHotCellMonitor::zeroCounters(void)
01103 {
01104
01105
01106 for (int i=0;i<85;++i)
01107 {
01108 for (int j=0;j<72;++j)
01109 {
01110 for (int k=0;k<4;++k)
01111 {
01112 abovepersistent[i][j][k]=0;
01113 abovepersistentET[i][j][k]=0;
01114 aboveneighbors[i][j][k]=0;
01115 aboveenergy[i][j][k]=0;
01116 aboveet[i][j][k]=0;
01117 rechit_occupancy_sum[i][j][k]=0;
01118 }
01119 }
01120 }
01121
01122 for (int i=0;i<500;++i)
01123 {
01124 hbVsNeighbor[i]=0;
01125 heVsNeighbor[i]=0;
01126 hoVsNeighbor[i]=0;
01127 hfVsNeighbor[i]=0;
01128 }
01129 return;
01130
01131 }
01132
01133 void HcalHotCellMonitor::endRun(const edm::Run& run, const edm::EventSetup& c)
01134 {
01135
01136 }
01137
01138 void HcalHotCellMonitor::endJob()
01139 {
01140 if (debug_>0) std::cout <<"HcalHotCellMonitor::endJob()"<<std::endl;
01141 if (enableCleanup_) cleanup();
01142 }
01143
01144 void HcalHotCellMonitor::cleanup()
01145 {
01146 if (debug_>0) std::cout <<"HcalHotCellMonitor::cleanup()"<<std::endl;
01147 if (!enableCleanup_) return;
01148 if (dbe_)
01149 {
01150
01151 dbe_->setCurrentFolder(subdir_);
01152 dbe_->removeContents();
01153 dbe_->setCurrentFolder(subdir_+"hot_rechit_above_threshold");
01154 dbe_->removeContents();
01155 dbe_->setCurrentFolder(subdir_+"hot_rechit_always_above_threshold");
01156 dbe_->removeContents();
01157 dbe_->setCurrentFolder(subdir_+"hot_neighbortest");
01158 dbe_->removeContents();
01159 dbe_->setCurrentFolder(subdir_+"LSvalues");
01160 dbe_->removeContents();
01161 }
01162 }
01163
01164 void HcalHotCellMonitor::periodicReset()
01165 {
01166
01167
01168
01169
01170
01171 zeroCounters();
01172
01173
01174
01175
01176 if (test_neighbor_)
01177 AboveNeighborsHotCellsByDepth.Reset();
01178 if (test_energy_ || makeDiagnostics_)
01179 AboveEnergyThresholdCellsByDepth.Reset();
01180 if (test_et_ || makeDiagnostics_)
01181 AboveETThresholdCellsByDepth.Reset();
01182 if (test_persistent_)
01183 {
01184 AbovePersistentThresholdCellsByDepth.Reset();
01185 if (test_et_)
01186 AbovePersistentETThresholdCellsByDepth.Reset();
01187 }
01188 return;
01189 }
01190 DEFINE_FWK_MODULE(HcalHotCellMonitor);