EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
genfit::AbsKalmanFitter Class Reference

Abstract base class for Kalman fitter and derived fitting algorithms. More...

#include <fun4all_GenFit/blob/master/fitters/include/AbsKalmanFitter.h>

+ Inheritance diagram for genfit::AbsKalmanFitter:
+ Collaboration diagram for genfit::AbsKalmanFitter:

Public Member Functions

 AbsKalmanFitter (unsigned int maxIterations=4, double deltaPval=1e-3, double blowUpFactor=1e3)
 
virtual ~AbsKalmanFitter ()
 
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.
 
virtual void setMaxIterations (unsigned int n)
 Set the maximum number of iterations.
 
void setDeltaPval (double deltaPval)
 Set Convergence criterion.
 
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.
 
void setMultipleMeasurementHandling (eMultipleMeasurementHandling mmh)
 How should multiple measurements be handled?
 
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.
 
- Public Member Functions inherited from genfit::AbsFitter
 AbsFitter ()
 
virtual ~AbsFitter ()
 
virtual void processTrackWithRep (Track *, const AbsTrackRep *, bool resortHits=false)=0
 
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
 

Protected Attributes

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.
 
double deltaPval_
 Convergence criterion.
 
double relChi2Change_
 
double blowUpFactor_
 Blow up the covariance of the forward (backward) fit by this factor before seeding the backward (forward) fit.
 
bool resetOffDiagonals_
 Reset the off-diagonals to 0 when blowing up the cov.
 
double blowUpMaxVal_
 Limit the cov entries to this maxuimum value when blowing up the cov.
 
eMultipleMeasurementHandling multipleMeasurementHandling_
 How to handle if there are multiple MeasurementsOnPlane.
 
int maxFailedHits_
 
- Protected Attributes inherited from genfit::AbsFitter
unsigned int debugLvl_
 

Detailed Description

Abstract base class for Kalman fitter and derived fitting algorithms.

Definition at line 51 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 51 of file AbsKalmanFitter.h

Constructor & Destructor Documentation

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

Definition at line 55 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 55 of file AbsKalmanFitter.h

References maxIterations_, and minIterations_.

virtual genfit::AbsKalmanFitter::~AbsKalmanFitter ( )
inlinevirtual

Definition at line 64 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 64 of file AbsKalmanFitter.h

Member Function Documentation

bool AbsKalmanFitter::canIgnoreWeights ( ) const

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

Definition at line 256 of file AbsKalmanFitter.cc.

View newest version in sPHENIX GitHub at line 256 of file AbsKalmanFitter.cc

References Acts::UnitConstants::e, multipleMeasurementHandling_, genfit::Exception::setFatal(), genfit::unweightedAverage, genfit::unweightedClosestToPrediction, genfit::unweightedClosestToPredictionWire, genfit::unweightedClosestToReference, genfit::unweightedClosestToReferenceWire, genfit::weightedAverage, genfit::weightedClosestToPrediction, genfit::weightedClosestToPredictionWire, genfit::weightedClosestToReference, and genfit::weightedClosestToReferenceWire.

Referenced by genfit::KalmanFitter::processTrackPoint(), genfit::KalmanFitterRefTrack::processTrackPoint(), and genfit::KalmanFitterRefTrack::processTrackPointSqrt().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 78 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 78 of file AbsKalmanFitter.h

References blowUpFactor_.

double genfit::AbsKalmanFitter::getBlowUpMaxVal ( ) const
inline

Definition at line 80 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 80 of file AbsKalmanFitter.h

References blowUpMaxVal_.

double AbsKalmanFitter::getChiSqu ( const Track tr,
const AbsTrackRep rep,
int  direction = -1 
) const

Definition at line 84 of file AbsKalmanFitter.cc.

View newest version in sPHENIX GitHub at line 84 of file AbsKalmanFitter.cc

References getChiSquNdf().

+ Here is the call graph for this function:

void AbsKalmanFitter::getChiSquNdf ( const Track tr,
const AbsTrackRep rep,
double &  bChi2,
double &  fChi2,
double &  bNdf,
double &  fNdf 
) const

Definition at line 40 of file AbsKalmanFitter.cc.

View newest version in sPHENIX GitHub at line 40 of file AbsKalmanFitter.cc

References genfit::KalmanFitterInfo::getBackwardUpdate(), genfit::KalmanFittedStateOnPlane::getChiSquareIncrement(), genfit::AbsTrackRep::getDim(), genfit::KalmanFitterInfo::getForwardUpdate(), genfit::KalmanFittedStateOnPlane::getNdf(), and genfit::Track::getPointsWithMeasurement().

Referenced by getChiSqu(), getNdf(), getPVal(), and getRedChiSqu().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double genfit::AbsKalmanFitter::getDeltaPval ( ) const
inline

Definition at line 76 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 76 of file AbsKalmanFitter.h

References deltaPval_.

int genfit::AbsKalmanFitter::getMaxFailedHits ( ) const
inline

Definition at line 82 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 82 of file AbsKalmanFitter.h

References maxFailedHits_.

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

Definition at line 75 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 75 of file AbsKalmanFitter.h

References maxIterations_.

const std::vector< MeasurementOnPlane * > AbsKalmanFitter::getMeasurements ( const KalmanFitterInfo fi,
const TrackPoint tp,
int  direction 
) const
protected

get the measurementsOnPlane taking the multipleMeasurementHandling_ into account

Definition at line 177 of file AbsKalmanFitter.cc.

View newest version in sPHENIX GitHub at line 177 of file AbsKalmanFitter.cc

References Acts::UnitConstants::e, genfit::KalmanFitterInfo::getClosestMeasurementOnPlane(), genfit::KalmanFitterInfo::getMeasurementsOnPlane(), genfit::TrackPoint::getNumRawMeasurements(), genfit::KalmanFitterInfo::getPrediction(), genfit::TrackPoint::getRawMeasurement(), genfit::KalmanFitterInfo::getReferenceState(), genfit::AbsFitterInfo::hasPrediction(), genfit::KalmanFitterInfo::hasReferenceState(), genfit::AbsMeasurement::isLeftRightMeasurement(), multipleMeasurementHandling_, genfit::Exception::setFatal(), genfit::unweightedAverage, genfit::unweightedClosestToPrediction, genfit::unweightedClosestToPredictionWire, genfit::unweightedClosestToReference, genfit::unweightedClosestToReferenceWire, genfit::weightedAverage, genfit::weightedClosestToPrediction, genfit::weightedClosestToPredictionWire, genfit::weightedClosestToReference, and genfit::weightedClosestToReferenceWire.

Referenced by genfit::KalmanFitter::processTrackPoint(), genfit::KalmanFitterRefTrack::processTrackPoint(), and genfit::KalmanFitterRefTrack::processTrackPointSqrt().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 74 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 74 of file AbsKalmanFitter.h

References minIterations_.

eMultipleMeasurementHandling genfit::AbsKalmanFitter::getMultipleMeasurementHandling ( ) const
inline

Definition at line 81 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 81 of file AbsKalmanFitter.h

References multipleMeasurementHandling_.

double AbsKalmanFitter::getNdf ( const Track tr,
const AbsTrackRep rep,
int  direction = -1 
) const

Definition at line 94 of file AbsKalmanFitter.cc.

View newest version in sPHENIX GitHub at line 94 of file AbsKalmanFitter.cc

References getChiSquNdf().

+ Here is the call graph for this function:

double AbsKalmanFitter::getPVal ( const Track tr,
const AbsTrackRep rep,
int  direction = -1 
) const

Definition at line 114 of file AbsKalmanFitter.cc.

View newest version in sPHENIX GitHub at line 114 of file AbsKalmanFitter.cc

References getChiSquNdf(), and max.

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double AbsKalmanFitter::getRedChiSqu ( const Track tr,
const AbsTrackRep rep,
int  direction = -1 
) const

Definition at line 104 of file AbsKalmanFitter.cc.

View newest version in sPHENIX GitHub at line 104 of file AbsKalmanFitter.cc

References getChiSquNdf().

+ Here is the call graph for this function:

double genfit::AbsKalmanFitter::getRelChi2Change ( ) const
inline

Definition at line 77 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 77 of file AbsKalmanFitter.h

References relChi2Change_.

bool genfit::AbsKalmanFitter::getResetOffDiagonals ( ) const
inline

Definition at line 79 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 79 of file AbsKalmanFitter.h

References resetOffDiagonals_.

bool AbsKalmanFitter::isTrackFitted ( const Track tr,
const AbsTrackRep rep 
) const

Definition at line 147 of file AbsKalmanFitter.cc.

View newest version in sPHENIX GitHub at line 147 of file AbsKalmanFitter.cc

References genfit::KalmanFitterInfo::checkConsistency(), genfit::Track::getFitStatus(), genfit::Track::getPointsWithMeasurement(), genfit::KalmanFitterInfo::hasBackwardUpdate(), genfit::KalmanFitterInfo::hasForwardUpdate(), and genfit::FitStatus::isFitted().

+ Here is the call graph for this function:

bool AbsKalmanFitter::isTrackPrepared ( const Track tr,
const AbsTrackRep rep 
) const

Definition at line 125 of file AbsKalmanFitter.cc.

View newest version in sPHENIX GitHub at line 125 of file AbsKalmanFitter.cc

References genfit::KalmanFitterInfo::checkConsistency(), genfit::Track::getPointsWithMeasurement(), and genfit::KalmanFitterInfo::hasReferenceState().

Referenced by genfit::KalmanFitterRefTrack::prepareTrack().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 108 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 108 of file AbsKalmanFitter.h

References blowUpFactor_.

void genfit::AbsKalmanFitter::setBlowUpMaxVal ( double  blowUpMaxVal)
inline

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.

View newest version in sPHENIX GitHub at line 119 of file AbsKalmanFitter.h

References blowUpMaxVal_.

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

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.

View newest version in sPHENIX GitHub at line 95 of file AbsKalmanFitter.h

References deltaPval_.

virtual void genfit::AbsKalmanFitter::setMaxFailedHits ( int  val)
inlinevirtual

Reimplemented in genfit::DAF.

Definition at line 124 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 124 of file AbsKalmanFitter.h

References maxFailedHits_.

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

+ Here is the caller graph for this function:

virtual void genfit::AbsKalmanFitter::setMaxIterations ( unsigned int  n)
inlinevirtual

Set the maximum number of iterations.

Reimplemented in genfit::DAF.

Definition at line 87 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 87 of file AbsKalmanFitter.h

References maxIterations_, minIterations_, and n.

Referenced by main().

+ Here is the caller graph for this function:

virtual void genfit::AbsKalmanFitter::setMinIterations ( unsigned int  n)
inlinevirtual

Set the minimum number of iterations.

Definition at line 85 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 85 of file AbsKalmanFitter.h

References max, maxIterations_, and minIterations_.

void genfit::AbsKalmanFitter::setMultipleMeasurementHandling ( eMultipleMeasurementHandling  mmh)
inline

How should multiple measurements be handled?

Definition at line 122 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 122 of file AbsKalmanFitter.h

References multipleMeasurementHandling_.

Referenced by main().

+ Here is the caller graph for this function:

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

@ 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.

View newest version in sPHENIX GitHub at line 106 of file AbsKalmanFitter.h

References relChi2Change_.

void genfit::AbsKalmanFitter::setResetOffDiagonals ( bool  resetOffDiagonals)
inline

Definition at line 109 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 109 of file AbsKalmanFitter.h

References resetOffDiagonals_.

Member Data Documentation

double genfit::AbsKalmanFitter::blowUpFactor_
protected
double genfit::AbsKalmanFitter::blowUpMaxVal_
protected
double genfit::AbsKalmanFitter::deltaPval_
protected

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.

View newest version in sPHENIX GitHub at line 148 of file AbsKalmanFitter.h

Referenced by getDeltaPval(), genfit::KalmanFitterRefTrack::processTrackWithRep(), genfit::KalmanFitter::processTrackWithRep(), genfit::DAF::processTrackWithRep(), and setDeltaPval().

int genfit::AbsKalmanFitter::maxFailedHits_
protected

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.

View newest version in sPHENIX GitHub at line 172 of file AbsKalmanFitter.h

Referenced by genfit::KalmanFitter::fitTrack(), getMaxFailedHits(), genfit::KalmanFitterRefTrack::prepareTrack(), and setMaxFailedHits().

unsigned int genfit::AbsKalmanFitter::maxIterations_
protected

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

Definition at line 141 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 141 of file AbsKalmanFitter.h

Referenced by AbsKalmanFitter(), getMaxIterations(), genfit::KalmanFitterRefTrack::processTrackWithRep(), genfit::KalmanFitter::processTrackWithRep(), genfit::DAF::processTrackWithRep(), genfit::DAF::setAnnealingScheme(), setMaxIterations(), genfit::DAF::setMaxIterations(), and setMinIterations().

unsigned int genfit::AbsKalmanFitter::minIterations_
protected

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

Definition at line 138 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 138 of file AbsKalmanFitter.h

Referenced by AbsKalmanFitter(), getMinIterations(), genfit::KalmanFitterRefTrack::processTrackWithRep(), genfit::KalmanFitter::processTrackWithRep(), genfit::DAF::processTrackWithRep(), genfit::DAF::setAnnealingScheme(), setMaxIterations(), and setMinIterations().

eMultipleMeasurementHandling genfit::AbsKalmanFitter::multipleMeasurementHandling_
protected

How to handle if there are multiple MeasurementsOnPlane.

Definition at line 168 of file AbsKalmanFitter.h.

View newest version in sPHENIX GitHub at line 168 of file AbsKalmanFitter.h

Referenced by canIgnoreWeights(), genfit::KalmanFitter::fitTrack(), getMeasurements(), getMultipleMeasurementHandling(), and setMultipleMeasurementHandling().

double genfit::AbsKalmanFitter::relChi2Change_
protected

@ 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.

View newest version in sPHENIX GitHub at line 158 of file AbsKalmanFitter.h

Referenced by getRelChi2Change(), genfit::KalmanFitterRefTrack::processTrackWithRep(), genfit::KalmanFitter::processTrackWithRep(), and setRelChi2Change().


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