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