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