Line data Source code
1 : // Author: Daniel.Lohner@cern.ch
2 :
3 : #ifndef ALIROOT_AliTRDNDFast
4 : #define ALIROOT_AliTRDNDFast
5 :
6 : #ifndef ROOT_TH1
7 : #include "TH1F.h"
8 : #endif
9 : #ifndef ROOT_TArrayF
10 : #include "TArrayF.h"
11 : #endif
12 : #ifndef ROOT_TF2
13 : #include "TF1.h"
14 : #endif
15 : #ifndef ROOT_TMath
16 : #include "TMath.h"
17 : #endif
18 : #ifndef ROOT_TRandom
19 : #include "TRandom.h"
20 : #endif
21 :
22 : using namespace std;
23 :
24 : extern Double_t langaufun(Double_t *x,Double_t *par);
25 :
26 : class AliTRDNDFast : public TObject {
27 :
28 : public:
29 : static const Int_t kNpar = 5;
30 :
31 : AliTRDNDFast();
32 : AliTRDNDFast(const char *name,Int_t ndim,Int_t nbins,Double_t xlow,Double_t xup);
33 : AliTRDNDFast(const AliTRDNDFast&);
34 : AliTRDNDFast &operator=(const AliTRDNDFast &ref);
35 : virtual ~AliTRDNDFast();
36 :
37 : TF1 *FitLandau(TString name,TH1F *htemp,Double_t range[2],TString option);
38 :
39 : void Build(TH1F **hdEdx,TString path="");
40 : void Build(Double_t **pars);
41 : Double_t Eval(Double_t *point) const;
42 : void Random(Double_t *point) const;
43 0 : Int_t GetNDim(){return fNDim;};
44 0 : Double_t GetParam(Int_t dim,Int_t par){if((dim>=0)&&(dim<fNDim)&&(par>=0)&&(par<kNpar)){return fPars[par].GetAt(dim);}else{return 0;}};
45 : void PrintPars();
46 : static void Random(Double_t *point,AliTRDNDFast *nd0,AliTRDNDFast *nd1,Double_t w0,Double_t w1);
47 :
48 : private:
49 :
50 : void ScaleLangauFun(TF1 *func,Double_t mpv);
51 : TF1 *GetLangauFun(TString funcname,Double_t range[2],Double_t scalefactor=1);
52 : void BuildHistos();
53 : void Init();
54 : void Cleanup();
55 :
56 : static Int_t BinarySearchInterpolation(Int_t start,Int_t end,Double_t *a0,Double_t *a1,Double_t w0,Double_t w1,Double_t val);
57 : static Double_t GetRandomInterpolation(TH1F *hist0,TH1F *hist1,Double_t w0,Double_t w1);
58 :
59 : Int_t fNDim; // Dimensions
60 : TString fTitle; //title
61 : TF1 **fFunc; //! functions, do not store
62 : TH1F **fHistos; //[fNDim] Histograms
63 : TArrayF fPars[kNpar]; // parameters
64 :
65 176 : ClassDef(AliTRDNDFast,1) //Fast TRD ND class
66 : };
67 :
68 : #endif
|