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;
127 unsigned long loopCounter = 0;
128 const unsigned long maxLoopCounter = 10000000;
140 }
while(loopCounter<maxLoopCounter && accepted > 0);
154 theNewEnergy += (*p)->getEnergy();
155 theNewA += (*p)->getA();
156 theNewZ += (*p)->getZ();
162 const G4double theNewEffectiveMass = theNewMass + theNewExcitationEnergy;
166 if(theNewEnergy<theNewEffectiveMass) {
167 INCL_WARN(
"Could not add all the dynamical spectators back into the projectile remnant."
168 <<
" Falling back to the \"most\" method." <<
'\n');
179 const G4double scalingFactorSquared = (theNewEnergy*theNewEnergy-theNewEffectiveMass*theNewEffectiveMass)/theNewMomentum.
mag2();
180 const G4double scalingFactor = std::sqrt(scalingFactorSquared);
181 INCL_DEBUG(
"Scaling factor for the projectile-remnant momentum = " << scalingFactor <<
'\n');
206 theNewEnergy += (*p)->getEnergy();
207 theNewA += (*p)->getA();
208 theNewZ += (*p)->getZ();
213 const G4double theNewInvariantMassSquared = theNewEnergy*theNewEnergy-theNewMomentum.
mag2();
215 G4bool positiveExcitationEnergy =
false;
216 if(theNewInvariantMassSquared>=0.) {
217 const G4double theNewInvariantMass = std::sqrt(theNewInvariantMassSquared);
218 positiveExcitationEnergy = (theNewInvariantMass-theNewMass>-1.e-5);
224 while(!positiveExcitationEnergy && !pL.empty()) {
225 G4double maxExcitationEnergy = -1.E30;
229 G4int bestA = -1, bestZ = -1;
230 for(ParticleList::iterator
p=pL.begin(),
e=pL.end();
p!=
e; ++
p) {
234 const G4double theNewerEnergy = theNewEnergy - (*p)->getEnergy();
235 const G4int theNewerA = theNewA - (*p)->getA();
236 const G4int theNewerZ = theNewZ - (*p)->getZ();
239 const G4double theNewerInvariantMassSquared = theNewerEnergy*theNewerEnergy-theNewerMomentum.
mag2();
241 if(theNewerInvariantMassSquared>=-1.
e-5) {
242 const G4double theNewerInvariantMass = std::sqrt(
std::max(0.,theNewerInvariantMassSquared));
243 const G4double theNewerExcitationEnergy = ((theNewerA>1) ? theNewerInvariantMass-theNewerMass : 0.);
246 if(theNewerExcitationEnergy>maxExcitationEnergy) {
248 maxExcitationEnergy = theNewerExcitationEnergy;
249 bestMomentum = theNewerMomentum;
250 bestEnergy = theNewerEnergy;
261 rejected.push_back(*best);
263 theNewMomentum = bestMomentum;
264 theNewEnergy = bestEnergy;
268 if(maxExcitationEnergy>0.) {
270 positiveExcitationEnergy =
true;
297 const G4double theNewInvariantMassSquared = theNewEnergy*theNewEnergy-theNewMomentum.
mag2();
299 if(theNewInvariantMassSquared<0.)
302 const G4double theNewInvariantMass = std::sqrt(theNewInvariantMassSquared);
304 if(theNewInvariantMass-theNewMass<-1.
e-5)
331 const unsigned theNewA = levels.size();
339 const G4double excitedState = std::accumulate(
344 return excitedState-groundState;
350 if((*p)->getID()!=exceptID) {
353 theEnergyLevels.push_back(i->second);
357 return theEnergyLevels;
365 theEnergyLevels.push_back(i->second);
370 theEnergyLevels.push_back(i->second);
374 return theEnergyLevels;
ParticleList::const_iterator ParticleIter
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double getEnergy() const
void setTableMass()
Set the mass of the Particle to its table mass.
ParticleList addDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
const G4INCL::ThreeVector & getMomentum() const
G4INCL::ThreeVector theMomentum
ParticleList addAllDynamicalSpectators(ParticleList const &pL)
Add back all dynamical spectators to the projectile remnant.
G4bool addDynamicalSpectator(Particle *const p)
Add back a nucleon to the projectile remnant.
G4double computeExcitationEnergyExcept(const long exceptID) const
Compute the excitation energy when a nucleon is removed.
std::string print() const
std::vector< G4double > EnergyLevels
G4ThreadLocal NuclearMassFn getTableMass
Static pointer to the mass function for nuclei.
ThreeVector const & getStoredMomentum(Particle const *const p) const
Return the stored momentum of a given projectile component.
G4INCL::ThreeVector thePosition
G4double thePotentialEnergy
std::string print() const
G4int getZ() const
Returns the charge number.
G4int getA() const
Returns the baryon number.
void reset()
Reset the projectile remnant to the state at the beginning of the cascade.
EnergyLevels theGroundStateEnergies
Ground-state energies for any number of nucleons.
void addParticle(Particle *const p)
Class for constructing a projectile-like remnant.
EnergyLevels getPresentEnergyLevelsWith(const ParticleList &pL) const
void removeParticle(Particle *const p, const G4double theProjectileCorrection)
Remove a nucleon from the projectile remnant.
EnergyLevelMap theInitialEnergyLevels
Initial energy levels of the projectile.
ParticleList addMostDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
G4double computeExcitationEnergyWith(const ParticleList &pL) const
Compute the excitation energy if some nucleons are put back.
void removeParticle(Particle *const p)
Remove a particle from the cluster components.
G4double computeExcitationEnergy(const EnergyLevels &levels) const
Compute the excitation energy for a given configuration.
std::map< long, Particle * > storedComponents
Return the stored energy of a given projectile component.
ParticleList::iterator ParticleMutableIter
EnergyLevels getPresentEnergyLevelsExcept(const long exceptID) const