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