File indexing completed on 2025-10-26 08:58:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef ROOT_TBackCompFitter_H_
0011 #define ROOT_TBackCompFitter_H_
0012
0013 #include "TVirtualFitter.h"
0014 #include "Fit/BasicFCN.h"
0015 #include "Fit/FitResult.h"
0016 #include "Fit/Fitter.h"
0017 #include "Math/IFunctionfwd.h"
0018 #include <vector>
0019
0020
0021
0022
0023
0024 class TGraph;
0025 class TFitResult;
0026
0027 namespace ROOT {
0028 namespace Fit {
0029 class FitData;
0030 }
0031 namespace Math {
0032 class Minimizer;
0033 }
0034 }
0035
0036
0037 class TBackCompFitter : public TVirtualFitter {
0038
0039 private:
0040
0041 TBackCompFitter(const TBackCompFitter &) = delete;
0042 TBackCompFitter& operator=(const TBackCompFitter &) = delete;
0043
0044 public:
0045
0046 TBackCompFitter();
0047
0048
0049 TBackCompFitter( const std::shared_ptr<ROOT::Fit::Fitter> & fitter, const std::shared_ptr<ROOT::Fit::FitData> & data );
0050
0051 ~TBackCompFitter() override;
0052
0053 enum EStatusBits {
0054 kCanDeleteLast = BIT(9)
0055 };
0056
0057
0058 Double_t Chisquare(Int_t npar, Double_t *params) const override;
0059 void Clear(Option_t *option="") override;
0060 Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs) override;
0061 void FixParameter(Int_t ipar) override;
0062
0063 void GetConfidenceIntervals(Int_t n, Int_t ndim, const Double_t *x, Double_t *ci, Double_t cl=0.95) override;
0064 void GetConfidenceIntervals(TObject *obj, Double_t cl=0.95) override;
0065
0066 Double_t *GetCovarianceMatrix() const override;
0067 Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const override;
0068 Int_t GetErrors(Int_t ipar,Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const override;
0069 Int_t GetNumberTotalParameters() const override;
0070 Int_t GetNumberFreeParameters() const override;
0071
0072 Double_t GetParError(Int_t ipar) const override;
0073 Double_t GetParameter(Int_t ipar) const override;
0074 Int_t GetParameter(Int_t ipar,char *name,Double_t &value,Double_t &verr,Double_t &vlow, Double_t &vhigh) const override;
0075 const char *GetParName(Int_t ipar) const override;
0076 Int_t GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const override;
0077 Double_t GetSumLog(Int_t i) override;
0078
0079 Bool_t IsFixed(Int_t ipar) const override ;
0080
0081 void PrintResults(Int_t level, Double_t amin) const override;
0082 void ReleaseParameter(Int_t ipar) override;
0083 void SetFitMethod(const char *name) override;
0084 Int_t SetParameter(Int_t ipar,const char *parname,Double_t value,Double_t verr,Double_t vlow, Double_t vhigh) override;
0085
0086 void SetFCN(void (*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t) ) override;
0087
0088
0089 virtual void SetMethodCall(TMethodCall * m) { fMethodCall = m; }
0090
0091
0092 ROOT::Fit::FitConfig & GetFitConfig() { return fFitter->Config(); }
0093
0094
0095 const ROOT::Fit::FitResult & GetFitResult() const { return fFitter->Result(); }
0096
0097
0098 TFitResult * GetTFitResult() const;
0099
0100
0101 const ROOT::Fit::FitData & GetFitData() const { return *fFitData; }
0102
0103
0104 ROOT::Math::Minimizer * GetMinimizer() const;
0105
0106
0107 ROOT::Math::IMultiGenFunction * GetObjFunction() const;
0108
0109
0110 bool Scan(unsigned int ipar, TGraph * gr, double xmin = 0, double xmax = 0);
0111
0112
0113
0114
0115
0116
0117
0118 bool Contour(unsigned int ipar, unsigned int jpar, TGraph * gr , double confLevel = 0.683);
0119
0120
0121 virtual void SetObjFunction( ROOT::Math::IMultiGenFunction * f);
0122
0123
0124 void ReCreateMinimizer();
0125
0126
0127 protected:
0128
0129 bool ValidParameterIndex(int ipar) const;
0130 void DoSetDimension();
0131
0132 private:
0133
0134
0135 std::shared_ptr<ROOT::Fit::FitData> fFitData;
0136 std::shared_ptr<ROOT::Fit::Fitter> fFitter;
0137 ROOT::Math::Minimizer * fMinimizer;
0138 ROOT::Math::IMultiGenFunction * fObjFunc;
0139 ROOT::Math::IParamMultiFunction * fModelFunc;
0140 mutable std::vector<double> fCovar;
0141
0142
0143
0144 ClassDefOverride(TBackCompFitter,1)
0145
0146 };
0147
0148
0149
0150 #endif