]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVGEN/AliGenEMlib.cxx
Changes for #84578: Request to extend AliGenBox for using Yrange
[u/mrichter/AliRoot.git] / EVGEN / AliGenEMlib.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 /* $Id: AliGenEMlib.cxx 30052 2008-11-25 14:54:18Z morsch $ */
17
18 /////////////////////////////////////////////////////////////////////////////
19 //                                                                         //
20 // Implementation of AliGenEMlib for electron, di-electron, and photon     //
21 // cocktail calculations.                                                  //
22 // It is based on AliGenGSIlib.                                            //
23 //                                                                         //
24 // Responsible: R.Averbeck@gsi.de                                          //
25 //                                                                         //
26 /////////////////////////////////////////////////////////////////////////////
27
28
29 #include "TMath.h"
30 #include "TRandom.h"
31 #include "TString.h"
32 #include "AliGenEMlib.h"
33
34
35 ClassImp(AliGenEMlib)
36
37 //==========================================================================
38 //
39 //              Definition of Particle Distributions
40 //                    
41 //==========================================================================
42
43 //--------------------------------------------------------------------------
44 //
45 //                              Pizero
46 //
47 //--------------------------------------------------------------------------
48 Int_t AliGenEMlib::IpPizero(TRandom *)
49 {
50 // Return pizero pdg code
51   return 111;     
52 }
53
54 Double_t AliGenEMlib::PtPizero( const Double_t *px, const Double_t */*dummy*/ )
55 {
56 // Generate pizero pT distribution from modified Hagedorn parameterization
57 // taken from fit to unidentified hadrons in pp at 7 TeV
58   const Double_t kc=0.000565;
59   const Double_t kp0=0.2472;
60   const Double_t kp1=4.354;
61   const Double_t kn=7.007;
62   Double_t invYield;
63   Double_t x=*px;
64
65   invYield = kc/TMath::Power(kp0+x/kp1,kn);
66
67   return invYield*(2*TMath::Pi()*x);
68    
69 }
70
71 Double_t AliGenEMlib::YPizero( const Double_t *py, const Double_t */*dummy*/ )
72 {
73   return YFlat(*py);
74
75 }
76
77 //--------------------------------------------------------------------------
78 //
79 //                              Eta
80 //
81 //--------------------------------------------------------------------------
82 Int_t AliGenEMlib::IpEta(TRandom *)
83 {
84 // Return eta pdg code
85   return 221;     
86 }
87
88 Double_t AliGenEMlib::PtEta( const Double_t *px, const Double_t */*dummy*/ )
89 {
90 // Eta pT
91   return MtScal(*px,1);
92 }
93
94 Double_t AliGenEMlib::YEta( const Double_t *py, const Double_t */*dummy*/ )
95 {
96   return YFlat(*py);
97
98 }
99
100 //--------------------------------------------------------------------------
101 //
102 //                              Rho
103 //
104 //--------------------------------------------------------------------------
105 Int_t AliGenEMlib::IpRho(TRandom *)
106 {
107 // Return rho pdg code
108   return 113;     
109 }
110
111 Double_t AliGenEMlib::PtRho( const Double_t *px, const Double_t */*dummy*/ )
112 {
113 // Rho pT
114   return MtScal(*px,2);
115 }
116
117 Double_t AliGenEMlib::YRho( const Double_t *py, const Double_t */*dummy*/ )
118 {
119   return YFlat(*py);
120
121 }
122
123 //--------------------------------------------------------------------------
124 //
125 //                              Omega
126 //
127 //--------------------------------------------------------------------------
128 Int_t AliGenEMlib::IpOmega(TRandom *)
129 {
130 // Return omega pdg code
131   return 223;     
132 }
133
134 Double_t AliGenEMlib::PtOmega( const Double_t *px, const Double_t */*dummy*/ )
135 {
136 // Omega pT
137   return MtScal(*px,3);
138 }
139
140 Double_t AliGenEMlib::YOmega( const Double_t *py, const Double_t */*dummy*/ )
141 {
142   return YFlat(*py);
143
144 }
145
146 //--------------------------------------------------------------------------
147 //
148 //                              Etaprime
149 //
150 //--------------------------------------------------------------------------
151 Int_t AliGenEMlib::IpEtaprime(TRandom *)
152 {
153 // Return etaprime pdg code
154   return 331;     
155 }
156
157 Double_t AliGenEMlib::PtEtaprime( const Double_t *px, const Double_t */*dummy*/ )
158 {
159 // Eta pT
160   return MtScal(*px,4);
161 }
162
163 Double_t AliGenEMlib::YEtaprime( const Double_t *py, const Double_t */*dummy*/ )
164 {
165   return YFlat(*py);
166
167 }
168
169 //--------------------------------------------------------------------------
170 //
171 //                              Phi
172 //
173 //--------------------------------------------------------------------------
174 Int_t AliGenEMlib::IpPhi(TRandom *)
175 {
176 // Return phi pdg code
177   return 333;     
178 }
179
180 Double_t AliGenEMlib::PtPhi( const Double_t *px, const Double_t */*dummy*/ )
181 {
182 // Phi pT
183   return MtScal(*px,5);
184 }
185
186 Double_t AliGenEMlib::YPhi( const Double_t *py, const Double_t */*dummy*/ )
187 {
188   return YFlat(*py);
189
190 }
191
192 Double_t AliGenEMlib::YFlat(Double_t /*y*/)
193 {
194 //--------------------------------------------------------------------------
195 //
196 //                    flat rapidity distribution 
197 //
198 //--------------------------------------------------------------------------
199
200   Double_t dNdy = 1.;   
201
202   return dNdy;
203
204 }
205
206 //============================================================= 
207 //
208 //                    Mt-scaling  
209 //
210 //============================================================= 
211 //
212  Double_t AliGenEMlib::MtScal(Double_t pt, Int_t np)
213 {
214 // Function for the calculation of the Pt distribution for a 
215 // given particle np, from the pizero Pt distribution using  
216 // mt scaling. 
217
218 // MASS   0=>PIZERO, 1=>ETA, 2=>RHO, 3=>OMEGA, 4=>ETAPRIME, 5=>PHI
219
220   const Double_t khm[6] = {0.13498, 0.54751, 0.7755, 0.78265, 0.95778, 1.01946};
221
222   Double_t scaledPt = sqrt(pt*pt + khm[np]*khm[np] - khm[0]*khm[0]);
223   Double_t scaledYield = PtPizero(&scaledPt, (Double_t*) 0);
224
225   //     VALUE MESON/PI AT 5 GEV
226
227   Double_t normPt = 5.;
228   Double_t scaledNormPt = sqrt(normPt*normPt + khm[np]*khm[np] - khm[0]*khm[0]);
229   const Double_t kfmax[6]={1., 0.48, 1.0, 0.9, 0.25, 0.4};
230
231   Double_t norm = kfmax[np] * (PtPizero(&normPt, (Double_t*) 0) / PtPizero(&scaledNormPt, (Double_t*) 0));
232
233   return norm*(pt/scaledPt)*scaledYield;
234 }
235
236 //==========================================================================
237 //
238 //                     Set Getters 
239 //    
240 //==========================================================================
241
242 typedef Double_t (*GenFunc) (const Double_t*,  const Double_t*);
243
244 typedef Int_t (*GenFuncIp) (TRandom *);
245
246 GenFunc AliGenEMlib::GetPt(Int_t param, const char * tname) const
247 {
248 // Return pointer to pT parameterisation
249    GenFunc func=0;
250    TString sname(tname);
251
252    switch (param) 
253     {
254     case kPizero:
255       func=PtPizero;
256       break;
257     case kEta:
258       func=PtEta;
259       break;
260     case kRho:
261       func=PtRho;
262       break;
263     case kOmega:
264       func=PtOmega;
265       break;
266     case kEtaprime:
267       func=PtEtaprime;
268       break;
269     case kPhi:
270       func=PtPhi;
271       break;
272
273     default:
274       func=0;
275       printf("<AliGenEMlib::GetPt> unknown parametrisation\n");
276     }
277    return func;
278 }
279
280 GenFunc AliGenEMlib::GetY(Int_t param, const char * tname) const
281 {
282 // Return pointer to y- parameterisation
283    GenFunc func=0;
284    TString sname(tname);
285
286    switch (param) 
287     {
288     case kPizero:
289          func=YPizero;
290          break;
291     case kEta:
292          func=YEta;
293          break;
294     case kRho:
295          func=YRho;
296          break;
297     case kOmega:
298          func=YOmega;
299          break;
300     case kEtaprime:
301          func=YEtaprime;
302          break;
303     case kPhi:
304          func=YPhi;
305          break;
306
307     default:
308         func=0;
309         printf("<AliGenEMlib::GetY> unknown parametrisation\n");
310     }
311     return func;
312 }
313
314 GenFuncIp AliGenEMlib::GetIp(Int_t param, const char * tname) const
315 {
316 // Return pointer to particle type parameterisation
317    GenFuncIp func=0;
318    TString sname(tname);
319
320    switch (param) 
321     {
322     case kPizero:
323          func=IpPizero;
324          break;
325     case kEta:
326          func=IpEta;
327          break;
328     case kRho:
329          func=IpRho;
330          break;
331     case kOmega:
332          func=IpOmega;
333          break;
334     case kEtaprime:
335          func=IpEtaprime;
336          break;
337     case kPhi:
338          func=IpPhi;
339          break;
340
341     default:
342         func=0;
343         printf("<AliGenEMlib::GetIp> unknown parametrisation\n");
344     }
345     return func;
346 }
347
348
349
350
351
352
353
354
355
356
357
358