]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVGEN/AliGenMUONlib.cxx
Coverity fix
[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::PtJpsiPPdummy(Double_t x, Double_t energy)
156 {
157 // J/Psi pT
158 // pp
159 // from the fit of RHIC, CDF & LHC data, see arXiv:1103.2394
160 //
161   const Double_t kpt0 = 1.04*TMath::Power(energy,0.101);
162   const Double_t kxn  = 3.9;
163   //
164   Double_t pass1 = 1.+0.363*(x/kpt0)*(x/kpt0);
165   return x/TMath::Power(pass1,kxn);
166 }
167
168 Double_t AliGenMUONlib::PtJpsiPP7000(const Double_t *px, const Double_t */*dummy*/)
169 {
170 // J/Psi pT
171 // pp 7 TeV
172 //
173   return PtJpsiPPdummy(*px,7000);
174 }
175
176 Double_t AliGenMUONlib::PtJpsiPP2760(const Double_t *px, const Double_t */*dummy*/)
177 {
178 // J/Psi pT
179 // pp 2.76 TeV
180 //
181   return PtJpsiPPdummy(*px,2760);
182 }
183
184 Double_t AliGenMUONlib::PtJpsiPP8800(const Double_t *px, const Double_t */*dummy*/)
185 {
186 // J/Psi pT
187 // pp 8.8 TeV
188 //
189   return PtJpsiPPdummy(*px,8800);
190 }
191
192 Double_t AliGenMUONlib::PtJpsiPbPb2760ShFdummy(Double_t x, Int_t n)
193 {
194 // J/Psi shadowing factor vs pT for PbPb min. bias and 11 centr. bins (in 2.5<y<4)
195 //
196 // PbPb 2.76 TeV, for EKS98, minimum bias shadowing factor = 0.66 in 4pi
197 // S.Grigoryan, details presented at the PWG3-Muon meeting (05.10.2011)
198 // https://indico.cern.ch/conferenceDisplay.py?confId=157367
199 //
200   const Double_t f1[12] = {1, 1.128, 1.097, 1.037, 0.937, 0.821, 0.693, 0.558,
201                            0.428, 0.317, 0.231, 0.156};
202   const Double_t f2[12] = {1, 1.313, 1.202, 1.039, 0.814, 0.593, 0.391, 0.224,
203                            0.106, 0.041, 0.013, 0.002};
204   const Double_t c1[7] = {1.6077e+00, 7.6300e-02,-7.1880e-03, 3.4067e-04,
205                           -9.2776e-06,1.5138e-07, 1.4652e-09}; 
206   const Double_t c2[7] = {6.2047e-01, 5.7653e-02,-4.1414e-03, 1.0301e-04, 
207                           9.6205e-07,-7.4098e-08, 5.0946e-09}; 
208   Double_t y1, y2;
209   Int_t j;
210   y1 = c1[j = 6]; y2 = c2[6];
211   while (j > 0) {y1 = y1 * x + c1[--j]; y2 = y2 * x + c2[j];}
212   
213   y1 /= 1.+c1[6]*TMath::Power(x,6);
214   y2 /= 1.+c2[6]*TMath::Power(x,6);
215   //  
216   y1 = 1 + (y1-2)*f1[n] + (y2+1-y1)*f2[n];
217   if(y1<0) y1=0;
218   return y1;
219 }
220
221 Double_t AliGenMUONlib::PtJpsiPbPb2760(const Double_t *px, const Double_t *dummy)
222 {
223 // J/Psi pT
224 // PbPb 2.76 TeV, minimum bias 0-100 %
225 //
226   return PtJpsiPbPb2760ShFdummy(*px, 0) * PtJpsiPP2760(px, dummy);
227 }
228
229 Double_t AliGenMUONlib::PtJpsiPbPb2760c1(const Double_t *px, const Double_t *dummy)
230 {
231 // J/Psi pT
232 // PbPb 2.76 TeV, 1st centrality bin 0-5 %
233 //
234   return PtJpsiPbPb2760ShFdummy(*px, 1) * PtJpsiPP2760(px, dummy);
235 }
236
237 Double_t AliGenMUONlib::PtJpsiPbPb2760c2(const Double_t *px, const Double_t *dummy)
238 {
239 // J/Psi pT
240 // PbPb 2.76 TeV, 2nd centrality bin 5-10 %
241 //
242   return PtJpsiPbPb2760ShFdummy(*px, 2) * PtJpsiPP2760(px, dummy);
243 }
244
245 Double_t AliGenMUONlib::PtJpsiPbPb2760c3(const Double_t *px, const Double_t *dummy)
246 {
247 // J/Psi pT
248 // PbPb 2.76 TeV, 3rd centrality bin 10-20 %
249 //
250   return PtJpsiPbPb2760ShFdummy(*px, 3) * PtJpsiPP2760(px, dummy);
251 }
252
253 Double_t AliGenMUONlib::PtJpsiPbPb2760c4(const Double_t *px, const Double_t *dummy)
254 {
255 // J/Psi pT
256 // PbPb 2.76 TeV, 4th centrality bin 20-30 %
257 //
258   return PtJpsiPbPb2760ShFdummy(*px, 4) * PtJpsiPP2760(px, dummy);
259 }
260
261 Double_t AliGenMUONlib::PtJpsiPbPb2760c5(const Double_t *px, const Double_t *dummy)
262 {
263 // J/Psi pT
264 // PbPb 2.76 TeV, 5th centrality bin 30-40 %
265 //
266   return PtJpsiPbPb2760ShFdummy(*px, 5) * PtJpsiPP2760(px, dummy);
267 }
268
269 Double_t AliGenMUONlib::PtJpsiPbPb2760c6(const Double_t *px, const Double_t *dummy)
270 {
271 // J/Psi pT
272 // PbPb 2.76 TeV, 6th centrality bin 40-50 %
273 //
274   return PtJpsiPbPb2760ShFdummy(*px, 6) * PtJpsiPP2760(px, dummy);
275 }
276
277 Double_t AliGenMUONlib::PtJpsiPbPb2760c7(const Double_t *px, const Double_t *dummy)
278 {
279 // J/Psi pT
280 // PbPb 2.76 TeV, 7th centrality bin 50-60 %
281 //
282   return PtJpsiPbPb2760ShFdummy(*px, 7) * PtJpsiPP2760(px, dummy);
283 }
284
285 Double_t AliGenMUONlib::PtJpsiPbPb2760c8(const Double_t *px, const Double_t *dummy)
286 {
287 // J/Psi pT
288 // PbPb 2.76 TeV, 8th centrality bin 60-70 %
289 //
290   return PtJpsiPbPb2760ShFdummy(*px, 8) * PtJpsiPP2760(px, dummy);
291 }
292
293 Double_t AliGenMUONlib::PtJpsiPbPb2760c9(const Double_t *px, const Double_t *dummy)
294 {
295 // J/Psi pT
296 // PbPb 2.76 TeV, 9th centrality bin 70-80 %
297 //
298   return PtJpsiPbPb2760ShFdummy(*px, 9) * PtJpsiPP2760(px, dummy);
299 }
300
301 Double_t AliGenMUONlib::PtJpsiPbPb2760c10(const Double_t *px, const Double_t *dummy)
302 {
303 // J/Psi pT
304 // PbPb 2.76 TeV, 10th centrality bin 80-90 %
305 //
306   return PtJpsiPbPb2760ShFdummy(*px, 10) * PtJpsiPP2760(px, dummy);
307 }
308
309 Double_t AliGenMUONlib::PtJpsiPbPb2760c11(const Double_t *px, const Double_t *dummy)
310 {
311 // J/Psi pT
312 // PbPb 2.76 TeV, 11th centrality bin 90-100 %
313 //
314   return PtJpsiPbPb2760ShFdummy(*px, 11) * PtJpsiPP2760(px, dummy);
315 }
316
317 Double_t AliGenMUONlib::PtJpsiPPb8800ShFdummy(Double_t x, Int_t n)
318 {
319 // J/Psi shadowing factor vs pT for pPb min. bias and 4 centr. bins (in 2.5<y<4)
320 //
321 // pPb 8.8 TeV, for EKS98, minimum bias shadowing factor = 0.78 in 4pi
322 //
323   const Double_t f[5] = {1, 1.33, 1.05, 0.67, 0.23};
324   const Double_t c[7] = {6.4922e-01, 6.4857e-03, 4.7268e-03,-9.5075e-04, 
325                          8.4075e-05,-4.2006e-06, 4.9970e-07};
326   Double_t y;
327   Int_t j;
328   y = c[j = 6];
329   while (j > 0) y  = y * x + c[--j];
330   y /= 1 + c[6]*TMath::Power(x,6);
331   //  
332   return 1 + (y-1)*f[n];
333 }
334
335 Double_t AliGenMUONlib::PtJpsiPPb8800(const Double_t *px, const Double_t *dummy)
336 {
337 // J/Psi pT
338 // pPb 8.8 TeV, minimum bias 0-100 %
339 //
340   return PtJpsiPPb8800ShFdummy(*px, 0) * PtJpsiPP8800(px, dummy);
341 }
342
343 Double_t AliGenMUONlib::PtJpsiPPb8800c1(const Double_t *px, const Double_t *dummy)
344 {
345 // J/Psi pT
346 // pPb 8.8 TeV, 1st centrality bin 0-20 %
347 //
348   return PtJpsiPPb8800ShFdummy(*px, 1) * PtJpsiPP8800(px, dummy);
349 }
350
351 Double_t AliGenMUONlib::PtJpsiPPb8800c2(const Double_t *px, const Double_t *dummy)
352 {
353 // J/Psi pT
354 // pPb 8.8 TeV, 2nd centrality bin 20-40 %
355 //
356   return PtJpsiPPb8800ShFdummy(*px, 2) * PtJpsiPP8800(px, dummy);
357 }
358
359 Double_t AliGenMUONlib::PtJpsiPPb8800c3(const Double_t *px, const Double_t *dummy)
360 {
361 // J/Psi pT
362 // pPb 8.8 TeV, 3rd centrality bin 40-60 %
363 //
364   return PtJpsiPPb8800ShFdummy(*px, 3) * PtJpsiPP8800(px, dummy);
365 }
366
367 Double_t AliGenMUONlib::PtJpsiPPb8800c4(const Double_t *px, const Double_t *dummy)
368 {
369 // J/Psi pT
370 // pPb 8.8 TeV, 4th centrality bin 60-100 %
371 //
372   return PtJpsiPPb8800ShFdummy(*px, 4) * PtJpsiPP8800(px, dummy);
373 }
374
375 Double_t AliGenMUONlib::PtJpsiPbP8800ShFdummy(Double_t x, Int_t n)
376 {
377 // J/Psi shadowing factor vs pT for Pbp min. bias and 4 centr. bins (in 2.5<y<4)
378 //
379 // Pbp 8.8 TeV, for EKS98, minimum bias shadowing factor = 0.78 in 4pi
380 //
381   const Double_t f[5] = {1, 1.33, 1.05, 0.67, 0.23};
382   const Double_t c[7] = {8.7562e-01, 2.1944e-02, 7.8509e-03,-1.3979e-03, 
383                          3.8513e-05, 4.2008e-06, 1.7088e-06};
384   Double_t y;
385   Int_t j;
386   y = c[j = 6];
387   while (j > 0) y  = y * x + c[--j];
388   y /= 1 + c[6]*TMath::Power(x,6);
389   //  
390   return 1 + (y-1)*f[n];
391 }
392
393 Double_t AliGenMUONlib::PtJpsiPbP8800(const Double_t *px, const Double_t *dummy)
394 {
395 // J/Psi pT
396 // Pbp 8.8 TeV, minimum bias 0-100 %
397 //
398   return PtJpsiPbP8800ShFdummy(*px, 0) * PtJpsiPP8800(px, dummy);
399 }
400
401 Double_t AliGenMUONlib::PtJpsiPbP8800c1(const Double_t *px, const Double_t *dummy)
402 {
403 // J/Psi pT
404 // Pbp 8.8 TeV, 1st centrality bin 0-20 %
405 //
406   return PtJpsiPbP8800ShFdummy(*px, 1) * PtJpsiPP8800(px, dummy);
407 }
408
409 Double_t AliGenMUONlib::PtJpsiPbP8800c2(const Double_t *px, const Double_t *dummy)
410 {
411 // J/Psi pT
412 // Pbp 8.8 TeV, 2nd centrality bin 20-40 %
413 //
414   return PtJpsiPbP8800ShFdummy(*px, 2) * PtJpsiPP8800(px, dummy);
415 }
416
417 Double_t AliGenMUONlib::PtJpsiPbP8800c3(const Double_t *px, const Double_t *dummy)
418 {
419 // J/Psi pT
420 // Pbp 8.8 TeV, 3rd centrality bin 40-60 %
421 //
422   return PtJpsiPbP8800ShFdummy(*px, 3) * PtJpsiPP8800(px, dummy);
423 }
424
425 Double_t AliGenMUONlib::PtJpsiPbP8800c4(const Double_t *px, const Double_t *dummy)
426 {
427 // J/Psi pT
428 // Pbp 8.8 TeV, 4th centrality bin 60-100 %
429 //
430   return PtJpsiPbP8800ShFdummy(*px, 4) * PtJpsiPP8800(px, dummy);
431 }
432
433 Double_t AliGenMUONlib::PtJpsi( const Double_t *px, const Double_t */*dummy*/)
434 {
435 // J/Psi pT
436   const Double_t kpt0 = 4.;
437   const Double_t kxn  = 3.6;
438   Double_t x=*px;
439   //
440   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
441   return x/TMath::Power(pass1,kxn);
442 }
443
444 Double_t AliGenMUONlib::PtJpsiCDFscaled( const Double_t *px, const Double_t */*dummy*/)
445 {
446 // J/Psi pT
447 //
448 // PbPb 5.5 TeV
449 // scaled from CDF data at 2 TeV
450 // see S.Grigoryan, PWG3 Meeting, 27th Oct 2008
451
452   const Double_t kpt0 = 5.100;
453   const Double_t kxn  = 4.102;
454   Double_t x=*px;
455   //
456   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
457   return x/TMath::Power(pass1,kxn);
458 }
459
460 Double_t AliGenMUONlib::PtJpsiCDFscaledPP( const Double_t *px, const Double_t */*dummy*/)
461 {
462 // J/Psi pT
463 //
464 // pp 14 TeV
465 // scaled from CDF data at 2 TeV
466
467   const Double_t kpt0 = 5.630;
468   const Double_t kxn  = 4.071;
469   Double_t x=*px;
470   //
471   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
472   return x/TMath::Power(pass1,kxn);
473 }
474
475 Double_t AliGenMUONlib::PtJpsiCDFscaledPP10( const Double_t *px, const Double_t */*dummy*/)
476 {
477 // J/Psi pT
478 //
479 // pp 10 TeV
480 // scaled from CDF data at 2 TeV
481
482   const Double_t kpt0 = 5.334;
483   const Double_t kxn  = 4.071;
484   Double_t x=*px;
485   //
486   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
487   return x/TMath::Power(pass1,kxn);
488 }
489
490 Double_t AliGenMUONlib::PtJpsiCDFscaledPP9( const Double_t *px, const Double_t */*dummy*/)
491 {
492 // J/Psi pT
493 //
494 // pp 8.8 TeV
495 // scaled from CDF data at 2 TeV
496 //
497   const Double_t kpt0 = 5.245;
498   const Double_t kxn  = 4.071;
499   Double_t x=*px;
500   //
501   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
502   return x/TMath::Power(pass1,kxn);
503 }
504
505 Double_t AliGenMUONlib::PtJpsiCDFscaledPP7( const Double_t *px, const Double_t */*dummy*/)
506 {
507 // J/Psi pT
508 //
509 // pp 7 TeV
510 // scaled from CDF data at 2 TeV
511
512   const Double_t kpt0 = 5.072;
513   const Double_t kxn  = 4.071;
514   Double_t x=*px;
515   //
516   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
517   return x/TMath::Power(pass1,kxn);
518 }
519
520 Double_t AliGenMUONlib::PtJpsiCDFscaledPP4( const Double_t *px, const Double_t */*dummy*/)
521 {
522 // J/Psi pT
523 //
524 // pp 3.94 TeV
525 // scaled from CDF data at 2 TeV
526 //
527   const Double_t kpt0 = 4.647;
528   const Double_t kxn  = 4.071;
529   Double_t x=*px;
530   //
531   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
532   return x/TMath::Power(pass1,kxn);
533 }
534
535 Double_t AliGenMUONlib::PtJpsiCDFscaledPP3( const Double_t *px, const Double_t */*dummy*/)
536 {
537 // J/Psi pT
538 //
539 // pp 2.76 TeV
540 // scaled from CDF data at 1.9 TeV
541 //
542   const Double_t kpt0 = 4.435;
543   const Double_t kxn  = 4.071;
544   Double_t x=*px;
545   //
546   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
547   return x/TMath::Power(pass1,kxn);
548 }
549
550 Double_t AliGenMUONlib::PtJpsiCDFscaledPP2( const Double_t *px, const Double_t */*dummy*/)
551 {
552 // J/Psi pT
553 //
554 // pp 1.96 TeV
555 // fit of the CDF data at 1.96 TeV
556 //
557   const Double_t kpt0 = 4.233;
558   const Double_t kxn  = 4.071;
559   Double_t x=*px;
560   //
561   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
562   return x/TMath::Power(pass1,kxn);
563 }
564
565 Double_t AliGenMUONlib::PtJpsiCDFscaledPPb9( const Double_t *px, const Double_t *dummy)
566 {
567 // J/Psi pT
568 //
569 // pPb 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.79
570 //
571   Double_t c[5] = {6.42774e-01, 1.86168e-02, -6.77296e-04, 8.93512e-06, 1.31586e-07};
572   Double_t x=*px;
573   Double_t y;
574   Int_t j;
575   y = c[j = 4];
576   while (j > 0) y  = y * x + c[--j];
577   //  
578   Double_t d = 1.+c[4]*TMath::Power(x,4);
579   return y/d * AliGenMUONlib::PtJpsiCDFscaledPP9(px,dummy);
580 }
581
582 Double_t AliGenMUONlib::PtJpsiCDFscaledPbP9( const Double_t *px, const Double_t *dummy)
583 {
584 // J/Psi pT
585 //
586 // Pbp 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.79
587 //
588   Double_t c[5] = {8.58557e-01, 5.39791e-02, -4.75180e-03, 2.49463e-04, 5.52396e-05};
589   Double_t x=*px;
590   Double_t y;
591   Int_t j;
592   y = c[j = 4];
593   while (j > 0) y  = y * x + c[--j];
594   //  
595   Double_t d = 1.+c[4]*TMath::Power(x,4);
596   return y/d * AliGenMUONlib::PtJpsiCDFscaledPP9(px,dummy);
597 }
598
599 Double_t AliGenMUONlib::PtJpsiCDFscaledPbPb4( const Double_t *px, const Double_t *dummy)
600 {
601 // J/Psi pT
602 //
603 // PbPb 3.94 TeV, for EKS98 with minimum bias shadowing factor 0.66
604 //
605   Double_t c[5] = {6.01022e-01, 4.70988e-02, -2.27917e-03, 3.09885e-05, 1.31955e-06};
606   Double_t x=*px;
607   Double_t y;
608   Int_t j;
609   y = c[j = 4];
610   while (j > 0) y  = y * x + c[--j];
611   //  
612   Double_t d = 1.+c[4]*TMath::Power(x,4);
613   return y/d * AliGenMUONlib::PtJpsiCDFscaledPP4(px,dummy);
614 }
615
616 Double_t AliGenMUONlib::PtJpsiFlat( const Double_t */*px*/, const Double_t */*dummy*/ )
617 {
618   return 1.;
619 }
620
621 Double_t AliGenMUONlib::PtJpsiPbPb( const Double_t *px, const Double_t */*dummy*/)
622 {
623 // J/Psi pT spectrum
624 //
625 // R. Vogt 2002
626 // PbPb 5.5 TeV
627 // MRST HO
628 // mc = 1.4 GeV, pt-kick 1 GeV
629 //
630     Float_t x = px[0];
631     Float_t c[8] = {
632         -2.13098e+00, 9.46552e+00, -5.06799e+00, 1.27260e+00, 
633         -1.83806e-01, 1.55853e-02, -7.23241e-04, 1.42105e-05
634     };
635     
636     Double_t y;
637     if (x < 10.) {
638         Int_t j;
639         y = c[j = 7];
640         while (j > 0) y  = y * x +c[--j];
641         y = x * TMath::Exp(y);
642     } else {
643         y = 0.;
644     }
645     return y;
646 }
647
648 Double_t AliGenMUONlib::PtJpsiBPbPb( const Double_t *px, const Double_t */*dummy*/)
649 {
650 // J/Psi pT spectrum
651 // B -> J/Psi X
652     Double_t x0 =   4.0384;
653     Double_t  n =   3.0288;
654     
655     Double_t x = px[0];
656     Double_t y = x / TMath::Power((1. + (x/x0)*(x/x0)), n);
657     
658     return y;
659 }
660
661
662 Double_t AliGenMUONlib::PtJpsiPP( const Double_t *px, const Double_t */*dummy*/)
663 {
664 // J/Psi pT spectrum
665 //
666 // R. Vogt 2002
667 // pp 14 TeV
668 // MRST HO
669 // mc = 1.4 GeV, pt-kick 1 GeV
670 //
671     Float_t x = px[0];
672     Float_t c[4] = {8.47471e+00, -1.93567e+00, 1.50271e-01, -5.51212e-03};
673  
674     Double_t y;
675     if (x < 10.) {
676         Int_t j;
677         y = c[j = 3];
678         while (j > 0) y  = y * x +c[--j];
679         y = x * TMath::Exp(y);
680     } else {
681         y = 0.;
682     }
683     return y;
684 }
685
686 //
687 //               y-distribution
688 //____________________________________________________________
689 Double_t AliGenMUONlib::YJpsiPPdummy(Double_t x, Double_t energy)
690 {
691 // J/Psi y
692 // pp
693 // from the fit of RHIC + LHC data, see arXiv:1103.2394
694 //
695     x = x/TMath::Log(energy/3.097);
696     x = x*x;
697     Double_t y = TMath::Exp(-x/0.4/0.4/2);
698     if(x > 1) y=0;
699     return y;
700 }
701
702 Double_t AliGenMUONlib::YJpsiPPpoly(Double_t x, Double_t energy)
703 {
704 // J/Psi y
705 // pp
706 // from the fit of RHIC + LHC data, see arXiv:1103.2394
707 //
708     x = x/TMath::Log(energy/3.097);
709     x = x*x;
710     Double_t y = 1 - 6.9*x*x;
711     if(y < 0) y=0;
712     return y;
713 }
714
715 Double_t AliGenMUONlib::YJpsiPP7000(const Double_t *px, const Double_t */*dummy*/)
716 {
717 // J/Psi y
718 // pp 7 TeV
719 //
720   return YJpsiPPdummy(*px, 7000);
721 }
722
723 Double_t AliGenMUONlib::YJpsiPP2760(const Double_t *px, const Double_t */*dummy*/)
724 {
725 // J/Psi y
726 // pp 2.76 TeV
727 //
728   return YJpsiPPdummy(*px, 2760);
729 }
730
731 Double_t AliGenMUONlib::YJpsiPP8800(const Double_t *px, const Double_t */*dummy*/)
732 {
733 // J/Psi y
734 // pp 8.8 TeV
735 //
736   return YJpsiPPdummy(*px, 8800);
737 }
738
739 Double_t AliGenMUONlib::YJpsiPPpoly7000(const Double_t *px, const Double_t */*dummy*/)
740 {
741 // J/Psi y
742 // pp 7 TeV
743 //
744   return YJpsiPPpoly(*px, 7000);
745 }
746
747 Double_t AliGenMUONlib::YJpsiPPpoly2760(const Double_t *px, const Double_t */*dummy*/)
748 {
749 // J/Psi y
750 // pp 2.76 TeV
751 //
752   return YJpsiPPpoly(*px, 2760);
753 }
754
755 Double_t AliGenMUONlib::YJpsiPbPb2760ShFdummy(Double_t x, Int_t n)
756 {
757 // J/Psi shadowing factor vs y for PbPb min. bias and 11 centr. bins
758 //
759 // PbPb 2.76 TeV, for EKS98, minimum bias shadowing factor = 0.66 in 4pi
760 //
761   const Double_t f1[12] = {1, 1.128, 1.097, 1.037, 0.937, 0.821, 0.693, 0.558,
762                            0.428, 0.317, 0.231, 0.156};
763   const Double_t f2[12] = {1, 1.313, 1.202, 1.039, 0.814, 0.593, 0.391, 0.224,
764                            0.106, 0.041, 0.013, 0.002};
765   const Double_t c1[5] = {1.5591e+00, 7.5827e-03, 2.0676e-03,-1.1717e-04, 1.5237e-06}; 
766   const Double_t c2[5] = {6.0861e-01, 4.8854e-03, 1.3685e-03,-7.9182e-05, 1.0475e-06}; 
767
768   x = x*x;
769   Double_t y1, y2;
770   Int_t j;
771   y1 = c1[j = 4]; y2 = c2[4];
772   while (j > 0) {y1 = y1 * x + c1[--j]; y2 = y2 * x + c2[j];}
773   
774   y1 = 1 + (y1-2)*f1[n] + (y2+1-y1)*f2[n];
775   if(y1<0) y1=0;
776   return y1;
777 }
778
779 Double_t AliGenMUONlib::YJpsiPbPb2760(const Double_t *px, const Double_t *dummy)
780 {
781 // J/Psi y
782 // PbPb 2.76 TeV, minimum bias 0-100 %
783 //
784   return YJpsiPbPb2760ShFdummy(*px, 0) * YJpsiPP2760(px, dummy);
785 }
786
787 Double_t AliGenMUONlib::YJpsiPbPb2760c1(const Double_t *px, const Double_t *dummy)
788 {
789 // J/Psi y
790 // PbPb 2.76 TeV, 1st centrality bin 0-5 %
791 //
792   return YJpsiPbPb2760ShFdummy(*px, 1) * YJpsiPP2760(px, dummy);
793 }
794
795 Double_t AliGenMUONlib::YJpsiPbPb2760c2(const Double_t *px, const Double_t *dummy)
796 {
797 // J/Psi y
798 // PbPb 2.76 TeV, 2nd centrality bin 5-10 %
799 //
800   return YJpsiPbPb2760ShFdummy(*px, 2) * YJpsiPP2760(px, dummy);
801 }
802
803 Double_t AliGenMUONlib::YJpsiPbPb2760c3(const Double_t *px, const Double_t *dummy)
804 {
805 // J/Psi y
806 // PbPb 2.76 TeV, 3rd centrality bin 10-20 %
807 //
808   return YJpsiPbPb2760ShFdummy(*px, 3) * YJpsiPP2760(px, dummy);
809 }
810
811 Double_t AliGenMUONlib::YJpsiPbPb2760c4(const Double_t *px, const Double_t *dummy)
812 {
813 // J/Psi y
814 // PbPb 2.76 TeV, 4th centrality bin 20-30 %
815 //
816   return YJpsiPbPb2760ShFdummy(*px, 4) * YJpsiPP2760(px, dummy);
817 }
818
819 Double_t AliGenMUONlib::YJpsiPbPb2760c5(const Double_t *px, const Double_t *dummy)
820 {
821 // J/Psi y
822 // PbPb 2.76 TeV, 5th centrality bin 30-40 %
823 //
824   return YJpsiPbPb2760ShFdummy(*px, 5) * YJpsiPP2760(px, dummy);
825 }
826
827 Double_t AliGenMUONlib::YJpsiPbPb2760c6(const Double_t *px, const Double_t *dummy)
828 {
829 // J/Psi y
830 // PbPb 2.76 TeV, 6th centrality bin 40-50 %
831 //
832   return YJpsiPbPb2760ShFdummy(*px, 6) * YJpsiPP2760(px, dummy);
833 }
834
835 Double_t AliGenMUONlib::YJpsiPbPb2760c7(const Double_t *px, const Double_t *dummy)
836 {
837 // J/Psi y
838 // PbPb 2.76 TeV, 7th centrality bin 50-60 %
839 //
840   return YJpsiPbPb2760ShFdummy(*px, 7) * YJpsiPP2760(px, dummy);
841 }
842
843 Double_t AliGenMUONlib::YJpsiPbPb2760c8(const Double_t *px, const Double_t *dummy)
844 {
845 // J/Psi y
846 // PbPb 2.76 TeV, 8th centrality bin 60-70 %
847 //
848   return YJpsiPbPb2760ShFdummy(*px, 8) * YJpsiPP2760(px, dummy);
849 }
850
851 Double_t AliGenMUONlib::YJpsiPbPb2760c9(const Double_t *px, const Double_t *dummy)
852 {
853 // J/Psi y
854 // PbPb 2.76 TeV, 9th centrality bin 70-80 %
855 //
856   return YJpsiPbPb2760ShFdummy(*px, 9) * YJpsiPP2760(px, dummy);
857 }
858
859 Double_t AliGenMUONlib::YJpsiPbPb2760c10(const Double_t *px, const Double_t *dummy)
860 {
861 // J/Psi y
862 // PbPb 2.76 TeV, 10th centrality bin 80-90 %
863 //
864   return YJpsiPbPb2760ShFdummy(*px, 10) * YJpsiPP2760(px, dummy);
865 }
866
867 Double_t AliGenMUONlib::YJpsiPbPb2760c11(const Double_t *px, const Double_t *dummy)
868 {
869 // J/Psi y
870 // PbPb 2.76 TeV, 11th centrality bin 90-100 %
871 //
872   return YJpsiPbPb2760ShFdummy(*px, 11) * YJpsiPP2760(px, dummy);
873 }
874
875 Double_t AliGenMUONlib::YJpsiPP8800dummy(Double_t px)
876 {
877     return AliGenMUONlib::YJpsiPP8800(&px, (Double_t*) 0);
878 }
879
880 Double_t AliGenMUONlib::YJpsiPPb8800ShFdummy(Double_t x, Int_t n)
881 {
882 // J/Psi shadowing factor vs y for pPb min. bias and 4 centr. bins
883 //
884 // pPb 8.8 TeV, for EKS98, minimum bias shadowing factor = 0.78 in 4pi
885 //
886     const Double_t f[5] = {1, 1.33, 1.05, 0.67, 0.23};
887     const Double_t c[7] = {7.4372e-01, 2.3299e-02, 2.8678e-03, 1.9595e-03, 
888                            3.2849e-04,-4.0547e-05,-7.9732e-06}; 
889     Double_t y;
890     Int_t j;
891     y = c[j = 6];
892     while (j > 0) y = y * x + c[--j];
893     if(y<0) y=0;
894     //
895     return 1 +(y-1)*f[n];
896 }
897
898 Double_t AliGenMUONlib::YJpsiPPb8800(const Double_t *px, const Double_t */*dummy*/)
899 {
900 // J/Psi y
901 // pPb 8.8 TeV, minimum bias 0-100 %
902 //
903   Double_t x = px[0] + 0.47;              // rapidity shift
904   return YJpsiPPb8800ShFdummy(x, 0) * YJpsiPP8800dummy(x);
905 }
906
907 Double_t AliGenMUONlib::YJpsiPPb8800c1(const Double_t *px, const Double_t */*dummy*/)
908 {
909 // J/Psi y
910 // pPb 8.8 TeV, 1st centrality bin 0-20 %
911 //
912   Double_t x = px[0] + 0.47;              // rapidity shift
913   return YJpsiPPb8800ShFdummy(x, 1) * YJpsiPP8800dummy(x);
914 }
915
916 Double_t AliGenMUONlib::YJpsiPPb8800c2(const Double_t *px, const Double_t */*dummy*/)
917 {
918 // J/Psi y
919 // pPb 8.8 TeV, 2nd centrality bin 20-40 %
920 //
921   Double_t x = px[0] + 0.47;              // rapidity shift
922   return YJpsiPPb8800ShFdummy(x, 2) * YJpsiPP8800dummy(x);
923 }
924
925 Double_t AliGenMUONlib::YJpsiPPb8800c3(const Double_t *px, const Double_t */*dummy*/)
926 {
927 // J/Psi y
928 // pPb 8.8 TeV, 3rd centrality bin 40-60 %
929 //
930   Double_t x = px[0] + 0.47;              // rapidity shift
931   return YJpsiPPb8800ShFdummy(x, 3) * YJpsiPP8800dummy(x);
932 }
933
934 Double_t AliGenMUONlib::YJpsiPPb8800c4(const Double_t *px, const Double_t */*dummy*/)
935 {
936 // J/Psi y
937 // pPb 8.8 TeV, 4th centrality bin 60-100 %
938 //
939   Double_t x = px[0] + 0.47;              // rapidity shift
940   return YJpsiPPb8800ShFdummy(x, 4) * YJpsiPP8800dummy(x);
941 }
942
943 Double_t AliGenMUONlib::YJpsiPbP8800(const Double_t *px, const Double_t */*dummy*/)
944 {
945 // J/Psi y
946 // Pbp 8.8 TeV, minimum bias 0-100 %
947 //
948   Double_t x = -px[0] + 0.47;              // rapidity shift
949   return YJpsiPPb8800ShFdummy(x, 0) * YJpsiPP8800dummy(x);
950 }
951
952 Double_t AliGenMUONlib::YJpsiPbP8800c1(const Double_t *px, const Double_t */*dummy*/)
953 {
954 // J/Psi y
955 // Pbp 8.8 TeV, 1st centrality bin 0-20 %
956 //
957   Double_t x = -px[0] + 0.47;              // rapidity shift
958   return YJpsiPPb8800ShFdummy(x, 1) * YJpsiPP8800dummy(x);
959 }
960
961 Double_t AliGenMUONlib::YJpsiPbP8800c2(const Double_t *px, const Double_t */*dummy*/)
962 {
963 // J/Psi y
964 // Pbp 8.8 TeV, 2nd centrality bin 20-40 %
965 //
966   Double_t x = -px[0] + 0.47;              // rapidity shift
967   return YJpsiPPb8800ShFdummy(x, 2) * YJpsiPP8800dummy(x);
968 }
969
970 Double_t AliGenMUONlib::YJpsiPbP8800c3(const Double_t *px, const Double_t */*dummy*/)
971 {
972 // J/Psi y
973 // Pbp 8.8 TeV, 3rd centrality bin 40-60 %
974 //
975   Double_t x = -px[0] + 0.47;              // rapidity shift
976   return YJpsiPPb8800ShFdummy(x, 3) * YJpsiPP8800dummy(x);
977 }
978
979 Double_t AliGenMUONlib::YJpsiPbP8800c4(const Double_t *px, const Double_t */*dummy*/)
980 {
981 // J/Psi y
982 // Pbp 8.8 TeV, 4th centrality bin 60-100 %
983 //
984   Double_t x = -px[0] + 0.47;              // rapidity shift
985   return YJpsiPPb8800ShFdummy(x, 4) * YJpsiPP8800dummy(x);
986 }
987
988 Double_t AliGenMUONlib::YJpsi(const Double_t *py, const Double_t */*dummy*/)
989 {
990 // J/psi y
991   const Double_t ky0 = 4.;
992   const Double_t kb=1.;
993   Double_t yj;
994   Double_t y=TMath::Abs(*py);
995   //
996   if (y < ky0)
997     yj=kb;
998   else
999     yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
1000   return yj;
1001 }
1002
1003 Double_t AliGenMUONlib::YJpsiFlat( const Double_t */*py*/, const Double_t */*dummy*/ )
1004 {
1005   return 1.;
1006 }
1007
1008
1009 Double_t AliGenMUONlib::YJpsiPbPb( const Double_t *px, const Double_t */*dummy*/)
1010 {
1011
1012 //
1013 // J/Psi y
1014 //
1015 //
1016 // R. Vogt 2002
1017 // PbPb 5.5 TeV
1018 // MRST HO
1019 // mc = 1.4 GeV, pt-kick 1 GeV
1020 //
1021     Double_t c[5] = {-6.03425e+02, 4.98257e+02, -1.38794e+02, 1.62209e+01, -6.85955e-01};
1022     Double_t x = TMath::Abs(px[0]);
1023     Double_t y;
1024     
1025     if (x < 4.) {
1026         y = 31.754;
1027     } else if (x < 6) {
1028         Int_t j;
1029         y = c[j = 4];
1030         while (j > 0) y  = y * x + c[--j];
1031     } else {
1032         y =0.;
1033     }
1034     
1035     return y;
1036 }
1037
1038 Double_t AliGenMUONlib::YJpsiCDFscaled( const Double_t *px, const Double_t* dummy)
1039 {
1040     // J/Psi y 
1041     return AliGenMUONlib::YJpsiPbPb(px, dummy);
1042 }
1043
1044 Double_t AliGenMUONlib::YJpsiCDFscaledPP( const Double_t *px, const Double_t* dummy)
1045 {
1046     // J/Psi y 
1047     return AliGenMUONlib::YJpsiPP(px, dummy);
1048 }
1049
1050 Double_t AliGenMUONlib::YJpsiCDFscaledPP10( const Double_t *px, const Double_t */*dummy*/)
1051 {
1052 // J/Psi y
1053 //
1054 // pp 10 TeV
1055 // scaled from YJpsiPP(14 TeV) using 10 TeV / 14 TeV ratio of y-spectra in LO pQCD. 
1056 // see S.Grigoryan, PWG3 Meeting, 27th Oct 2008
1057 //
1058
1059     Double_t c[5] = {2.46681e+01, 8.91486e+01, -3.21227e+01, 3.63075e+00, -1.32047e-01};
1060
1061     Double_t x = TMath::Abs(px[0]);
1062     Double_t y;
1063
1064     if (x < 3.2) {
1065         y = 98.523 - 1.3664 * x * x;
1066     } else if (x < 7.5) {
1067         Int_t j;
1068         y = c[j = 4];
1069         while (j > 0) y  = y * x + c[--j];
1070     } else {
1071         y =0.;
1072     }
1073
1074     if(y<0) y=0;
1075
1076     return y;
1077 }
1078
1079 Double_t AliGenMUONlib::YJpsiCDFscaledPP9( const Double_t *px, const Double_t */*dummy*/)
1080 {
1081 // J/Psi y
1082 //
1083 // pp 8.8 TeV
1084 // rescaling of YJpsiPP(14 TeV) using 8.8 TeV / 14 TeV ratio of y-spectra in LO QCD 
1085 //
1086     Double_t c[5] = {3.33882e+02, -1.30980e+02, 2.59082e+01, -3.08935e+00, 1.56375e-01};
1087     Double_t x = TMath::Abs(px[0]);
1088     Double_t y;
1089
1090     if (x < 3.7) {
1091         y = 99.236 - 1.5498 * x * x;
1092     } else if (x < 7.4) {
1093         Int_t j;
1094         y = c[j = 4];
1095         while (j > 0) y  = y * x + c[--j];
1096     } else {
1097         y =0.;
1098     }
1099
1100     if(y<0) y=0;
1101
1102     return y;
1103 }
1104
1105 Double_t AliGenMUONlib::YJpsiCDFscaledPP9dummy(Double_t px)
1106 {
1107     return AliGenMUONlib::YJpsiCDFscaledPP9(&px, (Double_t*) 0);
1108 }
1109
1110 Double_t AliGenMUONlib::YJpsiCDFscaledPP7( const Double_t *px, const Double_t */*dummy*/)
1111 {
1112 // J/Psi y
1113 //
1114 // pp 7 TeV
1115 // scaled from YJpsiPP(14 TeV) using 7 TeV / 14 TeV ratio of y-spectra in LO pQCD. 
1116 //
1117
1118     Double_t c[5] = {6.71181e+02, -3.69240e+02, 8.89644e+01, -1.04937e+01, 4.80959e-01};
1119
1120     Double_t x = TMath::Abs(px[0]);
1121     Double_t y;
1122
1123     if (x < 4.0) {
1124         y = 100.78 - 1.8353 * x * x;
1125     } else if (x < 7.3) {
1126         Int_t j;
1127         y = c[j = 4];
1128         while (j > 0) y  = y * x + c[--j];
1129     } else {
1130         y =0.;
1131     }
1132
1133     if(y<0) y=0;
1134
1135     return y;
1136 }
1137
1138 Double_t AliGenMUONlib::YJpsiCDFscaledPP4( const Double_t *px, const Double_t */*dummy*/)
1139 {
1140 // J/Psi y
1141 //
1142 // pp 3.94 TeV
1143 // rescaling of YJpsiPP(14 TeV) using 3.94 TeV / 14 TeV ratio of y-spectra in LO QCD 
1144 //
1145     Double_t c[5] = {4.00785e+02, -1.41159e+01, -3.28599e+01, 5.53048e+00, -2.45151e-01};
1146     Double_t x = TMath::Abs(px[0]);
1147     Double_t y;
1148
1149     if (x < 5.5) {
1150         y = 107.389 - 2.7454 * x * x;
1151     } else if (x < 7.0) {
1152         Int_t j;
1153         y = c[j = 4];
1154         while (j > 0) y  = y * x + c[--j];
1155     } else {
1156         y =0.;
1157     }
1158
1159     if(y<0) y=0;
1160
1161     return y;
1162 }
1163
1164 Double_t AliGenMUONlib::YJpsiCDFscaledPP3( const Double_t *px, const Double_t *dummy)
1165 {
1166 // J/Psi y 
1167     return AliGenMUONlib::YJpsiPP2760(px, dummy);
1168 }
1169
1170 Double_t AliGenMUONlib::YJpsiCDFscaledPP2( const Double_t *px, const Double_t */*dummy*/)
1171 {
1172 // J/Psi y
1173 // pp 1.96 TeV
1174 //
1175   return YJpsiPPdummy(*px, 1960);
1176 }
1177
1178 Double_t AliGenMUONlib::YJpsiPP( const Double_t *px, const Double_t */*dummy*/)
1179 {
1180
1181 //
1182 // J/Psi y
1183 //
1184 //
1185 // R. Vogt 2002
1186 // pp 14  TeV
1187 // MRST HO
1188 // mc = 1.4 GeV, pt-kick 1 GeV
1189 //
1190
1191     Double_t c[5] = {1.38532e+00, 1.00596e+02, -3.46378e+01, 3.94172e+00, -1.48319e-01};
1192     Double_t x = TMath::Abs(px[0]);
1193     Double_t y;
1194     
1195     if (x < 2.5) {
1196         y = 96.455 - 0.8483 * x * x;
1197     } else if (x < 7.9) {
1198         Int_t j;
1199         y = c[j = 4];
1200         while (j > 0) y  = y * x + c[--j];
1201     } else {
1202         y =0.;
1203     }
1204     
1205     return y;
1206 }
1207
1208 Double_t AliGenMUONlib::YJpsiCDFscaledPPb9( const Double_t *px, const Double_t */*dummy*/)
1209 {
1210 // J/Psi y
1211 //
1212 // pPb 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.79
1213 //
1214     Double_t c[7] = {7.52296e-01, 2.49917e-02, 3.36500e-03, 1.91187e-03, 2.92154e-04,
1215                      -4.16509e-05,-7.62709e-06}; 
1216     Double_t y;
1217     Double_t x = px[0] + 0.47;              // rapidity shift
1218     Int_t j;
1219     y = c[j = 6];
1220     while (j > 0) y = y * x + c[--j];
1221     if(y<0) y=0;
1222
1223     return y * AliGenMUONlib::YJpsiCDFscaledPP9dummy(x);
1224 }
1225
1226 Double_t AliGenMUONlib::YJpsiCDFscaledPbP9( const Double_t *px, const Double_t */*dummy*/)
1227 {
1228 // J/Psi y
1229 //
1230 // Pbp 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.79
1231 //
1232     Double_t c[7] = {7.52296e-01, 2.49917e-02, 3.36500e-03, 1.91187e-03, 2.92154e-04,
1233                      -4.16509e-05,-7.62709e-06}; 
1234     Double_t y;
1235     Double_t x = -px[0] + 0.47;              // rapidity shift
1236     Int_t j;
1237     y = c[j = 6];
1238     while (j > 0) y = y * x + c[--j];
1239     if(y<0) y=0;
1240
1241     return y * AliGenMUONlib::YJpsiCDFscaledPP9dummy(x);
1242 }
1243
1244 Double_t AliGenMUONlib::YJpsiCDFscaledPbPb4( const Double_t *px, const Double_t *dummy)
1245 {
1246 // J/Psi y
1247 //
1248 // PbPb 3.94 TeV, for EKS98 with minimum bias shadowing factor 0.66
1249 //
1250     Double_t c[4] = {5.95228e-01, 9.45069e-03, 2.44710e-04, -1.32894e-05}; 
1251     Double_t x = px[0]*px[0];
1252     Double_t y;
1253     Int_t j;
1254     y = c[j = 3];
1255     while (j > 0) y  = y * x + c[--j];
1256     if(y<0) y=0;
1257
1258     return y * AliGenMUONlib::YJpsiCDFscaledPP4(px,dummy);
1259 }
1260
1261 Double_t AliGenMUONlib::YJpsiBPbPb( const Double_t *px, const Double_t */*dummy*/)
1262 {
1263
1264 //
1265 // J/Psi from B->J/Psi X
1266 //
1267 //
1268     
1269
1270     Double_t c[7] = {7.37025e-02, 0., -2.94487e-03, 0., 6.07953e-06, 0., 5.39219e-07};
1271     
1272     Double_t x = TMath::Abs(px[0]);
1273     Double_t y;
1274     
1275     if (x > 6.) {
1276         y = 0.;
1277     } else {
1278         Int_t j;
1279         y = c[j = 6];
1280         while (j > 0) y  = y * x + c[--j];
1281     } 
1282     
1283     return y;
1284 }
1285
1286
1287
1288 //                 particle composition
1289 //
1290 Int_t AliGenMUONlib::IpJpsi(TRandom *)
1291 {
1292 // J/Psi composition
1293     return 443;
1294 }
1295 Int_t AliGenMUONlib::IpPsiP(TRandom *)
1296 {
1297 // Psi prime composition
1298     return 100443;
1299 }
1300 Int_t AliGenMUONlib::IpJpsiFamily(TRandom *)
1301 {
1302 // J/Psi composition
1303   Int_t ip;
1304   Float_t r = gRandom->Rndm();
1305   if (r < 0.98) {
1306     ip = 443;
1307   } else {
1308     ip = 100443;
1309   }
1310   return ip;
1311 }
1312
1313
1314
1315 //                      Upsilon
1316 //
1317 //
1318 //                  pt-distribution
1319 //____________________________________________________________
1320 Double_t AliGenMUONlib::PtUpsilonPPdummy(Double_t x, Double_t energy)
1321 {
1322 // Upsilon pT
1323 // pp
1324 // from the fit of CDF & LHC data, like for J/Psi in arXiv:1103.2394
1325 //
1326   const Double_t kpt0 = 1.96*TMath::Power(energy,0.095);
1327   const Double_t kxn  = 3.4;
1328   //
1329   Double_t pass1 = 1.+0.471*(x/kpt0)*(x/kpt0);
1330   return x/TMath::Power(pass1,kxn);
1331 }
1332
1333 Double_t AliGenMUONlib::PtUpsilonPP7000(const Double_t *px, const Double_t */*dummy*/)
1334 {
1335 // Upsilon pT
1336 // pp 7 TeV
1337 //
1338   return PtUpsilonPPdummy(*px,7000);
1339 }
1340
1341 Double_t AliGenMUONlib::PtUpsilonPP2760(const Double_t *px, const Double_t */*dummy*/)
1342 {
1343 // Upsilon pT
1344 // pp 2.76 TeV
1345 //
1346   return PtUpsilonPPdummy(*px,2760);
1347 }
1348
1349 Double_t AliGenMUONlib::PtUpsilonPP8800(const Double_t *px, const Double_t */*dummy*/)
1350 {
1351 // Upsilon pT
1352 // pp 8.8 TeV
1353 //
1354   return PtUpsilonPPdummy(*px,8800);
1355 }
1356
1357 Double_t AliGenMUONlib::PtUpsilonPbPb2760ShFdummy(Double_t x, Int_t n)
1358 {
1359 // Usilon shadowing factor vs pT for PbPb min. bias and 11 centr. bins (in 2.5<y<4)
1360 //
1361 // PbPb 2.76 TeV, for EKS98, minimum bias shadowing factor = 0.87 in 4pi
1362 //
1363   const Double_t f1[12] = {1, 1.128, 1.097, 1.037, 0.937, 0.821, 0.693, 0.558,
1364                            0.428, 0.317, 0.231, 0.156};
1365   const Double_t f2[12] = {1, 1.313, 1.202, 1.039, 0.814, 0.593, 0.391, 0.224,
1366                            0.106, 0.041, 0.013, 0.002};
1367   const Double_t c1[7] = {1.9089e+00, 1.2969e-03, 8.9786e-05,-5.3062e-06,
1368                           -1.0046e-06,6.1446e-08, 1.0885e-09};
1369   const Double_t c2[7] = {8.8423e-01,-8.7488e-05, 5.9857e-04,-5.7959e-05, 
1370                           2.0059e-06,-2.7343e-08, 6.6053e-10};
1371   Double_t y1, y2;
1372   Int_t j;
1373   y1 = c1[j = 6]; y2 = c2[6];
1374   while (j > 0) {y1 = y1 * x + c1[--j]; y2 = y2 * x + c2[j];}
1375   
1376   y1 /= 1.+c1[6]*TMath::Power(x,6);
1377   y2 /= 1.+c2[6]*TMath::Power(x,6);
1378   //  
1379   y1 = 1 + (y1-2)*f1[n] + (y2+1-y1)*f2[n];
1380   if(y1<0) y1=0;
1381   return y1;
1382 }
1383
1384 Double_t AliGenMUONlib::PtUpsilonPbPb2760(const Double_t *px, const Double_t *dummy)
1385 {
1386 // Upsilon pT
1387 // PbPb 2.76 TeV, minimum bias 0-100 %
1388 //
1389   return PtUpsilonPbPb2760ShFdummy(*px, 0) * PtUpsilonPP2760(px, dummy);
1390 }
1391
1392 Double_t AliGenMUONlib::PtUpsilonPbPb2760c1(const Double_t *px, const Double_t *dummy)
1393 {
1394 // Upsilon pT
1395 // PbPb 2.76 TeV, 1st centrality bin 0-5 %
1396 //
1397   return PtUpsilonPbPb2760ShFdummy(*px, 1) * PtUpsilonPP2760(px, dummy);
1398 }
1399
1400 Double_t AliGenMUONlib::PtUpsilonPbPb2760c2(const Double_t *px, const Double_t *dummy)
1401 {
1402 // Upsilon pT
1403 // PbPb 2.76 TeV, 2nd centrality bin 5-10 %
1404 //
1405   return PtUpsilonPbPb2760ShFdummy(*px, 2) * PtUpsilonPP2760(px, dummy);
1406 }
1407
1408 Double_t AliGenMUONlib::PtUpsilonPbPb2760c3(const Double_t *px, const Double_t *dummy)
1409 {
1410 // Upsilon pT
1411 // PbPb 2.76 TeV, 3rd centrality bin 10-20 %
1412 //
1413   return PtUpsilonPbPb2760ShFdummy(*px, 3) * PtUpsilonPP2760(px, dummy);
1414 }
1415
1416 Double_t AliGenMUONlib::PtUpsilonPbPb2760c4(const Double_t *px, const Double_t *dummy)
1417 {
1418 // Upsilon pT
1419 // PbPb 2.76 TeV, 4th centrality bin 20-30 %
1420 //
1421   return PtUpsilonPbPb2760ShFdummy(*px, 4) * PtUpsilonPP2760(px, dummy);
1422 }
1423
1424 Double_t AliGenMUONlib::PtUpsilonPbPb2760c5(const Double_t *px, const Double_t *dummy)
1425 {
1426 // Upsilon pT
1427 // PbPb 2.76 TeV, 5th centrality bin 30-40 %
1428 //
1429   return PtUpsilonPbPb2760ShFdummy(*px, 5) * PtUpsilonPP2760(px, dummy);
1430 }
1431
1432 Double_t AliGenMUONlib::PtUpsilonPbPb2760c6(const Double_t *px, const Double_t *dummy)
1433 {
1434 // Upsilon pT
1435 // PbPb 2.76 TeV, 6th centrality bin 40-50 %
1436 //
1437   return PtUpsilonPbPb2760ShFdummy(*px, 6) * PtUpsilonPP2760(px, dummy);
1438 }
1439
1440 Double_t AliGenMUONlib::PtUpsilonPbPb2760c7(const Double_t *px, const Double_t *dummy)
1441 {
1442 // Upsilon pT
1443 // PbPb 2.76 TeV, 7th centrality bin 50-60 %
1444 //
1445   return PtUpsilonPbPb2760ShFdummy(*px, 7) * PtUpsilonPP2760(px, dummy);
1446 }
1447
1448 Double_t AliGenMUONlib::PtUpsilonPbPb2760c8(const Double_t *px, const Double_t *dummy)
1449 {
1450 // Upsilon pT
1451 // PbPb 2.76 TeV, 8th centrality bin 60-70 %
1452 //
1453   return PtUpsilonPbPb2760ShFdummy(*px, 8) * PtUpsilonPP2760(px, dummy);
1454 }
1455
1456 Double_t AliGenMUONlib::PtUpsilonPbPb2760c9(const Double_t *px, const Double_t *dummy)
1457 {
1458 // Upsilon pT
1459 // PbPb 2.76 TeV, 9th centrality bin 70-80 %
1460 //
1461   return PtUpsilonPbPb2760ShFdummy(*px, 9) * PtUpsilonPP2760(px, dummy);
1462 }
1463
1464 Double_t AliGenMUONlib::PtUpsilonPbPb2760c10(const Double_t *px, const Double_t *dummy)
1465 {
1466 // Upsilon pT
1467 // PbPb 2.76 TeV, 10th centrality bin 80-90 %
1468 //
1469   return PtUpsilonPbPb2760ShFdummy(*px, 10) * PtUpsilonPP2760(px, dummy);
1470 }
1471
1472 Double_t AliGenMUONlib::PtUpsilonPbPb2760c11(const Double_t *px, const Double_t *dummy)
1473 {
1474 // Upsilon pT
1475 // PbPb 2.76 TeV, 11th centrality bin 90-100 %
1476 //
1477   return PtUpsilonPbPb2760ShFdummy(*px, 11) * PtUpsilonPP2760(px, dummy);
1478 }
1479
1480 Double_t AliGenMUONlib::PtUpsilonPPb8800ShFdummy(Double_t x, Int_t n)
1481 {
1482 // Upsilon shadowing factor vs pT for pPb min. bias and 4 centr. bins (in 2.5<y<4)
1483 //
1484 // pPb 8.8 TeV, for EKS98, minimum bias shadowing factor = 0.89 in 4pi
1485 //
1486   const Double_t f[5] = {1, 1.33, 1.05, 0.67, 0.23};
1487   const Double_t c[5] = {7.6561e-01, 1.1360e-04, 4.9596e-04,-3.0287e-05, 3.7555e-06};
1488   Double_t y;
1489   Int_t j;
1490   y = c[j = 4];
1491   while (j > 0) y  = y * x + c[--j];
1492   y /= 1 + c[4]*TMath::Power(x,4);
1493   //  
1494   return 1 + (y-1)*f[n];
1495 }
1496
1497 Double_t AliGenMUONlib::PtUpsilonPPb8800(const Double_t *px, const Double_t *dummy)
1498 {
1499 // Upsilon pT
1500 // pPb 8.8 TeV, minimum bias 0-100 %
1501 //
1502   return PtUpsilonPPb8800ShFdummy(*px, 0) * PtUpsilonPP8800(px, dummy);
1503 }
1504
1505 Double_t AliGenMUONlib::PtUpsilonPPb8800c1(const Double_t *px, const Double_t *dummy)
1506 {
1507 // Upsilon pT
1508 // pPb 8.8 TeV, 1st centrality bin 0-20 %
1509 //
1510   return PtUpsilonPPb8800ShFdummy(*px, 1) * PtUpsilonPP8800(px, dummy);
1511 }
1512
1513 Double_t AliGenMUONlib::PtUpsilonPPb8800c2(const Double_t *px, const Double_t *dummy)
1514 {
1515 // Upsilon pT
1516 // pPb 8.8 TeV, 2nd centrality bin 20-40 %
1517 //
1518   return PtUpsilonPPb8800ShFdummy(*px, 2) * PtUpsilonPP8800(px, dummy);
1519 }
1520
1521 Double_t AliGenMUONlib::PtUpsilonPPb8800c3(const Double_t *px, const Double_t *dummy)
1522 {
1523 // Upsilon pT
1524 // pPb 8.8 TeV, 3rd centrality bin 40-60 %
1525 //
1526   return PtUpsilonPPb8800ShFdummy(*px, 3) * PtUpsilonPP8800(px, dummy);
1527 }
1528
1529 Double_t AliGenMUONlib::PtUpsilonPPb8800c4(const Double_t *px, const Double_t *dummy)
1530 {
1531 // Upsilon pT
1532 // pPb 8.8 TeV, 4th centrality bin 60-100 %
1533 //
1534   return PtUpsilonPPb8800ShFdummy(*px, 4) * PtUpsilonPP8800(px, dummy);
1535 }
1536
1537 Double_t AliGenMUONlib::PtUpsilonPbP8800ShFdummy(Double_t x, Int_t n)
1538 {
1539 // Upsilon shadowing factor vs pT for Pbp min. bias and 4 centr. bins (in 2.5<y<4)
1540 //
1541 // Pbp 8.8 TeV, for EKS98, minimum bias shadowing factor = 0.89 in 4pi
1542 //
1543   const Double_t f[5] = {1, 1.33, 1.05, 0.67, 0.23};
1544   const Double_t c[5] = {1.0975, 3.1905e-03,-2.0477e-04, 8.5270e-06, 2.5343e-06};
1545   Double_t y;
1546   Int_t j;
1547   y = c[j = 4];
1548   while (j > 0) y  = y * x + c[--j];
1549   y /= 1 + c[4]*TMath::Power(x,4);
1550   //  
1551   return 1 + (y-1)*f[n];
1552 }
1553
1554 Double_t AliGenMUONlib::PtUpsilonPbP8800(const Double_t *px, const Double_t *dummy)
1555 {
1556 // Upsilon pT
1557 // Pbp 8.8 TeV, minimum bias 0-100 %
1558 //
1559   return PtUpsilonPbP8800ShFdummy(*px, 0) * PtUpsilonPP8800(px, dummy);
1560 }
1561
1562 Double_t AliGenMUONlib::PtUpsilonPbP8800c1(const Double_t *px, const Double_t *dummy)
1563 {
1564 // Upsilon pT
1565 // Pbp 8.8 TeV, 1st centrality bin 0-20 %
1566 //
1567   return PtUpsilonPbP8800ShFdummy(*px, 1) * PtUpsilonPP8800(px, dummy);
1568 }
1569
1570 Double_t AliGenMUONlib::PtUpsilonPbP8800c2(const Double_t *px, const Double_t *dummy)
1571 {
1572 // Upsilon pT
1573 // Pbp 8.8 TeV, 2nd centrality bin 20-40 %
1574 //
1575   return PtUpsilonPbP8800ShFdummy(*px, 2) * PtUpsilonPP8800(px, dummy);
1576 }
1577
1578 Double_t AliGenMUONlib::PtUpsilonPbP8800c3(const Double_t *px, const Double_t *dummy)
1579 {
1580 // Upsilon pT
1581 // Pbp 8.8 TeV, 3rd centrality bin 40-60 %
1582 //
1583   return PtUpsilonPbP8800ShFdummy(*px, 3) * PtUpsilonPP8800(px, dummy);
1584 }
1585
1586 Double_t AliGenMUONlib::PtUpsilonPbP8800c4(const Double_t *px, const Double_t *dummy)
1587 {
1588 // Upsilon pT
1589 // Pbp 8.8 TeV, 4th centrality bin 60-100 %
1590 //
1591   return PtUpsilonPbP8800ShFdummy(*px, 4) * PtUpsilonPP8800(px, dummy);
1592 }
1593
1594 Double_t AliGenMUONlib::PtUpsilon( const Double_t *px, const Double_t */*dummy*/ )
1595 {
1596 // Upsilon pT
1597   const Double_t kpt0 = 5.3;
1598   const Double_t kxn  = 2.5;
1599   Double_t x=*px;
1600   //
1601   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1602   return x/TMath::Power(pass1,kxn);
1603 }
1604
1605 Double_t AliGenMUONlib::PtUpsilonCDFscaled( const Double_t *px, const Double_t */*dummy*/ )
1606 {
1607 // Upsilon pT
1608   const Double_t kpt0 = 7.753;
1609   const Double_t kxn  = 3.042;
1610   Double_t x=*px;
1611   //
1612   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1613   return x/TMath::Power(pass1,kxn);
1614 }
1615
1616 Double_t AliGenMUONlib::PtUpsilonCDFscaledPP( const Double_t *px, const Double_t */*dummy*/ )
1617 {
1618 // Upsilon pT
1619 //
1620 // pp 14 TeV
1621 //
1622 // scaled from CDF data at 2 TeV
1623
1624   const Double_t kpt0 = 8.610;
1625   const Double_t kxn  = 3.051;
1626   Double_t x=*px;
1627   //
1628   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1629   return x/TMath::Power(pass1,kxn);
1630 }
1631
1632 Double_t AliGenMUONlib::PtUpsilonCDFscaledPP10( const Double_t *px, const Double_t */*dummy*/)
1633 {
1634 // Upsilon pT
1635 //
1636 // pp 10 TeV
1637 //
1638 // scaled from CDF data at 2 TeV
1639
1640   const Double_t kpt0 = 8.235;
1641   const Double_t kxn  = 3.051;
1642   Double_t x=*px;
1643   //
1644   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1645   return x/TMath::Power(pass1,kxn);
1646 }
1647
1648 Double_t AliGenMUONlib::PtUpsilonCDFscaledPP9( const Double_t *px, const Double_t */*dummy*/)
1649 {
1650 // Upsilon pT
1651 //
1652 // pp 8.8 TeV
1653 // scaled from CDF data at 2 TeV
1654 //
1655   const Double_t kpt0 = 8.048;
1656   const Double_t kxn  = 3.051;
1657   Double_t x=*px;
1658   //
1659   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1660   return x/TMath::Power(pass1,kxn);
1661 }
1662
1663 Double_t AliGenMUONlib::PtUpsilonCDFscaledPP7( const Double_t *px, const Double_t */*dummy*/)
1664 {
1665 // Upsilon pT
1666 //
1667 // pp 7 TeV
1668 //
1669 // scaled from CDF data at 2 TeV
1670
1671   const Double_t kpt0 = 7.817;
1672   const Double_t kxn  = 3.051;
1673   Double_t x=*px;
1674   //
1675   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1676   return x/TMath::Power(pass1,kxn);
1677 }
1678
1679 Double_t AliGenMUONlib::PtUpsilonCDFscaledPP4( const Double_t *px, const Double_t */*dummy*/)
1680 {
1681 // Upsilon pT
1682 //
1683 // pp 3.94 TeV
1684 // scaled from CDF data at 2 TeV
1685 //
1686   const Double_t kpt0 = 7.189;
1687   const Double_t kxn  = 3.051;
1688   Double_t x=*px;
1689   //
1690   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1691   return x/TMath::Power(pass1,kxn);
1692 }
1693
1694 Double_t AliGenMUONlib::PtUpsilonCDFscaledPPb9( const Double_t *px, const Double_t *dummy)
1695 {
1696 // Upsilon pT
1697 //
1698 // pPb 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.89
1699 //
1700   Double_t c[5] = {7.64952e-01, 1.12501e-04, 4.96038e-04, -3.03198e-05, 3.74035e-06};
1701   Double_t x=*px;
1702   Double_t y;
1703   Int_t j;
1704   y = c[j = 4];
1705   while (j > 0) y  = y * x + c[--j];
1706   //  
1707   Double_t d = 1.+c[4]*TMath::Power(x,4);
1708   return y/d * AliGenMUONlib::PtUpsilonCDFscaledPP9(px,dummy);
1709 }
1710
1711 Double_t AliGenMUONlib::PtUpsilonCDFscaledPbP9( const Double_t *px, const Double_t *dummy)
1712 {
1713 // Upsilon pT
1714 //
1715 // Pbp 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.89
1716 //
1717   Double_t c[5] = {1.09881e+00, 3.08329e-03, -2.00356e-04, 8.28991e-06, 2.52576e-06};
1718   Double_t x=*px;
1719   Double_t y;
1720   Int_t j;
1721   y = c[j = 4];
1722   while (j > 0) y  = y * x + c[--j];
1723   //  
1724   Double_t d = 1.+c[4]*TMath::Power(x,4);
1725   return y/d * AliGenMUONlib::PtUpsilonCDFscaledPP9(px,dummy);
1726 }
1727
1728 Double_t AliGenMUONlib::PtUpsilonCDFscaledPbPb4( const Double_t *px, const Double_t *dummy)
1729 {
1730 // Upsilon pT
1731 //
1732 // PbPb 3.94 TeV, for EKS98 with minimum bias shadowing factor 0.85
1733 //
1734   Double_t c[5] = {8.65872e-01, 2.05465e-03, 2.56063e-04, -1.65598e-05, 2.29209e-06};
1735   Double_t x=*px;
1736   Double_t y;
1737   Int_t j;
1738   y = c[j = 4];
1739   while (j > 0) y  = y * x + c[--j];
1740   //  
1741   Double_t d = 1.+c[4]*TMath::Power(x,4);
1742   return y/d * AliGenMUONlib::PtUpsilonCDFscaledPP4(px,dummy);
1743 }
1744
1745 Double_t AliGenMUONlib::PtUpsilonFlat( const Double_t */*px*/, const Double_t */*dummy*/ )
1746 {
1747   return 1.;
1748 }
1749
1750 Double_t AliGenMUONlib::PtUpsilonPbPb( const Double_t *px, const Double_t */*dummy*/)
1751 {
1752 //
1753 // Upsilon pT
1754 //
1755 //
1756 // R. Vogt 2002
1757 // PbPb 5.5 TeV
1758 // MRST HO
1759 // mc = 1.4 GeV, pt-kick 1 GeV
1760 //
1761     Float_t x = px[0];
1762     Double_t c[8] = {
1763         -1.03488e+01, 1.28065e+01, -6.60500e+00, 1.66140e+00,       
1764         -2.34293e-01, 1.86925e-02, -7.80708e-04, 1.30610e-05
1765     };
1766     Double_t y;
1767     if (x < 10.) {
1768         Int_t j;
1769         y = c[j = 7];
1770         while (j > 0) y  = y * x +c[--j];
1771         y = x * TMath::Exp(y);
1772     } else {
1773         y = 0.;
1774     }
1775     return y;
1776 }
1777
1778 Double_t AliGenMUONlib::PtUpsilonPP( const Double_t *px, const Double_t */*dummy*/)
1779 {
1780 //
1781 // Upsilon pT
1782 //
1783 //
1784 // R. Vogt 2002
1785 // pp 14 TeV
1786 // MRST HO
1787 // mc = 1.4 GeV, pt-kick 1 GeV
1788 //
1789     Float_t x = px[0];
1790     Double_t c[8] = {-7.93955e+00, 1.06306e+01, -5.21392e+00, 1.19703e+00,   
1791                      -1.45718e-01, 8.95151e-03, -2.04806e-04, -1.13053e-06};
1792     
1793     Double_t y;
1794     if (x < 10.) {
1795         Int_t j;
1796         y = c[j = 7];
1797         while (j > 0) y  = y * x +c[--j];
1798         y = x * TMath::Exp(y);
1799     } else {
1800         y = 0.;
1801     }
1802     return y;
1803 }
1804
1805 //
1806 //                    y-distribution
1807 //
1808 //____________________________________________________________
1809 Double_t AliGenMUONlib::YUpsilonPPdummy(Double_t x, Double_t energy)
1810 {
1811 // Upsilon y
1812 // pp
1813 // from the fit of CDF & LHC data, like for J/Psi in arXiv:1103.2394
1814 //
1815     x = x/TMath::Log(energy/9.46);
1816     x = x*x;
1817     Double_t y = TMath::Exp(-x/0.4/0.4/2);
1818     if(x > 1) y=0;
1819     return y;
1820 }
1821
1822 Double_t AliGenMUONlib::YUpsilonPPpoly(Double_t x, Double_t energy)
1823 {
1824 // Upsilon y
1825 // pp
1826 // from the fit of CDF & LHC data, like for J/Psi in arXiv:1103.2394
1827 //
1828     x = x/TMath::Log(energy/9.46);
1829     x = x*x;
1830     Double_t y = 1 - 6.9*x*x;
1831     if(y < 0) y=0;
1832     return y;
1833 }
1834
1835 Double_t AliGenMUONlib::YUpsilonPP7000(const Double_t *px, const Double_t */*dummy*/)
1836 {
1837 // Upsilon y
1838 // pp 7 TeV
1839 //
1840   return YUpsilonPPdummy(*px, 7000);
1841 }
1842
1843 Double_t AliGenMUONlib::YUpsilonPP2760(const Double_t *px, const Double_t */*dummy*/)
1844 {
1845 // Upsilon y
1846 // pp 2.76 TeV
1847 //
1848   return YUpsilonPPdummy(*px, 2760);
1849 }
1850
1851 Double_t AliGenMUONlib::YUpsilonPP8800(const Double_t *px, const Double_t */*dummy*/)
1852 {
1853 // Upsilon y
1854 // pp 8.8 TeV
1855 //
1856   return YUpsilonPPdummy(*px, 8800);
1857 }
1858
1859 Double_t AliGenMUONlib::YUpsilonPPpoly7000(const Double_t *px, const Double_t */*dummy*/)
1860 {
1861 // Upsilon y
1862 // pp 7 TeV
1863 //
1864   return YUpsilonPPpoly(*px, 7000);
1865 }
1866
1867 Double_t AliGenMUONlib::YUpsilonPPpoly2760(const Double_t *px, const Double_t */*dummy*/)
1868 {
1869 // Upsilon y
1870 // pp 2.76 TeV
1871 //
1872   return YUpsilonPPpoly(*px, 2760);
1873 }
1874
1875 Double_t AliGenMUONlib::YUpsilonPbPb2760ShFdummy(Double_t x, Int_t n)
1876 {
1877 // Upsilon shadowing factor vs y for PbPb min. bias and 11 centr. bins
1878 //
1879 // PbPb 2.76 TeV, for EKS98, minimum bias shadowing factor = 0.87 in 4pi
1880 //
1881   const Double_t f1[12] = {1, 1.128, 1.097, 1.037, 0.937, 0.821, 0.693, 0.558,
1882                            0.428, 0.317, 0.231, 0.156};
1883   const Double_t f2[12] = {1, 1.313, 1.202, 1.039, 0.814, 0.593, 0.391, 0.224,
1884                            0.106, 0.041, 0.013, 0.002};
1885   const Double_t c1[5] = {1.8547e+00, 1.6717e-02,-2.1285e-04,-9.7662e-05, 2.5768e-06};
1886   const Double_t c2[5] = {8.6029e-01, 1.1742e-02,-2.7944e-04,-6.7973e-05, 1.8838e-06}; 
1887
1888   x = x*x;
1889   Double_t y1, y2;
1890   Int_t j;
1891   y1 = c1[j = 4]; y2 = c2[4];
1892   while (j > 0) {y1 = y1 * x + c1[--j]; y2 = y2 * x + c2[j];}
1893   
1894   y1 = 1 + (y1-2)*f1[n] + (y2+1-y1)*f2[n];
1895   if(y1<0) y1=0;
1896   return y1;
1897 }
1898
1899 Double_t AliGenMUONlib::YUpsilonPbPb2760(const Double_t *px, const Double_t *dummy)
1900 {
1901 // Upsilon y
1902 // PbPb 2.76 TeV, minimum bias 0-100 %
1903 //
1904   return YUpsilonPbPb2760ShFdummy(*px, 0) * YUpsilonPP2760(px, dummy);
1905 }
1906
1907 Double_t AliGenMUONlib::YUpsilonPbPb2760c1(const Double_t *px, const Double_t *dummy)
1908 {
1909 // Upsilon y
1910 // PbPb 2.76 TeV, 1st centrality bin 0-5 %
1911 //
1912   return YUpsilonPbPb2760ShFdummy(*px, 1) * YUpsilonPP2760(px, dummy);
1913 }
1914
1915 Double_t AliGenMUONlib::YUpsilonPbPb2760c2(const Double_t *px, const Double_t *dummy)
1916 {
1917 // Upsilon y
1918 // PbPb 2.76 TeV, 2nd centrality bin 5-10 %
1919 //
1920   return YUpsilonPbPb2760ShFdummy(*px, 2) * YUpsilonPP2760(px, dummy);
1921 }
1922
1923 Double_t AliGenMUONlib::YUpsilonPbPb2760c3(const Double_t *px, const Double_t *dummy)
1924 {
1925 // Upsilon y
1926 // PbPb 2.76 TeV, 3rd centrality bin 10-20 %
1927 //
1928   return YUpsilonPbPb2760ShFdummy(*px, 3) * YUpsilonPP2760(px, dummy);
1929 }
1930
1931 Double_t AliGenMUONlib::YUpsilonPbPb2760c4(const Double_t *px, const Double_t *dummy)
1932 {
1933 // Upsilon y
1934 // PbPb 2.76 TeV, 4th centrality bin 20-30 %
1935 //
1936   return YUpsilonPbPb2760ShFdummy(*px, 4) * YUpsilonPP2760(px, dummy);
1937 }
1938
1939 Double_t AliGenMUONlib::YUpsilonPbPb2760c5(const Double_t *px, const Double_t *dummy)
1940 {
1941 // Upsilon y
1942 // PbPb 2.76 TeV, 5th centrality bin 30-40 %
1943 //
1944   return YUpsilonPbPb2760ShFdummy(*px, 5) * YUpsilonPP2760(px, dummy);
1945 }
1946
1947 Double_t AliGenMUONlib::YUpsilonPbPb2760c6(const Double_t *px, const Double_t *dummy)
1948 {
1949 // Upsilon y
1950 // PbPb 2.76 TeV, 6th centrality bin 40-50 %
1951 //
1952   return YUpsilonPbPb2760ShFdummy(*px, 6) * YUpsilonPP2760(px, dummy);
1953 }
1954
1955 Double_t AliGenMUONlib::YUpsilonPbPb2760c7(const Double_t *px, const Double_t *dummy)
1956 {
1957 // Upsilon y
1958 // PbPb 2.76 TeV, 7th centrality bin 50-60 %
1959 //
1960   return YUpsilonPbPb2760ShFdummy(*px, 7) * YUpsilonPP2760(px, dummy);
1961 }
1962
1963 Double_t AliGenMUONlib::YUpsilonPbPb2760c8(const Double_t *px, const Double_t *dummy)
1964 {
1965 // Upsilon y
1966 // PbPb 2.76 TeV, 8th centrality bin 60-70 %
1967 //
1968   return YUpsilonPbPb2760ShFdummy(*px, 8) * YUpsilonPP2760(px, dummy);
1969 }
1970
1971 Double_t AliGenMUONlib::YUpsilonPbPb2760c9(const Double_t *px, const Double_t *dummy)
1972 {
1973 // Upsilon y
1974 // PbPb 2.76 TeV, 9th centrality bin 70-80 %
1975 //
1976   return YUpsilonPbPb2760ShFdummy(*px, 9) * YUpsilonPP2760(px, dummy);
1977 }
1978
1979 Double_t AliGenMUONlib::YUpsilonPbPb2760c10(const Double_t *px, const Double_t *dummy)
1980 {
1981 // Upsilon y
1982 // PbPb 2.76 TeV, 10th centrality bin 80-90 %
1983 //
1984   return YUpsilonPbPb2760ShFdummy(*px, 10) * YUpsilonPP2760(px, dummy);
1985 }
1986
1987 Double_t AliGenMUONlib::YUpsilonPbPb2760c11(const Double_t *px, const Double_t *dummy)
1988 {
1989 // Upsilon y
1990 // PbPb 2.76 TeV, 11th centrality bin 90-100 %
1991 //
1992   return YUpsilonPbPb2760ShFdummy(*px, 11) * YUpsilonPP2760(px, dummy);
1993 }
1994
1995 Double_t AliGenMUONlib::YUpsilonPP8800dummy(Double_t px)
1996 {
1997     return AliGenMUONlib::YUpsilonPP8800(&px, (Double_t*) 0);
1998 }
1999
2000 Double_t AliGenMUONlib::YUpsilonPPb8800ShFdummy(Double_t x, Int_t n)
2001 {
2002 // Upsilon shadowing factor vs y for pPb min. bias and 4 centr. bins
2003 //
2004 // pPb 8.8 TeV, for EKS98, minimum bias shadowing factor = 0.89 in 4pi
2005 //
2006     const Double_t f[5] = {1, 1.33, 1.05, 0.67, 0.23};
2007     const Double_t c[7] = {8.6581e-01, 4.6111e-02, 7.6911e-03, 8.7313e-04,
2008                            -1.4700e-04,-5.0975e-05,-3.5718e-06}; 
2009     Double_t y;
2010     Int_t j;
2011     y = c[j = 6];
2012     while (j > 0) y = y * x + c[--j];
2013     if(y<0) y=0;
2014     //
2015     return 1 +(y-1)*f[n];
2016 }
2017
2018 Double_t AliGenMUONlib::YUpsilonPPb8800(const Double_t *px, const Double_t */*dummy*/)
2019 {
2020 // Upsilon y
2021 // pPb 8.8 TeV, minimum bias 0-100 %
2022 //
2023   Double_t x = px[0] + 0.47;              // rapidity shift
2024   return YUpsilonPPb8800ShFdummy(x, 0) * YUpsilonPP8800dummy(x);
2025 }
2026
2027 Double_t AliGenMUONlib::YUpsilonPPb8800c1(const Double_t *px, const Double_t */*dummy*/)
2028 {
2029 // Upsilon y
2030 // pPb 8.8 TeV, 1st centrality bin 0-20 %
2031 //
2032   Double_t x = px[0] + 0.47;              // rapidity shift
2033   return YUpsilonPPb8800ShFdummy(x, 1) * YUpsilonPP8800dummy(x);
2034 }
2035
2036 Double_t AliGenMUONlib::YUpsilonPPb8800c2(const Double_t *px, const Double_t */*dummy*/)
2037 {
2038 // Upsilon y
2039 // pPb 8.8 TeV, 2nd centrality bin 20-40 %
2040 //
2041   Double_t x = px[0] + 0.47;              // rapidity shift
2042   return YUpsilonPPb8800ShFdummy(x, 2) * YUpsilonPP8800dummy(x);
2043 }
2044
2045 Double_t AliGenMUONlib::YUpsilonPPb8800c3(const Double_t *px, const Double_t */*dummy*/)
2046 {
2047 // Upsilon y
2048 // pPb 8.8 TeV, 3rd centrality bin 40-60 %
2049 //
2050   Double_t x = px[0] + 0.47;              // rapidity shift
2051   return YUpsilonPPb8800ShFdummy(x, 3) * YUpsilonPP8800dummy(x);
2052 }
2053
2054 Double_t AliGenMUONlib::YUpsilonPPb8800c4(const Double_t *px, const Double_t */*dummy*/)
2055 {
2056 // Upsilon y
2057 // pPb 8.8 TeV, 4th centrality bin 60-100 %
2058 //
2059   Double_t x = px[0] + 0.47;              // rapidity shift
2060   return YUpsilonPPb8800ShFdummy(x, 4) * YUpsilonPP8800dummy(x);
2061 }
2062
2063 Double_t AliGenMUONlib::YUpsilonPbP8800(const Double_t *px, const Double_t */*dummy*/)
2064 {
2065 // Upsilon y
2066 // Pbp 8.8 TeV, minimum bias 0-100 %
2067 //
2068   Double_t x = -px[0] + 0.47;              // rapidity shift
2069   return YUpsilonPPb8800ShFdummy(x, 0) * YUpsilonPP8800dummy(x);
2070 }
2071
2072 Double_t AliGenMUONlib::YUpsilonPbP8800c1(const Double_t *px, const Double_t */*dummy*/)
2073 {
2074 // Upsilon y
2075 // Pbp 8.8 TeV, 1st centrality bin 0-20 %
2076 //
2077   Double_t x = -px[0] + 0.47;              // rapidity shift
2078   return YUpsilonPPb8800ShFdummy(x, 1) * YUpsilonPP8800dummy(x);
2079 }
2080
2081 Double_t AliGenMUONlib::YUpsilonPbP8800c2(const Double_t *px, const Double_t */*dummy*/)
2082 {
2083 // Upsilon y
2084 // Pbp 8.8 TeV, 2nd centrality bin 20-40 %
2085 //
2086   Double_t x = -px[0] + 0.47;              // rapidity shift
2087   return YUpsilonPPb8800ShFdummy(x, 2) * YUpsilonPP8800dummy(x);
2088 }
2089
2090 Double_t AliGenMUONlib::YUpsilonPbP8800c3(const Double_t *px, const Double_t */*dummy*/)
2091 {
2092 // Upsilon y
2093 // Pbp 8.8 TeV, 3rd centrality bin 40-60 %
2094 //
2095   Double_t x = -px[0] + 0.47;              // rapidity shift
2096   return YUpsilonPPb8800ShFdummy(x, 3) * YUpsilonPP8800dummy(x);
2097 }
2098
2099 Double_t AliGenMUONlib::YUpsilonPbP8800c4(const Double_t *px, const Double_t */*dummy*/)
2100 {
2101 // Upsilon y
2102 // Pbp 8.8 TeV, 4th centrality bin 60-100 %
2103 //
2104   Double_t x = -px[0] + 0.47;              // rapidity shift
2105   return YUpsilonPPb8800ShFdummy(x, 4) * YUpsilonPP8800dummy(x);
2106 }
2107
2108 Double_t AliGenMUONlib::YUpsilon(const Double_t *py, const Double_t */*dummy*/)
2109 {
2110 // Upsilon y
2111   const Double_t ky0 = 3.;
2112   const Double_t kb=1.;
2113   Double_t yu;
2114   Double_t y=TMath::Abs(*py);
2115   //
2116   if (y < ky0)
2117     yu=kb;
2118   else
2119     yu=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
2120   return yu;
2121 }
2122
2123
2124 Double_t AliGenMUONlib::YUpsilonPbPb( const Double_t *px, const Double_t */*dummy*/)
2125 {
2126
2127 //
2128 // Upsilon y
2129 //
2130 //
2131 // R. Vogt 2002
2132 // PbPb 5.5 TeV
2133 // MRST HO
2134 // mc = 1.4 GeV, pt-kick 1 GeV
2135 //
2136
2137     Double_t c[7] = {3.40036e-01, -3.98882e-07, -4.48398e-03, 8.46411e-08, -6.10854e-04,
2138                      -2.99753e-09, 1.28895e-05};
2139     Double_t x = TMath::Abs(px[0]);
2140     if (x > 5.55) return 0.;
2141     Int_t j;
2142     Double_t y = c[j = 6];
2143     while (j > 0) y  = y * x +c[--j];
2144     return y;
2145 }
2146
2147 Double_t AliGenMUONlib::YUpsilonCDFscaled( const Double_t *px, const Double_t *dummy)
2148 {
2149     // Upsilon y
2150     return AliGenMUONlib::YUpsilonPbPb(px, dummy);
2151     
2152 }
2153
2154 Double_t AliGenMUONlib::YUpsilonCDFscaledPP( const Double_t *px, const Double_t *dummy)
2155 {
2156     // Upsilon y
2157     return AliGenMUONlib::YUpsilonPP(px, dummy);
2158     
2159 }
2160
2161 Double_t AliGenMUONlib::YUpsilonFlat( const Double_t */*px*/, const Double_t */*dummy*/)
2162 {
2163     // Upsilon y
2164     return 1.;
2165     
2166 }
2167
2168 Double_t AliGenMUONlib::YUpsilonCDFscaledPP10( const Double_t *px, const Double_t */*dummy*/)
2169 {
2170 // Upsilon y
2171 //
2172 // pp 10 TeV
2173 // scaled from YUpsilonPP(14 TeV) using 10 TeV / 14 TeV ratio of y-spectra in LO pQCD. 
2174 // see S.Grigoryan, PWG3 Meeting, 27th Oct 2008
2175 //
2176     Double_t c[4] = {1., -2.17877e-02, -6.52830e-04, 1.40578e-05};
2177     Double_t x = TMath::Abs(px[0]);
2178     if (x > 6.1) return 0.;
2179     Int_t j;
2180     Double_t y = c[j = 3];
2181     while (j > 0) y  = y * x*x +c[--j];
2182     return y;
2183 }
2184
2185 Double_t AliGenMUONlib::YUpsilonCDFscaledPP9( const Double_t *px, const Double_t */*dummy*/)
2186 {
2187 // Upsilon y
2188 //
2189 // pp 8.8 TeV
2190 // rescaling of YUpsilonPP(14 TeV) using 8.8 TeV / 14 TeV ratio of y-spectra in LO QCD 
2191 //
2192     Double_t c[4] = {1., -2.37621e-02, -6.29610e-04, 1.47976e-05};
2193     Double_t x = TMath::Abs(px[0]);
2194     if (x > 6.1) return 0.;
2195     Int_t j;
2196     Double_t y = c[j = 3];
2197     while (j > 0) y  = y * x*x +c[--j];
2198     return y;
2199 }
2200
2201 Double_t AliGenMUONlib::YUpsilonCDFscaledPP9dummy(Double_t px)
2202 {
2203     return AliGenMUONlib::YUpsilonCDFscaledPP9(&px, (Double_t*) 0);
2204 }
2205
2206 Double_t AliGenMUONlib::YUpsilonCDFscaledPP7( const Double_t *px, const Double_t */*dummy*/)
2207 {
2208 // Upsilon y
2209 //
2210 // pp 7 TeV
2211 // scaled from YUpsilonPP(14 TeV) using 7 TeV / 14 TeV ratio of y-spectra in LO pQCD. 
2212 //
2213     Double_t c[4] = {1., -2.61009e-02, -6.83937e-04, 1.78451e-05};
2214     Double_t x = TMath::Abs(px[0]);
2215     if (x > 6.0) return 0.;
2216     Int_t j;
2217     Double_t y = c[j = 3];
2218     while (j > 0) y  = y * x*x +c[--j];
2219     return y;
2220 }
2221
2222 Double_t AliGenMUONlib::YUpsilonCDFscaledPP4( const Double_t *px, const Double_t */*dummy*/)
2223 {
2224 // Upsilon y
2225 //
2226 // pp 3.94 TeV
2227 // rescaling of YUpsilonPP(14 TeV) using 3.94 TeV / 14 TeV ratio of y-spectra in LO QCD
2228 //
2229     Double_t c[4] = {1., -3.91924e-02, -4.26184e-04, 2.10914e-05};
2230     Double_t x = TMath::Abs(px[0]);
2231     if (x > 5.7) return 0.;
2232     Int_t j;
2233     Double_t y = c[j = 3];
2234     while (j > 0) y  = y * x*x +c[--j];
2235
2236     return y;
2237 }
2238
2239 Double_t AliGenMUONlib::YUpsilonPP( const Double_t *px, const Double_t */*dummy*/)
2240 {
2241
2242 //
2243 // Upsilon y
2244 //
2245 //
2246 // R. Vogt 2002
2247 // p p  14. TeV
2248 // MRST HO
2249 // mc = 1.4 GeV, pt-kick 1 GeV
2250 //
2251     Double_t c[7] = {8.91936e-01, -6.46645e-07, -1.52774e-02, 4.28677e-08, -7.01517e-04, 
2252                      -6.20539e-10, 1.29943e-05};
2253     Double_t x = TMath::Abs(px[0]);
2254     if (x > 6.2) return 0.;
2255     Int_t j;
2256     Double_t y = c[j = 6];
2257     while (j > 0) y  = y * x +c[--j];
2258     return y;
2259 }
2260
2261 Double_t AliGenMUONlib::YUpsilonCDFscaledPPb9( const Double_t *px, const Double_t */*dummy*/)
2262 {
2263 // Upsilon y
2264 //
2265 // pPb 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.89
2266 //
2267     Double_t c[7] = {8.71829e-01, 4.77467e-02, 8.09671e-03, 6.45294e-04, -2.15730e-04,
2268                      -4.67538e-05,-2.11683e-06}; 
2269     Double_t y;
2270     Double_t x = px[0] + 0.47;              // rapidity shift
2271     Int_t j;
2272     y = c[j = 6];
2273     while (j > 0) y = y * x + c[--j];
2274     if(y<0) y=0;
2275
2276     return y * AliGenMUONlib::YUpsilonCDFscaledPP9dummy(x);
2277 }
2278
2279 Double_t AliGenMUONlib::YUpsilonCDFscaledPbP9( const Double_t *px, const Double_t */*dummy*/)
2280 {
2281 // Upsilon y
2282 //
2283 // Pbp 8.8 TeV, for EKS98 with minimum bias shadowing factor 0.89
2284 //
2285     Double_t c[7] = {8.71829e-01, 4.77467e-02, 8.09671e-03, 6.45294e-04, -2.15730e-04,
2286                      -4.67538e-05,-2.11683e-06}; 
2287     Double_t y;
2288     Double_t x = -px[0] + 0.47;              // rapidity shift
2289     Int_t j;
2290     y = c[j = 6];
2291     while (j > 0) y = y * x + c[--j];
2292     if(y<0) y=0;
2293
2294     return y * AliGenMUONlib::YUpsilonCDFscaledPP9dummy(x);
2295 }
2296
2297 Double_t AliGenMUONlib::YUpsilonCDFscaledPbPb4( const Double_t *px, const Double_t *dummy)
2298 {
2299 // Upsilon y
2300 //
2301 // PbPb 3.94 TeV, for EKS98 with minimum bias shadowing factor 0.85
2302 //
2303     Double_t c[4] = {8.27837e-01, 1.70115e-02, -1.26046e-03, 1.52091e-05}; 
2304     Double_t x = px[0]*px[0];
2305     Double_t y;
2306     Int_t j;
2307     y = c[j = 3];
2308     while (j > 0) y  = y * x + c[--j];
2309     if(y<0) y=0;
2310
2311     return y * AliGenMUONlib::YUpsilonCDFscaledPP4(px,dummy);
2312 }
2313
2314
2315 //                 particle composition
2316 //
2317 Int_t AliGenMUONlib::IpUpsilon(TRandom *)
2318 {
2319 // y composition
2320     return 553;
2321 }
2322 Int_t AliGenMUONlib::IpUpsilonP(TRandom *)
2323 {
2324 // y composition
2325     return 100553;
2326 }
2327 Int_t AliGenMUONlib::IpUpsilonPP(TRandom *)
2328 {
2329 // y composition
2330     return 200553;
2331 }
2332 Int_t AliGenMUONlib::IpUpsilonFamily(TRandom *)
2333 {
2334 // y composition
2335   Int_t ip;
2336   Float_t r = gRandom->Rndm();
2337   
2338   if (r < 0.712) {
2339     ip = 553;
2340   } else if (r < 0.896) {
2341     ip = 100553;
2342   } else {
2343     ip = 200553;
2344   }
2345   return ip;
2346 }
2347
2348
2349 //
2350 //                        Phi
2351 //
2352 //
2353 //    pt-distribution (by scaling of pion distribution)
2354 //____________________________________________________________
2355 Double_t AliGenMUONlib::PtPhi( const Double_t *px, const Double_t */*dummy*/)
2356 {
2357 // Phi pT
2358   return PtScal(*px,7);
2359 }
2360 //    y-distribution
2361 Double_t AliGenMUONlib::YPhi( const Double_t *px, const Double_t */*dummy*/)
2362 {
2363 // Phi y
2364     Double_t *dum=0;
2365     return YJpsi(px,dum);
2366 }
2367 //                 particle composition
2368 //
2369 Int_t AliGenMUONlib::IpPhi(TRandom *)
2370 {
2371 // Phi composition
2372     return 333;
2373 }
2374
2375 //
2376 //                        omega
2377 //
2378 //
2379 //    pt-distribution (by scaling of pion distribution)
2380 //____________________________________________________________
2381 Double_t AliGenMUONlib::PtOmega( const Double_t *px, const Double_t */*dummy*/)
2382 {
2383 // Omega pT
2384   return PtScal(*px,5);
2385 }
2386 //    y-distribution
2387 Double_t AliGenMUONlib::YOmega( const Double_t *px, const Double_t */*dummy*/)
2388 {
2389 // Omega y
2390     Double_t *dum=0;
2391     return YJpsi(px,dum);
2392 }
2393 //                 particle composition
2394 //
2395 Int_t AliGenMUONlib::IpOmega(TRandom *)
2396 {
2397 // Omega composition
2398     return 223;
2399 }
2400
2401
2402 //
2403 //                        Eta
2404 //
2405 //
2406 //    pt-distribution (by scaling of pion distribution)
2407 //____________________________________________________________
2408 Double_t AliGenMUONlib::PtEta( const Double_t *px, const Double_t */*dummy*/)
2409 {
2410 // Eta pT
2411   return PtScal(*px,3);
2412 }
2413 //    y-distribution
2414 Double_t AliGenMUONlib::YEta( const Double_t *px, const Double_t */*dummy*/)
2415 {
2416 // Eta y
2417     Double_t *dum=0;
2418     return YJpsi(px,dum);
2419 }
2420 //                 particle composition
2421 //
2422 Int_t AliGenMUONlib::IpEta(TRandom *)
2423 {
2424 // Eta composition
2425     return 221;
2426 }
2427
2428 //
2429 //                        Charm
2430 //
2431 //
2432 //                    pt-distribution
2433 //____________________________________________________________
2434 Double_t AliGenMUONlib::PtCharm( const Double_t *px, const Double_t */*dummy*/)
2435 {
2436 // Charm pT
2437   const Double_t kpt0 = 2.25;
2438   const Double_t kxn  = 3.17;
2439   Double_t x=*px;
2440   //
2441   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2442   return x/TMath::Power(pass1,kxn);
2443 }
2444
2445 Double_t AliGenMUONlib::PtCharmCentral( const Double_t *px, const Double_t */*dummy*/)
2446 {
2447 // Charm pT
2448   const Double_t kpt0 = 2.12;
2449   const Double_t kxn  = 2.78;
2450   Double_t x=*px;
2451   //
2452   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2453   return x/TMath::Power(pass1,kxn);
2454 }
2455 Double_t AliGenMUONlib::PtCharmF0M0S0PP( const Double_t *px, const Double_t */*dummy*/)
2456 {
2457 // FiMjSkPP define theoretical uncertainties around F0M0S0PP as follows:
2458 // PtCharmFiMjSkPP = PtCharmF0M0S0PP * (dN(i,j,k)/dpt / dN(0,0,0)/dpt)_MNR
2459 //       i=0,1,2;  j=0,1,2;  k=0,1,...,6
2460 // dN(i,j,k)/dpt - spectra obtained by A.Dainese (hep-ph/0601164, p.88; 
2461 // http://www-zeus.desy.de/~corradi/benchmarks) from NLO pQCD (MNR)
2462 // calculations for the following inputs: 
2463 // Peterson fragmentation function (F) with \epsilon_c = 0.02, 0.002 & 0.11 
2464 // for i=0,1 & 2 respectively; quark mass (M) of 1.5, 1.3 & 1.7 GeV 
2465 // for j=0,1 & 2 respectively; 
2466 // factorisation \mu_F = a*mt and renormalisation \mu_R = b*mt scales (S) 
2467 // with a/b = 1/1, 1/0.5, 0.5/1, 0.5/0.5, 1/2, 2/1 & 2/2 
2468 // for k = 0, 1, 2, 3, 4, 5 & 6 respectively; CTEQ6.1 PDF set 
2469 // (PDF uncertainty not considered since is small, see hep-ph/0601164, p.89).
2470 // June 2008, Smbat.Grigoryan@cern.ch
2471
2472 // Charm pT
2473 // Pythia6.214 (kCharmppMNRwmi, PDF = CTEQ5L, quark mass = 1.2 GeV, PtHard > 2.76 GeV/c)
2474 // for pp collisions at 14 TeV with one c-cbar pair per event.
2475 // Corresponding NLO total cross section is 5.68 mb
2476
2477
2478   const Double_t kpt0 = 2.2930;
2479   const Double_t kxn  = 3.1196;
2480   Double_t c[3]={-5.2180e-01,1.8753e-01,2.8669e-02};
2481   Double_t x=*px;
2482   //
2483   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2484   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
2485 }
2486 Double_t AliGenMUONlib::PtCharmF1M0S0PP( const Double_t *px, const Double_t */*dummy*/)
2487 {
2488 // Charm pT
2489 // Corresponding NLO total cross section is 6.06 mb
2490   const Double_t kpt0 = 2.8669;
2491   const Double_t kxn  = 3.1044;
2492   Double_t c[3]={-4.6714e-01,1.5005e-01,4.5003e-02};
2493   Double_t x=*px;
2494   //
2495   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2496   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
2497 }
2498 Double_t AliGenMUONlib::PtCharmF2M0S0PP( const Double_t *px, const Double_t */*dummy*/)
2499 {
2500 // Charm pT
2501 // Corresponding NLO total cross section is 6.06 mb
2502   const Double_t kpt0 = 1.8361;
2503   const Double_t kxn  = 3.2966;
2504   Double_t c[3]={-6.1550e-01,2.6498e-01,1.0728e-02};
2505   Double_t x=*px;
2506   //
2507   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2508   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
2509 }
2510 Double_t AliGenMUONlib::PtCharmF0M1S0PP( const Double_t *px, const Double_t */*dummy*/)
2511 {
2512 // Charm pT
2513 // Corresponding NLO total cross section is 7.69 mb
2514   const Double_t kpt0 = 2.1280;
2515   const Double_t kxn  = 3.1397;
2516   Double_t c[3]={-5.4021e-01,2.0944e-01,2.5211e-02};
2517   Double_t x=*px;
2518   //
2519   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2520   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
2521 }
2522 Double_t AliGenMUONlib::PtCharmF0M2S0PP( const Double_t *px, const Double_t */*dummy*/)
2523 {
2524 // Charm pT
2525 // Corresponding NLO total cross section is 4.81 mb
2526   const Double_t kpt0 = 2.4579;
2527   const Double_t kxn  = 3.1095;
2528   Double_t c[3]={-5.1497e-01,1.7532e-01,3.2429e-02};
2529   Double_t x=*px;
2530   //
2531   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2532   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
2533 }
2534 Double_t AliGenMUONlib::PtCharmF0M0S1PP( const Double_t *px, const Double_t */*dummy*/)
2535 {
2536 // Charm pT
2537 // Corresponding NLO total cross section is 14.09 mb
2538   const Double_t kpt0 = 2.1272;
2539   const Double_t kxn  = 3.1904;
2540   Double_t c[3]={-4.6088e-01,2.1918e-01,2.3055e-02};
2541   Double_t x=*px;
2542   //
2543   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2544   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
2545 }
2546 Double_t AliGenMUONlib::PtCharmF0M0S2PP( const Double_t *px, const Double_t */*dummy*/)
2547 {
2548 // Charm pT
2549 // Corresponding NLO total cross section is 1.52 mb
2550   const Double_t kpt0 = 2.8159;
2551   const Double_t kxn  = 3.0857;
2552   Double_t c[3]={-6.4691e-01,2.0289e-01,2.4922e-02};
2553   Double_t x=*px;
2554   //
2555   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2556   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
2557 }
2558 Double_t AliGenMUONlib::PtCharmF0M0S3PP( const Double_t *px, const Double_t */*dummy*/)
2559 {
2560 // Charm pT
2561 // Corresponding NLO total cross section is 3.67 mb
2562   const Double_t kpt0 = 2.7297;
2563   const Double_t kxn  = 3.3019;
2564   Double_t c[3]={-6.2216e-01,1.9031e-01,1.5341e-02};
2565   Double_t x=*px;
2566   //
2567   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2568   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
2569 }
2570 Double_t AliGenMUONlib::PtCharmF0M0S4PP( const Double_t *px, const Double_t */*dummy*/)
2571 {
2572 // Charm pT
2573 // Corresponding NLO total cross section is 3.38 mb
2574   const Double_t kpt0 = 2.3894;
2575   const Double_t kxn  = 3.1075;
2576   Double_t c[3]={-4.9742e-01,1.7032e-01,2.5994e-02};
2577   Double_t x=*px;
2578   //
2579   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2580   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
2581 }
2582 Double_t AliGenMUONlib::PtCharmF0M0S5PP( const Double_t *px, const Double_t */*dummy*/)
2583 {
2584 // Charm pT
2585 // Corresponding NLO total cross section is 10.37 mb
2586   const Double_t kpt0 = 2.0187;
2587   const Double_t kxn  = 3.3011;
2588   Double_t c[3]={-3.9869e-01,2.9248e-01,1.1763e-02};
2589   Double_t x=*px;
2590   //
2591   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2592   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
2593 }
2594 Double_t AliGenMUONlib::PtCharmF0M0S6PP( const Double_t *px, const Double_t */*dummy*/)
2595 {
2596 // Charm pT
2597 // Corresponding NLO total cross section is 7.22 mb
2598   const Double_t kpt0 = 2.1089;
2599   const Double_t kxn  = 3.1848;
2600   Double_t c[3]={-4.6275e-01,1.8114e-01,2.1363e-02};
2601   Double_t x=*px;
2602   //
2603   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2604   return x/TMath::Power(pass1,kxn)*(1.+c[0]*x+c[1]*x*x)/(1.+c[2]*x*x);
2605 }
2606
2607 //                  y-distribution
2608 Double_t AliGenMUONlib::YCharm( const Double_t *px, const Double_t */*dummy*/)
2609 {
2610 // Charm y :: Carrer & Dainese : ALICE-INT-2003-019 v.3 (hep-ph/0311225) 
2611 // Pythia tuned to reproduce the distribution given by the HVQMNR program based on NLO calculations (pQCD)
2612 // shadowing + kt broadening 
2613
2614     Double_t x=px[0];
2615     Double_t c[2]={-2.42985e-03,-2.31001e-04};
2616     Double_t y=1+(c[0]*TMath::Power(x,2))+(c[1]*TMath::Power(x,4));
2617     Double_t ycharm;
2618     
2619     if (TMath::Abs(x)>8) {
2620       ycharm=0.;
2621     }
2622     else {
2623       ycharm=TMath::Power(y,3);
2624     }
2625     
2626     return ycharm;
2627 }
2628 Double_t AliGenMUONlib::YCharmF0M0S0PP( const Double_t *px, const Double_t */*dummy*/)
2629 {
2630 // FiMjSkPP define theoretical uncertainties around F0M0S0PP as follows:
2631 // YCharmFiMjSkPP = YCharmF0M0S0PP * (dN(i,j,k)/dy / dN(0,0,0)/dy)_MNR
2632 //       i=0,1,2;  j=0,1,2;  k=0,1,...,6
2633 // dN(i,j,k)/dy - spectra obtained by A.Dainese (hep-ph/0601164, p.88; 
2634 // http://www-zeus.desy.de/~corradi/benchmarks) from NLO pQCD (MNR) 
2635 // calculations for the following inputs: 
2636 // Peterson fragmentation function (F) with \epsilon_c = 0.02, 0.002 & 0.11 
2637 // for i=0,1 & 2 respectively; quark mass (M) of 1.5, 1.3 & 1.7 GeV 
2638 // for j=0,1 & 2 respectively; 
2639 // factorisation \mu_F = a*mt and renormalisation \mu_R = b*mt scales (S) 
2640 // with a/b = 1/1,1/0.5, 0.5/1, 0.5/0.5, 1/2, 2/1 & 2/2 for 
2641 // k = 0, 1, 2, 3, 4, 5 & 6 respectively; CTEQ6.1 PDF set
2642 // (PDF uncertainty not considered since is small, see hep-ph/0601164, p.89).
2643 // June 2008, Smbat.Grigoryan@cern.ch
2644
2645 // Charm y
2646 // Pythia6.214 (kCharmppMNRwmi, PDF = CTEQ5L, quark mass = 1.2 GeV, PtHard > 2.76 GeV/c)
2647 // for pp collisions at 14 TeV with one c-cbar pair per event.
2648 // Corresponding NLO total cross section is 5.68 mb
2649
2650     Double_t x=px[0];
2651     Double_t c[2]={7.0909e-03,6.1967e-05};
2652     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
2653     Double_t ycharm;
2654     
2655     if (TMath::Abs(x)>9) {
2656       ycharm=0.;
2657     }
2658     else {
2659       ycharm=TMath::Power(y,3);
2660     }
2661     
2662     return ycharm;
2663 }
2664 Double_t AliGenMUONlib::YCharmF1M0S0PP( const Double_t *px, const Double_t */*dummy*/)
2665 {
2666 // Charm y
2667 // Corresponding NLO total cross section is 6.06 mb
2668     Double_t x=px[0];
2669     Double_t c[2]={6.9707e-03,6.0971e-05};
2670     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
2671     Double_t ycharm;
2672     
2673     if (TMath::Abs(x)>9) {
2674       ycharm=0.;
2675     }
2676     else {
2677       ycharm=TMath::Power(y,3);
2678     }
2679     
2680     return ycharm;
2681 }
2682 Double_t AliGenMUONlib::YCharmF2M0S0PP( const Double_t *px, const Double_t */*dummy*/)
2683 {
2684 // Charm y
2685 // Corresponding NLO total cross section is 6.06 mb
2686     Double_t x=px[0];
2687     Double_t c[2]={7.1687e-03,6.5303e-05};
2688     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
2689     Double_t ycharm;
2690     
2691     if (TMath::Abs(x)>9) {
2692       ycharm=0.;
2693     }
2694     else {
2695       ycharm=TMath::Power(y,3);
2696     }
2697     
2698     return ycharm;
2699 }
2700 Double_t AliGenMUONlib::YCharmF0M1S0PP( const Double_t *px, const Double_t */*dummy*/)
2701 {
2702 // Charm y
2703 // Corresponding NLO total cross section is 7.69 mb
2704     Double_t x=px[0];
2705     Double_t c[2]={5.9090e-03,7.1854e-05};
2706     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
2707     Double_t ycharm;
2708     
2709     if (TMath::Abs(x)>9) {
2710       ycharm=0.;
2711     }
2712     else {
2713       ycharm=TMath::Power(y,3);
2714     }
2715     
2716     return ycharm;
2717 }
2718 Double_t AliGenMUONlib::YCharmF0M2S0PP( const Double_t *px, const Double_t */*dummy*/)
2719 {
2720 // Charm y
2721 // Corresponding NLO total cross section is 4.81 mb
2722     Double_t x=px[0];
2723     Double_t c[2]={8.0882e-03,5.5872e-05};
2724     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
2725     Double_t ycharm;
2726     
2727     if (TMath::Abs(x)>9) {
2728       ycharm=0.;
2729     }
2730     else {
2731       ycharm=TMath::Power(y,3);
2732     }
2733     
2734     return ycharm;
2735 }
2736 Double_t AliGenMUONlib::YCharmF0M0S1PP( const Double_t *px, const Double_t */*dummy*/)
2737 {
2738 // Charm y
2739 // Corresponding NLO total cross section is 14.09 mb
2740     Double_t x=px[0];
2741     Double_t c[2]={7.2520e-03,6.2691e-05};
2742     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
2743     Double_t ycharm;
2744     
2745     if (TMath::Abs(x)>9) {
2746       ycharm=0.;
2747     }
2748     else {
2749       ycharm=TMath::Power(y,3);
2750     }
2751     
2752     return ycharm;
2753 }
2754 Double_t AliGenMUONlib::YCharmF0M0S2PP( const Double_t *px, const Double_t */*dummy*/)
2755 {
2756 // Charm y
2757 // Corresponding NLO total cross section is 1.52 mb
2758     Double_t x=px[0];
2759     Double_t c[2]={1.1040e-04,1.4498e-04};
2760     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
2761     Double_t ycharm;
2762     
2763     if (TMath::Abs(x)>9) {
2764       ycharm=0.;
2765     }
2766     else {
2767       ycharm=TMath::Power(y,3);
2768     }
2769     
2770     return ycharm;
2771 }
2772 Double_t AliGenMUONlib::YCharmF0M0S3PP( const Double_t *px, const Double_t */*dummy*/)
2773 {
2774 // Charm y
2775 // Corresponding NLO total cross section is 3.67 mb
2776     Double_t x=px[0];
2777     Double_t c[2]={-3.1328e-03,1.8270e-04};
2778     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
2779     Double_t ycharm;
2780     
2781     if (TMath::Abs(x)>9) {
2782       ycharm=0.;
2783     }
2784     else {
2785       ycharm=TMath::Power(y,3);
2786     }
2787     
2788     return ycharm;
2789 }
2790 Double_t AliGenMUONlib::YCharmF0M0S4PP( const Double_t *px, const Double_t */*dummy*/)
2791 {
2792 // Charm y
2793 // Corresponding NLO total cross section is 3.38 mb
2794     Double_t x=px[0];
2795     Double_t c[2]={7.0865e-03,6.2532e-05};
2796     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
2797     Double_t ycharm;
2798     
2799     if (TMath::Abs(x)>9) {
2800       ycharm=0.;
2801     }
2802     else {
2803       ycharm=TMath::Power(y,3);
2804     }
2805     
2806     return ycharm;
2807 }
2808 Double_t AliGenMUONlib::YCharmF0M0S5PP( const Double_t *px, const Double_t */*dummy*/)
2809 {
2810 // Charm y
2811 // Corresponding NLO total cross section is 10.37 mb
2812     Double_t x=px[0];
2813     Double_t c[2]={7.7070e-03,5.3533e-05};
2814     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
2815     Double_t ycharm;
2816     
2817     if (TMath::Abs(x)>9) {
2818       ycharm=0.;
2819     }
2820     else {
2821       ycharm=TMath::Power(y,3);
2822     }
2823     
2824     return ycharm;
2825 }
2826 Double_t AliGenMUONlib::YCharmF0M0S6PP( const Double_t *px, const Double_t */*dummy*/)
2827 {
2828 // Charm y
2829 // Corresponding NLO total cross section is 7.22 mb
2830     Double_t x=px[0];
2831     Double_t c[2]={7.9195e-03,5.3823e-05};
2832     Double_t y=1-(c[0]*TMath::Power(x,2))-(c[1]*TMath::Power(x,4));
2833     Double_t ycharm;
2834     
2835     if (TMath::Abs(x)>9) {
2836       ycharm=0.;
2837     }
2838     else {
2839       ycharm=TMath::Power(y,3);
2840     }
2841     
2842     return ycharm;
2843 }
2844
2845
2846 Int_t AliGenMUONlib::IpCharm(TRandom *ran)
2847 {  
2848 // Charm composition
2849     Float_t random;
2850     Int_t ip;
2851 //    411,421,431,4122
2852     random = ran->Rndm();
2853 //  Taux de production Carrer & Dainese : ALICE-INT-2003-019 v.3  
2854 //  >>>>> cf. tab 4 p 11
2855   
2856     if (random < 0.30) {                       
2857         ip=421;
2858     } else if (random < 0.60) {
2859         ip=-421;
2860     } else if (random < 0.70) {
2861         ip=411;
2862     } else if (random < 0.80) {
2863         ip=-411;
2864     } else if (random < 0.86) {
2865         ip=431;
2866     } else if (random < 0.92) {
2867         ip=-431;        
2868     } else if (random < 0.96) {
2869         ip=4122;
2870     } else {
2871         ip=-4122;
2872     }
2873     
2874     return ip;
2875 }
2876
2877 //
2878 //                        Beauty
2879 //
2880 //
2881 //                    pt-distribution
2882 //____________________________________________________________
2883 Double_t AliGenMUONlib::PtBeauty( const Double_t *px, const Double_t */*dummy*/)
2884 {
2885 // Beauty pT
2886   const Double_t kpt0 = 6.53;
2887   const Double_t kxn  = 3.59;
2888   Double_t x=*px;
2889   //
2890   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2891   return x/TMath::Power(pass1,kxn);
2892 }
2893
2894 Double_t AliGenMUONlib::PtBeautyCentral( const Double_t *px, const Double_t */*dummy*/)
2895 {
2896 // Beauty pT
2897   const Double_t kpt0 = 6.14;
2898   const Double_t kxn  = 2.93;
2899   Double_t x=*px;
2900   //
2901   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2902   return x/TMath::Power(pass1,kxn);
2903 }
2904 Double_t AliGenMUONlib::PtBeautyF0M0S0PP( const Double_t *px, const Double_t */*dummy*/)
2905 {
2906 // FiMjSkPP define theoretical uncertainties around F0M0S0PP as follows:
2907 // PtBeautyFiMjSkPP = PtBeautyF0M0S0PP * (dN(i,j,k)/dpt / dN(0,0,0)/dpt)_MNR
2908 //       i=0,1,2;  j=0,1,2;  k=0,1,...,6
2909 // dN(i,j,k)/dpt - spectra obtained by A.Dainese (hep-ph/0601164, p.88; 
2910 // http://www-zeus.desy.de/~corradi/benchmarks) from NLO pQCD (MNR) 
2911 // calculations for the following inputs: 
2912 // Peterson fragmentation function (F) with \epsilon_b = 0.001, 0.0002 & 0.004 
2913 // for i=0,1 & 2 respectively; quark mass (M) of 4.75, 4.5 & 5.0 GeV 
2914 // for j=0,1 & 2 respectively; 
2915 // factorisation \mu_F = a*mt and renormalisation \mu_R = b*mt scales (S) 
2916 // with a/b = 1/1, 1/0.5, 0.5/1, 0.5/0.5, 1/2, 2/1 & 2/2 for 
2917 // k = 0, 1, 2, 3, 4, 5 & 6 respectively; CTEQ6.1 PDF set
2918 // (PDF uncertainty not considered since is small, see hep-ph/0601164, p.89).
2919 // June 2008, Smbat.Grigoryan@cern.ch
2920
2921 // Beauty pT
2922 // Pythia6.214 (kBeautyppMNRwmi, PDF = CTEQ5L, quark mass = 4.75 GeV, PtHard > 2.76 GeV/c)
2923 // for pp collisions at 14 TeV with one b-bbar pair per event.
2924 // Corresponding NLO total cross section is 0.494 mb
2925
2926   const Double_t kpt0 = 8.0575;
2927   const Double_t kxn  = 3.1921;
2928   Double_t x=*px;
2929   //
2930   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2931   return x/TMath::Power(pass1,kxn);
2932 }
2933 Double_t AliGenMUONlib::PtBeautyF1M0S0PP( const Double_t *px, const Double_t */*dummy*/)
2934 {
2935 // Beauty pT
2936 // Corresponding NLO total cross section is 0.445 mb
2937   const Double_t kpt0 = 8.6239;
2938   const Double_t kxn  = 3.2911;
2939   Double_t x=*px;
2940   //
2941   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2942   return x/TMath::Power(pass1,kxn);
2943 }
2944 Double_t AliGenMUONlib::PtBeautyF2M0S0PP( const Double_t *px, const Double_t */*dummy*/)
2945 {
2946 // Beauty pT
2947 // Corresponding NLO total cross section is 0.445 mb
2948   const Double_t kpt0 = 7.3367;
2949   const Double_t kxn  = 3.0692;
2950   Double_t x=*px;
2951   //
2952   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2953   return x/TMath::Power(pass1,kxn);
2954 }
2955 Double_t AliGenMUONlib::PtBeautyF0M1S0PP( const Double_t *px, const Double_t */*dummy*/)
2956 {
2957 // Beauty pT
2958 // Corresponding NLO total cross section is 0.518 mb
2959   const Double_t kpt0 = 7.6409;
2960   const Double_t kxn  = 3.1364;
2961   Double_t x=*px;
2962   //
2963   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2964   return x/TMath::Power(pass1,kxn);
2965 }
2966 Double_t AliGenMUONlib::PtBeautyF0M2S0PP( const Double_t *px, const Double_t */*dummy*/)
2967 {
2968 // Beauty pT
2969 // Corresponding NLO total cross section is 0.384 mb
2970   const Double_t kpt0 = 8.4948;
2971   const Double_t kxn  = 3.2546;
2972   Double_t x=*px;
2973   //
2974   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2975   return x/TMath::Power(pass1,kxn);
2976 }
2977 Double_t AliGenMUONlib::PtBeautyF0M0S1PP( const Double_t *px, const Double_t */*dummy*/)
2978 {
2979 // Beauty pT
2980 // Corresponding NLO total cross section is 0.648 mb
2981   const Double_t kpt0 = 7.6631;
2982   const Double_t kxn  = 3.1621;
2983   Double_t x=*px;
2984   //
2985   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2986   return x/TMath::Power(pass1,kxn);
2987 }
2988 Double_t AliGenMUONlib::PtBeautyF0M0S2PP( const Double_t *px, const Double_t */*dummy*/)
2989 {
2990 // Beauty pT
2991 // Corresponding NLO total cross section is 0.294 mb
2992   const Double_t kpt0 = 8.7245;
2993   const Double_t kxn  = 3.2213;
2994   Double_t x=*px;
2995   //
2996   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
2997   return x/TMath::Power(pass1,kxn);
2998 }
2999 Double_t AliGenMUONlib::PtBeautyF0M0S3PP( const Double_t *px, const Double_t */*dummy*/)
3000 {
3001 // Beauty pT
3002 // Corresponding NLO total cross section is 0.475 mb
3003   const Double_t kpt0 = 8.5296;
3004   const Double_t kxn  = 3.2187;
3005   Double_t x=*px;
3006   //
3007   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
3008   return x/TMath::Power(pass1,kxn);
3009 }
3010 Double_t AliGenMUONlib::PtBeautyF0M0S4PP( const Double_t *px, const Double_t */*dummy*/)
3011 {
3012 // Beauty pT
3013 // Corresponding NLO total cross section is 0.324 mb
3014   const Double_t kpt0 = 7.9440;
3015   const Double_t kxn  = 3.1614;
3016   Double_t x=*px;
3017   //
3018   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
3019   return x/TMath::Power(pass1,kxn);
3020 }
3021 Double_t AliGenMUONlib::PtBeautyF0M0S5PP( const Double_t *px, const Double_t */*dummy*/)
3022 {
3023 // Beauty pT
3024 // Corresponding NLO total cross section is 0.536 mb
3025   const Double_t kpt0 = 8.2408;
3026   const Double_t kxn  = 3.3029;
3027   Double_t x=*px;
3028   //
3029   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
3030   return x/TMath::Power(pass1,kxn);
3031 }
3032 Double_t AliGenMUONlib::PtBeautyF0M0S6PP( const Double_t *px, const Double_t */*dummy*/)
3033 {
3034 // Beauty pT
3035 // Corresponding NLO total cross section is 0.420 mb
3036   const Double_t kpt0 = 7.8041;
3037   const Double_t kxn  = 3.2094;
3038   Double_t x=*px;
3039   //
3040   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
3041   return x/TMath::Power(pass1,kxn);
3042 }
3043
3044 //                     y-distribution
3045 Double_t AliGenMUONlib::YBeauty( const Double_t *px, const Double_t */*dummy*/)
3046 {
3047 // Beauty y :: Carrer & Dainese : ALICE-INT-2003-019 v.3 (hep-ph/0311225) 
3048 // Pythia tuned to reproduce the distribution given by the HVQMNR program based on NLO calculations (pQCD)
3049 // shadowing + kt broadening 
3050
3051     Double_t x=px[0];
3052     Double_t c[2]={-1.27590e-02,-2.42731e-04};
3053     Double_t y=1+c[0]*TMath::Power(x,2)+c[1]*TMath::Power(x,4);
3054     Double_t ybeauty;
3055     
3056     if (TMath::Abs(x)>6) {
3057       ybeauty=0.;
3058     }
3059     else {
3060       ybeauty=TMath::Power(y,3);
3061     }
3062     
3063     return ybeauty;
3064 }
3065 Double_t AliGenMUONlib::YBeautyF0M0S0PP( const Double_t *px, const Double_t */*dummy*/)
3066 {
3067 // FiMjSkPP define theoretical uncertainties around F0M0S0PP as follows:
3068 // YBeautyFiMjSkPP = YBeautyF0M0S0PP * (dN(i,j,k)/dy / dN(0,0,0)/dy)_MNR
3069 //       i=0,1,2;  j=0,1,2;  k=0,1,...,6
3070 // dN(i,j,k)/dy - spectra obtained by A.Dainese (hep-ph/0601164, p.88; 
3071 // http://www-zeus.desy.de/~corradi/benchmarks) from NLO pQCD (MNR) 
3072 // calculations for the following inputs: 
3073 // Peterson fragmentation function (F) with \epsilon_b = 0.001, 0.0002 & 0.004 
3074 // for i=0,1 & 2 respectively; quark mass (M) of 4.75, 4.5 & 5.0 GeV 
3075 // for j=0,1 & 2 respectively; 
3076 // factorisation \mu_F = a*mt and renormalisation \mu_R = b*mt scales (S) 
3077 // with a/b = 1/1, 1/0.5, 0.5/1, 0.5/0.5, 1/2, 2/1 & 2/2 
3078 // for k = 0, 1, 2, 3, 4, 5 & 6 respectively; CTEQ6.1 PDF set 
3079 // (PDF uncertainty not considered since is small, see hep-ph/0601164, p.89).
3080 // June 2008, Smbat.Grigoryan@cern.ch
3081
3082 // Beauty y
3083 // Pythia6.214 (kBeautyppMNRwmi, PDF = CTEQ5L, quark mass = 4.75 GeV, PtHard > 2.76 GeV/c)
3084 // for pp collisions at 14 TeV with one b-bbar pair per event.
3085 // Corresponding NLO total cross section is 0.494 mb
3086
3087
3088     Double_t x=px[0];
3089     Double_t c[2]={1.2350e-02,9.2667e-05};
3090     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
3091     Double_t ybeauty;
3092     
3093     if (TMath::Abs(x)>7.6) {
3094       ybeauty=0.;
3095     }
3096     else {
3097       ybeauty=TMath::Power(y,3);
3098     }
3099     
3100     return ybeauty;
3101 }
3102 Double_t AliGenMUONlib::YBeautyF1M0S0PP( const Double_t *px, const Double_t */*dummy*/)
3103 {
3104 // Beauty y
3105 // Corresponding NLO total cross section is 0.445 mb
3106     Double_t x=px[0];
3107     Double_t c[2]={1.2292e-02,9.1847e-05};
3108     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
3109     Double_t ybeauty;
3110     
3111     if (TMath::Abs(x)>7.6) {
3112       ybeauty=0.;
3113     }
3114     else {
3115       ybeauty=TMath::Power(y,3);
3116     }
3117     
3118     return ybeauty;
3119 }
3120 Double_t AliGenMUONlib::YBeautyF2M0S0PP( const Double_t *px, const Double_t */*dummy*/)
3121 {
3122 // Beauty y
3123 // Corresponding NLO total cross section is 0.445 mb
3124     Double_t x=px[0];
3125     Double_t c[2]={1.2436e-02,9.3709e-05};
3126     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
3127     Double_t ybeauty;
3128     
3129     if (TMath::Abs(x)>7.6) {
3130       ybeauty=0.;
3131     }
3132     else {
3133       ybeauty=TMath::Power(y,3);
3134     }
3135     
3136     return ybeauty;
3137 }
3138 Double_t AliGenMUONlib::YBeautyF0M1S0PP( const Double_t *px, const Double_t */*dummy*/)
3139 {
3140 // Beauty y
3141 // Corresponding NLO total cross section is 0.518 mb
3142     Double_t x=px[0];
3143     Double_t c[2]={1.1714e-02,1.0068e-04};
3144     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
3145     Double_t ybeauty;
3146     
3147     if (TMath::Abs(x)>7.6) {
3148       ybeauty=0.;
3149     }
3150     else {
3151       ybeauty=TMath::Power(y,3);
3152     }
3153     
3154     return ybeauty;
3155 }
3156 Double_t AliGenMUONlib::YBeautyF0M2S0PP( const Double_t *px, const Double_t */*dummy*/)
3157 {
3158 // Beauty y
3159 // Corresponding NLO total cross section is 0.384 mb
3160     Double_t x=px[0];
3161     Double_t c[2]={1.2944e-02,8.5500e-05};
3162     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
3163     Double_t ybeauty;
3164     
3165     if (TMath::Abs(x)>7.6) {
3166       ybeauty=0.;
3167     }
3168     else {
3169       ybeauty=TMath::Power(y,3);
3170     }
3171     
3172     return ybeauty;
3173 }
3174 Double_t AliGenMUONlib::YBeautyF0M0S1PP( const Double_t *px, const Double_t */*dummy*/)
3175 {
3176 // Beauty y
3177 // Corresponding NLO total cross section is 0.648 mb
3178     Double_t x=px[0];
3179     Double_t c[2]={1.2455e-02,9.2713e-05};
3180     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
3181     Double_t ybeauty;
3182     
3183     if (TMath::Abs(x)>7.6) {
3184       ybeauty=0.;
3185     }
3186     else {
3187       ybeauty=TMath::Power(y,3);
3188     }
3189     
3190     return ybeauty;
3191 }
3192 Double_t AliGenMUONlib::YBeautyF0M0S2PP( const Double_t *px, const Double_t */*dummy*/)
3193 {
3194 // Beauty y
3195 // Corresponding NLO total cross section is 0.294 mb
3196     Double_t x=px[0];
3197     Double_t c[2]={1.0897e-02,1.1878e-04};
3198     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
3199     Double_t ybeauty;
3200     
3201     if (TMath::Abs(x)>7.6) {
3202       ybeauty=0.;
3203     }
3204     else {
3205       ybeauty=TMath::Power(y,3);
3206     }
3207     
3208     return ybeauty;
3209 }
3210 Double_t AliGenMUONlib::YBeautyF0M0S3PP( const Double_t *px, const Double_t */*dummy*/)
3211 {
3212 // Beauty y
3213 // Corresponding NLO total cross section is 0.475 mb
3214     Double_t x=px[0];
3215     Double_t c[2]={1.0912e-02,1.1858e-04};
3216     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
3217     Double_t ybeauty;
3218     
3219     if (TMath::Abs(x)>7.6) {
3220       ybeauty=0.;
3221     }
3222     else {
3223       ybeauty=TMath::Power(y,3);
3224     }
3225     
3226     return ybeauty;
3227 }
3228 Double_t AliGenMUONlib::YBeautyF0M0S4PP( const Double_t *px, const Double_t */*dummy*/)
3229 {
3230 // Beauty y
3231 // Corresponding NLO total cross section is 0.324 mb
3232     Double_t x=px[0];
3233     Double_t c[2]={1.2378e-02,9.2490e-05};
3234     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
3235     Double_t ybeauty;
3236     
3237     if (TMath::Abs(x)>7.6) {
3238       ybeauty=0.;
3239     }
3240     else {
3241       ybeauty=TMath::Power(y,3);
3242     }
3243     
3244     return ybeauty;
3245 }
3246 Double_t AliGenMUONlib::YBeautyF0M0S5PP( const Double_t *px, const Double_t */*dummy*/)
3247 {
3248 // Beauty y
3249 // Corresponding NLO total cross section is 0.536 mb
3250     Double_t x=px[0];
3251     Double_t c[2]={1.2886e-02,8.2912e-05};
3252     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
3253     Double_t ybeauty;
3254     
3255     if (TMath::Abs(x)>7.6) {
3256       ybeauty=0.;
3257     }
3258     else {
3259       ybeauty=TMath::Power(y,3);
3260     }
3261     
3262     return ybeauty;
3263 }
3264 Double_t AliGenMUONlib::YBeautyF0M0S6PP( const Double_t *px, const Double_t */*dummy*/)
3265 {
3266 // Beauty y
3267 // Corresponding NLO total cross section is 0.420 mb
3268     Double_t x=px[0];
3269     Double_t c[2]={1.3106e-02,8.0115e-05};
3270     Double_t y=1-c[0]*TMath::Power(x,2)-c[1]*TMath::Power(x,4);
3271     Double_t ybeauty;
3272     
3273     if (TMath::Abs(x)>7.6) {
3274       ybeauty=0.;
3275     }
3276     else {
3277       ybeauty=TMath::Power(y,3);
3278     }
3279     
3280     return ybeauty;
3281 }
3282
3283 Int_t AliGenMUONlib::IpBeauty(TRandom *ran)
3284 {  
3285 // Beauty Composition
3286     Float_t random;
3287     Int_t ip;
3288     random = ran->Rndm(); 
3289     
3290 //  Taux de production Carrer & Dainese : ALICE-INT-2003-019 v.3  
3291 //  >>>>> cf. tab 4 p 11
3292     
3293  if (random < 0.20) {                       
3294         ip=511;
3295     } else if (random < 0.40) {
3296         ip=-511;
3297     } else if (random < 0.605) {
3298         ip=521;
3299     } else if (random < 0.81) {
3300         ip=-521;
3301     } else if (random < 0.87) {
3302         ip=531;
3303     } else if (random < 0.93) {
3304         ip=-531;        
3305     } else if (random < 0.965) {
3306         ip=5122;
3307     } else {
3308         ip=-5122;
3309     }
3310     
3311  return ip;
3312 }
3313
3314
3315 typedef Double_t (*GenFunc) (const Double_t*,  const Double_t*);
3316 GenFunc AliGenMUONlib::GetPt(Int_t param,  const char* tname) const
3317 {
3318 // Return pointer to pT parameterisation
3319     TString sname = TString(tname);
3320     GenFunc func;
3321     switch (param) 
3322     {
3323     case kPhi:
3324         func=PtPhi;
3325         break;
3326     case kOmega:
3327         func=PtOmega;
3328         break;
3329     case kEta:
3330         func=PtEta;
3331         break;
3332     case kJpsiFamily:
3333     case kPsiP:
3334     case kChic1:
3335     case kChic2:
3336     case kJpsi:
3337         if (sname == "Vogt" || sname == "Vogt PbPb") {
3338             func=PtJpsiPbPb;
3339         } else if (sname == "Vogt pp") {
3340             func=PtJpsiPP;
3341         } else if (sname == "pp 7") {
3342             func=PtJpsiPP7000;
3343         } else if (sname == "pp 2.76") {
3344             func=PtJpsiPP2760;
3345         } else if (sname == "PbPb 2.76") {
3346             func=PtJpsiPbPb2760;
3347         } else if (sname == "PbPb 2.76c1") {
3348             func=PtJpsiPbPb2760c1;
3349         } else if (sname == "PbPb 2.76c2") {
3350             func=PtJpsiPbPb2760c2;
3351         } else if (sname == "PbPb 2.76c3") {
3352             func=PtJpsiPbPb2760c3;
3353         } else if (sname == "PbPb 2.76c4") {
3354             func=PtJpsiPbPb2760c4;
3355         } else if (sname == "PbPb 2.76c5") {
3356             func=PtJpsiPbPb2760c5;
3357         } else if (sname == "PbPb 2.76c6") {
3358             func=PtJpsiPbPb2760c6;
3359         } else if (sname == "PbPb 2.76c7") {
3360             func=PtJpsiPbPb2760c7;
3361         } else if (sname == "PbPb 2.76c8") {
3362             func=PtJpsiPbPb2760c8;
3363         } else if (sname == "PbPb 2.76c9") {
3364             func=PtJpsiPbPb2760c9;
3365         } else if (sname == "PbPb 2.76c10") {
3366             func=PtJpsiPbPb2760c10;
3367         } else if (sname == "PbPb 2.76c11") {
3368             func=PtJpsiPbPb2760c11;
3369         } else if (sname == "pp 7 poly") {
3370             func=PtJpsiPP7000;
3371         } else if (sname == "pp 2.76 poly") {
3372             func=PtJpsiPP2760;
3373         } else if (sname == "pp 8.8") {
3374             func=PtJpsiPP8800;
3375         } else if (sname == "pPb 8.8") {
3376             func=PtJpsiPPb8800;
3377         } else if (sname == "pPb 8.8c1") {
3378             func=PtJpsiPPb8800c1;
3379         } else if (sname == "pPb 8.8c2") {
3380             func=PtJpsiPPb8800c2;
3381         } else if (sname == "pPb 8.8c3") {
3382             func=PtJpsiPPb8800c3;
3383         } else if (sname == "pPb 8.8c4") {
3384             func=PtJpsiPPb8800c4;
3385         } else if (sname == "Pbp 8.8") {
3386             func=PtJpsiPbP8800;
3387         } else if (sname == "Pbp 8.8c1") {
3388             func=PtJpsiPbP8800c1;
3389         } else if (sname == "Pbp 8.8c2") {
3390             func=PtJpsiPbP8800c2;
3391         } else if (sname == "Pbp 8.8c3") {
3392             func=PtJpsiPbP8800c3;
3393         } else if (sname == "Pbp 8.8c4") {
3394             func=PtJpsiPbP8800c4;
3395         } else if (sname == "CDF scaled") {
3396             func=PtJpsiCDFscaled;
3397         } else if (sname == "CDF pp") {
3398             func=PtJpsiCDFscaledPP;
3399         } else if (sname == "CDF pp 10") {
3400             func=PtJpsiCDFscaledPP10;
3401         } else if (sname == "CDF pp 8.8") {
3402             func=PtJpsiCDFscaledPP9;
3403         } else if (sname == "CDF pp 7" || sname == "CDF pp 7 flat y") {
3404             func=PtJpsiCDFscaledPP7;
3405         } else if (sname == "CDF pp 3.94") {
3406             func=PtJpsiCDFscaledPP4;
3407         } else if (sname == "CDF pp 2.76") {
3408             func=PtJpsiCDFscaledPP3;
3409         } else if (sname == "CDF pp 1.9") {
3410             func=PtJpsiCDFscaledPP2;
3411         } else if (sname == "CDF pPb 8.8") {
3412             func=PtJpsiCDFscaledPPb9;
3413         } else if (sname == "CDF Pbp 8.8") {
3414             func=PtJpsiCDFscaledPbP9;
3415         } else if (sname == "CDF PbPb 3.94") {
3416             func=PtJpsiCDFscaledPbPb4;
3417         } else if (sname == "Flat" || sname == "CDF pp 7 flat pt") {
3418             func=PtJpsiFlat;
3419         } else {
3420             func=PtJpsi;
3421         }
3422         break;
3423     case kJpsiFromB:
3424         func = PtJpsiBPbPb;
3425         break;
3426     case kUpsilonFamily:
3427     case kUpsilonP:
3428     case kUpsilonPP:
3429     case kUpsilon:
3430         if (sname == "Vogt" || sname == "Vogt PbPb") {
3431             func=PtUpsilonPbPb;
3432         } else if (sname == "Vogt pp") {
3433             func=PtUpsilonPP;
3434         } else if (sname == "pp 7") {
3435             func=PtUpsilonPP7000;
3436         } else if (sname == "pp 2.76") {
3437             func=PtUpsilonPP2760;
3438         } else if (sname == "PbPb 2.76") {
3439             func=PtUpsilonPbPb2760;
3440         } else if (sname == "PbPb 2.76c1") {
3441             func=PtUpsilonPbPb2760c1;
3442         } else if (sname == "PbPb 2.76c2") {
3443             func=PtUpsilonPbPb2760c2;
3444         } else if (sname == "PbPb 2.76c3") {
3445             func=PtUpsilonPbPb2760c3;
3446         } else if (sname == "PbPb 2.76c4") {
3447             func=PtUpsilonPbPb2760c4;
3448         } else if (sname == "PbPb 2.76c5") {
3449             func=PtUpsilonPbPb2760c5;
3450         } else if (sname == "PbPb 2.76c6") {
3451             func=PtUpsilonPbPb2760c6;
3452         } else if (sname == "PbPb 2.76c7") {
3453             func=PtUpsilonPbPb2760c7;
3454         } else if (sname == "PbPb 2.76c8") {
3455             func=PtUpsilonPbPb2760c8;
3456         } else if (sname == "PbPb 2.76c9") {
3457             func=PtUpsilonPbPb2760c9;
3458         } else if (sname == "PbPb 2.76c10") {
3459             func=PtUpsilonPbPb2760c10;
3460         } else if (sname == "PbPb 2.76c11") {
3461             func=PtUpsilonPbPb2760c11;
3462         } else if (sname == "pp 7 poly") {
3463             func=PtUpsilonPP7000;
3464         } else if (sname == "pp 2.76 poly") {
3465             func=PtUpsilonPP2760;
3466         } else if (sname == "pp 8.8") {
3467             func=PtUpsilonPP8800;
3468         } else if (sname == "pPb 8.8") {
3469             func=PtUpsilonPPb8800;
3470         } else if (sname == "pPb 8.8c1") {
3471             func=PtUpsilonPPb8800c1;
3472         } else if (sname == "pPb 8.8c2") {
3473             func=PtUpsilonPPb8800c2;
3474         } else if (sname == "pPb 8.8c3") {
3475             func=PtUpsilonPPb8800c3;
3476         } else if (sname == "pPb 8.8c4") {
3477             func=PtUpsilonPPb8800c4;
3478         } else if (sname == "Pbp 8.8") {
3479             func=PtUpsilonPbP8800;
3480         } else if (sname == "Pbp 8.8c1") {
3481             func=PtUpsilonPbP8800c1;
3482         } else if (sname == "Pbp 8.8c2") {
3483             func=PtUpsilonPbP8800c2;
3484         } else if (sname == "Pbp 8.8c3") {
3485             func=PtUpsilonPbP8800c3;
3486         } else if (sname == "Pbp 8.8c4") {
3487             func=PtUpsilonPbP8800c4;
3488         } else if (sname == "CDF scaled") {
3489             func=PtUpsilonCDFscaled;
3490         } else if (sname == "CDF pp") {
3491             func=PtUpsilonCDFscaledPP;
3492         } else if (sname == "CDF pp 10") {
3493             func=PtUpsilonCDFscaledPP10;
3494         } else if (sname == "CDF pp 8.8") {
3495             func=PtUpsilonCDFscaledPP9;
3496         } else if (sname == "CDF pp 7") {
3497             func=PtUpsilonCDFscaledPP7;
3498         } else if (sname == "CDF pp 3.94") {
3499             func=PtUpsilonCDFscaledPP4;
3500         } else if (sname == "CDF pPb 8.8") {
3501             func=PtUpsilonCDFscaledPPb9;
3502         } else if (sname == "CDF Pbp 8.8") {
3503             func=PtUpsilonCDFscaledPbP9;
3504         } else if (sname == "CDF PbPb 3.94") {
3505             func=PtUpsilonCDFscaledPbPb4;
3506         } else if (sname == "Flat") {
3507             func=PtUpsilonFlat;
3508         } else {
3509             func=PtUpsilon;
3510         }
3511         break;  
3512     case kCharm:
3513         if (sname == "F0M0S0 pp") {
3514             func=PtCharmF0M0S0PP;
3515         } else if (sname == "F1M0S0 pp") {
3516             func=PtCharmF1M0S0PP;
3517         } else if (sname == "F2M0S0 pp") {
3518             func=PtCharmF2M0S0PP;
3519         } else if (sname == "F0M1S0 pp") {
3520             func=PtCharmF0M1S0PP;
3521         } else if (sname == "F0M2S0 pp") {
3522             func=PtCharmF0M2S0PP;
3523         } else if (sname == "F0M0S1 pp") {
3524             func=PtCharmF0M0S1PP;
3525         } else if (sname == "F0M0S2 pp") {
3526             func=PtCharmF0M0S2PP;
3527         } else if (sname == "F0M0S3 pp") {
3528             func=PtCharmF0M0S3PP;
3529         } else if (sname == "F0M0S4 pp") {
3530             func=PtCharmF0M0S4PP;
3531         } else if (sname == "F0M0S5 pp") {
3532             func=PtCharmF0M0S5PP;
3533         } else if (sname == "F0M0S6 pp") {
3534             func=PtCharmF0M0S6PP;
3535         } else if (sname == "central") {
3536             func=PtCharmCentral;
3537         } else {
3538             func=PtCharm;
3539         }
3540         break;
3541     case kBeauty:
3542         if (sname == "F0M0S0 pp") {
3543             func=PtBeautyF0M0S0PP;
3544         } else if (sname == "F1M0S0 pp") {
3545             func=PtBeautyF1M0S0PP;
3546         } else if (sname == "F2M0S0 pp") {
3547             func=PtBeautyF2M0S0PP;
3548         } else if (sname == "F0M1S0 pp") {
3549             func=PtBeautyF0M1S0PP;
3550         } else if (sname == "F0M2S0 pp") {
3551             func=PtBeautyF0M2S0PP;
3552         } else if (sname == "F0M0S1 pp") {
3553             func=PtBeautyF0M0S1PP;
3554         } else if (sname == "F0M0S2 pp") {
3555             func=PtBeautyF0M0S2PP;
3556         } else if (sname == "F0M0S3 pp") {
3557             func=PtBeautyF0M0S3PP;
3558         } else if (sname == "F0M0S4 pp") {
3559             func=PtBeautyF0M0S4PP;
3560         } else if (sname == "F0M0S5 pp") {
3561             func=PtBeautyF0M0S5PP;
3562         } else if (sname == "F0M0S6 pp") {
3563             func=PtBeautyF0M0S6PP;
3564         } else if (sname == "central") {
3565             func=PtBeautyCentral;
3566         } else {
3567             func=PtBeauty;
3568         }
3569         break;
3570     case kPion:
3571         if (sname == "2010 Pos PP") {
3572             func=PtPionPos2010PP;
3573         } else if (sname == "2010 Neg PP") {
3574             func=PtPionNeg2010PP;
3575         } else {
3576             func=PtPion;
3577         }
3578         break;
3579     case kKaon:
3580         if (sname == "2010 Pos PP") {
3581             func=PtKaonPos2010PP;
3582         } else if (sname == "2010 Neg PP") {
3583             func=PtKaonNeg2010PP;
3584         } else {
3585             func=PtKaon;
3586         }
3587         break;
3588     case kChic0:
3589         func=PtChic0;
3590         break;
3591     case kChic:
3592         func=PtChic;
3593         break;
3594     default:
3595         func=0;
3596         printf("<AliGenMUONlib::GetPt> unknown parametrisation\n");
3597     }
3598     return func;
3599 }
3600
3601 GenFunc AliGenMUONlib::GetY(Int_t param, const char* tname) const
3602 {
3603   //    
3604   // Return pointer to y- parameterisation
3605   //
3606     TString sname = TString(tname);
3607     GenFunc func;
3608     switch (param) 
3609     {
3610     case kPhi:
3611         func=YPhi;
3612         break;
3613     case kEta:
3614         func=YEta;
3615         break;
3616     case kOmega:
3617         func=YOmega;
3618         break;
3619     case kJpsiFamily:
3620     case kPsiP:
3621     case kChic1:
3622     case kChic2:
3623     case kJpsi:
3624         if (sname == "Vogt" || sname == "Vogt PbPb") {
3625             func=YJpsiPbPb;
3626         } else if (sname == "Vogt pp"){
3627             func=YJpsiPP;
3628         } else if (sname == "pp 7") {
3629             func=YJpsiPP7000;
3630         } else if (sname == "pp 2.76") {
3631             func=YJpsiPP2760;
3632         } else if (sname == "PbPb 2.76") {
3633             func=YJpsiPbPb2760;
3634         } else if (sname == "PbPb 2.76c1") {
3635             func=YJpsiPbPb2760c1;
3636         } else if (sname == "PbPb 2.76c2") {
3637             func=YJpsiPbPb2760c2;
3638         } else if (sname == "PbPb 2.76c3") {
3639             func=YJpsiPbPb2760c3;
3640         } else if (sname == "PbPb 2.76c4") {
3641             func=YJpsiPbPb2760c4;
3642         } else if (sname == "PbPb 2.76c5") {
3643             func=YJpsiPbPb2760c5;
3644         } else if (sname == "PbPb 2.76c6") {
3645             func=YJpsiPbPb2760c6;
3646         } else if (sname == "PbPb 2.76c7") {
3647             func=YJpsiPbPb2760c7;
3648         } else if (sname == "PbPb 2.76c8") {
3649             func=YJpsiPbPb2760c8;
3650         } else if (sname == "PbPb 2.76c9") {
3651             func=YJpsiPbPb2760c9;
3652         } else if (sname == "PbPb 2.76c10") {
3653             func=YJpsiPbPb2760c10;
3654         } else if (sname == "PbPb 2.76c11") {
3655             func=YJpsiPbPb2760c11;
3656         } else if (sname == "pp 7 poly") {
3657             func=YJpsiPPpoly7000;
3658         } else if (sname == "pp 2.76 poly") {
3659             func=YJpsiPPpoly2760;
3660         } else if (sname == "pp 8.8") {
3661             func=YJpsiPP8800;
3662         } else if (sname == "pPb 8.8") {
3663             func=YJpsiPPb8800;
3664         } else if (sname == "pPb 8.8c1") {
3665             func=YJpsiPPb8800c1;
3666         } else if (sname == "pPb 8.8c2") {
3667             func=YJpsiPPb8800c2;
3668         } else if (sname == "pPb 8.8c3") {
3669             func=YJpsiPPb8800c3;
3670         } else if (sname == "pPb 8.8c4") {
3671             func=YJpsiPPb8800c4;
3672         } else if (sname == "Pbp 8.8") {
3673             func=YJpsiPbP8800;
3674         } else if (sname == "Pbp 8.8c1") {
3675             func=YJpsiPbP8800c1;
3676         } else if (sname == "Pbp 8.8c2") {
3677             func=YJpsiPbP8800c2;
3678         } else if (sname == "Pbp 8.8c3") {
3679             func=YJpsiPbP8800c3;
3680         } else if (sname == "Pbp 8.8c4") {
3681             func=YJpsiPbP8800c4;
3682         } else if (sname == "CDF scaled") {
3683             func=YJpsiCDFscaled;
3684         } else if (sname == "CDF pp") {
3685             func=YJpsiCDFscaledPP;
3686         } else if (sname == "CDF pp 10") {
3687             func=YJpsiCDFscaledPP10;
3688         } else if (sname == "CDF pp 8.8") {
3689             func=YJpsiCDFscaledPP9;
3690         } else if (sname == "CDF pp 7" || sname == "CDF pp 7 flat pt") {
3691             func=YJpsiCDFscaledPP7;
3692         } else if (sname == "CDF pp 3.94") {
3693             func=YJpsiCDFscaledPP4;
3694         } else if (sname == "CDF pp 2.76") {
3695             func=YJpsiCDFscaledPP3;
3696         } else if (sname == "CDF pp 1.9") {
3697             func=YJpsiCDFscaledPP2;
3698         } else if (sname == "CDF pPb 8.8") {
3699             func=YJpsiCDFscaledPPb9;
3700         } else if (sname == "CDF Pbp 8.8") {
3701             func=YJpsiCDFscaledPbP9;
3702         } else if (sname == "CDF PbPb 3.94") {
3703             func=YJpsiCDFscaledPbPb4;
3704         } else if (sname == "Flat" || sname == "CDF pp 7 flat y") {
3705             func=YJpsiFlat;
3706         } else {
3707             func=YJpsi;
3708         }
3709         break;
3710     case kJpsiFromB:
3711         func = YJpsiBPbPb;
3712         break;
3713     case kUpsilonFamily:
3714     case kUpsilonP:
3715     case kUpsilonPP:
3716     case kUpsilon:
3717         if (sname == "Vogt" || sname == "Vogt PbPb") {
3718             func=YUpsilonPbPb;
3719         } else if (sname == "Vogt pp") {
3720             func = YUpsilonPP;
3721         } else if (sname == "pp 7") {
3722             func=YUpsilonPP7000;
3723         } else if (sname == "pp 2.76") {
3724             func=YUpsilonPP2760;
3725         } else if (sname == "PbPb 2.76") {
3726             func=YUpsilonPbPb2760;
3727         } else if (sname == "PbPb 2.76c1") {
3728             func=YUpsilonPbPb2760c1;
3729         } else if (sname == "PbPb 2.76c2") {
3730             func=YUpsilonPbPb2760c2;
3731         } else if (sname == "PbPb 2.76c3") {
3732             func=YUpsilonPbPb2760c3;
3733         } else if (sname == "PbPb 2.76c4") {
3734             func=YUpsilonPbPb2760c4;
3735         } else if (sname == "PbPb 2.76c5") {
3736             func=YUpsilonPbPb2760c5;
3737         } else if (sname == "PbPb 2.76c6") {
3738             func=YUpsilonPbPb2760c6;
3739         } else if (sname == "PbPb 2.76c7") {
3740             func=YUpsilonPbPb2760c7;
3741         } else if (sname == "PbPb 2.76c8") {
3742             func=YUpsilonPbPb2760c8;
3743         } else if (sname == "PbPb 2.76c9") {
3744             func=YUpsilonPbPb2760c9;
3745         } else if (sname == "PbPb 2.76c10") {
3746             func=YUpsilonPbPb2760c10;
3747         } else if (sname == "PbPb 2.76c11") {
3748             func=YUpsilonPbPb2760c11;
3749         } else if (sname == "pp 7 poly") {
3750             func=YUpsilonPPpoly7000;
3751         } else if (sname == "pp 2.76 poly") {
3752             func=YUpsilonPPpoly2760;
3753         } else if (sname == "pp 8.8") {
3754             func=YUpsilonPP8800;
3755         } else if (sname == "pPb 8.8") {
3756             func=YUpsilonPPb8800;
3757         } else if (sname == "pPb 8.8c1") {
3758             func=YUpsilonPPb8800c1;
3759         } else if (sname == "pPb 8.8c2") {
3760             func=YUpsilonPPb8800c2;
3761         } else if (sname == "pPb 8.8c3") {
3762             func=YUpsilonPPb8800c3;
3763         } else if (sname == "pPb 8.8c4") {
3764             func=YUpsilonPPb8800c4;
3765         } else if (sname == "Pbp 8.8") {
3766             func=YUpsilonPbP8800;
3767         } else if (sname == "Pbp 8.8c1") {
3768             func=YUpsilonPbP8800c1;
3769         } else if (sname == "Pbp 8.8c2") {
3770             func=YUpsilonPbP8800c2;
3771         } else if (sname == "Pbp 8.8c3") {
3772             func=YUpsilonPbP8800c3;
3773         } else if (sname == "Pbp 8.8c4") {
3774             func=YUpsilonPbP8800c4;
3775         } else if (sname == "CDF scaled") {
3776             func=YUpsilonCDFscaled;
3777         } else if (sname == "CDF pp") {
3778             func=YUpsilonCDFscaledPP;
3779         } else if (sname == "CDF pp 10") {
3780             func=YUpsilonCDFscaledPP10;
3781         } else if (sname == "CDF pp 8.8") {
3782             func=YUpsilonCDFscaledPP9;
3783         } else if (sname == "CDF pp 7") {
3784             func=YUpsilonCDFscaledPP7;
3785         } else if (sname == "CDF pp 3.94") {
3786             func=YUpsilonCDFscaledPP4;
3787         } else if (sname == "CDF pPb 8.8") {
3788             func=YUpsilonCDFscaledPPb9;
3789         } else if (sname == "CDF Pbp 8.8") {
3790             func=YUpsilonCDFscaledPbP9;
3791         } else if (sname == "CDF PbPb 3.94") {
3792             func=YUpsilonCDFscaledPbPb4;
3793         } else if (sname == "Flat") {
3794             func=YUpsilonFlat;
3795         } else {
3796             func=YUpsilon;
3797         }
3798         break;
3799     case kCharm:
3800         if (sname == "F0M0S0 pp") {
3801             func=YCharmF0M0S0PP;
3802         } else if (sname == "F1M0S0 pp") {
3803             func=YCharmF1M0S0PP;
3804         } else if (sname == "F2M0S0 pp") {
3805             func=YCharmF2M0S0PP;
3806         } else if (sname == "F0M1S0 pp") {
3807             func=YCharmF0M1S0PP;
3808         } else if (sname == "F0M2S0 pp") {
3809             func=YCharmF0M2S0PP;
3810         } else if (sname == "F0M0S1 pp") {
3811             func=YCharmF0M0S1PP;
3812         } else if (sname == "F0M0S2 pp") {
3813             func=YCharmF0M0S2PP;
3814         } else if (sname == "F0M0S3 pp") {
3815             func=YCharmF0M0S3PP;
3816         } else if (sname == "F0M0S4 pp") {
3817             func=YCharmF0M0S4PP;
3818         } else if (sname == "F0M0S5 pp") {
3819             func=YCharmF0M0S5PP;
3820         } else if (sname == "F0M0S6 pp") {
3821             func=YCharmF0M0S6PP;
3822         } else {
3823             func=YCharm;
3824         }
3825         break;
3826     case kBeauty:
3827         if (sname == "F0M0S0 pp") {
3828             func=YBeautyF0M0S0PP;
3829         } else if (sname == "F1M0S0 pp") {
3830             func=YBeautyF1M0S0PP;
3831         } else if (sname == "F2M0S0 pp") {
3832             func=YBeautyF2M0S0PP;
3833         } else if (sname == "F0M1S0 pp") {
3834             func=YBeautyF0M1S0PP;
3835         } else if (sname == "F0M2S0 pp") {
3836             func=YBeautyF0M2S0PP;
3837         } else if (sname == "F0M0S1 pp") {
3838             func=YBeautyF0M0S1PP;
3839         } else if (sname == "F0M0S2 pp") {
3840             func=YBeautyF0M0S2PP;
3841         } else if (sname == "F0M0S3 pp") {
3842             func=YBeautyF0M0S3PP;
3843         } else if (sname == "F0M0S4 pp") {
3844             func=YBeautyF0M0S4PP;
3845         } else if (sname == "F0M0S5 pp") {
3846             func=YBeautyF0M0S5PP;
3847         } else if (sname == "F0M0S6 pp") {
3848             func=YBeautyF0M0S6PP;
3849         } else {
3850             func=YBeauty;
3851         }
3852         break;
3853     case kPion:
3854         if (sname == "2010 Pos PP") {
3855             func=YKaonPion2010PP;
3856         } else if (sname == "2010 Neg PP") {
3857             func=YKaonPion2010PP;
3858         } else {
3859             func=YPion;
3860         }
3861         break;
3862     case kKaon:
3863         if (sname == "2010 Pos PP") {
3864             func=YKaonPion2010PP;
3865         } else if (sname == "2010 Neg PP") {
3866             func=YKaonPion2010PP;
3867         } else {
3868             func=YKaon;
3869         }
3870         break;
3871     case kChic0:
3872         func=YChic0;
3873         break;
3874     case kChic:
3875         func=YChic;
3876         break;
3877     default:
3878         func=0;
3879         printf("<AliGenMUONlib::GetY> unknown parametrisation\n");
3880     }
3881     return func;
3882 }
3883
3884 //
3885 //                    Chi
3886 //
3887 //
3888 //                pt-distribution
3889 //____________________________________________________________
3890 Double_t AliGenMUONlib::PtChic0( const Double_t *px, const Double_t */*dummy*/)
3891 {
3892 // Chi_c1 pT
3893   const Double_t kpt0 = 4.;
3894   const Double_t kxn  = 3.6;
3895   Double_t x=*px;
3896   //
3897   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
3898   return x/TMath::Power(pass1,kxn);
3899 }
3900 Double_t AliGenMUONlib::PtChic1( const Double_t *px, const Double_t */*dummy*/)
3901 {
3902 // Chi_c1 pT
3903   const Double_t kpt0 = 4.;
3904   const Double_t kxn  = 3.6;
3905   Double_t x=*px;
3906   //
3907   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
3908   return x/TMath::Power(pass1,kxn);
3909 }
3910 Double_t AliGenMUONlib::PtChic2( const Double_t *px, const Double_t */*dummy*/)
3911 {
3912 // Chi_c2 pT
3913   const Double_t kpt0 = 4.;
3914   const Double_t kxn  = 3.6;
3915   Double_t x=*px;
3916   //
3917   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
3918   return x/TMath::Power(pass1,kxn);
3919 }
3920 Double_t AliGenMUONlib::PtChic( const Double_t *px, const Double_t */*dummy*/)
3921 {
3922 // Chi_c family pT
3923   const Double_t kpt0 = 4.;
3924   const Double_t kxn  = 3.6;
3925   Double_t x=*px;
3926   //
3927   Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
3928   return x/TMath::Power(pass1,kxn);
3929 }
3930
3931 //
3932 //               y-distribution
3933 //____________________________________________________________
3934 Double_t AliGenMUONlib::YChic0(const Double_t *py, const Double_t */*dummy*/)
3935 {
3936 // Chi-1c y
3937   const Double_t ky0 = 4.;
3938  const Double_t kb=1.;
3939   Double_t yj;
3940   Double_t y=TMath::Abs(*py);
3941   //
3942   if (y < ky0)
3943     yj=kb;
3944   else
3945     yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
3946   return yj;
3947 }
3948
3949 Double_t AliGenMUONlib::YChic1(const Double_t *py, const Double_t */*dummy*/)
3950 {
3951 // Chi-1c y
3952   const Double_t ky0 = 4.;
3953   const Double_t kb=1.;
3954   Double_t yj;
3955   Double_t y=TMath::Abs(*py);
3956   //
3957   if (y < ky0)
3958     yj=kb;
3959   else
3960     yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
3961   return yj;
3962 }
3963
3964 Double_t AliGenMUONlib::YChic2(const Double_t *py, const Double_t */*dummy*/)
3965 {
3966 // Chi-2c y
3967   const Double_t ky0 = 4.;
3968   const Double_t kb=1.;
3969   Double_t yj;
3970   Double_t y=TMath::Abs(*py);
3971   //
3972   if (y < ky0)
3973     yj=kb;
3974   else
3975     yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
3976   return yj;
3977 }
3978
3979 Double_t AliGenMUONlib::YChic(const Double_t *py, const Double_t */*dummy*/)
3980 {
3981 // Chi_c family y
3982   const Double_t ky0 = 4.;
3983   const Double_t kb=1.;
3984   Double_t yj;
3985   Double_t y=TMath::Abs(*py);
3986   //
3987   if (y < ky0)
3988     yj=kb;
3989   else
3990     yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
3991   return yj;
3992 }
3993
3994 //                 particle composition
3995 //
3996 Int_t AliGenMUONlib::IpChic0(TRandom *)
3997 {
3998 // Chi composition
3999     return 10441;
4000 }
4001 //
4002 Int_t AliGenMUONlib::IpChic1(TRandom *)
4003 {
4004 // Chi composition
4005     return 20443;
4006 }
4007 Int_t AliGenMUONlib::IpChic2(TRandom *)
4008 {
4009 // Chi_c2 prime composition
4010     return 445;
4011 }
4012 Int_t AliGenMUONlib::IpChic(TRandom *)
4013 {
4014 // Chi composition
4015   Int_t ip;
4016   Float_t r = gRandom->Rndm();
4017   if (r < 0.001) {
4018     ip = 10441;
4019   } else if( r < 0.377 ) {
4020     ip = 20443;
4021   } else {
4022     ip = 445;
4023   }
4024   return ip;
4025 }
4026
4027
4028 //_____________________________________________________________
4029
4030 typedef Int_t (*GenFuncIp) (TRandom *);
4031 GenFuncIp AliGenMUONlib::GetIp(Int_t param,  const char* tname) const
4032 {
4033 // Return pointer to particle type parameterisation
4034     TString sname = TString(tname);
4035     GenFuncIp func;
4036     switch (param) 
4037     {
4038     case kPhi:
4039         func=IpPhi;
4040         break;
4041     case kEta:
4042         func=IpEta;
4043         break;
4044     case kOmega:
4045         func=IpOmega;
4046         break;
4047     case kJpsiFamily:
4048         func=IpJpsiFamily;
4049         break;
4050     case kPsiP:
4051         func=IpPsiP;
4052         break;
4053     case kJpsi:
4054     case kJpsiFromB:
4055         func=IpJpsi;
4056         break;
4057     case kUpsilon:
4058         func=IpUpsilon;
4059         break;
4060     case kUpsilonFamily:
4061       func=IpUpsilonFamily;
4062       break;
4063     case kUpsilonP:
4064         func=IpUpsilonP;
4065         break;
4066     case kUpsilonPP:
4067         func=IpUpsilonPP;
4068         break;
4069     case kCharm:
4070         func=IpCharm;
4071         break;
4072     case kBeauty:
4073         func=IpBeauty;
4074         break;
4075     case kPion:
4076         if (sname == "2010 Pos PP") {
4077             func=IpPionPos;
4078         } else if (sname == "2010 Neg PP") {
4079             func=IpPionNeg;
4080         } else {
4081             func=IpPion;
4082         }
4083         break;
4084     case kKaon:
4085         if (sname == "2010 Pos PP") {
4086             func=IpKaonPos;
4087         } else if (sname == "2010 Neg PP") {
4088             func=IpKaonNeg;
4089         } else {
4090             func=IpKaon;
4091         }
4092         break;
4093     case kChic0:
4094         func=IpChic0;
4095         break;
4096     case kChic1:
4097         func=IpChic1;
4098         break;
4099     case kChic2:
4100         func=IpChic2;
4101         break;
4102     case kChic:
4103         func=IpChic;
4104         break;
4105     default:
4106         func=0;
4107         printf("<AliGenMUONlib::GetIp> unknown parametrisation\n");
4108     }
4109     return func;
4110 }
4111
4112
4113
4114 Float_t AliGenMUONlib::Interpolate(Float_t x, Float_t* y, Float_t x0, 
4115                                    Float_t dx,
4116                                    Int_t n, Int_t no)
4117 {
4118 //
4119 // Neville's alorithm for interpolation
4120 //
4121 // x:  x-value
4122 // y:  Input array
4123 // x0: minimum x 
4124 // dx: step size
4125 //  n: number of data points
4126 // no: order of polynom 
4127 //
4128     Float_t*  c = new Float_t[n];
4129     Float_t*  d = new Float_t[n];
4130     Int_t m, i;
4131     for (i = 0; i < n; i++) {
4132         c[i] = y[i];
4133         d[i] = y[i];
4134     }
4135     
4136     Int_t   ns  = int((x - x0)/dx);
4137     
4138     Float_t y1  = y[ns];
4139     ns--;    
4140     for (m = 0; m < no; m++) {
4141         for (i = 0; i < n-m; i++) {     
4142             Float_t ho = x0 + Float_t(i) * dx - x;
4143             Float_t hp = x0 + Float_t(i+m+1) * dx - x;
4144             Float_t w  = c[i+1] - d[i];
4145             Float_t den = ho-hp;
4146             den = w/den;
4147             d[i] = hp * den;
4148             c[i] = ho * den;
4149         }
4150         Float_t dy;
4151         
4152         if (2*ns < (n-m-1)) {
4153             dy  = c[ns+1];
4154         } else {
4155             dy  = d[ns--];
4156         }
4157         y1 += dy;}
4158     delete[] c;
4159     delete[] d;
4160
4161     return y1;
4162 }
4163
4164 //=============================================================================
4165 Double_t AliGenMUONlib::PtPionPos2010PP(const Double_t *px, const Double_t* /*dummy*/)
4166 {
4167 // Pos pion
4168   const Double_t par[3] = {2.27501, 0.116141, 5.59591};
4169   Double_t pt = px[0];
4170   Double_t m0 = TDatabasePDG::Instance()->GetParticle(211)->Mass();
4171   Double_t mt = TMath::Sqrt(m0*m0 + pt*pt);
4172   Double_t nc = par[1]*par[2];
4173   Double_t t1 = (par[2]-1.)/nc/(nc/(par[2]-2.)+m0);
4174   Double_t t2 = TMath::Power(1.+(mt-m0)/nc, -1.*par[2]);
4175   Double_t fn = par[0] * pt * t1 * t2;
4176   return fn;
4177 }
4178
4179 //=============================================================================
4180 Double_t AliGenMUONlib::PtPionNeg2010PP(const Double_t *px, const Double_t* /*dummy*/)
4181 {
4182 // Neg pion
4183   const Double_t par[3] = {2.25188, 0.12176, 5.91166};
4184   Double_t pt = px[0];
4185   Double_t m0 = TDatabasePDG::Instance()->GetParticle(211)->Mass();
4186   Double_t mt = TMath::Sqrt(m0*m0 + pt*pt);
4187   Double_t nc = par[1]*par[2];
4188   Double_t t1 = (par[2]-1.)/nc/(nc/(par[2]-2.)+m0);
4189   Double_t t2 = TMath::Power(1.+(mt-m0)/nc, -1.*par[2]);
4190   Double_t fn = par[0] * pt * t1 * t2;
4191   return fn;
4192 }
4193
4194 //=============================================================================
4195 Double_t AliGenMUONlib::PtKaonPos2010PP(const Double_t *px, const Double_t* /*dummy*/)
4196 {
4197 // Pos kaons
4198   const Double_t par[3] = {0.279386, 0.195466, 6.59587};
4199   Double_t pt = px[0];
4200   Double_t m0 = TDatabasePDG::Instance()->GetParticle(321)->Mass();
4201   Double_t mt = TMath::Sqrt(m0*m0 + pt*pt);
4202   Double_t nc = par[1]*par[2];
4203   Double_t t1 = (par[2]-1.)/nc/(nc/(par[2]-2.)+m0);
4204   Double_t t2 = TMath::Power(1.+(mt-m0)/nc, -1.*par[2]);
4205   Double_t fn = par[0] * pt * t1 * t2;
4206   return fn;
4207 }
4208
4209 //=============================================================================
4210 Double_t AliGenMUONlib::PtKaonNeg2010PP(const Double_t *px, const Double_t* /*dummy*/)
4211 {
4212 // Neg kaons
4213   const Double_t par[3] = {0.278927, 0.189049, 6.43006};
4214   Double_t pt = px[0];
4215   Double_t m0 = TDatabasePDG::Instance()->GetParticle(321)->Mass();
4216   Double_t mt = TMath::Sqrt(m0*m0 + pt*pt);
4217   Double_t nc = par[1]*par[2];
4218   Double_t t1 = (par[2]-1.)/nc/(nc/(par[2]-2.)+m0);
4219   Double_t t2 = TMath::Power(1.+(mt-m0)/nc, -1.*par[2]);
4220   Double_t fn = par[0] * pt * t1 * t2;
4221   return fn;
4222 }
4223
4224 //=============================================================================
4225 Double_t AliGenMUONlib::YKaonPion2010PP(const Double_t *px, const Double_t* /*dummy*/)
4226 {
4227 // pions and kaons
4228   Double_t y = px[0];
4229   Double_t sigma = 2.35;
4230   Double_t kernal = y/2./sigma;
4231   Double_t fxn = TMath::Exp(-1.*kernal*kernal);
4232   return fxn;
4233 }
4234
4235 //=============================================================================
4236 Int_t AliGenMUONlib::IpPionPos(TRandom *)
4237 {
4238 // Pos pions
4239     return 211;
4240 }
4241
4242 //=============================================================================
4243 Int_t AliGenMUONlib::IpPionNeg(TRandom *)
4244 {
4245 // Neg pions
4246     return -211;
4247 }
4248
4249 //=============================================================================
4250 Int_t AliGenMUONlib::IpKaonPos(TRandom *)
4251 {
4252 // pos Kaons
4253     return 321;
4254 }
4255
4256 //=============================================================================
4257 Int_t AliGenMUONlib::IpKaonNeg(TRandom *)
4258 {
4259 // neg Kaons 
4260     return -321;
4261 }