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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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 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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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::EDGetToken srcTT_
 
DAFTrackProducerAlgorithm theAlgo
 
bool TrajAnnSaving_
 

Additional Inherited Members

- 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

EDProducer for DAFTrackProducerAlgorithm.

Author
tropiano, genta \review in May 2014 by brondolin

Definition at line 17 of file DAFTrackProducer.h.

Member Typedef Documentation

◆ TrajectoryCollection

Definition at line 19 of file DAFTrackProducer.h.

Constructor & Destructor Documentation

◆ DAFTrackProducer()

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

Definition at line 20 of file DAFTrackProducer.cc.

21  : KfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"), false), 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  srcTT_ = consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("src"));
27  setAlias(iConfig.getParameter<std::string>("@module_label"));
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  produces<TrajAnnealingCollection>().setBranchAlias(alias_ + "TrajectoryAnnealing");
36  produces<reco::TrackCollection>("beforeDAF").setBranchAlias(alias_ + "TracksBeforeDAF");
37  produces<reco::TrackExtraCollection>("beforeDAF").setBranchAlias(alias_ + "TrackExtrasBeforeDAF");
38  produces<reco::TrackCollection>("afterDAF").setBranchAlias(alias_ + "TracksAfterDAF");
39  produces<reco::TrackExtraCollection>("afterDAF").setBranchAlias(alias_ + "TrackExtrasAfterDAF");
40 
41  TrajAnnSaving_ = iConfig.getParameter<bool>("TrajAnnealingSaving");
42 }

References TrackProducerBase< reco::Track >::alias_, edm::ParameterSet::getParameter(), TrackProducerBase< reco::Track >::setAlias(), TrackProducerBase< reco::Track >::setConf(), TrackProducerBase< reco::Track >::setSrc(), srcTT_, AlCaHLTBitMon_QueryRunRegistry::string, and TrajAnnSaving_.

Member Function Documentation

◆ getFromEvt()

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

Definition at line 173 of file DAFTrackProducer.cc.

175  {
176  //get the TrajTrackMap from the event
177  //WARNING: src has always to be redefined in cfg file
178  theEvent.getByToken(srcTT_, trajTrackAssociationHandle);
179 
180  //get the BeamSpot
181  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
182  theEvent.getByToken(bsSrc_, recoBeamSpotHandle);
183  bs = *recoBeamSpotHandle;
184 }

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

Referenced by produce().

◆ 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 44 of file DAFTrackProducer.cc.

44  {
45  edm::LogInfo("DAFTrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
46 
47  //empty output collections
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<TrajAnnealingCollection> outputTrajAnnColl(new TrajAnnealingCollection);
53  std::unique_ptr<std::vector<int> > outputIndecesInputColl(new std::vector<int>);
54 
55  //new tracks collections (changes before and after DAF)
56  std::unique_ptr<TrackingRecHitCollection> outputRHCollBeforeDAF(new TrackingRecHitCollection);
57  std::unique_ptr<reco::TrackCollection> outputTCollBeforeDAF(new reco::TrackCollection);
58  std::unique_ptr<reco::TrackExtraCollection> outputTECollBeforeDAF(new reco::TrackExtraCollection);
59  std::unique_ptr<std::vector<Trajectory> > outputTrajectoryCollBeforeDAF(new std::vector<Trajectory>);
60  std::unique_ptr<std::vector<int> > outputIndecesInputCollBeforeDAF(new std::vector<int>);
61  //----
62  std::unique_ptr<TrackingRecHitCollection> outputRHCollAfterDAF(new TrackingRecHitCollection);
63  std::unique_ptr<reco::TrackCollection> outputTCollAfterDAF(new reco::TrackCollection);
64  std::unique_ptr<reco::TrackExtraCollection> outputTECollAfterDAF(new reco::TrackExtraCollection);
65  std::unique_ptr<std::vector<Trajectory> > outputTrajectoryCollAfterDAF(new std::vector<Trajectory>);
66  std::unique_ptr<std::vector<int> > outputIndecesInputCollAfterDAF(new std::vector<int>);
67 
68  //declare and get stuff to be retrieved from ES
72  edm::ESHandle<Propagator> thePropagator;
75  getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
76 
78  setup.get<TrackerTopologyRcd>().get(httopo);
79 
80  //get additional es_modules needed by the DAF
81  edm::ESHandle<MultiRecHitCollector> measurementCollectorHandle;
82  std::string measurementCollectorName = getConf().getParameter<std::string>("MeasurementCollector");
83  setup.get<MultiRecHitRecord>().get(measurementCollectorName, measurementCollectorHandle);
85  std::string updatorName = getConf().getParameter<std::string>("UpdatorName");
86  setup.get<MultiRecHitRecord>().get(updatorName, updatorHandle);
87 
88  //get MeasurementTrackerEvent
90  theEvent.getByToken(mteSrc_, mte);
91 
92  //declare and get TrackCollection
93  AlgoProductCollection algoResults;
95  TrajAnnealingCollection trajannResults;
96 
97  //declare and get new tracks collections
98  AlgoProductCollection algoResultsBeforeDAF;
99  AlgoProductCollection algoResultsAfterDAF;
100  try {
101  edm::Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
102  getFromEvt(theEvent, trajTrackAssociationHandle, bs);
103 
104  //run the algorithm
105  LogDebug("DAFTrackProducer") << "run the DAF algorithm"
106  << "\n";
108  theMF.product(),
109  *trajTrackAssociationHandle,
110  &*mte,
111  theFitter.product(),
112  theBuilder.product(),
113  measurementCollectorHandle.product(),
114  updatorHandle.product(),
115  bs,
116  algoResults,
117  trajannResults,
119  algoResultsBeforeDAF,
120  algoResultsAfterDAF);
121 
122  } catch (cms::Exception& e) {
123  edm::LogInfo("DAFTrackProducer") << "cms::Exception caught!!!"
124  << "\n"
125  << e << "\n";
126  throw;
127  }
128 
129  //put everything in the event
130  putInEvt(theEvent,
131  thePropagator.product(),
132  theMeasTk.product(),
133  outputRHColl,
134  outputTColl,
135  outputTEColl,
136  outputTrajectoryColl,
137  outputIndecesInputColl,
138  algoResults,
139  theBuilder.product(),
140  httopo.product());
141  putInEvtTrajAnn(theEvent, trajannResults, outputTrajAnnColl);
142 
143  //put in theEvent before and after DAF tracks collections
144  putInEvt(theEvent,
145  thePropagator.product(),
146  theMeasTk.product(),
147  outputRHCollBeforeDAF,
148  outputTCollBeforeDAF,
149  outputTECollBeforeDAF,
150  outputTrajectoryCollBeforeDAF,
151  outputIndecesInputCollBeforeDAF,
152  algoResultsBeforeDAF,
153  theBuilder.product(),
154  httopo.product(),
155  1);
156  putInEvt(theEvent,
157  thePropagator.product(),
158  theMeasTk.product(),
159  outputRHCollAfterDAF,
160  outputTCollAfterDAF,
161  outputTECollAfterDAF,
162  outputTrajectoryCollAfterDAF,
163  outputIndecesInputCollAfterDAF,
164  algoResultsAfterDAF,
165  theBuilder.product(),
166  httopo.product(),
167  2);
168 
169  LogDebug("DAFTrackProducer") << "end the DAF algorithm."
170  << "\n";
171 }

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

◆ putInEvtTrajAnn()

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

Definition at line 186 of file DAFTrackProducer.cc.

188  {
189  const int size = trajannResults.size();
190  outputTrajAnnColl->reserve(size);
191 
192  for (unsigned int i = 0; i < trajannResults.size(); i++) {
193  outputTrajAnnColl->push_back(trajannResults[i]);
194  }
195 
196  theEvent.put(std::move(outputTrajAnnColl));
197 }

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

Referenced by produce().

Member Data Documentation

◆ srcTT_

edm::EDGetToken DAFTrackProducer::srcTT_
private

Definition at line 35 of file DAFTrackProducer.h.

Referenced by DAFTrackProducer(), and getFromEvt().

◆ theAlgo

DAFTrackProducerAlgorithm DAFTrackProducer::theAlgo
private

Definition at line 27 of file DAFTrackProducer.h.

Referenced by produce().

◆ TrajAnnSaving_

bool DAFTrackProducer::TrajAnnSaving_
private

Definition at line 34 of file DAFTrackProducer.h.

Referenced by DAFTrackProducer(), 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.
MultiRecHitRecord
Definition: MultiRecHitRecord.h:12
TrajAnnealingCollection
std::vector< TrajAnnealing > TrajAnnealingCollection
Definition: TrajAnnealing.h:36
mps_fire.i
i
Definition: mps_fire.py:355
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
edm::LogInfo
Definition: MessageLogger.h:254
TrackProducerBase< reco::Track >::AlgoProductCollection
typename Base::AlgoProductCollection AlgoProductCollection
Definition: TrackProducerBase.h:44
edm::Handle< reco::BeamSpot >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
TrackProducerBase< reco::Track >::getConf
const edm::ParameterSet & getConf() const
Definition: TrackProducerBase.h:100
cms::cuda::bs
bs
Definition: HistoContainer.h:127
DAFTrackProducer::getFromEvt
void getFromEvt(edm::Event &, edm::Handle< TrajTrackAssociationCollection > &, reco::BeamSpot &)
Definition: DAFTrackProducer.cc:173
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::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
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
DAFTrackProducer::srcTT_
edm::EDGetToken srcTT_
Definition: DAFTrackProducer.h:35
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
DAFTrackProducerAlgorithm::runWithCandidate
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.
Definition: DAFTrackProducerAlgorithm.cc:30
get
#define get
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
DAFTrackProducer::TrajAnnSaving_
bool TrajAnnSaving_
Definition: DAFTrackProducer.h:34
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TrackProducerBase< reco::Track >::bsSrc_
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
Definition: TrackProducerBase.h:110
eostools.move
def move(src, dest)
Definition: eostools.py:511
TrackProducerBase< reco::Track >::mteSrc_
edm::EDGetTokenT< MeasurementTrackerEvent > mteSrc_
Definition: TrackProducerBase.h:111
DAFTrackProducer::putInEvtTrajAnn
void putInEvtTrajAnn(edm::Event &theEvent, TrajAnnealingCollection &trajannResults, std::unique_ptr< TrajAnnealingCollection > &selTrajAnn)
Definition: DAFTrackProducer.cc:186
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 >
DAFTrackProducer::theAlgo
DAFTrackProducerAlgorithm theAlgo
Definition: DAFTrackProducer.h:27
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37