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" << 47 #include <sstream> 45 #include <sstream> 48 46 49 namespace G4INCL { 47 namespace G4INCL { 50 48 51 G4ThreadLocal long IAvatar::nextID = 1; << 49 long IAvatar::nextID = 1; 52 50 53 IAvatar::IAvatar() : 51 IAvatar::IAvatar() : 54 type(UnknownAvatarType), 52 type(UnknownAvatarType), 55 theTime(0.) 53 theTime(0.) 56 { 54 { 57 ID = nextID; 55 ID = nextID; 58 nextID++; 56 nextID++; 59 } 57 } 60 58 61 IAvatar::IAvatar(G4double time) : 59 IAvatar::IAvatar(G4double time) : 62 type(UnknownAvatarType), 60 type(UnknownAvatarType), 63 theTime(time) 61 theTime(time) 64 { 62 { 65 ID = nextID; 63 ID = nextID; 66 nextID++; 64 nextID++; 67 } 65 } 68 66 69 IAvatar::~IAvatar() { 67 IAvatar::~IAvatar() { 70 INCL_DEBUG("destroying avatar " << this << << 71 } 68 } 72 69 73 std::string IAvatar::toString() { 70 std::string IAvatar::toString() { 74 std::stringstream entry; 71 std::stringstream entry; 75 std::stringstream particleString; 72 std::stringstream particleString; 76 ParticleList const &pl = getParticles(); << 73 ParticleList pl = getParticles(); 77 G4int numberOfParticles = 0; 74 G4int numberOfParticles = 0; 78 for(ParticleIter i=pl.begin(), e=pl.end(); << 75 for(ParticleIter i = pl.begin(); i != pl.end(); ++i) { 79 numberOfParticles++; 76 numberOfParticles++; 80 particleString << (*i)->getID() << " "; 77 particleString << (*i)->getID() << " "; 81 } 78 } 82 if(numberOfParticles == 1) particleString 79 if(numberOfParticles == 1) particleString << "-1"; 83 entry << getID() << " " 80 entry << getID() << " " 84 << getType() << " " 81 << getType() << " " 85 << getTime() << " " 82 << getTime() << " " 86 << particleString.str(); 83 << particleString.str(); 87 return entry.str(); 84 return entry.str(); 88 } 85 } 89 86 90 FinalState *IAvatar::getFinalState() { << 87 G4INCL::FinalState* IAvatar::getFinalState() 91 FinalState *fs = new FinalState; << 88 { 92 fillFinalState(fs); << 93 return fs; << 94 } << 95 << 96 void IAvatar::fillFinalState(FinalState *fs) << 97 INCL_DEBUG("Random seeds before preInterac << 98 preInteraction(); 89 preInteraction(); 99 INCL_DEBUG("Random seeds before getChannel << 100 IChannel *c = getChannel(); 90 IChannel *c = getChannel(); 101 if( !c ) << 91 if( !c ) { 102 return; << 92 return new FinalState; 103 INCL_DEBUG("Random seeds before getFinalSt << 93 } 104 c->fillFinalState(fs); << 94 FinalState *fs = c->getFinalState(); 105 INCL_DEBUG("Random seeds before postIntera << 95 fs = postInteraction(fs); 106 postInteraction(fs); << 107 delete c; 96 delete c; >> 97 return fs; 108 } 98 } 109 99 110 } 100 } 111 101