44const G4double G4LorentzConvertor::small = 1.0e-10;
47 : verboseLevel(0), v2(0.), ecm_tot(0.), valong(0.), degenerated(false) {}
52 : verboseLevel(0), v2(0.), ecm_tot(0.), valong(0.), degenerated(false) {
60 : verboseLevel(0), v2(0.), ecm_tot(0.), valong(0.), degenerated(false) {
79 G4cout <<
" >>> G4LorentzConvertor::toTheCenterOfMass" <<
G4endl;
81 velocity = (target_mom+bullet_mom).boostVector();
82 if (verboseLevel > 3)
G4cout <<
" boost " << velocity <<
G4endl;
85 scm_momentum = target_mom;
86 scm_momentum.
boost(-velocity);
96 G4cout <<
" >>> G4LorentzConvertor::toTheTargetRestFrame" <<
G4endl;
99 if (verboseLevel > 3)
G4cout <<
" boost " << velocity <<
G4endl;
102 scm_momentum = bullet_mom;
103 scm_momentum.
boost(-velocity);
105 if (verboseLevel > 3)
G4cout <<
" pseudo-pscm " << scm_momentum.
vect() <<
G4endl;
113 ecm_tot = (target_mom+bullet_mom).m();
115 scm_direction = scm_momentum.
vect().
unit();
116 valong = velocity.
dot(scm_direction);
118 v2 = velocity.
mag2();
121 if (verboseLevel > 3)
G4cout <<
" pvsq " << pvsq <<
G4endl;
123 degenerated = (pvsq < small);
124 if (degenerated && verboseLevel > 2)
125 G4cout <<
" degenerated case (already along Z) " <<
G4endl;
127 if (verboseLevel > 3) {
128 G4cout <<
" v2 " << v2 <<
" valong " << valong
129 <<
" valong*valong " << valong*valong <<
G4endl;
135 if (verboseLevel > 2)
136 G4cout <<
" >>> G4LorentzConvertor::backToTheLab" <<
G4endl;
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;
144 if (v2 > small) mom1.
boost(velocity);
146 if (verboseLevel > 3)
147 G4cout <<
" at lab: px " << mom1.
x() <<
" py " << mom1.
y() <<
" pz "
157 if (verboseLevel > 2)
158 G4cout <<
" >>> G4LorentzConvertor::getKinEnergyInTheTRS" <<
G4endl;
162 return bmom.
e()-bmom.
m();
166 if (verboseLevel > 2)
167 G4cout <<
" >>> G4LorentzConvertor::getTRSMomentum" <<
G4endl;
175 if (verboseLevel > 2)
176 G4cout <<
" >>> G4LorentzConvertor::rotate(G4LorentzVector)" <<
G4endl;
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;
186 if (verboseLevel > 2)
187 G4cout <<
" rotating to align with reference z axis " <<
G4endl;
192 if (vscm.
mag() > small && vxcm.
mag() > small) {
193 if (verboseLevel > 3) {
194 G4cout <<
" reference z axis " << scm_direction
195 <<
" vscm " << vscm <<
" vxcm " << vxcm <<
G4endl;
199 mom.
z()*scm_direction);
202 G4cerr <<
">>> G4LorentzVector::rotate zero with !degenerated" <<
G4endl;
206 if (verboseLevel > 3) {
207 G4cout <<
" after rotation: px " << mom_rot.
x() <<
" py " << mom_rot.
y()
208 <<
" pz " << mom_rot.
z() <<
G4endl;
216 if (verboseLevel > 2)
217 G4cout <<
" >>> G4LorentzConvertor::rotate(G4LorentzVector,G4LorentzVector)"
220 if (verboseLevel > 3) {
221 G4cout <<
" before rotation: px " << mom.
x() <<
" py " << mom.
y()
222 <<
" pz " << mom.
z() <<
G4endl;
229 if (verboseLevel > 3) {
230 G4cout <<
" vperp " << vperp <<
" small? " << (vperp <= small) <<
G4endl;
236 if (verboseLevel > 2)
237 G4cout <<
" rotating to align with first z axis " <<
G4endl;
242 if (vmom1.
mag() > small && vxm1.
mag() > small) {
243 if (verboseLevel > 3) {
245 <<
" vmom1 " << vmom1 <<
" vxm1 " << vxm1 <<
G4endl;
252 G4cerr <<
">>> G4LorentzVector::rotate zero with !degenerated" <<
G4endl;
256 if (verboseLevel > 3) {
257 G4cout <<
" after rotation: px " << mom_rot.
x() <<
" py " << mom_rot.
y()
258 <<
" pz " << mom_rot.
z() <<
G4endl;
265 if (verboseLevel > 2)
266 G4cout <<
" >>> G4LorentzConvertor::reflectionNeeded (query)" <<
G4endl;
268 if (verboseLevel > 3) {
269 G4cout <<
" v2 = " << v2 <<
" SCM z = " << scm_momentum.
z()
270 <<
" degenerated? " << degenerated <<
G4endl;
273 if (v2 < small && !degenerated)
274 throw G4HadronicException(__FILE__, __LINE__,
"G4LorentzConvertor::reflectionNeeded - return value undefined");
276 if (verboseLevel > 2) {
277 G4cout <<
" reflection across XY is"
278 << ((v2>=small && (!degenerated || scm_momentum.
z()<0.0))?
"":
" NOT")
282 return (v2>=small && (!degenerated || scm_momentum.
z()<0.0));
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;
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;
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL 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)