CLHEP 2.0.4.7 Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

RotationY.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // CLASSDOC OFF
00003 // ---------------------------------------------------------------------------
00004 // CLASSDOC ON
00005 //
00006 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
00007 //
00008 // This is the definition of the HepRotationY class for performing rotations
00009 // around the X axis on objects of the Hep3Vector (and HepLorentzVector) class.
00010 //
00011 // HepRotationY is a concrete implementation of Hep3RotationInterface.
00012 //
00013 // .SS See Also
00014 // RotationInterfaces.h
00015 // ThreeVector.h, LorentzVector.h, LorentzRotation.h
00016 //
00017 // .SS Author
00018 // Mark Fischler
00019 
00020 #ifndef HEP_ROTATIONY_H
00021 #define HEP_ROTATIONY_H
00022 
00023 #ifdef GNUPRAGMA
00024 #pragma interface
00025 #endif
00026 
00027 #include "CLHEP/Vector/defs.h" 
00028 #include "CLHEP/Vector/RotationInterfaces.h"
00029 
00030 namespace CLHEP {
00031 
00032 class HepRotationY;
00033 class HepRotation;
00034 class HepBoost;
00035 
00036 inline HepRotationY inverseOf(const HepRotationY & r);
00037 // Returns the inverse of a RotationY.
00038 
00043 class HepRotationY {
00044 
00045 public:
00046 
00047   // ----------  Constructors and Assignment:
00048 
00049   inline HepRotationY();
00050   // Default constructor. Gives an identity rotation. 
00051 
00052   HepRotationY(double delta);
00053   // supply angle of rotation 
00054 
00055   inline HepRotationY(const HepRotationY & orig);
00056   // Copy constructor.
00057 
00058   inline HepRotationY & operator = (const HepRotationY & r);
00059   // Assignment from a Rotation, which must be RotationY
00060 
00061   HepRotationY & set ( double delta );
00062   // set angle of rotation 
00063 
00064   inline ~HepRotationY();
00065   // Trivial destructor.
00066 
00067   // ----------  Accessors:
00068 
00069   inline Hep3Vector colX() const;
00070   inline Hep3Vector colY() const;
00071   inline Hep3Vector colZ() const;
00072   // orthogonal unit-length column vectors
00073 
00074   inline Hep3Vector rowX() const;
00075   inline Hep3Vector rowY() const;
00076   inline Hep3Vector rowZ() const;
00077   // orthogonal unit-length row vectors
00078                                 
00079   inline double xx() const;
00080   inline double xy() const;
00081   inline double xz() const;
00082   inline double yx() const;
00083   inline double yy() const;
00084   inline double yz() const;
00085   inline double zx() const;
00086   inline double zy() const;
00087   inline double zz() const;
00088   // Elements of the rotation matrix (Geant4).
00089 
00090   inline HepRep3x3 rep3x3() const;
00091   //   3x3 representation:
00092 
00093   // ------------  Euler angles:
00094   inline  double getPhi  () const;
00095   inline  double getTheta() const;
00096   inline  double getPsi  () const;
00097   double    phi  () const;
00098   double    theta() const;
00099   double    psi  () const;
00100   HepEulerAngles eulerAngles() const;
00101 
00102   // ------------  axis & angle of rotation:
00103   inline  double  getDelta() const;
00104   inline  Hep3Vector getAxis () const;
00105   inline  double     delta() const;
00106   inline  Hep3Vector    axis () const;
00107   inline  HepAxisAngle  axisAngle() const;
00108   inline  void getAngleAxis(double & delta, Hep3Vector & axis) const;
00109   // Returns the rotation angle and rotation axis (Geant4).     
00110 
00111   // ------------- Angles of rotated axes
00112   double phiX() const;
00113   double phiY() const;
00114   double phiZ() const;
00115   double thetaX() const;
00116   double thetaY() const;
00117   double thetaZ() const;
00118   // Return angles (RADS) made by rotated axes against original axes (Geant4).
00119 
00120   // ----------  Other accessors treating pure rotation as a 4-rotation
00121 
00122   inline HepLorentzVector col1() const;
00123   inline HepLorentzVector col2() const;
00124   inline HepLorentzVector col3() const;
00125   //  orthosymplectic 4-vector columns - T component will be zero
00126 
00127   inline HepLorentzVector col4() const;
00128   // Will be (0,0,0,1) for this pure Rotation.
00129 
00130   inline HepLorentzVector row1() const;
00131   inline HepLorentzVector row2() const;
00132   inline HepLorentzVector row3() const;
00133   //  orthosymplectic 4-vector rows - T component will be zero
00134 
00135   inline HepLorentzVector row4() const;
00136   // Will be (0,0,0,1) for this pure Rotation.
00137 
00138   inline double xt() const;
00139   inline double yt() const;
00140   inline double zt() const;
00141   inline double tx() const;
00142   inline double ty() const;
00143   inline double tz() const;
00144   // Will be zero for this pure Rotation
00145 
00146   inline double tt() const;
00147   // Will be one for this pure Rotation
00148 
00149   inline HepRep4x4 rep4x4() const;
00150   //   4x4 representation.
00151 
00152   // ---------   Mutators 
00153 
00154   void setDelta (double delta);
00155   // change angle of rotation, leaving rotation axis unchanged.
00156 
00157   // ----------  Decomposition:
00158 
00159   void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
00160   void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
00161   void decompose (HepRotation & rotation, HepBoost & boost) const;
00162   void decompose (HepBoost & boost, HepRotation & rotation) const;
00163    // These are trivial, as the boost vector is 0.              
00164 
00165   // ----------  Comparisons: 
00166   
00167   inline bool isIdentity() const;                               
00168   // Returns true if the identity matrix (Geant4).      
00169 
00170   inline int compare( const HepRotationY & r  ) const;
00171   // Dictionary-order comparison, in order of delta
00172   // Used in operator<, >, <=, >=
00173 
00174   inline bool operator== ( const HepRotationY & r ) const;
00175   inline bool operator!= ( const HepRotationY & r ) const;
00176   inline bool operator<  ( const HepRotationY & r ) const;
00177   inline bool operator>  ( const HepRotationY & r ) const;
00178   inline bool operator<= ( const HepRotationY & r ) const;
00179   inline bool operator>= ( const HepRotationY & r ) const;
00180 
00181   double distance2( const HepRotationY & r  ) const; 
00182   // 3 - Tr ( this/r )
00183 
00184   double distance2( const HepRotation &  r  ) const;
00185   // 3 - Tr ( this/r ) -- This works with RotationY or Z also
00186 
00187   double howNear( const HepRotationY & r ) const;
00188   double howNear( const HepRotation  & r ) const;
00189   bool isNear( const HepRotationY & r,
00190              double epsilon=Hep4RotationInterface::tolerance) const;
00191   bool isNear( const HepRotation  & r,
00192              double epsilon=Hep4RotationInterface::tolerance) const;
00193                                      
00194   double distance2( const HepBoost           & lt  ) const;
00195   // 3 - Tr ( this ) + |b|^2 / (1-|b|^2)
00196   double distance2( const HepLorentzRotation & lt  ) const;
00197   // 3 - Tr ( this/r ) + |b|^2 / (1-|b|^2) where b is the boost vector of lt
00198 
00199   double howNear( const HepBoost           & lt ) const;
00200   double howNear( const HepLorentzRotation & lt ) const;
00201   bool isNear( const HepBoost           & lt,
00202              double epsilon=Hep4RotationInterface::tolerance) const;
00203   bool isNear( const HepLorentzRotation & lt,
00204              double epsilon=Hep4RotationInterface::tolerance) const;
00205 
00206   // ----------  Properties:
00207 
00208   double norm2() const; 
00209   // distance2 (IDENTITY), which is 3 - Tr ( *this )
00210 
00211   inline void rectify();
00212   // non-const but logically moot correction for accumulated roundoff errors
00213 
00214   // ---------- Application:
00215 
00216   inline Hep3Vector operator() (const Hep3Vector & p) const;
00217   // Rotate a Hep3Vector.                                       
00218 
00219   inline  Hep3Vector operator * (const Hep3Vector & p) const;
00220   // Multiplication with a Hep3Vector.
00221 
00222   inline HepLorentzVector operator()( const HepLorentzVector & w ) const;
00223   // Rotate (the space part of) a HepLorentzVector.             
00224 
00225   inline  HepLorentzVector operator* ( const HepLorentzVector & w ) const;
00226   // Multiplication with a HepLorentzVector.
00227 
00228   // ---------- Operations in the group of Rotations
00229 
00230   inline HepRotationY operator * (const HepRotationY & ry) const;
00231   // Product of two Y rotations (this) * ry is known to be RotationY.
00232 
00233   inline  HepRotationY & operator *= (const HepRotationY & r);
00234   inline  HepRotationY & transform   (const HepRotationY & r);
00235   // Matrix multiplication.
00236   // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a;
00237   // However, in this special case, they commute:  Both just add deltas.
00238 
00239   inline HepRotationY inverse() const;
00240   // Returns the inverse.
00241 
00242   friend HepRotationY inverseOf(const HepRotationY & r);
00243   // Returns the inverse of a RotationY.
00244 
00245   inline HepRotationY & invert();
00246   // Inverts the Rotation matrix (be negating delta).
00247 
00248   // ---------- I/O: 
00249 
00250   std::ostream & print( std::ostream & os ) const;
00251   // Output, identifying type of rotation and delta.
00252 
00253   // ---------- Tolerance
00254 
00255   static inline double getTolerance();
00256   static inline double setTolerance(double tol);
00257 
00258 protected:
00259 
00260   double d;
00261   // The angle of rotation.
00262 
00263   double s;
00264   double c;
00265   // Cache the trig functions, for rapid operations.
00266 
00267   inline HepRotationY ( double dd, double ss, double cc );
00268   // Unchecked load-the-data-members
00269 
00270   static inline double proper (double delta);
00271   // Put an angle into the range of (-PI, PI].  Useful helper method.
00272 
00273 };  // HepRotationY
00274 
00275 // ---------- Free-function operations in the group of Rotations
00276 
00277 inline   
00278 std::ostream & operator << 
00279         ( std::ostream & os, const HepRotationY & r ) {return r.print(os);}
00280 
00281 }  // namespace CLHEP
00282 
00283 #include "CLHEP/Vector/RotationY.icc"
00284 
00285 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
00286 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
00287 using namespace CLHEP;
00288 #endif
00289 
00290 #endif /* HEP_ROTATIONY_H */
00291 

Generated on Thu Jul 1 22:02:31 2010 for CLHEP by  doxygen 1.4.7