Geant4  10.00.p04
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Store Class Reference

Public Member Functions

 Store (Config const *const config)
 
 ~Store ()
 
void add (Particle *p)
 
void addParticleEntryAvatar (IAvatar *a)
 Add one ParticleEntry avatar. More...
 
void addParticleEntryAvatars (IAvatarList const &al)
 Add one ParticleEntry avatar. More...
 
void add (IAvatar *a)
 
IAvatarList constgetAvatars () const
 
void addIncomingParticle (Particle *const p)
 
void removeFromIncoming (Particle *const p)
 
void clearIncoming ()
 Clear the incoming list. More...
 
void deleteIncoming ()
 Clear the incoming list and delete the particles. More...
 
void particleHasBeenUpdated (Particle *const)
 
IAvatarfindSmallestTime ()
 
void timeStep (G4double step)
 
void particleHasBeenEjected (Particle *const)
 
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)
 
void particleHasEntered (Particle *const particle)
 Move a particle from incoming to inside. More...
 
ParticleList constgetIncomingParticles () const
 
ParticleList constgetOutgoingParticles () const
 
ParticleList extractDynamicalSpectators ()
 Returns a list of dynamical spectators. More...
 
ParticleList constgetParticles () const
 
BookgetBook ()
 
G4int countCascading ()
 
Config constgetConfig ()
 
void clear ()
 
void clearInside ()
 
void clearOutgoing ()
 
void clearAvatars ()
 
void initialiseParticleAvatarConnections ()
 Initialise the particleAvatarConnections map. More...
 
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. 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
 
IAvatarList avatarList
 
ParticleList incoming
 
ParticleList inside
 
ParticleList outgoing
 
ParticleList geomSpectators
 
G4double currentTime
 
Book theBook
 
G4int loadedA
 
G4int loadedZ
 
G4double loadedStoppingTime
 
Config consttheConfig
 

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.

Constructor & Destructor Documentation

Store ( Config const *const  config)

Store constructor

~Store ( )

Store destructor

Store ( const Store rhs)
private

Dummy copy constructor to shut up Coverity warnings.

Member Function Documentation

void 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]
void addParticleEntryAvatar ( IAvatar a)

Add one ParticleEntry avatar.

void addParticleEntryAvatars ( IAvatarList const al)

Add one ParticleEntry avatar.

void 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]
IAvatarList const& getAvatars ( ) const

Return the list of avatars

References Store::avatarList.

void addIncomingParticle ( Particle *const  p)

Add a particle to the incoming list.

Parameters
pparticle to add
void removeFromIncoming ( Particle *const  p)

Add a particle to the incoming list.

Parameters
pparticle to add

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

void clearIncoming ( )

Clear the incoming list.

References Store::incoming.

Referenced by Store::deleteIncoming().

void deleteIncoming ( )

Clear the incoming list and delete the particles.

References Store::clearIncoming(), and Store::incoming.

void particleHasBeenUpdated ( Particle const)

Notify the Store that a particle has been updated. This triggers the removal of obsolete avatars and their disconnection from the particle.

IAvatar* findSmallestTime ( )

Find the avatar that has the smallest time.

void timeStep ( G4double  step)

Make one time step: propagate particles and subtract the length of the step from the avatar times.

void particleHasBeenEjected ( Particle const)

Mark the particle as ejected. This removes it from the list of inside particles and removes all avatars related to this particle.

void addToOutgoing ( Particle p)

add the particle to the outgoing particle list.

Parameters
ppointer to the particle to be added

References Store::outgoing.

Referenced by Store::addToOutgoing().

void addToOutgoing ( ParticleList const pl)

Add a list of particles to the outgoing particle list.

Parameters
pllist of particles to be added

References Store::addToOutgoing().

void particleHasBeenDestroyed ( Particle const)

Remove the particle from the system. This also removes all avatars related to this particle.

void particleHasEntered ( Particle *const  particle)

Move a particle from incoming to inside.

Parameters
particlepointer to a particle

Referenced by Nucleus::insertParticle().

ParticleList const& getIncomingParticles ( ) const

Return the list of incoming particles (i.e. particles that have yet to enter the cascade).

References Store::incoming.

ParticleList const& getOutgoingParticles ( ) const

Return the list of outgoing particles (i.e. particles that have left the cascade).

References Store::outgoing.

Referenced by Nucleus::computeSeparationEnergyBalance().

ParticleList extractDynamicalSpectators ( )

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

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

ParticleList const& getParticles ( ) const

Return the list of "active" particles (i.e. particles that can participate in collisions).

References Store::inside.

Referenced by Nucleus::containsDeltas().

Book& getBook ( )

Return the pointer to the Book object which keeps track of various counters.

References Store::theBook.

Referenced by Nucleus::insertParticle(), and InteractionAvatar::shouldUseLocalEnergy().

G4int countCascading ( )

References Store::inside.

Config const* getConfig ( )

Get the config object

References Store::theConfig.

Referenced by InteractionAvatar::shouldUseLocalEnergy().

void clear ( )

Clear all avatars and particles from the store.

Warning! This actually deletes the objects as well!

void clearInside ( )

Clear all inside particles from the store.

Warning! This actually deletes the objects as well!

void clearOutgoing ( )

Clear all outgoing particles from the store.

Warning! This actually deletes the objects as well!

void clearAvatars ( )

Clear avatars only.

void 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.

void loadParticles ( std::string  filename)

Load particle configuration from ASCII file (see avatarPredictionTest).

G4int getLoadedA ( )

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

References Store::loadedA.

G4int getLoadedZ ( )

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

References Store::loadedZ.

G4double getLoadedStoppingTime ( )

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

References Store::loadedStoppingTime.

std::string printParticleConfiguration ( )

Print the nucleon configuration of the nucleus.

void writeParticles ( std::string  filename)

Print the nucleon configuration of the nucleus.

std::string printAvatars ( )

Print the list of avatars

G4bool containsCollisions ( ) const
static G4bool avatarComparisonPredicate ( IAvatar lhs,
IAvatar rhs 
)
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.

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

References IAvatar::getTime().

Store& operator= ( Store const rhs)
private

Dummy assignment operator to shut up Coverity warnings.

void 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
void 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
void 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
void 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

Member Data Documentation

std::map<Particle*, IAvatarList* > particleAvatarConnections
private

Map particle -> [avatar]

IAvatarList avatarList
private

List of all avatars

Referenced by Store::getAvatars().

ParticleList inside
private

List of particles that are inside the nucleus

Referenced by Store::countCascading(), and Store::getParticles().

ParticleList outgoing
private
ParticleList geomSpectators
private

List of geometrical spectators

G4double currentTime
private

The current time in the simulation

Book theBook
private

The Book object keeps track of global counters

Referenced by Store::getBook().

G4int loadedA
private

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

Referenced by Store::getLoadedA().

G4int loadedZ
private

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

Referenced by Store::getLoadedZ().

G4double loadedStoppingTime
private

The stopping time that was loaded from a particle file

Referenced by Store::getLoadedStoppingTime().

Config const* theConfig
private

Pointer to the Config object

Referenced by Store::getConfig().