35#define INCLXX_IN_GEANT4_MODE 1
66 for(std::map<long, Particle*>::const_iterator i=storedComponents.begin(); i!=storedComponents.end(); ++i) {
68 EnergyLevelMap::iterator energyIter = theInitialEnergyLevels.find(i->first);
70 const G4double energyLevel = energyIter->second;
71 theInitialEnergyLevels.erase(energyIter);
72 theInitialEnergyLevels[p->
getID()] = energyLevel;
77 DEBUG(
"ProjectileRemnant object was reset:" << std::endl <<
print());
83 DEBUG(
"The following Particle is about to be removed from the ProjectileRemnant:"
84 << std::endl << p->
print()
85 <<
"theProjectileCorrection=" << theProjectileCorrection << std::endl);
94#if !defined(NDEBUG) && !defined(INCLXX_IN_GEANT4_MODE)
103 const G4double theProjectileCorrectionPerNucleon = theProjectileCorrection /
particles.size();
107 (*i)->setEnergy((*i)->getEnergy() + theProjectileCorrectionPerNucleon);
108 (*i)->setMass((*i)->getInvariantMass());
109#if !defined(NDEBUG) && !defined(INCLXX_IN_GEANT4_MODE)
110 theTotalMomentum += (*i)->getMomentum();
111 theTotalEnergy += (*i)->getEnergy();
117 theEnergy -= oldEnergy - theProjectileCorrection;
121 DEBUG(
"After Particle removal, the ProjectileRemnant looks like this:"
122 << std::endl <<
print());
130 unsigned int accepted;
134 for(
ParticleIter p=toBeAdded.begin(); p!=toBeAdded.end(); ++p) {
135 G4bool isAccepted = addDynamicalSpectator(*p);
141 }
while(accepted > 0);
159 theNewMomentum += getStoredMomentum(*p);
160 theNewEnergy += (*p)->getEnergy();
161 theNewA += (*p)->getA();
162 theNewZ += (*p)->getZ();
167 const G4double theNewInvariantMassSquared = theNewEnergy*theNewEnergy-theNewMomentum.
mag2();
169 G4bool positiveExcitationEnergy =
false;
170 if(theNewInvariantMassSquared>=0.) {
171 const G4double theNewInvariantMass = std::sqrt(theNewInvariantMassSquared);
172 positiveExcitationEnergy = (theNewInvariantMass-theNewMass>-1.e-5);
178 while(!positiveExcitationEnergy && !pL.empty()) {
179 G4double maxExcitationEnergy = -1.E30;
180 ParticleList::iterator best = pL.end();
183 G4int bestA = -1, bestZ = -1;
184 for(ParticleList::iterator p=pL.begin(); p!=pL.end(); ++p) {
187 const ThreeVector theNewerMomentum = theNewMomentum - getStoredMomentum(*p);
188 const G4double theNewerEnergy = theNewEnergy - (*p)->getEnergy();
189 const G4int theNewerA = theNewA - (*p)->getA();
190 const G4int theNewerZ = theNewZ - (*p)->getZ();
193 const G4double theNewerInvariantMassSquared = theNewerEnergy*theNewerEnergy-theNewerMomentum.
mag2();
195 if(theNewerInvariantMassSquared>=-1.e-5) {
196 const G4double theNewerInvariantMass = std::sqrt(std::max(0.,theNewerInvariantMassSquared));
197 const G4double theNewerExcitationEnergy = theNewerInvariantMass-theNewerMass;
200 if(theNewerExcitationEnergy>maxExcitationEnergy) {
202 maxExcitationEnergy = theNewerExcitationEnergy;
203 bestMomentum = theNewerMomentum;
204 bestEnergy = theNewerEnergy;
215 rejected.push_back(*best);
217 theNewMomentum = bestMomentum;
218 theNewEnergy = bestEnergy;
222 if(maxExcitationEnergy>0.) {
224 positiveExcitationEnergy =
true;
240 G4bool ProjectileRemnant::addDynamicalSpectator(
Particle *
const p) {
244 ThreeVector const &oldMomentum = getStoredMomentum(p);
251 const G4double theNewInvariantMassSquared = theNewEnergy*theNewEnergy-theNewMomentum.
mag2();
253 if(theNewInvariantMassSquared<0.)
256 const G4double theNewInvariantMass = std::sqrt(theNewInvariantMassSquared);
258 if(theNewInvariantMass-theNewMass<-1.e-5)
278 const G4double groundState = theGroundStateEnergies.at(
theA-2);
282 const G4double excitedState = std::accumulate(
283 theEnergyLevels.begin(),
284 theEnergyLevels.end(),
287 return excitedState-groundState;
Class for constructing a projectile-like remnant.
void removeParticle(Particle *const p)
Remove a particle from the cluster components.
void addParticle(Particle *const p)
std::string print() const
static NuclearMassFn getTableMass
Static pointer to the mass function for nuclei.
G4INCL::ThreeVector theMomentum
G4double getEnergy() const
G4double thePotentialEnergy
G4int getZ() const
Returns the charge number.
const G4INCL::ThreeVector & getMomentum() const
std::string print() const
void setTableMass()
Set the mass of the Particle to its table mass.
G4int getA() const
Returns the baryon number.
G4INCL::ThreeVector thePosition
G4double computeExcitationEnergy(const long exceptID) const
Compute the excitation energy.
void removeParticle(Particle *const p, const G4double theProjectileCorrection)
Remove a nucleon from the projectile remnant.
ParticleList addMostDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
ParticleList addDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
EnergyLevels getPresentEnergyLevels(const long exceptID) const
void reset()
Reset the projectile remnant to the state at the beginning of the cascade.
std::list< G4INCL::Particle * > ParticleList
G4int shuffleComponentsHelper(G4int range)
Helper function for ProjectileRemnant::shuffleStoredComponents.
std::list< G4INCL::Particle * >::const_iterator ParticleIter