10 #pragma implementation
13 #include "CLHEP/Vector/LorentzRotation.h"
19 void HepLorentzRotation::decompose
20 (HepBoost & bboost, HepRotation & rotation)
const {
27 Hep3Vector betaVec ( xt(), yt(), zt() );
28 betaVec *= 1.0 / tt();
29 bboost.set( betaVec );
33 HepBoost
B( -betaVec );
34 HepLorentzRotation R(
B * *
this );
36 HepRep3x3 m1 ( R.xx(), R.xy(), R.xz(),
37 R.yx(), R.yy(), R.yz(),
38 R.zx(), R.zy(), R.zz() );
46 void HepLorentzRotation::decompose
47 (Hep3Vector & bboost, HepAxisAngle & rotation)
const {
51 bboost = b.boostVector();
52 rotation = r.axisAngle();
56 void HepLorentzRotation::decompose
57 (HepRotation & rotation, HepBoost & bboost)
const {
61 Hep3Vector betaVec( tx(), ty(), tz() );
62 betaVec *= 1.0 / tt();
63 bboost.set( betaVec );
67 HepBoost
B( -betaVec );
68 HepLorentzRotation R( *
this *
B );
70 HepRep3x3 m1 ( R.xx(), R.xy(), R.xz(),
71 R.yx(), R.yy(), R.yz(),
72 R.zx(), R.zy(), R.zz() );
79 void HepLorentzRotation::decompose
80 (HepAxisAngle & rotation, Hep3Vector & bboost)
const {
84 rotation = r.axisAngle();
85 bboost = b.boostVector();
89 double HepLorentzRotation::distance2(
const HepBoost & b )
const {
93 double db2 = b1.distance2( b );
94 double dr2 = r1.norm2();
98 double HepLorentzRotation::distance2(
const HepRotation & r )
const {
102 double db2 = b1.norm2( );
103 double dr2 = r1.distance2( r );
104 return ( db2 + dr2 );
107 double HepLorentzRotation::distance2(
108 const HepLorentzRotation & lt )
const {
114 lt.decompose (b2, r2);
115 double db2 = b1.distance2( b2 );
116 double dr2 = r1.distance2( r2 );
117 return ( db2 + dr2 );
120 double HepLorentzRotation::howNear(
const HepBoost & b )
const {
121 return std::sqrt( distance2( b ) );
123 double HepLorentzRotation::howNear(
const HepRotation & r )
const {
124 return std::sqrt( distance2( r ) );
126 double HepLorentzRotation::howNear(
const HepLorentzRotation & lt )
const {
127 return std::sqrt( distance2( lt ) );
130 bool HepLorentzRotation::isNear(
131 const HepBoost & b,
double epsilon )
const {
135 double db2 = b1.distance2(b);
136 if ( db2 > epsilon*epsilon ) {
139 double dr2 = r1.norm2();
140 return ( (db2 + dr2) <= epsilon*epsilon );
143 bool HepLorentzRotation::isNear(
144 const HepRotation & r,
double epsilon )
const {
148 double db2 = b1.norm2();
149 if ( db2 > epsilon*epsilon ) {
152 double dr2 = r1.distance2(r);
153 return ( (db2 + dr2) <= epsilon*epsilon );
156 bool HepLorentzRotation::isNear(
157 const HepLorentzRotation & lt,
double epsilon )
const {
163 lt.decompose (b2, r2);
164 double db2 = b1.distance2(b2);
165 if ( db2 > epsilon*epsilon ) {
168 double dr2 = r1.distance2(r2);
169 return ( (db2 + dr2) <= epsilon*epsilon );
172 double HepLorentzRotation::norm2()
const {
176 return b.norm2() + r.norm2();
179 void HepLorentzRotation::rectify() {
191 Hep3Vector beta (tx(), ty(), tz());
194 std::cerr <<
"HepLorentzRotation::rectify() - "
195 <<
"rectify() on a transformation with tt() <= 0 - will not help!"
200 HepLorentzRotation R = (*this) * HepBoost(-beta);
202 HepRep3x3 m1 ( R.xx(), R.xy(), R.xz(),
203 R.yx(), R.yy(), R.yz(),
204 R.zx(), R.zy(), R.zz() );
206 HepRotation Rgood (m1);
209 set ( Rgood, HepBoost(beta) );
double B(double temperature)
double epsilon(double density, double temperature)