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