CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes
GsfTrajectoryFitter Class Reference

#include <GsfTrajectoryFitter.h>

Inheritance diagram for GsfTrajectoryFitter:
TrajectoryFitter

Public Member Functions

virtual std::unique_ptr
< TrajectoryFitter
clone () const override
 
const MeasurementEstimatorestimator () const
 
Trajectory fitOne (const Trajectory &t, fitType type) const
 
Trajectory fitOne (const TrajectorySeed &aSeed, const RecHitContainer &hits, const TrajectoryStateOnSurface &firstPredTsos, fitType type) const
 
Trajectory fitOne (const TrajectorySeed &aSeed, const RecHitContainer &hits, fitType type) const
 
 GsfTrajectoryFitter (const Propagator &aPropagator, const TrajectoryStateUpdator &aUpdator, const MeasurementEstimator &aEstimator, const MultiTrajectoryStateMerger &aMerger, const DetLayerGeometry *detLayerGeometry=0)
 
const MultiTrajectoryStateMergermerger () const
 
const Propagatorpropagator () const
 
virtual void setHitCloner (TkCloner const *hc)
 
const TrajectoryStateUpdatorupdator () const
 
virtual ~GsfTrajectoryFitter ()
 
- 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 17 of file GsfTrajectoryFitter.cc.

References dummyGeometry, and theGeometry.

Referenced by clone().

21  :
22  thePropagator(aPropagator.clone()),
23  theUpdator(aUpdator.clone()),
24  theEstimator(aEstimator.clone()),
25  theMerger(aMerger.clone()),
26  theGeometry(detLayerGeometry)
27 {
29  // static SimpleConfigurable<bool> timeConf(false,"GsfTrajectoryFitter:activateTiming");
30  // theTiming = timeConf.value();
31 }
const Propagator * thePropagator
const MultiTrajectoryStateMerger * theMerger
virtual TrajectoryStateUpdator * clone() const =0
virtual Propagator * clone() const =0
const DetLayerGeometry * theGeometry
const MeasurementEstimator * theEstimator
virtual MeasurementEstimator * clone() const =0
MultiTrajectoryStateMerger * clone() const
const TrajectoryStateUpdator * theUpdator
const DetLayerGeometry dummyGeometry
GsfTrajectoryFitter::~GsfTrajectoryFitter ( )
virtual

Definition at line 33 of file GsfTrajectoryFitter.cc.

References theEstimator, theMerger, thePropagator, and theUpdator.

33  {
34  delete thePropagator;
35  delete theUpdator;
36  delete theEstimator;
37  delete theMerger;
38 }
const Propagator * thePropagator
const MultiTrajectoryStateMerger * theMerger
const MeasurementEstimator * theEstimator
const TrajectoryStateUpdator * theUpdator

Member Function Documentation

virtual 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
virtual

Implements TrajectoryFitter.

Definition at line 40 of file GsfTrajectoryFitter.cc.

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

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

!! no invalid hits on cylinders anymore??

Implements TrajectoryFitter.

Definition at line 58 of file GsfTrajectoryFitter.cc.

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

61  {
62 
63  // static TimingReport::Item* propTimer =
64  // &(*TimingReport::current())[string("GsfTrajectoryFitter:propagation")];
65  // propTimer->switchCPU(false);
66  // if ( !theTiming ) propTimer->switchOn(false);
67  // static TimingReport::Item* updateTimer =
68  // &(*TimingReport::current())[string("GsfTrajectoryFitter:update")];
69  // updateTimer->switchCPU(false);
70  // if ( !theTiming ) updateTimer->switchOn(false);
71 
72  if(hits.empty()) return Trajectory();
73 
74  Trajectory myTraj(aSeed, propagator()->propagationDirection());
75 
76  TSOS predTsos(firstPredTsos);
77  if(!predTsos.isValid()) {
78  edm::LogInfo("GsfTrajectoryFitter")
79  << "GsfTrajectoryFitter: predicted tsos of first measurement not valid!";
80  return Trajectory();
81  }
82 
83  TSOS currTsos;
84  if(hits.front()->isValid()) {
85  auto const & ihit = hits.front();
86  //update
87  assert( (!(ihit)->canImproveWithTrack()) | (nullptr!=theHitCloner));
88  assert( (!(ihit)->canImproveWithTrack()) | (nullptr!=dynamic_cast<BaseTrackerRecHit const*>(ihit.get())));
89  auto preciseHit = theHitCloner->makeShared(ihit,predTsos);
90  {
91  // TimeMe t(*updateTimer,false);
92  currTsos = updator()->update(predTsos, *preciseHit);
93  }
94  if (!predTsos.isValid() || !currTsos.isValid()){
95  edm::LogError("InvalidState")<<"first hit";
96  return Trajectory();
97  }
98  myTraj.push(TM(predTsos, currTsos, preciseHit, 0., theGeometry->idToLayer(preciseHit->geographicalId() )),
99  estimator()->estimate(predTsos, *preciseHit).second);
100  } else {
101  currTsos = predTsos;
102  if (!predTsos.isValid()){
103  edm::LogError("InvalidState")<<"first invalid hit";
104  return Trajectory();
105  }
106  myTraj.push(TM(predTsos, *hits.begin(),0., theGeometry->idToLayer((*hits.begin())->geographicalId()) ));
107  }
108 
109  for(RecHitContainer::const_iterator ihit = hits.begin() + 1;
110  ihit != hits.end(); ihit++) {
111  //
112  // temporary protection copied from KFTrajectoryFitter.
113  //
114  if ((**ihit).isValid() == false && (**ihit).det() == 0) {
115  LogDebug("GsfTrajectoryFitter") << " Error: invalid hit with no GeomDet attached .... skipping";
116  continue;
117  }
118 
120  // //
121  // // check type of surface in case of invalid hit
122  // // (in this version only propagations to planes are
123  // // supported for multi trajectory states)
124  // //
125  // if ( !(**ihit).isValid() ) {
126  // const BoundPlane* plane =
127  // dynamic_cast<const BoundPlane*>(&(**ihit).det().surface());
128  // //
129  // // no plane: insert invalid measurement
130  // //
131  // if ( plane==0 ) {
132  // myTraj.push(TM(TrajectoryStateOnSurface(),&(**ihit)));
133  // continue;
134  // }
135  // }
136  {
137  // TimeMe t(*propTimer,false);
138  predTsos = propagator()->propagate(currTsos,
139  (**ihit).det()->surface());
140  }
141  if(!predTsos.isValid()) {
142  if ( myTraj.foundHits()>=3 ) {
143  edm::LogInfo("GsfTrajectoryFitter")
144  << "GsfTrajectoryFitter: predicted tsos not valid! \n"
145  << "Returning trajectory with " << myTraj.foundHits() << " found hits.";
146  return myTraj;
147  }
148  else {
149  edm::LogInfo("GsfTrajectoryFitter")
150  << "GsfTrajectoryFitter: predicted tsos not valid after " << myTraj.foundHits()
151  << " hits, discarding candidate!";
152  return Trajectory();
153  }
154  }
155  if ( merger() ) predTsos = merger()->merge(predTsos);
156 
157  if((**ihit).isValid()) {
158  //update
159  assert( (!(*ihit)->canImproveWithTrack()) | (nullptr!=theHitCloner));
160  assert( (!(*ihit)->canImproveWithTrack()) | (nullptr!=dynamic_cast<BaseTrackerRecHit const*>((*ihit).get())));
161  auto preciseHit = theHitCloner->makeShared(*ihit,predTsos);
162  {
163  // TimeMe t(*updateTimer,false);
164  currTsos = updator()->update(predTsos, *preciseHit);
165  }
166  if (!predTsos.isValid() || !currTsos.isValid()){
167  edm::LogError("InvalidState")<<"inside hit";
168  return Trajectory();
169  }
170  myTraj.push(TM(predTsos, currTsos, preciseHit,
171  estimator()->estimate(predTsos, *preciseHit).second,
172  theGeometry->idToLayer(preciseHit->geographicalId() )));
173  } else {
174  currTsos = predTsos;
175  if (!predTsos.isValid()){
176  edm::LogError("InvalidState")<<"inside invalid hit";
177  return Trajectory();
178  }
179  myTraj.push(TM(predTsos, *ihit,0., theGeometry->idToLayer( (*ihit)->geographicalId()) ));
180  }
181  }
182  return myTraj;
183 }
#define LogDebug(id)
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
Definition: Propagator.h:119
assert(m_qm.get())
TrajectoryStateOnSurface merge(const TrajectoryStateOnSurface &tsos) const
const DetLayerGeometry * theGeometry
U second(std::pair< T, U > const &p)
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
const SurfaceType & surface() const
TrajectoryMeasurement TM
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
const MultiTrajectoryStateMerger * merger() const
TrackingRecHit *operator()[[cms TrackingRecHit::ConstRecHitPointer makeShared(TrackingRecHit::ConstRecHitPointer const &hit, TrajectoryStateOnSurface const &tsos) const
Definition: TkCloner.h:22
const Propagator * propagator() const
const TrajectoryStateUpdator * updator() const
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
virtual

Implements TrajectoryFitter.

Definition at line 49 of file GsfTrajectoryFitter.cc.

50  {
51 
52  edm::LogError("GsfTrajectoryFitter")
53  << "GsfTrajectoryFitter::fit(TrajectorySeed, vector<RecHit>) not implemented";
54 
55  return Trajectory();
56 }
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
virtual void GsfTrajectoryFitter::setHitCloner ( TkCloner const *  hc)
inlinevirtual

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().