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 > 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::TracktheAlgo
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtheTTopoToken
 

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, TransientRecHitRecordbuilderSrc_
 
edm::ParameterSet conf_
 
edm::ESGetToken< TrajectoryFitter, TrajectoryFitter::RecordfitterSrc_
 
edm::ESGetToken< MeasurementTracker, CkfComponentsRecordmeasTkSrc_
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmfSrc_
 
edm::EDGetTokenT< MeasurementTrackerEventmteSrc_
 
edm::ESGetToken< Propagator, TrackingComponentsRecordpropagatorSrc_
 
edm::OrphanHandle< TrackCollectionrTracks_
 
edm::ESGetToken< NavigationSchool, NavigationSchoolRecordschoolSrc_
 
edm::EDGetToken src_
 
edm::ESHandle< NavigationSchooltheSchool
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackGeomSrc_
 
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::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 makeGlobalPositionRcd_cfg::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::TrackExtraCollection>().setBranchAlias(alias_ + "TrackExtras");
36  produces<TrackingRecHitCollection>().setBranchAlias(alias_ + "RecHits");
37  // TrackCollection refers to TrackingRechit and TrackExtra
38  // collections, need to declare its production after them to work
39  // around a rare race condition in framework scheduling
40  produces<reco::TrackCollection>().setBranchAlias(alias_ + "Tracks");
41  produces<std::vector<Trajectory> >();
42  produces<std::vector<int> >();
43  produces<TrajTrackAssociationCollection>();
44 }
TrackProducerAlgorithm< reco::Track > theAlgo
Definition: TrackProducer.h:36
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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.
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTTopoToken
Definition: TrackProducer.h:37

Member Function Documentation

◆ getTransient()

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

Get Transient Tracks.

Definition at line 116 of file TrackProducer.cc.

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

116  {
117  LogDebug("TrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
118  //
119  // create empty output collections
120  //
121  std::vector<reco::TransientTrack> ttks;
122 
123  //
124  //declare and get stuff to be retrieved from ES
125  //
129  edm::ESHandle<Propagator> thePropagator;
132  getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
133 
134  //
135  //declare and get TrackColection to be retrieved from the event
136  //
137  AlgoProductCollection algoResults;
140  getFromEvt(theEvent, theTCCollection, bs);
141  //protect against missing product
142  if (theTCCollection.failedToGet()) {
143  edm::LogError("TrackProducer") << "could not get the TrackCandidateCollection.";
144  } else {
145  LogDebug("TrackProducer") << "run the algorithm"
146  << "\n";
147  try {
149  theMF.product(),
150  *theTCCollection,
151  theFitter.product(),
152  thePropagator.product(),
153  theBuilder.product(),
154  bs,
155  algoResults);
156  } catch (cms::Exception& e) {
157  edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithCandidate."
158  << "\n"
159  << e << "\n";
160  throw;
161  }
162  }
163  ttks.reserve(algoResults.size());
164  for (auto& prod : algoResults) {
165  ttks.push_back(reco::TransientTrack(*(prod.track), thePropagator.product()->magneticField()));
166  }
167 
168  LogDebug("TrackProducer") << "end"
169  << "\n";
170 
171  return ttks;
172 }
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:63
virtual const MagneticField * magneticField() const =0
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)

◆ produce()

void TrackProducer::produce ( edm::Event theEvent,
const edm::EventSetup setup 
)
overridevirtual

Implementation of produce method.

Implements TrackProducerBase< reco::Track >.

Definition at line 46 of file TrackProducer.cc.

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

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  //declare and get stuff to be retrieved from ES
59  //
63  edm::ESHandle<Propagator> thePropagator;
66  getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
67 
68  TrackerTopology const& ttopo = setup.getData(theTTopoToken);
69 
70  //
71  //declare and get TrackColection to be retrieved from the event
72  //
73  AlgoProductCollection algoResults;
76  getFromEvt(theEvent, theTCCollection, bs);
77  //protect against missing product
78  if (theTCCollection.failedToGet()) {
79  edm::LogError("TrackProducer") << "could not get the TrackCandidateCollection.";
80  } else {
81  LogDebug("TrackProducer") << "run the algorithm"
82  << "\n";
83  try {
85  theMF.product(),
86  *theTCCollection,
87  theFitter.product(),
88  thePropagator.product(),
89  theBuilder.product(),
90  bs,
91  algoResults);
92  } catch (cms::Exception& e) {
93  edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithCandidate."
94  << "\n"
95  << e << "\n";
96  throw;
97  }
98  }
99 
100  //put everything in the event
101  putInEvt(theEvent,
102  thePropagator.product(),
103  theMeasTk.product(),
104  outputRHColl,
105  outputTColl,
106  outputTEColl,
107  outputTrajectoryColl,
108  outputIndecesInputColl,
109  algoResults,
110  theBuilder.product(),
111  &ttopo);
112  LogDebug("TrackProducer") << "end"
113  << "\n";
114 }
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 failedToGet() const
Definition: HandleBase.h:72
T const * product() const
Definition: ESHandle.h:86
edm::EventID id() const
Definition: EventBase.h:63
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
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

◆ theAlgo

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

Definition at line 36 of file TrackProducer.h.

Referenced by getTransient(), and produce().

◆ theTTopoToken

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

Definition at line 37 of file TrackProducer.h.

Referenced by produce().