Skip to content

Commit

Permalink
Merge pull request #33723 from mmusich/CondToolsHLT_esConsumes
Browse files Browse the repository at this point in the history
CondTools/HLT: migrate to esConsumes
  • Loading branch information
cmsbuild authored May 18, 2021
2 parents e1c83ff + cd4228b commit 74144ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 6 additions & 3 deletions CondTools/HLT/src/AlCaRecoTriggerBitsRcdRead.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class AlCaRecoTriggerBitsRcdRead : public edm::EDAnalyzer {
void printMap(edm::RunNumber_t firstRun, edm::RunNumber_t lastRun, const AlCaRecoTriggerBits &triggerMap) const;

// members
edm::ESGetToken<AlCaRecoTriggerBits, AlCaRecoTriggerBitsRcd> triggerBitsToken_;
const OutputType outputType_;
edm::ESWatcher<AlCaRecoTriggerBitsRcd> watcher_;
edm::RunNumber_t firstRun_;
Expand All @@ -69,7 +70,10 @@ class AlCaRecoTriggerBitsRcdRead : public edm::EDAnalyzer {
///////////////////////////////////////////////////////////////////////

AlCaRecoTriggerBitsRcdRead::AlCaRecoTriggerBitsRcdRead(const edm::ParameterSet &cfg)
: outputType_(this->stringToEnum(cfg.getUntrackedParameter<std::string>("outputType"))), firstRun_(0), lastRun_(0) {
: triggerBitsToken_(esConsumes<edm::Transition::BeginRun>()),
outputType_(this->stringToEnum(cfg.getUntrackedParameter<std::string>("outputType"))),
firstRun_(0),
lastRun_(0) {
// edm::LogInfo("") << "@SUB=AlCaRecoTriggerBitsRcdRead"
// << cfg.getParameter<std::string>("@module_label");

Expand Down Expand Up @@ -119,8 +123,7 @@ void AlCaRecoTriggerBitsRcdRead::beginRun(const edm::Run &run, const edm::EventS
this->printMap(firstRun_, lastRun_, lastTriggerBits_);

// Get AlCaRecoTriggerBits from EventSetup:
edm::ESHandle<AlCaRecoTriggerBits> triggerBits;
iSetup.get<AlCaRecoTriggerBitsRcd>().get(triggerBits);
const auto &triggerBits = &iSetup.getData(triggerBitsToken_);
lastTriggerBits_ = *triggerBits; // copy for later use
firstRun_ = run.run(); // keep track where it started
}
Expand Down
7 changes: 4 additions & 3 deletions CondTools/HLT/src/AlCaRecoTriggerBitsRcdUpdate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class AlCaRecoTriggerBitsRcdUpdate : public edm::EDAnalyzer {
/// Takes over memory uresponsibility for 'bitsToWrite'.
void writeBitsToDB(AlCaRecoTriggerBits *bitsToWrite) const;

edm::ESGetToken<AlCaRecoTriggerBits, AlCaRecoTriggerBitsRcd> triggerBitsToken_;
unsigned int nEventCalls_;
const unsigned int firstRunIOV_;
const int lastRunIOV_;
Expand All @@ -58,7 +59,8 @@ class AlCaRecoTriggerBitsRcdUpdate : public edm::EDAnalyzer {
///////////////////////////////////////////////////////////////////////

AlCaRecoTriggerBitsRcdUpdate::AlCaRecoTriggerBitsRcdUpdate(const edm::ParameterSet &cfg)
: nEventCalls_(0),
: triggerBitsToken_(esConsumes()),
nEventCalls_(0),
firstRunIOV_(cfg.getParameter<unsigned int>("firstRunIOV")),
lastRunIOV_(cfg.getParameter<int>("lastRunIOV")),
startEmpty_(cfg.getParameter<bool>("startEmpty")),
Expand Down Expand Up @@ -98,8 +100,7 @@ AlCaRecoTriggerBitsRcdUpdate::createStartTriggerBits(bool startEmpty, const edm:
if (startEmpty) {
return new AlCaRecoTriggerBits;
} else {
edm::ESHandle<AlCaRecoTriggerBits> triggerBits;
evtSetup.get<AlCaRecoTriggerBitsRcd>().get(triggerBits);
const auto &triggerBits = &evtSetup.getData(triggerBitsToken_);
return new AlCaRecoTriggerBits(*triggerBits); // copy old one
}
}
Expand Down

0 comments on commit 74144ae

Please sign in to comment.