test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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

Detailed Description

Definition at line 11 of file KalmanGhostTrackUpdater.h.

Constructor & Destructor Documentation

virtual reco::KalmanGhostTrackUpdater::~KalmanGhostTrackUpdater ( )
inlinevirtual

Definition at line 13 of file KalmanGhostTrackUpdater.h.

13 {}

Member Function Documentation

virtual KalmanGhostTrackUpdater* reco::KalmanGhostTrackUpdater::clone ( void  ) const
inlinevirtual

Implements reco::GhostTrackFitter::PredictionUpdater.

Definition at line 15 of file KalmanGhostTrackUpdater.h.

16  { return new KalmanGhostTrackUpdater(*this); }
void KalmanGhostTrackUpdater::contribution ( const GhostTrackPrediction pred,
const GhostTrackState state,
double &  ndof,
double &  chi2,
bool  withPredError = false 
) const
virtual

Implements reco::GhostTrackFitter::PredictionUpdater.

Definition at line 129 of file KalmanGhostTrackUpdater.cc.

134 {
135  using namespace ROOT::Math;
136 
137  KalmanState kalmanState(pred, state);
138 
139  // this is called on the full predicted state,
140  // so the residual is already with respect to the filtered state
141 
142  // inverted error
143  Matrix2S invErr = kalmanState.measErr;
144  if (withPredError)
145  invErr += kalmanState.measPredErr;
146  if (!invErr.Invert()) {
147  ndof = 0.;
148  chi2 = 0.;
149  }
150 
151  ndof = 2.;
152  chi2 = Similarity(kalmanState.residual, invErr);
153 }
GhostTrackPrediction KalmanGhostTrackUpdater::update ( const GhostTrackPrediction pred,
const GhostTrackState state,
double &  ndof,
double &  chi2 
) const
virtual

Implements reco::GhostTrackFitter::PredictionUpdater.

Definition at line 87 of file KalmanGhostTrackUpdater.cc.

References reco::GhostTrackPrediction::covariance(), citk::if(), reco::GhostTrackPrediction::prediction(), and reco::GhostTrackState::weight().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), 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().

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