Add const to SolenoidField() method for correct overwriting from the parent class
[u/mrichter/AliRoot.git] / EVGEN / AliGenHIJINGparaBa.cxx
CommitLineData
388f2c07 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$
18*/
19///////////////////////////////////////////////////////////////////
20// Parameterisation of pi, K, n and p eta and pt distributions //
21// eta: according to HIJING (shadowing + quenching) //
22// pT : according to CDF measurement at 1.8 TeV //
23// Author: andreas.morsch@cern.ch //
24// //
25///////////////////////////////////////////////////////////////////
26
27#include "AliGenHIJINGparaBa.h"
28#include "AliGenEventHeader.h"
29#include "AliRun.h"
30#include "AliConst.h"
31#include "AliPDG.h"
32
33#include <TF1.h>
34#include <TArrayF.h>
35
36ClassImp(AliGenHIJINGparaBa)
37
38
39static Double_t ptpi(Double_t *px, Double_t *)
40{
41 //
42 // PT-PARAMETERIZATION CDF, PRL 61(88) 1819
43 // POWER LAW FOR PT > 500 MEV
44 // MT SCALING BELOW (T=160 MEV)
45 //
46 const Double_t kp0 = 1.3;
47 const Double_t kxn = 8.28;
48 const Double_t kxlim=0.5;
49 const Double_t kt=0.160;
50 const Double_t kxmpi=0.139;
51 const Double_t kb=1.;
52 Double_t y, y1, xmpi2, ynorm, a;
53 Double_t x=*px;
54 //
55 y1=TMath::Power(kp0/(kp0+kxlim),kxn);
56 xmpi2=kxmpi*kxmpi;
57 ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+xmpi2)/kt));
58 a=ynorm/y1;
59 if (x > kxlim)
60 y=a*TMath::Power(kp0/(kp0+x),kxn);
61 else
62 y=kb*TMath::Exp(-sqrt(x*x+xmpi2)/kt);
63 return y*x;
64}
65
66//_____________________________________________________________________________
67static Double_t ptscal(Double_t pt, Int_t np)
68{
69 // SCALING EN MASSE PAR RAPPORT A PTPI
70 // MASS PI,K,ETA,RHO,OMEGA,ETA',PHI
71 const Double_t khm[10] = {.13957,.493,.5488,.769,.7826,.958,1.02,0,0,0};
72 // VALUE MESON/PI AT 5 GEV
73 const Double_t kfmax[10]={1.,0.3,0.55,1.0,1.0,1.0,1.0,0,0,0};
74 np--;
75 Double_t f5=TMath::Power(((
76 sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3);
77 Double_t fmax2=f5/kfmax[np];
78 // PIONS
79 Double_t ptpion=100.*ptpi(&pt, (Double_t*) 0);
80 Double_t fmtscal=TMath::Power(((
81 sqrt(pt*pt+0.018215)+2.)/ (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/
82 fmax2;
83 return fmtscal*ptpion;
84}
85
86//_____________________________________________________________________________
87static Double_t ptka( Double_t *px, Double_t *)
88{
89 //
90 // pt parametrisation for k
91 //
92 return ptscal(*px,2);
93}
94
95
96//_____________________________________________________________________________
97static Double_t etapic( Double_t *py, Double_t *)
98{
99 //
100 // eta parametrisation for pi
101 //
102 const Double_t ka1 = 4913.;
103 const Double_t ka2 = 1819.;
104 const Double_t keta1 = 0.22;
105 const Double_t keta2 = 3.66;
106 const Double_t kdeta1 = 1.47;
107 const Double_t kdeta2 = 1.51;
108 Double_t y=TMath::Abs(*py);
109 //
110 Double_t ex1 = (y-keta1)*(y-keta1)/(2*kdeta1*kdeta1);
111 Double_t ex2 = (y-keta2)*(y-keta2)/(2*kdeta2*kdeta2);
112 return ka1*TMath::Exp(-ex1)+ka2*TMath::Exp(-ex2);
113}
114
115//_____________________________________________________________________________
116static Double_t etakac( Double_t *py, Double_t *)
117{
118 //
119 // eta parametrisation for ka
120 //
121 const Double_t ka1 = 497.6;
122 const Double_t ka2 = 215.6;
123 const Double_t keta1 = 0.79;
124 const Double_t keta2 = 4.09;
125 const Double_t kdeta1 = 1.54;
126 const Double_t kdeta2 = 1.40;
127 Double_t y=TMath::Abs(*py);
128 //
129 Double_t ex1 = (y-keta1)*(y-keta1)/(2*kdeta1*kdeta1);
130 Double_t ex2 = (y-keta2)*(y-keta2)/(2*kdeta2*kdeta2);
131 return ka1*TMath::Exp(-ex1)+ka2*TMath::Exp(-ex2);
132}
133
134 static Double_t ptbaryon( Double_t *px, Double_t *)
135{
136// baryons
137// pt-distribution
138//____________________________________________________________
139
140 return ptscal(*px,7); // 7==> Baryon in the PtScal function
141}
142
143 static Double_t etabaryon( Double_t *py, Double_t *)
144{
145// eta-distribution
146//____________________________________________________________
147 const Float_t p0 = 1.10343e+02;
148 const Float_t p1 = 1.73247e+01;
149 const Float_t p2 = -7.23808e+00;
150 const Float_t p3 = 4.48334e-01;
151 const Double_t y = TMath::Abs(*py);
152//
153 return (p0+p1*y+p2*y*y+p3*y*y*y)/20.;
154}
155
156AliGenHIJINGparaBa::AliGenHIJINGparaBa()
157 :AliGenHIJINGpara()
158{
159 //
160 // Default constructor
161 //
162 fName="HIGINGparaBa";
163 fTitle="HIJING Parametrisation Particle Generator with Baryons";
164 fETAba = 0;
165 fPtba = 0;
166}
167
168//_____________________________________________________________________________
169AliGenHIJINGparaBa::AliGenHIJINGparaBa(Int_t npart)
170 :AliGenHIJINGpara(npart)
171{
172 //
173 // Standard constructor
174 //
175 fName="HIGINGparaBa";
176 fTitle="HIJING Parametrisation Particle Generator with Baryons";
177 fETAba = 0;
178 fPtba = 0;
179}
180
181//_____________________________________________________________________________
182AliGenHIJINGparaBa::~AliGenHIJINGparaBa()
183{
184 //
185 // Standard destructor
186 //
187 delete fPtba;
188 delete fETAba;
189}
190
191//_____________________________________________________________________________
192void AliGenHIJINGparaBa::Init()
193{
194 //
195 // Initialise the HIJING parametrisation
196 //
197 Float_t etaMin =-TMath::Log(TMath::Tan(
198 TMath::Min((Double_t)fThetaMax/2,TMath::Pi()/2-1.e-10)));
199 Float_t etaMax = -TMath::Log(TMath::Tan(
200 TMath::Max((Double_t)fThetaMin/2,1.e-10)));
201 fPtpi = new TF1("ptpi",&ptpi,0,20,0);
202 fPtka = new TF1("ptka",&ptka,0,20,0);
203 fPtba = new TF1("ptbaryon",&ptbaryon,0,20,0);
204 fETApic = new TF1("etapic",&etapic,etaMin,etaMax,0);
205 fETAkac = new TF1("etakac",&etakac,etaMin,etaMax,0);
206 fETAba = new TF1("etabaryon",&etabaryon,etaMin,etaMax,0);
207
208 TF1 *etaPic0 = new TF1("etapic",&etapic, -7, 7, 0);
209 TF1 *etaKac0 = new TF1("etakac",&etakac, -7, 7, 0);
210 TF1 *etaBar0 = new TF1("etabar",&etabaryon, -7, 7, 0);
211
212 TF1 *ptPic0 = new TF1("ptpi", &ptpi, 0., 15., 0);
213 TF1 *ptKac0 = new TF1("ptka", &ptka, 0., 15., 0);
214 TF1 *ptBar0 = new TF1("ptbar", &ptbaryon, 0., 15., 0);
215
216 Float_t intETApi = etaPic0->Integral(-0.5, 0.5);
217 Float_t intETAka = etaKac0->Integral(-0.5, 0.5);
218 Float_t intETAba = etaBar0->Integral(-0.5, 0.5);
219
220 Float_t scalePi = 6979./(intETApi/1.5);
221 Float_t scaleKa = 657./(intETAka/2.0);
222 Float_t scaleBa = 364./(intETAba/2.0);
223
224// Fraction of events corresponding to the selected pt-range
225 Float_t intPt = (0.837*ptPic0->Integral(0, 15)+
226 0.105*ptKac0->Integral(0, 15)+
227 0.058*ptBar0->Integral(0, 15));
228 Float_t intPtSel = (0.837*ptPic0->Integral(fPtMin, fPtMax)+
229 0.105*ptKac0->Integral(fPtMin, fPtMax)+
230 0.058*ptBar0->Integral(fPtMin, fPtMax));
231 Float_t ptFrac = intPtSel/intPt;
232
233// Fraction of events corresponding to the selected eta-range
234 Float_t intETASel = (scalePi*etaPic0->Integral(etaMin, etaMax)+
235 scaleKa*etaKac0->Integral(etaMin, etaMax)+
236 scaleBa*etaBar0->Integral(etaMin, etaMax));
237// Fraction of events corresponding to the selected phi-range
238 Float_t phiFrac = (fPhiMax-fPhiMin)/2/TMath::Pi();
239
240 fParentWeight = Float_t(fNpart)/(intETASel*ptFrac*phiFrac);
241
242 printf("%s: The number of particles in the selected kinematic region corresponds to %f percent of a full event \n",
243 ClassName(),100.*fParentWeight);
244
245// Issue warning message if etaMin or etaMax are outside the alowed range
246// of the parametrization
247 if (etaMin < -8.001 || etaMax > 8.001) {
248 printf("\n \n WARNING FROM AliGenHIJINGParaBa !");
249 printf("\n YOU ARE USING THE PARAMETERISATION OUTSIDE ");
250 printf("\n THE ALLOWED PSEUDORAPIDITY RANGE (-8. - 8.)");
251 printf("\n YOUR LIMITS: %f %f \n \n ", etaMin, etaMax);
252 }
253}
254
255//_____________________________________________________________________________
256void AliGenHIJINGparaBa::Generate()
257{
258 //
259 // Generate one trigger
260 //
261
262
263 const Float_t kBorne1 = 0.837;
264 const Float_t kBorne2 = kBorne1+0.105;
265
266 Float_t polar[3]= {0,0,0};
267 //
268 const Int_t kPions[3] = {kPi0, kPiPlus, kPiMinus};
269 const Int_t kKaons[4] = {kK0Long, kK0Short, kKPlus, kKMinus};
270 const Int_t kBaryons[4] = {kProton, kProtonBar, kNeutron, kNeutronBar};
271 //
272 Float_t origin[3];
273 Float_t pt, pl, ptot;
274 Float_t phi, theta;
275 Float_t p[3];
276 Int_t i, part, nt, j;
277 //
278 TF1 *ptf;
279 TF1 *etaf;
280 //
281 Float_t random[6];
282 //
283 for (j=0;j<3;j++) origin[j]=fOrigin[j];
284
285 if(fVertexSmear == kPerEvent) {
286 Float_t dv[3];
287 dv[2] = 1.e10;
288 while(TMath::Abs(dv[2]) > fCutVertexZ*fOsigma[2]) {
289 Rndm(random,6);
290 for (j=0; j < 3; j++) {
291 dv[j] = fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
292 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
293 }
294 }
295 for (j=0; j < 3; j++) origin[j] += dv[j];
296 } // if kPerEvent
297 TArrayF eventVertex;
298 eventVertex.Set(3);
299 eventVertex[0] = origin[0];
300 eventVertex[1] = origin[1];
301 eventVertex[2] = origin[2];
302
303 for(i=0;i<fNpart;i++) {
304 while(1) {
305 Rndm(random,3);
306 if(random[0] < kBorne1) {
307 part = kPions[Int_t (random[1]*3)];
308 ptf = fPtpi;
309 etaf = fETApic;
310 } else if (random[0] < kBorne2) {
311 part = kKaons[Int_t (random[1]*4)];
312 ptf = fPtka;
313 etaf = fETAkac;
314 } else {
315 part = kBaryons[Int_t (random[1]*4)];
316 ptf = fPtba;
317 etaf = fETAba;
318 }
319
320 phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
321 theta=2*TMath::ATan(TMath::Exp(-etaf->GetRandom()));
322 if(theta<fThetaMin || theta>fThetaMax) continue;
323 pt=ptf->GetRandom();
324 pl=pt/TMath::Tan(theta);
325 ptot=TMath::Sqrt(pt*pt+pl*pl);
326 if(ptot<fPMin || ptot>fPMax) continue;
327 p[0]=pt*TMath::Cos(phi);
328 p[1]=pt*TMath::Sin(phi);
329 p[2]=pl;
330 if(fVertexSmear==kPerTrack) {
331 Rndm(random,6);
332 for (j=0;j<3;j++) {
333 origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
334 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
335 }
336 }
337 SetTrack(fTrackIt,-1,part,p,origin,polar,0,kPPrimary,nt,fParentWeight);
338 break;
339 } // while(1)
340 } // Particle loop
341// Header
342 AliGenEventHeader* header = new AliGenEventHeader("HIJINGparam");
343// Event Vertex
344 header->SetPrimaryVertex(eventVertex);
345 gAlice->SetGenEventHeader(header);
346}
347
348
349