1 //----------------------------------------------------------------------
4 // This class implements several function useful to fit pt spectra,
5 // including but not limited to blast wave models.
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.
10 // Before getting the function you need, you have to chose the
11 // variable you want to use calling AliPWGFunc::SetVarType with one of
12 // the elements of the VarType_t enum.
14 // TODO: code cleaup, make the naming convention of function more transparent
16 // Warning: not all variables are implemented for all the functions.
18 // Author: M. Floris, CERN
19 //----------------------------------------------------------------------
21 #include "AliPWGFunc.h"
31 AliPWGFunc::AliPWGFunc () : fLastFunc(0), fLineWidth(1), fVarType(kdNdpt) {
36 AliPWGFunc::~AliPWGFunc(){
39 if (fLastFunc) delete fLastFunc;
44 TF1 * AliPWGFunc::GetHistoFunc(TH1 * h, const char * name) {
46 // Regardless of the variable type, this returns a function made
47 // from the histo * a multiplicative normalization.
48 // This uses a bad hack...
50 fLastFunc = new TF1 (name, StaticHistoFunc, 0.0, 10, 2);
51 fLastFunc->SetParameter(0,1);
52 fLastFunc->FixParameter(1,Double_t(Long64_t(h)));
53 fLastFunc->SetParNames("norm", "pointer to histo");
54 fLastFunc->SetLineWidth(fLineWidth);
60 TF1 * AliPWGFunc::GetGraphFunc(TGraph * g, const char * name) {
62 // Regardless of the variable type, this returns a function made
63 // from the graph * a multiplicative normalization.
64 // This uses a bad hack...
66 fLastFunc = new TF1 (name, StaticHistoFunc, 0.0, 10, 2);
67 fLastFunc->SetParameter(0,1);
68 fLastFunc->FixParameter(1,Double_t(Long64_t(g)));
69 fLastFunc->SetParNames("norm", "pointer to histo");
70 fLastFunc->SetLineWidth(fLineWidth);
77 TF1 * AliPWGFunc::GetBGBW(Double_t mass, Double_t beta, Double_t T,
78 Double_t n, Double_t norm, const char * name){
80 // Boltzmann-Gibbs blast wave
84 return GetBGBWdNdptTimesPt(mass,beta,T,n,norm,name);
87 return GetBGBWdNdpt(mass,beta,T,n,norm,name);
90 AliFatal("Not implemented");
93 AliFatal("Not implemented");
101 TF1 * AliPWGFunc::GetBoltzmann(Double_t mass, Double_t T, Double_t norm, const char * name){
105 return GetBoltzmanndNdptTimesPt(mass, T, norm, name);
106 case kOneOverPtdNdpt:
107 AliFatal("Not implemented");
109 case kOneOverMtdNdmt:
110 AliFatal("Not implemented");
113 AliFatal("Not implemented");
121 TF1 * AliPWGFunc::GetTsallisBW(Double_t mass, Double_t beta, Double_t T, Double_t q,
122 Double_t norm, Double_t ymax, const char * name){
124 // Tsallis blast wave
127 return GetTsallisBWdNdptTimesPt(mass,beta,T,q,norm,ymax,name);
129 case kOneOverPtdNdpt:
130 return GetTsallisBWdNdpt(mass,beta,T,q,norm,ymax,name);
132 case kOneOverMtdNdmt:
133 AliFatal("Not implemented");
136 AliFatal("Not implemented");
144 TF1 * AliPWGFunc::GetMTExp(Double_t mass, Double_t T, Double_t norm, const char * name){
146 // Simple exponential in 1/mt*MT
149 return GetMTExpdNdptTimesPt(mass,T,norm,name);
151 case kOneOverPtdNdpt:
152 return GetMTExpdNdpt(mass,T,norm,name);
154 case kOneOverMtdNdmt:
155 AliFatal("Not implemented");
158 AliFatal("Not implemented");
167 TF1 * AliPWGFunc::GetBoseEinstein(Double_t mass, Double_t T, Double_t norm, const char * name){
172 return GetBoseEinsteindNdptTimesPt(mass,T,norm,name);
174 case kOneOverPtdNdpt:
175 return GetBoseEinsteindNdpt(mass,T,norm,name);
177 case kOneOverMtdNdmt:
178 AliFatal("Not implemented");
181 AliFatal("Not implemented");
189 TF1 * AliPWGFunc::GetFermiDirac(Double_t mass, Double_t T, Double_t norm, const char * name){
191 // Simple exponential in 1/mt*MT
194 return GetFermiDiracdNdptTimesPt(mass,T,norm,name);
196 case kOneOverPtdNdpt:
197 return GetFermiDiracdNdpt(mass,T,norm,name);
199 case kOneOverMtdNdmt:
200 AliFatal("Not implemented");
203 AliFatal("Not implemented");
212 TF1 * AliPWGFunc::GetPTExp(Double_t T, Double_t norm, const char * name){
214 // Simple exponential in 1/mt*MT
217 return GetPTExpdNdptTimesPt(T,norm,name);
219 case kOneOverPtdNdpt:
220 AliFatal("Not implemented");
222 case kOneOverMtdNdmt:
223 AliFatal("Not implemented");
226 AliFatal("Not implemented");
235 TF1 * AliPWGFunc::GetLevi(Double_t mass, Double_t T, Double_t n, Double_t norm, const char * name){
236 // Levi function (aka Tsallis)
239 return GetLevidNdptTimesPt(mass,T,n,norm,name);
241 case kOneOverPtdNdpt:
242 return GetLevidNdpt(mass,T,n,norm,name);
244 case kOneOverMtdNdmt:
245 return GetLevidNdmt(mass,T,n,norm,name,kOneOverMtdNdmt);
248 return GetLevidNdmt(mass,T,n,norm,name,kdNdmt);
250 case kOneOverMtdNdmtMinusM:
251 return GetLevidNdmt(mass,T,n,norm,name,kOneOverMtdNdmtMinusM);
254 AliFatal("Not implemented");
262 TF1 * AliPWGFunc::GetPowerLaw(Double_t pt0, Double_t n, Double_t norm, const char * name){
263 // power law Nuclear Physics B, Vol. 335, No. 2. (7 May 1990), pp. 261-287.
264 // This is sometimes also called Hagedorn or modified Hagedorn
268 return GetPowerLawdNdptTimesPt(pt0,n,norm,name);
270 case kOneOverPtdNdpt:
271 return GetPowerLawdNdpt(pt0,n,norm,name);
273 case kOneOverMtdNdmt:
274 AliFatal("Not Implemented");
275 // return GetUA1dNdmt(mass,T,n,norm,name);
278 AliFatal("Not implemented");
286 TF1 * AliPWGFunc::GetUA1(Double_t mass, Double_t p0star, Double_t pt0, Double_t n, Double_t T, Double_t norm, const char * name) {
287 // UA1 parametrization Nuclear Physics B, Vol. 335, No. 2. (7 May 1990), pp. 261-287.
292 fLastFunc = new TF1 (name, StaticUA1Func, 0.0, 10, 6);
293 fLastFunc->FixParameter(0,mass);
294 fLastFunc->SetParameter(1,p0star);
295 fLastFunc->SetParameter(2,pt0);
296 fLastFunc->SetParameter(3,n);
297 fLastFunc->SetParameter(4,T);
298 fLastFunc->SetParameter(5,norm);
299 fLastFunc->SetParLimits(1,0.01,1);
300 fLastFunc->SetParLimits(2,0.01,100);
301 fLastFunc->SetParLimits(3,0.01,100);
302 fLastFunc->SetParLimits(4,0.01,100);
303 fLastFunc->SetParNames("mass","p0star","pt0","n","T","norm");
304 fLastFunc->SetNpx(5000);
305 fLastFunc->SetLineWidth(fLineWidth);
309 case kOneOverPtdNdpt:
310 fLastFunc = new TF1 (name, StaticUA1FuncOneOverPt, 0.0, 10, 6);
311 fLastFunc->FixParameter(0,mass);
312 fLastFunc->SetParameter(1,p0star);
313 fLastFunc->SetParameter(2,pt0);
314 fLastFunc->SetParameter(3,n);
315 fLastFunc->SetParameter(4,T);
316 fLastFunc->SetParameter(5,norm);
317 fLastFunc->SetParLimits(1,0.01,1);
318 fLastFunc->SetParLimits(2,0.01,100);
319 fLastFunc->SetParLimits(3,0.01,100);
320 fLastFunc->SetParLimits(4,0.01,100);
321 fLastFunc->SetParNames("mass","p0star","pt0","n","T","norm");
322 fLastFunc->SetNpx(5000);
323 fLastFunc->SetLineWidth(fLineWidth);
327 case kOneOverMtdNdmt:
328 AliFatal("Not Implemented");
329 // return GetUA1dNdmt(mass,T,n,norm,name);
332 AliFatal("Not implemented");
341 // ________________________________________________________________________
343 // Backend (private functions and support functions for numerical integration)
345 Double_t AliPWGFunc::StaticHistoFunc(const double * x, const double* p){
347 // provides a function interpolating a histo with a spline;
348 // using double to store a pointer... This is a bad hack. To be replaced
352 TObject * h = (TObject*) Long64_t(p[1]);
354 // Int_t bin = h->FindBin(x[0]);
355 // double value = h->GetBinContent(bin);
358 // static TH1 * oldptr = 0;
359 // static TSpline3 * spl = 0;
361 // FIXME: recheck static pointers
363 if(h->InheritsFrom("TH1")) {
364 if ( ((TH1*)h)->FindBin(x[0]) > ((TH1*)h)->GetNbinsX()) return 0;
365 spl= new TSpline3((TH1*)h);
367 else if(h->InheritsFrom("TGraph")) spl= new TSpline3("fGraph",(TGraph*)h);
369 Printf("AliPWGFunc::StaticHistoFunc: Unsupported type");
373 double value = spl->Eval(x[0]);
380 Double_t AliPWGFunc::StaticUA1Func(const double * x, const double* p) {
383 // "mass","p0star","pt0","n","T","norm"
384 Double_t mass = p[0];
385 Double_t p0star = p[1];
388 Double_t temp = p[4];
389 Double_t norm = p[5];
393 static AliPWGFunc * self = new AliPWGFunc;
394 static TF1 * fPLaw = self->GetPowerLawdNdptTimesPt(pt0, n, norm, "fLocalPLawUA1");
395 static TF1 * fPMTExp = self->GetMTExpdNdptTimesPt (mass, temp, norm, "fLocalMTexpUA1");
397 fPLaw->SetParameters(norm,pt0,n);
398 fPMTExp->SetParameters(1,temp);
401 Double_t normMT =fPMTExp->Eval(p0star) >0 ? fPLaw->Eval(p0star) / fPMTExp->Eval(p0star) * fPMTExp->GetParameter(0) : 1;
402 fPMTExp->SetParameter(0,normMT);
405 if (TMath::Abs(fPMTExp->Eval(p0star) - fPLaw->Eval(p0star)) > 0.0001 ) {
406 Printf("AliPWGFunc::StaticUA1Func - Wrong norm") ;
407 Printf(" p0* %f NMT: %f N: %f PL: %f MT: %f", p0star, normMT, norm, fPLaw->Eval(p0star), fPMTExp->Eval(p0star));
410 if (xx > p0star) return fPLaw->Eval(xx);
411 return fPMTExp->Eval(xx);
416 Double_t AliPWGFunc::StaticUA1FuncOneOverPt(const double * x, const double* p) {
419 // "mass","p0star","pt0","n","T","norm"
420 Double_t mass = p[0];
421 Double_t p0star = p[1];
424 Double_t temp = p[4];
425 Double_t norm = p[5];
429 static AliPWGFunc * self = new AliPWGFunc;
430 static TF1 * fPLaw = self->GetPowerLawdNdpt(pt0, n, norm, "fLocalPLawUA1");
431 static TF1 * fPMTExp = self->GetMTExpdNdpt (mass, temp, norm, "fLocalMTexpUA1");
433 fPLaw->SetParameters(norm,pt0,n);
434 fPMTExp->SetParameters(1,temp);
437 Double_t normMT =fPMTExp->Eval(p0star) >0 ? fPLaw->Eval(p0star) / fPMTExp->Eval(p0star) * fPMTExp->GetParameter(0) : 1;
438 fPMTExp->SetParameter(0,normMT);
441 if (TMath::Abs(fPMTExp->Eval(p0star) - fPLaw->Eval(p0star)) > 0.0001 ) {
442 Printf("AliPWGFunc::StaticUA1Func - Wrong norm") ;
443 Printf(" p0* %f NMT: %f N: %f PL: %f MT: %f", p0star, normMT, norm, fPLaw->Eval(p0star), fPMTExp->Eval(p0star));
446 if (xx > p0star) return fPLaw->Eval(xx);
447 return fPMTExp->Eval(xx);
454 Double_t AliPWGFunc::IntegrandBG(const double * x, const double* p){
455 // integrand for boltzman-gibbs blast wave
456 // x[0] -> r (radius)
458 // p[1] -> pT (transverse momentum)
459 // p[2] -> beta_max (surface velocity)
460 // p[3] -> T (freezout temperature)
461 // p[4] -> n (velocity profile)
468 double beta_max = p[2];
472 // Keep beta within reasonable limits
473 Double_t beta = beta_max * TMath::Power(x0, n);
474 if (beta > 0.9999999999999999) beta = 0.9999999999999999;
476 double mT = TMath::Sqrt(mass*mass+pT*pT);
478 double rho0 = TMath::ATanH(beta);
479 double arg00 = pT*TMath::SinH(rho0)/temp;
480 if (arg00 > 700.) arg00 = 700.; // avoid FPE
481 double arg01 = mT*TMath::CosH(rho0)/temp;
482 double f0 = x0*mT*TMath::BesselI0(arg00)*TMath::BesselK1(arg01);
484 // printf("r=%f, pt=%f, beta_max=%f, temp=%f, n=%f, mt=%f, beta=%f, rho=%f, argI0=%f, argK1=%f\n", x0, pT, beta_max, temp, n, mT, beta, rho0, arg00, arg01);
491 Double_t AliPWGFunc::StaticBGdNdPt(const double * x, const double* p) {
493 // implementation of BGBW (1/pt dNdpt)
504 static TF1 * fIntBG = 0;
506 fIntBG = new TF1 ("fIntBG", IntegrandBG, 0, 1, 5);
508 fIntBG->SetParameters(mass, pT, beta, temp,n);
509 double result = fIntBG->Integral(0,1);
510 // printf ("[%4.4f], Int :%f\n", pT, result);
511 return result*norm;//*1e30;;
515 Double_t AliPWGFunc::StaticBGdNdPtTimesPt(const double * x, const double* p) {
516 // BGBW dNdpt implementation
517 return x[0]*StaticBGdNdPt(x,p);
521 TF1 * AliPWGFunc::GetBGBWdNdpt(Double_t mass, Double_t beta, Double_t temp,
522 Double_t n, Double_t norm, const char * name){
526 fLastFunc = new TF1 (name, StaticBGdNdPt, 0.0, 10, 5);
527 fLastFunc->SetParameters(mass,beta,temp,n,norm);
528 fLastFunc->FixParameter(0,mass);
529 fLastFunc->SetParNames("mass", "#beta", "T", "n", "norm");
530 fLastFunc->SetLineWidth(fLineWidth);
536 //_____________________________________________________________________
539 Double_t AliPWGFunc::IntegrandTsallis(const double * x, const double* p){
541 // integrand for numerical integration (tsallis)
547 Double_t mass = p[0];
549 Double_t beta = p[2];
550 Double_t temp = p[3];
553 Double_t mt = TMath::Sqrt(mass*mass+pt*pt);
555 Double_t rho = TMath::ATanH(beta*r); // TODO: implement different velocity profiles
558 r*TMath::CosH(y) *TMath::Power( (
560 mt*TMath::CosH(y)*TMath::CosH(rho) -
561 pt*TMath::SinH(rho)*TMath::Cos(phi)
573 Double_t AliPWGFunc::StaticTsallisdNdPt(const double * x, const double* p) {
575 // tsallis BW implementation 1/pt dNdpt
585 Double_t ymax = p[5];
588 static TF3 * fInt = 0;
590 fInt = new TF3 ("fIntTsa", IntegrandTsallis, 0, 1, -TMath::Pi(), TMath::Pi(), -ymax, ymax, 5);
591 // fInt->SetNpx(10000);
592 // fInt->SetNpy(10000);
593 // fInt->SetNpz(10000);
596 fInt->SetParameters(mass, pT, beta, temp, q);
597 double result = fInt->Integral(0,1, -TMath::Pi(), TMath::Pi(), -ymax, ymax);
598 // double result = fInt->Integral(0,1, -2, 2, -ymax, ymax);
600 return result*p[4];//*1e30;;
604 Double_t AliPWGFunc::StaticTsallisdNdPtTimesPt(const double * x, const double* p) {
606 // tsallis BW , implementatio of dNdpt
607 return x[0]*StaticTsallisdNdPt(x,p);
611 TF1 * AliPWGFunc::GetTsallisBWdNdpt(Double_t mass, Double_t beta, Double_t temp, Double_t q,
612 Double_t norm, Double_t ymax,const char * name){
615 // tsallis BW, 1/pt dNdpt
617 fLastFunc = new TF1 (name, StaticTsallisdNdPt, 0.0, 10, 6);
618 fLastFunc->SetParameters(mass,beta,temp,q,norm,ymax);
619 fLastFunc->SetParLimits(1,0.0,0.99);
620 fLastFunc->SetParLimits(2,0.01,0.99);
621 fLastFunc->SetParLimits(3,1.0001,1.9);
622 fLastFunc->SetParNames("mass", "#beta", "temp", "q", "norm", "ymax");
623 fLastFunc->SetLineWidth(fLineWidth);
629 // Boltzmann-Gibbs Blast Wave
630 TF1 * AliPWGFunc::GetBGBWdNdptTimesPt(Double_t mass, Double_t beta, Double_t temp, Double_t n,
631 Double_t norm, const char * name){
635 fLastFunc = new TF1 (name, StaticBGdNdPtTimesPt, 0.0, 10, 5);
636 fLastFunc->SetParameters(mass,beta,temp,n,norm);
637 fLastFunc->FixParameter(0,mass);
638 fLastFunc->SetParNames("mass", "#beta", "temp", "n", "norm");
639 fLastFunc->SetLineWidth(fLineWidth);
647 TF1 * AliPWGFunc::GetTsallisBWdNdptTimesPt(Double_t mass, Double_t beta, Double_t temp, Double_t q,
648 Double_t norm, Double_t ymax, const char * name){
650 // Tsallis blast wave, dNdpt
652 fLastFunc = new TF1 (name, StaticTsallisdNdPtTimesPt, 0.0, 10, 6);
653 fLastFunc->SetParameters(mass,beta,temp,q,norm,ymax);
654 fLastFunc->SetParNames("mass", "#beta", "temp", "q", "norm", "ymax");
655 fLastFunc->SetLineWidth(fLineWidth);
663 TF1 * AliPWGFunc::GetMTExpdNdptTimesPt(Double_t mass, Double_t temp, Double_t norm, const char * name){
665 // Simple exponential in 1/mt*MT, as a function of dNdpt
667 snprintf(formula,500,"[0]*x*exp(-sqrt(x**2+%f**2)/[1])", mass);
668 fLastFunc=new TF1(name,formula,0,10);
669 fLastFunc->SetParameters(norm, temp);
670 fLastFunc->SetParLimits(1, 0.01, 10);
671 fLastFunc->SetParNames("norm", "T");
672 fLastFunc->SetLineWidth(fLineWidth);
678 TF1 * AliPWGFunc::GetBoseEinsteindNdptTimesPt(Double_t mass, Double_t temp, Double_t norm, const char * name){
680 // Bose einstein distribution as a function of dNdpt
682 snprintf(formula,500,"[0]*x*1./(exp(sqrt(x**2+%f**2)/[1])-1)", mass);
683 fLastFunc=new TF1(name,formula,0,10);
684 fLastFunc->SetParameters(norm, temp);
685 fLastFunc->SetParLimits(1, 0.01, 10);
686 fLastFunc->SetParNames("norm", "T");
687 fLastFunc->SetLineWidth(fLineWidth);
693 TF1 * AliPWGFunc::GetFermiDiracdNdptTimesPt(Double_t mass, Double_t temp, Double_t norm, const char * name){
695 // Bose einstein distribution as a function of dNdpt
697 snprintf(formula,500,"[0]*x*1./(exp(sqrt(x**2+%f**2)/[1])+1)", mass);
698 fLastFunc=new TF1(name,formula,0,10);
699 fLastFunc->SetParameters(norm, temp);
700 fLastFunc->SetParLimits(1, 0.01, 10);
701 fLastFunc->SetParNames("norm", "T");
702 fLastFunc->SetLineWidth(fLineWidth);
710 TF1 * AliPWGFunc::GetPTExpdNdptTimesPt(Double_t temp, Double_t norm, const char * name){
712 // Simple exponential in 1/pt*dNdpT, as a function of dNdpt
714 snprintf(formula,500,"[0]*x*exp(-x/[1])");
715 fLastFunc=new TF1(name,formula,0,10);
716 fLastFunc->SetParameters(norm, temp);
717 fLastFunc->SetParLimits(1, 0.01, 10);
718 fLastFunc->SetParNames("norm", "T");
719 fLastFunc->SetLineWidth(fLineWidth);
726 TF1 * AliPWGFunc::GetBoltzmanndNdptTimesPt(Double_t mass, Double_t temp, Double_t norm, const char * name){
727 // Boltzmann (exp in 1/mt*dNdmT times mt) as a function of dNdpt
729 snprintf(formula,500,"[0]*x*sqrt(x**2+%f**2)*exp(-sqrt(x**2+%f**2)/[1])", mass,mass);
730 fLastFunc=new TF1(name,formula,0,10);
731 fLastFunc->SetParameters(norm, temp);
732 fLastFunc->SetParLimits(1, 0.01, 10);
733 fLastFunc->SetParNames("norm", "T");
734 fLastFunc->SetLineWidth(fLineWidth);
741 // Tsallis (no BW, a la CMS)
742 // TF1 * AliPWGFunc::GetTsallisdNdptTimesPt(Double_t mass, Double_t T, Double_t q, Double_t norm, const char * name){
744 // char formula[500];
745 // // sprintf(formula,"[0]*x*pow((1+(([2]-1)/[1])*(sqrt(x**2+%f**2)-%f)),(-1/([2]-1)))", mass, mass); //CMS
746 // sprintf(formula,"[0]*x*pow((1+(([2]-1)/[1])*(sqrt(x**2+%f**2))),(-1/([2]-1)))", mass); // STAR
747 // //sprintf(formula,"[0]*x*sqrt(x**2+%f**2)*pow((1+(([2]-1)/[1])*(sqrt(x**2+%f**2))),(-1/([2]-1)))", mass,mass); // STAR * mt
748 // fLastFunc=new TF1(name,formula,0,10);
749 // fLastFunc->SetParameters(norm, T, q);
750 // fLastFunc->SetParLimits(1, 0.001, 10);
751 // fLastFunc->SetParNames("norm", "T", "q");
752 // fLastFunc->SetLineWidth(fLineWidth);
759 TF1 * AliPWGFunc::GetLevidNdptTimesPt(Double_t mass, Double_t temp, Double_t n, Double_t norm, const char * name){
761 // Levi function, dNdpt
764 snprintf(formula,500,"( x*[0]*([1]-1)*([1]-2) )/( [1]*[2]*( [1]*[2]+[3]*([1]-2) ) ) * ( 1 + (sqrt([3]*[3]+x*x) -[3])/([1]*[2]) )^(-[1])");
765 // sprintf(formula,"( x*[0]*([1]-1)*([1]-2) )/( [1]*[2]*( [1]*[2]+[3]*([1]-2) ) ) * ( 1 + (sqrt([3]*[3]+x*x))/([1]*[2]) )^(-[1])");
766 fLastFunc=new TF1(name,formula,0,10);
767 fLastFunc->SetParameters(norm, n, temp,mass);
768 fLastFunc->SetParLimits(2, 0.01, 10);
769 fLastFunc->SetParNames("norm (dN/dy)", "n", "T", "mass");
770 fLastFunc->FixParameter(3,mass);
771 fLastFunc->SetLineWidth(fLineWidth);
777 TF1 * AliPWGFunc::GetPowerLawdNdptTimesPt(Double_t pt0, Double_t n, Double_t norm, const char * name){
779 // PowerLaw function, dNdpt
782 snprintf(formula,500,"x*[0]*( 1 + x/[1] )^(-[2])");
783 fLastFunc=new TF1(name,formula,0,10);
784 fLastFunc->SetParameters(norm, pt0, n);
785 fLastFunc->SetParLimits(1, 0.01, 10);
786 //fLastFunc->SetParLimits(2, 0.01, 50);
787 fLastFunc->SetParNames("norm", "pt0", "n");
788 fLastFunc->SetLineWidth(fLineWidth);
794 TF1 * AliPWGFunc::GetPowerLawdNdpt(Double_t pt0, Double_t n, Double_t norm, const char * name){
796 // PowerLaw function, 1/pt dNdpt
799 snprintf(formula,500," [0]*( 1 + x/[1] )^(-[2])");
800 fLastFunc=new TF1(name,formula,0,10);
801 fLastFunc->SetParameters(norm, pt0, n);
802 // fLastFunc->SetParLimits(2, 0.01, 10);
803 fLastFunc->SetParNames("norm", "pt0", "n");
804 fLastFunc->SetLineWidth(fLineWidth);
811 TF1 * AliPWGFunc::GetLevidNdpt(Double_t mass, Double_t temp, Double_t n, Double_t norm, const char * name){
813 // Levi function, dNdpt
816 snprintf(formula,500,"( [0]*([1]-1)*([1]-2) )/( [1]*[2]*( [1]*[2]+[3]*([1]-2) ) ) * ( 1 + (sqrt([3]*[3]+x*x) -[3])/([1]*[2]) )^(-[1])");
817 fLastFunc=new TF1(name,formula,0,10);
818 fLastFunc->SetParameters(norm, n, temp,mass);
819 fLastFunc->SetParLimits(2, 0.01, 10);
820 fLastFunc->SetParNames("norm (dN/dy)", "n", "T", "mass");
821 fLastFunc->FixParameter(3,mass);
822 fLastFunc->SetLineWidth(fLineWidth);
828 TF1 * AliPWGFunc::GetLevidNdmt(Double_t mass, Double_t temp, Double_t n, Double_t norm, const char * name, VarType_t var){
830 // Levi function, 1/mt dNdmt
832 if (var == kOneOverMtdNdmt)
833 snprintf(formula,500,"( [0]*([1]-1)*([1]-2) )/( [1]*[2]*( [1]*[2]+[3]*([1]-2) ) ) * ( 1 + (x -[3])/([1]*[2]) )^(-[1])");
834 else if (var == kdNdmt)
835 snprintf(formula,500,"( x*[0]*([1]-1)*([1]-2) )/( [1]*[2]*( [1]*[2]+[3]*([1]-2) ) ) * ( 1 + (x-[3])/([1]*[2]) )^(-[1])");
836 if (var == kOneOverMtdNdmtMinusM)
837 snprintf(formula,500,"( [0]*([1]-1)*([1]-2) )/( [1]*[2]*( [1]*[2]+[3]*([1]-2) ) ) * ( 1 + (x)/([1]*[2]) )^(-[1])");
839 //sprintf(formula,"( [0]*([1]-1)*([1]-2) )/( [1]*[2]*( [1]*[2]+[3]*([1]-2) ) ) * ( 1 + x/([1]*[2]) )^(-[1])");
840 // sprintf(formula,"[0] * ( 1 + x/([1]*[2]) )^(-[1])");
841 fLastFunc=new TF1(name,formula,0,10);
842 fLastFunc->SetParameters(norm, n, temp,mass);
843 fLastFunc->SetParLimits(2, 0.01, 10);
844 fLastFunc->SetParNames("norm", "n", "T", "mass");
845 fLastFunc->FixParameter(3,mass);
846 fLastFunc->SetLineWidth(fLineWidth);
856 Double_t AliPWGFunc::IntegrandTest(const double * x, const double* p){
862 Double_t mass = p[0];
864 Double_t temp = p[2];
866 Double_t mt = TMath::Sqrt(mass*mass+pt*pt);
868 return mt*TMath::CosH(y)*TMath::Exp(-mt*TMath::CosH(y)/temp);
872 Double_t AliPWGFunc::StaticTest(const double * x, const double* p) {
881 Double_t ymax = p[3];
884 static TF3 * fIntTest = 0;
886 fIntTest = new TF3 ("fIntTest", IntegrandTest, 0, 1, -TMath::Pi(), TMath::Pi(), -ymax, ymax, 5);
887 // fInt->SetNpx(10000);
890 fIntTest->SetParameters(mass, pT, temp);
891 double result = fIntTest->Integral(-ymax, ymax);
893 return result*p[2];//*1e30;;
897 TF1 * AliPWGFunc::GetTestFunc(Double_t mass, Double_t temp, Double_t norm, Double_t ymax, const char * name){
901 fLastFunc = new TF1 (name, StaticTest, 0.0, 10, 4);
902 fLastFunc->SetParameters(mass,temp,norm,ymax);
903 fLastFunc->SetParNames("mass", "#beta", "T", "q", "norm", "ymax");
904 fLastFunc->SetLineWidth(fLineWidth);
910 //___________________________________________________________
913 TF1 * AliPWGFunc::GetMTExpdNdpt(Double_t mass, Double_t temp, Double_t norm, const char * name){
914 // Simple exp in 1/mt dNdmt, as a function of dNdpt
917 snprintf(formula,500,"[0]*exp(-sqrt(x**2+%f**2)/[1])", mass);
918 fLastFunc=new TF1(name,formula,0,10);
919 fLastFunc->SetParameters(norm, temp);
920 fLastFunc->SetParLimits(1, 0.01, 10);
921 fLastFunc->SetParNames("norm", "T");
922 fLastFunc->SetLineWidth(fLineWidth);
926 TF1 * AliPWGFunc::GetBoseEinsteindNdpt(Double_t mass, Double_t temp, Double_t norm, const char * name){
929 snprintf(formula,500,"[0]*1./(exp(sqrt(x**2+%f**2)/[1])-1)", mass);
930 fLastFunc=new TF1(name,formula,0,10);
931 fLastFunc->SetParameters(norm, temp);
932 fLastFunc->SetParLimits(1, 0.01, 10);
933 fLastFunc->SetParNames("norm", "T");
934 fLastFunc->SetLineWidth(fLineWidth);
938 TF1 * AliPWGFunc::GetFermiDiracdNdpt(Double_t mass, Double_t temp, Double_t norm, const char * name){
941 snprintf(formula,500,"[0]*1./(exp(sqrt(x**2+%f**2)/[1])+1)", mass);
942 fLastFunc=new TF1(name,formula,0,10);
943 fLastFunc->SetParameters(norm, temp);
944 fLastFunc->SetParLimits(1, 0.01, 10);
945 fLastFunc->SetParNames("norm", "T");
946 fLastFunc->SetLineWidth(fLineWidth);
951 // // Simple tsallis (a la CMS)
952 // TF1 * AliPWGFunc::GetTsallisdNdpt(Double_t mass, Double_t temp, Double_t q, Double_t norm, const char * name){
954 // char formula[500];
955 // sprintf(formula,"[0]*sqrt(x**2+%f**2)*pow((1+(([2]-1)/[1])*(sqrt(x**2+%f**2))),(-1/([2]-1)))", mass,mass);
956 // fLastFunc=new TF1(name,formula,0,10);
957 // fLastFunc->SetParameters(norm, temp, q);
958 // fLastFunc->SetParLimits(1, 0.01, 10);
959 // fLastFunc->SetParNames("norm", "T", "q");
960 // fLastFunc->SetLineWidth(fLineWidth);