Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:23

0001 /* Copyright 2008-2010, Technische Universitaet Muenchen,
0002    Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
0003 
0004    This file is part of GENFIT.
0005 
0006    GENFIT is free software: you can redistribute it and/or modify
0007    it under the terms of the GNU Lesser General Public License as published
0008    by the Free Software Foundation, either version 3 of the License, or
0009    (at your option) any later version.
0010 
0011    GENFIT is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014    GNU Lesser General Public License for more details.
0015 
0016    You should have received a copy of the GNU Lesser General Public License
0017    along with GENFIT.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 /** @addtogroup genfit
0020  * @{
0021  */
0022 
0023 #ifndef genfit_KalmanFitStatus_h
0024 #define genfit_KalmanFitStatus_h
0025 
0026 #include "FitStatus.h"
0027 
0028 #include <Math/ProbFunc.h>
0029 
0030 
0031 namespace genfit {
0032 
0033 /**
0034  * @brief FitStatus for use with AbsKalmanFitter implementations
0035  */
0036 class KalmanFitStatus : public FitStatus {
0037 
0038  public:
0039 
0040   KalmanFitStatus() :
0041     FitStatus(), numIterations_(0), fittedWithDaf_(false), fittedWithReferenceTrack_(false),
0042     trackLen_(0), fChi2_(-1e99), fNdf_(-1e99), fPval_(-1e99) {;}
0043 
0044   virtual ~KalmanFitStatus() {};
0045 
0046   virtual FitStatus* clone() const override {return new KalmanFitStatus(*this);}
0047 
0048   unsigned int getNumIterations() const {return numIterations_;}
0049   bool isFittedWithDaf() const {return fittedWithDaf_;}
0050   bool isFittedWithReferenceTrack() const {return fittedWithReferenceTrack_;}
0051   double getTrackLen() const {return trackLen_;}
0052   double getForwardChi2() const {return fChi2_;}
0053   double getBackwardChi2() const {return FitStatus::getChi2();}
0054   double getForwardNdf() const {return fNdf_;}
0055   double getBackwardNdf() const {return FitStatus::getNdf();}
0056   // virtual double getPVal() : not overridden, as it does the right thing.
0057   double getForwardPVal() const {return std::max(0.,ROOT::Math::chisquared_cdf_c(fChi2_, fNdf_));}
0058   double getBackwardPVal() const {return FitStatus::getPVal(); }
0059 
0060   void setNumIterations(unsigned int numIterations) {numIterations_ = numIterations;}
0061   void setIsFittedWithDaf(bool fittedWithDaf = true) {fittedWithDaf_ = fittedWithDaf;}
0062   void setIsFittedWithReferenceTrack(bool fittedWithReferenceTrack = true) {fittedWithReferenceTrack_ = fittedWithReferenceTrack;}
0063   void setTrackLen(double trackLen) {trackLen_ = trackLen;}
0064   void setForwardChi2(double fChi2) {fChi2_ = fChi2;}
0065   void setBackwardChi2(double bChi2) {FitStatus::setChi2(bChi2);}
0066   void setForwardNdf(double fNdf) {fNdf_ = fNdf;}
0067   void setBackwardNdf(double bNdf) {FitStatus::setNdf(bNdf);}
0068 
0069   virtual void Print(const Option_t* = "") const override;
0070 
0071  protected:
0072 
0073   unsigned int numIterations_; // number of iterations that have been performed
0074   bool fittedWithDaf_;
0075   bool fittedWithReferenceTrack_;
0076 
0077   double trackLen_;
0078 
0079   double fChi2_; // chi^2 of the forward fit
0080   double fNdf_; // degrees of freedom of the forward fit
0081   double fPval_; // p-value of the forward fit, set whenever either of chi2 or ndf changes
0082 
0083  public:
0084 
0085   ClassDefOverride(KalmanFitStatus, 1)
0086 
0087 };
0088 
0089 } /* End of namespace genfit */
0090 /** @} */
0091 
0092 #endif // genfit_KalmanFitStatus_h