00001 #include "DQM/HcalMonitorTasks/interface/HcalDeadCellMonitor.h"
00002 #include "FWCore/Framework/interface/LuminosityBlock.h"
00003
00004 HcalDeadCellMonitor::HcalDeadCellMonitor(const edm::ParameterSet& ps)
00005 {
00006 Online_ = ps.getUntrackedParameter<bool>("online",false);
00007 mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns",false);
00008 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
00009 debug_ = ps.getUntrackedParameter<int>("debug",0);
00010 makeDiagnostics_ = ps.getUntrackedParameter<bool>("makeDiagnostics",false);
00011 prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
00012 if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
00013 prefixME_.append("/");
00014 subdir_ = ps.getUntrackedParameter<std::string>("TaskFolder","DeadCellMonitor_Hcal");
00015 if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
00016 subdir_.append("/");
00017 subdir_=prefixME_+subdir_;
00018 AllowedCalibTypes_ = ps.getUntrackedParameter<std::vector<int> > ("AllowedCalibTypes");
00019 skipOutOfOrderLS_ = ps.getUntrackedParameter<bool>("skipOutOfOrderLS",true);
00020 NLumiBlocks_ = ps.getUntrackedParameter<int>("NLumiBlocks",4000);
00021
00022 badChannelStatusMask_ = ps.getUntrackedParameter<int>("BadChannelStatusMask",
00023 ps.getUntrackedParameter<int>("BadChannelStatusMask",
00024 (1<<HcalChannelStatus::HcalCellDead)));
00025
00026
00027
00028 digiLabel_ =ps.getUntrackedParameter<edm::InputTag>("digiLabel");
00029 hbheRechitLabel_ = ps.getUntrackedParameter<edm::InputTag>("hbheRechitLabel");
00030 hoRechitLabel_ = ps.getUntrackedParameter<edm::InputTag>("hoRechitLabel");
00031 hfRechitLabel_ = ps.getUntrackedParameter<edm::InputTag>("hfRechitLabel");
00032
00033
00034 minDeadEventCount_ = ps.getUntrackedParameter<int>("minDeadEventCount",1000);
00035 excludeHORing2_ = ps.getUntrackedParameter<bool>("excludeHORing2",false);
00036 excludeHO1P02_ = ps.getUntrackedParameter<bool>("excludeHO1P02",false);
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 deadmon_test_digis_ = ps.getUntrackedParameter<bool>("test_digis",true);
00051 deadmon_test_rechits_ = ps.getUntrackedParameter<bool>("test_rechits",false);
00052
00053
00054 energyThreshold_ = ps.getUntrackedParameter<double>("MissingRechitEnergyThreshold",0);
00055 HBenergyThreshold_ = ps.getUntrackedParameter<double>("HB_energyThreshold",energyThreshold_);
00056 HEenergyThreshold_ = ps.getUntrackedParameter<double>("HE_energyThreshold",energyThreshold_);
00057 HOenergyThreshold_ = ps.getUntrackedParameter<double>("HO_energyThreshold",energyThreshold_);
00058 HFenergyThreshold_ = ps.getUntrackedParameter<double>("HF_energyThreshold",energyThreshold_);
00059
00060 HcalLogicalMapGenerator gen;
00061 logicalMap_=new HcalLogicalMap(gen.createMap());
00062 }
00063
00064 HcalDeadCellMonitor::~HcalDeadCellMonitor()
00065 {
00066 if (logicalMap_ == 0) delete logicalMap_;
00067 }
00068
00069
00070
00071
00072 void HcalDeadCellMonitor::setup()
00073 {
00074 HcalBaseDQMonitor::setup();
00075 zeroCounters(1);
00076 if (debug_>0)
00077 std::cout <<"<HcalDeadCellMonitor::setup> Setting up histograms"<<std::endl;
00078
00079 if (!dbe_) return;
00080
00081 dbe_->setCurrentFolder(subdir_);
00082 MonitorElement* excludeHO2=dbe_->bookInt("ExcludeHOring2");
00083
00084 if (excludeHO2) excludeHO2->Fill(excludeHORing2_==true ? 1 : 0);
00085
00086 Nevents = dbe_->book1D("NumberOfDeadCellEvents","Number of Events Seen by DeadCellMonitor",2,0,2);
00087 Nevents->setBinLabel(1,"allEvents");
00088 Nevents->setBinLabel(2,"lumiCheck");
00089
00090 ProblemsVsLB=dbe_->bookProfile("TotalDeadCells_HCAL_vs_LS",
00091 "Total Number of Dead Hcal Cells (excluding known problems) vs LS;Lumi Section;Dead Cells",
00092 NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00093 100,0,10000);
00094 ProblemsVsLB_HB=dbe_->bookProfile("TotalDeadCells_HB_vs_LS",
00095 "Total Number of Dead HB Cells (excluding known problems) vs LS;Lumi Section;Dead Cells",
00096 NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00097 100,0,10000);
00098 ProblemsVsLB_HE=dbe_->bookProfile("TotalDeadCells_HE_vs_LS",
00099 "Total Number of Dead HE Cells (excluding known problems) vs LS;Lumi Section;Dead Cells",
00100 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00101 ProblemsVsLB_HO=dbe_->bookProfile("TotalDeadCells_HO_vs_LS",
00102 "Total Number of Dead HO Cells (excluding known problems) vs LS;Lumi Section;Dead Cells",
00103 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00104 ProblemsVsLB_HF=dbe_->bookProfile("TotalDeadCells_HF_vs_LS",
00105 "Total Number of Dead HF Cells (excluding known problems) vs LS;Lumi Section;Dead Cells",
00106 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00107 ProblemsVsLB_HBHEHF=dbe_->bookProfile("TotalDeadCells_HBHEHF_vs_LS",
00108 "Total Number of Dead HBHEHF Cells (excluding known problems) vs LS;Lumi Section;Dead Cells",
00109 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00110
00111 (ProblemsVsLB->getTProfile())->SetMarkerStyle(20);
00112 (ProblemsVsLB_HB->getTProfile())->SetMarkerStyle(20);
00113 (ProblemsVsLB_HE->getTProfile())->SetMarkerStyle(20);
00114 (ProblemsVsLB_HO->getTProfile())->SetMarkerStyle(20);
00115 (ProblemsVsLB_HF->getTProfile())->SetMarkerStyle(20);
00116 (ProblemsVsLB_HBHEHF->getTProfile())->SetMarkerStyle(20);
00117
00118 RBX_loss_VS_LB=dbe_->book2D("RBX_loss_VS_LB",
00119 "RBX loss vs LS; Lumi Section; Index of lost RBX",
00120 NLumiBlocks_,0.5,NLumiBlocks_+0.5,132,0,132);
00121
00122 ProblemsInLastNLB_HBHEHF_alarm=dbe_->book1D("ProblemsInLastNLB_HBHEHF_alarm",
00123 "Total Number of Dead HBHEHF Cells in last 10 LS. Last bin contains OverFlow",
00124 100,0,100);
00125
00126
00127 dbe_->setCurrentFolder(subdir_+"dead_cell_parameters");
00128 MonitorElement* me=dbe_->bookInt("Test_NeverPresent_Digis");
00129 me->Fill(1);
00130 me=dbe_->bookInt("Test_DigiMissing_Periodic_Lumi_Check");
00131 if (deadmon_test_digis_)
00132 me->Fill(1);
00133 else
00134 me->Fill(0);
00135 me=dbe_->bookInt("Min_Events_Required_Periodic_Lumi_Check");
00136 me->Fill(minDeadEventCount_);
00137 me=dbe_->bookInt("Test_NeverPresent_RecHits");
00138 deadmon_test_rechits_>0 ? me->Fill(1) : me->Fill(0);
00139 me=dbe_->bookFloat("HBMinimumRecHitEnergy");
00140 me->Fill(HBenergyThreshold_);
00141 me=dbe_->bookFloat("HEMinimumRecHitEnergy");
00142 me->Fill(HEenergyThreshold_);
00143 me=dbe_->bookFloat("HOMinimumRecHitEnergy");
00144 me->Fill(HOenergyThreshold_);
00145 me=dbe_->bookFloat("HFMinimumRecHitEnergy");
00146 me->Fill(HFenergyThreshold_);
00147 me=dbe_->bookInt("Test_RecHitsMissing_Periodic_Lumi_Check");
00148 deadmon_test_rechits_>0 ? me->Fill(1) : me->Fill(0);
00149
00150
00151
00152
00153 std::stringstream units;
00154 std::stringstream name;
00155
00156
00157
00158 dbe_->setCurrentFolder(subdir_+"dead_digi_never_present");
00159 SetupEtaPhiHists(DigiPresentByDepth,
00160 "Digi Present At Least Once","");
00161
00162 NumberOfNeverPresentDigis=dbe_->bookProfile("Problem_NeverPresentDigis_HCAL_vs_LS",
00163 "Total Number of Never-Present Hcal Cells vs LS;Lumi Section;Dead Cells",
00164 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00165
00166 NumberOfNeverPresentDigisHB=dbe_->bookProfile("Problem_NeverPresentDigis_HB_vs_LS",
00167 "Total Number of Never-Present HB Cells vs LS;Lumi Section;Dead Cells",
00168 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00169
00170 NumberOfNeverPresentDigisHE=dbe_->bookProfile("Problem_NeverPresentDigis_HE_vs_LS",
00171 "Total Number of Never-Present HE Cells vs LS;Lumi Section;Dead Cells",
00172 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00173
00174 NumberOfNeverPresentDigisHO=dbe_->bookProfile("Problem_NeverPresentDigis_HO_vs_LS",
00175 "Total Number of Never-Present HO Cells vs LS;Lumi Section;Dead Cells",
00176 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00177
00178 NumberOfNeverPresentDigisHF=dbe_->bookProfile("Problem_NeverPresentDigis_HF_vs_LS",
00179 "Total Number of Never-Present HF Cells vs LS;Lumi Section;Dead Cells",
00180 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00181 (NumberOfNeverPresentDigis->getTProfile())->SetMarkerStyle(20);
00182 (NumberOfNeverPresentDigisHB->getTProfile())->SetMarkerStyle(20);
00183 (NumberOfNeverPresentDigisHE->getTProfile())->SetMarkerStyle(20);
00184 (NumberOfNeverPresentDigisHO->getTProfile())->SetMarkerStyle(20);
00185 (NumberOfNeverPresentDigisHF->getTProfile())->SetMarkerStyle(20);
00186
00187 FillUnphysicalHEHFBins(DigiPresentByDepth);
00188
00189 if (deadmon_test_digis_)
00190 {
00191 dbe_->setCurrentFolder(subdir_+"dead_digi_often_missing");
00192
00193 name<<"Dead Cells with No Digis";
00194 SetupEtaPhiHists(RecentMissingDigisByDepth,
00195 name.str(),
00196 "");
00197 name.str("");
00198 name<<"HB HE HF Depth 1 Dead Cells with No Digis for at least 1 Full Luminosity Block";
00199 RecentMissingDigisByDepth.depth[0]->setTitle(name.str().c_str());
00200
00201 name.str("");
00202 name<<"HB HE HF Depth 2 Dead Cells with No Digis for at least 1 Full Luminosity Block";
00203 RecentMissingDigisByDepth.depth[1]->setTitle(name.str().c_str());
00204
00205 name.str("");
00206 name<<"HE Depth 3 Dead Cells with No Digis for at least 1 Full Luminosity Block";
00207 RecentMissingDigisByDepth.depth[2]->setTitle(name.str().c_str());
00208
00209 name.str("");
00210 name<<"HO Depth 4 Dead Cells with No Digis for at least 1 Full Luminosity Block";
00211 RecentMissingDigisByDepth.depth[3]->setTitle(name.str().c_str());
00212 name.str("");
00213
00214
00215 name<<"Total Number of Hcal Digis Unoccupied for at least 1 Full Luminosity Block";
00216 NumberOfRecentMissingDigis=dbe_->bookProfile("Problem_RecentMissingDigis_HCAL_vs_LS",
00217 name.str(),
00218 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00219 name.str("");
00220 name<<"Total Number of HB Digis Unoccupied for at least 1 Full LS vs LS;Lumi Section; Dead Cells";
00221 NumberOfRecentMissingDigisHB=dbe_->bookProfile("Problem_RecentMissingDigis_HB_vs_LS",
00222 name.str(),
00223 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00224 name.str("");
00225 name<<"Total Number of HE Digis Unoccupied for at least 1 Full LS vs LS;Lumi Section; Dead Cells";
00226 NumberOfRecentMissingDigisHE=dbe_->bookProfile("Problem_RecentMissingDigis_HE_vs_LS",
00227 name.str(),
00228 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00229 name.str("");
00230 name<<"Total Number of HO Digis Unoccupied for at least 1 Full LS vs LS;Lumi Section; Dead Cells";
00231 NumberOfRecentMissingDigisHO=dbe_->bookProfile("Problem_RecentMissingDigis_HO_vs_LS",
00232 name.str(),
00233 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00234 name.str("");
00235 name<<"Total Number of HF Digis Unoccupied for at least 1 Full LS vs LS;Lumi Section; Dead Cells";
00236 NumberOfRecentMissingDigisHF=dbe_->bookProfile("Problem_RecentMissingDigis_HF_vs_LS",
00237 name.str(),
00238 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00239 (NumberOfRecentMissingDigis->getTProfile())->SetMarkerStyle(20);
00240 (NumberOfRecentMissingDigisHB->getTProfile())->SetMarkerStyle(20);
00241 (NumberOfRecentMissingDigisHE->getTProfile())->SetMarkerStyle(20);
00242 (NumberOfRecentMissingDigisHO->getTProfile())->SetMarkerStyle(20);
00243 (NumberOfRecentMissingDigisHF->getTProfile())->SetMarkerStyle(20);
00244
00245 }
00246
00247 if (deadmon_test_rechits_)
00248 {
00249
00250 dbe_->setCurrentFolder(subdir_+"dead_rechit_neverpresent");
00251 SetupEtaPhiHists(RecHitPresentByDepth,"RecHit Above Threshold At Least Once","");
00252
00253 units.str("");
00254 units<<"Cells Above Energy Threshold At Least Once: Depth 1 -- HB >="<<HBenergyThreshold_<<" GeV, HE >= "<<HEenergyThreshold_<<", HF >="<<HFenergyThreshold_<<" GeV";
00255 RecHitPresentByDepth.depth[0]->setTitle(units.str().c_str());
00256 units.str("");
00257 units<<"Cells Above Energy Threshold At Least Once: Depth 2 -- HB >="<<HBenergyThreshold_<<" GeV, HE >= "<<HEenergyThreshold_<<", HF >="<<HFenergyThreshold_<<" GeV";
00258 RecHitPresentByDepth.depth[1]->setTitle(units.str().c_str());
00259 units.str("");
00260 units<<"Cells Above Energy Threshold At Least Once: Depth 3 -- HE >="<<HEenergyThreshold_<<" GeV";
00261 RecHitPresentByDepth.depth[2]->setTitle(units.str().c_str());
00262 units.str("");
00263 units<<"Cells Above Energy Threshold At Least Once: Depth 4 -- HO >="<<HOenergyThreshold_<<" GeV";
00264 RecHitPresentByDepth.depth[3]->setTitle(units.str().c_str());
00265 units.str("");
00266
00267
00268 NumberOfNeverPresentRecHits=dbe_->bookProfile("Problem_RecHitsNeverPresent_HCAL_vs_LS",
00269 "Total Number of Hcal Rechits with Low Energy;Lumi Section;Dead Cells",
00270 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00271 name.str("");
00272 name<<"Total Number of HB RecHits with Energy Never >= "<<HBenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
00273 NumberOfNeverPresentRecHitsHB=dbe_->bookProfile("Problem_RecHitsNeverPresent_HB_vs_LS",
00274 name.str(),
00275 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00276 name.str("");
00277 name<<"Total Number of HE RecHits with Energy Never >= "<<HEenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
00278 NumberOfNeverPresentRecHitsHE=dbe_->bookProfile("Problem_RecHitsNeverPresent_HE_vs_LS",
00279 name.str(),
00280 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00281 name.str("");
00282 name<<"Total Number of HO RecHits with Energy Never >= "<<HOenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
00283 NumberOfNeverPresentRecHitsHO=dbe_->bookProfile("Problem_RecHitsNeverPresent_HO_vs_LS",
00284 name.str(),
00285 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00286 name.str("");
00287 name<<"Total Number of HF RecHits with Energy Never >= "<<HFenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
00288 NumberOfNeverPresentRecHitsHF=dbe_->bookProfile("Problem_RecHitsNeverPresent_HF_vs_LS",
00289 name.str(),
00290 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00291 (NumberOfNeverPresentRecHits->getTProfile())->SetMarkerStyle(20);
00292 (NumberOfNeverPresentRecHitsHB->getTProfile())->SetMarkerStyle(20);
00293 (NumberOfNeverPresentRecHitsHE->getTProfile())->SetMarkerStyle(20);
00294 (NumberOfNeverPresentRecHitsHO->getTProfile())->SetMarkerStyle(20);
00295 (NumberOfNeverPresentRecHitsHF->getTProfile())->SetMarkerStyle(20);
00296
00297 dbe_->setCurrentFolder(subdir_+"dead_rechit_often_missing");
00298 SetupEtaPhiHists(RecentMissingRecHitsByDepth,"RecHits Failing Energy Threshold Test","");
00299
00300 units.str("");
00301 units<<"RecHits with Consistent Low Energy Depth 1 -- HB <"<<HBenergyThreshold_<<" GeV, HE < "<<HEenergyThreshold_<<", HF <"<<HFenergyThreshold_<<" GeV";
00302 RecentMissingRecHitsByDepth.depth[0]->setTitle(units.str().c_str());
00303 units.str("");
00304 units<<"RecHits with Consistent Low Energy Depth 2 -- HB <"<<HBenergyThreshold_<<" GeV, HE < "<<HEenergyThreshold_<<", HF <"<<HFenergyThreshold_<<" GeV";
00305 RecentMissingRecHitsByDepth.depth[1]->setTitle(units.str().c_str());
00306 units.str("");
00307 units<<"RecHits with Consistent Low Energy Depth 3 -- HE <"<<HEenergyThreshold_<<" GeV";
00308 RecentMissingRecHitsByDepth.depth[2]->setTitle(units.str().c_str());
00309 units.str("");
00310 units<<"RecHits with Consistent Low Energy Depth 4 -- HO <"<<HOenergyThreshold_<<" GeV";
00311 RecentMissingRecHitsByDepth.depth[3]->setTitle(units.str().c_str());
00312 units.str("");
00313
00314
00315
00316 name.str("");
00317 name<<"Total Number of Hcal RecHits with Consistent Low Energy;Lumi Section;Dead Cells";
00318 NumberOfRecentMissingRecHits=dbe_->bookProfile("Problem_BelowEnergyRecHits_HCAL_vs_LS",
00319 name.str(),
00320 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00321 name.str("");
00322 name<<"Total Number of HB RecHits with Consistent Low Energy < "<<HBenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
00323 NumberOfRecentMissingRecHitsHB=dbe_->bookProfile("Problem_BelowEnergyRecHits_HB_vs_LS",
00324 name.str(),
00325 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00326 name.str("");
00327 name<<"Total Number of HE RecHits with Consistent Low Energy < "<<HEenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
00328 NumberOfRecentMissingRecHitsHE=dbe_->bookProfile("Problem_BelowEnergyRecHits_HE_vs_LS",
00329 name.str(),
00330 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00331 name.str("");
00332 name<<"Total Number of HO RecHits with Consistent Low Energy < "<<HOenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
00333 NumberOfRecentMissingRecHitsHO=dbe_->bookProfile("Problem_BelowEnergyRecHits_HO_vs_LS",
00334 name.str(),
00335 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00336 name.str("");
00337 name<<"Total Number of HF RecHits with Consistent Low Energy < "<<HFenergyThreshold_<<" GeV;Lumi Section;Dead Cells";
00338 NumberOfRecentMissingRecHitsHF=dbe_->bookProfile("Problem_BelowEnergyRecHits_HF_vs_LS",
00339 name.str(),
00340 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00341 (NumberOfRecentMissingRecHits->getTProfile())->SetMarkerStyle(20);
00342 (NumberOfRecentMissingRecHitsHB->getTProfile())->SetMarkerStyle(20);
00343 (NumberOfRecentMissingRecHitsHE->getTProfile())->SetMarkerStyle(20);
00344 (NumberOfRecentMissingRecHitsHO->getTProfile())->SetMarkerStyle(20);
00345 (NumberOfRecentMissingRecHitsHF->getTProfile())->SetMarkerStyle(20);
00346
00347 }
00348
00349
00350 if (makeDiagnostics_)
00351 {
00352 dbe_->setCurrentFolder(subdir_+"DiagnosticPlots");
00353 HBDeadVsEvent=dbe_->book1D("HBDeadVsEvent","HB Total Dead Cells Vs Event", NLumiBlocks_/10,-0.5,NLumiBlocks_-0.5);
00354 HEDeadVsEvent=dbe_->book1D("HEDeadVsEvent","HE Total Dead Cells Vs Event", NLumiBlocks_/10,-0.5,NLumiBlocks_-0.5);
00355 HODeadVsEvent=dbe_->book1D("HODeadVsEvent","HO Total Dead Cells Vs Event", NLumiBlocks_/10,-0.5,NLumiBlocks_-0.5);
00356 HFDeadVsEvent=dbe_->book1D("HFDeadVsEvent","HF Total Dead Cells Vs Event", NLumiBlocks_/10,-0.5,NLumiBlocks_-0.5);
00357 }
00358
00359 this->reset();
00360 return;
00361
00362 }
00363
00364 void HcalDeadCellMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c)
00365 {
00366 if (debug_>1) std::cout <<"HcalDeadCellMonitor::beginRun"<<std::endl;
00367 HcalBaseDQMonitor::beginRun(run,c);
00368
00369 if (tevt_==0) this->setup();
00370 if (mergeRuns_==false)
00371 this->reset();
00372
00373
00374 KnownBadCells_.clear();
00375 if (badChannelStatusMask_>0)
00376 {
00377 edm::ESHandle<HcalChannelQuality> p;
00378 c.get<HcalChannelQualityRcd>().get(p);
00379 HcalChannelQuality* chanquality= new HcalChannelQuality(*p.product());
00380 std::vector<DetId> mydetids = chanquality->getAllChannels();
00381 for (std::vector<DetId>::const_iterator i = mydetids.begin();
00382 i!=mydetids.end();
00383 ++i)
00384 {
00385 if (i->det()!=DetId::Hcal) continue;
00386 HcalDetId id=HcalDetId(*i);
00387 int status=(chanquality->getValues(id))->getValue();
00388 if ((status & badChannelStatusMask_))
00389 {
00390 KnownBadCells_[id.rawId()]=status;
00391 }
00392 }
00393 delete chanquality;
00394 }
00395 return;
00396 }
00397
00398 void HcalDeadCellMonitor::reset()
00399 {
00400 if (debug_>1) std::cout <<"HcalDeadCellMonitor::reset()"<<std::endl;
00401 HcalBaseDQMonitor::reset();
00402 zeroCounters();
00403 deadevt_=0;
00404 is_RBX_loss_ = 0;
00405 alarmer_counter_ = 0;
00406 hbhedcsON = true; hfdcsON = true;
00407 ProblemsVsLB->Reset(); ProblemsVsLB_HB->Reset(); ProblemsVsLB_HE->Reset(); ProblemsVsLB_HO->Reset(); ProblemsVsLB_HF->Reset(); ProblemsVsLB_HBHEHF->Reset();
00408 RBX_loss_VS_LB->Reset();
00409 ProblemsInLastNLB_HBHEHF_alarm->Reset();
00410 NumberOfNeverPresentDigis->Reset(); NumberOfNeverPresentDigisHB->Reset(); NumberOfNeverPresentDigisHE->Reset(); NumberOfNeverPresentDigisHO->Reset(); NumberOfNeverPresentDigisHF->Reset();
00411
00412 for (unsigned int depth=0;depth<DigiPresentByDepth.depth.size();++depth)
00413 DigiPresentByDepth.depth[depth]->Reset();
00414
00415
00416 if (excludeHORing2_==true && DigiPresentByDepth.depth.size()>3)
00417 {
00418 for (int ieta=11;ieta<=15;++ieta)
00419 for (int iphi=1;iphi<=72;++iphi)
00420 {
00421
00422 if (isSiPM(ieta,iphi,4)==false)
00423 DigiPresentByDepth.depth[3]->Fill(ieta,iphi,2);
00424
00425 DigiPresentByDepth.depth[3]->Fill(-1*ieta,iphi,2);
00426 }
00427 }
00428 FillUnphysicalHEHFBins(DigiPresentByDepth);
00429
00430
00431 if (deadmon_test_digis_)
00432 {
00433 NumberOfRecentMissingDigis->Reset(); NumberOfRecentMissingDigisHB->Reset(); NumberOfRecentMissingDigisHE->Reset(); NumberOfRecentMissingDigisHO->Reset(); NumberOfRecentMissingDigisHF->Reset();
00434 RecentMissingDigisByDepth.Reset();
00435 }
00436 if (deadmon_test_rechits_)
00437 {
00438 NumberOfRecentMissingRecHits->Reset();
00439 NumberOfRecentMissingRecHitsHB->Reset();
00440 NumberOfRecentMissingRecHitsHE->Reset();
00441 NumberOfRecentMissingRecHitsHO->Reset();
00442 NumberOfRecentMissingRecHitsHF->Reset();
00443 NumberOfNeverPresentRecHits->Reset();
00444 NumberOfNeverPresentRecHitsHB->Reset();
00445 NumberOfNeverPresentRecHitsHE->Reset();
00446 NumberOfNeverPresentRecHitsHO->Reset();
00447 NumberOfNeverPresentRecHitsHF->Reset();
00448 RecentMissingRecHitsByDepth.Reset();
00449 RecHitPresentByDepth.Reset();
00450
00451
00452 if (excludeHORing2_==true && RecHitPresentByDepth.depth.size()>3)
00453 {
00454 for (int ieta=11;ieta<=15;++ieta)
00455 for (int iphi=1;iphi<=72;++iphi)
00456 {
00457 RecHitPresentByDepth.depth[3]->Fill(ieta,iphi,2);
00458 RecHitPresentByDepth.depth[3]->Fill(-1*ieta,iphi,2);
00459 }
00460 }
00461 FillUnphysicalHEHFBins(RecHitPresentByDepth);
00462 }
00463
00464 Nevents->Reset();
00465 }
00466
00467
00468
00469
00470 void HcalDeadCellMonitor::cleanup()
00471 {
00472 if (!enableCleanup_) return;
00473 if (dbe_)
00474 {
00475 dbe_->setCurrentFolder(subdir_);
00476 dbe_->removeContents();
00477 dbe_->setCurrentFolder(subdir_+"dead_digi_never_present");
00478 dbe_->removeContents();
00479 dbe_->setCurrentFolder(subdir_+"dead_digi_often_missing");
00480 dbe_->removeContents();
00481 dbe_->setCurrentFolder(subdir_+"dead_rechit_neverpresent");
00482 dbe_->removeContents();
00483 dbe_->setCurrentFolder(subdir_+"dead_rechit_often_missing");
00484 dbe_->removeContents();
00485 dbe_->setCurrentFolder(subdir_+"dead_cell_parameters");
00486 dbe_->removeContents();
00487 dbe_->setCurrentFolder(subdir_+"LSvalues");
00488 dbe_->removeContents();
00489 }
00490 return;
00491 }
00492
00493
00494
00495 void HcalDeadCellMonitor::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
00496 const edm::EventSetup& c)
00497 {
00498
00499 if (this->LumiInOrder(lumiSeg.luminosityBlock())==false) return;
00500
00501
00502 if (ProblemsCurrentLB)
00503 ProblemsCurrentLB->Reset();
00504
00505 ProblemsInLastNLB_HBHEHF_alarm->Reset();
00506
00507
00508 if(hbhedcsON == true && hfdcsON == true && HBpresent_ == 1 && HEpresent_ == 1 && HFpresent_ == 1)
00509 ++alarmer_counter_;
00510 else
00511 alarmer_counter_ = 0;
00512
00513
00514
00515
00516
00517 if (deadevt_>=10 && deadevt_<minDeadEventCount_ && is_RBX_loss_==1)
00518 {
00519 fillNevents_problemCells();
00520 fillNevents_recentrechits();
00521
00522 endLumiProcessed_=true;
00523 is_RBX_loss_=0;
00524
00525 for (unsigned int i=0;i<132;++i)
00526 rbxlost[i] = 0;
00527
00528 if (ProblemsCurrentLB)
00529 {
00530 ProblemsCurrentLB->setBinContent(0,0, levt_);
00531 ProblemsCurrentLB->setBinContent(1,1, NumBadHB*levt_);
00532 ProblemsCurrentLB->setBinContent(2,1, NumBadHE*levt_);
00533 ProblemsCurrentLB->setBinContent(3,1, NumBadHO*levt_);
00534 ProblemsCurrentLB->setBinContent(4,1, NumBadHF*levt_);
00535 ProblemsCurrentLB->setBinContent(5,1, NumBadHO0*levt_);
00536 ProblemsCurrentLB->setBinContent(6,1, NumBadHO12*levt_);
00537 ProblemsCurrentLB->setBinContent(7,1, NumBadHFLUMI*levt_);
00538 }
00539 }
00540
00541 if (deadevt_<minDeadEventCount_)
00542 return;
00543
00544 endLumiProcessed_=true;
00545
00546 fillNevents_problemCells();
00547 fillNevents_recentdigis();
00548 fillNevents_recentrechits();
00549
00550 if (ProblemsCurrentLB)
00551 {
00552 ProblemsCurrentLB->setBinContent(0,0, levt_);
00553 ProblemsCurrentLB->setBinContent(1,1, NumBadHB*levt_);
00554 ProblemsCurrentLB->setBinContent(2,1, NumBadHE*levt_);
00555 ProblemsCurrentLB->setBinContent(3,1, NumBadHO*levt_);
00556 ProblemsCurrentLB->setBinContent(4,1, NumBadHF*levt_);
00557 ProblemsCurrentLB->setBinContent(5,1, NumBadHO0*levt_);
00558 ProblemsCurrentLB->setBinContent(6,1, NumBadHO12*levt_);
00559 ProblemsCurrentLB->setBinContent(7,1, NumBadHFLUMI*levt_);
00560 }
00561 zeroCounters();
00562 deadevt_=0;
00563 is_RBX_loss_=0;
00564
00565 return;
00566 }
00567
00568 void HcalDeadCellMonitor::endRun(const edm::Run& run, const edm::EventSetup& c)
00569 {
00570
00571
00572
00573 if (endLumiProcessed_==false) fillNevents_problemCells();
00574 return;
00575 }
00576
00577 void HcalDeadCellMonitor::endJob()
00578 {
00579 if (debug_>0) std::cout <<"HcalDeadCellMonitor::endJob()"<<std::endl;
00580 if (enableCleanup_) cleanup();
00581 }
00582
00583 void HcalDeadCellMonitor::analyze(edm::Event const&e, edm::EventSetup const&s)
00584 {
00585 if (!IsAllowedCalibType()) return;
00586 endLumiProcessed_=false;
00587 Nevents->Fill(0,1);
00588 if (LumiInOrder(e.luminosityBlock())==false) return;
00589
00590 edm::Handle<HBHEDigiCollection> hbhe_digi;
00591 edm::Handle<HODigiCollection> ho_digi;
00592 edm::Handle<HFDigiCollection> hf_digi;
00593
00594 edm::Handle<HBHERecHitCollection> hbhe_rechit;
00595 edm::Handle<HORecHitCollection> ho_rechit;
00596 edm::Handle<HFRecHitCollection> hf_rechit;
00597
00599
00600 edm::Handle<DcsStatusCollection> dcsStatus;
00601 e.getByLabel("scalersRawToDigi", dcsStatus);
00602
00603 if (dcsStatus.isValid() && dcsStatus->size() != 0)
00604 {
00605 if ((*dcsStatus)[0].ready(DcsStatus::HBHEa) &&
00606 (*dcsStatus)[0].ready(DcsStatus::HBHEb) &&
00607 (*dcsStatus)[0].ready(DcsStatus::HBHEc))
00608 {
00609 hbhedcsON = true;
00610 if (debug_) std::cout << "hbhe on" << std::endl;
00611 }
00612 else hbhedcsON = false;
00613
00614 if ((*dcsStatus)[0].ready(DcsStatus::HF))
00615 {
00616 hfdcsON = true;
00617 if (debug_) std::cout << "hf on" << std::endl;
00618 }
00619 else hfdcsON = false;
00620 }
00622
00623 if (!(e.getByLabel(digiLabel_,hbhe_digi)))
00624 {
00625 edm::LogWarning("HcalDeadCellMonitor")<< digiLabel_<<" hbhe_digi not available";
00626 return;
00627 }
00628 if (!(e.getByLabel(digiLabel_,ho_digi)))
00629 {
00630 edm::LogWarning("HcalDeadCellMonitor")<< digiLabel_<<" ho_digi not available";
00631 return;
00632 }
00633 if (!(e.getByLabel(digiLabel_,hf_digi)))
00634 {
00635 edm::LogWarning("HcalDeadCellMonitor")<< digiLabel_<<" hf_digi not available";
00636 return;
00637 }
00638
00639 if (!(e.getByLabel(hbheRechitLabel_,hbhe_rechit)))
00640 {
00641 edm::LogWarning("HcalDeadCellMonitor")<< hbheRechitLabel_<<" hbhe_rechit not available";
00642 return;
00643 }
00644
00645 if (!(e.getByLabel(hfRechitLabel_,hf_rechit)))
00646 {
00647 edm::LogWarning("HcalDeadCellMonitor")<< hfRechitLabel_<<" hf_rechit not available";
00648 return;
00649 }
00650 if (!(e.getByLabel(hoRechitLabel_,ho_rechit)))
00651 {
00652 edm::LogWarning("HcalDeadCellMonitor")<< hoRechitLabel_<<" ho_rechit not available";
00653 return;
00654 }
00655 if (debug_>1) std::cout <<"\t<HcalDeadCellMonitor::analyze> Processing good event! event # = "<<ievt_<<std::endl;
00656
00657
00658 HcalBaseDQMonitor::analyze(e,s);
00659
00660 ++deadevt_;
00661
00662 processEvent(*hbhe_rechit, *ho_rechit, *hf_rechit, *hbhe_digi, *ho_digi, *hf_digi);
00663
00664
00665 if(levt_>10 && tevt_ % 10 == 0 )
00666 {
00667 for(int i=71; i<132; i++)
00668 {
00669
00670 if(i >= 72 && i < 85)
00671 occupancy_RBX[i] = 1;
00672 if(i >=85 && i <= 95 && i%2==0)
00673 occupancy_RBX[i] = 1;
00674 if(i >=108 && i <= 119 && i%2==0)
00675 occupancy_RBX[i] = 1;
00676 if(i >=120 && i <= 131)
00677 occupancy_RBX[i] = 1;
00678
00679 if(i==117 || i==131)
00680 occupancy_RBX[i] = 1;
00681 }
00682
00683
00684 for (unsigned int i=0;i<132;++i)
00685 if(occupancy_RBX[i] == 0)
00686 {
00687 is_RBX_loss_ = 1;
00688 rbxlost[i] = 1;
00689 }
00690
00691
00692 if (is_RBX_loss_ == 0)
00693 for (unsigned int i=0;i<132;++i)
00694 occupancy_RBX[i] = 0;
00695 }
00696
00697
00698 if(is_RBX_loss_ == 1)
00699 for (unsigned int i=0;i<132;++i)
00700 if(rbxlost[i]==1) occupancy_RBX[i] = 0;
00701
00702 }
00703
00704
00705
00706
00707 void HcalDeadCellMonitor::processEvent(const HBHERecHitCollection& hbHits,
00708 const HORecHitCollection& hoHits,
00709 const HFRecHitCollection& hfHits,
00710 const HBHEDigiCollection& hbhedigi,
00711 const HODigiCollection& hodigi,
00712 const HFDigiCollection& hfdigi)
00713 {
00714 if (debug_>1) std::cout <<"<HcalDeadCellMonitor::processEvent> Processing event..."<<std::endl;
00715
00716
00717
00718
00719 for (unsigned int i=0;i<DigiPresentByDepth.depth.size();++i)
00720 DigiPresentByDepth.depth[i]->update();
00721
00722 NumberOfNeverPresentDigis->update();;
00723 NumberOfNeverPresentDigisHB->update();
00724 NumberOfNeverPresentDigisHE->update();
00725 NumberOfNeverPresentDigisHO->update();
00726 NumberOfNeverPresentDigisHF->update();
00727
00728 if (deadmon_test_digis_)
00729 {
00730
00731 for (unsigned int i=0;i<RecentMissingDigisByDepth.depth.size();++i)
00732 RecentMissingDigisByDepth.depth[i]->update();
00733
00734 NumberOfRecentMissingDigis->update();
00735 NumberOfRecentMissingDigisHB->update();
00736 NumberOfRecentMissingDigisHE->update();
00737 NumberOfRecentMissingDigisHO->update();
00738 NumberOfRecentMissingDigisHF->update();
00739 }
00740
00741 for (HBHEDigiCollection::const_iterator j=hbhedigi.begin();
00742 j!=hbhedigi.end(); ++j)
00743 {
00744 const HBHEDataFrame digi = (const HBHEDataFrame)(*j);
00745 processEvent_HBHEdigi(digi);
00746 }
00747
00748 for (HODigiCollection::const_iterator j=hodigi.begin();
00749 j!=hodigi.end(); ++j)
00750 {
00751 const HODataFrame digi = (const HODataFrame)(*j);
00752 process_Digi(digi);
00753 }
00754 for (HFDigiCollection::const_iterator j=hfdigi.begin();
00755 j!=hfdigi.end(); ++j)
00756 {
00757 const HFDataFrame digi = (const HFDataFrame)(*j);
00758 process_Digi(digi);
00759 }
00760 FillUnphysicalHEHFBins(DigiPresentByDepth);
00761
00762
00763 if (deadmon_test_rechits_)
00764 {
00765
00766 for (unsigned int i=0;i<RecentMissingRecHitsByDepth.depth.size();++i)
00767 RecentMissingRecHitsByDepth.depth[i]->update();
00768
00769 NumberOfRecentMissingRecHits->update();
00770 NumberOfRecentMissingRecHitsHB->update();
00771 NumberOfRecentMissingRecHitsHE->update();
00772 NumberOfRecentMissingRecHitsHO->update();
00773 NumberOfRecentMissingRecHitsHF->update();
00774
00775 for (HBHERecHitCollection::const_iterator j=hbHits.begin();
00776 j!=hbHits.end(); ++j)
00777 process_RecHit(j);
00778
00779 for (HORecHitCollection::const_iterator k=hoHits.begin();
00780 k!=hoHits.end(); ++k)
00781 process_RecHit(k);
00782
00783 for (HFRecHitCollection::const_iterator j=hfHits.begin();
00784 j!=hfHits.end(); ++j)
00785 process_RecHit(j);
00786
00787 }
00788
00789 if (!makeDiagnostics_) return;
00790 if (tevt_>=NLumiBlocks_) return;
00791
00792 int hbpresent=0;
00793 int hepresent=0;
00794 int hopresent=0;
00795 int hfpresent=0;
00796 int ieta=0;
00797 for (int d=0;d<4;++d)
00798 {
00799 for (int phi=0;phi<72;++phi)
00800 {
00801 for (int eta=0;eta<85;++eta)
00802 {
00803 if (!present_digi[eta][phi][d]) continue;
00804 if (d==3) ++hopresent;
00805 else if (d==2) ++hepresent;
00806 else if (d==1)
00807 {
00808 ieta=binmapd2[eta];
00809
00810 if (abs(ieta)>29) ++hfpresent;
00811 else if (abs(ieta)<17) ++hbpresent;
00812 else ++hepresent;
00813 }
00814 else if (d==0)
00815 {
00816 ieta=eta-42;
00817 if (abs(ieta)>29) ++hfpresent;
00818 else if (abs(ieta)<17) ++hbpresent;
00819 else ++hepresent;
00820 }
00821 }
00822 }
00823 }
00824 HBDeadVsEvent->Fill(tevt_,2592-hbpresent);
00825 HEDeadVsEvent->Fill(tevt_,2592-hepresent);
00826 HODeadVsEvent->Fill(tevt_,2160-hopresent);
00827 HFDeadVsEvent->Fill(tevt_,1728-hfpresent);
00828 return;
00829 }
00830
00831
00832
00833
00834
00835
00836 void HcalDeadCellMonitor::processEvent_HBHEdigi(const HBHEDataFrame digi)
00837 {
00838
00839 process_Digi(digi);
00840 return;
00841 }
00842
00843 template<class DIGI>
00844 void HcalDeadCellMonitor::process_Digi(DIGI& digi)
00845 {
00846
00847
00848 int ieta=digi.id().ieta();
00849 int iphi=digi.id().iphi();
00850 int depth=digi.id().depth();
00851
00852
00853 ++recentoccupancy_digi[CalcEtaBin(digi.id().subdet(),ieta,depth)][iphi-1][depth-1];
00854
00855
00856 if (present_digi[CalcEtaBin(digi.id().subdet(),ieta,depth)][iphi-1][depth-1]==false)
00857 {
00858 if (DigiPresentByDepth.depth[depth-1])
00859 {
00860 DigiPresentByDepth.depth[depth-1]->setBinContent(CalcEtaBin(digi.id().subdet(),ieta,depth)+1,iphi,1);
00861 }
00862 present_digi[CalcEtaBin(digi.id().subdet(),ieta,depth)][iphi-1][depth-1]=true;
00863 }
00864 return;
00865 }
00866
00867
00868
00869 template<class RECHIT>
00870 void HcalDeadCellMonitor::process_RecHit(RECHIT& rechit)
00871 {
00872 float en = rechit->energy();
00873 HcalDetId id(rechit->detid().rawId());
00874 int ieta = id.ieta();
00875 int iphi = id.iphi();
00876 int depth = id.depth();
00877
00878 if (id.subdet()==HcalBarrel)
00879 {
00880 if (en>=HBenergyThreshold_)
00881 {
00882 ++recentoccupancy_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00883 present_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1]=true;
00884 if (RecHitPresentByDepth.depth[depth-1])
00885 RecHitPresentByDepth.depth[depth-1]->setBinContent(CalcEtaBin(id.subdet(),ieta,depth)+1,iphi,1);
00886 }
00888
00889 int RBXindex = logicalMap_->getHcalFrontEndId(rechit->detid()).rbxIndex();
00890
00891 occupancy_RBX[RBXindex]++;
00893 }
00894 else if (id.subdet()==HcalEndcap)
00895 {
00896 if (en>=HEenergyThreshold_)
00897 {
00898 ++recentoccupancy_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00899 present_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1]=true;
00900 if (RecHitPresentByDepth.depth[depth-1])
00901 RecHitPresentByDepth.depth[depth-1]->setBinContent(CalcEtaBin(id.subdet(),ieta,depth)+1,iphi,1);
00902 }
00904
00905 int RBXindex = logicalMap_->getHcalFrontEndId(rechit->detid()).rbxIndex();
00906
00907 occupancy_RBX[RBXindex]++;
00909 }
00910 else if (id.subdet()==HcalForward)
00911 {
00912 if (en>=HFenergyThreshold_)
00913 {
00914 ++recentoccupancy_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00915
00916 present_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1]=true;
00917 if (RecHitPresentByDepth.depth[depth-1])
00918 RecHitPresentByDepth.depth[depth-1]->setBinContent(CalcEtaBin(id.subdet(),ieta,depth)+1,iphi,1);
00919 }
00920 }
00921 else if (id.subdet()==HcalOuter)
00922 {
00923 if (en>=HOenergyThreshold_)
00924 {
00925 ++recentoccupancy_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1];
00926 present_rechit[CalcEtaBin(id.subdet(),ieta,depth)][iphi-1][depth-1]=true;
00927 if (RecHitPresentByDepth.depth[depth-1])
00928 RecHitPresentByDepth.depth[depth-1]->setBinContent(CalcEtaBin(id.subdet(),ieta,depth)+1,iphi,1);
00929 }
00931
00932 int RBXindex = logicalMap_->getHcalFrontEndId(rechit->detid()).rbxIndex();
00933
00934 occupancy_RBX[RBXindex]++;
00936 }
00937 }
00938
00939 void HcalDeadCellMonitor::fillNevents_recentdigis()
00940 {
00941
00942 if (!deadmon_test_digis_) return;
00943
00944
00945 if (deadevt_ < minDeadEventCount_) return;
00946
00947 if (debug_>0)
00948 std::cout <<"<HcalDeadCellMonitor::fillNevents_recentdigis> CHECKING FOR RECENT MISSING DIGIS evtcount = "<<deadevt_<<std::endl;
00949
00950 int ieta=0;
00951 int iphi=0;
00952
00953 int etabins=0;
00954 int phibins=0;
00955
00957 if (deadevt_ >= 10 && deadevt_<minDeadEventCount_)
00958 if( is_RBX_loss_ == 1 )
00959 for (unsigned int depth=0;depth<RecentMissingDigisByDepth.depth.size();++depth)
00960 {
00961 RecentMissingDigisByDepth.depth[depth]->setBinContent(0,0,ievt_);
00962 etabins=RecentMissingDigisByDepth.depth[depth]->getNbinsX();
00963 phibins=RecentMissingDigisByDepth.depth[depth]->getNbinsY();
00964 for (int eta=0;eta<etabins;++eta)
00965 for (int phi=0;phi<phibins;++phi)
00966 {
00967 iphi=phi+1;
00968 for (int subdet=1;subdet<=4;++subdet)
00969 {
00970 ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
00971 if (ieta==-9999) continue;
00972 if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
00973 continue;
00974
00975 HcalDetId TempID((HcalSubdetector)subdet, ieta, iphi, (int)depth+1);
00976
00977 int index = logicalMap_->getHcalFrontEndId(TempID).rbxIndex();
00978 if(subdet==HcalForward) continue;
00979
00980 if(occupancy_RBX[index]==0)
00981 {
00982 recentoccupancy_digi[eta][phi][depth] = 0;
00983 RecentMissingDigisByDepth.depth[depth]->Fill(ieta,iphi,deadevt_);
00984 }
00985 }
00986 }
00987 }
00989
00990 for (unsigned int depth=0;depth<RecentMissingDigisByDepth.depth.size();++depth)
00991 {
00992 RecentMissingDigisByDepth.depth[depth]->setBinContent(0,0,ievt_);
00993 etabins=RecentMissingDigisByDepth.depth[depth]->getNbinsX();
00994 phibins=RecentMissingDigisByDepth.depth[depth]->getNbinsY();
00995 for (int eta=0;eta<etabins;++eta)
00996 {
00997 for (int subdet=1;subdet<=4;++subdet)
00998 {
00999 ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
01000 if (ieta==-9999) continue;
01001 for (int phi=0;phi<phibins;++phi)
01002 {
01003 iphi=phi+1;
01004
01005 if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
01006 continue;
01007
01008
01009
01010
01011
01012
01013
01014
01015 int zside=0;
01016 if (subdet==HcalForward)
01017 ieta<0 ? zside=-1 : zside=+1;
01018
01019 if (recentoccupancy_digi[eta][phi][depth]==0)
01020 {
01021 if (debug_>0)
01022 {
01023 std::cout <<"DEAD CELL; NO RECENT OCCUPANCY: subdet = "<<subdet<<", ieta = "<<ieta<<", iphi = "<<iphi<<" depth = "<<depth+1<<std::endl;
01024 std::cout <<"\t RAW COORDINATES: eta = "<<eta<< " phi = "<<phi<<" depth = "<<depth<<std::endl;
01025 std::cout <<"\t Present? "<<present_digi[eta][phi][depth]<<std::endl;
01026 }
01027
01028
01029 if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
01030 continue;
01031
01032
01033 if (RecentMissingDigisByDepth.depth[depth]) RecentMissingDigisByDepth.depth[depth]->Fill(ieta+zside,iphi,deadevt_);
01034 }
01035 }
01036 }
01037 }
01038 }
01039 FillUnphysicalHEHFBins(RecentMissingDigisByDepth);
01040
01041 return;
01042
01043 }
01044
01045
01046
01047
01048
01049 void HcalDeadCellMonitor::fillNevents_recentrechits()
01050 {
01051
01052
01053
01054
01055
01056
01057
01058
01059 if (!deadmon_test_rechits_) return;
01060 FillUnphysicalHEHFBins(RecHitPresentByDepth);
01061
01062 if (debug_>0)
01063 std::cout <<"<HcalDeadCellMonitor::fillNevents_energy> BELOW-ENERGY-THRESHOLD PLOTS"<<std::endl;
01064
01065 int ieta=0;
01066 int iphi=0;
01067
01068 int etabins=0;
01069 int phibins=0;
01070
01072 if (deadevt_ >= 10 && deadevt_<minDeadEventCount_)
01073 if( is_RBX_loss_ == 1 )
01074 for (unsigned int depth=0;depth<RecentMissingRecHitsByDepth.depth.size();++depth)
01075 {
01076 RecentMissingRecHitsByDepth.depth[depth]->setBinContent(0,0,ievt_);
01077 etabins=RecentMissingRecHitsByDepth.depth[depth]->getNbinsX();
01078 phibins=RecentMissingRecHitsByDepth.depth[depth]->getNbinsY();
01079 for (int eta=0;eta<etabins;++eta)
01080 for (int phi=0;phi<phibins;++phi)
01081 {
01082 iphi=phi+1;
01083 for (int subdet=1;subdet<=4;++subdet)
01084 {
01085 ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
01086 if (ieta==-9999) continue;
01087 if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
01088 continue;
01089
01090 HcalDetId TempID((HcalSubdetector)subdet, ieta, iphi, (int)depth+1);
01091
01092 int index = logicalMap_->getHcalFrontEndId(TempID).rbxIndex();
01093 if(subdet==HcalForward) continue;
01094
01095 if(occupancy_RBX[index]==0)
01096 {
01097 recentoccupancy_rechit[eta][phi][depth] = 0;
01098 RecentMissingRecHitsByDepth.depth[depth]->Fill(ieta,iphi,deadevt_);
01099 }
01100 }
01101 }
01102 }
01104
01105 if (deadevt_ < minDeadEventCount_) return;
01106
01107 for (unsigned int depth=0;depth<RecentMissingRecHitsByDepth.depth.size();++depth)
01108 {
01109 RecentMissingRecHitsByDepth.depth[depth]->setBinContent(0,0,ievt_);
01110 etabins=RecentMissingRecHitsByDepth.depth[depth]->getNbinsX();
01111 phibins=RecentMissingRecHitsByDepth.depth[depth]->getNbinsY();
01112 for (int eta=0;eta<etabins;++eta)
01113 {
01114 for (int subdet=1;subdet<=4;++subdet)
01115 {
01116 ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
01117 if (ieta==-9999) continue;
01118 for (int phi=0;phi<phibins;++phi)
01119 {
01120 iphi=phi+1;
01121 if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
01122 continue;
01123
01124 if (recentoccupancy_rechit[eta][phi][depth]>0) continue;
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134 int zside=0;
01135 if (subdet==HcalForward)
01136 {
01137 ieta<0 ? zside=-1 : zside=+1;
01138 }
01139
01140 if (debug_>2)
01141 std::cout <<"DEAD CELL; BELOW ENERGY THRESHOLD; subdet = "<<subdet<<" ieta = "<<ieta<<", phi = "<<iphi<<" depth = "<<depth+1<<std::endl;
01142 if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
01143 continue;
01144
01145 if (RecentMissingRecHitsByDepth.depth[depth]) RecentMissingRecHitsByDepth.depth[depth]->Fill(ieta+zside,iphi,deadevt_);
01146 }
01147 }
01148 }
01149 }
01150
01151 FillUnphysicalHEHFBins(RecentMissingRecHitsByDepth);
01152
01153 return;
01154 }
01155
01156
01157 void HcalDeadCellMonitor::fillNevents_problemCells()
01158 {
01159
01160
01161 if (debug_>0)
01162 std::cout <<"<HcalDeadCellMonitor::fillNevents_problemCells> FILLING PROBLEM CELL PLOTS"<<std::endl;
01163
01164 int ieta=0;
01165 int iphi=0;
01166
01167
01168
01169 NumBadHB=0;
01170 NumBadHE=0;
01171 NumBadHO=0;
01172 NumBadHF=0;
01173 NumBadHFLUMI=0;
01174 NumBadHO0=0;
01175 NumBadHO12=0;
01176 NumBadHO1P02=0;
01177
01178 int knownBadHB=0;
01179 int knownBadHE=0;
01180 int knownBadHF=0;
01181 int knownBadHO=0;
01182 int knownBadHFLUMI=0;
01183 int knownBadHO0=0;
01184 int knownBadHO12=0;
01185
01186
01187 unsigned int neverpresentHB=0;
01188 unsigned int neverpresentHE=0;
01189 unsigned int neverpresentHO=0;
01190 unsigned int neverpresentHF=0;
01191
01192 unsigned int unoccupiedHB=0;
01193 unsigned int unoccupiedHE=0;
01194 unsigned int unoccupiedHO=0;
01195 unsigned int unoccupiedHF=0;
01196
01197 unsigned int belowenergyHB=0;
01198 unsigned int belowenergyHE=0;
01199 unsigned int belowenergyHO=0;
01200 unsigned int belowenergyHF=0;
01201
01202 unsigned int energyneverpresentHB=0;
01203 unsigned int energyneverpresentHE=0;
01204 unsigned int energyneverpresentHO=0;
01205 unsigned int energyneverpresentHF=0;
01206
01207 if (deadevt_>=minDeadEventCount_)
01208 Nevents->Fill(1,deadevt_);
01209
01210 int etabins=0;
01211 int phibins=0;
01212
01213
01214
01215
01216
01218
01219 unsigned int RBX_loss_HB=0;
01220 unsigned int RBX_loss_HE=0;
01221 unsigned int RBX_loss_HO=0;
01222
01223 unsigned int counter_HB = 0;
01224 unsigned int counter_HE = 0;
01225 unsigned int counter_HO = 0;
01226
01227 for(int i=0; i<132; i++)
01228 {
01229 if(occupancy_RBX[i]==0 && is_RBX_loss_ == 1)
01230 {
01231 if(i<=35)
01232 { counter_HB ++ ; RBX_loss_HB = 72*(counter_HB); }
01233 if(i>=36 && i<=71)
01234 { counter_HE ++ ; RBX_loss_HE = 72*(counter_HE); }
01235 if(i>=72 && i<=132)
01236 { counter_HO ++ ; RBX_loss_HO = 72*(counter_HO); }
01237
01238 if(excludeHO1P02_==true && i==109) NumBadHO1P02 = 72;
01239 }
01240
01241 if(occupancy_RBX[i]>0)
01242 RBX_loss_VS_LB->Fill(currentLS, i, 0);
01243 if(occupancy_RBX[i]==0 && is_RBX_loss_ == 1)
01244 RBX_loss_VS_LB->Fill(currentLS, i, 1);
01245 }
01246
01247 if (deadevt_ >= 10 && deadevt_<minDeadEventCount_)
01248 if( is_RBX_loss_ == 1 )
01249 {
01250 NumBadHB+=RBX_loss_HB;
01251 NumBadHE+=RBX_loss_HE;
01252 NumBadHO+=RBX_loss_HO;
01253
01254 belowenergyHB+=RBX_loss_HB;
01255 belowenergyHE+=RBX_loss_HE;
01256 belowenergyHO+=RBX_loss_HO;
01257
01258 unoccupiedHB+=RBX_loss_HB;
01259 unoccupiedHE+=RBX_loss_HE;
01260 unoccupiedHO+=RBX_loss_HO;
01261 }
01263
01264 for (unsigned int depth=0;depth<DigiPresentByDepth.depth.size();++depth)
01265 {
01266 DigiPresentByDepth.depth[depth]->setBinContent(0,0,ievt_);
01267 etabins=DigiPresentByDepth.depth[depth]->getNbinsX();
01268 phibins=DigiPresentByDepth.depth[depth]->getNbinsY();
01269 for (int eta=0;eta<etabins;++eta)
01270 {
01271 for (int phi=0;phi<phibins;++phi)
01272 {
01273 iphi=phi+1;
01274 for (int subdet=1;subdet<=4;++subdet)
01275 {
01276 ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
01277 if (ieta==-9999) continue;
01278 if (!validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1))
01279 continue;
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296 if ((present_digi[eta][phi][depth]==0) ||
01297 (deadmon_test_digis_ && recentoccupancy_digi[eta][phi][depth]==0 && (deadevt_>=minDeadEventCount_)) ||
01298 (deadmon_test_rechits_ && recentoccupancy_rechit[eta][phi][depth]==0 && (deadevt_>=minDeadEventCount_))
01299 )
01300 {
01301 HcalDetId TempID((HcalSubdetector)subdet, ieta, iphi, (int)depth+1);
01302 if (subdet==HcalBarrel)
01303 {
01304 ++NumBadHB;
01305 if (KnownBadCells_.find(TempID.rawId())!=KnownBadCells_.end())
01306 ++knownBadHB;
01307 }
01308 else if (subdet==HcalEndcap)
01309 {
01310 ++NumBadHE;
01311 if (KnownBadCells_.find(TempID.rawId())!=KnownBadCells_.end())
01312 ++knownBadHE;
01313 }
01314
01315 else if (subdet==HcalOuter)
01316 {
01317 ++NumBadHO;
01318 if (abs(ieta)<5) ++NumBadHO0;
01319 else ++NumBadHO12;
01320
01321 if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
01322 {
01323 --NumBadHO;
01324 --NumBadHO12;
01325 }
01326
01327 if (excludeHO1P02_==true && ( (ieta>4 && ieta<10) && (iphi<=10 || iphi>70) ) )
01328 ++NumBadHO1P02;
01329
01330 if (KnownBadCells_.find(TempID.rawId())!=KnownBadCells_.end())
01331 {
01332 ++knownBadHO;
01333 if (abs(ieta)<5) ++knownBadHO0;
01334 else ++knownBadHO12;
01335
01336 if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
01337 {
01338 --knownBadHO;
01339 --knownBadHO12;
01340 }
01341 }
01342 }
01343 else if (subdet==HcalForward)
01344 {
01345 ++NumBadHF;
01346 if (depth==1 && (abs(ieta)==33 || abs(ieta)==34))
01347 ++NumBadHFLUMI;
01348 else if (depth==2 && (abs(ieta)==35 || abs(ieta)==36))
01349 ++NumBadHFLUMI;
01350 if (KnownBadCells_.find(TempID.rawId())!=KnownBadCells_.end())
01351 {
01352 ++knownBadHF;
01353 if (depth==1 && (abs(ieta)==33 || abs(ieta)==34))
01354 ++knownBadHFLUMI;
01355 else if (depth==2 && (abs(ieta)==35 || abs(ieta)==36))
01356 ++knownBadHFLUMI;
01357 }
01358 }
01359 }
01360 if (present_digi[eta][phi][depth]==0 )
01361 {
01362 if (subdet==HcalBarrel) ++neverpresentHB;
01363 else if (subdet==HcalEndcap) ++neverpresentHE;
01364 else if (subdet==HcalOuter)
01365 {
01366 ++neverpresentHO;
01367 if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
01368 --neverpresentHO;
01369 }
01370 else if (subdet==HcalForward) ++neverpresentHF;
01371 }
01372
01373 if (deadmon_test_digis_ && recentoccupancy_digi[eta][phi][depth]==0 && deadevt_>=minDeadEventCount_)
01374 {
01375 HcalDetId TempID((HcalSubdetector)subdet, ieta, iphi, (int)depth+1);
01376 if (subdet==HcalBarrel) ++unoccupiedHB;
01377 else if (subdet==HcalEndcap) ++unoccupiedHE;
01378 else if (subdet==HcalOuter)
01379 {
01380 ++unoccupiedHO;
01381 if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
01382 --unoccupiedHO;
01383 if (KnownBadCells_.find(TempID.rawId())!=KnownBadCells_.end() && abs(ieta)<=10)
01384 --unoccupiedHO;
01385 }
01386 else if (subdet==HcalForward) ++unoccupiedHF;
01387 }
01388
01389 if (deadmon_test_rechits_)
01390 {
01391 if (present_rechit[eta][phi][depth]==0)
01392 {
01393 if (subdet==HcalBarrel) ++energyneverpresentHB;
01394 else if (subdet==HcalEndcap) ++energyneverpresentHE;
01395 else if (subdet==HcalOuter)
01396 {
01397 ++energyneverpresentHO;
01398 if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
01399 --energyneverpresentHO;
01400 }
01401 else if (subdet==HcalForward) ++energyneverpresentHF;
01402 }
01403 if (recentoccupancy_rechit[eta][phi][depth]==0 && deadevt_>=minDeadEventCount_)
01404 {
01405 HcalDetId TempID((HcalSubdetector)subdet, ieta, iphi, (int)depth+1);
01406 if (subdet==HcalBarrel) ++belowenergyHB;
01407 else if (subdet==HcalEndcap) ++belowenergyHE;
01408 else if (subdet==HcalOuter)
01409 {
01410 ++belowenergyHO;
01411 if (excludeHORing2_==true && abs(ieta)>10 && isSiPM(ieta,iphi,depth+1)==false)
01412 --belowenergyHO;
01413 if (KnownBadCells_.find(TempID.rawId())!=KnownBadCells_.end() && abs(ieta)<=10)
01414 --belowenergyHO;
01415 }
01416 else if (subdet==HcalForward) ++belowenergyHF;
01417 }
01418 }
01419 }
01420 }
01421 }
01422 }
01423
01424
01425 NumberOfNeverPresentDigisHB->Fill(currentLS,neverpresentHB);
01426 NumberOfNeverPresentDigisHE->Fill(currentLS,neverpresentHE);
01427 NumberOfNeverPresentDigisHO->Fill(currentLS,neverpresentHO);
01428 NumberOfNeverPresentDigisHF->Fill(currentLS,neverpresentHF);
01429 NumberOfNeverPresentDigis->Fill(currentLS,neverpresentHB+neverpresentHE+neverpresentHO+neverpresentHF);
01430
01431 if (deadevt_>=minDeadEventCount_ && is_RBX_loss_ == 1 )
01432 {
01433 if( NumBadHB<RBX_loss_HB )
01434 NumBadHB+=RBX_loss_HB;
01435 if( NumBadHE<RBX_loss_HE )
01436 NumBadHE+=RBX_loss_HE;
01437 if( NumBadHO<RBX_loss_HO )
01438 NumBadHO+=RBX_loss_HO;
01439
01440 if( belowenergyHB<RBX_loss_HB )
01441 belowenergyHB+=RBX_loss_HB;
01442 if( belowenergyHE<RBX_loss_HE )
01443 belowenergyHE+=RBX_loss_HE;
01444 if( belowenergyHO<RBX_loss_HO )
01445 belowenergyHO+=RBX_loss_HO;
01446
01447 if( unoccupiedHB<RBX_loss_HB )
01448 unoccupiedHB+=RBX_loss_HB;
01449 if( unoccupiedHE<RBX_loss_HE )
01450 unoccupiedHE+=RBX_loss_HE;
01451 if( unoccupiedHO<RBX_loss_HO )
01452 unoccupiedHO+=RBX_loss_HO;
01453
01454 is_RBX_loss_ = 0;
01455 }
01456
01457 ProblemsVsLB_HB->Fill(currentLS,NumBadHB-knownBadHB+0.0001);
01458 ProblemsVsLB_HE->Fill(currentLS,NumBadHE-knownBadHE+0.0001);
01459 ProblemsVsLB_HO->Fill(currentLS,NumBadHO-knownBadHO+0.0001);
01460 ProblemsVsLB_HF->Fill(currentLS,NumBadHF-knownBadHF+0.0001);
01461 ProblemsVsLB_HBHEHF->Fill(currentLS,NumBadHB+NumBadHE+NumBadHF-knownBadHB-knownBadHE-knownBadHF+0.0001);
01462 ProblemsVsLB->Fill(currentLS,NumBadHB+NumBadHE+NumBadHO+NumBadHF-knownBadHB-knownBadHE-knownBadHO-knownBadHF+0.0001);
01463
01464 if(excludeHO1P02_==true)
01465 ProblemsVsLB_HO->Fill(0, NumBadHO1P02);
01466
01467 if( NumBadHB+NumBadHE+NumBadHF-knownBadHB-knownBadHE-knownBadHF < 50 )
01468 alarmer_counter_ = 0;
01469
01470 if( alarmer_counter_ >= 10 )
01471 ProblemsInLastNLB_HBHEHF_alarm->Fill( std::min(int(NumBadHB+NumBadHE+NumBadHF-knownBadHB-knownBadHE-knownBadHF), 99) );
01472
01473
01474
01475
01476 if (deadmon_test_digis_)
01477 {
01478 NumberOfRecentMissingDigisHB->Fill(currentLS,unoccupiedHB);
01479 NumberOfRecentMissingDigisHE->Fill(currentLS,unoccupiedHE);
01480 NumberOfRecentMissingDigisHO->Fill(currentLS,unoccupiedHO);
01481 NumberOfRecentMissingDigisHF->Fill(currentLS,unoccupiedHF);
01482 NumberOfRecentMissingDigis->Fill(currentLS,unoccupiedHB+unoccupiedHE+unoccupiedHO+unoccupiedHF);
01483 }
01484
01485 if (deadmon_test_rechits_)
01486 {
01487 NumberOfNeverPresentRecHitsHB->Fill(currentLS,energyneverpresentHB);
01488 NumberOfNeverPresentRecHitsHE->Fill(currentLS,energyneverpresentHE);
01489 NumberOfNeverPresentRecHitsHO->Fill(currentLS,energyneverpresentHO);
01490 NumberOfNeverPresentRecHitsHF->Fill(currentLS,energyneverpresentHF);
01491 NumberOfNeverPresentRecHits->Fill(currentLS,energyneverpresentHB+energyneverpresentHE+energyneverpresentHO+energyneverpresentHF);
01492
01493 NumberOfRecentMissingRecHitsHB->Fill(currentLS,belowenergyHB);
01494 NumberOfRecentMissingRecHitsHE->Fill(currentLS,belowenergyHE);
01495 NumberOfRecentMissingRecHitsHO->Fill(currentLS,belowenergyHO);
01496 NumberOfRecentMissingRecHitsHF->Fill(currentLS,belowenergyHF);
01497 NumberOfRecentMissingRecHits->Fill(currentLS,belowenergyHB+belowenergyHE+belowenergyHO+belowenergyHF);
01498 }
01499
01500 return;
01501 }
01502
01503
01504 void HcalDeadCellMonitor::zeroCounters(bool resetpresent)
01505 {
01506
01507
01508
01509
01510 for (unsigned int i=0;i<85;++i)
01511 {
01512 for (unsigned int j=0;j<72;++j)
01513 {
01514 for (unsigned int k=0;k<4;++k)
01515 {
01516 if (resetpresent) present_digi[i][j][k]=false;
01517 if (resetpresent) present_rechit[i][j][k]=false;
01518 recentoccupancy_digi[i][j][k]=0;
01519 recentoccupancy_rechit[i][j][k]=0;
01520 }
01521 }
01522 }
01523
01524 for (unsigned int i=0;i<132;++i)
01525 {
01526 occupancy_RBX[i] = 0;
01527 rbxlost[i] = 0;
01528 }
01529
01530 return;
01531 }
01532
01533 DEFINE_FWK_MODULE(HcalDeadCellMonitor);