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 // INCL++ intra-nuclear cascade model 26 // INCL++ intra-nuclear cascade model 27 // Alain Boudard, CEA-Saclay, France << 27 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics 28 // Joseph Cugnon, University of Liege, Belgium << 28 // Davide Mancusi, CEA 29 // Jean-Christophe David, CEA-Saclay, France << 29 // Alain Boudard, CEA 30 // Pekka Kaitaniemi, CEA-Saclay, France, and H << 30 // Sylvie Leray, CEA 31 // Sylvie Leray, CEA-Saclay, France << 31 // Joseph Cugnon, University of Liege 32 // Davide Mancusi, CEA-Saclay, France << 33 // 32 // 34 #define INCLXX_IN_GEANT4_MODE 1 33 #define INCLXX_IN_GEANT4_MODE 1 35 34 36 #include "globals.hh" 35 #include "globals.hh" 37 36 38 /* 37 /* 39 * IAvatar.cc 38 * IAvatar.cc 40 * 39 * 41 * \date 4 juin 2009 40 * \date 4 juin 2009 42 * \author Pekka Kaitaniemi 41 * \author Pekka Kaitaniemi 43 */ 42 */ 44 43 45 #include "G4INCLIAvatar.hh" 44 #include "G4INCLIAvatar.hh" 46 #include "G4INCLRandom.hh" 45 #include "G4INCLRandom.hh" 47 #include <sstream> 46 #include <sstream> 48 47 49 namespace G4INCL { 48 namespace G4INCL { 50 49 51 G4ThreadLocal long IAvatar::nextID = 1; 50 G4ThreadLocal long IAvatar::nextID = 1; 52 51 53 IAvatar::IAvatar() : 52 IAvatar::IAvatar() : 54 type(UnknownAvatarType), 53 type(UnknownAvatarType), 55 theTime(0.) 54 theTime(0.) 56 { 55 { 57 ID = nextID; 56 ID = nextID; 58 nextID++; 57 nextID++; 59 } 58 } 60 59 61 IAvatar::IAvatar(G4double time) : 60 IAvatar::IAvatar(G4double time) : 62 type(UnknownAvatarType), 61 type(UnknownAvatarType), 63 theTime(time) 62 theTime(time) 64 { 63 { 65 ID = nextID; 64 ID = nextID; 66 nextID++; 65 nextID++; 67 } 66 } 68 67 69 IAvatar::~IAvatar() { 68 IAvatar::~IAvatar() { 70 INCL_DEBUG("destroying avatar " << this << << 71 } 69 } 72 70 73 std::string IAvatar::toString() { 71 std::string IAvatar::toString() { 74 std::stringstream entry; 72 std::stringstream entry; 75 std::stringstream particleString; 73 std::stringstream particleString; 76 ParticleList const &pl = getParticles(); << 74 ParticleList pl = getParticles(); 77 G4int numberOfParticles = 0; 75 G4int numberOfParticles = 0; 78 for(ParticleIter i=pl.begin(), e=pl.end(); 76 for(ParticleIter i=pl.begin(), e=pl.end(); i!=e; ++i) { 79 numberOfParticles++; 77 numberOfParticles++; 80 particleString << (*i)->getID() << " "; 78 particleString << (*i)->getID() << " "; 81 } 79 } 82 if(numberOfParticles == 1) particleString 80 if(numberOfParticles == 1) particleString << "-1"; 83 entry << getID() << " " 81 entry << getID() << " " 84 << getType() << " " 82 << getType() << " " 85 << getTime() << " " 83 << getTime() << " " 86 << particleString.str(); 84 << particleString.str(); 87 return entry.str(); 85 return entry.str(); 88 } 86 } 89 87 90 FinalState *IAvatar::getFinalState() { << 88 G4INCL::FinalState* IAvatar::getFinalState() 91 FinalState *fs = new FinalState; << 89 { 92 fillFinalState(fs); << 90 INCL_DEBUG("Random seeds before preInteraction: " << Random::getSeeds() << std::endl); 93 return fs; << 94 } << 95 << 96 void IAvatar::fillFinalState(FinalState *fs) << 97 INCL_DEBUG("Random seeds before preInterac << 98 preInteraction(); 91 preInteraction(); 99 INCL_DEBUG("Random seeds before getChannel << 92 INCL_DEBUG("Random seeds before getChannel: " << Random::getSeeds() << std::endl); 100 IChannel *c = getChannel(); 93 IChannel *c = getChannel(); 101 if( !c ) << 94 if( !c ) { 102 return; << 95 return NULL; 103 INCL_DEBUG("Random seeds before getFinalSt << 96 } 104 c->fillFinalState(fs); << 97 INCL_DEBUG("Random seeds before getFinalState: " << Random::getSeeds() << std::endl); 105 INCL_DEBUG("Random seeds before postIntera << 98 FinalState *fs = c->getFinalState(); 106 postInteraction(fs); << 99 INCL_DEBUG("Random seeds before postInteraction: " << Random::getSeeds() << std::endl); >> 100 fs = postInteraction(fs); 107 delete c; 101 delete c; >> 102 return fs; 108 } 103 } 109 104 110 } 105 } 111 106