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