CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
GsfTrajectoryFitter Class Referencefinal

#include <GsfTrajectoryFitter.h>

Inheritance diagram for GsfTrajectoryFitter:
TrajectoryFitter

Public Member Functions

std::unique_ptr< TrajectoryFitterclone () const override
 
const MeasurementEstimatorestimator () const
 
Trajectory fitOne (const Trajectory &t, fitType type) const override
 
Trajectory fitOne (const TrajectorySeed &aSeed, const RecHitContainer &hits, const TrajectoryStateOnSurface &firstPredTsos, fitType type) const override
 
Trajectory fitOne (const TrajectorySeed &aSeed, const RecHitContainer &hits, fitType type) const override
 
 GsfTrajectoryFitter (const Propagator &aPropagator, const TrajectoryStateUpdator &aUpdator, const MeasurementEstimator &aEstimator, const MultiTrajectoryStateMerger &aMerger, const DetLayerGeometry *detLayerGeometry=0)
 
const MultiTrajectoryStateMergermerger () const
 
const Propagatorpropagator () const
 
void setHitCloner (TkCloner const *hc) override
 
const TrajectoryStateUpdatorupdator () const
 
 ~GsfTrajectoryFitter () override
 
- Public Member Functions inherited from TrajectoryFitter
std::vector< Trajectoryfit (const Trajectory &traj, fitType type=standard) const
 
std::vector< Trajectoryfit (const TrajectorySeed &seed, const RecHitContainer &hits, fitType type=standard) const
 
std::vector< Trajectoryfit (const TrajectorySeed &seed, const RecHitContainer &hits, const TrajectoryStateOnSurface &tsos, fitType type=standard) const
 
virtual ~TrajectoryFitter ()
 

Private Types

typedef TrajectoryMeasurement TM
 
typedef TrajectoryStateOnSurface TSOS
 

Private Attributes

const DetLayerGeometry dummyGeometry
 
const MeasurementEstimatortheEstimator
 
const DetLayerGeometrytheGeometry
 
TkCloner const * theHitCloner = 0
 
const MultiTrajectoryStateMergertheMerger
 
const PropagatorthePropagator
 
bool theTiming
 
const TrajectoryStateUpdatortheUpdator
 

Additional Inherited Members

- Public Types inherited from TrajectoryFitter
enum  fitType { standard =0, looper =1 }
 
typedef Trajectory::RecHitContainer RecHitContainer
 
typedef TrajectoryFitterRecord Record
 

Detailed Description

A GSF fitter, similar to KFTrajectoryFitter.

Definition at line 20 of file GsfTrajectoryFitter.h.

Member Typedef Documentation

Definition at line 24 of file GsfTrajectoryFitter.h.

Definition at line 23 of file GsfTrajectoryFitter.h.

Constructor & Destructor Documentation

GsfTrajectoryFitter::GsfTrajectoryFitter ( const Propagator aPropagator,
const TrajectoryStateUpdator aUpdator,
const MeasurementEstimator aEstimator,
const MultiTrajectoryStateMerger aMerger,
const DetLayerGeometry detLayerGeometry = 0 
)

Constructor with explicit components for propagation, update, chi2 calculation, merging and flag for merging before / after the update (i.e. fully configured)

Definition at line 15 of file GsfTrajectoryFitter.cc.

References dummyGeometry, and theGeometry.

Referenced by clone().

19  :
20  thePropagator(aPropagator.clone()),
21  theUpdator(aUpdator.clone()),
22  theEstimator(aEstimator.clone()),
23  theMerger(aMerger.clone()),
24  theGeometry(detLayerGeometry)
25 {
27 }
const Propagator * thePropagator
const MultiTrajectoryStateMerger * theMerger
virtual Propagator * clone() const =0
const DetLayerGeometry * theGeometry
const MeasurementEstimator * theEstimator
virtual MeasurementEstimator * clone() const =0
MultiTrajectoryStateMerger * clone() const
const TrajectoryStateUpdator * theUpdator
virtual TrajectoryStateUpdator * clone() const =0
const DetLayerGeometry dummyGeometry
GsfTrajectoryFitter::~GsfTrajectoryFitter ( )
override

Definition at line 29 of file GsfTrajectoryFitter.cc.

References theEstimator, theMerger, thePropagator, and theUpdator.

29  {
30  delete thePropagator;
31  delete theUpdator;
32  delete theEstimator;
33  delete theMerger;
34 }
const Propagator * thePropagator
const MultiTrajectoryStateMerger * theMerger
const MeasurementEstimator * theEstimator
const TrajectoryStateUpdator * theUpdator

Member Function Documentation

std::unique_ptr<TrajectoryFitter> GsfTrajectoryFitter::clone ( void  ) const
inlineoverridevirtual

Implements TrajectoryFitter.

Definition at line 54 of file GsfTrajectoryFitter.h.

References GsfTrajectoryFitter(), theEstimator, theGeometry, theMerger, thePropagator, and theUpdator.

55  {
56  return std::unique_ptr<TrajectoryFitter>(
58  *theUpdator,
59  *theEstimator,
60  *theMerger,
61  theGeometry));
62  }
const Propagator * thePropagator
const MultiTrajectoryStateMerger * theMerger
GsfTrajectoryFitter(const Propagator &aPropagator, const TrajectoryStateUpdator &aUpdator, const MeasurementEstimator &aEstimator, const MultiTrajectoryStateMerger &aMerger, const DetLayerGeometry *detLayerGeometry=0)
const DetLayerGeometry * theGeometry
const MeasurementEstimator * theEstimator
const TrajectoryStateUpdator * theUpdator
const MeasurementEstimator* GsfTrajectoryFitter::estimator ( void  ) const
inline

Definition at line 51 of file GsfTrajectoryFitter.h.

References theEstimator.

Referenced by fitOne().

51 {return theEstimator;}
const MeasurementEstimator * theEstimator
Trajectory GsfTrajectoryFitter::fitOne ( const Trajectory t,
fitType  type 
) const
overridevirtual

Implements TrajectoryFitter.

Definition at line 36 of file GsfTrajectoryFitter.cc.

References Trajectory::empty(), Trajectory::firstMeasurement(), Trajectory::recHits(), Trajectory::seed(), and TrajectoryMeasurement::updatedState().

36  {
37  if(aTraj.empty()) return Trajectory();
38 
39  TM const & firstTM = aTraj.firstMeasurement();
40  TSOS firstTsos = TrajectoryStateWithArbitraryError()(firstTM.updatedState());
41 
42  return fitOne(aTraj.seed(), aTraj.recHits(), firstTsos,type);
43 }
Trajectory fitOne(const Trajectory &t, fitType type) const override
type
Definition: HCALResponse.h:21
TrajectoryMeasurement TM
Trajectory GsfTrajectoryFitter::fitOne ( const TrajectorySeed aSeed,
const RecHitContainer hits,
const TrajectoryStateOnSurface firstPredTsos,
fitType  type 
) const
overridevirtual

Implements TrajectoryFitter.

Definition at line 54 of file GsfTrajectoryFitter.cc.

References vertices_cff::chi2, FrontierConditions_GlobalTag_cff::dump, MeasurementEstimator::estimate(), estimator(), Trajectory::foundHits(), DetLayerGeometry::idToLayer(), TrajectoryStateOnSurface::isValid(), LogDebug, TkCloner::makeShared(), MultiTrajectoryStateMerger::merge(), merger(), Propagator::propagate(), propagator(), Trajectory::push(), TrajectoryStateOnSurface::surface(), theGeometry, theHitCloner, TrajectoryStateUpdator::update(), and updator().

57  {
58 
59  if(hits.empty()) return Trajectory();
60 
61  Trajectory myTraj(aSeed, propagator()->propagationDirection());
62 
63  TSOS predTsos(firstPredTsos);
64  if(!predTsos.isValid()) {
65  edm::LogInfo("GsfTrackFitters")
66  << "GsfTrajectoryFitter: predicted tsos of first measurement not valid!";
67  return Trajectory();
68  }
69 
70  TSOS currTsos;
71  if(hits.front()->isValid()) {
72  auto const & ihit = hits.front();
73  //update
74  assert( (!(ihit)->canImproveWithTrack()) | (nullptr!=theHitCloner));
75  assert( (!(ihit)->canImproveWithTrack()) | (nullptr!=dynamic_cast<BaseTrackerRecHit const*>(ihit.get())));
76  auto preciseHit = theHitCloner->makeShared(ihit,predTsos);
77  dump(*preciseHit,1,"GsfTrackFitters");
78  {
79  currTsos = updator()->update(predTsos, *preciseHit);
80  }
81  if (!predTsos.isValid() || !currTsos.isValid()){
82  edm::LogError("InvalidState")<<"first hit";
83  return Trajectory();
84  }
85  myTraj.push(TM(predTsos, currTsos, preciseHit, 0., theGeometry->idToLayer(preciseHit->geographicalId() )),
86  estimator()->estimate(predTsos, *preciseHit).second);
87  } else {
88  currTsos = predTsos;
89  if (!predTsos.isValid()){
90  edm::LogError("InvalidState")<<"first invalid hit";
91  return Trajectory();
92  }
93  myTraj.push(TM(predTsos, hits.front(),0., theGeometry->idToLayer((hits.front())->geographicalId()) ));
94  }
95 
96  int hitcounter = 1;
97  for(RecHitContainer::const_iterator ihit = hits.begin() + 1;
98  ihit != hits.end(); ihit++) {
99  ++hitcounter;
100 
101  //
102  // temporary protection copied from KFTrajectoryFitter.
103  //
104  if ((**ihit).isValid() == false && (**ihit).det() == nullptr) {
105  LogDebug("GsfTrackFitters") << " Error: invalid hit with no GeomDet attached .... skipping";
106  continue;
107  }
108 
109  {
110  // TimeMe t(*propTimer,false);
111  predTsos = propagator()->propagate(currTsos,
112  (**ihit).det()->surface());
113  }
114  if(!predTsos.isValid()) {
115  if ( myTraj.foundHits()>=3 ) {
116  edm::LogInfo("GsfTrackFitters")
117  << "GsfTrajectoryFitter: predicted tsos not valid! \n"
118  << "Returning trajectory with " << myTraj.foundHits() << " found hits.";
119  return myTraj;
120  }
121  else {
122  edm::LogInfo("GsfTrackFitters")
123  << "GsfTrajectoryFitter: predicted tsos not valid after " << myTraj.foundHits()
124  << " hits, discarding candidate!";
125  return Trajectory();
126  }
127  }
128  if ( merger() ) predTsos = merger()->merge(predTsos);
129 
130  if((**ihit).isValid()) {
131  //update
132  assert( (!(*ihit)->canImproveWithTrack()) | (nullptr!=theHitCloner));
133  assert( (!(*ihit)->canImproveWithTrack()) | (nullptr!=dynamic_cast<BaseTrackerRecHit const*>((*ihit).get())));
134  auto preciseHit = theHitCloner->makeShared(*ihit,predTsos);
135  dump(*preciseHit,hitcounter,"GsfTrackFitters");
136  currTsos = updator()->update(predTsos, *preciseHit);
137  if (!predTsos.isValid() || !currTsos.isValid()){
138  edm::LogError("InvalidState")<<"inside hit";
139  return Trajectory();
140  }
141  auto chi2=estimator()->estimate(predTsos, *preciseHit).second;
142  myTraj.push(TM(predTsos, currTsos, preciseHit,
143  chi2,
144  theGeometry->idToLayer(preciseHit->geographicalId() )));
145  LogDebug("GsfTrackFitters") << "added measurement with chi2 " << chi2;
146  } else {
147  currTsos = predTsos;
148  if (!predTsos.isValid()){
149  edm::LogError("InvalidState")<<"inside invalid hit";
150  return Trajectory();
151  }
152  myTraj.push(TM(predTsos, *ihit,0., theGeometry->idToLayer( (*ihit)->geographicalId()) ));
153  }
154  dump(predTsos,"predTsos","GsfTrackFitters");
155  dump(currTsos,"currTsos","GsfTrackFitters");
156  }
157  return myTraj;
158 }
#define LogDebug(id)
TrajectoryStateOnSurface merge(const TrajectoryStateOnSurface &tsos) const
TrackingRecHit::ConstRecHitPointer makeShared(TrackingRecHit::ConstRecHitPointer const &hit, TrajectoryStateOnSurface const &tsos) const
Definition: TkCloner.h:23
const DetLayerGeometry * theGeometry
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
const SurfaceType & surface() const
TrajectoryMeasurement TM
const MultiTrajectoryStateMerger * merger() const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
const Propagator * propagator() const
const TrajectoryStateUpdator * updator() const
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
virtual const DetLayer * idToLayer(const DetId &detId) const
const MeasurementEstimator * estimator() const
TkCloner const * theHitCloner
Trajectory GsfTrajectoryFitter::fitOne ( const TrajectorySeed aSeed,
const RecHitContainer hits,
fitType  type 
) const
overridevirtual

Implements TrajectoryFitter.

Definition at line 45 of file GsfTrajectoryFitter.cc.

46  {
47 
48  edm::LogError("GsfTrajectoryFitter")
49  << "GsfTrajectoryFitter::fit(TrajectorySeed, vector<RecHit>) not implemented";
50 
51  return Trajectory();
52 }
const MultiTrajectoryStateMerger* GsfTrajectoryFitter::merger ( ) const
inline

Definition at line 52 of file GsfTrajectoryFitter.h.

References theMerger.

Referenced by fitOne().

52 {return theMerger;}
const MultiTrajectoryStateMerger * theMerger
const Propagator* GsfTrajectoryFitter::propagator ( ) const
inline

Definition at line 49 of file GsfTrajectoryFitter.h.

References thePropagator.

Referenced by fitOne().

49 {return thePropagator;}
const Propagator * thePropagator
void GsfTrajectoryFitter::setHitCloner ( TkCloner const *  hc)
inlineoverridevirtual

Implements TrajectoryFitter.

Definition at line 64 of file GsfTrajectoryFitter.h.

References AnalysisDataFormats_SUSYBSMObjects::hc, and theHitCloner.

64  {
65  theHitCloner = hc;
66  }
susybsm::HSCParticleCollection hc
Definition: classes.h:25
TkCloner const * theHitCloner
const TrajectoryStateUpdator* GsfTrajectoryFitter::updator ( ) const
inline

Definition at line 50 of file GsfTrajectoryFitter.h.

References theUpdator.

Referenced by fitOne().

50 {return theUpdator;}
const TrajectoryStateUpdator * theUpdator

Member Data Documentation

const DetLayerGeometry GsfTrajectoryFitter::dummyGeometry
private

Definition at line 75 of file GsfTrajectoryFitter.h.

Referenced by GsfTrajectoryFitter().

const MeasurementEstimator* GsfTrajectoryFitter::theEstimator
private

Definition at line 72 of file GsfTrajectoryFitter.h.

Referenced by clone(), estimator(), and ~GsfTrajectoryFitter().

const DetLayerGeometry* GsfTrajectoryFitter::theGeometry
private

Definition at line 76 of file GsfTrajectoryFitter.h.

Referenced by clone(), fitOne(), and GsfTrajectoryFitter().

TkCloner const* GsfTrajectoryFitter::theHitCloner = 0
private

Definition at line 74 of file GsfTrajectoryFitter.h.

Referenced by fitOne(), and setHitCloner().

const MultiTrajectoryStateMerger* GsfTrajectoryFitter::theMerger
private

Definition at line 73 of file GsfTrajectoryFitter.h.

Referenced by clone(), merger(), and ~GsfTrajectoryFitter().

const Propagator* GsfTrajectoryFitter::thePropagator
private

Definition at line 70 of file GsfTrajectoryFitter.h.

Referenced by clone(), propagator(), and ~GsfTrajectoryFitter().

bool GsfTrajectoryFitter::theTiming
private

Definition at line 78 of file GsfTrajectoryFitter.h.

const TrajectoryStateUpdator* GsfTrajectoryFitter::theUpdator
private

Definition at line 71 of file GsfTrajectoryFitter.h.

Referenced by clone(), updator(), and ~GsfTrajectoryFitter().