11 #include "CLHEP/Vector/ZMxpv.h" 17 inline double HepLorentzVector::x()
const {
return pp.x(); }
18 inline double HepLorentzVector::y()
const {
return pp.y(); }
19 inline double HepLorentzVector::z()
const {
return pp.z(); }
20 inline double HepLorentzVector::t()
const {
return ee; }
22 inline HepLorentzVector::
23 HepLorentzVector(
double x1,
double y1,
double z1,
double t1)
24 : pp(x1, y1, z1), ee(t1) {}
26 inline HepLorentzVector:: HepLorentzVector(
double x1,
double y1,
double z1)
27 : pp(x1, y1, z1), ee(0) {}
29 inline HepLorentzVector:: HepLorentzVector(
double t1)
30 : pp(0, 0, 0), ee(t1) {}
32 inline HepLorentzVector:: HepLorentzVector()
33 : pp(0, 0, 0), ee(0) {}
35 inline HepLorentzVector::HepLorentzVector(
const Hep3Vector & p,
double e1)
38 inline HepLorentzVector::HepLorentzVector(
double e1,
const Hep3Vector & p)
41 inline HepLorentzVector::HepLorentzVector(
const HepLorentzVector & p)
42 : pp(p.x(), p.y(), p.z()), ee(p.t()) {}
44 inline HepLorentzVector::~HepLorentzVector() {}
46 inline HepLorentzVector::operator
const Hep3Vector & ()
const {
return pp;}
47 inline HepLorentzVector::operator Hep3Vector & () {
return pp; }
49 inline void HepLorentzVector::setX(
double a) { pp.setX(a); }
50 inline void HepLorentzVector::setY(
double a) { pp.setY(a); }
51 inline void HepLorentzVector::setZ(
double a) { pp.setZ(a); }
52 inline void HepLorentzVector::setT(
double a) { ee = a;}
54 inline double HepLorentzVector::px()
const {
return pp.x(); }
55 inline double HepLorentzVector::py()
const {
return pp.y(); }
56 inline double HepLorentzVector::pz()
const {
return pp.z(); }
57 inline double HepLorentzVector::e()
const {
return ee; }
59 inline void HepLorentzVector::setPx(
double a) { pp.setX(a); }
60 inline void HepLorentzVector::setPy(
double a) { pp.setY(a); }
61 inline void HepLorentzVector::setPz(
double a) { pp.setZ(a); }
62 inline void HepLorentzVector::setE(
double a) { ee = a;}
64 inline Hep3Vector HepLorentzVector::vect()
const {
return pp; }
65 inline void HepLorentzVector::setVect(
const Hep3Vector &p) { pp = p; }
67 inline double HepLorentzVector::theta()
const {
return pp.theta(); }
68 inline double HepLorentzVector::cosTheta()
const {
return pp.cosTheta(); }
69 inline double HepLorentzVector::phi()
const {
return pp.phi(); }
70 inline double HepLorentzVector::rho()
const {
return pp.mag(); }
72 inline void HepLorentzVector::setTheta(
double a) { pp.setTheta(a); }
73 inline void HepLorentzVector::setPhi(
double a) { pp.setPhi(a); }
74 inline void HepLorentzVector::setRho(
double a) { pp.setMag(a); }
76 double & HepLorentzVector::operator [] (
int i) {
return (*
this)(i); }
77 double HepLorentzVector::operator [] (
int i)
const {
return (*
this)(i); }
79 inline HepLorentzVector &
80 HepLorentzVector::operator = (
const HepLorentzVector & q) {
86 inline HepLorentzVector
88 return HepLorentzVector(x()+q.x(), y()+q.y(), z()+q.z(), t()+q.t());
91 inline HepLorentzVector &
92 HepLorentzVector::operator += (
const HepLorentzVector & q) {
98 inline HepLorentzVector
100 return HepLorentzVector(x()-q.x(), y()-q.y(), z()-q.z(), t()-q.t());
103 inline HepLorentzVector &
104 HepLorentzVector::operator -= (
const HepLorentzVector & q) {
111 return HepLorentzVector(-x(), -y(), -z(), -t());
114 inline HepLorentzVector& HepLorentzVector::operator *= (
double a) {
121 HepLorentzVector::operator == (
const HepLorentzVector & q)
const {
122 return (vect()==q.vect() && t()==q.t());
126 HepLorentzVector::operator != (
const HepLorentzVector & q)
const {
127 return (vect()!=q.vect() || t()!=q.t());
130 inline double HepLorentzVector::perp2()
const {
return pp.perp2(); }
131 inline double HepLorentzVector::perp()
const {
return pp.perp(); }
132 inline void HepLorentzVector::setPerp(
double a) { pp.setPerp(a); }
134 inline double HepLorentzVector::perp2(
const Hep3Vector &v1)
const {
138 inline double HepLorentzVector::perp(
const Hep3Vector &v1)
const {
142 inline double HepLorentzVector::angle(
const Hep3Vector &v1)
const {
146 inline double HepLorentzVector::mag2()
const {
147 return metric*(t()*t() - pp.mag2());
150 inline double HepLorentzVector::mag()
const {
152 return mmm < 0.0 ? -std::sqrt(-mmm) :
std::sqrt(mmm);
155 inline double HepLorentzVector::m2()
const {
156 return t()*t() - pp.mag2();
159 inline double HepLorentzVector::m()
const {
return mag(); }
161 inline double HepLorentzVector::mt2()
const {
162 return e()*e() - pz()*pz();
165 inline double HepLorentzVector::mt()
const {
167 return mmm < 0.0 ? -std::sqrt(-mmm) :
std::sqrt(mmm);
170 inline double HepLorentzVector::et2()
const {
171 double pt2 = pp.perp2();
172 return pt2 == 0 ? 0 : e()*e() * pt2/(pt2+z()*z());
175 inline double HepLorentzVector::et()
const {
177 return e() < 0.0 ? -std::sqrt(etet) :
std::sqrt(etet);
180 inline double HepLorentzVector::et2(
const Hep3Vector & v1)
const {
181 double pt2 = pp.perp2(v1);
182 double pv = pp.dot(v1.unit());
183 return pt2 == 0 ? 0 : e()*e() * pt2/(pt2+pv*pv);
186 inline double HepLorentzVector::et(
const Hep3Vector & v1)
const {
187 double etet = et2(v1);
188 return e() < 0.0 ? -std::sqrt(etet) :
std::sqrt(etet);
192 HepLorentzVector::setVectMag(
const Hep3Vector & spatial,
double magnitude) {
194 setT(std::sqrt(magnitude * magnitude + spatial * spatial));
198 HepLorentzVector::setVectM(
const Hep3Vector & spatial,
double mass) {
199 setVectMag(spatial, mass);
203 return metric*(t()*q.t() - z()*q.z() - y()*q.y() - x()*q.x());
211 inline double HepLorentzVector::plus()
const {
215 inline double HepLorentzVector::minus()
const {
219 inline HepLorentzVector & HepLorentzVector::boost(
const Hep3Vector & b) {
220 return boost(b.x(), b.y(), b.z());
223 inline double HepLorentzVector::pseudoRapidity()
const {
224 return pp.pseudoRapidity();
227 inline double HepLorentzVector::eta()
const {
228 return pp.pseudoRapidity();
231 inline double HepLorentzVector::eta(
const Hep3Vector & ref )
const {
232 return pp.eta( ref );
235 inline HepLorentzVector &
236 HepLorentzVector::operator *= (
const HepRotation & m1) {
241 inline HepLorentzVector &
242 HepLorentzVector::transform(
const HepRotation & m1) {
247 inline HepLorentzVector
operator * (
const HepLorentzVector & p,
double a) {
248 return HepLorentzVector(a*p.x(), a*p.y(), a*p.z(), a*p.t());
251 inline HepLorentzVector
operator * (
double a,
const HepLorentzVector & p) {
252 return HepLorentzVector(a*p.x(), a*p.y(), a*p.z(), a*p.t());
257 inline HepLorentzVector::HepLorentzVector(
258 double x1,
double y1,
double z1, Tcomponent t1 ) :
259 pp(x1, y1, z1), ee(t1) {}
261 inline void HepLorentzVector::set(
262 double x1,
double y1,
double z1, Tcomponent t1 ) {
267 inline void HepLorentzVector::set(
268 double x1,
double y1,
double z1,
double t1 ) {
269 set (x1,y1,z1,Tcomponent(t1));
272 inline HepLorentzVector::HepLorentzVector(
273 Tcomponent t1,
double x1,
double y1,
double z1 ) :
274 pp(x1, y1, z1), ee(t1) {}
276 inline void HepLorentzVector::set(
277 Tcomponent t1,
double x1,
double y1,
double z1 ) {
282 inline void HepLorentzVector::set( Tcomponent t1 ) {
287 inline void HepLorentzVector::set(
double t1 ) {
292 inline HepLorentzVector::HepLorentzVector( Tcomponent t1 ) :
293 pp(0, 0, 0), ee(t1) {}
295 inline void HepLorentzVector::set(
const Hep3Vector & v1 ) {
300 inline HepLorentzVector::HepLorentzVector(
const Hep3Vector & v1 ) :
303 inline void HepLorentzVector::setV(
const Hep3Vector & v1) {
307 inline HepLorentzVector & HepLorentzVector::operator=(
const Hep3Vector & v1) {
313 inline double HepLorentzVector::getX()
const {
return pp.x(); }
314 inline double HepLorentzVector::getY()
const {
return pp.y(); }
315 inline double HepLorentzVector::getZ()
const {
return pp.z(); }
316 inline double HepLorentzVector::getT()
const {
return ee; }
318 inline Hep3Vector HepLorentzVector::getV()
const {
return pp; }
319 inline Hep3Vector HepLorentzVector::v()
const {
return pp; }
321 inline void HepLorentzVector::set(
double t1,
const Hep3Vector & v1) {
326 inline void HepLorentzVector::set(
const Hep3Vector & v1,
double t1) {
331 inline void HepLorentzVector::setV(
double x1,
333 double z1 ) { pp.set(x1, y1, z1); }
335 inline void HepLorentzVector::setRThetaPhi
336 (
double r,
double ttheta,
double phi1 )
337 { pp.setRThetaPhi( r, ttheta, phi1 ); }
339 inline void HepLorentzVector::setREtaPhi
340 (
double r,
double eta1,
double phi1 )
341 { pp.setREtaPhi( r, eta1, phi1 ); }
343 inline void HepLorentzVector::setRhoPhiZ
344 (
double rho1,
double phi1,
double z1 )
345 { pp.setRhoPhiZ ( rho1, phi1, z1 ); }
347 inline bool HepLorentzVector::isTimelike()
const {
348 return restMass2() > 0;
351 inline bool HepLorentzVector::isSpacelike()
const {
352 return restMass2() < 0;
355 inline bool HepLorentzVector::isLightlike(
double epsilon)
const {
356 return std::fabs(restMass2()) < 2.0 * epsilon * ee * ee;
359 inline double HepLorentzVector::diff2(
const HepLorentzVector & w )
const {
360 return metric*( (ee-w.ee)*(ee-w.ee) - (pp-w.pp).mag2() );
363 inline double HepLorentzVector::delta2Euclidean
364 (
const HepLorentzVector & w )
const {
365 return (ee-w.ee)*(ee-w.ee) + (pp-w.pp).mag2();
368 inline double HepLorentzVector::euclideanNorm2()
const {
369 return ee*ee + pp.mag2();
372 inline double HepLorentzVector::euclideanNorm()
const {
373 return std::sqrt(euclideanNorm2());
376 inline double HepLorentzVector::restMass2()
const {
return m2(); }
377 inline double HepLorentzVector::invariantMass2()
const {
return m2(); }
379 inline double HepLorentzVector::restMass()
const {
380 if( t() < 0.0 ) ZMthrowC(ZMxpvNegativeMass(
381 "E^2-p^2 < 0 for this particle. Magnitude returned."));
382 return t() < 0.0 ? -m() : m();
385 inline double HepLorentzVector::invariantMass()
const {
386 if( t() < 0.0 ) ZMthrowC(ZMxpvNegativeMass(
387 "E^2-p^2 < 0 for this particle. Magnitude returned."));
388 return t() < 0.0 ? -m() : m();
391 inline double HepLorentzVector::invariantMass2
392 (
const HepLorentzVector & w)
const {
393 return (*
this + w).m2();
403 (
const HepLorentzVector & vec,
double bbeta) {
404 HepLorentzVector vv (vec);
405 return vv.boostX (bbeta);
409 (
const HepLorentzVector & vec,
double bbeta) {
410 HepLorentzVector vv (vec);
411 return vv.boostY (bbeta);
415 (
const HepLorentzVector & vec,
double bbeta) {
416 HepLorentzVector vv (vec);
417 return vv.boostZ (bbeta);
420 inline HepLorentzVector
boostOf 421 (
const HepLorentzVector & vec,
const Hep3Vector & betaVector ) {
422 HepLorentzVector vv (vec);
423 return vv.boost (betaVector);
426 inline HepLorentzVector
boostOf 427 (
const HepLorentzVector & vec,
const Hep3Vector & aaxis,
double bbeta) {
428 HepLorentzVector vv (vec);
429 return vv.boost (aaxis, bbeta);
HepLorentzVector operator*(double a, const HepLorentzVector &p)
Hep3Vector operator-(const Hep3Vector &a, const Hep3Vector &b)
HepLorentzVector boostXOf(const HepLorentzVector &vec, double bbeta)
HepLorentzVector boostYOf(const HepLorentzVector &vec, double bbeta)
std::complex< double > dot(const SphericalHarmonicCoefficientSet &a, const SphericalHarmonicCoefficientSet &b)
Hep3Vector operator+(const Hep3Vector &a, const Hep3Vector &b)
HepLorentzVector boostZOf(const HepLorentzVector &vec, double bbeta)
HepLorentzVector boostOf(const HepLorentzVector &vec, const Hep3Vector &aaxis, double bbeta)