CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector< TrajectoryTrajectoryCollection
 
- Public Types inherited from TrackProducerBase< reco::Track >
typedef std::pair< Trajectory
*, std::pair< reco::Track
*, PropagationDirection > > 
AlgoProduct
 
typedef std::vector< AlgoProductAlgoProductCollection
 
typedef std::vector< reco::TrackTrackCollection
 
- 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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
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
 
- 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::auto_ptr< TrackingRecHitCollection > &, std::auto_ptr< reco::TrackCollection > &, std::auto_ptr< reco::TrackExtraCollection > &, std::auto_ptr< std::vector< Trajectory > > &, AlgoProductCollection &, TransientTrackingRecHitBuilder const *, 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< TrackCollection > &, 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)
 
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 ()
 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)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void getFromEvt (edm::Event &, edm::Handle< TrajTrackAssociationCollection > &, reco::BeamSpot &)
 
void putInEvtTrajAnn (edm::Event &theEvent, TrajAnnealingCollection &trajannResults, std::auto_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::EDGetTokenT
< MeasurementTrackerEvent
mteSrc_
 
bool rekeyClusterRefs_
 
edm::OrphanHandle
< TrackCollection
rTracks_
 
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 19 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_.

19  :
20  KfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),false),
21  theAlgo(iConfig)
22 {
23  setConf(iConfig);
24  setSrc( consumes<TrackCandidateCollection>(iConfig.getParameter<edm::InputTag>( "src" )),
25  consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>( "beamSpot" )),
26  consumes<MeasurementTrackerEvent>(iConfig.getParameter<edm::InputTag>( "MeasurementTrackerEvent") ));
27  srcTT_ = consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>( "src" ));
28  setAlias( iConfig.getParameter<std::string>( "@module_label" ) );
29 
30  //register your products
31  produces<reco::TrackCollection>().setBranchAlias( alias_ + "Tracks" );
32  produces<reco::TrackExtraCollection>().setBranchAlias( alias_ + "TrackExtras" );
33  produces<TrackingRecHitCollection>().setBranchAlias( alias_ + "RecHits" );
34  produces<std::vector<Trajectory> >();
35  produces<TrajTrackAssociationCollection>();
36  produces<TrajAnnealingCollection>().setBranchAlias( alias_ + "TrajectoryAnnealing" );
37  produces<reco::TrackCollection>("beforeDAF").setBranchAlias( alias_ + "TracksBeforeDAF" );
38  produces<reco::TrackExtraCollection>("beforeDAF").setBranchAlias( alias_ + "TrackExtrasBeforeDAF" );
39  produces<reco::TrackCollection>("afterDAF").setBranchAlias( alias_ + "TracksAfterDAF" );
40  produces<reco::TrackExtraCollection>("afterDAF").setBranchAlias( alias_ + "TrackExtrasAfterDAF" );
41 
42  TrajAnnSaving_ = iConfig.getParameter<bool>("TrajAnnealingSaving");
43 }
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 136 of file DAFTrackProducer.cc.

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

Referenced by produce().

137 {
138 
139  //get the TrajTrackMap from the event
140  //WARNING: src has always to be redefined in cfg file
141  theEvent.getByToken(srcTT_,trajTrackAssociationHandle);
142 
143  //get the BeamSpot
144  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
145  theEvent.getByToken(bsSrc_,recoBeamSpotHandle);
146  bs = *recoBeamSpotHandle;
147 
148 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
edm::EDGetToken srcTT_
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
void DAFTrackProducer::produce ( edm::Event theEvent,
const edm::EventSetup setup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 46 of file DAFTrackProducer.cc.

References alignCSCRings::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< class >::product(), KfTrackProducerBase::putInEvt(), putInEvtTrajAnn(), DAFTrackProducerAlgorithm::runWithCandidate(), AlCaHLTBitMon_QueryRunRegistry::string, theAlgo, and TrajAnnSaving_.

47 {
48  edm::LogInfo("DAFTrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
49 
50  //empty output collections
51  std::auto_ptr<TrackingRecHitCollection> outputRHColl (new TrackingRecHitCollection);
52  std::auto_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection);
53  std::auto_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
54  std::auto_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>);
55  std::auto_ptr<TrajAnnealingCollection> outputTrajAnnColl(new TrajAnnealingCollection);
56 
57  //new tracks collections (changes before and after DAF)
58  std::auto_ptr<TrackingRecHitCollection> outputRHCollBeforeDAF (new TrackingRecHitCollection);
59  std::auto_ptr<reco::TrackCollection> outputTCollBeforeDAF(new reco::TrackCollection);
60  std::auto_ptr<reco::TrackExtraCollection> outputTECollBeforeDAF(new reco::TrackExtraCollection);
61  std::auto_ptr<std::vector<Trajectory> > outputTrajectoryCollBeforeDAF(new std::vector<Trajectory>);
62  //----
63  std::auto_ptr<TrackingRecHitCollection> outputRHCollAfterDAF (new TrackingRecHitCollection);
64  std::auto_ptr<reco::TrackCollection> outputTCollAfterDAF(new reco::TrackCollection);
65  std::auto_ptr<reco::TrackExtraCollection> outputTECollAfterDAF(new reco::TrackExtraCollection);
66  std::auto_ptr<std::vector<Trajectory> > outputTrajectoryCollAfterDAF(new std::vector<Trajectory>);
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 
77  //get additional es_modules needed by the DAF
78  edm::ESHandle<MultiRecHitCollector> measurementCollectorHandle;
79  std::string measurementCollectorName = getConf().getParameter<std::string>("MeasurementCollector");
80  setup.get<MultiRecHitRecord>().get(measurementCollectorName, measurementCollectorHandle);
82  std::string updatorName = getConf().getParameter<std::string>("UpdatorName");
83  setup.get<MultiRecHitRecord>().get(updatorName, updatorHandle);
84 
85  //get MeasurementTrackerEvent
87  theEvent.getByToken(mteSrc_, mte);
88 
89 
90  //declare and get TrackCollection
91  AlgoProductCollection algoResults;
92  reco::BeamSpot bs;
93  TrajAnnealingCollection trajannResults;
94 
95  //declare and get new tracks collections
96  AlgoProductCollection algoResultsBeforeDAF;
97  AlgoProductCollection algoResultsAfterDAF;
98  try{
99 
100  edm::Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
101  getFromEvt(theEvent,trajTrackAssociationHandle,bs);
102 
103 
104  //run the algorithm
105  LogDebug("DAFTrackProducer") << "run the DAF algorithm" << "\n";
106  theAlgo.runWithCandidate(theG.product(), theMF.product(),
107  *trajTrackAssociationHandle,
108  &*mte,
109  theFitter.product(), theBuilder.product(),
110  measurementCollectorHandle.product(), updatorHandle.product(), bs,
111  algoResults, trajannResults, TrajAnnSaving_,
112  algoResultsBeforeDAF, algoResultsAfterDAF);
113 
114  } catch (cms::Exception &e){
115  edm::LogInfo("DAFTrackProducer") << "cms::Exception caught!!!" << "\n" << e << "\n";
116  throw;
117  }
118 
119  //put everything in the event
120  putInEvt(theEvent, thePropagator.product(),theMeasTk.product(),
121  outputRHColl, outputTColl, outputTEColl,
122  outputTrajectoryColl, algoResults, theBuilder.product());
123  putInEvtTrajAnn(theEvent, trajannResults, outputTrajAnnColl);
124 
125  //put in theEvent before and after DAF tracks collections
126  putInEvt(theEvent, thePropagator.product(),theMeasTk.product(),
127  outputRHCollBeforeDAF, outputTCollBeforeDAF, outputTECollBeforeDAF,
128  outputTrajectoryCollBeforeDAF, algoResultsBeforeDAF, theBuilder.product(), 1);
129  putInEvt(theEvent, thePropagator.product(),theMeasTk.product(),
130  outputRHCollAfterDAF, outputTCollAfterDAF, outputTECollAfterDAF,
131  outputTrajectoryCollAfterDAF, algoResultsAfterDAF, theBuilder.product(), 2);
132 
133  LogDebug("DAFTrackProducer") << "end the DAF algorithm." << "\n";
134 }
#define LogDebug(id)
T getParameter(std::string const &) const
virtual void putInEvt(edm::Event &, const Propagator *prop, const MeasurementTracker *measTk, std::auto_ptr< TrackingRecHitCollection > &, std::auto_ptr< reco::TrackCollection > &, std::auto_ptr< reco::TrackExtraCollection > &, std::auto_ptr< std::vector< Trajectory > > &, AlgoProductCollection &, TransientTrackingRecHitBuilder const *, int BeforeOrAfter=0)
Put produced collections in the event.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
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:13
DAFTrackProducerAlgorithm theAlgo
std::vector< TrajAnnealing > TrajAnnealingCollection
Definition: TrajAnnealing.h:42
void getFromEvt(edm::Event &, edm::Handle< TrajTrackAssociationCollection > &, reco::BeamSpot &)
std::vector< AlgoProduct > AlgoProductCollection
edm::EDGetTokenT< MeasurementTrackerEvent > mteSrc_
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
void putInEvtTrajAnn(edm::Event &theEvent, TrajAnnealingCollection &trajannResults, std::auto_ptr< TrajAnnealingCollection > &selTrajAnn)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
edm::EventID id() const
Definition: EventBase.h:60
const edm::ParameterSet & getConf() 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.
void DAFTrackProducer::putInEvtTrajAnn ( edm::Event theEvent,
TrajAnnealingCollection trajannResults,
std::auto_ptr< TrajAnnealingCollection > &  selTrajAnn 
)
private

Definition at line 150 of file DAFTrackProducer.cc.

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

Referenced by produce().

151  {
152  const int size = trajannResults.size();
153  outputTrajAnnColl->reserve(size);
154 
155  for(unsigned int i = 0; i < trajannResults.size() ; i++){
156  outputTrajAnnColl->push_back(trajannResults[i]);
157  }
158 
159  theEvent.put( outputTrajAnnColl );
160 }
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
tuple size
Write out results.

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