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

Determinstic Annealing Filter (DAF) implementation. More...

#include <DAF.h>

Inheritance diagram for genfit::DAF:
genfit::AbsKalmanFitter genfit::AbsFitter

Public Member Functions

 DAF (bool useRefKalman=true, double deltaWeight=1e-3, double deltaPval=1e-3)
 Create DAF. Per default, use KalmanFitterRefTrack as fitter. More...
 
 DAF (AbsKalmanFitter *kalman, double deltaWeight=1e-3, double deltaPval=1e-3)
 Create DAF. Use the provided AbsKalmanFitter as fitter. More...
 
 ~DAF ()
 
void processTrackWithRep (Track *tr, const AbsTrackRep *rep, bool resortHits=false)
 Process a track using the DAF. More...
 
void setProbCut (const double prob_cut)
 Set the probability cut for the weight calculation for the hits. More...
 
void addProbCut (const double prob_cut, const int measDim)
 Set the probability cut for the weight calculation for the hits for a specific measurement dimensionality. More...
 
void setBetas (double b1, double b2=-1, double b3=-1., double b4=-1., double b5=-1., double b6=-1., double b7=-1., double b8=-1., double b9=-1., double b10=-1.)
 Configure the annealing scheme. More...
 
const std::vector< double > & getBetas ()
 
void setAnnealingScheme (double bStart, double bFinal, unsigned int nSteps)
 Configure the annealing scheme. More...
 
void setMaxIterations (unsigned int n)
 Set the maximum number of iterations. More...
 
void setConvergenceDeltaWeight (double delta)
 If all weights change less than delta between two iterations, the fit is regarded as converged. More...
 
AbsKalmanFittergetKalman () const
 
virtual void setMaxFailedHits (int val)
 
virtual void setDebugLvl (unsigned int lvl=1)
 
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...
 
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...
 
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)
 

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

 DAF (const DAF &)
 
DAFoperator= (genfit::DAF const &)
 
bool calcWeights (Track *trk, const AbsTrackRep *rep, double beta)
 Calculate and set the weights for the next fitting pass. Return if convergence is met. The convergence criterium is the largest absolute change of all weights. More...
 

Private Attributes

double deltaWeight_
 
std::vector< double > betas_
 
double chi2Cuts_ [7]
 
boost::scoped_ptr
< AbsKalmanFitter
kalman_
 

Detailed Description

Determinstic Annealing Filter (DAF) implementation.

Author
Christian Höppner (Technische Universität München, original author)
Karl Bicker (Technische Universität München)

The DAF is an iterative Kalman filter with annealing. It is capable of fitting tracks which are contaminated with noise hits. The algorithm is taken from the references R. Fruehwirth & A. Strandlie, Computer Physics Communications 120 (1999) 197-214 and CERN thesis: Dissertation by Matthias Winkler.

The weights which were assigned to the hits by the DAF are accessible in the MeasurementOnPlane objects in the KalmanFitterInfo objects.

Definition at line 48 of file DAF.h.

Constructor & Destructor Documentation

genfit::DAF::DAF ( const DAF )
private
genfit::DAF::DAF ( bool  useRefKalman = true,
double  deltaWeight = 1e-3,
double  deltaPval = 1e-3 
)

Create DAF. Per default, use KalmanFitterRefTrack as fitter.

Parameters
useRefKalmanIf false, use KalmanFitter as fitter.
genfit::DAF::DAF ( AbsKalmanFitter kalman,
double  deltaWeight = 1e-3,
double  deltaPval = 1e-3 
)

Create DAF. Use the provided AbsKalmanFitter as fitter.

genfit::DAF::~DAF ( )
inline

Definition at line 67 of file DAF.h.

67 {};

Member Function Documentation

void genfit::DAF::addProbCut ( const double  prob_cut,
const int  measDim 
)

Set the probability cut for the weight calculation for the hits for a specific measurement dimensionality.

bool genfit::DAF::calcWeights ( Track trk,
const AbsTrackRep rep,
double  beta 
)
private

Calculate and set the weights for the next fitting pass. Return if convergence is met. The convergence criterium is the largest absolute change of all weights.

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

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

const std::vector<double>& genfit::DAF::getBetas ( )
inline

Definition at line 91 of file DAF.h.

References betas_.

91 {return betas_;}
std::vector< double > betas_
Definition: DAF.h:121
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.
AbsKalmanFitter* genfit::DAF::getKalman ( ) const
inline

Definition at line 105 of file DAF.h.

References kalman_.

Referenced by setDebugLvl(), and setMaxFailedHits().

105 {return kalman_.get();}
boost::scoped_ptr< AbsKalmanFitter > kalman_
Definition: DAF.h:127
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
DAF& genfit::DAF::operator= ( genfit::DAF const &  )
private
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::DAF::processTrackWithRep ( Track tr,
const AbsTrackRep rep,
bool  resortHits = false 
)
virtual

Process a track using the DAF.

Implements genfit::AbsFitter.

void genfit::DAF::setAnnealingScheme ( double  bStart,
double  bFinal,
unsigned int  nSteps 
)

Configure the annealing scheme.

Set a start and end temperature and the number of steps. A logarithmic sequence of temperatures will be calculated. Also sets minIterations_ and maxIterations_.

void genfit::DAF::setBetas ( double  b1,
double  b2 = -1,
double  b3 = -1.,
double  b4 = -1.,
double  b5 = -1.,
double  b6 = -1.,
double  b7 = -1.,
double  b8 = -1.,
double  b9 = -1.,
double  b10 = -1. 
)

Configure the annealing scheme.

In the current implementation you need to provide at least one temperature and not more then ten temperatures. Also sets minIterations_ and maxIterations_.

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.
void genfit::DAF::setConvergenceDeltaWeight ( double  delta)
inline

If all weights change less than delta between two iterations, the fit is regarded as converged.

Definition at line 103 of file DAF.h.

References deltaWeight_.

103 {deltaWeight_ = delta;}
double deltaWeight_
Definition: DAF.h:120
virtual void genfit::DAF::setDebugLvl ( unsigned int  lvl = 1)
inlinevirtual

Reimplemented from genfit::AbsFitter.

Definition at line 109 of file DAF.h.

References getKalman(), and genfit::AbsFitter::setDebugLvl().

109 {AbsFitter::setDebugLvl(lvl); if (lvl > 1) getKalman()->setDebugLvl(lvl-1);}
virtual void setDebugLvl(unsigned int lvl=1)
Definition: AbsFitter.h:50
AbsKalmanFitter * getKalman() const
Definition: DAF.h:105
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::DAF::setMaxFailedHits ( int  val)
inlinevirtual

Reimplemented from genfit::AbsKalmanFitter.

Definition at line 107 of file DAF.h.

References getKalman(), and genfit::AbsKalmanFitter::setMaxFailedHits().

Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
virtual void setMaxFailedHits(int val)
AbsKalmanFitter * getKalman() const
Definition: DAF.h:105
void genfit::DAF::setMaxIterations ( unsigned int  n)
inlinevirtual

Set the maximum number of iterations.

Reimplemented from genfit::AbsKalmanFitter.

Definition at line 100 of file DAF.h.

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

Referenced by PndRecoDafFit2::Init().

100 {maxIterations_ = n; betas_.resize(maxIterations_,betas_.back());}
std::vector< double > betas_
Definition: DAF.h:121
int n
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::DAF::setProbCut ( const double  prob_cut)

Set the probability cut for the weight calculation for the hits.

By default the cut values for measurements of dimensionality from 1 to 5 are calculated. If you what to have cut values for an arbitrary measurement dimensionality use addProbCut(double prob_cut, int maxDim);

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

std::vector<double> genfit::DAF::betas_
private

Definition at line 121 of file DAF.h.

Referenced by getBetas(), and setMaxIterations().

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

double genfit::DAF::chi2Cuts_[7]
private

Definition at line 122 of file DAF.h.

unsigned int genfit::AbsFitter::debugLvl_
protectedinherited

Definition at line 55 of file AbsFitter.h.

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

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

double genfit::DAF::deltaWeight_
private

Definition at line 120 of file DAF.h.

Referenced by setConvergenceDeltaWeight().

boost::scoped_ptr<AbsKalmanFitter> genfit::DAF::kalman_
private

Definition at line 127 of file DAF.h.

Referenced by getKalman().

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

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

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


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