Line data Source code
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 0 : void SetInitialParam(TVectorD *const param) { fParam=param;};
23 0 : void SetParamLimits(TMatrixD *const paramLimits) { fParamLimits=paramLimits;};
24 : //
25 0 : void SetFitFunction(TFormula *const formula) {fFormula=formula;};
26 0 : void SetWeightFunction(TFormula *const weightFunction) {fWeightFunction=weightFunction;};
27 : void SetWeightFunction(const Char_t *name, Float_t param1, Float_t param2 = 0.1);
28 0 : void SetFitAlgorithm(Char_t *const name) {fFitAlgorithm=name;};
29 0 : void SetMaxCalls(Int_t calls) {fMaxCalls = calls;};
30 0 : void SetTolerance(Double_t tol) {fPrecision = tol;};
31 0 : void SetPoints(TMatrixD *const points) {fPoints = points;};
32 0 : 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 0 : void EnableRobust(Bool_t b) {fUseRobust = b;};
37 0 : void EnableRobust(Bool_t b, Double_t sigma) {fUseRobust = b; fExpectedSigma = sigma;};
38 : //
39 0 : TMatrixD * GetPoints() const {return fPoints;};
40 0 : TVectorD * GetWeights() const {return fWeights;};
41 0 : TFormula * GetFormula() const {return fFormula;};
42 0 : TVectorD * GetParameters() const {return fParam;};
43 0 : TFormula * GetWeightFunction() const {return fWeightFunction;};
44 0 : TMatrixD * GetCovarianceMatrix() const {return fCovar;};
45 0 : Bool_t GetStatus() const {return fUseRobust;};
46 0 : 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 128 : ClassDef(AliTMinuitToolkit,1);
70 : };
71 :
72 :
73 :
74 : #endif
|