#ifndef ROOT_Math_GenVector_Cylindrical3D 
#define ROOT_Math_GenVector_Cylindrical3D  1
#ifndef ROOT_Math_Math
#include "Math/Math.h"
#endif
#ifndef ROOT_Math_GenVector_etaMax
#include "Math/GenVector/etaMax.h"
#endif
#include <limits>
 
namespace ROOT { 
  namespace Math { 
   
template <class T> 
class Cylindrical3D { 
public : 
   typedef T Scalar;
   
   Cylindrical3D() : fRho(0), fZ(0), fPhi(0) {  }
   
   Cylindrical3D(Scalar rho, Scalar z, Scalar phi) :  
      fRho(rho), fZ(z), fPhi(phi) { Restrict(); }
    
   template <class CoordSystem > 
   explicit Cylindrical3D( const CoordSystem & v ) : 
      fRho( v.Rho() ),  fZ( v.Z() ),  fPhi( v.Phi() ) { Restrict(); } 
   
   
   
   Cylindrical3D(const Cylindrical3D & v) :
      fRho(v.Rho() ),  fZ(v.Z() ),  fPhi(v.Phi() )  {   } 
   
   Cylindrical3D & operator= (const Cylindrical3D & v) { 
      fRho = v.Rho();  
      fZ   = v.Z(); 
      fPhi = v.Phi(); 
      return *this;
   } 
    
   void SetCoordinates( const Scalar src[] ) 
   { fRho=src[0]; fZ=src[1]; fPhi=src[2]; Restrict(); }
    
   void GetCoordinates( Scalar dest[] ) const 
   { dest[0] = fRho; dest[1] = fZ; dest[2] = fPhi; }
    
   void SetCoordinates(Scalar  rho, Scalar  z, Scalar  phi) 
   { fRho=rho; fZ=z; fPhi=phi; Restrict(); }
    
   void GetCoordinates(Scalar& rho, Scalar& z, Scalar& phi) const 
   {rho=fRho; z=fZ; phi=fPhi;}  				
private:
   inline static double pi() { return M_PI; } 
   inline void Restrict() {
      if ( fPhi <= -pi() || fPhi > pi() ) 
         fPhi = fPhi - std::floor( fPhi/(2*pi()) +.5 ) * 2*pi();
      return;
   } 
public:
   
   
 
   Scalar Rho()   const { return fRho; }
   Scalar Z()     const { return fZ;   }
   Scalar Phi()   const { return fPhi; }
  
   Scalar X()     const { return fRho*std::cos(fPhi); }
   Scalar Y()     const { return fRho*std::sin(fPhi); }
   Scalar Mag2()  const { return fRho*fRho + fZ*fZ;   }
   Scalar R()     const { return std::sqrt( Mag2());  }
   Scalar Perp2() const { return fRho*fRho;           }
   Scalar Theta() const { return (fRho==0 && fZ==0 ) ? 0.0 : atan2(fRho,fZ); }
   
   Scalar Eta() const {
      return Impl::Eta_FromRhoZ( fRho, fZ);
   } 
 
   
  
    
   void SetRho(T rho) { 
      fRho = rho;      
   }
    
   void SetZ(T z) { 
      fZ = z;      
   }
    
   void SetPhi(T phi) { 
      fPhi = phi;      
      Restrict();
   }
   
   void SetXYZ(Scalar x, Scalar y, Scalar z); 
    
   void Scale (T a) {   
      if (a < 0) {
         Negate();
         a = -a;
      }
      fRho *= a; 
      fZ *= a;
   }
    
   void Negate ( ) { 
      fPhi = ( fPhi > 0 ? fPhi - pi() : fPhi + pi() );
      fZ = -fZ;
   }
   
    
   template <class CoordSystem > 
   Cylindrical3D & operator= ( const CoordSystem & c ) { 
      fRho = c.Rho();  
      fZ   = c.Z(); 
      fPhi = c.Phi(); 
      return *this;
   }
     
   bool operator==(const Cylindrical3D & rhs) const {
      return fRho == rhs.fRho && fZ == rhs.fZ && fPhi == rhs.fPhi;
   }
   bool operator!= (const Cylindrical3D & rhs) const 
   {return !(operator==(rhs));}
  
   
  
   
   
   T x() const { return X();}
   T y() const { return Y();}
   T z() const { return Z(); } 
  
   
   
#if defined(__MAKECINT__) || defined(G__DICTIONARY) 
   
   void SetX(Scalar x);
   void SetY(Scalar y);   
   void SetEta(Scalar eta); 
   void SetR(Scalar r); 
   void SetTheta(Scalar theta); 
 
#endif
private:
   T fRho;
   T fZ;
   T fPhi;
};
  } 
} 
#ifndef ROOT_Math_Cartesian3D
#include "Math/GenVector/Cartesian3D.h"
#endif
#if defined(__MAKECINT__) || defined(G__DICTIONARY) 
#include "Math/GenVector/GenVector_exception.h"
#include "Math/GenVector/Polar3D.h"
#include "Math/GenVector/CylindricalEta3D.h"
#endif
namespace ROOT { 
  namespace Math { 
template <class T>  
void Cylindrical3D<T>::SetXYZ(Scalar x, Scalar y, Scalar z) {  
   *this = Cartesian3D<Scalar>(x, y, z);
}
#if defined(__MAKECINT__) || defined(G__DICTIONARY) 
  
template <class T>  
void Cylindrical3D<T>::SetX(Scalar x) {  
   GenVector_exception e("Cylindrical3D::SetX() is not supposed to be called");
   Throw(e);
   Cartesian3D<Scalar> v(*this); v.SetX(x); *this = Cylindrical3D<Scalar>(v);
}
template <class T>  
void Cylindrical3D<T>::SetY(Scalar y) {  
   GenVector_exception e("Cylindrical3D::SetY() is not supposed to be called");
   Throw(e);
   Cartesian3D<Scalar> v(*this); v.SetY(y); *this = Cylindrical3D<Scalar>(v);
}
template <class T>  
void Cylindrical3D<T>::SetR(Scalar r) {  
   GenVector_exception e("Cylindrical3D::SetR() is not supposed to be called");
   Throw(e);
   Polar3D<Scalar> v(*this); v.SetR(r); 
   *this = Cylindrical3D<Scalar>(v);
}
template <class T>  
void Cylindrical3D<T>::SetTheta(Scalar theta) {  
   GenVector_exception e("Cylindrical3D::SetTheta() is not supposed to be called");
   Throw(e);
   Polar3D<Scalar> v(*this); v.SetTheta(theta); 
   *this = Cylindrical3D<Scalar>(v);
}
template <class T>  
void Cylindrical3D<T>::SetEta(Scalar eta) {  
   GenVector_exception e("Cylindrical3D::SetEta() is not supposed to be called");
   Throw(e);
   CylindricalEta3D<Scalar> v(*this); v.SetEta(eta); 
   *this = Cylindrical3D<Scalar>(v);
}
#endif  
  } 
} 
#endif /* ROOT_Math_GenVector_Cylindrical3D  */
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.