CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DAFTrackProducer.cc
Go to the documentation of this file.
2 // system include files
3 #include <memory>
4 // user include files
10 
16 
18 
19 
21  KfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),false),
22  theAlgo(iConfig)
23 {
24  setConf(iConfig);
25  setSrc( iConfig.getParameter<edm::InputTag>( "src" ), iConfig.getParameter<edm::InputTag>( "beamSpot" ));
26  setAlias( iConfig.getParameter<std::string>( "@module_label" ) );
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 
34 
35 }
36 
37 
39 {
40  edm::LogInfo("DAFTrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
41 
42  // create empty output collections
43  //
44  std::auto_ptr<TrackingRecHitCollection> outputRHColl (new TrackingRecHitCollection);
45  std::auto_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection);
46  std::auto_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
47  std::auto_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>);
48 
49  //
50  //declare and get stuff to be retrieved from ES
51  //
55  edm::ESHandle<Propagator> thePropagator;
58  getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder);
59  //get additional es_modules needed by the DAF
60  edm::ESHandle<MultiRecHitCollector> measurementCollectorHandle;
62  std::string measurementCollectorName = getConf().getParameter<std::string>("MeasurementCollector");
63  setup.get<MultiRecHitRecord>().get(measurementCollectorName, measurementCollectorHandle);
64  std::string updatorName = getConf().getParameter<std::string>("UpdatorName");
65  setup.get<MultiRecHitRecord>().get(updatorName, updatorHandle);
66 
67  AlgoProductCollection algoResults;
68 
69  edm::Handle<std::vector<Trajectory> > theTrajectoryCollection;
70  reco::BeamSpot bs;
71 
72  getFromEvt(theEvent,theTrajectoryCollection,bs);
73 
74  measurementCollectorHandle->updateEvent(theEvent);
75 
76  //
77  //run the algorithm
78  //
79 
80  theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTrajectoryCollection,
81  theFitter.product(), theBuilder.product(), measurementCollectorHandle.product(), updatorHandle.product(),bs,algoResults);
82 
83  putInEvt(theEvent, thePropagator.product(), theMeasTk.product(),
84  outputRHColl, outputTColl, outputTEColl, outputTrajectoryColl, algoResults);
85 
86 }
87 
89 {
90  //
91  //get the TrajectoryCollection from the event
92  //
93 
95  theEvent.getByLabel(src_,theTrajectoryCollection );
96 
97  //get the BeamSpot
98  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
99  theEvent.getByLabel(bsSrc_,recoBeamSpotHandle);
100  bs = *recoBeamSpotHandle;
101 }
T getParameter(std::string const &) const
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
DAFTrackProducerAlgorithm theAlgo
void setAlias(std::string alias)
set the aliases of produced collections
void runWithCandidate(const TrackingGeometry *, const MagneticField *, const std::vector< Trajectory > &, const TrajectoryFitter *, const TransientTrackingRecHitBuilder *, const MultiRecHitCollector *measurementTracker, const SiTrackerMultiRecHitUpdator *, const reco::BeamSpot &, AlgoProductCollection &) const
Run the Final Fit taking TrackCandidates as input.
void setConf(edm::ParameterSet conf)
Set parameter set.
void getFromEvt(edm::Event &, edm::Handle< TrajectoryCollection > &, reco::BeamSpot &)
std::vector< AlgoProduct > AlgoProductCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
void setSrc(edm::InputTag src, edm::InputTag bsSrc)
set label of source collection
virtual void produce(edm::Event &, const edm::EventSetup &)
Implementation of produce method.
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:9
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
edm::EventID id() const
Definition: EventBase.h:56
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 &)
Put produced collections in the event.
DAFTrackProducer(const edm::ParameterSet &iConfig)
Constructor.
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.