34 #define INCLXX_IN_GEANT4_MODE 1
48 loadedStoppingTime(0.),
71 for(
ParticleIter i=pList.begin(), e=pList.end(); i!=e; ++i) {
88 for(
ParticleIter i=pList.begin(), e=pList.end(); i!=e; ++i) {
105 for(
PAIter i=iterPair.first, last=iterPair.second; i!=last; ++i) {
111 INCL_WARN(
"Loop in Store::disconnectAvatarFromParticle fell through." << std::endl
112 <<
"This indicates an inconsistent state of the particleAvatarConnections map." << std::endl);
118 for(
ParticleIter particleIter = particlesRelatedToAvatar.begin(), e = particlesRelatedToAvatar.end();
119 particleIter != e; ++particleIter) {
129 for(
PAIter i=iterPair.first, last=iterPair.second; i!=last; ++i) {
145 #ifdef INCL_AVATAR_SEARCH_FullSort
154 #elif defined(INCL_AVATAR_SEARCH_MinElement)
161 #error Unrecognized INCL_AVATAR_SEARCH. Allowed values are: FullSort, MinElement.
170 particleIter != particleEnd; ++particleIter) {
171 (*particleIter)->propagate(step);
210 INCL_WARN(
"Incoming list is not empty when Store::clear() is called" <<
'\n');
225 if((*iter)->isCluster()) {
228 #ifdef INCLXX_IN_GEANT4_MODE
241 G4int projectileA, projectileZ,
A, Z;
243 G4int ID, type, isParticipant;
247 std::ifstream in(filename.c_str());
248 in >> projectileA >> projectileZ >> A >> Z >> stoppingTime >> cutNN;
256 in >> ID >> type >> isParticipant >> x >> y >> z >> px >> py >> pz >> E >> v;
257 if(!in.good())
break;
264 else if(type == -1) {
269 INCL_FATAL(
"Unrecognized particle type while loading particles; type=" << type <<
'\n');
276 if(isParticipant == 1) {
287 std::stringstream ss;
290 if((*i)->getType() ==
Proton) {
294 if((*i)->getType() ==
Neutron) {
300 ss <<
"0 0 " << A <<
" " << Z <<
" "
305 G4int ID = (*i)->getID();
307 if((*i)->getType() ==
Proton) {
310 if((*i)->getType() ==
Neutron) {
314 G4int isParticipant = 0;
315 if((*i)->isParticipant()) {
320 G4double y = (*i)->getPosition().getY();
323 G4double px = (*i)->getMomentum().getX();
324 G4double py = (*i)->getMomentum().getY();
325 G4double pz = (*i)->getMomentum().getZ();
326 G4double V = (*i)->getPotentialEnergy();
328 ss << ID <<
" " << type <<
" " << isParticipant <<
" "
329 << x <<
" " << y <<
" " << z <<
" "
330 << px <<
" " << py <<
" " << pz <<
" "
331 << E <<
" " << V <<
'\n';
338 std::ofstream out(filename.c_str());
344 std::stringstream ss;
346 ss << (*i)->toString() <<
'\n';
std::string printParticleConfiguration()
Print the nucleon configuration of the nucleus.
void clearAvatars()
Clear avatars only.
The INCL configuration object.
static G4bool avatarComparisonPredicate(IAvatar *lhs, IAvatar *rhs)
Comparison predicate for avatars.
void disconnectAvatarFromParticle(IAvatar *const a, Particle *const p)
Disconnect an avatar from a particle.
std::string printAvatars()
Print the list of avatars.
G4bool containsCollisions() const
UnorderedVector< IAvatar * >::const_iterator IAvatarIter
IAvatar * findSmallestTime()
Find the avatar that has the smallest time.
void add(Particle *p)
Add one particle to the store.
ParticleList outgoing
List of outgoing particles.
std::multimap< Particle *, IAvatar * >::value_type PAPair
G4int loadedA
The target nucleus mass number that was loaded from a particle file.
Store(Config const *const config)
Store constructor.
Cluster is a particle (inherits from the Particle class) that is actually a collection of elementary ...
void connectAvatarToParticle(IAvatar *const a, Particle *const p)
Connect an avatar to a particle.
void removeAvatar(IAvatar *const a)
Remove an avatar from the list of avatars.
std::set< IAvatar * >::const_iterator ASIter
IAvatarList avatarList
List of all avatars.
void clear()
Clear all avatars and particles from the store.
void addParticleEntryAvatars(IAvatarList const &al)
Add one ParticleEntry avatar.
void removeScheduledAvatars()
Remove avatars that have been scheduled.
double A(double temperature)
G4double loadedStoppingTime
The stopping time that was loaded from a particle file.
void particleHasBeenDestroyed(Particle *const)
Remove the particle from the system.
void particleHasBeenEjected(Particle *const)
Mark the particle as ejected.
void loadParticles(std::string const &filename)
Load particle configuration from ASCII file (see avatarPredictionTest).
virtual ParticleList getParticles() const =0
void setPotentialEnergy(G4double v)
Set the particle potential energy.
void clearInside()
Clear all inside particles from the store.
std::pair< PAIter, PAIter > PAIterPair
void clearOutgoing()
Clear all outgoing particles from the store.
void incrementCascading()
void addParticleEntryAvatar(IAvatar *a)
Add one ParticleEntry avatar.
void particleHasBeenUpdated(Particle *const)
Notify the Store about a particle update.
std::multimap< Particle *, IAvatar * >::iterator PAIter
ParticleList incoming
List of incoming particles.
const G4double x[NPOINTSGL]
void addIncomingParticle(Particle *const p)
Add a particle to the incoming list.
std::multimap< Particle *, IAvatar * > particleAvatarConnections
Map particle -> [avatar].
void writeParticles(std::string const &filename)
Print the nucleon configuration of the nucleus.
virtual void makeParticipant()
~Store()
Store destructor.
G4int loadedZ
The target nucleus charge number that was loaded from a particle file.
std::set< IAvatar * > avatarsToBeRemoved
Set of avatars to be removed.
Book theBook
The Book object keeps track of global counters.
void timeStep(G4double step)
Make one time step: propagate particles and subtract the length of the step from the avatar times...
ParticleList::const_iterator ParticleIter
void removeFromIncoming(Particle *const p)
Add a particle to the incoming list.
void particleHasEntered(Particle *const particle)
Move a particle from incoming to inside.
ParticleList inside
List of particles that are inside the nucleus.