- Control precision of pT sampling TF1::SetNpx(..)
[u/mrichter/AliRoot.git] / EVGEN / AliGenMUONlib.cxx
CommitLineData
4c039060 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*/
19
fe4da5cc 20#include "AliGenMUONlib.h"
21#include "AliRun.h"
22ClassImp(AliGenMUONlib)
23//
24// Pions
25Double_t AliGenMUONlib::PtPion(Double_t *px, Double_t *)
26{
27//
28// PT-PARAMETERIZATION CDF, PRL 61(88) 1819
29// POWER LAW FOR PT > 500 MEV
30// MT SCALING BELOW (T=160 MEV)
31//
32 const Double_t p0 = 1.3;
33 const Double_t xn = 8.28;
34 const Double_t xlim=0.5;
35 const Double_t t=0.160;
36 const Double_t xmpi=0.139;
37 const Double_t b=1.;
38 Double_t y, y1, xmpi2, ynorm, a;
39 Double_t x=*px;
40 //
41 y1=TMath::Power(p0/(p0+xlim),xn);
42 xmpi2=xmpi*xmpi;
43 ynorm=b*(TMath::Exp(-sqrt(xlim*xlim+xmpi2)/t));
44 a=ynorm/y1;
45 if (x > xlim)
46 y=a*TMath::Power(p0/(p0+x),xn);
47 else
48 y=b*TMath::Exp(-sqrt(x*x+xmpi2)/t);
49 return y*x;
50}
753690b0 51//
52// y-distribution
53//
54Double_t AliGenMUONlib::YPion( Double_t *py, Double_t *)
55{
56 const Double_t a = 7000.;
57 const Double_t dy = 4.;
58
59 Double_t y=TMath::Abs(*py);
60 //
61 Double_t ex = y*y/(2*dy*dy);
62 return a*TMath::Exp(-ex);
63}
64// particle composition
65//
66Int_t AliGenMUONlib::IpPion()
67{
753690b0 68 Float_t random[1];
cfce8870 69 gMC->Rndm(random,1);
753690b0 70 if (random[0] < 0.5) {
71 return 211;
72 } else {
73 return -211;
74 }
75}
fe4da5cc 76
77//____________________________________________________________
78//
79// Mt-scaling
80
81Double_t AliGenMUONlib::PtScal(Double_t pt, Int_t np)
82{
83 // SCALING EN MASSE PAR RAPPORT A PTPI
84 // MASS PI,K,ETA,RHO,OMEGA,ETA',PHI
85 const Double_t hm[10] = {.13957,.493,.5488,.769,.7826,.958,1.02,0,0,0};
86 // VALUE MESON/PI AT 5 GEV
87 const Double_t fmax[10]={1.,0.3,0.55,1.0,1.0,1.0,1.0,0,0,0};
88 np--;
89 Double_t f5=TMath::Power(((sqrt(100.018215)+2.)/(sqrt(100.+hm[np]*hm[np])+2.0)),12.3);
90 Double_t fmax2=f5/fmax[np];
91 // PIONS
92 Double_t ptpion=100.*PtPion(&pt, (Double_t*) 0);
93 Double_t fmtscal=TMath::Power(((sqrt(pt*pt+0.018215)+2.)/
94 (sqrt(pt*pt+hm[np]*hm[np])+2.0)),12.3)/ fmax2;
95 return fmtscal*ptpion;
96}
97//
753690b0 98// kaon
99//
100// pt-distribution
101//____________________________________________________________
102Double_t AliGenMUONlib::PtKaon( Double_t *px, Double_t *)
103{
104 return PtScal(*px,2);
105}
106
107// y-distribution
fe4da5cc 108//____________________________________________________________
753690b0 109Double_t AliGenMUONlib::YKaon( Double_t *py, Double_t *)
fe4da5cc 110{
753690b0 111 const Double_t a = 1000.;
112 const Double_t dy = 4.;
113
114
fe4da5cc 115 Double_t y=TMath::Abs(*py);
116 //
753690b0 117 Double_t ex = y*y/(2*dy*dy);
118 return a*TMath::Exp(-ex);
119}
120
121// particle composition
122//
123Int_t AliGenMUONlib::IpKaon()
124{
753690b0 125 Float_t random[1];
cfce8870 126 gMC->Rndm(random,1);
753690b0 127 if (random[0] < 0.5) {
128 return 321;
129 } else {
130 return -321;
131 }
fe4da5cc 132}
753690b0 133
fe4da5cc 134// J/Psi
135//
136//
137// pt-distribution
138//____________________________________________________________
139Double_t AliGenMUONlib::PtJpsi( Double_t *px, Double_t *)
140{
141 const Double_t pt0 = 4.;
142 const Double_t xn = 3.6;
143 Double_t x=*px;
144 //
145 Double_t pass1 = 1.+(x/pt0)*(x/pt0);
146 return x/TMath::Power(pass1,xn);
147}
148//
149// y-distribution
150//____________________________________________________________
151Double_t AliGenMUONlib::YJpsi(Double_t *py, Double_t *)
152{
153 const Double_t y0 = 4.;
154 const Double_t b=1.;
155 Double_t yj;
156 Double_t y=TMath::Abs(*py);
157 //
158 if (y < y0)
159 yj=b;
160 else
161 yj=b*TMath::Exp(-(y-y0)*(y-y0)/2);
162 return yj;
163}
164// particle composition
165//
166Int_t AliGenMUONlib::IpJpsi()
167{
168 return 443;
169}
170
171// Upsilon
172//
173//
174// pt-distribution
175//____________________________________________________________
176Double_t AliGenMUONlib::PtUpsilon( Double_t *px, Double_t * )
177{
178 const Double_t pt0 = 5.3;
179 const Double_t xn = 2.5;
180 Double_t x=*px;
181 //
182 Double_t pass1 = 1.+(x/pt0)*(x/pt0);
183 return x/TMath::Power(pass1,xn);
184}
185//
186// y-distribution
187//
188//____________________________________________________________
189Double_t AliGenMUONlib::YUpsilon(Double_t *py, Double_t *)
190{
191 const Double_t y0 = 3.;
192 const Double_t b=1.;
193 Double_t yu;
194 Double_t y=TMath::Abs(*py);
195 //
196 if (y < y0)
197 yu=b;
198 else
199 yu=b*TMath::Exp(-(y-y0)*(y-y0)/2);
200 return yu;
201}
202// particle composition
203//
204Int_t AliGenMUONlib::IpUpsilon()
205{
206 return 553;
207}
208
209//
210// Phi
211//
212//
213// pt-distribution (by scaling of pion distribution)
214//____________________________________________________________
215Double_t AliGenMUONlib::PtPhi( Double_t *px, Double_t *)
216{
217 return PtScal(*px,7);
218}
219// y-distribution
220Double_t AliGenMUONlib::YPhi( Double_t *px, Double_t *)
221{
ccdc344b 222 Double_t *dummy=0;
fe4da5cc 223 return YJpsi(px,dummy);
224}
225// particle composition
226//
227Int_t AliGenMUONlib::IpPhi()
228{
229 return 41;
230}
231
232//
233// Charm
234//
235//
236// pt-distribution
237//____________________________________________________________
238Double_t AliGenMUONlib::PtCharm( Double_t *px, Double_t *)
239{
240 const Double_t pt0 = 4.08;
241 const Double_t xn = 9.40;
242 Double_t x=*px;
243 //
244 Double_t pass1 = 1.+(x/pt0)*(x/pt0);
245 return x/TMath::Power(pass1,xn);
246}
247// y-distribution
248Double_t AliGenMUONlib::YCharm( Double_t *px, Double_t *)
249{
ccdc344b 250 Double_t *dummy=0;
fe4da5cc 251 return YJpsi(px,dummy);
252}
253
254Int_t AliGenMUONlib::IpCharm()
255{
fe4da5cc 256 Float_t random[2];
257 Int_t ip;
258// 411,421,431,4122
cfce8870 259 gMC->Rndm(random,2);
fe4da5cc 260 if (random[0] < 0.5) {
261 ip=411;
262 } else if (random[0] < 0.75) {
263 ip=421;
264 } else if (random[0] < 0.90) {
265 ip=431;
266 } else {
267 ip=4122;
268 }
269 if (random[1] < 0.5) {ip=-ip;}
270
271 return ip;
272}
273
274
275//
276// Beauty
277//
278//
279// pt-distribution
280//____________________________________________________________
281Double_t AliGenMUONlib::PtBeauty( Double_t *px, Double_t *)
282{
283 const Double_t pt0 = 4.;
284 const Double_t xn = 3.6;
285 Double_t x=*px;
286 //
287 Double_t pass1 = 1.+(x/pt0)*(x/pt0);
288 return x/TMath::Power(pass1,xn);
289}
290// y-distribution
291Double_t AliGenMUONlib::YBeauty( Double_t *px, Double_t *)
292{
ccdc344b 293 Double_t *dummy=0;
fe4da5cc 294 return YJpsi(px,dummy);
295}
296
297Int_t AliGenMUONlib::IpBeauty()
298{
fe4da5cc 299 Float_t random[2];
300 Int_t ip;
cfce8870 301 gMC->Rndm(random,2);
fe4da5cc 302 if (random[0] < 0.5) {
303 ip=511;
304 } else if (random[0] < 0.75) {
305 ip=521;
306 } else if (random[0] < 0.90) {
307 ip=531;
308 } else {
309 ip=5122;
310 }
311 if (random[1] < 0.5) {ip=-ip;}
312
313 return ip;
314}
315
316typedef Double_t (*GenFunc) (Double_t*, Double_t*);
753690b0 317GenFunc AliGenMUONlib::GetPt(Param_t param)
fe4da5cc 318{
319 GenFunc func;
753690b0 320 switch (param)
fe4da5cc 321 {
753690b0 322 case phi_p:
fe4da5cc 323 func=PtPhi;
324 break;
753690b0 325 case jpsi_p:
fe4da5cc 326 func=PtJpsi;
327 break;
753690b0 328 case upsilon_p:
fe4da5cc 329 func=PtUpsilon;
330 break;
753690b0 331 case charm_p:
fe4da5cc 332 func=PtCharm;
333 break;
753690b0 334 case beauty_p:
fe4da5cc 335 func=PtBeauty;
336 break;
753690b0 337 case pion_p:
338 func=PtPion;
339 break;
340 case kaon_p:
341 func=PtKaon;
342 break;
119b35c7 343 default:
344 func=0;
345 printf("<AliGenMUONlib::GetPt> unknown parametrisation\n");
fe4da5cc 346 }
347 return func;
348}
349
753690b0 350GenFunc AliGenMUONlib::GetY(Param_t param)
fe4da5cc 351{
352 GenFunc func;
753690b0 353 switch (param)
fe4da5cc 354 {
753690b0 355 case phi_p:
fe4da5cc 356 func=YPhi;
357 break;
753690b0 358 case jpsi_p:
fe4da5cc 359 func=YJpsi;
360 break;
753690b0 361 case upsilon_p:
fe4da5cc 362 func=YUpsilon;
363 break;
753690b0 364 case charm_p:
fe4da5cc 365 func=YCharm;
366 break;
753690b0 367 case beauty_p:
fe4da5cc 368 func=YBeauty;
369 break;
753690b0 370 case pion_p:
371 func=YPion;
372 break;
373 case kaon_p:
374 func=YKaon;
375 break;
119b35c7 376 default:
377 func=0;
378 printf("<AliGenMUONlib::GetY> unknown parametrisation\n");
fe4da5cc 379 }
380 return func;
381}
382typedef Int_t (*GenFuncIp) ();
753690b0 383GenFuncIp AliGenMUONlib::GetIp(Param_t param)
fe4da5cc 384{
385 GenFuncIp func;
753690b0 386 switch (param)
fe4da5cc 387 {
753690b0 388 case phi_p:
fe4da5cc 389 func=IpPhi;
390 break;
753690b0 391 case jpsi_p:
fe4da5cc 392 func=IpJpsi;
393 break;
753690b0 394 case upsilon_p:
fe4da5cc 395 func=IpUpsilon;
396 break;
753690b0 397 case charm_p:
fe4da5cc 398 func=IpCharm;
399 break;
753690b0 400 case beauty_p:
fe4da5cc 401 func=IpBeauty;
402 break;
753690b0 403 case pion_p:
404 func=IpPion;
405 break;
406 case kaon_p:
407 func=IpKaon;
408 break;
119b35c7 409 default:
410 func=0;
411 printf("<AliGenMUONlib::GetIp> unknown parametrisation\n");
fe4da5cc 412 }
413 return func;
414}
415
416
753690b0 417
418