]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVGEN/AliGenMUONlib.cxx
Changes for #82873: Module debugging broken (Christian)
[u/mrichter/AliRoot.git] / EVGEN / AliGenMUONlib.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /* $Id$ */
17
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. 
23 //
24 // andreas.morsch@cern.ch
25 //
26
27 #include "TMath.h"
28 #include "TRandom.h"
29 #include "TDatabasePDG.h"
30
31 #include "AliGenMUONlib.h"
32
33 ClassImp(AliGenMUONlib)
34 //
35 //  Pions
36 Double_t AliGenMUONlib::PtPion(const Double_t *px, const Double_t* /*dummy*/)
37 {
38 //
39 //     PT-PARAMETERIZATION CDF, PRL 61(88) 1819
40 //     POWER LAW FOR PT > 500 MEV
41 //     MT SCALING BELOW (T=160 MEV)
42 //
43   const Double_t kp0 = 1.3;
44   const Double_t kxn = 8.28;
45   const Double_t kxlim=0.5;
46   const Double_t kt=0.160;
47   const Double_t kxmpi=0.139;
48   const Double_t kb=1.;
49   Double_t y, y1, xmpi2, ynorm, a;
50   Double_t x=*px;
51   //
52   y1=TMath::Power(kp0/(kp0+kxlim),kxn);
53   xmpi2=kxmpi*kxmpi;
54   ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+xmpi2)/kt));
55   a=ynorm/y1;
56   if (x > kxlim)
57     y=a*TMath::Power(kp0/(kp0+x),kxn);
58   else
59     y=kb*TMath::Exp(-sqrt(x*x+xmpi2)/kt);
60   return y*x;
61 }
62 //
63 // y-distribution
64 //
65 Double_t AliGenMUONlib::YPion( const Double_t *py, const Double_t */*dummy*/)
66 {
67 // Pion y
68   Double_t y=TMath::Abs(*py);
69 /*
70   const Double_t ka    = 7000.;
71   const Double_t kdy   = 4.;
72   Double_t ex = y*y/(2*kdy*kdy);
73   return ka*TMath::Exp(-ex);
74 */
75   return 1.16526e+04+y*-3.79886e+03+y*y*4.31130e+02;
76   
77 }
78 //                 particle composition
79 //
80 Int_t AliGenMUONlib::IpPion(TRandom *ran)
81 {
82 // Pion composition 
83     if (ran->Rndm() < 0.5) {
84         return  211;
85     } else {
86         return -211;
87     }
88 }
89
90 //____________________________________________________________
91 //
92 // Mt-scaling
93
94 Double_t AliGenMUONlib::PtScal(Double_t pt, Int_t np)
95 {
96   //    SCALING EN MASSE PAR RAPPORT A PTPI
97   //    MASS PI,K,ETA,RHO,OMEGA,ETA',PHI
98   const Double_t khm[10] = {.13957,.493,.5488,.769,.7826,.958,1.02,0,0,0};
99   //     VALUE MESON/PI AT 5 GEV
100   const Double_t kfmax[10]={1.,0.3,0.55,1.0,1.0,1.0,1.0,0,0,0};
101   np--;
102   Double_t f5=TMath::Power(((sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3);
103   Double_t fmax2=f5/kfmax[np];
104   // PIONS
105   Double_t ptpion=100.*PtPion(&pt, (Double_t*) 0);
106   Double_t fmtscal=TMath::Power(((sqrt(pt*pt+0.018215)+2.)/
107                                  (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/ fmax2;
108   return fmtscal*ptpion;
109 }
110 //
111 // kaon
112 //
113 //                pt-distribution
114 //____________________________________________________________
115 Double_t AliGenMUONlib::PtKaon( const Double_t *px, const Double_t */*dummy*/)
116 {
117 // Kaon pT
118   return PtScal(*px,2);
119 }
120
121 // y-distribution
122 //____________________________________________________________
123 Double_t AliGenMUONlib::YKaon( const Double_t *py, const Double_t */*dummy*/)
124 {
125 // Kaon y
126   Double_t y=TMath::Abs(*py);
127 /*
128   const Double_t ka    = 1000.;
129   const Double_t kdy   = 4.;
130   //
131   Double_t ex = y*y/(2*kdy*kdy);
132   return ka*TMath::Exp(-ex);
133 */
134
135   return 1.16526e+04+y*-3.79886e+03+y*y*4.31130e+02;
136 }
137
138 //                 particle composition
139 //
140 Int_t AliGenMUONlib::IpKaon(TRandom *ran)
141 {
142 // Kaon composition
143     if (ran->Rndm() < 0.5) {
144         return  321;
145     } else {
146         return -321;
147     }
148 }
149
150 //                    J/Psi 
151 //
152 //
153 //                pt-distribution
154 //____________________________________________________________
155 Double_t AliGenMUONlib::PtJpsiPP7000( const Double_t *px, const Double_t */*dummy*/)
156 {
157 // J/Psi pT
158 //
159 // pp 7 TeV
160 // using ALICE data at 2.5<y<4, see arXiv:1103.2394
161
162   const Double_t kpt0 = 2.44;
163   const Double_t kxn  = 3.9;
164   Double_t x=*px;
165   //
166   Double_t pass1 = 1.+0.36*(x/kpt0)*(x/kpt0);
167   return x/TMath::Power(pass1,kxn);
168 }
169
170 Double_t AliGenMUONlib::PtJpsiPP2760( const Double_t *px, const Double_t */*dummy*/)
171 {
172 // J/Psi pT
173 //
174 // pp 2.76 TeV
175 // from the fit of RHIC + LHC data, see arXiv:1103.2394
176
177   const Double_t kpt0 = 2.31;
178   const Double_t kxn  = 3.9;
179   Double_t x=*px;
180   //
181   Double_t pass1 = 1.+0.36*(x/kpt0)*(x/kpt0);
182   return x/TMath::Power(pass1,kxn);
183 }
184
185 Double_t AliGenMUONlib::PtJpsiPbPb2760( const Double_t *px, const Double_t *dummy)
186 {
187 // J/Psi pT
188 //
189 // PbPb 2.76 TeV, for EKS98 with minimum bias shadowing factor 0.66
190 //
191   Double_t c[5] = {6.01022e-01, 4.70988e-02, -2.27917e-03, 3.09885e-05, 1.31955e-06};
192   Double_t x=*px;
193   Double_t y;
194   Int_t j;
195   y = c[j = 4];
196   while (j > 0) y  = y * x + c[--j];
197   //  
198   Double_t d = 1.+c[4]*TMath::Power(x,4);
199   return y/d * AliGenMUONlib::PtJpsiPP2760(px,dummy);
200 }
201
202 Double_t AliGenMUONlib::PtJpsi( const Double_t *px, const Double_t */*dummy*/)
203 {
204 // J/Psi pT
205   const Double_t kpt0 = 4.;
206   const Double_t kxn  = 3.6;
207   Double_t x=*px;
208   //
209   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
210   return x/TMath::Power(pass1,kxn);
211 }
212
213 Double_t AliGenMUONlib::PtJpsiCDFscaled( const Double_t *px, const Double_t */*dummy*/)
214 {
215 // J/Psi pT
216 //
217 // PbPb 5.5 TeV
218 // scaled from CDF data at 2 TeV
219 // see S.Grigoryan, PWG3 Meeting, 27th Oct 2008
220
221   const Double_t kpt0 = 5.100;
222   const Double_t kxn  = 4.102;
223   Double_t x=*px;
224   //
225   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
226   return x/TMath::Power(pass1,kxn);
227 }
228
229 Double_t AliGenMUONlib::PtJpsiCDFscaledPP( const Double_t *px, const Double_t */*dummy*/)
230 {
231 // J/Psi pT
232 //
233 // pp 14 TeV
234 // scaled from CDF data at 2 TeV
235
236   const Double_t kpt0 = 5.630;
237   const Double_t kxn  = 4.071;
238   Double_t x=*px;
239   //
240   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
241   return x/TMath::Power(pass1,kxn);
242 }
243
244 Double_t AliGenMUONlib::PtJpsiCDFscaledPP10( const Double_t *px, const Double_t */*dummy*/)
245 {
246 // J/Psi pT
247 //
248 // pp 10 TeV
249 // scaled from CDF data at 2 TeV
250
251   const Double_t kpt0 = 5.334;
252   const Double_t kxn  = 4.071;
253   Double_t x=*px;
254   //
255   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
256   return x/TMath::Power(pass1,kxn);
257 }
258
259 Double_t AliGenMUONlib::PtJpsiCDFscaledPP9( const Double_t *px, const Double_t */*dummy*/)
260 {
261 // J/Psi pT
262 //
263 // pp 8.8 TeV
264 // scaled from CDF data at 2 TeV
265 //
266   const Double_t kpt0 = 5.245;
267   const Double_t kxn  = 4.071;
268   Double_t x=*px;
269   //
270   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
271   return x/TMath::Power(pass1,kxn);
272 }
273
274 Double_t AliGenMUONlib::PtJpsiCDFscaledPP7( const Double_t *px, const Double_t */*dummy*/)
275 {
276 // J/Psi pT
277 //
278 // pp 7 TeV
279 // scaled from CDF data at 2 TeV
280
281   const Double_t kpt0 = 5.072;
282   const Double_t kxn  = 4.071;
283   Double_t x=*px;
284   //
285   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
286   return x/TMath::Power(pass1,kxn);
287 }
288
289 Double_t AliGenMUONlib::PtJpsiCDFscaledPP4( const Double_t *px, const Double_t */*dummy*/)
290 {
291 // J/Psi pT
292 //
293 // pp 3.94 TeV
294 // scaled from CDF data at 2 TeV
295 //
296   const Double_t kpt0 = 4.647;
297   const Double_t kxn  = 4.071;
298   Double_t x=*px;
299   //
300   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
301   return x/TMath::Power(pass1,kxn);
302 }
303
304 Double_t AliGenMUONlib::PtJpsiCDFscaledPP3( const Double_t *px, const Double_t */*dummy*/)
305 {
306 // J/Psi pT
307 //
308 // pp 2.76 TeV
309 // scaled from CDF data at 1.9 TeV
310 //
311   const Double_t kpt0 = 4.435;
312   const Double_t kxn  = 4.071;
313   Double_t x=*px;
314   //
315   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
316   return x/TMath::Power(pass1,kxn);
317 }
318
319 Double_t AliGenMUONlib::PtJpsiCDFscaledPP2( const Double_t *px, const Double_t */*dummy*/)
320 {
321 // J/Psi pT
322 //
323 // pp 1.9 TeV
324 // fit of the CDF data at 1.9 TeV
325 //
326   const Double_t kpt0 = 4.233;
327   const Double_t kxn  = 4.071;
328   Double_t x=*px;
329   //
330   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
331   return x/TMath::Power(pass1,kxn);
332 }
333
334 Double_t AliGenMUONlib::PtJpsiCDFscaledPPb9( const Double_t *px, const Double_t *dummy)
335 {
336 // J/Psi pT
337 //
338 // pPb 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.80
339 //
340   Double_t c[5] = {6.42774e-01, 1.86168e-02, -6.77296e-04, 8.93512e-06, 1.31586e-07};
341   Double_t x=*px;
342   Double_t y;
343   Int_t j;
344   y = c[j = 4];
345   while (j > 0) y  = y * x + c[--j];
346   //  
347   Double_t d = 1.+c[4]*TMath::Power(x,4);
348   return y/d * AliGenMUONlib::PtJpsiCDFscaledPP9(px,dummy);
349 }
350
351 Double_t AliGenMUONlib::PtJpsiCDFscaledPbP9( const Double_t *px, const Double_t *dummy)
352 {
353 // J/Psi pT
354 //
355 // Pbp 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.80
356 //
357   Double_t c[5] = {8.58557e-01, 5.39791e-02, -4.75180e-03, 2.49463e-04, 5.52396e-05};
358   Double_t x=*px;
359   Double_t y;
360   Int_t j;
361   y = c[j = 4];
362   while (j > 0) y  = y * x + c[--j];
363   //  
364   Double_t d = 1.+c[4]*TMath::Power(x,4);
365   return y/d * AliGenMUONlib::PtJpsiCDFscaledPP9(px,dummy);
366 }
367
368 Double_t AliGenMUONlib::PtJpsiCDFscaledPbPb4( const Double_t *px, const Double_t *dummy)
369 {
370 // J/Psi pT
371 //
372 // PbPb 3.94 TeV, for EKS98 with minimum bias shadowing factor 0.66
373 //
374   Double_t c[5] = {6.01022e-01, 4.70988e-02, -2.27917e-03, 3.09885e-05, 1.31955e-06};
375   Double_t x=*px;
376   Double_t y;
377   Int_t j;
378   y = c[j = 4];
379   while (j > 0) y  = y * x + c[--j];
380   //  
381   Double_t d = 1.+c[4]*TMath::Power(x,4);
382   return y/d * AliGenMUONlib::PtJpsiCDFscaledPP4(px,dummy);
383 }
384
385 Double_t AliGenMUONlib::PtJpsiFlat( const Double_t */*px*/, const Double_t */*dummy*/ )
386 {
387   return 1.;
388 }
389
390 Double_t AliGenMUONlib::PtJpsiPbPb( const Double_t *px, const Double_t */*dummy*/)
391 {
392 // J/Psi pT spectrum
393 //
394 // R. Vogt 2002
395 // PbPb 5.5 TeV
396 // MRST HO
397 // mc = 1.4 GeV, pt-kick 1 GeV
398 //
399     Float_t x = px[0];
400     Float_t c[8] = {
401         -2.13098e+00, 9.46552e+00, -5.06799e+00, 1.27260e+00, 
402         -1.83806e-01, 1.55853e-02, -7.23241e-04, 1.42105e-05
403     };
404     
405     Double_t y;
406     if (x < 10.) {
407         Int_t j;
408         y = c[j = 7];
409         while (j > 0) y  = y * x +c[--j];
410         y = x * TMath::Exp(y);
411     } else {
412         y = 0.;
413     }
414     return y;
415 }
416
417 Double_t AliGenMUONlib::PtJpsiBPbPb( const Double_t *px, const Double_t */*dummy*/)
418 {
419 // J/Psi pT spectrum
420 // B -> J/Psi X
421     Double_t x0 =   4.0384;
422     Double_t  n =   3.0288;
423     
424     Double_t x = px[0];
425     Double_t y = x / TMath::Power((1. + (x/x0)*(x/x0)), n);
426     
427     return y;
428 }
429
430
431 Double_t AliGenMUONlib::PtJpsiPP( const Double_t *px, const Double_t */*dummy*/)
432 {
433 // J/Psi pT spectrum
434 //
435 // R. Vogt 2002
436 // pp 14 TeV
437 // MRST HO
438 // mc = 1.4 GeV, pt-kick 1 GeV
439 //
440     Float_t x = px[0];
441     Float_t c[4] = {8.47471e+00, -1.93567e+00, 1.50271e-01, -5.51212e-03};
442  
443     Double_t y;
444     if (x < 10.) {
445         Int_t j;
446         y = c[j = 3];
447         while (j > 0) y  = y * x +c[--j];
448         y = x * TMath::Exp(y);
449     } else {
450         y = 0.;
451     }
452     return y;
453 }
454
455 //
456 //               y-distribution
457 //____________________________________________________________
458 Double_t AliGenMUONlib::YJpsiPP7000( const Double_t *px, const Double_t */*dummy*/)
459 {
460 // J/Psi y
461 //
462 // pp 7 TeV
463 // from the fit of RHIC + LHC data, see arXiv:1103.2394
464 //
465     Double_t x = px[0]/7.72;
466     x = x*x;
467     Double_t y = TMath::Exp(-x/0.383/0.383/2);
468     if(x > 1) y=0;
469     return y;
470 }
471
472 Double_t AliGenMUONlib::YJpsiPP2760( const Double_t *px, const Double_t */*dummy*/)
473 {
474 // J/Psi y
475 //
476 // pp 2.76 TeV
477 // from the fit of RHIC + LHC data, see arXiv:1103.2394
478 //
479     Double_t x = px[0]/6.79;
480     x = x*x;
481     Double_t y = TMath::Exp(-x/0.383/0.383/2);
482     if(x > 1) y=0;
483     return y;
484 }
485
486 Double_t AliGenMUONlib::YJpsiPbPb2760( const Double_t *px, const Double_t *dummy)
487 {
488 // J/Psi y
489 //
490 // PbPb 2.76 TeV, for EKS98 with minimum bias shadowing factor 0.66
491 //
492     Double_t c[4] = {5.95228e-01, 9.45069e-03, 2.44710e-04, -1.32894e-05}; 
493     Double_t x = px[0]*px[0];
494     Double_t y;
495     Int_t j;
496     y = c[j = 3];
497     while (j > 0) y  = y * x + c[--j];
498     if(y<0) y=0;
499
500     return y * AliGenMUONlib::YJpsiPP2760(px,dummy);
501 }
502
503 Double_t AliGenMUONlib::YJpsi(const Double_t *py, const Double_t */*dummy*/)
504 {
505 // J/psi y
506   const Double_t ky0 = 4.;
507   const Double_t kb=1.;
508   Double_t yj;
509   Double_t y=TMath::Abs(*py);
510   //
511   if (y < ky0)
512     yj=kb;
513   else
514     yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
515   return yj;
516 }
517
518 Double_t AliGenMUONlib::YJpsiFlat( const Double_t */*py*/, const Double_t */*dummy*/ )
519 {
520   return 1.;
521 }
522
523
524 Double_t AliGenMUONlib::YJpsiPbPb( const Double_t *px, const Double_t */*dummy*/)
525 {
526
527 //
528 // J/Psi y
529 //
530 //
531 // R. Vogt 2002
532 // PbPb 5.5 TeV
533 // MRST HO
534 // mc = 1.4 GeV, pt-kick 1 GeV
535 //
536     Double_t c[5] = {-6.03425e+02, 4.98257e+02, -1.38794e+02, 1.62209e+01, -6.85955e-01};
537     Double_t x = TMath::Abs(px[0]);
538     Double_t y;
539     
540     if (x < 4.) {
541         y = 31.754;
542     } else if (x < 6) {
543         Int_t j;
544         y = c[j = 4];
545         while (j > 0) y  = y * x + c[--j];
546     } else {
547         y =0.;
548     }
549     
550     return y;
551 }
552
553 Double_t AliGenMUONlib::YJpsiCDFscaled( const Double_t *px, const Double_t* dummy)
554 {
555     // J/Psi y 
556     return AliGenMUONlib::YJpsiPbPb(px, dummy);
557 }
558
559 Double_t AliGenMUONlib::YJpsiCDFscaledPP( const Double_t *px, const Double_t* dummy)
560 {
561     // J/Psi y 
562     return AliGenMUONlib::YJpsiPP(px, dummy);
563 }
564
565 Double_t AliGenMUONlib::YJpsiCDFscaledPP10( const Double_t *px, const Double_t */*dummy*/)
566 {
567 // J/Psi y
568 //
569 // pp 10 TeV
570 // scaled from YJpsiPP(14 TeV) using 10 TeV / 14 TeV ratio of y-spectra in LO pQCD. 
571 // see S.Grigoryan, PWG3 Meeting, 27th Oct 2008
572 //
573
574     Double_t c[5] = {2.46681e+01, 8.91486e+01, -3.21227e+01, 3.63075e+00, -1.32047e-01};
575
576     Double_t x = TMath::Abs(px[0]);
577     Double_t y;
578
579     if (x < 3.2) {
580         y = 98.523 - 1.3664 * x * x;
581     } else if (x < 7.5) {
582         Int_t j;
583         y = c[j = 4];
584         while (j > 0) y  = y * x + c[--j];
585     } else {
586         y =0.;
587     }
588
589     if(y<0) y=0;
590
591     return y;
592 }
593
594 Double_t AliGenMUONlib::YJpsiCDFscaledPP9( const Double_t *px, const Double_t */*dummy*/)
595 {
596 // J/Psi y
597 //
598 // pp 8.8 TeV
599 // rescaling of YJpsiPP(14 TeV) using 8.8 TeV / 14 TeV ratio of y-spectra in LO QCD 
600 //
601     Double_t c[5] = {3.33882e+02, -1.30980e+02, 2.59082e+01, -3.08935e+00, 1.56375e-01};
602     Double_t x = TMath::Abs(px[0]);
603     Double_t y;
604
605     if (x < 3.7) {
606         y = 99.236 - 1.5498 * x * x;
607     } else if (x < 7.4) {
608         Int_t j;
609         y = c[j = 4];
610         while (j > 0) y  = y * x + c[--j];
611     } else {
612         y =0.;
613     }
614
615     if(y<0) y=0;
616
617     return y;
618 }
619
620 Double_t AliGenMUONlib::YJpsiCDFscaledPP9dummy(Double_t px)
621 {
622     return AliGenMUONlib::YJpsiCDFscaledPP9(&px, (Double_t*) 0);
623 }
624
625 Double_t AliGenMUONlib::YJpsiCDFscaledPP7( const Double_t *px, const Double_t */*dummy*/)
626 {
627 // J/Psi y
628 //
629 // pp 7 TeV
630 // scaled from YJpsiPP(14 TeV) using 7 TeV / 14 TeV ratio of y-spectra in LO pQCD. 
631 //
632
633     Double_t c[5] = {6.71181e+02, -3.69240e+02, 8.89644e+01, -1.04937e+01, 4.80959e-01};
634
635     Double_t x = TMath::Abs(px[0]);
636     Double_t y;
637
638     if (x < 4.0) {
639         y = 100.78 - 1.8353 * x * x;
640     } else if (x < 7.3) {
641         Int_t j;
642         y = c[j = 4];
643         while (j > 0) y  = y * x + c[--j];
644     } else {
645         y =0.;
646     }
647
648     if(y<0) y=0;
649
650     return y;
651 }
652
653 Double_t AliGenMUONlib::YJpsiCDFscaledPP4( const Double_t *px, const Double_t */*dummy*/)
654 {
655 // J/Psi y
656 //
657 // pp 3.94 TeV
658 // rescaling of YJpsiPP(14 TeV) using 3.94 TeV / 14 TeV ratio of y-spectra in LO QCD 
659 //
660     Double_t c[5] = {4.00785e+02, -1.41159e+01, -3.28599e+01, 5.53048e+00, -2.45151e-01};
661     Double_t x = TMath::Abs(px[0]);
662     Double_t y;
663
664     if (x < 5.5) {
665         y = 107.389 - 2.7454 * x * x;
666     } else if (x < 7.0) {
667         Int_t j;
668         y = c[j = 4];
669         while (j > 0) y  = y * x + c[--j];
670     } else {
671         y =0.;
672     }
673
674     if(y<0) y=0;
675
676     return y;
677 }
678
679 Double_t AliGenMUONlib::YJpsiCDFscaledPP3( const Double_t *px, const Double_t *dummy)
680 {
681 // J/Psi y 
682     return AliGenMUONlib::YJpsiPP2760(px, dummy);
683 }
684
685 Double_t AliGenMUONlib::YJpsiCDFscaledPP2( const Double_t *px, const Double_t */*dummy*/)
686 {
687 // J/Psi y
688 //
689 // pp 1.9 TeV
690 // from the fit of RHIC + LHC data, see arXiv:1103.2394
691 //
692     Double_t x = px[0]/6.42;
693     x = x*x;
694     Double_t y = TMath::Exp(-x/0.383/0.383/2);
695     if(x > 1) y=0;
696     return y;
697 }
698
699 Double_t AliGenMUONlib::YJpsiPP( const Double_t *px, const Double_t */*dummy*/)
700 {
701
702 //
703 // J/Psi y
704 //
705 //
706 // R. Vogt 2002
707 // pp 14  TeV
708 // MRST HO
709 // mc = 1.4 GeV, pt-kick 1 GeV
710 //
711
712     Double_t c[5] = {1.38532e+00, 1.00596e+02, -3.46378e+01, 3.94172e+00, -1.48319e-01};
713     Double_t x = TMath::Abs(px[0]);
714     Double_t y;
715     
716     if (x < 2.5) {
717         y = 96.455 - 0.8483 * x * x;
718     } else if (x < 7.9) {
719         Int_t j;
720         y = c[j = 4];
721         while (j > 0) y  = y * x + c[--j];
722     } else {
723         y =0.;
724     }
725     
726     return y;
727 }
728
729 Double_t AliGenMUONlib::YJpsiCDFscaledPPb9( const Double_t *px, const Double_t */*dummy*/)
730 {
731 // J/Psi y
732 //
733 // pPb 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.80
734 //
735     Double_t c[7] = {7.52296e-01, 2.49917e-02, 3.36500e-03, 1.91187e-03, 2.92154e-04,
736                      -4.16509e-05,-7.62709e-06}; 
737     Double_t y;
738     Double_t x = px[0] + 0.47;              // rapidity shift
739     Int_t j;
740     y = c[j = 6];
741     while (j > 0) y = y * x + c[--j];
742     if(y<0) y=0;
743
744     return y * AliGenMUONlib::YJpsiCDFscaledPP9dummy(x);
745 }
746
747 Double_t AliGenMUONlib::YJpsiCDFscaledPbP9( const Double_t *px, const Double_t */*dummy*/)
748 {
749 // J/Psi y
750 //
751 // Pbp 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.80
752 //
753     Double_t c[7] = {7.52296e-01, 2.49917e-02, 3.36500e-03, 1.91187e-03, 2.92154e-04,
754                      -4.16509e-05,-7.62709e-06}; 
755     Double_t y;
756     Double_t x = -px[0] + 0.47;              // rapidity shift
757     Int_t j;
758     y = c[j = 6];
759     while (j > 0) y = y * x + c[--j];
760     if(y<0) y=0;
761
762     return y * AliGenMUONlib::YJpsiCDFscaledPP9dummy(x);
763 }
764
765 Double_t AliGenMUONlib::YJpsiCDFscaledPbPb4( const Double_t *px, const Double_t *dummy)
766 {
767 // J/Psi y
768 //
769 // PbPb 3.94 TeV, for EKS98 with minimum bias shadowing factor 0.66
770 //
771     Double_t c[4] = {5.95228e-01, 9.45069e-03, 2.44710e-04, -1.32894e-05}; 
772     Double_t x = px[0]*px[0];
773     Double_t y;
774     Int_t j;
775     y = c[j = 3];
776     while (j > 0) y  = y * x + c[--j];
777     if(y<0) y=0;
778
779     return y * AliGenMUONlib::YJpsiCDFscaledPP4(px,dummy);
780 }
781
782 Double_t AliGenMUONlib::YJpsiBPbPb( const Double_t *px, const Double_t */*dummy*/)
783 {
784
785 //
786 // J/Psi from B->J/Psi X
787 //
788 //
789     
790
791     Double_t c[7] = {7.37025e-02, 0., -2.94487e-03, 0., 6.07953e-06, 0., 5.39219e-07};
792     
793     Double_t x = TMath::Abs(px[0]);
794     Double_t y;
795     
796     if (x > 6.) {
797         y = 0.;
798     } else {
799         Int_t j;
800         y = c[j = 6];
801         while (j > 0) y  = y * x + c[--j];
802     } 
803     
804     return y;
805 }
806
807
808
809 //                 particle composition
810 //
811 Int_t AliGenMUONlib::IpJpsi(TRandom *)
812 {
813 // J/Psi composition
814     return 443;
815 }
816 Int_t AliGenMUONlib::IpPsiP(TRandom *)
817 {
818 // Psi prime composition
819     return 100443;
820 }
821 Int_t AliGenMUONlib::IpJpsiFamily(TRandom *)
822 {
823 // J/Psi composition
824   Int_t ip;
825   Float_t r = gRandom->Rndm();
826   if (r < 0.98) {
827     ip = 443;
828   } else {
829     ip = 100443;
830   }
831   return ip;
832 }
833
834
835
836 //                      Upsilon
837 //
838 //
839 //                  pt-distribution
840 //____________________________________________________________
841 Double_t AliGenMUONlib::PtUpsilon( const Double_t *px, const Double_t */*dummy*/ )
842 {
843 // Upsilon pT
844   const Double_t kpt0 = 5.3;
845   const Double_t kxn  = 2.5;
846   Double_t x=*px;
847   //
848   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
849   return x/TMath::Power(pass1,kxn);
850 }
851
852 Double_t AliGenMUONlib::PtUpsilonCDFscaled( const Double_t *px, const Double_t */*dummy*/ )
853 {
854 // Upsilon pT
855   const Double_t kpt0 = 7.753;
856   const Double_t kxn  = 3.042;
857   Double_t x=*px;
858   //
859   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
860   return x/TMath::Power(pass1,kxn);
861 }
862
863 Double_t AliGenMUONlib::PtUpsilonCDFscaledPP( const Double_t *px, const Double_t */*dummy*/ )
864 {
865 // Upsilon pT
866 //
867 // pp 14 TeV
868 //
869 // scaled from CDF data at 2 TeV
870
871   const Double_t kpt0 = 8.610;
872   const Double_t kxn  = 3.051;
873   Double_t x=*px;
874   //
875   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
876   return x/TMath::Power(pass1,kxn);
877 }
878
879 Double_t AliGenMUONlib::PtUpsilonCDFscaledPP10( const Double_t *px, const Double_t */*dummy*/)
880 {
881 // Upsilon pT
882 //
883 // pp 10 TeV
884 //
885 // scaled from CDF data at 2 TeV
886
887   const Double_t kpt0 = 8.235;
888   const Double_t kxn  = 3.051;
889   Double_t x=*px;
890   //
891   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
892   return x/TMath::Power(pass1,kxn);
893 }
894
895 Double_t AliGenMUONlib::PtUpsilonCDFscaledPP9( const Double_t *px, const Double_t */*dummy*/)
896 {
897 // Upsilon pT
898 //
899 // pp 8.8 TeV
900 // scaled from CDF data at 2 TeV
901 //
902   const Double_t kpt0 = 8.048;
903   const Double_t kxn  = 3.051;
904   Double_t x=*px;
905   //
906   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
907   return x/TMath::Power(pass1,kxn);
908 }
909
910 Double_t AliGenMUONlib::PtUpsilonCDFscaledPP7( const Double_t *px, const Double_t */*dummy*/)
911 {
912 // Upsilon pT
913 //
914 // pp 7 TeV
915 //
916 // scaled from CDF data at 2 TeV
917
918   const Double_t kpt0 = 7.817;
919   const Double_t kxn  = 3.051;
920   Double_t x=*px;
921   //
922   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
923   return x/TMath::Power(pass1,kxn);
924 }
925
926 Double_t AliGenMUONlib::PtUpsilonCDFscaledPP4( const Double_t *px, const Double_t */*dummy*/)
927 {
928 // Upsilon pT
929 //
930 // pp 3.94 TeV
931 // scaled from CDF data at 2 TeV
932 //
933   const Double_t kpt0 = 7.189;
934   const Double_t kxn  = 3.051;
935   Double_t x=*px;
936   //
937   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
938   return x/TMath::Power(pass1,kxn);
939 }
940
941 Double_t AliGenMUONlib::PtUpsilonCDFscaledPPb9( const Double_t *px, const Double_t *dummy)
942 {
943 // Upsilon pT
944 //
945 // pPb 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.90
946 //
947   Double_t c[5] = {7.64952e-01, 1.12501e-04, 4.96038e-04, -3.03198e-05, 3.74035e-06};
948   Double_t x=*px;
949   Double_t y;
950   Int_t j;
951   y = c[j = 4];
952   while (j > 0) y  = y * x + c[--j];
953   //  
954   Double_t d = 1.+c[4]*TMath::Power(x,4);
955   return y/d * AliGenMUONlib::PtUpsilonCDFscaledPP9(px,dummy);
956 }
957
958 Double_t AliGenMUONlib::PtUpsilonCDFscaledPbP9( const Double_t *px, const Double_t *dummy)
959 {
960 // Upsilon pT
961 //
962 // Pbp 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.90
963 //
964   Double_t c[5] = {1.09881e+00, 3.08329e-03, -2.00356e-04, 8.28991e-06, 2.52576e-06};
965   Double_t x=*px;
966   Double_t y;
967   Int_t j;
968   y = c[j = 4];
969   while (j > 0) y  = y * x + c[--j];
970   //  
971   Double_t d = 1.+c[4]*TMath::Power(x,4);
972   return y/d * AliGenMUONlib::PtUpsilonCDFscaledPP9(px,dummy);
973 }
974
975 Double_t AliGenMUONlib::PtUpsilonCDFscaledPbPb4( const Double_t *px, const Double_t *dummy)
976 {
977 // Upsilon pT
978 //
979 // PbPb 3.94 TeV, for EKS98 with minimum bias shadowing factor 0.85
980 //
981   Double_t c[5] = {8.65872e-01, 2.05465e-03, 2.56063e-04, -1.65598e-05, 2.29209e-06};
982   Double_t x=*px;
983   Double_t y;
984   Int_t j;
985   y = c[j = 4];
986   while (j > 0) y  = y * x + c[--j];
987   //  
988   Double_t d = 1.+c[4]*TMath::Power(x,4);
989   return y/d * AliGenMUONlib::PtUpsilonCDFscaledPP4(px,dummy);
990 }
991
992 Double_t AliGenMUONlib::PtUpsilonFlat( const Double_t */*px*/, const Double_t */*dummy*/ )
993 {
994   return 1.;
995 }
996
997 Double_t AliGenMUONlib::PtUpsilonPbPb( const Double_t *px, const Double_t */*dummy*/)
998 {
999 //
1000 // Upsilon pT
1001 //
1002 //
1003 // R. Vogt 2002
1004 // PbPb 5.5 TeV
1005 // MRST HO
1006 // mc = 1.4 GeV, pt-kick 1 GeV
1007 //
1008     Float_t x = px[0];
1009     Double_t c[8] = {
1010         -1.03488e+01, 1.28065e+01, -6.60500e+00, 1.66140e+00,       
1011         -2.34293e-01, 1.86925e-02, -7.80708e-04, 1.30610e-05
1012     };
1013     Double_t y;
1014     if (x < 10.) {
1015         Int_t j;
1016         y = c[j = 7];
1017         while (j > 0) y  = y * x +c[--j];
1018         y = x * TMath::Exp(y);
1019     } else {
1020         y = 0.;
1021     }
1022     return y;
1023 }
1024
1025 Double_t AliGenMUONlib::PtUpsilonPP( const Double_t *px, const Double_t */*dummy*/)
1026 {
1027 //
1028 // Upsilon pT
1029 //
1030 //
1031 // R. Vogt 2002
1032 // pp 14 TeV
1033 // MRST HO
1034 // mc = 1.4 GeV, pt-kick 1 GeV
1035 //
1036     Float_t x = px[0];
1037     Double_t c[8] = {-7.93955e+00, 1.06306e+01, -5.21392e+00, 1.19703e+00,   
1038                      -1.45718e-01, 8.95151e-03, -2.04806e-04, -1.13053e-06};
1039     
1040     Double_t y;
1041     if (x < 10.) {
1042         Int_t j;
1043         y = c[j = 7];
1044         while (j > 0) y  = y * x +c[--j];
1045         y = x * TMath::Exp(y);
1046     } else {
1047         y = 0.;
1048     }
1049     return y;
1050 }
1051
1052 //
1053 //                    y-distribution
1054 //
1055 //____________________________________________________________
1056 Double_t AliGenMUONlib::YUpsilon(const Double_t *py, const Double_t */*dummy*/)
1057 {
1058 // Upsilon y
1059   const Double_t ky0 = 3.;
1060   const Double_t kb=1.;
1061   Double_t yu;
1062   Double_t y=TMath::Abs(*py);
1063   //
1064   if (y < ky0)
1065     yu=kb;
1066   else
1067     yu=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
1068   return yu;
1069 }
1070
1071
1072 Double_t AliGenMUONlib::YUpsilonPbPb( const Double_t *px, const Double_t */*dummy*/)
1073 {
1074
1075 //
1076 // Upsilon y
1077 //
1078 //
1079 // R. Vogt 2002
1080 // PbPb 5.5 TeV
1081 // MRST HO
1082 // mc = 1.4 GeV, pt-kick 1 GeV
1083 //
1084
1085     Double_t c[7] = {3.40036e-01, -3.98882e-07, -4.48398e-03, 8.46411e-08, -6.10854e-04,
1086                      -2.99753e-09, 1.28895e-05};
1087     Double_t x = TMath::Abs(px[0]);
1088     if (x > 5.55) return 0.;
1089     Int_t j;
1090     Double_t y = c[j = 6];
1091     while (j > 0) y  = y * x +c[--j];
1092     return y;
1093 }
1094
1095 Double_t AliGenMUONlib::YUpsilonCDFscaled( const Double_t *px, const Double_t *dummy)
1096 {
1097     // Upsilon y
1098     return AliGenMUONlib::YUpsilonPbPb(px, dummy);
1099     
1100 }
1101
1102 Double_t AliGenMUONlib::YUpsilonCDFscaledPP( const Double_t *px, const Double_t *dummy)
1103 {
1104     // Upsilon y
1105     return AliGenMUONlib::YUpsilonPP(px, dummy);
1106     
1107 }
1108
1109 Double_t AliGenMUONlib::YUpsilonFlat( const Double_t */*px*/, const Double_t */*dummy*/)
1110 {
1111     // Upsilon y
1112     return 1.;
1113     
1114 }
1115
1116 Double_t AliGenMUONlib::YUpsilonCDFscaledPP10( const Double_t *px, const Double_t */*dummy*/)
1117 {
1118 // Upsilon y
1119 //
1120 // pp 10 TeV
1121 // scaled from YUpsilonPP(14 TeV) using 10 TeV / 14 TeV ratio of y-spectra in LO pQCD. 
1122 // see S.Grigoryan, PWG3 Meeting, 27th Oct 2008
1123 //
1124     Double_t c[4] = {1., -2.17877e-02, -6.52830e-04, 1.40578e-05};
1125     Double_t x = TMath::Abs(px[0]);
1126     if (x > 6.1) return 0.;
1127     Int_t j;
1128     Double_t y = c[j = 3];
1129     while (j > 0) y  = y * x*x +c[--j];
1130     return y;
1131 }
1132
1133 Double_t AliGenMUONlib::YUpsilonCDFscaledPP9( const Double_t *px, const Double_t */*dummy*/)
1134 {
1135 // Upsilon y
1136 //
1137 // pp 8.8 TeV
1138 // rescaling of YUpsilonPP(14 TeV) using 8.8 TeV / 14 TeV ratio of y-spectra in LO QCD 
1139 //
1140     Double_t c[4] = {1., -2.37621e-02, -6.29610e-04, 1.47976e-05};
1141     Double_t x = TMath::Abs(px[0]);
1142     if (x > 6.1) return 0.;
1143     Int_t j;
1144     Double_t y = c[j = 3];
1145     while (j > 0) y  = y * x*x +c[--j];
1146     return y;
1147 }
1148
1149 Double_t AliGenMUONlib::YUpsilonCDFscaledPP9dummy(Double_t px)
1150 {
1151     return AliGenMUONlib::YUpsilonCDFscaledPP9(&px, (Double_t*) 0);
1152 }
1153
1154 Double_t AliGenMUONlib::YUpsilonCDFscaledPP7( const Double_t *px, const Double_t */*dummy*/)
1155 {
1156 // Upsilon y
1157 //
1158 // pp 7 TeV
1159 // scaled from YUpsilonPP(14 TeV) using 7 TeV / 14 TeV ratio of y-spectra in LO pQCD. 
1160 //
1161     Double_t c[4] = {1., -2.61009e-02, -6.83937e-04, 1.78451e-05};
1162     Double_t x = TMath::Abs(px[0]);
1163     if (x > 6.0) return 0.;
1164     Int_t j;
1165     Double_t y = c[j = 3];
1166     while (j > 0) y  = y * x*x +c[--j];
1167     return y;
1168 }
1169
1170 Double_t AliGenMUONlib::YUpsilonCDFscaledPP4( const Double_t *px, const Double_t */*dummy*/)
1171 {
1172 // Upsilon y
1173 //
1174 // pp 3.94 TeV
1175 // rescaling of YUpsilonPP(14 TeV) using 3.94 TeV / 14 TeV ratio of y-spectra in LO QCD
1176 //
1177     Double_t c[4] = {1., -3.91924e-02, -4.26184e-04, 2.10914e-05};
1178     Double_t x = TMath::Abs(px[0]);
1179     if (x > 5.7) return 0.;
1180     Int_t j;
1181     Double_t y = c[j = 3];
1182     while (j > 0) y  = y * x*x +c[--j];
1183
1184     return y;
1185 }
1186
1187 Double_t AliGenMUONlib::YUpsilonPP( const Double_t *px, const Double_t */*dummy*/)
1188 {
1189
1190 //
1191 // Upsilon y
1192 //
1193 //
1194 // R. Vogt 2002
1195 // p p  14. TeV
1196 // MRST HO
1197 // mc = 1.4 GeV, pt-kick 1 GeV
1198 //
1199     Double_t c[7] = {8.91936e-01, -6.46645e-07, -1.52774e-02, 4.28677e-08, -7.01517e-04, 
1200                      -6.20539e-10, 1.29943e-05};
1201     Double_t x = TMath::Abs(px[0]);
1202     if (x > 6.2) return 0.;
1203     Int_t j;
1204     Double_t y = c[j = 6];
1205     while (j > 0) y  = y * x +c[--j];
1206     return y;
1207 }
1208
1209 Double_t AliGenMUONlib::YUpsilonCDFscaledPPb9( const Double_t *px, const Double_t */*dummy*/)
1210 {
1211 // Upsilon y
1212 //
1213 // pPb 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.90
1214 //
1215     Double_t c[7] = {8.71829e-01, 4.77467e-02, 8.09671e-03, 6.45294e-04, -2.15730e-04,
1216                      -4.67538e-05,-2.11683e-06}; 
1217     Double_t y;
1218     Double_t x = px[0] + 0.47;              // rapidity shift
1219     Int_t j;
1220     y = c[j = 6];
1221     while (j > 0) y = y * x + c[--j];
1222     if(y<0) y=0;
1223
1224     return y * AliGenMUONlib::YUpsilonCDFscaledPP9dummy(x);
1225 }
1226
1227 Double_t AliGenMUONlib::YUpsilonCDFscaledPbP9( const Double_t *px, const Double_t */*dummy*/)
1228 {
1229 // Upsilon y
1230 //
1231 // Pbp 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.90
1232 //
1233     Double_t c[7] = {8.71829e-01, 4.77467e-02, 8.09671e-03, 6.45294e-04, -2.15730e-04,
1234                      -4.67538e-05,-2.11683e-06}; 
1235     Double_t y;
1236     Double_t x = -px[0] + 0.47;              // rapidity shift
1237     Int_t j;
1238     y = c[j = 6];
1239     while (j > 0) y = y * x + c[--j];
1240     if(y<0) y=0;
1241
1242     return y * AliGenMUONlib::YUpsilonCDFscaledPP9dummy(x);
1243 }
1244
1245 Double_t AliGenMUONlib::YUpsilonCDFscaledPbPb4( const Double_t *px, const Double_t *dummy)
1246 {
1247 // Upsilon y
1248 //
1249 // PbPb 3.94 TeV, for EKS98 with minimum bias shadowing factor 0.85
1250 //
1251     Double_t c[4] = {8.27837e-01, 1.70115e-02, -1.26046e-03, 1.52091e-05}; 
1252     Double_t x = px[0]*px[0];
1253     Double_t y;
1254     Int_t j;
1255     y = c[j = 3];
1256     while (j > 0) y  = y * x + c[--j];
1257     if(y<0) y=0;
1258
1259     return y * AliGenMUONlib::YUpsilonCDFscaledPP4(px,dummy);
1260 }
1261
1262
1263 //                 particle composition
1264 //
1265 Int_t AliGenMUONlib::IpUpsilon(TRandom *)
1266 {
1267 // y composition
1268     return 553;
1269 }
1270 Int_t AliGenMUONlib::IpUpsilonP(TRandom *)
1271 {
1272 // y composition
1273     return 100553;
1274 }
1275 Int_t AliGenMUONlib::IpUpsilonPP(TRandom *)
1276 {
1277 // y composition
1278     return 200553;
1279 }
1280 Int_t AliGenMUONlib::IpUpsilonFamily(TRandom *)
1281 {
1282 // y composition
1283   Int_t ip;
1284   Float_t r = gRandom->Rndm();
1285   
1286   if (r < 0.712) {
1287     ip = 553;
1288   } else if (r < 0.896) {
1289     ip = 100553;
1290   } else {
1291     ip = 200553;
1292   }
1293   return ip;
1294 }
1295
1296
1297 //
1298 //                        Phi
1299 //
1300 //
1301 //    pt-distribution (by scaling of pion distribution)
1302 //____________________________________________________________
1303 Double_t AliGenMUONlib::PtPhi( const Double_t *px, const Double_t */*dummy*/)
1304 {
1305 // Phi pT
1306   return PtScal(*px,7);
1307 }
1308 //    y-distribution
1309 Double_t AliGenMUONlib::YPhi( const Double_t *px, const Double_t */*dummy*/)
1310 {
1311 // Phi y
1312     Double_t *dum=0;
1313     return YJpsi(px,dum);
1314 }
1315 //                 particle composition
1316 //
1317 Int_t AliGenMUONlib::IpPhi(TRandom *)
1318 {
1319 // Phi composition
1320     return 333;
1321 }
1322
1323 //
1324 //                        omega
1325 //
1326 //
1327 //    pt-distribution (by scaling of pion distribution)
1328 //____________________________________________________________
1329 Double_t AliGenMUONlib::PtOmega( const Double_t *px, const Double_t */*dummy*/)
1330 {
1331 // Omega pT
1332   return PtScal(*px,5);
1333 }
1334 //    y-distribution
1335 Double_t AliGenMUONlib::YOmega( const Double_t *px, const Double_t */*dummy*/)
1336 {
1337 // Omega y
1338     Double_t *dum=0;
1339     return YJpsi(px,dum);
1340 }
1341 //                 particle composition
1342 //
1343 Int_t AliGenMUONlib::IpOmega(TRandom *)
1344 {
1345 // Omega composition
1346     return 223;
1347 }
1348
1349
1350 //
1351 //                        Eta
1352 //
1353 //
1354 //    pt-distribution (by scaling of pion distribution)
1355 //____________________________________________________________
1356 Double_t AliGenMUONlib::PtEta( const Double_t *px, const Double_t */*dummy*/)
1357 {
1358 // Eta pT
1359   return PtScal(*px,3);
1360 }
1361 //    y-distribution
1362 Double_t AliGenMUONlib::YEta( const Double_t *px, const Double_t */*dummy*/)
1363 {
1364 // Eta y
1365     Double_t *dum=0;
1366     return YJpsi(px,dum);
1367 }
1368 //                 particle composition
1369 //
1370 Int_t AliGenMUONlib::IpEta(TRandom *)
1371 {
1372 // Eta composition
1373     return 221;
1374 }
1375
1376 //
1377 //                        Charm
1378 //
1379 //
1380 //                    pt-distribution
1381 //____________________________________________________________
1382 Double_t AliGenMUONlib::PtCharm( const Double_t *px, const Double_t */*dummy*/)
1383 {
1384 // Charm pT
1385   const Double_t kpt0 = 2.25;
1386   const Double_t kxn  = 3.17;
1387   Double_t x=*px;
1388   //
1389   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1390   return x/TMath::Power(pass1,kxn);
1391 }
1392
1393 Double_t AliGenMUONlib::PtCharmCentral( const Double_t *px, const Double_t */*dummy*/)
1394 {
1395 // Charm pT
1396   const Double_t kpt0 = 2.12;
1397   const Double_t kxn  = 2.78;
1398   Double_t x=*px;
1399   //
1400   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1401   return x/TMath::Power(pass1,kxn);
1402 }
1403 Double_t AliGenMUONlib::PtCharmF0M0S0PP( const Double_t *px, const Double_t */*dummy*/)
1404 {
1405 // FiMjSkPP define theoretical uncertainties around F0M0S0PP as follows:
1406 // PtCharmFiMjSkPP = PtCharmF0M0S0PP * (dN(i,j,k)/dpt / dN(0,0,0)/dpt)_MNR
1407 //       i=0,1,2;  j=0,1,2;  k=0,1,...,6
1408 // dN(i,j,k)/dpt - spectra obtained by A.Dainese (hep-ph/0601164, p.88; 
1409 // http://www-zeus.desy.de/~corradi/benchmarks) from NLO pQCD (MNR)
1410 // calculations for the following inputs: 
1411 // Peterson fragmentation function (F) with \epsilon_c = 0.02, 0.002 & 0.11 
1412 // for i=0,1 & 2 respectively; quark mass (M) of 1.5, 1.3 & 1.7 GeV 
1413 // for j=0,1 & 2 respectively; 
1414 // factorisation \mu_F = a*mt and renormalisation \mu_R = b*mt scales (S) 
1415 // with a/b = 1/1, 1/0.5, 0.5/1, 0.5/0.5, 1/2, 2/1 & 2/2 
1416 // for k = 0, 1, 2, 3, 4, 5 & 6 respectively; CTEQ6.1 PDF set 
1417 // (PDF uncertainty not considered since is small, see hep-ph/0601164, p.89).
1418 // June 2008, Smbat.Grigoryan@cern.ch
1419
1420 // Charm pT
1421 // Pythia6.214 (kCharmppMNRwmi, PDF = CTEQ5L, quark mass = 1.2 GeV, PtHard > 2.76 GeV/c)
1422 // for pp collisions at 14 TeV with one c-cbar pair per event.
1423 // Corresponding NLO total cross section is 5.68 mb
1424
1425
1426   const Double_t kpt0 = 2.2930;
1427   const Double_t kxn  = 3.1196;
1428   Double_t c[3]={-5.2180e-01,1.8753e-01,2.8669e-02};
1429   Double_t x=*px;
1430   //
1431   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1432   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
1433 }
1434 Double_t AliGenMUONlib::PtCharmF1M0S0PP( const Double_t *px, const Double_t */*dummy*/)
1435 {
1436 // Charm pT
1437 // Corresponding NLO total cross section is 6.06 mb
1438   const Double_t kpt0 = 2.8669;
1439   const Double_t kxn  = 3.1044;
1440   Double_t c[3]={-4.6714e-01,1.5005e-01,4.5003e-02};
1441   Double_t x=*px;
1442   //
1443   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1444   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
1445 }
1446 Double_t AliGenMUONlib::PtCharmF2M0S0PP( const Double_t *px, const Double_t */*dummy*/)
1447 {
1448 // Charm pT
1449 // Corresponding NLO total cross section is 6.06 mb
1450   const Double_t kpt0 = 1.8361;
1451   const Double_t kxn  = 3.2966;
1452   Double_t c[3]={-6.1550e-01,2.6498e-01,1.0728e-02};
1453   Double_t x=*px;
1454   //
1455   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1456   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
1457 }
1458 Double_t AliGenMUONlib::PtCharmF0M1S0PP( const Double_t *px, const Double_t */*dummy*/)
1459 {
1460 // Charm pT
1461 // Corresponding NLO total cross section is 7.69 mb
1462   const Double_t kpt0 = 2.1280;
1463   const Double_t kxn  = 3.1397;
1464   Double_t c[3]={-5.4021e-01,2.0944e-01,2.5211e-02};
1465   Double_t x=*px;
1466   //
1467   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1468   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
1469 }
1470 Double_t AliGenMUONlib::PtCharmF0M2S0PP( const Double_t *px, const Double_t */*dummy*/)
1471 {
1472 // Charm pT
1473 // Corresponding NLO total cross section is 4.81 mb
1474   const Double_t kpt0 = 2.4579;
1475   const Double_t kxn  = 3.1095;
1476   Double_t c[3]={-5.1497e-01,1.7532e-01,3.2429e-02};
1477   Double_t x=*px;
1478   //
1479   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1480   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
1481 }
1482 Double_t AliGenMUONlib::PtCharmF0M0S1PP( const Double_t *px, const Double_t */*dummy*/)
1483 {
1484 // Charm pT
1485 // Corresponding NLO total cross section is 14.09 mb
1486   const Double_t kpt0 = 2.1272;
1487   const Double_t kxn  = 3.1904;
1488   Double_t c[3]={-4.6088e-01,2.1918e-01,2.3055e-02};
1489   Double_t x=*px;
1490   //
1491   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1492   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
1493 }
1494 Double_t AliGenMUONlib::PtCharmF0M0S2PP( const Double_t *px, const Double_t */*dummy*/)
1495 {
1496 // Charm pT
1497 // Corresponding NLO total cross section is 1.52 mb
1498   const Double_t kpt0 = 2.8159;
1499   const Double_t kxn  = 3.0857;
1500   Double_t c[3]={-6.4691e-01,2.0289e-01,2.4922e-02};
1501   Double_t x=*px;
1502   //
1503   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1504   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
1505 }
1506 Double_t AliGenMUONlib::PtCharmF0M0S3PP( const Double_t *px, const Double_t */*dummy*/)
1507 {
1508 // Charm pT
1509 // Corresponding NLO total cross section is 3.67 mb
1510   const Double_t kpt0 = 2.7297;
1511   const Double_t kxn  = 3.3019;
1512   Double_t c[3]={-6.2216e-01,1.9031e-01,1.5341e-02};
1513   Double_t x=*px;
1514   //
1515   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1516   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
1517 }
1518 Double_t AliGenMUONlib::PtCharmF0M0S4PP( const Double_t *px, const Double_t */*dummy*/)
1519 {
1520 // Charm pT
1521 // Corresponding NLO total cross section is 3.38 mb
1522   const Double_t kpt0 = 2.3894;
1523   const Double_t kxn  = 3.1075;
1524   Double_t c[3]={-4.9742e-01,1.7032e-01,2.5994e-02};
1525   Double_t x=*px;
1526   //
1527   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1528   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
1529 }
1530 Double_t AliGenMUONlib::PtCharmF0M0S5PP( const Double_t *px, const Double_t */*dummy*/)
1531 {
1532 // Charm pT
1533 // Corresponding NLO total cross section is 10.37 mb
1534   const Double_t kpt0 = 2.0187;
1535   const Double_t kxn  = 3.3011;
1536   Double_t c[3]={-3.9869e-01,2.9248e-01,1.1763e-02};
1537   Double_t x=*px;
1538   //
1539   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1540   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
1541 }
1542 Double_t AliGenMUONlib::PtCharmF0M0S6PP( const Double_t *px, const Double_t */*dummy*/)
1543 {
1544 // Charm pT
1545 // Corresponding NLO total cross section is 7.22 mb
1546   const Double_t kpt0 = 2.1089;
1547   const Double_t kxn  = 3.1848;
1548   Double_t c[3]={-4.6275e-01,1.8114e-01,2.1363e-02};
1549   Double_t x=*px;
1550   //
1551   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1552   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
1553 }
1554
1555 //                  y-distribution
1556 Double_t AliGenMUONlib::YCharm( const Double_t *px, const Double_t */*dummy*/)
1557 {
1558 // Charm y :: Carrer & Dainese : ALICE-INT-2003-019 v.3 (hep-ph/0311225) 
1559 // Pythia tuned to reproduce the distribution given by the HVQMNR program based on NLO calculations (pQCD)
1560 // shadowing + kt broadening 
1561
1562     Double_t x=px[0];
1563     Double_t c[2]={-2.42985e-03,-2.31001e-04};
1564     Double_t y=1+(c[0]*TMath::Power(x,2))+(c[1]*TMath::Power(x,4));
1565     Double_t ycharm;
1566     
1567     if (TMath::Abs(x)>8) {
1568       ycharm=0.;
1569     }
1570     else {
1571       ycharm=TMath::Power(y,3);
1572     }
1573     
1574     return ycharm;
1575 }
1576 Double_t AliGenMUONlib::YCharmF0M0S0PP( const Double_t *px, const Double_t */*dummy*/)
1577 {
1578 // FiMjSkPP define theoretical uncertainties around F0M0S0PP as follows:
1579 // YCharmFiMjSkPP = YCharmF0M0S0PP * (dN(i,j,k)/dy / dN(0,0,0)/dy)_MNR
1580 //       i=0,1,2;  j=0,1,2;  k=0,1,...,6
1581 // dN(i,j,k)/dy - spectra obtained by A.Dainese (hep-ph/0601164, p.88; 
1582 // http://www-zeus.desy.de/~corradi/benchmarks) from NLO pQCD (MNR) 
1583 // calculations for the following inputs: 
1584 // Peterson fragmentation function (F) with \epsilon_c = 0.02, 0.002 & 0.11 
1585 // for i=0,1 & 2 respectively; quark mass (M) of 1.5, 1.3 & 1.7 GeV 
1586 // for j=0,1 & 2 respectively; 
1587 // factorisation \mu_F = a*mt and renormalisation \mu_R = b*mt scales (S) 
1588 // with a/b = 1/1,1/0.5, 0.5/1, 0.5/0.5, 1/2, 2/1 & 2/2 for 
1589 // k = 0, 1, 2, 3, 4, 5 & 6 respectively; CTEQ6.1 PDF set
1590 // (PDF uncertainty not considered since is small, see hep-ph/0601164, p.89).
1591 // June 2008, Smbat.Grigoryan@cern.ch
1592
1593 // Charm y
1594 // Pythia6.214 (kCharmppMNRwmi, PDF = CTEQ5L, quark mass = 1.2 GeV, PtHard > 2.76 GeV/c)
1595 // for pp collisions at 14 TeV with one c-cbar pair per event.
1596 // Corresponding NLO total cross section is 5.68 mb
1597
1598     Double_t x=px[0];
1599     Double_t c[2]={7.0909e-03,6.1967e-05};
1600     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
1601     Double_t ycharm;
1602     
1603     if (TMath::Abs(x)>9) {
1604       ycharm=0.;
1605     }
1606     else {
1607       ycharm=TMath::Power(y,3);
1608     }
1609     
1610     return ycharm;
1611 }
1612 Double_t AliGenMUONlib::YCharmF1M0S0PP( const Double_t *px, const Double_t */*dummy*/)
1613 {
1614 // Charm y
1615 // Corresponding NLO total cross section is 6.06 mb
1616     Double_t x=px[0];
1617     Double_t c[2]={6.9707e-03,6.0971e-05};
1618     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
1619     Double_t ycharm;
1620     
1621     if (TMath::Abs(x)>9) {
1622       ycharm=0.;
1623     }
1624     else {
1625       ycharm=TMath::Power(y,3);
1626     }
1627     
1628     return ycharm;
1629 }
1630 Double_t AliGenMUONlib::YCharmF2M0S0PP( const Double_t *px, const Double_t */*dummy*/)
1631 {
1632 // Charm y
1633 // Corresponding NLO total cross section is 6.06 mb
1634     Double_t x=px[0];
1635     Double_t c[2]={7.1687e-03,6.5303e-05};
1636     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
1637     Double_t ycharm;
1638     
1639     if (TMath::Abs(x)>9) {
1640       ycharm=0.;
1641     }
1642     else {
1643       ycharm=TMath::Power(y,3);
1644     }
1645     
1646     return ycharm;
1647 }
1648 Double_t AliGenMUONlib::YCharmF0M1S0PP( const Double_t *px, const Double_t */*dummy*/)
1649 {
1650 // Charm y
1651 // Corresponding NLO total cross section is 7.69 mb
1652     Double_t x=px[0];
1653     Double_t c[2]={5.9090e-03,7.1854e-05};
1654     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
1655     Double_t ycharm;
1656     
1657     if (TMath::Abs(x)>9) {
1658       ycharm=0.;
1659     }
1660     else {
1661       ycharm=TMath::Power(y,3);
1662     }
1663     
1664     return ycharm;
1665 }
1666 Double_t AliGenMUONlib::YCharmF0M2S0PP( const Double_t *px, const Double_t */*dummy*/)
1667 {
1668 // Charm y
1669 // Corresponding NLO total cross section is 4.81 mb
1670     Double_t x=px[0];
1671     Double_t c[2]={8.0882e-03,5.5872e-05};
1672     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
1673     Double_t ycharm;
1674     
1675     if (TMath::Abs(x)>9) {
1676       ycharm=0.;
1677     }
1678     else {
1679       ycharm=TMath::Power(y,3);
1680     }
1681     
1682     return ycharm;
1683 }
1684 Double_t AliGenMUONlib::YCharmF0M0S1PP( const Double_t *px, const Double_t */*dummy*/)
1685 {
1686 // Charm y
1687 // Corresponding NLO total cross section is 14.09 mb
1688     Double_t x=px[0];
1689     Double_t c[2]={7.2520e-03,6.2691e-05};
1690     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
1691     Double_t ycharm;
1692     
1693     if (TMath::Abs(x)>9) {
1694       ycharm=0.;
1695     }
1696     else {
1697       ycharm=TMath::Power(y,3);
1698     }
1699     
1700     return ycharm;
1701 }
1702 Double_t AliGenMUONlib::YCharmF0M0S2PP( const Double_t *px, const Double_t */*dummy*/)
1703 {
1704 // Charm y
1705 // Corresponding NLO total cross section is 1.52 mb
1706     Double_t x=px[0];
1707     Double_t c[2]={1.1040e-04,1.4498e-04};
1708     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
1709     Double_t ycharm;
1710     
1711     if (TMath::Abs(x)>9) {
1712       ycharm=0.;
1713     }
1714     else {
1715       ycharm=TMath::Power(y,3);
1716     }
1717     
1718     return ycharm;
1719 }
1720 Double_t AliGenMUONlib::YCharmF0M0S3PP( const Double_t *px, const Double_t */*dummy*/)
1721 {
1722 // Charm y
1723 // Corresponding NLO total cross section is 3.67 mb
1724     Double_t x=px[0];
1725     Double_t c[2]={-3.1328e-03,1.8270e-04};
1726     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
1727     Double_t ycharm;
1728     
1729     if (TMath::Abs(x)>9) {
1730       ycharm=0.;
1731     }
1732     else {
1733       ycharm=TMath::Power(y,3);
1734     }
1735     
1736     return ycharm;
1737 }
1738 Double_t AliGenMUONlib::YCharmF0M0S4PP( const Double_t *px, const Double_t */*dummy*/)
1739 {
1740 // Charm y
1741 // Corresponding NLO total cross section is 3.38 mb
1742     Double_t x=px[0];
1743     Double_t c[2]={7.0865e-03,6.2532e-05};
1744     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
1745     Double_t ycharm;
1746     
1747     if (TMath::Abs(x)>9) {
1748       ycharm=0.;
1749     }
1750     else {
1751       ycharm=TMath::Power(y,3);
1752     }
1753     
1754     return ycharm;
1755 }
1756 Double_t AliGenMUONlib::YCharmF0M0S5PP( const Double_t *px, const Double_t */*dummy*/)
1757 {
1758 // Charm y
1759 // Corresponding NLO total cross section is 10.37 mb
1760     Double_t x=px[0];
1761     Double_t c[2]={7.7070e-03,5.3533e-05};
1762     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
1763     Double_t ycharm;
1764     
1765     if (TMath::Abs(x)>9) {
1766       ycharm=0.;
1767     }
1768     else {
1769       ycharm=TMath::Power(y,3);
1770     }
1771     
1772     return ycharm;
1773 }
1774 Double_t AliGenMUONlib::YCharmF0M0S6PP( const Double_t *px, const Double_t */*dummy*/)
1775 {
1776 // Charm y
1777 // Corresponding NLO total cross section is 7.22 mb
1778     Double_t x=px[0];
1779     Double_t c[2]={7.9195e-03,5.3823e-05};
1780     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
1781     Double_t ycharm;
1782     
1783     if (TMath::Abs(x)>9) {
1784       ycharm=0.;
1785     }
1786     else {
1787       ycharm=TMath::Power(y,3);
1788     }
1789     
1790     return ycharm;
1791 }
1792
1793
1794 Int_t AliGenMUONlib::IpCharm(TRandom *ran)
1795 {  
1796 // Charm composition
1797     Float_t random;
1798     Int_t ip;
1799 //    411,421,431,4122
1800     random = ran->Rndm();
1801 //  Taux de production Carrer & Dainese : ALICE-INT-2003-019 v.3  
1802 //  >>>>> cf. tab 4 p 11
1803   
1804     if (random < 0.30) {                       
1805         ip=421;
1806     } else if (random < 0.60) {
1807         ip=-421;
1808     } else if (random < 0.70) {
1809         ip=411;
1810     } else if (random < 0.80) {
1811         ip=-411;
1812     } else if (random < 0.86) {
1813         ip=431;
1814     } else if (random < 0.92) {
1815         ip=-431;        
1816     } else if (random < 0.96) {
1817         ip=4122;
1818     } else {
1819         ip=-4122;
1820     }
1821     
1822     return ip;
1823 }
1824
1825 //
1826 //                        Beauty
1827 //
1828 //
1829 //                    pt-distribution
1830 //____________________________________________________________
1831 Double_t AliGenMUONlib::PtBeauty( const Double_t *px, const Double_t */*dummy*/)
1832 {
1833 // Beauty pT
1834   const Double_t kpt0 = 6.53;
1835   const Double_t kxn  = 3.59;
1836   Double_t x=*px;
1837   //
1838   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1839   return x/TMath::Power(pass1,kxn);
1840 }
1841
1842 Double_t AliGenMUONlib::PtBeautyCentral( const Double_t *px, const Double_t */*dummy*/)
1843 {
1844 // Beauty pT
1845   const Double_t kpt0 = 6.14;
1846   const Double_t kxn  = 2.93;
1847   Double_t x=*px;
1848   //
1849   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1850   return x/TMath::Power(pass1,kxn);
1851 }
1852 Double_t AliGenMUONlib::PtBeautyF0M0S0PP( const Double_t *px, const Double_t */*dummy*/)
1853 {
1854 // FiMjSkPP define theoretical uncertainties around F0M0S0PP as follows:
1855 // PtBeautyFiMjSkPP = PtBeautyF0M0S0PP * (dN(i,j,k)/dpt / dN(0,0,0)/dpt)_MNR
1856 //       i=0,1,2;  j=0,1,2;  k=0,1,...,6
1857 // dN(i,j,k)/dpt - spectra obtained by A.Dainese (hep-ph/0601164, p.88; 
1858 // http://www-zeus.desy.de/~corradi/benchmarks) from NLO pQCD (MNR) 
1859 // calculations for the following inputs: 
1860 // Peterson fragmentation function (F) with \epsilon_b = 0.001, 0.0002 & 0.004 
1861 // for i=0,1 & 2 respectively; quark mass (M) of 4.75, 4.5 & 5.0 GeV 
1862 // for j=0,1 & 2 respectively; 
1863 // factorisation \mu_F = a*mt and renormalisation \mu_R = b*mt scales (S) 
1864 // with a/b = 1/1, 1/0.5, 0.5/1, 0.5/0.5, 1/2, 2/1 & 2/2 for 
1865 // k = 0, 1, 2, 3, 4, 5 & 6 respectively; CTEQ6.1 PDF set
1866 // (PDF uncertainty not considered since is small, see hep-ph/0601164, p.89).
1867 // June 2008, Smbat.Grigoryan@cern.ch
1868
1869 // Beauty pT
1870 // Pythia6.214 (kBeautyppMNRwmi, PDF = CTEQ5L, quark mass = 4.75 GeV, PtHard > 2.76 GeV/c)
1871 // for pp collisions at 14 TeV with one b-bbar pair per event.
1872 // Corresponding NLO total cross section is 0.494 mb
1873
1874   const Double_t kpt0 = 8.0575;
1875   const Double_t kxn  = 3.1921;
1876   Double_t x=*px;
1877   //
1878   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1879   return x/TMath::Power(pass1,kxn);
1880 }
1881 Double_t AliGenMUONlib::PtBeautyF1M0S0PP( const Double_t *px, const Double_t */*dummy*/)
1882 {
1883 // Beauty pT
1884 // Corresponding NLO total cross section is 0.445 mb
1885   const Double_t kpt0 = 8.6239;
1886   const Double_t kxn  = 3.2911;
1887   Double_t x=*px;
1888   //
1889   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1890   return x/TMath::Power(pass1,kxn);
1891 }
1892 Double_t AliGenMUONlib::PtBeautyF2M0S0PP( const Double_t *px, const Double_t */*dummy*/)
1893 {
1894 // Beauty pT
1895 // Corresponding NLO total cross section is 0.445 mb
1896   const Double_t kpt0 = 7.3367;
1897   const Double_t kxn  = 3.0692;
1898   Double_t x=*px;
1899   //
1900   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1901   return x/TMath::Power(pass1,kxn);
1902 }
1903 Double_t AliGenMUONlib::PtBeautyF0M1S0PP( const Double_t *px, const Double_t */*dummy*/)
1904 {
1905 // Beauty pT
1906 // Corresponding NLO total cross section is 0.518 mb
1907   const Double_t kpt0 = 7.6409;
1908   const Double_t kxn  = 3.1364;
1909   Double_t x=*px;
1910   //
1911   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1912   return x/TMath::Power(pass1,kxn);
1913 }
1914 Double_t AliGenMUONlib::PtBeautyF0M2S0PP( const Double_t *px, const Double_t */*dummy*/)
1915 {
1916 // Beauty pT
1917 // Corresponding NLO total cross section is 0.384 mb
1918   const Double_t kpt0 = 8.4948;
1919   const Double_t kxn  = 3.2546;
1920   Double_t x=*px;
1921   //
1922   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1923   return x/TMath::Power(pass1,kxn);
1924 }
1925 Double_t AliGenMUONlib::PtBeautyF0M0S1PP( const Double_t *px, const Double_t */*dummy*/)
1926 {
1927 // Beauty pT
1928 // Corresponding NLO total cross section is 0.648 mb
1929   const Double_t kpt0 = 7.6631;
1930   const Double_t kxn  = 3.1621;
1931   Double_t x=*px;
1932   //
1933   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1934   return x/TMath::Power(pass1,kxn);
1935 }
1936 Double_t AliGenMUONlib::PtBeautyF0M0S2PP( const Double_t *px, const Double_t */*dummy*/)
1937 {
1938 // Beauty pT
1939 // Corresponding NLO total cross section is 0.294 mb
1940   const Double_t kpt0 = 8.7245;
1941   const Double_t kxn  = 3.2213;
1942   Double_t x=*px;
1943   //
1944   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1945   return x/TMath::Power(pass1,kxn);
1946 }
1947 Double_t AliGenMUONlib::PtBeautyF0M0S3PP( const Double_t *px, const Double_t */*dummy*/)
1948 {
1949 // Beauty pT
1950 // Corresponding NLO total cross section is 0.475 mb
1951   const Double_t kpt0 = 8.5296;
1952   const Double_t kxn  = 3.2187;
1953   Double_t x=*px;
1954   //
1955   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1956   return x/TMath::Power(pass1,kxn);
1957 }
1958 Double_t AliGenMUONlib::PtBeautyF0M0S4PP( const Double_t *px, const Double_t */*dummy*/)
1959 {
1960 // Beauty pT
1961 // Corresponding NLO total cross section is 0.324 mb
1962   const Double_t kpt0 = 7.9440;
1963   const Double_t kxn  = 3.1614;
1964   Double_t x=*px;
1965   //
1966   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1967   return x/TMath::Power(pass1,kxn);
1968 }
1969 Double_t AliGenMUONlib::PtBeautyF0M0S5PP( const Double_t *px, const Double_t */*dummy*/)
1970 {
1971 // Beauty pT
1972 // Corresponding NLO total cross section is 0.536 mb
1973   const Double_t kpt0 = 8.2408;
1974   const Double_t kxn  = 3.3029;
1975   Double_t x=*px;
1976   //
1977   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1978   return x/TMath::Power(pass1,kxn);
1979 }
1980 Double_t AliGenMUONlib::PtBeautyF0M0S6PP( const Double_t *px, const Double_t */*dummy*/)
1981 {
1982 // Beauty pT
1983 // Corresponding NLO total cross section is 0.420 mb
1984   const Double_t kpt0 = 7.8041;
1985   const Double_t kxn  = 3.2094;
1986   Double_t x=*px;
1987   //
1988   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1989   return x/TMath::Power(pass1,kxn);
1990 }
1991
1992 //                     y-distribution
1993 Double_t AliGenMUONlib::YBeauty( const Double_t *px, const Double_t */*dummy*/)
1994 {
1995 // Beauty y :: Carrer & Dainese : ALICE-INT-2003-019 v.3 (hep-ph/0311225) 
1996 // Pythia tuned to reproduce the distribution given by the HVQMNR program based on NLO calculations (pQCD)
1997 // shadowing + kt broadening 
1998
1999     Double_t x=px[0];
2000     Double_t c[2]={-1.27590e-02,-2.42731e-04};
2001     Double_t y=1+c[0]*TMath::Power(x,2)+c[1]*TMath::Power(x,4);
2002     Double_t ybeauty;
2003     
2004     if (TMath::Abs(x)>6) {
2005       ybeauty=0.;
2006     }
2007     else {
2008       ybeauty=TMath::Power(y,3);
2009     }
2010     
2011     return ybeauty;
2012 }
2013 Double_t AliGenMUONlib::YBeautyF0M0S0PP( const Double_t *px, const Double_t */*dummy*/)
2014 {
2015 // FiMjSkPP define theoretical uncertainties around F0M0S0PP as follows:
2016 // YBeautyFiMjSkPP = YBeautyF0M0S0PP * (dN(i,j,k)/dy / dN(0,0,0)/dy)_MNR
2017 //       i=0,1,2;  j=0,1,2;  k=0,1,...,6
2018 // dN(i,j,k)/dy - spectra obtained by A.Dainese (hep-ph/0601164, p.88; 
2019 // http://www-zeus.desy.de/~corradi/benchmarks) from NLO pQCD (MNR) 
2020 // calculations for the following inputs: 
2021 // Peterson fragmentation function (F) with \epsilon_b = 0.001, 0.0002 & 0.004 
2022 // for i=0,1 & 2 respectively; quark mass (M) of 4.75, 4.5 & 5.0 GeV 
2023 // for j=0,1 & 2 respectively; 
2024 // factorisation \mu_F = a*mt and renormalisation \mu_R = b*mt scales (S) 
2025 // with a/b = 1/1, 1/0.5, 0.5/1, 0.5/0.5, 1/2, 2/1 & 2/2 
2026 // for k = 0, 1, 2, 3, 4, 5 & 6 respectively; CTEQ6.1 PDF set 
2027 // (PDF uncertainty not considered since is small, see hep-ph/0601164, p.89).
2028 // June 2008, Smbat.Grigoryan@cern.ch
2029
2030 // Beauty y
2031 // Pythia6.214 (kBeautyppMNRwmi, PDF = CTEQ5L, quark mass = 4.75 GeV, PtHard > 2.76 GeV/c)
2032 // for pp collisions at 14 TeV with one b-bbar pair per event.
2033 // Corresponding NLO total cross section is 0.494 mb
2034
2035
2036     Double_t x=px[0];
2037     Double_t c[2]={1.2350e-02,9.2667e-05};
2038     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
2039     Double_t ybeauty;
2040     
2041     if (TMath::Abs(x)>7.6) {
2042       ybeauty=0.;
2043     }
2044     else {
2045       ybeauty=TMath::Power(y,3);
2046     }
2047     
2048     return ybeauty;
2049 }
2050 Double_t AliGenMUONlib::YBeautyF1M0S0PP( const Double_t *px, const Double_t */*dummy*/)
2051 {
2052 // Beauty y
2053 // Corresponding NLO total cross section is 0.445 mb
2054     Double_t x=px[0];
2055     Double_t c[2]={1.2292e-02,9.1847e-05};
2056     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
2057     Double_t ybeauty;
2058     
2059     if (TMath::Abs(x)>7.6) {
2060       ybeauty=0.;
2061     }
2062     else {
2063       ybeauty=TMath::Power(y,3);
2064     }
2065     
2066     return ybeauty;
2067 }
2068 Double_t AliGenMUONlib::YBeautyF2M0S0PP( const Double_t *px, const Double_t */*dummy*/)
2069 {
2070 // Beauty y
2071 // Corresponding NLO total cross section is 0.445 mb
2072     Double_t x=px[0];
2073     Double_t c[2]={1.2436e-02,9.3709e-05};
2074     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
2075     Double_t ybeauty;
2076     
2077     if (TMath::Abs(x)>7.6) {
2078       ybeauty=0.;
2079     }
2080     else {
2081       ybeauty=TMath::Power(y,3);
2082     }
2083     
2084     return ybeauty;
2085 }
2086 Double_t AliGenMUONlib::YBeautyF0M1S0PP( const Double_t *px, const Double_t */*dummy*/)
2087 {
2088 // Beauty y
2089 // Corresponding NLO total cross section is 0.518 mb
2090     Double_t x=px[0];
2091     Double_t c[2]={1.1714e-02,1.0068e-04};
2092     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
2093     Double_t ybeauty;
2094     
2095     if (TMath::Abs(x)>7.6) {
2096       ybeauty=0.;
2097     }
2098     else {
2099       ybeauty=TMath::Power(y,3);
2100     }
2101     
2102     return ybeauty;
2103 }
2104 Double_t AliGenMUONlib::YBeautyF0M2S0PP( const Double_t *px, const Double_t */*dummy*/)
2105 {
2106 // Beauty y
2107 // Corresponding NLO total cross section is 0.384 mb
2108     Double_t x=px[0];
2109     Double_t c[2]={1.2944e-02,8.5500e-05};
2110     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
2111     Double_t ybeauty;
2112     
2113     if (TMath::Abs(x)>7.6) {
2114       ybeauty=0.;
2115     }
2116     else {
2117       ybeauty=TMath::Power(y,3);
2118     }
2119     
2120     return ybeauty;
2121 }
2122 Double_t AliGenMUONlib::YBeautyF0M0S1PP( const Double_t *px, const Double_t */*dummy*/)
2123 {
2124 // Beauty y
2125 // Corresponding NLO total cross section is 0.648 mb
2126     Double_t x=px[0];
2127     Double_t c[2]={1.2455e-02,9.2713e-05};
2128     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
2129     Double_t ybeauty;
2130     
2131     if (TMath::Abs(x)>7.6) {
2132       ybeauty=0.;
2133     }
2134     else {
2135       ybeauty=TMath::Power(y,3);
2136     }
2137     
2138     return ybeauty;
2139 }
2140 Double_t AliGenMUONlib::YBeautyF0M0S2PP( const Double_t *px, const Double_t */*dummy*/)
2141 {
2142 // Beauty y
2143 // Corresponding NLO total cross section is 0.294 mb
2144     Double_t x=px[0];
2145     Double_t c[2]={1.0897e-02,1.1878e-04};
2146     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
2147     Double_t ybeauty;
2148     
2149     if (TMath::Abs(x)>7.6) {
2150       ybeauty=0.;
2151     }
2152     else {
2153       ybeauty=TMath::Power(y,3);
2154     }
2155     
2156     return ybeauty;
2157 }
2158 Double_t AliGenMUONlib::YBeautyF0M0S3PP( const Double_t *px, const Double_t */*dummy*/)
2159 {
2160 // Beauty y
2161 // Corresponding NLO total cross section is 0.475 mb
2162     Double_t x=px[0];
2163     Double_t c[2]={1.0912e-02,1.1858e-04};
2164     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
2165     Double_t ybeauty;
2166     
2167     if (TMath::Abs(x)>7.6) {
2168       ybeauty=0.;
2169     }
2170     else {
2171       ybeauty=TMath::Power(y,3);
2172     }
2173     
2174     return ybeauty;
2175 }
2176 Double_t AliGenMUONlib::YBeautyF0M0S4PP( const Double_t *px, const Double_t */*dummy*/)
2177 {
2178 // Beauty y
2179 // Corresponding NLO total cross section is 0.324 mb
2180     Double_t x=px[0];
2181     Double_t c[2]={1.2378e-02,9.2490e-05};
2182     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
2183     Double_t ybeauty;
2184     
2185     if (TMath::Abs(x)>7.6) {
2186       ybeauty=0.;
2187     }
2188     else {
2189       ybeauty=TMath::Power(y,3);
2190     }
2191     
2192     return ybeauty;
2193 }
2194 Double_t AliGenMUONlib::YBeautyF0M0S5PP( const Double_t *px, const Double_t */*dummy*/)
2195 {
2196 // Beauty y
2197 // Corresponding NLO total cross section is 0.536 mb
2198     Double_t x=px[0];
2199     Double_t c[2]={1.2886e-02,8.2912e-05};
2200     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
2201     Double_t ybeauty;
2202     
2203     if (TMath::Abs(x)>7.6) {
2204       ybeauty=0.;
2205     }
2206     else {
2207       ybeauty=TMath::Power(y,3);
2208     }
2209     
2210     return ybeauty;
2211 }
2212 Double_t AliGenMUONlib::YBeautyF0M0S6PP( const Double_t *px, const Double_t */*dummy*/)
2213 {
2214 // Beauty y
2215 // Corresponding NLO total cross section is 0.420 mb
2216     Double_t x=px[0];
2217     Double_t c[2]={1.3106e-02,8.0115e-05};
2218     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
2219     Double_t ybeauty;
2220     
2221     if (TMath::Abs(x)>7.6) {
2222       ybeauty=0.;
2223     }
2224     else {
2225       ybeauty=TMath::Power(y,3);
2226     }
2227     
2228     return ybeauty;
2229 }
2230
2231 Int_t AliGenMUONlib::IpBeauty(TRandom *ran)
2232 {  
2233 // Beauty Composition
2234     Float_t random;
2235     Int_t ip;
2236     random = ran->Rndm(); 
2237     
2238 //  Taux de production Carrer & Dainese : ALICE-INT-2003-019 v.3  
2239 //  >>>>> cf. tab 4 p 11
2240     
2241  if (random < 0.20) {                       
2242         ip=511;
2243     } else if (random < 0.40) {
2244         ip=-511;
2245     } else if (random < 0.605) {
2246         ip=521;
2247     } else if (random < 0.81) {
2248         ip=-521;
2249     } else if (random < 0.87) {
2250         ip=531;
2251     } else if (random < 0.93) {
2252         ip=-531;        
2253     } else if (random < 0.965) {
2254         ip=5122;
2255     } else {
2256         ip=-5122;
2257     }
2258     
2259  return ip;
2260 }
2261
2262
2263 typedef Double_t (*GenFunc) (const Double_t*,  const Double_t*);
2264 GenFunc AliGenMUONlib::GetPt(Int_t param,  const char* tname) const
2265 {
2266 // Return pointer to pT parameterisation
2267     TString sname = TString(tname);
2268     GenFunc func;
2269     switch (param) 
2270     {
2271     case kPhi:
2272         func=PtPhi;
2273         break;
2274     case kOmega:
2275         func=PtOmega;
2276         break;
2277     case kEta:
2278         func=PtEta;
2279         break;
2280     case kJpsiFamily:
2281     case kPsiP:
2282     case kChic1:
2283     case kChic2:
2284     case kJpsi:
2285         if (sname == "Vogt" || sname == "Vogt PbPb") {
2286             func=PtJpsiPbPb;
2287         } else if (sname == "Vogt pp") {
2288             func=PtJpsiPP;
2289         } else if (sname == "pp 7") {
2290             func=PtJpsiPP7000;
2291         } else if (sname == "pp 2.76") {
2292             func=PtJpsiPP2760;
2293         } else if (sname == "PbPb 2.76") {
2294             func=PtJpsiPbPb2760;
2295         } else if (sname == "CDF scaled") {
2296             func=PtJpsiCDFscaled;
2297         } else if (sname == "CDF pp") {
2298             func=PtJpsiCDFscaledPP;
2299         } else if (sname == "CDF pp 10") {
2300             func=PtJpsiCDFscaledPP10;
2301         } else if (sname == "CDF pp 8.8") {
2302             func=PtJpsiCDFscaledPP9;
2303         } else if (sname == "CDF pp 7" || sname == "CDF pp 7 flat y") {
2304             func=PtJpsiCDFscaledPP7;
2305         } else if (sname == "CDF pp 3.94") {
2306             func=PtJpsiCDFscaledPP4;
2307         } else if (sname == "CDF pp 2.76") {
2308             func=PtJpsiCDFscaledPP3;
2309         } else if (sname == "CDF pp 1.9") {
2310             func=PtJpsiCDFscaledPP2;
2311         } else if (sname == "CDF pPb 8.8") {
2312             func=PtJpsiCDFscaledPPb9;
2313         } else if (sname == "CDF Pbp 8.8") {
2314             func=PtJpsiCDFscaledPbP9;
2315         } else if (sname == "CDF PbPb 3.94") {
2316             func=PtJpsiCDFscaledPbPb4;
2317         } else if (sname == "Flat" || sname == "CDF pp 7 flat pt") {
2318             func=PtJpsiFlat;
2319         } else {
2320             func=PtJpsi;
2321         }
2322         break;
2323     case kJpsiFromB:
2324         func = PtJpsiBPbPb;
2325         break;
2326     case kUpsilonFamily:
2327     case kUpsilonP:
2328     case kUpsilonPP:
2329     case kUpsilon:
2330         if (sname == "Vogt" || sname == "Vogt PbPb") {
2331             func=PtUpsilonPbPb;
2332         } else if (sname == "Vogt pp") {
2333             func=PtUpsilonPP;
2334         } else if (sname == "CDF scaled") {
2335             func=PtUpsilonCDFscaled;
2336         } else if (sname == "CDF pp") {
2337             func=PtUpsilonCDFscaledPP;
2338         } else if (sname == "CDF pp 10") {
2339             func=PtUpsilonCDFscaledPP10;
2340         } else if (sname == "CDF pp 8.8") {
2341             func=PtUpsilonCDFscaledPP9;
2342         } else if (sname == "CDF pp 7") {
2343             func=PtUpsilonCDFscaledPP7;
2344         } else if (sname == "CDF pp 3.94") {
2345             func=PtUpsilonCDFscaledPP4;
2346         } else if (sname == "CDF pPb 8.8") {
2347             func=PtUpsilonCDFscaledPPb9;
2348         } else if (sname == "CDF Pbp 8.8") {
2349             func=PtUpsilonCDFscaledPbP9;
2350         } else if (sname == "CDF PbPb 3.94") {
2351             func=PtUpsilonCDFscaledPbPb4;
2352         } else if (sname == "Flat") {
2353             func=PtUpsilonFlat;
2354         } else {
2355             func=PtUpsilon;
2356         }
2357         break;  
2358     case kCharm:
2359         if (sname == "F0M0S0 pp") {
2360             func=PtCharmF0M0S0PP;
2361         } else if (sname == "F1M0S0 pp") {
2362             func=PtCharmF1M0S0PP;
2363         } else if (sname == "F2M0S0 pp") {
2364             func=PtCharmF2M0S0PP;
2365         } else if (sname == "F0M1S0 pp") {
2366             func=PtCharmF0M1S0PP;
2367         } else if (sname == "F0M2S0 pp") {
2368             func=PtCharmF0M2S0PP;
2369         } else if (sname == "F0M0S1 pp") {
2370             func=PtCharmF0M0S1PP;
2371         } else if (sname == "F0M0S2 pp") {
2372             func=PtCharmF0M0S2PP;
2373         } else if (sname == "F0M0S3 pp") {
2374             func=PtCharmF0M0S3PP;
2375         } else if (sname == "F0M0S4 pp") {
2376             func=PtCharmF0M0S4PP;
2377         } else if (sname == "F0M0S5 pp") {
2378             func=PtCharmF0M0S5PP;
2379         } else if (sname == "F0M0S6 pp") {
2380             func=PtCharmF0M0S6PP;
2381         } else if (sname == "central") {
2382             func=PtCharmCentral;
2383         } else {
2384             func=PtCharm;
2385         }
2386         break;
2387     case kBeauty:
2388         if (sname == "F0M0S0 pp") {
2389             func=PtBeautyF0M0S0PP;
2390         } else if (sname == "F1M0S0 pp") {
2391             func=PtBeautyF1M0S0PP;
2392         } else if (sname == "F2M0S0 pp") {
2393             func=PtBeautyF2M0S0PP;
2394         } else if (sname == "F0M1S0 pp") {
2395             func=PtBeautyF0M1S0PP;
2396         } else if (sname == "F0M2S0 pp") {
2397             func=PtBeautyF0M2S0PP;
2398         } else if (sname == "F0M0S1 pp") {
2399             func=PtBeautyF0M0S1PP;
2400         } else if (sname == "F0M0S2 pp") {
2401             func=PtBeautyF0M0S2PP;
2402         } else if (sname == "F0M0S3 pp") {
2403             func=PtBeautyF0M0S3PP;
2404         } else if (sname == "F0M0S4 pp") {
2405             func=PtBeautyF0M0S4PP;
2406         } else if (sname == "F0M0S5 pp") {
2407             func=PtBeautyF0M0S5PP;
2408         } else if (sname == "F0M0S6 pp") {
2409             func=PtBeautyF0M0S6PP;
2410         } else if (sname == "central") {
2411             func=PtBeautyCentral;
2412         } else {
2413             func=PtBeauty;
2414         }
2415         break;
2416     case kPion:
2417         if (sname == "2010 Pos PP") {
2418             func=PtPionPos2010PP;
2419         } else if (sname == "2010 Neg PP") {
2420             func=PtPionNeg2010PP;
2421         } else {
2422             func=PtPion;
2423         }
2424         break;
2425     case kKaon:
2426         if (sname == "2010 Pos PP") {
2427             func=PtKaonPos2010PP;
2428         } else if (sname == "2010 Neg PP") {
2429             func=PtKaonNeg2010PP;
2430         } else {
2431             func=PtKaon;
2432         }
2433         break;
2434     case kChic0:
2435         func=PtChic0;
2436         break;
2437     case kChic:
2438         func=PtChic;
2439         break;
2440     default:
2441         func=0;
2442         printf("<AliGenMUONlib::GetPt> unknown parametrisation\n");
2443     }
2444     return func;
2445 }
2446
2447 GenFunc AliGenMUONlib::GetY(Int_t param, const char* tname) const
2448 {
2449   //    
2450   // Return pointer to y- parameterisation
2451   //
2452     TString sname = TString(tname);
2453     GenFunc func;
2454     switch (param) 
2455     {
2456     case kPhi:
2457         func=YPhi;
2458         break;
2459     case kEta:
2460         func=YEta;
2461         break;
2462     case kOmega:
2463         func=YOmega;
2464         break;
2465     case kJpsiFamily:
2466     case kPsiP:
2467     case kChic1:
2468     case kChic2:
2469     case kJpsi:
2470         if (sname == "Vogt" || sname == "Vogt PbPb") {
2471             func=YJpsiPbPb;
2472         } else if (sname == "Vogt pp"){
2473             func=YJpsiPP;
2474         } else if (sname == "pp 7") {
2475             func=YJpsiPP7000;
2476         } else if (sname == "pp 2.76") {
2477             func=YJpsiPP2760;
2478         } else if (sname == "PbPb 2.76") {
2479             func=YJpsiPbPb2760;
2480         } else if (sname == "CDF scaled") {
2481             func=YJpsiCDFscaled;
2482         } else if (sname == "CDF pp") {
2483             func=YJpsiCDFscaledPP;
2484         } else if (sname == "CDF pp 10") {
2485             func=YJpsiCDFscaledPP10;
2486         } else if (sname == "CDF pp 8.8") {
2487             func=YJpsiCDFscaledPP9;
2488         } else if (sname == "CDF pp 7" || sname == "CDF pp 7 flat pt") {
2489             func=YJpsiCDFscaledPP7;
2490         } else if (sname == "CDF pp 3.94") {
2491             func=YJpsiCDFscaledPP4;
2492         } else if (sname == "CDF pp 2.76") {
2493             func=YJpsiCDFscaledPP3;
2494         } else if (sname == "CDF pp 1.9") {
2495             func=YJpsiCDFscaledPP2;
2496         } else if (sname == "CDF pPb 8.8") {
2497             func=YJpsiCDFscaledPPb9;
2498         } else if (sname == "CDF Pbp 8.8") {
2499             func=YJpsiCDFscaledPbP9;
2500         } else if (sname == "CDF PbPb 3.94") {
2501             func=YJpsiCDFscaledPbPb4;
2502         } else if (sname == "Flat" || sname == "CDF pp 7 flat y") {
2503             func=YJpsiFlat;
2504         } else {
2505             func=YJpsi;
2506         }
2507         break;
2508     case kJpsiFromB:
2509         func = YJpsiBPbPb;
2510         break;
2511     case kUpsilonFamily:
2512     case kUpsilonP:
2513     case kUpsilonPP:
2514     case kUpsilon:
2515         if (sname == "Vogt" || sname == "Vogt PbPb") {
2516             func=YUpsilonPbPb;
2517         } else if (sname == "Vogt pp") {
2518             func = YUpsilonPP;
2519         } else if (sname == "CDF scaled") {
2520             func=YUpsilonCDFscaled;
2521         } else if (sname == "CDF pp") {
2522             func=YUpsilonCDFscaledPP;
2523         } else if (sname == "CDF pp 10") {
2524             func=YUpsilonCDFscaledPP10;
2525         } else if (sname == "CDF pp 8.8") {
2526             func=YUpsilonCDFscaledPP9;
2527         } else if (sname == "CDF pp 7") {
2528             func=YUpsilonCDFscaledPP7;
2529         } else if (sname == "CDF pp 3.94") {
2530             func=YUpsilonCDFscaledPP4;
2531         } else if (sname == "CDF pPb 8.8") {
2532             func=YUpsilonCDFscaledPPb9;
2533         } else if (sname == "CDF Pbp 8.8") {
2534             func=YUpsilonCDFscaledPbP9;
2535         } else if (sname == "CDF PbPb 3.94") {
2536             func=YUpsilonCDFscaledPbPb4;
2537         } else if (sname == "Flat") {
2538             func=YUpsilonFlat;
2539         } else {
2540             func=YUpsilon;
2541         }
2542         break;
2543     case kCharm:
2544         if (sname == "F0M0S0 pp") {
2545             func=YCharmF0M0S0PP;
2546         } else if (sname == "F1M0S0 pp") {
2547             func=YCharmF1M0S0PP;
2548         } else if (sname == "F2M0S0 pp") {
2549             func=YCharmF2M0S0PP;
2550         } else if (sname == "F0M1S0 pp") {
2551             func=YCharmF0M1S0PP;
2552         } else if (sname == "F0M2S0 pp") {
2553             func=YCharmF0M2S0PP;
2554         } else if (sname == "F0M0S1 pp") {
2555             func=YCharmF0M0S1PP;
2556         } else if (sname == "F0M0S2 pp") {
2557             func=YCharmF0M0S2PP;
2558         } else if (sname == "F0M0S3 pp") {
2559             func=YCharmF0M0S3PP;
2560         } else if (sname == "F0M0S4 pp") {
2561             func=YCharmF0M0S4PP;
2562         } else if (sname == "F0M0S5 pp") {
2563             func=YCharmF0M0S5PP;
2564         } else if (sname == "F0M0S6 pp") {
2565             func=YCharmF0M0S6PP;
2566         } else {
2567             func=YCharm;
2568         }
2569         break;
2570     case kBeauty:
2571         if (sname == "F0M0S0 pp") {
2572             func=YBeautyF0M0S0PP;
2573         } else if (sname == "F1M0S0 pp") {
2574             func=YBeautyF1M0S0PP;
2575         } else if (sname == "F2M0S0 pp") {
2576             func=YBeautyF2M0S0PP;
2577         } else if (sname == "F0M1S0 pp") {
2578             func=YBeautyF0M1S0PP;
2579         } else if (sname == "F0M2S0 pp") {
2580             func=YBeautyF0M2S0PP;
2581         } else if (sname == "F0M0S1 pp") {
2582             func=YBeautyF0M0S1PP;
2583         } else if (sname == "F0M0S2 pp") {
2584             func=YBeautyF0M0S2PP;
2585         } else if (sname == "F0M0S3 pp") {
2586             func=YBeautyF0M0S3PP;
2587         } else if (sname == "F0M0S4 pp") {
2588             func=YBeautyF0M0S4PP;
2589         } else if (sname == "F0M0S5 pp") {
2590             func=YBeautyF0M0S5PP;
2591         } else if (sname == "F0M0S6 pp") {
2592             func=YBeautyF0M0S6PP;
2593         } else {
2594             func=YBeauty;
2595         }
2596         break;
2597     case kPion:
2598         if (sname == "2010 Pos PP") {
2599             func=YKaonPion2010PP;
2600         } else if (sname == "2010 Neg PP") {
2601             func=YKaonPion2010PP;
2602         } else {
2603             func=YPion;
2604         }
2605         break;
2606     case kKaon:
2607         if (sname == "2010 Pos PP") {
2608             func=YKaonPion2010PP;
2609         } else if (sname == "2010 Neg PP") {
2610             func=YKaonPion2010PP;
2611         } else {
2612             func=YKaon;
2613         }
2614         break;
2615     case kChic0:
2616         func=YChic0;
2617         break;
2618     case kChic:
2619         func=YChic;
2620         break;
2621     default:
2622         func=0;
2623         printf("<AliGenMUONlib::GetY> unknown parametrisation\n");
2624     }
2625     return func;
2626 }
2627
2628 //
2629 //                    Chi
2630 //
2631 //
2632 //                pt-distribution
2633 //____________________________________________________________
2634 Double_t AliGenMUONlib::PtChic0( const Double_t *px, const Double_t */*dummy*/)
2635 {
2636 // Chi_c1 pT
2637   const Double_t kpt0 = 4.;
2638   const Double_t kxn  = 3.6;
2639   Double_t x=*px;
2640   //
2641   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2642   return x/TMath::Power(pass1,kxn);
2643 }
2644 Double_t AliGenMUONlib::PtChic1( const Double_t *px, const Double_t */*dummy*/)
2645 {
2646 // Chi_c1 pT
2647   const Double_t kpt0 = 4.;
2648   const Double_t kxn  = 3.6;
2649   Double_t x=*px;
2650   //
2651   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2652   return x/TMath::Power(pass1,kxn);
2653 }
2654 Double_t AliGenMUONlib::PtChic2( const Double_t *px, const Double_t */*dummy*/)
2655 {
2656 // Chi_c2 pT
2657   const Double_t kpt0 = 4.;
2658   const Double_t kxn  = 3.6;
2659   Double_t x=*px;
2660   //
2661   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2662   return x/TMath::Power(pass1,kxn);
2663 }
2664 Double_t AliGenMUONlib::PtChic( const Double_t *px, const Double_t */*dummy*/)
2665 {
2666 // Chi_c family pT
2667   const Double_t kpt0 = 4.;
2668   const Double_t kxn  = 3.6;
2669   Double_t x=*px;
2670   //
2671   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2672   return x/TMath::Power(pass1,kxn);
2673 }
2674
2675 //
2676 //               y-distribution
2677 //____________________________________________________________
2678 Double_t AliGenMUONlib::YChic0(const Double_t *py, const Double_t */*dummy*/)
2679 {
2680 // Chi-1c y
2681   const Double_t ky0 = 4.;
2682  const Double_t kb=1.;
2683   Double_t yj;
2684   Double_t y=TMath::Abs(*py);
2685   //
2686   if (y < ky0)
2687     yj=kb;
2688   else
2689     yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
2690   return yj;
2691 }
2692
2693 Double_t AliGenMUONlib::YChic1(const Double_t *py, const Double_t */*dummy*/)
2694 {
2695 // Chi-1c y
2696   const Double_t ky0 = 4.;
2697   const Double_t kb=1.;
2698   Double_t yj;
2699   Double_t y=TMath::Abs(*py);
2700   //
2701   if (y < ky0)
2702     yj=kb;
2703   else
2704     yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
2705   return yj;
2706 }
2707
2708 Double_t AliGenMUONlib::YChic2(const Double_t *py, const Double_t */*dummy*/)
2709 {
2710 // Chi-2c y
2711   const Double_t ky0 = 4.;
2712   const Double_t kb=1.;
2713   Double_t yj;
2714   Double_t y=TMath::Abs(*py);
2715   //
2716   if (y < ky0)
2717     yj=kb;
2718   else
2719     yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
2720   return yj;
2721 }
2722
2723 Double_t AliGenMUONlib::YChic(const Double_t *py, const Double_t */*dummy*/)
2724 {
2725 // Chi_c family y
2726   const Double_t ky0 = 4.;
2727   const Double_t kb=1.;
2728   Double_t yj;
2729   Double_t y=TMath::Abs(*py);
2730   //
2731   if (y < ky0)
2732     yj=kb;
2733   else
2734     yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
2735   return yj;
2736 }
2737
2738 //                 particle composition
2739 //
2740 Int_t AliGenMUONlib::IpChic0(TRandom *)
2741 {
2742 // Chi composition
2743     return 10441;
2744 }
2745 //
2746 Int_t AliGenMUONlib::IpChic1(TRandom *)
2747 {
2748 // Chi composition
2749     return 20443;
2750 }
2751 Int_t AliGenMUONlib::IpChic2(TRandom *)
2752 {
2753 // Chi_c2 prime composition
2754     return 445;
2755 }
2756 Int_t AliGenMUONlib::IpChic(TRandom *)
2757 {
2758 // Chi composition
2759   Int_t ip;
2760   Float_t r = gRandom->Rndm();
2761   if (r < 0.001) {
2762     ip = 10441;
2763   } else if( r < 0.377 ) {
2764     ip = 20443;
2765   } else {
2766     ip = 445;
2767   }
2768   return ip;
2769 }
2770
2771
2772 //_____________________________________________________________
2773
2774 typedef Int_t (*GenFuncIp) (TRandom *);
2775 GenFuncIp AliGenMUONlib::GetIp(Int_t param,  const char* tname) const
2776 {
2777 // Return pointer to particle type parameterisation
2778     TString sname = TString(tname);
2779     GenFuncIp func;
2780     switch (param) 
2781     {
2782     case kPhi:
2783         func=IpPhi;
2784         break;
2785     case kEta:
2786         func=IpEta;
2787         break;
2788     case kOmega:
2789         func=IpOmega;
2790         break;
2791     case kJpsiFamily:
2792         func=IpJpsiFamily;
2793         break;
2794     case kPsiP:
2795         func=IpPsiP;
2796         break;
2797     case kJpsi:
2798     case kJpsiFromB:
2799         func=IpJpsi;
2800         break;
2801     case kUpsilon:
2802         func=IpUpsilon;
2803         break;
2804     case kUpsilonFamily:
2805       func=IpUpsilonFamily;
2806       break;
2807     case kUpsilonP:
2808         func=IpUpsilonP;
2809         break;
2810     case kUpsilonPP:
2811         func=IpUpsilonPP;
2812         break;
2813     case kCharm:
2814         func=IpCharm;
2815         break;
2816     case kBeauty:
2817         func=IpBeauty;
2818         break;
2819     case kPion:
2820         if (sname == "2010 Pos PP") {
2821             func=IpPionPos;
2822         } else if (sname == "2010 Neg PP") {
2823             func=IpPionNeg;
2824         } else {
2825             func=IpPion;
2826         }
2827         break;
2828     case kKaon:
2829         if (sname == "2010 Pos PP") {
2830             func=IpKaonPos;
2831         } else if (sname == "2010 Neg PP") {
2832             func=IpKaonNeg;
2833         } else {
2834             func=IpKaon;
2835         }
2836         break;
2837     case kChic0:
2838         func=IpChic0;
2839         break;
2840     case kChic1:
2841         func=IpChic1;
2842         break;
2843     case kChic2:
2844         func=IpChic2;
2845         break;
2846     case kChic:
2847         func=IpChic;
2848         break;
2849     default:
2850         func=0;
2851         printf("<AliGenMUONlib::GetIp> unknown parametrisation\n");
2852     }
2853     return func;
2854 }
2855
2856
2857
2858 Float_t AliGenMUONlib::Interpolate(Float_t x, Float_t* y, Float_t x0, 
2859                                    Float_t dx,
2860                                    Int_t n, Int_t no)
2861 {
2862 //
2863 // Neville's alorithm for interpolation
2864 //
2865 // x:  x-value
2866 // y:  Input array
2867 // x0: minimum x 
2868 // dx: step size
2869 //  n: number of data points
2870 // no: order of polynom 
2871 //
2872     Float_t*  c = new Float_t[n];
2873     Float_t*  d = new Float_t[n];
2874     Int_t m, i;
2875     for (i = 0; i < n; i++) {
2876         c[i] = y[i];
2877         d[i] = y[i];
2878     }
2879     
2880     Int_t   ns  = int((x - x0)/dx);
2881     
2882     Float_t y1  = y[ns];
2883     ns--;    
2884     for (m = 0; m < no; m++) {
2885         for (i = 0; i < n-m; i++) {     
2886             Float_t ho = x0 + Float_t(i) * dx - x;
2887             Float_t hp = x0 + Float_t(i+m+1) * dx - x;
2888             Float_t w  = c[i+1] - d[i];
2889             Float_t den = ho-hp;
2890             den = w/den;
2891             d[i] = hp * den;
2892             c[i] = ho * den;
2893         }
2894         Float_t dy;
2895         
2896         if (2*ns < (n-m-1)) {
2897             dy  = c[ns+1];
2898         } else {
2899             dy  = d[ns--];
2900         }
2901         y1 += dy;}
2902     delete[] c;
2903     delete[] d;
2904
2905     return y1;
2906 }
2907
2908 //=============================================================================
2909 Double_t AliGenMUONlib::PtPionPos2010PP(const Double_t *px, const Double_t* /*dummy*/)
2910 {
2911 // Pos pion
2912   const Double_t par[3] = {2.27501, 0.116141, 5.59591};
2913   Double_t pt = px[0];
2914   Double_t m0 = TDatabasePDG::Instance()->GetParticle(211)->Mass();
2915   Double_t mt = TMath::Sqrt(m0*m0 + pt*pt);
2916   Double_t nc = par[1]*par[2];
2917   Double_t t1 = (par[2]-1.)/nc/(nc/(par[2]-2.)+m0);
2918   Double_t t2 = TMath::Power(1.+(mt-m0)/nc, -1.*par[2]);
2919   Double_t fn = par[0] * pt * t1 * t2;
2920   return fn;
2921 }
2922
2923 //=============================================================================
2924 Double_t AliGenMUONlib::PtPionNeg2010PP(const Double_t *px, const Double_t* /*dummy*/)
2925 {
2926 // Neg pion
2927   const Double_t par[3] = {2.25188, 0.12176, 5.91166};
2928   Double_t pt = px[0];
2929   Double_t m0 = TDatabasePDG::Instance()->GetParticle(211)->Mass();
2930   Double_t mt = TMath::Sqrt(m0*m0 + pt*pt);
2931   Double_t nc = par[1]*par[2];
2932   Double_t t1 = (par[2]-1.)/nc/(nc/(par[2]-2.)+m0);
2933   Double_t t2 = TMath::Power(1.+(mt-m0)/nc, -1.*par[2]);
2934   Double_t fn = par[0] * pt * t1 * t2;
2935   return fn;
2936 }
2937
2938 //=============================================================================
2939 Double_t AliGenMUONlib::PtKaonPos2010PP(const Double_t *px, const Double_t* /*dummy*/)
2940 {
2941 // Pos kaons
2942   const Double_t par[3] = {0.279386, 0.195466, 6.59587};
2943   Double_t pt = px[0];
2944   Double_t m0 = TDatabasePDG::Instance()->GetParticle(321)->Mass();
2945   Double_t mt = TMath::Sqrt(m0*m0 + pt*pt);
2946   Double_t nc = par[1]*par[2];
2947   Double_t t1 = (par[2]-1.)/nc/(nc/(par[2]-2.)+m0);
2948   Double_t t2 = TMath::Power(1.+(mt-m0)/nc, -1.*par[2]);
2949   Double_t fn = par[0] * pt * t1 * t2;
2950   return fn;
2951 }
2952
2953 //=============================================================================
2954 Double_t AliGenMUONlib::PtKaonNeg2010PP(const Double_t *px, const Double_t* /*dummy*/)
2955 {
2956 // Neg kaons
2957   const Double_t par[3] = {0.278927, 0.189049, 6.43006};
2958   Double_t pt = px[0];
2959   Double_t m0 = TDatabasePDG::Instance()->GetParticle(321)->Mass();
2960   Double_t mt = TMath::Sqrt(m0*m0 + pt*pt);
2961   Double_t nc = par[1]*par[2];
2962   Double_t t1 = (par[2]-1.)/nc/(nc/(par[2]-2.)+m0);
2963   Double_t t2 = TMath::Power(1.+(mt-m0)/nc, -1.*par[2]);
2964   Double_t fn = par[0] * pt * t1 * t2;
2965   return fn;
2966 }
2967
2968 //=============================================================================
2969 Double_t AliGenMUONlib::YKaonPion2010PP(const Double_t *px, const Double_t* /*dummy*/)
2970 {
2971 // pions and kaons
2972   Double_t y = px[0];
2973   Double_t sigma = 2.35;
2974   Double_t kernal = y/2./sigma;
2975   Double_t fxn = TMath::Exp(-1.*kernal*kernal);
2976   return fxn;
2977 }
2978
2979 //=============================================================================
2980 Int_t AliGenMUONlib::IpPionPos(TRandom *)
2981 {
2982 // Pos pions
2983     return 211;
2984 }
2985
2986 //=============================================================================
2987 Int_t AliGenMUONlib::IpPionNeg(TRandom *)
2988 {
2989 // Neg pions
2990     return -211;
2991 }
2992
2993 //=============================================================================
2994 Int_t AliGenMUONlib::IpKaonPos(TRandom *)
2995 {
2996 // pos Kaons
2997     return 321;
2998 }
2999
3000 //=============================================================================
3001 Int_t AliGenMUONlib::IpKaonNeg(TRandom *)
3002 {
3003 // neg Kaons 
3004     return -321;
3005 }