45const G4double G4LorentzConvertor::small = 1.0e-10;
48 : verboseLevel(0), v2(0.), ecm_tot(0.), valong(0.), degenerated(false) {}
53 : verboseLevel(0), v2(0.), ecm_tot(0.), valong(0.), degenerated(false) {
61 : verboseLevel(0), v2(0.), ecm_tot(0.), valong(0.), degenerated(false) {
80 G4cout <<
" >>> G4LorentzConvertor::toTheCenterOfMass" <<
G4endl;
82 velocity = (target_mom+bullet_mom).boostVector();
83 if (verboseLevel > 3)
G4cout <<
" boost " << velocity <<
G4endl;
86 scm_momentum = target_mom;
87 scm_momentum.
boost(-velocity);
97 G4cout <<
" >>> G4LorentzConvertor::toTheTargetRestFrame" <<
G4endl;
100 if (verboseLevel > 3)
G4cout <<
" boost " << velocity <<
G4endl;
103 scm_momentum = bullet_mom;
104 scm_momentum.
boost(-velocity);
106 if (verboseLevel > 3)
G4cout <<
" pseudo-pscm " << scm_momentum.
vect() <<
G4endl;
114 ecm_tot = (target_mom+bullet_mom).m();
116 scm_direction = scm_momentum.
vect().
unit();
117 valong = velocity.
dot(scm_direction);
119 v2 = velocity.
mag2();
122 if (verboseLevel > 3)
G4cout <<
" pvsq " << pvsq <<
G4endl;
124 degenerated = (pvsq < small);
125 if (degenerated && verboseLevel > 2)
126 G4cout <<
" degenerated case (already along Z) " <<
G4endl;
128 if (verboseLevel > 3) {
129 G4cout <<
" v2 " << v2 <<
" valong " << valong
130 <<
" valong*valong " << valong*valong <<
G4endl;
136 if (verboseLevel > 2)
137 G4cout <<
" >>> G4LorentzConvertor::backToTheLab" <<
G4endl;
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;
145 if (v2 > small) mom1.
boost(velocity);
147 if (verboseLevel > 3)
148 G4cout <<
" at lab: px " << mom1.
x() <<
" py " << mom1.
y() <<
" pz "
158 if (verboseLevel > 2)
159 G4cout <<
" >>> G4LorentzConvertor::getKinEnergyInTheTRS" <<
G4endl;
163 return bmom.
e()-bmom.
m();
167 if (verboseLevel > 2)
168 G4cout <<
" >>> G4LorentzConvertor::getTRSMomentum" <<
G4endl;
176 if (verboseLevel > 2)
177 G4cout <<
" >>> G4LorentzConvertor::rotate(G4LorentzVector)" <<
G4endl;
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;
187 if (verboseLevel > 2)
188 G4cout <<
" rotating to align with reference z axis " <<
G4endl;
193 if (vscm.
mag() > small && vxcm.
mag() > small) {
194 if (verboseLevel > 3) {
195 G4cout <<
" reference z axis " << scm_direction
196 <<
" vscm " << vscm <<
" vxcm " << vxcm <<
G4endl;
200 mom.
z()*scm_direction);
203 G4cerr <<
">>> G4LorentzVector::rotate zero with !degenerated" <<
G4endl;
207 if (verboseLevel > 3) {
208 G4cout <<
" after rotation: px " << mom_rot.
x() <<
" py " << mom_rot.
y()
209 <<
" pz " << mom_rot.
z() <<
G4endl;
217 if (verboseLevel > 2)
218 G4cout <<
" >>> G4LorentzConvertor::rotate(G4LorentzVector,G4LorentzVector)"
221 if (verboseLevel > 3) {
222 G4cout <<
" before rotation: px " << mom.
x() <<
" py " << mom.
y()
223 <<
" pz " << mom.
z() <<
G4endl;
230 if (verboseLevel > 3) {
231 G4cout <<
" vperp " << vperp <<
" small? " << (vperp <= small) <<
G4endl;
237 if (verboseLevel > 2)
238 G4cout <<
" rotating to align with first z axis " <<
G4endl;
243 if (vmom1.
mag() > small && vxm1.
mag() > small) {
244 if (verboseLevel > 3) {
246 <<
" vmom1 " << vmom1 <<
" vxm1 " << vxm1 <<
G4endl;
253 G4cerr <<
">>> G4LorentzVector::rotate zero with !degenerated" <<
G4endl;
257 if (verboseLevel > 3) {
258 G4cout <<
" after rotation: px " << mom_rot.
x() <<
" py " << mom_rot.
y()
259 <<
" pz " << mom_rot.
z() <<
G4endl;
266 if (verboseLevel > 2)
267 G4cout <<
" >>> G4LorentzConvertor::reflectionNeeded (query)" <<
G4endl;
269 if (verboseLevel > 3) {
270 G4cout <<
" v2 = " << v2 <<
" SCM z = " << scm_momentum.
z()
271 <<
" degenerated? " << degenerated <<
G4endl;
274 if (v2 < small && !degenerated)
275 throw G4HadronicException(__FILE__, __LINE__,
"G4LorentzConvertor::reflectionNeeded - return value undefined");
277 if (verboseLevel > 2) {
278 G4cout <<
" reflection across XY is"
279 << ((v2>=small && (!degenerated || scm_momentum.
z()<0.0))?
"":
" NOT")
283 return (v2>=small && (!degenerated || scm_momentum.
z()<0.0));
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;
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;
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
Hep3Vector cross(const Hep3Vector &) const
double dot(const Hep3Vector &) const
Hep3Vector boostVector() const
HepLorentzVector & boost(double, double, double)
void setVect(const Hep3Vector &)
G4LorentzVector getMomentum() const
void toTheTargetRestFrame()
G4double getTRSMomentum() const
G4bool reflectionNeeded() const
void setBullet(const G4InuclParticle *bullet)
G4LorentzVector backToTheLab(const G4LorentzVector &mom) const
G4LorentzVector rotate(const G4LorentzVector &mom) const
G4double getKinEnergyInTheTRS() const
void setTarget(const G4InuclParticle *target)