FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
genfit::KalmanFitterRefTrack Class Reference

Kalman filter implementation with linearization around a reference track. More...

#include <KalmanFitterRefTrack.h>

Inheritance diagram for genfit::KalmanFitterRefTrack:
genfit::AbsKalmanFitter genfit::AbsFitter

Public Member Functions

 KalmanFitterRefTrack (unsigned int maxIterations=4, double deltaPval=1e-3, double blowUpFactor=1e3)
 
virtual ~KalmanFitterRefTrack ()
 
TrackPointfitTrack (Track *tr, const AbsTrackRep *rep, double &chi2, double &ndf, int direction)
 Fit the track. More...
 
void processTrackWithRep (Track *tr, const AbsTrackRep *rep, bool resortHits=false)
 
bool prepareTrack (Track *tr, const AbsTrackRep *rep, bool setSortingParams, int &nFailedHits)
 Prepare the track. More...
 
void setRefitAll (bool refit=true)
 If true always refit all points, otherwise fit points only if reference states have changed. More...
 
void setDeltaChi2Ref (double dChi2)
 
void getChiSquNdf (const Track *tr, const AbsTrackRep *rep, double &bChi2, double &fChi2, double &bNdf, double &fNdf) const
 
double getChiSqu (const Track *tr, const AbsTrackRep *rep, int direction=-1) const
 
double getNdf (const Track *tr, const AbsTrackRep *rep, int direction=-1) const
 
double getRedChiSqu (const Track *tr, const AbsTrackRep *rep, int direction=-1) const
 
double getPVal (const Track *tr, const AbsTrackRep *rep, int direction=-1) const
 
unsigned int getMinIterations () const
 
unsigned int getMaxIterations () const
 
double getDeltaPval () const
 
double getRelChi2Change () const
 
double getBlowUpFactor () const
 
bool getResetOffDiagonals () const
 
double getBlowUpMaxVal () const
 
eMultipleMeasurementHandling getMultipleMeasurementHandling () const
 
int getMaxFailedHits () const
 
virtual void setMinIterations (unsigned int n)
 Set the minimum number of iterations. More...
 
virtual void setMaxIterations (unsigned int n)
 Set the maximum number of iterations. More...
 
void setDeltaPval (double deltaPval)
 Set Convergence criterion. More...
 
void setRelChi2Change (double relChi2Change)
 
void setBlowUpFactor (double blowUpFactor)
 
void setResetOffDiagonals (bool resetOffDiagonals)
 
void setBlowUpMaxVal (double blowUpMaxVal)
 Limit the cov entries to this maximum value when blowing up the cov. Set to negative value to disable. Default is 1.E6. More...
 
void setMultipleMeasurementHandling (eMultipleMeasurementHandling mmh)
 How should multiple measurements be handled? More...
 
virtual void setMaxFailedHits (int val)
 
bool isTrackPrepared (const Track *tr, const AbsTrackRep *rep) const
 
bool isTrackFitted (const Track *tr, const AbsTrackRep *rep) const
 
bool canIgnoreWeights () const
 returns if the fitter can ignore the weights and handle the MeasurementOnPlanes as if they had weight 1. More...
 
void processTrack (Track *, bool resortHits=false)
 
virtual void setDebugLvl (unsigned int lvl=1)
 

Protected Member Functions

const std::vector
< MeasurementOnPlane * > 
getMeasurements (const KalmanFitterInfo *fi, const TrackPoint *tp, int direction) const
 get the measurementsOnPlane taking the multipleMeasurementHandling_ into account More...
 

Protected Attributes

unsigned int minIterations_
 Minimum number of iterations to attempt. Forward and backward are counted as one iteration. More...
 
unsigned int maxIterations_
 Maximum number of iterations to attempt. Forward and backward are counted as one iteration. More...
 
double deltaPval_
 Convergence criterion. More...
 
double relChi2Change_
 
double blowUpFactor_
 Blow up the covariance of the forward (backward) fit by this factor before seeding the backward (forward) fit. More...
 
bool resetOffDiagonals_
 Reset the off-diagonals to 0 when blowing up the cov. More...
 
double blowUpMaxVal_
 Limit the cov entries to this maxuimum value when blowing up the cov. More...
 
eMultipleMeasurementHandling multipleMeasurementHandling_
 How to handle if there are multiple MeasurementsOnPlane. More...
 
int maxFailedHits_
 
unsigned int debugLvl_
 

Private Member Functions

void processTrackPoint (KalmanFitterInfo *fi, const KalmanFitterInfo *prevFi, const TrackPoint *tp, double &chi2, double &ndf, int direction)
 
bool removeOutdated (Track *tr, const AbsTrackRep *rep, int &notChangedUntil, int &notChangedFrom)
 Remove referenceStates if they are too far from smoothed states. More...
 
void removeForwardBackwardInfo (Track *tr, const AbsTrackRep *rep, int notChangedUntil, int notChangedFrom) const
 If refitAll_, remove all information. More...
 

Private Attributes

bool refitAll_
 
double deltaChi2Ref_
 
TMatrixD FTransportMatrix_
 
TMatrixD BTransportMatrix_
 
TMatrixDSym FNoiseMatrix_
 
TMatrixDSym BNoiseMatrix_
 
TVectorD forwardDeltaState_
 
TVectorD backwardDeltaState_
 
TVectorD p_
 
TMatrixDSym C_
 
TMatrixDSym covSumInv_
 
TMatrixDSym Rinv_
 
TVectorD res_
 
TVectorD resM_
 

Detailed Description

Kalman filter implementation with linearization around a reference track.

Definition at line 37 of file KalmanFitterRefTrack.h.

Constructor & Destructor Documentation

genfit::KalmanFitterRefTrack::KalmanFitterRefTrack ( unsigned int  maxIterations = 4,
double  deltaPval = 1e-3,
double  blowUpFactor = 1e3 
)
inline

Definition at line 39 of file KalmanFitterRefTrack.h.

40  : AbsKalmanFitter(maxIterations, deltaPval, blowUpFactor), refitAll_(false), deltaChi2Ref_(1) {}
AbsKalmanFitter(unsigned int maxIterations=4, double deltaPval=1e-3, double blowUpFactor=1e3)
virtual genfit::KalmanFitterRefTrack::~KalmanFitterRefTrack ( )
inlinevirtual

Definition at line 42 of file KalmanFitterRefTrack.h.

42 {}

Member Function Documentation

bool genfit::AbsKalmanFitter::canIgnoreWeights ( ) const
inherited

returns if the fitter can ignore the weights and handle the MeasurementOnPlanes as if they had weight 1.

TrackPoint* genfit::KalmanFitterRefTrack::fitTrack ( Track tr,
const AbsTrackRep rep,
double &  chi2,
double &  ndf,
int  direction 
)

Fit the track.

Needs a prepared track! Return last TrackPoint that has been processed.

double genfit::AbsKalmanFitter::getBlowUpFactor ( ) const
inlineinherited

Definition at line 78 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::blowUpFactor_.

78 {return blowUpFactor_;}
double blowUpFactor_
Blow up the covariance of the forward (backward) fit by this factor before seeding the backward (forw...
double genfit::AbsKalmanFitter::getBlowUpMaxVal ( ) const
inlineinherited

Definition at line 80 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::blowUpMaxVal_.

80 {return blowUpMaxVal_;}
double blowUpMaxVal_
Limit the cov entries to this maxuimum value when blowing up the cov.
double genfit::AbsKalmanFitter::getChiSqu ( const Track tr,
const AbsTrackRep rep,
int  direction = -1 
) const
inherited
void genfit::AbsKalmanFitter::getChiSquNdf ( const Track tr,
const AbsTrackRep rep,
double &  bChi2,
double &  fChi2,
double &  bNdf,
double &  fNdf 
) const
inherited
double genfit::AbsKalmanFitter::getDeltaPval ( ) const
inlineinherited

Definition at line 76 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::deltaPval_.

76 {return deltaPval_;}
double deltaPval_
Convergence criterion.
int genfit::AbsKalmanFitter::getMaxFailedHits ( ) const
inlineinherited

Definition at line 82 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::maxFailedHits_.

unsigned int genfit::AbsKalmanFitter::getMaxIterations ( ) const
inlineinherited

Definition at line 75 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::maxIterations_.

75 {return maxIterations_;}
unsigned int maxIterations_
Maximum number of iterations to attempt. Forward and backward are counted as one iteration.
const std::vector<MeasurementOnPlane *> genfit::AbsKalmanFitter::getMeasurements ( const KalmanFitterInfo fi,
const TrackPoint tp,
int  direction 
) const
protectedinherited

get the measurementsOnPlane taking the multipleMeasurementHandling_ into account

unsigned int genfit::AbsKalmanFitter::getMinIterations ( ) const
inlineinherited

Definition at line 74 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::minIterations_.

74 {return minIterations_;}
unsigned int minIterations_
Minimum number of iterations to attempt. Forward and backward are counted as one iteration.
eMultipleMeasurementHandling genfit::AbsKalmanFitter::getMultipleMeasurementHandling ( ) const
inlineinherited

Definition at line 81 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::multipleMeasurementHandling_.

eMultipleMeasurementHandling multipleMeasurementHandling_
How to handle if there are multiple MeasurementsOnPlane.
double genfit::AbsKalmanFitter::getNdf ( const Track tr,
const AbsTrackRep rep,
int  direction = -1 
) const
inherited
double genfit::AbsKalmanFitter::getPVal ( const Track tr,
const AbsTrackRep rep,
int  direction = -1 
) const
inherited
double genfit::AbsKalmanFitter::getRedChiSqu ( const Track tr,
const AbsTrackRep rep,
int  direction = -1 
) const
inherited
double genfit::AbsKalmanFitter::getRelChi2Change ( ) const
inlineinherited

Definition at line 77 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::relChi2Change_.

77 {return relChi2Change_;}
bool genfit::AbsKalmanFitter::getResetOffDiagonals ( ) const
inlineinherited

Definition at line 79 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::resetOffDiagonals_.

79 {return resetOffDiagonals_;}
bool resetOffDiagonals_
Reset the off-diagonals to 0 when blowing up the cov.
bool genfit::AbsKalmanFitter::isTrackFitted ( const Track tr,
const AbsTrackRep rep 
) const
inherited
bool genfit::AbsKalmanFitter::isTrackPrepared ( const Track tr,
const AbsTrackRep rep 
) const
inherited
bool genfit::KalmanFitterRefTrack::prepareTrack ( Track tr,
const AbsTrackRep rep,
bool  setSortingParams,
int &  nFailedHits 
)

Prepare the track.

Calc all reference states. If setSortingParams is true, the extrapolation lengths will be set as sorting parameters of the TrackPoints. Returns if the track has been changed.

void genfit::AbsFitter::processTrack ( Track ,
bool  resortHits = false 
)
inherited

Process all reps. Start with the cardinalRep and resort the hits if necessary (and supported by the fitter)

Referenced by PndRecoDafFit2::Fit(), and PndRecoKalmanFit2::Fit().

void genfit::KalmanFitterRefTrack::processTrackPoint ( KalmanFitterInfo fi,
const KalmanFitterInfo prevFi,
const TrackPoint tp,
double &  chi2,
double &  ndf,
int  direction 
)
private
void genfit::KalmanFitterRefTrack::processTrackWithRep ( Track ,
const AbsTrackRep ,
bool  resortHits = false 
)
virtual

Process Track with one AbsTrackRep of the Track. Optionally resort the hits if necessary (and supported by the fitter)

Implements genfit::AbsFitter.

void genfit::KalmanFitterRefTrack::removeForwardBackwardInfo ( Track tr,
const AbsTrackRep rep,
int  notChangedUntil,
int  notChangedFrom 
) const
private

If refitAll_, remove all information.

bool genfit::KalmanFitterRefTrack::removeOutdated ( Track tr,
const AbsTrackRep rep,
int &  notChangedUntil,
int &  notChangedFrom 
)
private

Remove referenceStates if they are too far from smoothed states.

Does NOT remove forward and backward info, but returns from/to where they have to be removed later Return if anything has changed.

void genfit::AbsKalmanFitter::setBlowUpFactor ( double  blowUpFactor)
inlineinherited

Definition at line 108 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::blowUpFactor_.

108 {blowUpFactor_ = blowUpFactor;}
double blowUpFactor_
Blow up the covariance of the forward (backward) fit by this factor before seeding the backward (forw...
void genfit::AbsKalmanFitter::setBlowUpMaxVal ( double  blowUpMaxVal)
inlineinherited

Limit the cov entries to this maximum value when blowing up the cov. Set to negative value to disable. Default is 1.E6.

This is especially useful for fits where the measurements do not constrain one direction, e.g. parallel wire measurements. The fit will not be constrained along the wire direction. This also means that the covariance along the wire direction will not get smaller during the fit. However, it will be blown up before the next iteration, leading to an exponential growth of the covariance element(s) corresponding to the wire direction. This can then lead to numerical problems. To prevent this, the maximum value of the covariance elements after blowing up can be limited.

Definition at line 119 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::blowUpMaxVal_.

119 {blowUpMaxVal_= blowUpMaxVal;}
double blowUpMaxVal_
Limit the cov entries to this maxuimum value when blowing up the cov.
virtual void genfit::AbsFitter::setDebugLvl ( unsigned int  lvl = 1)
inlinevirtualinherited

Reimplemented in genfit::DAF.

Definition at line 50 of file AbsFitter.h.

References genfit::AbsFitter::debugLvl_.

Referenced by genfit::DAF::setDebugLvl().

50 {debugLvl_ = lvl;}
unsigned int debugLvl_
Definition: AbsFitter.h:55
void genfit::KalmanFitterRefTrack::setDeltaChi2Ref ( double  dChi2)
inline

When will the reference track be updated? If (smoothedState - referenceState) * smoothedCov^(-1) * (smoothedState - referenceState)^T >= deltaChi2Ref_.

Definition at line 68 of file KalmanFitterRefTrack.h.

References deltaChi2Ref_.

void genfit::AbsKalmanFitter::setDeltaPval ( double  deltaPval)
inlineinherited

Set Convergence criterion.

if track total P-value changes less than this between consecutive iterations, consider the track converged. chiĀ² from the backwards fit is used.

Definition at line 95 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::deltaPval_.

95 {deltaPval_ = deltaPval;}
double deltaPval_
Convergence criterion.
virtual void genfit::AbsKalmanFitter::setMaxFailedHits ( int  val)
inlinevirtualinherited

Reimplemented in genfit::DAF.

Definition at line 124 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::maxFailedHits_, and val.

Referenced by genfit::DAF::setMaxFailedHits().

124 {maxFailedHits_ = val;}
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
virtual void genfit::AbsKalmanFitter::setMaxIterations ( unsigned int  n)
inlinevirtualinherited

Set the maximum number of iterations.

Reimplemented in genfit::DAF.

Definition at line 87 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::maxIterations_, genfit::AbsKalmanFitter::minIterations_, and n.

Referenced by PndRecoKalmanFit2::Init().

int n
unsigned int minIterations_
Minimum number of iterations to attempt. Forward and backward are counted as one iteration.
unsigned int maxIterations_
Maximum number of iterations to attempt. Forward and backward are counted as one iteration.
virtual void genfit::AbsKalmanFitter::setMinIterations ( unsigned int  n)
inlinevirtualinherited

Set the minimum number of iterations.

Definition at line 85 of file AbsKalmanFitter.h.

References max(), genfit::AbsKalmanFitter::maxIterations_, and genfit::AbsKalmanFitter::minIterations_.

int n
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:26
unsigned int minIterations_
Minimum number of iterations to attempt. Forward and backward are counted as one iteration.
unsigned int maxIterations_
Maximum number of iterations to attempt. Forward and backward are counted as one iteration.
void genfit::AbsKalmanFitter::setMultipleMeasurementHandling ( eMultipleMeasurementHandling  mmh)
inlineinherited

How should multiple measurements be handled?

Definition at line 122 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::multipleMeasurementHandling_.

eMultipleMeasurementHandling multipleMeasurementHandling_
How to handle if there are multiple MeasurementsOnPlane.
void genfit::KalmanFitterRefTrack::setRefitAll ( bool  refit = true)
inline

If true always refit all points, otherwise fit points only if reference states have changed.

Definition at line 62 of file KalmanFitterRefTrack.h.

References refitAll_.

void genfit::AbsKalmanFitter::setRelChi2Change ( double  relChi2Change)
inlineinherited

@ brief Set Non-convergence criterion

if the relative chi^2 between two iterations is larger than relChi2Change_, the fit is NOT converged and further iterations will be done, even if the deltaPval_ convergence criterium is met. This is especially useful for fits which have a p-value of almost 0 (possibly due to bad start values), where the p-value from one iteration to the next might not change much. However, a significant change in chi^2 tells us, that the fit might not yet be converged.

Definition at line 106 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::relChi2Change_.

106 {relChi2Change_ = relChi2Change;}
void genfit::AbsKalmanFitter::setResetOffDiagonals ( bool  resetOffDiagonals)
inlineinherited

Definition at line 109 of file AbsKalmanFitter.h.

References genfit::AbsKalmanFitter::resetOffDiagonals_.

109 {resetOffDiagonals_ = resetOffDiagonals;}
bool resetOffDiagonals_
Reset the off-diagonals to 0 when blowing up the cov.

Member Data Documentation

TVectorD genfit::KalmanFitterRefTrack::backwardDeltaState_
private

Definition at line 93 of file KalmanFitterRefTrack.h.

double genfit::AbsKalmanFitter::blowUpFactor_
protectedinherited

Blow up the covariance of the forward (backward) fit by this factor before seeding the backward (forward) fit.

Definition at line 161 of file AbsKalmanFitter.h.

Referenced by genfit::AbsKalmanFitter::getBlowUpFactor(), and genfit::AbsKalmanFitter::setBlowUpFactor().

double genfit::AbsKalmanFitter::blowUpMaxVal_
protectedinherited

Limit the cov entries to this maxuimum value when blowing up the cov.

Definition at line 165 of file AbsKalmanFitter.h.

Referenced by genfit::AbsKalmanFitter::getBlowUpMaxVal(), and genfit::AbsKalmanFitter::setBlowUpMaxVal().

TMatrixDSym genfit::KalmanFitterRefTrack::BNoiseMatrix_
private

Definition at line 91 of file KalmanFitterRefTrack.h.

TMatrixD genfit::KalmanFitterRefTrack::BTransportMatrix_
private

Definition at line 89 of file KalmanFitterRefTrack.h.

TMatrixDSym genfit::KalmanFitterRefTrack::C_
private

Definition at line 97 of file KalmanFitterRefTrack.h.

TMatrixDSym genfit::KalmanFitterRefTrack::covSumInv_
private

Definition at line 98 of file KalmanFitterRefTrack.h.

unsigned int genfit::AbsFitter::debugLvl_
protectedinherited

Definition at line 55 of file AbsFitter.h.

Referenced by genfit::AbsFitter::setDebugLvl().

double genfit::KalmanFitterRefTrack::deltaChi2Ref_
private

Definition at line 85 of file KalmanFitterRefTrack.h.

Referenced by setDeltaChi2Ref().

double genfit::AbsKalmanFitter::deltaPval_
protectedinherited

Convergence criterion.

if track total P-value changes less than this between consecutive iterations, consider the track converged. chiĀ² from the backwards fit is used.

Definition at line 148 of file AbsKalmanFitter.h.

Referenced by genfit::AbsKalmanFitter::getDeltaPval(), and genfit::AbsKalmanFitter::setDeltaPval().

TMatrixDSym genfit::KalmanFitterRefTrack::FNoiseMatrix_
private

Definition at line 90 of file KalmanFitterRefTrack.h.

TVectorD genfit::KalmanFitterRefTrack::forwardDeltaState_
private

Definition at line 92 of file KalmanFitterRefTrack.h.

TMatrixD genfit::KalmanFitterRefTrack::FTransportMatrix_
private

Definition at line 88 of file KalmanFitterRefTrack.h.

int genfit::AbsKalmanFitter::maxFailedHits_
protectedinherited

after how many failed hits (exception during construction of plane, extrapolation etc.) should the fit be cancelled. -1 means don't cancel

Definition at line 172 of file AbsKalmanFitter.h.

Referenced by genfit::AbsKalmanFitter::getMaxFailedHits(), and genfit::AbsKalmanFitter::setMaxFailedHits().

unsigned int genfit::AbsKalmanFitter::maxIterations_
protectedinherited

Maximum number of iterations to attempt. Forward and backward are counted as one iteration.

Definition at line 141 of file AbsKalmanFitter.h.

Referenced by genfit::AbsKalmanFitter::AbsKalmanFitter(), genfit::AbsKalmanFitter::getMaxIterations(), genfit::AbsKalmanFitter::setMaxIterations(), genfit::DAF::setMaxIterations(), and genfit::AbsKalmanFitter::setMinIterations().

unsigned int genfit::AbsKalmanFitter::minIterations_
protectedinherited

Minimum number of iterations to attempt. Forward and backward are counted as one iteration.

Definition at line 138 of file AbsKalmanFitter.h.

Referenced by genfit::AbsKalmanFitter::AbsKalmanFitter(), genfit::AbsKalmanFitter::getMinIterations(), genfit::AbsKalmanFitter::setMaxIterations(), and genfit::AbsKalmanFitter::setMinIterations().

eMultipleMeasurementHandling genfit::AbsKalmanFitter::multipleMeasurementHandling_
protectedinherited

How to handle if there are multiple MeasurementsOnPlane.

Definition at line 168 of file AbsKalmanFitter.h.

Referenced by genfit::AbsKalmanFitter::getMultipleMeasurementHandling(), and genfit::AbsKalmanFitter::setMultipleMeasurementHandling().

TVectorD genfit::KalmanFitterRefTrack::p_
private

Definition at line 96 of file KalmanFitterRefTrack.h.

bool genfit::KalmanFitterRefTrack::refitAll_
private

Definition at line 84 of file KalmanFitterRefTrack.h.

Referenced by setRefitAll().

double genfit::AbsKalmanFitter::relChi2Change_
protectedinherited

@ brief Non-convergence criterion

if the relative chi^2 between two iterations is larger than relChi2Change_, the fit is NOT converged and further iterations will be done, even if the deltaPval_ convergence criterium is met. This is especially useful for fits which have a p-value of almost 0 (possibly due to bad start values), where the p-value from one iteration to the next might not change much. However, a significant change in chi^2 tells us, that the fit might not yet be converged.

Definition at line 158 of file AbsKalmanFitter.h.

Referenced by genfit::AbsKalmanFitter::getRelChi2Change(), and genfit::AbsKalmanFitter::setRelChi2Change().

TVectorD genfit::KalmanFitterRefTrack::res_
private

Definition at line 100 of file KalmanFitterRefTrack.h.

bool genfit::AbsKalmanFitter::resetOffDiagonals_
protectedinherited

Reset the off-diagonals to 0 when blowing up the cov.

Definition at line 163 of file AbsKalmanFitter.h.

Referenced by genfit::AbsKalmanFitter::getResetOffDiagonals(), and genfit::AbsKalmanFitter::setResetOffDiagonals().

TVectorD genfit::KalmanFitterRefTrack::resM_
private

Definition at line 103 of file KalmanFitterRefTrack.h.

TMatrixDSym genfit::KalmanFitterRefTrack::Rinv_
private

Definition at line 99 of file KalmanFitterRefTrack.h.


The documentation for this class was generated from the following file: