]>
Commit | Line | Data |
---|---|---|
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$ | |
886b6f73 | 18 | Revision 1.5 1999/09/29 09:24:14 fca |
19 | Introduction of the Copyright and cvs Log | |
20 | ||
4c039060 | 21 | */ |
22 | ||
fe4da5cc | 23 | /////////////////////////////////////////////////////////////////// |
24 | // // | |
25 | // Generate the final state of the interaction as the input // | |
26 | // to the MonteCarlo // | |
27 | // | |
28 | //Begin_Html | |
29 | /* | |
1439f98e | 30 | <img src="picts/AliGeneratorClass.gif"> |
fe4da5cc | 31 | </pre> |
32 | <br clear=left> | |
33 | <font size=+2 color=red> | |
34 | <p>The responsible person for this module is | |
35 | <a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>. | |
36 | </font> | |
37 | <pre> | |
38 | */ | |
39 | //End_Html | |
40 | // // | |
41 | /////////////////////////////////////////////////////////////////// | |
42 | ||
43 | #include "AliSimpleGen.h" | |
44 | #include "AliRun.h" | |
1578254f | 45 | #include "AliConst.h" |
fe4da5cc | 46 | |
47 | ClassImp(AliGenHIJINGpara) | |
48 | ||
49 | //_____________________________________________________________________________ | |
50 | static Double_t ptpi(Double_t *px, Double_t *) | |
51 | { | |
52 | // | |
53 | // PT-PARAMETERIZATION CDF, PRL 61(88) 1819 | |
54 | // POWER LAW FOR PT > 500 MEV | |
55 | // MT SCALING BELOW (T=160 MEV) | |
56 | // | |
57 | const Double_t p0 = 1.3; | |
58 | const Double_t xn = 8.28; | |
59 | const Double_t xlim=0.5; | |
60 | const Double_t t=0.160; | |
61 | const Double_t xmpi=0.139; | |
62 | const Double_t b=1.; | |
63 | Double_t y, y1, xmpi2, ynorm, a; | |
64 | Double_t x=*px; | |
65 | // | |
66 | y1=TMath::Power(p0/(p0+xlim),xn); | |
67 | xmpi2=xmpi*xmpi; | |
68 | ynorm=b*(TMath::Exp(-sqrt(xlim*xlim+xmpi2)/t)); | |
69 | a=ynorm/y1; | |
70 | if (x > xlim) | |
71 | y=a*TMath::Power(p0/(p0+x),xn); | |
72 | else | |
73 | y=b*TMath::Exp(-sqrt(x*x+xmpi2)/t); | |
74 | return y*x; | |
75 | } | |
76 | ||
77 | //_____________________________________________________________________________ | |
78 | static Double_t ptscal(Double_t pt, Int_t np) | |
79 | { | |
80 | // SCALING EN MASSE PAR RAPPORT A PTPI | |
81 | // MASS PI,K,ETA,RHO,OMEGA,ETA',PHI | |
82 | const Double_t hm[10] = {.13957,.493,.5488,.769,.7826,.958,1.02,0,0,0}; | |
83 | // VALUE MESON/PI AT 5 GEV | |
84 | const Double_t fmax[10]={1.,0.3,0.55,1.0,1.0,1.0,1.0,0,0,0}; | |
85 | np--; | |
86 | Double_t f5=TMath::Power(((sqrt(100.018215)+2.)/(sqrt(100.+hm[np]*hm[np])+2.0)),12.3); | |
87 | Double_t fmax2=f5/fmax[np]; | |
88 | // PIONS | |
89 | Double_t ptpion=100.*ptpi(&pt, (Double_t*) 0); | |
90 | Double_t fmtscal=TMath::Power(((sqrt(pt*pt+0.018215)+2.)/ | |
91 | (sqrt(pt*pt+hm[np]*hm[np])+2.0)),12.3)/ fmax2; | |
92 | return fmtscal*ptpion; | |
93 | } | |
94 | ||
95 | //_____________________________________________________________________________ | |
96 | static Double_t ptka( Double_t *px, Double_t *) | |
97 | { | |
98 | // | |
99 | // pt parametrisation for k | |
100 | // | |
101 | return ptscal(*px,2); | |
102 | } | |
103 | ||
104 | ||
105 | //_____________________________________________________________________________ | |
106 | static Double_t etapic( Double_t *py, Double_t *) | |
107 | { | |
108 | // | |
109 | // eta parametrisation for pi | |
110 | // | |
111 | const Double_t a1 = 4913.; | |
112 | const Double_t a2 = 1819.; | |
113 | const Double_t eta1 = 0.22; | |
114 | const Double_t eta2 = 3.66; | |
115 | const Double_t deta1 = 1.47; | |
116 | const Double_t deta2 = 1.51; | |
117 | Double_t y=TMath::Abs(*py); | |
118 | // | |
119 | Double_t ex1 = (y-eta1)*(y-eta1)/(2*deta1*deta1); | |
120 | Double_t ex2 = (y-eta2)*(y-eta2)/(2*deta2*deta2); | |
121 | return a1*TMath::Exp(-ex1)+a2*TMath::Exp(-ex2); | |
122 | } | |
123 | ||
124 | //_____________________________________________________________________________ | |
125 | static Double_t etakac( Double_t *py, Double_t *) | |
126 | { | |
127 | // | |
128 | // eta parametrisation for ka | |
129 | // | |
130 | const Double_t a1 = 497.6; | |
131 | const Double_t a2 = 215.6; | |
132 | const Double_t eta1 = 0.79; | |
133 | const Double_t eta2 = 4.09; | |
134 | const Double_t deta1 = 1.54; | |
135 | const Double_t deta2 = 1.40; | |
136 | Double_t y=TMath::Abs(*py); | |
137 | // | |
138 | Double_t ex1 = (y-eta1)*(y-eta1)/(2*deta1*deta1); | |
139 | Double_t ex2 = (y-eta2)*(y-eta2)/(2*deta2*deta2); | |
140 | return a1*TMath::Exp(-ex1)+a2*TMath::Exp(-ex2); | |
141 | } | |
142 | ||
143 | //_____________________________________________________________________________ | |
144 | AliGenHIJINGpara::AliGenHIJINGpara() | |
145 | :AliGenerator() | |
146 | { | |
147 | // | |
148 | // Default constructor | |
149 | // | |
150 | fPtpi = 0; | |
151 | fPtka = 0; | |
152 | fETApic = 0; | |
153 | fETAkac = 0; | |
154 | } | |
155 | ||
156 | //_____________________________________________________________________________ | |
157 | AliGenHIJINGpara::AliGenHIJINGpara(Int_t npart) | |
158 | :AliGenerator(npart) | |
159 | { | |
160 | // | |
161 | // Standard constructor | |
162 | // | |
163 | fName="HIGINGpara"; | |
164 | fTitle="HIJING Parametrisation Particle Generator"; | |
165 | fPtpi = 0; | |
166 | fPtka = 0; | |
167 | fETApic = 0; | |
168 | fETAkac = 0; | |
169 | } | |
170 | ||
171 | //_____________________________________________________________________________ | |
172 | AliGenHIJINGpara::~AliGenHIJINGpara() | |
173 | { | |
174 | // | |
175 | // Standard destructor | |
176 | // | |
177 | delete fPtpi; | |
178 | delete fPtka; | |
179 | delete fETApic; | |
180 | delete fETAkac; | |
181 | } | |
182 | ||
183 | //_____________________________________________________________________________ | |
184 | void AliGenHIJINGpara::Init() | |
185 | { | |
186 | // | |
187 | // Initialise the HIJING parametrisation | |
188 | // | |
189 | Float_t etaMin = -TMath::Log(TMath::Tan(TMath::Min((Double_t)fThetaMax/2,TMath::Pi()/2-1.e-10))); | |
190 | Float_t etaMax = -TMath::Log(TMath::Tan(TMath::Max((Double_t)fThetaMin/2, 1.e-10))); | |
191 | fPtpi = new TF1("ptpi",&ptpi,0,20,0); | |
192 | fPtka = new TF1("ptka",&ptka,0,20,0); | |
193 | fETApic = new TF1("etapic",&etapic,etaMin,etaMax,0); | |
194 | fETAkac = new TF1("etakac",&etakac,etaMin,etaMax,0); | |
195 | TF1 *ETApic0 = new TF1("etapic",&etapic,-7,7,0); | |
196 | TF1 *ETAkac0 = new TF1("etakac",&etakac,-7,7,0); | |
197 | Float_t IntETApi = ETApic0->Integral(-0.5, 0.5); | |
198 | Float_t IntETAka = ETAkac0->Integral(-0.5, 0.5); | |
199 | Float_t scalePi=7316/(IntETApi/1.5); | |
200 | Float_t scaleKa= 684/(IntETAka/2.0); | |
201 | ||
202 | Float_t IntPt = (0.877*ETApic0->Integral(0, 15)+ | |
203 | 0.123*ETAkac0->Integral(0, 15)); | |
204 | Float_t IntPtSel = (0.877*ETApic0->Integral(fPtMin, fPtMax)+ | |
205 | 0.123*ETAkac0->Integral(fPtMin, fPtMax)); | |
206 | Float_t PtFrac = IntPtSel/IntPt; | |
207 | ||
208 | ||
209 | Float_t IntETASel = (scalePi*ETApic0->Integral(etaMin, etaMax)+ | |
210 | scaleKa*ETAkac0->Integral(etaMin, etaMax)); | |
211 | Float_t PhiFrac = (fPhiMax-fPhiMin)/2/TMath::Pi(); | |
212 | fParentWeight = Float_t(fNpart)/IntETASel*PtFrac*PhiFrac; | |
213 | ||
214 | printf("\n The number of particles in the selected kinematic region corresponds to %f percent of a full event\n ", 100.*fParentWeight); | |
215 | ||
216 | } | |
217 | ||
218 | //_____________________________________________________________________________ | |
219 | void AliGenHIJINGpara::Generate() | |
220 | { | |
221 | // | |
222 | // Generate one trigger | |
223 | // | |
224 | ||
fe4da5cc | 225 | |
226 | const Float_t raKpic=0.14; | |
227 | const Float_t borne=1/(1+raKpic); | |
228 | Float_t polar[3]= {0,0,0}; | |
229 | // | |
1578254f | 230 | const Int_t pions[3] = {kPi0, kPiPlus, kPiMinus}; |
231 | const Int_t kaons[4] = {kK0Long, kK0Short, kKPlus, kKMinus}; | |
fe4da5cc | 232 | // |
233 | Float_t origin[3]; | |
234 | Float_t pt, pl, ptot; | |
235 | Float_t phi, theta; | |
236 | Float_t p[3]; | |
237 | Int_t i, part, nt, j; | |
238 | // | |
239 | TF1 *ptf; | |
240 | TF1 *etaf; | |
241 | // | |
242 | Float_t random[6]; | |
243 | // | |
244 | for (j=0;j<3;j++) origin[j]=fOrigin[j]; | |
245 | if(fVertexSmear==perEvent) { | |
cfce8870 | 246 | gMC->Rndm(random,6); |
fe4da5cc | 247 | for (j=0;j<3;j++) { |
248 | origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* | |
249 | TMath::Sqrt(-2*TMath::Log(random[2*j+1])); | |
250 | } | |
251 | } | |
252 | for(i=0;i<fNpart;i++) { | |
253 | while(1) { | |
cfce8870 | 254 | gMC->Rndm(random,3); |
fe4da5cc | 255 | if(random[0]<borne) { |
256 | part=pions[Int_t (random[1]*3)]; | |
257 | ptf=fPtpi; | |
258 | etaf=fETApic; | |
259 | } else { | |
260 | part=kaons[Int_t (random[1]*4)]; | |
261 | ptf=fPtka; | |
262 | etaf=fETAkac; | |
263 | } | |
886b6f73 | 264 | phi=fPhiMin+random[2]*(fPhiMax-fPhiMin); |
fe4da5cc | 265 | theta=2*TMath::ATan(TMath::Exp(-etaf->GetRandom())); |
266 | if(theta<fThetaMin || theta>fThetaMax) continue; | |
267 | pt=ptf->GetRandom(); | |
268 | pl=pt/TMath::Tan(theta); | |
269 | ptot=TMath::Sqrt(pt*pt+pl*pl); | |
270 | if(ptot<fPMin || ptot>fPMax) continue; | |
271 | p[0]=pt*TMath::Cos(phi); | |
272 | p[1]=pt*TMath::Sin(phi); | |
273 | p[2]=pl; | |
274 | if(fVertexSmear==perTrack) { | |
cfce8870 | 275 | gMC->Rndm(random,6); |
fe4da5cc | 276 | for (j=0;j<3;j++) { |
277 | origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* | |
278 | TMath::Sqrt(-2*TMath::Log(random[2*j+1])); | |
279 | } | |
280 | } | |
886b6f73 | 281 | gAlice->SetTrack(fTrackIt,-1,part,p,origin,polar,0,"Primary",nt,fParentWeight); |
fe4da5cc | 282 | break; |
283 | } | |
284 | } | |
285 | } | |
286 | ||
287 | ClassImp(AliGenFixed) | |
288 | ||
289 | //_____________________________________________________________________________ | |
290 | AliGenFixed::AliGenFixed() | |
291 | :AliGenerator() | |
292 | { | |
293 | // | |
294 | // Default constructor | |
295 | // | |
296 | fIpart = 0; | |
297 | } | |
298 | ||
299 | //_____________________________________________________________________________ | |
300 | AliGenFixed::AliGenFixed(Int_t npart) | |
301 | :AliGenerator(npart) | |
302 | { | |
303 | // | |
304 | // Standard constructor | |
305 | // | |
306 | fName="Fixed"; | |
307 | fTitle="Fixed Particle Generator"; | |
308 | // Generate Proton by default | |
1578254f | 309 | fIpart=kProton; |
fe4da5cc | 310 | } |
311 | ||
312 | //_____________________________________________________________________________ | |
313 | void AliGenFixed::Generate() | |
314 | { | |
315 | // | |
316 | // Generate one trigger | |
317 | // | |
318 | Float_t polar[3]= {0,0,0}; | |
319 | Float_t p[3] = {fPMin*TMath::Cos(fPhiMin)*TMath::Sin(fThetaMin), | |
320 | fPMin*TMath::Sin(fPhiMin)*TMath::Sin(fThetaMin), | |
321 | fPMin*TMath::Cos(fThetaMin)}; | |
322 | Int_t i, nt; | |
323 | // | |
324 | for(i=0;i<fNpart;i++) { | |
886b6f73 | 325 | gAlice->SetTrack(fTrackIt,-1,fIpart,p,fOrigin.GetArray(),polar,0,"Primary",nt); |
fe4da5cc | 326 | } |
327 | } | |
328 | ||
329 | //_____________________________________________________________________________ | |
330 | void AliGenFixed::SetSigma(Float_t, Float_t, Float_t) | |
331 | { | |
332 | // | |
333 | // Set the interaction point sigma | |
334 | // | |
335 | printf("Vertex smearing not implemented for fixed generator\n"); | |
336 | } | |
337 | ||
338 | ||
339 | ClassImp(AliGenBox) | |
340 | ||
341 | //_____________________________________________________________________________ | |
342 | AliGenBox::AliGenBox() | |
343 | :AliGenerator() | |
344 | { | |
345 | // | |
346 | // Default constructor | |
347 | // | |
348 | fIpart=0; | |
349 | } | |
350 | ||
351 | //_____________________________________________________________________________ | |
352 | AliGenBox::AliGenBox(Int_t npart) | |
353 | :AliGenerator(npart) | |
354 | { | |
355 | // | |
356 | // Standard constructor | |
357 | // | |
358 | fName="Box"; | |
359 | fTitle="Box particle generator"; | |
360 | // Generate Proton by default | |
1578254f | 361 | fIpart=kProton; |
fe4da5cc | 362 | } |
363 | ||
364 | //_____________________________________________________________________________ | |
365 | void AliGenBox::Generate() | |
366 | { | |
367 | // | |
368 | // Generate one trigger | |
369 | // | |
fe4da5cc | 370 | |
371 | Float_t polar[3]= {0,0,0}; | |
372 | // | |
373 | Float_t origin[3]; | |
374 | Float_t p[3]; | |
375 | Int_t i, j, nt; | |
376 | Float_t pmom, theta, phi; | |
377 | // | |
378 | Float_t random[6]; | |
379 | // | |
380 | for (j=0;j<3;j++) origin[j]=fOrigin[j]; | |
381 | if(fVertexSmear==perEvent) { | |
cfce8870 | 382 | gMC->Rndm(random,6); |
fe4da5cc | 383 | for (j=0;j<3;j++) { |
384 | origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* | |
385 | TMath::Sqrt(-2*TMath::Log(random[2*j+1])); | |
386 | } | |
387 | } | |
388 | for(i=0;i<fNpart;i++) { | |
cfce8870 | 389 | gMC->Rndm(random,3); |
fe4da5cc | 390 | pmom=fPMin+random[0]*(fPMax-fPMin); |
391 | theta=fThetaMin+random[1]*(fThetaMax-fThetaMin); | |
392 | phi=fPhiMin+random[2]*(fPhiMax-fPhiMin); | |
393 | p[0] = pmom*TMath::Cos(phi)*TMath::Sin(theta); | |
394 | p[1] = pmom*TMath::Sin(phi)*TMath::Sin(theta); | |
395 | p[2] = pmom*TMath::Cos(theta); | |
396 | if(fVertexSmear==perTrack) { | |
cfce8870 | 397 | gMC->Rndm(random,6); |
fe4da5cc | 398 | for (j=0;j<3;j++) { |
399 | origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* | |
400 | TMath::Sqrt(-2*TMath::Log(random[2*j+1])); | |
401 | } | |
402 | } | |
886b6f73 | 403 | gAlice->SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,"Primary",nt); |
fe4da5cc | 404 | } |
405 | } | |
406 | ||
407 |