34#define INCLXX_IN_GEANT4_MODE 1
46 :theNucleus(n), theParticle(p)
119 const G4double theProjectileExcitationEnergy =
120 (projectileRemnant->
getA()-theParticle->
getA()>1) ?
127 const G4double theProjectileEffectiveMass =
129 + theProjectileExcitationEnergy;
131 const G4double theProjectileEnergy = std::sqrt(theProjectileMomentum.
mag2() + theProjectileEffectiveMass*theProjectileEffectiveMass);
134 theNucleus->
getA() + theParticle->
getA(),
135 theNucleus->
getZ() + theParticle->
getZ(),
136 theNucleus->
getS() + theParticle->
getS())
138 + theProjectileCorrection;
142 projectileRemnant->
removeParticle(theParticle, theProjectileCorrection);
150 INCL_DEBUG(
"The following Particle enters with correction " << theCorrection <<
'\n'
151 << theParticle->
print() <<
'\n');
155 G4bool success = particleEnters(theCorrection);
170 G4bool ParticleEntryChannel::particleEnters(
const G4double theQValueCorrection) {
184 thePotential(n->getPotential()),
185 theEnergy(theParticle->getEnergy()),
186 theMass(theParticle->getMass()),
187 theQValueCorrection(correction),
188 refraction(n->getStore()->getConfig()->getRefraction()),
189 theMomentumDirection(theParticle->getMomentum())
195 normal = -
position / std::sqrt(r2);
196 G4double cosIncidenceAngle = theParticle->getCosRPAngle();
197 if(cosIncidenceAngle < -1.)
198 sinIncidenceAnglePOut = 0.;
200 sinIncidenceAnglePOut = theMomentumDirection.mag()*std::sqrt(1.-cosIncidenceAngle*cosIncidenceAngle);
202 sinIncidenceAnglePOut = 0.;
205 ~IncomingEFunctor() {}
207 G4double energyInside = std::max(theMass, theEnergy + v - theQValueCorrection);
208 theParticle->setEnergy(energyInside);
209 theParticle->setPotentialEnergy(v);
212 const G4double pIn = std::sqrt(energyInside*energyInside-theMass*theMass);
213 const G4double sinRefractionAngle = sinIncidenceAnglePOut/pIn;
214 const G4double cosRefractionAngle = (sinRefractionAngle>1.) ? 0. :
std::sqrt(1.-sinRefractionAngle*sinRefractionAngle);
215 const ThreeVector momentumInside = theMomentumDirection - normal * normal.dot(theMomentumDirection) + normal * (pIn * cosRefractionAngle);
216 theParticle->setMomentum(momentumInside);
218 theParticle->setMomentum(theMomentumDirection);
221 theParticle->adjustMomentumFromEnergy();
222 return v - thePotential->computePotentialEnergy(theParticle);
224 void cleanUp(
const G4bool )
const {}
226 Particle *theParticle;
227 NuclearPotential::INuclearPotential
const *thePotential;
232 const ThreeVector theMomentumDirection;
235 } theIncomingEFunctor(theParticle,theNucleus,theQValueCorrection);
239 INCL_DEBUG(
"Particle " << theParticle->
getID() <<
" is trying to enter below 0" <<
'\n');
242 const RootFinder::Solution theSolution =
RootFinder::solve(&theIncomingEFunctor, v);
243 if(theSolution.success) {
244 theIncomingEFunctor(theSolution.x);
245 INCL_DEBUG(
"Particle successfully entered:\n" << theParticle->
print() <<
'\n');
247 INCL_WARN(
"Couldn't compute the potential for incoming particle, root-finding algorithm failed." <<
'\n');
249 return theSolution.success;
Simple class for computing intersections between a straight line and a sphere.
Static root-finder algorithm.
void makeParticleBelowFermi()
void addEnteringParticle(Particle *p)
void makeParticleBelowZero()
void setTotalEnergyBeforeInteraction(G4double E)
virtual G4double computePotentialEnergy(const Particle *const p) const =0
G4double getFermiEnergy(const Particle *const p) const
Return the Fermi energy for a particle.
ProjectileRemnant * getProjectileRemnant() const
Get the projectile remnant.
G4bool isNucleusNucleusCollision() const
Is it a nucleus-nucleus collision?
NuclearPotential::INuclearPotential const * getPotential() const
Getter for thePotential.
virtual ~ParticleEntryChannel()
void fillFinalState(FinalState *fs)
ParticleEntryChannel(Nucleus *n, Particle *p)
G4double getINCLMass() const
Get the INCL particle mass.
G4int getS() const
Returns the strangeness number.
G4double getEmissionQValueCorrection(const G4int AParent, const G4int ZParent) const
Computes correction on the emission Q-value.
void setNumberOfKaon(const G4int NK)
G4double getEnergy() const
G4bool isNucleonorLambda() const
Is this a Nucleon or a Lambda?
G4int getZ() const
Returns the charge number.
G4double getKineticEnergy() const
Get the particle kinetic energy.
void setINCLMass()
Set the mass of the Particle to its table mass.
const G4INCL::ThreeVector & getMomentum() const
G4bool isKaon() const
Is this a Kaon?
G4int getNumberOfKaon() const
Number of Kaon inside de nucleus.
virtual G4double getTableMass() const
Get the tabulated particle mass.
std::string print() const
G4int getA() const
Returns the baryon number.
void removeParticle(Particle *const p, const G4double theProjectileCorrection)
Remove a nucleon from the projectile remnant.
G4double computeExcitationEnergyExcept(const long exceptID) const
Compute the excitation energy when a nucleon is removed.
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.