thepeg is hosted by Hepforge, IPPP Durham
 ThePEG  2.2.1
ThePEG::ThreeVector< Value > Class Template Reference

A 3-component vector. More...

#include <ThreeVector.h>

## Public Member Functions

Value2 mag2 () const
Squared magnitude .

Value mag () const
Magnitude .

Value2 perp2 () const
Squared transverse component .

Value perp () const
Transverse component .

template<typename U >
auto dot (const ThreeVector< U > &a) const -> decltype(this->x() *a.x())
Dot product.

template<typename U >
Value2 perp2 (const ThreeVector< U > &p) const
Squared transverse component with respect to the given axis.

template<typename U >
Value perp (const ThreeVector< U > &p) const
Transverse component with respect to the given axis.

ThreeVector< double > unit () const
Parallel vector with unit length.

ThreeVector< Value > orthogonal () const
Orthogonal vector.

template<typename U >
double deltaPhi (const ThreeVector< U > &v2) const
Azimuthal angle difference, brought into the range .

template<typename U >
ThreeVector< Value > & rotate (double angle, const ThreeVector< U > &axis)
Apply a rotation. More...

ThreeVector< Value > & rotateUz (const Axis &axis)
Rotate the reference frame to a new z-axis.

ThreeVector< Value > & rotateUzBack (const Axis &axis)
Rotate from a reference frame to the z-axis.

template<typename U >
auto cross (const ThreeVector< U > &a) const -> ThreeVector< decltype(this->y() *a.z())>
Vector cross-product.

template<typename U >
double cosTheta (const ThreeVector< U > &q) const
Cosine of the azimuthal angle between two vectors.

template<typename U >
double angle (const ThreeVector< U > &v) const
Angle between two vectors.

Constructors.
ThreeVector ()

ThreeVector (Value x, Value y, Value z)

template<typename ValueB >
ThreeVector (const ThreeVector< ValueB > &v)

Component access methods.
Value x () const

Value y () const

Value z () const

Component set methods.
void setX (Value x)

void setY (Value y)

void setZ (Value z)

Spherical coordinates.
double theta () const
Polar angle.

double phi () const
Azimuthal angle.

void setTheta (double th)
Set the polar angle.

void setPhi (double ph)
Set the azimuthal angle.

Comparison operators.
bool operator== (const ThreeVector< Value > &a) const

bool operator!= (const ThreeVector< Value > &a) const

bool almostEqual (const ThreeVector< Value > &a, double threshold=1e-04) const

bool almostUnequal (const ThreeVector< Value > &a, double threshold=1e-04) const

Mathematical assignment operators.
ThreeVector< Value > & operator+= (const ThreeVector< Value > &a)

ThreeVector< Value > & operator-= (const ThreeVector< Value > &a)

ThreeVector< Value > & operator*= (double a)

ThreeVector< Value > & operator/= (double a)

## Private Types

using Value2 = decltype(sqr(std::declval< Value >()))
Value squared.

## Private Attributes

Vector components
Value theX

Value theY

Value theZ

## Detailed Description

### template<typename Value> class ThePEG::ThreeVector< Value >

A 3-component vector.

It can be created with any unit type as template parameter. All basic mathematical operations are supported, as well as a subset of the CLHEP Vector3 functionality.

Definition at line 34 of file ThreeVector.h.

## ◆ rotate()

template<typename Value>
template<typename U >
 ThreeVector& ThePEG::ThreeVector< Value >::rotate ( double angle, const ThreeVector< U > & axis )
inline

Apply a rotation.

Parameters
 angle Rotation angle in radians. axis Rotation axis.

Definition at line 177 of file ThreeVector.h.

References ThePEG::ThreeVector< Value >::mag(), and ThePEG::ZERO.

The documentation for this class was generated from the following file: