Geant4 Cross Reference |
1 // -*- C++ -*- 1 2 // CLASSDOC OFF 3 // ------------------------------------------- 4 // CLASSDOC ON 5 // 6 // This file is a part of the CLHEP - a Class 7 // 8 // This is the definition of the HepLorentzRot 9 // Lorentz transformations (rotations and boos 10 // HepLorentzVector class. 11 // 12 // HepLorentzRotation is a concrete implementa 13 // 14 // .SS See Also 15 // RotationInterfaces.h 16 // ThreeVector.h, LorentzVector.h 17 // Rotation.h, Boost.h 18 // 19 // .SS Author 20 // Leif Lonnblad, Mark Fischler 21 22 #ifndef HEP_LORENTZROTATION_H 23 #define HEP_LORENTZROTATION_H 24 25 #include "CLHEP/Vector/RotationInterfaces.h" 26 #include "CLHEP/Vector/Rotation.h" 27 #include "CLHEP/Vector/Boost.h" 28 #include "CLHEP/Vector/LorentzVector.h" 29 30 namespace CLHEP { 31 32 // Global methods 33 34 inline HepLorentzRotation inverseOf ( const He 35 HepLorentzRotation operator * (const HepRotati 36 const 37 HepLorentzRotation operator * (const HepRotati 38 const 39 HepLorentzRotation operator * (const HepRotati 40 const 41 HepLorentzRotation operator * (const HepRotati 42 const 43 44 /** 45 * @author 46 * @ingroup vector 47 */ 48 class HepLorentzRotation { 49 50 public: 51 // ---------- Identity HepLorentzRotation: 52 53 DLL_API static const HepLorentzRotation IDEN 54 55 // ---------- Constructors and Assignment: 56 57 inline HepLorentzRotation(); 58 // Default constructor. Gives a unit matrix. 59 60 inline HepLorentzRotation (const HepLorentz 61 inline HepLorentzRotation (HepLorentzRotati 62 // Copy and move constructors. 63 64 inline HepLorentzRotation (const H 65 inline explicit HepLorentzRotation (const H 66 inline explicit HepLorentzRotation (const H 67 inline explicit HepLorentzRotation (const H 68 inline HepLorentzRotation (const H 69 inline explicit HepLorentzRotation (const H 70 inline explicit HepLorentzRotation (const H 71 inline explicit HepLorentzRotation (const H 72 // Constructors from special cases. 73 74 inline HepLorentzRotation & operator = (HepL 75 inline HepLorentzRotation & operator = (cons 76 inline HepLorentzRotation & operator = (cons 77 inline HepLorentzRotation & operator = (cons 78 // Assignment. 79 80 HepLorentzRotation & set (double bx, 81 inline HepLorentzRotation & set (const Hep3V 82 inline HepLorentzRotation & set (const HepRo 83 inline HepLorentzRotation & set (const HepRo 84 inline HepLorentzRotation & set (const HepRo 85 inline HepLorentzRotation & set (const HepRo 86 inline HepLorentzRotation & set (const HepBo 87 inline HepLorentzRotation & set (const HepBo 88 inline HepLorentzRotation & set (const HepBo 89 inline HepLorentzRotation & set (const HepBo 90 inline HepLorentzRotation (double bx, double 91 inline HepLorentzRotation (const Hep3Vector 92 // Other Constructors giving a Lorentz-boost 93 94 HepLorentzRotation & set( const HepBo 95 inline HepLorentzRotation ( const HepBo 96 // supply B and R: T = B R: 97 98 HepLorentzRotation & set( const HepRo 99 inline HepLorentzRotation ( const HepRo 100 // supply R and B: T = R B: 101 102 HepLorentzRotation ( const HepLorentzVector 103 const HepLorentzVector & col2, 104 const HepLorentzVector & col3, 105 const HepLorentzVector & col4 ); 106 // Construct from four *orthosymplectic* Lor 107 // NOTE: 108 // This constructor, and the two 109 // will check that the columns (o 110 // matrix, and will adjust values 111 // as exact as possible. 112 // Orthosymplectic means the dot product US 113 // of two different coumns will be 0, and o 114 // itself will be one. 115 116 HepLorentzRotation & set( const HepLorentzVe 117 const HepLorentzVe 118 const HepLorentzVe 119 const HepLorentzVe 120 // supply four *orthosymplectic* HepLorent 121 122 HepLorentzRotation & setRows( const HepLoren 123 const HepLoren 124 const HepLoren 125 const HepLoren 126 // supply four *orthosymplectic* HepLorent 127 128 inline HepLorentzRotation & set( const HepRe 129 inline HepLorentzRotation ( const HepRe 130 // supply a HepRep4x4 structure (16 number 131 // WARNING: 132 // This constructor and set metho 133 // HepRep4x4 supplied is in fact 134 // No checking or correction is d 135 // not certain the matrix is orth 136 // into four HepLorentzVector col 137 // HepLorentzRotation (col1, col2 138 139 // ---------- Accessors: 140 141 inline double xx() const; 142 inline double xy() const; 143 inline double xz() const; 144 inline double xt() const; 145 inline double yx() const; 146 inline double yy() const; 147 inline double yz() const; 148 inline double yt() const; 149 inline double zx() const; 150 inline double zy() const; 151 inline double zz() const; 152 inline double zt() const; 153 inline double tx() const; 154 inline double ty() const; 155 inline double tz() const; 156 inline double tt() const; 157 // Elements of the matrix. 158 159 inline HepLorentzVector col1() const; 160 inline HepLorentzVector col2() const; 161 inline HepLorentzVector col3() const; 162 inline HepLorentzVector col4() const; 163 // orthosymplectic column vectors 164 165 inline HepLorentzVector row1() const; 166 inline HepLorentzVector row2() const; 167 inline HepLorentzVector row3() const; 168 inline HepLorentzVector row4() const; 169 // orthosymplectic row vectors 170 171 inline HepRep4x4 rep4x4() const; 172 // 4x4 representation: 173 174 // ------------ Subscripting: 175 176 class HepLorentzRotation_row { 177 public: 178 inline HepLorentzRotation_row(const HepLor 179 inline double operator [] (int) const; 180 private: 181 const HepLorentzRotation & rr; 182 int ii; 183 }; 184 // Helper class for implemention of C-style 185 186 inline const HepLorentzRotation_row operator 187 // Returns object of the helper class for C- 188 189 double operator () (int, int) const; 190 // Fortran-style subscripting: returns (i,j) 191 192 // ---------- Decomposition: 193 194 void decompose (Hep3Vector & boost, HepAxisA 195 void decompose (HepBoost & boost, HepRotat 196 // Find B and R such that L = B*R 197 198 void decompose (HepAxisAngle & rotation, Hep 199 void decompose (HepRotation & rotation, Hep 200 // Find R and B such that L = R*B 201 202 // ---------- Comparisons: 203 204 int compare( const HepLorentzRotation & m ) 205 // Dictionary-order comparison, in order tt, 206 // Used in operator<, >, <=, >= 207 208 inline bool operator == (const HepLorentzRot 209 inline bool operator != (const HepLorentzRot 210 inline bool operator <= (const HepLorentzRot 211 inline bool operator >= (const HepLorentzRot 212 inline bool operator < (const HepLorentzRot 213 inline bool operator > (const HepLorentzRot 214 215 inline bool isIdentity() const; 216 // Returns true if the Identity matrix. 217 218 double distance2( const HepBoost & b ) cons 219 double distance2( const HepRotation & r ) c 220 double distance2( const HepLorentzRotation & 221 // Decomposes L = B*R, returns the sum of di 222 223 double howNear( const HepBoost & b ) const 224 double howNear( const HepRotation & r) con 225 double howNear( const HepLorentzRotation & 226 227 bool isNear(const HepBoost & b, 228 double epsilon=Hep4RotationInterf 229 bool isNear(const HepRotation & r, 230 double epsilon=Hep4RotationInterf 231 bool isNear(const HepLorentzRotation & lt, 232 double epsilon=Hep4RotationInterf 233 234 // ---------- Properties: 235 236 double norm2() const; 237 // distance2 (IDENTITY), which involves deco 238 // norm2 for the individual B and R parts. 239 240 void rectify(); 241 // non-const but logically moot correction f 242 // rectify averages the matrix with th 243 // inverse (absent accumulated roundof 244 // the inverse)); this removes to firs 245 // Then it formally decomposes that, e 246 // Rotation part, forms a LorentzRotation fr 247 // with those values of axis and delta, time 248 // with that boost vector. 249 250 // ---------- Application: 251 252 inline HepLorentzVector vectorMultiplication 253 inline HepLorentzVector operator()( const He 254 inline HepLorentzVector operator* ( const He 255 // Multiplication with a Lorentz Vector. 256 257 // ---------- Operations in the group of 4-R 258 259 HepLorentzRotation matrixMultiplication(cons 260 261 inline HepLorentzRotation operator * (const 262 inline HepLorentzRotation operator * (const 263 inline HepLorentzRotation operator * (const 264 // Product of two Lorentz Rotations (this) * 265 266 inline HepLorentzRotation & operator *= (co 267 inline HepLorentzRotation & operator *= (co 268 inline HepLorentzRotation & operator *= (co 269 inline HepLorentzRotation & transform (co 270 inline HepLorentzRotation & transform (co 271 inline HepLorentzRotation & transform (co 272 // Matrix multiplication. 273 // Note a *= b; <=> a = a * b; while a.trans 274 275 // Here there is an opportunity for speedup 276 // of lt * r and lt * b where r is a Rotatio 277 // These are, in fact, provided below for th 278 279 HepLorentzRotation & rotateX(double delta); 280 // Rotation around the x-axis; equivalent to 281 282 HepLorentzRotation & rotateY(double delta); 283 // Rotation around the y-axis; equivalent to 284 285 HepLorentzRotation & rotateZ(double delta); 286 // Rotation around the z-axis; equivalent to 287 288 inline HepLorentzRotation & rotate(double de 289 inline HepLorentzRotation & rotate(double de 290 // Rotation around specified vector - LT = R 291 292 HepLorentzRotation & boostX(double beta); 293 // Pure boost along the x-axis; equivalent t 294 295 HepLorentzRotation & boostY(double beta); 296 // Pure boost along the y-axis; equivalent t 297 298 HepLorentzRotation & boostZ(double beta); 299 // Pure boost along the z-axis; equivalent t 300 301 inline HepLorentzRotation & boost(double, do 302 inline HepLorentzRotation & boost(const Hep3 303 // Lorenz boost. 304 305 inline HepLorentzRotation inverse() const; 306 // Return the inverse. 307 308 inline HepLorentzRotation & invert(); 309 // Inverts the LorentzRotation matrix. 310 311 // ---------- I/O: 312 313 std::ostream & print( std::ostream & os ) co 314 // Aligned six-digit-accurate output of the 315 316 // ---------- Tolerance 317 318 static inline double getTolerance(); 319 static inline double setTolerance(double tol 320 321 friend HepLorentzRotation inverseOf ( const 322 323 protected: 324 325 inline HepLorentzRotation 326 (double mxx, double mxy, double mxz, do 327 double myx, double myy, double myz, double m 328 double mzx, double mzy, double mzz, double m 329 double mtx, double mty, double mtz, double m 330 // Protected constructor. 331 // DOES NOT CHECK FOR VALIDITY AS A LORENTZ 332 333 inline void setBoost(double, double, double) 334 // Set elements according to a boost vector. 335 336 double mxx, mxy, mxz, mxt, 337 myx, myy, myz, myt, 338 mzx, mzy, mzz, mzt, 339 mtx, mty, mtz, mtt; 340 // The matrix elements. 341 342 }; // HepLorentzRotation 343 344 inline std::ostream & operator<< 345 ( std::ostream & os, const HepLorentzRota 346 {return lt.print(os);} 347 348 inline bool operator==(const HepRotation &r, c 349 { return lt==HepLorentzRotation(r); } 350 inline bool operator!=(const HepRotation &r, c 351 { return lt!=HepLorentzRotation(r); } 352 inline bool operator<=(const HepRotation &r, c 353 { return lt<=r; } 354 inline bool operator>=(const HepRotation &r, c 355 { return lt>=r; } 356 inline bool operator<(const HepRotation &r, co 357 { return lt<r; } 358 inline bool operator>(const HepRotation &r, co 359 { return lt>r; } 360 361 inline bool operator==(const HepBoost &b, cons 362 { return lt==HepLorentzRotation(b); } 363 inline bool operator!=(const HepBoost &b, cons 364 { return lt!=HepLorentzRotation(b); } 365 inline bool operator<=(const HepBoost &b, cons 366 { return lt<=b; } 367 inline bool operator>=(const HepBoost &b, cons 368 { return lt>=b; } 369 inline bool operator<(const HepBoost &b, const 370 { return lt<b; } 371 inline bool operator>(const HepBoost &b, const 372 { return lt>b; } 373 374 } // namespace CLHEP 375 376 #include "CLHEP/Vector/LorentzRotation.icc" 377 378 #endif /* HEP_LORENTZROTATION_H */ 379 380