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