CMS 3D CMS Logo

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

#include <GsfTrajectorySmoother.h>

Inheritance diagram for GsfTrajectorySmoother:
TrajectorySmoother

Public Member Functions

GsfTrajectorySmootherclone () const override
 
const MeasurementEstimatorestimator () const
 
 GsfTrajectorySmoother (const GsfPropagatorWithMaterial &aPropagator, const TrajectoryStateUpdator &aUpdator, const MeasurementEstimator &aEstimator, const MultiTrajectoryStateMerger &merger, float errorRescaling, const bool materialBeforeUpdate=true, const DetLayerGeometry *detLayerGeometry=nullptr)
 
void setHitCloner (TkCloner const *hc) override
 
Trajectory trajectory (const Trajectory &aTraj) const override
 
const TrajectoryStateUpdatorupdator () const
 
 ~GsfTrajectorySmoother () override
 
- Public Member Functions inherited from TrajectorySmoother
virtual TrajectoryContainer trajectories (const Trajectory &traj) const
 
virtual ~TrajectorySmoother ()
 

Private Types

typedef TrajectoryMeasurement TM
 
typedef TrajectoryStateOnSurface TSOS
 

Private Attributes

const DetLayerGeometry dummyGeometry
 
const GsfPropagatorWithMaterialtheAlongPropagator
 
const FullConvolutionWithMaterialtheConvolutor
 
float theErrorRescaling
 
const MeasurementEstimatortheEstimator
 
const DetLayerGeometrytheGeometry
 
const GsfPropagatorAdaptertheGeomPropagator
 
bool theMatBeforeUpdate
 
const MultiTrajectoryStateMergertheMerger
 
const GsfPropagatorWithMaterialtheOppositePropagator
 
bool theTiming
 
const TrajectoryStateUpdatortheUpdator
 

Additional Inherited Members

- Public Types inherited from TrajectorySmoother
typedef std::vector< TrajectoryTrajectoryContainer
 
typedef TrajectoryContainer::iterator TrajectoryIterator
 

Detailed Description

A GSF smoother, similar to KFTrajectorySmoother, but (for testing purposes) without combination with the forward fit.

Definition at line 21 of file GsfTrajectorySmoother.h.

Member Typedef Documentation

◆ TM

Definition at line 24 of file GsfTrajectorySmoother.h.

◆ TSOS

Definition at line 23 of file GsfTrajectorySmoother.h.

Constructor & Destructor Documentation

◆ GsfTrajectorySmoother()

GsfTrajectorySmoother::GsfTrajectorySmoother ( const GsfPropagatorWithMaterial aPropagator,
const TrajectoryStateUpdator aUpdator,
const MeasurementEstimator aEstimator,
const MultiTrajectoryStateMerger merger,
float  errorRescaling,
const bool  materialBeforeUpdate = true,
const DetLayerGeometry detLayerGeometry = nullptr 
)

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

Definition at line 11 of file GsfTrajectorySmoother.cc.

18  : theAlongPropagator(nullptr),
19  theOppositePropagator(nullptr),
20  theGeomPropagator(nullptr),
21  theConvolutor(nullptr),
22  theUpdator(aUpdator.clone()),
23  theEstimator(aEstimator.clone()),
24  theMerger(aMerger.clone()),
25  theMatBeforeUpdate(materialBeforeUpdate),
27  theGeometry(detLayerGeometry) {
28  auto p = aPropagator.clone();
29  p->setPropagationDirection(alongMomentum);
31  p = aPropagator.clone();
32  p->setPropagationDirection(oppositeToMomentum);
34  if (!theMatBeforeUpdate) {
37  }
38 
39  if (!theGeometry)
41 }

References alongMomentum, FullConvolutionWithMaterial::clone(), GsfPropagatorWithMaterial::clone(), GsfPropagatorWithMaterial::convolutionWithMaterial(), dummyGeometry, GsfPropagatorWithMaterial::geometricalPropagator(), oppositeToMomentum, AlCaHLTBitMon_ParallelJobs::p, theAlongPropagator, theConvolutor, theGeometry, theGeomPropagator, theMatBeforeUpdate, and theOppositePropagator.

Referenced by clone().

◆ ~GsfTrajectorySmoother()

GsfTrajectorySmoother::~GsfTrajectorySmoother ( )
override

Definition at line 43 of file GsfTrajectorySmoother.cc.

43  {
44  delete theAlongPropagator;
45  delete theOppositePropagator;
46  delete theGeomPropagator;
47  delete theConvolutor;
48  delete theUpdator;
49  delete theEstimator;
50  delete theMerger;
51 }

References theAlongPropagator, theConvolutor, theEstimator, theGeomPropagator, theMerger, theOppositePropagator, and theUpdator.

Member Function Documentation

◆ clone()

GsfTrajectorySmoother* GsfTrajectorySmoother::clone ( void  ) const
inlineoverridevirtual

◆ estimator()

const MeasurementEstimator* GsfTrajectorySmoother::estimator ( void  ) const
inline

Definition at line 43 of file GsfTrajectorySmoother.h.

43 { return theEstimator; }

References theEstimator.

Referenced by trajectory().

◆ setHitCloner()

void GsfTrajectorySmoother::setHitCloner ( TkCloner const *  hc)
inlineoverridevirtual

Implements TrajectorySmoother.

Definition at line 50 of file GsfTrajectorySmoother.h.

50 {}

◆ trajectory()

Trajectory GsfTrajectorySmoother::trajectory ( const Trajectory aTraj) const
overridevirtual

Implements TrajectorySmoother.

Definition at line 53 of file GsfTrajectorySmoother.cc.

53  {
54  if (aTraj.empty())
55  return Trajectory();
56 
57  const Propagator* usePropagator = theAlongPropagator;
58  if (aTraj.direction() == alongMomentum) {
59  usePropagator = theOppositePropagator;
60  }
61  if (not usePropagator) {
62  usePropagator = theGeomPropagator;
63  }
64 
65  Trajectory myTraj(aTraj.seed(), usePropagator->propagationDirection());
66 
67  std::vector<TM> const& avtm = aTraj.measurements();
68 
69  TSOS predTsos = avtm.back().forwardPredictedState();
71 
72  if (!predTsos.isValid()) {
73  edm::LogInfo("GsfTrackFitters") << "GsfTrajectorySmoother: predicted tsos of last measurement not valid!";
74  return Trajectory();
75  }
76  TSOS currTsos;
77 
78  //first smoothed tm is last fitted
79  if (avtm.back().recHit()->isValid()) {
80  {
81  // TimeMe t(*updateTimer,false);
82  currTsos = updator()->update(predTsos, *avtm.back().recHit());
83  }
84 
85  if (!currTsos.isValid()) {
86  edm::LogInfo("GsfTrajectorySmoother") << "GsfTrajectorySmoother: tsos not valid after update!";
87  return Trajectory();
88  }
89 
90  //check validity
91  if (!avtm.back().forwardPredictedState().isValid() || !predTsos.isValid() ||
92  !avtm.back().updatedState().isValid()) {
93  edm::LogError("InvalidState") << "first hit";
94  return Trajectory();
95  }
96 
97  myTraj.push(TM(avtm.back().forwardPredictedState(),
98  predTsos,
99  avtm.back().updatedState(),
100  avtm.back().recHit(),
101  avtm.back().estimate(),
102  theGeometry->idToLayer(avtm.back().recHit()->geographicalId())),
103  avtm.back().estimate());
104  } else {
105  currTsos = predTsos;
106  //check validity
107  if (!avtm.back().forwardPredictedState().isValid()) {
108  edm::LogError("InvalidState") << "first hit on invalid hit";
109  return Trajectory();
110  }
111 
112  myTraj.push(TM(avtm.back().forwardPredictedState(),
113  avtm.back().recHit(),
114  0.,
115  theGeometry->idToLayer(avtm.back().recHit()->geographicalId())));
116  }
117 
119 
120  int hitcounter = avtm.size() - 1;
121  for (std::vector<TM>::const_reverse_iterator itm = avtm.rbegin() + 1; itm < avtm.rend() - 1; ++itm) {
122  predTsos = usePropagator->propagate(currTsos, *(*itm).recHit()->surface());
123  if (predTsos.isValid() && theConvolutor && theMatBeforeUpdate)
124  predTsos = (*theConvolutor)(predTsos, usePropagator->propagationDirection());
125  if (!predTsos.isValid()) {
126  edm::LogInfo("GsfTrackFitters") << "GsfTrajectorySmoother: predicted tsos not valid!";
127  return Trajectory();
128  }
129  if (theMerger)
130  predTsos = theMerger->merge(predTsos);
131 
132  if ((*itm).recHit()->isValid()) {
133  //update
134  currTsos = updator()->update(predTsos, *(*itm).recHit());
135 
136  if (currTsos.isValid() && theConvolutor && !theMatBeforeUpdate)
137  currTsos = (*theConvolutor)(currTsos, usePropagator->propagationDirection());
138  if (!currTsos.isValid()) {
139  edm::LogInfo("GsfTrackFitters") << "GsfTrajectorySmoother: tsos not valid after update / material effects!";
140  return Trajectory();
141  }
142  //3 different possibilities to calculate smoothed state:
143  //1: update combined predictions with hit
144  //2: combine fwd-prediction with bwd-filter
145  //3: combine bwd-prediction with fwd-filter
146  TSOS combTsos = combiner(predTsos, (*itm).forwardPredictedState());
147  if (!combTsos.isValid()) {
148  LogDebug("GsfTrackFitters") << "KFTrajectorySmoother: combined tsos not valid!\n"
149  << "pred Tsos pos: " << predTsos.globalPosition() << "\n"
150  << "pred Tsos mom: " << predTsos.globalMomentum() << "\n"
151  << "TrackingRecHit: "
152  << (*itm).recHit()->surface()->toGlobal((*itm).recHit()->localPosition()) << "\n";
153  return Trajectory();
154  }
155 
156  TSOS smooTsos = combiner((*itm).updatedState(), predTsos);
157 
158  if (!smooTsos.isValid()) {
159  LogDebug("GsfTrackFitters") << "KFTrajectorySmoother: smoothed tsos not valid!";
160  return Trajectory();
161  }
162 
163  if (!(*itm).forwardPredictedState().isValid() || !predTsos.isValid() || !smooTsos.isValid()) {
164  edm::LogError("InvalidState") << "inside hits with combination.";
165  return Trajectory();
166  }
167 
168  auto chi2 = estimator()->estimate(combTsos, *(*itm).recHit()).second;
169  myTraj.push(TM((*itm).forwardPredictedState(),
170  predTsos,
171  smooTsos,
172  (*itm).recHit(),
173  chi2,
174  theGeometry->idToLayer((*itm).recHit()->geographicalId())),
175  (*itm).estimate());
176  LogDebug("GsfTrackFitters") << "added measurement #" << hitcounter-- << " with chi2 " << chi2;
177  dump(predTsos, "predTsos", "GsfTrackFitters");
178  dump(smooTsos, "smooTsos", "GsfTrackFitters");
179 
180  } else {
181  currTsos = predTsos;
182  TSOS combTsos = combiner(predTsos, (*itm).forwardPredictedState());
183 
184  if (!combTsos.isValid()) {
185  LogDebug("GsfTrackFitters") << "KFTrajectorySmoother: combined tsos not valid!";
186  return Trajectory();
187  }
188 
189  if (!(*itm).forwardPredictedState().isValid() || !predTsos.isValid() || !combTsos.isValid()) {
190  edm::LogError("InvalidState") << "inside hits with invalid rechit.";
191  return Trajectory();
192  }
193 
194  myTraj.push(TM((*itm).forwardPredictedState(),
195  predTsos,
196  combTsos,
197  (*itm).recHit(),
198  0.,
199  theGeometry->idToLayer((*itm).recHit()->geographicalId())));
200  LogDebug("GsfTrackFitters") << "added invalid measurement #" << hitcounter--;
201  dump(predTsos, "predTsos", "GsfTrackFitters");
202  dump(combTsos, "smooTsos", "GsfTrackFitters");
203  }
204  if (theMerger)
205  currTsos = theMerger->merge(currTsos);
206 
207  dump(currTsos, "currTsos", "GsfTrackFitters");
208  }
209 
210  //last smoothed tm is last filtered
211  predTsos = usePropagator->propagate(currTsos, *avtm.front().recHit()->surface());
212  if (predTsos.isValid() && theConvolutor && theMatBeforeUpdate)
213  predTsos = (*theConvolutor)(predTsos, usePropagator->propagationDirection());
214  if (!predTsos.isValid()) {
215  edm::LogInfo("GsfTrackFitters") << "GsfTrajectorySmoother: predicted tsos not valid!";
216  return Trajectory();
217  }
218  if (theMerger)
219  predTsos = theMerger->merge(predTsos);
220 
221  if (avtm.front().recHit()->isValid()) {
222  //update
223  currTsos = updator()->update(predTsos, *avtm.front().recHit());
224  if (currTsos.isValid() && theConvolutor && !theMatBeforeUpdate)
225  currTsos = (*theConvolutor)(currTsos, usePropagator->propagationDirection());
226  if (!currTsos.isValid()) {
227  edm::LogInfo("GsfTrackFitters") << "GsfTrajectorySmoother: tsos not valid after update / material effects!";
228  return Trajectory();
229  }
230 
231  if (!avtm.front().forwardPredictedState().isValid() || !predTsos.isValid() || !currTsos.isValid()) {
232  edm::LogError("InvalidState") << "last hit";
233  return Trajectory();
234  }
235 
236  auto chi2 = estimator()->estimate(predTsos, *avtm.front().recHit()).second;
237  myTraj.push(TM(avtm.front().forwardPredictedState(),
238  predTsos,
239  currTsos,
240  avtm.front().recHit(),
241  chi2,
242  theGeometry->idToLayer(avtm.front().recHit()->geographicalId())),
243  avtm.front().estimate());
244  LogDebug("GsfTrackFitters") << "added measurement #" << hitcounter-- << " with chi2 " << chi2;
245  dump(predTsos, "predTsos", "GsfTrackFitters");
246  dump(currTsos, "smooTsos", "GsfTrackFitters");
247 
248  } else {
249  if (!avtm.front().forwardPredictedState().isValid()) {
250  edm::LogError("InvalidState") << "last invalid hit";
251  return Trajectory();
252  }
253  myTraj.push(TM(avtm.front().forwardPredictedState(),
254  avtm.front().recHit(),
255  0.,
256  theGeometry->idToLayer(avtm.front().recHit()->geographicalId())));
257  LogDebug("GsfTrackFitters") << "added invalid measurement #" << hitcounter--;
258  }
259 
260  return myTraj;
261 }

References alongMomentum, hltPixelTracks_cff::chi2, heavyFlavorValidationHarvestingSequence_cff::combiner, Trajectory::direction(), FrontierConditions_GlobalTag_cff::dump, Trajectory::empty(), MeasurementEstimator::estimate(), TrajectoryMeasurement::estimate(), estimator(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), DetLayerGeometry::idToLayer(), TrajectoryStateOnSurface::isValid(), LogDebug, Trajectory::measurements(), MultiTrajectoryStateMerger::merge(), TrajectoryStateOnSurface::rescaleError(), edm::second(), Trajectory::seed(), TrajectoryStateOnSurface::surface(), theAlongPropagator, theConvolutor, theErrorRescaling, theGeometry, theGeomPropagator, theMatBeforeUpdate, theMerger, theOppositePropagator, TrajectoryStateUpdator::update(), and updator().

◆ updator()

const TrajectoryStateUpdator* GsfTrajectorySmoother::updator ( ) const
inline

Definition at line 42 of file GsfTrajectorySmoother.h.

42 { return theUpdator; }

References theUpdator.

Referenced by trajectory().

Member Data Documentation

◆ dummyGeometry

const DetLayerGeometry GsfTrajectorySmoother::dummyGeometry
private

Definition at line 65 of file GsfTrajectorySmoother.h.

Referenced by GsfTrajectorySmoother().

◆ theAlongPropagator

const GsfPropagatorWithMaterial* GsfTrajectorySmoother::theAlongPropagator
private

◆ theConvolutor

const FullConvolutionWithMaterial* GsfTrajectorySmoother::theConvolutor
private

◆ theErrorRescaling

float GsfTrajectorySmoother::theErrorRescaling
private

Definition at line 63 of file GsfTrajectorySmoother.h.

Referenced by clone(), and trajectory().

◆ theEstimator

const MeasurementEstimator* GsfTrajectorySmoother::theEstimator
private

Definition at line 58 of file GsfTrajectorySmoother.h.

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

◆ theGeometry

const DetLayerGeometry* GsfTrajectorySmoother::theGeometry
private

Definition at line 66 of file GsfTrajectorySmoother.h.

Referenced by clone(), GsfTrajectorySmoother(), and trajectory().

◆ theGeomPropagator

const GsfPropagatorAdapter* GsfTrajectorySmoother::theGeomPropagator
private

◆ theMatBeforeUpdate

bool GsfTrajectorySmoother::theMatBeforeUpdate
private

Definition at line 62 of file GsfTrajectorySmoother.h.

Referenced by clone(), GsfTrajectorySmoother(), and trajectory().

◆ theMerger

const MultiTrajectoryStateMerger* GsfTrajectorySmoother::theMerger
private

Definition at line 59 of file GsfTrajectorySmoother.h.

Referenced by clone(), trajectory(), and ~GsfTrajectorySmoother().

◆ theOppositePropagator

const GsfPropagatorWithMaterial* GsfTrajectorySmoother::theOppositePropagator
private

◆ theTiming

bool GsfTrajectorySmoother::theTiming
private

Definition at line 61 of file GsfTrajectorySmoother.h.

◆ theUpdator

const TrajectoryStateUpdator* GsfTrajectorySmoother::theUpdator
private

Definition at line 57 of file GsfTrajectorySmoother.h.

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

GsfTrajectorySmoother::theMatBeforeUpdate
bool theMatBeforeUpdate
Definition: GsfTrajectorySmoother.h:62
Trajectory::direction
PropagationDirection const & direction() const
Definition: Trajectory.cc:133
GsfTrajectorySmoother::dummyGeometry
const DetLayerGeometry dummyGeometry
Definition: GsfTrajectorySmoother.h:65
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
edm::LogInfo
Definition: MessageLogger.h:254
GsfTrajectorySmoother::estimator
const MeasurementEstimator * estimator() const
Definition: GsfTrajectorySmoother.h:43
oppositeToMomentum
Definition: PropagationDirection.h:4
DetLayerGeometry::idToLayer
virtual const DetLayer * idToLayer(const DetId &detId) const
Definition: DetLayerGeometry.h:33
GsfPropagatorWithMaterial::geometricalPropagator
const Propagator & geometricalPropagator() const
Access to the geometrical propagator.
Definition: GsfPropagatorWithMaterial.h:75
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
GsfTrajectorySmoother::GsfTrajectorySmoother
GsfTrajectorySmoother(const GsfPropagatorWithMaterial &aPropagator, const TrajectoryStateUpdator &aUpdator, const MeasurementEstimator &aEstimator, const MultiTrajectoryStateMerger &merger, float errorRescaling, const bool materialBeforeUpdate=true, const DetLayerGeometry *detLayerGeometry=nullptr)
Definition: GsfTrajectorySmoother.cc:11
MultiTrajectoryStateMerger::merge
TrajectoryStateOnSurface merge(const TrajectoryStateOnSurface &tsos) const
Definition: MultiTrajectoryStateMerger.cc:4
GsfTrajectorySmoother::theAlongPropagator
const GsfPropagatorWithMaterial * theAlongPropagator
Definition: GsfTrajectorySmoother.h:53
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
TrajectoryStateUpdator::clone
virtual TrajectoryStateUpdator * clone() const =0
GsfTrajectorySmoother::theErrorRescaling
float theErrorRescaling
Definition: GsfTrajectorySmoother.h:63
MeasurementEstimator::clone
virtual MeasurementEstimator * clone() const =0
GsfTrajectorySmoother::updator
const TrajectoryStateUpdator * updator() const
Definition: GsfTrajectorySmoother.h:42
GsfTrajectorySmoother::TM
TrajectoryMeasurement TM
Definition: GsfTrajectorySmoother.h:24
MeasurementEstimator::estimate
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
Propagator
Definition: Propagator.h:44
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
GsfPropagatorWithMaterial::convolutionWithMaterial
const FullConvolutionWithMaterial & convolutionWithMaterial() const
Access to the convolutor and thus to the material effects.
Definition: GsfPropagatorWithMaterial.h:77
GsfTrajectorySmoother::theUpdator
const TrajectoryStateUpdator * theUpdator
Definition: GsfTrajectorySmoother.h:57
HLTSiStripMonitoring_cff.errorRescaling
errorRescaling
Definition: HLTSiStripMonitoring_cff.py:192
GsfTrajectorySmoother::theGeometry
const DetLayerGeometry * theGeometry
Definition: GsfTrajectorySmoother.h:66
GsfPropagatorWithMaterial::clone
GsfPropagatorWithMaterial * clone() const override
Definition: GsfPropagatorWithMaterial.h:79
TrajectoryStateUpdator::update
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
GsfTrajectorySmoother::theEstimator
const MeasurementEstimator * theEstimator
Definition: GsfTrajectorySmoother.h:58
TrajectoryStateCombiner
Definition: TrajectoryStateCombiner.h:13
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::LogError
Definition: MessageLogger.h:183
FrontierConditions_GlobalTag_cff.dump
dump
Definition: FrontierConditions_GlobalTag_cff.py:12
Trajectory::measurements
DataContainer const & measurements() const
Definition: Trajectory.h:178
TrajectoryStateOnSurface::rescaleError
void rescaleError(double factor)
Definition: TrajectoryStateOnSurface.h:82
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
GsfTrajectorySmoother::theOppositePropagator
const GsfPropagatorWithMaterial * theOppositePropagator
Definition: GsfTrajectorySmoother.h:54
TrajectoryMeasurement::estimate
float estimate() const
Definition: TrajectoryMeasurement.h:192
Trajectory
Definition: Trajectory.h:38
GsfTrajectorySmoother::theConvolutor
const FullConvolutionWithMaterial * theConvolutor
Definition: GsfTrajectorySmoother.h:56
Trajectory::seed
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:263
heavyFlavorValidationHarvestingSequence_cff.combiner
combiner
Definition: heavyFlavorValidationHarvestingSequence_cff.py:107
GsfPropagatorAdapter
Definition: GsfPropagatorAdapter.h:14
GsfTrajectorySmoother::theMerger
const MultiTrajectoryStateMerger * theMerger
Definition: GsfTrajectorySmoother.h:59
GsfTrajectorySmoother::theGeomPropagator
const GsfPropagatorAdapter * theGeomPropagator
Definition: GsfTrajectorySmoother.h:55
alongMomentum
Definition: PropagationDirection.h:4
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
FullConvolutionWithMaterial::clone
FullConvolutionWithMaterial * clone() const
Clone.
Definition: FullConvolutionWithMaterial.h:29
Trajectory::empty
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:233