CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
Basic3DVector< long double > Class Template Reference

#include <Basic3DVectorLD.h>

Public Types

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

Private Attributes

T theW
 
T theX
 
T theY
 
T theZ
 

Detailed Description

template<>
class Basic3DVector< long double >

Definition at line 11 of file Basic3DVectorLD.h.

Member Typedef Documentation

Definition at line 17 of file Basic3DVectorLD.h.

typedef Basic3DVector<T> Basic3DVector< long double >::MathVector

Definition at line 21 of file Basic3DVectorLD.h.

typedef Spherical Basic3DVector< long double >::Polar

Definition at line 19 of file Basic3DVectorLD.h.

typedef T Basic3DVector< long double >::ScalarType

Definition at line 16 of file Basic3DVectorLD.h.

Definition at line 18 of file Basic3DVectorLD.h.

typedef long double Basic3DVector< long double >::T

Definition at line 15 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 27 of file Basic3DVectorLD.h.

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 30 of file Basic3DVectorLD.h.

30  :
31  theX(p.x()), theY(p.y()), theZ(p.z()), theW(0) {}
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T z() const
Cartesian z coordinate.
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 35 of file Basic3DVectorLD.h.

35  :
36  theX(p.x()), theY(p.y()), theZ(p.z()), theW(0) {}
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T z() const
Cartesian z coordinate.
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 39 of file Basic3DVectorLD.h.

39  :
40  theX(p.x()), theY(p.y()), theZ(0), theW(0) {}
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
template<class OtherPoint >
Basic3DVector< long double >::Basic3DVector ( const OtherPoint &  p)
inlineexplicit

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 51 of file Basic3DVectorLD.h.

Basic3DVector< long double >::Basic3DVector ( const T x,
const T y,
const T z 
)
inline

construct from cartesian coordinates

Definition at line 70 of file Basic3DVectorLD.h.

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 78 of file Basic3DVectorLD.h.

References AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, Geom::Theta< T >::value(), and Geom::Phi< T >::value().

79  {
80  Polar p( theta.value(), phi.value(), r);
81  theX = p.x(); theY = p.y(); theZ = p.z();
82  }
T value() const
Explicit access to value in case implicit conversion not OK.
Definition: Theta.h:25
T value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:38

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 120 of file Basic3DVectorLD.h.

120 {return std::atan2(y(),x());}
T x() const
Cartesian x coordinate.
T y() const
Cartesian y coordinate.
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 127 of file Basic3DVectorLD.h.

127 {return std::atan2(perp(),z());}
T perp() const
Magnitude of transverse component.
T z() const
Cartesian z coordinate.
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 205 of file Basic3DVectorLD.h.

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

205  {
206  return Basic3DVector( y()*v.z() - v.y()*z(),
207  z()*v.x() - v.z()*x(),
208  x()*v.y() - v.x()*y());
209  }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T x() const
Cartesian x coordinate.
T z() const
Cartesian z coordinate.
T y() const
Cartesian y coordinate.
T z() const
Cartesian z coordinate.
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 219 of file Basic3DVectorLD.h.

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

219  {
220  return Basic3DVector<typename PreciseFloatType<T,U>::Type>( y()*v.z() - v.y()*z(),
221  z()*v.x() - v.z()*x(),
222  x()*v.y() - v.x()*y());
223  }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T x() const
Cartesian x coordinate.
T z() const
Cartesian z coordinate.
T y() const
Cartesian y coordinate.
T z() const
Cartesian z coordinate.
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 190 of file Basic3DVectorLD.h.

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

Referenced by operator*().

190  {
191  return x()*v.x() + y()*v.y() + z()*v.z();
192  }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T x() const
Cartesian x coordinate.
T z() const
Cartesian z coordinate.
T y() const
Cartesian y coordinate.
T z() const
Cartesian z coordinate.
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 200 of file Basic3DVectorLD.h.

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

200  {
201  return x()*v.x() + y()*v.y() + z()*v.z();
202  }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T x() const
Cartesian x coordinate.
T z() const
Cartesian z coordinate.
T y() const
Cartesian y coordinate.
T z() const
Cartesian z coordinate.
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 135 of file Basic3DVectorLD.h.

Referenced by Particle.Particle::__str__(), Jet.Jet::jetID(), and Jet.Jet::puJetId().

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

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

Definition at line 105 of file Basic3DVectorLD.h.

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

105 { return std::sqrt( mag2());}
T sqrt(T t)
Definition: SSEVec.h:48
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
T Basic3DVector< long double >::mag2 ( ) const
inline

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

Definition at line 102 of file Basic3DVectorLD.h.

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

102 { return x()*x() + y()*y()+z()*z();}
T x() const
Cartesian x coordinate.
T y() const
Cartesian y coordinate.
T z() const
Cartesian z coordinate.
Basic3DVector& Basic3DVector< long double >::operator*= ( T  t)
inline

Scaling by a scalar value (multiplication)

Definition at line 173 of file Basic3DVectorLD.h.

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

173  {
174  theX *= t;
175  theY *= t;
176  theZ *= t;
177  return *this;
178  }
template<class U >
Basic3DVector& Basic3DVector< long double >::operator+= ( const Basic3DVector< U > &  p)
inline

Operator += with a Basic3DVector of possibly different precision.

Definition at line 152 of file Basic3DVectorLD.h.

152  {
153  theX += p.x();
154  theY += p.y();
155  theZ += p.z();
156  return *this;
157  }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T z() const
Cartesian z coordinate.
Basic3DVector Basic3DVector< long double >::operator- ( ) const
inline

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

Definition at line 170 of file Basic3DVectorLD.h.

170 { return Basic3DVector(-x(),-y(),-z());}
T x() const
Cartesian x coordinate.
T y() const
Cartesian y coordinate.
T z() const
Cartesian z coordinate.
template<class U >
Basic3DVector& Basic3DVector< long double >::operator-= ( const Basic3DVector< U > &  p)
inline

Operator -= with a Basic3DVector of possibly different precision.

Definition at line 162 of file Basic3DVectorLD.h.

162  {
163  theX -= p.x();
164  theY -= p.y();
165  theZ -= p.z();
166  return *this;
167  }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T z() const
Cartesian z coordinate.
Basic3DVector& Basic3DVector< long double >::operator/= ( T  t)
inline

Scaling by a scalar value (division)

Definition at line 181 of file Basic3DVectorLD.h.

References lumiQTWidget::t.

181  {
182  t = T(1)/t;
183  theX *= t;
184  theY *= t;
185  theZ *= t;
186  return *this;
187  }
bool Basic3DVector< long double >::operator== ( const Basic3DVector< long double > &  rh) const
inline

Definition at line 97 of file Basic3DVectorLD.h.

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

97  {
98  return x()==rh.x() && y()==rh.y() && z()==rh.z();
99  }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T x() const
Cartesian x coordinate.
T z() const
Cartesian z coordinate.
T y() const
Cartesian y coordinate.
T z() const
Cartesian z coordinate.
T Basic3DVector< long double >::perp ( ) const
inline

Magnitude of transverse component.

Definition at line 111 of file Basic3DVectorLD.h.

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

111 { return std::sqrt( perp2());}
T sqrt(T t)
Definition: SSEVec.h:48
T perp2() const
Squared magnitude of transverse component.
T Basic3DVector< long double >::perp2 ( ) const
inline

Squared magnitude of transverse component.

Definition at line 108 of file Basic3DVectorLD.h.

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

108 { return x()*x() + y()*y();}
T x() const
Cartesian x coordinate.
T y() const
Cartesian y coordinate.
Geom::Phi<T> Basic3DVector< long double >::phi ( ) const
inline

Definition at line 121 of file Basic3DVectorLD.h.

References Basic3DVector< T >::barePhi().

Referenced by Particle.Particle::__str__().

121 {return Geom::Phi<T>(barePhi());}
Definition: Phi.h:20
Geom::Theta<T> Basic3DVector< long double >::theta ( ) const
inline

Definition at line 128 of file Basic3DVectorLD.h.

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

Referenced by Tau.Tau::zImpact().

128 {return Geom::Theta<T>(std::atan2(perp(),z()));}
T perp() const
Magnitude of transverse component.
T z() const
Cartesian z coordinate.
T Basic3DVector< long double >::transverse ( ) const
inline

Another name for perp()

Definition at line 114 of file Basic3DVectorLD.h.

References Basic3DVector< T >::perp().

114 { return perp();}
T perp() const
Magnitude of transverse component.
Basic3DVector Basic3DVector< long double >::unit ( ) const
inline

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

Definition at line 141 of file Basic3DVectorLD.h.

References Basic3DVector< T >::mag2().

141  {
142  T my_mag = mag2();
143  if (my_mag==0) return *this;
144  my_mag = T(1)/std::sqrt(my_mag);
145  Basic3DVector ret(*this);
146  return ret*=my_mag;
147  }
T sqrt(T t)
Definition: SSEVec.h:48
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
long double T
T Basic3DVector< long double >::x ( ) const
inline
Basic2DVector<T> Basic3DVector< long double >::xy ( ) const
inline
T Basic3DVector< long double >::y ( ) const
inline
T Basic3DVector< long double >::z ( ) const
inline

Cartesian z coordinate.

Definition at line 91 of file Basic3DVectorLD.h.

References Basic3DVector< T >::theZ.

Referenced by operator*(), operator+(), operator-(), and geometryXMLparser.Alignable::pos().

Member Data Documentation

T Basic3DVector< long double >::theW
private

Definition at line 229 of file Basic3DVectorLD.h.

T Basic3DVector< long double >::theX
private

Definition at line 226 of file Basic3DVectorLD.h.

T Basic3DVector< long double >::theY
private

Definition at line 227 of file Basic3DVectorLD.h.

T Basic3DVector< long double >::theZ
private

Definition at line 228 of file Basic3DVectorLD.h.