diff --git a/RecoLocalTracker/SubCollectionProducers/interface/PixelClusterSelectorTopBottom.h b/RecoLocalTracker/SubCollectionProducers/interface/PixelClusterSelectorTopBottom.h index 09b8921740fd7..4b975a51bc45e 100644 --- a/RecoLocalTracker/SubCollectionProducers/interface/PixelClusterSelectorTopBottom.h +++ b/RecoLocalTracker/SubCollectionProducers/interface/PixelClusterSelectorTopBottom.h @@ -13,8 +13,6 @@ #include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" - #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" @@ -28,7 +26,8 @@ class PixelClusterSelectorTopBottom : public edm::global::EDProducer<> { public: explicit PixelClusterSelectorTopBottom(const edm::ParameterSet& cfg) - : token_(consumes(cfg.getParameter("label"))), + : tTrackerGeom_(esConsumes()), + token_(consumes(cfg.getParameter("label"))), y_(cfg.getParameter("y")) { produces(); } @@ -36,6 +35,7 @@ class PixelClusterSelectorTopBottom : public edm::global::EDProducer<> { void produce(edm::StreamID, edm::Event& event, const edm::EventSetup& setup) const override; private: + edm::ESGetToken const tTrackerGeom_; edm::EDGetTokenT token_; double y_; }; diff --git a/RecoLocalTracker/SubCollectionProducers/interface/StripClusterSelectorTopBottom.h b/RecoLocalTracker/SubCollectionProducers/interface/StripClusterSelectorTopBottom.h index b47abf504dfc4..dc50ef3d8ee41 100644 --- a/RecoLocalTracker/SubCollectionProducers/interface/StripClusterSelectorTopBottom.h +++ b/RecoLocalTracker/SubCollectionProducers/interface/StripClusterSelectorTopBottom.h @@ -13,7 +13,6 @@ #include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -29,7 +28,8 @@ class StripClusterSelectorTopBottom : public edm::global::EDProducer<> { public: explicit StripClusterSelectorTopBottom(const edm::ParameterSet& cfg) - : token_(consumes>(cfg.getParameter("label"))), + : tTrackerGeom_(esConsumes()), + token_(consumes>(cfg.getParameter("label"))), y_(cfg.getParameter("y")) { produces>(); } @@ -37,6 +37,7 @@ class StripClusterSelectorTopBottom : public edm::global::EDProducer<> { void produce(edm::StreamID, edm::Event& event, const edm::EventSetup& setup) const override; private: + edm::ESGetToken const tTrackerGeom_; edm::EDGetTokenT> token_; double y_; }; diff --git a/RecoLocalTracker/SubCollectionProducers/src/HITrackClusterRemover.cc b/RecoLocalTracker/SubCollectionProducers/src/HITrackClusterRemover.cc index 9b965a27e53f3..76abb063a1d9c 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/HITrackClusterRemover.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/HITrackClusterRemover.cc @@ -1,7 +1,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -46,6 +45,7 @@ class HITrackClusterRemover : public edm::stream::EDProducer<> { void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override; private: + edm::ESGetToken const tTrackerGeom_; struct ParamBlock { ParamBlock() : isSet_(false), usesCharge_(false) {} ParamBlock(const edm::ParameterSet &iConfig) @@ -143,7 +143,8 @@ void HITrackClusterRemover::readPSet( } HITrackClusterRemover::HITrackClusterRemover(const ParameterSet &iConfig) - : doTracks_(iConfig.exists("trajectories")), + : tTrackerGeom_(esConsumes()), + doTracks_(iConfig.exists("trajectories")), doStrip_(iConfig.existsAs("doStrip") ? iConfig.getParameter("doStrip") : true), doPixel_(iConfig.existsAs("doPixel") ? iConfig.getParameter("doPixel") : true), mergeOld_(iConfig.exists("oldClusterRemovalInfo")), @@ -410,8 +411,7 @@ void HITrackClusterRemover::process(const TrackingRecHit *hit, unsigned char chi void HITrackClusterRemover::produce(Event &iEvent, const EventSetup &iSetup) { ProductID pixelOldProdID, stripOldProdID; - edm::ESHandle tgh; - iSetup.get().get(tgh); + const auto &tgh = &iSetup.getData(tTrackerGeom_); Handle > pixelClusters; if (doPixel_) { @@ -525,7 +525,7 @@ void HITrackClusterRemover::produce(Event &iEvent, const EventSetup &iSetup) { auto hit = *(hb + h); if (!hit->isValid()) continue; - process(hit, chi2sX5[h], tgh.product()); + process(hit, chi2sX5[h], tgh); } } } diff --git a/RecoLocalTracker/SubCollectionProducers/src/HLTTrackClusterRemoverNew.cc b/RecoLocalTracker/SubCollectionProducers/src/HLTTrackClusterRemoverNew.cc index a5f025fb7e833..3d46e5f4660ce 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/HLTTrackClusterRemoverNew.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/HLTTrackClusterRemoverNew.cc @@ -1,7 +1,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -43,6 +42,7 @@ class HLTTrackClusterRemoverNew final : public edm::stream::EDProducer<> { void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override; private: + edm::ESGetToken const tTrackerGeom_; struct ParamBlock { ParamBlock() : isSet_(false), usesCharge_(false) {} ParamBlock(const edm::ParameterSet &iConfig) @@ -132,7 +132,8 @@ void HLTTrackClusterRemoverNew::readPSet( } HLTTrackClusterRemoverNew::HLTTrackClusterRemoverNew(const ParameterSet &iConfig) - : doTracks_(iConfig.exists("trajectories")), + : tTrackerGeom_(esConsumes()), + doTracks_(iConfig.exists("trajectories")), doStrip_(iConfig.existsAs("doStrip") ? iConfig.getParameter("doStrip") : true), doPixel_(iConfig.existsAs("doPixel") ? iConfig.getParameter("doPixel") : true), mergeOld_(false), @@ -364,8 +365,7 @@ void HLTTrackClusterRemoverNew::process(const TrackingRecHit *hit, float chi2, c void HLTTrackClusterRemoverNew::produce(Event &iEvent, const EventSetup &iSetup) { ProductID pixelOldProdID, stripOldProdID; - edm::ESHandle tgh; - iSetup.get().get(tgh); + const auto &tgh = &iSetup.getData(tTrackerGeom_); edm::Handle > pixelClusters; if (doPixel_) { @@ -411,7 +411,7 @@ void HLTTrackClusterRemoverNew::produce(Event &iEvent, const EventSetup &iSetup) if (!hit->isValid()) continue; // std::cout<<"process hit"<estimate(), tgh.product()); + process(hit, itm->estimate(), tgh); } } diff --git a/RecoLocalTracker/SubCollectionProducers/src/JetCoreClusterSplitter.cc b/RecoLocalTracker/SubCollectionProducers/src/JetCoreClusterSplitter.cc index b6a69cae8037f..258f57e3cdee3 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/JetCoreClusterSplitter.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/JetCoreClusterSplitter.cc @@ -46,8 +46,11 @@ class JetCoreClusterSplitter : public edm::stream::EDProducer<> { std::multimap secondDistDiffScore(const std::vector>& distanceMap); std::multimap secondDistScore(const std::vector>& distanceMap); std::multimap distScore(const std::vector>& distanceMap); + + edm::ESGetToken const tTrackingGeom_; + edm::ESGetToken const tCPE_; + bool verbose; - std::string pixelCPE_; double ptMin_; double deltaR_; double chargeFracMin_; @@ -62,8 +65,9 @@ class JetCoreClusterSplitter : public edm::stream::EDProducer<> { }; JetCoreClusterSplitter::JetCoreClusterSplitter(const edm::ParameterSet& iConfig) - : verbose(iConfig.getParameter("verbose")), - pixelCPE_(iConfig.getParameter("pixelCPE")), + : tTrackingGeom_(esConsumes()), + tCPE_(esConsumes(edm::ESInputTag("", iConfig.getParameter("pixelCPE")))), + verbose(iConfig.getParameter("verbose")), ptMin_(iConfig.getParameter("ptMin")), deltaR_(iConfig.getParameter("deltaRmax")), chargeFracMin_(iConfig.getParameter("chargeFractionMin")), @@ -87,8 +91,7 @@ bool SortPixels(const SiPixelCluster::Pixel& i, const SiPixelCluster::Pixel& j) void JetCoreClusterSplitter::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; - edm::ESHandle geometry; - iSetup.get().get(geometry); + const auto& geometry = &iSetup.getData(tTrackingGeom_); Handle> inputPixelClusters; iEvent.getByToken(pixelClusters_, inputPixelClusters); @@ -100,11 +103,7 @@ void JetCoreClusterSplitter::produce(edm::Event& iEvent, const edm::EventSetup& Handle> cores; iEvent.getByToken(cores_, cores); - edm::ESHandle pe; - const PixelClusterParameterEstimator* pp; - iSetup.get().get(pixelCPE_, pe); - pp = pe.product(); - + const PixelClusterParameterEstimator* pp = &iSetup.getData(tCPE_); auto output = std::make_unique>(); edmNew::DetSetVector::const_iterator detIt = inputPixelClusters->begin(); diff --git a/RecoLocalTracker/SubCollectionProducers/src/PixelClusterSelectorTopBottom.cc b/RecoLocalTracker/SubCollectionProducers/src/PixelClusterSelectorTopBottom.cc index ddff02e19af6c..feac4b993c8cf 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/PixelClusterSelectorTopBottom.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/PixelClusterSelectorTopBottom.cc @@ -5,9 +5,7 @@ void PixelClusterSelectorTopBottom::produce(edm::StreamID, edm::Event& event, co edm::Handle input; event.getByToken(token_, input); - edm::ESHandle geom; - setup.get().get(geom); - const TrackerGeometry& theTracker(*geom); + const TrackerGeometry& theTracker = setup.getData(tTrackerGeom_); auto output = std::make_unique(); diff --git a/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemover.cc b/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemover.cc index caa006c2012ce..38396256ba11f 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemover.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemover.cc @@ -1,7 +1,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -39,6 +38,7 @@ class SeedClusterRemover : public edm::stream::EDProducer<> { void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override; private: + edm::ESGetToken const tTrackerGeom_; struct ParamBlock { ParamBlock() : isSet_(false), usesCharge_(false) {} ParamBlock(const edm::ParameterSet &iConfig) @@ -111,7 +111,9 @@ void SeedClusterRemover::readPSet( } SeedClusterRemover::SeedClusterRemover(const ParameterSet &iConfig) - : doStrip_(iConfig.existsAs("doStrip") ? iConfig.getParameter("doStrip") : true), + : tTrackerGeom_( + esConsumes(edm::ESInputTag("", ""))), //is it correct to use "" ? + doStrip_(iConfig.existsAs("doStrip") ? iConfig.getParameter("doStrip") : true), doPixel_(iConfig.existsAs("doPixel") ? iConfig.getParameter("doPixel") : true), mergeOld_(iConfig.exists("oldClusterRemovalInfo")) { fill(pblocks_, pblocks_ + NumberOfParamBlocks, ParamBlock()); @@ -235,8 +237,7 @@ void SeedClusterRemover::process(const TrackingRecHit *hit, float chi2, const Tr } void SeedClusterRemover::produce(Event &iEvent, const EventSetup &iSetup) { - edm::ESHandle tgh; - iSetup.get().get("", tgh); //is it correct to use "" ? + const auto &tgh = &iSetup.getData(tTrackerGeom_); Handle > pixelClusters; if (doPixel_) { @@ -283,7 +284,7 @@ void SeedClusterRemover::produce(Event &iEvent, const EventSetup &iSetup) { for (auto const &hit : seed.recHits()) { if (!hit.isValid()) continue; - process(&hit, 0., tgh.product()); + process(&hit, 0., tgh); } } diff --git a/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemoverPhase2.cc b/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemoverPhase2.cc index 24df700d80ed4..f74ffe3886cfa 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemoverPhase2.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemoverPhase2.cc @@ -1,7 +1,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -38,6 +37,7 @@ class SeedClusterRemoverPhase2 : public edm::stream::EDProducer<> { void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override; private: + edm::ESGetToken const tTrackerGeom_; bool doOuterTracker_, doPixel_; bool mergeOld_; typedef edm::ContainerMask > PixelMaskContainer; @@ -61,7 +61,9 @@ using namespace std; using namespace edm; SeedClusterRemoverPhase2::SeedClusterRemoverPhase2(const ParameterSet &iConfig) - : doOuterTracker_(iConfig.existsAs("doOuterTracker") ? iConfig.getParameter("doOuterTracker") : true), + : tTrackerGeom_( + esConsumes(edm::ESInputTag("", ""))), //is it correct to use "" ? + doOuterTracker_(iConfig.existsAs("doOuterTracker") ? iConfig.getParameter("doOuterTracker") : true), doPixel_(iConfig.existsAs("doPixel") ? iConfig.getParameter("doPixel") : true), mergeOld_(iConfig.exists("oldClusterRemovalInfo")) { produces > >(); @@ -163,8 +165,7 @@ void SeedClusterRemoverPhase2::process(const TrackingRecHit *hit, float chi2, co void SeedClusterRemoverPhase2::produce(Event &iEvent, const EventSetup &iSetup) { ProductID pixelOldProdID, stripOldProdID; - edm::ESHandle tgh; - iSetup.get().get("", tgh); //is it correct to use "" ? + const auto &tgh = &iSetup.getData(tTrackerGeom_); Handle > pixelClusters; if (doPixel_) { @@ -211,7 +212,7 @@ void SeedClusterRemoverPhase2::produce(Event &iEvent, const EventSetup &iSetup) for (auto const &hit : seed.recHits()) { if (!hit.isValid()) continue; - process(&hit, 0., tgh.product()); + process(&hit, 0., tgh); } } diff --git a/RecoLocalTracker/SubCollectionProducers/src/StripClusterSelectorTopBottom.cc b/RecoLocalTracker/SubCollectionProducers/src/StripClusterSelectorTopBottom.cc index ce7eaca7083bd..52e298f8b7093 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/StripClusterSelectorTopBottom.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/StripClusterSelectorTopBottom.cc @@ -5,9 +5,7 @@ void StripClusterSelectorTopBottom::produce(edm::StreamID, edm::Event& event, co edm::Handle> input; event.getByToken(token_, input); - edm::ESHandle geom; - setup.get().get(geom); - const TrackerGeometry& theTracker(*geom); + const TrackerGeometry& theTracker = setup.getData(tTrackerGeom_); auto output = std::make_unique>();