Skip to content

Commit

Permalink
Use thread-safe access to HCAL containers
Browse files Browse the repository at this point in the history
The HCAL containers are no longer updated once published in the
EventSetup. Therefore when reading the conditions one must either
1) if using HcalChannelQuality, use 'withTopo' when getting the object
  from the HcalChannelQualityRcd
2) after getting the conditions, copy it and call setTopo on the copy.
  • Loading branch information
Dr15Jones committed Oct 30, 2014
1 parent 2771cfb commit 4257768
Show file tree
Hide file tree
Showing 31 changed files with 77 additions and 93 deletions.
1 change: 1 addition & 0 deletions CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/Framework/interface/ESTransientHandle.h"
#include "Geometry/HcalTowerAlgo/interface/HcalTrigTowerGeometry.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"
#include "FWCore/Utilities/interface/Exception.h"
Expand Down
1 change: 1 addition & 0 deletions CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef CALOTPGTRANSCODERULUT_H
#define CALOTPGTRANSCODERULUT_H 1

#include <memory>
#include <vector>
#include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h"

Expand Down
4 changes: 2 additions & 2 deletions CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class HcalPulseShapes {
Shape hpdShape_v2, hpdShapeMC_v2;
Shape hpdShape_v3, hpdShapeMC_v3;
Shape hpdBV30Shape_v2, hpdBV30ShapeMC_v2;
const HcalMCParams * theMCParams;
HcalMCParams * theMCParams;
const HcalTopology * theTopology;
const HcalRecoParams * theRecoParams;
HcalRecoParams * theRecoParams;
typedef std::map<int, const Shape *> ShapeMap;
ShapeMap theShapes;

Expand Down
2 changes: 1 addition & 1 deletion CaloOnlineTools/HcalOnlineDb/src/HcalLutGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void HcalLutGenerator::analyze(const edm::Event& iEvent, const edm::EventSetup&
//_____ get Channel Quality conditions from Event Setup (example)______
//
edm::ESHandle<HcalChannelQuality> hCQ;
iSetup.get<HcalChannelQualityRcd>().get(hCQ);
iSetup.get<HcalChannelQualityRcd>().get("withTopo",hCQ);
const HcalChannelQuality * _cq = &(*hCQ);
//
/*
Expand Down
2 changes: 1 addition & 1 deletion CondTools/Hcal/plugins/HcalChannelQualityPopConAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class HcalChannelQualityPopConAnalyzer: public popcon::PopConAnalyzer<HcalChanne
//Using ES to get the data:

edm::ESHandle<HcalChannelQuality> objecthandle;
esetup.get<HcalChannelQualityRcd>().get(objecthandle);
esetup.get<HcalChannelQualityRcd>().get("withTopo",objecthandle);
myDBObject = new HcalChannelQuality(*objecthandle.product() );
}

Expand Down
2 changes: 1 addition & 1 deletion DQM/HcalMonitorClient/interface/HcalMonitorClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class HcalMonitorClient: public edm::EDAnalyzer
std::vector<HcalBaseDQClient*> clients_;

DQMStore* dqmStore_;
HcalChannelQuality* chanquality_;
const HcalChannelQuality* chanquality_;

HcalSummaryClient* summaryClient_;
EtaPhiHists* ChannelStatus;
Expand Down
5 changes: 2 additions & 3 deletions DQM/HcalMonitorClient/src/HcalMonitorClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,8 @@ void HcalMonitorClient::beginRun(const edm::Run& r, const edm::EventSetup& c)
c.get<IdealGeometryRecord>().get(topo);

edm::ESHandle<HcalChannelQuality> p;
c.get<HcalChannelQualityRcd>().get(p);
chanquality_= new HcalChannelQuality(*p.product());
if (!chanquality_->topo()) chanquality_->setTopo(topo.product());
c.get<HcalChannelQualityRcd>().get("withTopo",p);
chanquality_= p.product();

if (dqmStore_ && ChannelStatus==0)
{
Expand Down
15 changes: 7 additions & 8 deletions DQM/HcalMonitorTasks/src/HcalBeamMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ void HcalBeamMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c)
// Get Channel quality info for the run
// Exclude bad channels from overall calculation
edm::ESHandle<HcalChannelQuality> p;
c.get<HcalChannelQualityRcd>().get(p);
HcalChannelQuality* chanquality = new HcalChannelQuality(*p.product());
c.get<HcalChannelQualityRcd>().get("withTopo",p);
const HcalChannelQuality* chanquality = p.product();
std::vector<DetId> mydetids = chanquality->getAllChannels();

for (unsigned int i=0;i<mydetids.size();++i)
Expand All @@ -446,20 +446,19 @@ void HcalBeamMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c)
(id.depth()==2 && (abs(id.ieta())==35 || abs(id.ieta())==36)))
{
const HcalChannelStatus* origstatus=chanquality->getValues(id);
HcalChannelStatus* mystatus=new HcalChannelStatus(origstatus->rawId(),origstatus->getValue());
if (mystatus->isBitSet(HcalChannelStatus::HcalCellHot))
HcalChannelStatus mystatus(origstatus->rawId(),origstatus->getValue());
if (mystatus.isBitSet(HcalChannelStatus::HcalCellHot))
BadCells_[id]=HcalChannelStatus::HcalCellHot;

else if (mystatus->isBitSet(HcalChannelStatus::HcalCellDead))
else if (mystatus.isBitSet(HcalChannelStatus::HcalCellDead))
BadCells_[id]=HcalChannelStatus::HcalCellDead;

if (mystatus->isBitSet(HcalChannelStatus::HcalCellHot) ||
mystatus->isBitSet(HcalChannelStatus::HcalCellDead))
if (mystatus.isBitSet(HcalChannelStatus::HcalCellHot) ||
mystatus.isBitSet(HcalChannelStatus::HcalCellDead))
{
if (id.depth()==1) --ring1totalchannels_;
else if (id.depth()==2) --ring2totalchannels_;
}
delete mystatus;
} // if ((id.depth()==1) ...
} // for (unsigned int i=0;...)

Expand Down
5 changes: 2 additions & 3 deletions DQM/HcalMonitorTasks/src/HcalDeadCellMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ void HcalDeadCellMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c
if (badChannelStatusMask_>0)
{
edm::ESHandle<HcalChannelQuality> p;
c.get<HcalChannelQualityRcd>().get(p);
HcalChannelQuality* chanquality= new HcalChannelQuality(*p.product());
c.get<HcalChannelQualityRcd>().get("withTopo",p);
const HcalChannelQuality* chanquality= p.product();
std::vector<DetId> mydetids = chanquality->getAllChannels();
for (std::vector<DetId>::const_iterator i = mydetids.begin();
i!=mydetids.end();
Expand All @@ -420,7 +420,6 @@ void HcalDeadCellMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c
if ((status & badChannelStatusMask_))
KnownBadCells_[id.rawId()]=status;
}
delete chanquality;
} // if (badChannelStatusMask_>0)
return;
} //void HcalDeadCellMonitor::beginRun(...)
Expand Down
4 changes: 2 additions & 2 deletions DQM/HcalMonitorTasks/src/HcalDetDiagLEDMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ void HcalDetDiagLEDMonitor::beginRun(const edm::Run& run, const edm::EventSetup&
if (mergeRuns_==false) this->reset();

edm::ESHandle<HcalChannelQuality> p;
c.get<HcalChannelQualityRcd>().get(p);
HcalChannelQuality* chanquality= new HcalChannelQuality(*p.product());
c.get<HcalChannelQualityRcd>().get("withTopo",p);
const HcalChannelQuality* chanquality= p.product();
std::vector<DetId> mydetids = chanquality->getAllChannels();
KnownBadCells_.clear();

Expand Down
4 changes: 2 additions & 2 deletions DQM/HcalMonitorTasks/src/HcalDetDiagLaserMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ HcalDetDiagLaserMonitor::HcalDetDiagLaserMonitor(const edm::ParameterSet& iConfi
}
void HcalDetDiagLaserMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c){
edm::ESHandle<HcalChannelQuality> p;
c.get<HcalChannelQualityRcd>().get(p);
HcalChannelQuality* chanquality= new HcalChannelQuality(*p.product());
c.get<HcalChannelQualityRcd>().get("withTopo",p);
const HcalChannelQuality* chanquality= p.product();
std::vector<DetId> mydetids = chanquality->getAllChannels();
KnownBadCells_.clear();

Expand Down
4 changes: 2 additions & 2 deletions DQM/HcalMonitorTasks/src/HcalDetDiagPedestalMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ void HcalDetDiagPedestalMonitor::beginRun(const edm::Run& run, const edm::EventS
emap=conditions_->getHcalMapping();

edm::ESHandle<HcalChannelQuality> p;
c.get<HcalChannelQualityRcd>().get(p);
HcalChannelQuality* chanquality= new HcalChannelQuality(*p.product());
c.get<HcalChannelQualityRcd>().get("withTopo",p);
const HcalChannelQuality* chanquality= p.product();
std::vector<DetId> mydetids = chanquality->getAllChannels();
KnownBadCells_.clear();

Expand Down
10 changes: 4 additions & 6 deletions DQM/HcalMonitorTasks/src/HcalDigiMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ void HcalDigiMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c)

// Get all pedestals by Cap ID
edm::ESHandle<HcalChannelQuality> p;
c.get<HcalChannelQualityRcd>().get(p);
HcalChannelQuality *chanquality= new HcalChannelQuality(*p.product());
c.get<HcalChannelQualityRcd>().get("withTopo",p);
const HcalChannelQuality *chanquality= p.product();
std::vector<DetId> mydetids = chanquality->getAllChannels();
PedestalsByCapId_.clear();

Expand All @@ -377,15 +377,14 @@ void HcalDigiMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c)

if (tevt_==0) this->setup(); // create all histograms; not necessary if merging runs together
if (mergeRuns_==false) this->reset(); // call reset at start of all runs
delete chanquality;

// Get known dead cells for this run
KnownBadCells_.clear();
if (badChannelStatusMask_>0)
{
edm::ESHandle<HcalChannelQuality> p;
c.get<HcalChannelQualityRcd>().get(p);
HcalChannelQuality* chanquality= new HcalChannelQuality(*p.product());
c.get<HcalChannelQualityRcd>().get("withTopo",p);
const HcalChannelQuality* chanquality= p.product();
std::vector<DetId> mydetids = chanquality->getAllChannels();
for (std::vector<DetId>::const_iterator i = mydetids.begin();
i!=mydetids.end();
Expand All @@ -399,7 +398,6 @@ void HcalDigiMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c)
KnownBadCells_[id.rawId()]=status;
}
}
delete chanquality;
} // if (badChannelStatusMask_>0)

} // void HcalDigiMonitor::beginRun()
Expand Down
5 changes: 1 addition & 4 deletions DQMOffline/Hcal/src/HcalRecHitsAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,8 @@ void HcalRecHitsAnalyzer::analyze(edm::Event const& ev, edm::EventSetup const& c

// HCAL channel status map ****************************************
edm::ESHandle<HcalChannelQuality> hcalChStatus;
c.get<HcalChannelQualityRcd>().get( hcalChStatus );
c.get<HcalChannelQualityRcd>().get( "withTopo", hcalChStatus );
theHcalChStatus = hcalChStatus.product();
edm::ESHandle<HcalTopology> topo;
c.get<IdealGeometryRecord>().get(topo);
if (!theHcalChStatus->topo()) theHcalChStatus->setTopo(topo.product());

// Assignment of severity levels **********************************
edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

#include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputer.h"
#include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputerRcd.h"
#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
#include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h"
#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"


#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
Expand Down Expand Up @@ -88,9 +89,10 @@ void EgammaHLTHcalIsolationProducersRegional::produce(edm::Event& iEvent, const
iEvent.getByToken(hbheRecHitProducer_, hbheRecHitHandle);
const HBHERecHitCollection* hbheRecHitCollection = hbheRecHitHandle.product();

edm::ESHandle<HcalChannelQuality> hcalChStatus;
iSetup.get<HcalChannelQualityRcd>().get(hcalChStatus);

edm::ESHandle<HcalChannelQuality> hcalChStatusHandle;
iSetup.get<HcalChannelQualityRcd>().get( "withTopo", hcalChStatusHandle );
const HcalChannelQuality* hcalChStatus = hcalChStatusHandle.product();

edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComp;
iSetup.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComp);

Expand Down Expand Up @@ -121,7 +123,7 @@ void EgammaHLTHcalIsolationProducersRegional::produce(edm::Event& iEvent, const
if(doEtSum_) {
isol = isolAlgo_->getEtSum(recoEcalCandRef->superCluster()->eta(),
recoEcalCandRef->superCluster()->phi(),hbheRecHitCollection,caloGeom,
hcalSevLvlComp.product(),hcalChStatus.product());
hcalSevLvlComp.product(),hcalChStatus);

if (doRhoCorrection_) {
if (fabs(recoEcalCandRef->superCluster()->eta()) < 1.442)
Expand All @@ -132,7 +134,7 @@ void EgammaHLTHcalIsolationProducersRegional::produce(edm::Event& iEvent, const
} else {
isol = isolAlgo_->getESum(recoEcalCandRef->superCluster()->eta(),recoEcalCandRef->superCluster()->phi(),
hbheRecHitCollection,caloGeom,
hcalSevLvlComp.product(),hcalChStatus.product());
hcalSevLvlComp.product(),hcalChStatus);
}

isoMap.insert(recoEcalCandRef, isol);
Expand Down
7 changes: 3 additions & 4 deletions RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,10 @@ void CaloTowersCreator::produce(edm::Event& e, const edm::EventSetup& c) {

// HCAL channel status map ****************************************
edm::ESHandle<HcalChannelQuality> hcalChStatus;
c.get<HcalChannelQualityRcd>().get( hcalChStatus );
c.get<HcalChannelQualityRcd>().get( "withTopo", hcalChStatus );

const HcalChannelQuality* dbHcalChStatus = hcalChStatus.product();

if (!dbHcalChStatus->topo()) dbHcalChStatus->setTopo(htopo.product());


// Assignment of severity levels **********************************
edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
c.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComputerHndl);
Expand Down
2 changes: 1 addition & 1 deletion RecoLocalCalo/HcalRecAlgos/test/HcalRecHitReflagger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ HcalRecHitReflagger::~HcalRecHitReflagger()
void HcalRecHitReflagger::beginRun(const Run& r, const EventSetup& c)
{
edm::ESHandle<HcalChannelQuality> p;
c.get<HcalChannelQualityRcd>().get(p);
c.get<HcalChannelQualityRcd>().get("withTopo",p);
const HcalChannelQuality& chanquality_(*p.product());

std::vector<DetId> mydetids = chanquality_.getAllChannels();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ Original Author: John Paul Chou (Brown University)
#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "DataFormats/JetReco/interface/TrackExtrapolation.h"
#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
#include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h"
#include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputerRcd.h"
#include "RecoLocalCalo/HcalRecAlgos/interface/HcalCaloFlagLabels.h"
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h"
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"

#include "RecoMET/METAlgorithms/interface/HcalHPDRBXMap.h"
#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
#include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h"

HBHEIsolatedNoiseReflagger::HBHEIsolatedNoiseReflagger(const edm::ParameterSet& iConfig) :

Expand Down Expand Up @@ -78,8 +79,9 @@ HBHEIsolatedNoiseReflagger::produce(edm::Event& iEvent, const edm::EventSetup& e
const EcalChannelStatus* dbEcalChStatus = ecalChStatus.product();

// get the HCAL channel status map

edm::ESHandle<HcalChannelQuality> hcalChStatus;
evSetup.get<HcalChannelQualityRcd>().get( hcalChStatus );
evSetup.get<HcalChannelQualityRcd>().get( "withTopo", hcalChStatus );
const HcalChannelQuality* dbHcalChStatus = hcalChStatus.product();

// get the severity level computers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Description: "Reflags" HB/HE hits based on their ECAL, HCAL, and tracking isolat
Original Author: John Paul Chou (Brown University)
Thursday, September 2, 2010
*/
#include <memory>

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
Expand All @@ -22,7 +23,7 @@ class HBHEIsolatedNoiseReflagger : public edm::EDProducer {


private:
virtual void produce(edm::Event&, const edm::EventSetup&);
virtual void produce(edm::Event&, const edm::EventSetup&) override;

void DumpHBHEHitMap(std::vector<HBHEHitMap>& i) const;

Expand Down
Loading

0 comments on commit 4257768

Please sign in to comment.