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

Made L1RCTProducer a stream module #29115

Merged
merged 1 commit into from
Mar 13, 2020
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
13 changes: 7 additions & 6 deletions L1Trigger/RegionalCaloTrigger/interface/L1RCTProducer.h
@@ -1,7 +1,7 @@
#ifndef L1RCTProducer_h
#define L1RCTProducer_h

#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"

#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/ESHandle.h"
Expand Down Expand Up @@ -37,14 +37,15 @@

#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <string>
#include <memory>

class L1RCT;
class L1RCTLookupTables;

class L1RCTProducer : public edm::EDProducer {
class L1RCTProducer : public edm::stream::EDProducer<> {
public:
explicit L1RCTProducer(const edm::ParameterSet &ps);
~L1RCTProducer() override;

void beginRun(edm::Run const &r, const edm::EventSetup &c) final;
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &context) final;
void produce(edm::Event &e, const edm::EventSetup &c) final;
Expand All @@ -60,8 +61,8 @@ class L1RCTProducer : public edm::EDProducer {
void printUpdatedFedMaskVerbose();

private:
L1RCTLookupTables *rctLookupTables;
L1RCT *rct;
std::unique_ptr<L1RCTLookupTables> rctLookupTables;
std::unique_ptr<L1RCT> rct;
bool useEcal;
bool useHcal;
std::vector<edm::InputTag> ecalDigis;
Expand All @@ -73,7 +74,7 @@ class L1RCTProducer : public edm::EDProducer {
std::string conditionsLabel;

// Create a channel mask object to be updated at every Run....
L1RCTChannelMask *fedUpdatedMask;
std::unique_ptr<L1RCTChannelMask> fedUpdatedMask;

enum crateSection { c_min, ebOddFed = c_min, ebEvenFed, eeFed, hbheFed, hfFed, hfFedUp, c_max = hfFedUp };

Expand Down
18 changes: 3 additions & 15 deletions L1Trigger/RegionalCaloTrigger/plugins/L1RCTProducer.cc
Expand Up @@ -32,7 +32,7 @@ const int L1RCTProducer::crateFED[18][6] = {{613, 614, 603, 702, 718, 1118},

L1RCTProducer::L1RCTProducer(const edm::ParameterSet &conf)
: rctLookupTables(new L1RCTLookupTables),
rct(new L1RCT(rctLookupTables)),
rct(new L1RCT(rctLookupTables.get())),
useEcal(conf.getParameter<bool>("useEcal")),
useHcal(conf.getParameter<bool>("useHcal")),
ecalDigis(conf.getParameter<std::vector<edm::InputTag>>("ecalDigis")),
Expand All @@ -57,15 +57,6 @@ L1RCTProducer::L1RCTProducer(const edm::ParameterSet &conf)
}
}

L1RCTProducer::~L1RCTProducer() {
if (rct != nullptr)
delete rct;
if (rctLookupTables != nullptr)
delete rctLookupTables;
if (fedUpdatedMask != nullptr)
delete fedUpdatedMask;
}

void L1RCTProducer::beginRun(edm::Run const &run, const edm::EventSetup &eventSetup) {
// std::cout << "getFedsFromOmds is " << getFedsFromOmds << std::endl;

Expand Down Expand Up @@ -156,10 +147,7 @@ void L1RCTProducer::updateFedVector(const edm::EventSetup &eventSetup,
// This is the beginning of run. We delete the old
// create the new and set it in the LUTs

if (fedUpdatedMask != nullptr)
delete fedUpdatedMask;

fedUpdatedMask = new L1RCTChannelMask();
fedUpdatedMask = std::make_unique<L1RCTChannelMask>();
// copy a constant object
for (int i = 0; i < 18; i++) {
for (int j = 0; j < 2; j++) {
Expand Down Expand Up @@ -291,7 +279,7 @@ void L1RCTProducer::updateFedVector(const edm::EventSetup &eventSetup,
}
}

rctLookupTables->setChannelMask(fedUpdatedMask);
rctLookupTables->setChannelMask(fedUpdatedMask.get());
}

const std::vector<int> L1RCTProducer::getFedVectorFromRunInfo(const edm::EventSetup &eventSetup) {
Expand Down