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