Warning, file /include/root/TMultiDimFit.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef ROOT_TMultiDimFit
0005 #define ROOT_TMultiDimFit
0006
0007 #include "TNamed.h"
0008 #include "TVectorD.h"
0009 #include "TMatrixD.h"
0010 #include "TVirtualFitter.h"
0011
0012 class TBrowser;
0013 class TList;
0014
0015 class TMultiDimFit : public TNamed {
0016
0017 public:
0018 enum EMDFPolyType {
0019 kMonomials,
0020 kChebyshev,
0021 kLegendre
0022 };
0023
0024 private:
0025 static TMultiDimFit* fgInstance;
0026 protected:
0027
0028 TVectorD fQuantity;
0029 TVectorD fSqError;
0030 Double_t fMeanQuantity;
0031 Double_t fMaxQuantity;
0032 Double_t fMinQuantity;
0033 Double_t fSumSqQuantity;
0034 Double_t fSumSqAvgQuantity;
0035
0036 TVectorD fVariables;
0037 Int_t fNVariables;
0038 TVectorD fMeanVariables;
0039 TVectorD fMaxVariables;
0040 TVectorD fMinVariables;
0041
0042 Int_t fSampleSize;
0043
0044 TVectorD fTestQuantity;
0045 TVectorD fTestSqError;
0046 TVectorD fTestVariables;
0047
0048 Int_t fTestSampleSize;
0049
0050 Double_t fMinAngle;
0051 Double_t fMaxAngle;
0052 Int_t fMaxTerms;
0053 Double_t fMinRelativeError;
0054 Int_t *fMaxPowers;
0055 Double_t fPowerLimit;
0056
0057
0058 TMatrixD fFunctions;
0059 Int_t fMaxFunctions;
0060 Int_t *fFunctionCodes;
0061 Int_t fMaxStudy;
0062 Int_t fMaxFuncNV;
0063
0064 TMatrixD fOrthFunctions;
0065 TVectorD fOrthFunctionNorms;
0066
0067
0068 Int_t *fMaxPowersFinal;
0069 Int_t *fPowers;
0070 Int_t *fPowerIndex;
0071
0072 TVectorD fResiduals;
0073 Double_t fMaxResidual;
0074 Double_t fMinResidual;
0075 Int_t fMaxResidualRow;
0076 Int_t fMinResidualRow;
0077 Double_t fSumSqResidual;
0078
0079 Int_t fNCoefficients;
0080 TVectorD fOrthCoefficients;
0081 TMatrixD fOrthCurvatureMatrix;
0082 TVectorD fCoefficients;
0083 TVectorD fCoefficientsRMS;
0084 Double_t fRMS;
0085 Double_t fChi2;
0086 Int_t fParameterisationCode;
0087
0088 Double_t fError;
0089 Double_t fTestError;
0090 Double_t fPrecision;
0091 Double_t fTestPrecision;
0092 Double_t fCorrelationCoeff;
0093 TMatrixD fCorrelationMatrix;
0094 Double_t fTestCorrelationCoeff;
0095
0096 TList* fHistograms;
0097 Byte_t fHistogramMask;
0098 Int_t fBinVarX;
0099 Int_t fBinVarY;
0100
0101 TVirtualFitter* fFitter;
0102
0103 EMDFPolyType fPolyType;
0104 Bool_t fShowCorrelation;
0105 Bool_t fIsUserFunction;
0106 Bool_t fIsVerbose;
0107
0108 virtual Double_t EvalFactor(Int_t p, Double_t x) const;
0109 virtual Double_t EvalControl(const Int_t *powers) const;
0110 virtual void MakeCoefficientErrors();
0111 virtual void MakeCorrelation();
0112 virtual Double_t MakeGramSchmidt(Int_t function);
0113 virtual void MakeCoefficients();
0114 virtual void MakeCandidates();
0115 virtual void MakeNormalized();
0116 virtual void MakeParameterization();
0117 virtual void MakeRealCode(const char *filename,
0118 const char *classname,
0119 Option_t *option="");
0120 virtual Bool_t Select(const Int_t *iv);
0121 virtual Bool_t TestFunction(Double_t squareResidual,
0122 Double_t dResidur);
0123 public:
0124 TMultiDimFit();
0125 TMultiDimFit(Int_t dimension,
0126 EMDFPolyType type=kMonomials,
0127 Option_t *option="");
0128 ~TMultiDimFit() override;
0129
0130 virtual void AddRow(const Double_t *x, Double_t D, Double_t E=0);
0131 virtual void AddTestRow(const Double_t *x, Double_t D, Double_t E=0);
0132 void Browse(TBrowser* b) override;
0133 void Clear(Option_t *option="") override;
0134 void Draw(Option_t * ="d") override { }
0135 virtual Double_t Eval(const Double_t *x, const Double_t *coeff = nullptr) const;
0136 virtual Double_t EvalError(const Double_t *x, const Double_t *coeff = nullptr) const;
0137 virtual void FindParameterization(Option_t* option="");
0138 virtual void Fit(Option_t *option="");
0139
0140 Double_t GetChi2() const { return fChi2; }
0141 const TMatrixD* GetCorrelationMatrix() const { return &fCorrelationMatrix; }
0142 const TVectorD* GetCoefficients() const { return &fCoefficients; }
0143 const TVectorD* GetCoefficientsRMS() const { return &fCoefficientsRMS; }
0144 Double_t GetError() const { return fError; }
0145 Int_t* GetFunctionCodes() const { return fFunctionCodes; }
0146 const TMatrixD* GetFunctions() const { return &fFunctions; }
0147 virtual TList* GetHistograms() const { return fHistograms; }
0148 Double_t GetMaxAngle() const { return fMaxAngle; }
0149 Int_t GetMaxFunctions() const { return fMaxFunctions; }
0150 Int_t* GetMaxPowers() const { return fMaxPowers; }
0151 Double_t GetMaxQuantity() const { return fMaxQuantity; }
0152 Int_t GetMaxStudy() const { return fMaxStudy; }
0153 Int_t GetMaxTerms() const { return fMaxTerms; }
0154 const TVectorD* GetMaxVariables() const { return &fMaxVariables; }
0155 Double_t GetMeanQuantity() const { return fMeanQuantity; }
0156 const TVectorD* GetMeanVariables() const { return &fMeanVariables; }
0157 Double_t GetMinAngle() const { return fMinAngle; }
0158 Double_t GetMinQuantity() const { return fMinQuantity; }
0159 Double_t GetMinRelativeError() const { return fMinRelativeError; }
0160 const TVectorD* GetMinVariables() const { return &fMinVariables; }
0161 Int_t GetNVariables() const { return fNVariables; }
0162 Int_t GetNCoefficients() const { return fNCoefficients; }
0163 Int_t GetPolyType() const { return fPolyType; }
0164 Int_t* GetPowerIndex() const { return fPowerIndex; }
0165 Double_t GetPowerLimit() const { return fPowerLimit; }
0166 const Int_t* GetPowers() const { return fPowers; }
0167 Double_t GetPrecision() const { return fPrecision; }
0168 const TVectorD* GetQuantity() const { return &fQuantity; }
0169 Double_t GetResidualMax() const { return fMaxResidual; }
0170 Double_t GetResidualMin() const { return fMinResidual; }
0171 Int_t GetResidualMaxRow() const { return fMaxResidualRow; }
0172 Int_t GetResidualMinRow() const { return fMinResidualRow; }
0173 Double_t GetResidualSumSq() const { return fSumSqResidual; }
0174 Double_t GetRMS() const { return fRMS; }
0175 Int_t GetSampleSize() const { return fSampleSize; }
0176 const TVectorD* GetSqError() const { return &fSqError; }
0177 Double_t GetSumSqAvgQuantity() const { return fSumSqAvgQuantity; }
0178 Double_t GetSumSqQuantity() const { return fSumSqQuantity; }
0179 Double_t GetTestError() const { return fTestError; }
0180 Double_t GetTestPrecision() const { return fTestPrecision; }
0181 const TVectorD* GetTestQuantity() const { return &fTestQuantity; }
0182 Int_t GetTestSampleSize() const { return fTestSampleSize; }
0183 const TVectorD* GetTestSqError() const { return &fTestSqError; }
0184 const TVectorD* GetTestVariables() const { return &fTestVariables; }
0185 const TVectorD* GetVariables() const { return &fVariables; }
0186
0187 static TMultiDimFit* Instance();
0188 Bool_t IsFolder() const override { return kTRUE; }
0189 virtual Double_t MakeChi2(const Double_t* coeff = nullptr);
0190 virtual void MakeCode(const char *functionName="MDF", Option_t *option="");
0191 virtual void MakeHistograms(Option_t* option="A");
0192 virtual void MakeMethod(const Char_t* className="MDF", Option_t* option="");
0193 void Print(Option_t *option="ps") const override;
0194
0195 void SetBinVarX(Int_t nbbinvarx) {fBinVarX = nbbinvarx;}
0196 void SetBinVarY(Int_t nbbinvary) {fBinVarY = nbbinvary;}
0197 void SetMaxAngle(Double_t angle=0);
0198 void SetMaxFunctions(Int_t n) { fMaxFunctions = n; }
0199 void SetMaxPowers(const Int_t *powers);
0200 void SetMaxStudy(Int_t n) { fMaxStudy = n; }
0201 void SetMaxTerms(Int_t terms) { fMaxTerms = terms; }
0202 void SetMinRelativeError(Double_t error);
0203 void SetMinAngle(Double_t angle=1);
0204 void SetPowerLimit(Double_t limit=1e-3);
0205 virtual void SetPowers(const Int_t *powers, Int_t terms);
0206
0207 ClassDefOverride(TMultiDimFit,2)
0208 }
0209 ;
0210 #endif