Geant4  10.00.p02
G4INCL::Store Class Reference

The purpose of the Store object is to act as a "particle manager" that keeps track ofall the particles in our simulation. More...

#include <G4INCLStore.hh>

+ Collaboration diagram for G4INCL::Store:

Public Member Functions

 Store (Config const *const config)
 Store constructor. More...
 
 ~Store ()
 Store destructor. More...
 
void add (Particle *p)
 Add one particle to the store. More...
 
void addParticleEntryAvatar (IAvatar *a)
 Add one ParticleEntry avatar. More...
 
void addParticleEntryAvatars (IAvatarList const &al)
 Add one ParticleEntry avatar. More...
 
void add (IAvatar *a)
 Add one avatar to the store. More...
 
IAvatarList const & getAvatars () const
 Return the list of avatars. More...
 
void addIncomingParticle (Particle *const p)
 Add a particle to the incoming list. More...
 
void removeFromIncoming (Particle *const p)
 Add a particle to the incoming list. More...
 
void clearIncoming ()
 Clear the incoming list. More...
 
void deleteIncoming ()
 Clear the incoming list and delete the particles. More...
 
void particleHasBeenUpdated (Particle *const)
 Notify the Store that a particle has been updated. More...
 
IAvatarfindSmallestTime ()
 Find the avatar that has the smallest time. More...
 
void timeStep (G4double step)
 Make one time step: propagate particles and subtract the length of the step from the avatar times. More...
 
void particleHasBeenEjected (Particle *const)
 Mark the particle as ejected. More...
 
void addToOutgoing (Particle *p)
 add the particle to the outgoing particle list. More...
 
void addToOutgoing (ParticleList const &pl)
 Add a list of particles to the outgoing particle list. More...
 
void particleHasBeenDestroyed (Particle *const)
 Remove the particle from the system. More...
 
void particleHasEntered (Particle *const particle)
 Move a particle from incoming to inside. More...
 
ParticleList const & getIncomingParticles () const
 Return the list of incoming particles (i.e. More...
 
ParticleList const & getOutgoingParticles () const
 Return the list of outgoing particles (i.e. More...
 
ParticleList extractDynamicalSpectators ()
 Returns a list of dynamical spectators. More...
 
ParticleList const & getParticles () const
 Return the list of "active" particles (i.e. More...
 
BookgetBook ()
 Return the pointer to the Book object which keeps track of various counters. More...
 
G4int countCascading ()
 
Config const * getConfig ()
 Get the config object. More...
 
void clear ()
 Clear all avatars and particles from the store. More...
 
void clearInside ()
 Clear all inside particles from the store. More...
 
void clearOutgoing ()
 Clear all outgoing particles from the store. More...
 
void clearAvatars ()
 Clear avatars only. More...
 
void initialiseParticleAvatarConnections ()
 Initialise the particleAvatarConnections map. More...
 
void loadParticles (std::string filename)
 Load particle configuration from ASCII file (see avatarPredictionTest). More...
 
G4int getLoadedA ()
 Get the value of the nucleus mass number that we read from file with loadParticles. More...
 
G4int getLoadedZ ()
 Get the value of the nucleus charge number that we read from file with loadParticles. More...
 
G4double getLoadedStoppingTime ()
 Get the value of the stopping time that we read from file with loadParticles. More...
 
std::string printParticleConfiguration ()
 Print the nucleon configuration of the nucleus. More...
 
void writeParticles (std::string filename)
 Print the nucleon configuration of the nucleus. More...
 
std::string printAvatars ()
 Print the list of avatars. More...
 
G4bool containsCollisions () const
 

Static Public Member Functions

static G4bool avatarComparisonPredicate (IAvatar *lhs, IAvatar *rhs)
 Comparison predicate for avatars. More...
 

Private Member Functions

 Store (const Store &rhs)
 Dummy copy constructor to shut up Coverity warnings. More...
 
Storeoperator= (Store const &rhs)
 Dummy assignment operator to shut up Coverity warnings. More...
 
void connectAvatarToParticle (IAvatar *const a, Particle *const p)
 Connect an avatar to a particle. More...
 
void disconnectAvatarFromParticle (IAvatar *const a, Particle *const p)
 Disconnect an avatar from a particle. More...
 
void removeAvatar (IAvatar *const a)
 Remove an avatar from the list of avatars. More...
 
void removeAndDeleteAvatar (IAvatar *const a)
 Remove an avatar from the list of avatars. More...
 

Private Attributes

std::map< Particle
*, IAvatarList * > 
particleAvatarConnections
 Map particle -> [avatar]. More...
 
IAvatarList avatarList
 List of all avatars. More...
 
ParticleList incoming
 List of incoming particles. More...
 
ParticleList inside
 List of particles that are inside the nucleus. More...
 
ParticleList outgoing
 List of outgoing particles. More...
 
ParticleList geomSpectators
 List of geometrical spectators. More...
 
G4double currentTime
 The current time in the simulation. More...
 
Book theBook
 The Book object keeps track of global counters. More...
 
G4int loadedA
 The target nucleus mass number that was loaded from a particle file. More...
 
G4int loadedZ
 The target nucleus charge number that was loaded from a particle file. More...
 
G4double loadedStoppingTime
 The stopping time that was loaded from a particle file. More...
 
Config const * theConfig
 Pointer to the Config object. More...
 

Detailed Description

The purpose of the Store object is to act as a "particle manager" that keeps track ofall the particles in our simulation.

It also tracks the avatars and their connections to particles.

Definition at line 61 of file G4INCLStore.hh.

Constructor & Destructor Documentation

G4INCL::Store::Store ( Config const *const  config)

Store constructor.

Definition at line 44 of file G4INCLStore.cc.

G4INCL::Store::~Store ( )

Store destructor.

Definition at line 52 of file G4INCLStore.cc.

References clear(), G4INCL::Book::reset(), and theBook.

+ Here is the call graph for this function:

G4INCL::Store::Store ( const Store rhs)
private

Dummy copy constructor to shut up Coverity warnings.

Member Function Documentation

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 57 of file G4INCLStore.cc.

References inside, and particleAvatarConnections.

Referenced by G4INCL::Nucleus::applyFinalState(), G4INCL::Nucleus::initializeParticles(), loadParticles(), particleHasEntered(), and G4INCL::StandardPropagationModel::registerAvatar().

+ Here is the caller graph for this function:

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 83 of file G4INCLStore.cc.

References avatarList, connectAvatarToParticle(), and G4INCL::IAvatar::getParticles().

+ Here is the call graph for this function:

void G4INCL::Store::addIncomingParticle ( Particle *const  p)

Add a particle to the incoming list.

Parameters
pparticle to add

Definition at line 100 of file G4INCLStore.cc.

References incoming.

Referenced by addParticleEntryAvatar().

+ Here is the caller graph for this function:

void G4INCL::Store::addParticleEntryAvatar ( IAvatar a)

Add one ParticleEntry avatar.

Definition at line 66 of file G4INCLStore.cc.

References addIncomingParticle(), avatarList, connectAvatarToParticle(), and G4INCL::IAvatar::getParticles().

Referenced by addParticleEntryAvatars(), G4INCL::INCL::makeCompoundNucleus(), and G4INCL::StandardPropagationModel::shootParticle().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4INCL::Store::addParticleEntryAvatars ( IAvatarList const &  al)

Add one ParticleEntry avatar.

Definition at line 78 of file G4INCLStore.cc.

References a, and addParticleEntryAvatar().

Referenced by G4INCL::StandardPropagationModel::shootComposite().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4INCL::Store::addToOutgoing ( Particle p)
inline

add the particle to the outgoing particle list.

Parameters
ppointer to the particle to be added

Definition at line 168 of file G4INCLStore.hh.

References outgoing.

Referenced by addToOutgoing(), G4INCL::Nucleus::applyFinalState(), G4INCL::Nucleus::computeOneNucleonRecoilKinematics(), G4INCL::Nucleus::decayMe(), G4INCL::Nucleus::decayOutgoingClusters(), G4INCL::Nucleus::decayOutgoingDeltas(), G4INCL::Nucleus::emitInsidePions(), and G4INCL::INCL::makeProjectileRemnant().

+ Here is the caller graph for this function:

void G4INCL::Store::addToOutgoing ( ParticleList const &  pl)
inline

Add a list of particles to the outgoing particle list.

Parameters
pllist of particles to be added

Definition at line 174 of file G4INCLStore.hh.

References addToOutgoing().

+ Here is the call graph for this function:

static G4bool G4INCL::Store::avatarComparisonPredicate ( IAvatar lhs,
IAvatar rhs 
)
inlinestatic

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.

Parameters
lhspointer to the first avatar
rhspointer to the second avatar
Returns
true iff lhs' time is smaller than rhs'.

Definition at line 337 of file G4INCLStore.hh.

References G4INCL::IAvatar::getTime().

Referenced by findSmallestTime().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4INCL::Store::clear ( void  )

Clear all avatars and particles from the store.

Warning! This actually deletes the objects as well!

Definition at line 273 of file G4INCLStore.cc.

References clearAvatars(), clearInside(), clearOutgoing(), INCL_WARN, and incoming.

Referenced by loadParticles(), and ~Store().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4INCL::Store::clearAvatars ( )

Clear avatars only.

Definition at line 252 of file G4INCLStore.cc.

References avatarList, and particleAvatarConnections.

Referenced by clear(), and G4INCL::StandardPropagationModel::propagate().

+ Here is the caller graph for this function:

void G4INCL::Store::clearIncoming ( )
inline

Clear the incoming list.

Definition at line 127 of file G4INCLStore.hh.

References incoming.

Referenced by deleteIncoming(), G4INCL::INCL::makeCompoundNucleus(), and G4INCL::INCL::postCascade().

+ Here is the caller graph for this function:

void G4INCL::Store::clearInside ( )

Clear all inside particles from the store.

Warning! This actually deletes the objects as well!

Definition at line 290 of file G4INCLStore.cc.

References inside.

Referenced by clear().

+ Here is the caller graph for this function:

void G4INCL::Store::clearOutgoing ( )

Clear all outgoing particles from the store.

Warning! This actually deletes the objects as well!

Definition at line 297 of file G4INCLStore.cc.

References G4INCL::Cluster::deleteParticles(), and outgoing.

Referenced by clear(), and G4INCL::INCL::makeCompoundNucleus().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4INCL::Store::connectAvatarToParticle ( IAvatar *const  a,
Particle *const  p 
)
private

Connect an avatar to a particle.

Adds the avatar to the list of avatars where the particle appears. This is typically called when the avatar is created.

Parameters
pthe particle
athe avatar

Definition at line 104 of file G4INCLStore.cc.

References particleAvatarConnections.

Referenced by add(), and addParticleEntryAvatar().

+ Here is the caller graph for this function:

G4bool G4INCL::Store::containsCollisions ( ) const

Definition at line 425 of file G4INCLStore.cc.

References avatarList, and G4INCL::CollisionAvatarType.

G4int G4INCL::Store::countCascading ( )
inline

Definition at line 239 of file G4INCLStore.hh.

References inside, and n.

void G4INCL::Store::deleteIncoming ( )
inline

Clear the incoming list and delete the particles.

Definition at line 132 of file G4INCLStore.hh.

References clearIncoming(), and incoming.

Referenced by G4INCL::INCL::postCascade().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4INCL::Store::disconnectAvatarFromParticle ( IAvatar *const  a,
Particle *const  p 
)
private

Disconnect an avatar from a particle.

Removes the avatar from the list of avatars where the particle appears. This is typically called when the avatar has been invalidated or realised.

Parameters
pthe particle
athe avatar

Definition at line 116 of file G4INCLStore.cc.

References particleAvatarConnections.

Referenced by removeAvatar().

+ Here is the caller graph for this function:

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.

Returns
the (possibly empty) list of dynamical spectators

Definition at line 210 of file G4INCLStore.hh.

References outgoing, and G4INCL::UnorderedVector< T >::remove().

Referenced by G4INCL::INCL::makeProjectileRemnant().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

IAvatar * G4INCL::Store::findSmallestTime ( )

Find the avatar that has the smallest time.

Definition at line 173 of file G4INCLStore.cc.

References a, avatarComparisonPredicate(), avatarList, and removeAvatar().

Referenced by G4INCL::StandardPropagationModel::propagate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

IAvatarList const& G4INCL::Store::getAvatars ( ) const
inline

Return the list of avatars.

Definition at line 108 of file G4INCLStore.hh.

References avatarList.

Config const* G4INCL::Store::getConfig ( )
inline

Get the config object.

Definition at line 251 of file G4INCLStore.hh.

References theConfig.

Referenced by G4INCL::SurfaceAvatar::getChannel(), G4INCL::ClusteringModelIntercomparison::getCluster(), G4INCL::SurfaceAvatar::getTransmissionProbability(), G4INCL::ParticleEntryChannel::particleEnters(), G4INCL::InteractionAvatar::postInteraction(), and G4INCL::InteractionAvatar::shouldUseLocalEnergy().

+ Here is the caller graph for this function:

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 195 of file G4INCLStore.hh.

References incoming.

Referenced by G4INCL::INCL::continueCascade().

+ Here is the caller graph for this function:

G4int G4INCL::Store::getLoadedA ( )
inline

Get the value of the nucleus mass number that we read from file with loadParticles.

Definition at line 296 of file G4INCLStore.hh.

References loadedA.

G4double G4INCL::Store::getLoadedStoppingTime ( )
inline

Get the value of the stopping time that we read from file with loadParticles.

Definition at line 308 of file G4INCLStore.hh.

References loadedStoppingTime.

G4int G4INCL::Store::getLoadedZ ( )
inline

Get the value of the nucleus charge number that we read from file with loadParticles.

Definition at line 302 of file G4INCLStore.hh.

References loadedZ.

ParticleList const& G4INCL::Store::getOutgoingParticles ( ) const
inline

Return the list of outgoing particles (i.e.

particles that have left the cascade).

Definition at line 201 of file G4INCLStore.hh.

References outgoing.

Referenced by G4INCL::Nucleus::computeOneNucleonRecoilKinematics(), G4INCL::Nucleus::computeRecoilKinematics(), G4INCL::Nucleus::computeSeparationEnergyBalance(), G4INCL::Nucleus::decayOutgoingClusters(), G4INCL::Nucleus::decayOutgoingDeltas(), G4INCL::Nucleus::fillEventInfo(), G4INCL::Nucleus::getConservationBalance(), G4INCL::INCL::makeCompoundNucleus(), G4INCL::INCL::postCascade(), and G4INCL::Nucleus::print().

+ Here is the caller graph for this function:

ParticleList const& G4INCL::Store::getParticles ( ) const
inline
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 267 of file G4INCLStore.cc.

References inside, and particleAvatarConnections.

Referenced by G4INCL::StandardPropagationModel::propagate().

+ Here is the caller graph for this function:

void G4INCL::Store::loadParticles ( std::string  filename)

Load particle configuration from ASCII file (see avatarPredictionTest).

Definition at line 313 of file G4INCLStore.cc.

References A, add(), clear(), INCL_FATAL, G4INCL::Book::incrementCascading(), loadedA, loadedStoppingTime, loadedZ, G4INCL::Particle::makeParticipant(), G4INCL::Neutron, G4INCL::Proton, G4INCL::Particle::setPotentialEnergy(), theBook, G4INCL::UnknownParticle, and z.

+ Here is the call graph for this function:

Store& G4INCL::Store::operator= ( Store const &  rhs)
private

Dummy assignment operator to shut up Coverity warnings.

void G4INCL::Store::particleHasBeenDestroyed ( Particle * const  p)

Remove the particle from the system.

This also removes all avatars related to this particle.

Definition at line 240 of file G4INCLStore.cc.

References inside, particleHasBeenUpdated(), and G4INCL::UnorderedVector< T >::remove().

Referenced by G4INCL::Nucleus::applyFinalState().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4INCL::Store::particleHasBeenEjected ( Particle * const  p)

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 231 of file G4INCLStore.cc.

References inside, particleAvatarConnections, particleHasBeenUpdated(), and G4INCL::UnorderedVector< T >::remove().

Referenced by G4INCL::Nucleus::applyFinalState(), G4INCL::Nucleus::computeOneNucleonRecoilKinematics(), and G4INCL::Nucleus::emitInsidePions().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4INCL::Store::particleHasBeenUpdated ( Particle * const  particle)

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 144 of file G4INCLStore.cc.

References particleAvatarConnections, and removeAndDeleteAvatar().

Referenced by G4INCL::Nucleus::applyFinalState(), particleHasBeenDestroyed(), and particleHasBeenEjected().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4INCL::Store::particleHasEntered ( Particle *const  particle)

Move a particle from incoming to inside.

Parameters
particlepointer to a particle

Definition at line 247 of file G4INCLStore.cc.

References add(), and removeFromIncoming().

Referenced by G4INCL::Nucleus::insertParticle().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string G4INCL::Store::printAvatars ( )

Print the list of avatars.

Definition at line 417 of file G4INCLStore.cc.

References avatarList.

std::string G4INCL::Store::printParticleConfiguration ( )

Print the nucleon configuration of the nucleus.

Definition at line 360 of file G4INCLStore.cc.

References A, inside, G4INCL::Neutron, G4INCL::Proton, and z.

Referenced by writeParticles().

+ Here is the caller graph for this function:

void G4INCL::Store::removeAndDeleteAvatar ( IAvatar *const  a)
private

Remove an avatar from the list of avatars.

Removes an avatar from the list of all avatars and deletes it.

Parameters
athe avatar to remove and delete

Definition at line 139 of file G4INCLStore.cc.

References removeAvatar().

Referenced by particleHasBeenUpdated().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4INCL::Store::removeAvatar ( IAvatar *const  a)
private

Remove an avatar from the list of avatars.

Removes an avatar from the list of all avatars. The avatar is not deleted. Use removeAndDeleteAvatar for that.

Parameters
athe avatar to remove

Definition at line 120 of file G4INCLStore.cc.

References avatarList, disconnectAvatarFromParticle(), G4INCL::IAvatar::getParticles(), and G4INCL::UnorderedVector< T >::remove().

Referenced by findSmallestTime(), and removeAndDeleteAvatar().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4INCL::Store::removeFromIncoming ( Particle *const  p)
inline

Add a particle to the incoming list.

Parameters
pparticle to add

Definition at line 124 of file G4INCLStore.hh.

References incoming, and G4INCL::UnorderedVector< T >::remove().

Referenced by particleHasEntered().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 224 of file G4INCLStore.cc.

References inside.

Referenced by G4INCL::StandardPropagationModel::propagate().

+ Here is the caller graph for this function:

void G4INCL::Store::writeParticles ( std::string  filename)

Print the nucleon configuration of the nucleus.

Definition at line 411 of file G4INCLStore.cc.

References printParticleConfiguration().

+ Here is the call graph for this function:

Member Data Documentation

IAvatarList G4INCL::Store::avatarList
private
G4double G4INCL::Store::currentTime
private

The current time in the simulation.

Definition at line 437 of file G4INCLStore.hh.

ParticleList G4INCL::Store::geomSpectators
private

List of geometrical spectators.

Definition at line 432 of file G4INCLStore.hh.

ParticleList G4INCL::Store::incoming
private

List of incoming particles.

Definition at line 417 of file G4INCLStore.hh.

Referenced by addIncomingParticle(), clear(), clearIncoming(), deleteIncoming(), getIncomingParticles(), and removeFromIncoming().

ParticleList G4INCL::Store::inside
private
G4int G4INCL::Store::loadedA
private

The target nucleus mass number that was loaded from a particle file.

Definition at line 447 of file G4INCLStore.hh.

Referenced by getLoadedA(), and loadParticles().

G4double G4INCL::Store::loadedStoppingTime
private

The stopping time that was loaded from a particle file.

Definition at line 457 of file G4INCLStore.hh.

Referenced by getLoadedStoppingTime(), and loadParticles().

G4int G4INCL::Store::loadedZ
private

The target nucleus charge number that was loaded from a particle file.

Definition at line 452 of file G4INCLStore.hh.

Referenced by getLoadedZ(), and loadParticles().

ParticleList G4INCL::Store::outgoing
private

List of outgoing particles.

Definition at line 427 of file G4INCLStore.hh.

Referenced by addToOutgoing(), clearOutgoing(), extractDynamicalSpectators(), and getOutgoingParticles().

std::map<Particle*, IAvatarList* > G4INCL::Store::particleAvatarConnections
private
Book G4INCL::Store::theBook
private

The Book object keeps track of global counters.

Definition at line 442 of file G4INCLStore.hh.

Referenced by getBook(), loadParticles(), and ~Store().

Config const* G4INCL::Store::theConfig
private

Pointer to the Config object.

Definition at line 462 of file G4INCLStore.hh.

Referenced by getConfig().


The documentation for this class was generated from the following files: