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())
137 + theProjectileCorrection;
141 projectileRemnant->
removeParticle(theParticle, theProjectileCorrection);
147 INCL_DEBUG(
"The following Particle enters with correction " << theCorrection <<
'\n'
148 << theParticle->
print() <<
'\n');
152 G4bool success = particleEnters(theCorrection);
167 G4bool ParticleEntryChannel::particleEnters(
const G4double theQValueCorrection) {
181 thePotential(n->getPotential()),
182 theEnergy(theParticle->getEnergy()),
183 theMass(theParticle->getMass()),
184 theQValueCorrection(correction),
185 refraction(n->getStore()->getConfig()->getRefraction()),
186 theMomentumDirection(theParticle->getMomentum())
192 normal = - position / std::sqrt(r2);
193 G4double cosIncidenceAngle = theParticle->getCosRPAngle();
194 if(cosIncidenceAngle < -1.)
195 sinIncidenceAnglePOut = 0.;
197 sinIncidenceAnglePOut = theMomentumDirection.mag()*std::sqrt(1.-cosIncidenceAngle*cosIncidenceAngle);
199 sinIncidenceAnglePOut = 0.;
202 ~IncomingEFunctor() {}
204 G4double energyInside =
std::max(theMass, theEnergy + v - theQValueCorrection);
205 theParticle->setEnergy(energyInside);
206 theParticle->setPotentialEnergy(v);
209 const G4double pIn = std::sqrt(energyInside*energyInside-theMass*theMass);
210 const G4double sinRefractionAngle = sinIncidenceAnglePOut/pIn;
211 const G4double cosRefractionAngle = (sinRefractionAngle>1.) ? 0. : std::sqrt(1.-sinRefractionAngle*sinRefractionAngle);
212 const ThreeVector momentumInside = theMomentumDirection -
normal *
normal.dot(theMomentumDirection) +
normal * (pIn * cosRefractionAngle);
213 theParticle->setMomentum(momentumInside);
215 theParticle->setMomentum(theMomentumDirection);
218 theParticle->adjustMomentumFromEnergy();
219 return v - thePotential->computePotentialEnergy(theParticle);
221 void cleanUp(
const G4bool )
const {}
223 Particle *theParticle;
224 NuclearPotential::INuclearPotential
const *thePotential;
229 const ThreeVector theMomentumDirection;
232 } theIncomingEFunctor(theParticle,theNucleus,theQValueCorrection);
236 INCL_DEBUG(
"Particle " << theParticle->
getID() <<
" is trying to enter below 0" <<
'\n');
239 const RootFinder::Solution theSolution =
RootFinder::solve(&theIncomingEFunctor, v);
240 if(theSolution.success) {
241 theIncomingEFunctor(theSolution.x);
242 INCL_DEBUG(
"Particle successfully entered:\n" << theParticle->
print() <<
'\n');
244 INCL_WARN(
"Couldn't compute the potential for incoming particle, root-finding algorithm failed." <<
'\n');
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.
static double normal(HepRandomEngine *eptr)
G4int getZ() const
Returns the charge number.
G4double computeExcitationEnergyExcept(const long exceptID) const
Compute the excitation energy when a nucleon is removed.
void fillFinalState(FinalState *fs)
void setTotalEnergyBeforeInteraction(G4double E)
void makeParticleBelowZero()
NuclearPotential::INuclearPotential const * getPotential() const
Getter for thePotential.
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.