Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use esConsumes in ConditionDumperInEdm #35968

Merged
merged 1 commit into from Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -33,13 +33,15 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"

#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/Common/interface/ConditionsInEdm.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"

#include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
#include "CondFormats/RunInfo/interface/RunInfo.h"

//
// class declaration
//
Expand All @@ -62,20 +64,14 @@ class ConditionDumperInEdm : public edm::one::EDProducer<edm::RunCache<edm::Cond
void endRunProduce(edm::Run&, const edm::EventSetup&) final;
void produce(edm::Event&, const edm::EventSetup&) final;

template <typename R, typename T>
const T* get(const edm::EventSetup& setup) {
edm::ESHandle<T> handle;
setup.get<R>().get(handle);
return handle.product();
}

// ----------member data ---------------------------

const edm::InputTag gtEvmDigisLabel_;

edm::ConditionsInEventBlock eventBlock_;

const edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> gtEvmDigisLabelToken_;
const edm::ESGetToken<RunInfo, RunInfoRcd> runInfoToken_;
const edm::EDPutTokenT<edm::ConditionsInLumiBlock> lumiToken_;
const edm::EDPutTokenT<edm::ConditionsInRunBlock> runToken_;
const edm::EDPutTokenT<edm::ConditionsInEventBlock> eventToken_;
Expand Down
13 changes: 5 additions & 8 deletions EventFilter/L1GlobalTriggerRawToDigi/src/ConditionDumperInEdm.cc
Expand Up @@ -6,15 +6,13 @@
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GtfeExtWord.h"

#include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
#include "CondFormats/RunInfo/interface/RunInfo.h"

//
// constructors and destructor
//
ConditionDumperInEdm::ConditionDumperInEdm(const edm::ParameterSet& iConfig)
: gtEvmDigisLabel_{iConfig.getParameter<edm::InputTag>("gtEvmDigisLabel")},
gtEvmDigisLabelToken_{consumes<L1GlobalTriggerEvmReadoutRecord>(gtEvmDigisLabel_)},
runInfoToken_{esConsumes<edm::Transition::EndRun>()},
//per LUMI products
lumiToken_{produces<edm::ConditionsInLumiBlock, edm::Transition::EndLuminosityBlock>()},
//per RUN products
Expand Down Expand Up @@ -45,11 +43,10 @@ void ConditionDumperInEdm::endRunProduce(edm::Run& run, const edm::EventSetup& s
//dump of RunInfo
auto& runBlock = *(runCache(run.index()));
{
edm::ESHandle<RunInfo> sum;
setup.get<RunInfoRcd>().get(sum);
runBlock.BStartCurrent = sum->m_start_current;
runBlock.BStopCurrent = sum->m_stop_current;
runBlock.BAvgCurrent = sum->m_avg_current;
auto const& sum = setup.getData(runInfoToken_);
runBlock.BStartCurrent = sum.m_start_current;
runBlock.BStopCurrent = sum.m_stop_current;
runBlock.BAvgCurrent = sum.m_avg_current;
}

run.emplace(runToken_, runBlock);
Expand Down