33 #define INCLXX_IN_GEANT4_MODE 1
68 const G4double energyLevel = energyIter->second;
75 INCL_DEBUG(
"ProjectileRemnant object was reset:" << std::endl <<
print());
81 INCL_DEBUG(
"The following Particle is about to be removed from the ProjectileRemnant:"
82 << std::endl << p->
print()
83 <<
"theProjectileCorrection=" << theProjectileCorrection << std::endl);
92 #if !defined(NDEBUG) && !defined(INCLXX_IN_GEANT4_MODE)
101 const G4double theProjectileCorrectionPerNucleon = theProjectileCorrection /
particles.size();
105 (*i)->setEnergy((*i)->getEnergy() + theProjectileCorrectionPerNucleon);
106 (*i)->setMass((*i)->getInvariantMass());
107 #if !defined(NDEBUG) && !defined(INCLXX_IN_GEANT4_MODE)
108 theTotalMomentum += (*i)->getMomentum();
109 theTotalEnergy += (*i)->getEnergy();
115 theEnergy -= oldEnergy - theProjectileCorrection;
119 INCL_DEBUG(
"After Particle removal, the ProjectileRemnant looks like this:"
120 << std::endl <<
print());
128 unsigned int accepted;
132 for(
ParticleIter p=toBeAdded.begin(), e=toBeAdded.end(); p!=e; ++p) {
139 }
while(accepted > 0);
153 theNewEnergy += (*p)->getEnergy();
154 theNewA += (*p)->getA();
155 theNewZ += (*p)->getZ();
161 const G4double theNewEffectiveMass = theNewMass + theNewExcitationEnergy;
165 if(theNewEnergy<theNewEffectiveMass) {
166 INCL_WARN(
"Could not add all the dynamical spectators back into the projectile remnant."
167 <<
" Falling back to the \"most\" method." << std::endl);
178 const G4double scalingFactorSquared = (theNewEnergy*theNewEnergy-theNewEffectiveMass*theNewEffectiveMass)/theNewMomentum.
mag2();
179 const G4double scalingFactor = std::sqrt(scalingFactorSquared);
180 INCL_DEBUG(
"Scaling factor for the projectile-remnant momentum = " << scalingFactor << std::endl);
205 theNewEnergy += (*p)->getEnergy();
206 theNewA += (*p)->getA();
207 theNewZ += (*p)->getZ();
212 const G4double theNewInvariantMassSquared = theNewEnergy*theNewEnergy-theNewMomentum.
mag2();
214 G4bool positiveExcitationEnergy =
false;
215 if(theNewInvariantMassSquared>=0.) {
216 const G4double theNewInvariantMass = std::sqrt(theNewInvariantMassSquared);
217 positiveExcitationEnergy = (theNewInvariantMass-theNewMass>-1.e-5);
223 while(!positiveExcitationEnergy && !pL.empty()) {
224 G4double maxExcitationEnergy = -1.E30;
228 G4int bestA = -1, bestZ = -1;
229 for(ParticleList::iterator p=pL.begin(), e=pL.end(); p!=e; ++p) {
233 const G4double theNewerEnergy = theNewEnergy - (*p)->getEnergy();
234 const G4int theNewerA = theNewA - (*p)->getA();
235 const G4int theNewerZ = theNewZ - (*p)->getZ();
238 const G4double theNewerInvariantMassSquared = theNewerEnergy*theNewerEnergy-theNewerMomentum.
mag2();
240 if(theNewerInvariantMassSquared>=-1.e-5) {
241 const G4double theNewerInvariantMass = std::sqrt(
std::max(0.,theNewerInvariantMassSquared));
242 const G4double theNewerExcitationEnergy = ((theNewerA>1) ? theNewerInvariantMass-theNewerMass : 0.);
245 if(theNewerExcitationEnergy>maxExcitationEnergy) {
247 maxExcitationEnergy = theNewerExcitationEnergy;
248 bestMomentum = theNewerMomentum;
249 bestEnergy = theNewerEnergy;
260 rejected.push_back(*best);
262 theNewMomentum = bestMomentum;
263 theNewEnergy = bestEnergy;
267 if(maxExcitationEnergy>0.) {
269 positiveExcitationEnergy =
true;
296 const G4double theNewInvariantMassSquared = theNewEnergy*theNewEnergy-theNewMomentum.
mag2();
298 if(theNewInvariantMassSquared<0.)
301 const G4double theNewInvariantMass = std::sqrt(theNewInvariantMassSquared);
303 if(theNewInvariantMass-theNewMass<-1.e-5)
330 const unsigned theNewA = levels.size();
338 const G4double excitedState = std::accumulate(
343 return excitedState-groundState;
349 if((*p)->getID()!=exceptID) {
352 theEnergyLevels.push_back(i->second);
356 return theEnergyLevels;
364 theEnergyLevels.push_back(i->second);
369 theEnergyLevels.push_back(i->second);
373 return theEnergyLevels;
G4int getA() const
Returns the baryon number.
G4int shuffleComponentsHelper(G4int range)
Helper function for ProjectileRemnant::shuffleStoredComponents.
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
ParticleList addAllDynamicalSpectators(ParticleList pL)
Add back all dynamical spectators to the projectile remnant.
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.
G4double shoot1()
Return a random number in the [0,1[ interval.
std::map< long, Particle * > storedComponents
Return the stored energy of a given projectile component.
UnorderedVector< Particle * > ParticleList
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.
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