GENFIT Rev: NoNumberAvailable
Loading...
Searching...
No Matches
FitStatus.h
Go to the documentation of this file.
1/* Copyright 2008-2010, Technische Universitaet Muenchen,
2 Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch & Tobias Schlüter
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_FitStatus_h
24#define genfit_FitStatus_h
25
26#include <Rtypes.h>
27#include <Math/ProbFuncMathCore.h>
28
29
30namespace genfit {
31
32
47struct PruneFlags {
48 PruneFlags();
49 void reset();
51 void setFlags(Option_t* option = "");
53 bool hasFlags(Option_t* option = "CFLWRMIU") const;
55 bool isPruned() const;
56
57 void Print(const Option_t* = "") const;
58
59private:
60 enum fields { C = 1 << 0,
61 F = 1 << 1,
62 L = 1 << 2,
63 W = 1 << 3,
64 R = 1 << 4,
65 M = 1 << 5,
66 I = 1 << 6,
67 U = 1 << 7 };
68
69 int value; // bitfield composed from above. ROOT cannot deal with
70 // bitfield notation, so this is done manually.
71
72 // No ClassDef here. Update FitStatus version number when changing this.
73};
74
75
80class FitStatus {
81
82 public:
83
86 trackHasChanged_(false), pruneFlags_(), charge_(0), chi2_(-1e99), ndf_(-1e99)
87 {;}
88
89 virtual ~FitStatus() {};
90
91 virtual FitStatus* clone() const {return new FitStatus(*this);}
92
94 bool isFitted() const {return isFitted_;}
96
105 bool isFitConverged(bool inAllPoints = true) const {
106 if (inAllPoints)
109 }
112 int getNFailedPoints() const {return nFailedPoints_;}
114 bool hasTrackChanged() const {return trackHasChanged_;}
116 bool isTrackPruned() const {return pruneFlags_.isPruned();}
118 double getCharge() const {return charge_;}
120 double getChi2() const {return chi2_;}
122 double getNdf() const {return ndf_;}
128 virtual double getPVal() const {return std::max(0.,ROOT::Math::chisquared_cdf_c(chi2_, ndf_));}
129
130 void setIsFitted(bool fitted = true) {isFitted_ = fitted;}
131 void setIsFitConvergedFully(bool fitConverged = true) {isFitConvergedFully_ = fitConverged;}
132 void setIsFitConvergedPartially(bool fitConverged = true) {isFitConvergedPartially_ = fitConverged;}
133 void setNFailedPoints(int nFailedPoints) {nFailedPoints_ = nFailedPoints;}
134 void setHasTrackChanged(bool trackChanged = true) {trackHasChanged_ = trackChanged;}
135 void setCharge(double charge) {charge_ = charge;}
136
138
139 void setChi2(const double& chi2) {chi2_ = chi2;}
140 void setNdf(const double& ndf) {ndf_ = ndf;}
141
142 virtual void Print(const Option_t* = "") const;
143
144 protected:
145
159 double charge_;
160
163 double chi2_;
164 double ndf_;
165
167};
168
169} /* End of namespace genfit */
171
172#endif // genfit_FitStatus_h
void setNdf(const double &ndf)
Definition FitStatus.h:140
int getNFailedPoints() const
Definition FitStatus.h:112
bool isFitConvergedPartially() const
Definition FitStatus.h:111
ClassDef(FitStatus, 3)
PruneFlags pruneFlags_
Prune flags.
Definition FitStatus.h:157
int nFailedPoints_
Number of failed TrackPoints.
Definition FitStatus.h:153
virtual ~FitStatus()
Definition FitStatus.h:89
void setIsFitConvergedPartially(bool fitConverged=true)
Definition FitStatus.h:132
virtual double getPVal() const
Get the p value of the fit.
Definition FitStatus.h:128
double getCharge() const
Get the fitted charge.
Definition FitStatus.h:118
virtual FitStatus * clone() const
Definition FitStatus.h:91
double getNdf() const
Get the degrees of freedom of the fit.
Definition FitStatus.h:122
bool isFitConvergedPartially_
did the fit converge with a subset of all TrackPoints?
Definition FitStatus.h:151
bool hasTrackChanged() const
Has anything in the Track been changed since the fit?
Definition FitStatus.h:114
bool isFitConverged(bool inAllPoints=true) const
Did the fit converge (in all Points or only partially)?
Definition FitStatus.h:105
double charge_
fitted charge
Definition FitStatus.h:159
bool isFitted() const
Has the track been fitted?
Definition FitStatus.h:94
void setIsFitted(bool fitted=true)
Definition FitStatus.h:130
bool trackHasChanged_
has anything in the Track been changed since the fit? -> fit isn't valid anymore
Definition FitStatus.h:155
void setNFailedPoints(int nFailedPoints)
Definition FitStatus.h:133
bool isTrackPruned() const
Has the track been pruned after the fit?
Definition FitStatus.h:116
PruneFlags & getPruneFlags()
Definition FitStatus.h:137
bool isFitted_
has the track been fitted?
Definition FitStatus.h:147
bool isFitConvergedFully_
did the fit converge with all TrackPoints?
Definition FitStatus.h:149
bool isFitConvergedFully() const
Definition FitStatus.h:110
void setHasTrackChanged(bool trackChanged=true)
Definition FitStatus.h:134
void setIsFitConvergedFully(bool fitConverged=true)
Definition FitStatus.h:131
double getChi2() const
Get chi^2 of the fit.
Definition FitStatus.h:120
virtual void Print(const Option_t *="") const
Definition FitStatus.cc:88
void setChi2(const double &chi2)
Definition FitStatus.h:139
void setCharge(double charge)
Definition FitStatus.h:135
Defines for I/O streams used for error and debug printing.
Info which information has been pruned from the Track.
Definition FitStatus.h:47
void setFlags(Option_t *option="")
does not reset! If a flag is already true and is not in opt, it will stay true.
Definition FitStatus.cc:38
bool hasFlags(Option_t *option="CFLWRMIU") const
check if all the given flags are set
Definition FitStatus.cc:53
bool isPruned() const
check if any of the flags is set
Definition FitStatus.cc:68
void Print(const Option_t *="") const
Definition FitStatus.cc:73