Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // 27 /// \file eventgenerator/pythia/decayer6/src/P 28 /// \brief Implementation of the Pythia6 class 29 30 // ------------------------------------------- 31 // According to TPythia6 class from Root: 32 // (The TPythia6 class is an interface class t 33 // CERNLIB event generators, written by T.Sjos 34 // http://root.cern.ch/ 35 // see http://root.cern.ch/root/License.html 36 // 37 // The complete Pythia6 documentation can be f 38 // http://home.thep.lu.se/~torbjorn/pythiaaux/ 39 // ------------------------------------------- 40 41 // ******************************************* 42 // ******************************************* 43 // ** 44 // ** 45 // ** *......* W 46 // ** *:::!!:::::::::::* 47 // ** *::::::!!::::::::::::::* P 48 // ** *::::::::!!::::::::::::::::* P 49 // ** *:::::::::!!:::::::::::::::::* P 50 // ** *:::::::::!!:::::::::::::::::* P 51 // ** *::::::::!!::::::::::::::::*! P 52 // ** *::::::!!::::::::::::::* !! 53 // ** !! *:::!!:::::::::::* !! T 54 // ** !! !* -><- * !! L 55 // ** !! !! !! 56 // ** !! !! !! N 57 // ** !! !! 58 // ** !! lh !! D 59 // ** !! !! w 60 // ** !! hh !! o 61 // ** !! ll !! w 62 // ** !! !! 63 // ** !! C 64 // ** 65 // ** An archive of program versions and docum 66 // ** http://www.thep.lu.se/~torbjorn/Pythia.h 67 // ** 68 // ** When you cite this program, the official 69 // ** T. Sjostrand, S. Mrenna and P. Skands, J 70 // ** (LU TP 06-13, FERMILAB-PUB-06-052-CD-T) 71 // ** 72 // ** Also remember that the program, to a lar 73 // ** physics research. Other publications of 74 // ** studies may therefore deserve separate m 75 // ** 76 // ** Main author: Torbjorn Sjostrand; Departm 77 // ** Lund University, Solvegatan 14A, S-223 78 // ** phone: + 46 - 46 - 222 48 16; e-mail: 79 // ** Author: Stephen Mrenna; Computing Divisi 80 // ** Fermi National Accelerator Laboratory, 81 // ** phone: + 1 - 630 - 840 - 2556; e-mail: 82 // ** Author: Peter Skands; Theoretical Physic 83 // ** Fermi National Accelerator Laboratory, 84 // ** and CERN/PH, CH-1211 Geneva, Switzerla 85 // ** phone: + 41 - 22 - 767 24 59; e-mail: 86 // ** 87 // ** 88 // ******************************************* 89 90 #include "Pythia6.hh" 91 92 #include <cstdlib> 93 #include <cstring> 94 #include <iostream> 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 107 extern "C" 108 { 109 int type_of_call pycomp(int* kf); 110 void type_of_call py1ent(int&, int&, double& 111 void* pythia6_common_address(const char*); 112 } 113 114 // Direct declaration of pythia6 common blocks 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 123 //....oooOO0OOooo........oooOO0OOooo........oo 124 125 Pythia6* Pythia6::Instance() 126 { 127 /// Static access method 128 129 if (!fgInstance) fgInstance = new Pythia6(); 130 131 return fgInstance; 132 } 133 134 //....oooOO0OOooo........oooOO0OOooo........oo 135 136 Pythia6::Pythia6() : fParticles(0), fPyjets(0) 137 { 138 /// Pythia6 constructor: creates a vector of 139 /// store all particles. Note that there may 140 /// object at a time, so it's not use to cre 141 142 // Protect against multiple objects. All a 143 // Instance member function. 144 if (fgInstance) { 145 std::cerr << "There's already an instance 146 exit(1); 147 } 148 149 fParticles = new ParticleVector(); 150 151 // Initialize common-blocks 152 fPyjets = (Pyjets_t*)pythia6_common_address( 153 fPydat1 = (Pydat1_t*)pythia6_common_address( 154 fPydat3 = (Pydat3_t*)pythia6_common_address( 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 } 162 163 //....oooOO0OOooo........oooOO0OOooo........oo 164 165 Pythia6::~Pythia6() 166 { 167 /// Destroy the object, delete and dispose a 168 /// list. 169 170 if (fParticles) { 171 ParticleVector::const_iterator it; 172 for (it = fParticles->begin(); it != fPart 173 delete *it; 174 delete fParticles; 175 } 176 } 177 178 //....oooOO0OOooo........oooOO0OOooo........oo 179 180 int Pythia6::Pycomp(int kf) 181 { 182 /// Interface with fortran routine pycomp 183 184 return pycomp(&kf); 185 } 186 187 //....oooOO0OOooo........oooOO0OOooo........oo 188 189 void Pythia6::Py1ent(int ip, int kf, double pe 190 { 191 /// Add one entry to the event record, i.e. 192 /// particle. 193 /// 194 /// IP: normally line number for the part 195 /// exceptions: 196 /// 197 /// If IP = 0: line number 1 is used 198 /// If IP < 0: line -IP is used, with 199 /// rather than 1; thus a 200 /// up by filling all but 201 /// system with IP < 0. 202 /// KF: parton/particle flavour code (PDG 203 /// PE: parton/particle energy. If PE is 204 /// the parton/particle is taken to b 205 /// THETA: 206 /// PHI: polar and azimuthal angle for the 207 /// parton/particle. 208 209 py1ent(ip, kf, pe, theta, phi); 210 } 211 212 //....oooOO0OOooo........oooOO0OOooo........oo 213 214 int Pythia6::ImportParticles(ParticleVector* p 215 { 216 /// Default primary creation method. It rea 217 /// has been filled by the GenerateEvent me 218 /// not use the HEPEVT common block, This r 219 /// the subclasses. 220 /// The function loops on the generated par 221 /// the TClonesArray pointed by the argumen 222 /// The default action is to store only the 223 /// This can be demanded explicitly by sett 224 /// If the option = "All", all the particle 225 226 if (particles == 0) return 0; 227 228 ParticleVector::const_iterator it; 229 for (it = particles->begin(); it != particle 230 delete *it; 231 particles->clear(); 232 233 int numpart = fPyjets->N; 234 int nparts = 0; 235 if (!strcmp(option, "") || !strcmp(option, " 236 for (int i = 0; i < numpart; i++) { 237 if (fPyjets->K[0][i] == 1) { 238 // 239 // Use the common block values for th 240 // 241 particles->push_back(new Pythia6Partic 242 fPyjets->K[0][i], fPyjets->K[1][i], 243 fPyjets->P[0][i], fPyjets->P[1][i], 244 fPyjets->V[0][i], fPyjets->V[1][i], 245 fPyjets->V[4][i])); 246 247 // if(gDebug) printf("%d %d %d! ", 248 nparts++; 249 } 250 } 251 } 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 262 return nparts; 263 } 264 265 //....oooOO0OOooo........oooOO0OOooo........oo 266