Place station 3 inside Dipole.
[u/mrichter/AliRoot.git] / EVGEN / AliGenHIJINGpara.cxx
CommitLineData
790bbabf 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$
9e1a0ddb 18Revision 1.5 2000/12/21 16:24:06 morsch
19Coding convention clean-up
20
675e9664 21Revision 1.4 2000/11/30 07:12:50 alibrary
22Introducing new Rndm and QA classes
23
65fb704d 24Revision 1.3 2000/10/02 21:28:06 fca
25Removal of useless dependecies via forward declarations
26
94de3818 27Revision 1.2 2000/07/11 18:24:55 fca
28Coding convention corrections + few minor bug fixes
29
aee8290b 30Revision 1.1 2000/06/09 20:20:30 morsch
31Same class as previously in AliSimpleGen.cxx
32All coding rule violations except RS3 corrected (AM)
33
790bbabf 34*/
675e9664 35
36// Parameterisation of pi and K, eta and pt distributions
37// used for the ALICE TDRs.
38// eta: according to HIJING (shadowing + quenching)
39// pT : according to CDF measurement at 1.8 TeV
40// Author: andreas.morsch@cern.ch
41
42
790bbabf 43//Begin_Html
44/*
45<img src="picts/AliGeneratorClass.gif">
46</pre>
47<br clear=left>
48<font size=+2 color=red>
49<p>The responsible person for this module is
50<a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
51</font>
52<pre>
53*/
54//End_Html
55// //
56///////////////////////////////////////////////////////////////////
57
58#include "AliGenHIJINGpara.h"
65fb704d 59#include "TF1.h"
790bbabf 60#include "AliRun.h"
61#include "AliConst.h"
62#include "AliPDG.h"
63
64ClassImp(AliGenHIJINGpara)
65
66AliGenHIJINGpara::AliGenHIJINGpara(const AliGenHIJINGpara & para)
67{
68// copy constructor
69}
70
71//_____________________________________________________________________________
72static Double_t ptpi(Double_t *px, Double_t *)
73{
74 //
75 // PT-PARAMETERIZATION CDF, PRL 61(88) 1819
76 // POWER LAW FOR PT > 500 MEV
77 // MT SCALING BELOW (T=160 MEV)
78 //
79 const Double_t kp0 = 1.3;
80 const Double_t kxn = 8.28;
81 const Double_t kxlim=0.5;
82 const Double_t kt=0.160;
83 const Double_t kxmpi=0.139;
84 const Double_t kb=1.;
85 Double_t y, y1, xmpi2, ynorm, a;
86 Double_t x=*px;
87 //
88 y1=TMath::Power(kp0/(kp0+kxlim),kxn);
89 xmpi2=kxmpi*kxmpi;
90 ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+xmpi2)/kt));
91 a=ynorm/y1;
92 if (x > kxlim)
93 y=a*TMath::Power(kp0/(kp0+x),kxn);
94 else
95 y=kb*TMath::Exp(-sqrt(x*x+xmpi2)/kt);
96 return y*x;
97}
98
99//_____________________________________________________________________________
100static Double_t ptscal(Double_t pt, Int_t np)
101{
102 // SCALING EN MASSE PAR RAPPORT A PTPI
103 // MASS PI,K,ETA,RHO,OMEGA,ETA',PHI
104 const Double_t khm[10] = {.13957,.493,.5488,.769,.7826,.958,1.02,0,0,0};
105 // VALUE MESON/PI AT 5 GEV
106 const Double_t kfmax[10]={1.,0.3,0.55,1.0,1.0,1.0,1.0,0,0,0};
107 np--;
108 Double_t f5=TMath::Power(((
109 sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3);
110 Double_t fmax2=f5/kfmax[np];
111 // PIONS
112 Double_t ptpion=100.*ptpi(&pt, (Double_t*) 0);
113 Double_t fmtscal=TMath::Power(((
114 sqrt(pt*pt+0.018215)+2.)/ (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/
115 fmax2;
116 return fmtscal*ptpion;
117}
118
119//_____________________________________________________________________________
120static Double_t ptka( Double_t *px, Double_t *)
121{
122 //
123 // pt parametrisation for k
124 //
125 return ptscal(*px,2);
126}
127
128
129//_____________________________________________________________________________
130static Double_t etapic( Double_t *py, Double_t *)
131{
132 //
133 // eta parametrisation for pi
134 //
135 const Double_t ka1 = 4913.;
136 const Double_t ka2 = 1819.;
137 const Double_t keta1 = 0.22;
138 const Double_t keta2 = 3.66;
139 const Double_t kdeta1 = 1.47;
140 const Double_t kdeta2 = 1.51;
141 Double_t y=TMath::Abs(*py);
142 //
143 Double_t ex1 = (y-keta1)*(y-keta1)/(2*kdeta1*kdeta1);
144 Double_t ex2 = (y-keta2)*(y-keta2)/(2*kdeta2*kdeta2);
145 return ka1*TMath::Exp(-ex1)+ka2*TMath::Exp(-ex2);
146}
147
148//_____________________________________________________________________________
149static Double_t etakac( Double_t *py, Double_t *)
150{
151 //
152 // eta parametrisation for ka
153 //
154 const Double_t ka1 = 497.6;
155 const Double_t ka2 = 215.6;
156 const Double_t keta1 = 0.79;
157 const Double_t keta2 = 4.09;
158 const Double_t kdeta1 = 1.54;
159 const Double_t kdeta2 = 1.40;
160 Double_t y=TMath::Abs(*py);
161 //
162 Double_t ex1 = (y-keta1)*(y-keta1)/(2*kdeta1*kdeta1);
163 Double_t ex2 = (y-keta2)*(y-keta2)/(2*kdeta2*kdeta2);
164 return ka1*TMath::Exp(-ex1)+ka2*TMath::Exp(-ex2);
165}
166
167//_____________________________________________________________________________
168AliGenHIJINGpara::AliGenHIJINGpara()
169 :AliGenerator()
170{
171 //
172 // Default constructor
173 //
174 fPtpi = 0;
175 fPtka = 0;
176 fETApic = 0;
177 fETAkac = 0;
178}
179
180//_____________________________________________________________________________
181AliGenHIJINGpara::AliGenHIJINGpara(Int_t npart)
182 :AliGenerator(npart)
183{
184 //
185 // Standard constructor
186 //
187 fName="HIGINGpara";
188 fTitle="HIJING Parametrisation Particle Generator";
189 fPtpi = 0;
190 fPtka = 0;
191 fETApic = 0;
192 fETAkac = 0;
193}
194
195//_____________________________________________________________________________
196AliGenHIJINGpara::~AliGenHIJINGpara()
197{
198 //
199 // Standard destructor
200 //
201 delete fPtpi;
202 delete fPtka;
203 delete fETApic;
204 delete fETAkac;
205}
206
207//_____________________________________________________________________________
208void AliGenHIJINGpara::Init()
209{
210 //
211 // Initialise the HIJING parametrisation
212 //
213 Float_t etaMin =-TMath::Log(TMath::Tan(
214 TMath::Min((Double_t)fThetaMax/2,TMath::Pi()/2-1.e-10)));
215 Float_t etaMax = -TMath::Log(TMath::Tan(
216 TMath::Max((Double_t)fThetaMin/2,1.e-10)));
217 fPtpi = new TF1("ptpi",&ptpi,0,20,0);
218 fPtka = new TF1("ptka",&ptka,0,20,0);
219 fETApic = new TF1("etapic",&etapic,etaMin,etaMax,0);
220 fETAkac = new TF1("etakac",&etakac,etaMin,etaMax,0);
221 TF1 *etaPic0 = new TF1("etapic",&etapic,-7,7,0);
222 TF1 *etaKac0 = new TF1("etakac",&etakac,-7,7,0);
223 Float_t intETApi = etaPic0->Integral(-0.5, 0.5);
224 Float_t intETAka = etaKac0->Integral(-0.5, 0.5);
225 Float_t scalePi=7316/(intETApi/1.5);
226 Float_t scaleKa= 684/(intETAka/2.0);
227
228 Float_t intPt = (0.877*etaPic0->Integral(0, 15)+
229 0.123*etaKac0->Integral(0, 15));
230 Float_t intPtSel = (0.877*etaPic0->Integral(fPtMin, fPtMax)+
231 0.123*etaKac0->Integral(fPtMin, fPtMax));
232 Float_t ptFrac = intPtSel/intPt;
233
234
235 Float_t intETASel = (scalePi*etaPic0->Integral(etaMin, etaMax)+
236 scaleKa*etaKac0->Integral(etaMin, etaMax));
237 Float_t phiFrac = (fPhiMax-fPhiMin)/2/TMath::Pi();
238 fParentWeight = Float_t(fNpart)/intETASel*ptFrac*phiFrac;
239
9e1a0ddb 240 printf("%s: The number of particles in the selected kinematic region corresponds to %f percent of a full event\n ",
241 ClassName(),100.*fParentWeight);
790bbabf 242
243}
244
245//_____________________________________________________________________________
246void AliGenHIJINGpara::Generate()
247{
248 //
249 // Generate one trigger
250 //
251
252
253 const Float_t kRaKpic=0.14;
254 const Float_t kBorne=1/(1+kRaKpic);
255 Float_t polar[3]= {0,0,0};
256 //
257 const Int_t kPions[3] = {kPi0, kPiPlus, kPiMinus};
258 const Int_t kKaons[4] = {kK0Long, kK0Short, kKPlus, kKMinus};
259 //
260 Float_t origin[3];
261 Float_t pt, pl, ptot;
262 Float_t phi, theta;
263 Float_t p[3];
264 Int_t i, part, nt, j;
265 //
266 TF1 *ptf;
267 TF1 *etaf;
268 //
269 Float_t random[6];
270 //
271 for (j=0;j<3;j++) origin[j]=fOrigin[j];
aee8290b 272 if(fVertexSmear==kPerEvent) {
65fb704d 273 Rndm(random,6);
790bbabf 274 for (j=0;j<3;j++) {
275 origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
276 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
277 }
278 }
279 for(i=0;i<fNpart;i++) {
280 while(1) {
65fb704d 281 Rndm(random,3);
790bbabf 282 if(random[0]<kBorne) {
283 part=kPions[Int_t (random[1]*3)];
284 ptf=fPtpi;
285 etaf=fETApic;
286 } else {
287 part=kKaons[Int_t (random[1]*4)];
288 ptf=fPtka;
289 etaf=fETAkac;
290 }
291 phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
292 theta=2*TMath::ATan(TMath::Exp(-etaf->GetRandom()));
293 if(theta<fThetaMin || theta>fThetaMax) continue;
294 pt=ptf->GetRandom();
295 pl=pt/TMath::Tan(theta);
296 ptot=TMath::Sqrt(pt*pt+pl*pl);
297 if(ptot<fPMin || ptot>fPMax) continue;
298 p[0]=pt*TMath::Cos(phi);
299 p[1]=pt*TMath::Sin(phi);
300 p[2]=pl;
aee8290b 301 if(fVertexSmear==kPerTrack) {
65fb704d 302 Rndm(random,6);
790bbabf 303 for (j=0;j<3;j++) {
304 origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
305 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
306 }
307 }
65fb704d 308 gAlice->SetTrack(fTrackIt,-1,part,p,origin,polar,0,kPPrimary,nt,fParentWeight);
790bbabf 309 break;
310 }
311 }
312}
313
314AliGenHIJINGpara& AliGenHIJINGpara::operator=(const AliGenHIJINGpara& rhs)
315{
316// Assignment operator
317 return *this;
318}
319
320