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::EDProducer TrackProducerBase< reco::Track > edm::ProducerBase 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 &)
 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 &)
 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 (edm::ParameterSet conf)
 Set parameter set. More...
 
void setSecondHitPattern (Trajectory *traj, reco::Track &track, const Propagator *prop, const MeasurementTracker *measTk)
 
void setSrc (edm::InputTag src, edm::InputTag bsSrc)
 set label of source collection More...
 
 TrackProducerBase (bool trajectoryInEvent=false)
 Constructor. More...
 
virtual ~TrackProducerBase ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 
- Protected Attributes inherited from TrackProducerBase< reco::Track >
std::string alias_
 
edm::InputTag bsSrc_
 
edm::InputTag clusterRemovalInfo_
 
bool rekeyClusterRefs_
 
edm::OrphanHandle
< TrackCollection
rTracks_
 
edm::ESHandle< NavigationSchooltheSchool
 
bool trajectoryInEvent_
 

Detailed Description

Produce Tracks from TrackCandidates

Date:
2007/10/06 08:04:12
Revision:
1.1
Author
cerati

Definition at line 17 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(), 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( iConfig.getParameter<edm::InputTag>( "src" ), iConfig.getParameter<edm::InputTag>( "beamSpot" ));
22  setAlias( iConfig.getParameter<std::string>( "@module_label" ) );
23 
24  if ( iConfig.exists("clusterRemovalInfo") ) {
25  edm::InputTag tag = iConfig.getParameter<edm::InputTag>("clusterRemovalInfo");
26  if (!(tag == edm::InputTag())) { setClusterRemovalInfo( tag ); }
27  }
28 
29  //register your products
30  produces<reco::TrackCollection>().setBranchAlias( alias_ + "Tracks" );
31  produces<reco::TrackExtraCollection>().setBranchAlias( alias_ + "TrackExtras" );
32  produces<TrackingRecHitCollection>().setBranchAlias( alias_ + "RecHits" );
33  produces<std::vector<Trajectory> >() ;
34  produces<TrajTrackAssociationCollection>();
35 
36 }
TrackProducerAlgorithm< reco::Track > theAlgo
Definition: TrackProducer.h:38
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(edm::ParameterSet conf)
Set parameter set.
void setSrc(edm::InputTag src, edm::InputTag bsSrc)
set label of source collection
KfTrackProducerBase(bool trajectoryInEvent, bool split)
Constructor.

Member Function Documentation

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

Get Transient Tracks.

Definition at line 85 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.

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

Implementation of produce method.

Implements edm::EDProducer.

Definition at line 39 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.

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

Referenced by getTransient(), and produce().