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