From 441cd2f568ed89b7a70059c70002c46daf606db1 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 17 Sep 2021 11:42:59 -0500 Subject: [PATCH] Use esConsumes in TSGForOIFromL2 --- .../plugins/TSGForOIFromL2.cc | 37 +++++++++---------- .../plugins/TSGForOIFromL2.h | 12 ++++-- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/RecoMuon/TrackerSeedGenerator/plugins/TSGForOIFromL2.cc b/RecoMuon/TrackerSeedGenerator/plugins/TSGForOIFromL2.cc index 69ee9a0d9b32c..5201426630ef4 100644 --- a/RecoMuon/TrackerSeedGenerator/plugins/TSGForOIFromL2.cc +++ b/RecoMuon/TrackerSeedGenerator/plugins/TSGForOIFromL2.cc @@ -50,7 +50,13 @@ TSGForOIFromL2::TSGForOIFromL2(const edm::ParameterSet& iConfig) tsosDiff1_(iConfig.getParameter("tsosDiff1")), tsosDiff2_(iConfig.getParameter("tsosDiff2")), propagatorName_(iConfig.getParameter("propagatorName")), - theCategory_(std::string("Muon|RecoMuon|TSGForOIFromL2")) { + theCategory_(std::string("Muon|RecoMuon|TSGForOIFromL2")), + estimatorToken_(esConsumes(edm::ESInputTag("", estimatorName_))), + magfieldToken_(esConsumes()), + propagatorToken_(esConsumes(edm::ESInputTag("", propagatorName_))), + tmpTkGeometryToken_(esConsumes()), + geometryToken_(esConsumes()), + sHPOppositeToken_(esConsumes(edm::ESInputTag("", "hltESPSteppingHelixPropagatorOpposite"))) { produces >(); } @@ -72,19 +78,13 @@ void TSGForOIFromL2::produce(edm::StreamID sid, edm::Event& iEvent, const edm::E // Read ESHandles edm::Handle measurementTrackerH; - edm::ESHandle estimatorH; - edm::ESHandle magfieldH; - edm::ESHandle propagatorAlongH; - edm::ESHandle propagatorOppositeH; - edm::ESHandle tmpTkGeometryH; - edm::ESHandle geometryH; - - iSetup.get().get(magfieldH); - iSetup.get().get(propagatorName_, propagatorOppositeH); - iSetup.get().get(propagatorName_, propagatorAlongH); - iSetup.get().get(geometryH); - iSetup.get().get(tmpTkGeometryH); - iSetup.get().get(estimatorName_, estimatorH); + const edm::ESHandle estimatorH = iSetup.getHandle(estimatorToken_); + const edm::ESHandle magfieldH = iSetup.getHandle(magfieldToken_); + const edm::ESHandle propagatorAlongH = iSetup.getHandle(propagatorToken_); + const edm::ESHandle& propagatorOppositeH = propagatorAlongH; + const edm::ESHandle tmpTkGeometryH = iSetup.getHandle(tmpTkGeometryToken_); + const edm::ESHandle geometryH = iSetup.getHandle(geometryToken_); + iEvent.getByToken(measurementTrackerTag_, measurementTrackerH); // Read L2 track collection @@ -110,8 +110,7 @@ void TSGForOIFromL2::produce(edm::StreamID sid, edm::Event& iEvent, const edm::E std::unique_ptr propagatorOpposite = SetPropagationDirection(*propagatorOppositeH, oppositeToMomentum); // Stepping Helix Propagator for propogation from muon system to tracker - edm::ESHandle SHPOpposite; - iSetup.get().get("hltESPSteppingHelixPropagatorOpposite", SHPOpposite); + const edm::ESHandle SHPOpposite = iSetup.getHandle(sHPOppositeToken_); // Loop over the L2's and make seeds for all of them LogTrace(theCategory_) << "TSGForOIFromL2::produce: Number of L2's: " << l2TrackCol->size(); @@ -329,7 +328,7 @@ void TSGForOIFromL2::produce(edm::StreamID sid, edm::Event& iEvent, const edm::E void TSGForOIFromL2::makeSeedsWithoutHits(const GeometricSearchDet& layer, const TrajectoryStateOnSurface& tsos, const Propagator& propagatorAlong, - edm::ESHandle& estimator, + const edm::ESHandle& estimator, double errorSF, unsigned int& hitlessSeedsMade, unsigned int& numSeedsMade, @@ -363,8 +362,8 @@ void TSGForOIFromL2::makeSeedsWithoutHits(const GeometricSearchDet& layer, void TSGForOIFromL2::makeSeedsFromHits(const GeometricSearchDet& layer, const TrajectoryStateOnSurface& tsos, const Propagator& propagatorAlong, - edm::ESHandle& estimator, - edm::Handle& measurementTracker, + const edm::ESHandle& estimator, + const edm::Handle& measurementTracker, double errorSF, unsigned int& hitSeedsMade, unsigned int& numSeedsMade, diff --git a/RecoMuon/TrackerSeedGenerator/plugins/TSGForOIFromL2.h b/RecoMuon/TrackerSeedGenerator/plugins/TSGForOIFromL2.h index 67c9a995a59b7..8addc4f76c02a 100644 --- a/RecoMuon/TrackerSeedGenerator/plugins/TSGForOIFromL2.h +++ b/RecoMuon/TrackerSeedGenerator/plugins/TSGForOIFromL2.h @@ -99,12 +99,18 @@ class TSGForOIFromL2 : public edm::global::EDProducer<> { /// Counters and flags for the implementation const std::string propagatorName_; const std::string theCategory_; + const edm::ESGetToken estimatorToken_; + const edm::ESGetToken magfieldToken_; + const edm::ESGetToken propagatorToken_; + const edm::ESGetToken tmpTkGeometryToken_; + const edm::ESGetToken geometryToken_; + const edm::ESGetToken sHPOppositeToken_; /// Create seeds without hits on a given layer (TOB or TEC) void makeSeedsWithoutHits(const GeometricSearchDet& layer, const TrajectoryStateOnSurface& tsos, const Propagator& propagatorAlong, - edm::ESHandle& estimator, + const edm::ESHandle& estimator, double errorSF, unsigned int& hitlessSeedsMade, unsigned int& numSeedsMade, @@ -114,8 +120,8 @@ class TSGForOIFromL2 : public edm::global::EDProducer<> { void makeSeedsFromHits(const GeometricSearchDet& layer, const TrajectoryStateOnSurface& tsos, const Propagator& propagatorAlong, - edm::ESHandle& estimator, - edm::Handle& measurementTracker, + const edm::ESHandle& estimator, + const edm::Handle& measurementTracker, double errorSF, unsigned int& hitSeedsMade, unsigned int& numSeedsMade,