CMS 3D CMS Logo

Public Types | Public Member Functions | Public Attributes | Private Attributes

Basic2DVector< T > Class Template Reference

#include <newBasic2DVector.h>

List of all members.

Public Types

typedef Geom::Polar2Cartesian< TPolar
typedef Geom::Polar2Cartesian< TPolar
typedef T ScalarType
typedef T ScalarType

Public Member Functions

T barePhi () const
T barePhi () const
 Basic2DVector (const Basic2DVector &p)
 Copy constructor from same type. Should not be needed but for gcc bug 12685.
template<class Other >
 Basic2DVector (const Other &p)
 Basic2DVector (const T &x, const T &y)
 construct from cartesian coordinates
 Basic2DVector ()
template<typename U >
 Basic2DVector (const Basic2DVector< U > &p)
 Basic2DVector ()
template<typename U >
 Basic2DVector (mathSSE::Vec2< U > const &iv)
 Basic2DVector (const Basic2DVector &p)
 Copy constructor from same type. Should not be needed but for gcc bug 12685.
template<class Other >
 Basic2DVector (const Other &p)
template<typename U >
 Basic2DVector (mathSSE::Vec4< U > const &iv)
 Basic2DVector (const T &x, const T &y)
 construct from cartesian coordinates
template<typename U >
 Basic2DVector (mathSSE::Vec2< U > const &iv)
template<typename U >
 Basic2DVector (mathSSE::Vec4< U > const &iv)
template<class U >
PreciseFloatType< T, U >::Type cross (const Basic2DVector< U > &v) const
T cross (const Basic2DVector &lh) const
 Vector product, or "cross" product, with a vector of same type.
T cross (const Basic2DVector &v) const
 Vector product, or "cross" product, with a vector of same type.
template<class U >
PreciseFloatType< T, U >::Type cross (const Basic2DVector< U > &lh) const
template<class U >
PreciseFloatType< T, U >::Type dot (const Basic2DVector< U > &lh) const
T dot (const Basic2DVector &lh) const
 Scalar product, or "dot" product, with a vector of same type.
T dot (const Basic2DVector &v) const
 Scalar product, or "dot" product, with a vector of same type.
template<class U >
PreciseFloatType< T, U >::Type dot (const Basic2DVector< U > &v) const
T mag () const
 The vector magnitude. Equivalent to sqrt(vec.mag2())
T mag () const
 The vector magnitude. Equivalent to sqrt(vec.mag2())
T mag2 () const
 The vector magnitude squared. Equivalent to vec.dot(vec)
T mag2 () const
 The vector magnitude squared. Equivalent to vec.dot(vec)
Basic2DVectoroperator*= (T t)
 Scaling by a scalar value (multiplication)
Basic2DVectoroperator*= (const T &t)
 Scaling by a scalar value (multiplication)
template<class U >
Basic2DVectoroperator+= (const Basic2DVector< U > &p)
template<class U >
Basic2DVectoroperator+= (const Basic2DVector< U > &p)
Basic2DVector operator- () const
 Unary minus, returns a vector with components (-x(),-y(),-z())
Basic2DVector operator- () const
 Unary minus, returns a vector with components (-x(),-y(),-z())
template<class U >
Basic2DVectoroperator-= (const Basic2DVector< U > &p)
template<class U >
Basic2DVectoroperator-= (const Basic2DVector< U > &p)
Basic2DVectoroperator/= (T t)
 Scaling by a scalar value (division)
Basic2DVectoroperator/= (const T &t)
 Scaling by a scalar value (division)
Geom::Phi< Tphi () const
Geom::Phi< Tphi () const
T r () const
 Radius, same as mag()
T r () const
 Radius, same as mag()
Basic2DVector unit () const
Basic2DVector unit () const
T x () const
 Cartesian x coordinate.
T x () const
 Cartesian x coordinate.
T y () const
 Cartesian y coordinate.
T y () const
 Cartesian y coordinate.

Public Attributes

mathSSE::Vec2< Tv

Private Attributes

T theX
T theY

Detailed Description

template<class T>
class Basic2DVector< T >

Definition at line 15 of file newBasic2DVector.h.


Member Typedef Documentation

template<class T>
typedef Geom::Polar2Cartesian<T> Basic2DVector< T >::Polar

Definition at line 19 of file newBasic2DVector.h.

template<class T>
typedef Geom::Polar2Cartesian<T> Basic2DVector< T >::Polar

Definition at line 24 of file oldBasic2DVector.h.

template<class T>
typedef T Basic2DVector< T >::ScalarType

Definition at line 23 of file oldBasic2DVector.h.

template<class T>
typedef T Basic2DVector< T >::ScalarType

Definition at line 18 of file newBasic2DVector.h.


Constructor & Destructor Documentation

template<class T>
Basic2DVector< T >::Basic2DVector ( ) [inline]

default constructor uses default constructor of T to initialize the components. For built-in floating-point types this means initialization to zero

Definition at line 25 of file newBasic2DVector.h.

Referenced by Basic2DVector< TmpType >::operator-().

{}
template<class T>
Basic2DVector< T >::Basic2DVector ( const Basic2DVector< T > &  p) [inline]

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

Definition at line 28 of file newBasic2DVector.h.

: v(p.v) {}
template<class T>
template<typename U >
Basic2DVector< T >::Basic2DVector ( const Basic2DVector< U > &  p) [inline]

Definition at line 31 of file newBasic2DVector.h.

: v(p.v) {}
template<class T>
template<class Other >
Basic2DVector< T >::Basic2DVector ( const Other &  p) [inline, explicit]

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

Definition at line 42 of file newBasic2DVector.h.

: v(p.x(),p.y()) {}
template<class T>
Basic2DVector< T >::Basic2DVector ( const T x,
const T y 
) [inline]

construct from cartesian coordinates

Definition at line 45 of file newBasic2DVector.h.

: v(x,y) {}
template<class T>
template<typename U >
Basic2DVector< T >::Basic2DVector ( mathSSE::Vec2< U > const &  iv) [inline]

Definition at line 49 of file newBasic2DVector.h.

: v(iv){}
template<class T>
template<typename U >
Basic2DVector< T >::Basic2DVector ( mathSSE::Vec4< U > const &  iv) [inline]

Definition at line 51 of file newBasic2DVector.h.

: v(iv.xy()){}
template<class T>
Basic2DVector< T >::Basic2DVector ( ) [inline]

default constructor uses default constructor of T to initialize the components. For built-in floating-point types this means initialization to zero

Definition at line 30 of file oldBasic2DVector.h.

: theX(0), theY(0) {}
template<class T>
Basic2DVector< T >::Basic2DVector ( const Basic2DVector< T > &  p) [inline]

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

Definition at line 33 of file oldBasic2DVector.h.

                                          : 
    theX(p.x()), theY(p.y()) {}
template<class T>
template<class Other >
Basic2DVector< T >::Basic2DVector ( const Other &  p) [inline, explicit]

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

Definition at line 44 of file oldBasic2DVector.h.

: theX(p.x()), theY(p.y()) {}
template<class T>
Basic2DVector< T >::Basic2DVector ( const T x,
const T y 
) [inline]

construct from cartesian coordinates

Definition at line 47 of file oldBasic2DVector.h.

: theX(x), theY(y) {}
template<class T>
template<typename U >
Basic2DVector< T >::Basic2DVector ( mathSSE::Vec2< U > const &  iv) [inline]

Definition at line 53 of file oldBasic2DVector.h.

                                          :
    theX(iv.arr[0]), theY(iv.arr[1]) {}
template<class T>
template<typename U >
Basic2DVector< T >::Basic2DVector ( mathSSE::Vec4< U > const &  iv) [inline]

Definition at line 56 of file oldBasic2DVector.h.

                                          :
    theX(iv.arr[0]), theY(iv.arr[1]) {}

Member Function Documentation

template<class T>
T Basic2DVector< T >::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 73 of file newBasic2DVector.h.

Referenced by PV2DBase< double, PointTag, LocalTag >::barePhi().

{return std::atan2(y(),x());}
template<class T>
T Basic2DVector< T >::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 80 of file oldBasic2DVector.h.

{return std::atan2(theY,theX);}
template<class T>
template<class U >
PreciseFloatType<T,U>::Type Basic2DVector< T >::cross ( const Basic2DVector< U > &  lh) 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 scalar is the more precise of the scalar types of the two vectors.

Definition at line 139 of file newBasic2DVector.h.

template<class T>
T Basic2DVector< T >::cross ( const Basic2DVector< T > &  v) const [inline]

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

Definition at line 142 of file oldBasic2DVector.h.

{ return x()*v.y() - y()*v.x();}
template<class T>
template<class U >
PreciseFloatType<T,U>::Type Basic2DVector< T >::cross ( const Basic2DVector< 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 scalar is the more precise of the scalar types of the two vectors.

Definition at line 150 of file oldBasic2DVector.h.

                                                                             { 
    return x()*v.y() - y()*v.x();
  }
template<class T>
T Basic2DVector< T >::cross ( const Basic2DVector< T > &  lh) const [inline]

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

Definition at line 131 of file newBasic2DVector.h.

Referenced by Basic2DVector< TmpType >::cross().

{ return ::cross(v,lh.v);}
template<class T>
template<class U >
PreciseFloatType<T,U>::Type Basic2DVector< T >::dot ( const Basic2DVector< 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 135 of file oldBasic2DVector.h.

                                                                           { 
    return x()*v.x() + y()*v.y();
  }
template<class T>
T Basic2DVector< T >::dot ( const Basic2DVector< T > &  lh) const [inline]

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

Definition at line 117 of file newBasic2DVector.h.

Referenced by Vector2DBase< float, GlobalTag >::dot(), Basic2DVector< TmpType >::dot(), Basic2DVector< TmpType >::mag2(), operator*(), and InnerDeltaPhi::phiRange().

{ return ::dot(v,lh.v);}
template<class T>
template<class U >
PreciseFloatType<T,U>::Type Basic2DVector< T >::dot ( const Basic2DVector< U > &  lh) 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 125 of file newBasic2DVector.h.

template<class T>
T Basic2DVector< T >::dot ( const Basic2DVector< T > &  v) const [inline]

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

Definition at line 127 of file oldBasic2DVector.h.

{ return x()*v.x() + y()*v.y();}
template<class T>
T Basic2DVector< T >::mag ( ) const [inline]
template<class T>
T Basic2DVector< T >::mag ( ) const [inline]

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

Definition at line 71 of file oldBasic2DVector.h.

{ return std::sqrt( mag2());}
template<class T>
T Basic2DVector< T >::mag2 ( ) const [inline]
template<class T>
T Basic2DVector< T >::mag2 ( ) const [inline]

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

Definition at line 68 of file oldBasic2DVector.h.

{ return theX*theX + theY*theY;}
template<class T>
Basic2DVector& Basic2DVector< T >::operator*= ( T  t) [inline]

Scaling by a scalar value (multiplication)

Definition at line 104 of file newBasic2DVector.h.

                                   {
    v = v*t;
    return *this;
  } 
template<class T>
Basic2DVector& Basic2DVector< T >::operator*= ( const T t) [inline]

Scaling by a scalar value (multiplication)

Definition at line 113 of file oldBasic2DVector.h.

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

Operator += with a Basic2DVector of possibly different precision.

Definition at line 87 of file newBasic2DVector.h.

                                                         {
    v = v + p.v;
    return *this;
  } 
template<class T>
template<class U >
Basic2DVector& Basic2DVector< T >::operator+= ( const Basic2DVector< U > &  p) [inline]

Operator += with a Basic2DVector of possibly different precision.

Definition at line 94 of file oldBasic2DVector.h.

                                                         {
    theX += p.x();
    theY += p.y();
    return *this;
  } 
template<class T>
Basic2DVector Basic2DVector< T >::operator- ( ) const [inline]

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

Definition at line 101 of file newBasic2DVector.h.

{ return Basic2DVector(-v);}
template<class T>
Basic2DVector Basic2DVector< T >::operator- ( ) const [inline]

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

Definition at line 110 of file oldBasic2DVector.h.

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

Operator -= with a Basic2DVector of possibly different precision.

Definition at line 95 of file newBasic2DVector.h.

                                                         {
    v = v - p.v;
    return *this;
  } 
template<class T>
template<class U >
Basic2DVector& Basic2DVector< T >::operator-= ( const Basic2DVector< U > &  p) [inline]

Operator -= with a Basic2DVector of possibly different precision.

Definition at line 103 of file oldBasic2DVector.h.

                                                         {
    theX -= p.x();
    theY -= p.y();
    return *this;
  } 
template<class T>
Basic2DVector& Basic2DVector< T >::operator/= ( const T t) [inline]

Scaling by a scalar value (division)

Definition at line 120 of file oldBasic2DVector.h.

                                          {
    theX /= t;
    theY /= t;
    return *this;
  } 
template<class T>
Basic2DVector& Basic2DVector< T >::operator/= ( T  t) [inline]

Scaling by a scalar value (division)

Definition at line 110 of file newBasic2DVector.h.

                                   {
    t = T(1)/t;
    v = v*t;
    return *this;
  } 
template<class T>
Geom::Phi<T> Basic2DVector< T >::phi ( ) const [inline]

Definition at line 81 of file oldBasic2DVector.h.

{return Geom::Phi<T>(atan2(theY,theX));}
template<class T>
Geom::Phi<T> Basic2DVector< T >::phi ( ) const [inline]
template<class T>
T Basic2DVector< T >::r ( ) const [inline]

Radius, same as mag()

Definition at line 67 of file newBasic2DVector.h.

Referenced by PixelTripletLargeTipGenerator::hitTriplets(), and PV2DBase< double, PointTag, LocalTag >::r().

{ return mag();}
template<class T>
T Basic2DVector< T >::r ( ) const [inline]

Radius, same as mag()

Definition at line 74 of file oldBasic2DVector.h.

{ return mag();}
template<class T>
Basic2DVector Basic2DVector< T >::unit ( ) const [inline]

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

Definition at line 79 of file newBasic2DVector.h.

Referenced by InnerDeltaPhi::phiRange().

                             {
    T my_mag = mag();
    return my_mag == 0 ? *this : *this / my_mag;
  }
template<class T>
Basic2DVector Basic2DVector< T >::unit ( ) const [inline]

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

Definition at line 86 of file oldBasic2DVector.h.

                             {
    T my_mag = mag();
    return my_mag == 0 ? *this : *this / my_mag;
  }
template<class T>
T Basic2DVector< T >::x ( ) const [inline]
template<class T>
T Basic2DVector< T >::x ( ) const [inline]

Cartesian x coordinate.

Definition at line 62 of file oldBasic2DVector.h.

{ return theX;}
template<class T>
T Basic2DVector< T >::y ( ) const [inline]
template<class T>
T Basic2DVector< T >::y ( ) const [inline]

Cartesian y coordinate.

Definition at line 65 of file oldBasic2DVector.h.

{ return theY;}

Member Data Documentation

template<class T>
T Basic2DVector< T >::theX [private]
template<class T>
T Basic2DVector< T >::theY [private]
template<class T>
mathSSE::Vec2<T> Basic2DVector< T >::v