| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

HepMC::ThreeVector Class Reference

For compatibility with existing code, the basic expected geometrical access methods are povided. 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

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.

00138   : m_x(xin), m_y(yin), m_z(zin) {}

HepMC::ThreeVector::ThreeVector (  )  [inline]

Definition at line 140 of file SimpleVector.h.

00141   : 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.

00148   : 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.

00152   : 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.

00094                                                    {
00095     std::swap( m_x, other.m_x );
00096     std::swap( m_y, other.m_y );
00097     std::swap( m_z, other.m_z );
00098 }

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.

00114                                                          {
00115   m_x = x;
00116   m_y = y;
00117   m_z = z;
00118 }

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

The azimuth angle.

Definition at line 104 of file SimpleVector.icc.

00104                                      {
00105   return m_x == 0.0 && m_y == 0.0 ? 0.0 : std::atan2(m_y,m_x);
00106 }

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

The polar angle.

Definition at line 100 of file SimpleVector.icc.

00100                                          {
00101   return m_x == 0.0 && m_y == 0.0 && m_z == 0.0 ? 0.0 : std::atan2(perp(),m_z);
00102 }

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

The magnitude.

Definition at line 112 of file SimpleVector.icc.

00112 { return mag(); }

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

The magnitude (r in spherical coordinate system).

Definition at line 108 of file SimpleVector.icc.

00108                                       { 
00109 return std::sqrt( m_x*m_x + m_y*m_y + m_z*m_z );
00110 }

void HepMC::ThreeVector::setPhi ( double   )  [inline]

Set phi keeping mag and theta constant (BaBar).

Definition at line 120 of file SimpleVector.icc.

00120                                          { 
00121   double xy   = perp();
00122   setX(xy*std::cos(ph));
00123   setY(xy*std::sin(ph));
00124 }

void HepMC::ThreeVector::setTheta ( double   )  [inline]

Set theta keeping mag and phi constant (BaBar).

Definition at line 126 of file SimpleVector.icc.

00126                                            { 
00127   double ma   = mag();
00128   double ph   = phi();
00129   setX(ma*std::sin(th)*std::cos(ph));
00130   setY(ma*std::sin(th)*std::sin(ph));
00131   setZ(ma*std::cos(th));
00132 }

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

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

Definition at line 134 of file SimpleVector.icc.

00134 { 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.

00136 { return std::sqrt(perp2()); }

ThreeVector & HepMC::ThreeVector::operator= ( const ThreeVector  )  [inline]

make a copy

Definition at line 138 of file SimpleVector.icc.

00138                                                                    {
00139   m_x = p.x();
00140   m_y = p.y();
00141   m_z = p.z();
00142   return *this;
00143 }

bool HepMC::ThreeVector::operator== ( const ThreeVector  )  const [inline]

equality

Definition at line 146 of file SimpleVector.icc.

00146                                                                 {
00147   return (v.x()==x() && v.y()==y() && v.z()==z()) ? true : false;
00148 }

bool HepMC::ThreeVector::operator!= ( const ThreeVector  )  const [inline]

inequality

Definition at line 150 of file SimpleVector.icc.

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


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 Mon Apr 11 19:56:45 2011 for HepMC by doxygen 1.4.7