Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
G4INCL::KinematicsUtils Namespace Reference

Functions

void transformToLocalEnergyFrame (Nucleus const *const n, Particle *const p)
 
G4double getLocalEnergy (Nucleus const *const n, Particle *const p)
 
ThreeVector makeBoostVector (Particle const *const p1, Particle const *const p2)
 
G4double totalEnergyInCM (Particle const *const p1, Particle const *const p2)
 
G4double squareTotalEnergyInCM (Particle const *const p1, Particle const *const p2)
 
G4double momentumInCM (Particle const *const p1, Particle const *const p2)
 gives the momentum in the CM frame of two particles. More...
 
G4double momentumInCM (const G4double E, const G4double M1, const G4double M2)
 
G4double momentumInLab (Particle const *const p1, Particle const *const p2)
 gives the momentum in the lab frame of two particles. More...
 
G4double momentumInLab (const G4double s, const G4double m1, const G4double m2)
 
G4double sumTotalEnergies (const ParticleList &)
 
ThreeVector sumMomenta (const ParticleList &)
 
G4double energy (const ThreeVector &p, const G4double m)
 
G4double invariantMass (const G4double E, const ThreeVector &p)
 
G4double squareInvariantMass (const G4double E, const ThreeVector &p)
 
G4double gammaFromKineticEnergy (const ParticleSpecies &p, const G4double EKin)
 

Function Documentation

G4double G4INCL::KinematicsUtils::energy ( const ThreeVector &  p,
const G4double  m 
)

Definition at line 156 of file G4INCLKinematicsUtils.cc.

References python.hepunit::m, and G4INCL::ThreeVector::mag2().

156  {
157  return std::sqrt(p.mag2() + m*m);
158  }
const char * p
Definition: xmltok.h:285
G4double G4INCL::KinematicsUtils::gammaFromKineticEnergy ( const ParticleSpecies &  p,
const G4double  EKin 
)

Definition at line 168 of file G4INCLKinematicsUtils.cc.

References G4INCL::Composite, G4INCL::ParticleTable::getTableMass, G4INCL::ParticleTable::getTableParticleMass, G4INCL::ParticleSpecies::theA, G4INCL::ParticleSpecies::theType, and G4INCL::ParticleSpecies::theZ.

168  {
169  G4double mass;
170  if(p.theType==Composite)
171  mass = ParticleTable::getTableMass(p.theA, p.theZ);
172  else
173  mass = ParticleTable::getTableParticleMass(p.theType);
174  return (1.+EKin/mass);
175  }
G4ThreadLocal ParticleMassFn getTableParticleMass
Static pointer to the mass function for particles.
const char * p
Definition: xmltok.h:285
G4ThreadLocal NuclearMassFn getTableMass
Static pointer to the mass function for nuclei.
double G4double
Definition: G4Types.hh:76
G4double G4INCL::KinematicsUtils::getLocalEnergy ( Nucleus const *const  n,
Particle *const  p 
)

Definition at line 51 of file G4INCLKinematicsUtils.cc.

References G4INCL::Nucleus::getDensity(), G4INCL::NuclearPotential::INuclearPotential::getFermiMomentum(), G4INCL::Particle::getKineticEnergy(), G4INCL::Particle::getMass(), G4INCL::NuclearDensity::getMaximumRadius(), G4INCL::NuclearDensity::getMaxRFromP(), G4INCL::NuclearDensity::getMinPFromR(), G4INCL::Particle::getMomentum(), G4INCL::Particle::getPosition(), G4INCL::Nucleus::getPotential(), G4INCL::Particle::getPotentialEnergy(), G4INCL::Particle::getReflectionMomentum(), G4INCL::NuclearPotential::INuclearPotential::getSeparationEnergy(), G4INCL::Particle::getType(), G4INCL::Nucleus::getUniverseRadius(), INCL_WARN, G4INCL::ThreeVector::mag(), readPY::pl, and G4INCL::Particle::print().

Referenced by transformToLocalEnergyFrame().

51  {
52 // assert(!p->isPion()); // No local energy for pions
53 
54  G4double vloc = 0.0;
55  const G4double r = p->getPosition().mag();
56  const G4double mass = p->getMass();
57 
58  // Local energy is constant outside the surface
59  if(r > n->getUniverseRadius()) {
60  INCL_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);
64  return 0.0;
65  }
66 
67  G4double pfl0 = 0.0;
68  const ParticleType t = p->getType();
69  const G4double kinE = p->getKineticEnergy();
70  if(kinE <= n->getPotential()->getFermiEnergy(t)) {
71  pfl0 = n->getPotential()->getFermiMomentum(p);
72  } else {
73  const G4double tf0 = p->getPotentialEnergy() - n->getPotential()->getSeparationEnergy(p);
74  if(tf0<0.0) return 0.0;
75  pfl0 = std::sqrt(tf0*(tf0 + 2.0*mass));
76  }
77  const G4double pReflection = p->getReflectionMomentum()/pfl0;
78  const G4double reflectionRadius = n->getDensity()->getMaxRFromP(p->getType(), pReflection);
79  const G4double pNominal = p->getMomentum().mag()/pfl0;
80  const G4double nominalReflectionRadius = n->getDensity()->getMaxRFromP(p->getType(), pNominal);
81  const G4double pl = pfl0*n->getDensity()->getMinPFromR(t, r*nominalReflectionRadius/reflectionRadius);
82  vloc = std::sqrt(pl*pl + mass*mass) - mass;
83 
84  return vloc;
85  }
const char * p
Definition: xmltok.h:285
#define INCL_WARN(x)
tuple pl
Definition: readPY.py:5
const G4int n
double G4double
Definition: G4Types.hh:76
G4double G4INCL::KinematicsUtils::invariantMass ( const G4double  E,
const ThreeVector &  p 
)

Definition at line 160 of file G4INCLKinematicsUtils.cc.

References squareInvariantMass().

Referenced by G4ReactionKinematics::TwoBodyScattering().

160  {
161  return std::sqrt(squareInvariantMass(E, p));
162  }
const char * p
Definition: xmltok.h:285
G4double squareInvariantMass(const G4double E, const ThreeVector &p)
ThreeVector G4INCL::KinematicsUtils::makeBoostVector ( Particle const *const  p1,
Particle const *const  p2 
)

Definition at line 87 of file G4INCLKinematicsUtils.cc.

References G4INCL::Particle::getEnergy(), and G4INCL::Particle::getMomentum().

Referenced by G4INCL::InteractionAvatar::preInteraction(), and squareTotalEnergyInCM().

87  {
88  const G4double totalEnergy = p1->getEnergy() + p2->getEnergy();
89  return ((p1->getMomentum() + p2->getMomentum())/totalEnergy);
90  }
double G4double
Definition: G4Types.hh:76
G4double G4INCL::KinematicsUtils::momentumInCM ( Particle const *const  p1,
Particle const *const  p2 
)

gives the momentum in the CM frame of two particles.

The formula is the following:

\[ p_{CM}^2 = \frac{z^2 - m_1^2 m_2^2}{2 z + m_1^2 + m_2^2} \]

where $z$ is the scalar product of the momentum four-vectors:

\[ z = E_1 E_2 - \vec{p}_1\cdot\vec{p}_2 \]

Parameters
p1pointer to particle 1
p2pointer to particle 2
Returns
the absolute value of the momentum of any of the two particles in the CM frame, in MeV/c.

Definition at line 105 of file G4INCLKinematicsUtils.cc.

References G4INCL::ThreeVector::dot(), G4INCL::Particle::getEnergy(), G4INCL::Particle::getMass(), G4INCL::Particle::getMomentum(), INCL_ERROR, and z.

Referenced by G4INCL::DeltaDecayChannel::computeDecayTime(), G4INCL::PhaseSpaceDecay::decay(), G4INCL::Nucleus::decayOutgoingDeltas(), G4INCL::DeltaProductionChannel::getFinalState(), G4INCL::DeltaDecayChannel::getFinalState(), and G4INCL::RecombinationChannel::getFinalState().

105  {
106  const G4double m1sq = std::pow(p1->getMass(),2);
107  const G4double m2sq = std::pow(p2->getMass(),2);
108  const G4double z = p1->getEnergy()*p2->getEnergy() - p1->getMomentum().dot(p2->getMomentum());
109  G4double pcm2 = (z*z-m1sq*m2sq)/(2*z+m1sq+m2sq);
110  if(pcm2 < 0.0) {
111  INCL_ERROR("momentumInCM: pcm2 == " << pcm2 << " < 0.0" << std::endl);
112  pcm2 = 0.0;
113  }
114  return std::sqrt(pcm2);
115  }
G4double z
Definition: TRTMaterials.hh:39
#define INCL_ERROR(x)
double G4double
Definition: G4Types.hh:76
G4double G4INCL::KinematicsUtils::momentumInCM ( const G4double  E,
const G4double  M1,
const G4double  M2 
)

Definition at line 117 of file G4INCLKinematicsUtils.cc.

117  {
118  return 0.5*std::sqrt((E*E - std::pow(M1 + M2, 2))
119  *(E*E - std::pow(M1 - M2, 2)))/E;
120  }
G4double G4INCL::KinematicsUtils::momentumInLab ( Particle const *const  p1,
Particle const *const  p2 
)

gives the momentum in the lab frame of two particles.

Assumes particle 1 carries all the momentum and particle 2 is at rest.

The formula is the following:

\[ p_{lab}^2 = \frac{s^2 - 2 s (m_1^2 + m_2^2) + {(m_1^2 - m_2^2)}^2}{4 m_2^2} \]

Parameters
p1pointer to particle 1
p2pointer to particle 2
Returns
the absolute value of the momentum of particle 1 in the lab frame, in MeV/c

Definition at line 133 of file G4INCLKinematicsUtils.cc.

References G4INCL::Particle::getMass(), python.hepunit::m2, and squareTotalEnergyInCM().

Referenced by G4INCL::CrossSectionsINCL46::deltaProduction(), G4INCL::CrossSectionsINCL46::elasticNNLegacy(), G4INCL::DeltaProductionChannel::getFinalState(), G4INCL::ElasticChannel::getFinalState(), and G4INCL::CrossSectionsINCL46::recombination().

133  {
134  const G4double m1 = p1->getMass();
135  const G4double m2 = p2->getMass();
136  const G4double s = squareTotalEnergyInCM(p1, p2);
137  return momentumInLab(s, m1, m2);
138  }
const XML_Char * s
G4double squareTotalEnergyInCM(Particle const *const p1, Particle const *const p2)
G4double momentumInLab(Particle const *const p1, Particle const *const p2)
gives the momentum in the lab frame of two particles.
double G4double
Definition: G4Types.hh:76
G4double G4INCL::KinematicsUtils::momentumInLab ( const G4double  s,
const G4double  m1,
const G4double  m2 
)

Definition at line 122 of file G4INCLKinematicsUtils.cc.

References INCL_ERROR, and python.hepunit::m2.

122  {
123  const G4double m1sq = m1*m1;
124  const G4double m2sq = m2*m2;
125  G4double plab2 = (s*s-2*s*(m1sq+m2sq)+(m1sq-m2sq)*(m1sq-m2sq))/(4*m2sq);
126  if(plab2 < 0.0) {
127  INCL_ERROR("momentumInLab: plab2 == " << plab2 << " < 0.0; m1sq == " << m1sq << "; m2sq == " << m2sq << "; s == " << s << std::endl);
128  plab2 = 0.0;
129  }
130  return std::sqrt(plab2);
131  }
const XML_Char * s
#define INCL_ERROR(x)
double G4double
Definition: G4Types.hh:76
G4double G4INCL::KinematicsUtils::squareInvariantMass ( const G4double  E,
const ThreeVector &  p 
)

Definition at line 164 of file G4INCLKinematicsUtils.cc.

References G4INCL::ThreeVector::mag2().

Referenced by invariantMass().

164  {
165  return E*E - p.mag2();
166  }
const char * p
Definition: xmltok.h:285
G4double G4INCL::KinematicsUtils::squareTotalEnergyInCM ( Particle const *const  p1,
Particle const *const  p2 
)

Definition at line 96 of file G4INCLKinematicsUtils.cc.

References G4INCL::Particle::getEnergy(), INCL_ERROR, G4INCL::ThreeVector::mag2(), and makeBoostVector().

Referenced by G4INCL::CrossSectionsINCL46::elasticNNLegacy(), G4INCL::StandardPropagationModel::generateBinaryCollisionAvatar(), G4INCL::BinaryCollisionAvatar::getChannel(), G4INCL::ElasticChannel::getFinalState(), momentumInLab(), G4INCL::CrossSectionsINCL46::recombination(), and totalEnergyInCM().

96  {
97  G4double beta2 = makeBoostVector(p1, p2).mag2();
98  if(beta2 > 1.0) {
99  INCL_ERROR("squareTotalEnergyInCM: beta2 == " << beta2 << " > 1.0" << std::endl);
100  beta2 = 0.0;
101  }
102  return (1.0 - beta2)*std::pow(p1->getEnergy() + p2->getEnergy(), 2);
103  }
#define INCL_ERROR(x)
ThreeVector makeBoostVector(Particle const *const p1, Particle const *const p2)
G4double mag2() const
double G4double
Definition: G4Types.hh:76
ThreeVector G4INCL::KinematicsUtils::sumMomenta ( const ParticleList &  pl)

Definition at line 148 of file G4INCLKinematicsUtils.cc.

148  {
149  ThreeVector p(0.0, 0.0, 0.0);
150  for(ParticleIter i=pl.begin(), e=pl.end(); i!=e; ++i) {
151  p += (*i)->getMomentum();
152  }
153  return p;
154  }
const char * p
Definition: xmltok.h:285
tuple pl
Definition: readPY.py:5
ParticleList::const_iterator ParticleIter
G4double G4INCL::KinematicsUtils::sumTotalEnergies ( const ParticleList &  pl)

Definition at line 140 of file G4INCLKinematicsUtils.cc.

140  {
141  G4double E = 0.0;
142  for(ParticleIter i=pl.begin(), e=pl.end(); i!=e; ++i) {
143  E += (*i)->getEnergy();
144  }
145  return E;
146  }
tuple pl
Definition: readPY.py:5
double G4double
Definition: G4Types.hh:76
ParticleList::const_iterator ParticleIter
G4double G4INCL::KinematicsUtils::totalEnergyInCM ( Particle const *const  p1,
Particle const *const  p2 
)
void G4INCL::KinematicsUtils::transformToLocalEnergyFrame ( Nucleus const *const  n,
Particle *const  p 
)

Definition at line 44 of file G4INCLKinematicsUtils.cc.

References G4INCL::Particle::adjustMomentumFromEnergy(), G4INCL::Particle::getEnergy(), getLocalEnergy(), and G4INCL::Particle::setEnergy().

Referenced by G4INCL::StandardPropagationModel::generateBinaryCollisionAvatar(), and G4INCL::InteractionAvatar::preInteractionLocalEnergy().

44  {
45  const G4double localEnergy = getLocalEnergy(n, p);
46  const G4double localTotalEnergy = p->getEnergy() - localEnergy;
47  p->setEnergy(localTotalEnergy);
48  p->adjustMomentumFromEnergy();
49  }
const char * p
Definition: xmltok.h:285
const G4int n
double G4double
Definition: G4Types.hh:76
G4double getLocalEnergy(Nucleus const *const n, Particle *const p)