Skip to content

Commit

Permalink
Merge pull request #36414 from mmusich/modernizeEventFilterPhase2Trac…
Browse files Browse the repository at this point in the history
…kerRawToDigi

modernize `EventFilter/Phase2TrackerRawToDigi`
  • Loading branch information
cmsbuild authored Dec 11, 2021
2 parents e713ae1 + 53646bb commit 1117863
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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<FEDRawDataCollection> token_;
Expand All @@ -39,9 +39,9 @@ Phase2Tracker::Phase2TrackerCommissioningDigiProducer::Phase2TrackerCommissionin
token_ = consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("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<FEDRawDataCollection> buffers;
event.getByToken(token_, buffers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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<Phase2TrackerCabling, Phase2TrackerCablingRcd> ph2CablingESToken_;

unsigned int runNumber_;
edm::EDGetTokenT<FEDRawDataCollection> token_;
const Phase2TrackerCabling* cabling_;
Expand Down Expand Up @@ -69,25 +68,17 @@ using namespace std;
namespace Phase2Tracker {

Phase2TrackerDigiProducer::Phase2TrackerDigiProducer(const edm::ParameterSet& pset)
: runNumber_(0), cabling_(nullptr), cacheId_(0) {
: ph2CablingESToken_(esConsumes<edm::Transition::BeginRun>()), runNumber_(0), cabling_(nullptr), cacheId_(0) {
// define product
produces<edm::DetSetVector<Phase2TrackerDigi>>("ProcessedRaw");
token_ = consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("ProductLabel"));
}

Phase2TrackerDigiProducer::~Phase2TrackerDigiProducer() {}

void Phase2TrackerDigiProducer::beginJob() {}

void Phase2TrackerDigiProducer::beginRun(edm::Run const& run, edm::EventSetup const& es) {
// fetch cabling from event setup
edm::ESHandle<Phase2TrackerCabling> c;
es.get<Phase2TrackerCablingRcd>().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();
Expand Down

0 comments on commit 1117863

Please sign in to comment.