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 > edm::stream::EDProducerBase AlgoProductTraits< reco::Track > edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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 Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 DAFTrackProducer (const edm::ParameterSet &iConfig)
 
virtual 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 ()(false)
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- 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 in May 2014 by brondolin

Definition at line 17 of file DAFTrackProducer.h.

Member Typedef Documentation

Definition at line 20 of file DAFTrackProducer.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file DAFTrackProducer.cc.

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

21  :
22  KfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),false),
23  theAlgo(iConfig)
24 {
25  setConf(iConfig);
26  setSrc( consumes<TrackCandidateCollection>(iConfig.getParameter<edm::InputTag>( "src" )),
27  consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>( "beamSpot" )),
28  consumes<MeasurementTrackerEvent>(iConfig.getParameter<edm::InputTag>( "MeasurementTrackerEvent") ));
29  srcTT_ = consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>( "src" ));
30  setAlias( iConfig.getParameter<std::string>( "@module_label" ) );
31 
32  //register your products
33  produces<reco::TrackCollection>().setBranchAlias( alias_ + "Tracks" );
34  produces<reco::TrackExtraCollection>().setBranchAlias( alias_ + "TrackExtras" );
35  produces<TrackingRecHitCollection>().setBranchAlias( alias_ + "RecHits" );
36  produces<std::vector<Trajectory> >();
37  produces<TrajTrackAssociationCollection>();
38  produces<TrajAnnealingCollection>().setBranchAlias( alias_ + "TrajectoryAnnealing" );
39  produces<reco::TrackCollection>("beforeDAF").setBranchAlias( alias_ + "TracksBeforeDAF" );
40  produces<reco::TrackExtraCollection>("beforeDAF").setBranchAlias( alias_ + "TrackExtrasBeforeDAF" );
41  produces<reco::TrackCollection>("afterDAF").setBranchAlias( alias_ + "TracksAfterDAF" );
42  produces<reco::TrackExtraCollection>("afterDAF").setBranchAlias( alias_ + "TrackExtrasAfterDAF" );
43 
44  TrajAnnSaving_ = iConfig.getParameter<bool>("TrajAnnealingSaving");
45 }
T getParameter(std::string const &) const
DAFTrackProducerAlgorithm theAlgo
void setAlias(std::string alias)
set the aliases of produced collections
void setConf(const edm::ParameterSet &conf)
Set parameter set.
edm::EDGetToken srcTT_
KfTrackProducerBase(bool trajectoryInEvent, bool split)
Constructor.
void setSrc(const edm::EDGetToken &src, const edm::EDGetTokenT< reco::BeamSpot > &bsSrc, const edm::EDGetTokenT< MeasurementTrackerEvent > &mteSrc)
set label of source collection

Member Function Documentation

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

Definition at line 145 of file DAFTrackProducer.cc.

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

Referenced by produce().

146 {
147 
148  //get the TrajTrackMap from the event
149  //WARNING: src has always to be redefined in cfg file
150  theEvent.getByToken(srcTT_,trajTrackAssociationHandle);
151 
152  //get the BeamSpot
153  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
154  theEvent.getByToken(bsSrc_,recoBeamSpotHandle);
155  bs = *recoBeamSpotHandle;
156 
157 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetToken srcTT_
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
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 48 of file DAFTrackProducer.cc.

References MillePedeFileConverter_cfg::e, edm::EventSetup::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(), AlCaHLTBitMon_QueryRunRegistry::string, theAlgo, and TrajAnnSaving_.

49 {
50  edm::LogInfo("DAFTrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
51 
52  //empty output collections
53  std::unique_ptr<TrackingRecHitCollection> outputRHColl (new TrackingRecHitCollection);
54  std::unique_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection);
55  std::unique_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
56  std::unique_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>);
57  std::unique_ptr<TrajAnnealingCollection> outputTrajAnnColl(new TrajAnnealingCollection);
58  std::unique_ptr<std::vector<int> > outputIndecesInputColl(new std::vector<int>);
59 
60 
61  //new tracks collections (changes before and after DAF)
62  std::unique_ptr<TrackingRecHitCollection> outputRHCollBeforeDAF (new TrackingRecHitCollection);
63  std::unique_ptr<reco::TrackCollection> outputTCollBeforeDAF(new reco::TrackCollection);
64  std::unique_ptr<reco::TrackExtraCollection> outputTECollBeforeDAF(new reco::TrackExtraCollection);
65  std::unique_ptr<std::vector<Trajectory> > outputTrajectoryCollBeforeDAF(new std::vector<Trajectory>);
66  std::unique_ptr<std::vector<int> > outputIndecesInputCollBeforeDAF(new std::vector<int>);
67  //----
68  std::unique_ptr<TrackingRecHitCollection> outputRHCollAfterDAF (new TrackingRecHitCollection);
69  std::unique_ptr<reco::TrackCollection> outputTCollAfterDAF(new reco::TrackCollection);
70  std::unique_ptr<reco::TrackExtraCollection> outputTECollAfterDAF(new reco::TrackExtraCollection);
71  std::unique_ptr<std::vector<Trajectory> > outputTrajectoryCollAfterDAF(new std::vector<Trajectory>);
72  std::unique_ptr<std::vector<int> > outputIndecesInputCollAfterDAF(new std::vector<int>);
73 
74  //declare and get stuff to be retrieved from ES
78  edm::ESHandle<Propagator> thePropagator;
81  getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder);
82 
84  setup.get<TrackerTopologyRcd>().get(httopo);
85 
86  //get additional es_modules needed by the DAF
87  edm::ESHandle<MultiRecHitCollector> measurementCollectorHandle;
88  std::string measurementCollectorName = getConf().getParameter<std::string>("MeasurementCollector");
89  setup.get<MultiRecHitRecord>().get(measurementCollectorName, measurementCollectorHandle);
91  std::string updatorName = getConf().getParameter<std::string>("UpdatorName");
92  setup.get<MultiRecHitRecord>().get(updatorName, updatorHandle);
93 
94  //get MeasurementTrackerEvent
96  theEvent.getByToken(mteSrc_, mte);
97 
98 
99  //declare and get TrackCollection
100  AlgoProductCollection algoResults;
101  reco::BeamSpot bs;
102  TrajAnnealingCollection trajannResults;
103 
104  //declare and get new tracks collections
105  AlgoProductCollection algoResultsBeforeDAF;
106  AlgoProductCollection algoResultsAfterDAF;
107  try{
108 
109  edm::Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
110  getFromEvt(theEvent,trajTrackAssociationHandle,bs);
111 
112 
113  //run the algorithm
114  LogDebug("DAFTrackProducer") << "run the DAF algorithm" << "\n";
115  theAlgo.runWithCandidate(theG.product(), theMF.product(),
116  *trajTrackAssociationHandle,
117  &*mte,
118  theFitter.product(), theBuilder.product(),
119  measurementCollectorHandle.product(), updatorHandle.product(), bs,
120  algoResults, trajannResults, TrajAnnSaving_,
121  algoResultsBeforeDAF, algoResultsAfterDAF);
122 
123  } catch (cms::Exception &e){
124  edm::LogInfo("DAFTrackProducer") << "cms::Exception caught!!!" << "\n" << e << "\n";
125  throw;
126  }
127 
128  //put everything in the event
129  putInEvt(theEvent, thePropagator.product(),theMeasTk.product(),
130  outputRHColl, outputTColl, outputTEColl,
131  outputTrajectoryColl, outputIndecesInputColl, algoResults, theBuilder.product(), httopo.product());
132  putInEvtTrajAnn(theEvent, trajannResults, outputTrajAnnColl);
133 
134  //put in theEvent before and after DAF tracks collections
135  putInEvt(theEvent, thePropagator.product(),theMeasTk.product(),
136  outputRHCollBeforeDAF, outputTCollBeforeDAF, outputTECollBeforeDAF,
137  outputTrajectoryCollBeforeDAF, outputIndecesInputCollBeforeDAF, algoResultsBeforeDAF, theBuilder.product(), httopo.product(), 1);
138  putInEvt(theEvent, thePropagator.product(),theMeasTk.product(),
139  outputRHCollAfterDAF, outputTCollAfterDAF, outputTECollAfterDAF,
140  outputTrajectoryCollAfterDAF, outputIndecesInputCollAfterDAF, algoResultsAfterDAF, theBuilder.product(), httopo.product(), 2);
141 
142  LogDebug("DAFTrackProducer") << "end the DAF algorithm." << "\n";
143 }
#define LogDebug(id)
T getParameter(std::string const &) const
typename Base::AlgoProductCollection AlgoProductCollection
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.
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
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.
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
DAFTrackProducerAlgorithm theAlgo
std::vector< TrajAnnealing > TrajAnnealingCollection
Definition: TrajAnnealing.h:42
void getFromEvt(edm::Event &, edm::Handle< TrajTrackAssociationCollection > &, reco::BeamSpot &)
edm::EDGetTokenT< MeasurementTrackerEvent > mteSrc_
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
const edm::ParameterSet & getConf() const
T const * product() const
Definition: ESHandle.h:86
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.
void DAFTrackProducer::putInEvtTrajAnn ( edm::Event theEvent,
TrajAnnealingCollection trajannResults,
std::unique_ptr< TrajAnnealingCollection > &  selTrajAnn 
)
private

Definition at line 159 of file DAFTrackProducer.cc.

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

Referenced by produce().

160  {
161  const int size = trajannResults.size();
162  outputTrajAnnColl->reserve(size);
163 
164  for(unsigned int i = 0; i < trajannResults.size() ; i++){
165  outputTrajAnnColl->push_back(trajannResults[i]);
166  }
167 
168  theEvent.put( std::move(outputTrajAnnColl) );
169 }
size
Write out results.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetToken DAFTrackProducer::srcTT_
private

Definition at line 34 of file DAFTrackProducer.h.

Referenced by DAFTrackProducer(), and getFromEvt().

DAFTrackProducerAlgorithm DAFTrackProducer::theAlgo
private

Definition at line 28 of file DAFTrackProducer.h.

Referenced by produce().

bool DAFTrackProducer::TrajAnnSaving_
private

Definition at line 33 of file DAFTrackProducer.h.

Referenced by DAFTrackProducer(), and produce().