Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added esConsumes to ConversionTrackCandidateProducer #35345

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -27,6 +27,8 @@

class TransientInitialStateEstimator;
class TrackerGeometry;
class CkfComponentsRecord;
class TrackerDigiGeometryRecord;

class ConversionTrackFinder {
public:
Expand Down Expand Up @@ -55,6 +57,10 @@ class ConversionTrackFinder {

edm::ESHandle<Propagator> thePropagator_;

edm::ESGetToken<MeasurementTracker, CkfComponentsRecord> theMeasurementTrackerToken_;
edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> theTrackerGeomToken_;
edm::ESGetToken<Propagator, TrackerDigiGeometryRecord> thePropagatorToken_;

bool useSplitHits_;

struct ExtractNumOfHits {
Expand Down
18 changes: 9 additions & 9 deletions RecoEgamma/EgammaPhotonAlgos/src/ConversionTrackFinder.cc
Expand Up @@ -21,7 +21,12 @@ ConversionTrackFinder::ConversionTrackFinder(const edm::ParameterSet& conf,
conf.getParameter<edm::ParameterSet>("TransientInitialStateEstimatorParameters"), iC)),
theTrackerGeom_(nullptr),
theUpdator_(nullptr),
thePropagator_(nullptr) {
thePropagator_(nullptr),
theMeasurementTrackerToken_(iC.esConsumes(edm::ESInputTag("", theMeasurementTrackerName_))),
theTrackerGeomToken_(iC.esConsumes()),
thePropagatorToken_(iC.esConsumes(edm::ESInputTag("", "AnyDirectionAnalyticalPropagator")))

{
// std::cout << " ConversionTrackFinder base CTOR " << std::endl;
useSplitHits_ = conf.getParameter<bool>("useHitsSplitting");
theMeasurementTrackerName_ = conf.getParameter<std::string>("MeasurementTrackerName");
Expand All @@ -30,16 +35,11 @@ ConversionTrackFinder::ConversionTrackFinder(const edm::ParameterSet& conf,
ConversionTrackFinder::~ConversionTrackFinder() {}

void ConversionTrackFinder::setEventSetup(const edm::EventSetup& es) {
edm::ESHandle<MeasurementTracker> measurementTrackerHandle;
es.get<CkfComponentsRecord>().get(theMeasurementTrackerName_, measurementTrackerHandle);
theMeasurementTracker_ = measurementTrackerHandle.product();

edm::ESHandle<TrackerGeometry> trackerHandle;
es.get<TrackerDigiGeometryRecord>().get(trackerHandle);
theTrackerGeom_ = trackerHandle.product();
theMeasurementTracker_ = &es.getData(theMeasurementTrackerToken_);

es.get<TrackingComponentsRecord>().get("AnyDirectionAnalyticalPropagator", thePropagator_);
theTrackerGeom_ = &es.getData(theTrackerGeomToken_);

thePropagator_ = es.getHandle(thePropagatorToken_);
theInitialState_->setEventSetup(
es, static_cast<TkTransientTrackingRecHitBuilder const*>(theCkfTrajectoryBuilder_->hitBuilder())->cloner());
}
Expand Up @@ -74,6 +74,10 @@ class ConversionTrackCandidateProducer : public edm::stream::EDProducer<> {
edm::EDGetTokenT<EcalRecHitCollection> endcapecalCollection_;
edm::EDGetTokenT<MeasurementTrackerEvent> measurementTrkEvtToken_;

const edm::ESGetToken<NavigationSchool, NavigationSchoolRecord> navToken_;
const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> theCaloGeomToken_;
const edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> sevlvToken_;

double hOverEConeSize_;
double maxHOverE_;
double minSCEt_;
Expand Down Expand Up @@ -142,6 +146,10 @@ ConversionTrackCandidateProducer::ConversionTrackCandidateProducer(const edm::Pa
endcapecalCollection_{consumes(config.getParameter<edm::InputTag>("endcapEcalRecHitCollection"))},
measurementTrkEvtToken_{consumes(edm::InputTag("MeasurementTrackerEvent"))},

navToken_(esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", "SimpleNavigationSchool"))),
theCaloGeomToken_(esConsumes()),
sevlvToken_(esConsumes()),

theTrajectoryBuilder_(createBaseCkfTrajectoryBuilder(
config.getParameter<edm::ParameterSet>("TrajectoryBuilderPSet"), consumesCollector())),
outInSeedFinder_{config, consumesCollector()},
Expand Down Expand Up @@ -212,9 +220,7 @@ void ConversionTrackCandidateProducer::setEventSetup(const edm::EventSetup& theE
}

void ConversionTrackCandidateProducer::beginRun(edm::Run const& r, edm::EventSetup const& theEventSetup) {
edm::ESHandle<NavigationSchool> nav;
theEventSetup.get<NavigationSchoolRecord>().get("SimpleNavigationSchool", nav);
const NavigationSchool* navigation = nav.product();
const NavigationSchool* navigation = &theEventSetup.getData(navToken_);
theTrajectoryBuilder_->setNavigationSchool(navigation);
outInSeedFinder_.setNavigationSchool(navigation);
inOutSeedFinder_.setNavigationSchool(navigation);
Expand Down Expand Up @@ -274,16 +280,14 @@ void ConversionTrackCandidateProducer::produce(edm::Event& theEvent, const edm::
}

// get the geometry from the event setup:
theEventSetup.get<CaloGeometryRecord>().get(theCaloGeom_);
theCaloGeom_ = theEventSetup.getHandle(theCaloGeomToken_);

hcalHelper_->beginEvent(theEvent, theEventSetup);

auto const& ecalhitsCollEB = theEvent.get(barrelecalCollection_);
auto const& ecalhitsCollEE = theEvent.get(endcapecalCollection_);

edm::ESHandle<EcalSeverityLevelAlgo> sevlv;
theEventSetup.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
const EcalSeverityLevelAlgo* sevLevel = &theEventSetup.getData(sevlvToken_);

caloPtrVecOutIn_.clear();
caloPtrVecInOut_.clear();
Expand Down