Geant4  10.02.p03
G4INCL::Store Class Reference

#include <G4INCLStore.hh>

Collaboration diagram for G4INCL::Store:

Public Member Functions

 Store (Config const *const config)
 
 ~Store ()
 
void add (Particle *p)
 
void add (ParticleList const &pL)
 Add a list of particles 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)
 
IAvatarList const & getAvatars () 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)
 Notify the Store about a particle update. More...
 
void removeScheduledAvatars ()
 Remove avatars that have been scheduled. More...
 
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 const & getIncomingParticles () const
 
ParticleList const & getOutgoingParticles () const
 
ParticleList extractDynamicalSpectators ()
 Returns a list of dynamical spectators. More...
 
ParticleList const & getParticles () const
 
BookgetBook ()
 
G4int countCascading ()
 
Config const * getConfig ()
 
void clear ()
 
void clearInside ()
 
void clearOutgoing ()
 
void clearAvatars ()
 
void loadParticles (std::string const &filename)
 
G4int getLoadedA ()
 
G4int getLoadedZ ()
 
G4double getLoadedStoppingTime ()
 
std::string printParticleConfiguration ()
 
void writeParticles (std::string const &filename)
 
std::string printAvatars ()
 
G4bool containsCollisions () const
 

Static Public Member Functions

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

Private Types

typedef std::multimap< Particle *, IAvatar * >::value_type PAPair
 
typedef std::multimap< Particle *, IAvatar * >::iterator PAIter
 
typedef std::pair< PAIter, PAIterPAIterPair
 
typedef std::set< IAvatar * >::const_iterator ASIter
 

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

Private Attributes

std::multimap< Particle *, IAvatar * > particleAvatarConnections
 
std::set< IAvatar * > avatarsToBeRemoved
 Set of avatars to be removed. More...
 
IAvatarList avatarList
 
ParticleList incoming
 
ParticleList inside
 
ParticleList outgoing
 
ParticleList geomSpectators
 
G4double currentTime
 
Book theBook
 
G4int loadedA
 
G4int loadedZ
 
G4double loadedStoppingTime
 
Config const * theConfig
 

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

Member Typedef Documentation

◆ ASIter

typedef std::set<IAvatar*>::const_iterator G4INCL::Store::ASIter
private

Definition at line 406 of file G4INCLStore.hh.

◆ PAIter

typedef std::multimap<Particle*, IAvatar*>::iterator G4INCL::Store::PAIter
private

Definition at line 401 of file G4INCLStore.hh.

◆ PAIterPair

typedef std::pair<PAIter, PAIter> G4INCL::Store::PAIterPair
private

Definition at line 402 of file G4INCLStore.hh.

◆ PAPair

typedef std::multimap<Particle*, IAvatar*>::value_type G4INCL::Store::PAPair
private

Definition at line 400 of file G4INCLStore.hh.

Constructor & Destructor Documentation

◆ Store() [1/2]

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

Store constructor

Definition at line 45 of file G4INCLStore.cc.

45  :
46  loadedA(0),
47  loadedZ(0),
50  {
51  }
Config const * theConfig
Definition: G4INCLStore.hh:462
G4double loadedStoppingTime
Definition: G4INCLStore.hh:457

◆ ~Store()

G4INCL::Store::~Store ( )

Store destructor

Definition at line 53 of file G4INCLStore.cc.

53  {
54  theBook.reset();
55  clear();
56  }
void reset()
Definition: G4INCLBook.hh:52
Here is the call graph for this function:

◆ Store() [2/2]

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

Dummy copy constructor to shut up Coverity warnings.

Member Function Documentation

◆ add() [1/3]

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

58  {
59  inside.push_back(p);
60  }
ParticleList inside
Definition: G4INCLStore.hh:422
Here is the caller graph for this function:

◆ add() [2/3]

void G4INCL::Store::add ( ParticleList const &  pL)

Add a list of particles to the Store.

This acts as if add(Particle *) was called on each element of the list.

Definition at line 62 of file G4INCLStore.cc.

62  {
63  inside.insert(inside.end(), pL.begin(), pL.end());
64  }
ParticleList inside
Definition: G4INCLStore.hh:422

◆ add() [3/3]

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.

83  {
84  // Add the avatar to the avatar map
85  avatarList.push_back(a);
86 
87  ParticleList pList = a->getParticles();
88  for(ParticleIter i=pList.begin(), e=pList.end(); i!=e; ++i) {
89  // Connect each particle to the avatar
91  }
92 
93  }
void connectAvatarToParticle(IAvatar *const a, Particle *const p)
Connect an avatar to a particle.
Definition: G4INCLStore.cc:99
IAvatarList avatarList
Definition: G4INCLStore.hh:412
ParticleList::const_iterator ParticleIter
Here is the call graph for this function:

◆ addIncomingParticle()

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

Add a particle to the incoming list.

Parameters
pparticle to add

Definition at line 95 of file G4INCLStore.cc.

95  {
96  incoming.push_back(p);
97  }
ParticleList incoming
Definition: G4INCLStore.hh:417
Here is the caller graph for this function:

◆ addParticleEntryAvatar()

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

Add one ParticleEntry avatar.

Definition at line 66 of file G4INCLStore.cc.

66  {
67  // Add the avatar to the avatar map
68  avatarList.push_back(a);
69 
70  ParticleList pList = a->getParticles();
71  for(ParticleIter i=pList.begin(), e=pList.end(); i!=e; ++i) {
72  addIncomingParticle((*i));
73  // Connect each particle to the avatar
75  }
76  }
void connectAvatarToParticle(IAvatar *const a, Particle *const p)
Connect an avatar to a particle.
Definition: G4INCLStore.cc:99
IAvatarList avatarList
Definition: G4INCLStore.hh:412
void addIncomingParticle(Particle *const p)
Definition: G4INCLStore.cc:95
ParticleList::const_iterator ParticleIter
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addParticleEntryAvatars()

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

Add one ParticleEntry avatar.

Definition at line 78 of file G4INCLStore.cc.

78  {
79  for(IAvatarIter a=al.begin(), e=al.end(); a!=e; ++a)
81  }
UnorderedVector< IAvatar * >::const_iterator IAvatarIter
void addParticleEntryAvatar(IAvatar *a)
Add one ParticleEntry avatar.
Definition: G4INCLStore.cc:66
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addToOutgoing() [1/2]

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

190 { outgoing.push_back(p); }
ParticleList outgoing
Definition: G4INCLStore.hh:427
Here is the caller graph for this function:

◆ addToOutgoing() [2/2]

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

196  {
197  for(ParticleIter p=pl.begin(), e=pl.end(); p!=e; ++p)
198  addToOutgoing(*p);
199  }
pl
Definition: readPY.py:5
void addToOutgoing(Particle *p)
add the particle to the outgoing particle list.
Definition: G4INCLStore.hh:190
ParticleList::const_iterator ParticleIter

◆ avatarComparisonPredicate()

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

352  {
353  return (lhs->getTime() < rhs->getTime());
354  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void G4INCL::Store::clear ( void  )

Clear all avatars and particles from the store.

Warning! This actually deletes the objects as well!

Definition at line 203 of file G4INCLStore.cc.

203  {
204  clearAvatars();
205 
206  clearInside();
207  clearOutgoing();
208 
209  if( incoming.size() != 0 ) {
210  INCL_WARN("Incoming list is not empty when Store::clear() is called" << '\n');
211  }
212  incoming.clear();
213 
214  }
void clearAvatars()
Definition: G4INCLStore.cc:193
#define INCL_WARN(x)
void clearInside()
Definition: G4INCLStore.cc:216
void clearOutgoing()
Definition: G4INCLStore.cc:223
ParticleList incoming
Definition: G4INCLStore.hh:417
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearAvatars()

void G4INCL::Store::clearAvatars ( )

Clear avatars only.

Definition at line 193 of file G4INCLStore.cc.

193  {
194  for(IAvatarIter iter = avatarList.begin(), e = avatarList.end(); iter != e; ++iter) {
195  delete *iter;
196  }
197 
199  avatarList.clear();
200  avatarsToBeRemoved.clear();
201  }
UnorderedVector< IAvatar * >::const_iterator IAvatarIter
IAvatarList avatarList
Definition: G4INCLStore.hh:412
std::multimap< Particle *, IAvatar * > particleAvatarConnections
Definition: G4INCLStore.hh:399
std::set< IAvatar * > avatarsToBeRemoved
Set of avatars to be removed.
Definition: G4INCLStore.hh:405
Here is the caller graph for this function:

◆ clearIncoming()

void G4INCL::Store::clearIncoming ( )
inline

Clear the incoming list.

Definition at line 145 of file G4INCLStore.hh.

145  {
146  incoming.clear();
147  }
ParticleList incoming
Definition: G4INCLStore.hh:417
Here is the caller graph for this function:

◆ clearInside()

void G4INCL::Store::clearInside ( )

Clear all inside particles from the store.

Warning! This actually deletes the objects as well!

Definition at line 216 of file G4INCLStore.cc.

216  {
217  for(ParticleIter iter=inside.begin(), e=inside.end(); iter!=e; ++iter) {
218  delete *iter;
219  }
220  inside.clear();
221  }
ParticleList::const_iterator ParticleIter
ParticleList inside
Definition: G4INCLStore.hh:422
Here is the caller graph for this function:

◆ clearOutgoing()

void G4INCL::Store::clearOutgoing ( )

Clear all outgoing particles from the store.

Warning! This actually deletes the objects as well!

Definition at line 223 of file G4INCLStore.cc.

223  {
224  for(ParticleIter iter=outgoing.begin(), e=outgoing.end(); iter!=e; ++iter) {
225  if((*iter)->isCluster()) {
226  Cluster *c = dynamic_cast<Cluster *>(*iter);
227 // assert(c);
228 #ifdef INCLXX_IN_GEANT4_MODE
229  if(!c)
230  continue;
231 #endif
232  c->deleteParticles();
233  }
234  delete (*iter);
235  }
236  outgoing.clear();
237  }
ParticleList outgoing
Definition: G4INCLStore.hh:427
ParticleList::const_iterator ParticleIter
Here is the call graph for this function:
Here is the caller graph for this function:

◆ connectAvatarToParticle()

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

99  {
101  }
std::multimap< Particle *, IAvatar * >::value_type PAPair
Definition: G4INCLStore.hh:400
std::multimap< Particle *, IAvatar * > particleAvatarConnections
Definition: G4INCLStore.hh:399
Here is the caller graph for this function:

◆ containsCollisions()

G4bool G4INCL::Store::containsCollisions ( ) const

Definition at line 351 of file G4INCLStore.cc.

351  {
352  for(IAvatarIter i = avatarList.begin(), e = avatarList.end(); i != e; ++i)
353  if((*i)->getType()==CollisionAvatarType) return true;
354  return false;
355  }
UnorderedVector< IAvatar * >::const_iterator IAvatarIter
IAvatarList avatarList
Definition: G4INCLStore.hh:412

◆ countCascading()

G4int G4INCL::Store::countCascading ( )
inline

Definition at line 261 of file G4INCLStore.hh.

261  {
262  G4int n=0;
263  for(ParticleIter i=inside.begin(), e=inside.end(); i!=e; ++i) {
264  if(!(*i)->isTargetSpectator())
265  ++n;
266  }
267  return n;
268  }
int G4int
Definition: G4Types.hh:78
Char_t n[5]
ParticleList::const_iterator ParticleIter
ParticleList inside
Definition: G4INCLStore.hh:422

◆ deleteIncoming()

void G4INCL::Store::deleteIncoming ( )
inline

Clear the incoming list and delete the particles.

Definition at line 150 of file G4INCLStore.hh.

150  {
151  for(ParticleIter iter=incoming.begin(), e=incoming.end(); iter!=e; ++iter) {
152  delete (*iter);
153  }
154  clearIncoming();
155  }
ParticleList incoming
Definition: G4INCLStore.hh:417
ParticleList::const_iterator ParticleIter
void clearIncoming()
Clear the incoming list.
Definition: G4INCLStore.hh:145
Here is the caller graph for this function:

◆ disconnectAvatarFromParticle()

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

103  {
104  PAIterPair iterPair = particleAvatarConnections.equal_range(p);
105  for(PAIter i=iterPair.first, last=iterPair.second; i!=last; ++i) {
106  if(i->second==a) {
107  particleAvatarConnections.erase(i);
108  return;
109  }
110  }
111  INCL_WARN("Loop in Store::disconnectAvatarFromParticle fell through." << std::endl
112  << "This indicates an inconsistent state of the particleAvatarConnections map." << std::endl);
113  }
#define INCL_WARN(x)
std::pair< PAIter, PAIter > PAIterPair
Definition: G4INCLStore.hh:402
std::multimap< Particle *, IAvatar * >::iterator PAIter
Definition: G4INCLStore.hh:401
std::multimap< Particle *, IAvatar * > particleAvatarConnections
Definition: G4INCLStore.hh:399
Here is the caller graph for this function:

◆ extractDynamicalSpectators()

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

232  {
233  ParticleList spectators;
234  for(ParticleIter p=outgoing.begin(), e=outgoing.end(); p!=e; ++p) {
235  if((*p)->isProjectileSpectator()) {
236 // assert((*p)->isNucleon());
237  spectators.push_back(*p); // add them to the list we will return
238  }
239  }
240 
241  // Now erase them from outgoing
242  for(ParticleIter i=spectators.begin(); i!=spectators.end(); ++i) {
243  outgoing.remove(*i);
244  }
245 
246  return spectators;
247  }
ParticleList outgoing
Definition: G4INCLStore.hh:427
ParticleList::const_iterator ParticleIter
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findSmallestTime()

IAvatar * G4INCL::Store::findSmallestTime ( )

Find the avatar that has the smallest time.

Definition at line 142 of file G4INCLStore.cc.

142  {
143  if(avatarList.empty()) return NULL;
144 
145 #ifdef INCL_AVATAR_SEARCH_FullSort
146 
147  /* Full sort algorithm.
148  *
149  * Simple, but guaranteed to work.
150  */
152  IAvatar *avatar = avatarList.front();
153 
154 #elif defined(INCL_AVATAR_SEARCH_MinElement)
155 
156  /* Algorithm provided by the C++ stdlib. */
157  IAvatar *avatar = *(std::min_element(avatarList.begin(), avatarList.end(),
159 
160 #else
161 #error Unrecognized INCL_AVATAR_SEARCH. Allowed values are: FullSort, MinElement.
162 #endif
163 
164  removeAvatar(avatar);
165  return avatar;
166  }
static G4bool avatarComparisonPredicate(IAvatar *lhs, IAvatar *rhs)
Comparison predicate for avatars.
Definition: G4INCLStore.hh:352
void removeAvatar(IAvatar *const a)
Remove an avatar from the list of avatars.
Definition: G4INCLStore.cc:115
IAvatarList avatarList
Definition: G4INCLStore.hh:412
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAvatars()

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

Return the list of avatars

Definition at line 126 of file G4INCLStore.hh.

126  {
127  return avatarList;
128  }
IAvatarList avatarList
Definition: G4INCLStore.hh:412

◆ getBook()

Book& G4INCL::Store::getBook ( )
inline

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

Definition at line 259 of file G4INCLStore.hh.

259 { return theBook; };
Here is the caller graph for this function:

◆ getConfig()

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

Get the config object

Definition at line 273 of file G4INCLStore.hh.

273 { return theConfig; };
Config const * theConfig
Definition: G4INCLStore.hh:462
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIncomingParticles()

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

217 { return incoming; }
ParticleList incoming
Definition: G4INCLStore.hh:417
Here is the caller graph for this function:

◆ getLoadedA()

G4int G4INCL::Store::getLoadedA ( )
inline

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

Definition at line 311 of file G4INCLStore.hh.

311 { return loadedA; };

◆ getLoadedStoppingTime()

G4double G4INCL::Store::getLoadedStoppingTime ( )
inline

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

Definition at line 323 of file G4INCLStore.hh.

323 { return loadedStoppingTime; };
G4double loadedStoppingTime
Definition: G4INCLStore.hh:457

◆ getLoadedZ()

G4int G4INCL::Store::getLoadedZ ( )
inline

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

Definition at line 317 of file G4INCLStore.hh.

317 { return loadedZ; };

◆ getOutgoingParticles()

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

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

Definition at line 223 of file G4INCLStore.hh.

223 { return outgoing; }
ParticleList outgoing
Definition: G4INCLStore.hh:427
Here is the caller graph for this function:

◆ getParticles()

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

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

Definition at line 253 of file G4INCLStore.hh.

253 { return inside; }
ParticleList inside
Definition: G4INCLStore.hh:422
Here is the caller graph for this function:

◆ loadParticles()

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

Load particle configuration from ASCII file (see avatarPredictionTest).

Definition at line 239 of file G4INCLStore.cc.

239  {
240  clear();
241  G4int projectileA, projectileZ, A, Z;
242  G4double stoppingTime, cutNN;
243  G4int ID, type, isParticipant;
244  G4double x, y, z;
245  G4double px, py, pz, E, v;
246 
247  std::ifstream in(filename.c_str());
248  in >> projectileA >> projectileZ >> A >> Z >> stoppingTime >> cutNN;
249  loadedA = A;
250  loadedZ = Z;
251  loadedStoppingTime = stoppingTime;
252 
253  G4int readA = 0;
254  G4int readZ = 0;
255  while(1) { /* Loop checking, 10.07.2015, D.Mancusi */
256  in >> ID >> type >> isParticipant >> x >> y >> z >> px >> py >> pz >> E >> v;
257  if(!in.good()) break;
258  ParticleType t;
259  if(type == 1) {
260  t = Proton;
261  readZ++;
262  readA++;
263  }
264  else if(type == -1) {
265  t = Neutron;
266  readA++;
267  }
268  else {
269  INCL_FATAL("Unrecognized particle type while loading particles; type=" << type << '\n');
270  t = UnknownParticle;
271  }
272 
273  Particle *p = new Particle(t, E, ThreeVector(px, py, pz),
274  ThreeVector(x, y, z));
275  p->setPotentialEnergy(v);
276  if(isParticipant == 1) {
277  p->makeParticipant();
279  }
280  add(p);
281  }
282 
283  in.close();
284  }
#define INCL_FATAL(x)
ifstream in
Definition: comparison.C:7
void add(Particle *p)
Definition: G4INCLStore.cc:58
int G4int
Definition: G4Types.hh:78
Double_t y
double A(double temperature)
G4double loadedStoppingTime
Definition: G4INCLStore.hh:457
Float_t Z
void incrementCascading()
Definition: G4INCLBook.hh:77
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:

◆ operator=()

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

Dummy assignment operator to shut up Coverity warnings.

◆ particleHasBeenDestroyed()

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

181  {
183  // Have to destroy the particle here, the Store will forget about it
184  inside.remove(p);
185  delete p;
186  }
void particleHasBeenUpdated(Particle *const)
Notify the Store about a particle update.
Definition: G4INCLStore.cc:127
ParticleList inside
Definition: G4INCLStore.hh:422
Here is the call graph for this function:
Here is the caller graph for this function:

◆ particleHasBeenEjected()

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

175  {
177  // The particle will be destroyed when destroying the Store
178  inside.remove(p);
179  }
void particleHasBeenUpdated(Particle *const)
Notify the Store about a particle update.
Definition: G4INCLStore.cc:127
ParticleList inside
Definition: G4INCLStore.hh:422
Here is the call graph for this function:
Here is the caller graph for this function:

◆ particleHasBeenUpdated()

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

Notify the Store about a particle update.

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

Definition at line 127 of file G4INCLStore.cc.

127  {
128  PAIterPair iterPair = particleAvatarConnections.equal_range(particle);
129  for(PAIter i=iterPair.first, last=iterPair.second; i!=last; ++i) {
130  avatarsToBeRemoved.insert(i->second);
131  }
132  }
std::pair< PAIter, PAIter > PAIterPair
Definition: G4INCLStore.hh:402
std::multimap< Particle *, IAvatar * >::iterator PAIter
Definition: G4INCLStore.hh:401
std::multimap< Particle *, IAvatar * > particleAvatarConnections
Definition: G4INCLStore.hh:399
std::set< IAvatar * > avatarsToBeRemoved
Set of avatars to be removed.
Definition: G4INCLStore.hh:405
Here is the caller graph for this function:

◆ particleHasEntered()

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

Move a particle from incoming to inside.

Parameters
particlepointer to a particle

Definition at line 188 of file G4INCLStore.cc.

188  {
189  removeFromIncoming(particle);
190  add(particle);
191  }
void add(Particle *p)
Definition: G4INCLStore.cc:58
void removeFromIncoming(Particle *const p)
Definition: G4INCLStore.hh:142
Here is the call graph for this function:
Here is the caller graph for this function:

◆ printAvatars()

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

Print the list of avatars

Definition at line 343 of file G4INCLStore.cc.

343  {
344  std::stringstream ss;
345  for(IAvatarIter i = avatarList.begin(), e = avatarList.end(); i != e; ++i) {
346  ss << (*i)->toString() << '\n';
347  }
348  return ss.str();
349  }
UnorderedVector< IAvatar * >::const_iterator IAvatarIter
IAvatarList avatarList
Definition: G4INCLStore.hh:412

◆ printParticleConfiguration()

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

Print the nucleon configuration of the nucleus.

Definition at line 286 of file G4INCLStore.cc.

286  {
287  std::stringstream ss;
288  G4int A = 0, Z = 0;
289  for(ParticleIter i=inside.begin(), e=inside.end(); i!=e; ++i) {
290  if((*i)->getType() == Proton) {
291  A++;
292  Z++;
293  }
294  if((*i)->getType() == Neutron) {
295  A++;
296  }
297  }
298  // Note: Projectile A and Z are set to 0 (we don't really know
299  // anything about them at this point).
300  ss << "0 0 " << A << " " << Z << " "
301  << "100.0" << " "
302  << "0.0" << '\n';
303 
304  for(ParticleIter i=inside.begin(), e=inside.end(); i!=e; ++i) {
305  G4int ID = (*i)->getID();
306  G4int type = 0;
307  if((*i)->getType() == Proton) {
308  type = 1;
309  }
310  if((*i)->getType() == Neutron) {
311  type = -1;
312  }
313 
314  G4int isParticipant = 0;
315  if((*i)->isParticipant()) {
316  isParticipant = 1;
317  }
318 
319  G4double x = (*i)->getPosition().getX();
320  G4double y = (*i)->getPosition().getY();
321  G4double z = (*i)->getPosition().getZ();
322  G4double E = (*i)->getEnergy();
323  G4double px = (*i)->getMomentum().getX();
324  G4double py = (*i)->getMomentum().getY();
325  G4double pz = (*i)->getMomentum().getZ();
326  G4double V = (*i)->getPotentialEnergy();
327 
328  ss << ID << " " << type << " " << isParticipant << " "
329  << x << " " << y << " " << z << " "
330  << px << " " << py << " " << pz << " "
331  << E << " " << V << '\n';
332  }
333 
334  return ss.str();
335  }
int G4int
Definition: G4Types.hh:78
Double_t y
double A(double temperature)
Float_t Z
double G4double
Definition: G4Types.hh:76
ParticleList::const_iterator ParticleIter
ParticleList inside
Definition: G4INCLStore.hh:422
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAvatar()

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.

Parameters
athe avatar to remove

Definition at line 115 of file G4INCLStore.cc.

115  {
116  // Disconnect the avatar from particles
117  ParticleList particlesRelatedToAvatar = avatar->getParticles();
118  for(ParticleIter particleIter = particlesRelatedToAvatar.begin(), e = particlesRelatedToAvatar.end();
119  particleIter != e; ++particleIter) {
120  disconnectAvatarFromParticle(avatar, *particleIter);
121  }
122 
123  // Remove the avatar itself
124  avatarList.remove(avatar);
125  }
void disconnectAvatarFromParticle(IAvatar *const a, Particle *const p)
Disconnect an avatar from a particle.
Definition: G4INCLStore.cc:103
IAvatarList avatarList
Definition: G4INCLStore.hh:412
ParticleList::const_iterator ParticleIter
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeFromIncoming()

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

Add a particle to the incoming list.

Parameters
pparticle to add

Definition at line 142 of file G4INCLStore.hh.

142 { incoming.remove(p); }
ParticleList incoming
Definition: G4INCLStore.hh:417
Here is the caller graph for this function:

◆ removeScheduledAvatars()

void G4INCL::Store::removeScheduledAvatars ( )

Remove avatars that have been scheduled.

Definition at line 134 of file G4INCLStore.cc.

134  {
135  for(ASIter a=avatarsToBeRemoved.begin(), e=avatarsToBeRemoved.end(); a!=e; ++a) {
136  removeAvatar(*a);
137  delete *a;
138  }
139  avatarsToBeRemoved.clear();
140  }
void removeAvatar(IAvatar *const a)
Remove an avatar from the list of avatars.
Definition: G4INCLStore.cc:115
std::set< IAvatar * >::const_iterator ASIter
Definition: G4INCLStore.hh:406
std::set< IAvatar * > avatarsToBeRemoved
Set of avatars to be removed.
Definition: G4INCLStore.hh:405
Here is the call graph for this function:
Here is the caller graph for this function:

◆ timeStep()

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

168  {
169  for(ParticleIter particleIter = inside.begin(), particleEnd=inside.end();
170  particleIter != particleEnd; ++particleIter) {
171  (*particleIter)->propagate(step);
172  }
173  }
ParticleList::const_iterator ParticleIter
ParticleList inside
Definition: G4INCLStore.hh:422
Here is the caller graph for this function:

◆ writeParticles()

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

Print the nucleon configuration of the nucleus.

Definition at line 337 of file G4INCLStore.cc.

337  {
338  std::ofstream out(filename.c_str());
340  out.close();
341  }
std::string printParticleConfiguration()
Definition: G4INCLStore.cc:286
Here is the call graph for this function:

Member Data Documentation

◆ avatarList

IAvatarList G4INCL::Store::avatarList
private

List of all avatars

Definition at line 412 of file G4INCLStore.hh.

◆ avatarsToBeRemoved

std::set<IAvatar*> G4INCL::Store::avatarsToBeRemoved
private

Set of avatars to be removed.

Definition at line 405 of file G4INCLStore.hh.

◆ currentTime

G4double G4INCL::Store::currentTime
private

The current time in the simulation

Definition at line 437 of file G4INCLStore.hh.

◆ geomSpectators

ParticleList G4INCL::Store::geomSpectators
private

List of geometrical spectators

Definition at line 432 of file G4INCLStore.hh.

◆ incoming

ParticleList G4INCL::Store::incoming
private

List of incoming particles

Definition at line 417 of file G4INCLStore.hh.

◆ inside

ParticleList G4INCL::Store::inside
private

List of particles that are inside the nucleus

Definition at line 422 of file G4INCLStore.hh.

◆ loadedA

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.

◆ loadedStoppingTime

G4double G4INCL::Store::loadedStoppingTime
private

The stopping time that was loaded from a particle file

Definition at line 457 of file G4INCLStore.hh.

◆ loadedZ

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.

◆ outgoing

ParticleList G4INCL::Store::outgoing
private

List of outgoing particles

Definition at line 427 of file G4INCLStore.hh.

◆ particleAvatarConnections

std::multimap<Particle*, IAvatar*> G4INCL::Store::particleAvatarConnections
private

Map particle -> [avatar]

Definition at line 399 of file G4INCLStore.hh.

◆ theBook

Book G4INCL::Store::theBook
private

The Book object keeps track of global counters

Definition at line 442 of file G4INCLStore.hh.

◆ theConfig

Config const* G4INCL::Store::theConfig
private

Pointer to the Config object

Definition at line 462 of file G4INCLStore.hh.


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