#ifndef ROOT_TMultiDimFit
#define ROOT_TMultiDimFit
#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
#ifndef ROOT_TVectorD
#include "TVectorD.h"
#endif
#ifndef ROOT_TMatrixD
#include "TMatrixD.h"
#endif
#ifndef ROOT_TList
#include "TList.h"
#endif
#ifndef ROOT_TVirtualFitter
#include "TVirtualFitter.h"
#endif
class TBrowser;
class TMultiDimFit : public TNamed {
public:
enum EMDFPolyType {
kMonomials,
kChebyshev,
kLegendre
};
private:
static TMultiDimFit* fgInstance;
protected:
TVectorD fQuantity;
TVectorD fSqError;
Double_t fMeanQuantity;
Double_t fMaxQuantity;
Double_t fMinQuantity;
Double_t fSumSqQuantity;
Double_t fSumSqAvgQuantity;
TVectorD fVariables;
Int_t fNVariables;
TVectorD fMeanVariables;
TVectorD fMaxVariables;
TVectorD fMinVariables;
Int_t fSampleSize;
TVectorD fTestQuantity;
TVectorD fTestSqError;
TVectorD fTestVariables;
Int_t fTestSampleSize;
Double_t fMinAngle;
Double_t fMaxAngle;
Int_t fMaxTerms;
Double_t fMinRelativeError;
Int_t *fMaxPowers;
Double_t fPowerLimit;
TMatrixD fFunctions;
Int_t fMaxFunctions;
Int_t *fFunctionCodes;
Int_t fMaxStudy;
Int_t fMaxFuncNV;
TMatrixD fOrthFunctions;
TVectorD fOrthFunctionNorms;
Int_t *fMaxPowersFinal;
Int_t *fPowers;
Int_t *fPowerIndex;
TVectorD fResiduals;
Double_t fMaxResidual;
Double_t fMinResidual;
Int_t fMaxResidualRow;
Int_t fMinResidualRow;
Double_t fSumSqResidual;
Int_t fNCoefficients;
TVectorD fOrthCoefficients;
TMatrixD fOrthCurvatureMatrix;
TVectorD fCoefficients;
TVectorD fCoefficientsRMS;
Double_t fRMS;
Double_t fChi2;
Int_t fParameterisationCode;
Double_t fError;
Double_t fTestError;
Double_t fPrecision;
Double_t fTestPrecision;
Double_t fCorrelationCoeff;
TMatrixD fCorrelationMatrix;
Double_t fTestCorrelationCoeff;
TList* fHistograms;
Byte_t fHistogramMask;
Int_t fBinVarX;
Int_t fBinVarY;
TVirtualFitter* fFitter;
EMDFPolyType fPolyType;
Bool_t fShowCorrelation;
Bool_t fIsUserFunction;
Bool_t fIsVerbose;
virtual Double_t EvalFactor(Int_t p, Double_t x) const;
virtual Double_t EvalControl(const Int_t *powers) const;
virtual void MakeCoefficientErrors();
virtual void MakeCorrelation();
virtual Double_t MakeGramSchmidt(Int_t function);
virtual void MakeCoefficients();
virtual void MakeCandidates();
virtual void MakeNormalized();
virtual void MakeParameterization();
virtual void MakeRealCode(const char *filename,
const char *classname,
Option_t *option="");
virtual Bool_t Select(const Int_t *iv);
virtual Bool_t TestFunction(Double_t squareResidual,
Double_t dResidur);
public:
TMultiDimFit();
TMultiDimFit(Int_t dimension,
EMDFPolyType type=kMonomials,
Option_t *option="");
virtual ~TMultiDimFit();
virtual void AddRow(const Double_t *x, Double_t D, Double_t E=0);
virtual void AddTestRow(const Double_t *x, Double_t D, Double_t E=0);
virtual void Browse(TBrowser* b);
virtual void Clear(Option_t *option="");
virtual void Draw(Option_t * ="d") { }
virtual Double_t Eval(const Double_t *x, const Double_t *coeff=0) const;
virtual Double_t EvalError(const Double_t *x, const Double_t *coeff=0) const;
virtual void FindParameterization(Option_t* option="");
virtual void Fit(Option_t *option="");
Double_t GetChi2() const { return fChi2; }
const TMatrixD* GetCorrelationMatrix() const { return &fCorrelationMatrix; }
const TVectorD* GetCoefficients() const { return &fCoefficients; }
Double_t GetError() const { return fError; }
Int_t* GetFunctionCodes() const { return fFunctionCodes; }
const TMatrixD* GetFunctions() const { return &fFunctions; }
virtual TList* GetHistograms() const { return fHistograms; }
Double_t GetMaxAngle() const { return fMaxAngle; }
Int_t GetMaxFunctions() const { return fMaxFunctions; }
Int_t* GetMaxPowers() const { return fMaxPowers; }
Double_t GetMaxQuantity() const { return fMaxQuantity; }
Int_t GetMaxStudy() const { return fMaxStudy; }
Int_t GetMaxTerms() const { return fMaxTerms; }
const TVectorD* GetMaxVariables() const { return &fMaxVariables; }
Double_t GetMeanQuantity() const { return fMeanQuantity; }
const TVectorD* GetMeanVariables() const { return &fMeanVariables; }
Double_t GetMinAngle() const { return fMinAngle; }
Double_t GetMinQuantity() const { return fMinQuantity; }
Double_t GetMinRelativeError() const { return fMinRelativeError; }
const TVectorD* GetMinVariables() const { return &fMinVariables; }
Int_t GetNVariables() const { return fNVariables; }
Int_t GetNCoefficients() const { return fNCoefficients; }
Int_t GetPolyType() const { return fPolyType; }
Int_t* GetPowerIndex() const { return fPowerIndex; }
Double_t GetPowerLimit() const { return fPowerLimit; }
const Int_t* GetPowers() const { return fPowers; }
Double_t GetPrecision() const { return fPrecision; }
const TVectorD* GetQuantity() const { return &fQuantity; }
Double_t GetResidualMax() const { return fMaxResidual; }
Double_t GetResidualMin() const { return fMinResidual; }
Int_t GetResidualMaxRow() const { return fMaxResidualRow; }
Int_t GetResidualMinRow() const { return fMinResidualRow; }
Double_t GetResidualSumSq() const { return fSumSqResidual; }
Double_t GetRMS() const { return fRMS; }
Int_t GetSampleSize() const { return fSampleSize; }
const TVectorD* GetSqError() const { return &fSqError; }
Double_t GetSumSqAvgQuantity() const { return fSumSqAvgQuantity; }
Double_t GetSumSqQuantity() const { return fSumSqQuantity; }
Double_t GetTestError() const { return fTestError; }
Double_t GetTestPrecision() const { return fTestPrecision; }
const TVectorD* GetTestQuantity() const { return &fTestQuantity; }
Int_t GetTestSampleSize() const { return fTestSampleSize; }
const TVectorD* GetTestSqError() const { return &fTestSqError; }
const TVectorD* GetTestVariables() const { return &fTestVariables; }
const TVectorD* GetVariables() const { return &fVariables; }
static TMultiDimFit* Instance();
virtual Bool_t IsFolder() const { return kTRUE; }
virtual Double_t MakeChi2(const Double_t* coeff=0);
virtual void MakeCode(const char *functionName="MDF", Option_t *option="");
virtual void MakeHistograms(Option_t* option="A");
virtual void MakeMethod(const Char_t* className="MDF", Option_t* option="");
virtual void Print(Option_t *option="ps") const;
void SetBinVarX(Int_t nbbinvarx) {fBinVarX = nbbinvarx;}
void SetBinVarY(Int_t nbbinvary) {fBinVarY = nbbinvary;}
void SetMaxAngle(Double_t angle=0);
void SetMaxFunctions(Int_t n) { fMaxFunctions = n; }
void SetMaxPowers(const Int_t *powers);
void SetMaxStudy(Int_t n) { fMaxStudy = n; }
void SetMaxTerms(Int_t terms) { fMaxTerms = terms; }
void SetMinRelativeError(Double_t error);
void SetMinAngle(Double_t angle=1);
void SetPowerLimit(Double_t limit=1e-3);
virtual void SetPowers(const Int_t *powers, Int_t terms);
ClassDef(TMultiDimFit,2)
}
;
#endif