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