Skip to content

Commit

Permalink
use esConsumes
Browse files Browse the repository at this point in the history
  • Loading branch information
kpedro88 committed Jul 29, 2020
1 parent 88d5b19 commit 2625222
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
21 changes: 11 additions & 10 deletions L1Trigger/L1TTrackMatch/plugins/L1TkElectronTrackProducer.cc
Expand Up @@ -22,7 +22,7 @@

#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "FWCore/Utilities/interface/ESGetToken.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "DataFormats/L1TCorrelator/interface/TkElectron.h"
Expand Down Expand Up @@ -95,17 +95,19 @@ class L1TkElectronTrackProducer : public edm::stream::EDProducer<> {
std::vector<double> dEtaCutoff_;
std::string matchType_;

const edm::EDGetTokenT<EGammaBxCollection> egToken;
const edm::EDGetTokenT<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > trackToken;
const edm::EDGetTokenT<EGammaBxCollection> egToken_;
const edm::EDGetTokenT<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > trackToken_;
const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomToken_;
};

//
// constructors and destructor
//
L1TkElectronTrackProducer::L1TkElectronTrackProducer(const edm::ParameterSet& iConfig)
: egToken(consumes<EGammaBxCollection>(iConfig.getParameter<edm::InputTag>("L1EGammaInputTag"))),
trackToken(consumes<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > >(
iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))) {
: egToken_(consumes<EGammaBxCollection>(iConfig.getParameter<edm::InputTag>("L1EGammaInputTag"))),
trackToken_(consumes<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > >(
iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))),
geomToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()) {
// label of the collection produced
// e.g. EG or IsoEG if all objects are kept
// EGIsoTrk or IsoEGIsoTrk if only the EG or IsoEG
Expand Down Expand Up @@ -145,19 +147,18 @@ void L1TkElectronTrackProducer::produce(edm::Event& iEvent, const edm::EventSetu
std::unique_ptr<TkElectronCollection> result(new TkElectronCollection);

// geometry needed to call pTFrom2Stubs
edm::ESHandle<TrackerGeometry> geomHandle;
iSetup.get<TrackerDigiGeometryRecord>().get("idealForDigi", geomHandle);
edm::ESHandle<TrackerGeometry> geomHandle = iSetup.getHandle(geomToken_);
const TrackerGeometry* tGeom = geomHandle.product();

// the L1EGamma objects
edm::Handle<EGammaBxCollection> eGammaHandle;
iEvent.getByToken(egToken, eGammaHandle);
iEvent.getByToken(egToken_, eGammaHandle);
EGammaBxCollection eGammaCollection = (*eGammaHandle.product());
EGammaBxCollection::const_iterator egIter;

// the L1Tracks
edm::Handle<L1TTTrackCollectionType> L1TTTrackHandle;
iEvent.getByToken(trackToken, L1TTTrackHandle);
iEvent.getByToken(trackToken_, L1TTTrackHandle);
L1TTTrackCollectionType::const_iterator trackIter;

if (!eGammaHandle.isValid()) {
Expand Down
1 change: 0 additions & 1 deletion L1Trigger/L1TTrackMatch/plugins/L1TkEmParticleProducer.cc
Expand Up @@ -13,7 +13,6 @@

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"

#include "DataFormats/Common/interface/Handle.h"
Expand Down
11 changes: 6 additions & 5 deletions L1Trigger/L1TTrackMatch/plugins/L1TkFastVertexProducer.cc
Expand Up @@ -18,7 +18,7 @@
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"

#include "FWCore/Utilities/interface/ESGetToken.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
Expand Down Expand Up @@ -88,6 +88,7 @@ class L1TkFastVertexProducer : public edm::global::EDProducer<> {
const edm::EDGetTokenT<edm::HepMCProduct> hepmcToken_;
const edm::EDGetTokenT<std::vector<reco::GenParticle> > genparticleToken_;
const edm::EDGetTokenT<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > trackToken_;
const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topoToken_;
};

//
Expand All @@ -106,7 +107,8 @@ L1TkFastVertexProducer::L1TkFastVertexProducer(const edm::ParameterSet& iConfig)
genparticleToken_(
consumes<std::vector<reco::GenParticle> >(iConfig.getParameter<edm::InputTag>("GenParticleInputTag"))),
trackToken_(consumes<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > >(
iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))) {
iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))),
topoToken_(esConsumes<TrackerTopology, TrackerTopologyRcd>()) {
zMax_ = (float)iConfig.getParameter<double>("ZMAX");
chi2Max_ = (float)iConfig.getParameter<double>("CHI2MAX");
pTMinTra_ = (float)iConfig.getParameter<double>("PTMINTRA");
Expand Down Expand Up @@ -143,9 +145,8 @@ void L1TkFastVertexProducer::produce(edm::StreamID, edm::Event& iEvent, const ed
auto result = std::make_unique<TkPrimaryVertexCollection>();

// Tracker Topology
edm::ESHandle<TrackerTopology> tTopoHandle_;
iSetup.get<TrackerTopologyRcd>().get(tTopoHandle_);
const TrackerTopology* tTopo = tTopoHandle_.product();
edm::ESHandle<TrackerTopology> tTopoHandle = iSetup.getHandle(topoToken_);
const TrackerTopology* tTopo = tTopoHandle.product();

TH1F htmp("htmp", ";z (cm); Tracks", nBinning_, xmin_, xmax_);
TH1F htmp_weight("htmp_weight", ";z (cm); Tracks", nBinning_, xmin_, xmax_);
Expand Down
1 change: 0 additions & 1 deletion L1Trigger/L1TTrackMatch/plugins/L1TkMuonProducer.cc
Expand Up @@ -8,7 +8,6 @@
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

Expand Down

0 comments on commit 2625222

Please sign in to comment.