Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCLKinematicsUtils.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// INCL++ intra-nuclear cascade model
27// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
28// Davide Mancusi, CEA
29// Alain Boudard, CEA
30// Sylvie Leray, CEA
31// Joseph Cugnon, University of Liege
32//
33// INCL++ revision: v5.1.8
34//
35#define INCLXX_IN_GEANT4_MODE 1
36
37#include "globals.hh"
38
41
42namespace G4INCL {
43
45 const G4double localEnergy = KinematicsUtils::getLocalEnergy(n, p);
46 const G4double localTotalEnergy = p->getEnergy() - localEnergy;
47 p->setEnergy(localTotalEnergy);
49 }
50
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 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 G4double kinE = p->getKineticEnergy();
69 if(kinE <= n->getPotential()->getFermiEnergy(p->getType())) {
70 pfl0 = n->getPotential()->getFermiMomentum(p);
71 } else {
72 const G4double tf0 = p->getPotentialEnergy() - n->getPotential()->getSeparationEnergy(p);
73 if(tf0<0.0) return 0.0;
74 pfl0 = std::sqrt(tf0*(tf0 + 2.0*mass));
75 }
76 const G4double pl = pfl0*n->getDensity()->getMaxTFromR(r);
77 vloc = std::sqrt(pl*pl + mass*mass) - mass;
78
79 return vloc;
80 }
81
83 const G4double totalEnergy = p1->getEnergy() + p2->getEnergy();
84 return ((p1->getMomentum() + p2->getMomentum())/totalEnergy);
85 }
86
87 G4double KinematicsUtils::totalEnergyInCM(Particle const * const p1, Particle const * const p2){
88 return std::sqrt(squareTotalEnergyInCM(p1,p2));
89 }
90
93 if(beta2 > 1.0) {
94 ERROR("KinematicsUtils::squareTotalEnergyInCM: beta2 == " << beta2 << " > 1.0" << std::endl);
95 beta2 = 0.0;
96 }
97 return (1.0 - beta2)*std::pow(p1->getEnergy() + p2->getEnergy(), 2);
98 }
99
100 G4double KinematicsUtils::momentumInCM(Particle const * const p1, Particle const * const p2) {
101 const G4double m1sq = std::pow(p1->getMass(),2);
102 const G4double m2sq = std::pow(p2->getMass(),2);
103 const G4double z = p1->getEnergy()*p2->getEnergy() - p1->getMomentum().dot(p2->getMomentum());
104 G4double pcm2 = (z*z-m1sq*m2sq)/(2*z+m1sq+m2sq);
105 if(pcm2 < 0.0) {
106 ERROR("KinematicsUtils::momentumInCM: pcm2 == " << pcm2 << " < 0.0" << std::endl);
107 pcm2 = 0.0;
108 }
109 return std::sqrt(pcm2);
110 }
111
113 return 0.5*std::sqrt((E*E - std::pow(M1 + M2, 2))
114 *(E*E - std::pow(M1 - M2, 2)))/E;
115 }
116
118 const G4double m1sq = m1*m1;
119 const G4double m2sq = m2*m2;
120 G4double plab2 = (s*s-2*s*(m1sq+m2sq)+(m1sq-m2sq)*(m1sq-m2sq))/(4*m2sq);
121 if(plab2 < 0.0) {
122 ERROR("KinematicsUtils::momentumInLab: plab2 == " << plab2 << " < 0.0; m1sq == " << m1sq << "; m2sq == " << m2sq << "; s == " << s << std::endl);
123 plab2 = 0.0;
124 }
125 return std::sqrt(plab2);
126 }
127
128 G4double KinematicsUtils::momentumInLab(Particle const * const p1, Particle const * const p2) {
129 const G4double m1 = p1->getMass();
130 const G4double m2 = p2->getMass();
131 const G4double s = squareTotalEnergyInCM(p1, p2);
132 return KinematicsUtils::momentumInLab(s, m1, m2);
133 }
134
136 G4double E = 0.0;
137 for(ParticleIter i = pl.begin(); i != pl.end(); ++i) {
138 E += (*i)->getEnergy();
139 }
140 return E;
141 }
142
144 ThreeVector p(0.0, 0.0, 0.0);
145 for(ParticleIter i = pl.begin(); i != pl.end(); ++i) {
146 p += (*i)->getMomentum();
147 }
148 return p;
149 }
150
152 return std::sqrt(p.mag2() + m*m);
153 }
154
156 return std::sqrt(E*E - p.mag2());
157 }
158
160 G4double mass;
161 if(p.theType==Composite)
163 else
165 return (1.+EKin/mass);
166 }
167
168}
#define WARN(x)
#define ERROR(x)
double G4double
Definition: G4Types.hh:64
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 mag() const
G4double dot(const ThreeVector &v) const
G4double mag2() const
std::list< G4INCL::Particle * > ParticleList
std::list< G4INCL::Particle * >::const_iterator ParticleIter