Add possibility to disable StepManager() for each module separately.
[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$
02c16581 18Revision 1.15 2001/03/27 10:54:50 morsch
19Add ResetDecayTable() and SsetDecayTable() methods.
20
14ee1cd0 21Revision 1.14 2001/03/09 13:03:40 morsch
22Process_t and Struc_Func_t moved to AliPythia.h
23
f1a48a38 24Revision 1.13 2000/12/18 08:55:35 morsch
25Make AliPythia dependent generartors work with new scheme of random number generation
26
3356c022 27Revision 1.12 2000/11/30 07:12:50 alibrary
28Introducing new Rndm and QA classes
29
65fb704d 30Revision 1.11 2000/10/20 06:30:06 fca
31Use version 0 to avoid streamer generation
32
3be3dfc7 33Revision 1.10 2000/10/06 14:18:44 morsch
34Upper cut of prim. pT distribution set to 5. GeV
35
e8d05e6c 36Revision 1.9 2000/09/18 10:41:35 morsch
37Add possibility to use nuclear structure functions from PDF library V8.
38
811826d8 39Revision 1.8 2000/09/06 14:26:24 morsch
40Decayer functionality of AliPythia has been moved to AliDecayerPythia.
41Class is now a singleton.
42
95b811fe 43Revision 1.7 2000/06/09 20:34:50 morsch
44All coding rule violations except RS3 corrected
45
f87cfe57 46Revision 1.6 1999/11/09 07:38:48 fca
47Changes for compatibility with version 2.23 of ROOT
48
084c1b4a 49Revision 1.5 1999/11/03 17:43:20 fca
50New version from G.Martinez & A.Morsch
51
886b6f73 52Revision 1.4 1999/09/29 09:24:14 fca
53Introduction of the Copyright and cvs Log
54
4c039060 55*/
56
75c6d54e 57
fe4da5cc 58#include "AliPythia.h"
f87cfe57 59
fe4da5cc 60ClassImp(AliPythia)
61
fe4da5cc 62//_____________________________________________________________________________
63
95b811fe 64AliPythia* AliPythia::fgAliPythia=NULL;
fe4da5cc 65
75c6d54e 66AliPythia::AliPythia()
67{
95b811fe 68// Default Constructor
3356c022 69//
70// Set random number
71 if (!sRandom) sRandom=fRandom;
14ee1cd0 72
fe4da5cc 73}
74
75void AliPythia::ProcInit(Process_t process, Float_t energy, StrucFunc_t strucfunc)
76{
f87cfe57 77// Initialise the process to generate
fe4da5cc 78 fProcess = process;
79 fEcms = energy;
80 fStrucFunc = strucfunc;
81// don't decay p0
95b811fe 82 SetMDCY(Pycomp(111),1,0);
fe4da5cc 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 {
f1a48a38 97 case kPyCharm:
fe4da5cc 98 SetMSEL(4);
99//
100// heavy quark masses
101
102 SetPMAS(4,1,1.2);
103
104//
105// primordial pT
106 SetMSTP(91,1);
e8d05e6c 107 SetPARP(91,1.);
108 SetPARP(93,5.);
fe4da5cc 109//
110 break;
f1a48a38 111 case kPyBeauty:
fe4da5cc 112 SetMSEL(5);
113 SetPMAS(5,1,4.75);
114 break;
f1a48a38 115 case kPyJpsi:
fe4da5cc 116 SetMSEL(0);
117// gg->J/Psi g
118 SetMSUB(86,1);
119 break;
f1a48a38 120 case kPyJpsiChi:
fe4da5cc 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);
02c16581 130 break;
f1a48a38 131 case kPyCharmUnforced:
fe4da5cc 132 SetMSEL(0);
133// gq->qg
134 SetMSUB(28,1);
135// gg->qq
136 SetMSUB(53,1);
137// gg->gg
138 SetMSUB(68,1);
02c16581 139 break;
f1a48a38 140 case kPyBeautyUnforced:
fe4da5cc 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;
f1a48a38 149 case kPyMb:
75c6d54e 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
14ee1cd0 156 SetMSEL(0);
75c6d54e 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);
f1a48a38 171 break;
172 case kPyJets:
173 SetMSEL(1);
174 break;
175 case kPyDirectGamma:
176 SetMSEL(10);
177 break;
fe4da5cc 178 }
179//
180// Initialize PYTHIA
95b811fe 181 SetMSTP(41,1);
75c6d54e 182
95b811fe 183 Initialize("CMS","p","p",fEcms);
14ee1cd0 184
fe4da5cc 185}
186
95b811fe 187Int_t AliPythia::CheckedLuComp(Int_t kf)
fe4da5cc 188{
95b811fe 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;
fe4da5cc 193}
194
811826d8 195void 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
95b811fe 216AliPythia* AliPythia::Instance()
3356c022 217{
218// Set random number generator
95b811fe 219 if (fgAliPythia) {
220 return fgAliPythia;
221 } else {
222 fgAliPythia = new AliPythia();
223 return fgAliPythia;
fe4da5cc 224 }
fe4da5cc 225}
fe4da5cc 226
14ee1cd0 227void 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
254void 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
262void 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}
fe4da5cc 270
271
3356c022 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
282extern "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
fe4da5cc 288
289
290