CLHEP 2.4.7.1
C++ Class Library for High Energy Physics
Boost.h
Go to the documentation of this file.
1// -*- C++ -*-
2//
3// This file is a part of the CLHEP - a Class Library for High Energy Physics.
4//
5// This is the definition of the HepBoost class for performing specialized
6// Lorentz transformations which are pure boosts on objects of the
7// HepLorentzVector class.
8//
9// HepBoost is a concrete implementation of Hep4RotationInterface.
10//
11// .SS See Also
12// RotationInterfaces.h
13// LorentzVector.h LorentzRotation.h
14// BoostX.h BoostY.h BoostZ.h
15//
16// .SS Author
17// Mark Fischler
18
19#ifndef HEP_BOOST_H
20#define HEP_BOOST_H
21
22#include "CLHEP/Vector/defs.h"
24#include "CLHEP/Vector/BoostX.h"
25#include "CLHEP/Vector/BoostY.h"
26#include "CLHEP/Vector/BoostZ.h"
28
29namespace CLHEP {
30
31// Declarations of classes and global methods
32class HepBoost;
33inline HepBoost inverseOf ( const HepBoost & lt );
34
39class HepBoost {
40
41public:
42
43 // ---------- Constructors and Assignment:
44
45 inline HepBoost();
46 // Default constructor. Gives a boost of 0.
47
48 inline HepBoost(const HepBoost & m);
49 inline HepBoost(HepBoost && m) = default;
50 // Copy and move constructors.
51
52 inline HepBoost & operator = (const HepBoost & m);
53 inline HepBoost & operator = (HepBoost && m) = default;
54 // Copy and move assignment operators.
55
56 HepBoost & set (double betaX, double betaY, double betaZ);
57 inline HepBoost (double betaX, double betaY, double betaZ);
58 // Constructor from three components of beta vector
59
61 inline HepBoost (const HepRep4x4Symmetric & m);
62 // Constructor from symmetric HepRep4x4
63
65 inline HepBoost (Hep3Vector direction, double beta);
66 // Constructor from a three vector direction and the magnitude of beta
67
68 HepBoost & set (const Hep3Vector & boost);
69 inline HepBoost (const Hep3Vector & boost);
70 // Constructor from a 3-vector of less than unit length
71
72 inline HepBoost & set (const HepBoostX & boost);
73 inline HepBoost & set (const HepBoostY & boost);
74 inline HepBoost & set (const HepBoostZ & boost);
75 inline HepBoost (const HepBoostX & boost);
76 inline HepBoost (const HepBoostY & boost);
77 inline HepBoost (const HepBoostZ & boost);
78
79 // ---------- Accessors:
80
81 inline double beta() const;
82 inline double gamma() const;
83 inline Hep3Vector boostVector() const;
84 inline Hep3Vector getDirection() const;
85 inline Hep3Vector direction() const;
86
87 inline double xx() const;
88 inline double xy() const;
89 inline double xz() const;
90 inline double xt() const;
91 inline double yx() const;
92 inline double yy() const;
93 inline double yz() const;
94 inline double yt() const;
95 inline double zx() const;
96 inline double zy() const;
97 inline double zz() const;
98 inline double zt() const;
99 inline double tx() const;
100 inline double ty() const;
101 inline double tz() const;
102 inline double tt() const;
103 // Elements of the matrix.
104
105 inline HepLorentzVector col1() const;
106 inline HepLorentzVector col2() const;
107 inline HepLorentzVector col3() const;
108 inline HepLorentzVector col4() const;
109 // orthosymplectic column vectors
110
111 inline HepLorentzVector row1() const;
112 inline HepLorentzVector row2() const;
113 inline HepLorentzVector row3() const;
114 inline HepLorentzVector row4() const;
115 // orthosymplectic row vectors
116
117 inline HepRep4x4 rep4x4() const;
118 // 4x4 representation.
119
120 inline HepRep4x4Symmetric rep4x4Symmetric() const;
121 // Symmetric 4x4 representation.
122
123 // ---------- Decomposition:
124
125 void decompose (HepRotation & rotation, HepBoost & boost) const;
126 void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
127 // Find R and B such that L = R*B -- trivial, since R is identity
128
129 void decompose (HepBoost & boost, HepRotation & rotation) const;
130 void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
131 // Find R and B such that L = B*R -- trivial, since R is identity
132
133 // ---------- Comparisons:
134
135 inline int compare( const HepBoost & b ) const;
136 // Dictionary-order comparison, in order tt,zt,zz,yt,yz,yy,xt,xz,xy,xx
137 // Used in operator<, >, <=, >=
138
139 inline bool operator == (const HepBoost & b) const;
140 inline bool operator != (const HepBoost & b) const;
141 inline bool operator <= (const HepBoost & b) const;
142 inline bool operator >= (const HepBoost & b) const;
143 inline bool operator < (const HepBoost & b) const;
144 inline bool operator > (const HepBoost & b) const;
145 // Comparisons.
146
147 inline bool isIdentity() const;
148 // Returns true if a null boost.
149
150 inline double distance2( const HepBoost & b ) const;
151 inline double distance2( const HepBoostX & bx ) const;
152 inline double distance2( const HepBoostY & by ) const;
153 inline double distance2( const HepBoostZ & bz ) const;
154 // Defined as the distance2 between the vectors (gamma*betaVector)
155
156 double distance2( const HepRotation & r ) const;
157 double distance2( const HepLorentzRotation & lt ) const;
158 // Distance between this and other sorts of transformations
159
160 inline double howNear( const HepBoost & b ) const;
161 inline bool isNear( const HepBoost & b,
162 double epsilon=Hep4RotationInterface::tolerance) const;
163
164 double howNear( const HepRotation & r ) const;
165 double howNear( const HepLorentzRotation & lt ) const;
166
167 bool isNear( const HepRotation & r,
168 double epsilon=Hep4RotationInterface::tolerance) const;
169 bool isNear( const HepLorentzRotation & lt,
170 double epsilon=Hep4RotationInterface::tolerance) const;
171
172 // ---------- Properties:
173
174 double norm2() const;
175 // (beta*gamma)^2
176
177 void rectify();
178 // set as an exact boost, based on the timelike part of the boost matrix.
179
180 // ---------- Application:
181
182 inline HepLorentzVector operator()( const HepLorentzVector & p ) const;
183 // Transform a Lorentz Vector.
184
185 inline HepLorentzVector operator* ( const HepLorentzVector & p ) const;
186 // Multiplication with a Lorentz Vector.
187
188 // ---------- Operations in the group of 4-Rotations
189
193 // Product of two Lorentz Rotations (this) * lt - matrix multiplication
194 // Notice that the product of two pure boosts is no longer a pure boost
195
196 inline HepBoost inverse() const;
197 // Return the inverse.
198
199 inline friend HepBoost inverseOf ( const HepBoost & lt );
200 // global methods to invert.
201
202 inline HepBoost & invert();
203 // Inverts the Boost matrix.
204
205 // ---------- I/O:
206
207 std::ostream & print( std::ostream & os ) const;
208 // Output form is (bx, by, bz)
209
210 // ---------- Tolerance
211
212 static inline double getTolerance();
213 static inline double setTolerance(double tol);
214
215protected:
216
218 ( const HepLorentzVector & w ) const;
219 // Multiplication with a Lorentz Vector.
220
223
224 inline HepBoost
225 (double xx, double xy, double xz, double xt,
226 double yy, double yz, double yt,
227 double zz, double zt,
228 double tt);
229 // Protected constructor.
230 // DOES NOT CHECK FOR VALIDITY AS A LORENTZ BOOST.
231
232 inline void setBoost(double bx, double by, double bz);
233
235
236}; // HepBoost
237
238inline
239std::ostream & operator <<
240 ( std::ostream & os, const HepBoost& b ) {return b.print(os);}
241
242} // namespace CLHEP
243
244#include "CLHEP/Vector/Boost.icc"
245
246#ifdef ENABLE_BACKWARDS_COMPATIBILITY
247// backwards compatibility will be enabled ONLY in CLHEP 1.9
248using namespace CLHEP;
249#endif
250
251#endif /* HEP_BOOST_H */
bool isNear(const HepLorentzRotation &lt, double epsilon=Hep4RotationInterface::tolerance) const
double norm2() const
Hep3Vector getDirection() const
Definition Boost.icc:81
HepBoost & set(double betaX, double betaY, double betaZ)
HepBoost & operator=(const HepBoost &m)
Definition Boost.icc:20
HepRep4x4Symmetric rep4x4Symmetric() const
Definition Boost.icc:137
double howNear(const HepRotation &r) const
bool isNear(const HepRotation &r, double epsilon=Hep4RotationInterface::tolerance) const
void decompose(HepRotation &rotation, HepBoost &boost) const
HepLorentzVector col2() const
Definition Boost.icc:110
bool isIdentity() const
Definition Boost.icc:188
double distance2(const HepLorentzRotation &lt) const
bool operator<(const HepBoost &b) const
Definition Boost.icc:183
HepLorentzVector row2() const
Definition Boost.icc:123
HepLorentzVector col3() const
Definition Boost.icc:113
HepLorentzVector row1() const
Definition Boost.icc:120
double beta() const
Definition Boost.icc:69
HepLorentzRotation matrixMultiplication(const HepRep4x4 &m) const
void decompose(HepBoost &boost, HepRotation &rotation) const
HepLorentzVector col4() const
Definition Boost.icc:116
double tz() const
Definition Boost.icc:104
bool isNear(const HepBoost &b, double epsilon=Hep4RotationInterface::tolerance) const
Definition Boost.icc:227
void setBoost(double bx, double by, double bz)
Definition Boost.icc:142
int compare(const HepBoost &b) const
Definition Boost.icc:149
static double setTolerance(double tol)
Definition Boost.icc:285
HepLorentzVector operator*(const HepLorentzVector &p) const
Definition Boost.icc:252
double yt() const
Definition Boost.icc:97
double xt() const
Definition Boost.icc:93
friend HepBoost inverseOf(const HepBoost &lt)
Definition Boost.icc:266
double yx() const
Definition Boost.icc:94
double howNear(const HepBoost &b) const
Definition Boost.icc:223
static double getTolerance()
Definition Boost.icc:282
double xz() const
Definition Boost.icc:92
double distance2(const HepBoost &b) const
Definition Boost.icc:195
double tt() const
Definition Boost.icc:105
double zy() const
Definition Boost.icc:99
HepBoost & set(const HepRep4x4Symmetric &m)
HepLorentzVector row3() const
Definition Boost.icc:126
HepLorentzVector col1() const
Definition Boost.icc:107
double tx() const
Definition Boost.icc:102
Hep3Vector direction() const
Definition Boost.icc:86
double howNear(const HepLorentzRotation &lt) const
HepRep4x4 rep4x4() const
Definition Boost.icc:133
HepLorentzRotation matrixMultiplication(const HepRep4x4Symmetric &m) const
void decompose(Hep3Vector &boost, HepAxisAngle &rotation) const
Hep3Vector boostVector() const
Definition Boost.icc:77
bool operator==(const HepBoost &b) const
Definition Boost.icc:165
double zx() const
Definition Boost.icc:98
bool operator!=(const HepBoost &b) const
Definition Boost.icc:176
double gamma() const
Definition Boost.icc:73
bool operator>(const HepBoost &b) const
Definition Boost.icc:185
HepLorentzVector vectorMultiplication(const HepLorentzVector &w) const
Definition Boost.icc:235
HepBoost inverse() const
Definition Boost.icc:259
double yy() const
Definition Boost.icc:95
HepRep4x4Symmetric rep_
Definition Boost.h:234
HepBoost(HepBoost &&m)=default
HepLorentzVector row4() const
Definition Boost.icc:129
double xx() const
Definition Boost.icc:90
HepBoost & set(Hep3Vector direction, double beta)
bool operator>=(const HepBoost &b) const
Definition Boost.icc:181
std::ostream & print(std::ostream &os) const
double ty() const
Definition Boost.icc:103
HepBoost & set(const Hep3Vector &boost)
double distance2(const HepRotation &r) const
double zt() const
Definition Boost.icc:101
void decompose(HepAxisAngle &rotation, Hep3Vector &boost) const
double zz() const
Definition Boost.icc:100
HepBoost & invert()
Definition Boost.icc:273
HepLorentzVector operator()(const HepLorentzVector &p) const
Definition Boost.icc:247
bool operator<=(const HepBoost &b) const
Definition Boost.icc:179
double yz() const
Definition Boost.icc:96
double xy() const
Definition Boost.icc:91
HepBoost inverseOf(const HepBoost &lt)
Definition Boost.icc:266