diff --git a/RecoPixelVertexing/PixelLowPtUtilities/interface/PixelTripletLowPtGenerator.h b/RecoPixelVertexing/PixelLowPtUtilities/interface/PixelTripletLowPtGenerator.h index 8da3d41d2deb9..580ea101378a1 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/interface/PixelTripletLowPtGenerator.h +++ b/RecoPixelVertexing/PixelLowPtUtilities/interface/PixelTripletLowPtGenerator.h @@ -27,6 +27,8 @@ class TrackerGeometry; class TransientTrackingRecHitBuilder; class TransientRecHitRecord; class TripletFilter; +class ClusterShapeHitFilter; +class CkfComponentsRecord; #include @@ -56,6 +58,7 @@ class PixelTripletLowPtGenerator : public HitTripletGeneratorFromPairAndLayers { edm::ESGetToken m_magfieldToken; edm::ESGetToken m_ttrhBuilderToken; edm::ESGetToken m_msmakerToken; + edm::ESGetToken m_clusterFilterToken; void getTracker(const edm::EventSetup& es); GlobalPoint getGlobalPosition(const TrackingRecHit* recHit); diff --git a/RecoPixelVertexing/PixelLowPtUtilities/interface/TripletFilter.h b/RecoPixelVertexing/PixelLowPtUtilities/interface/TripletFilter.h index 3530647e389ce..eef6aebb2b6a9 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/interface/TripletFilter.h +++ b/RecoPixelVertexing/PixelLowPtUtilities/interface/TripletFilter.h @@ -6,9 +6,6 @@ #include -namespace edm { - class EventSetup; -} class TrackingRecHit; class ClusterShapeHitFilter; class TrackerTopology; @@ -16,16 +13,16 @@ class SiPixelClusterShapeCache; class TripletFilter { public: - TripletFilter(const edm::EventSetup& es); - ~TripletFilter(); + explicit TripletFilter(const ClusterShapeHitFilter* iFilter) : theFilter(iFilter) {} + ~TripletFilter() = default; bool checkTrack(const std::vector& recHits, const std::vector& localDirs, const TrackerTopology* tTopo, - const SiPixelClusterShapeCache& clusterShapeCache); + const SiPixelClusterShapeCache& clusterShapeCache) const; bool checkTrack(const std::vector& recHits, const std::vector& globalDirs, const TrackerTopology* tTopo, - const SiPixelClusterShapeCache& clusterShapeCache); + const SiPixelClusterShapeCache& clusterShapeCache) const; private: const ClusterShapeHitFilter* theFilter; diff --git a/RecoPixelVertexing/PixelLowPtUtilities/src/PixelTripletLowPtGenerator.cc b/RecoPixelVertexing/PixelLowPtUtilities/src/PixelTripletLowPtGenerator.cc index e1dfba39ba51f..20a8c8f086c69 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/src/PixelTripletLowPtGenerator.cc +++ b/RecoPixelVertexing/PixelLowPtUtilities/src/PixelTripletLowPtGenerator.cc @@ -15,6 +15,7 @@ #include "RecoTracker/TkMSParametrization/interface/MultipleScatteringParametrisationMaker.h" #include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "RecoTracker/Record/interface/TrackerMultipleScatteringRecord.h" +#include "RecoTracker/Record/interface/CkfComponentsRecord.h" #undef Debug @@ -28,6 +29,7 @@ PixelTripletLowPtGenerator::PixelTripletLowPtGenerator(const edm::ParameterSet& m_magfieldToken(iC.esConsumes()), m_ttrhBuilderToken(iC.esConsumes(edm::ESInputTag("", cfg.getParameter("TTRHBuilder")))), m_msmakerToken(iC.esConsumes()), + m_clusterFilterToken(iC.esConsumes(edm::ESInputTag("", "ClusterShapeHitFilter"))), theTracker(nullptr), theClusterShapeCacheToken( iC.consumes(cfg.getParameter("clusterShapeCacheSrc"))) { @@ -51,7 +53,7 @@ void PixelTripletLowPtGenerator::getTracker(const edm::EventSetup& es) { } if (!theFilter) { - theFilter = std::make_unique(es); + theFilter = std::make_unique(&es.getData(m_clusterFilterToken)); } } diff --git a/RecoPixelVertexing/PixelLowPtUtilities/src/TripletFilter.cc b/RecoPixelVertexing/PixelLowPtUtilities/src/TripletFilter.cc index 7cb6f255a7700..bf067af76831b 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/src/TripletFilter.cc +++ b/RecoPixelVertexing/PixelLowPtUtilities/src/TripletFilter.cc @@ -3,37 +3,20 @@ #include "RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h" #include "RecoPixelVertexing/PixelLowPtUtilities/interface/HitInfo.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" -#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" - #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" -#include "RecoTracker/Record/interface/CkfComponentsRecord.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" using namespace std; -/*****************************************************************************/ -TripletFilter::TripletFilter(const edm::EventSetup& es) { - // Get cluster shape hit filter - edm::ESHandle shape; - es.get().get("ClusterShapeHitFilter", shape); - theFilter = shape.product(); -} - -/*****************************************************************************/ -TripletFilter::~TripletFilter() {} - /*****************************************************************************/ bool TripletFilter::checkTrack(const vector& recHits, const vector& localDirs, const TrackerTopology* tTopo, - const SiPixelClusterShapeCache& clusterShapeCache) { + const SiPixelClusterShapeCache& clusterShapeCache) const { bool ok = true; vector::const_iterator localDir = localDirs.begin(); @@ -62,7 +45,7 @@ bool TripletFilter::checkTrack(const vector& recHits, bool TripletFilter::checkTrack(const vector& recHits, const vector& globalDirs, const TrackerTopology* tTopo, - const SiPixelClusterShapeCache& clusterShapeCache) { + const SiPixelClusterShapeCache& clusterShapeCache) const { bool ok = true; vector::const_iterator globalDir = globalDirs.begin();