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