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.13 2002/10/14 14:55:35 hristov
19 Merging the VirtualMC branch to the main development branch (HEAD)
21 Revision 1.11.4.1 2002/07/24 08:56:28 alibrary
22 Updating EVGEN on TVirtulaMC
24 Revision 1.12 2002/06/19 06:56:34 hristov
27 Revision 1.11 2002/03/20 10:21:13 hristov
28 Set fPtMax to 15 GeV in order to avoid some numerical problems
30 Revision 1.10 2001/10/15 16:44:46 morsch
31 - Possibility for vertex distribution truncation.
32 - Write mc header with vertex position.
34 Revision 1.9 2001/07/27 17:09:36 morsch
35 Use local SetTrack, KeepTrack and SetHighWaterMark methods
36 to delegate either to local stack or to stack owned by AliRun.
37 (Piotr Skowronski, A.M.)
39 Revision 1.8 2001/07/20 11:03:58 morsch
40 Issue warning message if used outside allowed eta range (-8 to 8).
42 Revision 1.7 2001/07/17 12:41:01 morsch
43 - Calculation of fraction of event corresponding to selected pt-range corrected
45 - Parent weight corrected.
47 Revision 1.6 2001/05/16 14:57:10 alibrary
48 New files for folders and Stack
50 Revision 1.5 2000/12/21 16:24:06 morsch
51 Coding convention clean-up
53 Revision 1.4 2000/11/30 07:12:50 alibrary
54 Introducing new Rndm and QA classes
56 Revision 1.3 2000/10/02 21:28:06 fca
57 Removal of useless dependecies via forward declarations
59 Revision 1.2 2000/07/11 18:24:55 fca
60 Coding convention corrections + few minor bug fixes
62 Revision 1.1 2000/06/09 20:20:30 morsch
63 Same class as previously in AliSimpleGen.cxx
64 All coding rule violations except RS3 corrected (AM)
68 // Parameterisation of pi and K, eta and pt distributions
69 // used for the ALICE TDRs.
70 // eta: according to HIJING (shadowing + quenching)
71 // pT : according to CDF measurement at 1.8 TeV
72 // Author: andreas.morsch@cern.ch
77 <img src="picts/AliGeneratorClass.gif">
80 <font size=+2 color=red>
81 <p>The responsible person for this module is
82 <a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
88 ///////////////////////////////////////////////////////////////////
90 #include "AliGenHIJINGpara.h"
91 #include "AliGenEventHeader.h"
94 #include "AliDecayer.h"
95 #include "AliDecayerPythia.h"
100 #include <TDatabasePDG.h>
101 #include <TClonesArray.h>
102 #include <TParticle.h>
104 ClassImp(AliGenHIJINGpara)
106 AliGenHIJINGpara::AliGenHIJINGpara(const AliGenHIJINGpara & para)
111 //_____________________________________________________________________________
112 static Double_t ptpi(Double_t *px, Double_t *)
115 // PT-PARAMETERIZATION CDF, PRL 61(88) 1819
116 // POWER LAW FOR PT > 500 MEV
117 // MT SCALING BELOW (T=160 MEV)
119 const Double_t kp0 = 1.3;
120 const Double_t kxn = 8.28;
121 const Double_t kxlim=0.5;
122 const Double_t kt=0.160;
123 const Double_t kxmpi=0.139;
124 const Double_t kb=1.;
125 Double_t y, y1, xmpi2, ynorm, a;
128 y1=TMath::Power(kp0/(kp0+kxlim),kxn);
130 ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+xmpi2)/kt));
133 y=a*TMath::Power(kp0/(kp0+x),kxn);
135 y=kb*TMath::Exp(-sqrt(x*x+xmpi2)/kt);
139 //_____________________________________________________________________________
140 static Double_t ptscal(Double_t pt, Int_t np)
142 // SCALING EN MASSE PAR RAPPORT A PTPI
143 // MASS PI,K,ETA,RHO,OMEGA,ETA',PHI
144 const Double_t khm[10] = {.13957,.493,.5488,.769,.7826,.958,1.02,0,0,0};
145 // VALUE MESON/PI AT 5 GEV
146 const Double_t kfmax[10]={1.,0.3,0.55,1.0,1.0,1.0,1.0,0,0,0};
148 Double_t f5=TMath::Power(((
149 sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3);
150 Double_t fmax2=f5/kfmax[np];
152 Double_t ptpion=100.*ptpi(&pt, (Double_t*) 0);
153 Double_t fmtscal=TMath::Power(((
154 sqrt(pt*pt+0.018215)+2.)/ (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/
156 return fmtscal*ptpion;
159 //_____________________________________________________________________________
160 static Double_t ptka( Double_t *px, Double_t *)
163 // pt parametrisation for k
165 return ptscal(*px,2);
169 //_____________________________________________________________________________
170 static Double_t etapic( Double_t *py, Double_t *)
173 // eta parametrisation for pi
175 const Double_t ka1 = 4913.;
176 const Double_t ka2 = 1819.;
177 const Double_t keta1 = 0.22;
178 const Double_t keta2 = 3.66;
179 const Double_t kdeta1 = 1.47;
180 const Double_t kdeta2 = 1.51;
181 Double_t y=TMath::Abs(*py);
183 Double_t ex1 = (y-keta1)*(y-keta1)/(2*kdeta1*kdeta1);
184 Double_t ex2 = (y-keta2)*(y-keta2)/(2*kdeta2*kdeta2);
185 return ka1*TMath::Exp(-ex1)+ka2*TMath::Exp(-ex2);
188 //_____________________________________________________________________________
189 static Double_t etakac( Double_t *py, Double_t *)
192 // eta parametrisation for ka
194 const Double_t ka1 = 497.6;
195 const Double_t ka2 = 215.6;
196 const Double_t keta1 = 0.79;
197 const Double_t keta2 = 4.09;
198 const Double_t kdeta1 = 1.54;
199 const Double_t kdeta2 = 1.40;
200 Double_t y=TMath::Abs(*py);
202 Double_t ex1 = (y-keta1)*(y-keta1)/(2*kdeta1*kdeta1);
203 Double_t ex2 = (y-keta2)*(y-keta2)/(2*kdeta2*kdeta2);
204 return ka1*TMath::Exp(-ex1)+ka2*TMath::Exp(-ex2);
207 //_____________________________________________________________________________
208 AliGenHIJINGpara::AliGenHIJINGpara()
212 // Default constructor
224 //_____________________________________________________________________________
225 AliGenHIJINGpara::AliGenHIJINGpara(Int_t npart)
229 // Standard constructor
232 fTitle="HIJING Parametrisation Particle Generator";
243 //_____________________________________________________________________________
244 AliGenHIJINGpara::~AliGenHIJINGpara()
247 // Standard destructor
255 //_____________________________________________________________________________
256 void AliGenHIJINGpara::Init()
259 // Initialise the HIJING parametrisation
261 Float_t etaMin =-TMath::Log(TMath::Tan(
262 TMath::Min((Double_t)fThetaMax/2,TMath::Pi()/2-1.e-10)));
263 Float_t etaMax = -TMath::Log(TMath::Tan(
264 TMath::Max((Double_t)fThetaMin/2,1.e-10)));
265 fPtpi = new TF1("ptpi",&ptpi,0,20,0);
266 fPtka = new TF1("ptka",&ptka,0,20,0);
267 fETApic = new TF1("etapic",&etapic,etaMin,etaMax,0);
268 fETAkac = new TF1("etakac",&etakac,etaMin,etaMax,0);
270 TF1 etaPic0("etapic",&etapic,-7,7,0);
271 TF1 etaKac0("etakac",&etakac,-7,7,0);
273 TF1 ptPic0("ptpi",&ptpi,0.,15.,0);
274 TF1 ptKac0("ptka",&ptka,0.,15.,0);
276 Float_t intETApi = etaPic0.Integral(-0.5, 0.5);
277 Float_t intETAka = etaKac0.Integral(-0.5, 0.5);
278 Float_t scalePi = 7316/(intETApi/1.5);
279 Float_t scaleKa = 684/(intETAka/2.0);
281 // Fraction of events corresponding to the selected pt-range
282 Float_t intPt = (0.877*ptPic0.Integral(0, 15)+
283 0.123*ptKac0.Integral(0, 15));
284 Float_t intPtSel = (0.877*ptPic0.Integral(fPtMin, fPtMax)+
285 0.123*ptKac0.Integral(fPtMin, fPtMax));
286 Float_t ptFrac = intPtSel/intPt;
288 // Fraction of events corresponding to the selected eta-range
289 Float_t intETASel = (scalePi*etaPic0.Integral(etaMin, etaMax)+
290 scaleKa*etaKac0.Integral(etaMin, etaMax));
291 // Fraction of events corresponding to the selected phi-range
292 Float_t phiFrac = (fPhiMax-fPhiMin)/2/TMath::Pi();
294 fParentWeight = Float_t(fNpart)/(intETASel*ptFrac*phiFrac);
296 printf("%s: The number of particles in the selected kinematic region corresponds to %f percent of a full event\n ",
297 ClassName(),100.*fParentWeight);
299 // Issue warning message if etaMin or etaMax are outside the alowed range
300 // of the parametrization
301 if (etaMin < -8.001 || etaMax > 8.001) {
302 printf("\n \n WARNING FROM AliGenHIJINGPara !");
303 printf("\n YOU ARE USING THE PARAMETERISATION OUTSIDE ");
304 printf("\n THE ALLOWED PSEUDORAPIDITY RANGE (-8. - 8.)");
305 printf("\n YOUR LIMITS: %f %f \n \n ", etaMin, etaMax);
309 if (fPi0Decays) fDecayer = new AliDecayerPythia();
313 //_____________________________________________________________________________
314 void AliGenHIJINGpara::Generate()
317 // Generate one trigger
321 const Float_t kRaKpic=0.14;
322 const Float_t kBorne=1/(1+kRaKpic);
323 Float_t polar[3]= {0,0,0};
325 const Int_t kPions[3] = {kPi0, kPiPlus, kPiMinus};
326 const Int_t kKaons[4] = {kK0Long, kK0Short, kKPlus, kKMinus};
329 Float_t pt, pl, ptot;
332 Int_t i, part, nt, j;
339 for (j=0;j<3;j++) origin[j]=fOrigin[j];
341 if(fVertexSmear == kPerEvent) {
344 while(TMath::Abs(dv[2]) > fCutVertexZ*fOsigma[2]) {
346 for (j=0; j < 3; j++) {
347 dv[j] = fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
348 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
351 for (j=0; j < 3; j++) origin[j] += dv[j];
355 eventVertex[0] = origin[0];
356 eventVertex[1] = origin[1];
357 eventVertex[2] = origin[2];
359 for(i=0;i<fNpart;i++) {
362 if(random[0]<kBorne) {
363 part=kPions[Int_t (random[1]*3)];
367 part=kKaons[Int_t (random[1]*4)];
371 phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
372 theta=2*TMath::ATan(TMath::Exp(-etaf->GetRandom()));
373 if(theta<fThetaMin || theta>fThetaMax) continue;
375 pl=pt/TMath::Tan(theta);
376 ptot=TMath::Sqrt(pt*pt+pl*pl);
377 if(ptot<fPMin || ptot>fPMax) continue;
378 p[0]=pt*TMath::Cos(phi);
379 p[1]=pt*TMath::Sin(phi);
381 if(fVertexSmear==kPerTrack) {
384 origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
385 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
388 SetTrack(fTrackIt,-1,part,p,origin,polar,0,kPPrimary,nt,fParentWeight);
390 // Decay pi0 if requested
391 if (part == kPi0 && fPi0Decays) DecayPi0(origin, p);
396 AliGenEventHeader* header = new AliGenEventHeader("HIJINGparam");
398 header->SetPrimaryVertex(eventVertex);
399 gAlice->SetGenEventHeader(header);
402 AliGenHIJINGpara& AliGenHIJINGpara::operator=(const AliGenHIJINGpara& rhs)
404 // Assignment operator
408 void AliGenHIJINGpara::SetPtRange(Float_t ptmin, Float_t ptmax) {
409 AliGenerator::SetPtRange(ptmin, ptmax);
412 void AliGenHIJINGpara::DecayPi0(Float_t* orig, Float_t * p)
416 // and put decay products on the stack
418 static TClonesArray *particles;
419 if(!particles) particles = new TClonesArray("TParticle",1000);
421 const Float_t kMass = TDatabasePDG::Instance()->GetParticle(kPi0)->Mass();
422 Float_t e = TMath::Sqrt(p[0] * p[0] + p[1] * p[1] +p[2] * p[2] * kMass * kMass);
425 TLorentzVector pmom(p[0], p[1], p[2], e);
426 fDecayer->Decay(kPi0, &pmom);
428 // Put decay particles on the stack
431 Float_t polar[3] = {0., 0., 0.};
432 Int_t np = fDecayer->ImportParticles(particles);
434 for (Int_t i = 1; i < np; i++)
436 TParticle* iParticle = (TParticle *) particles->At(1);
437 p[0]=iParticle->Px();
438 p[1]=iParticle->Py();
439 p[2]=iParticle->Pz();
440 Int_t part = iParticle->GetPdgCode();
441 SetTrack(fTrackIt, 0, part, p, orig, polar, 0, kPDecay, nt, fParentWeight);