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');
91#if !defined(NDEBUG) && !defined(INCLXX_IN_GEANT4_MODE)
100 const G4double theProjectileCorrectionPerNucleon = theProjectileCorrection /
particles.size();
104 (*i)->setEnergy((*i)->getEnergy() + theProjectileCorrectionPerNucleon);
105 (*i)->setMass((*i)->getInvariantMass());
106#if !defined(NDEBUG) && !defined(INCLXX_IN_GEANT4_MODE)
107 theTotalMomentum += (*i)->getMomentum();
108 theTotalEnergy += (*i)->getEnergy();
114 theEnergy -= oldEnergy - theProjectileCorrection;
118 INCL_DEBUG(
"After Particle removal, the ProjectileRemnant looks like this:"
127 unsigned int accepted;
128 unsigned long loopCounter = 0;
129 const unsigned long maxLoopCounter = 10000000;
133 for(
ParticleIter p=toBeAdded.begin(), e=toBeAdded.end(); p!=e; ++p) {
141 }
while(loopCounter<maxLoopCounter && accepted > 0);
156 theNewEnergy += (*p)->getEnergy();
157 theNewA += (*p)->getA();
158 theNewZ += (*p)->getZ();
159 theNewS += (*p)->getS();
165 const G4double theNewEffectiveMass = theNewMass + theNewExcitationEnergy;
169 if(theNewEnergy<theNewEffectiveMass) {
170 INCL_WARN(
"Could not add all the dynamical spectators back into the projectile remnant."
171 <<
" Falling back to the \"most\" method." <<
'\n');
182 const G4double scalingFactorSquared = (theNewEnergy*theNewEnergy-theNewEffectiveMass*theNewEffectiveMass)/theNewMomentum.
mag2();
183 const G4double scalingFactor = std::sqrt(scalingFactorSquared);
184 INCL_DEBUG(
"Scaling factor for the projectile-remnant momentum = " << scalingFactor <<
'\n');
211 theNewEnergy += (*p)->getEnergy();
212 theNewA += (*p)->getA();
213 theNewZ += (*p)->getZ();
214 theNewS += (*p)->getS();
219 const G4double theNewInvariantMassSquared = theNewEnergy*theNewEnergy-theNewMomentum.
mag2();
221 G4bool positiveExcitationEnergy =
false;
222 if(theNewInvariantMassSquared>=0.) {
223 const G4double theNewInvariantMass = std::sqrt(theNewInvariantMassSquared);
224 positiveExcitationEnergy = (theNewInvariantMass-theNewMass>-1.e-5);
230 while(!positiveExcitationEnergy && !pL.empty()) {
231 G4double maxExcitationEnergy = -1.E30;
235 G4int bestA = -1, bestZ = -1, bestS = 0;
236 for(ParticleList::iterator p=pL.begin(), e=pL.end(); p!=e; ++p) {
240 const G4double theNewerEnergy = theNewEnergy - (*p)->getEnergy();
241 const G4int theNewerA = theNewA - (*p)->getA();
242 const G4int theNewerZ = theNewZ - (*p)->getZ();
243 const G4int theNewerS = theNewS - (*p)->getS();
246 const G4double theNewerInvariantMassSquared = theNewerEnergy*theNewerEnergy-theNewerMomentum.
mag2();
248 if(theNewerInvariantMassSquared>=-1.e-5) {
249 const G4double theNewerInvariantMass = std::sqrt(
std::max(0.,theNewerInvariantMassSquared));
250 const G4double theNewerExcitationEnergy = ((theNewerA>1) ? theNewerInvariantMass-theNewerMass : 0.);
253 if(theNewerExcitationEnergy>maxExcitationEnergy) {
255 maxExcitationEnergy = theNewerExcitationEnergy;
256 bestMomentum = theNewerMomentum;
257 bestEnergy = theNewerEnergy;
269 rejected.push_back(*best);
271 theNewMomentum = bestMomentum;
272 theNewEnergy = bestEnergy;
277 if(maxExcitationEnergy>0.) {
279 positiveExcitationEnergy =
true;
307 const G4double theNewInvariantMassSquared = theNewEnergy*theNewEnergy-theNewMomentum.
mag2();
309 if(theNewInvariantMassSquared<0.)
312 const G4double theNewInvariantMass = std::sqrt(theNewInvariantMassSquared);
314 if(theNewInvariantMass-theNewMass<-1.e-5)
341 const unsigned theNewA = levels.size();
349 const G4double excitedState = std::accumulate(
354 return excitedState-groundState;
360 if((*p)->getID()!=exceptID) {
363 theEnergyLevels.push_back(i->second);
367 return theEnergyLevels;
375 theEnergyLevels.push_back(i->second);
380 theEnergyLevels.push_back(i->second);
384 return theEnergyLevels;
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
G4int getS() const
Returns the strangeness number.
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
EnergyLevelMap theInitialEnergyLevels
Initial energy levels of the projectile.
void removeParticle(Particle *const p, const G4double theProjectileCorrection)
Remove a nucleon from the projectile remnant.
std::vector< G4double > EnergyLevels
G4double computeExcitationEnergyWith(const ParticleList &pL) const
Compute the excitation energy if some nucleons are put back.
G4bool addDynamicalSpectator(Particle *const p)
Add back a nucleon to the projectile remnant.
ParticleList addMostDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
ThreeVector const & getStoredMomentum(Particle const *const p) const
Return the stored momentum of a given projectile component.
G4double computeExcitationEnergy(const EnergyLevels &levels) const
Compute the excitation energy for a given configuration.
EnergyLevels getPresentEnergyLevelsExcept(const long exceptID) const
ParticleList addAllDynamicalSpectators(ParticleList const &pL)
Add back all dynamical spectators to the projectile remnant.
std::map< long, Particle * > storedComponents
Return the stored energy of a given projectile component.
ParticleList addDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
EnergyLevels getPresentEnergyLevelsWith(const ParticleList &pL) const
G4double computeExcitationEnergyExcept(const long exceptID) const
Compute the excitation energy when a nucleon is removed.
EnergyLevels theGroundStateEnergies
Ground-state energies for any number of nucleons.
void reset()
Reset the projectile remnant to the state at the beginning of the cascade.
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.
ParticleList::iterator ParticleMutableIter
ParticleList::const_iterator ParticleIter