34 #define INCLXX_IN_GEANT4_MODE 1
65 const G4double energyLevel = energyIter->second;
79 INCL_DEBUG(
"The following Particle is about to be removed from the ProjectileRemnant:"
81 <<
"theProjectileCorrection=" << theProjectileCorrection <<
'\n');
90 #if !defined(NDEBUG) && !defined(INCLXX_IN_GEANT4_MODE)
99 const G4double theProjectileCorrectionPerNucleon = theProjectileCorrection /
particles.size();
103 (*i)->setEnergy((*i)->getEnergy() + theProjectileCorrectionPerNucleon);
104 (*i)->setMass((*i)->getInvariantMass());
105 #if !defined(NDEBUG) && !defined(INCLXX_IN_GEANT4_MODE)
106 theTotalMomentum += (*i)->getMomentum();
107 theTotalEnergy += (*i)->getEnergy();
113 theEnergy -= oldEnergy - theProjectileCorrection;
117 INCL_DEBUG(
"After Particle removal, the ProjectileRemnant looks like this:"
126 unsigned int accepted;
130 for(
ParticleIter p=toBeAdded.begin(), e=toBeAdded.end(); p!=e; ++p) {
137 }
while(accepted > 0);
151 theNewEnergy += (*p)->getEnergy();
152 theNewA += (*p)->getA();
153 theNewZ += (*p)->getZ();
159 const G4double theNewEffectiveMass = theNewMass + theNewExcitationEnergy;
163 if(theNewEnergy<theNewEffectiveMass) {
164 INCL_WARN(
"Could not add all the dynamical spectators back into the projectile remnant."
165 <<
" Falling back to the \"most\" method." <<
'\n');
176 const G4double scalingFactorSquared = (theNewEnergy*theNewEnergy-theNewEffectiveMass*theNewEffectiveMass)/theNewMomentum.
mag2();
177 const G4double scalingFactor = std::sqrt(scalingFactorSquared);
178 INCL_DEBUG(
"Scaling factor for the projectile-remnant momentum = " << scalingFactor <<
'\n');
203 theNewEnergy += (*p)->getEnergy();
204 theNewA += (*p)->getA();
205 theNewZ += (*p)->getZ();
210 const G4double theNewInvariantMassSquared = theNewEnergy*theNewEnergy-theNewMomentum.
mag2();
212 G4bool positiveExcitationEnergy =
false;
213 if(theNewInvariantMassSquared>=0.) {
214 const G4double theNewInvariantMass = std::sqrt(theNewInvariantMassSquared);
215 positiveExcitationEnergy = (theNewInvariantMass-theNewMass>-1.e-5);
221 while(!positiveExcitationEnergy && !pL.empty()) {
222 G4double maxExcitationEnergy = -1.E30;
226 G4int bestA = -1, bestZ = -1;
227 for(ParticleList::iterator p=pL.begin(), e=pL.end(); p!=e; ++p) {
231 const G4double theNewerEnergy = theNewEnergy - (*p)->getEnergy();
232 const G4int theNewerA = theNewA - (*p)->getA();
233 const G4int theNewerZ = theNewZ - (*p)->getZ();
236 const G4double theNewerInvariantMassSquared = theNewerEnergy*theNewerEnergy-theNewerMomentum.
mag2();
238 if(theNewerInvariantMassSquared>=-1.e-5) {
239 const G4double theNewerInvariantMass = std::sqrt(
std::max(0.,theNewerInvariantMassSquared));
240 const G4double theNewerExcitationEnergy = ((theNewerA>1) ? theNewerInvariantMass-theNewerMass : 0.);
243 if(theNewerExcitationEnergy>maxExcitationEnergy) {
245 maxExcitationEnergy = theNewerExcitationEnergy;
246 bestMomentum = theNewerMomentum;
247 bestEnergy = theNewerEnergy;
258 rejected.push_back(*best);
260 theNewMomentum = bestMomentum;
261 theNewEnergy = bestEnergy;
265 if(maxExcitationEnergy>0.) {
267 positiveExcitationEnergy =
true;
294 const G4double theNewInvariantMassSquared = theNewEnergy*theNewEnergy-theNewMomentum.
mag2();
296 if(theNewInvariantMassSquared<0.)
299 const G4double theNewInvariantMass = std::sqrt(theNewInvariantMassSquared);
301 if(theNewInvariantMass-theNewMass<-1.e-5)
328 const unsigned theNewA = levels.size();
336 const G4double excitedState = std::accumulate(
341 return excitedState-groundState;
347 if((*p)->getID()!=exceptID) {
350 theEnergyLevels.push_back(i->second);
354 return theEnergyLevels;
362 theEnergyLevels.push_back(i->second);
367 theEnergyLevels.push_back(i->second);
371 return theEnergyLevels;
G4int getA() const
Returns the baryon number.
EnergyLevels getPresentEnergyLevelsWith(const ParticleList &pL) const
G4bool addDynamicalSpectator(Particle *const p)
Add back a nucleon to the projectile remnant.
EnergyLevels getPresentEnergyLevelsExcept(const long exceptID) const
const G4INCL::ThreeVector & getMomentum() const
Get the momentum vector.
Class for constructing a projectile-like remnant.
std::string print() const
G4double getEnergy() const
Get the energy of the particle in MeV.
ThreeVector const & getStoredMomentum(Particle const *const p) const
Return the stored momentum of a given projectile component.
void reset()
Reset the projectile remnant to the state at the beginning of the cascade.
G4double mag2() const
Get the square of the length.
G4double computeExcitationEnergyWith(const ParticleList &pL) const
Compute the excitation energy if some nucleons are put back.
std::map< long, Particle * > storedComponents
Return the stored energy of a given projectile component.
std::string print() const
G4int getZ() const
Returns the charge number.
G4double computeExcitationEnergyExcept(const long exceptID) const
Compute the excitation energy when a nucleon is removed.
G4INCL::ThreeVector thePosition
void removeParticle(Particle *const p)
Remove a particle from the cluster components.
ParticleList addDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
ParticleList addAllDynamicalSpectators(ParticleList const &pL)
Add back all dynamical spectators to the projectile remnant.
G4double computeExcitationEnergy(const EnergyLevels &levels) const
Compute the excitation energy for a given configuration.
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4ThreadLocal NuclearMassFn getTableMass
Static pointer to the mass function for nuclei.
void setTableMass()
Set the mass of the Particle to its table mass.
EnergyLevels theGroundStateEnergies
Ground-state energies for any number of nucleons.
ParticleList addMostDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
EnergyLevelMap theInitialEnergyLevels
Initial energy levels of the projectile.
void addParticle(Particle *const p)
Add one particle to the cluster.
std::vector< G4double > EnergyLevels
void removeParticle(Particle *const p, const G4double theProjectileCorrection)
Remove a nucleon from the projectile remnant.
G4INCL::ThreeVector theMomentum
ParticleList::iterator ParticleMutableIter
G4double thePotentialEnergy
ParticleList::const_iterator ParticleIter