17#ifndef __THREEVECTOR_H
18#define __THREEVECTOR_H
28 namespace OrcaKinFit {
34 inline ThreeVector(
double px_,
double py_,
double pz_);
37 inline double getPx()
const;
38 inline double getPy()
const;
39 inline double getPz()
const;
40 inline double getX()
const;
41 inline double getY()
const;
42 inline double getZ()
const;
44 inline double getP2()
const;
45 inline double getP()
const;
46 inline double getMag()
const;
47 inline double getPt2()
const;
48 inline double getPt()
const;
49 inline double getR()
const;
51 inline double getPhi()
const;
52 inline double getTheta()
const;
53 inline double getEta()
const;
55 inline double getComponent(
int i)
const;
57 inline ThreeVector& setValues(
double px_,
double py_,
double pz_);
67 ThreeVector::ThreeVector()
71 ThreeVector::ThreeVector(
double px_,
double py_,
double pz_)
72 : px(px_), py(py_), pz(pz_)
75 double ThreeVector::getPx()
const {
return px; }
76 double ThreeVector::getPy()
const {
return py; }
77 double ThreeVector::getPz()
const {
return pz; }
78 double ThreeVector::getX()
const {
return px; }
79 double ThreeVector::getY()
const {
return py; }
80 double ThreeVector::getZ()
const {
return pz; }
82 double ThreeVector::getPt2()
const {
return px * px + py * py; }
83 double ThreeVector::getPt()
const {
return std::sqrt(getPt2()); }
84 double ThreeVector::getR()
const {
return std::sqrt(getPt2()); }
86 double ThreeVector::getP2()
const {
return px * px + py * py + pz * pz; }
87 double ThreeVector::getP()
const {
return std::sqrt(getP2()); }
88 double ThreeVector::getMag()
const {
return std::sqrt(getP2()); }
90 double ThreeVector::getPhi()
const {
return std::atan2(py, px); }
91 double ThreeVector::getTheta()
const {
return std::atan2(getPt(), pz); }
92 double ThreeVector::getEta()
const {
return -std::log(std::tan(0.5 * getTheta())); }
94 double ThreeVector::getComponent(
int i)
const
97 case 0:
return getPx();
98 case 1:
return getPy();
99 case 2:
return getPz();
104 ThreeVector& ThreeVector::setValues(
double px_,
double py_,
double pz_)
113 ThreeVector& ThreeVector::operator+= (
const ThreeVector& rhs)
121 ThreeVector& ThreeVector::operator-= (
const ThreeVector& rhs)
129 ThreeVector& ThreeVector::operator*= (
double rhs)
137 inline ThreeVector operator+ (
const ThreeVector& lhs,
const ThreeVector& rhs)
139 return ThreeVector(lhs.getPx() + rhs.getPx(), lhs.getPy() + rhs.getPy(), lhs.getPz() + rhs.getPz());
142 inline ThreeVector operator- (
const ThreeVector& lhs,
const ThreeVector& rhs)
144 return ThreeVector(lhs.getPx() - rhs.getPx(), lhs.getPy() - rhs.getPy(), lhs.getPz() - rhs.getPz());
147 inline ThreeVector operator- (
const ThreeVector& rhs)
149 return ThreeVector(-rhs.getPx(), -rhs.getPy(), -rhs.getPz());
152 inline double operator* (
const ThreeVector& lhs,
const ThreeVector& rhs)
154 return lhs.getPx() * rhs.getPx() + lhs.getPy() * rhs.getPy() + lhs.getPz() * rhs.getPz();
157 inline ThreeVector operator* (
double lhs,
const ThreeVector& rhs)
159 return ThreeVector(lhs * rhs.getPx(), lhs * rhs.getPy(), lhs * rhs.getPz());
162 inline std::ostream& operator<< (std::ostream& out,
const ThreeVector& v)
164 out <<
"(" << v.getPx() <<
", " << v.getPy() <<
", " << v.getPz() <<
")";
Abstract base class for different kinds of events.