Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Pythia6.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: Pythia6.cc,v 1.3 2014/11/14 23:26:26 mccumber Exp $
27 //
30 
31 // ----------------------------------------------------------------------------
32 // According to TPythia6 class from Root:
33 // (The TPythia6 class is an interface class to F77 routines in Pythia6 //
34 // CERNLIB event generators, written by T.Sjostrand.)
35 // http://root.cern.ch/
36 // see http://root.cern.ch/root/License.html
37 //
38 // The complete Pythia6 documentation can be found at:
39 // http://home.thep.lu.se/~torbjorn/pythiaaux/recent.html
40 // ----------------------------------------------------------------------------
41 
42 // ******************************************************************************
43 // ******************************************************************************
44 // ** **
45 // ** **
46 // ** *......* Welcome to the Lund Monte Carlo! **
47 // ** *:::!!:::::::::::* **
48 // ** *::::::!!::::::::::::::* PPP Y Y TTTTT H H III A **
49 // ** *::::::::!!::::::::::::::::* P P Y Y T H H I A A **
50 // ** *:::::::::!!:::::::::::::::::* PPP Y T HHHHH I AAAAA **
51 // ** *:::::::::!!:::::::::::::::::* P Y T H H I A A **
52 // ** *::::::::!!::::::::::::::::*! P Y T H H III A A **
53 // ** *::::::!!::::::::::::::* !! **
54 // ** !! *:::!!:::::::::::* !! This is PYTHIA version 6.418 **
55 // ** !! !* -><- * !! Last date of change: 9 Jun 2008 **
56 // ** !! !! !! **
57 // ** !! !! !! Now is 0 Jan 2000 at 0:00:00 **
58 // ** !! !! **
59 // ** !! lh !! Disclaimer: this program comes **
60 // ** !! !! without any guarantees. Beware **
61 // ** !! hh !! of errors and use common sense **
62 // ** !! ll !! when interpreting results. **
63 // ** !! !! **
64 // ** !! Copyright T. Sjostrand (2008) **
65 // ** **
66 // ** An archive of program versions and documentation is found on the web: **
67 // ** http://www.thep.lu.se/~torbjorn/Pythia.html **
68 // ** **
69 // ** When you cite this program, the official reference is to the 6.4 manual: **
70 // ** T. Sjostrand, S. Mrenna and P. Skands, JHEP05 (2006) 026 **
71 // ** (LU TP 06-13, FERMILAB-PUB-06-052-CD-T) [hep-ph/0603175]. **
72 // ** **
73 // ** Also remember that the program, to a large extent, represents original **
74 // ** physics research. Other publications of special relevance to your **
75 // ** studies may therefore deserve separate mention. **
76 // ** **
77 // ** Main author: Torbjorn Sjostrand; Department of Theoretical Physics, **
78 // ** Lund University, Solvegatan 14A, S-223 62 Lund, Sweden; **
79 // ** phone: + 46 - 46 - 222 48 16; e-mail: torbjorn@thep.lu.se **
80 // ** Author: Stephen Mrenna; Computing Division, GDS Group, **
81 // ** Fermi National Accelerator Laboratory, MS 234, Batavia, IL 60510, USA; **
82 // ** phone: + 1 - 630 - 840 - 2556; e-mail: mrenna@fnal.gov **
83 // ** Author: Peter Skands; Theoretical Physics Department, **
84 // ** Fermi National Accelerator Laboratory, MS 106, Batavia, IL 60510, USA; **
85 // ** and CERN/PH, CH-1211 Geneva, Switzerland; **
86 // ** phone: + 41 - 22 - 767 24 59; e-mail: skands@fnal.gov **
87 // ** **
88 // ** **
89 // ******************************************************************************
90 
91 #include "Pythia6.hh"
92 
93 #include <iostream>
94 #include <cstdlib>
95 #include <cstring>
96 
97 #ifndef WIN32
98 # define pycomp pycomp_
99 # define py1ent py1ent_
100 # define type_of_call
101 #else
102 # define pycomp PYCOMP
103 # define py1ent PY1ENT
104 # define type_of_call _stdcall
105 #endif
106 
107 extern "C" {
108  int type_of_call pycomp(int *kf);
109  void type_of_call py1ent(int&, int&, double&, double&, double&);
110  void* pythia6_common_address(const char*);
111 }
112 
113 Pythia6* Pythia6::fgInstance = 0;
114 
115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
116 
118 {
120 
121  if ( ! fgInstance ) fgInstance = new Pythia6();
122 
123  return fgInstance;
124 }
125 
126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
127 
129  : fParticles(0),
130  fPyjets(0),
131  fPydat1(0),
132  fPydat3(0)
133 {
137 
138  // Protect against multiple objects. All access should be via the
139  // Instance member function.
140  if ( fgInstance ) {
141  std::cerr << "There's already an instance of Pythia6" << std::endl;
142  exit (1);
143  }
144 
145  fParticles = new ParticleVector();
146 
147  // initialize common-blocks
148  fPyjets = static_cast<Pyjets_t*> (pythia6_common_address("PYJETS"));
149  fPydat1 = static_cast<Pydat1_t*> (pythia6_common_address("PYDAT1"));
150  fPydat3 = static_cast<Pydat3_t*> (pythia6_common_address("PYDAT3"));
151 
152  // turn off Pythia Logo print
153  fPydat1->MSTU[12-1] = 12345;
154 }
155 
156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
157 
159 {
162 
163  if ( fParticles ) {
164  ParticleVector::const_iterator it;
165  for ( it = fParticles->begin(); it != fParticles->end(); ++it )
166  delete *it;
167  delete fParticles;
168  }
169 }
170 
171 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
172 
173 int Pythia6::Pycomp(int kf)
174 {
176 
177  return pycomp(&kf);
178 }
179 
180 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
181 
182 void Pythia6::Py1ent(int ip, int kf, double pe, double theta, double phi)
183 {
201 
202  py1ent(ip, kf, pe, theta, phi);
203 }
204 
205 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
206 
207 int Pythia6::ImportParticles(ParticleVector* particles, const char* option)
208 {
218 
219  if ( particles == 0 ) return 0;
220 
221  ParticleVector::const_iterator it;
222  for ( it = particles->begin(); it != particles->end(); ++it )
223  delete *it;
224  particles->clear();
225 
226  int numpart = fPyjets->N;
227  int nparts=0;
228  if (!strcmp(option,"") || !strcmp(option,"Final")) {
229  for (int i = 0; i<numpart; i++) {
230 
231  if (fPyjets->K[0][i] == 1) {
232  //
233  // Use the common block values for the TParticle constructor
234  //
235  particles->push_back(
236  new Pythia6Particle(
237  fPyjets->K[0][i] ,
238  fPyjets->K[1][i] ,
239  fPyjets->K[2][i] ,
240  fPyjets->K[3][i] ,
241  fPyjets->K[4][i] ,
242  fPyjets->P[0][i] ,
243  fPyjets->P[1][i] ,
244  fPyjets->P[2][i] ,
245  fPyjets->P[3][i] ,
246  fPyjets->P[4][i] ,
247  fPyjets->V[0][i] ,
248  fPyjets->V[1][i] ,
249  fPyjets->V[2][i] ,
250  fPyjets->V[3][i] ,
251  fPyjets->V[4][i]));
252 
253  // if(gDebug) printf("%d %d %d! ",i,fPyjets->K[1][i],numpart);
254  nparts++;
255  }
256  }
257  }
258  else if (!strcmp(option,"All")) {
259  for (int i = 0; i<numpart; i++) {
260  particles->push_back(
261  new Pythia6Particle(
262  fPyjets->K[0][i] ,
263  fPyjets->K[1][i] ,
264  fPyjets->K[2][i] ,
265  fPyjets->K[3][i] ,
266  fPyjets->K[4][i] ,
267  fPyjets->P[0][i] ,
268  fPyjets->P[1][i] ,
269  fPyjets->P[2][i] ,
270  fPyjets->P[3][i] ,
271  fPyjets->P[4][i] ,
272  fPyjets->V[0][i] ,
273  fPyjets->V[1][i] ,
274  fPyjets->V[2][i] ,
275  fPyjets->V[3][i] ,
276  fPyjets->V[4][i]));
277  }
278  nparts=numpart;
279  }
280 
281  return nparts;
282 }
283 
284 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#define py1ent
Definition: Pythia6.cc:99
Pythia6()
Definition: Pythia6.cc:128
Structure for Pythia6 particle properties.
Definition: Pythia6.hh:119
PYDAT3 common-block.
Definition: Pythia6.hh:110
void * pythia6_common_address(const char *)
int Pycomp(int kf)
Definition: Pythia6.cc:173
int K[5][4000]
Definition: Pythia6.hh:95
#define type_of_call
Definition: Pythia6.cc:100
PYJETS common-block.
Definition: Pythia6.hh:91
double V[5][4000]
Definition: Pythia6.hh:97
static Pythia6 * Instance()
Definition: Pythia6.cc:117
double P[5][4000]
Definition: Pythia6.hh:96
int MSTU[200]
Definition: Pythia6.hh:103
void Py1ent(int line, int kf, double pe, double theta, double phi)
Definition: Pythia6.cc:182
std::vector< Pythia6Particle * > ParticleVector
Definition: Pythia6.hh:149
virtual ~Pythia6()
Definition: Pythia6.cc:158
int N
Definition: Pythia6.hh:93
ParticleVector * ImportParticles()
PYDAT1 common-block.
Definition: Pythia6.hh:101
#define pycomp
Definition: Pythia6.cc:98