From 53646bb299bd54560a88c5beb240d8f06c96422c Mon Sep 17 00:00:00 2001 From: mmusich Date: Wed, 8 Dec 2021 14:18:43 +0100 Subject: [PATCH] modernize EventFilter/Phase2TrackerRawToDigi --- .../Phase2TrackerCommissioningDigiProducer.cc | 14 +++++------ .../plugins/Phase2TrackerDigiProducer.cc | 23 ++++++------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/EventFilter/Phase2TrackerRawToDigi/plugins/Phase2TrackerCommissioningDigiProducer.cc b/EventFilter/Phase2TrackerRawToDigi/plugins/Phase2TrackerCommissioningDigiProducer.cc index 59a774b5284e7..0bbb0c713a3a6 100644 --- a/EventFilter/Phase2TrackerRawToDigi/plugins/Phase2TrackerCommissioningDigiProducer.cc +++ b/EventFilter/Phase2TrackerRawToDigi/plugins/Phase2TrackerCommissioningDigiProducer.cc @@ -5,7 +5,7 @@ #include "EventFilter/Phase2TrackerRawToDigi/interface/Phase2TrackerFEDBuffer.h" #include "EventFilter/Phase2TrackerRawToDigi/interface/Phase2TrackerFEDHeader.h" #include "EventFilter/Phase2TrackerRawToDigi/interface/utils.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -14,13 +14,13 @@ namespace Phase2Tracker { - class Phase2TrackerCommissioningDigiProducer : public edm::EDProducer { + class Phase2TrackerCommissioningDigiProducer : public edm::global::EDProducer<> { public: /// constructor Phase2TrackerCommissioningDigiProducer(const edm::ParameterSet& pset); /// default constructor - ~Phase2TrackerCommissioningDigiProducer() override; - void produce(edm::Event& event, const edm::EventSetup& es) override; + ~Phase2TrackerCommissioningDigiProducer() override = default; + void produce(edm::StreamID, edm::Event& ev, const edm::EventSetup& es) const override; private: edm::EDGetTokenT token_; @@ -39,9 +39,9 @@ Phase2Tracker::Phase2TrackerCommissioningDigiProducer::Phase2TrackerCommissionin token_ = consumes(pset.getParameter("ProductLabel")); } -Phase2Tracker::Phase2TrackerCommissioningDigiProducer::~Phase2TrackerCommissioningDigiProducer() {} - -void Phase2Tracker::Phase2TrackerCommissioningDigiProducer::produce(edm::Event& event, const edm::EventSetup& es) { +void Phase2Tracker::Phase2TrackerCommissioningDigiProducer::produce(edm::StreamID, + edm::Event& event, + const edm::EventSetup& es) const { // Retrieve FEDRawData collection edm::Handle buffers; event.getByToken(token_, buffers); diff --git a/EventFilter/Phase2TrackerRawToDigi/plugins/Phase2TrackerDigiProducer.cc b/EventFilter/Phase2TrackerRawToDigi/plugins/Phase2TrackerDigiProducer.cc index b1e58b61a5d62..d8db61f1b8372 100644 --- a/EventFilter/Phase2TrackerRawToDigi/plugins/Phase2TrackerDigiProducer.cc +++ b/EventFilter/Phase2TrackerRawToDigi/plugins/Phase2TrackerDigiProducer.cc @@ -13,8 +13,7 @@ #include "EventFilter/Phase2TrackerRawToDigi/interface/Phase2TrackerFEDRawChannelUnpacker.h" #include "EventFilter/Phase2TrackerRawToDigi/interface/Phase2TrackerFEDZSChannelUnpacker.h" #include "EventFilter/Phase2TrackerRawToDigi/interface/utils.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -23,18 +22,18 @@ namespace Phase2Tracker { - class Phase2TrackerDigiProducer : public edm::EDProducer { + class Phase2TrackerDigiProducer : public edm::stream::EDProducer<> { public: /// constructor Phase2TrackerDigiProducer(const edm::ParameterSet& pset); /// default constructor - ~Phase2TrackerDigiProducer() override; - void beginJob() override; + ~Phase2TrackerDigiProducer() override = default; void beginRun(edm::Run const&, edm::EventSetup const&) override; void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override; private: + const edm::ESGetToken ph2CablingESToken_; + unsigned int runNumber_; edm::EDGetTokenT token_; const Phase2TrackerCabling* cabling_; @@ -69,25 +68,17 @@ using namespace std; namespace Phase2Tracker { Phase2TrackerDigiProducer::Phase2TrackerDigiProducer(const edm::ParameterSet& pset) - : runNumber_(0), cabling_(nullptr), cacheId_(0) { + : ph2CablingESToken_(esConsumes()), runNumber_(0), cabling_(nullptr), cacheId_(0) { // define product produces>("ProcessedRaw"); token_ = consumes(pset.getParameter("ProductLabel")); } - Phase2TrackerDigiProducer::~Phase2TrackerDigiProducer() {} - - void Phase2TrackerDigiProducer::beginJob() {} - void Phase2TrackerDigiProducer::beginRun(edm::Run const& run, edm::EventSetup const& es) { // fetch cabling from event setup - edm::ESHandle c; - es.get().get(c); - cabling_ = c.product(); + cabling_ = &es.getData(ph2CablingESToken_); } - void Phase2TrackerDigiProducer::endJob() {} - void Phase2TrackerDigiProducer::produce(edm::Event& event, const edm::EventSetup& es) { // empty vectors for the next event proc_work_registry_.clear();