CLHEP/Vector/RotationZ.h

// -*- C++ -*-
// CLASSDOC OFF
// ---------------------------------------------------------------------------
// CLASSDOC ON
//
// This file is a part of the CLHEP - a Class Library for High Energy Physics.
//
// This is the definition of the HepRotationZ class for performing rotations
// around the X axis on objects of the Hep3Vector (and HepLorentzVector) class.
//
// HepRotationZ is a concrete implementation of Hep3RotationInterface.
//
// .SS See Also
// RotationInterfaces.h
// ThreeVector.h, LorentzVector.h, LorentzRotation.h
//
// .SS Author
// Mark Fischler

#ifndef HEP_ROTATIONZ_H
#define HEP_ROTATIONZ_H

#ifdef GNUPRAGMA
#pragma interface
#endif

#include "CLHEP/Vector/RotationInterfaces.h"

#ifdef HEP_NO_INLINE_IN_DECLARATION
#define inline
#endif

class HepRotation;

class HepRotationZ : public Hep3RotationInterface {

public:

  // ----------  Constructors and Assignment:

  inline HepRotationZ();
  // Default constructor. Gives an identity rotation. 

  HepRotationZ(HepDouble delta);
  // supply angle of rotation 

  inline HepRotationZ(const HepRotationZ & orig);
  // Copy constructor.

  inline HepRotationZ & operator = (const HepRotationZ & r);
  // Assignment from a Rotation, which must be RotationZ

  HepRotationZ & set ( HepDouble delta );
  // set angle of rotation 

  inline ~HepRotationZ();
  // Trivial destructor.

  // ----------  Accessors:

  inline Hep3Vector colX() const;
  inline Hep3Vector colY() const;
  inline Hep3Vector colZ() const;
  // orthogonal unit-length column vectors

  inline Hep3Vector rowX() const;
  inline Hep3Vector rowY() const;
  inline Hep3Vector rowZ() const;
  // orthogonal unit-length row vectors
                                
  inline HepDouble xx() const;
  inline HepDouble xy() const;
  inline HepDouble xz() const;
  inline HepDouble yx() const;
  inline HepDouble yy() const;
  inline HepDouble yz() const;
  inline HepDouble zx() const;
  inline HepDouble zy() const;
  inline HepDouble zz() const;
  // Elements of the rotation matrix (Geant4).

  virtual HepRep3x3 rep3x3() const;
  //   3x3 representation:

  // ------------  Euler angles:
  inline  HepDouble getPhi  () const;
  inline  HepDouble getTheta() const;
  inline  HepDouble getPsi  () const;
  virtual HepDouble    phi  () const;
  virtual HepDouble    theta() const;
  virtual HepDouble    psi  () const;
  virtual HepEulerAngles eulerAngles() const;

  // ------------  axis & angle of rotation:
  inline  HepDouble  getDelta() const;
  inline  Hep3Vector getAxis () const;
  inline  HepDouble     delta() const;
  inline  Hep3Vector    axis () const;
  inline  HepAxisAngle  axisAngle() const;
  inline  void getAngleAxis(HepDouble & delta, Hep3Vector & axis) const;
  // Returns the rotation angle and rotation axis (Geant4). 	

  // ------------- Angles of rotated axes
  HepDouble phiX() const;
  HepDouble phiY() const;
  HepDouble phiZ() const;
  HepDouble thetaX() const;
  HepDouble thetaY() const;
  HepDouble thetaZ() const;
  // Return angles (RADS) made by rotated axes against original axes (Geant4).

  // ----------  Other accessors treating pure rotation as a 4-rotation
  //		 are inherited from Hep3RotationInterface

  // ---------   Mutators 

  virtual void setDelta (HepDouble delta);
  // change angle of rotation, leaving rotation axis unchanged.

  // ----------  Decomposition:

  virtual void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
  virtual void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
  // These are trivial, as the boost vector is 0.		

  // ----------  Comparisons: 
  
         HepBoolean operator == (const HepRotationZ &) const;  
         HepBoolean operator == (const Hep3RotationInterface &) const;  
         HepBoolean operator == (const Hep4RotationInterface &) const;  
  inline HepBoolean operator != (const HepRotationZ &) const;
  inline HepBoolean operator != (const Hep3RotationInterface &) const;
  inline HepBoolean operator != (const Hep4RotationInterface &) const;
  // Comparisons (Geant4).

  inline HepBoolean isIdentity() const;				
  // Returns true if the identity matrix (Geant4).	

  // Dictionary-order comparisons inherited from Hep3RotationInterface.
  
  virtual HepDouble distance2( const Hep4RotationInterface & lt  ) const; 
  // 3 - Tr ( this/r ) + |b|^2 / (1-|b|^2) where b is the boost vector of lt

  virtual HepDouble distance2( const HepRotationZ & r  ) const; 
  virtual HepDouble distance2( const Hep3RotationInterface & r  ) const; 
  // 3 - Tr ( this/r )

  virtual HepDouble howNear(   const Hep4RotationInterface & lt ) const;
  virtual HepDouble howNear(   const Hep3RotationInterface & r  ) const;
  virtual HepDouble howNear(   const HepRotationZ & r  ) const;

  virtual HepBoolean isNear(   const Hep4RotationInterface & lt,
                                     HepDouble epsilon=tolerance) const;
  virtual HepBoolean isNear(   const Hep3RotationInterface & r,
                                     HepDouble epsilon=tolerance) const;
  virtual HepBoolean isNear(   const HepRotationZ & r,
                                     HepDouble epsilon=tolerance) const;

  // ----------  Properties:

  virtual HepDouble norm2() const; 
  // distance2 (IDENTITY), which is 3 - Tr ( *this )

  inline void rectify();
  // non-const but logically moot correction for accumulated roundoff errors

  // ---------- Application:

  virtual Hep3Vector operator() (const Hep3Vector & p) const;
  // Rotate a Hep3Vector.					

  inline  Hep3Vector operator * (const Hep3Vector & p) const;
  // Multiplication with a Hep3Vector.

  virtual HepLorentzVector operator()( const HepLorentzVector & w ) const;
  // Rotate (the space part of) a HepLorentzVector.		

  inline  HepLorentzVector operator* ( const HepLorentzVector & w ) const;
  // Multiplication with a HepLorentzVector.

 // ---------- Operations in the group of Rotations

  virtual HepRotation operator * (const Hep3RotationInterface & r) const;
  // Product of two rotations (this) * r - matrix multiplication

  virtual HepRotationZ operator * (const HepRotationZ & rz) const;
  // Product of two Z rotations:  (this) * rz is known to be RotationZ.

  // Product of two rotations (this) * b - matrix multiplication  

  inline  HepRotationZ & operator *= (const HepRotationZ & r);
  inline  HepRotationZ & transform   (const HepRotationZ & r);
  // Matrix multiplication.
  // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a;
  // However, in this special case, they commute:  Both just add deltas.

  inline HepRotationZ inverse() const;
  // Returns the inverse.

  inline HepRotationZ & invert();
  // Inverts the Rotation matrix (be negating delta).

  // ---------- I/O: 

  virtual HepStd::ostream & print( HepStd::ostream & os ) const;
  // Output, identifying type of rotation and delta.

protected:

  HepDouble d;
  // The angle of rotation.

  HepDouble s;
  HepDouble c;
  // Cache the trig functions, for rapid operations.

  inline HepRotationZ ( HepDouble dd, HepDouble ss, HepDouble cc );
  // Unchecked load-the-data-members

};

// ---------- Free-function operations in the group of Rotations

inline HepRotationZ inverseOf(const HepRotationZ & r);
// Returns the inverse of a RotationZ.

#ifdef HEP_NO_INLINE_IN_DECLARATION
#undef inline
#endif

#ifndef HEP_DEBUG_INLINE
#include "CLHEP/Vector/RotationZ.icc"
#endif

#endif /* HEP_ROTATIONZ_H */


Generated by GNU enscript 1.6.1.