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