diff --git a/FastSimulation/Tracking/src/TrackingLayer.cc b/FastSimulation/Tracking/src/TrackingLayer.cc index 577e78ab1d93b..8eab08115af2b 100644 --- a/FastSimulation/Tracking/src/TrackingLayer.cc +++ b/FastSimulation/Tracking/src/TrackingLayer.cc @@ -1,4 +1,5 @@ #include "FastSimulation/Tracking/interface/TrackingLayer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" @@ -72,7 +73,8 @@ TrackingLayer TrackingLayer::createFromDetId(const DetId& detId, const TrackerTo throw cms::Exception("FastSimulation/Tracking") << "Cannot determine seeding layer from DetId:" << trackerTopology.print(detId).c_str() << std::endl; } - //std::cout<<"LayerSpec::createFromDetId: "<>(edm::InputTag("fastSimProducer"))), mySimEvent(2, static_cast(0)), h0(2, static_cast(0)), TracksvsEtaP(2, static_cast(0)), @@ -84,15 +89,15 @@ testGeneralTracks::testGeneralTracks(const edm::ParameterSet& p) HitsvsEta(2, static_cast(0)), LayersvsP(2, static_cast(0)), LayersvsEta(2, static_cast(0)), - Num(2, static_cast(0)), - totalNEvt(0) { // Let's just initialize the SimEvent's particleFilter_ = p.getParameter("TestParticleFilter"); - allTracks.push_back(p.getParameter("Full")); - allTracks.push_back(p.getParameter("Fast")); + allTracks_.emplace_back(p.getParameter("Full")); + allTracks_.emplace_back(p.getParameter("Fast")); + for (const auto& tag : allTracks_) + allTrackToken_.emplace_back(consumes(tag)); // For the full sim mySimEvent[0] = new FSimEvent(particleFilter_); @@ -152,10 +157,8 @@ void testGeneralTracks::analyze(const edm::Event& iEvent, const edm::EventSetup& std::unique_ptr nuclSimTracks(new edm::SimTrackContainer); - edm::Handle > fastSimTracks; - iEvent.getByLabel("fastSimProducer", fastSimTracks); - edm::Handle > fastSimVertices; - iEvent.getByLabel("fastSimProducer", fastSimVertices); + const edm::Handle>& fastSimTracks = iEvent.getHandle(tokSimTrack_); + const edm::Handle>& fastSimVertices = iEvent.getHandle(tokSimVertex_); mySimEvent[1]->fill(*fastSimTracks, *fastSimVertices); if (!mySimEvent[1]->nVertices()) @@ -177,9 +180,8 @@ void testGeneralTracks::analyze(const edm::Event& iEvent, const edm::EventSetup& std::vector firstSeed(2, static_cast(false)); std::vector secondSeed(2, static_cast(false)); - for (unsigned ievt = 0; ievt < 2; ++ievt) { - edm::Handle tkRef0; - iEvent.getByLabel(allTracks[ievt], tkRef0); + for (unsigned ievt = 0; ievt < allTracks_.size(); ++ievt) { + const edm::Handle& tkRef0 = iEvent.getHandle(allTrackToken_[ievt]); std::vector tkColl; tkColl.push_back(tkRef0.product());