CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 > AlgoProductTraits< reco::Track >

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 initTrackProducerBase (const edm::ParameterSet &conf, edm::ConsumesCollector cc, const edm::EDGetToken &src)
 Call this method in inheriting class' constructor. More...
 
void setAlias (std::string alias)
 set the aliases of produced collections More...
 
void setSecondHitPattern (Trajectory *traj, reco::Track &track, const Propagator *prop, const MeasurementTrackerEvent *measTk, const TrackerTopology *ttopo)
 
 TrackProducerBase (bool trajectoryInEvent=false)
 Constructor. More...
 
virtual ~TrackProducerBase () noexcept(false)
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

TrackProducerAlgorithm
< reco::Track
theAlgo
 
edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
theTTopoToken
 

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<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Protected Member Functions inherited from KfTrackProducerBase
void setClusterRemovalInfo (const edm::InputTag &clusterRemovalInfo)
 Sets the information on cluster removal, and turns it on. More...
 
- Protected Attributes inherited from KfTrackProducerBase
edm::InputTag clusterRemovalInfo_
 
bool rekeyClusterRefs_
 
- Protected Attributes inherited from TrackProducerBase< reco::Track >
std::string alias_
 
edm::EDGetTokenT< reco::BeamSpotbsSrc_
 
edm::ESGetToken
< TransientTrackingRecHitBuilder,
TransientRecHitRecord
builderSrc_
 
edm::ParameterSet conf_
 
edm::ESGetToken
< TrajectoryFitter,
TrajectoryFitter::Record
fitterSrc_
 
edm::ESGetToken
< MeasurementTracker,
CkfComponentsRecord
measTkSrc_
 
edm::ESGetToken< MagneticField,
IdealMagneticFieldRecord
mfSrc_
 
edm::EDGetTokenT
< MeasurementTrackerEvent
mteSrc_
 
edm::ESGetToken< Propagator,
TrackingComponentsRecord
propagatorSrc_
 
edm::OrphanHandle
< TrackCollection
rTracks_
 
edm::ESGetToken
< NavigationSchool,
NavigationSchoolRecord
schoolSrc_
 
edm::EDGetToken src_
 
edm::ESHandle< NavigationSchooltheSchool
 
edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
trackGeomSrc_
 
bool trajectoryInEvent_
 
bool useSchool_
 

Detailed Description

Produce Tracks from TrackCandidates

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 >::initTrackProducerBase(), TrackProducerBase< reco::Track >::setAlias(), KfTrackProducerBase::setClusterRemovalInfo(), AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.

19  : KfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),
20  iConfig.getParameter<bool>("useHitsSplitting")),
21  theAlgo(iConfig),
24  iConfig, consumesCollector(), consumes<TrackCandidateCollection>(iConfig.getParameter<edm::InputTag>("src")));
25  setAlias(iConfig.getParameter<std::string>("@module_label"));
26 
27  if (iConfig.exists("clusterRemovalInfo")) {
28  edm::InputTag tag = iConfig.getParameter<edm::InputTag>("clusterRemovalInfo");
29  if (!(tag == edm::InputTag())) {
31  }
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 }
TrackProducerAlgorithm< reco::Track > theAlgo
Definition: TrackProducer.h:36
bool exists(std::string const &parameterName) const
checks if a parameter exists
void initTrackProducerBase(const edm::ParameterSet &conf, edm::ConsumesCollector cc, const edm::EDGetToken &src)
Call this method in inheriting class&#39; constructor.
void setAlias(std::string alias)
set the aliases of produced collections
void setClusterRemovalInfo(const edm::InputTag &clusterRemovalInfo)
Sets the information on cluster removal, and turns it on.
KfTrackProducerBase(bool trajectoryInEvent, bool split)
Constructor.
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTTopoToken
Definition: TrackProducer.h:37
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283

Member Function Documentation

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

Get Transient Tracks.

Definition at line 113 of file TrackProducer.cc.

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

113  {
114  LogDebug("TrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
115  //
116  // create empty output collections
117  //
118  std::vector<reco::TransientTrack> ttks;
119 
120  //
121  //declare and get stuff to be retrieved from ES
122  //
126  edm::ESHandle<Propagator> thePropagator;
129  getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
130 
131  //
132  //declare and get TrackColection to be retrieved from the event
133  //
134  AlgoProductCollection algoResults;
137  getFromEvt(theEvent, theTCCollection, bs);
138  //protect against missing product
139  if (theTCCollection.failedToGet()) {
140  edm::LogError("TrackProducer") << "could not get the TrackCandidateCollection.";
141  } else {
142  LogDebug("TrackProducer") << "run the algorithm"
143  << "\n";
144  try {
146  theMF.product(),
147  *theTCCollection,
148  theFitter.product(),
149  thePropagator.product(),
150  theBuilder.product(),
151  bs,
152  algoResults);
153  } catch (cms::Exception& e) {
154  edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithCandidate."
155  << "\n"
156  << e << "\n";
157  throw;
158  }
159  }
160  ttks.reserve(algoResults.size());
161  for (auto& prod : algoResults) {
162  ttks.push_back(reco::TransientTrack(*(prod.track), thePropagator.product()->magneticField()));
163  }
164 
165  LogDebug("TrackProducer") << "end"
166  << "\n";
167 
168  return ttks;
169 }
TrackProducerAlgorithm< reco::Track > theAlgo
Definition: TrackProducer.h:36
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
typename Base::AlgoProductCollection AlgoProductCollection
Log< level::Error, false > LogError
bool failedToGet() const
Definition: HandleBase.h:72
T const * product() const
Definition: ESHandle.h:86
edm::EventID id() const
Definition: EventBase.h:59
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.
#define LogDebug(id)
void TrackProducer::produce ( edm::Event theEvent,
const edm::EventSetup setup 
)
overridevirtual

Implementation of produce method.

Implements TrackProducerBase< reco::Track >.

Definition at line 43 of file TrackProducer.cc.

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

43  {
44  LogDebug("TrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
45  //
46  // create empty output collections
47  //
48  std::unique_ptr<TrackingRecHitCollection> outputRHColl(new TrackingRecHitCollection);
49  std::unique_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection);
50  std::unique_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
51  std::unique_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>);
52  std::unique_ptr<std::vector<int> > outputIndecesInputColl(new std::vector<int>);
53 
54  //
55  //declare and get stuff to be retrieved from ES
56  //
60  edm::ESHandle<Propagator> thePropagator;
63  getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
64 
65  TrackerTopology const& ttopo = setup.getData(theTTopoToken);
66 
67  //
68  //declare and get TrackColection to be retrieved from the event
69  //
70  AlgoProductCollection algoResults;
73  getFromEvt(theEvent, theTCCollection, bs);
74  //protect against missing product
75  if (theTCCollection.failedToGet()) {
76  edm::LogError("TrackProducer") << "could not get the TrackCandidateCollection.";
77  } else {
78  LogDebug("TrackProducer") << "run the algorithm"
79  << "\n";
80  try {
82  theMF.product(),
83  *theTCCollection,
84  theFitter.product(),
85  thePropagator.product(),
86  theBuilder.product(),
87  bs,
88  algoResults);
89  } catch (cms::Exception& e) {
90  edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithCandidate."
91  << "\n"
92  << e << "\n";
93  throw;
94  }
95  }
96 
97  //put everything in the event
98  putInEvt(theEvent,
99  thePropagator.product(),
100  theMeasTk.product(),
101  outputRHColl,
102  outputTColl,
103  outputTEColl,
104  outputTrajectoryColl,
105  outputIndecesInputColl,
106  algoResults,
107  theBuilder.product(),
108  &ttopo);
109  LogDebug("TrackProducer") << "end"
110  << "\n";
111 }
TrackProducerAlgorithm< reco::Track > theAlgo
Definition: TrackProducer.h:36
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
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.
typename Base::AlgoProductCollection AlgoProductCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
Log< level::Error, false > LogError
bool getData(T &iHolder) const
Definition: EventSetup.h:128
bool failedToGet() const
Definition: HandleBase.h:72
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
T const * product() const
Definition: ESHandle.h:86
edm::EventID id() const
Definition: EventBase.h:59
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTTopoToken
Definition: TrackProducer.h:37
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.
#define LogDebug(id)

Member Data Documentation

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

Definition at line 36 of file TrackProducer.h.

Referenced by getTransient(), and produce().

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> TrackProducer::theTTopoToken
private

Definition at line 37 of file TrackProducer.h.

Referenced by produce().