]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenPHOSlib.cxx
Fixed bug in parent assignment and implemented Birk's law in the Step Manager
[u/mrichter/AliRoot.git] / EVGEN / AliGenPHOSlib.cxx
CommitLineData
74c62c73 1
886b6f73 2/**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
88cb7938 17/* $Id$ */
886b6f73 18
19//======================================================================
20// AliGenPHOSlib class contains parameterizations of the
21// pion, kaon, eta, omega, etaprime, phi and baryon (proton,
22// antiproton, neutron and anti-neutron) particles for the
23// study of the neutral background in PHOS detector.
24// These parameterizations are used by the
25// AliGenParam class:
26// AliGenParam(npar, param, AliGenPHOSlib::GetPt(param),
27// AliGenPHOSlib::GetY(param),
28// AliGenPHOSlib::GetIp(param) )
29// param represents the particle to be simulated :
30// Pion, Kaon, Eta, Omega, Etaprime, Phi or Baryon
31// Pt distributions are calculated from the transverse mass scaling
9ae59e17 32// with Pions, using the PtScal function taken from AliGenMUONlib
886b6f73 33// version aliroot 3.01
34//
9ae59e17 35// Gines MARTINEZ. Laurent APHECETCHE and Yves SCHUTZ
36// GPS @ SUBATECH, Nantes , France (October 1999)
886b6f73 37// http://www-subatech.in2p3.fr/~photons/subatech
38// martinez@subatech.in2p3.fr
39//======================================================================
40
65fb704d 41#include "TMath.h"
42#include "TRandom.h"
43
886b6f73 44#include "AliGenPHOSlib.h"
886b6f73 45
46ClassImp(AliGenPHOSlib)
47
48//======================================================================
49// P I O N S
50// (From GetPt, GetY and GetIp as param = Pion)
51// Transverse momentum distribution" PtPion
52// Rapidity distribution YPion
53// Particle distribution IdPion 111, 211 and -211 (pi0, pi+ and pi-)
54//
55 Double_t AliGenPHOSlib::PtPion(Double_t *px, Double_t *)
56{
57// Pion transverse momentum distribtuion taken
9ae59e17 58// from AliGenMUONlib class, version 3.01 of aliroot
886b6f73 59// PT-PARAMETERIZATION CDF, PRL 61(88) 1819
60// POWER LAW FOR PT > 500 MEV
61// MT SCALING BELOW (T=160 MEV)
62//
f87cfe57 63 const Double_t kp0 = 1.3;
64 const Double_t kxn = 8.28;
65 const Double_t kxlim=0.5;
66 const Double_t kt=0.160;
67 const Double_t kxmpi=0.139;
68 const Double_t kb=1.;
69 Double_t y, y1, kxmpi2, ynorm, a;
886b6f73 70 Double_t x=*px;
71 //
f87cfe57 72 y1=TMath::Power(kp0/(kp0+kxlim),kxn);
73 kxmpi2=kxmpi*kxmpi;
74 ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+kxmpi2)/kt));
886b6f73 75 a=ynorm/y1;
f87cfe57 76 if (x > kxlim)
77 y=a*TMath::Power(kp0/(kp0+x),kxn);
886b6f73 78 else
f87cfe57 79 y=kb*TMath::Exp(-sqrt(x*x+kxmpi2)/kt);
886b6f73 80 return y*x;
81}
886b6f73 82 Double_t AliGenPHOSlib::YPion( Double_t *py, Double_t *)
83{
f87cfe57 84//
85// pion y-distribution
86//
87
88 const Double_t ka = 7000.;
89 const Double_t kdy = 4.;
886b6f73 90
91 Double_t y=TMath::Abs(*py);
92 //
f87cfe57 93 Double_t ex = y*y/(2*kdy*kdy);
94 return ka*TMath::Exp(-ex);
886b6f73 95}
f87cfe57 96
65fb704d 97 Int_t AliGenPHOSlib::IpPion(TRandom *ran)
886b6f73 98{
f87cfe57 99// particle composition pi+, pi0, pi-
100//
101
74c62c73 102 Float_t random = ran->Rndm();
103
104 if ( (3.*random) < 1. )
105 {
106 return 211 ;
107 }
108 else
109 {
110 if ( (3.*random) >= 2.)
111 {
112 return -211 ;
113 }
114 else
115 {
886b6f73 116 return 111 ;
117 }
118 }
119}
74c62c73 120
121//End Pions
122//======================================================================
123// Pi 0 Flat Distribution
124// Transverse momentum distribution PtPi0Flat
125// Rapidity distribution YPi0Flat
126// Particle distribution IdPi0Flat 111 (pi0)
127//
128
198bb1c7 129Double_t AliGenPHOSlib::PtPi0Flat(Double_t */*px*/, Double_t *)
74c62c73 130{
131// Pion transverse momentum flat distribution
132
133return 1;
134
135}
136
198bb1c7 137Double_t AliGenPHOSlib::YPi0Flat( Double_t */*py*/, Double_t *)
74c62c73 138{
139
140// pion y-distribution
141//
142 return 1.;
143}
144
145 Int_t AliGenPHOSlib::IpPi0Flat(TRandom *)
146{
147
148// particle composition pi0
149//
150 return 111 ;
151}
152// End Pi0Flat
886b6f73 153//=============================================================
154//
f87cfe57 155 Double_t AliGenPHOSlib::PtScal(Double_t pt, Int_t np)
156{
886b6f73 157// Mt-scaling
158// Fonction for the calculation of the Pt distribution for a
159// given particle np, from the pion Pt distribution using the
160// mt scaling. This function was taken from AliGenMUONlib
161// aliroot version 3.01, and was extended for baryons
162// np = 1=>Pions 2=>Kaons 3=>Etas 4=>Omegas 5=>ETA' 6=>PHI
163// 7=>BARYONS-BARYONBARS
f87cfe57 164
886b6f73 165 // SCALING EN MASSE PAR RAPPORT A PTPI
166 // MASS 1=>PI, 2=>K, 3=>ETA, 4=>OMEGA, 5=>ETA',6=>PHI
f87cfe57 167 const Double_t khm[10] = {0.1396, 0.494, 0.547, 0.782, 0.957, 1.02,
886b6f73 168 // MASS 7=>BARYON-BARYONBAR
169 0.938, 0. , 0., 0.};
170 // VALUE MESON/PI AT 5 GEV
f87cfe57 171 const Double_t kfmax[10]={1., 1., 1., 1., 1., 1., 1., 1., 1., 1.};
886b6f73 172 np--;
f87cfe57 173 Double_t f5=TMath::Power(((sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3);
174 Double_t kfmax2=f5/kfmax[np];
886b6f73 175 // PIONS
176 Double_t ptpion=100.*PtPion(&pt, (Double_t*) 0);
177 Double_t fmtscal=TMath::Power(((sqrt(pt*pt+0.018215)+2.)/
f87cfe57 178 (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/ kfmax2;
886b6f73 179 return fmtscal*ptpion;
74c62c73 180
886b6f73 181}
182// End Scaling
183//============================================================================
184// K A O N S
886b6f73 185 Double_t AliGenPHOSlib::PtKaon( Double_t *px, Double_t *)
186{
f87cfe57 187// kaon
188// pt-distribution
189//____________________________________________________________
190
886b6f73 191 return PtScal(*px,2); // 2==> Kaon in the PtScal function
192}
193
886b6f73 194 Double_t AliGenPHOSlib::YKaon( Double_t *py, Double_t *)
195{
f87cfe57 196// y-distribution
197//____________________________________________________________
198
199 const Double_t ka = 1000.;
200 const Double_t kdy = 4.;
886b6f73 201
202
203 Double_t y=TMath::Abs(*py);
204 //
f87cfe57 205 Double_t ex = y*y/(2*kdy*kdy);
206 return ka*TMath::Exp(-ex);
886b6f73 207}
208
65fb704d 209 Int_t AliGenPHOSlib::IpKaon(TRandom *ran)
886b6f73 210{
f87cfe57 211// particle composition
212//
213
65fb704d 214 Float_t random = ran->Rndm();
215 Float_t random2 = ran->Rndm();
216 if (random2 < 0.5)
886b6f73 217 {
65fb704d 218 if (random < 0.5) {
886b6f73 219 return 321; // K+
220 } else {
221 return -321; // K-
222 }
223 }
224 else
225 {
65fb704d 226 if (random < 0.5) {
9ae59e17 227 return 130; // K^0 short
886b6f73 228 } else {
9ae59e17 229 return 310; // K^0 long
886b6f73 230 }
231 }
232}
233// End Kaons
234//============================================================================
235//============================================================================
236// E T A S
886b6f73 237 Double_t AliGenPHOSlib::PtEta( Double_t *px, Double_t *)
238{
f87cfe57 239// etas
240// pt-distribution
241//____________________________________________________________
242
886b6f73 243 return PtScal(*px,3); // 3==> Eta in the PtScal function
244}
245
886b6f73 246 Double_t AliGenPHOSlib::YEta( Double_t *py, Double_t *)
247{
f87cfe57 248// y-distribution
249//____________________________________________________________
250
251 const Double_t ka = 1000.;
252 const Double_t kdy = 4.;
886b6f73 253
254
255 Double_t y=TMath::Abs(*py);
256 //
f87cfe57 257 Double_t ex = y*y/(2*kdy*kdy);
258 return ka*TMath::Exp(-ex);
886b6f73 259}
260
65fb704d 261 Int_t AliGenPHOSlib::IpEta(TRandom *)
886b6f73 262{
f87cfe57 263// particle composition
264//
265
886b6f73 266 return 221; // eta
267}
268// End Etas
74c62c73 269
270//======================================================================
271// Eta Flat Distribution
272// Transverse momentum distribution PtEtaFlat
273// Rapidity distribution YEtaFlat
274// Particle distribution IdEtaFlat 111 (pi0)
275//
276
198bb1c7 277Double_t AliGenPHOSlib::PtEtaFlat(Double_t */*px*/, Double_t *)
74c62c73 278{
279// Eta transverse momentum flat distribution
280
281 return 1;
282
283}
284
198bb1c7 285Double_t AliGenPHOSlib::YEtaFlat( Double_t */*py*/, Double_t *)
74c62c73 286{
287//
288// pion y-distribution
289//
290 return 1.;
291}
292
293 Int_t AliGenPHOSlib::IpEtaFlat(TRandom *)
294{
295//
296// particle composition eta
297//
298 return 221 ;
299}
300// End Pi0Flat
886b6f73 301//============================================================================
302//============================================================================
303// O M E G A S
f87cfe57 304 Double_t AliGenPHOSlib::PtOmega( Double_t *px, Double_t *)
305{
886b6f73 306// omegas
307// pt-distribution
308//____________________________________________________________
f87cfe57 309
886b6f73 310 return PtScal(*px,4); // 4==> Omega in the PtScal function
311}
312
886b6f73 313 Double_t AliGenPHOSlib::YOmega( Double_t *py, Double_t *)
314{
f87cfe57 315// y-distribution
316//____________________________________________________________
317
318 const Double_t ka = 1000.;
319 const Double_t kdy = 4.;
886b6f73 320
321
322 Double_t y=TMath::Abs(*py);
323 //
f87cfe57 324 Double_t ex = y*y/(2*kdy*kdy);
325 return ka*TMath::Exp(-ex);
886b6f73 326}
327
65fb704d 328 Int_t AliGenPHOSlib::IpOmega(TRandom *)
886b6f73 329{
f87cfe57 330// particle composition
331//
332
886b6f73 333 return 223; // Omega
334}
335// End Omega
336//============================================================================
337//============================================================================
338// E T A P R I M E
f87cfe57 339 Double_t AliGenPHOSlib::PtEtaprime( Double_t *px, Double_t *)
340{
886b6f73 341// etaprime
342// pt-distribution
343//____________________________________________________________
f87cfe57 344
886b6f73 345 return PtScal(*px,5); // 5==> Etaprime in the PtScal function
346}
347
886b6f73 348 Double_t AliGenPHOSlib::YEtaprime( Double_t *py, Double_t *)
349{
f87cfe57 350// y-distribution
351//____________________________________________________________
352
353 const Double_t ka = 1000.;
354 const Double_t kdy = 4.;
886b6f73 355
356
357 Double_t y=TMath::Abs(*py);
358 //
f87cfe57 359 Double_t ex = y*y/(2*kdy*kdy);
360 return ka*TMath::Exp(-ex);
886b6f73 361}
362
65fb704d 363 Int_t AliGenPHOSlib::IpEtaprime(TRandom *)
886b6f73 364{
f87cfe57 365// particle composition
366//
367
886b6f73 368 return 331; // Etaprime
369}
370// End EtaPrime
371//===================================================================
372//============================================================================
373// P H I S
f87cfe57 374 Double_t AliGenPHOSlib::PtPhi( Double_t *px, Double_t *)
375{
886b6f73 376// phi
377// pt-distribution
378//____________________________________________________________
f87cfe57 379
886b6f73 380 return PtScal(*px,6); // 6==> Phi in the PtScal function
381}
382
886b6f73 383 Double_t AliGenPHOSlib::YPhi( Double_t *py, Double_t *)
384{
f87cfe57 385// y-distribution
386//____________________________________________________________
387
388 const Double_t ka = 1000.;
389 const Double_t kdy = 4.;
886b6f73 390
391
392 Double_t y=TMath::Abs(*py);
393 //
f87cfe57 394 Double_t ex = y*y/(2*kdy*kdy);
395 return ka*TMath::Exp(-ex);
886b6f73 396}
397
65fb704d 398 Int_t AliGenPHOSlib::IpPhi(TRandom *)
f87cfe57 399{
886b6f73 400// particle composition
401//
f87cfe57 402
886b6f73 403 return 333; // Phi
404}
405// End Phis
406//===================================================================
407//============================================================================
408// B A R Y O N S == protons, protonsbar, neutrons, and neutronsbars
f87cfe57 409 Double_t AliGenPHOSlib::PtBaryon( Double_t *px, Double_t *)
410{
886b6f73 411// baryons
412// pt-distribution
413//____________________________________________________________
f87cfe57 414
886b6f73 415 return PtScal(*px,7); // 7==> Baryon in the PtScal function
416}
417
886b6f73 418 Double_t AliGenPHOSlib::YBaryon( Double_t *py, Double_t *)
419{
f87cfe57 420// y-distribution
421//____________________________________________________________
422
423 const Double_t ka = 1000.;
424 const Double_t kdy = 4.;
886b6f73 425
426
427 Double_t y=TMath::Abs(*py);
428 //
f87cfe57 429 Double_t ex = y*y/(2*kdy*kdy);
430 return ka*TMath::Exp(-ex);
886b6f73 431}
432
65fb704d 433 Int_t AliGenPHOSlib::IpBaryon(TRandom *ran)
886b6f73 434{
f87cfe57 435// particle composition
436//
437
65fb704d 438 Float_t random = ran->Rndm();
439 Float_t random2 = ran->Rndm();
440 if (random2 < 0.5)
886b6f73 441 {
65fb704d 442 if (random < 0.5) {
886b6f73 443 return 2212; // p
444 } else {
445 return -2212; // pbar
446 }
447 }
448 else
449 {
65fb704d 450 if (random < 0.5) {
886b6f73 451 return 2112; // n
452 } else {
453 return -2112; // n bar
454 }
455 }
456}
457// End Baryons
458//===================================================================
459
460
74c62c73 461typedef Double_t (*GenFunc) (Double_t*, Double_t*);
198bb1c7 462GenFunc AliGenPHOSlib::GetPt(Int_t param, const char* /*tname*/) const
886b6f73 463{
f87cfe57 464// Return pinter to pT parameterisation
886b6f73 465 GenFunc func;
466
467 switch (param)
468 {
34f60c01 469 case kPion:
886b6f73 470 func=PtPion;
471 break;
74c62c73 472 case kPi0Flat:
473 func=PtPi0Flat;
474 break;
34f60c01 475 case kKaon:
886b6f73 476 func=PtKaon;
477 break;
34f60c01 478 case kEta:
886b6f73 479 func=PtEta;
480 break;
74c62c73 481 case kEtaFlat:
482 func=PtEtaFlat;
483 break;
34f60c01 484 case kOmega:
886b6f73 485 func=PtOmega;
486 break;
34f60c01 487 case kEtaPrime:
886b6f73 488 func=PtEtaprime;
489 break;
34f60c01 490 case kBaryon:
886b6f73 491 func=PtBaryon;
492 break;
493 default:
494 func=0;
495 printf("<AliGenPHOSlib::GetPt> unknown parametrisationn");
496 }
497 return func;
498}
499
198bb1c7 500GenFunc AliGenPHOSlib::GetY(Int_t param, const char* /*tname*/) const
886b6f73 501{
f87cfe57 502// Return pointer to Y parameterisation
886b6f73 503 GenFunc func;
504 switch (param)
505 {
34f60c01 506 case kPion:
886b6f73 507 func=YPion;
508 break;
74c62c73 509 case kPi0Flat:
510 func=YPi0Flat;
511 break;
34f60c01 512 case kKaon:
886b6f73 513 func=YKaon;
514 break;
34f60c01 515 case kEta:
886b6f73 516 func=YEta;
517 break;
74c62c73 518 case kEtaFlat:
519 func=YEtaFlat;
520 break;
34f60c01 521 case kOmega:
886b6f73 522 func=YOmega;
523 break;
34f60c01 524 case kEtaPrime:
886b6f73 525 func=YEtaprime;
526 break;
34f60c01 527 case kPhi:
886b6f73 528 func=YPhi;
529 break;
34f60c01 530 case kBaryon:
886b6f73 531 func=YBaryon;
532 break;
533 default:
534 func=0;
535 printf("<AliGenPHOSlib::GetY> unknown parametrisationn");
536 }
537 return func;
538}
65fb704d 539typedef Int_t (*GenFuncIp) (TRandom *);
198bb1c7 540GenFuncIp AliGenPHOSlib::GetIp(Int_t param, const char* /*tname*/) const
886b6f73 541{
f87cfe57 542// Return pointer to particle composition
886b6f73 543 GenFuncIp func;
544 switch (param)
545 {
74c62c73 546 case kPion:
886b6f73 547 func=IpPion;
548 break;
74c62c73 549 case kPi0Flat:
550 func=IpPi0Flat;
551 break;
34f60c01 552 case kKaon:
886b6f73 553 func=IpKaon;
554 break;
34f60c01 555 case kEta:
886b6f73 556 func=IpEta;
557 break;
74c62c73 558 case kEtaFlat:
559 func=IpEtaFlat;
560 break;
561
34f60c01 562 case kOmega:
886b6f73 563 func=IpOmega;
564 break;
34f60c01 565 case kEtaPrime:
886b6f73 566 func=IpEtaprime;
567 break;
34f60c01 568 case kPhi:
886b6f73 569 func=IpPhi;
570 break;
34f60c01 571 case kBaryon:
886b6f73 572 func=IpBaryon;
573 break;
574 default:
575 func=0;
576 printf("<AliGenPHOSlib::GetIp> unknown parametrisationn");
577 }
578 return func;
579}
580