1 #ifndef AliTMINUITTOOLKIT_H
2 #define AliTMINUITTOOLKIT_H
6 #include <TVirtualFitter.h>
17 class AliTMinuitToolkit: public TNamed{
23 virtual ~AliTMinuitToolkit();
25 void FitHistogram(TH1F * his);
26 void FitHistogram(TH2F * his);
27 void SetInitialParam(TVectorD *param) { fParam=param;};
28 void SetParamLimits(TMatrixD *paramLimits) { fParamLimits=paramLimits;};
30 void SetFitFunction(TFormula * formula) {fFormula=formula;};
31 void SetWeightFunction(TFormula * weightFunction) {fWeightFunction=weightFunction;};
32 void SetWeightFunction(Char_t * name, Float_t param1, Float_t param2 = 0.1);
33 void SetFitAlgorithm(Char_t * name) {fFitAlgorithm=name;};
34 void SetMaxCalls(Int_t calls) {fMaxCalls = calls;};
35 void SetTolerance(Double_t tol) {fPrecision = tol;};
36 void SetPoints(TMatrixD * points) {fPoints = points;};
37 void SetWeights(TVectorD * weights) {fWeights = weights;};
39 static void FitterFCN(int &npar, double *dummy, double &fchisq, double *gin, int iflag);
41 void EnableRobust(Bool_t b) {fUseRobust = b;};
42 void EnableRobust(Bool_t b, Double_t sigma) {fUseRobust = b; fExpectedSigma = sigma;};
44 TMatrixD * GetPoints() {return fPoints;};
45 TVectorD * GetWeights() {return fWeights;};
46 TFormula * GetFormula() {return fFormula;};
47 TVectorD * GetParameters() {return fParam;};
48 TFormula * GetWeightFunction() {return fWeightFunction;};
49 TMatrixD * GetCovarianceMatrix() {return fCovar;};
50 Bool_t GetStatus() {return fUseRobust;};
51 Double_t GetExpectedSigma() {return fExpectedSigma;};
55 AliTMinuitToolkit(const AliTMinuitToolkit&); // fake copy constr. -- suppress warnings
56 AliTMinuitToolkit& operator=(const AliTMinuitToolkit&); // fake -- suppress warnings
58 TFormula * fFormula; // formula of the fitted function
59 TFormula * fWeightFunction; // weight function, must be defined between 0 and 1
60 Char_t * fFitAlgorithm; // fit algorithm for TMinuit: migrad, simplex, ...
63 TMatrixD * fPoints; // fitted points
64 TVectorD * fWeights; // weights of the points
65 TVectorD * fParam; // parameter values
66 TMatrixD * fParamLimits; // limits of the parameters (up, down)
67 TMatrixD * fCovar; // covariance matrix
68 Double_t * fChi2; // chi-square
69 Int_t fMaxCalls; // maximum number of calls, default value depends on fit algorithm
70 Double_t fPrecision; // normalized tolerance, default value depends on fit algorithm
71 Bool_t fUseRobust; // switch on/off robust option, default: kFalse
72 Double_t fExpectedSigma; // expected sigma to normalize robust fitting
74 ClassDef(AliTMinuitToolkit,1);