CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GsfTrackProducer.cc
Go to the documentation of this file.
14 
16 public:
18  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
19 
20  void produce(edm::Event&, const edm::EventSetup&) override;
21 
22 private:
24 
26 };
27 
29  : GsfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),
30  iConfig.getParameter<bool>("useHitsSplitting")),
31  theAlgo(iConfig),
32  theTopoToken(esConsumes()) {
34  iConfig, consumesCollector(), consumes<TrackCandidateCollection>(iConfig.getParameter<edm::InputTag>("src")));
35  setAlias(iConfig.getParameter<std::string>("@module_label"));
36  // string a = alias_;
37  // a.erase(a.size()-6,a.size());
38  //register your products
39  produces<reco::GsfTrackCollection>().setBranchAlias(alias_ + "GsfTracks");
40  produces<reco::TrackExtraCollection>().setBranchAlias(alias_ + "TrackExtras");
41  produces<reco::GsfTrackExtraCollection>().setBranchAlias(alias_ + "GsfTrackExtras");
42  produces<TrackingRecHitCollection>().setBranchAlias(alias_ + "RecHits");
43  produces<std::vector<Trajectory> >();
44  produces<TrajGsfTrackAssociationCollection>();
45 }
46 
48  edm::LogInfo("GsfTrackProducer") << "Analyzing event number: " << theEvent.id() << "\n";
49  //
50  // create empty output collections
51  //
52  std::unique_ptr<TrackingRecHitCollection> outputRHColl(new TrackingRecHitCollection);
53  std::unique_ptr<reco::GsfTrackCollection> outputTColl(new reco::GsfTrackCollection);
54  std::unique_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
55  std::unique_ptr<reco::GsfTrackExtraCollection> outputGsfTEColl(new reco::GsfTrackExtraCollection);
56  std::unique_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>);
57 
58  //
59  //declare and get stuff to be retrieved from ES
60  //
64  edm::ESHandle<Propagator> thePropagator;
67  getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
68 
69  TrackerTopology const& ttopo = setup.getData(theTopoToken);
70 
71  //
72  //declare and get TrackColection to be retrieved from the event
73  //
74  AlgoProductCollection algoResults;
76  try {
78  getFromEvt(theEvent, theTCCollection, bs);
79 
80  //
81  //run the algorithm
82  //
83  LogDebug("GsfTrackProducer") << "run the algorithm"
84  << "\n";
86  theMF.product(),
87  *theTCCollection,
88  theFitter.product(),
89  thePropagator.product(),
90  theBuilder.product(),
91  bs,
92  algoResults);
93  } catch (cms::Exception& e) {
94  edm::LogInfo("GsfTrackProducer") << "cms::Exception caught!!!"
95  << "\n"
96  << e << "\n";
97  throw;
98  }
99  //
100  //put everything in the event
101  putInEvt(theEvent,
102  thePropagator.product(),
103  theMeasTk.product(),
104  outputRHColl,
105  outputTColl,
106  outputTEColl,
107  outputGsfTEColl,
108  outputTrajectoryColl,
109  algoResults,
110  theBuilder.product(),
111  bs,
112  &ttopo);
113  LogDebug("GsfTrackProducer") << "end"
114  << "\n";
115 }
116 
119 
120  desc.add<edm::InputTag>("src", edm::InputTag("CkfElectronCandidates"));
121  desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpot"));
122  desc.add<std::string>("producer", std::string(""));
123  desc.add<std::string>("Fitter", std::string("GsfElectronFittingSmoother"));
124  desc.add<bool>("useHitsSplitting", false);
125  desc.add<bool>("TrajectoryInEvent", false);
126  desc.add<std::string>("TTRHBuilder", std::string("WithTrackAngle"));
127  desc.add<std::string>("Propagator", std::string("fwdElectronPropagator"));
128  desc.add<std::string>("NavigationSchool", std::string("SimpleNavigationSchool"));
129  desc.add<std::string>("MeasurementTracker", std::string(""));
130  desc.add<edm::InputTag>("MeasurementTrackerEvent", edm::InputTag("MeasurementTrackerEvent"));
131  desc.add<bool>("GeometricInnerState", false);
132  desc.add<std::string>("AlgorithmName", std::string("gsf"));
133 
134  descriptions.add("gsfTrackProducer", desc);
135 }
136 
void produce(edm::Event &, const edm::EventSetup &) override
Method where the procduction take place. To be implemented in concrete classes.
TrackProducerAlgorithm< reco::GsfTrack > theAlgo
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< GsfTrackExtra > GsfTrackExtraCollection
collection of GsfTrackExtra objects
void initTrackProducerBase(const edm::ParameterSet &conf, edm::ConsumesCollector cc, const edm::EDGetToken &src)
Call this method in inheriting class&#39; constructor.
void setAlias(std::string alias)
set the aliases of produced collections
bool getData(T &iHolder) const
Definition: EventSetup.h:128
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTopoToken
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
virtual void putInEvt(edm::Event &, const Propagator *prop, const MeasurementTracker *measTk, std::unique_ptr< TrackingRecHitCollection > &, std::unique_ptr< reco::GsfTrackCollection > &, std::unique_ptr< reco::TrackExtraCollection > &, std::unique_ptr< reco::GsfTrackExtraCollection > &, std::unique_ptr< std::vector< Trajectory > > &, AlgoProductCollection &, TransientTrackingRecHitBuilder const *, const reco::BeamSpot &, const TrackerTopology *ttopo)
Put produced collections in the event.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Log< level::Info, false > LogInfo
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< AlgoProduct > AlgoProductCollection
T const * product() const
Definition: ESHandle.h:86
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EventID id() const
Definition: EventBase.h:59
void runWithCandidate(const TrackingGeometry *, const MagneticField *, const TrackCandidateCollection &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
Run the Final Fit taking TrackCandidates as input.
GsfTrackProducer(const edm::ParameterSet &iConfig)
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
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.
#define LogDebug(id)