4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
7 // some common functions
8 // author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
10 #if !defined(__CINT__) || defined(__MAKECINT__)
20 inline T* FindObj(TFile* f, const TString& name)
23 // check if the object exists
25 T* obj = dynamic_cast<T*>(f->Get(name.Data()));
28 f->Error("Get","%s not found", name.Data());
36 inline T* FindObj(TFile* f, const TString& dir, const TString& name)
39 // check if the object exists
41 if(dir=="") return FindObj<T>(f,name);
42 return FindObj<T>(f, dir + "/" + name + ";1");
46 inline T* FindObj(const TList* l, const TString& name)
49 // check if the object exists
51 T* obj = dynamic_cast<T*>(l->FindObject(name.Data()));
55 l->Error("FindObject","%s not found", name.Data());
62 inline TH1D* Divide(const TH1* hX, const TH1* hY, const TString& name)
67 TH1D* q = dynamic_cast<TH1D*>(hX->Clone(name.Data()));
71 hX->Warning("Clone", "could not clone %s", hX->GetName());
81 inline Double_t GetMass(const TString& name)
84 // return particle mass
86 TString particle=name;
89 if(particle.Contains("electron")) return 0.000511;
90 if(particle.Contains("muon")) return 0.10566;
91 if(particle.Contains("pion")) return 0.13957;
92 if(particle.Contains("kaon")) return 0.49368;
93 if(particle.Contains("proton")) return 0.93827;
94 if(particle.Contains("deuteron")) return 1.87561;
95 if(particle.Contains("triton")) return 2.80925;
96 if(particle.Contains("he3")) return 2.80923;
97 if(particle.Contains("alpha")) return 3.727417;
99 //cerr << "Warning unknown particle " << particle << endl;
104 inline TF1* Tsallis(Double_t m0, const TString& name, Double_t xmin=0, Double_t xmax=10)
107 // Tsallis distribution
108 // Journal of Statistical Physics, Vol. 52, Nos. 1/2, 1988
109 // J. Phys. G: Nucl. Part. Phys. 39 (2012)
111 TF1* fnc = new TF1(name.Data(), Form("[0]*sqrt(x*x+%f)*pow(1+([1]-1)*sqrt(x*x+%f)/[2],[1]/(1-[1]))/pow(2*TMath::Pi(),3)",m0*m0,m0*m0),xmin,xmax);
113 fnc->SetParNames("gV","q","T");
114 fnc->SetParameters(100., 1.1, 0.07);
116 fnc->SetParLimits(0, 0., 1.e+7);
117 fnc->SetParLimits(1, 1.0001, 3.);
118 fnc->SetParLimits(2, 0.001, 0.3);
123 inline TF1* TsallisDYield(Double_t m0, const TString& name, Double_t xmin=0, Double_t xmax=10)
126 // Tsallis distribution for differential yield
128 TF1* fnc = new TF1(name.Data(), Form("[0]*x*sqrt(x*x+%f)*pow(1+([1]-1)*sqrt(x*x+%f)/[2],[1]/(1-[1]))/pow(2.*TMath::Pi(),2)",m0*m0,m0*m0),xmin,xmax);
130 fnc->SetParNames("gV","q","T");
131 fnc->SetParameters(100., 1.1, 0.07);
133 fnc->SetParLimits(0, 0., 1.e+7);
134 fnc->SetParLimits(1, 1.0001, 3.);
135 fnc->SetParLimits(2, 0.001, 0.3);
140 inline TF1* PtTsallisDYield(Double_t m0, const TString& name, Double_t xmin=0, Double_t xmax=10)
143 // Tsallis distribution for mean pt
145 TF1* fnc = new TF1(name.Data(), Form("[0]*x*x*sqrt(x*x+%f)*pow(1+([1]-1)*sqrt(x*x+%f)/[2],[1]/(1-[1]))/pow(2.*TMath::Pi(),2)",m0*m0,m0*m0),xmin,xmax);
147 fnc->SetParNames("gV","q","T");
148 fnc->SetParameters(100., 1.1, 0.07);
150 fnc->SetParLimits(0, 0., 1.e+7);
151 fnc->SetParLimits(1, 1.0001, 3.);
152 fnc->SetParLimits(2, 0.001, 0.3);
157 inline TF1* QTsallis(Double_t m0, const TString& name, Double_t xmin=0, Double_t xmax=10)
160 // q-Tsallis distribution
161 // Phys. Rev. C 83, 064903 (2011)
162 // Phys. Rev. C 75, 064901 (2007)
164 TF1* fnc = new TF1(name.Data(), Form("[0]*([1]-1)*([1]-2)*pow(1+(sqrt(x*x+%f)-%f)/([1]*[2]),-[1])/(2*TMath::Pi()*[1]*[2]*([1]*[2]+%f*([1]-2)))", m0*m0, m0, m0), xmin, xmax);
166 fnc->SetParNames("dN/dy","n","C");
167 fnc->SetParameters(0.05, 7, 0.3);
169 fnc->SetParLimits(0, 0, 10);
170 fnc->SetParLimits(1, 4, 50);
171 fnc->SetParLimits(2, 0.01, 10);
176 inline TF1* QTsallisDYield(Double_t m0, const TString& name, Double_t xmin=0, Double_t xmax=10)
179 // q-Tsallis distribution for differential yield
181 TF1* fnc = new TF1(name.Data(), Form("x*[0]*([1]-1)*([1]-2)*pow(1+(sqrt(x*x+%f)-%f)/([1]*[2]),-[1])/([1]*[2]*([1]*[2]+%f*([1]-2)))", m0*m0, m0, m0), xmin, xmax);
183 fnc->SetParNames("dN/dy","n","C");
184 fnc->SetParameters(0.05, 7, 0.3);
186 fnc->SetParLimits(0, 0, 1);
187 fnc->SetParLimits(1, 4, 50);
188 fnc->SetParLimits(2, 0.01, 10);
193 inline TF1* PtQTsallisDYield(Double_t m0, const TString& name, Double_t xmin=0, Double_t xmax=10)
196 // q-Tsallis distribution for mean pt
198 TF1* fnc = new TF1(name.Data(), Form("x*x*[0]*([1]-1)*([1]-2)*pow(1+(sqrt(x*x+%f)-%f)/([1]*[2]),-[1])/([1]*[2]*([1]*[2]+%f*([1]-2)))", m0*m0, m0, m0), xmin, xmax);
200 fnc->SetParNames("dN/dy","n","C");
201 fnc->SetParameters(0.05, 7, 0.3);
203 fnc->SetParLimits(0, 0, 1);
204 fnc->SetParLimits(1, 4, 50);
205 fnc->SetParLimits(2, 0.01, 10);