Geant4 Cross Reference |
1 // -*- C++ -*- 1 // -*- C++ -*- 2 // 2 // 3 // This file is a part of the CLHEP - a Class 3 // This file is a part of the CLHEP - a Class Library for High Energy Physics. 4 // 4 // 5 // This is the definition of the HepBoostZ cla 5 // This is the definition of the HepBoostZ class for performing specialized 6 // Lorentz transformations which are pure boos 6 // Lorentz transformations which are pure boosts in the Z direction, on 7 // objects of the HepLorentzVector class. 7 // objects of the HepLorentzVector class. 8 // 8 // 9 // HepLorentzRotation is a concrete implementa 9 // HepLorentzRotation is a concrete implementation of Hep4RotationInterface. 10 // 10 // 11 // .SS See Also 11 // .SS See Also 12 // RotationInterfaces.h 12 // RotationInterfaces.h 13 // LorentzVector.h LorentzRotation.h 13 // LorentzVector.h LorentzRotation.h 14 // Boost.h 14 // Boost.h 15 // 15 // 16 // .SS Author 16 // .SS Author 17 // Mark Fischler 17 // Mark Fischler 18 18 19 #ifndef HEP_BOOSTZ_H 19 #ifndef HEP_BOOSTZ_H 20 #define HEP_BOOSTZ_H 20 #define HEP_BOOSTZ_H 21 21 >> 22 #ifdef GNUPRAGMA >> 23 #pragma interface >> 24 #endif >> 25 22 #include "CLHEP/Vector/RotationInterfaces.h" 26 #include "CLHEP/Vector/RotationInterfaces.h" 23 #include "CLHEP/Vector/LorentzVector.h" 27 #include "CLHEP/Vector/LorentzVector.h" 24 28 25 namespace CLHEP { 29 namespace CLHEP { 26 30 27 // Declarations of classes and global methods 31 // Declarations of classes and global methods 28 class HepBoostZ; 32 class HepBoostZ; 29 inline HepBoostZ inverseOf ( const HepBoostZ & 33 inline HepBoostZ inverseOf ( const HepBoostZ & b ); 30 class HepBoost; 34 class HepBoost; 31 class HepRotation; 35 class HepRotation; 32 36 33 /** 37 /** 34 * @author 38 * @author 35 * @ingroup vector 39 * @ingroup vector 36 */ 40 */ 37 class HepBoostZ { 41 class HepBoostZ { 38 42 39 public: 43 public: 40 44 41 // ---------- Constructors and Assignment: 45 // ---------- Constructors and Assignment: 42 46 43 inline HepBoostZ(); 47 inline HepBoostZ(); 44 // Default constructor. Gives a boost of 0. 48 // Default constructor. Gives a boost of 0. 45 49 46 inline HepBoostZ(const HepBoostZ & b); 50 inline HepBoostZ(const HepBoostZ & b); 47 inline HepBoostZ(HepBoostZ && b) = default; 51 inline HepBoostZ(HepBoostZ && b) = default; 48 // Copy and move constructors. 52 // Copy and move constructors. 49 53 50 inline HepBoostZ & operator = (const HepBoos 54 inline HepBoostZ & operator = (const HepBoostZ & m); 51 inline HepBoostZ & operator = (HepBoostZ && 55 inline HepBoostZ & operator = (HepBoostZ && m) = default; 52 // Copy and move assignment operators. 56 // Copy and move assignment operators. 53 57 54 HepBoostZ & set (double beta); 58 HepBoostZ & set (double beta); 55 inline HepBoostZ (double beta); 59 inline HepBoostZ (double beta); 56 // Constructor from beta 60 // Constructor from beta 57 61 58 // ---------- Accessors: 62 // ---------- Accessors: 59 63 60 inline double beta() const; 64 inline double beta() const; 61 inline double gamma() const; 65 inline double gamma() const; 62 inline Hep3Vector boostVector() const; 66 inline Hep3Vector boostVector() const; 63 inline Hep3Vector getDirection() const; 67 inline Hep3Vector getDirection() const; 64 68 65 inline double xx() const; 69 inline double xx() const; 66 inline double xy() const; 70 inline double xy() const; 67 inline double xz() const; 71 inline double xz() const; 68 inline double xt() const; 72 inline double xt() const; 69 inline double yx() const; 73 inline double yx() const; 70 inline double yy() const; 74 inline double yy() const; 71 inline double yz() const; 75 inline double yz() const; 72 inline double yt() const; 76 inline double yt() const; 73 inline double zx() const; 77 inline double zx() const; 74 inline double zy() const; 78 inline double zy() const; 75 inline double zz() const; 79 inline double zz() const; 76 inline double zt() const; 80 inline double zt() const; 77 inline double tx() const; 81 inline double tx() const; 78 inline double ty() const; 82 inline double ty() const; 79 inline double tz() const; 83 inline double tz() const; 80 inline double tt() const; 84 inline double tt() const; 81 // Elements of the matrix. 85 // Elements of the matrix. 82 86 83 inline HepLorentzVector col1() const; 87 inline HepLorentzVector col1() const; 84 inline HepLorentzVector col2() const; 88 inline HepLorentzVector col2() const; 85 inline HepLorentzVector col3() const; 89 inline HepLorentzVector col3() const; 86 inline HepLorentzVector col4() const; 90 inline HepLorentzVector col4() const; 87 // orthosymplectic column vectors 91 // orthosymplectic column vectors 88 92 89 inline HepLorentzVector row1() const; 93 inline HepLorentzVector row1() const; 90 inline HepLorentzVector row2() const; 94 inline HepLorentzVector row2() const; 91 inline HepLorentzVector row3() const; 95 inline HepLorentzVector row3() const; 92 inline HepLorentzVector row4() const; 96 inline HepLorentzVector row4() const; 93 // orthosymplectic row vectors 97 // orthosymplectic row vectors 94 98 95 HepRep4x4 rep4x4() const; 99 HepRep4x4 rep4x4() const; 96 // 4x4 representation: 100 // 4x4 representation: 97 101 98 HepRep4x4Symmetric rep4x4Symmetric() const; 102 HepRep4x4Symmetric rep4x4Symmetric() const; 99 // Symmetric 4x4 representation. 103 // Symmetric 4x4 representation. 100 104 101 // ---------- Decomposition: 105 // ---------- Decomposition: 102 106 103 void decompose (HepRotation & rotation, Hep 107 void decompose (HepRotation & rotation, HepBoost & boost) const; 104 void decompose (HepAxisAngle & rotation, Hep 108 void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const; 105 // Find R and B such that L = R*B -- trivial 109 // Find R and B such that L = R*B -- trivial, since R is identity 106 110 107 void decompose (HepBoost & boost, HepRotat 111 void decompose (HepBoost & boost, HepRotation & rotation) const; 108 void decompose (Hep3Vector & boost, HepAxisA 112 void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const; 109 // Find R and B such that L = B*R -- trivial 113 // Find R and B such that L = B*R -- trivial, since R is identity 110 114 111 // ---------- Comparisons: 115 // ---------- Comparisons: 112 116 113 inline int compare( const HepBoostZ & b ) c 117 inline int compare( const HepBoostZ & b ) const; 114 // Dictionary-order comparison, in order of 118 // Dictionary-order comparison, in order of beta. 115 // Used in operator<, >, <=, >= 119 // Used in operator<, >, <=, >= 116 120 117 inline bool operator == (const HepBoostZ & b 121 inline bool operator == (const HepBoostZ & b) const; 118 inline bool operator != (const HepBoostZ & b 122 inline bool operator != (const HepBoostZ & b) const; 119 inline bool operator <= (const HepBoostZ & b 123 inline bool operator <= (const HepBoostZ & b) const; 120 inline bool operator >= (const HepBoostZ & b 124 inline bool operator >= (const HepBoostZ & b) const; 121 inline bool operator < (const HepBoostZ & b 125 inline bool operator < (const HepBoostZ & b) const; 122 inline bool operator > (const HepBoostZ & b 126 inline bool operator > (const HepBoostZ & b) const; 123 // Comparisons. 127 // Comparisons. 124 128 125 inline bool isIdentity() const; 129 inline bool isIdentity() const; 126 // Returns true if a null boost. 130 // Returns true if a null boost. 127 131 128 inline double distance2( const HepBoostZ & 132 inline double distance2( const HepBoostZ & b ) const; 129 double distance2( const HepBoost & b ) c 133 double distance2( const HepBoost & b ) const; 130 // Defined as the distance2 between the vect 134 // Defined as the distance2 between the vectors (gamma*betaVector) 131 135 132 double distance2( const HepRotation & r ) c 136 double distance2( const HepRotation & r ) const; 133 double distance2( const HepLorentzRotation & 137 double distance2( const HepLorentzRotation & lt ) const; 134 // Decompose lt = B*R; add norm2 to distance 138 // Decompose lt = B*R; add norm2 to distance2 to between boosts. 135 139 136 inline double howNear( const HepBoostZ & b 140 inline double howNear( const HepBoostZ & b ) const; 137 inline double howNear( const HepBoost & b 141 inline double howNear( const HepBoost & b ) const; 138 inline double howNear( const HepRotation & 142 inline double howNear( const HepRotation & r ) const; 139 inline double howNear( const HepLorentzRot 143 inline double howNear( const HepLorentzRotation & lt ) const; 140 144 141 inline bool isNear( const HepBoostZ & b, 145 inline bool isNear( const HepBoostZ & b, 142 double epsilon=Hep4RotationInterf 146 double epsilon=Hep4RotationInterface::tolerance) const; 143 inline bool isNear( const HepBoost & b, 147 inline bool isNear( const HepBoost & b, 144 double epsilon=Hep4RotationInterf 148 double epsilon=Hep4RotationInterface::tolerance) const; 145 bool isNear( const HepRotation & r, 149 bool isNear( const HepRotation & r, 146 double epsilon=Hep4RotationInterf 150 double epsilon=Hep4RotationInterface::tolerance) const; 147 bool isNear( const HepLorentzRotation & lt 151 bool isNear( const HepLorentzRotation & lt, 148 double epsilon=Hep4RotationInterf 152 double epsilon=Hep4RotationInterface::tolerance) const; 149 153 150 // ---------- Properties: 154 // ---------- Properties: 151 155 152 inline double norm2() const; 156 inline double norm2() const; 153 // distance2 (IDENTITY), which is beta^2 * g 157 // distance2 (IDENTITY), which is beta^2 * gamma^2 154 158 155 void rectify(); 159 void rectify(); 156 // sets according to the stored beta 160 // sets according to the stored beta 157 161 158 // ---------- Application: 162 // ---------- Application: 159 163 160 inline HepLorentzVector operator()( const He 164 inline HepLorentzVector operator()( const HepLorentzVector & w ) const; 161 // Transform a Lorentz Vector. 165 // Transform a Lorentz Vector. 162 166 163 inline HepLorentzVector operator* ( const He 167 inline HepLorentzVector operator* ( const HepLorentzVector & w ) const; 164 // Multiplication with a Lorentz Vector. 168 // Multiplication with a Lorentz Vector. 165 169 166 // ---------- Operations in the group of 4-R 170 // ---------- Operations in the group of 4-Rotations 167 171 168 HepBoostZ operator * (const HepBoostZ & b) 172 HepBoostZ operator * (const HepBoostZ & b) const; 169 HepLorentzRotation operator * (const HepBoos 173 HepLorentzRotation operator * (const HepBoost & b) const; 170 HepLorentzRotation operator * (const HepRota 174 HepLorentzRotation operator * (const HepRotation & r) const; 171 HepLorentzRotation operator * (const HepLore 175 HepLorentzRotation operator * (const HepLorentzRotation & lt) const; 172 // Product of two Lorentz Rotations (this) * 176 // Product of two Lorentz Rotations (this) * lt - matrix multiplication 173 // Notice that the product of two pure boost 177 // Notice that the product of two pure boosts in different directions 174 // is no longer a pure boost. 178 // is no longer a pure boost. 175 179 176 inline HepBoostZ inverse() const; 180 inline HepBoostZ inverse() const; 177 // Return the inverse. 181 // Return the inverse. 178 182 179 inline friend HepBoostZ inverseOf ( const He 183 inline friend HepBoostZ inverseOf ( const HepBoostZ & b ); 180 // global methods to invert. 184 // global methods to invert. 181 185 182 inline HepBoostZ & invert(); 186 inline HepBoostZ & invert(); 183 // Inverts the Boost matrix. 187 // Inverts the Boost matrix. 184 188 185 // ---------- I/O: 189 // ---------- I/O: 186 190 187 std::ostream & print( std::ostream & os ) co 191 std::ostream & print( std::ostream & os ) const; 188 // Output form is BOOSTZ (beta=..., gamma=.. 192 // Output form is BOOSTZ (beta=..., gamma=...); 189 193 190 // ---------- Tolerance 194 // ---------- Tolerance 191 195 192 static inline double getTolerance(); 196 static inline double getTolerance(); 193 static inline double setTolerance(double tol 197 static inline double setTolerance(double tol); 194 198 195 protected: 199 protected: 196 200 197 inline HepLorentzVector vectorMultiplication 201 inline HepLorentzVector vectorMultiplication 198 ( cons 202 ( const HepLorentzVector & w ) const; 199 // Multiplication with a Lorentz Vector. 203 // Multiplication with a Lorentz Vector. 200 204 201 HepLorentzRotation matrixMultiplication (con 205 HepLorentzRotation matrixMultiplication (const HepRep4x4 & m) const; 202 HepLorentzRotation matrixMultiplication (con 206 HepLorentzRotation matrixMultiplication (const HepRep4x4Symmetric & m) const; 203 207 204 inline HepBoostZ (double beta, double gamma) 208 inline HepBoostZ (double beta, double gamma); 205 209 206 double beta_; 210 double beta_; 207 double gamma_; 211 double gamma_; 208 212 209 }; // HepBoostZ 213 }; // HepBoostZ 210 214 211 inline 215 inline 212 std::ostream & operator << 216 std::ostream & operator << 213 ( std::ostream & os, const HepBoostZ& b ) {r 217 ( std::ostream & os, const HepBoostZ& b ) {return b.print(os);} 214 218 215 } // namespace CLHEP 219 } // namespace CLHEP 216 220 217 #include "CLHEP/Vector/BoostZ.icc" 221 #include "CLHEP/Vector/BoostZ.icc" 218 222 219 #endif /* HEP_BOOSTZ_H */ 223 #endif /* HEP_BOOSTZ_H */ 220 224