CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TrackProducer Class Reference

#include <TrackProducer.h>

Inheritance diagram for TrackProducer:
KfTrackProducerBase edm::stream::EDProducer<> TrackProducerBase< reco::Track > edm::stream::EDProducerBase AlgoProductTraits< reco::Track > edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

std::vector< reco::TransientTrackgetTransient (edm::Event &, const edm::EventSetup &)
 Get Transient Tracks. More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 Implementation of produce method. More...
 
 TrackProducer (const edm::ParameterSet &iConfig)
 Constructor. More...
 
- Public Member Functions inherited from KfTrackProducerBase
 KfTrackProducerBase (bool trajectoryInEvent, bool split)
 Constructor. More...
 
virtual void putInEvt (edm::Event &, const Propagator *prop, const MeasurementTracker *measTk, std::unique_ptr< TrackingRecHitCollection > &, std::unique_ptr< reco::TrackCollection > &, std::unique_ptr< reco::TrackExtraCollection > &, std::unique_ptr< std::vector< Trajectory > > &, std::unique_ptr< std::vector< int > > &, AlgoProductCollection &, TransientTrackingRecHitBuilder const *, const TrackerTopology *ttopo, int BeforeOrAfter=0)
 Put produced collections in the event. More...
 
- Public Member Functions inherited from TrackProducerBase< reco::Track >
const edm::ParameterSetgetConf () const
 
virtual void getFromES (const edm::EventSetup &, edm::ESHandle< TrackerGeometry > &, edm::ESHandle< MagneticField > &, edm::ESHandle< TrajectoryFitter > &, edm::ESHandle< Propagator > &, edm::ESHandle< MeasurementTracker > &, edm::ESHandle< TransientTrackingRecHitBuilder > &)
 Get needed services from the Event Setup. More...
 
virtual void getFromEvt (edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
 Get TrackCandidateCollection from the Event (needed by TrackProducer) More...
 
virtual void getFromEvt (edm::Event &, edm::Handle< TrackView > &, reco::BeamSpot &)
 Get TrackCollection from the Event (needed by TrackRefitter) More...
 
void setAlias (std::string alias)
 set the aliases of produced collections More...
 
void setClusterRemovalInfo (const edm::InputTag &clusterRemovalInfo)
 Sets the information on cluster removal, and turns it on. More...
 
void setConf (const edm::ParameterSet &conf)
 Set parameter set. More...
 
void setSecondHitPattern (Trajectory *traj, reco::Track &track, const Propagator *prop, const MeasurementTrackerEvent *measTk, const TrackerTopology *ttopo)
 
void setSrc (const edm::EDGetToken &src, const edm::EDGetTokenT< reco::BeamSpot > &bsSrc, const edm::EDGetTokenT< MeasurementTrackerEvent > &mteSrc)
 set label of source collection More...
 
 TrackProducerBase (bool trajectoryInEvent=false)
 Constructor. More...
 
virtual ~TrackProducerBase ()(false)
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

TrackProducerAlgorithm< reco::TracktheAlgo
 

Additional Inherited Members

- Public Types inherited from TrackProducerBase< reco::Track >
using AlgoProductCollection = typename Base::AlgoProductCollection
 
using Base = AlgoProductTraits< reco::Track >
 
using TrackCollection = typename Base::TrackCollection
 
using TrackView = typename Base::TrackView
 
- Public Types inherited from AlgoProductTraits< reco::Track >
using AlgoProductCollection = std::vector< AlgoProduct >
 
using TrackCollection = std::vector< reco::Track >
 
using TrackView = edm::View< reco::Track >
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Attributes inherited from TrackProducerBase< reco::Track >
std::string alias_
 
edm::EDGetTokenT< reco::BeamSpotbsSrc_
 
edm::InputTag clusterRemovalInfo_
 
edm::ParameterSet conf_
 
edm::EDGetTokenT< MeasurementTrackerEventmteSrc_
 
bool rekeyClusterRefs_
 
edm::OrphanHandle< TrackCollectionrTracks_
 
edm::EDGetToken src_
 
edm::ESHandle< NavigationSchooltheSchool
 
bool trajectoryInEvent_
 

Detailed Description

Produce Tracks from TrackCandidates

Author
cerati

Definition at line 16 of file TrackProducer.h.

Constructor & Destructor Documentation

TrackProducer::TrackProducer ( const edm::ParameterSet iConfig)
explicit

Constructor.

Definition at line 18 of file TrackProducer.cc.

References TrackProducerBase< reco::Track >::alias_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), TrackProducerBase< reco::Track >::setAlias(), TrackProducerBase< reco::Track >::setClusterRemovalInfo(), TrackProducerBase< reco::Track >::setConf(), TrackProducerBase< reco::Track >::setSrc(), AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.

18  :
19  KfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),
20  iConfig.getParameter<bool>("useHitsSplitting")),
21  theAlgo(iConfig)
22 {
23  setConf(iConfig);
24  setSrc( consumes<TrackCandidateCollection>(iConfig.getParameter<edm::InputTag>( "src" )),
25  consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>( "beamSpot" )),
26  consumes<MeasurementTrackerEvent>(iConfig.getParameter<edm::InputTag>( "MeasurementTrackerEvent") ));
27  setAlias( iConfig.getParameter<std::string>( "@module_label" ) );
28 
29  if ( iConfig.exists("clusterRemovalInfo") ) {
30  edm::InputTag tag = iConfig.getParameter<edm::InputTag>("clusterRemovalInfo");
31  if (!(tag == edm::InputTag())) { setClusterRemovalInfo( tag ); }
32  }
33 
34  //register your products
35  produces<reco::TrackCollection>().setBranchAlias( alias_ + "Tracks" );
36  produces<reco::TrackExtraCollection>().setBranchAlias( alias_ + "TrackExtras" );
37  produces<TrackingRecHitCollection>().setBranchAlias( alias_ + "RecHits" );
38  produces<std::vector<Trajectory> >() ;
39  produces<std::vector<int> >() ;
40  produces<TrajTrackAssociationCollection>();
41 
42 }
TrackProducerAlgorithm< reco::Track > theAlgo
Definition: TrackProducer.h:37
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
void setClusterRemovalInfo(const edm::InputTag &clusterRemovalInfo)
Sets the information on cluster removal, and turns it on.
void setAlias(std::string alias)
set the aliases of produced collections
void setConf(const edm::ParameterSet &conf)
Set parameter set.
KfTrackProducerBase(bool trajectoryInEvent, bool split)
Constructor.
void setSrc(const edm::EDGetToken &src, const edm::EDGetTokenT< reco::BeamSpot > &bsSrc, const edm::EDGetTokenT< MeasurementTrackerEvent > &mteSrc)
set label of source collection

Member Function Documentation

std::vector< reco::TransientTrack > TrackProducer::getTransient ( edm::Event theEvent,
const edm::EventSetup setup 
)

Get Transient Tracks.

Definition at line 96 of file TrackProducer.cc.

References MillePedeFileConverter_cfg::e, edm::HandleBase::failedToGet(), TrackProducerBase< reco::Track >::getFromES(), TrackProducerBase< reco::Track >::getFromEvt(), edm::EventBase::id(), LogDebug, Propagator::magneticField(), parseEventContent::prod, edm::ESHandle< T >::product(), TrackProducerAlgorithm< T >::runWithCandidate(), and theAlgo.

97 {
98  LogDebug("TrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
99  //
100  // create empty output collections
101  //
102  std::vector<reco::TransientTrack> ttks;
103 
104  //
105  //declare and get stuff to be retrieved from ES
106  //
110  edm::ESHandle<Propagator> thePropagator;
113  getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder);
114 
115  //
116  //declare and get TrackColection to be retrieved from the event
117  //
118  AlgoProductCollection algoResults;
120  reco::BeamSpot bs;
121  getFromEvt(theEvent,theTCCollection,bs);
122  //protect against missing product
123  if (theTCCollection.failedToGet()){
124  edm::LogError("TrackProducer") <<"could not get the TrackCandidateCollection.";}
125  else{
126  LogDebug("TrackProducer") << "run the algorithm" << "\n";
127  try{
128  theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTCCollection,
129  theFitter.product(), thePropagator.product(), theBuilder.product(), bs, algoResults);
130  }
131  catch (cms::Exception &e){ edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithCandidate." << "\n" << e << "\n"; throw; }
132  }
133  ttks.reserve(algoResults.size());
134  for (auto & prod : algoResults){
135  ttks.push_back( reco::TransientTrack(*(prod.track),thePropagator.product()->magneticField() ));
136  }
137 
138  LogDebug("TrackProducer") << "end" << "\n";
139 
140  return ttks;
141 }
#define LogDebug(id)
TrackProducerAlgorithm< reco::Track > theAlgo
Definition: TrackProducer.h:37
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
typename Base::AlgoProductCollection AlgoProductCollection
virtual const MagneticField * magneticField() const =0
bool failedToGet() const
Definition: HandleBase.h:78
edm::EventID id() const
Definition: EventBase.h:60
void runWithCandidate(const TrackingGeometry *, const MagneticField *, const TrackCandidateCollection &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
Run the Final Fit taking TrackCandidates as input.
T const * product() const
Definition: ESHandle.h:86
virtual void getFromES(const edm::EventSetup &, edm::ESHandle< TrackerGeometry > &, edm::ESHandle< MagneticField > &, edm::ESHandle< TrajectoryFitter > &, edm::ESHandle< Propagator > &, edm::ESHandle< MeasurementTracker > &, edm::ESHandle< TransientTrackingRecHitBuilder > &)
Get needed services from the Event Setup.
void TrackProducer::produce ( edm::Event theEvent,
const edm::EventSetup setup 
)
overridevirtual

Implementation of produce method.

Implements TrackProducerBase< reco::Track >.

Definition at line 45 of file TrackProducer.cc.

References MillePedeFileConverter_cfg::e, edm::HandleBase::failedToGet(), edm::EventSetup::get(), TrackProducerBase< reco::Track >::getFromES(), TrackProducerBase< reco::Track >::getFromEvt(), edm::EventBase::id(), LogDebug, edm::ESHandle< T >::product(), KfTrackProducerBase::putInEvt(), TrackProducerAlgorithm< T >::runWithCandidate(), and theAlgo.

46 {
47  LogDebug("TrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
48  //
49  // create empty output collections
50  //
51  std::unique_ptr<TrackingRecHitCollection> outputRHColl (new TrackingRecHitCollection);
52  std::unique_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection);
53  std::unique_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
54  std::unique_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>);
55  std::unique_ptr<std::vector<int> > outputIndecesInputColl(new std::vector<int>);
56 
57 
58  //
59  //declare and get stuff to be retrieved from ES
60  //
64  edm::ESHandle<Propagator> thePropagator;
67  getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder);
68 
70  setup.get<TrackerTopologyRcd>().get(httopo);
71 
72  //
73  //declare and get TrackColection to be retrieved from the event
74  //
75  AlgoProductCollection algoResults;
77  reco::BeamSpot bs;
78  getFromEvt(theEvent,theTCCollection,bs);
79  //protect against missing product
80  if (theTCCollection.failedToGet()){
81  edm::LogError("TrackProducer") <<"could not get the TrackCandidateCollection.";}
82  else{
83  LogDebug("TrackProducer") << "run the algorithm" << "\n";
84  try{
85  theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTCCollection,
86  theFitter.product(), thePropagator.product(), theBuilder.product(), bs, algoResults);
87  } catch (cms::Exception &e){ edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithCandidate." << "\n" << e << "\n"; throw;}
88  }
89 
90  //put everything in the event
91  putInEvt(theEvent, thePropagator.product(),theMeasTk.product(), outputRHColl, outputTColl, outputTEColl, outputTrajectoryColl, outputIndecesInputColl, algoResults, theBuilder.product(), httopo.product());
92  LogDebug("TrackProducer") << "end" << "\n";
93 }
#define LogDebug(id)
TrackProducerAlgorithm< reco::Track > theAlgo
Definition: TrackProducer.h:37
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
typename Base::AlgoProductCollection AlgoProductCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
virtual void putInEvt(edm::Event &, const Propagator *prop, const MeasurementTracker *measTk, std::unique_ptr< TrackingRecHitCollection > &, std::unique_ptr< reco::TrackCollection > &, std::unique_ptr< reco::TrackExtraCollection > &, std::unique_ptr< std::vector< Trajectory > > &, std::unique_ptr< std::vector< int > > &, AlgoProductCollection &, TransientTrackingRecHitBuilder const *, const TrackerTopology *ttopo, int BeforeOrAfter=0)
Put produced collections in the event.
bool failedToGet() const
Definition: HandleBase.h:78
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
const T & get() const
Definition: EventSetup.h:55
edm::EventID id() const
Definition: EventBase.h:60
void runWithCandidate(const TrackingGeometry *, const MagneticField *, const TrackCandidateCollection &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
Run the Final Fit taking TrackCandidates as input.
T const * product() const
Definition: ESHandle.h:86
virtual void getFromES(const edm::EventSetup &, edm::ESHandle< TrackerGeometry > &, edm::ESHandle< MagneticField > &, edm::ESHandle< TrajectoryFitter > &, edm::ESHandle< Propagator > &, edm::ESHandle< MeasurementTracker > &, edm::ESHandle< TransientTrackingRecHitBuilder > &)
Get needed services from the Event Setup.

Member Data Documentation

TrackProducerAlgorithm<reco::Track> TrackProducer::theAlgo
private

Definition at line 37 of file TrackProducer.h.

Referenced by getTransient(), and produce().