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