 |
Belle II Software
release-05-02-19
|
17 #ifndef __FOURVECTOR_H
18 #define __FOURVECTOR_H
20 #include "analysis/OrcaKinFit/ThreeVector.h"
28 namespace OrcaKinFit {
48 inline FourVector(
double E_,
double px_,
double py_,
double pz_);
50 inline FourVector(
double E_,
const ThreeVector& p_);
52 inline FourVector(
const ThreeVector& p_,
double m_);
56 inline double getE()
const;
58 inline double getPx()
const;
60 inline double getPy()
const;
62 inline double getPz()
const;
64 inline double getM2()
const;
66 inline double getM()
const;
71 inline double getP2()
const;
73 inline double getP()
const;
75 inline double getPt2()
const;
77 inline double getPt()
const;
80 inline double getPhi()
const;
84 inline double getEta()
const;
89 inline ThreeVector getBeta()
const { assert(E > 0);
return (1. / E) *
p;};
90 inline double getGamma()
const { assert(
getM() > 0);
return getE() /
getM();};
91 inline ThreeVector getBetaGamma()
const { assert(
getM() > 0);
return (1. /
getM() > 0) *
p;};
99 inline void setValues(
double E_,
double px_,
double py_,
double pz_);
116 : E(E_), p(px_, py_, pz_)
124 : E(std::sqrt(p_.getP2() + m * m)), p(p_)
151 case 2:
return getPy();
157 void FourVector::setValues(
double E_,
double px_,
double py_,
double pz_)
160 p.setValues(px_, py_, pz_);
170 FourVector& FourVector::operator-= (
const FourVector& rhs)
177 FourVector& FourVector::operator*= (
double rhs)
188 inline FourVector
operator+ (
const FourVector& lhs,
const FourVector& rhs)
190 return FourVector(lhs.getE() + rhs.getE(), lhs.getPx() + rhs.getPx(), lhs.getPy() + rhs.getPy(), lhs.getPz() + rhs.getPz());
197 inline FourVector
operator- (
const FourVector& lhs,
const FourVector& rhs)
199 return FourVector(lhs.getE() - rhs.getE(), lhs.getPx() - rhs.getPx(), lhs.getPy() - rhs.getPy(), lhs.getPz() - rhs.getPz());
206 inline FourVector
operator- (
const FourVector& rhs)
208 return FourVector(-rhs.getE(), -rhs.getPx(), -rhs.getPy(), -rhs.getPz());
215 inline FourVector
operator* (
double lhs,
const FourVector& rhs)
217 return FourVector(lhs * rhs.getE(), lhs * rhs.getPx(), lhs * rhs.getPy(), lhs * rhs.getPz());
224 inline double operator* (
const FourVector& lhs,
const FourVector& rhs)
226 return lhs.getE() * rhs.getE() - lhs.getPx() * rhs.getPx() - lhs.getPy() * rhs.getPy() - lhs.getPz() * rhs.getPz();
234 inline std::ostream&
operator<< (std::ostream& os,
238 os <<
"(" << rhs.getE() <<
", " << rhs.getPx() <<
", " << rhs.getPy() <<
", " << rhs.getPz() <<
")";
246 #endif // __FOURVECTOR_H
double getMass() const
Returns the mass / magnitude.
double getPt2() const
Returns the transverse momentum squared / magnitude of the 1 and 2 component vector squared.
double getP() const
Returns the momentum / magnitude of the three vector.
double getComponent(int i) const
Returns the i'th component (starting from 0=energy)
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
const ThreeVector & getThreeVector() const
Returns the momentum three vector.
double getPhi() const
Returns the azimuthal angle of the momentum / three vector squared.
double getPt() const
Returns the transverse momentum / magnitude of the 1 and 2 component vector.
double getM2() const
Returns the mass squared / magnitude squared.
double getPx() const
Returns the x momentum / 1 component.
double getTheta() const
Returns the polar angle of the momentum / three vector squared.
B2Vector3< DataType > operator*(DataType a, const B2Vector3< DataType > &p)
non-memberfunction Scaling of 3-vectors with a real number
Yet another four vector class, with metric +—.
double getPy() const
Returns the y momentum / 2 component.
double getP2() const
Returns the momentum squared / magnitude of the three vector squared.
Abstract base class for different kinds of events.
double E
The energy / 0 component.
double getM() const
Returns the mass / magnitude.
B2Vector3< DataType > operator-(const TVector3 &a, const B2Vector3< DataType > &b)
non-memberfunction for substracting a TVector3 from a B2Vector3
B2Vector3< DataType > operator+(const TVector3 &a, const B2Vector3< DataType > &b)
non-memberfunction for adding a TVector3 to a B2Vector3
double getE() const
Returns the energy / 0 component.
FourVector()
Default constructor.
double getEta() const
Returns the pseudo rapidity of the momentum / three vector squared.
double getPz() const
Returns the z momentum / 3 component.
ThreeVector p
The momentum three vector.