Wrongly deleted code is restored
[u/mrichter/AliRoot.git] / EVGEN / AliGenMUONlib.cxx
CommitLineData
4c039060 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
88cb7938 16/* $Id$ */
4c039060 17
53904666 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
65fb704d 27#include "TMath.h"
28#include "TRandom.h"
29
fe4da5cc 30#include "AliGenMUONlib.h"
5c3fd7ea 31
fe4da5cc 32ClassImp(AliGenMUONlib)
33//
34// Pions
198bb1c7 35Double_t AliGenMUONlib::PtPion(Double_t *px, Double_t* /*dummy*/)
fe4da5cc 36{
37//
38// PT-PARAMETERIZATION CDF, PRL 61(88) 1819
39// POWER LAW FOR PT > 500 MEV
40// MT SCALING BELOW (T=160 MEV)
41//
d90f80fd 42 const Double_t kp0 = 1.3;
43 const Double_t kxn = 8.28;
44 const Double_t kxlim=0.5;
45 const Double_t kt=0.160;
46 const Double_t kxmpi=0.139;
47 const Double_t kb=1.;
fe4da5cc 48 Double_t y, y1, xmpi2, ynorm, a;
49 Double_t x=*px;
50 //
d90f80fd 51 y1=TMath::Power(kp0/(kp0+kxlim),kxn);
52 xmpi2=kxmpi*kxmpi;
53 ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+xmpi2)/kt));
fe4da5cc 54 a=ynorm/y1;
d90f80fd 55 if (x > kxlim)
56 y=a*TMath::Power(kp0/(kp0+x),kxn);
fe4da5cc 57 else
d90f80fd 58 y=kb*TMath::Exp(-sqrt(x*x+xmpi2)/kt);
fe4da5cc 59 return y*x;
60}
753690b0 61//
62// y-distribution
63//
198bb1c7 64Double_t AliGenMUONlib::YPion( Double_t *py, Double_t */*dummy*/)
753690b0 65{
d90f80fd 66// Pion y
2280e6af 67 Double_t y=TMath::Abs(*py);
68/*
d90f80fd 69 const Double_t ka = 7000.;
70 const Double_t kdy = 4.;
d90f80fd 71 Double_t ex = y*y/(2*kdy*kdy);
72 return ka*TMath::Exp(-ex);
2280e6af 73*/
74 return 1.16526e+04+y*-3.79886e+03+y*y*4.31130e+02;
75
753690b0 76}
77// particle composition
78//
65fb704d 79Int_t AliGenMUONlib::IpPion(TRandom *ran)
753690b0 80{
d90f80fd 81// Pion composition
65fb704d 82 if (ran->Rndm() < 0.5) {
753690b0 83 return 211;
84 } else {
85 return -211;
86 }
87}
fe4da5cc 88
89//____________________________________________________________
90//
91// Mt-scaling
92
93Double_t AliGenMUONlib::PtScal(Double_t pt, Int_t np)
94{
95 // SCALING EN MASSE PAR RAPPORT A PTPI
96 // MASS PI,K,ETA,RHO,OMEGA,ETA',PHI
d90f80fd 97 const Double_t khm[10] = {.13957,.493,.5488,.769,.7826,.958,1.02,0,0,0};
fe4da5cc 98 // VALUE MESON/PI AT 5 GEV
d90f80fd 99 const Double_t kfmax[10]={1.,0.3,0.55,1.0,1.0,1.0,1.0,0,0,0};
fe4da5cc 100 np--;
d90f80fd 101 Double_t f5=TMath::Power(((sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3);
102 Double_t fmax2=f5/kfmax[np];
fe4da5cc 103 // PIONS
104 Double_t ptpion=100.*PtPion(&pt, (Double_t*) 0);
105 Double_t fmtscal=TMath::Power(((sqrt(pt*pt+0.018215)+2.)/
d90f80fd 106 (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/ fmax2;
fe4da5cc 107 return fmtscal*ptpion;
108}
109//
753690b0 110// kaon
111//
112// pt-distribution
113//____________________________________________________________
198bb1c7 114Double_t AliGenMUONlib::PtKaon( Double_t *px, Double_t */*dummy*/)
753690b0 115{
d90f80fd 116// Kaon pT
753690b0 117 return PtScal(*px,2);
118}
119
120// y-distribution
fe4da5cc 121//____________________________________________________________
198bb1c7 122Double_t AliGenMUONlib::YKaon( Double_t *py, Double_t */*dummy*/)
fe4da5cc 123{
d90f80fd 124// Kaon y
2280e6af 125 Double_t y=TMath::Abs(*py);
126/*
d90f80fd 127 const Double_t ka = 1000.;
128 const Double_t kdy = 4.;
fe4da5cc 129 //
d90f80fd 130 Double_t ex = y*y/(2*kdy*kdy);
131 return ka*TMath::Exp(-ex);
2280e6af 132*/
133
134 return 1.16526e+04+y*-3.79886e+03+y*y*4.31130e+02;
753690b0 135}
136
137// particle composition
138//
65fb704d 139Int_t AliGenMUONlib::IpKaon(TRandom *ran)
753690b0 140{
d90f80fd 141// Kaon composition
65fb704d 142 if (ran->Rndm() < 0.5) {
753690b0 143 return 321;
144 } else {
145 return -321;
146 }
fe4da5cc 147}
753690b0 148
fe4da5cc 149// J/Psi
150//
151//
152// pt-distribution
153//____________________________________________________________
198bb1c7 154Double_t AliGenMUONlib::PtJpsi( Double_t *px, Double_t */*dummy*/)
fe4da5cc 155{
d90f80fd 156// J/Psi pT
157 const Double_t kpt0 = 4.;
158 const Double_t kxn = 3.6;
fe4da5cc 159 Double_t x=*px;
160 //
d90f80fd 161 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
162 return x/TMath::Power(pass1,kxn);
fe4da5cc 163}
05932df6 164
0e137c25 165Double_t AliGenMUONlib::PtJpsiCDFscaled( Double_t *px, Double_t */*dummy*/)
166{
167// J/Psi pT
48416d65 168 const Double_t kpt0 = 4.703;
169 const Double_t kxn = 3.826;
0e137c25 170 Double_t x=*px;
171 //
172 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
173 return x/TMath::Power(pass1,kxn);
174}
175
9ff13849 176Double_t AliGenMUONlib::PtJpsiCDFscaledPP( Double_t *px, Double_t */*dummy*/)
177{
178// J/Psi pT
179//
180// pp 14 TeV
181//
182// scaled from CDF data at 2 TeV
183
184 const Double_t kpt0 = 5.355;
185 const Double_t kxn = 3.821;
186 Double_t x=*px;
187 //
188 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
189 return x/TMath::Power(pass1,kxn);
190}
191
a384decf 192Double_t AliGenMUONlib::PtJpsiFlat( Double_t */*px*/, Double_t */*dummy*/ )
4ca8d070 193{
194 return 1.;
195}
196
198bb1c7 197Double_t AliGenMUONlib::PtJpsiPbPb( Double_t *px, Double_t */*dummy*/)
05932df6 198{
1af7144e 199// J/Psi pT spectrum
05932df6 200//
201// R. Vogt 2002
202// PbPb 5.5 TeV
203// MRST HO
204// mc = 1.4 GeV, pt-kick 1 GeV
205//
1af7144e 206 Float_t x = px[0];
207 Float_t c[8] = {
208 -2.13098e+00, 9.46552e+00, -5.06799e+00, 1.27260e+00,
209 -1.83806e-01, 1.55853e-02, -7.23241e-04, 1.42105e-05
05932df6 210 };
1af7144e 211
3d905dd7 212 Double_t y;
36349df1 213 if (x < 10.) {
3d905dd7 214 Int_t j;
215 y = c[j = 7];
216 while (j > 0) y = y * x +c[--j];
217 y = x * TMath::Exp(y);
218 } else {
219 y = 0.;
220 }
1af7144e 221 return y;
05932df6 222}
17d28ba5 223
224Double_t AliGenMUONlib::PtJpsiBPbPb( Double_t *px, Double_t */*dummy*/)
225{
226// J/Psi pT spectrum
227// B -> J/Psi X
228 Double_t x0 = 4.0384;
229 Double_t n = 3.0288;
230
231 Double_t x = px[0];
232 Double_t y = x / TMath::Power((1. + (x/x0)*(x/x0)), n);
233
234 return y;
235}
236
237
198bb1c7 238Double_t AliGenMUONlib::PtJpsiPP( Double_t *px, Double_t */*dummy*/)
bb6e81ac 239{
240// J/Psi pT spectrum
241//
242// R. Vogt 2002
243// pp 14 TeV
244// MRST HO
245// mc = 1.4 GeV, pt-kick 1 GeV
246//
247 Float_t x = px[0];
248 Float_t c[4] = {8.47471e+00, -1.93567e+00, 1.50271e-01, -5.51212e-03};
249
250 Double_t y;
251 if (x < 10.) {
252 Int_t j;
253 y = c[j = 3];
254 while (j > 0) y = y * x +c[--j];
255 y = x * TMath::Exp(y);
256 } else {
257 y = 0.;
258 }
259 return y;
260}
261
fe4da5cc 262//
263// y-distribution
264//____________________________________________________________
198bb1c7 265Double_t AliGenMUONlib::YJpsi(Double_t *py, Double_t */*dummy*/)
fe4da5cc 266{
d90f80fd 267// J/psi y
268 const Double_t ky0 = 4.;
269 const Double_t kb=1.;
fe4da5cc 270 Double_t yj;
271 Double_t y=TMath::Abs(*py);
272 //
d90f80fd 273 if (y < ky0)
274 yj=kb;
fe4da5cc 275 else
d90f80fd 276 yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
fe4da5cc 277 return yj;
278}
05932df6 279
a384decf 280Double_t AliGenMUONlib::YJpsiFlat( Double_t */*py*/, Double_t */*dummy*/ )
4ca8d070 281{
282 return 1.;
283}
284
05932df6 285
198bb1c7 286Double_t AliGenMUONlib::YJpsiPbPb( Double_t *px, Double_t */*dummy*/)
05932df6 287{
288
289//
290// J/Psi y
291//
292//
293// R. Vogt 2002
294// PbPb 5.5 TeV
295// MRST HO
296// mc = 1.4 GeV, pt-kick 1 GeV
297//
1af7144e 298 Double_t c[5] = {-6.03425e+02, 4.98257e+02, -1.38794e+02, 1.62209e+01, -6.85955e-01};
299 Double_t x = TMath::Abs(px[0]);
300 Double_t y;
301
302 if (x < 4.) {
303 y = 31.754;
304 } else if (x < 6) {
305 Int_t j;
306 y = c[j = 4];
307 while (j > 0) y = y * x + c[--j];
308 } else {
309 y =0.;
310 }
311
312 return y;
05932df6 313}
314
0e137c25 315Double_t AliGenMUONlib::YJpsiCDFscaled( Double_t *px, Double_t* dummy)
316{
317 // J/Psi y
318 return AliGenMUONlib::YJpsiPbPb(px, dummy);
319}
320
9ff13849 321Double_t AliGenMUONlib::YJpsiCDFscaledPP( Double_t *px, Double_t* dummy)
322{
323 // J/Psi y
324 return AliGenMUONlib::YJpsiPP(px, dummy);
325}
0e137c25 326
198bb1c7 327Double_t AliGenMUONlib::YJpsiPP( Double_t *px, Double_t */*dummy*/)
bb6e81ac 328{
329
330//
331// J/Psi y
332//
333//
334// R. Vogt 2002
335// pp 14 TeV
336// MRST HO
337// mc = 1.4 GeV, pt-kick 1 GeV
338//
339
340 Double_t c[5] = {1.38532e+00, 1.00596e+02, -3.46378e+01, 3.94172e+00, -1.48319e-01};
341 Double_t x = TMath::Abs(px[0]);
342 Double_t y;
343
344 if (x < 2.5) {
345 y = 96.455 - 0.8483 * x * x;
346 } else if (x < 7.9) {
347 Int_t j;
348 y = c[j = 4];
349 while (j > 0) y = y * x + c[--j];
350 } else {
351 y =0.;
352 }
353
354 return y;
355}
356
17d28ba5 357Double_t AliGenMUONlib::YJpsiBPbPb( Double_t *px, Double_t */*dummy*/)
358{
359
360//
361// J/Psi from B->J/Psi X
362//
363//
364
365
366 Double_t c[7] = {7.37025e-02, 0., -2.94487e-03, 0., 6.07953e-06, 0., 5.39219e-07};
367
368 Double_t x = TMath::Abs(px[0]);
369 Double_t y;
370
371 if (x > 6.) {
372 y = 0.;
373 } else {
374 Int_t j;
375 y = c[j = 6];
376 while (j > 0) y = y * x + c[--j];
377 }
378
379 return y;
380}
381
382
383
fe4da5cc 384// particle composition
385//
65fb704d 386Int_t AliGenMUONlib::IpJpsi(TRandom *)
fe4da5cc 387{
d90f80fd 388// J/Psi composition
88cb7938 389 return 443;
fe4da5cc 390}
88e5db43 391Int_t AliGenMUONlib::IpPsiP(TRandom *)
392{
393// Psi prime composition
394 return 100443;
395}
0ad09590 396Int_t AliGenMUONlib::IpJpsiFamily(TRandom *)
397{
398// J/Psi composition
399 Int_t ip;
400 Float_t r = gRandom->Rndm();
401 if (r < 0.98) {
402 ip = 443;
403 } else {
404 ip = 100443;
405 }
406 return ip;
407}
408
fe4da5cc 409
88e5db43 410
fe4da5cc 411// Upsilon
412//
413//
414// pt-distribution
415//____________________________________________________________
198bb1c7 416Double_t AliGenMUONlib::PtUpsilon( Double_t *px, Double_t */*dummy*/ )
fe4da5cc 417{
d90f80fd 418// Upsilon pT
419 const Double_t kpt0 = 5.3;
420 const Double_t kxn = 2.5;
fe4da5cc 421 Double_t x=*px;
422 //
d90f80fd 423 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
424 return x/TMath::Power(pass1,kxn);
fe4da5cc 425}
05932df6 426
0e137c25 427Double_t AliGenMUONlib::PtUpsilonCDFscaled( Double_t *px, Double_t */*dummy*/ )
428{
429// Upsilon pT
48416d65 430 const Double_t kpt0 = 7.753;
431 const Double_t kxn = 3.042;
0e137c25 432 Double_t x=*px;
433 //
434 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
435 return x/TMath::Power(pass1,kxn);
436}
437
9ff13849 438Double_t AliGenMUONlib::PtUpsilonCDFscaledPP( Double_t *px, Double_t */*dummy*/ )
439{
440// Upsilon pT
441//
442// pp 14 TeV
443//
444// scaled from CDF data at 2 TeV
445
446 const Double_t kpt0 = 8.610;
447 const Double_t kxn = 3.051;
448 Double_t x=*px;
449 //
450 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
451 return x/TMath::Power(pass1,kxn);
452}
453
a384decf 454Double_t AliGenMUONlib::PtUpsilonFlat( Double_t */*px*/, Double_t */*dummy*/ )
4ca8d070 455{
456 return 1.;
457}
458
198bb1c7 459Double_t AliGenMUONlib::PtUpsilonPbPb( Double_t *px, Double_t */*dummy*/)
05932df6 460{
461
462//
463// Upsilon pT
464//
465//
466// R. Vogt 2002
467// PbPb 5.5 TeV
468// MRST HO
469// mc = 1.4 GeV, pt-kick 1 GeV
470//
1af7144e 471 Float_t x = px[0];
472 Double_t c[8] = {
473 -1.03488e+01, 1.28065e+01, -6.60500e+00, 1.66140e+00,
474 -2.34293e-01, 1.86925e-02, -7.80708e-04, 1.30610e-05
475 };
3d905dd7 476 Double_t y;
477 if (x < 10.) {
478 Int_t j;
479 y = c[j = 7];
480 while (j > 0) y = y * x +c[--j];
481 y = x * TMath::Exp(y);
482 } else {
483 y = 0.;
484 }
1af7144e 485 return y;
05932df6 486}
487
198bb1c7 488Double_t AliGenMUONlib::PtUpsilonPP( Double_t *px, Double_t */*dummy*/)
bb6e81ac 489{
490
491//
492// Upsilon pT
493//
494//
495// R. Vogt 2002
496// pp 14 TeV
497// MRST HO
498// mc = 1.4 GeV, pt-kick 1 GeV
499//
500 Float_t x = px[0];
501 Double_t c[8] = {-7.93955e+00, 1.06306e+01, -5.21392e+00, 1.19703e+00,
502 -1.45718e-01, 8.95151e-03, -2.04806e-04, -1.13053e-06};
503
504 Double_t y;
505 if (x < 10.) {
506 Int_t j;
507 y = c[j = 7];
508 while (j > 0) y = y * x +c[--j];
509 y = x * TMath::Exp(y);
510 } else {
511 y = 0.;
512 }
513 return y;
514}
515
fe4da5cc 516//
517// y-distribution
518//
519//____________________________________________________________
198bb1c7 520Double_t AliGenMUONlib::YUpsilon(Double_t *py, Double_t */*dummy*/)
fe4da5cc 521{
d90f80fd 522// Upsilon y
523 const Double_t ky0 = 3.;
524 const Double_t kb=1.;
fe4da5cc 525 Double_t yu;
526 Double_t y=TMath::Abs(*py);
527 //
d90f80fd 528 if (y < ky0)
529 yu=kb;
fe4da5cc 530 else
d90f80fd 531 yu=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
fe4da5cc 532 return yu;
533}
05932df6 534
535
198bb1c7 536Double_t AliGenMUONlib::YUpsilonPbPb( Double_t *px, Double_t */*dummy*/)
05932df6 537{
538
539//
540// Upsilon y
541//
542//
543// R. Vogt 2002
544// PbPb 5.5 TeV
545// MRST HO
546// mc = 1.4 GeV, pt-kick 1 GeV
547//
548
1af7144e 549 Double_t c[7] = {3.40036e-01, -3.98882e-07, -4.48398e-03, 8.46411e-08, -6.10854e-04,
550 -2.99753e-09, 1.28895e-05};
551
552 Double_t x = px[0];
553 if (TMath::Abs(x) > 5.55) return 0.;
554 Int_t j;
555 Double_t y = c[j = 6];
556 while (j > 0) y = y * x +c[--j];
557 return y;
05932df6 558}
559
0e137c25 560Double_t AliGenMUONlib::YUpsilonCDFscaled( Double_t *px, Double_t *dummy)
561{
562 // Upsilon y
563 return AliGenMUONlib::YUpsilonPbPb(px, dummy);
564
565}
9ff13849 566
567Double_t AliGenMUONlib::YUpsilonCDFscaledPP( Double_t *px, Double_t *dummy)
568{
569 // Upsilon y
570 return AliGenMUONlib::YUpsilonPP(px, dummy);
571
572}
573
a384decf 574Double_t AliGenMUONlib::YUpsilonFlat( Double_t */*px*/, Double_t */*dummy*/)
4ca8d070 575{
576 // Upsilon y
577 return 1.;
578
579}
0e137c25 580
198bb1c7 581Double_t AliGenMUONlib::YUpsilonPP( Double_t *px, Double_t */*dummy*/)
bb6e81ac 582{
583
584//
585// Upsilon y
586//
587//
588// R. Vogt 2002
589// p p 14. TeV
590// MRST HO
591// mc = 1.4 GeV, pt-kick 1 GeV
592//
593 Double_t c[7] = {8.91936e-01, -6.46645e-07, -1.52774e-02, 4.28677e-08, -7.01517e-04,
594 -6.20539e-10, 1.29943e-05};
595
596 Double_t x = px[0];
597 if (TMath::Abs(x) > 6.2) return 0.;
598 Int_t j;
599 Double_t y = c[j = 6];
600 while (j > 0) y = y * x +c[--j];
601 return y;
602}
603
fe4da5cc 604// particle composition
605//
65fb704d 606Int_t AliGenMUONlib::IpUpsilon(TRandom *)
fe4da5cc 607{
d90f80fd 608// y composition
88cb7938 609 return 553;
fe4da5cc 610}
88e5db43 611Int_t AliGenMUONlib::IpUpsilonP(TRandom *)
612{
613// y composition
614 return 100553;
615}
616Int_t AliGenMUONlib::IpUpsilonPP(TRandom *)
617{
618// y composition
619 return 200553;
620}
0ad09590 621Int_t AliGenMUONlib::IpUpsilonFamily(TRandom *)
622{
623// y composition
624 Int_t ip;
625 Float_t r = gRandom->Rndm();
626
627 if (r < 0.712) {
628 ip = 553;
629 } else if (r < 0.896) {
630 ip = 100553;
631 } else {
632 ip = 200553;
633 }
634 return ip;
635}
fe4da5cc 636
88e5db43 637
fe4da5cc 638//
639// Phi
640//
641//
642// pt-distribution (by scaling of pion distribution)
643//____________________________________________________________
198bb1c7 644Double_t AliGenMUONlib::PtPhi( Double_t *px, Double_t */*dummy*/)
fe4da5cc 645{
d90f80fd 646// Phi pT
fe4da5cc 647 return PtScal(*px,7);
648}
649// y-distribution
198bb1c7 650Double_t AliGenMUONlib::YPhi( Double_t *px, Double_t */*dummy*/)
fe4da5cc 651{
d90f80fd 652// Phi y
653 Double_t *dum=0;
654 return YJpsi(px,dum);
fe4da5cc 655}
656// particle composition
657//
65fb704d 658Int_t AliGenMUONlib::IpPhi(TRandom *)
fe4da5cc 659{
d90f80fd 660// Phi composition
89512a3b 661 return 333;
662}
663
664//
665// omega
666//
667//
668// pt-distribution (by scaling of pion distribution)
669//____________________________________________________________
198bb1c7 670Double_t AliGenMUONlib::PtOmega( Double_t *px, Double_t */*dummy*/)
89512a3b 671{
672// Omega pT
673 return PtScal(*px,5);
674}
675// y-distribution
198bb1c7 676Double_t AliGenMUONlib::YOmega( Double_t *px, Double_t */*dummy*/)
89512a3b 677{
678// Omega y
679 Double_t *dum=0;
680 return YJpsi(px,dum);
681}
682// particle composition
683//
684Int_t AliGenMUONlib::IpOmega(TRandom *)
685{
686// Omega composition
687 return 223;
688}
689
690
691//
692// Eta
693//
694//
695// pt-distribution (by scaling of pion distribution)
696//____________________________________________________________
198bb1c7 697Double_t AliGenMUONlib::PtEta( Double_t *px, Double_t */*dummy*/)
89512a3b 698{
699// Eta pT
700 return PtScal(*px,3);
701}
702// y-distribution
198bb1c7 703Double_t AliGenMUONlib::YEta( Double_t *px, Double_t */*dummy*/)
89512a3b 704{
705// Eta y
706 Double_t *dum=0;
707 return YJpsi(px,dum);
708}
709// particle composition
710//
711Int_t AliGenMUONlib::IpEta(TRandom *)
712{
713// Eta composition
714 return 221;
fe4da5cc 715}
716
717//
718// Charm
719//
720//
721// pt-distribution
722//____________________________________________________________
198bb1c7 723Double_t AliGenMUONlib::PtCharm( Double_t *px, Double_t */*dummy*/)
fe4da5cc 724{
d90f80fd 725// Charm pT
bd0276a8 726 const Double_t kpt0 = 2.25;
727 const Double_t kxn = 3.17;
2280e6af 728
fe4da5cc 729 Double_t x=*px;
730 //
bd0276a8 731 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
732 return x/TMath::Power(pass1,kxn);
733}
734
735Double_t AliGenMUONlib::PtCharmCentral( Double_t *px, Double_t */*dummy*/)
736{
737// Charm pT
738 const Double_t kpt0 = 2.12;
739 const Double_t kxn = 2.78;
740
741 Double_t x=*px;
742 //
743 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
d90f80fd 744 return x/TMath::Power(pass1,kxn);
fe4da5cc 745}
746// y-distribution
198bb1c7 747Double_t AliGenMUONlib::YCharm( Double_t *px, Double_t */*dummy*/)
fe4da5cc 748{
ec772ba2 749// Charm y :: Carrer & Dainese : ALICE-INT-2003-019 v.3 (hep-ph/0311225)
750// Pythia tuned to reproduce the distribution given by the HVQMNR program based on NLO calculations (pQCD)
751// shadowing + kt broadening
752
753 Double_t x=px[0];
754 Double_t c[2]={-2.42985e-03,-2.31001e-04};
755 Double_t y=1+(c[0]*TMath::Power(x,2))+(c[1]*TMath::Power(x,4));
756 Double_t ycharm;
757
758 if (TMath::Abs(x)>8) {
759 ycharm=0.;
760 }
761 else {
762 ycharm=TMath::Power(y,3);
763 }
764
765 return ycharm;
fe4da5cc 766}
767
ec772ba2 768
65fb704d 769Int_t AliGenMUONlib::IpCharm(TRandom *ran)
fe4da5cc 770{
d90f80fd 771// Charm composition
65fb704d 772 Float_t random;
fe4da5cc 773 Int_t ip;
774// 411,421,431,4122
65fb704d 775 random = ran->Rndm();
ec772ba2 776// Taux de production Carrer & Dainese : ALICE-INT-2003-019 v.3
777// >>>>> cf. tab 4 p 11
778
779 if (random < 0.30) {
780 ip=421;
781 } else if (random < 0.60) {
782 ip=-421;
783 } else if (random < 0.70) {
784 ip=411;
785 } else if (random < 0.80) {
786 ip=-411;
787 } else if (random < 0.86) {
788 ip=431;
789 } else if (random < 0.92) {
790 ip=-431;
791 } else if (random < 0.96) {
792 ip=4122;
fe4da5cc 793 } else {
ec772ba2 794 ip=-4122;
fe4da5cc 795 }
fe4da5cc 796
797 return ip;
798}
799
fe4da5cc 800//
801// Beauty
802//
803//
804// pt-distribution
805//____________________________________________________________
198bb1c7 806Double_t AliGenMUONlib::PtBeauty( Double_t *px, Double_t */*dummy*/)
fe4da5cc 807{
d90f80fd 808// Beauty pT
bd0276a8 809 const Double_t kpt0 = 6.53;
810 const Double_t kxn = 3.59;
811 Double_t x=*px;
812 //
813 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
814 return x/TMath::Power(pass1,kxn);
815}
816
817Double_t AliGenMUONlib::PtBeautyCentral( Double_t *px, Double_t */*dummy*/)
818{
819// Beauty pT
820 const Double_t kpt0 = 6.14;
821 const Double_t kxn = 2.93;
fe4da5cc 822 Double_t x=*px;
823 //
d90f80fd 824 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
825 return x/TMath::Power(pass1,kxn);
fe4da5cc 826}
827// y-distribution
198bb1c7 828Double_t AliGenMUONlib::YBeauty( Double_t *px, Double_t */*dummy*/)
fe4da5cc 829{
ec772ba2 830// Beauty y :: Carrer & Dainese : ALICE-INT-2003-019 v.3 (hep-ph/0311225)
831// Pythia tuned to reproduce the distribution given by the HVQMNR program based on NLO calculations (pQCD)
832// shadowing + kt broadening
833
834 Double_t x=px[0];
835 Double_t c[2]={-1.27590e-02,-2.42731e-04};
836 Double_t y=1+c[0]*TMath::Power(x,2)+c[1]*TMath::Power(x,4);
837 Double_t ybeauty;
838
839 if (TMath::Abs(x)>6) {
840 ybeauty=0.;
841 }
842 else {
843 ybeauty=TMath::Power(y,3);
844 }
845
846 return ybeauty;
fe4da5cc 847}
848
ec772ba2 849
65fb704d 850Int_t AliGenMUONlib::IpBeauty(TRandom *ran)
fe4da5cc 851{
d90f80fd 852// Beauty Composition
65fb704d 853 Float_t random;
fe4da5cc 854 Int_t ip;
ec772ba2 855 random = ran->Rndm();
856
857// Taux de production Carrer & Dainese : ALICE-INT-2003-019 v.3
858// >>>>> cf. tab 4 p 11
859
860 if (random < 0.20) {
861 ip=511;
862 } else if (random < 0.40) {
863 ip=-511;
864 } else if (random < 0.605) {
865 ip=521;
866 } else if (random < 0.81) {
867 ip=-521;
868 } else if (random < 0.87) {
869 ip=531;
870 } else if (random < 0.93) {
871 ip=-531;
872 } else if (random < 0.965) {
873 ip=5122;
fe4da5cc 874 } else {
ec772ba2 875 ip=-5122;
fe4da5cc 876 }
fe4da5cc 877
ec772ba2 878 return ip;
fe4da5cc 879}
880
ec772ba2 881
fe4da5cc 882typedef Double_t (*GenFunc) (Double_t*, Double_t*);
53904666 883GenFunc AliGenMUONlib::GetPt(Int_t param, const char* tname) const
fe4da5cc 884{
d90f80fd 885// Return pointer to pT parameterisation
05932df6 886 TString sname = TString(tname);
fe4da5cc 887 GenFunc func;
753690b0 888 switch (param)
fe4da5cc 889 {
34f60c01 890 case kPhi:
fe4da5cc 891 func=PtPhi;
892 break;
89512a3b 893 case kOmega:
894 func=PtOmega;
895 break;
896 case kEta:
897 func=PtEta;
898 break;
0ad09590 899 case kJpsiFamily:
88e5db43 900 case kPsiP:
34f60c01 901 case kJpsi:
bb6e81ac 902 if (sname == "Vogt" || sname == "Vogt PbPb") {
05932df6 903 func=PtJpsiPbPb;
bb6e81ac 904 } else if (sname == "Vogt pp") {
905 func=PtJpsiPP;
0e137c25 906 } else if (sname == "CDF scaled") {
907 func=PtJpsiCDFscaled;
9ff13849 908 } else if (sname == "CDF pp") {
909 func=PtJpsiCDFscaledPP;
4ca8d070 910 } else if (sname == "Flat") {
911 func=PtJpsiFlat;
05932df6 912 } else {
913 func=PtJpsi;
914 }
fe4da5cc 915 break;
17d28ba5 916 case kJpsiFromB:
917 func = PtJpsiBPbPb;
918 break;
0ad09590 919 case kUpsilonFamily:
88e5db43 920 case kUpsilonP:
921 case kUpsilonPP:
34f60c01 922 case kUpsilon:
bb6e81ac 923 if (sname == "Vogt" || sname == "Vogt PbPb") {
05932df6 924 func=PtUpsilonPbPb;
bb6e81ac 925 } else if (sname == "Vogt pp") {
926 func=PtUpsilonPP;
0e137c25 927 } else if (sname == "CDF scaled") {
928 func=PtUpsilonCDFscaled;
9ff13849 929 } else if (sname == "CDF pp") {
930 func=PtUpsilonCDFscaledPP;
4ca8d070 931 } else if (sname == "Flat") {
932 func=PtUpsilonFlat;
05932df6 933 } else {
934 func=PtUpsilon;
935 }
0ad09590 936 break;
34f60c01 937 case kCharm:
bd0276a8 938 if (sname == "central") {
939 func=PtCharmCentral;
940 } else {
941 func=PtCharm;
942 }
fe4da5cc 943 break;
34f60c01 944 case kBeauty:
bd0276a8 945 if (sname == "central") {
946 func=PtBeautyCentral;
947 } else {
948 func=PtBeauty;
949 }
fe4da5cc 950 break;
34f60c01 951 case kPion:
753690b0 952 func=PtPion;
953 break;
34f60c01 954 case kKaon:
753690b0 955 func=PtKaon;
956 break;
119b35c7 957 default:
958 func=0;
959 printf("<AliGenMUONlib::GetPt> unknown parametrisation\n");
fe4da5cc 960 }
961 return func;
962}
963
53904666 964GenFunc AliGenMUONlib::GetY(Int_t param, const char* tname) const
fe4da5cc 965{
ac3faee4 966 //
967 // Return pointer to y- parameterisation
968 //
05932df6 969 TString sname = TString(tname);
fe4da5cc 970 GenFunc func;
753690b0 971 switch (param)
fe4da5cc 972 {
34f60c01 973 case kPhi:
fe4da5cc 974 func=YPhi;
975 break;
89512a3b 976 case kEta:
977 func=YEta;
978 break;
979 case kOmega:
980 func=YOmega;
981 break;
0ad09590 982 case kJpsiFamily:
88e5db43 983 case kPsiP:
34f60c01 984 case kJpsi:
bb6e81ac 985 if (sname == "Vogt" || sname == "Vogt PbPb") {
05932df6 986 func=YJpsiPbPb;
bb6e81ac 987 } else if (sname == "Vogt pp"){
988 func=YJpsiPP;
0e137c25 989 } else if (sname == "CDF scaled") {
990 func=YJpsiCDFscaled;
9ff13849 991 } else if (sname == "CDF pp") {
992 func=YJpsiCDFscaledPP;
4ca8d070 993 } else if (sname == "Flat") {
994 func=YJpsiFlat;
05932df6 995 } else {
996 func=YJpsi;
997 }
fe4da5cc 998 break;
17d28ba5 999 case kJpsiFromB:
1000 func = YJpsiBPbPb;
1001 break;
0ad09590 1002 case kUpsilonFamily:
88e5db43 1003 case kUpsilonP:
1004 case kUpsilonPP:
34f60c01 1005 case kUpsilon:
bb6e81ac 1006 if (sname == "Vogt" || sname == "Vogt PbPb") {
05932df6 1007 func=YUpsilonPbPb;
bb6e81ac 1008 } else if (sname == "Vogt pp") {
1009 func = YUpsilonPP;
0e137c25 1010 } else if (sname == "CDF scaled") {
1011 func=YUpsilonCDFscaled;
9ff13849 1012 } else if (sname == "CDF pp") {
1013 func=YUpsilonCDFscaledPP;
4ca8d070 1014 } else if (sname == "Flat") {
1015 func=YUpsilonFlat;
05932df6 1016 } else {
1017 func=YUpsilon;
1018 }
fe4da5cc 1019 break;
34f60c01 1020 case kCharm:
fe4da5cc 1021 func=YCharm;
1022 break;
34f60c01 1023 case kBeauty:
fe4da5cc 1024 func=YBeauty;
1025 break;
34f60c01 1026 case kPion:
753690b0 1027 func=YPion;
1028 break;
34f60c01 1029 case kKaon:
753690b0 1030 func=YKaon;
1031 break;
119b35c7 1032 default:
1033 func=0;
1034 printf("<AliGenMUONlib::GetY> unknown parametrisation\n");
fe4da5cc 1035 }
1036 return func;
1037}
65fb704d 1038typedef Int_t (*GenFuncIp) (TRandom *);
198bb1c7 1039GenFuncIp AliGenMUONlib::GetIp(Int_t param, const char* /*tname*/) const
fe4da5cc 1040{
d90f80fd 1041// Return pointer to particle type parameterisation
fe4da5cc 1042 GenFuncIp func;
753690b0 1043 switch (param)
fe4da5cc 1044 {
34f60c01 1045 case kPhi:
fe4da5cc 1046 func=IpPhi;
1047 break;
89512a3b 1048 case kEta:
1049 func=IpEta;
1050 break;
1051 case kOmega:
1052 func=IpOmega;
1053 break;
0ad09590 1054 case kJpsiFamily:
1055 func=IpJpsiFamily;
1056 break;
88e5db43 1057 case kPsiP:
1058 func=IpPsiP;
1059 break;
34f60c01 1060 case kJpsi:
17d28ba5 1061 case kJpsiFromB:
fe4da5cc 1062 func=IpJpsi;
1063 break;
34f60c01 1064 case kUpsilon:
fe4da5cc 1065 func=IpUpsilon;
1066 break;
0ad09590 1067 case kUpsilonFamily:
1068 func=IpUpsilonFamily;
1069 break;
88e5db43 1070 case kUpsilonP:
1071 func=IpUpsilonP;
1072 break;
1073 case kUpsilonPP:
1074 func=IpUpsilonPP;
1075 break;
34f60c01 1076 case kCharm:
fe4da5cc 1077 func=IpCharm;
1078 break;
34f60c01 1079 case kBeauty:
fe4da5cc 1080 func=IpBeauty;
1081 break;
34f60c01 1082 case kPion:
753690b0 1083 func=IpPion;
1084 break;
34f60c01 1085 case kKaon:
753690b0 1086 func=IpKaon;
1087 break;
119b35c7 1088 default:
1089 func=0;
1090 printf("<AliGenMUONlib::GetIp> unknown parametrisation\n");
fe4da5cc 1091 }
1092 return func;
1093}
1094
1095
753690b0 1096
05932df6 1097Float_t AliGenMUONlib::Interpolate(Float_t x, Float_t* y, Float_t x0,
1098 Float_t dx,
1099 Int_t n, Int_t no)
1100{
1101//
1102// Neville's alorithm for interpolation
1103//
1104// x: x-value
1105// y: Input array
1106// x0: minimum x
1107// dx: step size
1108// n: number of data points
1109// no: order of polynom
1110//
1111 Float_t* c = new Float_t[n];
1112 Float_t* d = new Float_t[n];
1113 Int_t m, i;
1114 for (i = 0; i < n; i++) {
1115 c[i] = y[i];
1116 d[i] = y[i];
1117 }
1118
1119 Int_t ns = int((x - x0)/dx);
1120
1121 Float_t y1 = y[ns];
1122 ns--;
1123 for (m = 0; m < no; m++) {
1124 for (i = 0; i < n-m; i++) {
1125 Float_t ho = x0 + Float_t(i) * dx - x;
1126 Float_t hp = x0 + Float_t(i+m+1) * dx - x;
1127 Float_t w = c[i+1] - d[i];
1128 Float_t den = ho-hp;
1129 den = w/den;
1130 d[i] = hp * den;
1131 c[i] = ho * den;
1132 }
1133 Float_t dy;
1134
1135 if (2*ns < (n-m-1)) {
1136 dy = c[ns+1];
1137 } else {
1138 dy = d[ns--];
1139 }
1140 y1 += dy;}
1141 delete[] c;
1142 delete[] d;
1143
1144 return y1;
1145}
1146
753690b0 1147