1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.5 1999/09/29 09:24:14 fca
19 Introduction of the Copyright and cvs Log
23 ///////////////////////////////////////////////////////////////////
25 // Generate the final state of the interaction as the input //
26 // to the MonteCarlo //
30 <img src="picts/AliGeneratorClass.gif">
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>.
41 ///////////////////////////////////////////////////////////////////
43 #include "AliSimpleGen.h"
47 ClassImp(AliGenHIJINGpara)
49 //_____________________________________________________________________________
50 static Double_t ptpi(Double_t *px, Double_t *)
53 // PT-PARAMETERIZATION CDF, PRL 61(88) 1819
54 // POWER LAW FOR PT > 500 MEV
55 // MT SCALING BELOW (T=160 MEV)
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;
63 Double_t y, y1, xmpi2, ynorm, a;
66 y1=TMath::Power(p0/(p0+xlim),xn);
68 ynorm=b*(TMath::Exp(-sqrt(xlim*xlim+xmpi2)/t));
71 y=a*TMath::Power(p0/(p0+x),xn);
73 y=b*TMath::Exp(-sqrt(x*x+xmpi2)/t);
77 //_____________________________________________________________________________
78 static Double_t ptscal(Double_t pt, Int_t np)
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};
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];
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;
95 //_____________________________________________________________________________
96 static Double_t ptka( Double_t *px, Double_t *)
99 // pt parametrisation for k
101 return ptscal(*px,2);
105 //_____________________________________________________________________________
106 static Double_t etapic( Double_t *py, Double_t *)
109 // eta parametrisation for pi
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);
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);
124 //_____________________________________________________________________________
125 static Double_t etakac( Double_t *py, Double_t *)
128 // eta parametrisation for ka
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);
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);
143 //_____________________________________________________________________________
144 AliGenHIJINGpara::AliGenHIJINGpara()
148 // Default constructor
156 //_____________________________________________________________________________
157 AliGenHIJINGpara::AliGenHIJINGpara(Int_t npart)
161 // Standard constructor
164 fTitle="HIJING Parametrisation Particle Generator";
171 //_____________________________________________________________________________
172 AliGenHIJINGpara::~AliGenHIJINGpara()
175 // Standard destructor
183 //_____________________________________________________________________________
184 void AliGenHIJINGpara::Init()
187 // Initialise the HIJING parametrisation
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);
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;
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;
214 printf("\n The number of particles in the selected kinematic region corresponds to %f percent of a full event\n ", 100.*fParentWeight);
218 //_____________________________________________________________________________
219 void AliGenHIJINGpara::Generate()
222 // Generate one trigger
226 const Float_t raKpic=0.14;
227 const Float_t borne=1/(1+raKpic);
228 Float_t polar[3]= {0,0,0};
230 const Int_t pions[3] = {kPi0, kPiPlus, kPiMinus};
231 const Int_t kaons[4] = {kK0Long, kK0Short, kKPlus, kKMinus};
234 Float_t pt, pl, ptot;
237 Int_t i, part, nt, j;
244 for (j=0;j<3;j++) origin[j]=fOrigin[j];
245 if(fVertexSmear==perEvent) {
248 origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
249 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
252 for(i=0;i<fNpart;i++) {
255 if(random[0]<borne) {
256 part=pions[Int_t (random[1]*3)];
260 part=kaons[Int_t (random[1]*4)];
264 phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
265 theta=2*TMath::ATan(TMath::Exp(-etaf->GetRandom()));
266 if(theta<fThetaMin || theta>fThetaMax) continue;
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);
274 if(fVertexSmear==perTrack) {
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]));
281 gAlice->SetTrack(fTrackIt,-1,part,p,origin,polar,0,"Primary",nt,fParentWeight);
287 ClassImp(AliGenFixed)
289 //_____________________________________________________________________________
290 AliGenFixed::AliGenFixed()
294 // Default constructor
299 //_____________________________________________________________________________
300 AliGenFixed::AliGenFixed(Int_t npart)
304 // Standard constructor
307 fTitle="Fixed Particle Generator";
308 // Generate Proton by default
312 //_____________________________________________________________________________
313 void AliGenFixed::Generate()
316 // Generate one trigger
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)};
324 for(i=0;i<fNpart;i++) {
325 gAlice->SetTrack(fTrackIt,-1,fIpart,p,fOrigin.GetArray(),polar,0,"Primary",nt);
329 //_____________________________________________________________________________
330 void AliGenFixed::SetSigma(Float_t, Float_t, Float_t)
333 // Set the interaction point sigma
335 printf("Vertex smearing not implemented for fixed generator\n");
341 //_____________________________________________________________________________
342 AliGenBox::AliGenBox()
346 // Default constructor
351 //_____________________________________________________________________________
352 AliGenBox::AliGenBox(Int_t npart)
356 // Standard constructor
359 fTitle="Box particle generator";
360 // Generate Proton by default
364 //_____________________________________________________________________________
365 void AliGenBox::Generate()
368 // Generate one trigger
371 Float_t polar[3]= {0,0,0};
376 Float_t pmom, theta, phi;
380 for (j=0;j<3;j++) origin[j]=fOrigin[j];
381 if(fVertexSmear==perEvent) {
384 origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
385 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
388 for(i=0;i<fNpart;i++) {
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) {
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]));
403 gAlice->SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,"Primary",nt);