12 #ifndef __THREEVECTOR_H
13 #define __THREEVECTOR_H
21 inline ThreeVector(
double px_,
double py_,
double pz_);
24 inline double getPx()
const;
25 inline double getPy()
const;
26 inline double getPz()
const;
27 inline double getX()
const;
28 inline double getY()
const;
29 inline double getZ()
const;
31 inline double getP2()
const;
32 inline double getP()
const;
33 inline double getMag()
const;
34 inline double getPt2()
const;
35 inline double getPt()
const;
36 inline double getR()
const;
38 inline double getPhi()
const;
39 inline double getTheta()
const;
40 inline double getEta()
const;
42 inline double getComponent (
int i)
const;
44 inline ThreeVector& setValues(
double px_,
double py_,
double pz_);
54 ThreeVector::ThreeVector()
58 ThreeVector::ThreeVector(
double px_,
double py_,
double pz_)
59 : px(px_), py(py_), pz(pz_)
62 double ThreeVector::getPx()
const {
return px; }
63 double ThreeVector::getPy()
const {
return py; }
64 double ThreeVector::getPz()
const {
return pz; }
65 double ThreeVector::getX()
const {
return px; }
66 double ThreeVector::getY()
const {
return py; }
67 double ThreeVector::getZ()
const {
return pz; }
69 double ThreeVector::getPt2()
const {
return px*px + py*py; }
70 double ThreeVector::getPt()
const {
return std::sqrt(getPt2()); }
71 double ThreeVector::getR()
const {
return std::sqrt(getPt2()); }
73 double ThreeVector::getP2()
const {
return px*px + py*py + pz*pz; }
74 double ThreeVector::getP()
const {
return std::sqrt(getP2()); }
75 double ThreeVector::getMag()
const {
return std::sqrt(getP2()); }
77 double ThreeVector::getPhi()
const {
return std::atan2(py, px); }
78 double ThreeVector::getTheta()
const {
return std::atan2(getPt(), pz); }
79 double ThreeVector::getEta()
const {
return -std::log(std::tan(0.5*getTheta())); }
81 double ThreeVector::getComponent(
int i)
const {
83 case 0:
return getPx();
84 case 1:
return getPy();
85 case 2:
return getPz();
90 ThreeVector& ThreeVector::setValues(
double px_,
double py_,
double pz_) {
112 ThreeVector& ThreeVector::operator*= (
double rhs) {
120 return ThreeVector (lhs.getPx()+rhs.getPx(), lhs.getPy()+rhs.getPy(), lhs.getPz()+rhs.getPz());
124 return ThreeVector (lhs.getPx()-rhs.getPx(), lhs.getPy()-rhs.getPy(), lhs.getPz()-rhs.getPz());
128 return ThreeVector (-rhs.getPx(), -rhs.getPy(), -rhs.getPz());
132 return lhs.getPx()*rhs.getPx() + lhs.getPy()*rhs.getPy() + lhs.getPz()*rhs.getPz();
136 return ThreeVector (lhs*rhs.getPx(), lhs*rhs.getPy(), lhs*rhs.getPz());
140 out <<
"(" << v.getPx() <<
", " << v.getPy() <<
", " << v.getPz() <<
")";
146 #endif // __THREEVECTOR_H
std::ostream & operator<<(std::ostream &os, const BaseConstraint &bc)
Prints out a BaseConstraint, using its print method.
Definition: BaseConstraint.h:128
Definition: ThreeVector.h:18