Belle II Software development
ThreeVector Class Reference

Public Member Functions

 ThreeVector (double px_, double py_, double pz_)
 
double getPx () const
 
double getPy () const
 
double getPz () const
 
double getX () const
 
double getY () const
 
double getZ () const
 
double getP2 () const
 
double getP () const
 
double getMag () const
 
double getPt2 () const
 
double getPt () const
 
double getR () const
 
double getPhi () const
 
double getTheta () const
 
double getEta () const
 
double getComponent (int i) const
 
ThreeVectorsetValues (double px_, double py_, double pz_)
 
ThreeVectoroperator+= (const ThreeVector &rhs)
 
ThreeVectoroperator-= (const ThreeVector &rhs)
 
ThreeVectoroperator*= (double rhs)
 

Private Attributes

double px
 
double py
 
double pz
 

Detailed Description

Definition at line 31 of file ThreeVector.h.

Constructor & Destructor Documentation

◆ ThreeVector() [1/2]

ThreeVector ( )
inline

Definition at line 67 of file ThreeVector.h.

68 : px(0), py(0), pz(0)
69 {}

◆ ThreeVector() [2/2]

ThreeVector ( double  px_,
double  py_,
double  pz_ 
)
inline

Definition at line 71 of file ThreeVector.h.

72 : px(px_), py(py_), pz(pz_)
73 {}

Member Function Documentation

◆ getComponent()

double getComponent ( int  i) const
inline

Definition at line 94 of file ThreeVector.h.

95 {
96 switch (i) {
97 case 0: return getPx();
98 case 1: return getPy();
99 case 2: return getPz();
100 }
101 return NAN; // not-a-number, defined in cmath
102 }

◆ getEta()

double getEta ( ) const
inline

Definition at line 92 of file ThreeVector.h.

92{ return -std::log(std::tan(0.5 * getTheta())); }

◆ getMag()

double getMag ( ) const
inline

Definition at line 88 of file ThreeVector.h.

88{ return std::sqrt(getP2()); }

◆ getP()

double getP ( ) const
inline

Definition at line 87 of file ThreeVector.h.

87{ return std::sqrt(getP2()); }

◆ getP2()

double getP2 ( ) const
inline

Definition at line 86 of file ThreeVector.h.

86{ return px * px + py * py + pz * pz; }

◆ getPhi()

double getPhi ( ) const
inline

Definition at line 90 of file ThreeVector.h.

90{ return std::atan2(py, px); }

◆ getPt()

double getPt ( ) const
inline

Definition at line 83 of file ThreeVector.h.

83{ return std::sqrt(getPt2()); }

◆ getPt2()

double getPt2 ( ) const
inline

Definition at line 82 of file ThreeVector.h.

82{ return px * px + py * py; }

◆ getPx()

double getPx ( ) const
inline

Definition at line 75 of file ThreeVector.h.

75{ return px; }

◆ getPy()

double getPy ( ) const
inline

Definition at line 76 of file ThreeVector.h.

76{ return py; }

◆ getPz()

double getPz ( ) const
inline

Definition at line 77 of file ThreeVector.h.

77{ return pz; }

◆ getR()

double getR ( ) const
inline

Definition at line 84 of file ThreeVector.h.

84{ return std::sqrt(getPt2()); }

◆ getTheta()

double getTheta ( ) const
inline

Definition at line 91 of file ThreeVector.h.

91{ return std::atan2(getPt(), pz); }

◆ getX()

double getX ( ) const
inline

Definition at line 78 of file ThreeVector.h.

78{ return px; }

◆ getY()

double getY ( ) const
inline

Definition at line 79 of file ThreeVector.h.

79{ return py; }

◆ getZ()

double getZ ( ) const
inline

Definition at line 80 of file ThreeVector.h.

80{ return pz; }

◆ operator*=()

ThreeVector & operator*= ( double  rhs)
inline

Definition at line 129 of file ThreeVector.h.

130 {
131 px *= rhs;
132 py *= rhs;
133 pz *= rhs;
134 return *this;
135 }

◆ operator+=()

ThreeVector & operator+= ( const ThreeVector rhs)
inline

Definition at line 113 of file ThreeVector.h.

114 {
115 px += rhs.px;
116 py += rhs.py;
117 pz += rhs.pz;
118 return *this;
119 }

◆ operator-=()

ThreeVector & operator-= ( const ThreeVector rhs)
inline

Definition at line 121 of file ThreeVector.h.

122 {
123 px -= rhs.px;
124 py -= rhs.py;
125 pz -= rhs.pz;
126 return *this;
127 }

◆ setValues()

ThreeVector & setValues ( double  px_,
double  py_,
double  pz_ 
)
inline

Definition at line 104 of file ThreeVector.h.

105 {
106 px = px_;
107 py = py_;
108 pz = pz_;
109 return *this;
110 }

Member Data Documentation

◆ px

double px
private

Definition at line 64 of file ThreeVector.h.

◆ py

double py
private

Definition at line 64 of file ThreeVector.h.

◆ pz

double pz
private

Definition at line 64 of file ThreeVector.h.


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