CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

BoostZ.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // ---------------------------------------------------------------------------
3 //
4 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
5 //
6 // This is the implementation of the HepBoostZ class.
7 //
8 
9 #ifdef GNUPRAGMA
10 #pragma implementation
11 #endif
12 
13 #include "CLHEP/Vector/defs.h"
14 #include "CLHEP/Vector/BoostZ.h"
15 #include "CLHEP/Vector/Boost.h"
16 #include "CLHEP/Vector/Rotation.h"
17 #include "CLHEP/Vector/LorentzRotation.h"
18 #include "CLHEP/Vector/ZMxpv.h"
19 
20 namespace CLHEP {
21 
22 // ---------- Constructors and Assignment:
23 
24 HepBoostZ & HepBoostZ::set (double bbeta) {
25  double b2 = bbeta*bbeta;
26  if (b2 >= 1) {
27  ZMthrowA (ZMxpvTachyonic(
28  "Beta supplied to set HepBoostZ represents speed >= c."));
29  beta_ = 1.0 - 1.0E-8; // NaN-proofing
30  gamma_ = 1.0 / std::sqrt(1.0 - b2);
31  return *this;
32  }
33  beta_ = bbeta;
34  gamma_ = 1.0 / std::sqrt(1.0 - b2);
35  return *this;
36 }
37 
38 // ---------- Accessors:
39 
41  double bg = beta_*gamma_;
42  return HepRep4x4( 1, 0, 0, 0,
43  0, 1, 0, 0,
44  0, 0, gamma_, bg,
45  0, 0, bg, gamma_ );
46 }
47 
49  double bg = beta_*gamma_;
50  return HepRep4x4Symmetric( 1, 0, 0, 0,
51  1, 0, 0,
52  gamma_, bg,
53  gamma_ );
54 }
55 
56 // ---------- Decomposition:
57 
58 void HepBoostZ::decompose (HepRotation & rotation, HepBoost & boost) const {
59  HepAxisAngle vdelta = HepAxisAngle();
60  rotation = HepRotation(vdelta);
61  Hep3Vector bbeta = boostVector();
62  boost = HepBoost(bbeta);
63 }
64 
65 void HepBoostZ::decompose (HepAxisAngle & rotation, Hep3Vector & boost) const {
66  rotation = HepAxisAngle();
67  boost = boostVector();
68 }
69 
70 void HepBoostZ::decompose (HepBoost & boost, HepRotation & rotation) const {
71  HepAxisAngle vdelta = HepAxisAngle();
72  rotation = HepRotation(vdelta);
73  Hep3Vector bbeta = boostVector();
74  boost = HepBoost(bbeta);
75 }
76 
77 void HepBoostZ::decompose (Hep3Vector & boost, HepAxisAngle & rotation) const {
78  rotation = HepAxisAngle();
79  boost = boostVector();
80 }
81 
82 // ---------- Comparisons:
83 
84 double HepBoostZ::distance2( const HepBoost & b ) const {
85  return b.distance2(*this);
86 }
87 
88 double HepBoostZ::distance2( const HepRotation & r ) const {
89  double db2 = norm2();
90  double dr2 = r.norm2();
91  return (db2 + dr2);
92 }
93 
94 double HepBoostZ::distance2( const HepLorentzRotation & lt ) const {
95  HepBoost b1;
96  HepRotation r1;
97  lt.decompose(b1,r1);
98  double db2 = distance2(b1);
99  double dr2 = r1.norm2();
100  return (db2 + dr2);
101 }
102 
103 bool HepBoostZ::isNear (const HepRotation & r, double epsilon) const {
104  double db2 = norm2();
105  if (db2 > epsilon*epsilon) return false;
106  double dr2 = r.norm2();
107  return (db2+dr2 <= epsilon*epsilon);
108 }
109 
111  double epsilon ) const {
112  HepBoost b1;
113  HepRotation r1;
114  double db2 = distance2(b1);
115  lt.decompose(b1,r1);
116  if (db2 > epsilon*epsilon) return false;
117  double dr2 = r1.norm2();
118  return (db2 + dr2);
119 }
120 
121 // ---------- Properties:
122 
124  // Assuming the representation of this is close to a true pure boost,
125  // but may have drifted due to round-off error from many operations,
126  // this forms an "exact" pure BoostZ matrix for again.
127 
128  double b2 = beta_*beta_;
129  if (b2 >= 1) {
130  beta_ = 1.0 - 1.0e-8; // NaN-proofing
131  b2 = beta_*beta_;
132  }
133  gamma_ = 1.0 / std::sqrt(1.0 - b2);
134 }
135 
136 // ---------- Application:
137 
138 // ---------- Operations in the group of 4-Rotations
139 
141  return HepBoostZ ( (beta()+b.beta()) / (1+beta()*b.beta()) );
142 }
144  HepLorentzRotation me (*this);
145  return me*b;
146 }
148  HepLorentzRotation me (*this);
149  return me*r;
150 }
152  HepLorentzRotation me (*this);
153  return me*lt;
154 }
155 
156 // ---------- I/O
157 
158 std::ostream & HepBoostZ::print( std::ostream & os ) const {
159  os << "Boost in Z direction (beta = " << beta_
160  << ", gamma = " << gamma_ << ") ";
161  return os;
162 }
163 
164 } // namespace CLHEP
CLHEP::HepBoostZ::operator*
HepLorentzVector operator*(const HepLorentzVector &w) const
CLHEP::HepBoostZ::beta
double beta() const
CLHEP::HepBoostZ::boostVector
Hep3Vector boostVector() const
CLHEP::HepAxisAngle
Definition: Geometry/CLHEP/Vector/AxisAngle.h:37
HepBoost
namespace and inside the zmpv namespace it typedef s UnitVector to be HepUnit3Vector The conversion which provide those methods available for GETTING INFORMATION if an object might be either a Rotation or a since RI has methods a routine can be passed a RI &and take because anything you wish to ask about a LT you could equally well ask about a Rotation From one derives Rotation and its special cases RotationX etc We can t derive RotationX from from one derives HepLorentzRotation along with HepBoost
Definition: keyMergeIssues.doc:304
b
@ b
Definition: testCategories.cc:125
CLHEP::HepBoostZ::beta_
double beta_
Definition: Geometry/CLHEP/Vector/BoostZ.h:209
CLHEP::HepRep4x4Symmetric
Definition: Geometry/CLHEP/Vector/RotationInterfaces.h:370
CLHEP::HepBoostZ::rectify
void rectify()
Definition: BoostZ.cc:123
CLHEP::HepBoostZ::decompose
void decompose(HepRotation &rotation, HepBoost &boost) const
Definition: BoostZ.cc:58
CLHEP::HepBoostZ::print
std::ostream & print(std::ostream &os) const
Definition: BoostZ.cc:158
CLHEP::HepBoostZ::HepBoostZ
HepBoostZ()
CLHEP::HepRotation
Definition: Geometry/CLHEP/Vector/Rotation.h:48
CLHEP::HepBoostZ::gamma_
double gamma_
Definition: Geometry/CLHEP/Vector/BoostZ.h:210
CLHEP::HepLorentzRotation
Definition: Geometry/CLHEP/Vector/LorentzRotation.h:54
CLHEP::HepRep4x4
Definition: Geometry/CLHEP/Vector/RotationInterfaces.h:336
CLHEP::HepBoostZ::set
HepBoostZ & set(double beta)
Definition: BoostZ.cc:24
CLHEP
Definition: ClhepVersion.h:13
CLHEP::HepBoostZ::distance2
double distance2(const HepBoostZ &b) const
CLHEP::HepBoost
Definition: Geometry/CLHEP/Vector/Boost.h:43
CLHEP::HepBoostZ::norm2
double norm2() const
CLHEP::HepBoostZ
Definition: Geometry/CLHEP/Vector/BoostZ.h:42
CLHEP::Hep3Vector
Definition: Geometry/CLHEP/Vector/ThreeVector.h:41
CLHEP::HepBoostZ::isNear
bool isNear(const HepBoostZ &b, double epsilon=Hep4RotationInterface::tolerance) const
CLHEP::HepBoostZ::rep4x4
HepRep4x4 rep4x4() const
Definition: BoostZ.cc:40
CLHEP::HepLorentzRotation::decompose
void decompose(Hep3Vector &boost, HepAxisAngle &rotation) const
Definition: LorentzRotationD.cc:48
ZMthrowA
it has advantages For I leave the ZMthrows but substitute I replaced ZMthrow with ZMthrowA in this package ZMthrowA
Definition: keyMergeIssues.doc:69
CLHEP::HepRotation::norm2
double norm2() const
Definition: RotationP.cc:52
CLHEP::HepBoostZ::rep4x4Symmetric
HepRep4x4Symmetric rep4x4Symmetric() const
Definition: BoostZ.cc:48