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