#include <G4INCLStore.hh>
Public Member Functions | |
Store (Config const *const config) | |
~Store () | |
void | add (Particle *p) |
void | addParticleEntryAvatar (IAvatar *a) |
Add one ParticleEntry avatar. | |
void | addParticleEntryAvatars (IAvatarList const &al) |
Add one ParticleEntry avatar. | |
void | add (IAvatar *a) |
IAvatarList const & | getAvatars () const |
void | addIncomingParticle (Particle *const p) |
void | removeFromIncoming (Particle *const p) |
void | clearIncoming () |
Clear the incoming list. | |
void | deleteIncoming () |
Clear the incoming list and delete the particles. | |
void | particleHasBeenUpdated (long) |
IAvatar * | findSmallestTime () |
void | timeStep (G4double step) |
void | particleHasBeenEjected (long) |
void | addToOutgoing (Particle *p) |
add the particle to the outgoing particle list. | |
void | addToOutgoing (ParticleList const &pl) |
Add a list of particles to the outgoing particle list. | |
void | particleHasBeenDestroyed (long) |
void | particleHasEntered (Particle *const particle) |
Move a particle from incoming to inside. | |
ParticleList const & | getIncomingParticles () const |
ParticleList const & | getOutgoingParticles () const |
ParticleList | extractDynamicalSpectators () |
Returns a list of dynamical spectators. | |
ParticleList const & | getParticles () const |
Book * | getBook () |
G4int | countCascading () |
Config const * | getConfig () |
ParticleList | getParticipants () |
ParticleList | getSpectators () |
void | clear () |
void | clearOutgoing () |
void | clearAvatars () |
void | initialiseParticleAvatarConnections () |
Initialise the particleAvatarConnections map. | |
void | loadParticles (std::string filename) |
G4int | getLoadedA () |
G4int | getLoadedZ () |
G4double | getLoadedStoppingTime () |
std::string | printParticleConfiguration () |
void | writeParticles (std::string filename) |
std::string | printAvatars () |
G4bool | containsCollisions () const |
Static Public Member Functions | |
static G4bool | avatarComparisonPredicate (IAvatar *lhs, IAvatar *rhs) |
Comparison predicate for avatars. |
Definition at line 62 of file G4INCLStore.hh.
G4INCL::Store::Store | ( | Config const *const | config | ) |
Store constructor
Definition at line 44 of file G4INCLStore.cc.
00044 : 00045 theBook(new Book), 00046 loadedA(0), 00047 loadedZ(0), 00048 loadedStoppingTime(0.), 00049 theConfig(config) 00050 { 00051 }
G4INCL::Store::~Store | ( | ) |
Store destructor
Definition at line 53 of file G4INCLStore.cc.
References clear(), and G4INCL::Book::reset().
00053 { 00054 theBook->reset(); 00055 delete theBook; 00056 theBook = 0; 00057 clear(); 00058 }
void G4INCL::Store::add | ( | IAvatar * | a | ) |
Add one avatar to the store
Avatars know about the particles they are associated with. Adding an avatar consists of the following steps: 1. Add the new avatar to the avatar list 2. Add any related new particles to the store by calling add(Particle*) (this should not happen, by the time we are adding avatars all particles should have already been added) 3. Connect the particles involved to the avatar in the map: particleAvatarConnections :: ParticleID -> [AvatarID] 4. Add the new avatar to the map: avatarParticleConnections :: AvatarID -> [ParticleID]
Definition at line 89 of file G4INCLStore.cc.
References add(), ERROR, G4INCL::IAvatar::getID(), and G4INCL::IAvatar::getParticles().
00089 { 00090 // Add the avatar to the avatar map 00091 avatars[a->getID()]=a; 00092 avatarList.push_back(a); 00093 00094 ParticleList pList = a->getParticles(); 00095 for(ParticleIter i = pList.begin(); i != pList.end(); ++i) { 00096 // If one of the particles participating in this avatar haven't 00097 // been registered with the store we can do it now. On the other 00098 // hand, if this happens, it's probably a symptom of a bug 00099 // somewhere... 00100 if(particles.find((*i)->getID()) == particles.end()) { 00101 ERROR("Avatar was added before related particles. This is probably a bug." << std::endl); 00102 add((*i)); 00103 } 00104 // Connect each particle to the avatar 00105 connectParticleAndAvatar((*i)->getID(), a->getID()); 00106 } 00107 00108 }
void G4INCL::Store::add | ( | Particle * | p | ) |
Add one particle to the store.
Particle objects don't know anything about avatars so this method will only do two things: 1. add the particle to the particle map ParticleID -> Particle* 2. add an empty entry for this particle into map AvatarID -> [ParticleID]
Definition at line 60 of file G4INCLStore.cc.
References G4INCL::Particle::getID().
Referenced by add(), G4INCL::Nucleus::applyFinalState(), G4INCL::Nucleus::initializeParticles(), loadParticles(), particleHasEntered(), and G4INCL::StandardPropagationModel::registerAvatar().
00060 { 00061 const long ID = p->getID(); 00062 particles[ID]=p; 00063 inside.push_back(p); 00064 00065 if(particleAvatarConnections.find(ID)==particleAvatarConnections.end()) { 00066 std::vector<long> *aIDs = new std::vector<long>; 00067 particleAvatarConnections[ID] = aIDs; 00068 } 00069 }
void G4INCL::Store::addIncomingParticle | ( | Particle *const | p | ) |
Add a particle to the incoming list.
p | particle to add |
Definition at line 110 of file G4INCLStore.cc.
Referenced by addParticleEntryAvatar().
void G4INCL::Store::addParticleEntryAvatar | ( | IAvatar * | a | ) |
Add one ParticleEntry avatar.
Definition at line 71 of file G4INCLStore.cc.
References addIncomingParticle(), G4INCL::IAvatar::getID(), and G4INCL::IAvatar::getParticles().
Referenced by addParticleEntryAvatars(), and G4INCL::StandardPropagationModel::shootParticle().
00071 { 00072 // Add the avatar to the avatar map 00073 avatars[a->getID()]=a; 00074 avatarList.push_back(a); 00075 00076 ParticleList pList = a->getParticles(); 00077 for(ParticleIter i = pList.begin(); i != pList.end(); ++i) { 00078 addIncomingParticle((*i)); 00079 // Connect each particle to the avatar 00080 connectParticleAndAvatar((*i)->getID(), a->getID()); 00081 } 00082 }
void G4INCL::Store::addParticleEntryAvatars | ( | IAvatarList const & | al | ) |
Add one ParticleEntry avatar.
Definition at line 84 of file G4INCLStore.cc.
References addParticleEntryAvatar().
Referenced by G4INCL::StandardPropagationModel::shootComposite().
00084 { 00085 for(IAvatarIter a=al.begin(); a!=al.end(); ++a) 00086 addParticleEntryAvatar(*a); 00087 }
void G4INCL::Store::addToOutgoing | ( | ParticleList const & | pl | ) | [inline] |
Add a list of particles to the outgoing particle list.
pl | list of particles to be added |
Definition at line 175 of file G4INCLStore.hh.
References addToOutgoing().
00175 { 00176 for(ParticleIter p=pl.begin(); p!=pl.end(); ++p) 00177 addToOutgoing(*p); 00178 }
void G4INCL::Store::addToOutgoing | ( | Particle * | p | ) | [inline] |
add the particle to the outgoing particle list.
p | pointer to the particle to be added |
Definition at line 169 of file G4INCLStore.hh.
Referenced by addToOutgoing(), G4INCL::Nucleus::applyFinalState(), G4INCL::Nucleus::decayMe(), G4INCL::Nucleus::decayOutgoingClusters(), G4INCL::Nucleus::decayOutgoingDeltas(), G4INCL::Nucleus::emitInsidePions(), G4INCL::Nucleus::finalizeProjectileRemnant(), and G4INCL::Nucleus::moveProjectileRemnantComponentsToOutgoing().
static G4bool G4INCL::Store::avatarComparisonPredicate | ( | IAvatar * | lhs, | |
IAvatar * | rhs | |||
) | [inline, static] |
Comparison predicate for avatars.
avatarComparisonPredicate is used by the std::sort or std::min_element functions to compare the avatar objects according to their time.
lhs | pointer to the first avatar | |
rhs | pointer to the second avatar |
Definition at line 348 of file G4INCLStore.hh.
References G4INCL::IAvatar::getTime().
Referenced by findSmallestTime().
void G4INCL::Store::clear | ( | ) |
Clear all avatars and particles from the store.
Warning! This actually deletes the objects as well!
Definition at line 340 of file G4INCLStore.cc.
References clearAvatars(), clearOutgoing(), and WARN.
Referenced by loadParticles(), and ~Store().
00340 { 00341 clearAvatars(); 00342 inside.clear(); 00343 00344 for(std::map<long, Particle*>::iterator iter = particles.begin(); 00345 iter != particles.end(); ++iter) { 00346 delete (*iter).second; 00347 } 00348 particles.clear(); 00349 00350 clearOutgoing(); 00351 00352 if( incoming.size() != 0 ) { 00353 WARN("Incoming list is not empty when Store::clear() is called" << std::endl); 00354 } 00355 incoming.clear(); 00356 00357 #ifdef INCL_AVATAR_SEARCH_INCLSort 00358 avatarIterList.clear(); 00359 #endif 00360 00361 }
void G4INCL::Store::clearAvatars | ( | ) |
Clear avatars only.
Definition at line 316 of file G4INCLStore.cc.
Referenced by clear(), and G4INCL::StandardPropagationModel::propagate().
00316 { 00317 for(std::map<long, IAvatar*>::iterator iter = avatars.begin(); 00318 iter != avatars.end(); ++iter) { 00319 delete (*iter).second; 00320 } 00321 00322 for(std::map<long, std::vector<long>*>::iterator iter = particleAvatarConnections.begin(); 00323 iter != particleAvatarConnections.end(); ++iter) { 00324 delete (*iter).second; 00325 } 00326 00327 particleAvatarConnections.clear(); 00328 avatars.clear(); 00329 avatarList.clear(); 00330 00331 }
void G4INCL::Store::clearIncoming | ( | ) | [inline] |
Clear the incoming list.
Definition at line 128 of file G4INCLStore.hh.
Referenced by deleteIncoming().
void G4INCL::Store::clearOutgoing | ( | ) |
Clear all outgoing particles from the store.
Warning! This actually deletes the objects as well!
Definition at line 363 of file G4INCLStore.cc.
Referenced by clear().
00363 { 00364 for(ParticleIter iter = outgoing.begin(); iter != outgoing.end(); ++iter) { 00365 if((*iter)->isCluster()) { 00366 Cluster *c = dynamic_cast<Cluster *>(*iter); 00367 // assert(c); 00368 #ifdef INCLXX_IN_GEANT4_MODE 00369 if(!c) 00370 continue; 00371 #endif 00372 c->deleteParticles(); 00373 } 00374 delete (*iter); 00375 } 00376 outgoing.clear(); 00377 }
G4bool G4INCL::Store::containsCollisions | ( | ) | const |
Definition at line 492 of file G4INCLStore.cc.
References G4INCL::CollisionAvatarType.
00492 { 00493 IAvatarIter i; 00494 for(i = avatarList.begin(); i != avatarList.end(); ++i) 00495 if((*i)->getType()==CollisionAvatarType) return true; 00496 return false; 00497 }
G4int G4INCL::Store::countCascading | ( | ) | [inline] |
Definition at line 243 of file G4INCLStore.hh.
References CLHEP::detail::n.
00243 { 00244 G4int n=0; 00245 for(ParticleIter i=inside.begin(); i!=inside.end(); ++i) { 00246 if(!(*i)->isTargetSpectator()) 00247 ++n; 00248 } 00249 return n; 00250 }
void G4INCL::Store::deleteIncoming | ( | ) | [inline] |
Clear the incoming list and delete the particles.
Definition at line 133 of file G4INCLStore.hh.
References clearIncoming().
00133 { 00134 for(ParticleIter iter = incoming.begin(); iter != incoming.end(); ++iter) { 00135 delete (*iter); 00136 } 00137 clearIncoming(); 00138 }
ParticleList G4INCL::Store::extractDynamicalSpectators | ( | ) | [inline] |
Returns a list of dynamical spectators.
Looks in the outgoing list for particles without collisions and decays, removes them from outgoing and returns them in a list.
Definition at line 211 of file G4INCLStore.hh.
00211 { 00212 ParticleList spectators; 00213 std::list<std::list<Particle*>::iterator> toBeErased; 00214 for(std::list<Particle*>::iterator p=outgoing.begin(); p!=outgoing.end(); ++p) { 00215 if((*p)->isProjectileSpectator()) { 00216 // assert((*p)->isNucleon()); 00217 spectators.push_back(*p); // add them to the list we will return 00218 toBeErased.push_back(p); // we will remove them from outgoing later 00219 } 00220 } 00221 00222 // Now erase them from outgoing 00223 for(std::list<std::list<Particle*>::iterator>::iterator i=toBeErased.begin(); 00224 i!=toBeErased.end(); ++i) { 00225 outgoing.erase(*i); 00226 } 00227 00228 return spectators; 00229 }
IAvatar * G4INCL::Store::findSmallestTime | ( | ) |
Find the avatar that has the smallest time.
Definition at line 210 of file G4INCLStore.cc.
References avatarComparisonPredicate(), and G4INCL::IAvatar::getID().
Referenced by G4INCL::StandardPropagationModel::propagate().
00210 { 00211 if(avatarList.empty()) return NULL; 00212 00213 #ifdef INCL_AVATAR_SEARCH_FullSort 00214 00215 /* Full sort algorithm. 00216 * 00217 * Simple, but guaranteed to work. 00218 */ 00219 avatarList.sort(Store::avatarComparisonPredicate); 00220 IAvatar *avatar = avatarList.front(); 00221 00222 #elif defined(INCL_AVATAR_SEARCH_INCLSort) 00223 00224 /* Partial sort algorithm used by INCL4.6. 00225 * 00226 * It nevers sorts the whole avatar list, but rather starts from the last 00227 * best avatar. It requires the avatarList to be updated by appending new 00228 * avatars at the end. 00229 */ 00230 00231 IAvatarIter best; 00232 if(avatarIterList.empty()) 00233 best = avatarList.begin(); 00234 else 00235 best = avatarIterList.back(); 00236 G4double bestTime = (*best)->getTime(); 00237 IAvatarIter a = best; 00238 00239 for(++a; a!=avatarList.end(); ++a) 00240 if((*a)->getTime() < bestTime) { 00241 best = a; 00242 bestTime = (*best)->getTime(); 00243 avatarIterList.push_back(best); 00244 } 00245 IAvatar *avatar = *best; 00246 00247 #elif defined(INCL_AVATAR_SEARCH_MinElement) 00248 00249 /* Algorithm provided by the C++ stdlib. */ 00250 IAvatar *avatar = *(std::min_element(avatarList.begin(), avatarList.end(), 00251 Store::avatarComparisonPredicate)); 00252 00253 #else 00254 #error Unrecognized INCL_AVATAR_SEARCH. Allowed values are: FullSort, INCLSort, MinElement. 00255 #endif 00256 00257 removeAvatarByID(avatar->getID()); 00258 return avatar; 00259 }
IAvatarList const& G4INCL::Store::getAvatars | ( | ) | const [inline] |
Book* G4INCL::Store::getBook | ( | ) | [inline] |
Return the pointer to the Book object which keeps track of various counters.
Definition at line 241 of file G4INCLStore.hh.
Referenced by G4INCL::Nucleus::applyFinalState(), G4INCL::Nucleus::decayOutgoingDeltas(), G4INCL::Nucleus::emitInsidePions(), G4INCL::Nucleus::fillEventInfo(), G4INCL::StandardPropagationModel::generateBinaryCollisionAvatar(), G4INCL::BinaryCollisionAvatar::getChannel(), G4INCL::INCL::initializeTarget(), G4INCL::Nucleus::insertParticle(), G4INCL::PauliStrictStandard::isBlocked(), G4INCL::SurfaceAvatar::postInteraction(), G4INCL::InteractionAvatar::postInteraction(), G4INCL::DecayAvatar::postInteraction(), G4INCL::BinaryCollisionAvatar::postInteraction(), G4INCL::StandardPropagationModel::propagate(), and G4INCL::InteractionAvatar::shouldUseLocalEnergy().
Config const* G4INCL::Store::getConfig | ( | ) | [inline] |
Get the config object
Definition at line 255 of file G4INCLStore.hh.
Referenced by G4INCL::ClusteringModelIntercomparison::getCluster(), G4INCL::InteractionAvatar::postInteraction(), and G4INCL::InteractionAvatar::shouldUseLocalEnergy().
ParticleList const& G4INCL::Store::getIncomingParticles | ( | ) | const [inline] |
Return the list of incoming particles (i.e. particles that have yet to enter the cascade).
Definition at line 196 of file G4INCLStore.hh.
G4int G4INCL::Store::getLoadedA | ( | ) | [inline] |
Get the value of the nucleus mass number that we read from file with loadParticles.
Definition at line 307 of file G4INCLStore.hh.
G4double G4INCL::Store::getLoadedStoppingTime | ( | ) | [inline] |
Get the value of the stopping time that we read from file with loadParticles.
Definition at line 319 of file G4INCLStore.hh.
G4int G4INCL::Store::getLoadedZ | ( | ) | [inline] |
Get the value of the nucleus charge number that we read from file with loadParticles.
Definition at line 313 of file G4INCLStore.hh.
ParticleList const& G4INCL::Store::getOutgoingParticles | ( | ) | const [inline] |
Return the list of outgoing particles (i.e. particles that have left the cascade).
Definition at line 202 of file G4INCLStore.hh.
Referenced by G4INCL::Nucleus::computeRecoilKinematics(), G4INCL::Nucleus::computeSeparationEnergyBalance(), G4INCL::Nucleus::decayOutgoingClusters(), G4INCL::Nucleus::decayOutgoingDeltas(), G4INCL::Nucleus::fillEventInfo(), G4INCL::Nucleus::getConservationBalance(), G4INCL::Nucleus::isEventTransparent(), and G4INCL::Nucleus::print().
ParticleList G4INCL::Store::getParticipants | ( | ) |
Get list of participants (active nucleons).
Warning: This (slow) method may be deprecated in the near future...
Definition at line 292 of file G4INCLStore.cc.
References WARN.
Referenced by G4INCL::Nucleus::dump(), and G4INCL::Nucleus::print().
00292 { 00293 WARN("Store::getParticipants is probably slow..." << std::endl); 00294 ParticleList result; 00295 for(std::map<long, Particle*>::iterator iter = particles.begin(); 00296 iter != particles.end(); ++iter) { 00297 if((*iter).second->isParticipant()) { 00298 result.push_back((*iter).second); 00299 } 00300 } 00301 return result; 00302 }
ParticleList const& G4INCL::Store::getParticles | ( | ) | const [inline] |
Return the list of "active" particles (i.e. particles that can participate in collisions).
Definition at line 235 of file G4INCLStore.hh.
Referenced by G4INCL::Nucleus::computeCenterOfMass(), G4INCL::Nucleus::computeTotalEnergy(), G4INCL::Nucleus::containsDeltas(), G4INCL::Nucleus::decayInsideDeltas(), G4INCL::Nucleus::emitInsidePions(), G4INCL::StandardPropagationModel::generateAllAvatars(), G4INCL::PauliStandard::getBlockingProbability(), G4INCL::ClusteringModelIntercomparison::getCluster(), G4INCL::CDPP::isBlocked(), and G4INCL::StandardPropagationModel::updateAvatars().
ParticleList G4INCL::Store::getSpectators | ( | ) |
Get list of spectators (active nucleons).
Warning: This (slow) method may be deprecated in the near future...
Definition at line 304 of file G4INCLStore.cc.
References WARN.
Referenced by G4INCL::Nucleus::print().
00304 { 00305 WARN("Store::getSpectators is probably slow..." << std::endl); 00306 ParticleList result; 00307 for(std::map<long, Particle*>::iterator iter = particles.begin(); 00308 iter != particles.end(); ++iter) { 00309 if(!(*iter).second->isParticipant()) { 00310 result.push_back((*iter).second); 00311 } 00312 } 00313 return result; 00314 }
void G4INCL::Store::initialiseParticleAvatarConnections | ( | ) |
Initialise the particleAvatarConnections map.
Generate an empty avatar-ID vector for each particle in the inside list and fill in the relevant particle-avatar map entry.
Definition at line 333 of file G4INCLStore.cc.
Referenced by G4INCL::StandardPropagationModel::propagate().
00333 { 00334 for(ParticleIter ip=inside.begin(); ip!=inside.end(); ++ip) { 00335 std::vector<long> *aIDs = new std::vector<long>; 00336 particleAvatarConnections[(*ip)->getID()] = aIDs; 00337 } 00338 }
void G4INCL::Store::loadParticles | ( | std::string | filename | ) |
Load particle configuration from ASCII file (see avatarPredictionTest).
Definition at line 379 of file G4INCLStore.cc.
References add(), clear(), FATAL, G4INCL::Book::incrementCascading(), G4INCL::Particle::makeParticipant(), G4INCL::Neutron, G4INCL::Proton, G4INCL::Particle::setPotentialEnergy(), and G4INCL::UnknownParticle.
00379 { 00380 clear(); 00381 G4int projectileA, projectileZ, A, Z; 00382 G4double stoppingTime, cutNN; 00383 G4int ID, type, isParticipant; 00384 G4double x, y, z; 00385 G4double px, py, pz, E, v; 00386 00387 std::ifstream in(filename.c_str()); 00388 in >> projectileA >> projectileZ >> A >> Z >> stoppingTime >> cutNN; 00389 loadedA = A; 00390 loadedZ = Z; 00391 loadedStoppingTime = stoppingTime; 00392 00393 G4int readA = 0; 00394 G4int readZ = 0; 00395 while(1) { 00396 in >> ID >> type >> isParticipant >> x >> y >> z >> px >> py >> pz >> E >> v; 00397 if(!in.good()) break; 00398 ParticleType t; 00399 if(type == 1) { 00400 t = Proton; 00401 readZ++; 00402 readA++; 00403 } 00404 else if(type == -1) { 00405 t = Neutron; 00406 readA++; 00407 } 00408 else { 00409 FATAL("Unrecognized particle type while loading particles; type=" << type << std::endl); 00410 t = UnknownParticle; 00411 } 00412 00413 Particle *p = new Particle(t, E, ThreeVector(px, py, pz), 00414 ThreeVector(x, y, z)); 00415 p->setPotentialEnergy(v); 00416 if(isParticipant == 1) { 00417 p->makeParticipant(); 00418 theBook->incrementCascading(); 00419 } 00420 add(p); 00421 } 00422 00423 in.close(); 00424 }
void G4INCL::Store::particleHasBeenDestroyed | ( | long | ) |
Remove the particle from the system. This also removes all avatars related to this particle.
Definition at line 278 of file G4INCLStore.cc.
References particleHasBeenUpdated().
Referenced by G4INCL::Nucleus::applyFinalState().
00278 { 00279 particleHasBeenUpdated(ID); 00280 // Have to destroy the particle here, the Store will forget about it 00281 Particle * const toDelete = particles.find(ID)->second; 00282 inside.remove(toDelete); 00283 delete toDelete; 00284 particles.erase(ID); 00285 }
void G4INCL::Store::particleHasBeenEjected | ( | long | ) |
Mark the particle as ejected. This removes it from the list of inside particles and removes all avatars related to this particle.
Definition at line 269 of file G4INCLStore.cc.
References particleHasBeenUpdated().
Referenced by G4INCL::Nucleus::applyFinalState(), and G4INCL::Nucleus::emitInsidePions().
00269 { 00270 particleHasBeenUpdated(ID); 00271 // The particle will be destroyed when destroying the Store 00272 inside.remove(particles.find(ID)->second); 00273 particles.erase(ID); 00274 delete particleAvatarConnections.find(ID)->second; 00275 particleAvatarConnections.erase(ID); 00276 }
void G4INCL::Store::particleHasBeenUpdated | ( | long | ) |
Notify the Store that a particle has been updated. This triggers the removal of obsolete avatars and their disconnection from the particle.
Definition at line 162 of file G4INCLStore.cc.
Referenced by G4INCL::Nucleus::applyFinalState(), particleHasBeenDestroyed(), and particleHasBeenEjected().
00162 { 00163 std::vector<long> temp_aIDs; 00164 std::vector<long> *aIDs = particleAvatarConnections.find(particleID)->second; 00165 for(std::vector<long>::iterator i = aIDs->begin(); 00166 i != aIDs->end(); ++i) { 00167 temp_aIDs.push_back((*i)); 00168 } 00169 00170 for(std::vector<long>::iterator i = temp_aIDs.begin(); 00171 i != temp_aIDs.end(); ++i) { 00172 IAvatar *tmpAvatar = avatars.find(*i)->second; 00173 removeAvatarByID((*i)); 00174 delete tmpAvatar; 00175 } 00176 }
void G4INCL::Store::particleHasEntered | ( | Particle *const | particle | ) |
Move a particle from incoming to inside.
particle | pointer to a particle |
Definition at line 287 of file G4INCLStore.cc.
References add(), and removeFromIncoming().
Referenced by G4INCL::Nucleus::insertParticle().
00287 { 00288 removeFromIncoming(particle); 00289 add(particle); 00290 }
std::string G4INCL::Store::printAvatars | ( | ) |
Print the list of avatars
Definition at line 483 of file G4INCLStore.cc.
00483 { 00484 std::stringstream ss; 00485 IAvatarIter i; 00486 for(i = avatarList.begin(); i != avatarList.end(); ++i) { 00487 ss << (*i)->toString() << std::endl; 00488 } 00489 return ss.str(); 00490 }
std::string G4INCL::Store::printParticleConfiguration | ( | ) |
Print the nucleon configuration of the nucleus.
Definition at line 426 of file G4INCLStore.cc.
References G4INCL::Neutron, and G4INCL::Proton.
Referenced by writeParticles().
00426 { 00427 std::stringstream ss; 00428 G4int A = 0, Z = 0; 00429 for(ParticleIter i = inside.begin(); i != inside.end(); ++i) { 00430 if((*i)->getType() == Proton) { 00431 A++; 00432 Z++; 00433 } 00434 if((*i)->getType() == Neutron) { 00435 A++; 00436 } 00437 } 00438 // Note: Projectile A and Z are set to 0 (we don't really know 00439 // anything about them at this point). 00440 ss << "0 0 " << A << " " << Z << " " 00441 << "100.0" << " " 00442 << "0.0" << std::endl; 00443 00444 for(ParticleIter i = inside.begin(); i != inside.end(); ++i) { 00445 G4int ID = (*i)->getID(); 00446 G4int type = 0; 00447 if((*i)->getType() == Proton) { 00448 type = 1; 00449 } 00450 if((*i)->getType() == Neutron) { 00451 type = -1; 00452 } 00453 00454 G4int isParticipant = 0; 00455 if((*i)->isParticipant()) { 00456 isParticipant = 1; 00457 } 00458 00459 G4double x = (*i)->getPosition().getX(); 00460 G4double y = (*i)->getPosition().getY(); 00461 G4double z = (*i)->getPosition().getZ(); 00462 G4double E = (*i)->getEnergy(); 00463 G4double px = (*i)->getMomentum().getX(); 00464 G4double py = (*i)->getMomentum().getY(); 00465 G4double pz = (*i)->getMomentum().getZ(); 00466 G4double V = (*i)->getPotentialEnergy(); 00467 00468 ss << ID << " " << type << " " << isParticipant << " " 00469 << x << " " << y << " " << z << " " 00470 << px << " " << py << " " << pz << " " 00471 << E << " " << V << std::endl; 00472 } 00473 00474 return ss.str(); 00475 }
void G4INCL::Store::removeFromIncoming | ( | Particle *const | p | ) | [inline] |
Add a particle to the incoming list.
p | particle to add |
Definition at line 125 of file G4INCLStore.hh.
Referenced by particleHasEntered().
void G4INCL::Store::timeStep | ( | G4double | step | ) |
Make one time step: propagate particles and subtract the length of the step from the avatar times.
Definition at line 261 of file G4INCLStore.cc.
Referenced by G4INCL::StandardPropagationModel::propagate().
00261 { 00262 for(std::map<long, Particle*>::iterator particleIter 00263 = particles.begin(); 00264 particleIter != particles.end(); ++particleIter) { 00265 (*particleIter).second->propagate(step); 00266 } 00267 }
void G4INCL::Store::writeParticles | ( | std::string | filename | ) |
Print the nucleon configuration of the nucleus.
Definition at line 477 of file G4INCLStore.cc.
References printParticleConfiguration().
00477 { 00478 std::ofstream out(filename.c_str()); 00479 out << printParticleConfiguration(); 00480 out.close(); 00481 }