10 #pragma implementation
13 #include "CLHEP/Vector/BoostX.h"
14 #include "CLHEP/Vector/Boost.h"
15 #include "CLHEP/Vector/Rotation.h"
16 #include "CLHEP/Vector/LorentzRotation.h"
23 HepBoostX & HepBoostX::set (
double bbeta) {
24 double b2 = bbeta*bbeta;
26 std::cerr <<
"HepBoostX::set() - "
27 <<
"Beta supplied to set HepBoostX represents speed >= c." << std::endl;
29 gamma_ = 1.0 / std::sqrt(1.0 - b2);
33 gamma_ = 1.0 / std::sqrt(1.0 - b2);
39 HepRep4x4 HepBoostX::rep4x4()
const {
40 double bg = beta_*gamma_;
41 return HepRep4x4( gamma_, 0, 0, bg,
47 HepRep4x4Symmetric HepBoostX::rep4x4Symmetric()
const {
48 double bg = beta_*gamma_;
49 return HepRep4x4Symmetric( gamma_, 0, 0, bg,
57 void HepBoostX::decompose (HepRotation & rotation, HepBoost & boost)
const {
58 HepAxisAngle vdelta = HepAxisAngle();
59 rotation = HepRotation(vdelta);
60 Hep3Vector bbeta = boostVector();
61 boost = HepBoost(bbeta);
64 void HepBoostX::decompose (HepAxisAngle & rotation, Hep3Vector & boost)
const {
65 rotation = HepAxisAngle();
66 boost = boostVector();
69 void HepBoostX::decompose (HepBoost & boost, HepRotation & rotation)
const {
70 HepAxisAngle vdelta = HepAxisAngle();
71 rotation = HepRotation(vdelta);
72 Hep3Vector bbeta = boostVector();
73 boost = HepBoost(bbeta);
76 void HepBoostX::decompose (Hep3Vector & boost, HepAxisAngle & rotation)
const {
77 rotation = HepAxisAngle();
78 boost = boostVector();
83 double HepBoostX::distance2(
const HepBoost & b )
const {
84 return b.distance2(*
this);
87 double HepBoostX::distance2(
const HepRotation & r )
const {
89 double dr2 = r.norm2();
93 double HepBoostX::distance2(
const HepLorentzRotation & lt )
const {
97 double db2 = distance2(b1);
98 double dr2 = r1.norm2();
102 bool HepBoostX::isNear (
const HepRotation & r,
double epsilon)
const {
103 double db2 = norm2();
104 if (db2 > epsilon*epsilon)
return false;
105 double dr2 = r.norm2();
106 return (db2+dr2 <= epsilon*epsilon);
109 bool HepBoostX::isNear (
const HepLorentzRotation & lt,
110 double epsilon)
const {
113 double db2 = distance2(b1);
115 if (db2 > epsilon*epsilon)
return false;
116 double dr2 = r1.norm2();
122 void HepBoostX::rectify() {
127 double b2 = beta_*beta_;
129 beta_ = 1.0 - 1.0e-8;
132 gamma_ = 1.0 / std::sqrt(1.0 - b2);
140 return HepBoostX ( (beta()+b.beta()) / (1+beta()*b.beta()) );
143 HepLorentzRotation me (*
this);
147 HepLorentzRotation me (*
this);
151 HepLorentzRotation me (*
this);
158 os <<
"Boost in X direction (beta = " << beta_
159 <<
", gamma = " << gamma_ <<
") ";
G4ErrorMatrix operator*(const G4ErrorMatrix &m1, const G4ErrorMatrix &m2)
void print(const std::vector< T > &data)