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

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

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