]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVGEN/AliGenEMlib.cxx
Coverity fix.
[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   1=>PIZERO, 2=>ETA, 3=>RHO, 4=>OMEGA, 5=>ETAPRIME, 6=>PHI
219
220   const Double_t khm[6] = {0.13498, 0.54751, 0.7755, 0.78265, 0.95778, 1.01946};
221   np--;
222
223   Double_t scaledPt = sqrt(pt*pt + khm[np]*khm[np] - khm[0]*khm[0]);
224   Double_t scaledYield = PtPizero(&scaledPt, (Double_t*) 0);
225
226   //     VALUE MESON/PI AT 5 GEV
227
228   Double_t normPt = 5.;
229   Double_t scaledNormPt = sqrt(normPt*normPt + khm[np]*khm[np] - khm[0]*khm[0]);
230   const Double_t kfmax[6]={1., 0.48, 1.0, 0.9, 0.25, 0.4};
231
232   Double_t norm = kfmax[np] * (PtPizero(&normPt, (Double_t*) 0) / PtPizero(&scaledNormPt, (Double_t*) 0));
233
234   return norm*(pt/scaledPt)*scaledYield;
235 }
236
237 //==========================================================================
238 //
239 //                     Set Getters 
240 //    
241 //==========================================================================
242
243 typedef Double_t (*GenFunc) (const Double_t*,  const Double_t*);
244
245 typedef Int_t (*GenFuncIp) (TRandom *);
246
247 GenFunc AliGenEMlib::GetPt(Int_t param, const char * tname) const
248 {
249 // Return pointer to pT parameterisation
250    GenFunc func=0;
251    TString sname(tname);
252
253    switch (param) 
254     {
255     case kPizero:
256       func=PtPizero;
257       break;
258     case kEta:
259       func=PtEta;
260       break;
261     case kRho:
262       func=PtRho;
263       break;
264     case kOmega:
265       func=PtOmega;
266       break;
267     case kEtaprime:
268       func=PtEtaprime;
269       break;
270     case kPhi:
271       func=PtPhi;
272       break;
273
274     default:
275       func=0;
276       printf("<AliGenEMlib::GetPt> unknown parametrisation\n");
277     }
278    return func;
279 }
280
281 GenFunc AliGenEMlib::GetY(Int_t param, const char * tname) const
282 {
283 // Return pointer to y- parameterisation
284    GenFunc func=0;
285    TString sname(tname);
286
287    switch (param) 
288     {
289     case kPizero:
290          func=YPizero;
291          break;
292     case kEta:
293          func=YEta;
294          break;
295     case kRho:
296          func=YRho;
297          break;
298     case kOmega:
299          func=YOmega;
300          break;
301     case kEtaprime:
302          func=YEtaprime;
303          break;
304     case kPhi:
305          func=YPhi;
306          break;
307
308     default:
309         func=0;
310         printf("<AliGenEMlib::GetY> unknown parametrisation\n");
311     }
312     return func;
313 }
314
315 GenFuncIp AliGenEMlib::GetIp(Int_t param, const char * tname) const
316 {
317 // Return pointer to particle type parameterisation
318    GenFuncIp func=0;
319    TString sname(tname);
320
321    switch (param) 
322     {
323     case kPizero:
324          func=IpPizero;
325          break;
326     case kEta:
327          func=IpEta;
328          break;
329     case kRho:
330          func=IpRho;
331          break;
332     case kOmega:
333          func=IpOmega;
334          break;
335     case kEtaprime:
336          func=IpEtaprime;
337          break;
338     case kPhi:
339          func=IpPhi;
340          break;
341
342     default:
343         func=0;
344         printf("<AliGenEMlib::GetIp> unknown parametrisation\n");
345     }
346     return func;
347 }
348
349
350
351
352
353
354
355
356
357
358
359