ROOT::Math::VectorUtil Namespace Reference
[GenVector]

Global Helper functions for generic Vector classes. More...


Functions

template<class Vector1 , class Vector2 >
double DeltaPhi (const Vector1 &v1, const Vector2 &v2)
 Find aximutal Angle difference between two generic vectors ( v2.Phi() - v1.Phi() ) The only requirements on the Vector classes is that they implement the Phi() method.
template<class Vector1 , class Vector2 >
double DeltaR2 (const Vector1 &v1, const Vector2 &v2)
 Find square of the difference in pseudorapidity (Eta) and Phi betwen two generic vectors The only requirements on the Vector classes is that they implement the Phi() and Eta() method.
template<class Vector1 , class Vector2 >
double DeltaR (const Vector1 &v1, const Vector2 &v2)
 Find difference in pseudorapidity (Eta) and Phi betwen two generic vectors The only requirements on the Vector classes is that they implement the Phi() and Eta() method.
template<class Vector1 , class Vector2 >
double CosTheta (const Vector1 &v1, const Vector2 &v2)
 Find CosTheta Angle between two generic 3D vectors pre-requisite: vectors implement the X(), Y() and Z().
template<class Vector1 , class Vector2 >
double Angle (const Vector1 &v1, const Vector2 &v2)
 Find Angle between two vectors.
template<class Vector1 , class Vector2 >
Vector1 ProjVector (const Vector1 &v, const Vector2 &u)
 Find the projection of v along the given direction u.
template<class Vector1 , class Vector2 >
Vector1 PerpVector (const Vector1 &v, const Vector2 &u)
 Find the vector component of v perpendicular to the given direction of u.
template<class Vector1 , class Vector2 >
double Perp2 (const Vector1 &v, const Vector2 &u)
 Find the magnitude square of the vector component of v perpendicular to the given direction of u.
template<class Vector1 , class Vector2 >
double Perp (const Vector1 &v, const Vector2 &u)
 Find the magnitude of the vector component of v perpendicular to the given direction of u.
template<class Vector1 , class Vector2 >
double InvariantMass (const Vector1 &v1, const Vector2 &v2)
 return the invariant mass of two LorentzVector The only requirement on the LorentzVector is that they need to implement the X() , Y(), Z() and E() methods.
template<class Vector >
Vector RotateX (const Vector &v, double alpha)
 rotation along X axis for a generic vector by an Angle alpha returning a new vector.
template<class Vector >
Vector RotateY (const Vector &v, double alpha)
 rotation along Y axis for a generic vector by an Angle alpha returning a new vector.
template<class Vector >
Vector RotateZ (const Vector &v, double alpha)
 rotation along Z axis for a generic vector by an Angle alpha returning a new vector.
template<class Vector , class RotationMatrix >
Vector Rotate (const Vector &v, const RotationMatrix &rot)
 rotation on a generic vector using a generic rotation class.
template<class LVector , class BoostVector >
LVector boost (const LVector &v, const BoostVector &b)
 Boost a generic Lorentz Vector class using a generic 3D Vector class describing the boost The only requirement on the vector is that implements the X(), Y(), Z(), T() and SetXYZT methods.
template<class LVector >
LVector boostX (const LVector &v, double beta)
 Boost a generic Lorentz Vector class along the X direction with a factor beta The only requirement on the vector is that implements the X(), Y(), Z(), T() and SetXYZT methods.
template<class LVector >
LVector boostY (const LVector &v, double beta)
 Boost a generic Lorentz Vector class along the Y direction with a factor beta The only requirement on the vector is that implements the X(), Y(), Z(), T() methods and be constructed from x,y,z,t values The beta of the boost must be <= 1 or a nul Lorentz Vector will be returned.
template<class LVector >
LVector boostZ (const LVector &v, double beta)
 Boost a generic Lorentz Vector class along the Z direction with a factor beta The only requirement on the vector is that implements the X(), Y(), Z(), T() methods and be constructed from x,y,z,t values The beta of the boost must be <= 1 or a nul Lorentz Vector will be returned.
template<class Matrix , class CoordSystem , class U >
DisplacementVector3D
< CoordSystem, U > 
Mult (const Matrix &m, const DisplacementVector3D< CoordSystem, U > &v)
 Multiplications of a generic matrices with a DisplacementVector3D of any coordinate system.
template<class Matrix , class CoordSystem , class U >
PositionVector3D< CoordSystem, U > Mult (const Matrix &m, const PositionVector3D< CoordSystem, U > &p)
 Multiplications of a generic matrices with a generic PositionVector Assume that the matrix implements the operator( i,j) and that it has at least 3 columns and 3 rows.
template<class CoordSystem , class Matrix >
LorentzVector< CoordSystem > Mult (const Matrix &m, const LorentzVector< CoordSystem > &v)
 Multiplications of a generic matrices with a LorentzVector described in any coordinate system.
double Phi_0_2pi (double phi)
 Return a phi angle in the interval (0,2*PI].
double Phi_mpi_pi (double phi)
 Returns phi angle in the interval (-PI,PI].
double DeltaPhi (const XYZVector &v1, const XYZVector &v2)
double DeltaPhi (const XYZPoint &v1, const XYZPoint &v2)
double DeltaPhi (const XYZTVector &v1, const XYZTVector &v2)
double DeltaR (const XYZVector &v1, const XYZVector &v2)
double DeltaR (const XYZPoint &v1, const XYZPoint &v2)
double DeltaR (const XYZTVector &v1, const XYZTVector &v2)
double CosTheta (const XYZVector &v1, const XYZVector &v2)
double CosTheta (const XYZPoint &v1, const XYZPoint &v2)
double CosTheta (const XYZTVector &v1, const XYZTVector &v2)
double Angle (const XYZVector &v1, const XYZVector &v2)
double Angle (const XYZPoint &v1, const XYZPoint &v2)
double Angle (const XYZTVector &v1, const XYZTVector &v2)
double InvariantMass (const XYZTVector &v1, const XYZTVector &v2)


Detailed Description

Global Helper functions for generic Vector classes.

Any Vector classes implementing some defined member functions, like Phi() or Eta() or mag() can use these functions. The functions returning a scalar value, returns always double precision number even if the vector are based on another precision type


Function Documentation

double ROOT::Math::VectorUtil::Angle ( const XYZTVector &  v1,
const XYZTVector &  v2 
)

Definition at line 197 of file VectorUtil_Cint.h.

double ROOT::Math::VectorUtil::Angle ( const XYZPoint &  v1,
const XYZPoint &  v2 
)

Definition at line 185 of file VectorUtil_Cint.h.

double ROOT::Math::VectorUtil::Angle ( const XYZVector &  v1,
const XYZVector &  v2 
)

Definition at line 173 of file VectorUtil_Cint.h.

template<class Vector1 , class Vector2 >
double ROOT::Math::VectorUtil::Angle ( const Vector1 &  v1,
const Vector2 &  v2 
) [inline]

Find Angle between two vectors.

Use the CosTheta() function

Parameters:
v1 Vector v1
v2 Vector v2
Returns:
Angle between the two vectors

\[ \theta = \cos ^{-1} \frac { \vec{v1} \cdot \vec{v2} }{ | \vec{v1} | | \vec{v2} | } \]

Definition at line 140 of file GenVector/VectorUtil.h.

References acos(), and CosTheta().

template<class LVector , class BoostVector >
LVector ROOT::Math::VectorUtil::boost ( const LVector &  v,
const BoostVector &  b 
) [inline]

Boost a generic Lorentz Vector class using a generic 3D Vector class describing the boost The only requirement on the vector is that implements the X(), Y(), Z(), T() and SetXYZT methods.

The requirement on the boost vector is that needs to implement the X(), Y() , Z() retorning the vector elements describing the boost The beta of the boost must be <= 1 or a nul Lorentz Vector will be returned

Definition at line 314 of file GenVector/VectorUtil.h.

References ROOT::Math::Cephes::gamma(), ROOT::Math::sqrt(), and ROOT::Math::Throw().

template<class LVector >
LVector ROOT::Math::VectorUtil::boostX ( const LVector &  v,
double  beta 
) [inline]

Boost a generic Lorentz Vector class along the X direction with a factor beta The only requirement on the vector is that implements the X(), Y(), Z(), T() and SetXYZT methods.

The beta of the boost must be <= 1 or a nul Lorentz Vector will be returned

Definition at line 343 of file GenVector/VectorUtil.h.

References ROOT::Math::Cephes::gamma(), ROOT::Math::sqrt(), and ROOT::Math::Throw().

template<class LVector >
LVector ROOT::Math::VectorUtil::boostY ( const LVector &  v,
double  beta 
) [inline]

Boost a generic Lorentz Vector class along the Y direction with a factor beta The only requirement on the vector is that implements the X(), Y(), Z(), T() methods and be constructed from x,y,z,t values The beta of the boost must be <= 1 or a nul Lorentz Vector will be returned.

Definition at line 363 of file GenVector/VectorUtil.h.

References ROOT::Math::Cephes::gamma(), ROOT::Math::sqrt(), and ROOT::Math::Throw().

template<class LVector >
LVector ROOT::Math::VectorUtil::boostZ ( const LVector &  v,
double  beta 
) [inline]

Boost a generic Lorentz Vector class along the Z direction with a factor beta The only requirement on the vector is that implements the X(), Y(), Z(), T() methods and be constructed from x,y,z,t values The beta of the boost must be <= 1 or a nul Lorentz Vector will be returned.

Definition at line 383 of file GenVector/VectorUtil.h.

References ROOT::Math::Cephes::gamma(), ROOT::Math::sqrt(), and ROOT::Math::Throw().

double ROOT::Math::VectorUtil::CosTheta ( const XYZTVector &  v1,
const XYZTVector &  v2 
)

Definition at line 163 of file VectorUtil_Cint.h.

double ROOT::Math::VectorUtil::CosTheta ( const XYZPoint &  v1,
const XYZPoint &  v2 
)

Definition at line 151 of file VectorUtil_Cint.h.

double ROOT::Math::VectorUtil::CosTheta ( const XYZVector &  v1,
const XYZVector &  v2 
)

Definition at line 139 of file VectorUtil_Cint.h.

template<class Vector1 , class Vector2 >
double ROOT::Math::VectorUtil::CosTheta ( const Vector1 &  v1,
const Vector2 &  v2 
) [inline]

Find CosTheta Angle between two generic 3D vectors pre-requisite: vectors implement the X(), Y() and Z().

Parameters:
v1 Vector v1
v2 Vector v2
Returns:
cosine of Angle between the two vectors

\[ \cos \theta = \frac { \vec{v1} \cdot \vec{v2} }{ | \vec{v1} | | \vec{v2} | } \]

Definition at line 114 of file GenVector/VectorUtil.h.

References ROOT::Math::sqrt().

Referenced by Angle().

double ROOT::Math::VectorUtil::DeltaPhi ( const XYZTVector &  v1,
const XYZTVector &  v2 
)

Definition at line 94 of file VectorUtil_Cint.h.

double ROOT::Math::VectorUtil::DeltaPhi ( const XYZPoint &  v1,
const XYZPoint &  v2 
)

Definition at line 82 of file VectorUtil_Cint.h.

double ROOT::Math::VectorUtil::DeltaPhi ( const XYZVector &  v1,
const XYZVector &  v2 
)

Definition at line 70 of file VectorUtil_Cint.h.

template<class Vector1 , class Vector2 >
double ROOT::Math::VectorUtil::DeltaPhi ( const Vector1 &  v1,
const Vector2 &  v2 
) [inline]

Find aximutal Angle difference between two generic vectors ( v2.Phi() - v1.Phi() ) The only requirements on the Vector classes is that they implement the Phi() method.

Parameters:
v1 Vector of any type implementing the Phi() operator
v2 Vector of any type implementing the Phi() operator
Returns:
Phi difference

\[ \Delta \phi = \phi_2 - \phi_1 \]

Definition at line 61 of file GenVector/VectorUtil.h.

References M_PI.

Referenced by DeltaR2().

double ROOT::Math::VectorUtil::DeltaR ( const XYZTVector &  v1,
const XYZTVector &  v2 
)

Definition at line 129 of file VectorUtil_Cint.h.

double ROOT::Math::VectorUtil::DeltaR ( const XYZPoint &  v1,
const XYZPoint &  v2 
)

Definition at line 117 of file VectorUtil_Cint.h.

double ROOT::Math::VectorUtil::DeltaR ( const XYZVector &  v1,
const XYZVector &  v2 
)

Definition at line 105 of file VectorUtil_Cint.h.

template<class Vector1 , class Vector2 >
double ROOT::Math::VectorUtil::DeltaR ( const Vector1 &  v1,
const Vector2 &  v2 
) [inline]

Find difference in pseudorapidity (Eta) and Phi betwen two generic vectors The only requirements on the Vector classes is that they implement the Phi() and Eta() method.

Parameters:
v1 Vector 1
v2 Vector 2
Returns:
Angle between the two vectors

\[ \Delta R = \sqrt{ ( \Delta \phi )^2 + ( \Delta \eta )^2 } \]

Definition at line 97 of file GenVector/VectorUtil.h.

References DeltaR2(), and ROOT::Math::sqrt().

template<class Vector1 , class Vector2 >
double ROOT::Math::VectorUtil::DeltaR2 ( const Vector1 &  v1,
const Vector2 &  v2 
) [inline]

Find square of the difference in pseudorapidity (Eta) and Phi betwen two generic vectors The only requirements on the Vector classes is that they implement the Phi() and Eta() method.

Parameters:
v1 Vector 1
v2 Vector 2
Returns:
Angle between the two vectors

\[ \Delta R2 = ( \Delta \phi )^2 + ( \Delta \eta )^2 \]

Definition at line 82 of file GenVector/VectorUtil.h.

References DeltaPhi().

Referenced by DeltaR().

double ROOT::Math::VectorUtil::InvariantMass ( const XYZTVector &  v1,
const XYZTVector &  v2 
)

Definition at line 207 of file VectorUtil_Cint.h.

template<class Vector1 , class Vector2 >
double ROOT::Math::VectorUtil::InvariantMass ( const Vector1 &  v1,
const Vector2 &  v2 
) [inline]

return the invariant mass of two LorentzVector The only requirement on the LorentzVector is that they need to implement the X() , Y(), Z() and E() methods.

Parameters:
v1 LorenzVector 1
v2 LorenzVector 2
Returns:
invariant mass M

\[ M_{12} = \sqrt{ (\vec{v1} + \vec{v2} ) \cdot (\vec{v1} + \vec{v2} ) } \]

Definition at line 217 of file GenVector/VectorUtil.h.

References ROOT::Math::sqrt().

template<class CoordSystem , class Matrix >
LorentzVector<CoordSystem> ROOT::Math::VectorUtil::Mult ( const Matrix &  m,
const LorentzVector< CoordSystem > &  v 
) [inline]

Multiplications of a generic matrices with a LorentzVector described in any coordinate system.

Assume that the matrix implements the operator( i,j) and that it has at least 4 columns and 4 rows. There is no check on the matrix size !!

Definition at line 443 of file GenVector/VectorUtil.h.

References m, ROOT::Math::LorentzVector< CoordSystem >::SetXYZT(), ROOT::Math::LorentzVector< CoordSystem >::t(), ROOT::Math::LorentzVector< CoordSystem >::x(), ROOT::Math::LorentzVector< CoordSystem >::y(), and ROOT::Math::LorentzVector< CoordSystem >::z().

template<class Matrix , class CoordSystem , class U >
PositionVector3D<CoordSystem,U> ROOT::Math::VectorUtil::Mult ( const Matrix &  m,
const PositionVector3D< CoordSystem, U > &  p 
) [inline]

Multiplications of a generic matrices with a generic PositionVector Assume that the matrix implements the operator( i,j) and that it has at least 3 columns and 3 rows.

There is no check on the matrix size !!

Definition at line 426 of file GenVector/VectorUtil.h.

References m, ROOT::Math::DisplacementVector3D< CoordSystem, Tag >::SetXYZ(), ROOT::Math::PositionVector3D< CoordSystem, Tag >::x(), ROOT::Math::PositionVector3D< CoordSystem, Tag >::y(), and ROOT::Math::PositionVector3D< CoordSystem, Tag >::z().

template<class Matrix , class CoordSystem , class U >
DisplacementVector3D<CoordSystem,U> ROOT::Math::VectorUtil::Mult ( const Matrix &  m,
const DisplacementVector3D< CoordSystem, U > &  v 
) [inline]

Multiplications of a generic matrices with a DisplacementVector3D of any coordinate system.

Assume that the matrix implements the operator( i,j) and that it has at least 3 columns and 3 rows. There is no check on the matrix size !!

Definition at line 411 of file GenVector/VectorUtil.h.

References m, ROOT::Math::DisplacementVector3D< CoordSystem, Tag >::SetXYZ(), ROOT::Math::DisplacementVector3D< CoordSystem, Tag >::x(), ROOT::Math::DisplacementVector3D< CoordSystem, Tag >::y(), and ROOT::Math::DisplacementVector3D< CoordSystem, Tag >::z().

template<class Vector1 , class Vector2 >
double ROOT::Math::VectorUtil::Perp ( const Vector1 &  v,
const Vector2 &  u 
) [inline]

Find the magnitude of the vector component of v perpendicular to the given direction of u.

Parameters:
v Vector v for which the perpendicular component is to be found
u Vector specifying the direction
Returns:
value of the component of v which is perpendicular to u

\[ perp = | \vec{v} - \frac{ \vec{v} \cdot \vec{u} }{|\vec{u}|}\vec{u} | \]

Precondition is that Vector1 implements Dot function and Vector2 implements X(),Y() and Z()

Definition at line 198 of file GenVector/VectorUtil.h.

References Perp2(), and ROOT::Math::sqrt().

template<class Vector1 , class Vector2 >
double ROOT::Math::VectorUtil::Perp2 ( const Vector1 &  v,
const Vector2 &  u 
) [inline]

Find the magnitude square of the vector component of v perpendicular to the given direction of u.

Parameters:
v Vector v for which the perpendicular component is to be found
u Vector specifying the direction
Returns:
square value of the component of v which is perpendicular to u

\[ perp = | \vec{v} - \frac{ \vec{v} \cdot \vec{u} }{|\vec{u}|}\vec{u} |^2 \]

Precondition is that Vector1 implements Dot function and Vector2 implements X(),Y() and Z()

Definition at line 182 of file GenVector/VectorUtil.h.

Referenced by Perp().

template<class Vector1 , class Vector2 >
Vector1 ROOT::Math::VectorUtil::PerpVector ( const Vector1 &  v,
const Vector2 &  u 
) [inline]

Find the vector component of v perpendicular to the given direction of u.

Parameters:
v Vector v for which the perpendicular component is to be found
u Vector specifying the direction
Returns:
Vector component of v which is perpendicular to u

\[ \vec{perp} = \vec{v} - \frac{ \vec{v} \cdot \vec{u} }{|\vec{u}|}\vec{u} \]

Precondition is that Vector1 implements Dot function and Vector2 implements X(),Y() and Z()

Definition at line 169 of file GenVector/VectorUtil.h.

References ProjVector().

double ROOT::Math::VectorUtil::Phi_0_2pi ( double  phi  ) 

Return a phi angle in the interval (0,2*PI].

Definition at line 22 of file VectorUtil.cxx.

References M_PI.

double ROOT::Math::VectorUtil::Phi_mpi_pi ( double  phi  ) 

Returns phi angle in the interval (-PI,PI].

Definition at line 36 of file VectorUtil.cxx.

References M_PI.

template<class Vector1 , class Vector2 >
Vector1 ROOT::Math::VectorUtil::ProjVector ( const Vector1 &  v,
const Vector2 &  u 
) [inline]

Find the projection of v along the given direction u.

Parameters:
v Vector v for which the propjection is to be found
u Vector specifying the direction
Returns:
Vector projection (same type of v)

\[ \vec{proj} = \frac{ \vec{v} \cdot \vec{u} }{|\vec{u}|}\vec{u} \]

Precondition is that Vector1 implements Dot function and Vector2 implements X(),Y() and Z()

Definition at line 153 of file GenVector/VectorUtil.h.

Referenced by PerpVector().

template<class Vector , class RotationMatrix >
Vector ROOT::Math::VectorUtil::Rotate ( const Vector &  v,
const RotationMatrix &  rot 
) [inline]

rotation on a generic vector using a generic rotation class.

The only requirement on the vector is that implements the X(), Y(), Z() and SetXYZ methods. The requirement on the rotation matrix is that need to implement the (i,j) operator returning the matrix element with R(0,0) = xx element

Definition at line 293 of file GenVector/VectorUtil.h.

template<class Vector >
Vector ROOT::Math::VectorUtil::RotateX ( const Vector &  v,
double  alpha 
) [inline]

rotation along X axis for a generic vector by an Angle alpha returning a new vector.

The only pre requisite on the Vector is that it has to implement the X() , Y() and Z() and SetXYZ methods.

Definition at line 240 of file GenVector/VectorUtil.h.

References cos(), and sin().

template<class Vector >
Vector ROOT::Math::VectorUtil::RotateY ( const Vector &  v,
double  alpha 
) [inline]

rotation along Y axis for a generic vector by an Angle alpha returning a new vector.

The only pre requisite on the Vector is that it has to implement the X() , Y() and Z() and SetXYZ methods.

Definition at line 257 of file GenVector/VectorUtil.h.

References cos(), and sin().

template<class Vector >
Vector ROOT::Math::VectorUtil::RotateZ ( const Vector &  v,
double  alpha 
) [inline]

rotation along Z axis for a generic vector by an Angle alpha returning a new vector.

The only pre requisite on the Vector is that it has to implement the X() , Y() and Z() and SetXYZ methods.

Definition at line 274 of file GenVector/VectorUtil.h.

References cos(), and sin().


Generated on Thu Dec 16 21:13:58 2010 for ROOT Mathematical Libraries by  doxygen 1.5.9