]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STAT/AliTMinuitToolkit.h
correcting baryon mass subtraction for visible energy in MC
[u/mrichter/AliRoot.git] / STAT / AliTMinuitToolkit.h
1 #ifndef ALITMINUITTOOLKIT_H
2 #define ALITMINUITTOOLKIT_H
3
4
5 #include <TNamed.h>
6 class TH1F;
7 class TH2F;
8 class TFormula;
9 #include <TVectorDfwd.h>
10 #include <TMatrixDfwd.h>
11
12 class AliTMinuitToolkit: public TNamed{
13 public:
14   //
15   //
16   //
17   AliTMinuitToolkit();
18   virtual ~AliTMinuitToolkit();
19   
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;};
24   //
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;};
33   static void Test();
34   static void FitterFCN(int &npar, double *dummy, double &fchisq, double *gin, int iflag);
35   void Fit();
36   void EnableRobust(Bool_t b) {fUseRobust = b;};
37   void EnableRobust(Bool_t b, Double_t sigma) {fUseRobust = b; fExpectedSigma = sigma;}; 
38   //
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;};
47  
48 private:
49   //
50   AliTMinuitToolkit(const AliTMinuitToolkit&); // fake copy constr. -- suppress warnings
51   AliTMinuitToolkit& operator=(const AliTMinuitToolkit&); // fake -- suppress warnings
52   //
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, ...
56   //
57   //
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
68   //  
69   ClassDef(AliTMinuitToolkit,1);
70 };
71
72
73
74 #endif