Skip to content

Commit

Permalink
Merge pull request #36620 from Dr15Jones/deprecated_L1TriggerGlobalCa…
Browse files Browse the repository at this point in the history
…loTrigger

Fix CMS deprecated warnings in  L1Trigger/GlobalCaloTrigger
  • Loading branch information
cmsbuild committed Jan 5, 2022
2 parents 174d797 + cc8423c commit c33bb6c
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 41 deletions.
1 change: 0 additions & 1 deletion L1Trigger/GlobalCaloTrigger/plugins/L1GctEmulator.cc
Expand Up @@ -7,7 +7,6 @@
// EDM includes
#include "FWCore/PluginManager/interface/ModuleDef.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/ESHandle.h"
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/GlobalCaloTrigger/plugins/L1GctPrintLuts.h
Expand Up @@ -20,7 +20,7 @@

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"

#include "FWCore/Framework/interface/Event.h"

Expand All @@ -42,7 +42,7 @@
// class declaration
//

class L1GctPrintLuts : public edm::EDAnalyzer {
class L1GctPrintLuts : public edm::one::EDAnalyzer<> {
public:
/// typedefs
typedef L1GlobalCaloTrigger::lutPtr lutPtr;
Expand Down
4 changes: 3 additions & 1 deletion L1Trigger/GlobalCaloTrigger/plugins/L1GctValidation.cc
Expand Up @@ -18,7 +18,9 @@ L1GctValidation::L1GctValidation(const edm::ParameterSet& iConfig)
m_energy_tag(iConfig.getUntrackedParameter<edm::InputTag>("gctInputTag", edm::InputTag("gctDigis"))),
m_jfParsToken(esConsumes<L1GctJetFinderParams, L1GctJetFinderParamsRcd>()),
m_htMissScaleToken(esConsumes<L1CaloEtScale, L1HtMissScaleRcd>()),
m_hfRingEtScaleToken(esConsumes<L1CaloEtScale, L1HfRingEtScaleRcd>()) {}
m_hfRingEtScaleToken(esConsumes<L1CaloEtScale, L1HfRingEtScaleRcd>()) {
usesResource(TFileService::kSharedResource);
}

L1GctValidation::~L1GctValidation() {
// do anything here that needs to be done at desctruction time
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/GlobalCaloTrigger/plugins/L1GctValidation.h
Expand Up @@ -21,7 +21,7 @@

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"

#include "FWCore/Framework/interface/Event.h"

Expand All @@ -40,7 +40,7 @@
// class declaration
//

class L1GctValidation : public edm::EDAnalyzer {
class L1GctValidation : public edm::one::EDAnalyzer<edm::one::SharedResources> {
public:
explicit L1GctValidation(const edm::ParameterSet&);
~L1GctValidation() override;
Expand Down
49 changes: 27 additions & 22 deletions L1Trigger/GlobalCaloTrigger/test/L1GctTest.cc
Expand Up @@ -72,14 +72,18 @@ L1GctTest::L1GctTest(const edm::ParameterSet& iConfig)
<< "no reference filename provided for firmware tests.\n"
<< "Specify non-blank parameter referenceFile in cmsRun configuration\n";
}

m_jfParsToken = esConsumes();
m_chanMaskToken = esConsumes();
m_etScaleToken = esConsumes();
m_htMissScaleToken = esConsumes();
m_hfRingEtScaleToken = esConsumes();
}

L1GctTest::~L1GctTest() {
// do anything here that needs to be done at desctruction time
// (e.g. close files, deallocate resources etc.)

delete m_gct;
delete m_tester;
}

//
Expand All @@ -93,7 +97,12 @@ void L1GctTest::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
bool endOfFile = false;

configureGct(iSetup);
m_tester->configure(iSetup);
L1GctJetFinderParams const& jfPars = iSetup.getData(m_jfParsToken);
L1GctChannelMask const& chanMask = iSetup.getData(m_chanMaskToken);
L1CaloEtScale const& etScale = iSetup.getData(m_etScaleToken);
L1CaloEtScale const& htMissScale = iSetup.getData(m_htMissScaleToken);
L1CaloEtScale const& hfRingEtScale = iSetup.getData(m_hfRingEtScaleToken);
m_tester->configure(jfPars, chanMask, etScale, htMissScale, hfRingEtScale);

m_gct->setupTauAlgo(theUseNewTauAlgoFlag, false);
if (theConfigParamsPrintFlag)
Expand Down Expand Up @@ -177,7 +186,7 @@ void L1GctTest::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
void L1GctTest::beginJob() {
// instantiate the GCT
m_gct = new L1GlobalCaloTrigger(L1GctJetLeafCard::hardwareJetFinder);
m_tester = new gctTestFunctions();
m_tester = std::make_unique<gctTestFunctions>();

// Fill the jetEtCalibLuts vector
lutPtr nextLut(new L1GctJetEtCalibrationLut());
Expand All @@ -201,31 +210,27 @@ void L1GctTest::endJob() {

void L1GctTest::configureGct(const edm::EventSetup& c) {
// get data from EventSetup
edm::ESHandle<L1GctJetFinderParams> jfPars;
c.get<L1GctJetFinderParamsRcd>().get(jfPars); // which record?
edm::ESHandle<L1GctChannelMask> chanMask;
c.get<L1GctChannelMaskRcd>().get(chanMask); // which record?
edm::ESHandle<L1CaloEtScale> etScale;
c.get<L1JetEtScaleRcd>().get(etScale); // which record?
edm::ESHandle<L1CaloEtScale> htMissScale;
c.get<L1HtMissScaleRcd>().get(htMissScale); // which record?
edm::ESHandle<L1CaloEtScale> hfRingEtScale;
c.get<L1HfRingEtScaleRcd>().get(hfRingEtScale); // which record?

m_gct->setJetFinderParams(jfPars.product());

L1GctJetFinderParams const& jfPars = c.getData(m_jfParsToken);
L1GctChannelMask const& chanMask = c.getData(m_chanMaskToken);
L1CaloEtScale const& etScale = c.getData(m_etScaleToken);
L1CaloEtScale const& htMissScale = c.getData(m_htMissScaleToken);
L1CaloEtScale const& hfRingEtScale = c.getData(m_hfRingEtScaleToken);

m_gct->setJetFinderParams(&jfPars);

// tell the jet Et Luts about the scales
for (unsigned ieta = 0; ieta < m_jetEtCalibLuts.size(); ieta++) {
m_jetEtCalibLuts.at(ieta)->setFunction(jfPars.product());
m_jetEtCalibLuts.at(ieta)->setOutputEtScale(etScale.product());
m_jetEtCalibLuts.at(ieta)->setFunction(&jfPars);
m_jetEtCalibLuts.at(ieta)->setOutputEtScale(&etScale);
}

// pass all the setup info to the gct
m_gct->setJetEtCalibrationLuts(m_jetEtCalibLuts);
m_gct->setJetFinderParams(jfPars.product());
m_gct->setHtMissScale(htMissScale.product());
m_gct->setupHfSumLuts(hfRingEtScale.product());
m_gct->setChannelMask(chanMask.product());
m_gct->setJetFinderParams(&jfPars);
m_gct->setHtMissScale(&htMissScale);
m_gct->setupHfSumLuts(&hfRingEtScale);
m_gct->setChannelMask(&chanMask);
}

void L1GctTest::configParamsPrint(std::ostream& out) {
Expand Down
17 changes: 14 additions & 3 deletions L1Trigger/GlobalCaloTrigger/test/L1GctTest.h
Expand Up @@ -19,7 +19,7 @@

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
Expand All @@ -33,8 +33,13 @@ class gctTestFunctions;
//
// class declaration
//
class L1GctJetFinderParamsRcd;
class L1GctChannelMaskRcd;
class L1JetEtScaleRcd;
class L1HtMissScaleRcd;
class L1HfRingEtScaleRcd;

class L1GctTest : public edm::EDAnalyzer {
class L1GctTest : public edm::one::EDAnalyzer<> {
public:
/// typedefs
typedef L1GlobalCaloTrigger::lutPtr lutPtr;
Expand All @@ -56,7 +61,13 @@ class L1GctTest : public edm::EDAnalyzer {
L1GlobalCaloTrigger* m_gct;
lutPtrVector m_jetEtCalibLuts;

gctTestFunctions* m_tester;
std::unique_ptr<gctTestFunctions> m_tester;

edm::ESGetToken<L1GctJetFinderParams, L1GctJetFinderParamsRcd> m_jfParsToken;
edm::ESGetToken<L1GctChannelMask, L1GctChannelMaskRcd> m_chanMaskToken;
edm::ESGetToken<L1CaloEtScale, L1JetEtScaleRcd> m_etScaleToken;
edm::ESGetToken<L1CaloEtScale, L1HtMissScaleRcd> m_htMissScaleToken;
edm::ESGetToken<L1CaloEtScale, L1HfRingEtScaleRcd> m_hfRingEtScaleToken;

bool theElectronTestIsEnabled;
bool theSingleEventTestIsEnabled;
Expand Down
1 change: 0 additions & 1 deletion L1Trigger/GlobalCaloTrigger/test/L1GctTestAnalyzer.cc
Expand Up @@ -6,7 +6,6 @@

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
Expand Down
8 changes: 4 additions & 4 deletions L1Trigger/GlobalCaloTrigger/test/L1GctTestAnalyzer.h
Expand Up @@ -17,7 +17,7 @@
//

// user include files
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"

#include "FWCore/Framework/interface/Event.h"

Expand All @@ -31,12 +31,12 @@
// class decleration
//

class L1GctTestAnalyzer : public edm::EDAnalyzer {
class L1GctTestAnalyzer : public edm::one::EDAnalyzer<> {
public:
explicit L1GctTestAnalyzer(const edm::ParameterSet&);
~L1GctTestAnalyzer();
~L1GctTestAnalyzer() override;

virtual void analyze(const edm::Event&, const edm::EventSetup&);
void analyze(const edm::Event&, const edm::EventSetup&) override;

void doRctEM(const edm::Event&, edm::InputTag label);
void doInternEM(const edm::Event&, edm::InputTag label);
Expand Down
14 changes: 10 additions & 4 deletions L1Trigger/GlobalCaloTrigger/test/gctTestFunctions.cc
Expand Up @@ -51,8 +51,13 @@ gctTestFunctions::~gctTestFunctions() {
//=================================================================================================================
//
/// Configuration method
void gctTestFunctions::configure(const edm::EventSetup& c) {
void gctTestFunctions::configure(const L1GctJetFinderParams& jfPars,
const L1GctChannelMask& chanMask,
const L1CaloEtScale& etScale,
const L1CaloEtScale& htMissScale,
const L1CaloEtScale& hfRingEtScale) {
// get data from EventSetup
/*
edm::ESHandle<L1GctJetFinderParams> jfPars;
c.get<L1GctJetFinderParamsRcd>().get(jfPars); // which record?
edm::ESHandle<L1GctChannelMask> chanMask;
Expand All @@ -63,10 +68,11 @@ void gctTestFunctions::configure(const edm::EventSetup& c) {
c.get<L1HtMissScaleRcd>().get(htMissScale); // which record?
edm::ESHandle<L1CaloEtScale> hfRingEtScale;
c.get<L1HfRingEtScaleRcd>().get(hfRingEtScale); // which record?
*/

theEnergyAlgosTester->configure(chanMask.product());
theHtTester->configure(etScale.product(), htMissScale.product(), jfPars.product());
theHfEtSumsTester->configure(hfRingEtScale.product());
theEnergyAlgosTester->configure(&chanMask);
theHtTester->configure(&etScale, &htMissScale, &jfPars);
theHfEtSumsTester->configure(&hfRingEtScale);
}

//=================================================================================================================
Expand Down
10 changes: 9 additions & 1 deletion L1Trigger/GlobalCaloTrigger/test/gctTestFunctions.h
Expand Up @@ -35,6 +35,10 @@ class gctTestHfEtSums;

class L1GlobalCaloTrigger;

class L1GctJetFinderParams;
class L1GctChannelMask;
class L1CaloEtScale;

class gctTestFunctions {
public:
// structs and typedefs
Expand All @@ -44,7 +48,11 @@ class gctTestFunctions {
~gctTestFunctions();

// Configuration method based on EventSetup - so not to be called from constructor
void configure(const edm::EventSetup& c);
void configure(const L1GctJetFinderParams& jfPars,
const L1GctChannelMask& chanMask,
const L1CaloEtScale& etScale,
const L1CaloEtScale& htMissScale,
const L1CaloEtScale& hfRingEtScale);

/// Clear vectors of input data
void reset();
Expand Down

0 comments on commit c33bb6c

Please sign in to comment.