Logo ROOT   6.13/01
Reference Guide
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ROOT::Math::PositionVector2D< CoordSystem, Tag > Class Template Reference

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
class ROOT::Math::PositionVector2D< CoordSystem, Tag >

Class describing a generic position vector (point) in 2 dimensions.

Class describing a 2D Position vector.

This class is templated on the type of Coordinate system. One example is the XYPoint which is a vector based on double precision x,y data members by using the ROOT::Math::Cartesian2D<double> Coordinate system. The class is having also an extra template parameter, the coordinate system tag, to be able to identify (tag) vector described in different reference coordinate system, like global or local coordinate systems.

Definition at line 48 of file PositionVector2D.h.

Public Types

typedef Tag CoordinateSystemTag
 
typedef CoordSystem CoordinateType
 
typedef CoordSystem::Scalar Scalar
 

Public Member Functions

 PositionVector2D ()
 Default constructor. More...
 
 PositionVector2D (const Scalar &a, const Scalar &b)
 Construct from three values of type Scalar. More...
 
template<class T >
 PositionVector2D (const PositionVector2D< T, Tag > &v)
 Construct from a position vector expressed in different coordinates, or using a different Scalar type. More...
 
template<class T >
 PositionVector2D (const DisplacementVector2D< T, Tag > &p)
 Construct from an arbitrary displacement vector. More...
 
template<class ForeignVector >
 PositionVector2D (const ForeignVector &v)
 Construct from a foreign 2D vector type, for example, Hep2Vector Precondition: v must implement methods x() and y() More...
 
const CoordSystem & Coordinates () const
 Retrieve a copy of the coordinates object. More...
 
template<class OtherCoords >
Scalar Dot (const DisplacementVector2D< OtherCoords, Tag > &v) const
 Return the scalar (Dot) product of this with a displacement vector in any coordinate system, but with the same tag. More...
 
void GetCoordinates (Scalar &a, Scalar &b) const
 get internal data into 2 Scalar numbers. More...
 
Scalar Mag2 () const
 Magnitute squared ( r^2 in spherical coordinate) More...
 
Scalar mag2 () const
 
bool operator!= (const PositionVector2D &rhs) const
 
PositionVector2D operator* (Scalar a) const
 Multiply a vector by a real number. More...
 
PositionVector2Doperator*= (Scalar a)
 multiply this vector by a scalar quantity More...
 
template<class OtherCoords >
PositionVector2Doperator+= (const DisplacementVector2D< OtherCoords, Tag > &v)
 Self Addition with a displacement vector. More...
 
template<class OtherCoords >
PositionVector2Doperator-= (const DisplacementVector2D< OtherCoords, Tag > &v)
 Self Difference with a displacement vector. More...
 
PositionVector2D operator/ (Scalar a) const
 Division of a vector with a real number. More...
 
PositionVector2Doperator/= (Scalar a)
 divide this vector by a scalar quantity More...
 
template<class OtherCoords >
PositionVector2Doperator= (const PositionVector2D< OtherCoords, Tag > &v)
 Assignment operator from a position vector of arbitrary type. More...
 
template<class OtherCoords >
PositionVector2Doperator= (const DisplacementVector2D< OtherCoords, Tag > &v)
 Assignment operator from a displacement vector of arbitrary type. More...
 
template<class ForeignVector >
PositionVector2Doperator= (const ForeignVector &v)
 Assignment from a foreign 2D vector type, for example, Hep2Vector Precondition: v must implement methods x() and y() More...
 
bool operator== (const PositionVector2D &rhs) const
 Exact equality. More...
 
Scalar Phi () const
 Polar phi, converting if necessary from internal coordinate system. More...
 
Scalar phi () const
 
Scalar R () const
 Polar R, converting if necessary from internal coordinate system. More...
 
Scalar r () const
 
void Rotate (Scalar angle)
 Rotate by an angle. More...
 
PositionVector2D< CoordSystem, Tag > & SetCoordinates (Scalar a, Scalar b)
 Set internal data based on 2 Scalar numbers. More...
 
PositionVector2D< CoordSystem, Tag > & SetPhi (Scalar ang)
 Change Phi - Polar2D coordinates. More...
 
PositionVector2D< CoordSystem, Tag > & SetR (Scalar a)
 Change R - Polar2D coordinates only. More...
 
PositionVector2D< CoordSystem, Tag > & SetX (Scalar a)
 Change X - Cartesian2D coordinates only. More...
 
PositionVector2D< CoordSystem, Tag > & SetXY (Scalar a, Scalar b)
 set the values of the vector from the cartesian components (x,y) (if the vector is held in polar coordinates, then (x, y) are converted to that form) More...
 
PositionVector2D< CoordSystem, Tag > & SetY (Scalar a)
 Change Y - Cartesian2D coordinates only. More...
 
Scalar X () const
 Cartesian X, converting if necessary from internal coordinate system. More...
 
Scalar x () const
 
Scalar Y () const
 Cartesian Y, converting if necessary from internal coordinate system. More...
 
Scalar y () const
 

Private Member Functions

template<class OtherCoords , class OtherTag >
 PositionVector2D (const PositionVector2D< OtherCoords, OtherTag > &)
 
template<class OtherCoords , class OtherTag >
 PositionVector2D (const DisplacementVector2D< OtherCoords, OtherTag > &)
 
template<class OtherCoords , class OtherTag >
PositionVector2Doperator+= (const DisplacementVector2D< OtherCoords, OtherTag > &)
 
template<class OtherCoords , class OtherTag >
PositionVector2Doperator-= (const DisplacementVector2D< OtherCoords, OtherTag > &)
 
template<class OtherCoords , class OtherTag >
PositionVector2Doperator= (const PositionVector2D< OtherCoords, OtherTag > &)
 
template<class OtherCoords , class OtherTag >
PositionVector2Doperator= (const DisplacementVector2D< OtherCoords, OtherTag > &)
 

Private Attributes

CoordSystem fCoordinates
 

#include <Math/GenVector/PositionVector2D.h>

Member Typedef Documentation

◆ CoordinateSystemTag

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
typedef Tag ROOT::Math::PositionVector2D< CoordSystem, Tag >::CoordinateSystemTag

Definition at line 54 of file PositionVector2D.h.

◆ CoordinateType

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
typedef CoordSystem ROOT::Math::PositionVector2D< CoordSystem, Tag >::CoordinateType

Definition at line 53 of file PositionVector2D.h.

◆ Scalar

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
typedef CoordSystem::Scalar ROOT::Math::PositionVector2D< CoordSystem, Tag >::Scalar

Definition at line 52 of file PositionVector2D.h.

Constructor & Destructor Documentation

◆ PositionVector2D() [1/7]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
ROOT::Math::PositionVector2D< CoordSystem, Tag >::PositionVector2D ( )
inline

Default constructor.

Construct an empty object with zero values

Definition at line 62 of file PositionVector2D.h.

◆ PositionVector2D() [2/7]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
ROOT::Math::PositionVector2D< CoordSystem, Tag >::PositionVector2D ( const Scalar a,
const Scalar b 
)
inline

Construct from three values of type Scalar.

In the case of a XYPoint the values are x,y In the case of a polar vector they are r,phi

Definition at line 69 of file PositionVector2D.h.

◆ PositionVector2D() [3/7]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class T >
ROOT::Math::PositionVector2D< CoordSystem, Tag >::PositionVector2D ( const PositionVector2D< T, Tag > &  v)
inlineexplicit

Construct from a position vector expressed in different coordinates, or using a different Scalar type.

Definition at line 77 of file PositionVector2D.h.

◆ PositionVector2D() [4/7]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class T >
ROOT::Math::PositionVector2D< CoordSystem, Tag >::PositionVector2D ( const DisplacementVector2D< T, Tag > &  p)
inlineexplicit

Construct from an arbitrary displacement vector.

Definition at line 84 of file PositionVector2D.h.

◆ PositionVector2D() [5/7]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class ForeignVector >
ROOT::Math::PositionVector2D< CoordSystem, Tag >::PositionVector2D ( const ForeignVector &  v)
inlineexplicit

Construct from a foreign 2D vector type, for example, Hep2Vector Precondition: v must implement methods x() and y()

Definition at line 92 of file PositionVector2D.h.

◆ PositionVector2D() [6/7]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class OtherCoords , class OtherTag >
ROOT::Math::PositionVector2D< CoordSystem, Tag >::PositionVector2D ( const PositionVector2D< OtherCoords, OtherTag > &  )
explicitprivate

◆ PositionVector2D() [7/7]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class OtherCoords , class OtherTag >
ROOT::Math::PositionVector2D< CoordSystem, Tag >::PositionVector2D ( const DisplacementVector2D< OtherCoords, OtherTag > &  )
explicitprivate

Member Function Documentation

◆ Coordinates()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
const CoordSystem& ROOT::Math::PositionVector2D< CoordSystem, Tag >::Coordinates ( ) const
inline

Retrieve a copy of the coordinates object.

Definition at line 132 of file PositionVector2D.h.

◆ Dot()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class OtherCoords >
Scalar ROOT::Math::PositionVector2D< CoordSystem, Tag >::Dot ( const DisplacementVector2D< OtherCoords, Tag > &  v) const
inline

Return the scalar (Dot) product of this with a displacement vector in any coordinate system, but with the same tag.

Definition at line 251 of file PositionVector2D.h.

◆ GetCoordinates()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
void ROOT::Math::PositionVector2D< CoordSystem, Tag >::GetCoordinates ( Scalar a,
Scalar b 
) const
inline

get internal data into 2 Scalar numbers.

These are for example (x,y) for a cartesian vector or (r,phi) for a polar vector

Definition at line 150 of file PositionVector2D.h.

◆ Mag2()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
Scalar ROOT::Math::PositionVector2D< CoordSystem, Tag >::Mag2 ( ) const
inline

Magnitute squared ( r^2 in spherical coordinate)

Definition at line 201 of file PositionVector2D.h.

◆ mag2()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
Scalar ROOT::Math::PositionVector2D< CoordSystem, Tag >::mag2 ( ) const
inline

Definition at line 329 of file PositionVector2D.h.

◆ operator!=()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
bool ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator!= ( const PositionVector2D< CoordSystem, Tag > &  rhs) const
inline

Definition at line 172 of file PositionVector2D.h.

◆ operator*()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
PositionVector2D ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator* ( Scalar  a) const
inline

Multiply a vector by a real number.

Definition at line 301 of file PositionVector2D.h.

◆ operator*=()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
PositionVector2D& ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator*= ( Scalar  a)
inline

multiply this vector by a scalar quantity

Definition at line 283 of file PositionVector2D.h.

◆ operator+=() [1/2]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class OtherCoords >
PositionVector2D& ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator+= ( const DisplacementVector2D< OtherCoords, Tag > &  v)
inline

Self Addition with a displacement vector.

Definition at line 264 of file PositionVector2D.h.

◆ operator+=() [2/2]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class OtherCoords , class OtherTag >
PositionVector2D& ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator+= ( const DisplacementVector2D< OtherCoords, OtherTag > &  )
private

◆ operator-=() [1/2]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class OtherCoords >
PositionVector2D& ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator-= ( const DisplacementVector2D< OtherCoords, Tag > &  v)
inline

Self Difference with a displacement vector.

Definition at line 274 of file PositionVector2D.h.

◆ operator-=() [2/2]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class OtherCoords , class OtherTag >
PositionVector2D& ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator-= ( const DisplacementVector2D< OtherCoords, OtherTag > &  )
private

◆ operator/()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
PositionVector2D ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator/ ( Scalar  a) const
inline

Division of a vector with a real number.

Definition at line 310 of file PositionVector2D.h.

◆ operator/=()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
PositionVector2D& ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator/= ( Scalar  a)
inline

divide this vector by a scalar quantity

Definition at line 291 of file PositionVector2D.h.

◆ operator=() [1/5]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class OtherCoords >
PositionVector2D& ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator= ( const PositionVector2D< OtherCoords, Tag > &  v)
inline

Assignment operator from a position vector of arbitrary type.

Definition at line 104 of file PositionVector2D.h.

◆ operator=() [2/5]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class OtherCoords >
PositionVector2D& ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator= ( const DisplacementVector2D< OtherCoords, Tag > &  v)
inline

Assignment operator from a displacement vector of arbitrary type.

Definition at line 114 of file PositionVector2D.h.

◆ operator=() [3/5]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class ForeignVector >
PositionVector2D& ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator= ( const ForeignVector &  v)
inline

Assignment from a foreign 2D vector type, for example, Hep2Vector Precondition: v must implement methods x() and y()

Definition at line 124 of file PositionVector2D.h.

◆ operator=() [4/5]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class OtherCoords , class OtherTag >
PositionVector2D& ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator= ( const PositionVector2D< OtherCoords, OtherTag > &  )
private

◆ operator=() [5/5]

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
template<class OtherCoords , class OtherTag >
PositionVector2D& ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator= ( const DisplacementVector2D< OtherCoords, OtherTag > &  )
private

◆ operator==()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
bool ROOT::Math::PositionVector2D< CoordSystem, Tag >::operator== ( const PositionVector2D< CoordSystem, Tag > &  rhs) const
inline

Exact equality.

Definition at line 169 of file PositionVector2D.h.

◆ Phi()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
Scalar ROOT::Math::PositionVector2D< CoordSystem, Tag >::Phi ( ) const
inline

Polar phi, converting if necessary from internal coordinate system.

Definition at line 196 of file PositionVector2D.h.

◆ phi()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
Scalar ROOT::Math::PositionVector2D< CoordSystem, Tag >::phi ( ) const
inline

Definition at line 328 of file PositionVector2D.h.

◆ R()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
Scalar ROOT::Math::PositionVector2D< CoordSystem, Tag >::R ( ) const
inline

Polar R, converting if necessary from internal coordinate system.

Definition at line 191 of file PositionVector2D.h.

◆ r()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
Scalar ROOT::Math::PositionVector2D< CoordSystem, Tag >::r ( ) const
inline

Definition at line 327 of file PositionVector2D.h.

◆ Rotate()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
void ROOT::Math::PositionVector2D< CoordSystem, Tag >::Rotate ( Scalar  angle)
inline

Rotate by an angle.

Definition at line 319 of file PositionVector2D.h.

◆ SetCoordinates()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
PositionVector2D<CoordSystem, Tag>& ROOT::Math::PositionVector2D< CoordSystem, Tag >::SetCoordinates ( Scalar  a,
Scalar  b 
)
inline

Set internal data based on 2 Scalar numbers.

These are for example (x,y) for a cartesian vector or (r,phi) for a polar vector

Definition at line 140 of file PositionVector2D.h.

◆ SetPhi()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
PositionVector2D<CoordSystem, Tag>& ROOT::Math::PositionVector2D< CoordSystem, Tag >::SetPhi ( Scalar  ang)
inline

Change Phi - Polar2D coordinates.

Definition at line 237 of file PositionVector2D.h.

◆ SetR()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
PositionVector2D<CoordSystem, Tag>& ROOT::Math::PositionVector2D< CoordSystem, Tag >::SetR ( Scalar  a)
inline

Change R - Polar2D coordinates only.

Definition at line 229 of file PositionVector2D.h.

◆ SetX()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
PositionVector2D<CoordSystem, Tag>& ROOT::Math::PositionVector2D< CoordSystem, Tag >::SetX ( Scalar  a)
inline

Change X - Cartesian2D coordinates only.

Definition at line 212 of file PositionVector2D.h.

◆ SetXY()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
PositionVector2D<CoordSystem, Tag>& ROOT::Math::PositionVector2D< CoordSystem, Tag >::SetXY ( Scalar  a,
Scalar  b 
)
inline

set the values of the vector from the cartesian components (x,y) (if the vector is held in polar coordinates, then (x, y) are converted to that form)

Definition at line 159 of file PositionVector2D.h.

◆ SetY()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
PositionVector2D<CoordSystem, Tag>& ROOT::Math::PositionVector2D< CoordSystem, Tag >::SetY ( Scalar  a)
inline

Change Y - Cartesian2D coordinates only.

Definition at line 220 of file PositionVector2D.h.

◆ X()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
Scalar ROOT::Math::PositionVector2D< CoordSystem, Tag >::X ( ) const
inline

Cartesian X, converting if necessary from internal coordinate system.

Definition at line 181 of file PositionVector2D.h.

◆ x()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
Scalar ROOT::Math::PositionVector2D< CoordSystem, Tag >::x ( ) const
inline

Definition at line 325 of file PositionVector2D.h.

◆ Y()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
Scalar ROOT::Math::PositionVector2D< CoordSystem, Tag >::Y ( ) const
inline

Cartesian Y, converting if necessary from internal coordinate system.

Definition at line 186 of file PositionVector2D.h.

◆ y()

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
Scalar ROOT::Math::PositionVector2D< CoordSystem, Tag >::y ( ) const
inline

Definition at line 326 of file PositionVector2D.h.

Member Data Documentation

◆ fCoordinates

template<class CoordSystem, class Tag = DefaultCoordinateSystemTag>
CoordSystem ROOT::Math::PositionVector2D< CoordSystem, Tag >::fCoordinates
private

Definition at line 333 of file PositionVector2D.h.


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