diff --git a/FastSimulation/Tracking/plugins/PixelTracksProducer.cc b/FastSimulation/Tracking/plugins/PixelTracksProducer.cc index 3692c8a4d4bd8..b3f478202f9e3 100644 --- a/FastSimulation/Tracking/plugins/PixelTracksProducer.cc +++ b/FastSimulation/Tracking/plugins/PixelTracksProducer.cc @@ -4,16 +4,12 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/Common/interface/OwnVector.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" - //Pixel Specific stuff #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducerFactory.h" @@ -32,7 +28,8 @@ using namespace pixeltrackfitting; -PixelTracksProducer::PixelTracksProducer(const edm::ParameterSet& conf) : theRegionProducer(nullptr) { +PixelTracksProducer::PixelTracksProducer(const edm::ParameterSet& conf) + : theRegionProducer(nullptr), ttopoToken(esConsumes()) { produces(); produces(); produces(); @@ -62,9 +59,7 @@ void PixelTracksProducer::produce(edm::Event& e, const edm::EventSetup& es) { TracksWithRecHits pixeltracks; TracksWithRecHits cleanedTracks; - edm::ESHandle httopo; - es.get().get(httopo); - const TrackerTopology& ttopo = *httopo; + const TrackerTopology& ttopo = es.getData(ttopoToken); edm::Handle hfitter; e.getByToken(fitterToken, hfitter); @@ -107,7 +102,7 @@ void PixelTracksProducer::produce(edm::Event& e, const edm::EventSetup& es) { } // fitting the triplet - std::unique_ptr track = fitter.run(TripletHits, region, es); + std::unique_ptr track = fitter.run(TripletHits, region); // decide if track should be skipped according to filter if (!theFilter(track.get(), TripletHits)) { diff --git a/FastSimulation/Tracking/plugins/PixelTracksProducer.h b/FastSimulation/Tracking/plugins/PixelTracksProducer.h index ca5ebac6635c6..fa314e712c4f5 100644 --- a/FastSimulation/Tracking/plugins/PixelTracksProducer.h +++ b/FastSimulation/Tracking/plugins/PixelTracksProducer.h @@ -1,23 +1,21 @@ #ifndef FastSimulation_Tracking_PixelTracksProducer_H #define FastSimulation_Tracking_PixelTracksProducer_H +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Utilities/interface/InputTag.h" #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" + #include class PixelFitter; class PixelTrackFilter; class TrackingRegionProducer; -namespace edm { - class ParameterSet; - class Event; - class EventSetup; -} // namespace edm - class PixelTracksProducer : public edm::stream::EDProducer<> { public: explicit PixelTracksProducer(const edm::ParameterSet& conf); @@ -32,5 +30,6 @@ class PixelTracksProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT seedProducerToken; edm::EDGetTokenT filterToken; + edm::ESGetToken ttopoToken; }; #endif diff --git a/RecoPixelVertexing/PixelLowPtUtilities/interface/TrackFitter.h b/RecoPixelVertexing/PixelLowPtUtilities/interface/TrackFitter.h index eb6d6fce0039a..11046390f5d43 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/interface/TrackFitter.h +++ b/RecoPixelVertexing/PixelLowPtUtilities/interface/TrackFitter.h @@ -4,7 +4,6 @@ #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/TrackReco/interface/Track.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -23,8 +22,7 @@ class TrackFitter : public PixelFitterBase { ~TrackFitter() override {} std::unique_ptr run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup& setup) const override; + const TrackingRegion& region) const override; private: float getCotThetaAndUpdateZip( diff --git a/RecoPixelVertexing/PixelLowPtUtilities/src/TrackFitter.cc b/RecoPixelVertexing/PixelLowPtUtilities/src/TrackFitter.cc index b40d79aa499ca..32bcadeb7478e 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/src/TrackFitter.cc +++ b/RecoPixelVertexing/PixelLowPtUtilities/src/TrackFitter.cc @@ -39,8 +39,7 @@ namespace { /*****************************************************************************/ std::unique_ptr TrackFitter::run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup& setup) const { + const TrackingRegion& region) const { std::unique_ptr ret; int nhits = hits.size(); diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/KFBasedPixelFitter.h b/RecoPixelVertexing/PixelTrackFitting/interface/KFBasedPixelFitter.h index 8bc3a414a3072..2f64047386149 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/KFBasedPixelFitter.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/KFBasedPixelFitter.h @@ -7,9 +7,6 @@ #include -namespace edm { - class EventSetup; -} namespace reco { class Track; class BeamSpot; @@ -33,8 +30,7 @@ class KFBasedPixelFitter : public PixelFitterBase { ~KFBasedPixelFitter() override {} std::unique_ptr run(const std::vector &hits, - const TrackingRegion ®ion, - const edm::EventSetup &setup) const override; + const TrackingRegion ®ion) const override; private: //this two simple classes are copied from Alignment/ReferenceTrajectories in order to avoid dependencies diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitter.h b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitter.h index dcb4bc4e03c34..dfc6b5cc19140 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitter.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitter.h @@ -12,10 +12,8 @@ class PixelFitter { void swap(PixelFitter& o) { std::swap(fitter_, o.fitter_); } - std::unique_ptr run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup& setup) const { - return fitter_->run(hits, region, setup); + std::unique_ptr run(const std::vector& hits, const TrackingRegion& region) const { + return fitter_->run(hits, region); } private: diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h index aaa99ec666bb3..4125d59ea93f2 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h @@ -6,9 +6,6 @@ #include #include -namespace edm { - class EventSetup; -} class TrackingRegion; class TrackingRecHit; @@ -17,7 +14,6 @@ class PixelFitterBase { virtual ~PixelFitterBase() {} virtual std::unique_ptr run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup& setup) const = 0; + const TrackingRegion& region) const = 0; }; #endif diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByConformalMappingAndLine.h b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByConformalMappingAndLine.h index 6e32766ce3193..4e2e94398203c 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByConformalMappingAndLine.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByConformalMappingAndLine.h @@ -4,7 +4,6 @@ #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/TrackReco/interface/Track.h" class TrackerGeometry; @@ -20,8 +19,7 @@ class PixelFitterByConformalMappingAndLine : public PixelFitterBase { bool useFixImpactParameter); ~PixelFitterByConformalMappingAndLine() override {} std::unique_ptr run(const std::vector &hits, - const TrackingRegion ®ion, - const edm::EventSetup &setup) const override; + const TrackingRegion ®ion) const override; private: const TransientTrackingRecHitBuilder *theTTRHBuilder; diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByHelixProjections.h b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByHelixProjections.h index 1b9633e436630..ab84d268f036f 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByHelixProjections.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByHelixProjections.h @@ -4,7 +4,6 @@ #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/TrackReco/interface/Track.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -14,19 +13,18 @@ class TrackerTopology; class PixelFitterByHelixProjections final : public PixelFitterBase { public: - explicit PixelFitterByHelixProjections(const edm::EventSetup *es, + explicit PixelFitterByHelixProjections(const TrackerTopology *ttopo, const MagneticField *field, bool scaleErrorsForBPix1, float scaleFactor); ~PixelFitterByHelixProjections() override {} std::unique_ptr run(const std::vector &hits, - const TrackingRegion ®ion, - const edm::EventSetup &setup) const override; + const TrackingRegion ®ion) const override; private: + const TrackerTopology *theTopo; const MagneticField *theField; const bool thescaleErrorsForBPix1; const float thescaleFactor; - TrackerTopology const *theTopo = nullptr; }; #endif diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/PixelNtupletsFitter.h b/RecoPixelVertexing/PixelTrackFitting/interface/PixelNtupletsFitter.h index 9fb8843589669..28d83745bfc2e 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/PixelNtupletsFitter.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/PixelNtupletsFitter.h @@ -5,7 +5,6 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h" @@ -15,8 +14,7 @@ class PixelNtupletsFitter final : public PixelFitterBase { explicit PixelNtupletsFitter(float nominalB, const MagneticField* field, bool useRiemannFit); ~PixelNtupletsFitter() override = default; std::unique_ptr run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup& setup) const override; + const TrackingRegion& region) const override; private: float nominalB_; diff --git a/RecoPixelVertexing/PixelTrackFitting/interface/PixelTrackReconstruction.h b/RecoPixelVertexing/PixelTrackFitting/interface/PixelTrackReconstruction.h index f2a772f0500db..427e118a86491 100644 --- a/RecoPixelVertexing/PixelTrackFitting/interface/PixelTrackReconstruction.h +++ b/RecoPixelVertexing/PixelTrackFitting/interface/PixelTrackReconstruction.h @@ -1,26 +1,20 @@ #ifndef RecoPixelVertexing_PixelTrackFitting_PixelTrackReconstruction_H #define RecoPixelVertexing_PixelTrackFitting_PixelTrackReconstruction_H +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "RecoPixelVertexing/PixelTrackFitting/interface/TracksWithHits.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "RecoPixelVertexing/PixelTrackFitting/interface/PixelTrackCleaner.h" #include "FWCore/Utilities/interface/EDGetToken.h" #include class PixelFitter; -class PixelTrackCleaner; class PixelTrackFilter; class RegionsSeedingHitSets; -namespace edm { - class Event; - class EventSetup; - class Run; - class ParameterSetDescription; -} // namespace edm - class PixelTrackReconstruction { public: PixelTrackReconstruction(const edm::ParameterSet& conf, edm::ConsumesCollector&& iC); @@ -34,6 +28,6 @@ class PixelTrackReconstruction { edm::EDGetTokenT theHitSetsToken; edm::EDGetTokenT theFitterToken; edm::EDGetTokenT theFilterToken; - std::string theCleanerName; + edm::ESGetToken theCleanerToken; }; #endif diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/KFBasedPixelFitterProducer.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/KFBasedPixelFitterProducer.cc index 6357a09597e92..483708cefc5cd 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/KFBasedPixelFitterProducer.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/KFBasedPixelFitterProducer.cc @@ -4,7 +4,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" @@ -30,21 +29,25 @@ class KFBasedPixelFitterProducer : public edm::global::EDProducer<> { private: void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; - std::string thePropagatorLabel; - std::string thePropagatorOppositeLabel; - std::string theTTRHBuilderName; edm::EDGetTokenT theBeamSpotToken; + const edm::ESGetToken theTTRHBuilderToken; + const edm::ESGetToken thePropagatorToken; + const edm::ESGetToken thePropagatorOppositeToken; + const edm::ESGetToken theTrackerToken; + const edm::ESGetToken theFieldToken; + const edm::EDPutTokenT thePutToken; }; KFBasedPixelFitterProducer::KFBasedPixelFitterProducer(const edm::ParameterSet& iConfig) - : thePropagatorLabel(iConfig.getParameter("propagator")), - thePropagatorOppositeLabel(iConfig.getParameter("propagator")), - theTTRHBuilderName(iConfig.getParameter("TTRHBuilder")) { + : theTTRHBuilderToken(esConsumes(edm::ESInputTag("", iConfig.getParameter("TTRHBuilder")))), + thePropagatorToken(esConsumes(edm::ESInputTag("", iConfig.getParameter("propagator")))), + thePropagatorOppositeToken(esConsumes(edm::ESInputTag("", iConfig.getParameter("propagator")))), + theTrackerToken(esConsumes()), + theFieldToken(esConsumes()), + thePutToken(produces()) { if (iConfig.getParameter("useBeamSpotConstraint")) { theBeamSpotToken = consumes(iConfig.getParameter("beamSpotConstraint")); } - - produces(); } void KFBasedPixelFitterProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -60,21 +63,6 @@ void KFBasedPixelFitterProducer::fillDescriptions(edm::ConfigurationDescriptions } void KFBasedPixelFitterProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - edm::ESHandle ttrhb; - iSetup.get().get(theTTRHBuilderName, ttrhb); - - edm::ESHandle propagator; - iSetup.get().get(thePropagatorLabel, propagator); - - edm::ESHandle opropagator; - iSetup.get().get(thePropagatorOppositeLabel, opropagator); - - edm::ESHandle tracker; - iSetup.get().get(tracker); - - edm::ESHandle field; - iSetup.get().get(field); - const reco::BeamSpot* beamspot = nullptr; if (!theBeamSpotToken.isUninitialized()) { edm::Handle hbs; @@ -82,10 +70,13 @@ void KFBasedPixelFitterProducer::produce(edm::StreamID, edm::Event& iEvent, cons beamspot = hbs.product(); } - auto impl = std::make_unique( - propagator.product(), opropagator.product(), ttrhb.product(), tracker.product(), field.product(), beamspot); - auto prod = std::make_unique(std::move(impl)); - iEvent.put(std::move(prod)); + iEvent.emplace(thePutToken, + std::make_unique(&iSetup.getData(thePropagatorToken), + &iSetup.getData(thePropagatorOppositeToken), + &iSetup.getData(theTTRHBuilderToken), + &iSetup.getData(theTrackerToken), + &iSetup.getData(theFieldToken), + beamspot)); } DEFINE_FWK_MODULE(KFBasedPixelFitterProducer); diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByConformalMappingAndLineProducer.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByConformalMappingAndLineProducer.cc index 5a1c9f69a95a3..ad9f319a71742 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByConformalMappingAndLineProducer.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByConformalMappingAndLineProducer.cc @@ -4,7 +4,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" @@ -21,15 +20,16 @@ class PixelFitterByConformalMappingAndLineProducer : public edm::global::EDProducer<> { public: explicit PixelFitterByConformalMappingAndLineProducer(const edm::ParameterSet& iConfig) - : theTTRHBuilderName(iConfig.getParameter("TTRHBuilder")), + : theTTRHBuilderToken(esConsumes(edm::ESInputTag("", iConfig.getParameter("TTRHBuilder")))), + theTrackerToken(esConsumes()), + theFieldToken(esConsumes()), + thePutToken(produces()), theFixImpactParameter(0), theUseFixImpactParameter(false) { if (iConfig.getParameter("useFixImpactParameter")) { theFixImpactParameter = iConfig.getParameter("fixImpactParameter"); theUseFixImpactParameter = true; } - - produces(); } ~PixelFitterByConformalMappingAndLineProducer() override {} @@ -45,7 +45,10 @@ class PixelFitterByConformalMappingAndLineProducer : public edm::global::EDProdu private: void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; - std::string theTTRHBuilderName; + const edm::ESGetToken theTTRHBuilderToken; + const edm::ESGetToken theTrackerToken; + const edm::ESGetToken theFieldToken; + const edm::EDPutTokenT thePutToken; double theFixImpactParameter; bool theUseFixImpactParameter; }; @@ -53,19 +56,12 @@ class PixelFitterByConformalMappingAndLineProducer : public edm::global::EDProdu void PixelFitterByConformalMappingAndLineProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - edm::ESHandle ttrhBuilder; - iSetup.get().get(theTTRHBuilderName, ttrhBuilder); - - edm::ESHandle tracker; - iSetup.get().get(tracker); - - edm::ESHandle field; - iSetup.get().get(field); - - auto impl = std::make_unique( - ttrhBuilder.product(), tracker.product(), field.product(), theFixImpactParameter, theUseFixImpactParameter); - auto prod = std::make_unique(std::move(impl)); - iEvent.put(std::move(prod)); + iEvent.emplace(thePutToken, + std::make_unique(&iSetup.getData(theTTRHBuilderToken), + &iSetup.getData(theTrackerToken), + &iSetup.getData(theFieldToken), + theFixImpactParameter, + theUseFixImpactParameter)); } DEFINE_FWK_MODULE(PixelFitterByConformalMappingAndLineProducer); diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByHelixProjectionsProducer.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByHelixProjectionsProducer.cc index 5cf2b36b27cab..1755f911f4207 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByHelixProjectionsProducer.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelFitterByHelixProjectionsProducer.cc @@ -4,7 +4,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" @@ -15,14 +14,17 @@ #include "MagneticField/Engine/interface/MagneticField.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" class PixelFitterByHelixProjectionsProducer : public edm::global::EDProducer<> { public: explicit PixelFitterByHelixProjectionsProducer(const edm::ParameterSet& iConfig) - : thescaleErrorsForBPix1(iConfig.getParameter("scaleErrorsForBPix1")), - thescaleFactor(iConfig.getParameter("scaleFactor")) { - produces(); - } + : theTopoToken(esConsumes()), + theFieldToken(esConsumes()), + thePutToken(produces()), + thescaleErrorsForBPix1(iConfig.getParameter("scaleErrorsForBPix1")), + thescaleFactor(iConfig.getParameter("scaleFactor")) {} ~PixelFitterByHelixProjectionsProducer() override {} static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -34,6 +36,10 @@ class PixelFitterByHelixProjectionsProducer : public edm::global::EDProducer<> { private: void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; + + const edm::ESGetToken theTopoToken; + const edm::ESGetToken theFieldToken; + const edm::EDPutTokenT thePutToken; const bool thescaleErrorsForBPix1; const float thescaleFactor; }; @@ -41,13 +47,10 @@ class PixelFitterByHelixProjectionsProducer : public edm::global::EDProducer<> { void PixelFitterByHelixProjectionsProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - edm::ESHandle fieldESH; - iSetup.get().get(fieldESH); - - auto impl = std::make_unique( - &iSetup, fieldESH.product(), thescaleErrorsForBPix1, thescaleFactor); - auto prod = std::make_unique(std::move(impl)); - iEvent.put(std::move(prod)); + iEvent.emplace( + thePutToken, + std::make_unique( + &iSetup.getData(theTopoToken), &iSetup.getData(theFieldToken), thescaleErrorsForBPix1, thescaleFactor)); } DEFINE_FWK_MODULE(PixelFitterByHelixProjectionsProducer); diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelNtupletsFitterProducer.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelNtupletsFitterProducer.cc index 01f6bf0c87ae7..f8483e1efd755 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelNtupletsFitterProducer.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelNtupletsFitterProducer.cc @@ -1,4 +1,3 @@ -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Frameworkfwd.h" diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackCleanerBySharedHitsESProducer.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackCleanerBySharedHitsESProducer.cc index cc7216b86e7da..eb5bca5e98e7b 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackCleanerBySharedHitsESProducer.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackCleanerBySharedHitsESProducer.cc @@ -2,8 +2,6 @@ #include "FWCore/Framework/interface/ModuleFactory.h" #include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/Framework/interface/ESHandle.h" - #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelTrackCleanerBySharedHits.h" class PixelTrackCleanerBySharedHitsESProducer : public edm::ESProducer { diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc index a73b773824f18..f3d6022e21654 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc @@ -6,7 +6,6 @@ #include "CUDADataFormats/Vertex/interface/ZVertexHeterogeneous.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducer.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducer.cc index eb25abc2d32ab..96571c998b180 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducer.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducer.cc @@ -6,7 +6,6 @@ #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc index cabe23c818470..465633ca34e00 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc @@ -7,7 +7,6 @@ #include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h" #include "DataFormats/GeometrySurface/interface/Plane.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc index ad2da317e8ba6..4edf28fe38267 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc @@ -4,7 +4,6 @@ #include "CUDADataFormats/Common/interface/HostProduct.h" #include "CUDADataFormats/Track/interface/PixelTrackHeterogeneous.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/storeTracks.h b/RecoPixelVertexing/PixelTrackFitting/plugins/storeTracks.h index c16923a20c9f8..25635cb2a6f38 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/storeTracks.h +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/storeTracks.h @@ -3,7 +3,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h" diff --git a/RecoPixelVertexing/PixelTrackFitting/src/KFBasedPixelFitter.cc b/RecoPixelVertexing/PixelTrackFitting/src/KFBasedPixelFitter.cc index c3f7a9885b7e7..e58dfa0efbf0a 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/KFBasedPixelFitter.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/KFBasedPixelFitter.cc @@ -66,8 +66,7 @@ KFBasedPixelFitter::KFBasedPixelFitter(const Propagator *propagator, theBeamSpot(beamSpot) {} std::unique_ptr KFBasedPixelFitter::run(const std::vector &hits, - const TrackingRegion ®ion, - const edm::EventSetup &setup) const { + const TrackingRegion ®ion) const { std::unique_ptr ret; int nhits = hits.size(); diff --git a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc index b25bfd7ae8ff4..f4bc223207620 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByConformalMappingAndLine.cc @@ -1,8 +1,5 @@ #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByConformalMappingAndLine.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" - #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h" @@ -45,8 +42,7 @@ PixelFitterByConformalMappingAndLine::PixelFitterByConformalMappingAndLine( theUseFixImpactParameter(useFixImpactParameter) {} std::unique_ptr PixelFitterByConformalMappingAndLine::run(const std::vector &hits, - const TrackingRegion ®ion, - const edm::EventSetup &setup) const { + const TrackingRegion ®ion) const { int nhits = hits.size(); vector points; diff --git a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc index 050d36c977adc..10205acb77d7e 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/PixelFitterByHelixProjections.cc @@ -30,7 +30,6 @@ #include "DataFormats/GeometryVector/interface/Pi.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "CommonTools/Utils/interface/DynArray.h" @@ -88,20 +87,14 @@ namespace { } } // namespace -PixelFitterByHelixProjections::PixelFitterByHelixProjections(const edm::EventSetup* es, +PixelFitterByHelixProjections::PixelFitterByHelixProjections(const TrackerTopology* ttopo, const MagneticField* field, bool scaleErrorsForBPix1, float scaleFactor) - : theField(field), thescaleErrorsForBPix1(scaleErrorsForBPix1), thescaleFactor(scaleFactor) { - //Retrieve tracker topology from geometry - edm::ESHandle tTopo; - es->get().get(tTopo); - theTopo = tTopo.product(); -} + : theTopo(ttopo), theField(field), thescaleErrorsForBPix1(scaleErrorsForBPix1), thescaleFactor(scaleFactor) {} std::unique_ptr PixelFitterByHelixProjections::run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup& setup) const { + const TrackingRegion& region) const { std::unique_ptr ret; int nhits = hits.size(); diff --git a/RecoPixelVertexing/PixelTrackFitting/src/PixelNtupletsFitter.cc b/RecoPixelVertexing/PixelTrackFitting/src/PixelNtupletsFitter.cc index 96f5d5fe03448..9bc1663ff041d 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/PixelNtupletsFitter.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/PixelNtupletsFitter.cc @@ -5,7 +5,6 @@ #include "DataFormats/GeometryVector/interface/LocalPoint.h" #include "DataFormats/GeometryVector/interface/Pi.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Geometry/CommonDetUnit/interface/GeomDet.h" @@ -24,8 +23,7 @@ PixelNtupletsFitter::PixelNtupletsFitter(float nominalB, const MagneticField* fi : nominalB_(nominalB), field_(field), useRiemannFit_(useRiemannFit) {} std::unique_ptr PixelNtupletsFitter::run(const std::vector& hits, - const TrackingRegion& region, - const edm::EventSetup&) const { + const TrackingRegion& region) const { using namespace riemannFit; std::unique_ptr ret; diff --git a/RecoPixelVertexing/PixelTrackFitting/src/PixelTrackReconstruction.cc b/RecoPixelVertexing/PixelTrackFitting/src/PixelTrackReconstruction.cc index 065fdfe2b25a0..93d587cfe3c76 100644 --- a/RecoPixelVertexing/PixelTrackFitting/src/PixelTrackReconstruction.cc +++ b/RecoPixelVertexing/PixelTrackFitting/src/PixelTrackReconstruction.cc @@ -3,14 +3,12 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackExtra.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitter.h" -#include "RecoPixelVertexing/PixelTrackFitting/interface/PixelTrackCleaner.h" #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelTrackCleanerWrapper.h" #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelTrackFilter.h" #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelTrackReconstruction.h" @@ -22,12 +20,15 @@ using edm::ParameterSet; PixelTrackReconstruction::PixelTrackReconstruction(const ParameterSet& cfg, edm::ConsumesCollector&& iC) : theHitSetsToken(iC.consumes(cfg.getParameter("SeedingHitSets"))), - theFitterToken(iC.consumes(cfg.getParameter("Fitter"))), - theCleanerName(cfg.getParameter("Cleaner")) { + theFitterToken(iC.consumes(cfg.getParameter("Fitter"))) { edm::InputTag filterTag = cfg.getParameter("Filter"); if (not filterTag.label().empty()) { theFilterToken = iC.consumes(filterTag); } + std::string cleanerName = cfg.getParameter("Cleaner"); + if (not cleanerName.empty()) { + theCleanerToken = iC.esConsumes(edm::ESInputTag("", cleanerName)); + } } PixelTrackReconstruction::~PixelTrackReconstruction() {} @@ -68,7 +69,7 @@ void PixelTrackReconstruction::run(TracksWithTTRHs& tracks, edm::Event& ev, cons hits[iHit] = tuplet[iHit]; // fitting - std::unique_ptr track = fitter.run(hits, region, es); + std::unique_ptr track = fitter.run(hits, region); if (!track) continue; @@ -90,10 +91,8 @@ void PixelTrackReconstruction::run(TracksWithTTRHs& tracks, edm::Event& ev, cons } // skip ovelrapped tracks - if (!theCleanerName.empty()) { - edm::ESHandle hcleaner; - es.get().get(theCleanerName, hcleaner); - const auto& cleaner = *hcleaner; + if (theCleanerToken.isInitialized()) { + const auto& cleaner = es.getData(theCleanerToken); if (cleaner.fast()) cleaner.cleanTracks(tracks); else diff --git a/RecoPixelVertexing/PixelTrackFitting/test/PixelTrackTest.cc b/RecoPixelVertexing/PixelTrackFitting/test/PixelTrackTest.cc index 718c51bb4f3d3..5e641a5e26f88 100644 --- a/RecoPixelVertexing/PixelTrackFitting/test/PixelTrackTest.cc +++ b/RecoPixelVertexing/PixelTrackFitting/test/PixelTrackTest.cc @@ -4,7 +4,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h"