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