]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenMUONlib.cxx
primary Z coord. vertex finder. Possibly a better and faster solution for pp. Efficie...
[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
198bb1c7 165Double_t AliGenMUONlib::PtJpsiPbPb( Double_t *px, Double_t */*dummy*/)
05932df6 166{
1af7144e 167// J/Psi pT spectrum
05932df6 168//
169// R. Vogt 2002
170// PbPb 5.5 TeV
171// MRST HO
172// mc = 1.4 GeV, pt-kick 1 GeV
173//
1af7144e 174 Float_t x = px[0];
175 Float_t c[8] = {
176 -2.13098e+00, 9.46552e+00, -5.06799e+00, 1.27260e+00,
177 -1.83806e-01, 1.55853e-02, -7.23241e-04, 1.42105e-05
05932df6 178 };
1af7144e 179
3d905dd7 180 Double_t y;
181 if (x < 10.) {
182 Int_t j;
183 y = c[j = 7];
184 while (j > 0) y = y * x +c[--j];
185 y = x * TMath::Exp(y);
186 } else {
187 y = 0.;
188 }
1af7144e 189 return y;
05932df6 190}
17d28ba5 191
192Double_t AliGenMUONlib::PtJpsiBPbPb( Double_t *px, Double_t */*dummy*/)
193{
194// J/Psi pT spectrum
195// B -> J/Psi X
196 Double_t x0 = 4.0384;
197 Double_t n = 3.0288;
198
199 Double_t x = px[0];
200 Double_t y = x / TMath::Power((1. + (x/x0)*(x/x0)), n);
201
202 return y;
203}
204
205
198bb1c7 206Double_t AliGenMUONlib::PtJpsiPP( Double_t *px, Double_t */*dummy*/)
bb6e81ac 207{
208// J/Psi pT spectrum
209//
210// R. Vogt 2002
211// pp 14 TeV
212// MRST HO
213// mc = 1.4 GeV, pt-kick 1 GeV
214//
215 Float_t x = px[0];
216 Float_t c[4] = {8.47471e+00, -1.93567e+00, 1.50271e-01, -5.51212e-03};
217
218 Double_t y;
219 if (x < 10.) {
220 Int_t j;
221 y = c[j = 3];
222 while (j > 0) y = y * x +c[--j];
223 y = x * TMath::Exp(y);
224 } else {
225 y = 0.;
226 }
227 return y;
228}
229
fe4da5cc 230//
231// y-distribution
232//____________________________________________________________
198bb1c7 233Double_t AliGenMUONlib::YJpsi(Double_t *py, Double_t */*dummy*/)
fe4da5cc 234{
d90f80fd 235// J/psi y
236 const Double_t ky0 = 4.;
237 const Double_t kb=1.;
fe4da5cc 238 Double_t yj;
239 Double_t y=TMath::Abs(*py);
240 //
d90f80fd 241 if (y < ky0)
242 yj=kb;
fe4da5cc 243 else
d90f80fd 244 yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
fe4da5cc 245 return yj;
246}
05932df6 247
248
198bb1c7 249Double_t AliGenMUONlib::YJpsiPbPb( Double_t *px, Double_t */*dummy*/)
05932df6 250{
251
252//
253// J/Psi y
254//
255//
256// R. Vogt 2002
257// PbPb 5.5 TeV
258// MRST HO
259// mc = 1.4 GeV, pt-kick 1 GeV
260//
1af7144e 261 Double_t c[5] = {-6.03425e+02, 4.98257e+02, -1.38794e+02, 1.62209e+01, -6.85955e-01};
262 Double_t x = TMath::Abs(px[0]);
263 Double_t y;
264
265 if (x < 4.) {
266 y = 31.754;
267 } else if (x < 6) {
268 Int_t j;
269 y = c[j = 4];
270 while (j > 0) y = y * x + c[--j];
271 } else {
272 y =0.;
273 }
274
275 return y;
05932df6 276}
277
198bb1c7 278Double_t AliGenMUONlib::YJpsiPP( Double_t *px, Double_t */*dummy*/)
bb6e81ac 279{
280
281//
282// J/Psi y
283//
284//
285// R. Vogt 2002
286// pp 14 TeV
287// MRST HO
288// mc = 1.4 GeV, pt-kick 1 GeV
289//
290
291 Double_t c[5] = {1.38532e+00, 1.00596e+02, -3.46378e+01, 3.94172e+00, -1.48319e-01};
292 Double_t x = TMath::Abs(px[0]);
293 Double_t y;
294
295 if (x < 2.5) {
296 y = 96.455 - 0.8483 * x * x;
297 } else if (x < 7.9) {
298 Int_t j;
299 y = c[j = 4];
300 while (j > 0) y = y * x + c[--j];
301 } else {
302 y =0.;
303 }
304
305 return y;
306}
307
17d28ba5 308Double_t AliGenMUONlib::YJpsiBPbPb( Double_t *px, Double_t */*dummy*/)
309{
310
311//
312// J/Psi from B->J/Psi X
313//
314//
315
316
317 Double_t c[7] = {7.37025e-02, 0., -2.94487e-03, 0., 6.07953e-06, 0., 5.39219e-07};
318
319 Double_t x = TMath::Abs(px[0]);
320 Double_t y;
321
322 if (x > 6.) {
323 y = 0.;
324 } else {
325 Int_t j;
326 y = c[j = 6];
327 while (j > 0) y = y * x + c[--j];
328 }
329
330 return y;
331}
332
333
334
fe4da5cc 335// particle composition
336//
65fb704d 337Int_t AliGenMUONlib::IpJpsi(TRandom *)
fe4da5cc 338{
d90f80fd 339// J/Psi composition
88cb7938 340 return 443;
fe4da5cc 341}
342
343// Upsilon
344//
345//
346// pt-distribution
347//____________________________________________________________
198bb1c7 348Double_t AliGenMUONlib::PtUpsilon( Double_t *px, Double_t */*dummy*/ )
fe4da5cc 349{
d90f80fd 350// Upsilon pT
351 const Double_t kpt0 = 5.3;
352 const Double_t kxn = 2.5;
fe4da5cc 353 Double_t x=*px;
354 //
d90f80fd 355 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
356 return x/TMath::Power(pass1,kxn);
fe4da5cc 357}
05932df6 358
198bb1c7 359Double_t AliGenMUONlib::PtUpsilonPbPb( Double_t *px, Double_t */*dummy*/)
05932df6 360{
361
362//
363// Upsilon pT
364//
365//
366// R. Vogt 2002
367// PbPb 5.5 TeV
368// MRST HO
369// mc = 1.4 GeV, pt-kick 1 GeV
370//
1af7144e 371 Float_t x = px[0];
372 Double_t c[8] = {
373 -1.03488e+01, 1.28065e+01, -6.60500e+00, 1.66140e+00,
374 -2.34293e-01, 1.86925e-02, -7.80708e-04, 1.30610e-05
375 };
3d905dd7 376 Double_t y;
377 if (x < 10.) {
378 Int_t j;
379 y = c[j = 7];
380 while (j > 0) y = y * x +c[--j];
381 y = x * TMath::Exp(y);
382 } else {
383 y = 0.;
384 }
1af7144e 385 return y;
05932df6 386}
387
198bb1c7 388Double_t AliGenMUONlib::PtUpsilonPP( Double_t *px, Double_t */*dummy*/)
bb6e81ac 389{
390
391//
392// Upsilon pT
393//
394//
395// R. Vogt 2002
396// pp 14 TeV
397// MRST HO
398// mc = 1.4 GeV, pt-kick 1 GeV
399//
400 Float_t x = px[0];
401 Double_t c[8] = {-7.93955e+00, 1.06306e+01, -5.21392e+00, 1.19703e+00,
402 -1.45718e-01, 8.95151e-03, -2.04806e-04, -1.13053e-06};
403
404 Double_t y;
405 if (x < 10.) {
406 Int_t j;
407 y = c[j = 7];
408 while (j > 0) y = y * x +c[--j];
409 y = x * TMath::Exp(y);
410 } else {
411 y = 0.;
412 }
413 return y;
414}
415
fe4da5cc 416//
417// y-distribution
418//
419//____________________________________________________________
198bb1c7 420Double_t AliGenMUONlib::YUpsilon(Double_t *py, Double_t */*dummy*/)
fe4da5cc 421{
d90f80fd 422// Upsilon y
423 const Double_t ky0 = 3.;
424 const Double_t kb=1.;
fe4da5cc 425 Double_t yu;
426 Double_t y=TMath::Abs(*py);
427 //
d90f80fd 428 if (y < ky0)
429 yu=kb;
fe4da5cc 430 else
d90f80fd 431 yu=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
fe4da5cc 432 return yu;
433}
05932df6 434
435
198bb1c7 436Double_t AliGenMUONlib::YUpsilonPbPb( Double_t *px, Double_t */*dummy*/)
05932df6 437{
438
439//
440// Upsilon y
441//
442//
443// R. Vogt 2002
444// PbPb 5.5 TeV
445// MRST HO
446// mc = 1.4 GeV, pt-kick 1 GeV
447//
448
1af7144e 449 Double_t c[7] = {3.40036e-01, -3.98882e-07, -4.48398e-03, 8.46411e-08, -6.10854e-04,
450 -2.99753e-09, 1.28895e-05};
451
452 Double_t x = px[0];
453 if (TMath::Abs(x) > 5.55) return 0.;
454 Int_t j;
455 Double_t y = c[j = 6];
456 while (j > 0) y = y * x +c[--j];
457 return y;
05932df6 458}
459
198bb1c7 460Double_t AliGenMUONlib::YUpsilonPP( Double_t *px, Double_t */*dummy*/)
bb6e81ac 461{
462
463//
464// Upsilon y
465//
466//
467// R. Vogt 2002
468// p p 14. TeV
469// MRST HO
470// mc = 1.4 GeV, pt-kick 1 GeV
471//
472 Double_t c[7] = {8.91936e-01, -6.46645e-07, -1.52774e-02, 4.28677e-08, -7.01517e-04,
473 -6.20539e-10, 1.29943e-05};
474
475 Double_t x = px[0];
476 if (TMath::Abs(x) > 6.2) return 0.;
477 Int_t j;
478 Double_t y = c[j = 6];
479 while (j > 0) y = y * x +c[--j];
480 return y;
481}
482
fe4da5cc 483// particle composition
484//
65fb704d 485Int_t AliGenMUONlib::IpUpsilon(TRandom *)
fe4da5cc 486{
d90f80fd 487// y composition
88cb7938 488 return 553;
fe4da5cc 489}
490
491//
492// Phi
493//
494//
495// pt-distribution (by scaling of pion distribution)
496//____________________________________________________________
198bb1c7 497Double_t AliGenMUONlib::PtPhi( Double_t *px, Double_t */*dummy*/)
fe4da5cc 498{
d90f80fd 499// Phi pT
fe4da5cc 500 return PtScal(*px,7);
501}
502// y-distribution
198bb1c7 503Double_t AliGenMUONlib::YPhi( Double_t *px, Double_t */*dummy*/)
fe4da5cc 504{
d90f80fd 505// Phi y
506 Double_t *dum=0;
507 return YJpsi(px,dum);
fe4da5cc 508}
509// particle composition
510//
65fb704d 511Int_t AliGenMUONlib::IpPhi(TRandom *)
fe4da5cc 512{
d90f80fd 513// Phi composition
89512a3b 514 return 333;
515}
516
517//
518// omega
519//
520//
521// pt-distribution (by scaling of pion distribution)
522//____________________________________________________________
198bb1c7 523Double_t AliGenMUONlib::PtOmega( Double_t *px, Double_t */*dummy*/)
89512a3b 524{
525// Omega pT
526 return PtScal(*px,5);
527}
528// y-distribution
198bb1c7 529Double_t AliGenMUONlib::YOmega( Double_t *px, Double_t */*dummy*/)
89512a3b 530{
531// Omega y
532 Double_t *dum=0;
533 return YJpsi(px,dum);
534}
535// particle composition
536//
537Int_t AliGenMUONlib::IpOmega(TRandom *)
538{
539// Omega composition
540 return 223;
541}
542
543
544//
545// Eta
546//
547//
548// pt-distribution (by scaling of pion distribution)
549//____________________________________________________________
198bb1c7 550Double_t AliGenMUONlib::PtEta( Double_t *px, Double_t */*dummy*/)
89512a3b 551{
552// Eta pT
553 return PtScal(*px,3);
554}
555// y-distribution
198bb1c7 556Double_t AliGenMUONlib::YEta( Double_t *px, Double_t */*dummy*/)
89512a3b 557{
558// Eta y
559 Double_t *dum=0;
560 return YJpsi(px,dum);
561}
562// particle composition
563//
564Int_t AliGenMUONlib::IpEta(TRandom *)
565{
566// Eta composition
567 return 221;
fe4da5cc 568}
569
570//
571// Charm
572//
573//
574// pt-distribution
575//____________________________________________________________
198bb1c7 576Double_t AliGenMUONlib::PtCharm( Double_t *px, Double_t */*dummy*/)
fe4da5cc 577{
d90f80fd 578// Charm pT
579 const Double_t kpt0 = 4.08;
580 const Double_t kxn = 9.40;
2280e6af 581
fe4da5cc 582 Double_t x=*px;
583 //
2280e6af 584 Double_t pass1 = 1.+(x/kpt0);
d90f80fd 585 return x/TMath::Power(pass1,kxn);
fe4da5cc 586}
587// y-distribution
198bb1c7 588Double_t AliGenMUONlib::YCharm( Double_t *px, Double_t */*dummy*/)
fe4da5cc 589{
d90f80fd 590// Charm y
591 Double_t *dum=0;
592 return YJpsi(px,dum);
fe4da5cc 593}
594
65fb704d 595Int_t AliGenMUONlib::IpCharm(TRandom *ran)
fe4da5cc 596{
d90f80fd 597// Charm composition
65fb704d 598 Float_t random;
fe4da5cc 599 Int_t ip;
600// 411,421,431,4122
65fb704d 601 random = ran->Rndm();
602 if (random < 0.5) {
fe4da5cc 603 ip=411;
65fb704d 604 } else if (random < 0.75) {
fe4da5cc 605 ip=421;
65fb704d 606 } else if (random < 0.90) {
fe4da5cc 607 ip=431;
608 } else {
609 ip=4122;
610 }
65fb704d 611 if (ran->Rndm() < 0.5) {ip=-ip;}
fe4da5cc 612
613 return ip;
614}
615
616
617//
618// Beauty
619//
620//
621// pt-distribution
622//____________________________________________________________
198bb1c7 623Double_t AliGenMUONlib::PtBeauty( Double_t *px, Double_t */*dummy*/)
fe4da5cc 624{
d90f80fd 625// Beauty pT
626 const Double_t kpt0 = 4.;
627 const Double_t kxn = 3.6;
fe4da5cc 628 Double_t x=*px;
629 //
d90f80fd 630 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
631 return x/TMath::Power(pass1,kxn);
fe4da5cc 632}
633// y-distribution
198bb1c7 634Double_t AliGenMUONlib::YBeauty( Double_t *px, Double_t */*dummy*/)
fe4da5cc 635{
d90f80fd 636// Beauty y
637 Double_t *dum=0;
638 return YJpsi(px,dum);
fe4da5cc 639}
640
65fb704d 641Int_t AliGenMUONlib::IpBeauty(TRandom *ran)
fe4da5cc 642{
d90f80fd 643// Beauty Composition
65fb704d 644 Float_t random;
fe4da5cc 645 Int_t ip;
65fb704d 646 random = ran->Rndm();
647 if (random < 0.5) {
fe4da5cc 648 ip=511;
65fb704d 649 } else if (random < 0.75) {
fe4da5cc 650 ip=521;
65fb704d 651 } else if (random < 0.90) {
fe4da5cc 652 ip=531;
653 } else {
654 ip=5122;
655 }
65fb704d 656 if (ran->Rndm() < 0.5) {ip=-ip;}
fe4da5cc 657
658 return ip;
659}
660
661typedef Double_t (*GenFunc) (Double_t*, Double_t*);
53904666 662GenFunc AliGenMUONlib::GetPt(Int_t param, const char* tname) const
fe4da5cc 663{
d90f80fd 664// Return pointer to pT parameterisation
05932df6 665 TString sname = TString(tname);
fe4da5cc 666 GenFunc func;
753690b0 667 switch (param)
fe4da5cc 668 {
34f60c01 669 case kPhi:
fe4da5cc 670 func=PtPhi;
671 break;
89512a3b 672 case kOmega:
673 func=PtOmega;
674 break;
675 case kEta:
676 func=PtEta;
677 break;
34f60c01 678 case kJpsi:
bb6e81ac 679 if (sname == "Vogt" || sname == "Vogt PbPb") {
05932df6 680 func=PtJpsiPbPb;
bb6e81ac 681 } else if (sname == "Vogt pp") {
682 func=PtJpsiPP;
05932df6 683 } else {
684 func=PtJpsi;
685 }
fe4da5cc 686 break;
17d28ba5 687 case kJpsiFromB:
688 func = PtJpsiBPbPb;
689 break;
34f60c01 690 case kUpsilon:
bb6e81ac 691 if (sname == "Vogt" || sname == "Vogt PbPb") {
05932df6 692 func=PtUpsilonPbPb;
bb6e81ac 693 } else if (sname == "Vogt pp") {
694 func=PtUpsilonPP;
05932df6 695 } else {
696 func=PtUpsilon;
697 }
fe4da5cc 698 break;
34f60c01 699 case kCharm:
fe4da5cc 700 func=PtCharm;
701 break;
34f60c01 702 case kBeauty:
fe4da5cc 703 func=PtBeauty;
704 break;
34f60c01 705 case kPion:
753690b0 706 func=PtPion;
707 break;
34f60c01 708 case kKaon:
753690b0 709 func=PtKaon;
710 break;
119b35c7 711 default:
712 func=0;
713 printf("<AliGenMUONlib::GetPt> unknown parametrisation\n");
fe4da5cc 714 }
715 return func;
716}
717
53904666 718GenFunc AliGenMUONlib::GetY(Int_t param, const char* tname) const
fe4da5cc 719{
05932df6 720 TString sname = TString(tname);
721
d90f80fd 722// Return pointer to y- parameterisation
fe4da5cc 723 GenFunc func;
753690b0 724 switch (param)
fe4da5cc 725 {
34f60c01 726 case kPhi:
fe4da5cc 727 func=YPhi;
728 break;
89512a3b 729 case kEta:
730 func=YEta;
731 break;
732 case kOmega:
733 func=YOmega;
734 break;
34f60c01 735 case kJpsi:
bb6e81ac 736 if (sname == "Vogt" || sname == "Vogt PbPb") {
05932df6 737 func=YJpsiPbPb;
bb6e81ac 738 } else if (sname == "Vogt pp"){
739 func=YJpsiPP;
05932df6 740 } else {
741 func=YJpsi;
742 }
bb6e81ac 743
17d28ba5 744 break;
745 case kJpsiFromB:
746 func = YJpsiBPbPb;
fe4da5cc 747 break;
34f60c01 748 case kUpsilon:
bb6e81ac 749 if (sname == "Vogt" || sname == "Vogt PbPb") {
05932df6 750 func=YUpsilonPbPb;
bb6e81ac 751 } else if (sname == "Vogt pp") {
752 func = YUpsilonPP;
05932df6 753 } else {
754 func=YUpsilon;
755 }
fe4da5cc 756 break;
34f60c01 757 case kCharm:
fe4da5cc 758 func=YCharm;
759 break;
34f60c01 760 case kBeauty:
fe4da5cc 761 func=YBeauty;
762 break;
34f60c01 763 case kPion:
753690b0 764 func=YPion;
765 break;
34f60c01 766 case kKaon:
753690b0 767 func=YKaon;
768 break;
119b35c7 769 default:
770 func=0;
771 printf("<AliGenMUONlib::GetY> unknown parametrisation\n");
fe4da5cc 772 }
773 return func;
774}
65fb704d 775typedef Int_t (*GenFuncIp) (TRandom *);
198bb1c7 776GenFuncIp AliGenMUONlib::GetIp(Int_t param, const char* /*tname*/) const
fe4da5cc 777{
d90f80fd 778// Return pointer to particle type parameterisation
fe4da5cc 779 GenFuncIp func;
753690b0 780 switch (param)
fe4da5cc 781 {
34f60c01 782 case kPhi:
fe4da5cc 783 func=IpPhi;
784 break;
89512a3b 785 case kEta:
786 func=IpEta;
787 break;
788 case kOmega:
789 func=IpOmega;
790 break;
34f60c01 791 case kJpsi:
17d28ba5 792 case kJpsiFromB:
fe4da5cc 793 func=IpJpsi;
794 break;
34f60c01 795 case kUpsilon:
fe4da5cc 796 func=IpUpsilon;
797 break;
34f60c01 798 case kCharm:
fe4da5cc 799 func=IpCharm;
800 break;
34f60c01 801 case kBeauty:
fe4da5cc 802 func=IpBeauty;
803 break;
34f60c01 804 case kPion:
753690b0 805 func=IpPion;
806 break;
34f60c01 807 case kKaon:
753690b0 808 func=IpKaon;
809 break;
119b35c7 810 default:
811 func=0;
812 printf("<AliGenMUONlib::GetIp> unknown parametrisation\n");
fe4da5cc 813 }
814 return func;
815}
816
817
753690b0 818
05932df6 819Float_t AliGenMUONlib::Interpolate(Float_t x, Float_t* y, Float_t x0,
820 Float_t dx,
821 Int_t n, Int_t no)
822{
823//
824// Neville's alorithm for interpolation
825//
826// x: x-value
827// y: Input array
828// x0: minimum x
829// dx: step size
830// n: number of data points
831// no: order of polynom
832//
833 Float_t* c = new Float_t[n];
834 Float_t* d = new Float_t[n];
835 Int_t m, i;
836 for (i = 0; i < n; i++) {
837 c[i] = y[i];
838 d[i] = y[i];
839 }
840
841 Int_t ns = int((x - x0)/dx);
842
843 Float_t y1 = y[ns];
844 ns--;
845 for (m = 0; m < no; m++) {
846 for (i = 0; i < n-m; i++) {
847 Float_t ho = x0 + Float_t(i) * dx - x;
848 Float_t hp = x0 + Float_t(i+m+1) * dx - x;
849 Float_t w = c[i+1] - d[i];
850 Float_t den = ho-hp;
851 den = w/den;
852 d[i] = hp * den;
853 c[i] = ho * den;
854 }
855 Float_t dy;
856
857 if (2*ns < (n-m-1)) {
858 dy = c[ns+1];
859 } else {
860 dy = d[ns--];
861 }
862 y1 += dy;}
863 delete[] c;
864 delete[] d;
865
866 return y1;
867}
868
753690b0 869