Save pythia default decay table at first initialization. Reload at each
[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$
f1a48a38 18Revision 1.13 2000/12/18 08:55:35 morsch
19Make AliPythia dependent generartors work with new scheme of random number generation
20
3356c022 21Revision 1.12 2000/11/30 07:12:50 alibrary
22Introducing new Rndm and QA classes
23
65fb704d 24Revision 1.11 2000/10/20 06:30:06 fca
25Use version 0 to avoid streamer generation
26
3be3dfc7 27Revision 1.10 2000/10/06 14:18:44 morsch
28Upper cut of prim. pT distribution set to 5. GeV
29
e8d05e6c 30Revision 1.9 2000/09/18 10:41:35 morsch
31Add possibility to use nuclear structure functions from PDF library V8.
32
811826d8 33Revision 1.8 2000/09/06 14:26:24 morsch
34Decayer functionality of AliPythia has been moved to AliDecayerPythia.
35Class is now a singleton.
36
95b811fe 37Revision 1.7 2000/06/09 20:34:50 morsch
38All coding rule violations except RS3 corrected
39
f87cfe57 40Revision 1.6 1999/11/09 07:38:48 fca
41Changes for compatibility with version 2.23 of ROOT
42
084c1b4a 43Revision 1.5 1999/11/03 17:43:20 fca
44New version from G.Martinez & A.Morsch
45
886b6f73 46Revision 1.4 1999/09/29 09:24:14 fca
47Introduction of the Copyright and cvs Log
48
4c039060 49*/
50
75c6d54e 51
fe4da5cc 52#include "AliPythia.h"
f87cfe57 53
fe4da5cc 54ClassImp(AliPythia)
55
fe4da5cc 56//_____________________________________________________________________________
57
95b811fe 58AliPythia* AliPythia::fgAliPythia=NULL;
fe4da5cc 59
75c6d54e 60AliPythia::AliPythia()
61{
95b811fe 62// Default Constructor
3356c022 63//
64// Set random number
65 if (!sRandom) sRandom=fRandom;
fe4da5cc 66}
67
68void AliPythia::ProcInit(Process_t process, Float_t energy, StrucFunc_t strucfunc)
69{
f87cfe57 70// Initialise the process to generate
fe4da5cc 71 fProcess = process;
72 fEcms = energy;
73 fStrucFunc = strucfunc;
74// don't decay p0
95b811fe 75 SetMDCY(Pycomp(111),1,0);
fe4da5cc 76// select structure function
77 SetMSTP(52,2);
78 SetMSTP(51,strucfunc);
79//
80// Pythia initialisation for selected processes//
81//
82// Make MSEL clean
83//
84 for (Int_t i=1; i<= 200; i++) {
85 SetMSUB(i,0);
86 }
87// select charm production
88 switch (process)
89 {
f1a48a38 90 case kPyCharm:
fe4da5cc 91 SetMSEL(4);
92//
93// heavy quark masses
94
95 SetPMAS(4,1,1.2);
96
97//
98// primordial pT
99 SetMSTP(91,1);
e8d05e6c 100 SetPARP(91,1.);
101 SetPARP(93,5.);
fe4da5cc 102//
103 break;
f1a48a38 104 case kPyBeauty:
fe4da5cc 105 SetMSEL(5);
106 SetPMAS(5,1,4.75);
107 break;
f1a48a38 108 case kPyJpsi:
fe4da5cc 109 SetMSEL(0);
110// gg->J/Psi g
111 SetMSUB(86,1);
112 break;
f1a48a38 113 case kPyJpsiChi:
fe4da5cc 114 SetMSEL(0);
115// gg->J/Psi g
116 SetMSUB(86,1);
117// gg-> chi_0c g
118 SetMSUB(87,1);
119// gg-> chi_1c g
120 SetMSUB(88,1);
121// gg-> chi_2c g
122 SetMSUB(89,1);
f1a48a38 123 case kPyCharmUnforced:
fe4da5cc 124 SetMSEL(0);
125// gq->qg
126 SetMSUB(28,1);
127// gg->qq
128 SetMSUB(53,1);
129// gg->gg
130 SetMSUB(68,1);
f1a48a38 131 case kPyBeautyUnforced:
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);
139 break;
f1a48a38 140 case kPyMb:
75c6d54e 141// Minimum Bias pp-Collisions
142//
143// Tuning of parameters descibed in G. Ciapetti and A. Di Ciaccio
144// Proc. of the LHC Workshop, Aachen 1990, Vol. II p. 155
145//
146// select Pythia min. bias model
147 SetMSEL(2);
148 SetMSUB(92,1);
149 SetMSUB(93,1);
150 SetMSUB(94,1);
151 SetMSUB(95,1);
152// Multiple interactions switched on
153 SetMSTP(81,1);
154 SetMSTP(82,1);
155// Low-pT cut-off for hard scattering
156 SetPARP(81,1.9);
157// model for subsequent non-hardest interaction
158// 90% gg->gg 10% gg->qq
159 SetPARP(86,0.9);
160// 90% of gluon interactions have minimum string length
161 SetPARP(85,0.9);
f1a48a38 162 break;
163 case kPyJets:
164 SetMSEL(1);
165 break;
166 case kPyDirectGamma:
167 SetMSEL(10);
168 break;
fe4da5cc 169 }
170//
171// Initialize PYTHIA
95b811fe 172 SetMSTP(41,1);
75c6d54e 173
95b811fe 174 Initialize("CMS","p","p",fEcms);
fe4da5cc 175}
176
95b811fe 177Int_t AliPythia::CheckedLuComp(Int_t kf)
fe4da5cc 178{
95b811fe 179// Check Lund particle code (for debugging)
180 Int_t kc=Pycomp(kf);
181 printf("\n Lucomp kf,kc %d %d",kf,kc);
182 return kc;
fe4da5cc 183}
184
811826d8 185void AliPythia::SetNuclei(Int_t a1, Int_t a2)
186{
187// Treat protons as inside nuclei with mass numbers a1 and a2
188// The MSTP array in the PYPARS common block is used to enable and
189// select the nuclear structure functions.
190// MSTP(52) : (D=1) choice of proton and nuclear structure-function library
191// =1: internal PYTHIA acording to MSTP(51)
192// =2: PDFLIB proton s.f., with MSTP(51) = 1000xNGROUP+NSET
193// =3: PDFLIB proton s.f. with nuclar correction:
194// MSTP( 51) = 1000xNPGROUP+NPSET
195// MSTP(151) = 1000xNAGROUP+NASET
196// MSTP(192) : Mass number of nucleus side 1
197// MSTP(193) : Mass number of nucleus side 2
198
199 SetMSTP(52,3);
200 SetMSTP(191, 1001);
201 SetMSTP(192, a1);
202 SetMSTP(193, a2);
203}
204
205
95b811fe 206AliPythia* AliPythia::Instance()
3356c022 207{
208// Set random number generator
95b811fe 209 if (fgAliPythia) {
210 return fgAliPythia;
211 } else {
212 fgAliPythia = new AliPythia();
213 return fgAliPythia;
fe4da5cc 214 }
fe4da5cc 215}
fe4da5cc 216
217
218
3356c022 219#ifndef WIN32
220#define pyr pyr_
221#define pyrset pyrset_
222#define pyrget pyrget_
223#else
224#define pyr PYR
225#define pyrset PYRSET
226#define pyrget PYRGET
227#endif
228
229extern "C" {
230 Double_t pyr(Int_t*) {return sRandom->Rndm();}
231 void pyrset(Int_t*,Int_t*) {}
232 void pyrget(Int_t*,Int_t*) {}
233}
234
fe4da5cc 235
236
237