CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

Basic3DVector< long double > Class Template Reference

#include <Basic3DVectorLD.h>

List of all members.

Public Types

typedef
Geom::Cylindrical2Cartesian< T
Cylindrical
typedef Spherical Polar
typedef T ScalarType
typedef
Geom::Spherical2Cartesian< T
Spherical
typedef long double T

Public Member Functions

T barePhi () const
T bareTheta () const
 Basic3DVector (const Basic3DVector &p)
 Copy constructor from same type. Should not be needed but for gcc bug 12685.
template<typename U >
 Basic3DVector (const Geom::Theta< U > &theta, const Geom::Phi< U > &phi, const T &r)
 Basic3DVector (const Basic2DVector< T > &p)
 constructor from 2D vector (X and Y from 2D vector, z set to zero)
 Basic3DVector ()
template<class OtherPoint >
 Basic3DVector (const OtherPoint &p)
template<class U >
 Basic3DVector (const Basic3DVector< U > &p)
 Copy constructor and implicit conversion from Basic3DVector of different precision.
template<typename U >
 Basic3DVector (mathSSE::Vec4< U > const &iv)
 Basic3DVector (const T &x, const T &y, const T &z)
 construct from cartesian coordinates
template<class U >
Basic3DVector< typename
PreciseFloatType< T, U >::Type > 
cross (const Basic3DVector< U > &v) const
Basic3DVector cross (const Basic3DVector &v) const
 Vector product, or "cross" product, with a vector of same type.
template<class U >
PreciseFloatType< T, U >::Type dot (const Basic3DVector< U > &v) const
T dot (const Basic3DVector &v) const
 Scalar product, or "dot" product, with a vector of same type.
T eta () const
T mag () const
 The vector magnitude. Equivalent to sqrt(vec.mag2())
T mag2 () const
 The vector magnitude squared. Equivalent to vec.dot(vec)
Basic3DVectoroperator*= (T t)
 Scaling by a scalar value (multiplication)
template<class U >
Basic3DVectoroperator+= (const Basic3DVector< U > &p)
Basic3DVector operator- () const
 Unary minus, returns a vector with components (-x(),-y(),-z())
template<class U >
Basic3DVectoroperator-= (const Basic3DVector< U > &p)
Basic3DVectoroperator/= (T t)
 Scaling by a scalar value (division)
bool operator== (const Basic3DVector &rh) const
T perp () const
 Magnitude of transverse component.
T perp2 () const
 Squared magnitude of transverse component.
Geom::Phi< Tphi () const
Geom::Theta< Ttheta () const
T transverse () const
 Another name for perp()
Basic3DVector unit () const
T x () const
 Cartesian x coordinate.
Basic2DVector< Txy () const
T y () const
 Cartesian y coordinate.
T z () const
 Cartesian z coordinate.

Private Attributes

T theW
T theX
T theY
T theZ

Detailed Description

template<>
class Basic3DVector< long double >

Definition at line 7 of file Basic3DVectorLD.h.


Member Typedef Documentation

Definition at line 11 of file Basic3DVectorLD.h.

typedef Spherical Basic3DVector< long double >::Polar

Definition at line 13 of file Basic3DVectorLD.h.

typedef T Basic3DVector< long double >::ScalarType

Definition at line 10 of file Basic3DVectorLD.h.

Definition at line 12 of file Basic3DVectorLD.h.

typedef long double Basic3DVector< long double >::T

Definition at line 9 of file Basic3DVectorLD.h.


Constructor & Destructor Documentation

Basic3DVector< long double >::Basic3DVector ( ) [inline]

default constructor uses default constructor of T to initialize the components. For built-in floating-point types this means initialization to zero??? (force init to 0)

Definition at line 19 of file Basic3DVectorLD.h.

: theX(0), theY(0), theZ(0), theW(0) {}
Basic3DVector< long double >::Basic3DVector ( const Basic3DVector< long double > &  p) [inline]

Copy constructor from same type. Should not be needed but for gcc bug 12685.

Definition at line 22 of file Basic3DVectorLD.h.

                                          : 
    theX(p.x()), theY(p.y()), theZ(p.z()), theW(0) {}
template<class U >
Basic3DVector< long double >::Basic3DVector ( const Basic3DVector< U > &  p) [inline]

Copy constructor and implicit conversion from Basic3DVector of different precision.

Definition at line 27 of file Basic3DVectorLD.h.

                                             : 
    theX(p.x()), theY(p.y()), theZ(p.z()), theW(0) {}
Basic3DVector< long double >::Basic3DVector ( const Basic2DVector< T > &  p) [inline]

constructor from 2D vector (X and Y from 2D vector, z set to zero)

Definition at line 31 of file Basic3DVectorLD.h.

                                             : 
    theX(p.x()), theY(p.y()), theZ(0), theW(0) {}
template<class OtherPoint >
Basic3DVector< long double >::Basic3DVector ( const OtherPoint &  p) [inline, explicit]

Explicit constructor from other (possibly unrelated) vector classes The only constraint on the argument type is that it has methods x(), y() and z(), and that these methods return a type convertible to T. Examples of use are
construction from a Basic3DVector with different precision
construction from a Hep3Vector
construction from a coordinate system converter

Definition at line 43 of file Basic3DVectorLD.h.

                                               : 
    theX(p.x()), theY(p.y()), theZ(p.z()), theW(0) {}
template<typename U >
Basic3DVector< long double >::Basic3DVector ( mathSSE::Vec4< U > const &  iv) [inline]

Definition at line 50 of file Basic3DVectorLD.h.

                                          :
    theX(iv.arr[0]), theY(iv.arr[1]), theZ(iv.arr[2]), theW(0) {}
Basic3DVector< long double >::Basic3DVector ( const T x,
const T y,
const T z 
) [inline]

construct from cartesian coordinates

Definition at line 55 of file Basic3DVectorLD.h.

                                                     : 
    theX(x), theY(y), theZ(z), theW(0) {}
template<typename U >
Basic3DVector< long double >::Basic3DVector ( const Geom::Theta< U > &  theta,
const Geom::Phi< U > &  phi,
const T r 
) [inline]

Deprecated construct from polar coordinates, use
Basic3DVector<T>( Basic3DVector<T>::Polar( theta, phi, r)) instead.

Definition at line 63 of file Basic3DVectorLD.h.

References L1TEmulatorMonitor_cff::p, csvReporter::r, Basic3DVector< T >::theX, Basic3DVector< T >::theY, Basic3DVector< T >::theZ, Geom::Phi< T >::value(), and Geom::Theta< T >::value().

                                                    {
    Polar p( theta.value(), phi.value(), r);
    theX = p.x(); theY = p.y(); theZ = p.z();
  }

Member Function Documentation

T Basic3DVector< long double >::barePhi ( ) const [inline]

Azimuthal angle. The value is returned in radians, in the range (-pi,pi]. Same precision as the system atan2(x,y) function. The return type is Geom::Phi<T>, see it's documentation.

Definition at line 105 of file Basic3DVectorLD.h.

References Basic3DVector< T >::x(), and Basic3DVector< T >::y().

{return std::atan2(y(),x());}
T Basic3DVector< long double >::bareTheta ( ) const [inline]

Polar angle. The value is returned in radians, in the range [0,pi] Same precision as the system atan2(x,y) function. The return type is Geom::Phi<T>, see it's documentation.

Definition at line 112 of file Basic3DVectorLD.h.

References Basic3DVector< T >::perp(), and Basic3DVector< T >::z().

{return std::atan2(perp(),z());}
Basic3DVector Basic3DVector< long double >::cross ( const Basic3DVector< long double > &  v) const [inline]

Vector product, or "cross" product, with a vector of same type.

Definition at line 190 of file Basic3DVectorLD.h.

References Basic3DVector< T >::Basic3DVector(), Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

                                                     {
    return Basic3DVector( y()*v.z() - v.y()*z(), 
                          z()*v.x() - v.z()*x(), 
                          x()*v.y() - v.x()*y());
  }
template<class U >
Basic3DVector<typename PreciseFloatType<T,U>::Type> Basic3DVector< long double >::cross ( const Basic3DVector< U > &  v) const [inline]

Vector (or cross) product with a vector of different precision. The product is computed without loss of precision. The type of the returned vector is the more precise of the types of the two vectors.

Definition at line 204 of file Basic3DVectorLD.h.

References Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

                                          {
    return Basic3DVector<typename PreciseFloatType<T,U>::Type>( y()*v.z() - v.y()*z(), 
                                                                z()*v.x() - v.z()*x(), 
                                                                x()*v.y() - v.x()*y());
  }
T Basic3DVector< long double >::dot ( const Basic3DVector< long double > &  v) const [inline]

Scalar product, or "dot" product, with a vector of same type.

Definition at line 175 of file Basic3DVectorLD.h.

References Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

Referenced by operator*().

                                       { 
    return x()*v.x() + y()*v.y() + z()*v.z();
  }
template<class U >
PreciseFloatType<T,U>::Type Basic3DVector< long double >::dot ( const Basic3DVector< U > &  v) const [inline]

Scalar (or dot) product with a vector of different precision. The product is computed without loss of precision. The type of the returned scalar is the more precise of the scalar types of the two vectors.

Definition at line 185 of file Basic3DVectorLD.h.

References Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

                                                                           { 
    return x()*v.x() + y()*v.y() + z()*v.z();
  }
T Basic3DVector< long double >::eta ( ) const [inline]

Pseudorapidity. Does not check for zero transverse component; in this case the behavior is as for divide-by zero, i.e. system-dependent.

Definition at line 120 of file Basic3DVectorLD.h.

References Basic3DVector< T >::eta(), Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

{ return detailsBasic3DVector::eta(x(),y(),z());} // correct 
T Basic3DVector< long double >::mag ( ) const [inline]

The vector magnitude. Equivalent to sqrt(vec.mag2())

Definition at line 90 of file Basic3DVectorLD.h.

References Basic3DVector< T >::mag2(), and mathSSE::sqrt().

{ return std::sqrt( mag2());}
T Basic3DVector< long double >::mag2 ( ) const [inline]

The vector magnitude squared. Equivalent to vec.dot(vec)

Definition at line 87 of file Basic3DVectorLD.h.

References Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

{ return  x()*x() + y()*y()+z()*z();}
Basic3DVector& Basic3DVector< long double >::operator*= ( T  t) [inline]

Scaling by a scalar value (multiplication)

Definition at line 158 of file Basic3DVectorLD.h.

References matplotRender::t, Basic3DVector< T >::theX, Basic3DVector< T >::theY, and Basic3DVector< T >::theZ.

                                   {
    theX *= t;
    theY *= t;
    theZ *= t;
    return *this;
  } 
template<class U >
Basic3DVector& Basic3DVector< long double >::operator+= ( const Basic3DVector< U > &  p) [inline]

Operator += with a Basic3DVector of possibly different precision.

Definition at line 137 of file Basic3DVectorLD.h.

References Basic3DVector< T >::theX, Basic3DVector< T >::theY, Basic3DVector< T >::theZ, Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

                                                         {
    theX += p.x();
    theY += p.y();
    theZ += p.z();
    return *this;
  } 
Basic3DVector Basic3DVector< long double >::operator- ( ) const [inline]

Unary minus, returns a vector with components (-x(),-y(),-z())

Definition at line 155 of file Basic3DVectorLD.h.

References Basic3DVector< T >::Basic3DVector(), Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

{ return Basic3DVector(-x(),-y(),-z());}
template<class U >
Basic3DVector& Basic3DVector< long double >::operator-= ( const Basic3DVector< U > &  p) [inline]

Operator -= with a Basic3DVector of possibly different precision.

Definition at line 147 of file Basic3DVectorLD.h.

References Basic3DVector< T >::theX, Basic3DVector< T >::theY, Basic3DVector< T >::theZ, Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

                                                         {
    theX -= p.x();
    theY -= p.y();
    theZ -= p.z();
    return *this;
  } 
Basic3DVector& Basic3DVector< long double >::operator/= ( T  t) [inline]

Scaling by a scalar value (division)

Definition at line 166 of file Basic3DVectorLD.h.

References matplotRender::t, Basic3DVector< T >::theX, Basic3DVector< T >::theY, and Basic3DVector< T >::theZ.

                                   {
    t = T(1)/t;
    theX *= t;
    theY *= t;   
    theZ *= t;
    return *this;
  } 
bool Basic3DVector< long double >::operator== ( const Basic3DVector< long double > &  rh) const [inline]

Definition at line 82 of file Basic3DVectorLD.h.

References Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

                                                 {
    return x()==rh.x() && y()==rh.y() && z()==rh.z();
  }
T Basic3DVector< long double >::perp ( ) const [inline]

Magnitude of transverse component.

Definition at line 96 of file Basic3DVectorLD.h.

References Basic3DVector< T >::perp2(), and mathSSE::sqrt().

{ return std::sqrt( perp2());}
T Basic3DVector< long double >::perp2 ( ) const [inline]

Squared magnitude of transverse component.

Definition at line 93 of file Basic3DVectorLD.h.

References Basic3DVector< T >::x(), and Basic3DVector< T >::y().

{ return x()*x() + y()*y();}
Geom::Phi<T> Basic3DVector< long double >::phi ( ) const [inline]

Definition at line 106 of file Basic3DVectorLD.h.

References Basic3DVector< T >::barePhi().

{return Geom::Phi<T>(barePhi());}
Geom::Theta<T> Basic3DVector< long double >::theta ( ) const [inline]

Definition at line 113 of file Basic3DVectorLD.h.

References Basic3DVector< T >::perp(), and Basic3DVector< T >::z().

{return Geom::Theta<T>(std::atan2(perp(),z()));}
T Basic3DVector< long double >::transverse ( ) const [inline]

Another name for perp()

Definition at line 99 of file Basic3DVectorLD.h.

References Basic3DVector< T >::perp().

{ return perp();}
Basic3DVector Basic3DVector< long double >::unit ( ) const [inline]

Unit vector parallel to this. If mag() is zero, a zero vector is returned.

Definition at line 126 of file Basic3DVectorLD.h.

References Basic3DVector< T >::mag2(), runTheMatrix::ret, and mathSSE::sqrt().

                             {
    T my_mag = mag2();
    if (my_mag==0) return *this;
    my_mag = T(1)/std::sqrt(my_mag);
    Basic3DVector ret(*this);
    return  ret*=my_mag;
  }
T Basic3DVector< long double >::x ( ) const [inline]

Cartesian x coordinate.

Definition at line 70 of file Basic3DVectorLD.h.

References Basic3DVector< T >::theX.

Referenced by operator*(), and operator+().

{ return theX;}
Basic2DVector<T> Basic3DVector< long double >::xy ( ) const [inline]

Definition at line 78 of file Basic3DVectorLD.h.

References Basic3DVector< T >::theX, and Basic3DVector< T >::theY.

T Basic3DVector< long double >::y ( ) const [inline]

Cartesian y coordinate.

Definition at line 73 of file Basic3DVectorLD.h.

References Basic3DVector< T >::theY.

Referenced by operator*(), and operator+().

{ return theY;}
T Basic3DVector< long double >::z ( ) const [inline]

Cartesian z coordinate.

Definition at line 76 of file Basic3DVectorLD.h.

References Basic3DVector< T >::theZ.

Referenced by operator*(), and operator+().

{ return theZ;}

Member Data Documentation

T Basic3DVector< long double >::theW [private]

Definition at line 214 of file Basic3DVectorLD.h.

T Basic3DVector< long double >::theX [private]

Definition at line 211 of file Basic3DVectorLD.h.

T Basic3DVector< long double >::theY [private]

Definition at line 212 of file Basic3DVectorLD.h.

T Basic3DVector< long double >::theZ [private]

Definition at line 213 of file Basic3DVectorLD.h.