Add const to SolenoidField() method for correct overwriting from the parent class
[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
16/*
17$Log$
53904666 18Revision 1.14 2002/02/22 17:26:43 morsch
19Eta and omega added.
20
89512a3b 21Revision 1.13 2001/03/27 11:01:04 morsch
22Charm pt-distribution corrected. More realistic y-distribution for pi and K.
23
2280e6af 24Revision 1.12 2001/03/09 13:01:41 morsch
25- enum constants for paramterisation type (particle family) moved to AliGen*lib.h
26- use AliGenGSIlib::kUpsilon, AliGenPHOSlib::kEtaPrime to access the constants
27
34f60c01 28Revision 1.11 2000/11/30 07:12:50 alibrary
29Introducing new Rndm and QA classes
30
65fb704d 31Revision 1.10 2000/06/29 21:08:27 morsch
32All paramatrisation libraries derive from the pure virtual base class AliGenLib.
33This allows to pass a pointer to a library directly to AliGenParam and avoids the
34use of function pointers in Config.C.
35
b22ee262 36Revision 1.9 2000/06/14 15:20:56 morsch
37Include clean-up (IH)
38
5c3fd7ea 39Revision 1.8 2000/06/09 20:32:11 morsch
40All coding rule violations except RS3 corrected
41
f87cfe57 42Revision 1.7 2000/05/02 08:12:13 morsch
43Coding rule violations corrected.
44
d90f80fd 45Revision 1.6 1999/09/29 09:24:14 fca
46Introduction of the Copyright and cvs Log
47
4c039060 48*/
49
53904666 50// Library class for particle pt and y distributions used for
51// muon spectrometer simulations.
52// To be used with AliGenParam.
53// The following particle typed can be simulated:
54// pi, K, phi, omega, eta, J/Psi, Upsilon, charm and beauty mesons.
55//
56// andreas.morsch@cern.ch
57//
58
65fb704d 59#include "TMath.h"
60#include "TRandom.h"
61
fe4da5cc 62#include "AliGenMUONlib.h"
5c3fd7ea 63
fe4da5cc 64ClassImp(AliGenMUONlib)
65//
66// Pions
d90f80fd 67Double_t AliGenMUONlib::PtPion(Double_t *px, Double_t *dummy)
fe4da5cc 68{
69//
70// PT-PARAMETERIZATION CDF, PRL 61(88) 1819
71// POWER LAW FOR PT > 500 MEV
72// MT SCALING BELOW (T=160 MEV)
73//
d90f80fd 74 const Double_t kp0 = 1.3;
75 const Double_t kxn = 8.28;
76 const Double_t kxlim=0.5;
77 const Double_t kt=0.160;
78 const Double_t kxmpi=0.139;
79 const Double_t kb=1.;
fe4da5cc 80 Double_t y, y1, xmpi2, ynorm, a;
81 Double_t x=*px;
82 //
d90f80fd 83 y1=TMath::Power(kp0/(kp0+kxlim),kxn);
84 xmpi2=kxmpi*kxmpi;
85 ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+xmpi2)/kt));
fe4da5cc 86 a=ynorm/y1;
d90f80fd 87 if (x > kxlim)
88 y=a*TMath::Power(kp0/(kp0+x),kxn);
fe4da5cc 89 else
d90f80fd 90 y=kb*TMath::Exp(-sqrt(x*x+xmpi2)/kt);
fe4da5cc 91 return y*x;
92}
753690b0 93//
94// y-distribution
95//
d90f80fd 96Double_t AliGenMUONlib::YPion( Double_t *py, Double_t *dummy)
753690b0 97{
d90f80fd 98// Pion y
2280e6af 99 Double_t y=TMath::Abs(*py);
100/*
d90f80fd 101 const Double_t ka = 7000.;
102 const Double_t kdy = 4.;
d90f80fd 103 Double_t ex = y*y/(2*kdy*kdy);
104 return ka*TMath::Exp(-ex);
2280e6af 105*/
106 return 1.16526e+04+y*-3.79886e+03+y*y*4.31130e+02;
107
753690b0 108}
109// particle composition
110//
65fb704d 111Int_t AliGenMUONlib::IpPion(TRandom *ran)
753690b0 112{
d90f80fd 113// Pion composition
65fb704d 114 if (ran->Rndm() < 0.5) {
753690b0 115 return 211;
116 } else {
117 return -211;
118 }
119}
fe4da5cc 120
121//____________________________________________________________
122//
123// Mt-scaling
124
125Double_t AliGenMUONlib::PtScal(Double_t pt, Int_t np)
126{
127 // SCALING EN MASSE PAR RAPPORT A PTPI
128 // MASS PI,K,ETA,RHO,OMEGA,ETA',PHI
d90f80fd 129 const Double_t khm[10] = {.13957,.493,.5488,.769,.7826,.958,1.02,0,0,0};
fe4da5cc 130 // VALUE MESON/PI AT 5 GEV
d90f80fd 131 const Double_t kfmax[10]={1.,0.3,0.55,1.0,1.0,1.0,1.0,0,0,0};
fe4da5cc 132 np--;
d90f80fd 133 Double_t f5=TMath::Power(((sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3);
134 Double_t fmax2=f5/kfmax[np];
fe4da5cc 135 // PIONS
136 Double_t ptpion=100.*PtPion(&pt, (Double_t*) 0);
137 Double_t fmtscal=TMath::Power(((sqrt(pt*pt+0.018215)+2.)/
d90f80fd 138 (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/ fmax2;
fe4da5cc 139 return fmtscal*ptpion;
140}
141//
753690b0 142// kaon
143//
144// pt-distribution
145//____________________________________________________________
d90f80fd 146Double_t AliGenMUONlib::PtKaon( Double_t *px, Double_t *dummy)
753690b0 147{
d90f80fd 148// Kaon pT
753690b0 149 return PtScal(*px,2);
150}
151
152// y-distribution
fe4da5cc 153//____________________________________________________________
d90f80fd 154Double_t AliGenMUONlib::YKaon( Double_t *py, Double_t *dummy)
fe4da5cc 155{
d90f80fd 156// Kaon y
2280e6af 157 Double_t y=TMath::Abs(*py);
158/*
d90f80fd 159 const Double_t ka = 1000.;
160 const Double_t kdy = 4.;
fe4da5cc 161 //
d90f80fd 162 Double_t ex = y*y/(2*kdy*kdy);
163 return ka*TMath::Exp(-ex);
2280e6af 164*/
165
166 return 1.16526e+04+y*-3.79886e+03+y*y*4.31130e+02;
753690b0 167}
168
169// particle composition
170//
65fb704d 171Int_t AliGenMUONlib::IpKaon(TRandom *ran)
753690b0 172{
d90f80fd 173// Kaon composition
65fb704d 174 if (ran->Rndm() < 0.5) {
753690b0 175 return 321;
176 } else {
177 return -321;
178 }
fe4da5cc 179}
753690b0 180
fe4da5cc 181// J/Psi
182//
183//
184// pt-distribution
185//____________________________________________________________
d90f80fd 186Double_t AliGenMUONlib::PtJpsi( Double_t *px, Double_t *dummy)
fe4da5cc 187{
d90f80fd 188// J/Psi pT
189 const Double_t kpt0 = 4.;
190 const Double_t kxn = 3.6;
fe4da5cc 191 Double_t x=*px;
192 //
d90f80fd 193 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
194 return x/TMath::Power(pass1,kxn);
fe4da5cc 195}
196//
197// y-distribution
198//____________________________________________________________
d90f80fd 199Double_t AliGenMUONlib::YJpsi(Double_t *py, Double_t *dummy)
fe4da5cc 200{
d90f80fd 201// J/psi y
202 const Double_t ky0 = 4.;
203 const Double_t kb=1.;
fe4da5cc 204 Double_t yj;
205 Double_t y=TMath::Abs(*py);
206 //
d90f80fd 207 if (y < ky0)
208 yj=kb;
fe4da5cc 209 else
d90f80fd 210 yj=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
fe4da5cc 211 return yj;
212}
213// particle composition
214//
65fb704d 215Int_t AliGenMUONlib::IpJpsi(TRandom *)
fe4da5cc 216{
d90f80fd 217// J/Psi composition
fe4da5cc 218 return 443;
219}
220
221// Upsilon
222//
223//
224// pt-distribution
225//____________________________________________________________
d90f80fd 226Double_t AliGenMUONlib::PtUpsilon( Double_t *px, Double_t *dummy )
fe4da5cc 227{
d90f80fd 228// Upsilon pT
229 const Double_t kpt0 = 5.3;
230 const Double_t kxn = 2.5;
fe4da5cc 231 Double_t x=*px;
232 //
d90f80fd 233 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
234 return x/TMath::Power(pass1,kxn);
fe4da5cc 235}
236//
237// y-distribution
238//
239//____________________________________________________________
d90f80fd 240Double_t AliGenMUONlib::YUpsilon(Double_t *py, Double_t *dummy)
fe4da5cc 241{
d90f80fd 242// Upsilon y
243 const Double_t ky0 = 3.;
244 const Double_t kb=1.;
fe4da5cc 245 Double_t yu;
246 Double_t y=TMath::Abs(*py);
247 //
d90f80fd 248 if (y < ky0)
249 yu=kb;
fe4da5cc 250 else
d90f80fd 251 yu=kb*TMath::Exp(-(y-ky0)*(y-ky0)/2);
fe4da5cc 252 return yu;
253}
254// particle composition
255//
65fb704d 256Int_t AliGenMUONlib::IpUpsilon(TRandom *)
fe4da5cc 257{
d90f80fd 258// y composition
fe4da5cc 259 return 553;
260}
261
262//
263// Phi
264//
265//
266// pt-distribution (by scaling of pion distribution)
267//____________________________________________________________
d90f80fd 268Double_t AliGenMUONlib::PtPhi( Double_t *px, Double_t *dummy)
fe4da5cc 269{
d90f80fd 270// Phi pT
fe4da5cc 271 return PtScal(*px,7);
272}
273// y-distribution
d90f80fd 274Double_t AliGenMUONlib::YPhi( Double_t *px, Double_t *dummy)
fe4da5cc 275{
d90f80fd 276// Phi y
277 Double_t *dum=0;
278 return YJpsi(px,dum);
fe4da5cc 279}
280// particle composition
281//
65fb704d 282Int_t AliGenMUONlib::IpPhi(TRandom *)
fe4da5cc 283{
d90f80fd 284// Phi composition
89512a3b 285 return 333;
286}
287
288//
289// omega
290//
291//
292// pt-distribution (by scaling of pion distribution)
293//____________________________________________________________
294Double_t AliGenMUONlib::PtOmega( Double_t *px, Double_t *dummy)
295{
296// Omega pT
297 return PtScal(*px,5);
298}
299// y-distribution
300Double_t AliGenMUONlib::YOmega( Double_t *px, Double_t *dummy)
301{
302// Omega y
303 Double_t *dum=0;
304 return YJpsi(px,dum);
305}
306// particle composition
307//
308Int_t AliGenMUONlib::IpOmega(TRandom *)
309{
310// Omega composition
311 return 223;
312}
313
314
315//
316// Eta
317//
318//
319// pt-distribution (by scaling of pion distribution)
320//____________________________________________________________
321Double_t AliGenMUONlib::PtEta( Double_t *px, Double_t *dummy)
322{
323// Eta pT
324 return PtScal(*px,3);
325}
326// y-distribution
327Double_t AliGenMUONlib::YEta( Double_t *px, Double_t *dummy)
328{
329// Eta y
330 Double_t *dum=0;
331 return YJpsi(px,dum);
332}
333// particle composition
334//
335Int_t AliGenMUONlib::IpEta(TRandom *)
336{
337// Eta composition
338 return 221;
fe4da5cc 339}
340
341//
342// Charm
343//
344//
345// pt-distribution
346//____________________________________________________________
d90f80fd 347Double_t AliGenMUONlib::PtCharm( Double_t *px, Double_t *dummy)
fe4da5cc 348{
d90f80fd 349// Charm pT
350 const Double_t kpt0 = 4.08;
351 const Double_t kxn = 9.40;
2280e6af 352
fe4da5cc 353 Double_t x=*px;
354 //
2280e6af 355 Double_t pass1 = 1.+(x/kpt0);
d90f80fd 356 return x/TMath::Power(pass1,kxn);
fe4da5cc 357}
358// y-distribution
d90f80fd 359Double_t AliGenMUONlib::YCharm( Double_t *px, Double_t *dummy)
fe4da5cc 360{
d90f80fd 361// Charm y
362 Double_t *dum=0;
363 return YJpsi(px,dum);
fe4da5cc 364}
365
65fb704d 366Int_t AliGenMUONlib::IpCharm(TRandom *ran)
fe4da5cc 367{
d90f80fd 368// Charm composition
65fb704d 369 Float_t random;
fe4da5cc 370 Int_t ip;
371// 411,421,431,4122
65fb704d 372 random = ran->Rndm();
373 if (random < 0.5) {
fe4da5cc 374 ip=411;
65fb704d 375 } else if (random < 0.75) {
fe4da5cc 376 ip=421;
65fb704d 377 } else if (random < 0.90) {
fe4da5cc 378 ip=431;
379 } else {
380 ip=4122;
381 }
65fb704d 382 if (ran->Rndm() < 0.5) {ip=-ip;}
fe4da5cc 383
384 return ip;
385}
386
387
388//
389// Beauty
390//
391//
392// pt-distribution
393//____________________________________________________________
d90f80fd 394Double_t AliGenMUONlib::PtBeauty( Double_t *px, Double_t *dummy)
fe4da5cc 395{
d90f80fd 396// Beauty pT
397 const Double_t kpt0 = 4.;
398 const Double_t kxn = 3.6;
fe4da5cc 399 Double_t x=*px;
400 //
d90f80fd 401 Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
402 return x/TMath::Power(pass1,kxn);
fe4da5cc 403}
404// y-distribution
d90f80fd 405Double_t AliGenMUONlib::YBeauty( Double_t *px, Double_t *dummy)
fe4da5cc 406{
d90f80fd 407// Beauty y
408 Double_t *dum=0;
409 return YJpsi(px,dum);
fe4da5cc 410}
411
65fb704d 412Int_t AliGenMUONlib::IpBeauty(TRandom *ran)
fe4da5cc 413{
d90f80fd 414// Beauty Composition
65fb704d 415 Float_t random;
fe4da5cc 416 Int_t ip;
65fb704d 417 random = ran->Rndm();
418 if (random < 0.5) {
fe4da5cc 419 ip=511;
65fb704d 420 } else if (random < 0.75) {
fe4da5cc 421 ip=521;
65fb704d 422 } else if (random < 0.90) {
fe4da5cc 423 ip=531;
424 } else {
425 ip=5122;
426 }
65fb704d 427 if (ran->Rndm() < 0.5) {ip=-ip;}
fe4da5cc 428
429 return ip;
430}
431
432typedef Double_t (*GenFunc) (Double_t*, Double_t*);
53904666 433GenFunc AliGenMUONlib::GetPt(Int_t param, const char* tname) const
fe4da5cc 434{
d90f80fd 435// Return pointer to pT parameterisation
fe4da5cc 436 GenFunc func;
753690b0 437 switch (param)
fe4da5cc 438 {
34f60c01 439 case kPhi:
fe4da5cc 440 func=PtPhi;
441 break;
89512a3b 442 case kOmega:
443 func=PtOmega;
444 break;
445 case kEta:
446 func=PtEta;
447 break;
34f60c01 448 case kJpsi:
fe4da5cc 449 func=PtJpsi;
450 break;
34f60c01 451 case kUpsilon:
fe4da5cc 452 func=PtUpsilon;
453 break;
34f60c01 454 case kCharm:
fe4da5cc 455 func=PtCharm;
456 break;
34f60c01 457 case kBeauty:
fe4da5cc 458 func=PtBeauty;
459 break;
34f60c01 460 case kPion:
753690b0 461 func=PtPion;
462 break;
34f60c01 463 case kKaon:
753690b0 464 func=PtKaon;
465 break;
119b35c7 466 default:
467 func=0;
468 printf("<AliGenMUONlib::GetPt> unknown parametrisation\n");
fe4da5cc 469 }
470 return func;
471}
472
53904666 473GenFunc AliGenMUONlib::GetY(Int_t param, const char* tname) const
fe4da5cc 474{
d90f80fd 475// Return pointer to y- parameterisation
fe4da5cc 476 GenFunc func;
753690b0 477 switch (param)
fe4da5cc 478 {
34f60c01 479 case kPhi:
fe4da5cc 480 func=YPhi;
481 break;
89512a3b 482 case kEta:
483 func=YEta;
484 break;
485 case kOmega:
486 func=YOmega;
487 break;
34f60c01 488 case kJpsi:
fe4da5cc 489 func=YJpsi;
490 break;
34f60c01 491 case kUpsilon:
fe4da5cc 492 func=YUpsilon;
493 break;
34f60c01 494 case kCharm:
fe4da5cc 495 func=YCharm;
496 break;
34f60c01 497 case kBeauty:
fe4da5cc 498 func=YBeauty;
499 break;
34f60c01 500 case kPion:
753690b0 501 func=YPion;
502 break;
34f60c01 503 case kKaon:
753690b0 504 func=YKaon;
505 break;
119b35c7 506 default:
507 func=0;
508 printf("<AliGenMUONlib::GetY> unknown parametrisation\n");
fe4da5cc 509 }
510 return func;
511}
65fb704d 512typedef Int_t (*GenFuncIp) (TRandom *);
53904666 513GenFuncIp AliGenMUONlib::GetIp(Int_t param, const char* tname) const
fe4da5cc 514{
d90f80fd 515// Return pointer to particle type parameterisation
fe4da5cc 516 GenFuncIp func;
753690b0 517 switch (param)
fe4da5cc 518 {
34f60c01 519 case kPhi:
fe4da5cc 520 func=IpPhi;
521 break;
89512a3b 522 case kEta:
523 func=IpEta;
524 break;
525 case kOmega:
526 func=IpOmega;
527 break;
34f60c01 528 case kJpsi:
fe4da5cc 529 func=IpJpsi;
530 break;
34f60c01 531 case kUpsilon:
fe4da5cc 532 func=IpUpsilon;
533 break;
34f60c01 534 case kCharm:
fe4da5cc 535 func=IpCharm;
536 break;
34f60c01 537 case kBeauty:
fe4da5cc 538 func=IpBeauty;
539 break;
34f60c01 540 case kPion:
753690b0 541 func=IpPion;
542 break;
34f60c01 543 case kKaon:
753690b0 544 func=IpKaon;
545 break;
119b35c7 546 default:
547 func=0;
548 printf("<AliGenMUONlib::GetIp> unknown parametrisation\n");
fe4da5cc 549 }
550 return func;
551}
552
553
753690b0 554
555