Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 157 of file G4INCLKinematicsUtils.cc.

157  {
158  return std::sqrt(p.mag2() + m*m);
159  }
const char * p
Definition: xmltok.h:285
static constexpr double m
Definition: G4SIunits.hh:129

Here is the call graph for this function:

G4double G4INCL::KinematicsUtils::gammaFromKineticEnergy ( const ParticleSpecies &  p,
const G4double  EKin 
)

Definition at line 169 of file G4INCLKinematicsUtils.cc.

169  {
170  G4double mass;
171  if(p.theType==Composite)
172  mass = ParticleTable::getTableMass(p.theA, p.theZ);
173  else
174  mass = ParticleTable::getTableParticleMass(p.theType);
175  return (1.+EKin/mass);
176  }
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 52 of file G4INCLKinematicsUtils.cc.

52  {
53 // assert(!p->isPion()); // No local energy for pions
54 
55  G4double vloc = 0.0;
56  const G4double r = p->getPosition().mag();
57  const G4double mass = p->getMass();
58 
59  // Local energy is constant outside the surface
60  if(r > n->getUniverseRadius()) {
61  INCL_WARN("Tried to evaluate local energy for a particle outside the maximum radius."
62  << '\n' << p->print() << '\n'
63  << "Maximum radius = " << n->getDensity()->getMaximumRadius() << '\n'
64  << "Universe radius = " << n->getUniverseRadius() << '\n');
65  return 0.0;
66  }
67 
68  G4double pfl0 = 0.0;
69  const ParticleType t = p->getType();
70  const G4double kinE = p->getKineticEnergy();
71  if(kinE <= n->getPotential()->getFermiEnergy(t)) {
72  pfl0 = n->getPotential()->getFermiMomentum(p);
73  } else {
74  const G4double tf0 = p->getPotentialEnergy() - n->getPotential()->getSeparationEnergy(p);
75  if(tf0<0.0) return 0.0;
76  pfl0 = std::sqrt(tf0*(tf0 + 2.0*mass));
77  }
78  const G4double pReflection = p->getReflectionMomentum()/pfl0;
79  const G4double reflectionRadius = n->getDensity()->getMaxRFromP(p->getType(), pReflection);
80  const G4double pNominal = p->getMomentum().mag()/pfl0;
81  const G4double nominalReflectionRadius = n->getDensity()->getMaxRFromP(p->getType(), pNominal);
82  const G4double pl = pfl0*n->getDensity()->getMinPFromR(t, r*nominalReflectionRadius/reflectionRadius);
83  vloc = std::sqrt(pl*pl + mass*mass) - mass;
84 
85  return vloc;
86  }
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

Here is the call graph for this function:

Here is the caller graph for this function:

G4double G4INCL::KinematicsUtils::invariantMass ( const G4double  E,
const ThreeVector &  p 
)

Definition at line 161 of file G4INCLKinematicsUtils.cc.

161  {
162  return std::sqrt(squareInvariantMass(E, p));
163  }
const char * p
Definition: xmltok.h:285
G4double squareInvariantMass(const G4double E, const ThreeVector &p)

Here is the call graph for this function:

ThreeVector G4INCL::KinematicsUtils::makeBoostVector ( Particle const *const  p1,
Particle const *const  p2 
)

Definition at line 88 of file G4INCLKinematicsUtils.cc.

88  {
89  const G4double totalEnergy = p1->getEnergy() + p2->getEnergy();
90  return ((p1->getMomentum() + p2->getMomentum())/totalEnergy);
91  }
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

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 106 of file G4INCLKinematicsUtils.cc.

106  {
107  const G4double m1sq = std::pow(p1->getMass(),2);
108  const G4double m2sq = std::pow(p2->getMass(),2);
109  const G4double z = p1->getEnergy()*p2->getEnergy() - p1->getMomentum().dot(p2->getMomentum());
110  G4double pcm2 = (z*z-m1sq*m2sq)/(2*z+m1sq+m2sq);
111  if(pcm2 < 0.0) {
112  INCL_ERROR("momentumInCM: pcm2 == " << pcm2 << " < 0.0" << '\n');
113  pcm2 = 0.0;
114  }
115  return std::sqrt(pcm2);
116  }
#define INCL_ERROR(x)
tuple z
Definition: test.py:28
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

G4double G4INCL::KinematicsUtils::momentumInCM ( const G4double  E,
const G4double  M1,
const G4double  M2 
)

Definition at line 118 of file G4INCLKinematicsUtils.cc.

118  {
119  return 0.5*std::sqrt((E*E - std::pow(M1 + M2, 2))
120  *(E*E - std::pow(M1 - M2, 2)))/E;
121  }
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 134 of file G4INCLKinematicsUtils.cc.

134  {
135  const G4double m1 = p1->getMass();
136  const G4double m2 = p2->getMass();
137  const G4double s = squareTotalEnergyInCM(p1, p2);
138  return momentumInLab(s, m1, m2);
139  }
G4double squareTotalEnergyInCM(Particle const *const p1, Particle const *const p2)
const XML_Char * s
Definition: expat.h:262
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
static constexpr double m2
Definition: G4SIunits.hh:130

Here is the call graph for this function:

Here is the caller graph for this function:

G4double G4INCL::KinematicsUtils::momentumInLab ( const G4double  s,
const G4double  m1,
const G4double  m2 
)

Definition at line 123 of file G4INCLKinematicsUtils.cc.

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

Definition at line 165 of file G4INCLKinematicsUtils.cc.

165  {
166  return E*E - p.mag2();
167  }
const char * p
Definition: xmltok.h:285

Here is the call graph for this function:

Here is the caller graph for this function:

G4double G4INCL::KinematicsUtils::squareTotalEnergyInCM ( Particle const *const  p1,
Particle const *const  p2 
)

Definition at line 97 of file G4INCLKinematicsUtils.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

ThreeVector G4INCL::KinematicsUtils::sumMomenta ( const ParticleList &  pl)

Definition at line 149 of file G4INCLKinematicsUtils.cc.

149  {
150  ThreeVector p(0.0, 0.0, 0.0);
151  for(ParticleIter i=pl.begin(), e=pl.end(); i!=e; ++i) {
152  p += (*i)->getMomentum();
153  }
154  return p;
155  }
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 141 of file G4INCLKinematicsUtils.cc.

141  {
142  G4double E = 0.0;
143  for(ParticleIter i=pl.begin(), e=pl.end(); i!=e; ++i) {
144  E += (*i)->getEnergy();
145  }
146  return E;
147  }
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 
)

Definition at line 93 of file G4INCLKinematicsUtils.cc.

93  {
94  return std::sqrt(squareTotalEnergyInCM(p1,p2));
95  }
G4double squareTotalEnergyInCM(Particle const *const p1, Particle const *const p2)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4INCL::KinematicsUtils::transformToLocalEnergyFrame ( Nucleus const *const  n,
Particle *const  p 
)

Definition at line 45 of file G4INCLKinematicsUtils.cc.

45  {
46  const G4double localEnergy = getLocalEnergy(n, p);
47  const G4double localTotalEnergy = p->getEnergy() - localEnergy;
48  p->setEnergy(localTotalEnergy);
49  p->adjustMomentumFromEnergy();
50  }
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)

Here is the call graph for this function:

Here is the caller graph for this function: