alocate memory dynamically not on stack
[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;};
37 void Test();
38 static void FitterFCN(int &npar, double *dummy, double &fchisq, double *gin, int iflag);
39 void Fit();
40 //
41 TMatrixD * GetPoints() {return fPoints;};
42 TFormula * GetFormula() {return fFormula;};
43 TVectorD * GetParameters() {return fParam;};
44 TFormula * GetWeightFunction() {return fWeightFunction;};
45 TMatrixD * GetCovarianceMatrix() {return fCovar;};
46
47private:
48 //
49 TFormula * fFormula; // formula of the fitted function
50 TFormula * fWeightFunction; // weight function, must be defined between 0 and 1
51 Char_t * fFitAlgorithm; // fit algorithm for TMinuit: migrad, simplex, ...
52 //
53 //
54 TMatrixD * fPoints; // fitted points
55 TVectorD * fParam; // parameter values
56 TMatrixD * fParamLimits; // limits of the parameters (up, down)
57 TMatrixD * fCovar; // covariance matrix
58 Double_t * fChi2; // chi-square
59 Int_t fMaxCalls; // maximum number of calls, default value depends on fit algorithm
60 Double_t fPrecision; // normalized tolerance, default value depends on fit algorithm
61 //
62 ClassDef(AliTMinuitToolkit,1);
63};
64
65
66
67#endif