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

modernize EventFilter/Phase2TrackerRawToDigi #36414

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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