Loading...
Searching...
No Matches
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//
27/// \file eventgenerator/pythia/decayer6/src/Pythia6.cc
28/// \brief Implementation of the Pythia6 class
29
30// ----------------------------------------------------------------------------
31// According to TPythia6 class from Root:
32// (The TPythia6 class is an interface class to F77 routines in Pythia6 //
33// CERNLIB event generators, written by T.Sjostrand.)
34// http://root.cern.ch/
35// see http://root.cern.ch/root/License.html
36//
37// The complete Pythia6 documentation can be found at:
38// http://home.thep.lu.se/~torbjorn/pythiaaux/recent.html
39// ----------------------------------------------------------------------------
40
41// ******************************************************************************
42// ******************************************************************************
43// ** **
44// ** **
45// ** *......* Welcome to the Lund Monte Carlo! **
46// ** *:::!!:::::::::::* **
47// ** *::::::!!::::::::::::::* PPP Y Y TTTTT H H III A **
48// ** *::::::::!!::::::::::::::::* P P Y Y T H H I A A **
49// ** *:::::::::!!:::::::::::::::::* PPP Y T HHHHH I AAAAA **
50// ** *:::::::::!!:::::::::::::::::* P Y T H H I A A **
51// ** *::::::::!!::::::::::::::::*! P Y T H H III A A **
52// ** *::::::!!::::::::::::::* !! **
53// ** !! *:::!!:::::::::::* !! This is PYTHIA version 6.418 **
54// ** !! !* -><- * !! Last date of change: 9 Jun 2008 **
55// ** !! !! !! **
56// ** !! !! !! Now is 0 Jan 2000 at 0:00:00 **
57// ** !! !! **
58// ** !! lh !! Disclaimer: this program comes **
59// ** !! !! without any guarantees. Beware **
60// ** !! hh !! of errors and use common sense **
61// ** !! ll !! when interpreting results. **
62// ** !! !! **
63// ** !! Copyright T. Sjostrand (2008) **
64// ** **
65// ** An archive of program versions and documentation is found on the web: **
66// ** http://www.thep.lu.se/~torbjorn/Pythia.html **
67// ** **
68// ** When you cite this program, the official reference is to the 6.4 manual: **
69// ** T. Sjostrand, S. Mrenna and P. Skands, JHEP05 (2006) 026 **
70// ** (LU TP 06-13, FERMILAB-PUB-06-052-CD-T) [hep-ph/0603175]. **
71// ** **
72// ** Also remember that the program, to a large extent, represents original **
73// ** physics research. Other publications of special relevance to your **
74// ** studies may therefore deserve separate mention. **
75// ** **
76// ** Main author: Torbjorn Sjostrand; Department of Theoretical Physics, **
77// ** Lund University, Solvegatan 14A, S-223 62 Lund, Sweden; **
78// ** phone: + 46 - 46 - 222 48 16; e-mail: torbjorn@thep.lu.se **
79// ** Author: Stephen Mrenna; Computing Division, GDS Group, **
80// ** Fermi National Accelerator Laboratory, MS 234, Batavia, IL 60510, USA; **
81// ** phone: + 1 - 630 - 840 - 2556; e-mail: mrenna@fnal.gov **
82// ** Author: Peter Skands; Theoretical Physics Department, **
83// ** Fermi National Accelerator Laboratory, MS 106, Batavia, IL 60510, USA; **
84// ** and CERN/PH, CH-1211 Geneva, Switzerland; **
85// ** phone: + 41 - 22 - 767 24 59; e-mail: skands@fnal.gov **
86// ** **
87// ** **
88// ******************************************************************************
89
90#include "Pythia6.hh"
91
92#include <iostream>
93#include <cstdlib>
94#include <cstring>
95
96#ifndef WIN32
97# define pycomp pycomp_
98# define py1ent py1ent_
99# define type_of_call
100#else
101# define pycomp PYCOMP
102# define py1ent PY1ENT
103# define type_of_call _stdcall
104#endif
105
106// pythia6 functions
107extern "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// Direct declaration of pythia6 common blocks
114// extern "C" {
115// extern Pyjets_t pyjets_;
116// extern Pydat1_t pydat1_;
117// extern Pydat3_t pydat3_;
118// }
119
121
122//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
123
125{
126/// Static access method
127
128 if ( ! fgInstance ) fgInstance = new Pythia6();
129
130 return fgInstance;
131}
132
133//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134
136 : fParticles(0),
137 fPyjets(0),
138 fPydat1(0),
139 fPydat3(0)
140{
141/// Pythia6 constructor: creates a vector of Pythia6Particle in which it will
142/// store all particles. Note that there may be only one functional Pythia6
143/// object at a time, so it's not use to create more than one instance of it.
144
145 // Protect against multiple objects. All access should be via the
146 // Instance member function.
147 if ( fgInstance ) {
148 std::cerr << "There's already an instance of Pythia6" << std::endl;
149 exit (1);
150 }
151
153
154 // Initialize common-blocks
158
159 // Alternative way to initialize common-blocks
160 // usind direct declaration of pythia6 common blocks
161 // fPyjets = &pyjets_;
162 // fPydat1 = &pydat1_;
163 // fPydat3 = &pydat3_;
164}
165
166//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
167
169{
170/// Destroy the object, delete and dispose all Pythia6Particles currently on
171/// list.
172
173 if ( fParticles ) {
174 ParticleVector::const_iterator it;
175 for ( it = fParticles->begin(); it != fParticles->end(); it++ )
176 delete *it;
177 delete fParticles;
178 }
179}
180
181//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
182
183int Pythia6::Pycomp(int kf)
184{
185/// Interface with fortran routine pycomp
186
187 return pycomp(&kf);
188}
189
190//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
191
192void Pythia6::Py1ent(int ip, int kf, double pe, double theta, double phi)
193{
194/// Add one entry to the event record, i.e. either a parton or a
195/// particle.
196///
197/// IP: normally line number for the parton/particle. There are two
198/// exceptions:
199///
200/// If IP = 0: line number 1 is used and PYEXEC is called.
201/// If IP < 0: line -IP is used, with status code K(-IP,2)=2
202/// rather than 1; thus a parton system may be built
203/// up by filling all but the last parton of the
204/// system with IP < 0.
205/// KF: parton/particle flavour code (PDG code)
206/// PE: parton/particle energy. If PE is smaller than the mass,
207/// the parton/particle is taken to be at rest.
208/// THETA:
209/// PHI: polar and azimuthal angle for the momentum vector of the
210/// parton/particle.
211
212 py1ent(ip, kf, pe, theta, phi);
213}
214
215//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
216
217int Pythia6::ImportParticles(ParticleVector* particles, const char* option)
218{
219/// Default primary creation method. It reads the /HEPEVT/ common block which
220/// has been filled by the GenerateEvent method. If the event generator does
221/// not use the HEPEVT common block, This routine has to be overloaded by
222/// the subclasses.
223/// The function loops on the generated particles and store them in
224/// the TClonesArray pointed by the argument particles.
225/// The default action is to store only the stable particles (ISTHEP = 1)
226/// This can be demanded explicitly by setting the option = "Final"
227/// If the option = "All", all the particles are stored.
228
229 if ( particles == 0 ) return 0;
230
231 ParticleVector::const_iterator it;
232 for ( it = particles->begin(); it != particles->end(); it++ )
233 delete *it;
234 particles->clear();
235
236 int numpart = fPyjets->N;
237 int nparts=0;
238 if (!strcmp(option,"") || !strcmp(option,"Final")) {
239 for (int i = 0; i<numpart; i++) {
240
241 if (fPyjets->K[0][i] == 1) {
242 //
243 // Use the common block values for the TParticle constructor
244 //
245 particles->push_back(
246 new Pythia6Particle(
247 fPyjets->K[0][i] ,
248 fPyjets->K[1][i] ,
249 fPyjets->K[2][i] ,
250 fPyjets->K[3][i] ,
251 fPyjets->K[4][i] ,
252 fPyjets->P[0][i] ,
253 fPyjets->P[1][i] ,
254 fPyjets->P[2][i] ,
255 fPyjets->P[3][i] ,
256 fPyjets->P[4][i] ,
257 fPyjets->V[0][i] ,
258 fPyjets->V[1][i] ,
259 fPyjets->V[2][i] ,
260 fPyjets->V[3][i] ,
261 fPyjets->V[4][i]));
262
263 // if(gDebug) printf("%d %d %d! ",i,fPyjets->K[1][i],numpart);
264 nparts++;
265 }
266 }
267 }
268 else if (!strcmp(option,"All")) {
269 for (int i = 0; i<numpart; i++) {
270 particles->push_back(
271 new Pythia6Particle(
272 fPyjets->K[0][i] ,
273 fPyjets->K[1][i] ,
274 fPyjets->K[2][i] ,
275 fPyjets->K[3][i] ,
276 fPyjets->K[4][i] ,
277 fPyjets->P[0][i] ,
278 fPyjets->P[1][i] ,
279 fPyjets->P[2][i] ,
280 fPyjets->P[3][i] ,
281 fPyjets->P[4][i] ,
282 fPyjets->V[0][i] ,
283 fPyjets->V[1][i] ,
284 fPyjets->V[2][i] ,
285 fPyjets->V[3][i] ,
286 fPyjets->V[4][i]));
287 }
288 nparts=numpart;
289 }
290
291 return nparts;
292}
293
294//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void * pythia6_common_address(const char *)
#define pycomp
Definition Pythia6.cc:97
#define type_of_call
Definition Pythia6.cc:99
#define py1ent
Definition Pythia6.cc:98
Definition of the Pythia6 class.
std::vector< Pythia6Particle * > ParticleVector
Definition Pythia6.hh:148
The C++ interface class to Pythia6.
static Pythia6 * Instance()
Definition Pythia6.cc:124
ParticleVector * ImportParticles()
ParticleVector * fParticles
Definition Pythia6.hh:193
virtual ~Pythia6()
Definition Pythia6.cc:168
Pydat3_t * fPydat3
Definition Pythia6.hh:196
Pythia6()
Definition Pythia6.cc:135
int Pycomp(int kf)
Definition Pythia6.cc:183
static Pythia6 * fgInstance
Definition Pythia6.hh:191
Pydat1_t * fPydat1
Definition Pythia6.hh:195
void Py1ent(int line, int kf, double pe, double theta, double phi)
Definition Pythia6.cc:192
Pyjets_t * fPyjets
Definition Pythia6.hh:194
PYDAT1 common-block.
Definition Pythia6.hh:101
PYDAT3 common-block.
Definition Pythia6.hh:110
PYJETS common-block.
Definition Pythia6.hh:91
int K[5][4000]
Definition Pythia6.hh:94
double P[5][4000]
Definition Pythia6.hh:95
double V[5][4000]
Definition Pythia6.hh:96
int N
Definition Pythia6.hh:92
Structure for Pythia6 particle properties.
Definition Pythia6.hh:119

Applications | User Support | Publications | Collaboration