]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVGEN/AliPythia.cxx
Fully commented version by Bruno Espagnon.
[u/mrichter/AliRoot.git] / EVGEN / AliPythia.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.15  2001/03/27 10:54:50  morsch
19 Add ResetDecayTable() and SsetDecayTable() methods.
20
21 Revision 1.14  2001/03/09 13:03:40  morsch
22 Process_t and Struc_Func_t moved to AliPythia.h
23
24 Revision 1.13  2000/12/18 08:55:35  morsch
25 Make AliPythia dependent generartors work with new scheme of random number generation
26
27 Revision 1.12  2000/11/30 07:12:50  alibrary
28 Introducing new Rndm and QA classes
29
30 Revision 1.11  2000/10/20 06:30:06  fca
31 Use version 0 to avoid streamer generation
32
33 Revision 1.10  2000/10/06 14:18:44  morsch
34 Upper cut of prim. pT distribution set to 5. GeV
35
36 Revision 1.9  2000/09/18 10:41:35  morsch
37 Add possibility to use nuclear structure functions from PDF library V8.
38
39 Revision 1.8  2000/09/06 14:26:24  morsch
40 Decayer functionality of AliPythia has been moved to AliDecayerPythia.
41 Class is now a singleton.
42
43 Revision 1.7  2000/06/09 20:34:50  morsch
44 All coding rule violations except RS3 corrected
45
46 Revision 1.6  1999/11/09 07:38:48  fca
47 Changes for compatibility with version 2.23 of ROOT
48
49 Revision 1.5  1999/11/03 17:43:20  fca
50 New version from G.Martinez & A.Morsch
51
52 Revision 1.4  1999/09/29 09:24:14  fca
53 Introduction of the Copyright and cvs Log
54
55 */
56
57
58 #include "AliPythia.h"
59
60 ClassImp(AliPythia)
61
62 //_____________________________________________________________________________
63
64 AliPythia* AliPythia::fgAliPythia=NULL;
65
66 AliPythia::AliPythia()
67 {
68 // Default Constructor
69 //
70 //  Set random number
71     if (!sRandom) sRandom=fRandom;
72
73 }
74
75 void AliPythia::ProcInit(Process_t process, Float_t energy, StrucFunc_t strucfunc)
76 {
77 // Initialise the process to generate 
78     fProcess = process;
79     fEcms = energy;
80     fStrucFunc = strucfunc;
81 //  don't decay p0
82     SetMDCY(Pycomp(111),1,0);
83 //  select structure function 
84     SetMSTP(52,2);
85     SetMSTP(51,strucfunc);
86 //
87 // Pythia initialisation for selected processes//
88 //
89 // Make MSEL clean
90 //
91     for (Int_t i=1; i<= 200; i++) {
92         SetMSUB(i,0);
93     }
94 //  select charm production
95     switch (process) 
96     {
97     case kPyCharm:
98         SetMSEL(4);
99 //
100 //  heavy quark masses
101
102         SetPMAS(4,1,1.2);
103
104 //
105 //    primordial pT
106         SetMSTP(91,1);
107         SetPARP(91,1.);
108         SetPARP(93,5.);
109 //
110         break;
111     case kPyBeauty:
112         SetMSEL(5);
113         SetPMAS(5,1,4.75);
114         break;
115     case kPyJpsi:
116         SetMSEL(0);
117 // gg->J/Psi g
118         SetMSUB(86,1);
119         break;
120     case kPyJpsiChi:
121         SetMSEL(0);
122 // gg->J/Psi g
123         SetMSUB(86,1);
124 // gg-> chi_0c g
125         SetMSUB(87,1);
126 // gg-> chi_1c g
127         SetMSUB(88,1);
128 // gg-> chi_2c g
129         SetMSUB(89,1);  
130         break;
131     case kPyCharmUnforced:
132         SetMSEL(0);
133 // gq->qg   
134         SetMSUB(28,1);
135 // gg->qq
136         SetMSUB(53,1);
137 // gg->gg
138         SetMSUB(68,1);
139         break;
140     case kPyBeautyUnforced:
141         SetMSEL(0);
142 // gq->qg   
143         SetMSUB(28,1);
144 // gg->qq
145         SetMSUB(53,1);
146 // gg->gg
147         SetMSUB(68,1);
148         break;
149     case kPyMb:
150 // Minimum Bias pp-Collisions
151 //
152 // Tuning of parameters descibed in G. Ciapetti and A. Di Ciaccio
153 // Proc. of the LHC Workshop, Aachen 1990, Vol. II p. 155
154 //   
155 //      select Pythia min. bias model
156         SetMSEL(0);
157         SetMSUB(92,1);
158         SetMSUB(93,1);
159         SetMSUB(94,1);
160         SetMSUB(95,1);  
161 //      Multiple interactions switched on
162         SetMSTP(81,1);
163         SetMSTP(82,1);
164 //      Low-pT cut-off for hard scattering
165         SetPARP(81,1.9);
166 //      model for subsequent non-hardest interaction
167 //      90% gg->gg 10% gg->qq
168         SetPARP(86,0.9);
169 //      90% of gluon interactions have minimum string length
170         SetPARP(85,0.9);
171         break;
172     case kPyJets:
173         SetMSEL(1);
174         break;
175     case kPyDirectGamma:
176         SetMSEL(10);
177         break;
178     }
179 //
180 //  Initialize PYTHIA
181     SetMSTP(41,1);
182
183     Initialize("CMS","p","p",fEcms);
184
185 }
186
187 Int_t AliPythia::CheckedLuComp(Int_t kf)
188 {
189 // Check Lund particle code (for debugging)
190     Int_t kc=Pycomp(kf);
191     printf("\n Lucomp kf,kc %d %d",kf,kc);
192     return kc;
193 }
194
195 void AliPythia::SetNuclei(Int_t a1, Int_t a2)
196 {
197 // Treat protons as inside nuclei with mass numbers a1 and a2  
198 //    The MSTP array in the PYPARS common block is used to enable and 
199 //    select the nuclear structure functions. 
200 //    MSTP(52)  : (D=1) choice of proton and nuclear structure-function library
201 //            =1: internal PYTHIA acording to MSTP(51) 
202 //            =2: PDFLIB proton  s.f., with MSTP(51)  = 1000xNGROUP+NSET
203 //            =3: PDFLIB proton  s.f. with nuclar correction:
204 //                MSTP( 51)  = 1000xNPGROUP+NPSET
205 //                MSTP(151)  = 1000xNAGROUP+NASET
206 //    MSTP(192) : Mass number of nucleus side 1
207 //    MSTP(193) : Mass number of nucleus side 2
208
209     SetMSTP(52,3);
210     SetMSTP(191, 1001);
211     SetMSTP(192, a1);
212     SetMSTP(193, a2);  
213 }
214         
215
216 AliPythia* AliPythia::Instance()
217
218 // Set random number generator 
219     if (fgAliPythia) {
220         return fgAliPythia;
221     } else {
222         fgAliPythia = new AliPythia();
223         return fgAliPythia;
224     }
225 }
226
227 void AliPythia::PrintParticles()
228
229 // Print list of particl properties
230     Int_t np = 0;
231     
232     for (Int_t kf=0; kf<1000000; kf++) {
233         for (Int_t c = 1;  c > -2; c-=2) {
234             
235             Int_t kc = Pycomp(c*kf);
236             if (kc) {
237                 Float_t mass  = GetPMAS(kc,1);
238                 Float_t width = GetPMAS(kc,2);  
239                 Float_t tau   = GetPMAS(kc,4);
240                 
241                 char*   name = new char[8];
242                 Pyname(kf,name);
243         
244                 np++;
245                 
246                 printf("\n mass, width, tau: %6d %s %10.3f %10.3e %10.3e", 
247                        c*kf, name, mass, width, tau);
248             }
249         }
250     }
251     printf("\n Number of particles %d \n \n", np);
252 }
253
254 void  AliPythia::ResetDecayTable()
255 {
256 //  Set default values for pythia decay switches
257     Int_t i;
258     for (i = 1; i <  501; i++) SetMDCY(i,1,fDefMDCY[i]);
259     for (i = 1; i < 2001; i++) SetMDME(i,1,fDefMDME[i]);
260 }
261
262 void  AliPythia::SetDecayTable()
263 {
264 //  Set default values for pythia decay switches
265 //
266     Int_t i;
267     for (i = 1; i <  501; i++) fDefMDCY[i] = GetMDCY(i,1);
268     for (i = 1; i < 2001; i++) fDefMDME[i] = GetMDME(i,1);
269 }
270
271
272 #ifndef WIN32
273 #define pyr    pyr_
274 #define pyrset pyrset_
275 #define pyrget pyrget_
276 #else
277 #define pyr    PYR
278 #define pyrset PYRSET
279 #define pyrget PYRGET
280 #endif
281
282 extern "C" {
283   Double_t pyr(Int_t*) {return sRandom->Rndm();}
284   void pyrset(Int_t*,Int_t*) {}
285   void pyrget(Int_t*,Int_t*) {}
286 }
287
288
289
290