1#ifndef RIVET_MATH_VECTOR4
2#define RIVET_MATH_VECTOR4
4#include "Rivet/Tools/TypeTraits.hh"
5#include "Rivet/Math/MathConstants.hh"
6#include "Rivet/Math/MathUtils.hh"
7#include "Rivet/Math/VectorN.hh"
8#include "Rivet/Math/Vector3.hh"
11namespace fastjet {
class PseudoJet; }
17 typedef FourVector Vector4;
18 typedef FourVector V4;
21 typedef FourMomentum P4;
23 class LorentzTransform;
24 FourVector transform(
const LorentzTransform& lt,
const FourVector& v4);
40 template<typename V4TYPE, typename std::enable_if<HasXYZT<V4TYPE>::value,
int>::type DUMMY=0>
42 this->setT(other.t());
43 this->setX(other.x());
44 this->setY(other.y());
45 this->setZ(other.z());
51 FourVector(
const double t,
const double x,
const double y,
const double z) {
64 operator fastjet::PseudoJet ()
const;
69 double t()
const {
return get(0); }
70 double t2()
const {
return sqr(t()); }
71 FourVector& setT(
const double t) { set(0, t);
return *
this; }
73 double x()
const {
return get(1); }
74 double x2()
const {
return sqr(x()); }
75 FourVector& setX(
const double x) {
set(1, x);
return *
this; }
77 double y()
const {
return get(2); }
78 double y2()
const {
return sqr(y()); }
79 FourVector& setY(
const double y) {
set(2, y);
return *
this; }
81 double z()
const {
return get(3); }
82 double z2()
const {
return sqr(z()); }
83 FourVector& setZ(
const double z) {
set(3, z);
return *
this; }
85 double invariant()
const {
87 return (t() + z())*(t() - z()) - x()*x() - y()*y();
178 return Vector3(get(1), get(2), get(3));
189 const double result = t()*v.t() - x()*v.x() - y()*v.y() - z()*v.z();
205 _vec = multiply(a, *
this)._vec;
211 _vec = multiply(1.0/a, *
this)._vec;
217 _vec = add(*
this, v)._vec;
223 _vec = add(*
this, -v)._vec;
237 result.setT(-result.t());
254 inline FourVector multiply(
const double a,
const FourVector& v) {
256 result._vec = a * v._vec;
260 inline FourVector multiply(
const FourVector& v,
const double a) {
261 return multiply(a, v);
264 inline FourVector operator * (
const double a,
const FourVector& v) {
265 return multiply(a, v);
268 inline FourVector operator * (
const FourVector& v,
const double a) {
269 return multiply(a, v);
272 inline FourVector operator / (
const FourVector& v,
const double a) {
273 return multiply(1.0/a, v);
276 inline FourVector add(
const FourVector& a,
const FourVector& b) {
278 result._vec = a._vec + b._vec;
282 inline FourVector operator+(
const FourVector& a,
const FourVector& b) {
286 inline FourVector operator-(
const FourVector& a,
const FourVector& b) {
293 return lv.invariant();
325 template<typename V4TYPE, typename std::enable_if<HasXYZT<V4TYPE>::value,
int>::type DUMMY=0>
327 this->
setE(other.t());
328 this->
setPx(other.x());
329 this->
setPy(other.y());
330 this->
setPz(other.z());
379 throw std::invalid_argument(
"Negative energy given as argument: " +
to_str(
E));
400 throw std::invalid_argument(
"Negative mass given as argument: " +
to_str(
mass));
417 throw std::invalid_argument(
"Negative mass given as argument");
419 throw std::invalid_argument(
"Negative energy given as argument");
420 const double theta = 2 * atan(exp(-
eta));
421 if (theta < 0 || theta > M_PI)
422 throw std::domain_error(
"Polar angle outside 0..pi in calculation");
433 throw std::invalid_argument(
"Negative mass given as argument");
435 throw std::invalid_argument(
"Negative transverse momentum given as argument");
436 const double theta = 2 * atan(exp(-
eta));
437 if (theta < 0 || theta > M_PI)
438 throw std::domain_error(
"Polar angle outside 0..pi in calculation");
455 throw std::invalid_argument(
"Negative mass given as argument");
457 throw std::invalid_argument(
"Negative energy given as argument");
458 const double sqrt_pt2_m2 =
E / cosh(y);
461 throw std::domain_error(
"Negative transverse momentum in calculation");
462 const double pz = sqrt_pt2_m2 * sinh(y);
463 const double px =
pt * cos(
phi);
464 const double py =
pt * sin(
phi);
475 throw std::invalid_argument(
"Negative mass given as argument");
477 throw std::invalid_argument(
"Negative transverse mass given as argument");
480 throw std::domain_error(
"Negative energy in calculation");
491 if (theta < 0 || theta > M_PI)
492 throw std::invalid_argument(
"Polar angle outside 0..pi given as argument");
494 throw std::invalid_argument(
"Negative mass given as argument");
496 throw std::invalid_argument(
"Negative energy given as argument");
501 throw std::invalid_argument(
"Negative transverse momentum in calculation");
502 const double px =
pt * cos(
phi);
503 const double py =
pt * sin(
phi);
514 if (theta < 0 || theta > M_PI)
515 throw std::invalid_argument(
"Polar angle outside 0..pi given as argument");
517 throw std::invalid_argument(
"Negative mass given as argument");
519 throw std::invalid_argument(
"Negative transverse momentum given as argument");
521 const double px =
pt * cos(
phi);
522 const double py =
pt * sin(
phi);
534 throw std::invalid_argument(
"Negative transverse momentum given as argument");
536 throw std::invalid_argument(
"Negative mass given as argument");
538 throw std::invalid_argument(
"Negative energy given as argument");
539 const double px =
pt * cos(
phi);
540 const double py =
pt * sin(
phi);
553 double E()
const {
return t(); }
555 double E2()
const {
return t2(); }
558 double px()
const {
return x(); }
560 double px2()
const {
return x2(); }
563 double py()
const {
return y(); }
565 double py2()
const {
return y2(); }
568 double pz()
const {
return z(); }
570 double pz2()
const {
return z2(); }
608 return 0.5 * std::log( (
E() +
pz()) / (
E() -
pz()) );
701 struct byEAscending {
703 const double pt2left = left.
E();
704 const double pt2right = right.
E();
705 return pt2left < pt2right;
708 bool operator()(
const FourMomentum* left,
const FourMomentum* right)
const{
709 return (*
this)(*left, *right);
716 struct byEDescending {
717 bool operator()(
const FourMomentum& left,
const FourMomentum& right)
const{
718 return byEAscending()(right, left);
721 bool operator()(
const FourMomentum* left,
const FourVector* right)
const{
722 return (*
this)(*left, *right);
737 _vec = multiply(a, *
this)._vec;
743 _vec = multiply(1.0/a, *
this)._vec;
749 _vec = add(*
this, v)._vec;
755 _vec = add(*
this, -v)._vec;
769 result.
setE(-result.
E());
833 inline FourMomentum multiply(
const double a,
const FourMomentum& v) {
835 result._vec = a * v._vec;
839 inline FourMomentum multiply(
const FourMomentum& v,
const double a) {
840 return multiply(a, v);
843 inline FourMomentum operator*(
const double a,
const FourMomentum& v) {
844 return multiply(a, v);
847 inline FourMomentum operator*(
const FourMomentum& v,
const double a) {
848 return multiply(a, v);
851 inline FourMomentum operator/(
const FourMomentum& v,
const double a) {
852 return multiply(1.0/a, v);
855 inline FourMomentum add(
const FourMomentum& a,
const FourMomentum& b) {
857 result._vec = a._vec + b._vec;
861 inline FourMomentum operator+(
const FourMomentum& a,
const FourMomentum& b) {
865 inline FourMomentum operator-(
const FourMomentum& a,
const FourMomentum& b) {
887 case PSEUDORAPIDITY :
894 string err =
"deltaR with scheme RAPIDITY can only be called with FourMomentum objects, not FourVectors";
895 throw std::runtime_error(err);
897 return deltaR2(*ma, *mb, scheme);
900 throw std::runtime_error(
"The specified deltaR scheme is not yet implemented");
914 return sqrt(
deltaR2(a, b, scheme));
926 double eta2,
double phi2,
929 case PSEUDORAPIDITY :
935 string err =
"deltaR with scheme RAPIDITY can only be called with FourMomentum objects, not FourVectors";
936 throw std::runtime_error(err);
938 return deltaR2(*mv, eta2, phi2, scheme);
941 throw std::runtime_error(
"The specified deltaR scheme is not yet implemented");
952 double eta2,
double phi2,
954 return sqrt(
deltaR2(v, eta2, phi2, scheme));
964 inline double deltaR2(
double eta1,
double phi1,
968 case PSEUDORAPIDITY :
974 string err =
"deltaR with scheme RAPIDITY can only be called with FourMomentum objects, not FourVectors";
975 throw std::runtime_error(err);
977 return deltaR2(eta1, phi1, *mv, scheme);
980 throw std::runtime_error(
"The specified deltaR scheme is not yet implemented");
990 inline double deltaR(
double eta1,
double phi1,
993 return sqrt(
deltaR2(eta1, phi1, v, scheme));
1006 case PSEUDORAPIDITY:
1011 throw std::runtime_error(
"The specified deltaR scheme is not yet implemented");
1023 return sqrt(
deltaR2(a, b, scheme));
1033 double eta2,
double phi2,
1036 case PSEUDORAPIDITY:
1041 throw std::runtime_error(
"The specified deltaR scheme is not yet implemented");
1051 double eta2,
double phi2,
1053 return sqrt(
deltaR2(v, eta2, phi2, scheme));
1066 case PSEUDORAPIDITY:
1071 throw std::runtime_error(
"The specified deltaR scheme is not yet implemented");
1080 inline double deltaR(
double eta1,
double phi1,
1083 return sqrt(
deltaR2(eta1, phi1, v, scheme));
1095 case PSEUDORAPIDITY:
1100 throw std::runtime_error(
"The specified deltaR scheme is not yet implemented");
1111 return sqrt(
deltaR2(a, b, scheme));
1132 return deltaR(b, a, scheme);
1357 return a.
pt() > b.
pt();
1361 return a.
pt() < b.
pt();
1375 return a.
Et() > b.
Et();
1379 return a.
Et() < b.
Et();
1384 return a.
E() > b.
E();
1388 return a.
E() < b.
E();
1402 return a.
eta() < b.
eta();
1412 return fabs(a.
eta()) < fabs(b.
eta());
1417 return fabs(a.
eta()) > fabs(b.
eta());
1444 template<
typename MOMS,
typename CMP>
1446 std::sort(pbs.begin(), pbs.end(),
cmp);
1450 template<
typename MOMS,
typename CMP>
1453 std::sort(rtn.begin(), rtn.end(),
cmp);
1458 template<
typename MOMS>
1463 template<
typename MOMS>
1469 template<
typename MOMS>
1474 template<
typename MOMS>
1480 template<
typename MOMS>
1485 template<
typename MOMS>
1498 return mT(vis.
p3(), invis.
p3());
1503 return mT(vis.
p3(), invis);
1508 return mT(vis, invis.
p3());
1522 std::ostringstream out;
1523 out <<
"(" << (fabs(lv.t()) < 1E-30 ? 0.0 : lv.t())
1524 <<
"; " << (fabs(lv.x()) < 1E-30 ? 0.0 : lv.x())
1525 <<
", " << (fabs(lv.y()) < 1E-30 ? 0.0 : lv.y())
1526 <<
", " << (fabs(lv.z()) < 1E-30 ? 0.0 : lv.z())
1542 typedef std::vector<FourMomentum> FourMomenta;
Specialized version of the FourVector with momentum/energy functionality.
Definition Vector4.hh:316
Specialisation of VectorN to a general (non-momentum) Lorentz 4-vector.
Definition Vector4.hh:30
Three-dimensional specialisation of Vector.
Definition Vector3.hh:40
Vector3 rhoVec() const
Synonym for polarVec.
Definition Vector3.hh:140
double polarRadius() const
Polar radius.
Definition Vector3.hh:158
double rho() const
Synonym for polarRadius.
Definition Vector3.hh:166
double eta() const
Synonym for pseudorapidity.
Definition Vector3.hh:219
double perp() const
Synonym for polarRadius.
Definition Vector3.hh:162
double perp2() const
Synonym for polarRadius2.
Definition Vector3.hh:149
double pseudorapidity() const
Purely geometric approximation to rapidity.
Definition Vector3.hh:212
Vector3 unit() const
Synonym for unitVec.
Definition Vector3.hh:124
double theta() const
Synonym for polarAngle.
Definition Vector3.hh:200
double phi(const PhiMapping mapping=ZERO_2PI) const
Synonym for azimuthalAngle.
Definition Vector3.hh:183
double polarRadius2() const
Square of the polar radius (.
Definition Vector3.hh:145
Vector3 perpVec() const
Synonym for polarVec.
Definition Vector3.hh:136
double azimuthalAngle(const PhiMapping mapping=ZERO_2PI) const
Angle subtended by the vector's projection in x-y and the x-axis.
Definition Vector3.hh:174
double rho2() const
Synonym for polarRadius2.
Definition Vector3.hh:153
double angle(const Vector3 &v) const
Angle in radians to another vector.
Definition Vector3.hh:108
double polarAngle() const
Angle subtended by the vector and the z-axis.
Definition Vector3.hh:193
Vector3 polarVec() const
Polar projection of this vector into the x-y plane.
Definition Vector3.hh:130
A minimal base class for -dimensional vectors.
Definition VectorN.hh:23
double mod() const
Calculate the modulus of a vector. .
Definition VectorN.hh:95
double mod2() const
Calculate the modulus-squared of a vector. .
Definition VectorN.hh:84
Vector< N > & set(const size_t index, const double value)
Set indexed value.
Definition VectorN.hh:60
MOMS & isortBy(MOMS &pbs, const CMP &cmp)
Sort a container of momenta by cmp and return by reference for non-const inputs.
Definition Vector4.hh:1445
MOMS & isortByE(MOMS &pbs)
Sort a container of momenta by E (decreasing) and return by reference for non-const inputs.
Definition Vector4.hh:1470
MOMS & isortByEt(MOMS &pbs)
Sort a container of momenta by Et (decreasing) and return by reference for non-const inputs.
Definition Vector4.hh:1481
bool cmpMomByDescEta(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by decreasing eta (pseudorapidity)
Definition Vector4.hh:1406
bool cmpMomByMass(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by decreasing mass.
Definition Vector4.hh:1392
bool cmpMomByP(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by decreasing 3-momentum magnitude |p|.
Definition Vector4.hh:1365
bool cmpMomByAscEt(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by increasing transverse energy.
Definition Vector4.hh:1378
bool cmpMomByRap(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by increasing rapidity.
Definition Vector4.hh:1421
bool cmpMomByE(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by decreasing energy.
Definition Vector4.hh:1383
MOMS sortBy(const MOMS &pbs, const CMP &cmp)
Sort a container of momenta by cmp and return by value for const inputs.
Definition Vector4.hh:1451
bool cmpMomByAbsRap(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by increasing absolute rapidity.
Definition Vector4.hh:1431
MOMS sortByPt(const MOMS &pbs)
Sort a container of momenta by pT (decreasing) and return by value for const inputs.
Definition Vector4.hh:1464
MOMS sortByEt(const MOMS &pbs)
Sort a container of momenta by Et (decreasing) and return by value for const inputs.
Definition Vector4.hh:1486
bool cmpMomByEt(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by decreasing transverse energy.
Definition Vector4.hh:1374
bool cmpMomByAscPt(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by increasing pT.
Definition Vector4.hh:1360
bool cmpMomByAscP(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by increasing 3-momentum magnitude |p|.
Definition Vector4.hh:1369
bool cmpMomByAscMass(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by increasing mass.
Definition Vector4.hh:1396
MOMS sortByE(const MOMS &pbs)
Sort a container of momenta by E (decreasing) and return by value for const inputs.
Definition Vector4.hh:1475
bool cmpMomByPt(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by decreasing pT.
Definition Vector4.hh:1356
bool cmpMomByAbsEta(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by increasing absolute eta (pseudorapidity)
Definition Vector4.hh:1411
bool cmpMomByDescAbsEta(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by increasing absolute eta (pseudorapidity)
Definition Vector4.hh:1416
bool cmpMomByEta(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by increasing eta (pseudorapidity)
Definition Vector4.hh:1401
bool cmpMomByAscE(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by increasing energy.
Definition Vector4.hh:1387
bool cmpMomByDescAbsRap(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by decreasing absolute rapidity.
Definition Vector4.hh:1436
MOMS & isortByPt(MOMS &pbs)
Sort a container of momenta by pT (decreasing) and return by reference for non-const inputs.
Definition Vector4.hh:1459
std::vector< FourVector > FourVectors
Definition Vector4.hh:1541
bool cmpMomByDescRap(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by decreasing rapidity.
Definition Vector4.hh:1426
FourVector operator-() const
Multiply all components (space and time) by -1.
Definition Vector4.hh:228
double p2() const
Get the modulus-squared of the 3-momentum.
Definition Vector4.hh:601
double E2() const
Get energy-squared .
Definition Vector4.hh:555
double mass() const
Get the mass (the Lorentz self-invariant).
Definition Vector4.hh:576
double pz2() const
Get z-squared .
Definition Vector4.hh:570
double rapidity() const
Calculate the rapidity.
Definition Vector4.hh:607
FourMomentum reverse() const
Multiply space components only by -1.
Definition Vector4.hh:767
double perp2() const
Synonym for polarRadius2.
Definition Vector4.hh:110
double px() const
Get x-component of momentum .
Definition Vector4.hh:558
FourMomentum & setPtPhiME(double pt, double phi, double mass, double E)
Definition Vector4.hh:532
FourMomentum & setRapPhiMPt(double y, double phi, double mass, double pt)
Definition Vector4.hh:473
Vector3 p3() const
Get 3-momentum part, .
Definition Vector4.hh:593
FourVector & operator/=(double a)
Divide by a scalar.
Definition Vector4.hh:210
double rho() const
Synonym for polarRadius.
Definition Vector4.hh:127
FourMomentum & setPz(double pz)
Set z-component of momentum .
Definition Vector4.hh:370
double p() const
Get the modulus of the 3-momentum.
Definition Vector4.hh:596
FourMomentum & setXYZE(double px, double py, double pz, double E)
Alias for setPE.
Definition Vector4.hh:384
static FourMomentum mkThetaPhiME(double theta, double phi, double mass, double E)
Make a vector from (theta,phi,energy) coordinates and the mass.
Definition Vector4.hh:813
Vector3 perpVec() const
Synonym for polarVec.
Definition Vector4.hh:136
Vector3 vector3() const
Get the spatial part of the 4-vector as a 3-vector.
Definition Vector4.hh:177
double angle(const FourVector &v) const
Angle between this vector and another.
Definition Vector4.hh:95
Vector3 gammaVec() const
Definition Vector4.hh:674
double pt() const
Calculate the transverse momentum .
Definition Vector4.hh:647
double phi(const PhiMapping mapping=ZERO_2PI) const
Synonym for azimuthalAngle.
Definition Vector4.hh:149
double contract(const FourVector &v) const
Contract two 4-vectors, with metric signature (+ - - -).
Definition Vector4.hh:188
FourMomentum & setPE(double px, double py, double pz, double E)
Set the p coordinates and energy simultaneously.
Definition Vector4.hh:377
double py() const
Get y-component of momentum .
Definition Vector4.hh:563
double abseta() const
Get the directly (alias).
Definition Vector4.hh:174
static FourMomentum mkRapPhiME(double y, double phi, double mass, double E)
Make a vector from (y,phi,energy) coordinates and the mass.
Definition Vector4.hh:803
double beta() const
Definition Vector4.hh:680
double Et() const
Calculate the transverse energy .
Definition Vector4.hh:656
double Et2() const
Calculate the transverse energy .
Definition Vector4.hh:652
double azimuthalAngle(const PhiMapping mapping=ZERO_2PI) const
Angle subtended by the 3-vector's projection in x-y and the x-axis.
Definition Vector4.hh:145
static FourMomentum mkXYZE(double px, double py, double pz, double E)
Make a vector from (px,py,pz,E) coordinates.
Definition Vector4.hh:783
FourMomentum & setPy(double py)
Set y-component of momentum .
Definition Vector4.hh:364
double rap() const
Alias for rapidity.
Definition Vector4.hh:611
FourMomentum & setPx(double px)
Set x-component of momentum .
Definition Vector4.hh:358
double pt2() const
Calculate the squared transverse momentum .
Definition Vector4.hh:638
double dot(const FourVector &v) const
Contract two 4-vectors, with metric signature (+ - - -).
Definition Vector4.hh:194
double perp() const
Synonym for polarRadius.
Definition Vector4.hh:123
static FourMomentum mkPtPhiME(double pt, double phi, double mass, double E)
Make a vector from (pT,phi,energy) coordinates and the mass.
Definition Vector4.hh:823
Vector3 pTvec() const
Calculate the transverse momentum vector .
Definition Vector4.hh:625
FourVector & operator*=(double a)
Multiply by a scalar.
Definition Vector4.hh:204
double operator*(const FourVector &v) const
Contract two 4-vectors, with metric signature (+ - - -).
Definition Vector4.hh:199
double eta() const
Synonym for pseudorapidity.
Definition Vector4.hh:167
FourMomentum & setRapPhiME(double y, double phi, double mass, double E)
Definition Vector4.hh:453
double theta() const
Synonym for polarAngle.
Definition Vector4.hh:158
Vector3 ptvec() const
Synonym for pTvec.
Definition Vector4.hh:629
double mass2() const
Get the squared mass (the Lorentz self-invariant).
Definition Vector4.hh:587
FourMomentum & setEtaPhiMPt(double eta, double phi, double mass, double pt)
Definition Vector4.hh:431
double pz() const
Get z-component of momentum .
Definition Vector4.hh:568
double pseudorapidity() const
Pseudorapidity (defined purely by the 3-vector components)
Definition Vector4.hh:163
double py2() const
Get y-squared .
Definition Vector4.hh:565
double absrap() const
Absolute rapidity.
Definition Vector4.hh:620
double pT2() const
Calculate the squared transverse momentum .
Definition Vector4.hh:634
double polarRadius() const
Magnitude of projection of 3-vector on to the plane.
Definition Vector4.hh:119
static FourMomentum mkEtaPhiME(double eta, double phi, double mass, double E)
Make a vector from (eta,phi,energy) coordinates and the mass.
Definition Vector4.hh:793
double px2() const
Get x-squared .
Definition Vector4.hh:560
Vector3 betaVec() const
Definition Vector4.hh:686
Vector3 rhoVec() const
Synonym for polarVec.
Definition Vector4.hh:140
double angle(const Vector3 &v3) const
Angle between this vector and another (3-vector)
Definition Vector4.hh:99
Vector3 polarVec() const
Projection of 3-vector on to the plane.
Definition Vector4.hh:132
double polarRadius2() const
Mod-square of the projection of the 3-vector on to the plane This is a more efficient function than ...
Definition Vector4.hh:106
FourVector reverse() const
Multiply space components only by -1.
Definition Vector4.hh:235
FourMomentum & operator-=(const FourMomentum &v)
Subtract from this 4-vector. NB time as well as space components are subtracted.
Definition Vector4.hh:754
static FourMomentum mkXYZM(double px, double py, double pz, double mass)
Make a vector from (px,py,pz) coordinates and the mass.
Definition Vector4.hh:788
FourMomentum & setThetaPhiME(double theta, double phi, double mass, double E)
Definition Vector4.hh:490
double E() const
Get energy (time component of momentum).
Definition Vector4.hh:553
FourMomentum & setXYZM(double px, double py, double pz, double mass)
Alias for setPM.
Definition Vector4.hh:406
FourMomentum & operator+=(const FourMomentum &v)
Add to this 4-vector. NB time as well as space components are added.
Definition Vector4.hh:748
static FourMomentum mkEtaPhiMPt(double eta, double phi, double mass, double pt)
Make a vector from (eta,phi,pT) coordinates and the mass.
Definition Vector4.hh:798
static FourMomentum mkRapPhiMPt(double y, double phi, double mass, double pt)
Make a vector from (y,phi,pT) coordinates and the mass.
Definition Vector4.hh:808
double pT() const
Calculate the transverse momentum .
Definition Vector4.hh:643
double polarAngle() const
Angle subtended by the 3-vector and the z-axis.
Definition Vector4.hh:154
FourVector & operator-=(const FourVector &v)
Subtract from this 4-vector. NB time as well as space components are subtracted.
Definition Vector4.hh:222
static FourMomentum mkThetaPhiMPt(double theta, double phi, double mass, double pt)
Make a vector from (theta,phi,pT) coordinates and the mass.
Definition Vector4.hh:818
double abspseudorapidity() const
Get the directly.
Definition Vector4.hh:172
FourVector & operator+=(const FourVector &v)
Add to this 4-vector.
Definition Vector4.hh:216
FourMomentum & setThetaPhiMPt(double theta, double phi, double mass, double pt)
Definition Vector4.hh:513
FourMomentum operator-() const
Multiply all components (time and space) by -1.
Definition Vector4.hh:760
double absrapidity() const
Absolute rapidity.
Definition Vector4.hh:616
FourMomentum & setEtaPhiME(double eta, double phi, double mass, double E)
Definition Vector4.hh:415
FourMomentum & operator/=(double a)
Divide by a scalar.
Definition Vector4.hh:742
double rho2() const
Synonym for polarRadius2.
Definition Vector4.hh:114
FourMomentum & setE(double E)
Set energy (time component of momentum).
Definition Vector4.hh:352
double gamma() const
Definition Vector4.hh:668
FourMomentum & operator*=(double a)
Multiply by a scalar.
Definition Vector4.hh:736
FourMomentum & setPM(double px, double py, double pz, double mass)
Set the p coordinates and mass simultaneously.
Definition Vector4.hh:398
string to_str(const T &x)
Convert any object to a string.
Definition Utils.hh:66
Definition MC_Cent_pPb.hh:10
double deltaR(double rap1, double phi1, double rap2, double phi2)
Definition MathUtils.hh:699
double deltaPhi(double phi1, double phi2, bool sign=false)
Calculate the difference between two angles in radians.
Definition MathUtils.hh:669
double deltaEta(double eta1, double eta2, bool sign=false)
Definition MathUtils.hh:677
PhiMapping
Enum for range of to be mapped into.
Definition MathConstants.hh:49
double deltaR2(double rap1, double phi1, double rap2, double phi2)
Definition MathUtils.hh:692
double mT(double pT1, double pT2, double dphi)
Definition MathUtils.hh:721
std::ostream & operator<<(std::ostream &os, const AnalysisInfo &ai)
Stream an AnalysisInfo as a text description.
Definition AnalysisInfo.hh:368
double invariant(const FourVector &lv)
Definition Vector4.hh:292
constexpr std::enable_if< std::is_arithmetic< NUM >::value, int >::type sign(NUM val)
Find the sign of a number.
Definition MathUtils.hh:266
double contract(const FourVector &a, const FourVector &b)
Contract two 4-vectors, with metric signature (+ - - -).
Definition Vector4.hh:245
RapScheme
Enum for rapidity variable to be used in calculating , applying rapidity cuts, etc.
Definition MathConstants.hh:46
double deltaRap(double y1, double y2, bool sign=false)
Definition MathUtils.hh:685
Cmp< T > cmp(const T &t1, const T &t2)
Global helper function for easy creation of Cmp objects.
Definition Cmp.hh:255
std::string toString(const AnalysisInfo &ai)
String representation.
std::enable_if< std::is_arithmetic< NUM >::value, NUM >::type sqr(NUM a)
Named number-type squaring operation.
Definition MathUtils.hh:219
std::enable_if< std::is_floating_point< NUM >::value, bool >::type isZero(NUM val, double tolerance=1e-8)
Compare a number to zero.
Definition MathUtils.hh:24
double angle(const Vector2 &a, const Vector2 &b)
Angle (in radians) between two 2-vectors.
Definition Vector2.hh:177
double rapidity(double E, double pz)
Calculate a rapidity value from the supplied energy E and longitudinal momentum pz.
Definition MathUtils.hh:704