]>
Commit | Line | Data |
---|---|---|
b7d1d891 | 1 | #ifndef ALITMINUITTOOLKIT_H |
2 | #define ALITMINUITTOOLKIT_H | |
4b23a517 | 3 | |
4 | ||
5 | #include <TNamed.h> | |
b7d1d891 | 6 | class TH1F; |
7 | class TH2F; | |
8 | class TFormula; | |
9 | #include <TVectorDfwd.h> | |
10 | #include <TMatrixDfwd.h> | |
4b23a517 | 11 | |
12 | class AliTMinuitToolkit: public TNamed{ | |
b7d1d891 | 13 | public: |
4b23a517 | 14 | // |
15 | // | |
16 | // | |
4b23a517 | 17 | AliTMinuitToolkit(); |
18 | virtual ~AliTMinuitToolkit(); | |
19 | ||
b7d1d891 | 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;}; | |
4b23a517 | 24 | // |
b7d1d891 | 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;}; | |
4b23a517 | 29 | void SetMaxCalls(Int_t calls) {fMaxCalls = calls;}; |
30 | void SetTolerance(Double_t tol) {fPrecision = tol;}; | |
b7d1d891 | 31 | void SetPoints(TMatrixD *const points) {fPoints = points;}; |
32 | void SetWeights(TVectorD *const weights) {fWeights = weights;}; | |
305a4a95 | 33 | static void Test(); |
b7d1d891 | 34 | static void FitterFCN(int &npar, double *dummy, double &fchisq, double *gin, int iflag); |
4b23a517 | 35 | void Fit(); |
dc697472 | 36 | void EnableRobust(Bool_t b) {fUseRobust = b;}; |
37 | void EnableRobust(Bool_t b, Double_t sigma) {fUseRobust = b; fExpectedSigma = sigma;}; | |
4b23a517 | 38 | // |
b7d1d891 | 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;}; | |
4b23a517 | 47 | |
48 | private: | |
da7c9ae3 | 49 | // |
dc697472 | 50 | AliTMinuitToolkit(const AliTMinuitToolkit&); // fake copy constr. -- suppress warnings |
da7c9ae3 | 51 | AliTMinuitToolkit& operator=(const AliTMinuitToolkit&); // fake -- suppress warnings |
4b23a517 | 52 | // |
53 | TFormula * fFormula; // formula of the fitted function | |
54 | TFormula * fWeightFunction; // weight function, must be defined between 0 and 1 | |
bf7bd859 | 55 | TString fFitAlgorithm; // fit algorithm for TMinuit: migrad, simplex, ... |
4b23a517 | 56 | // |
57 | // | |
58 | TMatrixD * fPoints; // fitted points | |
dc697472 | 59 | TVectorD * fWeights; // weights of the points |
4b23a517 | 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 | |
dc697472 | 66 | Bool_t fUseRobust; // switch on/off robust option, default: kFalse |
67 | Double_t fExpectedSigma; // expected sigma to normalize robust fitting | |
4b23a517 | 68 | // |
69 | ClassDef(AliTMinuitToolkit,1); | |
70 | }; | |
71 | ||
72 | ||
73 | ||
74 | #endif |