CMS 3D CMS Logo

Public Member Functions

reco::KalmanGhostTrackUpdater Class Reference

#include <KalmanGhostTrackUpdater.h>

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

List of all members.

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

Detailed Description

Definition at line 11 of file KalmanGhostTrackUpdater.h.


Constructor & Destructor Documentation

virtual reco::KalmanGhostTrackUpdater::~KalmanGhostTrackUpdater ( ) [inline, virtual]

Definition at line 13 of file KalmanGhostTrackUpdater.h.

{}

Member Function Documentation

virtual KalmanGhostTrackUpdater* reco::KalmanGhostTrackUpdater::clone ( void  ) const [inline, virtual]

Implements reco::GhostTrackFitter::PredictionUpdater.

Definition at line 15 of file KalmanGhostTrackUpdater.h.

        { 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 128 of file KalmanGhostTrackUpdater.cc.

{
        using namespace ROOT::Math;

        KalmanState kalmanState(pred, state);

        // this is called on the full predicted state,
        // so the residual is already with respect to the filtered state

        // inverted error
        Matrix2S invErr = kalmanState.measErr;
        if (withPredError)
                invErr += kalmanState.measPredErr;
        if (!invErr.Invert()) {
                ndof = 0.;
                chi2 = 0.;
        }

        ndof = 2.;
        chi2 = Similarity(kalmanState.residual, invErr);
}                            
GhostTrackPrediction KalmanGhostTrackUpdater::update ( const GhostTrackPrediction pred,
const GhostTrackState state,
double &  ndof,
double &  chi2 
) const [virtual]

Implements reco::GhostTrackFitter::PredictionUpdater.

Definition at line 86 of file KalmanGhostTrackUpdater.cc.

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

{
        using namespace ROOT::Math;

        KalmanState kalmanState(pred, state);

        if (state.weight() < 1.0e-3)
                return pred;

        // inverted combined error
        Matrix2S invErr = kalmanState.measPredErr +
                          (1.0 / state.weight()) * kalmanState.measErr;
        if (!invErr.Invert())
                return pred;

        // gain
        Matrix42 gain = pred.covariance() * Transpose(kalmanState.h) * invErr;

        // new prediction
        Vector4 newPred = pred.prediction() + (gain * kalmanState.residual);
        Matrix44 tmp44 = SMatrixIdentity();
        tmp44 = (tmp44 - gain * kalmanState.h) * pred.covariance();
        Matrix4S newError(tmp44.LowerBlock());

        // filtered residuals
        Matrix22 tmp22 = SMatrixIdentity();
        tmp22 = tmp22 - kalmanState.h * gain;
        Vector2 filtRes = tmp22 * kalmanState.residual;
        tmp22 *= kalmanState.measErr;
        Matrix2S filtResErr(tmp22.LowerBlock());
        if (!filtResErr.Invert())
                return pred;

        ndof += state.weight() * 2.;
        chi2 += state.weight() * Similarity(filtRes, filtResErr);

        return GhostTrackPrediction(newPred, newError);
}