]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenPHOSlib.cxx
Removal of useless dependencies via forward declarations
[u/mrichter/AliRoot.git] / EVGEN / AliGenPHOSlib.cxx
CommitLineData
886b6f73 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$
b22ee262 18Revision 1.4 2000/06/14 15:21:05 morsch
19Include clean-up (IH)
20
5c3fd7ea 21Revision 1.3 2000/06/09 20:32:54 morsch
22All coding rule violations except RS3 corrected
23
f87cfe57 24Revision 1.2 1999/11/04 11:30:48 fca
25Improve comments
26
9ae59e17 27Revision 1.1 1999/11/03 17:43:20 fca
28New version from G.Martinez & A.Morsch
29
886b6f73 30*/
31
32//======================================================================
33// AliGenPHOSlib class contains parameterizations of the
34// pion, kaon, eta, omega, etaprime, phi and baryon (proton,
35// antiproton, neutron and anti-neutron) particles for the
36// study of the neutral background in PHOS detector.
37// These parameterizations are used by the
38// AliGenParam class:
39// AliGenParam(npar, param, AliGenPHOSlib::GetPt(param),
40// AliGenPHOSlib::GetY(param),
41// AliGenPHOSlib::GetIp(param) )
42// param represents the particle to be simulated :
43// Pion, Kaon, Eta, Omega, Etaprime, Phi or Baryon
44// Pt distributions are calculated from the transverse mass scaling
9ae59e17 45// with Pions, using the PtScal function taken from AliGenMUONlib
886b6f73 46// version aliroot 3.01
47//
9ae59e17 48// Gines MARTINEZ. Laurent APHECETCHE and Yves SCHUTZ
49// GPS @ SUBATECH, Nantes , France (October 1999)
886b6f73 50// http://www-subatech.in2p3.fr/~photons/subatech
51// martinez@subatech.in2p3.fr
52//======================================================================
53
54#include "AliGenPHOSlib.h"
5c3fd7ea 55#include "AliMC.h"
886b6f73 56
57ClassImp(AliGenPHOSlib)
58
59//======================================================================
60// P I O N S
61// (From GetPt, GetY and GetIp as param = Pion)
62// Transverse momentum distribution" PtPion
63// Rapidity distribution YPion
64// Particle distribution IdPion 111, 211 and -211 (pi0, pi+ and pi-)
65//
66 Double_t AliGenPHOSlib::PtPion(Double_t *px, Double_t *)
67{
68// Pion transverse momentum distribtuion taken
9ae59e17 69// from AliGenMUONlib class, version 3.01 of aliroot
886b6f73 70// PT-PARAMETERIZATION CDF, PRL 61(88) 1819
71// POWER LAW FOR PT > 500 MEV
72// MT SCALING BELOW (T=160 MEV)
73//
f87cfe57 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.;
80 Double_t y, y1, kxmpi2, ynorm, a;
886b6f73 81 Double_t x=*px;
82 //
f87cfe57 83 y1=TMath::Power(kp0/(kp0+kxlim),kxn);
84 kxmpi2=kxmpi*kxmpi;
85 ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+kxmpi2)/kt));
886b6f73 86 a=ynorm/y1;
f87cfe57 87 if (x > kxlim)
88 y=a*TMath::Power(kp0/(kp0+x),kxn);
886b6f73 89 else
f87cfe57 90 y=kb*TMath::Exp(-sqrt(x*x+kxmpi2)/kt);
886b6f73 91 return y*x;
92}
886b6f73 93 Double_t AliGenPHOSlib::YPion( Double_t *py, Double_t *)
94{
f87cfe57 95//
96// pion y-distribution
97//
98
99 const Double_t ka = 7000.;
100 const Double_t kdy = 4.;
886b6f73 101
102 Double_t y=TMath::Abs(*py);
103 //
f87cfe57 104 Double_t ex = y*y/(2*kdy*kdy);
105 return ka*TMath::Exp(-ex);
886b6f73 106}
f87cfe57 107
886b6f73 108 Int_t AliGenPHOSlib::IpPion()
109{
f87cfe57 110// particle composition pi+, pi0, pi-
111//
112
886b6f73 113 Float_t random[1];
114 gMC->Rndm(random,1);
115
116 if ( (3.*random[0]) < 1. )
117 {
118 return 211 ;
119 }
120 else
121 {
122 if ( (3.*random[0]) >= 2.)
123 {
124 return -211 ;
125 }
126 else
127 {
128 return 111 ;
129 }
130 }
131}
132// End Pions
133//=============================================================
134//
f87cfe57 135 Double_t AliGenPHOSlib::PtScal(Double_t pt, Int_t np)
136{
886b6f73 137// Mt-scaling
138// Fonction for the calculation of the Pt distribution for a
139// given particle np, from the pion Pt distribution using the
140// mt scaling. This function was taken from AliGenMUONlib
141// aliroot version 3.01, and was extended for baryons
142// np = 1=>Pions 2=>Kaons 3=>Etas 4=>Omegas 5=>ETA' 6=>PHI
143// 7=>BARYONS-BARYONBARS
f87cfe57 144
886b6f73 145 // SCALING EN MASSE PAR RAPPORT A PTPI
146 // MASS 1=>PI, 2=>K, 3=>ETA, 4=>OMEGA, 5=>ETA',6=>PHI
f87cfe57 147 const Double_t khm[10] = {0.1396, 0.494, 0.547, 0.782, 0.957, 1.02,
886b6f73 148 // MASS 7=>BARYON-BARYONBAR
149 0.938, 0. , 0., 0.};
150 // VALUE MESON/PI AT 5 GEV
f87cfe57 151 const Double_t kfmax[10]={1., 1., 1., 1., 1., 1., 1., 1., 1., 1.};
886b6f73 152 np--;
f87cfe57 153 Double_t f5=TMath::Power(((sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3);
154 Double_t kfmax2=f5/kfmax[np];
886b6f73 155 // PIONS
156 Double_t ptpion=100.*PtPion(&pt, (Double_t*) 0);
157 Double_t fmtscal=TMath::Power(((sqrt(pt*pt+0.018215)+2.)/
f87cfe57 158 (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/ kfmax2;
886b6f73 159 return fmtscal*ptpion;
160}
161// End Scaling
162//============================================================================
163// K A O N S
886b6f73 164 Double_t AliGenPHOSlib::PtKaon( Double_t *px, Double_t *)
165{
f87cfe57 166// kaon
167// pt-distribution
168//____________________________________________________________
169
886b6f73 170 return PtScal(*px,2); // 2==> Kaon in the PtScal function
171}
172
886b6f73 173 Double_t AliGenPHOSlib::YKaon( Double_t *py, Double_t *)
174{
f87cfe57 175// y-distribution
176//____________________________________________________________
177
178 const Double_t ka = 1000.;
179 const Double_t kdy = 4.;
886b6f73 180
181
182 Double_t y=TMath::Abs(*py);
183 //
f87cfe57 184 Double_t ex = y*y/(2*kdy*kdy);
185 return ka*TMath::Exp(-ex);
886b6f73 186}
187
886b6f73 188 Int_t AliGenPHOSlib::IpKaon()
189{
f87cfe57 190// particle composition
191//
192
886b6f73 193 Float_t random[1],random2[1];
194 gMC->Rndm(random,1);
195 gMC->Rndm(random2,1);
196 if (random2[0] < 0.5)
197 {
198 if (random[0] < 0.5) {
199 return 321; // K+
200 } else {
201 return -321; // K-
202 }
203 }
204 else
205 {
206 if (random[0] < 0.5) {
9ae59e17 207 return 130; // K^0 short
886b6f73 208 } else {
9ae59e17 209 return 310; // K^0 long
886b6f73 210 }
211 }
212}
213// End Kaons
214//============================================================================
215//============================================================================
216// E T A S
886b6f73 217 Double_t AliGenPHOSlib::PtEta( Double_t *px, Double_t *)
218{
f87cfe57 219// etas
220// pt-distribution
221//____________________________________________________________
222
886b6f73 223 return PtScal(*px,3); // 3==> Eta in the PtScal function
224}
225
886b6f73 226 Double_t AliGenPHOSlib::YEta( Double_t *py, Double_t *)
227{
f87cfe57 228// y-distribution
229//____________________________________________________________
230
231 const Double_t ka = 1000.;
232 const Double_t kdy = 4.;
886b6f73 233
234
235 Double_t y=TMath::Abs(*py);
236 //
f87cfe57 237 Double_t ex = y*y/(2*kdy*kdy);
238 return ka*TMath::Exp(-ex);
886b6f73 239}
240
886b6f73 241 Int_t AliGenPHOSlib::IpEta()
242{
f87cfe57 243// particle composition
244//
245
886b6f73 246 return 221; // eta
247}
248// End Etas
249//============================================================================
250//============================================================================
251// O M E G A S
f87cfe57 252 Double_t AliGenPHOSlib::PtOmega( Double_t *px, Double_t *)
253{
886b6f73 254// omegas
255// pt-distribution
256//____________________________________________________________
f87cfe57 257
886b6f73 258 return PtScal(*px,4); // 4==> Omega in the PtScal function
259}
260
886b6f73 261 Double_t AliGenPHOSlib::YOmega( Double_t *py, Double_t *)
262{
f87cfe57 263// y-distribution
264//____________________________________________________________
265
266 const Double_t ka = 1000.;
267 const Double_t kdy = 4.;
886b6f73 268
269
270 Double_t y=TMath::Abs(*py);
271 //
f87cfe57 272 Double_t ex = y*y/(2*kdy*kdy);
273 return ka*TMath::Exp(-ex);
886b6f73 274}
275
886b6f73 276 Int_t AliGenPHOSlib::IpOmega()
277{
f87cfe57 278// particle composition
279//
280
886b6f73 281 return 223; // Omega
282}
283// End Omega
284//============================================================================
285//============================================================================
286// E T A P R I M E
f87cfe57 287 Double_t AliGenPHOSlib::PtEtaprime( Double_t *px, Double_t *)
288{
886b6f73 289// etaprime
290// pt-distribution
291//____________________________________________________________
f87cfe57 292
886b6f73 293 return PtScal(*px,5); // 5==> Etaprime in the PtScal function
294}
295
886b6f73 296 Double_t AliGenPHOSlib::YEtaprime( Double_t *py, Double_t *)
297{
f87cfe57 298// y-distribution
299//____________________________________________________________
300
301 const Double_t ka = 1000.;
302 const Double_t kdy = 4.;
886b6f73 303
304
305 Double_t y=TMath::Abs(*py);
306 //
f87cfe57 307 Double_t ex = y*y/(2*kdy*kdy);
308 return ka*TMath::Exp(-ex);
886b6f73 309}
310
886b6f73 311 Int_t AliGenPHOSlib::IpEtaprime()
312{
f87cfe57 313// particle composition
314//
315
886b6f73 316 return 331; // Etaprime
317}
318// End EtaPrime
319//===================================================================
320//============================================================================
321// P H I S
f87cfe57 322 Double_t AliGenPHOSlib::PtPhi( Double_t *px, Double_t *)
323{
886b6f73 324// phi
325// pt-distribution
326//____________________________________________________________
f87cfe57 327
886b6f73 328 return PtScal(*px,6); // 6==> Phi in the PtScal function
329}
330
886b6f73 331 Double_t AliGenPHOSlib::YPhi( Double_t *py, Double_t *)
332{
f87cfe57 333// y-distribution
334//____________________________________________________________
335
336 const Double_t ka = 1000.;
337 const Double_t kdy = 4.;
886b6f73 338
339
340 Double_t y=TMath::Abs(*py);
341 //
f87cfe57 342 Double_t ex = y*y/(2*kdy*kdy);
343 return ka*TMath::Exp(-ex);
886b6f73 344}
345
f87cfe57 346 Int_t AliGenPHOSlib::IpPhi()
347{
886b6f73 348// particle composition
349//
f87cfe57 350
886b6f73 351 return 333; // Phi
352}
353// End Phis
354//===================================================================
355//============================================================================
356// B A R Y O N S == protons, protonsbar, neutrons, and neutronsbars
f87cfe57 357 Double_t AliGenPHOSlib::PtBaryon( Double_t *px, Double_t *)
358{
886b6f73 359// baryons
360// pt-distribution
361//____________________________________________________________
f87cfe57 362
886b6f73 363 return PtScal(*px,7); // 7==> Baryon in the PtScal function
364}
365
886b6f73 366 Double_t AliGenPHOSlib::YBaryon( Double_t *py, Double_t *)
367{
f87cfe57 368// y-distribution
369//____________________________________________________________
370
371 const Double_t ka = 1000.;
372 const Double_t kdy = 4.;
886b6f73 373
374
375 Double_t y=TMath::Abs(*py);
376 //
f87cfe57 377 Double_t ex = y*y/(2*kdy*kdy);
378 return ka*TMath::Exp(-ex);
886b6f73 379}
380
886b6f73 381 Int_t AliGenPHOSlib::IpBaryon()
382{
f87cfe57 383// particle composition
384//
385
886b6f73 386 Float_t random[1],random2[1];
387 gMC->Rndm(random,1);
388 gMC->Rndm(random2,1);
389 if (random2[0] < 0.5)
390 {
391 if (random[0] < 0.5) {
392 return 2212; // p
393 } else {
394 return -2212; // pbar
395 }
396 }
397 else
398 {
399 if (random[0] < 0.5) {
400 return 2112; // n
401 } else {
402 return -2112; // n bar
403 }
404 }
405}
406// End Baryons
407//===================================================================
408
409
410typedef Double_t (*GenFunc) (Double_t*, Double_t*);
b22ee262 411 GenFunc AliGenPHOSlib::GetPt(Param_t param, const char* tname)
886b6f73 412{
f87cfe57 413// Return pinter to pT parameterisation
886b6f73 414 GenFunc func;
415
416 switch (param)
417 {
418 case Pion:
419 func=PtPion;
420 break;
421 case Kaon:
422 func=PtKaon;
423 break;
424 case Eta:
425 func=PtEta;
426 break;
427 case Omega:
428 func=PtOmega;
429 break;
430 case Etaprime:
431 func=PtEtaprime;
432 break;
433 case Baryon:
434 func=PtBaryon;
435 break;
436 default:
437 func=0;
438 printf("<AliGenPHOSlib::GetPt> unknown parametrisationn");
439 }
440 return func;
441}
442
b22ee262 443 GenFunc AliGenPHOSlib::GetY(Param_t param, const char* tname)
886b6f73 444{
f87cfe57 445// Return pointer to Y parameterisation
886b6f73 446 GenFunc func;
447 switch (param)
448 {
449 case Pion:
450 func=YPion;
451 break;
452 case Kaon:
453 func=YKaon;
454 break;
455 case Eta:
456 func=YEta;
457 break;
458 case Omega:
459 func=YOmega;
460 break;
461 case Etaprime:
462 func=YEtaprime;
463 break;
464 case Phi:
465 func=YPhi;
466 break;
467 case Baryon:
468 func=YBaryon;
469 break;
470 default:
471 func=0;
472 printf("<AliGenPHOSlib::GetY> unknown parametrisationn");
473 }
474 return func;
475}
476typedef Int_t (*GenFuncIp) ();
b22ee262 477 GenFuncIp AliGenPHOSlib::GetIp(Param_t param, const char* tname)
886b6f73 478{
f87cfe57 479// Return pointer to particle composition
886b6f73 480 GenFuncIp func;
481 switch (param)
482 {
483 case Pion:
484
485 func=IpPion;
486 break;
487 case Kaon:
488 func=IpKaon;
489 break;
490 case Eta:
491 func=IpEta;
492 break;
493 case Omega:
494 func=IpOmega;
495 break;
496 case Etaprime:
497 func=IpEtaprime;
498 break;
499 case Phi:
500 func=IpPhi;
501 break;
502 case Baryon:
503 func=IpBaryon;
504 break;
505 default:
506 func=0;
507 printf("<AliGenPHOSlib::GetIp> unknown parametrisationn");
508 }
509 return func;
510}
511