CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MTFTrackProducer.cc
Go to the documentation of this file.
2 // system include files
3 #include <memory>
4 // user include files
14 
16 
17 
19  KfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),false),
20  theAlgo(iConfig)
21 {
22  setConf(iConfig);
23  setSrc( iConfig.getParameter<edm::InputTag>( "src" ), iConfig.getParameter<edm::InputTag>( "beamSpot" ));
24  setAlias( iConfig.getParameter<std::string>( "@module_label" ) );
25  //register your products
26  produces<reco::TrackCollection>().setBranchAlias( alias_ + "Tracks" );
27  produces<reco::TrackExtraCollection>().setBranchAlias( alias_ + "TrackExtras" );
28  produces<TrackingRecHitCollection>().setBranchAlias( alias_ + "RecHits" );
29  produces<std::vector<Trajectory> >() ;
30  produces<TrajTrackAssociationCollection>();
31 }
32 
33 
35 {
36  edm::LogInfo("MTFTrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
37  //
38  // create empty output collections
39  //
40  std::auto_ptr<TrackingRecHitCollection> outputRHColl (new TrackingRecHitCollection);
41  std::auto_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection);
42  std::auto_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
43  std::auto_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>);
44 
45  //
46  //declare and get stuff to be retrieved from ES
47  //
51  edm::ESHandle<Propagator> thePropagator;
54  getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder);
55  //get additional es_modules needed by the MTF
56  edm::ESHandle<MultiTrackFilterHitCollector> measurementCollectorHandle;
58  std::string measurementCollectorName = getConf().getParameter<std::string>("MeasurementCollector");
59  setup.get<MultiRecHitRecord>().get(measurementCollectorName, measurementCollectorHandle);
60  std::string updatorName = getConf().getParameter<std::string>("UpdatorName");
61  setup.get<MultiRecHitRecord>().get(updatorName, updatorHandle);
62 
63  AlgoProductCollection algoResults;
64 
65  edm::Handle<std::vector<Trajectory> > theTrajectoryCollection;
66 
67  reco::BeamSpot bs;
68 
69 
70  getFromEvt(theEvent,theTrajectoryCollection,bs);
71 
72  measurementCollectorHandle->updateEvent(theEvent);
73  //
74  //run the algorithm
75  //
76 
77  theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTrajectoryCollection,
78  theFitter.product(), theBuilder.product(), measurementCollectorHandle.product(), updatorHandle.product(),bs,algoResults);
79  //
80  //put everything in the event
81  putInEvt(theEvent, thePropagator.product(), theMeasTk.product(),
82  outputRHColl, outputTColl, outputTEColl, outputTrajectoryColl, algoResults);
83  LogDebug("MTFTrackProducer") << "end" << "\n";
84 }
85 
86 
88 {
89 
91  theEvent.getByLabel(src_,theTrajectoryCollection );
92 
93  //get the BeamSpot
94  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
95  theEvent.getByLabel(bsSrc_,recoBeamSpotHandle);
96  bs = *recoBeamSpotHandle;
97 }
#define LogDebug(id)
T getParameter(std::string const &) const
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
MTFTrackProducer(const edm::ParameterSet &iConfig)
Constructor.
void setAlias(std::string alias)
set the aliases of produced collections
MTFTrackProducerAlgorithm theAlgo
void runWithCandidate(const TrackingGeometry *, const MagneticField *, const std::vector< Trajectory > &, const TrajectoryFitter *, const TransientTrackingRecHitBuilder *, const MultiTrackFilterHitCollector *measurementTracker, const SiTrackerMultiRecHitUpdatorMTF *, const reco::BeamSpot &, AlgoProductCollection &) const
Run the Final Fit taking TrackCandidates as input.
void setConf(edm::ParameterSet conf)
Set parameter set.
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
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
void getFromEvt(edm::Event &, edm::Handle< TrajectoryCollection > &, reco::BeamSpot &)
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.
virtual void produce(edm::Event &, const edm::EventSetup &)
Implementation of produce method.
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.