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