syst. check that reads the MC information for the case of TPC-only
[u/mrichter/AliRoot.git] / STAT / AliTMinuitToolkit.h
CommitLineData
4b23a517 1#ifndef AliTMINUITTOOLKIT_H
2#define AliTMINUITTOOLKIT_H
3
4
5#include <TNamed.h>
6#include <TVirtualFitter.h>
7#include <TH1F.h>
8#include <TH2F.h>
9#include <TF1.h>
10#include <TFormula.h>
11#include <TVectorD.h>
12#include <TMatrixD.h>
13#include <TMath.h>
14#include <TString.h>
15
16
17class AliTMinuitToolkit: public TNamed{
18 //
19 //
20 //
21public:
22 AliTMinuitToolkit();
23 virtual ~AliTMinuitToolkit();
24
25 void FitHistogram(TH1F * his);
26 void FitHistogram(TH2F * his);
27 void SetInitialParam(TVectorD *param) { fParam=param;};
28 void SetParamLimits(TMatrixD *paramLimits) { fParamLimits=paramLimits;};
29 //
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;};
dc697472 37 void SetWeights(TVectorD * weights) {fWeights = weights;};
305a4a95 38 static void Test();
4b23a517 39 static void FitterFCN(int &npar, double *dummy, double &fchisq, double *gin, int iflag);
40 void Fit();
dc697472 41 void EnableRobust(Bool_t b) {fUseRobust = b;};
42 void EnableRobust(Bool_t b, Double_t sigma) {fUseRobust = b; fExpectedSigma = sigma;};
4b23a517 43 //
44 TMatrixD * GetPoints() {return fPoints;};
dc697472 45 TVectorD * GetWeights() {return fWeights;};
4b23a517 46 TFormula * GetFormula() {return fFormula;};
47 TVectorD * GetParameters() {return fParam;};
48 TFormula * GetWeightFunction() {return fWeightFunction;};
49 TMatrixD * GetCovarianceMatrix() {return fCovar;};
dc697472 50 Bool_t GetStatus() {return fUseRobust;};
51 Double_t GetExpectedSigma() {return fExpectedSigma;};
4b23a517 52
53private:
54 //
dc697472 55 AliTMinuitToolkit(const AliTMinuitToolkit&); // fake copy constr. -- suppress warnings
da7c9ae3 56 AliTMinuitToolkit& operator=(const AliTMinuitToolkit&); // fake -- suppress warnings
57 //
4b23a517 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, ...
61 //
62 //
63 TMatrixD * fPoints; // fitted points
dc697472 64 TVectorD * fWeights; // weights of the points
4b23a517 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
dc697472 71 Bool_t fUseRobust; // switch on/off robust option, default: kFalse
72 Double_t fExpectedSigma; // expected sigma to normalize robust fitting
4b23a517 73 //
74 ClassDef(AliTMinuitToolkit,1);
75};
76
77
78
79#endif