Belle II Software  release-06-02-00
DAF.h
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 */
23 #ifndef genfit_DAF_h
24 #define genfit_DAF_h
25 
26 #include "AbsKalmanFitter.h"
27 
28 #include <vector>
29 #include <map>
30 #include <memory>
31 
32 
33 namespace genfit {
34 
49 class DAF : public AbsKalmanFitter {
50 
51  private:
52 
53  DAF(const DAF&);
54  DAF& operator=(genfit::DAF const&);
55 
56  public:
57 
63  DAF(bool useRefKalman = true, double deltaPval = 1e-3, double deltaWeight = 1e-3);
67  DAF(AbsKalmanFitter* kalman, double deltaPval = 1e-3, double deltaWeight = 1e-3);
68  ~DAF() {};
69 
71  void processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool resortHits = false) override;
72 
79  void setProbCut(const double prob_cut);
80 
82  void addProbCut(const double prob_cut, const int measDim);
83 
84  const std::vector<double>& getBetas() const {return betas_;}
85 
91  void setAnnealingScheme(double bStart, double bFinal, unsigned int nSteps);
92 
93  void setMaxIterations(unsigned int n) override {maxIterations_ = n; betas_.resize(maxIterations_,betas_.back());}
94 
96  void setConvergenceDeltaWeight(double delta) {deltaWeight_ = delta;}
97 
98  AbsKalmanFitter* getKalman() const {return kalman_.get();}
99 
100  virtual void setMaxFailedHits(int val) override {getKalman()->setMaxFailedHits(val);}
101 
102  virtual void setDebugLvl(unsigned int lvl = 1) override {AbsFitter::setDebugLvl(lvl); if (lvl > 1) getKalman()->setDebugLvl(lvl-1);}
103 
104  private:
105 
110  bool calcWeights(Track* trk, const AbsTrackRep* rep, double beta);
111 
112 
113  double deltaWeight_; // convergence criterium
114  std::vector<double> betas_; // Temperatures, NOT inverse temperatures.
115  double chi2Cuts_[7]; // '7' assumes tracks are helices with one
116  // parameter, i.e. we're living in 3D space,
117  // where time may be used in the fit. Zeroth
118  // entry is not used.
119 
120  std::unique_ptr<AbsKalmanFitter> kalman_;
121 
122  public:
123 
124  ClassDefOverride(DAF,2)
125 
126 };
127 
128 } /* End of namespace genfit */
131 #endif //genfit_DAF_h
Abstract base class for Kalman fitter and derived fitting algorithms.
unsigned int maxIterations_
Maximum number of iterations to attempt. Forward and backward are counted as one iteration.
Abstract base class for a track representation.
Definition: AbsTrackRep.h:66
Determinstic Annealing Filter (DAF) implementation.
Definition: DAF.h:49
void setConvergenceDeltaWeight(double delta)
If all weights change less than delta between two iterations, the fit is regarded as converged.
Definition: DAF.h:96
void processTrackWithRep(Track *tr, const AbsTrackRep *rep, bool resortHits=false) override
Process a track using the DAF.
Definition: DAF.cc:76
void setProbCut(const double prob_cut)
Set the probability cut for the weight calculation for the hits.
Definition: DAF.cc:174
void setMaxIterations(unsigned int n) override
Set the maximum number of iterations.
Definition: DAF.h:93
void setAnnealingScheme(double bStart, double bFinal, unsigned int nSteps)
Configure the annealing scheme.
Definition: DAF.cc:194
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:180
bool calcWeights(Track *trk, const AbsTrackRep *rep, double beta)
Calculate and set the weights for the next fitting pass.
Definition: DAF.cc:218
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
Definition: Track.h:71
Defines for I/O streams used for error and debug printing.