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