Geant4-11
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | Static Private Attributes
G4LorentzConvertor Class Reference

#include <G4LorentzConvertor.hh>

Public Member Functions

G4LorentzVector backToTheLab (const G4LorentzVector &mom) const
 
void fillKinematics ()
 
 G4LorentzConvertor ()
 
 G4LorentzConvertor (const G4InuclParticle *bullet, const G4InuclParticle *target)
 
 G4LorentzConvertor (const G4LorentzVector &bmom, G4double bmass, const G4LorentzVector &tmom, G4double tmass)
 
const G4LorentzVectorgetBullet () const
 
G4double getKinEnergyInTheTRS () const
 
G4double getSCMMomentum () const
 
const G4LorentzVectorgetTarget () const
 
G4double getTotalSCMEnergy () const
 
G4double getTRSMomentum () const
 
void printBullet () const
 
void printTarget () const
 
G4bool reflectionNeeded () const
 
G4LorentzVector rotate (const G4LorentzVector &mom) const
 
G4LorentzVector rotate (const G4LorentzVector &mom1, const G4LorentzVector &mom) const
 
void setBullet (const G4InuclParticle &bullet)
 
void setBullet (const G4InuclParticle *bullet)
 
void setBullet (const G4LorentzVector &bmom)
 
void setBullet (const G4LorentzVector &bmom, G4double bmass)
 
void setTarget (const G4InuclParticle &target)
 
void setTarget (const G4InuclParticle *target)
 
void setTarget (const G4LorentzVector &bmom)
 
void setTarget (const G4LorentzVector &tmom, G4double tmass)
 
void setVerbose (G4int vb=0)
 
void toTheCenterOfMass ()
 
void toTheTargetRestFrame ()
 
G4bool trivial () const
 

Private Attributes

G4LorentzVector bullet_mom
 
G4bool degenerated
 
G4double ecm_tot
 
G4ThreeVector scm_direction
 
G4LorentzVector scm_momentum
 
G4LorentzVector target_mom
 
G4double v2
 
G4double valong
 
G4ThreeVector velocity
 
G4int verboseLevel
 

Static Private Attributes

static const G4double small = 1.0e-10
 

Detailed Description

Definition at line 44 of file G4LorentzConvertor.hh.

Constructor & Destructor Documentation

◆ G4LorentzConvertor() [1/3]

G4LorentzConvertor::G4LorentzConvertor ( )

◆ G4LorentzConvertor() [2/3]

G4LorentzConvertor::G4LorentzConvertor ( const G4LorentzVector bmom,
G4double  bmass,
const G4LorentzVector tmom,
G4double  tmass 
)

Definition at line 49 of file G4LorentzConvertor.cc.

52 : verboseLevel(0), v2(0.), ecm_tot(0.), valong(0.), degenerated(false) {
53 setBullet(bmom, bmass);
54 setTarget(tmom, tmass);
55}
void setBullet(const G4InuclParticle *bullet)
void setTarget(const G4InuclParticle *target)

References setBullet(), and setTarget().

◆ G4LorentzConvertor() [3/3]

G4LorentzConvertor::G4LorentzConvertor ( const G4InuclParticle bullet,
const G4InuclParticle target 
)

Definition at line 57 of file G4LorentzConvertor.cc.

60 : verboseLevel(0), v2(0.), ecm_tot(0.), valong(0.), degenerated(false) {
61 setBullet(bullet);
62 setTarget(target);
63}

References setBullet(), and setTarget().

Member Function Documentation

◆ backToTheLab()

G4LorentzVector G4LorentzConvertor::backToTheLab ( const G4LorentzVector mom) const

Definition at line 134 of file G4LorentzConvertor.cc.

134 {
135 if (verboseLevel > 2)
136 G4cout << " >>> G4LorentzConvertor::backToTheLab" << G4endl;
137
138 if (verboseLevel > 3)
139 G4cout << " at rest: px " << mom.x() << " py " << mom.y() << " pz "
140 << mom.z() << " e " << mom.e() << G4endl
141 << " v2 " << v2 << G4endl;
142
143 G4LorentzVector mom1 = mom;
144 if (v2 > small) mom1.boost(velocity);
145
146 if (verboseLevel > 3)
147 G4cout << " at lab: px " << mom1.x() << " py " << mom1.y() << " pz "
148 << mom1.z() << G4endl;
149
150 return mom1;
151}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
HepLorentzVector & boost(double, double, double)
static const G4double small

References CLHEP::HepLorentzVector::boost(), CLHEP::HepLorentzVector::e(), G4cout, G4endl, small, v2, velocity, verboseLevel, CLHEP::HepLorentzVector::x(), CLHEP::HepLorentzVector::y(), and CLHEP::HepLorentzVector::z().

Referenced by G4CollisionOutput::boostToLabFrame(), G4ElementaryParticleCollider::collide(), G4EquilibriumEvaporator::deExcite(), G4NonEquilibriumEvaporator::deExcite(), and G4NucleiModel::initializeCascad().

◆ fillKinematics()

void G4LorentzConvertor::fillKinematics ( )

Definition at line 112 of file G4LorentzConvertor.cc.

112 {
114
117
118 v2 = velocity.mag2();
119
120 G4double pvsq = v2 - valong*valong; // velocity perp to scm_momentum
121 if (verboseLevel > 3) G4cout << " pvsq " << pvsq << G4endl;
122
123 degenerated = (pvsq < small);
124 if (degenerated && verboseLevel > 2)
125 G4cout << " degenerated case (already along Z) " << G4endl;
126
127 if (verboseLevel > 3) {
128 G4cout << " v2 " << v2 << " valong " << valong
129 << " valong*valong " << valong*valong << G4endl;
130 }
131}
static constexpr double m
Definition: G4SIunits.hh:109
double G4double
Definition: G4Types.hh:83
Hep3Vector unit() const
double mag2() const
double dot(const Hep3Vector &) const
Hep3Vector vect() const
G4LorentzVector target_mom
G4ThreeVector scm_direction
G4LorentzVector bullet_mom
G4LorentzVector scm_momentum

References bullet_mom, degenerated, CLHEP::Hep3Vector::dot(), ecm_tot, G4cout, G4endl, m, CLHEP::Hep3Vector::mag2(), scm_direction, scm_momentum, small, target_mom, CLHEP::Hep3Vector::unit(), v2, valong, CLHEP::HepLorentzVector::vect(), velocity, and verboseLevel.

Referenced by toTheCenterOfMass(), and toTheTargetRestFrame().

◆ getBullet()

const G4LorentzVector & G4LorentzConvertor::getBullet ( ) const
inline

Definition at line 92 of file G4LorentzConvertor.hh.

92{ return bullet_mom; }

References bullet_mom.

◆ getKinEnergyInTheTRS()

G4double G4LorentzConvertor::getKinEnergyInTheTRS ( ) const

◆ getSCMMomentum()

G4double G4LorentzConvertor::getSCMMomentum ( ) const
inline

Definition at line 97 of file G4LorentzConvertor.hh.

97{ return scm_momentum.rho(); }

References CLHEP::HepLorentzVector::rho(), and scm_momentum.

◆ getTarget()

const G4LorentzVector & G4LorentzConvertor::getTarget ( ) const
inline

Definition at line 93 of file G4LorentzConvertor.hh.

93{ return target_mom; }

References target_mom.

◆ getTotalSCMEnergy()

G4double G4LorentzConvertor::getTotalSCMEnergy ( ) const
inline

Definition at line 96 of file G4LorentzConvertor.hh.

96{ return ecm_tot; }

References ecm_tot.

Referenced by G4ElementaryParticleCollider::collide().

◆ getTRSMomentum()

G4double G4LorentzConvertor::getTRSMomentum ( ) const

Definition at line 165 of file G4LorentzConvertor.cc.

165 {
166 if (verboseLevel > 2)
167 G4cout << " >>> G4LorentzConvertor::getTRSMomentum" << G4endl;
168
171 return bmom.rho();
172}

References CLHEP::HepLorentzVector::boost(), CLHEP::HepLorentzVector::boostVector(), bullet_mom, G4cout, G4endl, CLHEP::HepLorentzVector::rho(), target_mom, and verboseLevel.

Referenced by G4InuclCollider::collide().

◆ printBullet()

void G4LorentzConvertor::printBullet ( ) const

Definition at line 288 of file G4LorentzConvertor.cc.

288 {
289 G4cout << " G4LC bullet: px " << bullet_mom.px() << " py " << bullet_mom.py()
290 << " pz " << bullet_mom.pz() << " e " << bullet_mom.e()
291 << " mass " << bullet_mom.m() << G4endl;
292 }

References bullet_mom, CLHEP::HepLorentzVector::e(), G4cout, G4endl, CLHEP::HepLorentzVector::m(), CLHEP::HepLorentzVector::px(), CLHEP::HepLorentzVector::py(), and CLHEP::HepLorentzVector::pz().

Referenced by setBullet().

◆ printTarget()

void G4LorentzConvertor::printTarget ( ) const

Definition at line 294 of file G4LorentzConvertor.cc.

294 {
295 G4cout << " G4LC target: px " << target_mom.px() << " py " << target_mom.py()
296 << " pz " << target_mom.pz() << " e " << target_mom.e()
297 << " mass " << target_mom.m() << G4endl;
298}

References CLHEP::HepLorentzVector::e(), G4cout, G4endl, CLHEP::HepLorentzVector::m(), CLHEP::HepLorentzVector::px(), CLHEP::HepLorentzVector::py(), CLHEP::HepLorentzVector::pz(), and target_mom.

Referenced by setTarget().

◆ reflectionNeeded()

G4bool G4LorentzConvertor::reflectionNeeded ( ) const

Definition at line 264 of file G4LorentzConvertor.cc.

264 {
265 if (verboseLevel > 2)
266 G4cout << " >>> G4LorentzConvertor::reflectionNeeded (query)" << G4endl;
267
268 if (verboseLevel > 3) {
269 G4cout << " v2 = " << v2 << " SCM z = " << scm_momentum.z()
270 << " degenerated? " << degenerated << G4endl;
271 }
272
273 if (v2 < small && !degenerated)
274 throw G4HadronicException(__FILE__, __LINE__, "G4LorentzConvertor::reflectionNeeded - return value undefined");
275
276 if (verboseLevel > 2) {
277 G4cout << " reflection across XY is"
278 << ((v2>=small && (!degenerated || scm_momentum.z()<0.0))?"":" NOT")
279 << " needed" << G4endl;
280 }
281
282 return (v2>=small && (!degenerated || scm_momentum.z()<0.0));
283}

References degenerated, G4cout, G4endl, scm_momentum, small, v2, verboseLevel, and CLHEP::HepLorentzVector::z().

Referenced by G4CollisionOutput::boostToLabFrame().

◆ rotate() [1/2]

G4LorentzVector G4LorentzConvertor::rotate ( const G4LorentzVector mom) const

Definition at line 174 of file G4LorentzConvertor.cc.

174 {
175 if (verboseLevel > 2)
176 G4cout << " >>> G4LorentzConvertor::rotate(G4LorentzVector)" << G4endl;
177
178 if (verboseLevel > 3) {
179 G4cout << " valong " << valong << " degenerated " << degenerated << G4endl
180 << " before rotation: px " << mom.x() << " py " << mom.y()
181 << " pz " << mom.z() << G4endl;
182 }
183
184 G4LorentzVector mom_rot = mom;
185 if (!degenerated) {
186 if (verboseLevel > 2)
187 G4cout << " rotating to align with reference z axis " << G4endl;
188
191
192 if (vscm.mag() > small && vxcm.mag() > small) { // Double check
193 if (verboseLevel > 3) {
194 G4cout << " reference z axis " << scm_direction
195 << " vscm " << vscm << " vxcm " << vxcm << G4endl;
196 }
197
198 mom_rot.setVect(mom.x()*vscm.unit() + mom.y()*vxcm.unit() +
199 mom.z()*scm_direction);
200 } else {
201 if (verboseLevel)
202 G4cerr << ">>> G4LorentzVector::rotate zero with !degenerated" << G4endl;
203 }
204 }
205
206 if (verboseLevel > 3) {
207 G4cout << " after rotation: px " << mom_rot.x() << " py " << mom_rot.y()
208 << " pz " << mom_rot.z() << G4endl;
209 }
210
211 return mom_rot;
212}
G4GLOB_DLL std::ostream G4cerr
Hep3Vector cross(const Hep3Vector &) const
double mag() const
void setVect(const Hep3Vector &)

References CLHEP::Hep3Vector::cross(), degenerated, G4cerr, G4cout, G4endl, CLHEP::Hep3Vector::mag(), scm_direction, CLHEP::HepLorentzVector::setVect(), small, CLHEP::Hep3Vector::unit(), valong, velocity, verboseLevel, CLHEP::HepLorentzVector::x(), CLHEP::HepLorentzVector::y(), and CLHEP::HepLorentzVector::z().

Referenced by G4CollisionOutput::boostToLabFrame(), G4CascadeFinalStateAlgorithm::FillDirManyBody(), G4CascadeFinalStateAlgorithm::FillDirThreeBody(), and G4CascadeFinalStateAlgorithm::GenerateTwoBody().

◆ rotate() [2/2]

G4LorentzVector G4LorentzConvertor::rotate ( const G4LorentzVector mom1,
const G4LorentzVector mom 
) const

Definition at line 214 of file G4LorentzConvertor.cc.

215 {
216 if (verboseLevel > 2)
217 G4cout << " >>> G4LorentzConvertor::rotate(G4LorentzVector,G4LorentzVector)"
218 << G4endl;
219
220 if (verboseLevel > 3) {
221 G4cout << " before rotation: px " << mom.x() << " py " << mom.y()
222 << " pz " << mom.z() << G4endl;
223 }
224
225 G4ThreeVector mom1_dir = mom1.vect().unit();
226 G4double pv = velocity.dot(mom1_dir);
227
228 G4double vperp = v2 - pv*pv; // velocity perpendicular to mom1
229 if (verboseLevel > 3) {
230 G4cout << " vperp " << vperp << " small? " << (vperp <= small) << G4endl;
231 }
232
233 G4LorentzVector mom_rot = mom;
234
235 if (vperp > small) {
236 if (verboseLevel > 2)
237 G4cout << " rotating to align with first z axis " << G4endl;
238
239 G4ThreeVector vmom1 = velocity - pv*mom1_dir;
240 G4ThreeVector vxm1 = mom1_dir.cross(velocity);
241
242 if (vmom1.mag() > small && vxm1.mag() > small) { // Double check
243 if (verboseLevel > 3) {
244 G4cout << " first z axis " << mom1_dir << G4endl
245 << " vmom1 " << vmom1 << " vxm1 " << vxm1 << G4endl;
246 }
247
248 mom_rot.setVect(mom.x()*vmom1.unit() + mom.y()*vxm1.unit() +
249 mom.z()*mom1_dir );
250 } else {
251 if (verboseLevel)
252 G4cerr << ">>> G4LorentzVector::rotate zero with !degenerated" << G4endl;
253 }
254 }
255
256 if (verboseLevel > 3) {
257 G4cout << " after rotation: px " << mom_rot.x() << " py " << mom_rot.y()
258 << " pz " << mom_rot.z() << G4endl;
259 }
260
261 return mom_rot;
262}

References CLHEP::Hep3Vector::cross(), CLHEP::Hep3Vector::dot(), G4cerr, G4cout, G4endl, CLHEP::Hep3Vector::mag(), CLHEP::HepLorentzVector::setVect(), small, CLHEP::Hep3Vector::unit(), v2, CLHEP::HepLorentzVector::vect(), velocity, verboseLevel, CLHEP::HepLorentzVector::x(), CLHEP::HepLorentzVector::y(), and CLHEP::HepLorentzVector::z().

◆ setBullet() [1/4]

void G4LorentzConvertor::setBullet ( const G4InuclParticle bullet)
inline

Definition at line 59 of file G4LorentzConvertor.hh.

59{ setBullet(&bullet); }

References setBullet().

Referenced by setBullet().

◆ setBullet() [2/4]

void G4LorentzConvertor::setBullet ( const G4InuclParticle bullet)

◆ setBullet() [3/4]

void G4LorentzConvertor::setBullet ( const G4LorentzVector bmom)
inline

Definition at line 63 of file G4LorentzConvertor.hh.

63 {
64 bullet_mom = bmom;
65 if (verboseLevel > 3) printBullet();
66 }

References bullet_mom, printBullet(), and verboseLevel.

◆ setBullet() [4/4]

void G4LorentzConvertor::setBullet ( const G4LorentzVector bmom,
G4double  bmass 
)
inline

Definition at line 74 of file G4LorentzConvertor.hh.

74 {
75 bullet_mom.setVectM(bmom.vect(), bmass);
76 if (verboseLevel > 3) printBullet();
77 }
void setVectM(const Hep3Vector &spatial, double mass)

References bullet_mom, printBullet(), CLHEP::HepLorentzVector::setVectM(), CLHEP::HepLorentzVector::vect(), and verboseLevel.

◆ setTarget() [1/4]

void G4LorentzConvertor::setTarget ( const G4InuclParticle target)
inline

Definition at line 60 of file G4LorentzConvertor.hh.

60{ setTarget(&target); }

References setTarget().

Referenced by setTarget().

◆ setTarget() [2/4]

void G4LorentzConvertor::setTarget ( const G4InuclParticle target)

◆ setTarget() [3/4]

void G4LorentzConvertor::setTarget ( const G4LorentzVector bmom)
inline

Definition at line 68 of file G4LorentzConvertor.hh.

68 {
69 target_mom = bmom;
70 if (verboseLevel > 3) printTarget();
71 }

References printTarget(), target_mom, and verboseLevel.

◆ setTarget() [4/4]

void G4LorentzConvertor::setTarget ( const G4LorentzVector tmom,
G4double  tmass 
)
inline

◆ setVerbose()

void G4LorentzConvertor::setVerbose ( G4int  vb = 0)
inline

◆ toTheCenterOfMass()

void G4LorentzConvertor::toTheCenterOfMass ( )

Definition at line 77 of file G4LorentzConvertor.cc.

77 {
78 if (verboseLevel > 2)
79 G4cout << " >>> G4LorentzConvertor::toTheCenterOfMass" << G4endl;
80
81 velocity = (target_mom+bullet_mom).boostVector();
82 if (verboseLevel > 3) G4cout << " boost " << velocity << G4endl;
83
84 // "SCM" is reverse target momentum in the CM frame
88
89 if (verboseLevel > 3) G4cout << " pscm " << scm_momentum.vect() << G4endl;
90
92}

References CLHEP::HepLorentzVector::boost(), bullet_mom, fillKinematics(), G4cout, G4endl, scm_momentum, CLHEP::HepLorentzVector::setVect(), target_mom, CLHEP::HepLorentzVector::vect(), velocity, and verboseLevel.

Referenced by G4ElementaryParticleCollider::collide(), G4NucleiModel::inverseMeanFreePath(), and G4CascadeFinalStateAlgorithm::SaveKinematics().

◆ toTheTargetRestFrame()

void G4LorentzConvertor::toTheTargetRestFrame ( )

Definition at line 94 of file G4LorentzConvertor.cc.

94 {
95 if (verboseLevel > 2)
96 G4cout << " >>> G4LorentzConvertor::toTheTargetRestFrame" << G4endl;
97
99 if (verboseLevel > 3) G4cout << " boost " << velocity << G4endl;
100
101 // "SCM" is bullet momentum in the target's frame
104
105 if (verboseLevel > 3) G4cout << " pseudo-pscm " << scm_momentum.vect() << G4endl;
106
108}

References CLHEP::HepLorentzVector::boost(), CLHEP::HepLorentzVector::boostVector(), bullet_mom, fillKinematics(), G4cout, G4endl, scm_momentum, target_mom, CLHEP::HepLorentzVector::vect(), velocity, and verboseLevel.

Referenced by G4InuclCollider::collide(), G4EquilibriumEvaporator::deExcite(), G4NonEquilibriumEvaporator::deExcite(), and G4NucleiModel::initializeCascad().

◆ trivial()

G4bool G4LorentzConvertor::trivial ( ) const
inline

Definition at line 107 of file G4LorentzConvertor.hh.

107{ return degenerated; }

References degenerated.

Referenced by G4InuclCollider::collide().

Field Documentation

◆ bullet_mom

G4LorentzVector G4LorentzConvertor::bullet_mom
private

◆ degenerated

G4bool G4LorentzConvertor::degenerated
private

Definition at line 128 of file G4LorentzConvertor.hh.

Referenced by fillKinematics(), reflectionNeeded(), rotate(), and trivial().

◆ ecm_tot

G4double G4LorentzConvertor::ecm_tot
private

Definition at line 126 of file G4LorentzConvertor.hh.

Referenced by fillKinematics(), and getTotalSCMEnergy().

◆ scm_direction

G4ThreeVector G4LorentzConvertor::scm_direction
private

Definition at line 121 of file G4LorentzConvertor.hh.

Referenced by fillKinematics(), and rotate().

◆ scm_momentum

G4LorentzVector G4LorentzConvertor::scm_momentum
private

◆ small

const G4double G4LorentzConvertor::small = 1.0e-10
staticprivate

Definition at line 114 of file G4LorentzConvertor.hh.

Referenced by backToTheLab(), fillKinematics(), reflectionNeeded(), and rotate().

◆ target_mom

G4LorentzVector G4LorentzConvertor::target_mom
private

◆ v2

G4double G4LorentzConvertor::v2
private

Definition at line 125 of file G4LorentzConvertor.hh.

Referenced by backToTheLab(), fillKinematics(), reflectionNeeded(), and rotate().

◆ valong

G4double G4LorentzConvertor::valong
private

Definition at line 127 of file G4LorentzConvertor.hh.

Referenced by fillKinematics(), and rotate().

◆ velocity

G4ThreeVector G4LorentzConvertor::velocity
private

◆ verboseLevel

G4int G4LorentzConvertor::verboseLevel
private

The documentation for this class was generated from the following files: