/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Private Attributes
HepMC::ThreeVector Class Reference

ThreeVector is a simple representation of a position or displacement 3 vector. More...

#include <SimpleVector.h>

List of all members.

Public Member Functions

 ThreeVector (double xin, double yin=0, double zin=0)
 construct using x, y, and z (only x is required)
 ThreeVector ()
template<class T >
 ThreeVector (const T &v, typename detail::disable_if< detail::is_arithmetic< T >::value, void >::type *=0)
 templated constructor this is used ONLY if T is not arithmetic
 ThreeVector (const ThreeVector &v)
 copy constructor
void swap (ThreeVector &other)
 swap
double x () const
 return x
double y () const
 return y
double z () const
 return z
void setX (double x)
 set x
void setY (double y)
 set y
void setZ (double z)
 set z
void set (double x, double y, double z)
 set x, y, and z
double phi () const
 The azimuth angle.
double theta () const
 The polar angle.
double r () const
 The magnitude.
double mag () const
 The magnitude (r in spherical coordinate system).
void setPhi (double)
 Set phi keeping mag and theta constant (BaBar).
void setTheta (double)
 Set theta keeping mag and phi constant (BaBar).
double perp2 () const
 The transverse component squared (rho^2 in cylindrical coordinate system).
double perp () const
 The transverse component (rho in cylindrical coordinate system).
ThreeVectoroperator= (const ThreeVector &)
 make a copy
bool operator== (const ThreeVector &) const
 equality
bool operator!= (const ThreeVector &) const
 inequality

Private Attributes

double m_x
double m_y
double m_z

Detailed Description

ThreeVector is a simple representation of a position or displacement 3 vector.

For compatibility with existing code, the basic expected geometrical access methods are povided. Also, there is a templated constructor that will take another vector (HepLorentzVector, GenVector, ...) which must have the following methods: x(), y(), z().

Definition at line 132 of file SimpleVector.h.


Constructor & Destructor Documentation

HepMC::ThreeVector::ThreeVector ( double  xin,
double  yin = 0,
double  zin = 0 
) [inline]

construct using x, y, and z (only x is required)

Definition at line 137 of file SimpleVector.h.

  : m_x(xin), m_y(yin), m_z(zin) {}
HepMC::ThreeVector::ThreeVector ( ) [inline]

Definition at line 140 of file SimpleVector.h.

  : m_x(0), m_y(0), m_z(0) {}
template<class T >
HepMC::ThreeVector::ThreeVector ( const T &  v,
typename detail::disable_if< detail::is_arithmetic< T >::value, void >::type *  = 0 
) [inline]

templated constructor this is used ONLY if T is not arithmetic

Definition at line 146 of file SimpleVector.h.

  : m_x(v.x()), m_y(v.y()), m_z(v.z()) {}
HepMC::ThreeVector::ThreeVector ( const ThreeVector v) [inline]

copy constructor

Definition at line 151 of file SimpleVector.h.

  : m_x(v.x()), m_y(v.y()), m_z(v.z()) {}

Member Function Documentation

void HepMC::ThreeVector::swap ( ThreeVector other) [inline]

swap

Definition at line 94 of file SimpleVector.icc.

                                                   {
    std::swap( m_x, other.m_x );
    std::swap( m_y, other.m_y );
    std::swap( m_z, other.m_z );
}
double HepMC::ThreeVector::x ( ) const [inline]

return x

Definition at line 156 of file SimpleVector.h.

double HepMC::ThreeVector::y ( ) const [inline]

return y

Definition at line 157 of file SimpleVector.h.

double HepMC::ThreeVector::z ( ) const [inline]

return z

Definition at line 158 of file SimpleVector.h.

void HepMC::ThreeVector::setX ( double  x) [inline]

set x

Definition at line 160 of file SimpleVector.h.

void HepMC::ThreeVector::setY ( double  y) [inline]

set y

Definition at line 161 of file SimpleVector.h.

void HepMC::ThreeVector::setZ ( double  z) [inline]

set z

Definition at line 162 of file SimpleVector.h.

void HepMC::ThreeVector::set ( double  x,
double  y,
double  z 
) [inline]

set x, y, and z

Definition at line 114 of file SimpleVector.icc.

                                                         {
  m_x = x;
  m_y = y;
  m_z = z;
}
double HepMC::ThreeVector::phi ( ) const [inline]

The azimuth angle.

Definition at line 104 of file SimpleVector.icc.

                                     {
  return m_x == 0.0 && m_y == 0.0 ? 0.0 : std::atan2(m_y,m_x);
}
double HepMC::ThreeVector::theta ( ) const [inline]

The polar angle.

Definition at line 100 of file SimpleVector.icc.

                                         {
  return m_x == 0.0 && m_y == 0.0 && m_z == 0.0 ? 0.0 : std::atan2(perp(),m_z);
}
double HepMC::ThreeVector::r ( ) const [inline]

The magnitude.

Definition at line 112 of file SimpleVector.icc.

{ return mag(); }
double HepMC::ThreeVector::mag ( ) const [inline]

The magnitude (r in spherical coordinate system).

Definition at line 108 of file SimpleVector.icc.

                                      { 
return std::sqrt( m_x*m_x + m_y*m_y + m_z*m_z );
}
void HepMC::ThreeVector::setPhi ( double  ph) [inline]

Set phi keeping mag and theta constant (BaBar).

Definition at line 120 of file SimpleVector.icc.

                                         { 
  double xy   = perp();
  setX(xy*std::cos(ph));
  setY(xy*std::sin(ph));
}
void HepMC::ThreeVector::setTheta ( double  th) [inline]

Set theta keeping mag and phi constant (BaBar).

Definition at line 126 of file SimpleVector.icc.

                                           { 
  double ma   = mag();
  double ph   = phi();
  setX(ma*std::sin(th)*std::cos(ph));
  setY(ma*std::sin(th)*std::sin(ph));
  setZ(ma*std::cos(th));
}
double HepMC::ThreeVector::perp2 ( ) const [inline]

The transverse component squared (rho^2 in cylindrical coordinate system).

Definition at line 134 of file SimpleVector.icc.

{ return m_x*m_x + m_y*m_y; }
double HepMC::ThreeVector::perp ( ) const [inline]

The transverse component (rho in cylindrical coordinate system).

Definition at line 136 of file SimpleVector.icc.

{ return std::sqrt(perp2()); }
ThreeVector & HepMC::ThreeVector::operator= ( const ThreeVector p) [inline]

make a copy

Definition at line 138 of file SimpleVector.icc.

                                                                   {
  m_x = p.x();
  m_y = p.y();
  m_z = p.z();
  return *this;
}
bool HepMC::ThreeVector::operator== ( const ThreeVector v) const [inline]

equality

Definition at line 146 of file SimpleVector.icc.

                                                                {
  return (v.x()==x() && v.y()==y() && v.z()==z()) ? true : false;
}
bool HepMC::ThreeVector::operator!= ( const ThreeVector v) const [inline]

inequality

Definition at line 150 of file SimpleVector.icc.

                                                                {
  return (v.x()!=x() || v.y()!=y() || v.z()!=z()) ? true : false;
}

Member Data Documentation

double HepMC::ThreeVector::m_x [private]

Definition at line 184 of file SimpleVector.h.

double HepMC::ThreeVector::m_y [private]

Definition at line 185 of file SimpleVector.h.

double HepMC::ThreeVector::m_z [private]

Definition at line 186 of file SimpleVector.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:49:37 for HepMC by doxygen 1.7.4