Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4LorentzConvertor Class Reference

#include <G4LorentzConvertor.hh>

Public Member Functions

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

Detailed Description

Definition at line 44 of file G4LorentzConvertor.hh.

Constructor & Destructor Documentation

◆ G4LorentzConvertor() [1/3]

G4LorentzConvertor::G4LorentzConvertor ( )

Definition at line 46 of file G4LorentzConvertor.cc.

47 : verboseLevel(0), v2(0.), ecm_tot(0.), valong(0.), degenerated(false) {}

◆ 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)

◆ 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}

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)

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 {
113 ecm_tot = (target_mom+bullet_mom).m();
114
115 scm_direction = scm_momentum.vect().unit();
116 valong = velocity.dot(scm_direction);
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}
double G4double
Definition: G4Types.hh:83
Hep3Vector unit() const
double mag2() const
double dot(const Hep3Vector &) const
Hep3Vector vect() const

Referenced by toTheCenterOfMass(), and toTheTargetRestFrame().

◆ getBullet()

const G4LorentzVector & G4LorentzConvertor::getBullet ( ) const
inline

Definition at line 92 of file G4LorentzConvertor.hh.

92{ return bullet_mom; }

◆ getKinEnergyInTheTRS()

G4double G4LorentzConvertor::getKinEnergyInTheTRS ( ) const

Definition at line 156 of file G4LorentzConvertor.cc.

156 {
157 if (verboseLevel > 2)
158 G4cout << " >>> G4LorentzConvertor::getKinEnergyInTheTRS" << G4endl;
159
160 G4LorentzVector bmom = bullet_mom;
161 bmom.boost(-target_mom.boostVector());
162 return bmom.e()-bmom.m();
163}
Hep3Vector boostVector() const

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

◆ getSCMMomentum()

G4double G4LorentzConvertor::getSCMMomentum ( ) const
inline

Definition at line 97 of file G4LorentzConvertor.hh.

97{ return scm_momentum.rho(); }

◆ getTarget()

const G4LorentzVector & G4LorentzConvertor::getTarget ( ) const
inline

Definition at line 93 of file G4LorentzConvertor.hh.

93{ return target_mom; }

◆ getTotalSCMEnergy()

G4double G4LorentzConvertor::getTotalSCMEnergy ( ) const
inline

Definition at line 96 of file G4LorentzConvertor.hh.

96{ return 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
169 G4LorentzVector bmom = bullet_mom;
170 bmom.boost(-target_mom.boostVector());
171 return bmom.rho();
172}

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 }

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}

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}

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
189 G4ThreeVector vscm = velocity - valong*scm_direction;
190 G4ThreeVector vxcm = scm_direction.cross(velocity);
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 &)

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}

◆ setBullet() [1/4]

void G4LorentzConvertor::setBullet ( const G4InuclParticle bullet)
inline

Definition at line 59 of file G4LorentzConvertor.hh.

59{ setBullet(&bullet); }

Referenced by setBullet().

◆ setBullet() [2/4]

◆ 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 }

◆ 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)

◆ setTarget() [1/4]

void G4LorentzConvertor::setTarget ( const G4InuclParticle target)
inline

Definition at line 60 of file G4LorentzConvertor.hh.

60{ setTarget(&target); }

Referenced by setTarget().

◆ setTarget() [2/4]

◆ 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 }

◆ setTarget() [4/4]

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

Definition at line 79 of file G4LorentzConvertor.hh.

79 {
80 target_mom.setVectM(tmom.vect(), tmass);
81 if (verboseLevel > 3) printTarget();
82 }

◆ setVerbose()

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

Definition at line 54 of file G4LorentzConvertor.hh.

54{ verboseLevel = vb; }

Referenced by G4ElementaryParticleCollider::collide(), and G4CascadeFinalStateAlgorithm::SetVerboseLevel().

◆ 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
85 scm_momentum = target_mom;
86 scm_momentum.boost(-velocity);
87 scm_momentum.setVect(-scm_momentum.vect());
88
89 if (verboseLevel > 3) G4cout << " pscm " << scm_momentum.vect() << G4endl;
90
92}

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
98 velocity = target_mom.boostVector();
99 if (verboseLevel > 3) G4cout << " boost " << velocity << G4endl;
100
101 // "SCM" is bullet momentum in the target's frame
102 scm_momentum = bullet_mom;
103 scm_momentum.boost(-velocity);
104
105 if (verboseLevel > 3) G4cout << " pseudo-pscm " << scm_momentum.vect() << G4endl;
106
108}

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; }

Referenced by G4InuclCollider::collide().


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