1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 // Library class for particle pt and y distributions used for
19 // muon spectrometer simulations.
20 // To be used with AliGenParam.
21 // The following particle typed can be simulated:
22 // pi, K, phi, omega, eta, J/Psi, Upsilon, charm and beauty mesons.
24 // andreas.morsch@cern.ch
30 #include "AliGenMUONlib.h"
32 ClassImp(AliGenMUONlib)
35 Double_t AliGenMUONlib::PtPion(Double_t *px, Double_t* /*dummy*/)
38 // PT-PARAMETERIZATION CDF, PRL 61(88) 1819
39 // POWER LAW FOR PT > 500 MEV
40 // MT SCALING BELOW (T=160 MEV)
42 const Double_t kp0 = 1.3;
43 const Double_t kxn = 8.28;
44 const Double_t kxlim=0.5;
45 const Double_t kt=0.160;
46 const Double_t kxmpi=0.139;
48 Double_t y, y1, xmpi2, ynorm, a;
51 y1=TMath::Power(kp0/(kp0+kxlim),kxn);
53 ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+xmpi2)/kt));
56 y=a*TMath::Power(kp0/(kp0+x),kxn);
58 y=kb*TMath::Exp(-sqrt(x*x+xmpi2)/kt);
64 Double_t AliGenMUONlib::YPion( Double_t *py, Double_t */*dummy*/)
67 Double_t y=TMath::Abs(*py);
69 const Double_t ka = 7000.;
70 const Double_t kdy = 4.;
71 Double_t ex = y*y/(2*kdy*kdy);
72 return ka*TMath::Exp(-ex);
74 return 1.16526e+04+y*-3.79886e+03+y*y*4.31130e+02;
77 // particle composition
79 Int_t AliGenMUONlib::IpPion(TRandom *ran)
82 if (ran->Rndm() < 0.5) {
89 //____________________________________________________________
93 Double_t AliGenMUONlib::PtScal(Double_t pt, Int_t np)
95 // SCALING EN MASSE PAR RAPPORT A PTPI
96 // MASS PI,K,ETA,RHO,OMEGA,ETA',PHI
97 const Double_t khm[10] = {.13957,.493,.5488,.769,.7826,.958,1.02,0,0,0};
98 // VALUE MESON/PI AT 5 GEV
99 const Double_t kfmax[10]={1.,0.3,0.55,1.0,1.0,1.0,1.0,0,0,0};
101 Double_t f5=TMath::Power(((sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3);
102 Double_t fmax2=f5/kfmax[np];
104 Double_t ptpion=100.*PtPion(&pt, (Double_t*) 0);
105 Double_t fmtscal=TMath::Power(((sqrt(pt*pt+0.018215)+2.)/
106 (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/ fmax2;
107 return fmtscal*ptpion;
113 //____________________________________________________________
114 Double_t AliGenMUONlib::PtKaon( Double_t *px, Double_t */*dummy*/)
117 return PtScal(*px,2);
121 //____________________________________________________________
122 Double_t AliGenMUONlib::YKaon( Double_t *py, Double_t */*dummy*/)
125 Double_t y=TMath::Abs(*py);
127 const Double_t ka = 1000.;
128 const Double_t kdy = 4.;
130 Double_t ex = y*y/(2*kdy*kdy);
131 return ka*TMath::Exp(-ex);
134 return 1.16526e+04+y*-3.79886e+03+y*y*4.31130e+02;
137 // particle composition
139 Int_t AliGenMUONlib::IpKaon(TRandom *ran)
142 if (ran->Rndm() < 0.5) {
153 //____________________________________________________________
154 Double_t AliGenMUONlib::PtJpsi( Double_t *px, Double_t */*dummy*/)
157 const Double_t kpt0 = 4.;
158 const Double_t kxn = 3.6;
161 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
162 return x/TMath::Power(pass1,kxn);
165 Double_t AliGenMUONlib::PtJpsiCDFscaled( Double_t *px, Double_t */*dummy*/)
168 const Double_t kpt0 = 4.703;
169 const Double_t kxn = 3.826;
172 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
173 return x/TMath::Power(pass1,kxn);
176 Double_t AliGenMUONlib::PtJpsiPbPb( Double_t *px, Double_t */*dummy*/)
183 // mc = 1.4 GeV, pt-kick 1 GeV
187 -2.13098e+00, 9.46552e+00, -5.06799e+00, 1.27260e+00,
188 -1.83806e-01, 1.55853e-02, -7.23241e-04, 1.42105e-05
195 while (j > 0) y = y * x +c[--j];
196 y = x * TMath::Exp(y);
203 Double_t AliGenMUONlib::PtJpsiBPbPb( Double_t *px, Double_t */*dummy*/)
207 Double_t x0 = 4.0384;
211 Double_t y = x / TMath::Power((1. + (x/x0)*(x/x0)), n);
217 Double_t AliGenMUONlib::PtJpsiPP( Double_t *px, Double_t */*dummy*/)
224 // mc = 1.4 GeV, pt-kick 1 GeV
227 Float_t c[4] = {8.47471e+00, -1.93567e+00, 1.50271e-01, -5.51212e-03};
233 while (j > 0) y = y * x +c[--j];
234 y = x * TMath::Exp(y);
243 //____________________________________________________________
244 Double_t AliGenMUONlib::YJpsi(Double_t *py, Double_t */*dummy*/)
247 const Double_t ky0 = 4.;
248 const Double_t kb=1.;
250 Double_t y=TMath::Abs(*py);
255 yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
260 Double_t AliGenMUONlib::YJpsiPbPb( Double_t *px, Double_t */*dummy*/)
270 // mc = 1.4 GeV, pt-kick 1 GeV
272 Double_t c[5] = {-6.03425e+02, 4.98257e+02, -1.38794e+02, 1.62209e+01, -6.85955e-01};
273 Double_t x = TMath::Abs(px[0]);
281 while (j > 0) y = y * x + c[--j];
289 Double_t AliGenMUONlib::YJpsiCDFscaled( Double_t *px, Double_t* dummy)
292 return AliGenMUONlib::YJpsiPbPb(px, dummy);
296 Double_t AliGenMUONlib::YJpsiPP( Double_t *px, Double_t */*dummy*/)
306 // mc = 1.4 GeV, pt-kick 1 GeV
309 Double_t c[5] = {1.38532e+00, 1.00596e+02, -3.46378e+01, 3.94172e+00, -1.48319e-01};
310 Double_t x = TMath::Abs(px[0]);
314 y = 96.455 - 0.8483 * x * x;
315 } else if (x < 7.9) {
318 while (j > 0) y = y * x + c[--j];
326 Double_t AliGenMUONlib::YJpsiBPbPb( Double_t *px, Double_t */*dummy*/)
330 // J/Psi from B->J/Psi X
335 Double_t c[7] = {7.37025e-02, 0., -2.94487e-03, 0., 6.07953e-06, 0., 5.39219e-07};
337 Double_t x = TMath::Abs(px[0]);
345 while (j > 0) y = y * x + c[--j];
353 // particle composition
355 Int_t AliGenMUONlib::IpJpsi(TRandom *)
360 Int_t AliGenMUONlib::IpPsiP(TRandom *)
362 // Psi prime composition
365 Int_t AliGenMUONlib::IpJpsiFamily(TRandom *)
369 Float_t r = gRandom->Rndm();
384 //____________________________________________________________
385 Double_t AliGenMUONlib::PtUpsilon( Double_t *px, Double_t */*dummy*/ )
388 const Double_t kpt0 = 5.3;
389 const Double_t kxn = 2.5;
392 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
393 return x/TMath::Power(pass1,kxn);
396 Double_t AliGenMUONlib::PtUpsilonCDFscaled( Double_t *px, Double_t */*dummy*/ )
399 const Double_t kpt0 = 7.753;
400 const Double_t kxn = 3.042;
403 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
404 return x/TMath::Power(pass1,kxn);
407 Double_t AliGenMUONlib::PtUpsilonPbPb( Double_t *px, Double_t */*dummy*/)
417 // mc = 1.4 GeV, pt-kick 1 GeV
421 -1.03488e+01, 1.28065e+01, -6.60500e+00, 1.66140e+00,
422 -2.34293e-01, 1.86925e-02, -7.80708e-04, 1.30610e-05
428 while (j > 0) y = y * x +c[--j];
429 y = x * TMath::Exp(y);
436 Double_t AliGenMUONlib::PtUpsilonPP( Double_t *px, Double_t */*dummy*/)
446 // mc = 1.4 GeV, pt-kick 1 GeV
449 Double_t c[8] = {-7.93955e+00, 1.06306e+01, -5.21392e+00, 1.19703e+00,
450 -1.45718e-01, 8.95151e-03, -2.04806e-04, -1.13053e-06};
456 while (j > 0) y = y * x +c[--j];
457 y = x * TMath::Exp(y);
467 //____________________________________________________________
468 Double_t AliGenMUONlib::YUpsilon(Double_t *py, Double_t */*dummy*/)
471 const Double_t ky0 = 3.;
472 const Double_t kb=1.;
474 Double_t y=TMath::Abs(*py);
479 yu=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
484 Double_t AliGenMUONlib::YUpsilonPbPb( Double_t *px, Double_t */*dummy*/)
494 // mc = 1.4 GeV, pt-kick 1 GeV
497 Double_t c[7] = {3.40036e-01, -3.98882e-07, -4.48398e-03, 8.46411e-08, -6.10854e-04,
498 -2.99753e-09, 1.28895e-05};
501 if (TMath::Abs(x) > 5.55) return 0.;
503 Double_t y = c[j = 6];
504 while (j > 0) y = y * x +c[--j];
508 Double_t AliGenMUONlib::YUpsilonCDFscaled( Double_t *px, Double_t *dummy)
511 return AliGenMUONlib::YUpsilonPbPb(px, dummy);
515 Double_t AliGenMUONlib::YUpsilonPP( Double_t *px, Double_t */*dummy*/)
525 // mc = 1.4 GeV, pt-kick 1 GeV
527 Double_t c[7] = {8.91936e-01, -6.46645e-07, -1.52774e-02, 4.28677e-08, -7.01517e-04,
528 -6.20539e-10, 1.29943e-05};
531 if (TMath::Abs(x) > 6.2) return 0.;
533 Double_t y = c[j = 6];
534 while (j > 0) y = y * x +c[--j];
538 // particle composition
540 Int_t AliGenMUONlib::IpUpsilon(TRandom *)
545 Int_t AliGenMUONlib::IpUpsilonP(TRandom *)
550 Int_t AliGenMUONlib::IpUpsilonPP(TRandom *)
555 Int_t AliGenMUONlib::IpUpsilonFamily(TRandom *)
559 Float_t r = gRandom->Rndm();
563 } else if (r < 0.896) {
576 // pt-distribution (by scaling of pion distribution)
577 //____________________________________________________________
578 Double_t AliGenMUONlib::PtPhi( Double_t *px, Double_t */*dummy*/)
581 return PtScal(*px,7);
584 Double_t AliGenMUONlib::YPhi( Double_t *px, Double_t */*dummy*/)
588 return YJpsi(px,dum);
590 // particle composition
592 Int_t AliGenMUONlib::IpPhi(TRandom *)
602 // pt-distribution (by scaling of pion distribution)
603 //____________________________________________________________
604 Double_t AliGenMUONlib::PtOmega( Double_t *px, Double_t */*dummy*/)
607 return PtScal(*px,5);
610 Double_t AliGenMUONlib::YOmega( Double_t *px, Double_t */*dummy*/)
614 return YJpsi(px,dum);
616 // particle composition
618 Int_t AliGenMUONlib::IpOmega(TRandom *)
629 // pt-distribution (by scaling of pion distribution)
630 //____________________________________________________________
631 Double_t AliGenMUONlib::PtEta( Double_t *px, Double_t */*dummy*/)
634 return PtScal(*px,3);
637 Double_t AliGenMUONlib::YEta( Double_t *px, Double_t */*dummy*/)
641 return YJpsi(px,dum);
643 // particle composition
645 Int_t AliGenMUONlib::IpEta(TRandom *)
656 //____________________________________________________________
657 Double_t AliGenMUONlib::PtCharm( Double_t *px, Double_t */*dummy*/)
660 const Double_t kpt0 = 2.25;
661 const Double_t kxn = 3.17;
665 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
666 return x/TMath::Power(pass1,kxn);
669 Double_t AliGenMUONlib::PtCharmCentral( Double_t *px, Double_t */*dummy*/)
672 const Double_t kpt0 = 2.12;
673 const Double_t kxn = 2.78;
677 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
678 return x/TMath::Power(pass1,kxn);
681 Double_t AliGenMUONlib::YCharm( Double_t *px, Double_t */*dummy*/)
685 return YJpsi(px,dum);
688 Int_t AliGenMUONlib::IpCharm(TRandom *ran)
694 random = ran->Rndm();
697 } else if (random < 0.75) {
699 } else if (random < 0.90) {
704 if (ran->Rndm() < 0.5) {ip=-ip;}
715 //____________________________________________________________
716 Double_t AliGenMUONlib::PtBeauty( Double_t *px, Double_t */*dummy*/)
719 const Double_t kpt0 = 6.53;
720 const Double_t kxn = 3.59;
723 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
724 return x/TMath::Power(pass1,kxn);
727 Double_t AliGenMUONlib::PtBeautyCentral( Double_t *px, Double_t */*dummy*/)
730 const Double_t kpt0 = 6.14;
731 const Double_t kxn = 2.93;
734 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
735 return x/TMath::Power(pass1,kxn);
738 Double_t AliGenMUONlib::YBeauty( Double_t *px, Double_t */*dummy*/)
742 return YJpsi(px,dum);
745 Int_t AliGenMUONlib::IpBeauty(TRandom *ran)
747 // Beauty Composition
750 random = ran->Rndm();
753 } else if (random < 0.75) {
755 } else if (random < 0.90) {
760 if (ran->Rndm() < 0.5) {ip=-ip;}
765 typedef Double_t (*GenFunc) (Double_t*, Double_t*);
766 GenFunc AliGenMUONlib::GetPt(Int_t param, const char* tname) const
768 // Return pointer to pT parameterisation
769 TString sname = TString(tname);
785 if (sname == "Vogt" || sname == "Vogt PbPb") {
787 } else if (sname == "Vogt pp") {
789 } else if (sname == "CDF scaled") {
790 func=PtJpsiCDFscaled;
802 if (sname == "Vogt" || sname == "Vogt PbPb") {
804 } else if (sname == "Vogt pp") {
806 } else if (sname == "CDF scaled") {
807 func=PtUpsilonCDFscaled;
813 if (sname == "central") {
820 if (sname == "central") {
821 func=PtBeautyCentral;
834 printf("<AliGenMUONlib::GetPt> unknown parametrisation\n");
839 GenFunc AliGenMUONlib::GetY(Int_t param, const char* tname) const
842 // Return pointer to y- parameterisation
844 TString sname = TString(tname);
860 if (sname == "Vogt" || sname == "Vogt PbPb") {
862 } else if (sname == "Vogt pp"){
864 } else if (sname == "CDF scaled") {
877 if (sname == "Vogt" || sname == "Vogt PbPb") {
879 } else if (sname == "Vogt pp") {
881 } else if (sname == "CDF scaled") {
882 func=YUpsilonCDFscaled;
901 printf("<AliGenMUONlib::GetY> unknown parametrisation\n");
905 typedef Int_t (*GenFuncIp) (TRandom *);
906 GenFuncIp AliGenMUONlib::GetIp(Int_t param, const char* /*tname*/) const
908 // Return pointer to particle type parameterisation
935 func=IpUpsilonFamily;
957 printf("<AliGenMUONlib::GetIp> unknown parametrisation\n");
964 Float_t AliGenMUONlib::Interpolate(Float_t x, Float_t* y, Float_t x0,
969 // Neville's alorithm for interpolation
975 // n: number of data points
976 // no: order of polynom
978 Float_t* c = new Float_t[n];
979 Float_t* d = new Float_t[n];
981 for (i = 0; i < n; i++) {
986 Int_t ns = int((x - x0)/dx);
990 for (m = 0; m < no; m++) {
991 for (i = 0; i < n-m; i++) {
992 Float_t ho = x0 + Float_t(i) * dx - x;
993 Float_t hp = x0 + Float_t(i+m+1) * dx - x;
994 Float_t w = c[i+1] - d[i];
1002 if (2*ns < (n-m-1)) {