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