Skip to content

Commit

Permalink
Avoid getting EventSetup data in TripletFilter
Browse files Browse the repository at this point in the history
The esConsumes and get is done in the user of the class.
  • Loading branch information
Dr15Jones committed Oct 27, 2022
1 parent 3899963 commit 61c71b5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class TrackerGeometry;
class TransientTrackingRecHitBuilder;
class TransientRecHitRecord;
class TripletFilter;
class ClusterShapeHitFilter;
class CkfComponentsRecord;

#include <vector>

Expand Down Expand Up @@ -56,6 +58,7 @@ class PixelTripletLowPtGenerator : public HitTripletGeneratorFromPairAndLayers {
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> m_magfieldToken;
edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> m_ttrhBuilderToken;
edm::ESGetToken<MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord> m_msmakerToken;
edm::ESGetToken<ClusterShapeHitFilter, CkfComponentsRecord> m_clusterFilterToken;

void getTracker(const edm::EventSetup& es);
GlobalPoint getGlobalPosition(const TrackingRecHit* recHit);
Expand Down
11 changes: 4 additions & 7 deletions RecoPixelVertexing/PixelLowPtUtilities/interface/TripletFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,23 @@

#include <vector>

namespace edm {
class EventSetup;
}
class TrackingRecHit;
class ClusterShapeHitFilter;
class TrackerTopology;
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<const TrackingRecHit*>& recHits,
const std::vector<LocalVector>& localDirs,
const TrackerTopology* tTopo,
const SiPixelClusterShapeCache& clusterShapeCache);
const SiPixelClusterShapeCache& clusterShapeCache) const;
bool checkTrack(const std::vector<const TrackingRecHit*>& recHits,
const std::vector<GlobalVector>& globalDirs,
const TrackerTopology* tTopo,
const SiPixelClusterShapeCache& clusterShapeCache);
const SiPixelClusterShapeCache& clusterShapeCache) const;

private:
const ClusterShapeHitFilter* theFilter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -28,6 +29,7 @@ PixelTripletLowPtGenerator::PixelTripletLowPtGenerator(const edm::ParameterSet&
m_magfieldToken(iC.esConsumes()),
m_ttrhBuilderToken(iC.esConsumes(edm::ESInputTag("", cfg.getParameter<string>("TTRHBuilder")))),
m_msmakerToken(iC.esConsumes()),
m_clusterFilterToken(iC.esConsumes(edm::ESInputTag("", "ClusterShapeHitFilter"))),
theTracker(nullptr),
theClusterShapeCacheToken(
iC.consumes<SiPixelClusterShapeCache>(cfg.getParameter<edm::InputTag>("clusterShapeCacheSrc"))) {
Expand All @@ -51,7 +53,7 @@ void PixelTripletLowPtGenerator::getTracker(const edm::EventSetup& es) {
}

if (!theFilter) {
theFilter = std::make_unique<TripletFilter>(es);
theFilter = std::make_unique<TripletFilter>(&es.getData(m_clusterFilterToken));
}
}

Expand Down
21 changes: 2 additions & 19 deletions RecoPixelVertexing/PixelLowPtUtilities/src/TripletFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<ClusterShapeHitFilter> shape;
es.get<CkfComponentsRecord>().get("ClusterShapeHitFilter", shape);
theFilter = shape.product();
}

/*****************************************************************************/
TripletFilter::~TripletFilter() {}

/*****************************************************************************/
bool TripletFilter::checkTrack(const vector<const TrackingRecHit*>& recHits,
const vector<LocalVector>& localDirs,
const TrackerTopology* tTopo,
const SiPixelClusterShapeCache& clusterShapeCache) {
const SiPixelClusterShapeCache& clusterShapeCache) const {
bool ok = true;

vector<LocalVector>::const_iterator localDir = localDirs.begin();
Expand Down Expand Up @@ -62,7 +45,7 @@ bool TripletFilter::checkTrack(const vector<const TrackingRecHit*>& recHits,
bool TripletFilter::checkTrack(const vector<const TrackingRecHit*>& recHits,
const vector<GlobalVector>& globalDirs,
const TrackerTopology* tTopo,
const SiPixelClusterShapeCache& clusterShapeCache) {
const SiPixelClusterShapeCache& clusterShapeCache) const {
bool ok = true;

vector<GlobalVector>::const_iterator globalDir = globalDirs.begin();
Expand Down

0 comments on commit 61c71b5

Please sign in to comment.