Skip to content

Commit

Permalink
Use esConsumes in TTStubAssociator
Browse files Browse the repository at this point in the history
  • Loading branch information
makortel committed Nov 4, 2021
1 parent fc5836f commit 42160a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ void TTStubAssociator<Ref_Phase2TrackerDigi_>::produce(edm::Event& iEvent, const

int ncont1 = 0;

const TrackerGeometry* const theTrackerGeom = theTrackerGeometry_.product();
const TrackerTopology* const tTopo = theTrackerTopology_.product();
const TrackerGeometry* const theTrackerGeom = &iSetup.getData(theTrackerGeometryToken_);
const TrackerTopology* const tTopo = &iSetup.getData(theTrackerTopologyToken_);

/// Loop over the InputTags to handle multiple collections

Expand Down
11 changes: 5 additions & 6 deletions SimTracker/TrackTriggerAssociation/plugins/TTStubAssociator.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

Expand Down Expand Up @@ -60,8 +59,8 @@ class TTStubAssociator : public edm::stream::EDProducer<> {
std::vector<edm::EDGetTokenT<edmNew::DetSetVector<TTStub<T> > > > ttStubsTokens_;
std::vector<edm::EDGetTokenT<TTClusterAssociationMap<T> > > ttClusterTruthTokens_;

edm::ESHandle<TrackerGeometry> theTrackerGeometry_;
edm::ESHandle<TrackerTopology> theTrackerTopology_;
edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> theTrackerGeometryToken_;
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> theTrackerTopologyToken_;

/// Mandatory methods
void beginRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
Expand Down Expand Up @@ -92,6 +91,9 @@ TTStubAssociator<T>::TTStubAssociator(const edm::ParameterSet& iConfig) {

produces<TTStubAssociationMap<T> >(iTag.instance());
}

theTrackerGeometryToken_ = esConsumes();
theTrackerTopologyToken_ = esConsumes();
}

/// Destructor
Expand All @@ -103,9 +105,6 @@ template <typename T>
void TTStubAssociator<T>::beginRun(const edm::Run& run, const edm::EventSetup& iSetup) {
/// Print some information when loaded
edm::LogInfo("TTStubAssociator< ") << templateNameFinder<T>() << " > loaded.";

iSetup.get<TrackerTopologyRcd>().get(theTrackerTopology_);
iSetup.get<TrackerDigiGeometryRecord>().get(theTrackerGeometry_);
}

/// End run
Expand Down

0 comments on commit 42160a6

Please sign in to comment.