Skip to content

Commit

Permalink
Avoid the crashes in the DQM code
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Sep 30, 2015
1 parent 21624b1 commit f403a0d
Show file tree
Hide file tree
Showing 9 changed files with 178 additions and 175 deletions.
2 changes: 2 additions & 0 deletions DQM/HcalMonitorTasks/interface/HcalCoarsePedestalMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class HcalCoarsePedestalMonitor: public HcalBaseDQMonitor {
const HcalUnpackerReport& report);


void beginRun(edm::EventSetup const & c);

// Begin LumiBlock
void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
const edm::EventSetup& c) ;
Expand Down
2 changes: 2 additions & 0 deletions DQM/HcalMonitorTasks/interface/HcalDeadCellMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class HcalDeadCellMonitor: public HcalBaseDQMonitor {
void setup(DQMStore::IBooker &);
void bookHistograms(DQMStore::IBooker &ib, const edm::Run& run, const edm::EventSetup& c);
void analyze(edm::Event const&e, edm::EventSetup const&s);

void beginRun(edm::EventSetup const & c);
void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
const edm::EventSetup& c);
void endRun(const edm::Run& run, const edm::EventSetup& c);
Expand Down
2 changes: 2 additions & 0 deletions DQM/HcalMonitorTasks/interface/HcalDigiMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class HcalDigiMonitor: public HcalBaseDQMonitor {
const HcalUnpackerReport& report,
int orN, int bcN);

void beginRun(edm::EventSetup const & c);

// Begin LumiBlock
void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
const edm::EventSetup& c) ;
Expand Down
4 changes: 2 additions & 2 deletions DQM/HcalMonitorTasks/interface/HcalEtaPhiHists.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ inline bool isSiPM(int ieta, int iphi, int depth)


// Checks whether (subdet, ieta, iphi, depth) value is a valid Hcal cell
/*

inline bool validDetId(HcalSubdetector sd, int ies, int ip, int dp)
{
// inputs are (subdetector, ieta, iphi, depth)
Expand Down Expand Up @@ -549,7 +549,7 @@ inline bool validDetId(HcalSubdetector sd, int ies, int ip, int dp)


} // bool validDetId(HcalSubdetector sd, int ies, int ip, int dp)
*/


// Sets eta, phi labels for 'summary' eta-phi plots (identical to Depth 1 Eta-Phi labelling)

Expand Down
2 changes: 2 additions & 0 deletions DQM/HcalMonitorTasks/interface/HcalHotCellMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class HcalHotCellMonitor: public HcalBaseDQMonitor {
// analyze function
void analyze(edm::Event const&e, edm::EventSetup const&s);

void beginRun(edm::EventSetup const & c);

// Begin LumiBlock
void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
const edm::EventSetup& c) ;
Expand Down
22 changes: 13 additions & 9 deletions DQM/HcalMonitorTasks/src/HcalCoarsePedestalMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ HcalCoarsePedestalMonitor::HcalCoarsePedestalMonitor(const edm::ParameterSet& ps


// destructor
HcalCoarsePedestalMonitor::~HcalCoarsePedestalMonitor() {}
HcalCoarsePedestalMonitor::~HcalCoarsePedestalMonitor() {
if (topo_) delete topo_;
}


void HcalCoarsePedestalMonitor::endRun(const edm::Run& run, const edm::EventSetup& c)
Expand Down Expand Up @@ -104,10 +106,6 @@ void HcalCoarsePedestalMonitor::bookHistograms(DQMStore::IBooker &ib, const edm:
void HcalCoarsePedestalMonitor::analyze(edm::Event const&e, edm::EventSetup const&s) {
HcalBaseDQMonitor::analyze(e,s);

edm::ESHandle<HcalTopology> topo;
s.get<HcalRecNumberingRecord>().get(topo);
topo_ = &(*topo);

if (!IsAllowedCalibType()) return;
if (LumiInOrder(e.luminosityBlock())==false) return;

Expand Down Expand Up @@ -267,6 +265,12 @@ void HcalCoarsePedestalMonitor::processEvent(const HBHEDigiCollection& hbhe,
} // void HcalCoarsePedestalMonitor::processEvent(...)


void HcalCoarsePedestalMonitor::beginRun(const edm::EventSetup& c) {
edm::ESHandle<HcalTopology> htopo;
c.get<HcalRecNumberingRecord>().get(htopo);
topo_ = new HcalTopology(*htopo);
}

void HcalCoarsePedestalMonitor::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
const edm::EventSetup& c)
{
Expand Down Expand Up @@ -308,25 +312,25 @@ void HcalCoarsePedestalMonitor::fill_Nevents()
for (int eta=0;eta<83;++eta)
{
ieta=eta-41; // actual ieta value;
if (topo_->validDetId(HcalBarrel, ieta, iphi, idepth))
if (validDetId(HcalBarrel, ieta, iphi, idepth))
{
calcEta = CalcEtaBin(HcalBarrel,ieta,idepth);
CoarsePedestalsSumByDepth.depth[d]->Fill(ieta,iphi,pedestalsum_[calcEta][phi][d]);
CoarsePedestalsOccByDepth.depth[d]->Fill(ieta,iphi,pedestalocc_[calcEta][phi][d]);
}
if (topo_->validDetId(HcalEndcap, ieta, iphi, idepth))
if (validDetId(HcalEndcap, ieta, iphi, idepth))
{
calcEta = CalcEtaBin(HcalEndcap,ieta,idepth);
CoarsePedestalsSumByDepth.depth[d]->Fill(ieta,iphi,pedestalsum_[calcEta][phi][d]);
CoarsePedestalsOccByDepth.depth[d]->Fill(ieta,iphi,pedestalocc_[calcEta][phi][d]);
}
if (topo_->validDetId(HcalOuter, ieta, iphi, idepth))
if (validDetId(HcalOuter, ieta, iphi, idepth))
{
calcEta = CalcEtaBin(HcalOuter,ieta,idepth);
CoarsePedestalsSumByDepth.depth[d]->Fill(ieta,iphi,pedestalsum_[calcEta][phi][d]);
CoarsePedestalsOccByDepth.depth[d]->Fill(ieta,iphi,pedestalocc_[calcEta][phi][d]);
}
if (topo_->validDetId(HcalForward, ieta, iphi, idepth))
if (validDetId(HcalForward, ieta, iphi, idepth))
{
calcEta = CalcEtaBin(HcalBarrel,ieta,idepth);
int zside=ieta/abs(ieta);
Expand Down
24 changes: 13 additions & 11 deletions DQM/HcalMonitorTasks/src/HcalDeadCellMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ HcalDeadCellMonitor::HcalDeadCellMonitor(const edm::ParameterSet& ps):HcalBaseDQ

} //constructor

HcalDeadCellMonitor::~HcalDeadCellMonitor()
{
HcalDeadCellMonitor::~HcalDeadCellMonitor() {
if (topo_) delete topo_;
} //destructor


Expand Down Expand Up @@ -389,6 +389,12 @@ void HcalDeadCellMonitor::setup(DQMStore::IBooker &ib)

} // void HcalDeadCellMonitor::setup(...)

void HcalDeadCellMonitor::beginRun(const edm::EventSetup& c) {
edm::ESHandle<HcalTopology> htopo;
c.get<HcalRecNumberingRecord>().get(htopo);
topo_ = new HcalTopology(*htopo);
}

void HcalDeadCellMonitor::bookHistograms(DQMStore::IBooker &ib, const edm::Run& run, const edm::EventSetup& c)
{
if (debug_>1) std::cout <<"HcalDeadCellMonitor::bookHistograms"<<std::endl;
Expand Down Expand Up @@ -606,10 +612,6 @@ void HcalDeadCellMonitor::analyze(edm::Event const&e, edm::EventSetup const&s)
{
HcalBaseDQMonitor::analyze(e,s);

edm::ESHandle<HcalTopology> topo;
s.get<HcalRecNumberingRecord>().get(topo);
topo_ = &(*topo);

if (!IsAllowedCalibType()) return;
endLumiProcessed_=false;

Expand Down Expand Up @@ -1051,7 +1053,7 @@ void HcalDeadCellMonitor::fillNevents_recentdigis()
{
ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
if (ieta==-9999) continue;
if (!(topo_->validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1)))
if (!(validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1)))
continue;
// now check which dead cell tests failed; increment counter if any failed
HcalDetId TempID((HcalSubdetector)subdet, ieta, iphi, (int)depth+1);
Expand Down Expand Up @@ -1086,7 +1088,7 @@ void HcalDeadCellMonitor::fillNevents_recentdigis()
{
iphi=phi+1;

if (!(topo_->validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1)))
if (!(validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1)))
continue;

// Ignore subdetectors that weren't in run?
Expand Down Expand Up @@ -1168,7 +1170,7 @@ void HcalDeadCellMonitor::fillNevents_recentrechits()
{
ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
if (ieta==-9999) continue;
if (!(topo_->validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1)))
if (!(validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1)))
continue;
// now check which dead cell tests failed; increment counter if any failed
HcalDetId TempID((HcalSubdetector)subdet, ieta, iphi, (int)depth+1);
Expand Down Expand Up @@ -1202,7 +1204,7 @@ void HcalDeadCellMonitor::fillNevents_recentrechits()
for (int phi=0;phi<phibins;++phi)
{
iphi=phi+1;
if (!(topo_->validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1)))
if (!(validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1)))
continue;

if (recentoccupancy_rechit[eta][phi][depth]>0) continue; // cell exceeded energy at least once, so it's not dead
Expand Down Expand Up @@ -1373,7 +1375,7 @@ void HcalDeadCellMonitor::fillNevents_problemCells()
{
ieta=CalcIeta((HcalSubdetector)subdet,eta,depth+1);
if (ieta==-9999) continue;
if (!(topo_->validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1)))
if (!(validDetId((HcalSubdetector)subdet, ieta, iphi, depth+1)))
continue;
// Ignore subdetectors that weren't in run?
/*
Expand Down
Loading

0 comments on commit f403a0d

Please sign in to comment.