CMS 3D CMS Logo

List of all members | Public Member Functions
reco::KalmanGhostTrackUpdater Class Reference

#include <KalmanGhostTrackUpdater.h>

Inheritance diagram for reco::KalmanGhostTrackUpdater:
reco::GhostTrackFitter::PredictionUpdater

Public Member Functions

KalmanGhostTrackUpdaterclone () const override
 
void contribution (const GhostTrackPrediction &pred, const GhostTrackState &state, double &ndof, double &chi2, bool withPredError=false) const override
 
GhostTrackPrediction update (const GhostTrackPrediction &pred, const GhostTrackState &state, double &ndof, double &chi2) const override
 
 ~KalmanGhostTrackUpdater () override
 
- Public Member Functions inherited from reco::GhostTrackFitter::PredictionUpdater
virtual ~PredictionUpdater ()
 

Detailed Description

Definition at line 11 of file KalmanGhostTrackUpdater.h.

Constructor & Destructor Documentation

◆ ~KalmanGhostTrackUpdater()

reco::KalmanGhostTrackUpdater::~KalmanGhostTrackUpdater ( )
inlineoverride

Definition at line 13 of file KalmanGhostTrackUpdater.h.

13 {}

Member Function Documentation

◆ clone()

KalmanGhostTrackUpdater* reco::KalmanGhostTrackUpdater::clone ( void  ) const
inlineoverridevirtual

Implements reco::GhostTrackFitter::PredictionUpdater.

Definition at line 15 of file KalmanGhostTrackUpdater.h.

15 { return new KalmanGhostTrackUpdater(*this); }

◆ contribution()

void KalmanGhostTrackUpdater::contribution ( const GhostTrackPrediction pred,
const GhostTrackState state,
double &  ndof,
double &  chi2,
bool  withPredError = false 
) const
overridevirtual

Implements reco::GhostTrackFitter::PredictionUpdater.

Definition at line 124 of file KalmanGhostTrackUpdater.cc.

References nano_mu_local_reco_cff::chi2, and ndof.

128  {
129  using namespace ROOT::Math;
130 
131  KalmanState kalmanState(pred, state);
132 
133  // this is called on the full predicted state,
134  // so the residual is already with respect to the filtered state
135 
136  // inverted error
137  Matrix2S invErr = kalmanState.measErr;
138  if (withPredError)
139  invErr += kalmanState.measPredErr;
140  if (!invErr.Invert()) {
141  ndof = 0.;
142  chi2 = 0.;
143  }
144 
145  ndof = 2.;
146  chi2 = Similarity(kalmanState.residual, invErr);
147 }

◆ update()

GhostTrackPrediction KalmanGhostTrackUpdater::update ( const GhostTrackPrediction pred,
const GhostTrackState state,
double &  ndof,
double &  chi2 
) const
overridevirtual

Implements reco::GhostTrackFitter::PredictionUpdater.

Definition at line 84 of file KalmanGhostTrackUpdater.cc.

References nano_mu_local_reco_cff::chi2, reco::GhostTrackPrediction::covariance(), PedestalClient_cfi::gain, caHitNtupletGeneratorKernels::if(), ndof, and reco::GhostTrackPrediction::prediction().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

87  {
88  using namespace ROOT::Math;
89 
90  KalmanState kalmanState(pred, state);
91 
92  if (state.weight() < 1.0e-3)
93  return pred;
94 
95  // inverted combined error
96  Matrix2S invErr = kalmanState.measPredErr + (1.0 / state.weight()) * kalmanState.measErr;
97  if (!invErr.Invert())
98  return pred;
99 
100  // gain
101  Matrix42 gain = pred.covariance() * Transpose(kalmanState.h) * invErr;
102 
103  // new prediction
104  Vector4 newPred = pred.prediction() + (gain * kalmanState.residual);
105  Matrix44 tmp44 = SMatrixIdentity();
106  tmp44 = (tmp44 - gain * kalmanState.h) * pred.covariance();
107  Matrix4S newError(tmp44.LowerBlock());
108 
109  // filtered residuals
110  Matrix22 tmp22 = SMatrixIdentity();
111  tmp22 = tmp22 - kalmanState.h * gain;
112  Vector2 filtRes = tmp22 * kalmanState.residual;
113  tmp22 *= kalmanState.measErr;
114  Matrix2S filtResErr(tmp22.LowerBlock());
115  if (!filtResErr.Invert())
116  return pred;
117 
118  ndof += state.weight() * 2.;
119  chi2 += state.weight() * Similarity(filtRes, filtResErr);
120 
121  return GhostTrackPrediction(newPred, newError);
122 }
const Vector & prediction() const
const Error & covariance() const