CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
DAFTrackProducer Class Reference

#include <DAFTrackProducer.h>

Inheritance diagram for DAFTrackProducer:
KfTrackProducerBase edm::stream::EDProducer<> TrackProducerBase< reco::Track > AlgoProductTraits< reco::Track >

Public Types

typedef std::vector< TrajectoryTrajectoryCollection
 
- 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
 

Public Member Functions

 DAFTrackProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &, const edm::EventSetup &) override
 Method where the procduction take place. To be implemented in concrete classes. 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 Member Functions

void getFromEvt (edm::Event &, edm::Handle< TrajTrackAssociationCollection > &, reco::BeamSpot &)
 
void putInEvtTrajAnn (edm::Event &theEvent, TrajAnnealingCollection &trajannResults, std::unique_ptr< TrajAnnealingCollection > &selTrajAnn)
 

Private Attributes

edm::ESGetToken< MultiRecHitCollector, MultiRecHitRecordmeasurementCollectorToken_
 
edm::EDGetTokenT< TrajTrackAssociationCollectionsrcTT_
 
DAFTrackProducerAlgorithm theAlgo
 
bool TrajAnnSaving_
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdttopoToken_
 
edm::ESGetToken< SiTrackerMultiRecHitUpdator, MultiRecHitRecordupdatorToken_
 

Additional Inherited Members

- 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

EDProducer for DAFTrackProducerAlgorithm.

Author
tropiano, genta in May 2014 by brondolin

Definition at line 19 of file DAFTrackProducer.h.

Member Typedef Documentation

◆ TrajectoryCollection

Definition at line 21 of file DAFTrackProducer.h.

Constructor & Destructor Documentation

◆ DAFTrackProducer()

DAFTrackProducer::DAFTrackProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 20 of file DAFTrackProducer.cc.

References TrackProducerBase< reco::Track >::alias_, deDxTools::esConsumes(), TrackProducerBase< reco::Track >::getConf(), edm::ParameterSet::getParameter(), TrackProducerBase< reco::Track >::initTrackProducerBase(), measurementCollectorToken_, TrackProducerBase< reco::Track >::setAlias(), srcTT_, AlCaHLTBitMon_QueryRunRegistry::string, TrajAnnSaving_, ttopoToken_, and updatorToken_.

21  : KfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"), false), theAlgo(iConfig) {
23  iConfig, consumesCollector(), consumes<TrackCandidateCollection>(iConfig.getParameter<edm::InputTag>("src")));
24  srcTT_ = consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("src"));
25  setAlias(iConfig.getParameter<std::string>("@module_label"));
26 
27  //register your products
28  produces<reco::TrackCollection>().setBranchAlias(alias_ + "Tracks");
29  produces<reco::TrackExtraCollection>().setBranchAlias(alias_ + "TrackExtras");
30  produces<TrackingRecHitCollection>().setBranchAlias(alias_ + "RecHits");
31  produces<std::vector<Trajectory> >();
32  produces<TrajTrackAssociationCollection>();
33  produces<TrajAnnealingCollection>().setBranchAlias(alias_ + "TrajectoryAnnealing");
34  produces<reco::TrackCollection>("beforeDAF").setBranchAlias(alias_ + "TracksBeforeDAF");
35  produces<reco::TrackExtraCollection>("beforeDAF").setBranchAlias(alias_ + "TrackExtrasBeforeDAF");
36  produces<reco::TrackCollection>("afterDAF").setBranchAlias(alias_ + "TracksAfterDAF");
37  produces<reco::TrackExtraCollection>("afterDAF").setBranchAlias(alias_ + "TrackExtrasAfterDAF");
38 
39  TrajAnnSaving_ = iConfig.getParameter<bool>("TrajAnnealingSaving");
41  std::string measurementCollectorName = getConf().getParameter<std::string>("MeasurementCollector");
42  measurementCollectorToken_ = esConsumes(edm::ESInputTag("", measurementCollectorName));
43  std::string updatorName = getConf().getParameter<std::string>("UpdatorName");
44  updatorToken_ = esConsumes(edm::ESInputTag("", updatorName));
45 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ParameterSet & getConf() const
edm::ESGetToken< SiTrackerMultiRecHitUpdator, MultiRecHitRecord > updatorToken_
void initTrackProducerBase(const edm::ParameterSet &conf, edm::ConsumesCollector cc, const edm::EDGetToken &src)
Call this method in inheriting class&#39; constructor.
DAFTrackProducerAlgorithm theAlgo
void setAlias(std::string alias)
set the aliases of produced collections
edm::ESGetToken< MultiRecHitCollector, MultiRecHitRecord > measurementCollectorToken_
edm::EDGetTokenT< TrajTrackAssociationCollection > srcTT_
KfTrackProducerBase(bool trajectoryInEvent, bool split)
Constructor.
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_

Member Function Documentation

◆ getFromEvt()

void DAFTrackProducer::getFromEvt ( edm::Event theEvent,
edm::Handle< TrajTrackAssociationCollection > &  trajTrackAssociationHandle,
reco::BeamSpot bs 
)
private

Definition at line 171 of file DAFTrackProducer.cc.

References cms::cuda::bs, TrackProducerBase< reco::Track >::bsSrc_, edm::Event::getByToken(), and srcTT_.

Referenced by produce().

173  {
174  //get the TrajTrackMap from the event
175  //WARNING: src has always to be redefined in cfg file
176  theEvent.getByToken(srcTT_, trajTrackAssociationHandle);
177 
178  //get the BeamSpot
179  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
180  theEvent.getByToken(bsSrc_, recoBeamSpotHandle);
181  bs = *recoBeamSpotHandle;
182 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:540
edm::EDGetTokenT< TrajTrackAssociationCollection > srcTT_
edm::EDGetTokenT< reco::BeamSpot > bsSrc_

◆ produce()

void DAFTrackProducer::produce ( edm::Event ,
const edm::EventSetup  
)
overridevirtual

Method where the procduction take place. To be implemented in concrete classes.

Implements TrackProducerBase< reco::Track >.

Definition at line 47 of file DAFTrackProducer.cc.

References cms::cuda::bs, MillePedeFileConverter_cfg::e, edm::Event::getByToken(), TrackProducerBase< reco::Track >::getFromES(), getFromEvt(), edm::EventBase::id(), LogDebug, measurementCollectorToken_, TrackProducerBase< reco::Track >::mteSrc_, edm::ESHandle< T >::product(), KfTrackProducerBase::putInEvt(), putInEvtTrajAnn(), DAFTrackProducerAlgorithm::runWithCandidate(), singleTopDQM_cfi::setup, theAlgo, TrajAnnSaving_, ttopoToken_, and updatorToken_.

47  {
48  edm::LogInfo("DAFTrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
49 
50  //empty output collections
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<TrajAnnealingCollection> outputTrajAnnColl(new TrajAnnealingCollection);
56  std::unique_ptr<std::vector<int> > outputIndecesInputColl(new std::vector<int>);
57 
58  //new tracks collections (changes before and after DAF)
59  std::unique_ptr<TrackingRecHitCollection> outputRHCollBeforeDAF(new TrackingRecHitCollection);
60  std::unique_ptr<reco::TrackCollection> outputTCollBeforeDAF(new reco::TrackCollection);
61  std::unique_ptr<reco::TrackExtraCollection> outputTECollBeforeDAF(new reco::TrackExtraCollection);
62  std::unique_ptr<std::vector<Trajectory> > outputTrajectoryCollBeforeDAF(new std::vector<Trajectory>);
63  std::unique_ptr<std::vector<int> > outputIndecesInputCollBeforeDAF(new std::vector<int>);
64  //----
65  std::unique_ptr<TrackingRecHitCollection> outputRHCollAfterDAF(new TrackingRecHitCollection);
66  std::unique_ptr<reco::TrackCollection> outputTCollAfterDAF(new reco::TrackCollection);
67  std::unique_ptr<reco::TrackExtraCollection> outputTECollAfterDAF(new reco::TrackExtraCollection);
68  std::unique_ptr<std::vector<Trajectory> > outputTrajectoryCollAfterDAF(new std::vector<Trajectory>);
69  std::unique_ptr<std::vector<int> > outputIndecesInputCollAfterDAF(new std::vector<int>);
70 
71  //declare and get stuff to be retrieved from ES
75  edm::ESHandle<Propagator> thePropagator;
78  getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
79 
81 
82  //get additional es_modules needed by the DAF
83  edm::ESHandle<MultiRecHitCollector> measurementCollectorHandle = setup.getHandle(measurementCollectorToken_);
85 
86  //get MeasurementTrackerEvent
88  theEvent.getByToken(mteSrc_, mte);
89 
90  //declare and get TrackCollection
91  AlgoProductCollection algoResults;
93  TrajAnnealingCollection trajannResults;
94 
95  //declare and get new tracks collections
96  AlgoProductCollection algoResultsBeforeDAF;
97  AlgoProductCollection algoResultsAfterDAF;
98  try {
99  edm::Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
100  getFromEvt(theEvent, trajTrackAssociationHandle, bs);
101 
102  //run the algorithm
103  LogDebug("DAFTrackProducer") << "run the DAF algorithm"
104  << "\n";
106  theMF.product(),
107  *trajTrackAssociationHandle,
108  &*mte,
109  theFitter.product(),
110  theBuilder.product(),
111  measurementCollectorHandle.product(),
112  updatorHandle.product(),
113  bs,
114  algoResults,
115  trajannResults,
117  algoResultsBeforeDAF,
118  algoResultsAfterDAF);
119 
120  } catch (cms::Exception& e) {
121  edm::LogInfo("DAFTrackProducer") << "cms::Exception caught!!!"
122  << "\n"
123  << e << "\n";
124  throw;
125  }
126 
127  //put everything in the event
128  putInEvt(theEvent,
129  thePropagator.product(),
130  theMeasTk.product(),
131  outputRHColl,
132  outputTColl,
133  outputTEColl,
134  outputTrajectoryColl,
135  outputIndecesInputColl,
136  algoResults,
137  theBuilder.product(),
138  httopo.product());
139  putInEvtTrajAnn(theEvent, trajannResults, outputTrajAnnColl);
140 
141  //put in theEvent before and after DAF tracks collections
142  putInEvt(theEvent,
143  thePropagator.product(),
144  theMeasTk.product(),
145  outputRHCollBeforeDAF,
146  outputTCollBeforeDAF,
147  outputTECollBeforeDAF,
148  outputTrajectoryCollBeforeDAF,
149  outputIndecesInputCollBeforeDAF,
150  algoResultsBeforeDAF,
151  theBuilder.product(),
152  httopo.product(),
153  1);
154  putInEvt(theEvent,
155  thePropagator.product(),
156  theMeasTk.product(),
157  outputRHCollAfterDAF,
158  outputTCollAfterDAF,
159  outputTECollAfterDAF,
160  outputTrajectoryCollAfterDAF,
161  outputIndecesInputCollAfterDAF,
162  algoResultsAfterDAF,
163  theBuilder.product(),
164  httopo.product(),
165  2);
166 
167  LogDebug("DAFTrackProducer") << "end the DAF algorithm."
168  << "\n";
169 }
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< TrajAnnealing > TrajAnnealingCollection
Definition: TrajAnnealing.h:36
edm::ESGetToken< SiTrackerMultiRecHitUpdator, MultiRecHitRecord > updatorToken_
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
DAFTrackProducerAlgorithm theAlgo
void getFromEvt(edm::Event &, edm::Handle< TrajTrackAssociationCollection > &, reco::BeamSpot &)
T const * product() const
Definition: ESHandle.h:86
edm::ESGetToken< MultiRecHitCollector, MultiRecHitRecord > measurementCollectorToken_
edm::EDGetTokenT< MeasurementTrackerEvent > mteSrc_
Log< level::Info, false > LogInfo
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
void runWithCandidate(const TrackingGeometry *, const MagneticField *, const TrajTrackAssociationCollection &, const MeasurementTrackerEvent *measTk, const TrajectoryFitter *, const TransientTrackingRecHitBuilder *, const MultiRecHitCollector *measurementTracker, const SiTrackerMultiRecHitUpdator *, const reco::BeamSpot &, AlgoProductCollection &, TrajAnnealingCollection &, bool, AlgoProductCollection &, AlgoProductCollection &) const
Run the Final Fit taking TrackCandidates as input.
void putInEvtTrajAnn(edm::Event &theEvent, TrajAnnealingCollection &trajannResults, std::unique_ptr< TrajAnnealingCollection > &selTrajAnn)
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)
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_

◆ putInEvtTrajAnn()

void DAFTrackProducer::putInEvtTrajAnn ( edm::Event theEvent,
TrajAnnealingCollection trajannResults,
std::unique_ptr< TrajAnnealingCollection > &  selTrajAnn 
)
private

Definition at line 184 of file DAFTrackProducer.cc.

References mps_fire::i, eostools::move(), edm::Event::put(), and findQualityFiles::size.

Referenced by produce().

186  {
187  const int size = trajannResults.size();
188  outputTrajAnnColl->reserve(size);
189 
190  for (unsigned int i = 0; i < trajannResults.size(); i++) {
191  outputTrajAnnColl->push_back(trajannResults[i]);
192  }
193 
194  theEvent.put(std::move(outputTrajAnnColl));
195 }
size
Write out results.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ measurementCollectorToken_

edm::ESGetToken<MultiRecHitCollector, MultiRecHitRecord> DAFTrackProducer::measurementCollectorToken_
private

Definition at line 39 of file DAFTrackProducer.h.

Referenced by DAFTrackProducer(), and produce().

◆ srcTT_

edm::EDGetTokenT<TrajTrackAssociationCollection> DAFTrackProducer::srcTT_
private

Definition at line 37 of file DAFTrackProducer.h.

Referenced by DAFTrackProducer(), and getFromEvt().

◆ theAlgo

DAFTrackProducerAlgorithm DAFTrackProducer::theAlgo
private

Definition at line 29 of file DAFTrackProducer.h.

Referenced by produce().

◆ TrajAnnSaving_

bool DAFTrackProducer::TrajAnnSaving_
private

Definition at line 36 of file DAFTrackProducer.h.

Referenced by DAFTrackProducer(), and produce().

◆ ttopoToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> DAFTrackProducer::ttopoToken_
private

Definition at line 38 of file DAFTrackProducer.h.

Referenced by DAFTrackProducer(), and produce().

◆ updatorToken_

edm::ESGetToken<SiTrackerMultiRecHitUpdator, MultiRecHitRecord> DAFTrackProducer::updatorToken_
private

Definition at line 40 of file DAFTrackProducer.h.

Referenced by DAFTrackProducer(), and produce().