]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenHIJINGpara.cxx
Minor correction of method signature needed on Sun
[u/mrichter/AliRoot.git] / EVGEN / AliGenHIJINGpara.cxx
CommitLineData
790bbabf 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$
a99cf51f 18Revision 1.8 2001/07/20 11:03:58 morsch
19Issue warning message if used outside allowed eta range (-8 to 8).
20
5b0e4c0f 21Revision 1.7 2001/07/17 12:41:01 morsch
22- Calculation of fraction of event corresponding to selected pt-range corrected
23(R. Turrisi)
24- Parent weight corrected.
25
f25521b2 26Revision 1.6 2001/05/16 14:57:10 alibrary
27New files for folders and Stack
28
9e1a0ddb 29Revision 1.5 2000/12/21 16:24:06 morsch
30Coding convention clean-up
31
675e9664 32Revision 1.4 2000/11/30 07:12:50 alibrary
33Introducing new Rndm and QA classes
34
65fb704d 35Revision 1.3 2000/10/02 21:28:06 fca
36Removal of useless dependecies via forward declarations
37
94de3818 38Revision 1.2 2000/07/11 18:24:55 fca
39Coding convention corrections + few minor bug fixes
40
aee8290b 41Revision 1.1 2000/06/09 20:20:30 morsch
42Same class as previously in AliSimpleGen.cxx
43All coding rule violations except RS3 corrected (AM)
44
790bbabf 45*/
675e9664 46
47// Parameterisation of pi and K, eta and pt distributions
48// used for the ALICE TDRs.
49// eta: according to HIJING (shadowing + quenching)
50// pT : according to CDF measurement at 1.8 TeV
51// Author: andreas.morsch@cern.ch
52
53
790bbabf 54//Begin_Html
55/*
56<img src="picts/AliGeneratorClass.gif">
57</pre>
58<br clear=left>
59<font size=+2 color=red>
60<p>The responsible person for this module is
61<a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
62</font>
63<pre>
64*/
65//End_Html
66// //
67///////////////////////////////////////////////////////////////////
68
69#include "AliGenHIJINGpara.h"
65fb704d 70#include "TF1.h"
790bbabf 71#include "AliRun.h"
72#include "AliConst.h"
73#include "AliPDG.h"
74
75ClassImp(AliGenHIJINGpara)
76
77AliGenHIJINGpara::AliGenHIJINGpara(const AliGenHIJINGpara & para)
78{
79// copy constructor
80}
81
82//_____________________________________________________________________________
83static Double_t ptpi(Double_t *px, Double_t *)
84{
85 //
86 // PT-PARAMETERIZATION CDF, PRL 61(88) 1819
87 // POWER LAW FOR PT > 500 MEV
88 // MT SCALING BELOW (T=160 MEV)
89 //
90 const Double_t kp0 = 1.3;
91 const Double_t kxn = 8.28;
92 const Double_t kxlim=0.5;
93 const Double_t kt=0.160;
94 const Double_t kxmpi=0.139;
95 const Double_t kb=1.;
96 Double_t y, y1, xmpi2, ynorm, a;
97 Double_t x=*px;
98 //
99 y1=TMath::Power(kp0/(kp0+kxlim),kxn);
100 xmpi2=kxmpi*kxmpi;
101 ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+xmpi2)/kt));
102 a=ynorm/y1;
103 if (x > kxlim)
104 y=a*TMath::Power(kp0/(kp0+x),kxn);
105 else
106 y=kb*TMath::Exp(-sqrt(x*x+xmpi2)/kt);
107 return y*x;
108}
109
110//_____________________________________________________________________________
111static Double_t ptscal(Double_t pt, Int_t np)
112{
113 // SCALING EN MASSE PAR RAPPORT A PTPI
114 // MASS PI,K,ETA,RHO,OMEGA,ETA',PHI
115 const Double_t khm[10] = {.13957,.493,.5488,.769,.7826,.958,1.02,0,0,0};
116 // VALUE MESON/PI AT 5 GEV
117 const Double_t kfmax[10]={1.,0.3,0.55,1.0,1.0,1.0,1.0,0,0,0};
118 np--;
119 Double_t f5=TMath::Power(((
120 sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3);
121 Double_t fmax2=f5/kfmax[np];
122 // PIONS
123 Double_t ptpion=100.*ptpi(&pt, (Double_t*) 0);
124 Double_t fmtscal=TMath::Power(((
125 sqrt(pt*pt+0.018215)+2.)/ (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/
126 fmax2;
127 return fmtscal*ptpion;
128}
129
130//_____________________________________________________________________________
131static Double_t ptka( Double_t *px, Double_t *)
132{
133 //
134 // pt parametrisation for k
135 //
136 return ptscal(*px,2);
137}
138
139
140//_____________________________________________________________________________
141static Double_t etapic( Double_t *py, Double_t *)
142{
143 //
144 // eta parametrisation for pi
145 //
146 const Double_t ka1 = 4913.;
147 const Double_t ka2 = 1819.;
148 const Double_t keta1 = 0.22;
149 const Double_t keta2 = 3.66;
150 const Double_t kdeta1 = 1.47;
151 const Double_t kdeta2 = 1.51;
152 Double_t y=TMath::Abs(*py);
153 //
154 Double_t ex1 = (y-keta1)*(y-keta1)/(2*kdeta1*kdeta1);
155 Double_t ex2 = (y-keta2)*(y-keta2)/(2*kdeta2*kdeta2);
156 return ka1*TMath::Exp(-ex1)+ka2*TMath::Exp(-ex2);
157}
158
159//_____________________________________________________________________________
160static Double_t etakac( Double_t *py, Double_t *)
161{
162 //
163 // eta parametrisation for ka
164 //
165 const Double_t ka1 = 497.6;
166 const Double_t ka2 = 215.6;
167 const Double_t keta1 = 0.79;
168 const Double_t keta2 = 4.09;
169 const Double_t kdeta1 = 1.54;
170 const Double_t kdeta2 = 1.40;
171 Double_t y=TMath::Abs(*py);
172 //
173 Double_t ex1 = (y-keta1)*(y-keta1)/(2*kdeta1*kdeta1);
174 Double_t ex2 = (y-keta2)*(y-keta2)/(2*kdeta2*kdeta2);
175 return ka1*TMath::Exp(-ex1)+ka2*TMath::Exp(-ex2);
176}
177
178//_____________________________________________________________________________
179AliGenHIJINGpara::AliGenHIJINGpara()
180 :AliGenerator()
181{
182 //
183 // Default constructor
184 //
185 fPtpi = 0;
186 fPtka = 0;
187 fETApic = 0;
188 fETAkac = 0;
189}
190
191//_____________________________________________________________________________
192AliGenHIJINGpara::AliGenHIJINGpara(Int_t npart)
193 :AliGenerator(npart)
194{
195 //
196 // Standard constructor
197 //
198 fName="HIGINGpara";
199 fTitle="HIJING Parametrisation Particle Generator";
200 fPtpi = 0;
201 fPtka = 0;
202 fETApic = 0;
203 fETAkac = 0;
204}
205
206//_____________________________________________________________________________
207AliGenHIJINGpara::~AliGenHIJINGpara()
208{
209 //
210 // Standard destructor
211 //
212 delete fPtpi;
213 delete fPtka;
214 delete fETApic;
215 delete fETAkac;
216}
217
218//_____________________________________________________________________________
219void AliGenHIJINGpara::Init()
220{
221 //
222 // Initialise the HIJING parametrisation
223 //
224 Float_t etaMin =-TMath::Log(TMath::Tan(
225 TMath::Min((Double_t)fThetaMax/2,TMath::Pi()/2-1.e-10)));
226 Float_t etaMax = -TMath::Log(TMath::Tan(
227 TMath::Max((Double_t)fThetaMin/2,1.e-10)));
f25521b2 228 fPtpi = new TF1("ptpi",&ptpi,0,20,0);
229 fPtka = new TF1("ptka",&ptka,0,20,0);
790bbabf 230 fETApic = new TF1("etapic",&etapic,etaMin,etaMax,0);
231 fETAkac = new TF1("etakac",&etakac,etaMin,etaMax,0);
f25521b2 232
790bbabf 233 TF1 *etaPic0 = new TF1("etapic",&etapic,-7,7,0);
234 TF1 *etaKac0 = new TF1("etakac",&etakac,-7,7,0);
f25521b2 235
236 TF1 *ptPic0 = new TF1("ptpi",&ptpi,0.,15.,0);
237 TF1 *ptKac0 = new TF1("ptka",&ptka,0.,15.,0);
238
790bbabf 239 Float_t intETApi = etaPic0->Integral(-0.5, 0.5);
240 Float_t intETAka = etaKac0->Integral(-0.5, 0.5);
f25521b2 241 Float_t scalePi = 7316/(intETApi/1.5);
242 Float_t scaleKa = 684/(intETAka/2.0);
243
244// Fraction of events corresponding to the selected pt-range
245 Float_t intPt = (0.877*ptPic0->Integral(0, 15)+
246 0.123*ptKac0->Integral(0, 15));
247 Float_t intPtSel = (0.877*ptPic0->Integral(fPtMin, fPtMax)+
248 0.123*ptKac0->Integral(fPtMin, fPtMax));
249 Float_t ptFrac = intPtSel/intPt;
250
251// Fraction of events corresponding to the selected eta-range
790bbabf 252 Float_t intETASel = (scalePi*etaPic0->Integral(etaMin, etaMax)+
253 scaleKa*etaKac0->Integral(etaMin, etaMax));
f25521b2 254// Fraction of events corresponding to the selected phi-range
255 Float_t phiFrac = (fPhiMax-fPhiMin)/2/TMath::Pi();
256
257 fParentWeight = Float_t(fNpart)/(intETASel*ptFrac*phiFrac);
790bbabf 258
9e1a0ddb 259 printf("%s: The number of particles in the selected kinematic region corresponds to %f percent of a full event\n ",
260 ClassName(),100.*fParentWeight);
5b0e4c0f 261
262// Issue warning message if etaMin or etaMax are outside the alowed range
263// of the parametrization
264 if (etaMin < -8.001 || etaMax > 8.001) {
265 printf("\n \n WARNING FROM AliGenHIJINGPara !");
266 printf("\n YOU ARE USING THE PARAMETERISATION OUTSIDE ");
267 printf("\n THE ALLOWED PSEUDORAPIDITY RANGE (-8. - 8.)");
268 printf("\n YOUR LIMITS: %f %f \n \n ", etaMin, etaMax);
269 }
790bbabf 270}
271
272//_____________________________________________________________________________
273void AliGenHIJINGpara::Generate()
274{
275 //
276 // Generate one trigger
277 //
278
279
280 const Float_t kRaKpic=0.14;
281 const Float_t kBorne=1/(1+kRaKpic);
282 Float_t polar[3]= {0,0,0};
283 //
284 const Int_t kPions[3] = {kPi0, kPiPlus, kPiMinus};
285 const Int_t kKaons[4] = {kK0Long, kK0Short, kKPlus, kKMinus};
286 //
287 Float_t origin[3];
288 Float_t pt, pl, ptot;
289 Float_t phi, theta;
290 Float_t p[3];
291 Int_t i, part, nt, j;
292 //
293 TF1 *ptf;
294 TF1 *etaf;
295 //
296 Float_t random[6];
297 //
298 for (j=0;j<3;j++) origin[j]=fOrigin[j];
aee8290b 299 if(fVertexSmear==kPerEvent) {
65fb704d 300 Rndm(random,6);
790bbabf 301 for (j=0;j<3;j++) {
302 origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
303 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
304 }
305 }
306 for(i=0;i<fNpart;i++) {
307 while(1) {
65fb704d 308 Rndm(random,3);
790bbabf 309 if(random[0]<kBorne) {
310 part=kPions[Int_t (random[1]*3)];
311 ptf=fPtpi;
312 etaf=fETApic;
313 } else {
314 part=kKaons[Int_t (random[1]*4)];
315 ptf=fPtka;
316 etaf=fETAkac;
317 }
318 phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
319 theta=2*TMath::ATan(TMath::Exp(-etaf->GetRandom()));
320 if(theta<fThetaMin || theta>fThetaMax) continue;
321 pt=ptf->GetRandom();
322 pl=pt/TMath::Tan(theta);
323 ptot=TMath::Sqrt(pt*pt+pl*pl);
324 if(ptot<fPMin || ptot>fPMax) continue;
325 p[0]=pt*TMath::Cos(phi);
326 p[1]=pt*TMath::Sin(phi);
327 p[2]=pl;
aee8290b 328 if(fVertexSmear==kPerTrack) {
65fb704d 329 Rndm(random,6);
790bbabf 330 for (j=0;j<3;j++) {
331 origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
332 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
333 }
334 }
a99cf51f 335 SetTrack(fTrackIt,-1,part,p,origin,polar,0,kPPrimary,nt,fParentWeight);
790bbabf 336 break;
337 }
338 }
339}
340
341AliGenHIJINGpara& AliGenHIJINGpara::operator=(const AliGenHIJINGpara& rhs)
342{
343// Assignment operator
344 return *this;
345}
346
347