]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/SPECTRA/Fit/AliBWFunc.h
Removing try/catch-es
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / Fit / AliBWFunc.h
1 //----------------------------------------------------------------------
2 //                              AliBWFunc
3 //
4 // This class implements several function useful to fit pt spectra,
5 // including but not limited to blast wave models.
6 //
7 // It can return the same functional for as a function of different
8 // variables: dNdpt vs pt, 1/pt dNdpt vs pt, 1/mt dNdmt vs mt. 
9 //
10 // Before getting the function you need, you have to chose the
11 // variable you want to use calling AliBWFunc::SetVarType with one of
12 // the elements of the VarType_t enum.
13 //
14 // Author: M. Floris, CERN
15 //----------------------------------------------------------------------
16
17 #ifndef ALIBWFUNC_H
18 #define ALIBWFUNC_H
19
20 #if !defined(__CINT__) || defined(__MAKECINT__)
21
22 #include "TObject.h"
23
24 class TF1;
25 class TH1;
26 class TGraph;
27 #endif
28
29
30
31 class AliBWFunc : public TObject {
32
33
34 public:
35   // define the variables used for the function
36   typedef enum {kdNdpt,kOneOverPtdNdpt,kOneOverMtdNdmt,kdNdmt,kOneOverMtdNdmtMinusM} VarType_t;
37
38   AliBWFunc();
39   ~AliBWFunc();
40
41   // Boltzmann-Gibbs Blast Wave
42   TF1 * GetBGBW(Double_t mass, Double_t beta, Double_t T, Double_t n,
43                 Double_t norm, const char * name = "fBGBW");
44
45   
46   // Boltzmann
47   TF1 * GetBoltzmann(Double_t mass, Double_t T, Double_t norm, const char * name ="fBoltzmann");
48
49   // Tsallis blast wave
50   TF1 * GetTsallisBW(Double_t mass, Double_t beta, Double_t T, Double_t q,
51                      Double_t norm, Double_t ymax = 0.5, const char * name = "fTsallisBW");
52
53   // Simple exponential in 1/mt*dNdmt
54   TF1 * GetMTExp(Double_t mass, Double_t T, Double_t norm, const char * name ="fMtExp");
55
56   // Simple exponential in 1/pt*dNdpt
57   TF1 * GetPTExp(Double_t T, Double_t norm, const char * name ="fPtExp");
58
59   // Tsallis (no BW, a la CMS)
60   TF1 * GetTsallis(Double_t mass, Double_t T, Double_t q, Double_t norm, const char * name="fTsallis") 
61   {return GetLevi (mass,T,1/(q-1),norm,name);}
62   
63   // Levi function (aka Tsallis)
64   TF1 * GetLevi(Double_t mass, Double_t T, Double_t n, Double_t norm, const char * name="fLevi");
65
66   // UA1 function 
67   TF1 * GetUA1(Double_t mass, Double_t p0star, Double_t pt0, Double_t n, Double_t T, Double_t norm, const char * name="fUA1");
68
69   // Function derived from a histo
70   TF1 * GetHistoFunc(TH1 * h, const char * name = "fHisto");
71
72   // Function derived from a graph
73   TF1 * GetGraphFunc(TGraph * h, const char * name = "fHisto");
74
75   // Power law
76   TF1 * GetPowerLaw(Double_t pt0, Double_t n, Double_t norm, const char * name="fPowerLaw");
77   
78
79   // Bose-Einstein
80   TF1 * GetBoseEinstein(Double_t mass, Double_t T, Double_t norm, const char * name="fBoseEinstein");
81
82   // Fermi-Dirac
83   TF1 * GetFermiDirac(Double_t mass, Double_t T, Double_t norm, const char * name="fFermiDirac");
84
85
86   void SetVarType(VarType_t tp) {fVarType=tp;}
87
88 protected:
89
90   // dNdpt here means 1/pt dN/dpt
91   
92
93   // Boltzmann-Gibbs blast wave
94   TF1 * GetBGBWdNdpt(Double_t mass, Double_t beta, Double_t temp,
95                      Double_t n, Double_t norm, const char * name= "fBGBW");
96
97   // Tsallis blast wave
98   TF1 * GetTsallisBWdNdpt(Double_t mass, Double_t beta, Double_t T, Double_t q,
99                           Double_t norm, Double_t ymax = 0.5, const char * name = "fTsallisBW");
100
101   // Simple exponential in 1/mt*MT
102   TF1 * GetMTExpdNdpt(Double_t mass, Double_t T, Double_t norm, const char * name ="fExp");
103
104   // Bose-Einstein
105   TF1 * GetBoseEinsteindNdpt(Double_t mass, Double_t T, Double_t norm, const char * name="fBoseEinstein");
106
107   // Fermi-Dirac
108   TF1 * GetFermiDiracdNdpt(Double_t mass, Double_t T, Double_t norm, const char * name="fFermiDirac");
109
110
111   // Tsallis (no BW, a la CMS)
112   TF1 * GetTsallisdNdpt(Double_t mass, Double_t T, Double_t q, Double_t norm, const char * name="fTsallis");
113
114   // Levi function
115   TF1 * GetLevidNdpt(Double_t mass, Double_t T, Double_t n, Double_t norm, const char * name="fLevi");
116
117   // Power Law function
118   TF1 * GetPowerLawdNdpt(Double_t pt0, Double_t n, Double_t norm, const char * name="fLevi");
119
120   // UA1 function
121   TF1 * GetUA1dNdpt(Double_t pt0, Double_t n, Double_t norm, const char * name="fLevi");
122
123   // TimesPt means dNdpt
124
125   // Boltzmann-Gibbs Blast Wave
126   TF1 * GetBGBWdNdptTimesPt(Double_t mass, Double_t beta, Double_t T, Double_t n,
127                             Double_t norm, const char * name = "fBGBWTimesPt");
128
129   // Tsallis blast wave
130   TF1 * GetTsallisBWdNdptTimesPt(Double_t mass, Double_t beta, Double_t T, Double_t q,
131                                  Double_t norm, Double_t ymax = 0.5, const char * name = "fTsallisBWTimesPt");
132   // Levi function
133   TF1 * GetLevidNdptTimesPt(Double_t mass, Double_t T, Double_t n, Double_t norm, const char * name="fLevi");
134
135   // UA1 function
136   TF1 * GetUA1dNdptTimesPt(Double_t pt0, Double_t n, Double_t norm, const char * name="fLevi");
137
138   // PowerLaw function
139   TF1 * GetPowerLawdNdptTimesPt(Double_t pt0, Double_t n, Double_t norm, const char * name="fLevi");
140
141   // Simple exponential in 1/mt*dNdmT
142   TF1 * GetMTExpdNdptTimesPt(Double_t mass, Double_t T, Double_t norm, const char * name ="fMtExpTimesPt");
143
144   // Bose-Einstein
145   TF1 * GetBoseEinsteindNdptTimesPt(Double_t mass, Double_t T, Double_t norm, const char * name="fBoseEinstein");
146
147   // Fermi-Dirac
148   TF1 * GetFermiDiracdNdptTimesPt(Double_t mass, Double_t T, Double_t norm, const char * name="fFermiDirac");
149
150
151   // Simple exponential in 1/mp*dNdpT
152   TF1 * GetPTExpdNdptTimesPt(Double_t T, Double_t norm, const char * name ="fPtExpTimesPt");
153
154   // Boltzmann (exp in 1/mt*dNdmT times mt)
155   TF1 * GetBoltzmanndNdptTimesPt(Double_t mass, Double_t T, Double_t norm, const char * name ="fBoltzmannTimesPt");
156
157   // Tsallis (no BW, a la CMS)
158   TF1 * GetTsallisdNdptTimesPt(Double_t mass, Double_t T, Double_t q, Double_t norm, const char * name="fTsallisTimesPt");
159
160   // 1/mt dNdmt
161   
162   // Levi
163   TF1 * GetLevidNdmt(Double_t mass, Double_t T, Double_t n, Double_t norm, const char * name = "fLeviMt", VarType_t var = kOneOverMtdNdmt);
164
165   // gereral setters
166   void SetLineWidth(Width_t width) { fLineWidth = width;}
167
168   TF1 * GetTestFunc(Double_t mass, Double_t T, Double_t norm, Double_t ymax, const char * name ="fTest") ;
169
170   // static functions for TF1
171   // Boltzmann-Gibbs Blast Wave
172   static Double_t StaticBGdNdPt(const double * x, const double* p);
173   static Double_t StaticBGdNdPtTimesPt(const double * x, const double* p);
174   // Tsallis blast wave
175   static Double_t StaticTsallisdNdPt(const double * x, const double* p);
176   static Double_t StaticTsallisdNdPtTimesPt(const double * x, const double* p);
177   // Helper funcs for numeric integration
178   static Double_t IntegrandBG(const double * x, const double* p);
179   static Double_t IntegrandTsallis(const double * x, const double* p);
180
181   // Test func
182   static Double_t StaticTest(const double * x, const double* p);
183   static Double_t IntegrandTest(const double * x, const double* p);
184
185   // histo func
186   static Double_t StaticHistoFunc(const double * x, const double* p);
187
188   // UA1 parametrization
189   static Double_t StaticUA1Func(const double * x, const double* p);
190   
191
192 private:
193
194
195   TF1 * fLastFunc;     // Last function returned
196   Width_t fLineWidth;  // Line width
197   VarType_t fVarType;  // Variable types (e.g. dNdpt vs pt, 1/mt dNdmt vs mt...) 
198   
199   AliBWFunc(const AliBWFunc&);            // not implemented
200   AliBWFunc& operator=(const AliBWFunc&); // not implemented
201
202
203   ClassDef(AliBWFunc, 1)
204
205
206 };
207
208 #endif