Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 // $Id: Pythia6.cc,v 1.1 2008/11/03 11:48:35 gcosmo Exp $ >> 27 // GEANT4 tag $Name: geant4-09-02 $ 26 // 28 // 27 /// \file eventgenerator/pythia/decayer6/src/P << 28 /// \brief Implementation of the Pythia6 class << 29 << 30 // ------------------------------------------- << 31 // According to TPythia6 class from Root: 29 // According to TPythia6 class from Root: 32 // (The TPythia6 class is an interface class t 30 // (The TPythia6 class is an interface class to F77 routines in Pythia6 // 33 // CERNLIB event generators, written by T.Sjos << 31 // CERNLIB event generators, written by T.Sjostrand.) 34 // http://root.cern.ch/ 32 // http://root.cern.ch/ 35 // see http://root.cern.ch/root/License.html 33 // see http://root.cern.ch/root/License.html 36 // 34 // 37 // The complete Pythia6 documentation can be f 35 // The complete Pythia6 documentation can be found at: 38 // http://home.thep.lu.se/~torbjorn/pythiaaux/ 36 // http://home.thep.lu.se/~torbjorn/pythiaaux/recent.html 39 // ------------------------------------------- 37 // ---------------------------------------------------------------------------- 40 38 41 // ******************************************* 39 // ****************************************************************************** 42 // ******************************************* 40 // ****************************************************************************** 43 // ** 41 // ** ** 44 // ** 42 // ** ** 45 // ** *......* W 43 // ** *......* Welcome to the Lund Monte Carlo! ** 46 // ** *:::!!:::::::::::* 44 // ** *:::!!:::::::::::* ** 47 // ** *::::::!!::::::::::::::* P 45 // ** *::::::!!::::::::::::::* PPP Y Y TTTTT H H III A ** 48 // ** *::::::::!!::::::::::::::::* P 46 // ** *::::::::!!::::::::::::::::* P P Y Y T H H I A A ** 49 // ** *:::::::::!!:::::::::::::::::* P 47 // ** *:::::::::!!:::::::::::::::::* PPP Y T HHHHH I AAAAA ** 50 // ** *:::::::::!!:::::::::::::::::* P 48 // ** *:::::::::!!:::::::::::::::::* P Y T H H I A A ** 51 // ** *::::::::!!::::::::::::::::*! P 49 // ** *::::::::!!::::::::::::::::*! P Y T H H III A A ** 52 // ** *::::::!!::::::::::::::* !! 50 // ** *::::::!!::::::::::::::* !! ** 53 // ** !! *:::!!:::::::::::* !! T 51 // ** !! *:::!!:::::::::::* !! This is PYTHIA version 6.418 ** 54 // ** !! !* -><- * !! L 52 // ** !! !* -><- * !! Last date of change: 9 Jun 2008 ** 55 // ** !! !! !! 53 // ** !! !! !! ** 56 // ** !! !! !! N 54 // ** !! !! !! Now is 0 Jan 2000 at 0:00:00 ** 57 // ** !! !! 55 // ** !! !! ** 58 // ** !! lh !! D 56 // ** !! lh !! Disclaimer: this program comes ** 59 // ** !! !! w 57 // ** !! !! without any guarantees. Beware ** 60 // ** !! hh !! o 58 // ** !! hh !! of errors and use common sense ** 61 // ** !! ll !! w 59 // ** !! ll !! when interpreting results. ** 62 // ** !! !! 60 // ** !! !! ** 63 // ** !! C 61 // ** !! Copyright T. Sjostrand (2008) ** 64 // ** 62 // ** ** 65 // ** An archive of program versions and docum 63 // ** An archive of program versions and documentation is found on the web: ** 66 // ** http://www.thep.lu.se/~torbjorn/Pythia.h 64 // ** http://www.thep.lu.se/~torbjorn/Pythia.html ** 67 // ** 65 // ** ** 68 // ** When you cite this program, the official 66 // ** When you cite this program, the official reference is to the 6.4 manual: ** 69 // ** T. Sjostrand, S. Mrenna and P. Skands, J 67 // ** T. Sjostrand, S. Mrenna and P. Skands, JHEP05 (2006) 026 ** 70 // ** (LU TP 06-13, FERMILAB-PUB-06-052-CD-T) 68 // ** (LU TP 06-13, FERMILAB-PUB-06-052-CD-T) [hep-ph/0603175]. ** 71 // ** 69 // ** ** 72 // ** Also remember that the program, to a lar 70 // ** Also remember that the program, to a large extent, represents original ** 73 // ** physics research. Other publications of 71 // ** physics research. Other publications of special relevance to your ** 74 // ** studies may therefore deserve separate m 72 // ** studies may therefore deserve separate mention. ** 75 // ** 73 // ** ** 76 // ** Main author: Torbjorn Sjostrand; Departm 74 // ** Main author: Torbjorn Sjostrand; Department of Theoretical Physics, ** 77 // ** Lund University, Solvegatan 14A, S-223 75 // ** Lund University, Solvegatan 14A, S-223 62 Lund, Sweden; ** 78 // ** phone: + 46 - 46 - 222 48 16; e-mail: 76 // ** phone: + 46 - 46 - 222 48 16; e-mail: torbjorn@thep.lu.se ** 79 // ** Author: Stephen Mrenna; Computing Divisi 77 // ** Author: Stephen Mrenna; Computing Division, GDS Group, ** 80 // ** Fermi National Accelerator Laboratory, 78 // ** Fermi National Accelerator Laboratory, MS 234, Batavia, IL 60510, USA; ** 81 // ** phone: + 1 - 630 - 840 - 2556; e-mail: 79 // ** phone: + 1 - 630 - 840 - 2556; e-mail: mrenna@fnal.gov ** 82 // ** Author: Peter Skands; Theoretical Physic 80 // ** Author: Peter Skands; Theoretical Physics Department, ** 83 // ** Fermi National Accelerator Laboratory, 81 // ** Fermi National Accelerator Laboratory, MS 106, Batavia, IL 60510, USA; ** 84 // ** and CERN/PH, CH-1211 Geneva, Switzerla 82 // ** and CERN/PH, CH-1211 Geneva, Switzerland; ** 85 // ** phone: + 41 - 22 - 767 24 59; e-mail: 83 // ** phone: + 41 - 22 - 767 24 59; e-mail: skands@fnal.gov ** 86 // ** 84 // ** ** 87 // ** 85 // ** ** 88 // ******************************************* 86 // ****************************************************************************** 89 87 90 #include "Pythia6.hh" 88 #include "Pythia6.hh" 91 89 92 #include <cstdlib> << 93 #include <cstring> << 94 #include <iostream> 90 #include <iostream> 95 91 96 #ifndef WIN32 92 #ifndef WIN32 97 # define pycomp pycomp_ << 93 # define pycomp pycomp_ 98 # define py1ent py1ent_ << 94 # define py1ent py1ent_ 99 # define type_of_call << 95 # define type_of_call 100 #else 96 #else 101 # define pycomp PYCOMP << 97 # define pycomp PYCOMP 102 # define py1ent PY1ENT << 98 # define py1ent PY1ENT 103 # define type_of_call _stdcall << 99 # define type_of_call _stdcall 104 #endif 100 #endif 105 101 106 // pythia6 functions << 102 extern "C" { 107 extern "C" << 103 int type_of_call pycomp(int *kf); 108 { << 109 int type_of_call pycomp(int* kf); << 110 void type_of_call py1ent(int&, int&, double& 104 void type_of_call py1ent(int&, int&, double&, double&, double&); 111 void* pythia6_common_address(const char*); << 105 void* pythia6_common_address(const char*); 112 } 106 } 113 107 114 // Direct declaration of pythia6 common blocks << 108 Pythia6* Pythia6::fgInstance = 0; 115 // extern "C" { << 116 // extern Pyjets_t pyjets_; << 117 // extern Pydat1_t pydat1_; << 118 // extern Pydat3_t pydat3_; << 119 // } << 120 << 121 Pythia6* Pythia6::fgInstance = 0; << 122 109 123 //....oooOO0OOooo........oooOO0OOooo........oo << 110 //______________________________________________________________________________ 124 << 111 Pythia6* Pythia6::Instance() 125 Pythia6* Pythia6::Instance() << 126 { 112 { 127 /// Static access method << 113 /// Static access method 128 114 129 if (!fgInstance) fgInstance = new Pythia6(); << 115 if ( ! fgInstance ) fgInstance = new Pythia6(); 130 116 131 return fgInstance; << 117 return fgInstance; 132 } 118 } 133 119 134 //....oooOO0OOooo........oooOO0OOooo........oo << 135 120 136 Pythia6::Pythia6() : fParticles(0), fPyjets(0) << 121 //______________________________________________________________________________ >> 122 Pythia6::Pythia6() >> 123 : fParticles(0) 137 { 124 { 138 /// Pythia6 constructor: creates a vector of << 125 /// Pythia6 constructor: creates a vector of Pythia6Particle in which it will store all 139 /// store all particles. Note that there may << 126 /// particles. Note that there may be only one functional Pythia6 object 140 /// object at a time, so it's not use to cre << 127 /// at a time, so it's not use to create more than one instance of it. 141 << 128 142 // Protect against multiple objects. All a << 129 // Protect against multiple objects. All access should be via the 143 // Instance member function. << 130 // Instance member function. 144 if (fgInstance) { << 131 if ( fgInstance ) { 145 std::cerr << "There's already an instance << 132 std::cerr << "There's already an instance of Pythia6" << std::endl; 146 exit(1); << 133 exit (1); 147 } << 134 } 148 << 135 149 fParticles = new ParticleVector(); << 136 fParticles = new ParticleVector(); 150 137 151 // Initialize common-blocks << 138 // initialize common-blocks 152 fPyjets = (Pyjets_t*)pythia6_common_address( << 139 fPyjets = (Pyjets_t*) pythia6_common_address("PYJETS"); 153 fPydat1 = (Pydat1_t*)pythia6_common_address( << 140 fPydat1 = (Pydat1_t*) pythia6_common_address("PYDAT1"); 154 fPydat3 = (Pydat3_t*)pythia6_common_address( << 141 fPydat3 = (Pydat3_t*) pythia6_common_address("PYDAT3"); 155 << 156 // Alternative way to initialize common-bloc << 157 // usind direct declaration of pythia6 commo << 158 // fPyjets = &pyjets_; << 159 // fPydat1 = &pydat1_; << 160 // fPydat3 = &pydat3_; << 161 } 142 } 162 143 163 //....oooOO0OOooo........oooOO0OOooo........oo << 144 //______________________________________________________________________________ 164 << 165 Pythia6::~Pythia6() 145 Pythia6::~Pythia6() 166 { 146 { 167 /// Destroy the object, delete and dispose a << 147 /// Destroy the object, delete and dispose all Pythia6Particles currently on list. 168 /// list. << 169 148 170 if (fParticles) { << 149 if ( fParticles ) { 171 ParticleVector::const_iterator it; << 150 ParticleVector::const_iterator it; 172 for (it = fParticles->begin(); it != fPart << 151 for ( it = fParticles->begin(); it != fParticles->end(); it++ ) 173 delete *it; << 152 delete *it; 174 delete fParticles; << 153 delete fParticles; 175 } << 154 } 176 } 155 } 177 156 178 //....oooOO0OOooo........oooOO0OOooo........oo << 157 //______________________________________________________________________________ 179 << 158 int Pythia6::Pycomp(int kf) 180 int Pythia6::Pycomp(int kf) << 181 { 159 { 182 /// Interface with fortran routine pycomp << 160 /// Interface with fortran routine pycomp 183 161 184 return pycomp(&kf); << 162 return pycomp(&kf); 185 } 163 } 186 164 187 //....oooOO0OOooo........oooOO0OOooo........oo << 165 //______________________________________________________________________________ 188 << 189 void Pythia6::Py1ent(int ip, int kf, double pe 166 void Pythia6::Py1ent(int ip, int kf, double pe, double theta, double phi) 190 { 167 { 191 /// Add one entry to the event record, i.e. << 168 /// Add one entry to the event record, i.e. either a parton or a 192 /// particle. << 169 /// particle. 193 /// << 170 /// 194 /// IP: normally line number for the part << 171 /// IP: normally line number for the parton/particle. There are two 195 /// exceptions: << 172 /// exceptions: 196 /// << 173 /// 197 /// If IP = 0: line number 1 is used << 174 /// If IP = 0: line number 1 is used and PYEXEC is called. 198 /// If IP < 0: line -IP is used, with << 175 /// If IP < 0: line -IP is used, with status code K(-IP,2)=2 199 /// rather than 1; thus a << 176 /// rather than 1; thus a parton system may be built 200 /// up by filling all but << 177 /// up by filling all but the last parton of the 201 /// system with IP < 0. << 178 /// system with IP < 0. 202 /// KF: parton/particle flavour code (PDG << 179 /// KF: parton/particle flavour code (PDG code) 203 /// PE: parton/particle energy. If PE is << 180 /// PE: parton/particle energy. If PE is smaller than the mass, 204 /// the parton/particle is taken to b << 181 /// the parton/particle is taken to be at rest. 205 /// THETA: << 182 /// THETA: 206 /// PHI: polar and azimuthal angle for the << 183 /// PHI: polar and azimuthal angle for the momentum vector of the 207 /// parton/particle. << 184 /// parton/particle. 208 185 209 py1ent(ip, kf, pe, theta, phi); << 186 py1ent(ip, kf, pe, theta, phi); 210 } 187 } 211 188 212 //....oooOO0OOooo........oooOO0OOooo........oo << 189 //______________________________________________________________________________ 213 << 214 int Pythia6::ImportParticles(ParticleVector* p 190 int Pythia6::ImportParticles(ParticleVector* particles, const char* option) 215 { 191 { 216 /// Default primary creation method. It rea << 192 /// Default primary creation method. It reads the /HEPEVT/ common block which 217 /// has been filled by the GenerateEvent me << 193 /// has been filled by the GenerateEvent method. If the event generator does 218 /// not use the HEPEVT common block, This r << 194 /// not use the HEPEVT common block, This routine has to be overloaded by 219 /// the subclasses. << 195 /// the subclasses. 220 /// The function loops on the generated par << 196 /// The function loops on the generated particles and store them in 221 /// the TClonesArray pointed by the argumen << 197 /// the TClonesArray pointed by the argument particles. 222 /// The default action is to store only the << 198 /// The default action is to store only the stable particles (ISTHEP = 1) 223 /// This can be demanded explicitly by sett << 199 /// This can be demanded explicitly by setting the option = "Final" 224 /// If the option = "All", all the particle << 200 /// If the option = "All", all the particles are stored. 225 << 201 226 if (particles == 0) return 0; << 202 if ( particles == 0 ) return 0; 227 << 203 228 ParticleVector::const_iterator it; << 204 ParticleVector::const_iterator it; 229 for (it = particles->begin(); it != particle << 205 for ( it = particles->begin(); it != particles->end(); it++ ) 230 delete *it; << 206 delete *it; 231 particles->clear(); << 207 particles->clear(); 232 << 208 233 int numpart = fPyjets->N; << 209 int numpart = fPyjets->N; 234 int nparts = 0; << 210 int nparts=0; 235 if (!strcmp(option, "") || !strcmp(option, " << 211 if (!strcmp(option,"") || !strcmp(option,"Final")) { 236 for (int i = 0; i < numpart; i++) { << 212 for (int i = 0; i<numpart; i++) { 237 if (fPyjets->K[0][i] == 1) { << 213 238 // << 214 if (fPyjets->K[0][i] == 1) { 239 // Use the common block values for th << 215 // 240 // << 216 // Use the common block values for the TParticle constructor 241 particles->push_back(new Pythia6Partic << 217 // 242 fPyjets->K[0][i], fPyjets->K[1][i], << 218 particles->push_back( 243 fPyjets->P[0][i], fPyjets->P[1][i], << 219 new Pythia6Particle( 244 fPyjets->V[0][i], fPyjets->V[1][i], << 220 fPyjets->K[0][i] , 245 fPyjets->V[4][i])); << 221 fPyjets->K[1][i] , 246 << 222 fPyjets->K[2][i] , 247 // if(gDebug) printf("%d %d %d! ", << 223 fPyjets->K[3][i] , 248 nparts++; << 224 fPyjets->K[4][i] , >> 225 fPyjets->P[0][i] , >> 226 fPyjets->P[1][i] , >> 227 fPyjets->P[2][i] , >> 228 fPyjets->P[3][i] , >> 229 fPyjets->P[4][i] , >> 230 fPyjets->V[0][i] , >> 231 fPyjets->V[1][i] , >> 232 fPyjets->V[2][i] , >> 233 fPyjets->V[3][i] , >> 234 fPyjets->V[4][i])); >> 235 >> 236 // if(gDebug) printf("%d %d %d! ",i,fPyjets->K[1][i],numpart); >> 237 nparts++; >> 238 } >> 239 } >> 240 } >> 241 else if (!strcmp(option,"All")) { >> 242 for (int i = 0; i<numpart; i++) { >> 243 particles->push_back( >> 244 new Pythia6Particle( >> 245 fPyjets->K[0][i] , >> 246 fPyjets->K[1][i] , >> 247 fPyjets->K[2][i] , >> 248 fPyjets->K[3][i] , >> 249 fPyjets->K[4][i] , >> 250 fPyjets->P[0][i] , >> 251 fPyjets->P[1][i] , >> 252 fPyjets->P[2][i] , >> 253 fPyjets->P[3][i] , >> 254 fPyjets->P[4][i] , >> 255 fPyjets->V[0][i] , >> 256 fPyjets->V[1][i] , >> 257 fPyjets->V[2][i] , >> 258 fPyjets->V[3][i] , >> 259 fPyjets->V[4][i])); 249 } 260 } 250 } << 261 nparts=numpart; 251 } << 262 } 252 else if (!strcmp(option, "All")) { << 253 for (int i = 0; i < numpart; i++) { << 254 particles->push_back(new Pythia6Particle << 255 fPyjets->K[0][i], fPyjets->K[1][i], fP << 256 fPyjets->P[0][i], fPyjets->P[1][i], fP << 257 fPyjets->V[0][i], fPyjets->V[1][i], fP << 258 } << 259 nparts = numpart; << 260 } << 261 263 262 return nparts; << 264 return nparts; 263 } 265 } 264 << 265 //....oooOO0OOooo........oooOO0OOooo........oo << 266 266