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

reco::KalmanGhostTrackUpdater::~KalmanGhostTrackUpdater ( )
inlineoverride

Definition at line 13 of file KalmanGhostTrackUpdater.h.

13 {}

Member Function Documentation

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

Implements reco::GhostTrackFitter::PredictionUpdater.

Definition at line 15 of file KalmanGhostTrackUpdater.h.

References hltPixelTracks_cff::chi2, contribution(), ndof, and update().

15 { return new KalmanGhostTrackUpdater(*this); }
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.

Referenced by clone().

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 }
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 reco::GhostTrackPrediction::covariance(), PedestalClient_cfi::gain, reco::GhostTrackPrediction::prediction(), and reco::GhostTrackState::weight().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), clone(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

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 }
double weight() const
const Vector & prediction() const
const Error & covariance() const