From 0b80e875da447420c5fa698d6518c639c07d506a Mon Sep 17 00:00:00 2001 From: mmusich Date: Sun, 21 Mar 2021 11:54:04 +0100 Subject: [PATCH] migrate Validation/SiOuterTrackerV to esConsumes --- .../plugins/OuterTrackerMonitorTrackingParticles.cc | 6 ++---- .../plugins/OuterTrackerMonitorTrackingParticles.h | 1 + Validation/TrackerRecHits/src/SiStripRecHitsValid.cc | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Validation/SiOuterTrackerV/plugins/OuterTrackerMonitorTrackingParticles.cc b/Validation/SiOuterTrackerV/plugins/OuterTrackerMonitorTrackingParticles.cc index 420c30848ef36..fc9dc92ad0cd6 100644 --- a/Validation/SiOuterTrackerV/plugins/OuterTrackerMonitorTrackingParticles.cc +++ b/Validation/SiOuterTrackerV/plugins/OuterTrackerMonitorTrackingParticles.cc @@ -38,7 +38,7 @@ // constructors and destructor // OuterTrackerMonitorTrackingParticles::OuterTrackerMonitorTrackingParticles(const edm::ParameterSet &iConfig) - : conf_(iConfig) { + : m_topoToken(esConsumes()), conf_(iConfig) { topFolderName_ = conf_.getParameter("TopFolderName"); trackingParticleToken_ = consumes>(conf_.getParameter("trackingParticleToken")); @@ -80,9 +80,7 @@ void OuterTrackerMonitorTrackingParticles::analyze(const edm::Event &iEvent, con iEvent.getByToken(ttStubMCTruthToken_, MCTruthTTStubHandle); // Geometries - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology *const tTopo = tTopoHandle.product(); + const TrackerTopology *const tTopo = &iSetup.getData(m_topoToken); // Loop over tracking particles int this_tp = 0; diff --git a/Validation/SiOuterTrackerV/plugins/OuterTrackerMonitorTrackingParticles.h b/Validation/SiOuterTrackerV/plugins/OuterTrackerMonitorTrackingParticles.h index e4c402c56a114..dde2474ccdd23 100644 --- a/Validation/SiOuterTrackerV/plugins/OuterTrackerMonitorTrackingParticles.h +++ b/Validation/SiOuterTrackerV/plugins/OuterTrackerMonitorTrackingParticles.h @@ -97,6 +97,7 @@ class OuterTrackerMonitorTrackingParticles : public DQMEDAnalyzer { MonitorElement *resd0_eta2to2p4 = nullptr; private: + const edm::ESGetToken m_topoToken; edm::ParameterSet conf_; edm::EDGetTokenT> trackingParticleToken_; edm::EDGetTokenT> diff --git a/Validation/TrackerRecHits/src/SiStripRecHitsValid.cc b/Validation/TrackerRecHits/src/SiStripRecHitsValid.cc index b6c02c26c5989..d5f045867ae84 100644 --- a/Validation/TrackerRecHits/src/SiStripRecHitsValid.cc +++ b/Validation/TrackerRecHits/src/SiStripRecHitsValid.cc @@ -399,8 +399,8 @@ void SiStripRecHitsValid::rechitanalysis(SiStripRecHit2D const rechit, closest = &m; } } - - if(!closest) + + if (!closest) return; rechitpro.bunch = closest->eventId().bunchCrossing();