CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

std::vector< reco::TransientTrackgetTransient (edm::Event &, const edm::EventSetup &)
 Get Transient Tracks. More...
 
virtual 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::auto_ptr< TrackingRecHitCollection > &, std::auto_ptr< reco::TrackCollection > &, std::auto_ptr< reco::TrackExtraCollection > &, std::auto_ptr< std::vector< Trajectory > > &, AlgoProductCollection &, TransientTrackingRecHitBuilder const *)
 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< TrackCollection > &, 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)
 
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 ()
 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
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

TrackProducerAlgorithm
< reco::Track
theAlgo
 

Additional Inherited Members

- Public Types inherited from TrackProducerBase< reco::Track >
typedef std::pair< Trajectory
*, std::pair< reco::Track
*, PropagationDirection > > 
AlgoProduct
 
typedef std::vector< AlgoProductAlgoProductCollection
 
typedef std::vector< reco::TrackTrackCollection
 
- 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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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::EDGetTokenT
< MeasurementTrackerEvent
mteSrc_
 
bool rekeyClusterRefs_
 
edm::OrphanHandle
< TrackCollection
rTracks_
 
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 15 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.

15  :
16  KfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),
17  iConfig.getParameter<bool>("useHitsSplitting")),
18  theAlgo(iConfig)
19 {
20  setConf(iConfig);
21  setSrc( consumes<TrackCandidateCollection>(iConfig.getParameter<edm::InputTag>( "src" )),
22  consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>( "beamSpot" )),
23  consumes<MeasurementTrackerEvent>(iConfig.getParameter<edm::InputTag>( "MeasurementTrackerEvent") ));
24  setAlias( iConfig.getParameter<std::string>( "@module_label" ) );
25 
26  if ( iConfig.exists("clusterRemovalInfo") ) {
27  edm::InputTag tag = iConfig.getParameter<edm::InputTag>("clusterRemovalInfo");
28  if (!(tag == edm::InputTag())) { setClusterRemovalInfo( tag ); }
29  }
30 
31  //register your products
32  produces<reco::TrackCollection>().setBranchAlias( alias_ + "Tracks" );
33  produces<reco::TrackExtraCollection>().setBranchAlias( alias_ + "TrackExtras" );
34  produces<TrackingRecHitCollection>().setBranchAlias( alias_ + "RecHits" );
35  produces<std::vector<Trajectory> >() ;
36  produces<TrajTrackAssociationCollection>();
37 
38 }
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 87 of file TrackProducer.cc.

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

88 {
89  LogDebug("TrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
90  //
91  // create empty output collections
92  //
93  std::vector<reco::TransientTrack> ttks;
94 
95  //
96  //declare and get stuff to be retrieved from ES
97  //
101  edm::ESHandle<Propagator> thePropagator;
104  getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder);
105 
106  //
107  //declare and get TrackColection to be retrieved from the event
108  //
109  AlgoProductCollection algoResults;
111  reco::BeamSpot bs;
112  getFromEvt(theEvent,theTCCollection,bs);
113  //protect against missing product
114  if (theTCCollection.failedToGet()){
115  edm::LogError("TrackProducer") <<"could not get the TrackCandidateCollection.";}
116  else{
117  LogDebug("TrackProducer") << "run the algorithm" << "\n";
118  try{
119  theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTCCollection,
120  theFitter.product(), thePropagator.product(), theBuilder.product(), bs, algoResults);
121  }
122  catch (cms::Exception &e){ edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithCandidate." << "\n" << e << "\n"; throw; }
123  }
124  ttks.reserve(algoResults.size());
125  for (AlgoProductCollection::iterator prod=algoResults.begin();prod!=algoResults.end(); prod++){
126  ttks.push_back( reco::TransientTrack(*((*prod).second.first),thePropagator.product()->magneticField() ));
127  }
128 
129  LogDebug("TrackProducer") << "end" << "\n";
130 
131  return ttks;
132 }
#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)
std::vector< AlgoProduct > AlgoProductCollection
bool failedToGet() const
Definition: HandleBase.h:80
T const * product() const
Definition: ESHandle.h:86
edm::EventID id() const
Definition: EventBase.h:56
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.
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 edm::stream::EDProducerBase.

Definition at line 41 of file TrackProducer.cc.

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

42 {
43  LogDebug("TrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
44  //
45  // create empty output collections
46  //
47  std::auto_ptr<TrackingRecHitCollection> outputRHColl (new TrackingRecHitCollection);
48  std::auto_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection);
49  std::auto_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
50  std::auto_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>);
51 
52  //
53  //declare and get stuff to be retrieved from ES
54  //
58  edm::ESHandle<Propagator> thePropagator;
61  getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder);
62 
63  //
64  //declare and get TrackColection to be retrieved from the event
65  //
66  AlgoProductCollection algoResults;
68  reco::BeamSpot bs;
69  getFromEvt(theEvent,theTCCollection,bs);
70  //protect against missing product
71  if (theTCCollection.failedToGet()){
72  edm::LogError("TrackProducer") <<"could not get the TrackCandidateCollection.";}
73  else{
74  LogDebug("TrackProducer") << "run the algorithm" << "\n";
75  try{
76  theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTCCollection,
77  theFitter.product(), thePropagator.product(), theBuilder.product(), bs, algoResults);
78  } catch (cms::Exception &e){ edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithCandidate." << "\n" << e << "\n"; throw;}
79  }
80 
81  //put everything in the event
82  putInEvt(theEvent, thePropagator.product(),theMeasTk.product(), outputRHColl, outputTColl, outputTEColl, outputTrajectoryColl, algoResults, theBuilder.product());
83  LogDebug("TrackProducer") << "end" << "\n";
84 }
#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)
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
virtual void putInEvt(edm::Event &, const Propagator *prop, const MeasurementTracker *measTk, std::auto_ptr< TrackingRecHitCollection > &, std::auto_ptr< reco::TrackCollection > &, std::auto_ptr< reco::TrackExtraCollection > &, std::auto_ptr< std::vector< Trajectory > > &, AlgoProductCollection &, TransientTrackingRecHitBuilder const *)
Put produced collections in the event.
std::vector< AlgoProduct > AlgoProductCollection
bool failedToGet() const
Definition: HandleBase.h:80
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
T const * product() const
Definition: ESHandle.h:86
edm::EventID id() const
Definition: EventBase.h:56
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.
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().