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