33 #define INCLXX_IN_GEANT4_MODE 1
45 :theNucleus(n), theParticle(p)
118 const G4double theProjectileExcitationEnergy =
119 (projectileRemnant->
getA()-theParticle->
getA()>1) ?
126 const G4double theProjectileEffectiveMass =
128 + theProjectileExcitationEnergy;
130 const G4double theProjectileEnergy = std::sqrt(theProjectileMomentum.mag2() + theProjectileEffectiveMass*theProjectileEffectiveMass);
133 theNucleus->
getA() + theParticle->
getA(),
134 theNucleus->
getZ() + theParticle->
getZ())
136 + theProjectileCorrection;
140 projectileRemnant->
removeParticle(theParticle, theProjectileCorrection);
146 INCL_DEBUG(
"The following Particle enters with correction " << theCorrection
147 << theParticle->
print() << std::endl);
151 G4bool success = particleEnters(theCorrection);
168 G4bool ParticleEntryChannel::particleEnters(
const G4double theQValueCorrection) {
182 thePotential(n->getPotential()),
183 theEnergy(theParticle->getEnergy()),
184 theMass(theParticle->getMass()),
185 theQValueCorrection(correction),
186 refraction(n->getStore()->getConfig()->getRefraction()),
187 theMomentumDirection(theParticle->getMomentum())
193 normal = - position / std::sqrt(r2);
194 G4double cosIncidenceAngle = theParticle->getCosRPAngle();
195 if(cosIncidenceAngle < -1.)
196 sinIncidenceAnglePOut = 0.;
198 sinIncidenceAnglePOut = theMomentumDirection.mag()*std::sqrt(1.-cosIncidenceAngle*cosIncidenceAngle);
200 sinIncidenceAnglePOut = 0.;
203 ~IncomingEFunctor() {}
205 G4double energyInside =
std::max(theMass, theEnergy + v - theQValueCorrection);
206 theParticle->setEnergy(energyInside);
207 theParticle->setPotentialEnergy(v);
210 const G4double pIn = std::sqrt(energyInside*energyInside-theMass*theMass);
211 const G4double sinRefractionAngle = sinIncidenceAnglePOut/pIn;
212 const G4double cosRefractionAngle = (sinRefractionAngle>1.) ? 0. : std::sqrt(1.-sinRefractionAngle*sinRefractionAngle);
213 const ThreeVector momentumInside = theMomentumDirection - normal * normal.dot(theMomentumDirection) + normal * (pIn * cosRefractionAngle);
214 theParticle->setMomentum(momentumInside);
216 theParticle->setMomentum(theMomentumDirection);
219 theParticle->adjustMomentumFromEnergy();
220 return v - thePotential->computePotentialEnergy(theParticle);
222 void cleanUp(
const G4bool )
const {}
224 Particle *theParticle;
225 NuclearPotential::INuclearPotential
const *thePotential;
230 const ThreeVector theMomentumDirection;
233 } theIncomingEFunctor(theParticle,theNucleus,theQValueCorrection);
237 INCL_DEBUG(
"Particle " << theParticle->
getID() <<
" is trying to enter below 0" << std::endl);
240 const RootFinder::Solution theSolution =
RootFinder::solve(&theIncomingEFunctor, v);
241 if(theSolution.success) {
242 theIncomingEFunctor(theSolution.x);
244 INCL_WARN(
"Couldn't compute the potential for incoming particle, root-finding algorithm failed." << std::endl);
246 return theSolution.success;
G4int getA() const
Returns the baryon number.
G4bool isNucleusNucleusCollision() const
Is it a nucleus-nucleus collision?
const G4INCL::ThreeVector & getMomentum() const
std::string print() const
G4double getEnergy() const
void setINCLMass()
Set the mass of the Particle to its table mass.
G4double getINCLMass() const
Get the INCL particle mass.
ParticleEntryChannel(Nucleus *n, Particle *p)
virtual ~ParticleEntryChannel()
G4double getFermiEnergy(const Particle *const p) const
Return the Fermi energy for a particle.
G4int getZ() const
Returns the charge number.
G4double computeExcitationEnergyExcept(const long exceptID) const
Compute the excitation energy when a nucleon is removed.
void setTotalEnergyBeforeInteraction(G4double E)
void makeParticleBelowZero()
NuclearPotential::INuclearPotential const * getPotential() const
Getter for thePotential.
FinalState * getFinalState()
void makeParticleBelowFermi()
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.
Solution solve(RootFunctor const *const f, const G4double x0)
Numerically solve a one-dimensional equation.
void removeParticle(Particle *const p, const G4double theProjectileCorrection)
Remove a nucleon from the projectile remnant.
virtual G4double getTableMass() const
Get the tabulated particle mass.
ProjectileRemnant * getProjectileRemnant() const
Get the projectile remnant.
G4double getKineticEnergy() const
Get the particle kinetic energy.
virtual G4double computePotentialEnergy(const Particle *const p) const =0
void addEnteringParticle(Particle *p)
G4double getEmissionQValueCorrection(const G4int AParent, const G4int ZParent) const
Computes correction on the emission Q-value.
Simple class for computing intersections between a straight line and a sphere.
Static root-finder algorithm.