34 #define INCLXX_IN_GEANT4_MODE 1
61 for(std::map<long, Particle*>::const_iterator i=storedComponents.begin(); i!=storedComponents.end(); ++i) {
63 EnergyLevelMap::iterator energyIter = theInitialEnergyLevels.find(i->first);
65 const G4double energyLevel = energyIter->second;
66 theInitialEnergyLevels.erase(energyIter);
67 theInitialEnergyLevels[p->
getID()] = energyLevel;
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;
133 G4bool isAccepted = addDynamicalSpectator(*
p);
140 }
while(loopCounter<maxLoopCounter && accepted > 0);
153 theNewMomentum += getStoredMomentum(*
p);
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');
205 theNewMomentum += getStoredMomentum(*
p);
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) {
233 const ThreeVector theNewerMomentum = theNewMomentum - getStoredMomentum(*
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;
290 ThreeVector const &oldMomentum = getStoredMomentum(p);
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)
317 const EnergyLevels theEnergyLevels = getPresentEnergyLevelsExcept(exceptID);
318 return computeExcitationEnergy(theEnergyLevels);
322 const EnergyLevels theEnergyLevels = getPresentEnergyLevelsWith(pL);
323 return computeExcitationEnergy(theEnergyLevels);
326 G4double ProjectileRemnant::computeExcitationEnergy(
const EnergyLevels &levels)
const {
331 const unsigned theNewA = levels.size();
336 const G4double groundState = theGroundStateEnergies.at(theNewA-1);
339 const G4double excitedState = std::accumulate(
344 return excitedState-groundState;
350 if((*p)->getID()!=exceptID) {
351 EnergyLevelMap::const_iterator i = theInitialEnergyLevels.find((*p)->getID());
353 theEnergyLevels.push_back(i->second);
357 return theEnergyLevels;
363 EnergyLevelMap::const_iterator i = theInitialEnergyLevels.find((*p)->getID());
365 theEnergyLevels.push_back(i->second);
368 EnergyLevelMap::const_iterator i = theInitialEnergyLevels.find((*p)->getID());
370 theEnergyLevels.push_back(i->second);
374 return theEnergyLevels;
G4int getA() const
Returns the baryon number.
const G4INCL::ThreeVector & getMomentum() const
Class for constructing a projectile-like remnant.
std::string print() const
G4double getEnergy() const
void reset()
Reset the projectile remnant to the state at the beginning of the cascade.
G4double computeExcitationEnergyWith(const ParticleList &pL) const
Compute the excitation energy if some nucleons are put back.
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.
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.
ParticleList addMostDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
void addParticle(Particle *const p)
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