CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 initTrackProducerBase (const edm::ParameterSet &conf, edm::ConsumesCollector cc, const edm::EDGetToken &src)
 Call this method in inheriting class' constructor. More...
 
void setAlias (std::string alias)
 set the aliases of produced collections More...
 
void setSecondHitPattern (Trajectory *traj, reco::GsfTrack &track, const Propagator *prop, const MeasurementTrackerEvent *measTk, const TrackerTopology *ttopo)
 
 TrackProducerBase (bool trajectoryInEvent=false)
 Constructor. More...
 
virtual ~TrackProducerBase () noexcept(false)
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Types

enum  Constraint { none, vertex }
 

Private Attributes

Constraint constraint_
 
edm::EDGetTokenT
< GsfTrackVtxConstraintAssociationCollection
gsfTrackVtxConstraintTag_
 
TrackProducerAlgorithm
< reco::GsfTrack
theAlgo
 

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<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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::ESGetToken
< TransientTrackingRecHitBuilder,
TransientRecHitRecord
builderSrc_
 
edm::ParameterSet conf_
 
edm::ESGetToken
< TrajectoryFitter,
TrajectoryFitter::Record
fitterSrc_
 
edm::ESGetToken
< MeasurementTracker,
CkfComponentsRecord
measTkSrc_
 
edm::ESGetToken< MagneticField,
IdealMagneticFieldRecord
mfSrc_
 
edm::EDGetTokenT
< MeasurementTrackerEvent
mteSrc_
 
edm::ESGetToken< Propagator,
TrackingComponentsRecord
propagatorSrc_
 
edm::OrphanHandle
< TrackCollection
rTracks_
 
edm::ESGetToken
< NavigationSchool,
NavigationSchoolRecord
schoolSrc_
 
edm::EDGetToken src_
 
edm::ESHandle< NavigationSchooltheSchool
 
edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
trackGeomSrc_
 
bool trajectoryInEvent_
 
bool useSchool_
 

Detailed Description

Refit GSF Tracks. Based on the TrackRefitter.

Definition at line 14 of file GsfTrackRefitter.h.

Member Enumeration Documentation

Enumerator
none 
vertex 

Definition at line 24 of file GsfTrackRefitter.h.

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

Constructor & Destructor Documentation

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

Constructor.

Definition at line 18 of file GsfTrackRefitter.cc.

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

19  : GsfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),
20  iConfig.getParameter<bool>("useHitsSplitting")),
21  theAlgo(iConfig) {
23  iConfig, consumesCollector(), consumes<edm::View<reco::GsfTrack>>(iConfig.getParameter<edm::InputTag>("src")));
24  setAlias(iConfig.getParameter<std::string>("@module_label"));
25  std::string constraint_str = iConfig.getParameter<std::string>("constraint");
26 
27  if (constraint_str.empty())
28  constraint_ = none;
29  // else if (constraint_str == "momentum") constraint_ = momentum;
30  else if (constraint_str == "vertex") {
32  gsfTrackVtxConstraintTag_ = consumes<GsfTrackVtxConstraintAssociationCollection>(
33  iConfig.getParameter<edm::InputTag>("gsfTrackVtxConstraintTag"));
34  } else {
35  edm::LogError("GsfTrackRefitter") << "constraint: " << constraint_str
36  << " not understood. Set it to 'momentum', 'vertex' or leave it empty";
37  throw cms::Exception("GsfTrackRefitter")
38  << "unknown type of contraint! Set it to 'momentum', 'vertex' or leave it empty";
39  }
40 
41  //register your products
42  produces<reco::GsfTrackCollection>().setBranchAlias(alias_ + "GsfTracks");
43  produces<reco::TrackExtraCollection>().setBranchAlias(alias_ + "TrackExtras");
44  produces<reco::GsfTrackExtraCollection>().setBranchAlias(alias_ + "GsfTrackExtras");
45  produces<TrackingRecHitCollection>().setBranchAlias(alias_ + "RecHits");
46  produces<std::vector<Trajectory>>();
47  produces<TrajGsfTrackAssociationCollection>();
48 }
Constraint constraint_
void initTrackProducerBase(const edm::ParameterSet &conf, edm::ConsumesCollector cc, const edm::EDGetToken &src)
Call this method in inheriting class&#39; constructor.
Log< level::Error, false > LogError
void setAlias(std::string alias)
set the aliases of produced collections
GsfTrackProducerBase(bool trajectoryInEvent, bool split)
Constructor.
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackProducerAlgorithm< reco::GsfTrack > theAlgo
edm::EDGetTokenT< GsfTrackVtxConstraintAssociationCollection > gsfTrackVtxConstraintTag_

Member Function Documentation

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

Implementation of produce method.

Implements TrackProducerBase< reco::GsfTrack >.

Definition at line 50 of file GsfTrackRefitter.cc.

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

50  {
51  edm::LogInfo("GsfTrackRefitter") << "Analyzing event number: " << theEvent.id() << "\n";
52  //
53  // create empty output collections
54  //
55  std::unique_ptr<TrackingRecHitCollection> outputRHColl(new TrackingRecHitCollection);
56  std::unique_ptr<reco::GsfTrackCollection> outputTColl(new reco::GsfTrackCollection);
57  std::unique_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
58  std::unique_ptr<reco::GsfTrackExtraCollection> outputGsfTEColl(new reco::GsfTrackExtraCollection);
59  std::unique_ptr<std::vector<Trajectory>> outputTrajectoryColl(new std::vector<Trajectory>);
60 
61  //
62  //declare and get stuff to be retrieved from ES
63  //
67  edm::ESHandle<Propagator> thePropagator;
69  // getFromES(setup,theG,theMF,theFitter,thePropagator);
71  getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
72 
74  setup.get<TrackerTopologyRcd>().get(httopo);
75 
76  //
77  //declare and get TrackCollection to be retrieved from the event
78  //
79  AlgoProductCollection algoResults;
81  switch (constraint_) {
82  case none: {
84  getFromEvt(theEvent, theTCollection, bs);
85  if (theTCollection.failedToGet()) {
86  edm::LogError("GsfTrackRefitter") << "could not get the reco::GsfTrackCollection.";
87  return;
88  }
89  LogDebug("GsfTrackRefitter") << "run the algorithm"
90  << "\n";
91  try {
93  theMF.product(),
94  *theTCollection,
95  theFitter.product(),
96  thePropagator.product(),
97  theBuilder.product(),
98  bs,
99  algoResults);
100  } catch (cms::Exception& e) {
101  edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithTrack."
102  << "\n"
103  << e << "\n";
104  throw;
105  }
106  break;
107  }
108  case vertex: {
109  edm::Handle<GsfTrackVtxConstraintAssociationCollection> theTCollectionWithConstraint;
110  theEvent.getByToken(gsfTrackVtxConstraintTag_, theTCollectionWithConstraint);
111  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
112  theEvent.getByToken(bsSrc_, recoBeamSpotHandle);
113  bs = *recoBeamSpotHandle;
114  if (theTCollectionWithConstraint.failedToGet()) {
115  edm::LogError("TrackRefitter") << "could not get TrackVtxConstraintAssociationCollection product.";
116  break;
117  }
118  LogDebug("TrackRefitter") << "run the algorithm"
119  << "\n";
120  try {
122  theMF.product(),
123  *theTCollectionWithConstraint,
124  theFitter.product(),
125  thePropagator.product(),
126  theBuilder.product(),
127  bs,
128  algoResults);
129  } catch (cms::Exception& e) {
130  edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithTrack."
131  << "\n"
132  << e << "\n";
133  throw;
134  }
135  }
136  //default... there cannot be any other possibility due to the check in the ctor
137  }
138 
139  //put everything in th event
140  putInEvt(theEvent,
141  thePropagator.product(),
142  theMeasTk.product(),
143  outputRHColl,
144  outputTColl,
145  outputTEColl,
146  outputGsfTEColl,
147  outputTrajectoryColl,
148  algoResults,
149  theBuilder.product(),
150  bs,
151  httopo.product());
152  LogDebug("GsfTrackRefitter") << "end"
153  << "\n";
154 }
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
typename Base::AlgoProductCollection AlgoProductCollection
Constraint constraint_
std::vector< GsfTrackExtra > GsfTrackExtraCollection
collection of GsfTrackExtra objects
Log< level::Error, false > LogError
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)
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.
Log< level::Info, false > LogInfo
void runWithVertex(const TrackingGeometry *, const MagneticField *, const VtxConstraintAssociationCollection &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
bool failedToGet() const
Definition: HandleBase.h:72
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
edm::EventID id() const
Definition: EventBase.h:59
T get() const
Definition: EventSetup.h:88
TrackProducerAlgorithm< reco::GsfTrack > theAlgo
edm::EDGetTokenT< GsfTrackVtxConstraintAssociationCollection > gsfTrackVtxConstraintTag_
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)

Member Data Documentation

Constraint GsfTrackRefitter::constraint_
private

Definition at line 29 of file GsfTrackRefitter.h.

Referenced by GsfTrackRefitter(), and produce().

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

Definition at line 30 of file GsfTrackRefitter.h.

Referenced by GsfTrackRefitter(), and produce().

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

Definition at line 23 of file GsfTrackRefitter.h.

Referenced by produce().