CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
GsfTrackRefitter Class Reference

#include <GsfTrackRefitter.h>

Inheritance diagram for GsfTrackRefitter:
GsfTrackProducerBase edm::stream::EDProducer<> TrackProducerBase< reco::GsfTrack > AlgoProductTraits< reco::GsfTrack >

Public Member Functions

 GsfTrackRefitter (const edm::ParameterSet &iConfig)
 Constructor. More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 Implementation of produce method. More...
 
- Public Member Functions inherited from GsfTrackProducerBase
 GsfTrackProducerBase (bool trajectoryInEvent, bool split)
 Constructor. More...
 
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. More...
 
- Public Member Functions inherited from TrackProducerBase< reco::GsfTrack >
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< TrackView > &, 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::GsfTrack &track, const Propagator *prop, const MeasurementTrackerEvent *measTk, const TrackerTopology *ttopo)
 
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 () noexcept(false)
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Types

enum  Constraint { none, vertex }
 

Private Attributes

Constraint constraint_
 
edm::EDGetTokenT< GsfTrackVtxConstraintAssociationCollectiongsfTrackVtxConstraintTag_
 
TrackProducerAlgorithm< reco::GsfTracktheAlgo
 

Additional Inherited Members

- Public Types inherited from TrackProducerBase< reco::GsfTrack >
using AlgoProductCollection = typename Base::AlgoProductCollection
 
using Base = AlgoProductTraits< reco::GsfTrack >
 
using TrackCollection = typename Base::TrackCollection
 
using TrackView = typename Base::TrackView
 
- Public Types inherited from AlgoProductTraits< reco::GsfTrack >
using AlgoProductCollection = std::vector< AlgoProduct >
 
using TrackCollection = std::vector< reco::GsfTrack >
 
using TrackView = edm::View< reco::GsfTrack >
 
- 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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Protected Member Functions inherited from GsfTrackProducerBase
void fillMode (reco::GsfTrack &track, const TrajectoryStateOnSurface innertsos, const Propagator &gsfProp, const TransverseImpactPointExtrapolator &tipExtrapolator, TrajectoryStateClosestToBeamLineBuilder &tscblBuilder, const reco::BeamSpot &bs) const
 
void fillStates (TrajectoryStateOnSurface tsos, std::vector< reco::GsfComponent5D > &states) const
 
- Protected Attributes inherited from TrackProducerBase< reco::GsfTrack >
std::string alias_
 
edm::EDGetTokenT< reco::BeamSpotbsSrc_
 
edm::InputTag clusterRemovalInfo_
 
edm::ParameterSet conf_
 
edm::EDGetTokenT< MeasurementTrackerEventmteSrc_
 
bool rekeyClusterRefs_
 
edm::OrphanHandle< TrackCollectionrTracks_
 
edm::EDGetToken src_
 
edm::ESHandle< NavigationSchooltheSchool
 
bool trajectoryInEvent_
 

Detailed Description

Refit GSF Tracks. Based on the TrackRefitter.

Definition at line 14 of file GsfTrackRefitter.h.

Member Enumeration Documentation

◆ Constraint

Enumerator
none 
vertex 

Definition at line 24 of file GsfTrackRefitter.h.

24  {
25  none,
26  // momentum,
27  vertex
28  };

Constructor & Destructor Documentation

◆ GsfTrackRefitter()

GsfTrackRefitter::GsfTrackRefitter ( const edm::ParameterSet iConfig)
explicit

Constructor.

Definition at line 18 of file GsfTrackRefitter.cc.

19  : GsfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),
20  iConfig.getParameter<bool>("useHitsSplitting")),
21  theAlgo(iConfig) {
22  setConf(iConfig);
24  consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpot")),
25  consumes<MeasurementTrackerEvent>(iConfig.getParameter<edm::InputTag>("MeasurementTrackerEvent")));
26  setAlias(iConfig.getParameter<std::string>("@module_label"));
27  std::string constraint_str = iConfig.getParameter<std::string>("constraint");
28 
29  if (constraint_str.empty())
30  constraint_ = none;
31  // else if (constraint_str == "momentum") constraint_ = momentum;
32  else if (constraint_str == "vertex") {
34  gsfTrackVtxConstraintTag_ = consumes<GsfTrackVtxConstraintAssociationCollection>(
35  iConfig.getParameter<edm::InputTag>("gsfTrackVtxConstraintTag"));
36  } else {
37  edm::LogError("GsfTrackRefitter") << "constraint: " << constraint_str
38  << " not understood. Set it to 'momentum', 'vertex' or leave it empty";
39  throw cms::Exception("GsfTrackRefitter")
40  << "unknown type of contraint! Set it to 'momentum', 'vertex' or leave it empty";
41  }
42 
43  //register your products
44  produces<reco::GsfTrackCollection>().setBranchAlias(alias_ + "GsfTracks");
45  produces<reco::TrackExtraCollection>().setBranchAlias(alias_ + "TrackExtras");
46  produces<reco::GsfTrackExtraCollection>().setBranchAlias(alias_ + "GsfTrackExtras");
47  produces<TrackingRecHitCollection>().setBranchAlias(alias_ + "RecHits");
48  produces<std::vector<Trajectory>>();
49  produces<TrajGsfTrackAssociationCollection>();
50 }

References TrackProducerBase< reco::GsfTrack >::alias_, constraint_, Exception, edm::ParameterSet::getParameter(), gsfTrackVtxConstraintTag_, none, TrackProducerBase< reco::GsfTrack >::setAlias(), TrackProducerBase< reco::GsfTrack >::setConf(), TrackProducerBase< reco::GsfTrack >::setSrc(), AlCaHLTBitMon_QueryRunRegistry::string, and vertex.

Member Function Documentation

◆ produce()

void GsfTrackRefitter::produce ( edm::Event theEvent,
const edm::EventSetup setup 
)
overridevirtual

Implementation of produce method.

Implements TrackProducerBase< reco::GsfTrack >.

Definition at line 52 of file GsfTrackRefitter.cc.

52  {
53  edm::LogInfo("GsfTrackRefitter") << "Analyzing event number: " << theEvent.id() << "\n";
54  //
55  // create empty output collections
56  //
57  std::unique_ptr<TrackingRecHitCollection> outputRHColl(new TrackingRecHitCollection);
58  std::unique_ptr<reco::GsfTrackCollection> outputTColl(new reco::GsfTrackCollection);
59  std::unique_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
60  std::unique_ptr<reco::GsfTrackExtraCollection> outputGsfTEColl(new reco::GsfTrackExtraCollection);
61  std::unique_ptr<std::vector<Trajectory>> outputTrajectoryColl(new std::vector<Trajectory>);
62 
63  //
64  //declare and get stuff to be retrieved from ES
65  //
69  edm::ESHandle<Propagator> thePropagator;
71  // getFromES(setup,theG,theMF,theFitter,thePropagator);
73  getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
74 
76  setup.get<TrackerTopologyRcd>().get(httopo);
77 
78  //
79  //declare and get TrackCollection to be retrieved from the event
80  //
81  AlgoProductCollection algoResults;
83  switch (constraint_) {
84  case none: {
86  getFromEvt(theEvent, theTCollection, bs);
87  if (theTCollection.failedToGet()) {
88  edm::LogError("GsfTrackRefitter") << "could not get the reco::GsfTrackCollection.";
89  return;
90  }
91  LogDebug("GsfTrackRefitter") << "run the algorithm"
92  << "\n";
93  try {
95  theMF.product(),
96  *theTCollection,
97  theFitter.product(),
98  thePropagator.product(),
99  theBuilder.product(),
100  bs,
101  algoResults);
102  } catch (cms::Exception& e) {
103  edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithTrack."
104  << "\n"
105  << e << "\n";
106  throw;
107  }
108  break;
109  }
110  case vertex: {
111  edm::Handle<GsfTrackVtxConstraintAssociationCollection> theTCollectionWithConstraint;
112  theEvent.getByToken(gsfTrackVtxConstraintTag_, theTCollectionWithConstraint);
113  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
114  theEvent.getByToken(bsSrc_, recoBeamSpotHandle);
115  bs = *recoBeamSpotHandle;
116  if (theTCollectionWithConstraint.failedToGet()) {
117  edm::LogError("TrackRefitter") << "could not get TrackVtxConstraintAssociationCollection product.";
118  break;
119  }
120  LogDebug("TrackRefitter") << "run the algorithm"
121  << "\n";
122  try {
124  theMF.product(),
125  *theTCollectionWithConstraint,
126  theFitter.product(),
127  thePropagator.product(),
128  theBuilder.product(),
129  bs,
130  algoResults);
131  } catch (cms::Exception& e) {
132  edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithTrack."
133  << "\n"
134  << e << "\n";
135  throw;
136  }
137  }
138  //default... there cannot be any other possibility due to the check in the ctor
139  }
140 
141  //put everything in th event
142  putInEvt(theEvent,
143  thePropagator.product(),
144  theMeasTk.product(),
145  outputRHColl,
146  outputTColl,
147  outputTEColl,
148  outputGsfTEColl,
149  outputTrajectoryColl,
150  algoResults,
151  theBuilder.product(),
152  bs,
153  httopo.product());
154  LogDebug("GsfTrackRefitter") << "end"
155  << "\n";
156 }

References cms::cuda::bs, TrackProducerBase< reco::GsfTrack >::bsSrc_, constraint_, MillePedeFileConverter_cfg::e, edm::HandleBase::failedToGet(), get, edm::Event::getByToken(), TrackProducerBase< reco::GsfTrack >::getFromES(), TrackProducerBase< reco::GsfTrack >::getFromEvt(), gsfTrackVtxConstraintTag_, edm::EventBase::id(), LogDebug, none, edm::ESHandle< T >::product(), GsfTrackProducerBase::putInEvt(), TrackProducerAlgorithm< T >::runWithTrack(), TrackProducerAlgorithm< T >::runWithVertex(), singleTopDQM_cfi::setup, theAlgo, and vertex.

Member Data Documentation

◆ constraint_

Constraint GsfTrackRefitter::constraint_
private

Definition at line 29 of file GsfTrackRefitter.h.

Referenced by GsfTrackRefitter(), and produce().

◆ gsfTrackVtxConstraintTag_

edm::EDGetTokenT<GsfTrackVtxConstraintAssociationCollection> GsfTrackRefitter::gsfTrackVtxConstraintTag_
private

Definition at line 30 of file GsfTrackRefitter.h.

Referenced by GsfTrackRefitter(), and produce().

◆ theAlgo

TrackProducerAlgorithm<reco::GsfTrack> GsfTrackRefitter::theAlgo
private

Definition at line 23 of file GsfTrackRefitter.h.

Referenced by produce().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
TrackProducerBase< reco::GsfTrack >::getFromES
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.
TrackProducerBase< reco::GsfTrack >::getFromEvt
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
TrackProducerAlgorithm::runWithVertex
void runWithVertex(const TrackingGeometry *, const MagneticField *, const VtxConstraintAssociationCollection &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
GsfTrackRefitter::vertex
Definition: GsfTrackRefitter.h:27
TrackProducerBase< reco::GsfTrack >::setConf
void setConf(const edm::ParameterSet &conf)
Set parameter set.
Definition: TrackProducerBase.h:71
edm::LogInfo
Definition: MessageLogger.h:254
reco::GsfTrackExtraCollection
std::vector< GsfTrackExtra > GsfTrackExtraCollection
collection of GsfTrackExtra objects
Definition: GsfTrackExtraFwd.h:9
GsfTrackRefitter::theAlgo
TrackProducerAlgorithm< reco::GsfTrack > theAlgo
Definition: GsfTrackRefitter.h:23
TrackProducerBase< reco::GsfTrack >::AlgoProductCollection
typename Base::AlgoProductCollection AlgoProductCollection
Definition: TrackProducerBase.h:44
edm::Handle
Definition: AssociativeIterator.h:50
GsfTrackRefitter::gsfTrackVtxConstraintTag_
edm::EDGetTokenT< GsfTrackVtxConstraintAssociationCollection > gsfTrackVtxConstraintTag_
Definition: GsfTrackRefitter.h:30
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
cms::cuda::bs
bs
Definition: HistoContainer.h:127
reco::BeamSpot
Definition: BeamSpot.h:21
edm::ESHandle< TrackerGeometry >
reco::TrackExtraCollection
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
TrackProducerBase< reco::GsfTrack >::setAlias
void setAlias(std::string alias)
set the aliases of produced collections
Definition: TrackProducerBase.h:83
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::View
Definition: CaloClusterFwd.h:14
edm::HandleBase::failedToGet
bool failedToGet() const
Definition: HandleBase.h:72
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
GsfTrackProducerBase::putInEvt
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.
Definition: GsfTrackProducerBase.cc:30
edm::LogError
Definition: MessageLogger.h:183
GsfTrackRefitter::constraint_
Constraint constraint_
Definition: GsfTrackRefitter.h:29
GsfTrackRefitter::none
Definition: GsfTrackRefitter.h:25
TrackProducerBase< reco::GsfTrack >::alias_
std::string alias_
Definition: TrackProducerBase.h:107
get
#define get
GsfTrackProducerBase::GsfTrackProducerBase
GsfTrackProducerBase(bool trajectoryInEvent, bool split)
Constructor.
Definition: GsfTrackProducerBase.h:29
TrackProducerBase< reco::GsfTrack >::setSrc
void setSrc(const edm::EDGetToken &src, const edm::EDGetTokenT< reco::BeamSpot > &bsSrc, const edm::EDGetTokenT< MeasurementTrackerEvent > &mteSrc)
set label of source collection
Definition: TrackProducerBase.h:74
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TrackProducerBase< reco::GsfTrack >::bsSrc_
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
Definition: TrackProducerBase.h:110
reco::GsfTrackCollection
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
Exception
Definition: hltDiff.cc:246
edm::EventBase::id
edm::EventID id() const
Definition: EventBase.h:59
cms::Exception
Definition: Exception.h:70
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
TrackProducerAlgorithm::runWithTrack
void runWithTrack(const TrackingGeometry *, const MagneticField *, const TrackView &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
Run the Final Fit taking Tracks as input (for Refitter)
edm::InputTag
Definition: InputTag.h:15
edm::OwnVector< TrackingRecHit >
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37