Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
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 45 of file G4LorentzConvertor.hh.

Constructor & Destructor Documentation

G4LorentzConvertor::G4LorentzConvertor ( )

Definition at line 47 of file G4LorentzConvertor.cc.

48  : verboseLevel(0), v2(0.), ecm_tot(0.), valong(0.), degenerated(false) {}
G4LorentzConvertor::G4LorentzConvertor ( const G4LorentzVector bmom,
G4double  bmass,
const G4LorentzVector tmom,
G4double  tmass 
)

Definition at line 51 of file G4LorentzConvertor.cc.

References setBullet(), and setTarget().

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

Definition at line 59 of file G4LorentzConvertor.cc.

References setBullet(), and setTarget().

61  : verboseLevel(0), v2(0.), ecm_tot(0.), valong(0.), degenerated(false) {
62  setBullet(bullet);
63  setTarget(target);
64 }
void setBullet(const G4InuclParticle *bullet)
void setTarget(const G4InuclParticle *target)

Member Function Documentation

G4LorentzVector G4LorentzConvertor::backToTheLab ( const G4LorentzVector mom) const

Definition at line 135 of file G4LorentzConvertor.cc.

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

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

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

Definition at line 113 of file G4LorentzConvertor.cc.

References CLHEP::Hep3Vector::dot(), G4cout, G4endl, python.hepunit::m, CLHEP::Hep3Vector::mag2(), CLHEP::Hep3Vector::unit(), and CLHEP::HepLorentzVector::vect().

Referenced by toTheCenterOfMass(), and toTheTargetRestFrame().

113  {
114  ecm_tot = (target_mom+bullet_mom).m();
115 
116  scm_direction = scm_momentum.vect().unit();
117  valong = velocity.dot(scm_direction);
118 
119  v2 = velocity.mag2();
120 
121  G4double pvsq = v2 - valong*valong; // velocity perp to scm_momentum
122  if (verboseLevel > 3) G4cout << " pvsq " << pvsq << G4endl;
123 
124  degenerated = (pvsq < small);
125  if (degenerated && verboseLevel > 2)
126  G4cout << " degenerated case (already along Z) " << G4endl;
127 
128  if (verboseLevel > 3) {
129  G4cout << " v2 " << v2 << " valong " << valong
130  << " valong*valong " << valong*valong << G4endl;
131  }
132 }
double dot(const Hep3Vector &) const
Hep3Vector vect() const
G4GLOB_DLL std::ostream G4cout
Hep3Vector unit() const
double mag2() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
const G4LorentzVector& G4LorentzConvertor::getBullet ( ) const
inline

Definition at line 93 of file G4LorentzConvertor.hh.

93 { return bullet_mom; }
G4double G4LorentzConvertor::getKinEnergyInTheTRS ( ) const

Definition at line 157 of file G4LorentzConvertor.cc.

References CLHEP::HepLorentzVector::boost(), CLHEP::HepLorentzVector::boostVector(), CLHEP::HepLorentzVector::e(), G4cout, G4endl, and CLHEP::HepLorentzVector::m().

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

157  {
158  if (verboseLevel > 2)
159  G4cout << " >>> G4LorentzConvertor::getKinEnergyInTheTRS" << G4endl;
160 
161  G4LorentzVector bmom = bullet_mom;
162  bmom.boost(-target_mom.boostVector());
163  return bmom.e()-bmom.m();
164 }
Hep3Vector boostVector() const
G4GLOB_DLL std::ostream G4cout
HepLorentzVector & boost(double, double, double)
#define G4endl
Definition: G4ios.hh:61
G4double G4LorentzConvertor::getSCMMomentum ( ) const
inline

Definition at line 98 of file G4LorentzConvertor.hh.

References CLHEP::HepLorentzVector::rho().

98 { return scm_momentum.rho(); }
double rho() const
const G4LorentzVector& G4LorentzConvertor::getTarget ( ) const
inline

Definition at line 94 of file G4LorentzConvertor.hh.

94 { return target_mom; }
G4double G4LorentzConvertor::getTotalSCMEnergy ( ) const
inline

Definition at line 97 of file G4LorentzConvertor.hh.

Referenced by G4ElementaryParticleCollider::collide().

97 { return ecm_tot; }
G4double G4LorentzConvertor::getTRSMomentum ( ) const

Definition at line 166 of file G4LorentzConvertor.cc.

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

Referenced by G4InuclCollider::collide().

166  {
167  if (verboseLevel > 2)
168  G4cout << " >>> G4LorentzConvertor::getTRSMomentum" << G4endl;
169 
170  G4LorentzVector bmom = bullet_mom;
171  bmom.boost(-target_mom.boostVector());
172  return bmom.rho();
173 }
Hep3Vector boostVector() const
G4GLOB_DLL std::ostream G4cout
HepLorentzVector & boost(double, double, double)
double rho() const
#define G4endl
Definition: G4ios.hh:61
void G4LorentzConvertor::printBullet ( ) const

Definition at line 289 of file G4LorentzConvertor.cc.

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

Referenced by setBullet().

289  {
290  G4cout << " G4LC bullet: px " << bullet_mom.px() << " py " << bullet_mom.py()
291  << " pz " << bullet_mom.pz() << " e " << bullet_mom.e()
292  << " mass " << bullet_mom.m() << G4endl;
293  }
G4GLOB_DLL std::ostream G4cout
double py() const
double px() const
double pz() const
#define G4endl
Definition: G4ios.hh:61
void G4LorentzConvertor::printTarget ( ) const

Definition at line 295 of file G4LorentzConvertor.cc.

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

Referenced by setTarget().

295  {
296  G4cout << " G4LC target: px " << target_mom.px() << " py " << target_mom.py()
297  << " pz " << target_mom.pz() << " e " << target_mom.e()
298  << " mass " << target_mom.m() << G4endl;
299 }
G4GLOB_DLL std::ostream G4cout
double py() const
double px() const
double pz() const
#define G4endl
Definition: G4ios.hh:61
G4bool G4LorentzConvertor::reflectionNeeded ( ) const

Definition at line 265 of file G4LorentzConvertor.cc.

References G4cout, G4endl, and CLHEP::HepLorentzVector::z().

Referenced by G4CollisionOutput::boostToLabFrame().

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

Definition at line 175 of file G4LorentzConvertor.cc.

References CLHEP::Hep3Vector::cross(), G4cerr, G4cout, G4endl, CLHEP::Hep3Vector::mag(), CLHEP::HepLorentzVector::setVect(), CLHEP::Hep3Vector::unit(), CLHEP::HepLorentzVector::x(), CLHEP::HepLorentzVector::y(), and CLHEP::HepLorentzVector::z().

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

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

Definition at line 215 of file G4LorentzConvertor.cc.

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

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

Definition at line 60 of file G4LorentzConvertor.hh.

References setBullet().

Referenced by setBullet().

60 { setBullet(&bullet); }
void setBullet(const G4InuclParticle *bullet)
void G4LorentzConvertor::setBullet ( const G4LorentzVector bmom)
inline

Definition at line 64 of file G4LorentzConvertor.hh.

References printBullet().

64  {
65  bullet_mom = bmom;
66  if (verboseLevel > 3) printBullet();
67  }
void G4LorentzConvertor::setBullet ( const G4LorentzVector bmom,
G4double  bmass 
)
inline

Definition at line 75 of file G4LorentzConvertor.hh.

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

75  {
76  bullet_mom.setVectM(bmom.vect(), bmass);
77  if (verboseLevel > 3) printBullet();
78  }
void setVectM(const Hep3Vector &spatial, double mass)
Hep3Vector vect() const
void G4LorentzConvertor::setTarget ( const G4InuclParticle target)
void G4LorentzConvertor::setTarget ( const G4InuclParticle target)
inline

Definition at line 61 of file G4LorentzConvertor.hh.

References setTarget().

Referenced by setTarget().

61 { setTarget(&target); }
void setTarget(const G4InuclParticle *target)
void G4LorentzConvertor::setTarget ( const G4LorentzVector bmom)
inline

Definition at line 69 of file G4LorentzConvertor.hh.

References printTarget().

69  {
70  target_mom = bmom;
71  if (verboseLevel > 3) printTarget();
72  }
void G4LorentzConvertor::setTarget ( const G4LorentzVector tmom,
G4double  tmass 
)
inline

Definition at line 80 of file G4LorentzConvertor.hh.

References printTarget(), CLHEP::HepLorentzVector::setVectM(), and CLHEP::HepLorentzVector::vect().

80  {
81  target_mom.setVectM(tmom.vect(), tmass);
82  if (verboseLevel > 3) printTarget();
83  }
void setVectM(const Hep3Vector &spatial, double mass)
Hep3Vector vect() const
void G4LorentzConvertor::setVerbose ( G4int  vb = 0)
inline

Definition at line 55 of file G4LorentzConvertor.hh.

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

55 { verboseLevel = vb; }
void G4LorentzConvertor::toTheCenterOfMass ( )

Definition at line 78 of file G4LorentzConvertor.cc.

References CLHEP::HepLorentzVector::boost(), fillKinematics(), G4cout, G4endl, CLHEP::HepLorentzVector::setVect(), and CLHEP::HepLorentzVector::vect().

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

78  {
79  if (verboseLevel > 2)
80  G4cout << " >>> G4LorentzConvertor::toTheCenterOfMass" << G4endl;
81 
82  velocity = (target_mom+bullet_mom).boostVector();
83  if (verboseLevel > 3) G4cout << " boost " << velocity << G4endl;
84 
85  // "SCM" is reverse target momentum in the CM frame
86  scm_momentum = target_mom;
87  scm_momentum.boost(-velocity);
88  scm_momentum.setVect(-scm_momentum.vect());
89 
90  if (verboseLevel > 3) G4cout << " pscm " << scm_momentum.vect() << G4endl;
91 
93 }
Hep3Vector vect() const
G4GLOB_DLL std::ostream G4cout
HepLorentzVector & boost(double, double, double)
#define G4endl
Definition: G4ios.hh:61
void setVect(const Hep3Vector &)
void G4LorentzConvertor::toTheTargetRestFrame ( )

Definition at line 95 of file G4LorentzConvertor.cc.

References CLHEP::HepLorentzVector::boost(), CLHEP::HepLorentzVector::boostVector(), fillKinematics(), G4cout, G4endl, and CLHEP::HepLorentzVector::vect().

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

95  {
96  if (verboseLevel > 2)
97  G4cout << " >>> G4LorentzConvertor::toTheTargetRestFrame" << G4endl;
98 
99  velocity = target_mom.boostVector();
100  if (verboseLevel > 3) G4cout << " boost " << velocity << G4endl;
101 
102  // "SCM" is bullet momentum in the target's frame
103  scm_momentum = bullet_mom;
104  scm_momentum.boost(-velocity);
105 
106  if (verboseLevel > 3) G4cout << " pseudo-pscm " << scm_momentum.vect() << G4endl;
107 
108  fillKinematics();
109 }
Hep3Vector boostVector() const
Hep3Vector vect() const
G4GLOB_DLL std::ostream G4cout
HepLorentzVector & boost(double, double, double)
#define G4endl
Definition: G4ios.hh:61
G4bool G4LorentzConvertor::trivial ( ) const
inline

Definition at line 108 of file G4LorentzConvertor.hh.

Referenced by G4InuclCollider::collide().

108 { return degenerated; }

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