FairRoot/PandaRoot
|
Generic Kalman Filter implementation. More...
#include <GFKalman.h>
Public Member Functions | |
GFKalman () | |
~GFKalman () | |
void | operator() (GFTrack *track) |
Operator for use with STL. More... | |
void | operator() (std::pair< int, GFTrack * > tr) |
Operator for use with STL. More... | |
void | setLazy (Int_t) |
Switch lazy error handling. More... | |
void | setNumIterations (Int_t i) |
Set number of iterations for Kalman Filter. More... | |
void | processTrack (GFTrack *trk) |
Performs fit on a GFTrack. More... | |
void | fittingPass (GFTrack *, int dir) |
Performs fit on a GFTrack beginning with the current hit. More... | |
double | getChi2Hit (GFAbsRecoHit *, GFAbsTrackRep *) |
Calculates chi2 of a given hit with respect to a given track representation. More... | |
void | setInitialDirection (int d) |
Sets the inital direction of the track fit (1 for inner to outer, or -1 for outer to inner). The standard is 1 and is set in the ctor. More... | |
void | setBlowUpFactor (double f) |
Set the blowup factor (see blowUpCovs() ) More... | |
Private Member Functions | |
void | processHit (GFTrack *, int, int, int) |
One Kalman step. More... | |
void | switchDirection (GFTrack *trk) |
Used to switch between forward and backward filtering. More... | |
TMatrixT< double > | calcGain (const TMatrixT< double > &cov, const TMatrixT< double > &HitCov, const TMatrixT< double > &H) |
Calculate Kalman Gain. More... | |
double | chi2Increment (const TMatrixT< double > &r, const TMatrixT< double > &H, const TMatrixT< double > &cov, const TMatrixT< double > &V) |
this returns the reduced chi2 increment for a hit More... | |
void | blowUpCovs (GFTrack *trk) |
this is needed to blow up the covariance matrix before a fitting pass drops off-diagonal elements and blows up diagonal by blowUpFactor More... | |
Private Attributes | |
int | fInitialDirection |
Int_t | fNumIt |
double | fBlowUpFactor |
bool | fSmooth |
Generic Kalman Filter implementation.
The Kalman Filter operates on genfit GFTrack objects. It is an implementation of the Kalman Filter algebra that uses the genfit interface classes GFAbsRecoHit and GFAbsTrackRep in order to be independent from the specific detector geometry and the details of the track parameterization / track extraoplation engine.
The Kalman Filter can use hits from several detectors in a single fit to estimate the parameters of several track representations in parallel.
Definition at line 50 of file GFKalman.h.
GFKalman::GFKalman | ( | ) |
Definition at line 36 of file GFKalman.cxx.
GFKalman::~GFKalman | ( | ) |
Definition at line 38 of file GFKalman.cxx.
|
private |
this is needed to blow up the covariance matrix before a fitting pass drops off-diagonal elements and blows up diagonal by blowUpFactor
Definition at line 128 of file GFKalman.cxx.
References GFTrack::blowUpCovs(), and fBlowUpFactor.
Referenced by processTrack().
|
private |
Calculate Kalman Gain.
Definition at line 327 of file GFKalman.cxx.
References GFTools::invertMatrix().
Referenced by processHit().
|
private |
this returns the reduced chi2 increment for a hit
Definition at line 178 of file GFKalman.cxx.
References GFTools::invertMatrix(), r, R, GFException::setFatal(), and GFException::setMatrices().
Referenced by getChi2Hit(), and processHit().
void GFKalman::fittingPass | ( | GFTrack * | trk, |
int | dir | ||
) |
Performs fit on a GFTrack beginning with the current hit.
Definition at line 133 of file GFKalman.cxx.
References GFTrack::addFailedHit(), GFBookkeeping::clearFailedHits(), GFTrack::getBK(), GFTrack::getNextHitToFit(), GFTrack::getNumHits(), GFTrack::getNumReps(), GFAbsTrackRep::getStatusFlag(), GFTrack::getTrackRep(), GFException::info(), GFException::isFatal(), nhits, processHit(), GFAbsTrackRep::setChiSqu(), GFAbsTrackRep::setNDF(), GFTrack::setNextHitToFit(), GFAbsTrackRep::setStatusFlag(), and GFException::what().
Referenced by processTrack().
double GFKalman::getChi2Hit | ( | GFAbsRecoHit * | hit, |
GFAbsTrackRep * | rep | ||
) |
Calculates chi2 of a given hit with respect to a given track representation.
Definition at line 215 of file GFKalman.cxx.
References chi2Increment(), GFAbsTrackRep::extrapolate(), GFAbsRecoHit::getDetPlane(), GFAbsTrackRep::getDim(), GFAbsRecoHit::getHitCov(), GFAbsRecoHit::getHMatrix(), r, and GFAbsRecoHit::residualVector().
|
inline |
Operator for use with STL.
This operator allows to use the std::foreach algorithm with an STL container o GFTrack* objects.
Definition at line 65 of file GFKalman.h.
References processTrack().
|
inline |
Operator for use with STL.
This operator allows to use the std::foreach algorithm with an STL container o GFTrack* objects.
Definition at line 72 of file GFKalman.h.
References processTrack().
|
private |
One Kalman step.
Performs
Definition at line 240 of file GFKalman.cxx.
References GFAbsTrackRep::addChiSqu(), GFAbsTrackRep::addNDF(), calcGain(), chi2Increment(), COVEXC, GFAbsTrackRep::extrapolate(), fSmooth, GFAbsTrackRep::getAuxInfo(), GFTrack::getBK(), GFAbsTrackRep::getCov(), GFAbsRecoHit::getDetPlane(), GFAbsTrackRep::getDim(), GFTrack::getHit(), GFAbsRecoHit::getHitCov(), GFAbsRecoHit::getHMatrix(), GFAbsTrackRep::getReferencePlane(), GFTrack::getRepAtHit(), GFAbsTrackRep::getState(), GFTrack::getTrackRep(), GFAbsTrackRep::hasAuxInfo(), hit(), r, res, GFAbsRecoHit::residualVector(), GFAbsTrackRep::setData(), GFBookkeeping::setDetPlane(), GFBookkeeping::setMatrix(), GFTrack::setRepAtHit(), and update().
Referenced by fittingPass().
void GFKalman::processTrack | ( | GFTrack * | trk | ) |
Performs fit on a GFTrack.
The hits are processed in the order in which they are stored in the GFTrack object. Sorting of hits in space has to be done before!
Definition at line 40 of file GFKalman.cxx.
References blowUpCovs(), GFBookkeeping::bookGFDetPlanes(), GFBookkeeping::bookMatrices(), GFTrack::clearRepAtHit(), fInitialDirection, fittingPass(), fNumIt, fSmooth, GFTrack::getBK(), GFAbsTrackRep::getCov(), GFBookkeeping::getMatrixKeys(), GFTrack::getNumHits(), GFTrack::getNumReps(), GFAbsTrackRep::getReferencePlane(), GFTrack::getSmoothing(), GFAbsTrackRep::getState(), GFTrack::getTrackRep(), GFAbsTrackRep::hasAuxInfo(), i, GFTrack::setNextHitToFit(), GFBookkeeping::setNhits(), and switchDirection().
Referenced by PndHypKalmanTask::Exec(), PndHypDKalmanTask::Exec(), PndLmdKalmanTask::Exec(), PndRecoKalmanFit::Fit(), operator()(), and GFDaf::processTrack().
|
inline |
Set the blowup factor (see blowUpCovs() )
Definition at line 111 of file GFKalman.h.
References f, and fBlowUpFactor.
|
inline |
Sets the inital direction of the track fit (1 for inner to outer, or -1 for outer to inner). The standard is 1 and is set in the ctor.
Definition at line 107 of file GFKalman.h.
References d, and fInitialDirection.
|
inline |
Switch lazy error handling.
This is a historically left-over method and shall be deleted some time
Definition at line 80 of file GFKalman.h.
|
inline |
Set number of iterations for Kalman Filter.
One iteration is one forward pass plus one backward pass
Definition at line 86 of file GFKalman.h.
Referenced by PndHypDKalmanTask::Exec(), PndLmdKalmanTask::Exec(), GFDaf::GFDaf(), and PndRecoKalmanFit::Init().
|
private |
Used to switch between forward and backward filtering.
Definition at line 121 of file GFKalman.cxx.
References GFTrack::getNumReps(), GFTrack::getTrackRep(), i, and GFAbsTrackRep::switchDirection().
Referenced by processTrack().
|
private |
Definition at line 147 of file GFKalman.h.
Referenced by blowUpCovs(), and setBlowUpFactor().
|
private |
Definition at line 145 of file GFKalman.h.
Referenced by processTrack(), and setInitialDirection().
|
private |
Definition at line 146 of file GFKalman.h.
Referenced by processTrack(), and setNumIterations().
|
private |
Definition at line 148 of file GFKalman.h.
Referenced by processHit(), and processTrack().