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::EDProducer TrackProducerBase< reco::Track > 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::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 DAFTrackProducer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
- 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 *)
 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::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
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< TrajectoryCollection > &, reco::BeamSpot &)
 
void putInEvtTrajAnn (edm::Event &theEvent, TrajAnnealingCollection &trajannResults, std::auto_ptr< TrajAnnealingCollection > &selTrajAnn)
 

Private Attributes

edm::EDGetToken src_
 
DAFTrackProducerAlgorithm theAlgo
 
bool TrajAnnSaving_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 16 of file DAFTrackProducer.h.

Member Typedef Documentation

Definition at line 19 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(), src_, 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  src_ = consumes<TrajectoryCollection>(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 
38  TrajAnnSaving_ = iConfig.getParameter<bool>("TrajAnnealingSaving");
39 }
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 src_
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< TrajectoryCollection > &  theTrajectoryCollection,
reco::BeamSpot bs 
)
private

Definition at line 108 of file DAFTrackProducer.cc.

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

Referenced by produce().

109 {
110 
111  //get the TrajectoryCollection from the event
112  //WARNING: src has always to be redefined in cfg file
113  theEvent.getByToken(src_,theTrajectoryCollection );
114 
115  //get the BeamSpot
116  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
117  theEvent.getByToken(bsSrc_,recoBeamSpotHandle);
118  bs = *recoBeamSpotHandle;
119 
120 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
edm::EDGetToken src_
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
void DAFTrackProducer::produce ( edm::Event theEvent,
const edm::EventSetup setup 
)
virtual

Implements edm::EDProducer.

Definition at line 42 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_.

43 {
44  edm::LogInfo("DAFTrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
45 
46  //empty output collections
47  std::auto_ptr<TrackingRecHitCollection> outputRHColl (new TrackingRecHitCollection);
48  std::auto_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection);
49  std::auto_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
50  std::auto_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>);
51  std::auto_ptr<TrajAnnealingCollection> outputTrajAnnColl(new TrajAnnealingCollection);
52 
53  //declare and get stuff to be retrieved from ES
57  edm::ESHandle<Propagator> thePropagator;
60  getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder);
61 
62  //get additional es_modules needed by the DAF
63  edm::ESHandle<MultiRecHitCollector> measurementCollectorHandle;
64  std::string measurementCollectorName = getConf().getParameter<std::string>("MeasurementCollector");
65  setup.get<MultiRecHitRecord>().get(measurementCollectorName, measurementCollectorHandle);
67  std::string updatorName = getConf().getParameter<std::string>("UpdatorName");
68  setup.get<MultiRecHitRecord>().get(updatorName, updatorHandle);
69 
70  //get MeasurementTrackerEvent
72  theEvent.getByToken(mteSrc_, mte);
73 
74 
75  //declare and get TrackColection
76  AlgoProductCollection algoResults;
77  reco::BeamSpot bs;
78  TrajAnnealingCollection trajannResults;
79  try{
80 
81  edm::Handle<std::vector<Trajectory> > theTrajectoryCollection;
82  getFromEvt(theEvent,theTrajectoryCollection,bs);
83 
84  //obsolete?
85  //measurementCollectorHandle->updateEvent(theEvent);
86 
87  //run the algorithm
88  LogDebug("DAFTrackProducer") << "run the DAF algorithm" << "\n";
89  theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTrajectoryCollection, &*mte,
90  theFitter.product(), theBuilder.product(),
91  measurementCollectorHandle.product(), updatorHandle.product(), bs,
92  algoResults, trajannResults, TrajAnnSaving_);
93 
94  } catch (cms::Exception &e){
95  edm::LogInfo("DAFTrackProducer") << "cms::Exception caught!!!" << "\n" << e << "\n";
96  throw;
97  }
98 
99  //put everything in the event
100  putInEvt(theEvent, thePropagator.product(),theMeasTk.product(),
101  outputRHColl, outputTColl, outputTEColl,
102  outputTrajectoryColl, algoResults, theBuilder.product());
103  putInEvtTrajAnn(theEvent, trajannResults, outputTrajAnnColl);
104 
105  LogDebug("DAFTrackProducer") << "end the DAF algorithm." << "\n";
106 }
#define LogDebug(id)
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
DAFTrackProducerAlgorithm theAlgo
std::vector< TrajAnnealing > TrajAnnealingCollection
Definition: TrajAnnealing.h:42
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 *)
Put produced collections in the event.
void getFromEvt(edm::Event &, edm::Handle< TrajectoryCollection > &, 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:56
void runWithCandidate(const TrackingGeometry *, const MagneticField *, const std::vector< Trajectory > &, const MeasurementTrackerEvent *measTk, const TrajectoryFitter *, const TransientTrackingRecHitBuilder *, const MultiRecHitCollector *measurementTracker, const SiTrackerMultiRecHitUpdator *, const reco::BeamSpot &, AlgoProductCollection &, TrajAnnealingCollection &, bool) const
Run the Final Fit taking TrackCandidates as input.
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 122 of file DAFTrackProducer.cc.

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

Referenced by produce().

123  {
124  const int size = trajannResults.size();
125  outputTrajAnnColl->reserve(size);
126 
127  for(unsigned int i = 0; i < trajannResults.size() ; i++){
128  outputTrajAnnColl->push_back(trajannResults[i]);
129  }
130 
131  theEvent.put( outputTrajAnnColl );
132 }
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
tuple size
Write out results.

Member Data Documentation

edm::EDGetToken DAFTrackProducer::src_
private

Definition at line 33 of file DAFTrackProducer.h.

Referenced by DAFTrackProducer(), and getFromEvt().

DAFTrackProducerAlgorithm DAFTrackProducer::theAlgo
private

Definition at line 27 of file DAFTrackProducer.h.

Referenced by produce().

bool DAFTrackProducer::TrajAnnSaving_
private

Definition at line 32 of file DAFTrackProducer.h.

Referenced by DAFTrackProducer(), and produce().