35#define INCLXX_IN_GEANT4_MODE 1
59 if(r > n->getUniverseRadius()) {
60 WARN(
"Tried to evaluate local energy for a particle outside the maximum radius."
61 << std::endl << p->
print() << std::endl
62 <<
"Maximum radius = " << n->getDensity()->getMaximumRadius() << std::endl
63 <<
"Universe radius = " << n->getUniverseRadius() << std::endl);
69 if(kinE <= n->getPotential()->getFermiEnergy(p->
getType())) {
70 pfl0 = n->getPotential()->getFermiMomentum(p);
73 if(tf0<0.0)
return 0.0;
74 pfl0 = std::sqrt(tf0*(tf0 + 2.0*mass));
76 const G4double pl = pfl0*n->getDensity()->getMaxTFromR(r);
77 vloc = std::sqrt(pl*pl + mass*mass) - mass;
94 ERROR(
"KinematicsUtils::squareTotalEnergyInCM: beta2 == " << beta2 <<
" > 1.0" << std::endl);
104 G4double pcm2 = (z*z-m1sq*m2sq)/(2*z+m1sq+m2sq);
106 ERROR(
"KinematicsUtils::momentumInCM: pcm2 == " << pcm2 <<
" < 0.0" << std::endl);
109 return std::sqrt(pcm2);
113 return 0.5*std::sqrt((E*E - std::pow(M1 + M2, 2))
114 *(E*E - std::pow(M1 - M2, 2)))/E;
120 G4double plab2 = (s*s-2*s*(m1sq+m2sq)+(m1sq-m2sq)*(m1sq-m2sq))/(4*m2sq);
122 ERROR(
"KinematicsUtils::momentumInLab: plab2 == " << plab2 <<
" < 0.0; m1sq == " << m1sq <<
"; m2sq == " << m2sq <<
"; s == " << s << std::endl);
125 return std::sqrt(plab2);
138 E += (*i)->getEnergy();
146 p += (*i)->getMomentum();
152 return std::sqrt(p.
mag2() + m*m);
156 return std::sqrt(E*E - p.
mag2());
165 return (1.+EKin/mass);
static G4double squareTotalEnergyInCM(Particle const *const p1, Particle const *const p2)
static G4double invariantMass(const G4double E, const ThreeVector &p)
static ThreeVector sumMomenta(const ParticleList &)
static G4double gammaFromKineticEnergy(const ParticleSpecies &p, const G4double EKin)
static G4double sumTotalEnergies(const ParticleList &)
static G4double energy(const ThreeVector &p, const G4double m)
static ThreeVector makeBoostVector(Particle const *const p1, Particle const *const p2)
static G4double totalEnergyInCM(Particle const *const p1, Particle const *const p2)
static void transformToLocalEnergyFrame(Nucleus const *const n, Particle *const p)
static G4double momentumInLab(Particle const *const p1, Particle const *const p2)
gives the momentum in the lab frame of two particles.
static G4double momentumInCM(Particle const *const p1, Particle const *const p2)
gives the momentum in the CM frame of two particles.
static G4double getLocalEnergy(Nucleus const *const n, Particle *const p)
static NuclearMassFn getTableMass
Static pointer to the mass function for nuclei.
static ParticleMassFn getTableParticleMass
Static pointer to the mass function for particles.
G4double getEnergy() const
G4double getPotentialEnergy() const
Get the particle potential energy.
const G4INCL::ThreeVector & getPosition() const
G4double getKineticEnergy() const
Get the particle kinetic energy.
const ThreeVector & adjustMomentumFromEnergy()
Rescale the momentum to match the total energy.
const G4INCL::ThreeVector & getMomentum() const
G4INCL::ParticleType getType() const
void setEnergy(G4double energy)
std::string print() const
G4double getMass() const
Get the cached particle mass.
G4double dot(const ThreeVector &v) const
std::list< G4INCL::Particle * > ParticleList
std::list< G4INCL::Particle * >::const_iterator ParticleIter