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