Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
G4INCL::Store Class Reference

#include <G4INCLStore.hh>

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

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.

44  :
45  loadedA(0),
46  loadedZ(0),
47  loadedStoppingTime(0.),
48  theConfig(config)
49  {
50  }
G4INCL::Store::~Store ( )

Store destructor

Definition at line 52 of file G4INCLStore.cc.

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

52  {
53  theBook.reset();
54  clear();
55  }
void reset()
Definition: G4INCLBook.hh:51

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.

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

57  {
58  inside.push_back(p);
59 
60  if(particleAvatarConnections.find(p)==particleAvatarConnections.end()) {
61  IAvatarList *avatars = new IAvatarList;
62  particleAvatarConnections[p] = avatars;
63  }
64  }
const char * p
Definition: xmltok.h:285
UnorderedVector< IAvatar * > IAvatarList
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 G4INCL::IAvatar::getParticles().

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  // If one of the particles participating in this avatar hasn't been
90  // registered with the store, it's probably a symptom of a bug
91  // somewhere...
92 // assert(particleAvatarConnections.find(*i) != particleAvatarConnections.end());
93 
94  // Connect each particle to the avatar
95  connectAvatarToParticle(a, *i);
96  }
97 
98  }
UnorderedVector< Particle * > ParticleList
ParticleList::const_iterator ParticleIter
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.

Referenced by addParticleEntryAvatar().

100  {
101  incoming.push_back(p);
102  }
const char * p
Definition: xmltok.h:285
void G4INCL::Store::addParticleEntryAvatar ( IAvatar a)

Add one ParticleEntry avatar.

Definition at line 66 of file G4INCLStore.cc.

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

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

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
74  connectAvatarToParticle(a, *i);
75  }
76  }
UnorderedVector< Particle * > ParticleList
void addIncomingParticle(Particle *const p)
Definition: G4INCLStore.cc:100
ParticleList::const_iterator ParticleIter
void G4INCL::Store::addParticleEntryAvatars ( IAvatarList const &  al)

Add one ParticleEntry avatar.

Definition at line 78 of file G4INCLStore.cc.

References test::a, and addParticleEntryAvatar().

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

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

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

168 { outgoing.push_back(p); }
const char * p
Definition: xmltok.h:285
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().

174  {
175  for(ParticleIter p=pl.begin(), e=pl.end(); p!=e; ++p)
176  addToOutgoing(*p);
177  }
const char * p
Definition: xmltok.h:285
tuple pl
Definition: readPY.py:5
void addToOutgoing(Particle *p)
add the particle to the outgoing particle list.
Definition: G4INCLStore.hh:168
ParticleList::const_iterator ParticleIter
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().

337  {
338  return (lhs->getTime() < rhs->getTime());
339  }
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(), and INCL_WARN.

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

273  {
274  clearAvatars();
275 
276  clearInside();
277  clearOutgoing();
278 
279  if( incoming.size() != 0 ) {
280  INCL_WARN("Incoming list is not empty when Store::clear() is called" << std::endl);
281  }
282  incoming.clear();
283 
284 #ifdef INCL_AVATAR_SEARCH_INCLSort
285  avatarIterList.clear();
286 #endif
287 
288  }
void clearAvatars()
Definition: G4INCLStore.cc:252
#define INCL_WARN(x)
void clearInside()
Definition: G4INCLStore.cc:290
void clearOutgoing()
Definition: G4INCLStore.cc:297
void G4INCL::Store::clearAvatars ( )

Clear avatars only.

Definition at line 252 of file G4INCLStore.cc.

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

252  {
253  for(IAvatarIter iter = avatarList.begin(), e = avatarList.end(); iter != e; ++iter) {
254  delete *iter;
255  }
256 
257  for(std::map<Particle*, IAvatarList*>::iterator iter = particleAvatarConnections.begin(),
258  e = particleAvatarConnections.end(); iter != e; ++iter) {
259  delete iter->second;
260  }
261 
262  particleAvatarConnections.clear();
263  avatarList.clear();
264 
265  }
UnorderedVector< IAvatar * >::const_iterator IAvatarIter
void G4INCL::Store::clearIncoming ( )
inline

Clear the incoming list.

Definition at line 127 of file G4INCLStore.hh.

Referenced by deleteIncoming().

127  {
128  incoming.clear();
129  }
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.

Referenced by clear().

290  {
291  for(ParticleIter iter=inside.begin(), e=inside.end(); iter!=e; ++iter) {
292  delete *iter;
293  }
294  inside.clear();
295  }
ParticleList::const_iterator ParticleIter
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 test::c, and G4INCL::Cluster::deleteParticles().

Referenced by clear().

297  {
298  for(ParticleIter iter=outgoing.begin(), e=outgoing.end(); iter!=e; ++iter) {
299  if((*iter)->isCluster()) {
300  Cluster *c = dynamic_cast<Cluster *>(*iter);
301 // assert(c);
302 #ifdef INCLXX_IN_GEANT4_MODE
303  if(!c)
304  continue;
305 #endif
306  c->deleteParticles();
307  }
308  delete (*iter);
309  }
310  outgoing.clear();
311  }
ParticleList::const_iterator ParticleIter
G4bool G4INCL::Store::containsCollisions ( ) const

Definition at line 425 of file G4INCLStore.cc.

References G4INCL::CollisionAvatarType.

425  {
426  for(IAvatarIter i = avatarList.begin(), e = avatarList.end(); i != e; ++i)
427  if((*i)->getType()==CollisionAvatarType) return true;
428  return false;
429  }
UnorderedVector< IAvatar * >::const_iterator IAvatarIter
G4int G4INCL::Store::countCascading ( )
inline

Definition at line 239 of file G4INCLStore.hh.

References n.

239  {
240  G4int n=0;
241  for(ParticleIter i=inside.begin(), e=inside.end(); i!=e; ++i) {
242  if(!(*i)->isTargetSpectator())
243  ++n;
244  }
245  return n;
246  }
int G4int
Definition: G4Types.hh:78
const G4int n
ParticleList::const_iterator ParticleIter
void G4INCL::Store::deleteIncoming ( )
inline

Clear the incoming list and delete the particles.

Definition at line 132 of file G4INCLStore.hh.

References clearIncoming().

132  {
133  for(ParticleIter iter=incoming.begin(), e=incoming.end(); iter!=e; ++iter) {
134  delete (*iter);
135  }
136  clearIncoming();
137  }
ParticleList::const_iterator ParticleIter
void clearIncoming()
Clear the incoming list.
Definition: G4INCLStore.hh:127
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 G4INCL::UnorderedVector< T >::remove().

210  {
211  ParticleList spectators;
212  for(ParticleIter p=outgoing.begin(), e=outgoing.end(); p!=e; ++p) {
213  if((*p)->isProjectileSpectator()) {
214 // assert((*p)->isNucleon());
215  spectators.push_back(*p); // add them to the list we will return
216  }
217  }
218 
219  // Now erase them from outgoing
220  for(ParticleIter i=spectators.begin(); i!=spectators.end(); ++i) {
221  outgoing.remove(*i);
222  }
223 
224  return spectators;
225  }
const char * p
Definition: xmltok.h:285
void remove(const T &t)
UnorderedVector< Particle * > ParticleList
ParticleList::const_iterator ParticleIter
IAvatar * G4INCL::Store::findSmallestTime ( )

Find the avatar that has the smallest time.

Definition at line 173 of file G4INCLStore.cc.

References test::a, and avatarComparisonPredicate().

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

173  {
174  if(avatarList.empty()) return NULL;
175 
176 #ifdef INCL_AVATAR_SEARCH_FullSort
177 
178  /* Full sort algorithm.
179  *
180  * Simple, but guaranteed to work.
181  */
182  avatarList.sort(Store::avatarComparisonPredicate);
183  IAvatar *avatar = avatarList.front();
184 
185 #elif defined(INCL_AVATAR_SEARCH_INCLSort)
186 
187  /* Partial sort algorithm used by INCL4.6.
188  *
189  * It nevers sorts the whole avatar list, but rather starts from the last
190  * best avatar. It requires the avatarList to be updated by appending new
191  * avatars at the end.
192  */
193 
194  IAvatarIter best;
195  if(avatarIterList.empty())
196  best = avatarList.begin();
197  else
198  best = avatarIterList.back();
199  G4double bestTime = (*best)->getTime();
200  IAvatarIter a = best;
201 
202  for(++a; a!=avatarList.end(); ++a)
203  if((*a)->getTime() < bestTime) {
204  best = a;
205  bestTime = (*best)->getTime();
206  avatarIterList.push_back(best);
207  }
208  IAvatar *avatar = *best;
209 
210 #elif defined(INCL_AVATAR_SEARCH_MinElement)
211 
212  /* Algorithm provided by the C++ stdlib. */
213  IAvatar *avatar = *(std::min_element(avatarList.begin(), avatarList.end(),
215 
216 #else
217 #error Unrecognized INCL_AVATAR_SEARCH. Allowed values are: FullSort, INCLSort, MinElement.
218 #endif
219 
220  removeAvatar(avatar);
221  return avatar;
222  }
static G4bool avatarComparisonPredicate(IAvatar *lhs, IAvatar *rhs)
Comparison predicate for avatars.
Definition: G4INCLStore.hh:337
UnorderedVector< IAvatar * >::const_iterator IAvatarIter
double G4double
Definition: G4Types.hh:76
IAvatarList const& G4INCL::Store::getAvatars ( ) const
inline

Return the list of avatars

Definition at line 108 of file G4INCLStore.hh.

108  {
109  return avatarList;
110  }
Book& G4INCL::Store::getBook ( )
inline
Config const* G4INCL::Store::getConfig ( )
inline
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.

195 { return incoming; }
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.

296 { return 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.

308 { return 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.

302 { return loadedZ; };
ParticleList const& G4INCL::Store::getOutgoingParticles ( ) const
inline
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.

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

267  {
268  for(ParticleIter ip=inside.begin(), e=inside.end(); ip!=e; ++ip) {
269  particleAvatarConnections[*ip] = new IAvatarList;
270  }
271  }
UnorderedVector< IAvatar * > IAvatarList
ParticleList::const_iterator ParticleIter
void G4INCL::Store::loadParticles ( std::string  filename)

Load particle configuration from ASCII file (see avatarPredictionTest).

Definition at line 313 of file G4INCLStore.cc.

References add(), clear(), INCL_FATAL, G4INCL::Book::incrementCascading(), G4INCL::Particle::makeParticipant(), G4INCL::Neutron, G4INCL::Proton, G4INCL::Particle::setPotentialEnergy(), G4INCL::UnknownParticle, test::v, test::x, and z.

313  {
314  clear();
315  G4int projectileA, projectileZ, A, Z;
316  G4double stoppingTime, cutNN;
317  G4int ID, type, isParticipant;
318  G4double x, y, z;
319  G4double px, py, pz, E, v;
320 
321  std::ifstream in(filename.c_str());
322  in >> projectileA >> projectileZ >> A >> Z >> stoppingTime >> cutNN;
323  loadedA = A;
324  loadedZ = Z;
325  loadedStoppingTime = stoppingTime;
326 
327  G4int readA = 0;
328  G4int readZ = 0;
329  while(1) {
330  in >> ID >> type >> isParticipant >> x >> y >> z >> px >> py >> pz >> E >> v;
331  if(!in.good()) break;
332  ParticleType t;
333  if(type == 1) {
334  t = Proton;
335  readZ++;
336  readA++;
337  }
338  else if(type == -1) {
339  t = Neutron;
340  readA++;
341  }
342  else {
343  INCL_FATAL("Unrecognized particle type while loading particles; type=" << type << std::endl);
344  t = UnknownParticle;
345  }
346 
347  Particle *p = new Particle(t, E, ThreeVector(px, py, pz),
348  ThreeVector(x, y, z));
349  p->setPotentialEnergy(v);
350  if(isParticipant == 1) {
351  p->makeParticipant();
352  theBook.incrementCascading();
353  }
354  add(p);
355  }
356 
357  in.close();
358  }
#define INCL_FATAL(x)
G4double z
Definition: TRTMaterials.hh:39
const char * p
Definition: xmltok.h:285
void add(Particle *p)
Definition: G4INCLStore.cc:57
int G4int
Definition: G4Types.hh:78
void incrementCascading()
Definition: G4INCLBook.hh:76
double G4double
Definition: G4Types.hh:76
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 particleHasBeenUpdated(), and G4INCL::UnorderedVector< T >::remove().

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

240  {
242  // Have to destroy the particle here, the Store will forget about it
243  inside.remove(p);
244  delete p;
245  }
const char * p
Definition: xmltok.h:285
void remove(const T &t)
void particleHasBeenUpdated(Particle *const)
Definition: G4INCLStore.cc:144
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 particleHasBeenUpdated(), and G4INCL::UnorderedVector< T >::remove().

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

231  {
233  // The particle will be destroyed when destroying the Store
234  inside.remove(p);
235  std::map<Particle*, IAvatarList*>::iterator mapItem = particleAvatarConnections.find(p);
236  delete mapItem->second;
237  particleAvatarConnections.erase(mapItem);
238  }
const char * p
Definition: xmltok.h:285
void remove(const T &t)
void particleHasBeenUpdated(Particle *const)
Definition: G4INCLStore.cc:144
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.

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

144  {
145  // must make a copy of this list, because calls to removeAvatar will modify
146  // the list itself
147  IAvatarList avatars = *(particleAvatarConnections.find(particle)->second);
148  std::for_each(avatars.begin(), avatars.end(), std::bind1st(std::mem_fun(&G4INCL::Store::removeAndDeleteAvatar), this));
149  }
UnorderedVector< IAvatar * > IAvatarList
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().

247  {
248  removeFromIncoming(particle);
249  add(particle);
250  }
void add(Particle *p)
Definition: G4INCLStore.cc:57
void removeFromIncoming(Particle *const p)
Definition: G4INCLStore.hh:124
std::string G4INCL::Store::printAvatars ( )

Print the list of avatars

Definition at line 417 of file G4INCLStore.cc.

417  {
418  std::stringstream ss;
419  for(IAvatarIter i = avatarList.begin(), e = avatarList.end(); i != e; ++i) {
420  ss << (*i)->toString() << std::endl;
421  }
422  return ss.str();
423  }
UnorderedVector< IAvatar * >::const_iterator IAvatarIter
std::string G4INCL::Store::printParticleConfiguration ( )

Print the nucleon configuration of the nucleus.

Definition at line 360 of file G4INCLStore.cc.

References G4INCL::Neutron, G4INCL::Proton, test::x, and z.

Referenced by writeParticles().

360  {
361  std::stringstream ss;
362  G4int A = 0, Z = 0;
363  for(ParticleIter i=inside.begin(), e=inside.end(); i!=e; ++i) {
364  if((*i)->getType() == Proton) {
365  A++;
366  Z++;
367  }
368  if((*i)->getType() == Neutron) {
369  A++;
370  }
371  }
372  // Note: Projectile A and Z are set to 0 (we don't really know
373  // anything about them at this point).
374  ss << "0 0 " << A << " " << Z << " "
375  << "100.0" << " "
376  << "0.0" << std::endl;
377 
378  for(ParticleIter i=inside.begin(), e=inside.end(); i!=e; ++i) {
379  G4int ID = (*i)->getID();
380  G4int type = 0;
381  if((*i)->getType() == Proton) {
382  type = 1;
383  }
384  if((*i)->getType() == Neutron) {
385  type = -1;
386  }
387 
388  G4int isParticipant = 0;
389  if((*i)->isParticipant()) {
390  isParticipant = 1;
391  }
392 
393  G4double x = (*i)->getPosition().getX();
394  G4double y = (*i)->getPosition().getY();
395  G4double z = (*i)->getPosition().getZ();
396  G4double E = (*i)->getEnergy();
397  G4double px = (*i)->getMomentum().getX();
398  G4double py = (*i)->getMomentum().getY();
399  G4double pz = (*i)->getMomentum().getZ();
400  G4double V = (*i)->getPotentialEnergy();
401 
402  ss << ID << " " << type << " " << isParticipant << " "
403  << x << " " << y << " " << z << " "
404  << px << " " << py << " " << pz << " "
405  << E << " " << V << std::endl;
406  }
407 
408  return ss.str();
409  }
G4double z
Definition: TRTMaterials.hh:39
int G4int
Definition: G4Types.hh:78
double G4double
Definition: G4Types.hh:76
ParticleList::const_iterator ParticleIter
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 G4INCL::UnorderedVector< T >::remove().

Referenced by particleHasEntered().

124 { incoming.remove(p); }
const char * p
Definition: xmltok.h:285
void remove(const T &t)
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.

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

224  {
225  for(ParticleIter particleIter = inside.begin(), particleEnd=inside.end();
226  particleIter != particleEnd; ++particleIter) {
227  (*particleIter)->propagate(step);
228  }
229  }
ParticleList::const_iterator ParticleIter
void G4INCL::Store::writeParticles ( std::string  filename)

Print the nucleon configuration of the nucleus.

Definition at line 411 of file G4INCLStore.cc.

References printParticleConfiguration().

411  {
412  std::ofstream out(filename.c_str());
414  out.close();
415  }
std::string printParticleConfiguration()
Definition: G4INCLStore.cc:360

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