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 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 () 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
 

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 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

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.

19  : KfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),
20  iConfig.getParameter<bool>("useHitsSplitting")),
21  theAlgo(iConfig) {
22  setConf(iConfig);
23  setSrc(consumes<TrackCandidateCollection>(iConfig.getParameter<edm::InputTag>("src")),
24  consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpot")),
25  consumes<MeasurementTrackerEvent>(iConfig.getParameter<edm::InputTag>("MeasurementTrackerEvent")));
26  setAlias(iConfig.getParameter<std::string>("@module_label"));
27 
28  if (iConfig.exists("clusterRemovalInfo")) {
29  edm::InputTag tag = iConfig.getParameter<edm::InputTag>("clusterRemovalInfo");
30  if (!(tag == edm::InputTag())) {
32  }
33  }
34 
35  //register your products
36  produces<reco::TrackCollection>().setBranchAlias(alias_ + "Tracks");
37  produces<reco::TrackExtraCollection>().setBranchAlias(alias_ + "TrackExtras");
38  produces<TrackingRecHitCollection>().setBranchAlias(alias_ + "RecHits");
39  produces<std::vector<Trajectory> >();
40  produces<std::vector<int> >();
41  produces<TrajTrackAssociationCollection>();
42 }

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 makeGlobalPositionRcd_cfg::tag.

Member Function Documentation

◆ getTransient()

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

Get Transient Tracks.

Definition at line 115 of file TrackProducer.cc.

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

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

◆ produce()

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

Implementation of produce method.

Implements TrackProducerBase< reco::Track >.

Definition at line 44 of file TrackProducer.cc.

44  {
45  LogDebug("TrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
46  //
47  // create empty output collections
48  //
49  std::unique_ptr<TrackingRecHitCollection> outputRHColl(new TrackingRecHitCollection);
50  std::unique_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection);
51  std::unique_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
52  std::unique_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>);
53  std::unique_ptr<std::vector<int> > outputIndecesInputColl(new std::vector<int>);
54 
55  //
56  //declare and get stuff to be retrieved from ES
57  //
61  edm::ESHandle<Propagator> thePropagator;
64  getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
65 
67  setup.get<TrackerTopologyRcd>().get(httopo);
68 
69  //
70  //declare and get TrackColection to be retrieved from the event
71  //
72  AlgoProductCollection algoResults;
75  getFromEvt(theEvent, theTCCollection, bs);
76  //protect against missing product
77  if (theTCCollection.failedToGet()) {
78  edm::LogError("TrackProducer") << "could not get the TrackCandidateCollection.";
79  } else {
80  LogDebug("TrackProducer") << "run the algorithm"
81  << "\n";
82  try {
84  theMF.product(),
85  *theTCCollection,
86  theFitter.product(),
87  thePropagator.product(),
88  theBuilder.product(),
89  bs,
90  algoResults);
91  } catch (cms::Exception& e) {
92  edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithCandidate."
93  << "\n"
94  << e << "\n";
95  throw;
96  }
97  }
98 
99  //put everything in the event
100  putInEvt(theEvent,
101  thePropagator.product(),
102  theMeasTk.product(),
103  outputRHColl,
104  outputTColl,
105  outputTEColl,
106  outputTrajectoryColl,
107  outputIndecesInputColl,
108  algoResults,
109  theBuilder.product(),
110  httopo.product());
111  LogDebug("TrackProducer") << "end"
112  << "\n";
113 }

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

Member Data Documentation

◆ theAlgo

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

Definition at line 36 of file TrackProducer.h.

Referenced by getTransient(), and produce().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
TrackProducerBase< reco::Track >::getFromES
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.
TrackProducerBase< reco::Track >::getFromEvt
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
KfTrackProducerBase::KfTrackProducerBase
KfTrackProducerBase(bool trajectoryInEvent, bool split)
Constructor.
Definition: KfTrackProducerBase.h:19
TrackProducerBase< reco::Track >::setConf
void setConf(const edm::ParameterSet &conf)
Set parameter set.
Definition: TrackProducerBase.h:71
TrackProducerBase< reco::Track >::AlgoProductCollection
typename Base::AlgoProductCollection AlgoProductCollection
Definition: TrackProducerBase.h:44
Propagator::magneticField
virtual const MagneticField * magneticField() const =0
edm::Handle< TrackCandidateCollection >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
cms::cuda::bs
bs
Definition: HistoContainer.h:76
TrackProducerBase< reco::Track >::setClusterRemovalInfo
void setClusterRemovalInfo(const edm::InputTag &clusterRemovalInfo)
Sets the information on cluster removal, and turns it on.
Definition: TrackProducerBase.h:89
TrackProducerAlgorithm::runWithCandidate
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.
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
reco::BeamSpot
Definition: BeamSpot.h:21
edm::ESHandle< TrackerGeometry >
reco::TrackExtraCollection
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
TrackProducerBase< reco::Track >::setAlias
void setAlias(std::string alias)
set the aliases of produced collections
Definition: TrackProducerBase.h:83
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
edm::HandleBase::failedToGet
bool failedToGet() const
Definition: HandleBase.h:72
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
KfTrackProducerBase::putInEvt
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.
Definition: KfTrackProducerBase.cc:21
TrackProducerBase< reco::Track >::alias_
std::string alias_
Definition: TrackProducerBase.h:107
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackProducerBase< reco::Track >::setSrc
void setSrc(const edm::EDGetToken &src, const edm::EDGetTokenT< reco::BeamSpot > &bsSrc, const edm::EDGetTokenT< MeasurementTrackerEvent > &mteSrc)
set label of source collection
Definition: TrackProducerBase.h:74
TrackProducer::theAlgo
TrackProducerAlgorithm< reco::Track > theAlgo
Definition: TrackProducer.h:36
reco::TransientTrack
Definition: TransientTrack.h:19
edm::EventBase::id
edm::EventID id() const
Definition: EventBase.h:59
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
cms::Exception
Definition: Exception.h:70
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::OwnVector< TrackingRecHit >
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37