GENFIT Rev: NoNumberAvailable
Loading...
Searching...
No Matches
DAF.h
Go to the documentation of this file.
1/* Copyright 2013, Ludwig-Maximilians Universität München,
2 Authors: Tobias Schlüter & Johannes Rauch
3
4 This file is part of GENFIT.
5
6 GENFIT is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 GENFIT is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18*/
22
23#ifndef genfit_DAF_h
24#define genfit_DAF_h
25
26#include "AbsKalmanFitter.h"
27
28#include <map>
29#include <memory>
30#include <tuple>
31#include <vector>
32
33
34namespace genfit {
35
50class DAF : public AbsKalmanFitter {
51
52 private:
53
54 DAF(const DAF&);
56
57 public:
58
72 DAF(const std::tuple<double, double, int>& annealingScheme, int minIter, int maxIter, int minIterForPval, bool useRefKalman = true, double deltaPval = 1e-3, double deltaWeight = 1e-3, double probCut = 1e-3);
78 DAF(bool useRefKalman = true, double deltaPval = 1e-3, double deltaWeight = 1e-3);
82 DAF(AbsKalmanFitter* kalman, double deltaPval = 1e-3, double deltaWeight = 1e-3);
86 ~DAF() {};
87
89 void processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool resortHits = false) override;
90
97 void setProbCut(const double prob_cut);
98
100 void addProbCut(const double prob_cut, const int measDim);
101
102 const std::vector<double>& getBetas() const {return betas_;}
103
109 void setAnnealingScheme(double bStart, double bFinal, unsigned int nSteps);
110
116 void setAnnealingScheme(double bStart, double bFinal, unsigned int nSteps, unsigned int minIter, unsigned int maxIter);
117
121 void setMaxIterations(unsigned int n) override {maxIterations_ = n; betas_.resize(maxIterations_,betas_.back());}
122
126 void setConvergenceDeltaWeight(double delta) {deltaWeight_ = delta;}
127
131 AbsKalmanFitter* getKalman() const {return kalman_.get();}
132
141
145 virtual void setMaxFailedHits(int val) override {getKalman()->setMaxFailedHits(val);}
146
147 virtual void setDebugLvl(unsigned int lvl = 1) override {AbsFitter::setDebugLvl(lvl); if (lvl > 1) getKalman()->setDebugLvl(lvl-1);}
148
149 private:
150
155 bool calcWeights(Track* trk, const AbsTrackRep* rep, double beta);
156
157 int minIterForPval_; //minimum number of iterations before checking pvalue convergence criterion
158 double deltaWeight_; // convergence criterium
159 std::vector<double> betas_; // Temperatures, NOT inverse temperatures.
160 double chi2Cuts_[7]; // '7' assumes tracks are helices with one
161 // parameter, i.e. we're living in 3D space,
162 // where time may be used in the fit. Zeroth
163 // entry is not used.
164
165 std::unique_ptr<AbsKalmanFitter> kalman_; // Internal Kalman fitter.
166
167 public:
168
169 ClassDefOverride(DAF,2)
170
171};
172
173} /* End of namespace genfit */
175
176#endif //genfit_DAF_h
virtual void setDebugLvl(unsigned int lvl=1)
Definition AbsFitter.h:50
virtual void setMaxIterations(unsigned int n)
Set the maximum number of iterations.
unsigned int maxIterations_
Maximum number of iterations to attempt. Forward and backward are counted as one iteration.
virtual void setMaxFailedHits(int val)
AbsKalmanFitter(unsigned int maxIterations=4, double deltaPval=1e-3, double blowUpFactor=1e3)
Abstract base class for a track representation.
Definition AbsTrackRep.h:66
Determinstic Annealing Filter (DAF) implementation.
Definition DAF.h:50
virtual void setMaxFailedHits(int val) override
Set the maximum number of accepted failed hits by the internal Kalman fitter.
Definition DAF.h:145
std::vector< double > betas_
Definition DAF.h:159
bool calcWeights(Track *trk, const AbsTrackRep *rep, double beta)
Calculate and set the weights for the next fitting pass. Return if convergence is met....
Definition DAF.cc:256
void setAnnealingScheme(double bStart, double bFinal, unsigned int nSteps)
Configure the annealing scheme.
Definition DAF.cc:214
DAF & operator=(genfit::DAF const &)
void setMaxIterationsKalman(unsigned int n)
Set the maximum number of iterations of the internal Kalman fitter.
Definition DAF.h:140
AbsKalmanFitter * getKalman() const
Get a pointer to the internal Kalman fitter.
Definition DAF.h:131
void processTrackWithRep(Track *tr, const AbsTrackRep *rep, bool resortHits=false) override
Process a track using the DAF.
Definition DAF.cc:96
void addProbCut(const double prob_cut, const int measDim)
Set the probability cut for the weight calculation for the hits for a specific measurement dimensiona...
Definition DAF.cc:200
const std::vector< double > & getBetas() const
Definition DAF.h:102
double chi2Cuts_[7]
Definition DAF.h:160
void setConvergenceDeltaWeight(double delta)
If all weights change less than delta between two iterations, the fit is regarded as converged.
Definition DAF.h:126
virtual void setDebugLvl(unsigned int lvl=1) override
Definition DAF.h:147
DAF(const DAF &)
double deltaWeight_
Definition DAF.h:158
int minIterForPval_
Definition DAF.h:157
~DAF()
Destruct DAF.
Definition DAF.h:86
std::unique_ptr< AbsKalmanFitter > kalman_
Definition DAF.h:165
void setProbCut(const double prob_cut)
Set the probability cut for the weight calculation for the hits.
Definition DAF.cc:194
void setMaxIterations(unsigned int n) override
Set the maximum number of iterations of the DAF.
Definition DAF.h:121
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
Definition Track.h:71
Defines for I/O streams used for error and debug printing.