Hep3Vector


Hep3Vector is a general 3-vector class defining vectors in 3D using HepDouble components. Rotations of these vectors are performed by multiplying with an object of the HepRotation class.

Authors

Leif Lonnblad and Anders Nilsson.

See also

HepRotation, HepLorentzVector, HepLorentzRotation.

Declaration

#include "CLHEP/Vector/ThreeVector.h"

class Hep3Vector

Constants

HepXHat
extern const Hep3Vector HepXHat(1,0,0)
HepYHat
extern const Hep3Vector HepYHat(0,1,0)
HepZHat
extern const Hep3Vector HepZHat(0,0,1)

Public Member Functions

Constructor
inline Hep3Vector(HepDouble x = 0.0, HepDouble y = 0.0, HepDouble z = 0.0)
Copy constructor
inline Hep3Vector(const Hep3Vector &)
Destructor
inline ~Hep3Vector()
=
inline Hep3Vector & operator = (const Hep3Vector &)
Assignment.
+=
inline Hep3Vector & operator += (const Hep3Vector &)
Addition.
-
inline Hep3Vector operator - () const
Unary minus.
-=
inline Hep3Vector & operator -= (const Hep3Vector &)
Subtraction.
*=
inline Hep3Vector & operator *= (HepDouble)
Scaling with a real number.

Hep3Vector & operator *= (const HepRotation &)
Transformation with a HepRotation matrix.
==
inline HepBoolean operator == (const Hep3Vector &) const
Test for equality.
This method has been provided by Geant4.
!=
inline HepBoolean operator != (const Hep3Vector &) const
Test for inequality.
This method has been provided by Geant4.
()
HepDouble operator () (int) const
Get components by index; valid indeces are 0, 1 and 2.
This method has been provided by Geant4.

HepDouble & operator () (int)
Set components by index.
[]
inline HepDouble operator [] (int) const
Get components by index; valid indeces are 0, 1 and 2.

inline HepDouble & operator [] (int)
Set components by index.
angle
inline HepDouble angle(const Hep3Vector &) const
Return the angle w.r.t. another 3-vector.
cosTheta
inline HepDouble cosTheta() const
Return cosine of the polar angle.
cross
inline Hep3Vector cross(const Hep3Vector &) const
Cross product.
dot
inline HepDouble dot(const Hep3Vector &) const
Scalar product.
mag
inline HepDouble mag() const
Return the magnitude (rho in spherical coordinate system).
mag2
inline HepDouble mag2() const
Return the magnitude squared (rho^2 in spherical coordinate system).
orthogonal
inline Hep3Vector orthogonal() const
Return vector orthogonal to this.
This method has been provided by Geant4.
perp
inline HepDouble perp() const
Return the transverse component (R in cylindrical coordinate system).

inline HepDouble perp(const Hep3Vector &) const
Return the transverse component w.r.t. given axis.
perp2
inline HepDouble perp2() const
Return the transverse component squared (R^2 in cylindrical coordinate system).

inline HepDouble perp2(const Hep3Vector &) const
Return the transverse component w.r.t. given axis squared.
phi
inline HepDouble phi() const
Return the azimuth angle.
pseudoRapidity
HepDouble pseudoRapidity() const
Returns the pseudo-rapidity, i.e. -ln(tan(theta/2))
rotate
void rotate(HepDouble, const Hep3Vector &)
Rotates the Hep3Vector around the axis specified by another Hep3Vector.
rotateUz
void rotateUz(Hep3Vector &)
Rotates reference frame from Uz to newUz (unit vector).
This method has been provided by Geant4.
rotateX
void rotateX(HepDouble)
Rotates the Hep3Vector around the x-axis.
rotateY
void rotateY(HepDouble)
Rotates the Hep3Vector around the y-axis.
rotateZ
void rotateZ(HepDouble)
Rotates the Hep3Vector around the z-axis.
setMag
inline void setMag(HepDouble)
Set magnitude keeping theta and phi constant.
This method has been provided by BaBar.
setPerp
inline void setPerp(HepDouble)
Set the transverse component keeping phi and z constant.
setPhi
inline void setPhi(HepDouble)
Set phi keeping mag and theta constant.
This method has been provided by BaBar.
setTheta
inline void setTheta(HepDouble)
Set theta keeping mag and phi constant.
This method has been provided by BaBar.
setX
inline void setX(HepDouble)
Set x component.
setY
inline void setY(HepDouble)
Set y component.
setZ
inline void setZ(HepDouble)
Set z component.
theta
inline HepDouble theta() const
Return the polar angle.
transfrom
Hep3Vector & transform(const HepRotation &)
Transformation with a HepRotation matrix.
unit
inline Hep3Vector unit() const
Return unit vector parallel to this.
x
inline HepDouble x() const
Return x component.
y
inline HepDouble y() const
Return y component.
z
inline HepDouble z() const
Return z component.

Non-Member Functions

+
Hep3Vector operator + (const Hep3Vector &, const Hep3Vector &&)
Addition of two Hep3Vectors.
-
Hep3Vector operator - (const Hep3Vector &, const Hep3Vector &&)
Subtraction of two Hep3Vectors.
*
HepDouble operator * (const Hep3Vector &, const Hep3Vector &)
Scalar product.

Hep3Vector operator * (const Hep3Vector &, HepDouble a)
Hep3Vector operator * (HepDouble a, const Hep3Vector &)
Scaling with a real number.
<<
std::ostream & operator << (std::ostream &, const Hep3Vector &)
Output to a stream.
>>
std::istream & operator >> (std::istream &, Hep3Vector &)
Input from a stream.

Example

CLHEP/test/testThreeVector.cc


03 May 1999
EVC