]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenMUONlib.cxx
Handle missing rec-point tree in a uniform way: return null pointer to TEvePointSet.
[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
4ca8d070 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
0e137c25 579}
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;
00935af2 957 case kChi_c0:
958 func=PtChi_c0;
959 break;
960 case kChi_c1:
961 func=PtChi_c1;
962 break;
963 case kChi_c2:
964 func=PtChi_c2;
965 break;
966 case kChi_c:
967 func=PtChi_c;
968 break;
119b35c7 969 default:
970 func=0;
971 printf("<AliGenMUONlib::GetPt> unknown parametrisation\n");
fe4da5cc 972 }
973 return func;
974}
975
53904666 976GenFunc AliGenMUONlib::GetY(Int_t param, const char* tname) const
fe4da5cc 977{
ac3faee4 978 //
979 // Return pointer to y- parameterisation
980 //
05932df6 981 TString sname = TString(tname);
fe4da5cc 982 GenFunc func;
753690b0 983 switch (param)
fe4da5cc 984 {
34f60c01 985 case kPhi:
fe4da5cc 986 func=YPhi;
987 break;
89512a3b 988 case kEta:
989 func=YEta;
990 break;
991 case kOmega:
992 func=YOmega;
993 break;
0ad09590 994 case kJpsiFamily:
88e5db43 995 case kPsiP:
34f60c01 996 case kJpsi:
bb6e81ac 997 if (sname == "Vogt" || sname == "Vogt PbPb") {
05932df6 998 func=YJpsiPbPb;
bb6e81ac 999 } else if (sname == "Vogt pp"){
1000 func=YJpsiPP;
0e137c25 1001 } else if (sname == "CDF scaled") {
1002 func=YJpsiCDFscaled;
9ff13849 1003 } else if (sname == "CDF pp") {
1004 func=YJpsiCDFscaledPP;
4ca8d070 1005 } else if (sname == "Flat") {
1006 func=YJpsiFlat;
05932df6 1007 } else {
1008 func=YJpsi;
1009 }
17d28ba5 1010 break;
1011 case kJpsiFromB:
1012 func = YJpsiBPbPb;
fe4da5cc 1013 break;
0ad09590 1014 case kUpsilonFamily:
88e5db43 1015 case kUpsilonP:
1016 case kUpsilonPP:
34f60c01 1017 case kUpsilon:
bb6e81ac 1018 if (sname == "Vogt" || sname == "Vogt PbPb") {
05932df6 1019 func=YUpsilonPbPb;
bb6e81ac 1020 } else if (sname == "Vogt pp") {
1021 func = YUpsilonPP;
0e137c25 1022 } else if (sname == "CDF scaled") {
1023 func=YUpsilonCDFscaled;
9ff13849 1024 } else if (sname == "CDF pp") {
1025 func=YUpsilonCDFscaledPP;
4ca8d070 1026 } else if (sname == "Flat") {
1027 func=YUpsilonFlat;
05932df6 1028 } else {
1029 func=YUpsilon;
1030 }
fe4da5cc 1031 break;
34f60c01 1032 case kCharm:
fe4da5cc 1033 func=YCharm;
1034 break;
34f60c01 1035 case kBeauty:
fe4da5cc 1036 func=YBeauty;
1037 break;
34f60c01 1038 case kPion:
753690b0 1039 func=YPion;
1040 break;
34f60c01 1041 case kKaon:
753690b0 1042 func=YKaon;
1043 break;
00935af2 1044 case kChi_c0:
1045 func=YChi_c0;
1046 break;
1047 case kChi_c1:
1048 func=YChi_c1;
1049 break;
1050 case kChi_c2:
1051 func=YChi_c2;
1052 break;
1053 case kChi_c:
1054 func=YChi_c;
1055 break;
119b35c7 1056 default:
1057 func=0;
1058 printf("<AliGenMUONlib::GetY> unknown parametrisation\n");
fe4da5cc 1059 }
1060 return func;
1061}
00935af2 1062
1063//
1064// Chi
1065//
1066//
1067// pt-distribution
1068//____________________________________________________________
1069Double_t AliGenMUONlib::PtChi_c0( Double_t *px, Double_t */*dummy*/)
1070{
1071// Chi_c1 pT
1072 const Double_t kpt0 = 4.;
1073 const Double_t kxn = 3.6;
1074 Double_t x=*px;
1075 //
1076 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1077 return x/TMath::Power(pass1,kxn);
1078}
1079Double_t AliGenMUONlib::PtChi_c1( Double_t *px, Double_t */*dummy*/)
1080{
1081// Chi_c1 pT
1082 const Double_t kpt0 = 4.;
1083 const Double_t kxn = 3.6;
1084 Double_t x=*px;
1085 //
1086 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1087 return x/TMath::Power(pass1,kxn);
1088}
1089Double_t AliGenMUONlib::PtChi_c2( Double_t *px, Double_t */*dummy*/)
1090{
1091// Chi_c2 pT
1092 const Double_t kpt0 = 4.;
1093 const Double_t kxn = 3.6;
1094 Double_t x=*px;
1095 //
1096 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1097 return x/TMath::Power(pass1,kxn);
1098}
1099Double_t AliGenMUONlib::PtChi_c( Double_t *px, Double_t */*dummy*/)
1100{
1101// Chi_c family pT
1102 const Double_t kpt0 = 4.;
1103 const Double_t kxn = 3.6;
1104 Double_t x=*px;
1105 //
1106 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
1107 return x/TMath::Power(pass1,kxn);
1108}
1109
1110//
1111// y-distribution
1112//____________________________________________________________
1113Double_t AliGenMUONlib::YChi_c0(Double_t *py, Double_t */*dummy*/)
1114{
1115// Chi-1c y
1116 const Double_t ky0 = 4.;
1117 const Double_t kb=1.;
1118 Double_t yj;
1119 Double_t y=TMath::Abs(*py);
1120 //
1121 if (y < ky0)
1122 yj=kb;
1123 else
1124 yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
1125 return yj;
1126}
1127
1128Double_t AliGenMUONlib::YChi_c1(Double_t *py, Double_t */*dummy*/)
1129{
1130// Chi-1c y
1131 const Double_t ky0 = 4.;
1132 const Double_t kb=1.;
1133 Double_t yj;
1134 Double_t y=TMath::Abs(*py);
1135 //
1136 if (y < ky0)
1137 yj=kb;
1138 else
1139 yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
1140 return yj;
1141}
1142
1143Double_t AliGenMUONlib::YChi_c2(Double_t *py, Double_t */*dummy*/)
1144{
1145// Chi-2c y
1146 const Double_t ky0 = 4.;
1147 const Double_t kb=1.;
1148 Double_t yj;
1149 Double_t y=TMath::Abs(*py);
1150 //
1151 if (y < ky0)
1152 yj=kb;
1153 else
1154 yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
1155 return yj;
1156}
1157
1158Double_t AliGenMUONlib::YChi_c(Double_t *py, Double_t */*dummy*/)
1159{
1160// Chi_c family y
1161 const Double_t ky0 = 4.;
1162 const Double_t kb=1.;
1163 Double_t yj;
1164 Double_t y=TMath::Abs(*py);
1165 //
1166 if (y < ky0)
1167 yj=kb;
1168 else
1169 yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
1170 return yj;
1171}
1172
1173// particle composition
1174//
1175Int_t AliGenMUONlib::IpChi_c0(TRandom *)
1176{
1177// Chi composition
1178 return 10441;
1179}
1180//
1181Int_t AliGenMUONlib::IpChi_c1(TRandom *)
1182{
1183// Chi composition
1184 return 20443;
1185}
1186Int_t AliGenMUONlib::IpChi_c2(TRandom *)
1187{
1188// Chi_c2 prime composition
1189 return 445;
1190}
1191Int_t AliGenMUONlib::IpChi_c(TRandom *)
1192{
1193// Chi composition
1194 Int_t ip;
1195 Float_t r = gRandom->Rndm();
1196 if (r < 0.001) {
1197 ip = 10441;
1198 } else if( r < 0.377 ) {
1199 ip = 20443;
1200 } else {
1201 ip = 445;
1202 }
1203 return ip;
1204}
1205
1206
1207//_____________________________________________________________
1208
65fb704d 1209typedef Int_t (*GenFuncIp) (TRandom *);
198bb1c7 1210GenFuncIp AliGenMUONlib::GetIp(Int_t param, const char* /*tname*/) const
fe4da5cc 1211{
d90f80fd 1212// Return pointer to particle type parameterisation
fe4da5cc 1213 GenFuncIp func;
753690b0 1214 switch (param)
fe4da5cc 1215 {
34f60c01 1216 case kPhi:
fe4da5cc 1217 func=IpPhi;
1218 break;
89512a3b 1219 case kEta:
1220 func=IpEta;
1221 break;
1222 case kOmega:
1223 func=IpOmega;
1224 break;
0ad09590 1225 case kJpsiFamily:
1226 func=IpJpsiFamily;
1227 break;
88e5db43 1228 case kPsiP:
1229 func=IpPsiP;
1230 break;
34f60c01 1231 case kJpsi:
17d28ba5 1232 case kJpsiFromB:
fe4da5cc 1233 func=IpJpsi;
1234 break;
34f60c01 1235 case kUpsilon:
fe4da5cc 1236 func=IpUpsilon;
1237 break;
0ad09590 1238 case kUpsilonFamily:
1239 func=IpUpsilonFamily;
1240 break;
88e5db43 1241 case kUpsilonP:
1242 func=IpUpsilonP;
1243 break;
1244 case kUpsilonPP:
1245 func=IpUpsilonPP;
1246 break;
34f60c01 1247 case kCharm:
fe4da5cc 1248 func=IpCharm;
1249 break;
34f60c01 1250 case kBeauty:
fe4da5cc 1251 func=IpBeauty;
1252 break;
34f60c01 1253 case kPion:
753690b0 1254 func=IpPion;
1255 break;
34f60c01 1256 case kKaon:
753690b0 1257 func=IpKaon;
1258 break;
00935af2 1259 case kChi_c0:
1260 func=IpChi_c0;
1261 break;
1262 case kChi_c1:
1263 func=IpChi_c1;
1264 break;
1265 case kChi_c2:
1266 func=IpChi_c2;
1267 break;
1268 case kChi_c:
1269 func=IpChi_c;
1270 break;
119b35c7 1271 default:
1272 func=0;
1273 printf("<AliGenMUONlib::GetIp> unknown parametrisation\n");
fe4da5cc 1274 }
1275 return func;
1276}
1277
1278
753690b0 1279
05932df6 1280Float_t AliGenMUONlib::Interpolate(Float_t x, Float_t* y, Float_t x0,
1281 Float_t dx,
1282 Int_t n, Int_t no)
1283{
1284//
1285// Neville's alorithm for interpolation
1286//
1287// x: x-value
1288// y: Input array
1289// x0: minimum x
1290// dx: step size
1291// n: number of data points
1292// no: order of polynom
1293//
1294 Float_t* c = new Float_t[n];
1295 Float_t* d = new Float_t[n];
1296 Int_t m, i;
1297 for (i = 0; i < n; i++) {
1298 c[i] = y[i];
1299 d[i] = y[i];
1300 }
1301
1302 Int_t ns = int((x - x0)/dx);
1303
1304 Float_t y1 = y[ns];
1305 ns--;
1306 for (m = 0; m < no; m++) {
1307 for (i = 0; i < n-m; i++) {
1308 Float_t ho = x0 + Float_t(i) * dx - x;
1309 Float_t hp = x0 + Float_t(i+m+1) * dx - x;
1310 Float_t w = c[i+1] - d[i];
1311 Float_t den = ho-hp;
1312 den = w/den;
1313 d[i] = hp * den;
1314 c[i] = ho * den;
1315 }
1316 Float_t dy;
1317
1318 if (2*ns < (n-m-1)) {
1319 dy = c[ns+1];
1320 } else {
1321 dy = d[ns--];
1322 }
1323 y1 += dy;}
1324 delete[] c;
1325 delete[] d;
1326
1327 return y1;
1328}
1329
753690b0 1330