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