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