diff --git a/Alignment/KalmanAlignmentAlgorithm/src/KalmanAlignmentTrackRefitter.cc b/Alignment/KalmanAlignmentAlgorithm/src/KalmanAlignmentTrackRefitter.cc index 8c05e498f7fb2..bffbea21406ee 100644 --- a/Alignment/KalmanAlignmentAlgorithm/src/KalmanAlignmentTrackRefitter.cc +++ b/Alignment/KalmanAlignmentAlgorithm/src/KalmanAlignmentTrackRefitter.cc @@ -30,8 +30,10 @@ KalmanAlignmentTrackRefitter::KalmanAlignmentTrackRefitter( const edm::Parameter theDebugFlag( config.getUntrackedParameter( "debug", true ) ) { TrackProducerBase< reco::Track >::setConf( config ); - TrackProducerBase< reco::Track >::setSrc( config.getParameter< edm::InputTag >( "src" ), - config.getParameter< edm::InputTag >( "bsSrc" ) ); + // --- GPetrucc: I can't understand where anything is read from the event, and who's the consumer. + // If there is one anywhere, it should do the consumes calls and pass that to the setSrc + //TrackProducerBase< reco::Track >::setSrc( consumes(iConfig.getParameter( "src" )), + // consumes(iConfig.getParameter( "beamSpot" ))); } diff --git a/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc b/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc index 9de865d2586db..216bcfc6ffbd1 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/TrackProducerWithSCAssociation.cc @@ -22,8 +22,8 @@ TrackProducerWithSCAssociation::TrackProducerWithSCAssociation(const edm::Parame theAlgo(iConfig) { setConf(iConfig); - setSrc( iConfig.getParameter( "src" ), - iConfig.getParameter( "beamSpot" )); + setSrc( consumes(iConfig.getParameter( "src" )), + consumes(iConfig.getParameter( "beamSpot" ))); setAlias( iConfig.getParameter( "@module_label" ) ); if ( iConfig.exists("clusterRemovalInfo") ) { diff --git a/RecoTracker/CkfPattern/interface/CkfTrackCandidateMaker.h b/RecoTracker/CkfPattern/interface/CkfTrackCandidateMaker.h index d369b06673fa3..908a144129d91 100644 --- a/RecoTracker/CkfPattern/interface/CkfTrackCandidateMaker.h +++ b/RecoTracker/CkfPattern/interface/CkfTrackCandidateMaker.h @@ -24,12 +24,12 @@ class TransientInitialStateEstimator; namespace cms { - class CkfTrackCandidateMaker : public CkfTrackCandidateMakerBase, public edm::EDProducer + class CkfTrackCandidateMaker : public edm::EDProducer, public CkfTrackCandidateMakerBase { public: explicit CkfTrackCandidateMaker(const edm::ParameterSet& conf): - CkfTrackCandidateMakerBase(conf){ + CkfTrackCandidateMakerBase(conf, consumesCollector()){ produces(); } diff --git a/RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h b/RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h index 7243457674150..8dd894dd12239 100644 --- a/RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h +++ b/RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h @@ -4,6 +4,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -28,7 +29,7 @@ namespace cms class CkfTrackCandidateMakerBase { public: - explicit CkfTrackCandidateMakerBase(const edm::ParameterSet& conf); + explicit CkfTrackCandidateMakerBase(const edm::ParameterSet& conf, edm::ConsumesCollector && iC); virtual ~CkfTrackCandidateMakerBase(); @@ -65,7 +66,7 @@ namespace cms RedundantSeedCleaner* theSeedCleaner; - edm::InputTag theSeedLabel; + edm::EDGetTokenT > theSeedLabel; unsigned int maxSeedsBeforeCleaning_; // methods for debugging diff --git a/RecoTracker/CkfPattern/interface/CkfTrajectoryMaker.h b/RecoTracker/CkfPattern/interface/CkfTrajectoryMaker.h index 624f7178fb923..f0bef7c979a4a 100644 --- a/RecoTracker/CkfPattern/interface/CkfTrajectoryMaker.h +++ b/RecoTracker/CkfPattern/interface/CkfTrajectoryMaker.h @@ -24,13 +24,13 @@ class TransientInitialStateEstimator; namespace cms { - class CkfTrajectoryMaker : public CkfTrackCandidateMakerBase, public edm::EDProducer + class CkfTrajectoryMaker : public edm::EDProducer, public CkfTrackCandidateMakerBase { public: typedef std::vector TrajectoryCollection; explicit CkfTrajectoryMaker(const edm::ParameterSet& conf): - CkfTrackCandidateMakerBase(conf) + CkfTrackCandidateMakerBase(conf, consumesCollector()) { theTrackCandidateOutput=conf.getParameter("trackCandidateAlso"); theTrajectoryOutput=true; diff --git a/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc b/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc index 06b67ccaa3543..09e204f2efcff 100644 --- a/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc +++ b/RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc @@ -41,7 +41,7 @@ using namespace edm; using namespace std; namespace cms{ - CkfTrackCandidateMakerBase::CkfTrackCandidateMakerBase(edm::ParameterSet const& conf) : + CkfTrackCandidateMakerBase::CkfTrackCandidateMakerBase(edm::ParameterSet const& conf, edm::ConsumesCollector && iC) : conf_(conf), theTrackCandidateOutput(true), @@ -66,7 +66,7 @@ namespace cms{ // if (!conf.exists("src")) // theSeedLabel = InputTag(conf_.getParameter("SeedProducer"),conf_.getParameter("SeedLabel")); // else - theSeedLabel= conf.getParameter("src"); + theSeedLabel= iC.consumes >(conf.getParameter("src")); if ( conf.exists("maxSeedsBeforeCleaning") ) maxSeedsBeforeCleaning_=conf.getParameter("maxSeedsBeforeCleaning"); @@ -157,7 +157,7 @@ namespace cms{ // Step B: Retrieve seeds edm::Handle > collseed; - e.getByLabel(theSeedLabel, collseed); + e.getByToken(theSeedLabel, collseed); // Step C: Create empty output collection std::auto_ptr output(new TrackCandidateCollection); diff --git a/RecoTracker/DeDx/plugins/DeDxDiscriminatorLearner.cc b/RecoTracker/DeDx/plugins/DeDxDiscriminatorLearner.cc index c68a6914f37cf..d75bea6a39f6a 100644 --- a/RecoTracker/DeDx/plugins/DeDxDiscriminatorLearner.cc +++ b/RecoTracker/DeDx/plugins/DeDxDiscriminatorLearner.cc @@ -35,8 +35,8 @@ using namespace edm; DeDxDiscriminatorLearner::DeDxDiscriminatorLearner(const edm::ParameterSet& iConfig) : ConditionDBWriter(iConfig) { - m_tracksTag = iConfig.getParameter("tracks"); - m_trajTrackAssociationTag = iConfig.getParameter("trajectoryTrackAssociation"); + m_tracksTag = consumes(iConfig.getParameter("tracks")); + m_trajTrackAssociationTag = consumes(iConfig.getParameter("trajectoryTrackAssociation")); usePixel = iConfig.getParameter("UsePixel"); useStrip = iConfig.getParameter("UseStrip"); @@ -137,11 +137,11 @@ void DeDxDiscriminatorLearner::algoAnalyze(const edm::Event& iEvent, const edm:: Handle trajTrackAssociationHandle; - iEvent.getByLabel(m_trajTrackAssociationTag, trajTrackAssociationHandle); + iEvent.getByToken(m_trajTrackAssociationTag, trajTrackAssociationHandle); const TrajTrackAssociationCollection TrajToTrackMap = *trajTrackAssociationHandle.product(); edm::Handle trackCollectionHandle; - iEvent.getByLabel(m_tracksTag,trackCollectionHandle); + iEvent.getByToken(m_tracksTag,trackCollectionHandle); unsigned track_index = 0; for(TrajTrackAssociationCollection::const_iterator it = TrajToTrackMap.begin(); it!=TrajToTrackMap.end(); ++it, track_index++) { diff --git a/RecoTracker/DeDx/plugins/DeDxDiscriminatorLearner.h b/RecoTracker/DeDx/plugins/DeDxDiscriminatorLearner.h index 7dd5f1a95bcd1..a774f62f8e600 100644 --- a/RecoTracker/DeDx/plugins/DeDxDiscriminatorLearner.h +++ b/RecoTracker/DeDx/plugins/DeDxDiscriminatorLearner.h @@ -47,8 +47,8 @@ class DeDxDiscriminatorLearner : public ConditionDBWriter m_trajTrackAssociationTag; + edm::EDGetTokenT m_tracksTag; bool usePixel; bool useStrip; diff --git a/RecoTracker/DeDx/plugins/DeDxDiscriminatorLearnerFromCalibTree.h b/RecoTracker/DeDx/plugins/DeDxDiscriminatorLearnerFromCalibTree.h index c8c5e24c33c02..a5b9256b88a8b 100644 --- a/RecoTracker/DeDx/plugins/DeDxDiscriminatorLearnerFromCalibTree.h +++ b/RecoTracker/DeDx/plugins/DeDxDiscriminatorLearnerFromCalibTree.h @@ -50,8 +50,8 @@ class DeDxDiscriminatorLearnerFromCalibTree : public ConditionDBWriter m_trajTrackAssociationTag; + edm::EDGetTokenT m_tracksTag; bool usePixel; bool useStrip; diff --git a/RecoTracker/DeDx/plugins/DeDxDiscriminatorProducer.cc b/RecoTracker/DeDx/plugins/DeDxDiscriminatorProducer.cc index c0d5457f19528..f58d1b8cea26a 100644 --- a/RecoTracker/DeDx/plugins/DeDxDiscriminatorProducer.cc +++ b/RecoTracker/DeDx/plugins/DeDxDiscriminatorProducer.cc @@ -51,8 +51,8 @@ DeDxDiscriminatorProducer::DeDxDiscriminatorProducer(const edm::ParameterSet& iC produces >(); - m_tracksTag = iConfig.getParameter("tracks"); - m_trajTrackAssociationTag = iConfig.getParameter("trajectoryTrackAssociation"); + m_tracksTag = consumes(iConfig.getParameter("tracks")); + m_trajTrackAssociationTag = consumes(iConfig.getParameter("trajectoryTrackAssociation")); usePixel = iConfig.getParameter("UsePixel"); useStrip = iConfig.getParameter("UseStrip"); @@ -231,11 +231,11 @@ void DeDxDiscriminatorProducer::produce(edm::Event& iEvent, const edm::EventSetu ValueMap::Filler filler(*trackDeDxDiscrimAssociation); Handle trajTrackAssociationHandle; - iEvent.getByLabel(m_trajTrackAssociationTag, trajTrackAssociationHandle); + iEvent.getByToken(m_trajTrackAssociationTag, trajTrackAssociationHandle); const TrajTrackAssociationCollection TrajToTrackMap = *trajTrackAssociationHandle.product(); edm::Handle trackCollectionHandle; - iEvent.getByLabel(m_tracksTag,trackCollectionHandle); + iEvent.getByToken(m_tracksTag,trackCollectionHandle); edm::ESHandle tkGeom; iSetup.get().get( tkGeom ); diff --git a/RecoTracker/DeDx/plugins/DeDxDiscriminatorProducer.h b/RecoTracker/DeDx/plugins/DeDxDiscriminatorProducer.h index 51456cc281baa..db1f22360d2da 100644 --- a/RecoTracker/DeDx/plugins/DeDxDiscriminatorProducer.h +++ b/RecoTracker/DeDx/plugins/DeDxDiscriminatorProducer.h @@ -65,8 +65,8 @@ class DeDxDiscriminatorProducer : public edm::EDProducer { // ----------member data --------------------------- - edm::InputTag m_trajTrackAssociationTag; - edm::InputTag m_tracksTag; + edm::EDGetTokenT m_trajTrackAssociationTag; + edm::EDGetTokenT m_tracksTag; bool usePixel; bool useStrip; diff --git a/RecoTracker/DeDx/plugins/DeDxEstimatorProducer.cc b/RecoTracker/DeDx/plugins/DeDxEstimatorProducer.cc index 39dc262470ea1..de3aa147d9dc1 100644 --- a/RecoTracker/DeDx/plugins/DeDxEstimatorProducer.cc +++ b/RecoTracker/DeDx/plugins/DeDxEstimatorProducer.cc @@ -63,8 +63,8 @@ DeDxEstimatorProducer::DeDxEstimatorProducer(const edm::ParameterSet& iConfig) MaxNrStrips = iConfig.getUntrackedParameter("maxNrStrips" , 255); MinTrackHits = iConfig.getUntrackedParameter("MinTrackHits" , 4); - m_tracksTag = iConfig.getParameter("tracks"); - m_trajTrackAssociationTag = iConfig.getParameter("trajectoryTrackAssociation"); + m_tracksTag = consumes(iConfig.getParameter("tracks")); + m_trajTrackAssociationTag = consumes(iConfig.getParameter("trajectoryTrackAssociation")); usePixel = iConfig.getParameter("UsePixel"); useStrip = iConfig.getParameter("UseStrip"); @@ -138,11 +138,11 @@ void DeDxEstimatorProducer::produce(edm::Event& iEvent, const edm::EventSetup& i ValueMap::Filler filler(*trackDeDxEstimateAssociation); Handle trajTrackAssociationHandle; - iEvent.getByLabel(m_trajTrackAssociationTag, trajTrackAssociationHandle); + iEvent.getByToken(m_trajTrackAssociationTag, trajTrackAssociationHandle); const TrajTrackAssociationCollection & TrajToTrackMap = *trajTrackAssociationHandle.product(); edm::Handle trackCollectionHandle; - iEvent.getByLabel(m_tracksTag,trackCollectionHandle); + iEvent.getByToken(m_tracksTag,trackCollectionHandle); size_t n = TrajToTrackMap.size(); std::vector dedxEstimate(n); diff --git a/RecoTracker/DeDx/plugins/DeDxEstimatorProducer.h b/RecoTracker/DeDx/plugins/DeDxEstimatorProducer.h index ffdf7c7fb6421..ec4da729c0878 100644 --- a/RecoTracker/DeDx/plugins/DeDxEstimatorProducer.h +++ b/RecoTracker/DeDx/plugins/DeDxEstimatorProducer.h @@ -21,6 +21,7 @@ #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" +#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" #include "TFile.h" #include "TChain.h" @@ -50,8 +51,8 @@ class DeDxEstimatorProducer : public edm::EDProducer { // ----------member data --------------------------- BaseDeDxEstimator* m_estimator; - edm::InputTag m_trajTrackAssociationTag; - edm::InputTag m_tracksTag; + edm::EDGetTokenT m_trajTrackAssociationTag; + edm::EDGetTokenT m_tracksTag; bool usePixel; bool useStrip; diff --git a/RecoTracker/DeDx/plugins/DeDxEstimatorProducerPixelTripplet.cc b/RecoTracker/DeDx/plugins/DeDxEstimatorProducerPixelTripplet.cc index 03329fe859934..6493034dfd1fd 100644 --- a/RecoTracker/DeDx/plugins/DeDxEstimatorProducerPixelTripplet.cc +++ b/RecoTracker/DeDx/plugins/DeDxEstimatorProducerPixelTripplet.cc @@ -58,8 +58,8 @@ DeDxEstimatorProducerPixelTripplet::DeDxEstimatorProducerPixelTripplet(const edm MaxNrStrips = iConfig.getUntrackedParameter("maxNrStrips" , 255); MinTrackHits = iConfig.getUntrackedParameter("MinTrackHits" , 4); - m_tracksTag = iConfig.getParameter("tracks"); - m_trajTrackAssociationTag = iConfig.getParameter("trajectoryTrackAssociation"); + m_tracksTag = consumes(iConfig.getParameter("tracks")); + m_trajTrackAssociationTag = consumes(iConfig.getParameter("trajectoryTrackAssociation")); usePixel = iConfig.getParameter("UsePixel"); useStrip = iConfig.getParameter("UseStrip"); @@ -137,7 +137,7 @@ void DeDxEstimatorProducerPixelTripplet::produce(edm::Event& iEvent, const edm:: ValueMap::Filler filler(*trackDeDxEstimateAssociation); Handle trackCollHandle; - iEvent.getByLabel(m_trajTrackAssociationTag, trackCollHandle); + iEvent.getByToken(m_trajTrackAssociationTag, trackCollHandle); const TrackCollection trackColl = *trackCollHandle.product(); size_t n = trackColl.size(); diff --git a/RecoTracker/DeDx/plugins/DeDxEstimatorProducerPixelTripplet.h b/RecoTracker/DeDx/plugins/DeDxEstimatorProducerPixelTripplet.h index 44c78300e2b84..539e536c0f10f 100644 --- a/RecoTracker/DeDx/plugins/DeDxEstimatorProducerPixelTripplet.h +++ b/RecoTracker/DeDx/plugins/DeDxEstimatorProducerPixelTripplet.h @@ -15,6 +15,7 @@ #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h" +#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" #include @@ -48,8 +49,8 @@ class DeDxEstimatorProducerPixelTripplet : public edm::EDProducer { // ----------member data --------------------------- BaseDeDxEstimator* m_estimator; - edm::InputTag m_trajTrackAssociationTag; - edm::InputTag m_tracksTag; + edm::EDGetTokenT m_trajTrackAssociationTag; + edm::EDGetTokenT m_tracksTag; bool usePixel; bool useStrip; diff --git a/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc b/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc index 0869d277730f0..6ca580f65feeb 100644 --- a/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc +++ b/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc @@ -40,6 +40,8 @@ HLTDeDxFilter::HLTDeDxFilter(const edm::ParameterSet& iConfig) : HLTFilter(iConf maxETA_ = iConfig.getParameter ("maxETA"); inputTracksTag_ = iConfig.getParameter< edm::InputTag > ("inputTracksTag"); inputdedxTag_ = iConfig.getParameter< edm::InputTag > ("inputDeDxTag"); + inputTracksToken_ = consumes(iConfig.getParameter< edm::InputTag > ("inputTracksTag")); + inputdedxToken_ = consumes >(iConfig.getParameter< edm::InputTag > ("inputDeDxTag")); thisModuleTag_ = edm::InputTag(iConfig.getParameter("@module_label")); @@ -83,11 +85,11 @@ bool } edm::Handle trackCollectionHandle; - iEvent.getByLabel(inputTracksTag_,trackCollectionHandle); + iEvent.getByToken(inputTracksToken_,trackCollectionHandle); reco::TrackCollection trackCollection = *trackCollectionHandle.product(); edm::Handle > dEdxTrackHandle; - iEvent.getByLabel(inputdedxTag_, dEdxTrackHandle); + iEvent.getByToken(inputdedxToken_, dEdxTrackHandle); const edm::ValueMap dEdxTrack = *dEdxTrackHandle.product(); bool accept=false; diff --git a/RecoTracker/DeDx/plugins/HLTDeDxFilter.h b/RecoTracker/DeDx/plugins/HLTDeDxFilter.h index 66ff068c5d8b1..feb04f35228bf 100644 --- a/RecoTracker/DeDx/plugins/HLTDeDxFilter.h +++ b/RecoTracker/DeDx/plugins/HLTDeDxFilter.h @@ -8,6 +8,7 @@ */ #include "HLTrigger/HLTcore/interface/HLTFilter.h" +#include "FWCore/Utilities/interface/EDGetToken.h" namespace edm { class ConfigurationDescriptions; @@ -32,6 +33,8 @@ class HLTDeDxFilter : public HLTFilter { double minPT_; double minNOM_; double maxETA_; + edm::EDGetToken inputTracksToken_; + edm::EDGetToken inputdedxToken_; edm::InputTag inputTracksTag_; edm::InputTag inputdedxTag_; edm::InputTag thisModuleTag_; diff --git a/RecoTracker/DebugTools/interface/CkfDebugTrackCandidateMaker.h b/RecoTracker/DebugTools/interface/CkfDebugTrackCandidateMaker.h index 2c74284bc1cff..54abe1f4475ec 100644 --- a/RecoTracker/DebugTools/interface/CkfDebugTrackCandidateMaker.h +++ b/RecoTracker/DebugTools/interface/CkfDebugTrackCandidateMaker.h @@ -7,9 +7,9 @@ #include "FWCore/Framework/interface/EDProducer.h" namespace cms { - class CkfDebugTrackCandidateMaker : public CkfTrackCandidateMakerBase, public edm::EDProducer { + class CkfDebugTrackCandidateMaker : public edm::EDProducer, public CkfTrackCandidateMakerBase { public: - CkfDebugTrackCandidateMaker(const edm::ParameterSet& conf) : CkfTrackCandidateMakerBase(conf) { + CkfDebugTrackCandidateMaker(const edm::ParameterSet& conf) : CkfTrackCandidateMakerBase(conf, consumesCollector()) { produces(); } diff --git a/RecoTracker/FinalTrackSelectors/interface/AnalyticalTrackSelector.h b/RecoTracker/FinalTrackSelectors/interface/AnalyticalTrackSelector.h index 678a1fe0cf87e..75682f209d241 100644 --- a/RecoTracker/FinalTrackSelectors/interface/AnalyticalTrackSelector.h +++ b/RecoTracker/FinalTrackSelectors/interface/AnalyticalTrackSelector.h @@ -58,6 +58,9 @@ namespace reco { namespace modules { /// eta restrictions double minEta_; double maxEta_; + + edm::EDGetTokenT > srcTraj_; + edm::EDGetTokenT srcTass_; /// storage std::auto_ptr selTracks_; diff --git a/RecoTracker/FinalTrackSelectors/interface/CosmicTrackSelector.h b/RecoTracker/FinalTrackSelectors/interface/CosmicTrackSelector.h index 6e2402345d9d7..7c393b2ac9922 100644 --- a/RecoTracker/FinalTrackSelectors/interface/CosmicTrackSelector.h +++ b/RecoTracker/FinalTrackSelectors/interface/CosmicTrackSelector.h @@ -49,12 +49,14 @@ namespace reco { namespace modules { // return class, or -1 if rejected bool select (const reco::BeamSpot &vertexBeamSpot, const reco::Track &tk); // source collection label - edm::InputTag src_; - edm::InputTag beamspot_; + edm::EDGetTokenT src_; + edm::EDGetTokenT beamspot_; // copy only the tracks, not extras and rechits (for AOD) bool copyExtras_; // copy also trajectories and trajectory->track associations bool copyTrajectories_; + edm::EDGetTokenT > srcTraj_; + edm::EDGetTokenT srcTass_; // save all the tracks bool keepAllTracks_; diff --git a/RecoTracker/FinalTrackSelectors/interface/DuplicateListMerger.h b/RecoTracker/FinalTrackSelectors/interface/DuplicateListMerger.h index b31b59f28374a..78344a9d616dd 100644 --- a/RecoTracker/FinalTrackSelectors/interface/DuplicateListMerger.h +++ b/RecoTracker/FinalTrackSelectors/interface/DuplicateListMerger.h @@ -25,6 +25,7 @@ #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" #include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h" #include "DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h" +#include "DataFormats/Common/interface/ValueMap.h" #include #include #include @@ -56,12 +57,25 @@ namespace reco { namespace modules { } /// track input collection - edm::InputTag mergedTrackSource_; - edm::InputTag originalTrackSource_; - edm::InputTag candidateSource_; + struct ThreeTokens { + edm::InputTag tag; + edm::EDGetTokenT tk; + edm::EDGetTokenT > traj; + edm::EDGetTokenT tass; + ThreeTokens() {} + ThreeTokens(const edm::InputTag &tag_, edm::EDGetTokenT && tk_, edm::EDGetTokenT > && traj_, edm::EDGetTokenT && tass_) : + tag(tag_), tk(tk_), traj(traj_), tass(tass_) {} + }; + ThreeTokens threeTokens(const edm::InputTag &tag) { + return ThreeTokens(tag, consumes(tag), consumes >(tag), consumes(tag)); + } + ThreeTokens mergedTrackSource_, originalTrackSource_; + edm::EDGetTokenT > candidateSource_; - edm::InputTag originalMVAVals_; - edm::InputTag mergedMVAVals_; + edm::InputTag originalMVAVals_; + edm::InputTag mergedMVAVals_; + edm::EDGetTokenT > originalMVAValsToken_; + edm::EDGetTokenT > mergedMVAValsToken_; reco::TrackBase::TrackQuality qualityToSet_; unsigned int diffHitsCut_; diff --git a/RecoTracker/FinalTrackSelectors/interface/DuplicateTrackMerger.h b/RecoTracker/FinalTrackSelectors/interface/DuplicateTrackMerger.h index afe8027d4f650..4b33eafa0e454 100644 --- a/RecoTracker/FinalTrackSelectors/interface/DuplicateTrackMerger.h +++ b/RecoTracker/FinalTrackSelectors/interface/DuplicateTrackMerger.h @@ -62,7 +62,7 @@ namespace reco { namespace modules { float* gbrVals_; /// track input collection - edm::InputTag trackSource_; + edm::EDGetTokenT trackSource_; /// MVA weights file std::string dbFileName_; bool useForestFromDB_; diff --git a/RecoTracker/FinalTrackSelectors/src/AnalyticalTrackSelector.cc b/RecoTracker/FinalTrackSelectors/src/AnalyticalTrackSelector.cc index 48255d5242214..a0c5a57386240 100644 --- a/RecoTracker/FinalTrackSelectors/src/AnalyticalTrackSelector.cc +++ b/RecoTracker/FinalTrackSelectors/src/AnalyticalTrackSelector.cc @@ -46,13 +46,17 @@ AnalyticalTrackSelector::AnalyticalTrackSelector( const edm::ParameterSet & cfg forest_ = 0; gbrVals_ = 0; - src_ = cfg.getParameter( "src" ); - beamspot_ = cfg.getParameter( "beamspot" ); + src_ = consumes(cfg.getParameter( "src" )); + beamspot_ = consumes(cfg.getParameter( "beamspot" )); useVertices_ = cfg.getParameter( "useVertices" ); useVtxError_ = cfg.getParameter( "useVtxError" ); - vertices_ = useVertices_ ? cfg.getParameter( "vertices" ) : edm::InputTag("NONE"); + if (useVertices_) vertices_ = consumes(cfg.getParameter( "vertices" )); copyExtras_ = cfg.getUntrackedParameter("copyExtras", false); copyTrajectories_ = cfg.getUntrackedParameter("copyTrajectories", false); + if (copyTrajectories_) { + srcTraj_ = consumes >(cfg.getParameter( "src" )); + srcTass_ = consumes(cfg.getParameter( "src" )); + } qualityToSet_.push_back( TrackBase::undefQuality ); // parameters for vertex selection @@ -153,7 +157,7 @@ void AnalyticalTrackSelector::produce( edm::Event& evt, const edm::EventSetup& e // looking for the beam spot edm::Handle hBsp; - evt.getByLabel(beamspot_, hBsp); + evt.getByToken(beamspot_, hBsp); reco::BeamSpot vertexBeamSpot; vertexBeamSpot = *hBsp; @@ -162,14 +166,14 @@ void AnalyticalTrackSelector::produce( edm::Event& evt, const edm::EventSetup& e std::vector points; std::vector vterr, vzerr; if (useVertices_) { - evt.getByLabel(vertices_, hVtx); + evt.getByToken(vertices_, hVtx); selectVertices(0,*hVtx, points, vterr, vzerr); // Debug LogDebug("SelectVertex") << points.size() << " good pixel vertices"; } // Get tracks - evt.getByLabel( src_, hSrcTrack ); + evt.getByToken( src_, hSrcTrack ); selTracks_ = auto_ptr(new TrackCollection()); rTracks_ = evt.getRefBeforePut(); @@ -234,8 +238,8 @@ void AnalyticalTrackSelector::produce( edm::Event& evt, const edm::EventSetup& e if ( copyTrajectories_ ) { Handle< vector > hTraj; Handle< TrajTrackAssociationCollection > hTTAss; - evt.getByLabel(src_, hTTAss); - evt.getByLabel(src_, hTraj); + evt.getByToken(srcTass_, hTTAss); + evt.getByToken(srcTraj_, hTraj); selTrajs_ = auto_ptr< vector >(new vector()); rTrajectories_ = evt.getRefBeforePut< vector >(); selTTAss_ = auto_ptr< TrajTrackAssociationCollection >(new TrajTrackAssociationCollection()); diff --git a/RecoTracker/FinalTrackSelectors/src/CosmicTrackSelector.cc b/RecoTracker/FinalTrackSelectors/src/CosmicTrackSelector.cc index b31df36bfb169..17b6a22979719 100644 --- a/RecoTracker/FinalTrackSelectors/src/CosmicTrackSelector.cc +++ b/RecoTracker/FinalTrackSelectors/src/CosmicTrackSelector.cc @@ -6,8 +6,8 @@ using reco::modules::CosmicTrackSelector; CosmicTrackSelector::CosmicTrackSelector( const edm::ParameterSet & cfg ) : - src_( cfg.getParameter( "src" ) ), - beamspot_( cfg.getParameter( "beamspot" ) ), + src_( consumes( cfg.getParameter( "src" ) ) ), + beamspot_( consumes( cfg.getParameter( "beamspot" ) ) ), copyExtras_(cfg.getUntrackedParameter("copyExtras", false)), copyTrajectories_(cfg.getUntrackedParameter("copyTrajectories", false)), keepAllTracks_( cfg.exists("keepAllTracks") ? @@ -50,6 +50,8 @@ CosmicTrackSelector::CosmicTrackSelector( const edm::ParameterSet & cfg ) : produces().setBranchAlias( alias + "RecHits"); } if (copyTrajectories_) { + srcTraj_ = consumes >(cfg.getParameter( "src" )); + srcTass_ = consumes(cfg.getParameter( "src" )); produces< std::vector >().setBranchAlias( alias + "Trajectories"); produces< TrajTrackAssociationCollection >().setBranchAlias( alias + "TrajectoryTrackAssociations"); } @@ -72,12 +74,12 @@ void CosmicTrackSelector::produce( edm::Event& evt, const edm::EventSetup& es ) // looking for the beam spot edm::Handle hBsp; - evt.getByLabel(beamspot_, hBsp); + evt.getByToken(beamspot_, hBsp); reco::BeamSpot vertexBeamSpot; vertexBeamSpot = *hBsp; // Get tracks - evt.getByLabel( src_, hSrcTrack ); + evt.getByToken( src_, hSrcTrack ); selTracks_ = auto_ptr(new TrackCollection()); rTracks_ = evt.getRefBeforePut(); @@ -125,8 +127,8 @@ void CosmicTrackSelector::produce( edm::Event& evt, const edm::EventSetup& es ) if ( copyTrajectories_ ) { Handle< vector > hTraj; Handle< TrajTrackAssociationCollection > hTTAss; - evt.getByLabel(src_, hTTAss); - evt.getByLabel(src_, hTraj); + evt.getByToken(srcTass_, hTTAss); + evt.getByToken(srcTraj_, hTraj); selTrajs_ = auto_ptr< vector >(new vector()); rTrajectories_ = evt.getRefBeforePut< vector >(); selTTAss_ = auto_ptr< TrajTrackAssociationCollection >(new TrajTrackAssociationCollection()); diff --git a/RecoTracker/FinalTrackSelectors/src/DuplicateListMerger.cc b/RecoTracker/FinalTrackSelectors/src/DuplicateListMerger.cc index 7dfc3c468a00a..a019ef7e5da7d 100644 --- a/RecoTracker/FinalTrackSelectors/src/DuplicateListMerger.cc +++ b/RecoTracker/FinalTrackSelectors/src/DuplicateListMerger.cc @@ -16,21 +16,23 @@ DuplicateListMerger::DuplicateListMerger(const edm::ParameterSet& iPara) minTrkProbCut_ = 0.0; if(iPara.exists("diffHitsCut"))diffHitsCut_ = iPara.getParameter("diffHitsCut"); if(iPara.exists("minTrkProbCut"))minTrkProbCut_ = iPara.getParameter("minTrkProbCut"); - if(iPara.exists("mergedSource"))mergedTrackSource_ = iPara.getParameter("mergedSource"); - if(iPara.exists("originalSource"))originalTrackSource_ = iPara.getParameter("originalSource"); - if(iPara.exists("candidateSource"))candidateSource_ = iPara.getParameter("candidateSource"); + if(iPara.exists("mergedSource")) mergedTrackSource_ = threeTokens(iPara.getParameter("mergedSource")); + if(iPara.exists("originalSource"))originalTrackSource_ = threeTokens(iPara.getParameter("originalSource")); + if(iPara.exists("candidateSource"))candidateSource_ = consumes >(iPara.getParameter("candidateSource")); if(iPara.exists("mergedMVAVals")){ mergedMVAVals_ = iPara.getParameter("mergedMVAVals"); }else{ - mergedMVAVals_ = edm::InputTag(mergedTrackSource_.label(),"MVAVals"); + mergedMVAVals_ = edm::InputTag(mergedTrackSource_.tag.label(),"MVAVals"); } + mergedMVAValsToken_ = consumes >(mergedMVAVals_); if(iPara.exists("originalMVAVals")){ originalMVAVals_ = iPara.getParameter("originalMVAVals"); }else{ - originalMVAVals_ = edm::InputTag(originalTrackSource_.label(),"MVAVals"); + originalMVAVals_ = edm::InputTag(originalTrackSource_.tag.label(),"MVAVals"); } + originalMVAValsToken_ = consumes >(originalMVAVals_); copyExtras_ = iPara.getUntrackedParameter("copyExtras",true); qualityToSet_ = reco::TrackBase::undefQuality; @@ -69,26 +71,26 @@ DuplicateListMerger::~DuplicateListMerger() void DuplicateListMerger::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::Handle originalHandle; - iEvent.getByLabel(originalTrackSource_,originalHandle); + iEvent.getByToken(originalTrackSource_.tk,originalHandle); edm::Handle mergedHandle; - iEvent.getByLabel(mergedTrackSource_,mergedHandle); + iEvent.getByToken(mergedTrackSource_.tk,mergedHandle); const reco::TrackCollection& mergedTracks(*mergedHandle); reco::TrackRefProd originalTrackRefs(originalHandle); reco::TrackRefProd mergedTrackRefs(mergedHandle); edm::Handle< std::vector > mergedTrajHandle; - iEvent.getByLabel(mergedTrackSource_,mergedTrajHandle); + iEvent.getByToken(mergedTrackSource_.traj,mergedTrajHandle); edm::Handle< TrajTrackAssociationCollection > mergedTrajTrackHandle; - iEvent.getByLabel(mergedTrackSource_,mergedTrajTrackHandle); + iEvent.getByToken(mergedTrackSource_.tass,mergedTrajTrackHandle); edm::Handle< std::vector > originalTrajHandle; - iEvent.getByLabel(originalTrackSource_,originalTrajHandle); + iEvent.getByToken(originalTrackSource_.traj,originalTrajHandle); edm::Handle< TrajTrackAssociationCollection > originalTrajTrackHandle; - iEvent.getByLabel(originalTrackSource_,originalTrajTrackHandle); + iEvent.getByToken(originalTrackSource_.tass,originalTrajTrackHandle); edm::Handle > candidateHandle; - iEvent.getByLabel(candidateSource_,candidateHandle); + iEvent.getByToken(candidateSource_,candidateHandle); std::auto_ptr > out_generalTracks(new std::vector()); out_generalTracks->reserve(originalHandle->size()); @@ -112,8 +114,8 @@ void DuplicateListMerger::produce(edm::Event& iEvent, const edm::EventSetup& iSe edm::Handle > originalMVAStore; edm::Handle > mergedMVAStore; - iEvent.getByLabel(originalMVAVals_,originalMVAStore); - iEvent.getByLabel(mergedMVAVals_,mergedMVAStore); + iEvent.getByToken(originalMVAValsToken_,originalMVAStore); + iEvent.getByToken(mergedMVAValsToken_,mergedMVAStore); std::auto_ptr > vmMVA = std::auto_ptr >(new edm::ValueMap); edm::ValueMap::Filler fillerMVA(*vmMVA); diff --git a/RecoTracker/FinalTrackSelectors/src/DuplicateTrackMerger.cc b/RecoTracker/FinalTrackSelectors/src/DuplicateTrackMerger.cc index 55147a4a819be..7858a6dd9ac5a 100644 --- a/RecoTracker/FinalTrackSelectors/src/DuplicateTrackMerger.cc +++ b/RecoTracker/FinalTrackSelectors/src/DuplicateTrackMerger.cc @@ -36,7 +36,7 @@ DuplicateTrackMerger::DuplicateTrackMerger(const edm::ParameterSet& iPara) : mer if(iPara.exists("maxDdsz"))maxDdsz_ = iPara.getParameter("maxDdsz"); if(iPara.exists("maxDdxy"))maxDdxy_ = iPara.getParameter("maxDdxy"); if(iPara.exists("maxDQoP"))maxDQoP_ = iPara.getParameter("maxDQoP"); - if(iPara.exists("source"))trackSource_ = iPara.getParameter("source"); + if(iPara.exists("source"))trackSource_ = consumes(iPara.getParameter("source")); if(iPara.exists("minDeltaR3d"))minDeltaR3d_ = iPara.getParameter("minDeltaR3d"); if(iPara.exists("minBDTG"))minBDTG_ = iPara.getParameter("minBDTG"); @@ -95,7 +95,7 @@ void DuplicateTrackMerger::produce(edm::Event& iEvent, const edm::EventSetup& iS //edm::Handle >handle; edm::Handlehandle; - iEvent.getByLabel(trackSource_,handle); + iEvent.getByToken(trackSource_,handle); reco::TrackRefProd refTrks(handle); iSetup.get().get(magfield_); diff --git a/RecoTracker/FinalTrackSelectors/src/MultiTrackSelector.cc b/RecoTracker/FinalTrackSelectors/src/MultiTrackSelector.cc index 7e89d352f837a..78f343e3cf858 100755 --- a/RecoTracker/FinalTrackSelectors/src/MultiTrackSelector.cc +++ b/RecoTracker/FinalTrackSelectors/src/MultiTrackSelector.cc @@ -21,13 +21,13 @@ MultiTrackSelector::MultiTrackSelector() } MultiTrackSelector::MultiTrackSelector( const edm::ParameterSet & cfg ) : - src_( cfg.getParameter( "src" ) ), - beamspot_( cfg.getParameter( "beamspot" ) ), + src_( consumes( cfg.getParameter( "src" ) ) ), + beamspot_( consumes( cfg.getParameter( "beamspot" ) ) ), useVertices_( cfg.getParameter( "useVertices" ) ), - useVtxError_( cfg.getParameter( "useVtxError" ) ), - vertices_( useVertices_ ? cfg.getParameter( "vertices" ) : edm::InputTag("NONE")) + useVtxError_( cfg.getParameter( "useVtxError" ) ) // now get the pset for each selector { + if (useVertices_) vertices_ = consumes(cfg.getParameter( "vertices" )); useAnyMVA_ = false; forestLabel_ = "MVASelectorIter0"; @@ -199,18 +199,18 @@ void MultiTrackSelector::produce( edm::Event& evt, const edm::EventSetup& es ) // Get tracks Handle hSrcTrack; - evt.getByLabel( src_, hSrcTrack ); + evt.getByToken( src_, hSrcTrack ); const TrackCollection& srcTracks(*hSrcTrack); // looking for the beam spot edm::Handle hBsp; - evt.getByLabel(beamspot_, hBsp); + evt.getByToken(beamspot_, hBsp); const reco::BeamSpot& vertexBeamSpot(*hBsp); // Select good primary vertices for use in subsequent track selection edm::Handle hVtx; - if (useVertices_) evt.getByLabel(vertices_, hVtx); + if (useVertices_) evt.getByToken(vertices_, hVtx); unsigned int trkSize=srcTracks.size(); std::vector selTracksSave( qualityToSet_.size()*trkSize,0); @@ -469,7 +469,7 @@ void MultiTrackSelector::processMVA(edm::Event& evt, const edm::EventSetup& es) // Get tracks Handle hSrcTrack; - evt.getByLabel( src_, hSrcTrack ); + evt.getByToken( src_, hSrcTrack ); const TrackCollection& srcTracks(*hSrcTrack); auto_ptr >mvaValValueMap = auto_ptr >(new edm::ValueMap); diff --git a/RecoTracker/FinalTrackSelectors/src/MultiTrackSelector.h b/RecoTracker/FinalTrackSelectors/src/MultiTrackSelector.h index b741b7c63a152..31dcbd64a2c89 100755 --- a/RecoTracker/FinalTrackSelectors/src/MultiTrackSelector.h +++ b/RecoTracker/FinalTrackSelectors/src/MultiTrackSelector.h @@ -66,12 +66,12 @@ namespace reco { namespace modules { void processMVA(edm::Event& evt, const edm::EventSetup& es); /// source collection label - edm::InputTag src_; - edm::InputTag beamspot_; + edm::EDGetTokenT src_; + edm::EDGetTokenT beamspot_; bool useVertices_; bool useVtxError_; bool useAnyMVA_; - edm::InputTag vertices_; + edm::EDGetTokenT vertices_; /// do I have to set a quality bit? std::vector setQualityBit_; diff --git a/RecoTracker/FinalTrackSelectors/src/TrackListMerger.cc b/RecoTracker/FinalTrackSelectors/src/TrackListMerger.cc index ead69b58d3249..15a3217515904 100644 --- a/RecoTracker/FinalTrackSelectors/src/TrackListMerger.cc +++ b/RecoTracker/FinalTrackSelectors/src/TrackListMerger.cc @@ -109,8 +109,8 @@ namespace cms TrackListMerger::TrackListMerger(edm::ParameterSet const& conf) { copyExtras_ = conf.getUntrackedParameter("copyExtras", true); - - trackProducers_ = conf.getParameter >("TrackProducers"); + + std::vector trackProducerTags(conf.getParameter >("TrackProducers")); //which of these do I need to turn into vectors? maxNormalizedChisq_ = conf.getParameter("MaxNormalizedChisq"); minPT_ = conf.getParameter("MinPT"); @@ -139,28 +139,26 @@ namespace cms promoteQuality_.push_back(setsToMerge[i].getParameter("pQual")); } - hasSelector_=conf.getParameter >("hasSelector"); - selectors_=conf.getParameter >("selectedTrackQuals"); + hasSelector_= conf.getParameter >("hasSelector"); + std::vector selectors(conf.getParameter >("selectedTrackQuals")); + std::vector mvaStores; if(conf.exists("mvaValueTags")){ - mvaStores_ = conf.getParameter >("mvaValueTags"); + mvaStores = conf.getParameter >("mvaValueTags"); }else{ - std::vector mvaValueTags; - for (int i = 0; i < (int)selectors_.size(); i++){ - edm::InputTag ntag(selectors_[i].label(),"MVAVals"); - mvaValueTags.push_back(ntag); + for (int i = 0; i < (int)selectors.size(); i++){ + edm::InputTag ntag(selectors[i].label(),"MVAVals"); + mvaStores.push_back(ntag); } - - mvaStores_ = mvaValueTags; } - unsigned int numTrkColl = trackProducers_.size(); - if (numTrkColl != hasSelector_.size() || numTrkColl != selectors_.size()) { + unsigned int numTrkColl = trackProducerTags.size(); + if (numTrkColl != hasSelector_.size() || numTrkColl != selectors.size()) { throw cms::Exception("Inconsistent size") << "need same number of track collections and selectors"; } - if (numTrkColl != hasSelector_.size() || numTrkColl != mvaStores_.size()) { + if (numTrkColl != hasSelector_.size() || numTrkColl != mvaStores.size()) { throw cms::Exception("Inconsistent size") << "need same number of track collections and MVA stores"; } for (unsigned int i = indivShareFrac_.size(); i < numTrkColl; i++) { - // edm::LogWarning("TrackListMerger") << "No indivShareFrac for " << trackProducers_[i] <<". Using default value of 1"; + // edm::LogWarning("TrackListMerger") << "No indivShareFrac for " << trackProducersTags <<". Using default value of 1"; indivShareFrac_.push_back(1.0); } @@ -168,7 +166,7 @@ namespace cms if ( trkQualMod_) { bool ok=true; for ( unsigned int i=1; i(); } produces >("MVAVals"); + + // Do all the consumes + trackProducers_.resize(numTrkColl); + for (unsigned int i = 0; i < numTrkColl; ++i) { + trackProducers_[i] = hasSelector_[i]>0 ? edTokens(trackProducerTags[i], selectors[i], mvaStores[i]) : edTokens(trackProducerTags[i], mvaStores[i]); + } } @@ -221,11 +225,11 @@ namespace cms for ( unsigned int i=0; i trackColl; - e.getByLabel(trackProducers_[i], trackHandles[i]); + e.getByToken(trackProducers_[i].tk, trackHandles[i]); if (trackHandles[i].isValid()) { trackColls[i]= trackHandles[i].product(); } else { - edm::LogWarning("TrackListMerger") << "TrackCollection " << trackProducers_[i] <<" not found"; + edm::LogWarning("TrackListMerger") << "TrackCollection " << trackProducers_[i].tag <<" not found"; trackColls[i]=&s_empty; } } @@ -263,9 +267,9 @@ namespace cms edm::Handle > trackSelColl; edm::Handle > trackMVAStore; - e.getByLabel(mvaStores_[j], trackMVAStore); + e.getByToken(trackProducers_[j].tmva, trackMVAStore); if ( hasSelector_[j]>0 ){ - e.getByLabel(selectors_[j], trackSelColl); + e.getByToken(trackProducers_[j].tsel, trackSelColl); } if ( 0size() ){ @@ -667,8 +671,8 @@ namespace cms for (unsigned int ti=0; ti > hTraj1; edm::Handle< TrajTrackAssociationCollection > hTTAss1; - e.getByLabel(trackProducers_[ti], hTraj1); - e.getByLabel(trackProducers_[ti], hTTAss1); + e.getByToken(trackProducers_[ti].traj, hTraj1); + e.getByToken(trackProducers_[ti].tass, hTTAss1); if (hTraj1.failedToGet() || hTTAss1.failedToGet()) continue; diff --git a/RecoTracker/FinalTrackSelectors/src/TrackListMerger.h b/RecoTracker/FinalTrackSelectors/src/TrackListMerger.h index 3624818e135e6..4b2b309f4d8e7 100644 --- a/RecoTracker/FinalTrackSelectors/src/TrackListMerger.h +++ b/RecoTracker/FinalTrackSelectors/src/TrackListMerger.h @@ -30,6 +30,7 @@ #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/Common/interface/ValueMap.h" namespace cms { @@ -60,7 +61,31 @@ namespace cms bool copyExtras_; bool makeReKeyedSeeds_; - std::vector trackProducers_; + struct TkEDGetTokenss { + edm::InputTag tag; + edm::EDGetTokenT tk; + edm::EDGetTokenT > traj; + edm::EDGetTokenT tass; + edm::EDGetTokenT > tsel; + edm::EDGetTokenT > tmva; + TkEDGetTokenss() {} + TkEDGetTokenss(const edm::InputTag &tag_, edm::EDGetTokenT && tk_, + edm::EDGetTokenT > && traj_, edm::EDGetTokenT && tass_, + edm::EDGetTokenT > &&tsel_, edm::EDGetTokenT > && tmva_) : + tag(tag_), tk(tk_), traj(traj_), tass(tass_), tsel(tsel_), tmva(tmva_) {} + }; + TkEDGetTokenss edTokens(const edm::InputTag &tag, const edm::InputTag &seltag, const edm::InputTag &mvatag) { + return TkEDGetTokenss(tag, consumes(tag), + consumes >(tag), consumes(tag), + consumes >(seltag), consumes >(mvatag)); + } + TkEDGetTokenss edTokens(const edm::InputTag &tag, const edm::InputTag &mvatag) { + return TkEDGetTokenss(tag, consumes(tag), + consumes >(tag), consumes(tag), + edm::EDGetTokenT >(), consumes >(mvatag)); + } + std::vector trackProducers_; + double maxNormalizedChisq_; double minPT_; unsigned int minFound_; @@ -73,8 +98,6 @@ namespace cms std::vector< std::vector< int> > listsToMerge_; std::vector promoteQuality_; std::vector hasSelector_; - std::vector selectors_; - std::vector mvaStores_; bool allowFirstHitShare_; reco::TrackBase::TrackQuality qualityToSet_; diff --git a/RecoTracker/IterativeTracking/interface/QualityFilter.h b/RecoTracker/IterativeTracking/interface/QualityFilter.h index a1cf4e4a21d5d..6d779a621baa2 100644 --- a/RecoTracker/IterativeTracking/interface/QualityFilter.h +++ b/RecoTracker/IterativeTracking/interface/QualityFilter.h @@ -6,6 +6,7 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" class QualityFilter : public edm::EDProducer { public: @@ -19,7 +20,8 @@ class QualityFilter : public edm::EDProducer { // ----------member data --------------------------- private: - edm::InputTag tkTag; + edm::EDGetTokenT > trajTag; + edm::EDGetTokenT tassTag; reco::TrackBase::TrackQuality trackQuality_; bool copyExtras_; }; diff --git a/RecoTracker/IterativeTracking/src/QualityFilter.cc b/RecoTracker/IterativeTracking/src/QualityFilter.cc index a4eb04bceec92..11d9a7cf54964 100644 --- a/RecoTracker/IterativeTracking/src/QualityFilter.cc +++ b/RecoTracker/IterativeTracking/src/QualityFilter.cc @@ -26,7 +26,8 @@ QualityFilter::QualityFilter(const edm::ParameterSet& iConfig) produces >(); produces(); - tkTag = iConfig.getParameter("recTracks"); + trajTag = consumes >(iConfig.getParameter("recTracks")); + tassTag = consumes(iConfig.getParameter("recTracks")); trackQuality_=TrackBase::qualityByName(iConfig.getParameter("TrackQuality")); } @@ -67,8 +68,8 @@ QualityFilter::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) Handle > TrajectoryCollection; Handle assoMap; - iEvent.getByLabel(tkTag,TrajectoryCollection); - iEvent.getByLabel(tkTag,assoMap); + iEvent.getByToken(trajTag,TrajectoryCollection); + iEvent.getByToken(tassTag,assoMap); diff --git a/RecoTracker/TrackProducer/interface/TrackProducerBase.h b/RecoTracker/TrackProducer/interface/TrackProducerBase.h index c56402bb2c15e..afa07201748a1 100644 --- a/RecoTracker/TrackProducer/interface/TrackProducerBase.h +++ b/RecoTracker/TrackProducer/interface/TrackProducerBase.h @@ -69,7 +69,7 @@ class TrackProducerBase { void setConf(const edm::ParameterSet& conf){conf_=conf;} /// set label of source collection - void setSrc(const edm::InputTag& src, const edm::InputTag& bsSrc){src_=src;bsSrc_=bsSrc;} + void setSrc(const edm::EDGetToken& src, const edm::EDGetTokenT& bsSrc){src_=src;bsSrc_=bsSrc;} /// set the aliases of produced collections void setAlias(std::string alias){ @@ -89,12 +89,12 @@ class TrackProducerBase { const edm::ParameterSet& getConf() const {return conf_;} private: edm::ParameterSet conf_; - edm::InputTag src_; + edm::EDGetToken src_; protected: std::string alias_; bool trajectoryInEvent_; edm::OrphanHandle rTracks_; - edm::InputTag bsSrc_; + edm::EDGetTokenT bsSrc_; bool rekeyClusterRefs_; edm::InputTag clusterRemovalInfo_; diff --git a/RecoTracker/TrackProducer/interface/TrackProducerBase.icc b/RecoTracker/TrackProducer/interface/TrackProducerBase.icc index 28bc114198d9d..964bb25be7ee6 100644 --- a/RecoTracker/TrackProducer/interface/TrackProducerBase.icc +++ b/RecoTracker/TrackProducer/interface/TrackProducerBase.icc @@ -105,11 +105,11 @@ TrackProducerBase::getFromEvt(edm::Event& theEvent,edm::Handle recoBeamSpotHandle; - theEvent.getByLabel(bsSrc_,recoBeamSpotHandle); + theEvent.getByToken(bsSrc_,recoBeamSpotHandle); bs = *recoBeamSpotHandle; } @@ -121,11 +121,11 @@ TrackProducerBase::getFromEvt(edm::Event& theEvent,edm::Handle recoBeamSpotHandle; - theEvent.getByLabel(bsSrc_,recoBeamSpotHandle); + theEvent.getByToken(bsSrc_,recoBeamSpotHandle); bs = *recoBeamSpotHandle; } diff --git a/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc b/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc index 26d699d70453f..70a6fe3547977 100644 --- a/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc +++ b/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc @@ -21,7 +21,8 @@ GsfTrackProducer::GsfTrackProducer(const edm::ParameterSet& iConfig): theAlgo(iConfig) { setConf(iConfig); - setSrc( iConfig.getParameter( "src" ), iConfig.getParameter( "beamSpot" )); + setSrc( consumes(iConfig.getParameter( "src" )), + consumes(iConfig.getParameter( "beamSpot" ))); setAlias( iConfig.getParameter( "@module_label" ) ); // string a = alias_; // a.erase(a.size()-6,a.size()); diff --git a/RecoTracker/TrackProducer/plugins/GsfTrackRefitter.cc b/RecoTracker/TrackProducer/plugins/GsfTrackRefitter.cc index db8ee1b7f9fc7..77610a2910610 100644 --- a/RecoTracker/TrackProducer/plugins/GsfTrackRefitter.cc +++ b/RecoTracker/TrackProducer/plugins/GsfTrackRefitter.cc @@ -18,7 +18,8 @@ GsfTrackRefitter::GsfTrackRefitter(const edm::ParameterSet& iConfig): theAlgo(iConfig) { setConf(iConfig); - setSrc( iConfig.getParameter( "src" ), iConfig.getParameter( "beamSpot" )); + setSrc( consumes(iConfig.getParameter( "src" )), + consumes(iConfig.getParameter( "beamSpot" ))); setAlias( iConfig.getParameter( "@module_label" ) ); std::string constraint_str = iConfig.getParameter( "constraint" ); @@ -26,7 +27,7 @@ GsfTrackRefitter::GsfTrackRefitter(const edm::ParameterSet& iConfig): // else if (constraint_str == "momentum") constraint_ = momentum; else if (constraint_str == "vertex") { constraint_ = vertex; - gsfTrackVtxConstraintTag_ = iConfig.getParameter("gsfTrackVtxConstraintTag"); + gsfTrackVtxConstraintTag_ = consumes(iConfig.getParameter("gsfTrackVtxConstraintTag")); } else { edm::LogError("GsfTrackRefitter")<<"constraint: "< theTCollectionWithConstraint; - theEvent.getByLabel(gsfTrackVtxConstraintTag_, theTCollectionWithConstraint); + theEvent.getByToken(gsfTrackVtxConstraintTag_, theTCollectionWithConstraint); edm::Handle recoBeamSpotHandle; - theEvent.getByLabel(bsSrc_,recoBeamSpotHandle); + theEvent.getByToken(bsSrc_,recoBeamSpotHandle); bs = *recoBeamSpotHandle; if (theTCollectionWithConstraint.failedToGet()){ edm::LogError("TrackRefitter")<<"could not get TrackVtxConstraintAssociationCollection product."; break;} diff --git a/RecoTracker/TrackProducer/plugins/GsfTrackRefitter.h b/RecoTracker/TrackProducer/plugins/GsfTrackRefitter.h index d0c26810c0e86..4745837320b05 100644 --- a/RecoTracker/TrackProducer/plugins/GsfTrackRefitter.h +++ b/RecoTracker/TrackProducer/plugins/GsfTrackRefitter.h @@ -8,6 +8,7 @@ #include "RecoTracker/TrackProducer/interface/GsfTrackProducerBase.h" #include "RecoTracker/TrackProducer/interface/TrackProducerAlgorithm.h" #include "FWCore/Utilities/interface/InputTag.h" +#include "TrackingTools/GsfTracking/interface/GsfTrackConstraintAssociation.h" class GsfTrackRefitter : public GsfTrackProducerBase, public edm::EDProducer { public: @@ -24,7 +25,7 @@ class GsfTrackRefitter : public GsfTrackProducerBase, public edm::EDProducer { // momentum, vertex }; Constraint constraint_; - edm::InputTag gsfTrackVtxConstraintTag_; + edm::EDGetTokenT gsfTrackVtxConstraintTag_; }; #endif diff --git a/RecoTracker/TrackProducer/plugins/TrackProducer.cc b/RecoTracker/TrackProducer/plugins/TrackProducer.cc index e2a8b954f906c..556073bdae646 100644 --- a/RecoTracker/TrackProducer/plugins/TrackProducer.cc +++ b/RecoTracker/TrackProducer/plugins/TrackProducer.cc @@ -18,7 +18,8 @@ TrackProducer::TrackProducer(const edm::ParameterSet& iConfig): theAlgo(iConfig) { setConf(iConfig); - setSrc( iConfig.getParameter( "src" ), iConfig.getParameter( "beamSpot" )); + setSrc( consumes(iConfig.getParameter( "src" )), + consumes(iConfig.getParameter( "beamSpot" ))); setAlias( iConfig.getParameter( "@module_label" ) ); if ( iConfig.exists("clusterRemovalInfo") ) { diff --git a/RecoTracker/TrackProducer/plugins/TrackRefitter.cc b/RecoTracker/TrackProducer/plugins/TrackRefitter.cc index 7dfabd21ce0a2..eee7a95027c20 100644 --- a/RecoTracker/TrackProducer/plugins/TrackRefitter.cc +++ b/RecoTracker/TrackProducer/plugins/TrackRefitter.cc @@ -16,16 +16,17 @@ TrackRefitter::TrackRefitter(const edm::ParameterSet& iConfig): theAlgo(iConfig) { setConf(iConfig); - setSrc( iConfig.getParameter( "src" ), iConfig.getParameter( "beamSpot" )); + setSrc( consumes(iConfig.getParameter( "src" )), + consumes(iConfig.getParameter( "beamSpot" ))); setAlias( iConfig.getParameter( "@module_label" ) ); std::string constraint_str = iConfig.getParameter( "constraint" ); - trkconstrcoll_=iConfig.getParameter( "srcConstr" ); + edm::InputTag trkconstrcoll = iConfig.getParameter( "srcConstr" ); if (constraint_str == "") constraint_ = none; - else if (constraint_str == "momentum") constraint_ = momentum; - else if (constraint_str == "vertex") constraint_ = vertex; - else if (constraint_str == "trackParameters") constraint_ = trackParameters; + else if (constraint_str == "momentum") { constraint_ = momentum; trkconstrcoll_ = consumes(trkconstrcoll); } + else if (constraint_str == "vertex") { constraint_ = vertex; trkconstrcoll_ = consumes(trkconstrcoll); } + else if (constraint_str == "trackParameters") { constraint_ = trackParameters; trkconstrcoll_ = consumes(trkconstrcoll); } else { edm::LogError("TrackRefitter")<<"constraint: "< theTCollectionWithConstraint; - theEvent.getByLabel(trkconstrcoll_,theTCollectionWithConstraint); + theEvent.getByToken(trkconstrcoll_,theTCollectionWithConstraint); edm::Handle recoBeamSpotHandle; - theEvent.getByLabel(bsSrc_,recoBeamSpotHandle); + theEvent.getByToken(bsSrc_,recoBeamSpotHandle); bs = *recoBeamSpotHandle; if (theTCollectionWithConstraint.failedToGet()){ //edm::LogError("TrackRefitter")<<"could not get TrackMomConstraintAssociationCollection product."; @@ -105,9 +106,9 @@ void TrackRefitter::produce(edm::Event& theEvent, const edm::EventSetup& setup) case vertex : { edm::Handle theTCollectionWithConstraint; - theEvent.getByLabel(trkconstrcoll_,theTCollectionWithConstraint); + theEvent.getByToken(trkconstrcoll_,theTCollectionWithConstraint); edm::Handle recoBeamSpotHandle; - theEvent.getByLabel(bsSrc_,recoBeamSpotHandle); + theEvent.getByToken(bsSrc_,recoBeamSpotHandle); bs = *recoBeamSpotHandle; if (theTCollectionWithConstraint.failedToGet()){ edm::LogError("TrackRefitter")<<"could not get TrackVtxConstraintAssociationCollection product."; break;} @@ -120,9 +121,9 @@ void TrackRefitter::produce(edm::Event& theEvent, const edm::EventSetup& setup) case trackParameters : { edm::Handle theTCollectionWithConstraint; - theEvent.getByLabel(trkconstrcoll_,theTCollectionWithConstraint); + theEvent.getByToken(trkconstrcoll_,theTCollectionWithConstraint); edm::Handle recoBeamSpotHandle; - theEvent.getByLabel(bsSrc_,recoBeamSpotHandle); + theEvent.getByToken(bsSrc_,recoBeamSpotHandle); bs = *recoBeamSpotHandle; if (theTCollectionWithConstraint.failedToGet()){ //edm::LogError("TrackRefitter")<<"could not get TrackParamConstraintAssociationCollection product."; diff --git a/RecoTracker/TrackProducer/plugins/TrackRefitter.h b/RecoTracker/TrackProducer/plugins/TrackRefitter.h index 9e25c5291973e..f4dfc74b72250 100644 --- a/RecoTracker/TrackProducer/plugins/TrackRefitter.h +++ b/RecoTracker/TrackProducer/plugins/TrackRefitter.h @@ -25,7 +25,7 @@ class TrackRefitter : public KfTrackProducerBase, public edm::EDProducer { TrackProducerAlgorithm theAlgo; enum Constraint { none, momentum, vertex, trackParameters }; Constraint constraint_; - edm::InputTag trkconstrcoll_; + edm::EDGetToken trkconstrcoll_; };