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 contains the definition of two abstrac 9 // Hep4RotationInterface 10 // Hep3RotationInterface. 11 // However, these are mostly for defining meth 12 // any 4- or 3-rotation class, however special 13 // not inherit from these. The virtual functi 14 // to be too steep for that to be practical. 15 // 16 // It may be desirable in the future to turn t 17 // in the Stroustrup sense, so as to enforce t 18 // inheritance. However, they do contain an i 19 // static double tolerance to set criteria for 20 // 21 // This file also defines structs 22 // HepRep3x3; 23 // HepRep4x4; 24 // HepRep4x4Symmetric; 25 // which are used by various Rotation classes. 26 // 27 // Hep4RotationInterface 28 // contains all the methods to get attributes 29 // HepLorentzRotation or a HepRotation -- any 30 // that pertains to a LorentzRotation can als 31 // for a HepRotation.(For example, the 4x4 re 32 // would just have 0's in the space-time entr 33 // the time-time entry.) 34 // 35 // Hep3RotationInterface 36 // inherits from Hep4RotationInterface, and 37 // which are well-defined only in the case of 38 // For example, a 3x3 representation is an at 39 // if the generic LorentzRotation involves no 40 // 41 // In terms of classes in the ZOOM PhysicsVect 42 // Hep4RotationInterface <--> LorentzTransfor 43 // Hep3RotationInterface <--> RotationInterfa 44 // 45 // Hep4RotationInterface defines the required 46 // HepLorentzRotation 47 // HepBoost 48 // HepBoostX 49 // HepBoostY 50 // HepBoostZ 51 // 52 // Hep3RotationInterface defines the required 53 // HepRotation 54 // HepRotationX 55 // HepRotationY 56 // HepRotationZ 57 // 58 // .SS See Also 59 // Rotation.h, LorentzRotation.h 60 // 61 // .SS Author 62 // Mark Fischler 63 // 64 65 #ifndef HEP_ROTATION_INTERFACES_H 66 #define HEP_ROTATION_INTERFACES_H 67 68 #include "CLHEP/Vector/ThreeVector.h" 69 #include "CLHEP/Vector/LorentzVector.h" 70 #include "CLHEP/Vector/AxisAngle.h" 71 72 namespace CLHEP { 73 74 struct HepRep3x3; 75 struct HepRep4x4; 76 struct HepRep4x4Symmetric; 77 78 class HepRotation; 79 class HepRotationX; 80 class HepRotationY; 81 class HepRotationZ; 82 class HepLorentzRotation; 83 class HepBoost; 84 class HepBoostX; 85 class HepBoostY; 86 class HepBoostZ; 87 88 //-****************************** 89 // 90 // Hep4RotationInterface 91 // 92 //-****************************** 93 94 /** 95 * @author 96 * @ingroup vector 97 */ 98 class Hep4RotationInterface { 99 100 // All attributes of shared by HepLorentzRot 101 // HepBoostX, HepBoostY, HepBoostZ. HepRota 102 // HepRotationY, HepRotationZ also share thi 103 104 friend class HepRotation; 105 friend class HepRotationX; 106 friend class HepRotationY; 107 friend class HepRotationZ; 108 friend class HepLorentzRotation; 109 friend class HepBoost; 110 friend class HepBoostX; 111 friend class HepBoostY; 112 friend class HepBoostZ; 113 114 public: 115 116 DLL_API static double tolerance; // t 117 118 // ---------- Accessors: 119 120 #ifdef ONLY_IN_CONCRETE_CLASSES 121 // orthosymplectic 4-vectors: 122 HepLorentzVector col1() const; 123 HepLorentzVector col2() const; 124 HepLorentzVector col3() const; 125 HepLorentzVector col4() const; 126 HepLorentzVector row1() const; 127 HepLorentzVector row2() const; 128 HepLorentzVector row3() const; 129 HepLorentzVector row4() const; 130 131 // individual elements: 132 double xx() const ; 133 double xy() const ; 134 double xz() const ; 135 double xt() const ; 136 double yx() const ; 137 double yy() const ; 138 double yz() const ; 139 double yt() const ; 140 double zx() const ; 141 double zy() const ; 142 double zz() const ; 143 double zt() const ; 144 double tx() const ; 145 double ty() const ; 146 double tz() const ; 147 double tt() const ; 148 149 // 4x4 representation: 150 //HepRep4x4 rep4x4() const; JMM Declared here 151 152 // ---------- Operations: 153 // comparisons: 154 155 inline int compare( const Hep4RotationInterf 156 // Dictionary-order comparisons, utilizing t 157 158 // decomposition: 159 160 void decompose (HepAxisAngle & rotation, Hep 161 // Decompose as T= R * B, where R is pure ro 162 163 void decompose (Hep3Vector & boost, HepAxisA 164 // Decompose as T= B * R, where R is pure ro 165 166 bool operator == (const Hep4RotationInterfac 167 bool operator != (const Hep4RotationInterfac 168 169 // relative comparison: 170 171 double norm2() const ; 172 double distance2( const Hep4RotationInterfa 173 double howNear( const Hep4RotationInterface 174 bool isNear (const Hep4RotationInterface & l 175 double epsilon=tolerance) const ; 176 177 void rectify() ; 178 // non-const but logically const correction 179 180 // ---------- Apply LorentzTransformations: 181 182 HepLorentzVector operator* ( const HepLorent 183 HepLorentzVector operator()( const HepLorent 184 // Apply to a 4-vector 185 186 // ---------- I/O: 187 188 std::ostream & print( std::ostream & os ) co 189 190 #endif /* ONLY_IN_CONCRETE_CLASSES */ 191 192 static double getTolerance(); 193 static double setTolerance( double tol ); 194 195 static const int ToleranceTicks = 100; 196 197 protected: 198 199 ~Hep4RotationInterface() {} // protect destr 200 201 }; // Hep4RotationInterface 202 203 204 //-****************************** 205 // 206 // Hep3RotationInterface 207 // 208 //-****************************** 209 210 /** 211 * @author 212 * @ingroup vector 213 */ 214 class Hep3RotationInterface : public Hep4Rotat 215 216 // All attributes of HepRotation, HepRotatio 217 // beyond those available by virtue of being 218 219 friend class HepRotation; 220 friend class HepRotationX; 221 friend class HepRotationY; 222 friend class HepRotationZ; 223 224 public: 225 226 #ifdef ONLY_IN_CONCRETE_CLASSES 227 228 // Euler angles: 229 double getPhi () const ; 230 double getTheta() const ; 231 double getPsi () const ; 232 double phi () const ; 233 double theta() const ; 234 double psi () const ; 235 HepEulerAngles eulerAngles() const ; 236 237 // axis & angle of rotation: 238 double getDelta() const ; 239 Hep3Vector getAxis () const ; 240 double delta() const ; 241 Hep3Vector axis () const ; 242 HepAxisAngle axisAngle() const ; 243 244 // orthogonal unit-length vectors: 245 Hep3Vector rowX() const; 246 Hep3Vector rowY() const; 247 Hep3Vector rowZ() const; 248 249 Hep3Vector colX() const; 250 Hep3Vector colY() const; 251 Hep3Vector colZ() const; 252 253 //HepRep3x3 rep3x3() const; JMM Declared here 254 // 3x3 representation 255 256 // orthosymplectic 4-vectors treating this 257 HepLorentzVector col1() const; 258 HepLorentzVector col2() const; 259 HepLorentzVector col3() const; 260 HepLorentzVector col4() const; 261 HepLorentzVector row1() const; 262 HepLorentzVector row2() const; 263 HepLorentzVector row3() const; 264 HepLorentzVector row4() const; 265 266 // individual elements treating this as a 4 267 double xt() const; 268 double yt() const; 269 double zt() const; 270 double tx() const; 271 double ty() const; 272 double tz() const; 273 double tt() const; 274 275 // ---------- Operations in the Rotation gro 276 277 HepRotation operator * ( const Hep3RotationI 278 279 // ---------- Application 280 281 HepLorentzVector operator* ( const HepLorent 282 HepLorentzVector operator()( const HepLorent 283 // apply to HepLorentzVector 284 285 Hep3Vector operator* ( const Hep3Vector & v 286 Hep3Vector operator()( const Hep3Vector & v 287 // apply to Hep3Vector 288 289 // ---------- I/O and a helper method 290 291 std::ostream & print( std::ostream & os ) co 292 293 #endif /* ONLY_IN_CONCRETE_CLASSES */ 294 295 private: 296 297 ~Hep3RotationInterface() {} // private destr 298 299 }; // Hep3RotationInterface 300 301 //-*************************** 302 // 3x3 and 4x4 representations 303 //-*************************** 304 305 struct HepRep3x3 { 306 307 // ----- Constructors: 308 309 inline HepRep3x3(); 310 311 inline HepRep3x3( double xx, double xy, dou 312 , double yx, double yy, dou 313 , double zx, double zy, dou 314 ); 315 316 inline HepRep3x3( const double * array ); 317 // construct from an array of doubles, holdi 318 // in ROW order (xx, xy, ...) 319 320 inline void setToIdentity(); 321 322 // ----- The data members are public: 323 double xx_, xy_, xz_, 324 yx_, yy_, yz_, 325 zx_, zy_, zz_; 326 327 inline void getArray ( double * array ) cons 328 // fill array with the NINE doubles xx, xy, 329 330 }; // HepRep3x3 331 332 struct HepRep4x4 { 333 334 // ----- Constructors: 335 inline HepRep4x4(); 336 337 inline HepRep4x4( double xx, double xy, dou 338 , double yx, double yy, dou 339 , double zx, double zy, dou 340 , double tx, double ty, dou 341 ); 342 343 inline HepRep4x4( const HepRep4x4Symmetric & 344 345 inline HepRep4x4( const double * array ); 346 // construct from an array of doubles, holdi 347 // in ROW order xx, xy, ... 348 349 inline void setToIdentity(); 350 351 // ----- The data members are public: 352 double xx_, xy_, xz_, xt_, 353 yx_, yy_, yz_, yt_, 354 zx_, zy_, zz_, zt_, 355 tx_, ty_, tz_, tt_; 356 357 inline void getArray ( double * array ) cons 358 // fill array with the SIXTEEN doubles xx, x 359 360 inline bool operator==(HepRep4x4 const & r) 361 inline bool operator!=(HepRep4x4 const & r) 362 363 364 }; // HepRep4x4 365 366 struct HepRep4x4Symmetric { 367 368 // ----- Constructors: 369 370 inline HepRep4x4Symmetric(); 371 372 inline HepRep4x4Symmetric 373 ( double xx, double xy, double xz, double xt 374 , double yy, double yz, 375 , double z 376 377 378 inline HepRep4x4Symmetric( const double * ar 379 // construct from an array of doubles, holdi 380 // elements in this order: xx, xy, xz, xt, 381 382 inline void setToIdentity(); 383 384 // ----- The data members are public: 385 double xx_, xy_, xz_, xt_, 386 yy_, yz_, yt_, 387 zz_, zt_, 388 tt_; 389 390 inline void getArray ( double * array ) cons 391 // fill array with the TEN doubles xx, xy, x 392 393 }; 394 395 } // namespace CLHEP 396 397 #include "CLHEP/Vector/RotationInterfaces.icc" 398 399 #endif // ROTATION_INTERFACES_H 400