19 #ifdef MARLIN_USE_ROOT
21 #ifndef __FOURVECTOR_H
22 #define __FOURVECTOR_H
24 #include "ThreeVector.h"
44 inline FourVector(
double E_,
double px_,
double py_,
double pz_);
46 inline FourVector(
double E_,
const ThreeVector& p_);
48 inline FourVector(
const ThreeVector& p_,
double m_);
52 inline double getE()
const;
54 inline double getPx()
const;
56 inline double getPy()
const;
58 inline double getPz()
const;
60 inline double getM2()
const;
62 inline double getM()
const;
64 inline double getMass()
const;
67 inline double getP2()
const;
69 inline double getP()
const;
71 inline double getPt2()
const;
73 inline double getPt()
const;
76 inline double getPhi()
const;
78 inline double getTheta()
const;
80 inline double getEta()
const;
83 inline double getComponent (
int i)
const;
85 inline ThreeVector getBeta()
const { assert (E>0);
return (1./E)*p;};
86 inline double getGamma()
const { assert (getM()>0);
return getE()/getM();};
87 inline ThreeVector getBetaGamma()
const { assert (getM()>0);
return (1./getM()>0)*p;};
90 inline const ThreeVector& getThreeVector()
const {
return p;}
92 FourVector& boost (
const FourVector& P);
93 void decayto (FourVector& d1, FourVector& d2)
const;
95 inline void setValues (
double E_,
double px_,
double py_,
double pz_);
97 inline FourVector& operator+= (
const FourVector& rhs);
98 inline FourVector& operator-= (
const FourVector& rhs);
100 inline FourVector& operator*= (
double rhs);
107 FourVector::FourVector()
111 FourVector::FourVector(
double E_,
double px_,
double py_,
double pz_)
112 : E(E_), p(px_, py_, pz_)
115 FourVector::FourVector(
double E_,
const ThreeVector& p_)
119 FourVector::FourVector(
const ThreeVector& p_,
double m)
120 : E(std::sqrt(p_.getP2() + m*m)), p(p_)
123 double FourVector::getE()
const {
return E; }
124 double FourVector::getPx()
const {
return p.getPx(); }
125 double FourVector::getPy()
const {
return p.getPy(); }
126 double FourVector::getPz()
const {
return p.getPz(); }
128 double FourVector::getPt2()
const {
return p.getPt2(); }
129 double FourVector::getPt()
const {
return p.getPt(); }
131 double FourVector::getP2()
const {
return p.getP2(); }
132 double FourVector::getP()
const {
return p.getP(); }
134 double FourVector::getM2()
const {
return std::abs(getE()*getE()-getP2()); }
135 double FourVector::getM()
const {
return std::sqrt(getM2()); }
136 double FourVector::getMass()
const {
return std::sqrt(getM2()); }
138 double FourVector::getPhi()
const {
return p.getPhi(); }
139 double FourVector::getTheta()
const {
return p.getTheta(); }
141 double FourVector::getEta()
const {
return p.getEta(); }
143 double FourVector::getComponent(
int i)
const {
145 case 1:
return getPx();
146 case 2:
return getPy();
147 case 3:
return getPz();
152 void FourVector::setValues(
double E_,
double px_,
double py_,
double pz_) {
154 p.setValues (px_, py_, pz_);
157 FourVector& FourVector::operator+= (
const FourVector& rhs) {
163 FourVector& FourVector::operator-= (
const FourVector& rhs) {
169 FourVector& FourVector::operator*= (
double rhs) {
179 inline FourVector operator+ (
const FourVector& lhs,
const FourVector& rhs) {
180 return FourVector (lhs.getE()+rhs.getE(), lhs.getPx()+rhs.getPx(), lhs.getPy()+rhs.getPy(), lhs.getPz()+rhs.getPz());
187 inline FourVector operator- (
const FourVector& lhs,
const FourVector& rhs) {
188 return FourVector (lhs.getE()-rhs.getE(), lhs.getPx()-rhs.getPx(), lhs.getPy()-rhs.getPy(), lhs.getPz()-rhs.getPz());
195 inline FourVector operator- (
const FourVector& rhs) {
196 return FourVector (-rhs.getE(), -rhs.getPx(), -rhs.getPy(), -rhs.getPz());
203 inline FourVector operator* (
double lhs,
const FourVector& rhs) {
204 return FourVector (lhs*rhs.getE(), lhs*rhs.getPx(), lhs*rhs.getPy(), lhs*rhs.getPz());
211 inline double operator* (
const FourVector& lhs,
const FourVector& rhs) {
212 return lhs.getE()*rhs.getE() - lhs.getPx()*rhs.getPx() - lhs.getPy()*rhs.getPy() - lhs.getPz()*rhs.getPz();
220 inline std::ostream&
operator<< (std::ostream& os,
221 const FourVector& rhs
223 os <<
"(" << rhs.getE() <<
", " << rhs.getPx() <<
", " << rhs.getPy() <<
", " << rhs.getPz() <<
")";
228 #endif // __FOURVECTOR_H
230 #endif // MARLIN_USE_ROOT
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