Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 #ifdef GNUPRAGMA
23 #pragma interface
24 #endif
25 
27 #include "CLHEP/Vector/BoostX.h"
28 #include "CLHEP/Vector/BoostY.h"
29 #include "CLHEP/Vector/BoostZ.h"
31 
32 namespace CLHEP {
33 
34 // Declarations of classes and global methods
35 class HepBoost;
36 inline HepBoost inverseOf ( const HepBoost & lt );
37 
38 /**
39  * @author
40  * @ingroup vector
41  */
42 class HepBoost {
43 
44 public:
45 
46  // ---------- Constructors and Assignment:
47 
48  inline HepBoost();
49  // Default constructor. Gives a boost of 0.
50 
51  inline HepBoost(const HepBoost & m);
52  // Copy constructor.
53 
54  inline HepBoost & operator = (const HepBoost & m);
55  // Assignment.
56 
57  HepBoost & set (double betaX, double betaY, double betaZ);
58  inline HepBoost (double betaX, double betaY, double betaZ);
59  // Constructor from three components of beta vector
60 
61  HepBoost & set (const HepRep4x4Symmetric & m);
62  inline HepBoost (const HepRep4x4Symmetric & m);
63  // Constructor from symmetric HepRep4x4
64 
65  HepBoost & set (Hep3Vector direction, double beta);
66  inline HepBoost (Hep3Vector direction, double beta);
67  // Constructor from a three vector direction and the magnitude of beta
68 
69  HepBoost & set (const Hep3Vector & boost);
70  inline HepBoost (const Hep3Vector & boost);
71  // Constructor from a 3-vector of less than unit length
72 
73  inline HepBoost & set (const HepBoostX & boost);
74  inline HepBoost & set (const HepBoostY & boost);
75  inline HepBoost & set (const HepBoostZ & boost);
76  inline HepBoost (const HepBoostX & boost);
77  inline HepBoost (const HepBoostY & boost);
78  inline HepBoost (const HepBoostZ & boost);
79 
80  // ---------- Accessors:
81 
82  inline double beta() const;
83  inline double gamma() const;
84  inline Hep3Vector boostVector() const;
85  inline Hep3Vector getDirection() const;
86  inline Hep3Vector direction() const;
87 
88  inline double xx() const;
89  inline double xy() const;
90  inline double xz() const;
91  inline double xt() const;
92  inline double yx() const;
93  inline double yy() const;
94  inline double yz() const;
95  inline double yt() const;
96  inline double zx() const;
97  inline double zy() const;
98  inline double zz() const;
99  inline double zt() const;
100  inline double tx() const;
101  inline double ty() const;
102  inline double tz() const;
103  inline double tt() const;
104  // Elements of the matrix.
105 
106  inline HepLorentzVector col1() const;
107  inline HepLorentzVector col2() const;
108  inline HepLorentzVector col3() const;
109  inline HepLorentzVector col4() const;
110  // orthosymplectic column vectors
111 
112  inline HepLorentzVector row1() const;
113  inline HepLorentzVector row2() const;
114  inline HepLorentzVector row3() const;
115  inline HepLorentzVector row4() const;
116  // orthosymplectic row vectors
117 
118  inline HepRep4x4 rep4x4() const;
119  // 4x4 representation.
120 
121  inline HepRep4x4Symmetric rep4x4Symmetric() const;
122  // Symmetric 4x4 representation.
123 
124  // ---------- Decomposition:
125 
126  void decompose (HepRotation & rotation, HepBoost & boost) const;
127  void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
128  // Find R and B such that L = R*B -- trivial, since R is identity
129 
130  void decompose (HepBoost & boost, HepRotation & rotation) const;
131  void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
132  // Find R and B such that L = B*R -- trivial, since R is identity
133 
134  // ---------- Comparisons:
135 
136  inline int compare( const HepBoost & b ) const;
137  // Dictionary-order comparison, in order tt,zt,zz,yt,yz,yy,xt,xz,xy,xx
138  // Used in operator<, >, <=, >=
139 
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  inline bool operator > (const HepBoost & b) const;
146  // Comparisons.
147 
148  inline bool isIdentity() const;
149  // Returns true if a null boost.
150 
151  inline double distance2( const HepBoost & b ) const;
152  inline double distance2( const HepBoostX & bx ) const;
153  inline double distance2( const HepBoostY & by ) const;
154  inline double distance2( const HepBoostZ & bz ) const;
155  // Defined as the distance2 between the vectors (gamma*betaVector)
156 
157  double distance2( const HepRotation & r ) const;
158  double distance2( const HepLorentzRotation & lt ) const;
159  // Distance between this and other sorts of transformations
160 
161  inline double howNear( const HepBoost & b ) const;
162  inline bool isNear( const HepBoost & b,
163  double epsilon=Hep4RotationInterface::tolerance) const;
164 
165  double howNear( const HepRotation & r ) const;
166  double howNear( const HepLorentzRotation & lt ) const;
167 
168  bool isNear( const HepRotation & r,
169  double epsilon=Hep4RotationInterface::tolerance) const;
170  bool isNear( const HepLorentzRotation & lt,
171  double epsilon=Hep4RotationInterface::tolerance) const;
172 
173  // ---------- Properties:
174 
175  double norm2() const;
176  // (beta*gamma)^2
177 
178  void rectify();
179  // set as an exact boost, based on the timelike part of the boost matrix.
180 
181  // ---------- Application:
182 
183  inline HepLorentzVector operator()( const HepLorentzVector & p ) const;
184  // Transform a Lorentz Vector.
185 
186  inline HepLorentzVector operator* ( const HepLorentzVector & p ) const;
187  // Multiplication with a Lorentz Vector.
188 
189  // ---------- Operations in the group of 4-Rotations
190 
191  HepLorentzRotation operator * (const HepBoost & b) const;
192  HepLorentzRotation operator * (const HepRotation & r) const;
194  // Product of two Lorentz Rotations (this) * lt - matrix multiplication
195  // Notice that the product of two pure boosts is no longer a pure boost
196 
197  inline HepBoost inverse() const;
198  // Return the inverse.
199 
200  inline friend HepBoost inverseOf ( const HepBoost & lt );
201  // global methods to invert.
202 
203  inline HepBoost & invert();
204  // Inverts the Boost matrix.
205 
206  // ---------- I/O:
207 
208  std::ostream & print( std::ostream & os ) const;
209  // Output form is (bx, by, bz)
210 
211  // ---------- Tolerance
212 
213  static inline double getTolerance();
214  static inline double setTolerance(double tol);
215 
216 protected:
217 
219  ( const HepLorentzVector & w ) const;
220  // Multiplication with a Lorentz Vector.
221 
224 
225  inline HepBoost
226  (double xx, double xy, double xz, double xt,
227  double yy, double yz, double yt,
228  double zz, double zt,
229  double tt);
230  // Protected constructor.
231  // DOES NOT CHECK FOR VALIDITY AS A LORENTZ BOOST.
232 
233  inline void setBoost(double bx, double by, double bz);
234 
236 
237 }; // HepBoost
238 
239 inline
240 std::ostream & operator <<
241  ( std::ostream & os, const HepBoost& b ) {return b.print(os);}
242 
243 } // namespace CLHEP
244 
245 #include "CLHEP/Vector/Boost.icc"
246 
247 #endif /* HEP_BOOST_H */
bool operator>=(const HepBoost &b) const
HepLorentzVector col1() const
double xt() const
HepBoost inverse() const
static double setTolerance(double tol)
double xy() const
const char * p
Definition: xmltok.h:285
double howNear(const HepBoost &b) const
double xx() const
static DLL_API double tolerance
bool operator<(const HepBoost &b) const
std::ostream & print(std::ostream &os) const
Definition: Boost.cc:246
double distance2(const HepBoost &b) const
double yz() const
void rectify()
Definition: Boost.cc:145
double norm2() const
Definition: Boost.cc:138
HepLorentzVector row2() const
HepRep4x4 rep4x4() const
Hep3Vector boostVector() const
HepBoost & operator=(const HepBoost &m)
HepBoost inverseOf(const HepBoost &lt)
bool operator<=(const HepBoost &b) const
double yy() const
double zy() const
double tt() const
double xz() const
HepRep4x4Symmetric rep_
Definition: Boost.h:235
HepLorentzVector col2() const
static double getTolerance()
double gamma() const
double zx() const
double zt() const
void decompose(HepRotation &rotation, HepBoost &boost) const
Definition: Boost.cc:69
Hep3Vector getDirection() const
HepLorentzVector col4() const
double zz() const
bool operator>(const HepBoost &b) const
double yx() const
double ty() const
void setBoost(double bx, double by, double bz)
int compare(const HepBoost &b) const
bool isNear(const HepBoost &b, double epsilon=Hep4RotationInterface::tolerance) const
HepLorentzVector row1() const
HepLorentzVector operator()(const HepLorentzVector &p) const
HepRep4x4Symmetric rep4x4Symmetric() const
friend HepBoost inverseOf(const HepBoost &lt)
HepLorentzVector row3() const
double tx() const
double beta() const
bool operator==(const HepBoost &b) const
HepBoost & set(double betaX, double betaY, double betaZ)
Definition: Boost.cc:21
double tz() const
Hep3Vector direction() const
double yt() const
HepLorentzVector row4() const
HepLorentzVector operator*(const HepLorentzVector &p) const
HepLorentzVector vectorMultiplication(const HepLorentzVector &w) const
HepLorentzVector col3() const
bool operator!=(const HepBoost &b) const
HepLorentzRotation matrixMultiplication(const HepRep4x4 &m) const
Definition: Boost.cc:180
bool isIdentity() const
HepBoost & invert()