Vector4.hh
#ifndef RIVET_MATH_VECTOR4
#define RIVET_MATH_VECTOR4
#include "Rivet/Math/MathHeader.hh"
#include "Rivet/Math/MathUtils.hh"
#include "Rivet/Math/VectorN.hh"
#include "Rivet/Math/Vector3.hh"
namespace Rivet {
class FourVector;
class FourMomentum;
class LorentzTransform;
typedef FourVector Vector4;
FourVector transform(const LorentzTransform& lt, const FourVector& v4);
class FourVector : public Vector<4> {
friend FourVector multiply(const double a, const FourVector& v);
friend FourVector multiply(const FourVector& v, const double a);
friend FourVector add(const FourVector& a, const FourVector& b);
friend FourVector transform(const LorentzTransform& lt, const FourVector& v4);
public:
FourVector() : Vector<4>() { }
template<typename V4>
FourVector(const V4& other) {
this->setT(other.t());
this->setX(other.x());
this->setY(other.y());
this->setZ(other.z());
}
FourVector(const Vector<4>& other)
: Vector<4>(other) { }
FourVector(const double t, const double x, const double y, const double z) {
this->setT(t);
this->setX(x);
this->setY(y);
this->setZ(z);
}
virtual ~FourVector() { }
public:
double t() const { return get(0); }
double x() const { return get(1); }
double y() const { return get(2); }
double z() const { return get(3); }
FourVector& setT(const double t) { set(0, t); return *this; }
FourVector& setX(const double x) { set(1, x); return *this; }
FourVector& setY(const double y) { set(2, y); return *this; }
FourVector& setZ(const double z) { set(3, z); return *this; }
double invariant() const {
// Done this way for numerical precision
return (t() + z())*(t() - z()) - x()*x() - y()*y();
}
double angle(const FourVector& v) const {
return vector3().angle( v.vector3() );
}
double angle(const Vector3& v3) const {
return vector3().angle(v3);
}
double polarRadius2() const {
return vector3().polarRadius2();
}
double perp2() const {
return vector3().perp2();
}
double rho2() const {
return vector3().rho2();
}
double polarRadius() const {
return vector3().polarRadius();
}
double perp() const {
return vector3().perp();
}
double rho() const {
return vector3().rho();
}
double azimuthalAngle(const PhiMapping mapping = ZERO_2PI) const {
return vector3().azimuthalAngle(mapping);
}
double phi(const PhiMapping mapping = ZERO_2PI) const {
return vector3().phi(mapping);
}
double polarAngle() const {
return vector3().polarAngle();
}
double theta() const {
return vector3().theta();
}
double pseudorapidity() const {
return vector3().pseudorapidity();
}
double eta() const {
return vector3().eta();
}
Vector3 vector3() const {
return Vector3(get(1), get(2), get(3));
}
public:
double contract(const FourVector& v) const {
const double result = t()*v.t() - x()*v.x() - y()*v.y() - z()*v.z();
return result;
}
double dot(const FourVector& v) const {
return contract(v);
}
double operator*(const FourVector& v) const {
return contract(v);
}
FourVector& operator*=(double a) {
_vec = multiply(a, *this)._vec;
return *this;
}
FourVector& operator/=(double a) {
_vec = multiply(1.0/a, *this)._vec;
return *this;
}
FourVector& operator+=(const FourVector& v) {
_vec = add(*this, v)._vec;
return *this;
}
FourVector& operator-=(const FourVector& v) {
_vec = add(*this, -v)._vec;
return *this;
}
FourVector operator-() const {
FourVector result;
result._vec = -_vec;
return result;
}
};
inline double contract(const FourVector& a, const FourVector& b) {
return a.contract(b);
}
inline double dot(const FourVector& a, const FourVector& b) {
return contract(a, b);
}
inline FourVector multiply(const double a, const FourVector& v) {
FourVector result;
result._vec = a * v._vec;
return result;
}
inline FourVector multiply(const FourVector& v, const double a) {
return multiply(a, v);
}
inline FourVector operator*(const double a, const FourVector& v) {
return multiply(a, v);
}
inline FourVector operator*(const FourVector& v, const double a) {
return multiply(a, v);
}
inline FourVector operator/(const FourVector& v, const double a) {
return multiply(1.0/a, v);
}
inline FourVector add(const FourVector& a, const FourVector& b) {
FourVector result;
result._vec = a._vec + b._vec;
return result;
}
inline FourVector operator+(const FourVector& a, const FourVector& b) {
return add(a, b);
}
inline FourVector operator-(const FourVector& a, const FourVector& b) {
return add(a, -b);
}
inline double invariant(const FourVector& lv) {
return lv.invariant();
}
inline double angle(const FourVector& a, const FourVector& b) {
return a.angle(b);
}
inline double angle(const Vector3& a, const FourVector& b) {
return angle( a, b.vector3() );
}
inline double angle(const FourVector& a, const Vector3& b) {
return a.angle(b);
}
inline double polarRadius2(const FourVector& v) {
return v.polarRadius2();
}
inline double perp2(const FourVector& v) {
return v.perp2();
}
inline double rho2(const FourVector& v) {
return v.rho2();
}
inline double polarRadius(const FourVector& v) {
return v.polarRadius();
}
inline double perp(const FourVector& v) {
return v.perp();
}
inline double rho(const FourVector& v) {
return v.rho();
}
inline double azimuthalAngle(const FourVector& v, const PhiMapping mapping = ZERO_2PI) {
return v.azimuthalAngle(mapping);
}
inline double phi(const FourVector& v, const PhiMapping mapping = ZERO_2PI) {
return v.phi(mapping);
}
inline double polarAngle(const FourVector& v) {
return v.polarAngle();
}
inline double theta(const FourVector& v) {
return v.theta();
}
inline double pseudorapidity(const FourVector& v) {
return v.pseudorapidity();
}
inline double eta(const FourVector& v) {
return v.eta();
}
class FourMomentum : public FourVector {
friend FourMomentum multiply(const double a, const FourMomentum& v);
friend FourMomentum multiply(const FourMomentum& v, const double a);
friend FourMomentum add(const FourMomentum& a, const FourMomentum& b);
friend FourMomentum transform(const LorentzTransform& lt, const FourMomentum& v4);
public:
FourMomentum() { }
template<typename V4>
FourMomentum(const V4& other) {
this->setE(other.t());
this->setPx(other.x());
this->setPy(other.y());
this->setPz(other.z());
}
FourMomentum(const Vector<4>& other)
: FourVector(other) { }
FourMomentum(const double E, const double px, const double py, const double pz) {
this->setE(E);
this->setPx(px);
this->setPy(py);
this->setPz(pz);
}
~FourMomentum() {}
public:
double E() const { return t(); }
Vector3 p() const { return vector3(); }
double px() const { return x(); }
double py() const { return y(); }
double pz() const { return z(); }
FourMomentum& setE(double E) { setT(E); return *this; }
FourMomentum& setPx(double px) { setX(px); return *this; }
FourMomentum& setPy(double py) { setY(py); return *this; }
FourMomentum& setPz(double pz) { setZ(pz); return *this; }
double mass() const {
// assert(Rivet::isZero(mass2()) || mass2() > 0);
// if (Rivet::isZero(mass2())) {
// return 0.0;
// } else {
// return sqrt(mass2());
// }
return sign(mass2()) * sqrt(fabs(mass2()));
}
double mass2() const {
return invariant();
}
double rapidity() const {
return 0.5 * std::log( (E() + pz()) / (E() - pz()) );
}
double pT2() const {
return vector3().polarRadius2();
}
double pT() const {
return sqrt(pT2());
}
double Et2() const {
return Et() * Et();
}
double Et() const {
return E() * sin(polarAngle());
}
Vector3 boostVector() const {
// const Vector3 p3 = vector3();
// const double m2 = mass2();
// if (Rivet::isZero(m2)) return p3.unit();
// else {
// // Could also do this via beta = tanh(rapidity), but that's
// // probably more messy from a numerical hygiene point of view.
// const double p2 = p3.mod2();
// const double beta = sqrt( p2 / (m2 + p2) );
// return beta * p3.unit();
// }
return Vector3(px()/E(), py()/E(), pz()/E());
}
struct byEAscending {
bool operator()(const FourMomentum& left, const FourMomentum& right) const{
double pt2left = left.E();
double pt2right = right.E();
return pt2left < pt2right;
}
bool operator()(const FourMomentum* left, const FourMomentum* right) const{
return (*this)(left, right);
}
};
struct byEDescending {
bool operator()(const FourMomentum& left, const FourMomentum& right) const{
return byEAscending()(right, left);
}
bool operator()(const FourMomentum* left, const FourVector* right) const{
return (*this)(left, right);
}
};
FourMomentum& operator*=(double a) {
_vec = multiply(a, *this)._vec;
return *this;
}
FourMomentum& operator/=(double a) {
_vec = multiply(1.0/a, *this)._vec;
return *this;
}
FourMomentum& operator+=(const FourMomentum& v) {
_vec = add(*this, v)._vec;
return *this;
}
FourMomentum& operator-=(const FourMomentum& v) {
_vec = add(*this, -v)._vec;
return *this;
}
FourMomentum operator-() const {
FourMomentum result;
result._vec = -_vec;
return result;
}
};
inline FourMomentum multiply(const double a, const FourMomentum& v) {
FourMomentum result;
result._vec = a * v._vec;
return result;
}
inline FourMomentum multiply(const FourMomentum& v, const double a) {
return multiply(a, v);
}
inline FourMomentum operator*(const double a, const FourMomentum& v) {
return multiply(a, v);
}
inline FourMomentum operator*(const FourMomentum& v, const double a) {
return multiply(a, v);
}
inline FourMomentum operator/(const FourMomentum& v, const double a) {
return multiply(1.0/a, v);
}
inline FourMomentum add(const FourMomentum& a, const FourMomentum& b) {
FourMomentum result;
result._vec = a._vec + b._vec;
return result;
}
inline FourMomentum operator+(const FourMomentum& a, const FourMomentum& b) {
return add(a, b);
}
inline FourMomentum operator-(const FourMomentum& a, const FourMomentum& b) {
return add(a, -b);
}
inline double mass(const FourMomentum& v) {
return v.mass();
}
inline double mass2(const FourMomentum& v) {
return v.mass2();
}
inline double rapidity(const FourMomentum& v) {
return v.rapidity();
}
inline double pT2(const FourMomentum& v) {
return v.pT2();
}
inline double pT(const FourMomentum& v) {
return v.pT();
}
inline double Et2(const FourMomentum& v) {
return v.Et2();}
inline double Et(const FourMomentum& v) {
return v.Et();
}
inline Vector3 boostVector(const FourMomentum& v) {
return v.boostVector();
}
inline double deltaR(const FourVector& a, const FourVector& b,
RapScheme scheme = PSEUDORAPIDITY) {
switch (scheme) {
case PSEUDORAPIDITY :
return deltaR(a.vector3(), b.vector3());
case RAPIDITY:
{
const FourMomentum* ma = dynamic_cast<const FourMomentum*>(&a);
const FourMomentum* mb = dynamic_cast<const FourMomentum*>(&b);
if (!ma || !mb) {
string err = "deltaR with scheme RAPIDITY can only be called with FourMomentum objects, not FourVectors";
throw std::runtime_error(err);
}
return deltaR(*ma, *mb, scheme);
}
default:
throw std::runtime_error("The specified deltaR scheme is not yet implemented");
}
}
inline double deltaR(const FourVector& v,
double eta2, double phi2,
RapScheme scheme = PSEUDORAPIDITY) {
switch (scheme) {
case PSEUDORAPIDITY :
return deltaR(v.vector3(), eta2, phi2);
case RAPIDITY:
{
const FourMomentum* mv = dynamic_cast<const FourMomentum*>(&v);
if (!mv) {
string err = "deltaR with scheme RAPIDITY can only be called with FourMomentum objects, not FourVectors";
throw std::runtime_error(err);
}
return deltaR(*mv, eta2, phi2, scheme);
}
default:
throw std::runtime_error("The specified deltaR scheme is not yet implemented");
}
}
inline double deltaR(double eta1, double phi1,
const FourVector& v,
RapScheme scheme = PSEUDORAPIDITY) {
switch (scheme) {
case PSEUDORAPIDITY :
return deltaR(eta1, phi1, v.vector3());
case RAPIDITY:
{
const FourMomentum* mv = dynamic_cast<const FourMomentum*>(&v);
if (!mv) {
string err = "deltaR with scheme RAPIDITY can only be called with FourMomentum objects, not FourVectors";
throw std::runtime_error(err);
}
return deltaR(eta1, phi1, *mv, scheme);
}
default:
throw std::runtime_error("The specified deltaR scheme is not yet implemented");
}
}
inline double deltaR(const FourMomentum& a, const FourMomentum& b,
RapScheme scheme = PSEUDORAPIDITY) {
switch (scheme) {
case PSEUDORAPIDITY:
return deltaR(a.vector3(), b.vector3());
case RAPIDITY:
return deltaR(a.rapidity(), a.azimuthalAngle(), b.rapidity(), b.azimuthalAngle());
default:
throw std::runtime_error("The specified deltaR scheme is not yet implemented");
}
}
inline double deltaR(const FourMomentum& v,
double eta2, double phi2,
RapScheme scheme = PSEUDORAPIDITY) {
switch (scheme) {
case PSEUDORAPIDITY:
return deltaR(v.vector3(), eta2, phi2);
case RAPIDITY:
return deltaR(v.rapidity(), v.azimuthalAngle(), eta2, phi2);
default:
throw std::runtime_error("The specified deltaR scheme is not yet implemented");
}
}
inline double deltaR(double eta1, double phi1,
const FourMomentum& v,
RapScheme scheme = PSEUDORAPIDITY) {
switch (scheme) {
case PSEUDORAPIDITY:
return deltaR(eta1, phi1, v.vector3());
case RAPIDITY:
return deltaR(eta1, phi1, v.rapidity(), v.azimuthalAngle());
default:
throw std::runtime_error("The specified deltaR scheme is not yet implemented");
}
}
inline double deltaR(const FourMomentum& a, const FourVector& b,
RapScheme scheme = PSEUDORAPIDITY) {
switch (scheme) {
case PSEUDORAPIDITY:
return deltaR(a.vector3(), b.vector3());
case RAPIDITY:
return deltaR(a.rapidity(), a.azimuthalAngle(), FourMomentum(b).rapidity(), b.azimuthalAngle());
default:
throw std::runtime_error("The specified deltaR scheme is not yet implemented");
}
}
inline double deltaR(const FourVector& a, const FourMomentum& b,
RapScheme scheme = PSEUDORAPIDITY) {
switch (scheme) {
case PSEUDORAPIDITY:
return deltaR(a.vector3(), b.vector3());
case RAPIDITY:
return deltaR(FourMomentum(a).rapidity(), a.azimuthalAngle(), b.rapidity(), b.azimuthalAngle());
default:
throw std::runtime_error("The specified deltaR scheme is not yet implemented");
}
}
inline double deltaR(const FourMomentum& a, const Vector3& b) {
return deltaR(a.vector3(), b);
}
inline double deltaR(const Vector3& a, const FourMomentum& b) {
return deltaR(a, b.vector3());
}
inline double deltaR(const FourVector& a, const Vector3& b) {
return deltaR(a.vector3(), b);
}
inline double deltaR(const Vector3& a, const FourVector& b) {
return deltaR(a, b.vector3());
}
inline double deltaPhi(const FourMomentum& a, const FourMomentum& b) {
return deltaPhi(a.vector3(), b.vector3());
}
inline double deltaPhi(const FourMomentum& v, double phi2) {
return deltaPhi(v.vector3(), phi2);
}
inline double deltaPhi(double phi1, const FourMomentum& v) {
return deltaPhi(phi1, v.vector3());
}
inline double deltaPhi(const FourVector& a, const FourVector& b) {
return deltaPhi(a.vector3(), b.vector3());
}
inline double deltaPhi(const FourVector& v, double phi2) {
return deltaPhi(v.vector3(), phi2);
}
inline double deltaPhi(double phi1, const FourVector& v) {
return deltaPhi(phi1, v.vector3());
}
inline double deltaPhi(const FourVector& a, const FourMomentum& b) {
return deltaPhi(a.vector3(), b.vector3());
}
inline double deltaPhi(const FourMomentum& a, const FourVector& b) {
return deltaPhi(a.vector3(), b.vector3());
}
inline double deltaPhi(const FourVector& a, const Vector3& b) {
return deltaPhi(a.vector3(), b);
}
inline double deltaPhi(const Vector3& a, const FourVector& b) {
return deltaPhi(a, b.vector3());
}
inline double deltaPhi(const FourMomentum& a, const Vector3& b) {
return deltaPhi(a.vector3(), b);
}
inline double deltaPhi(const Vector3& a, const FourMomentum& b) {
return deltaPhi(a, b.vector3());
}
inline double deltaEta(const FourMomentum& a, const FourMomentum& b) {
return deltaEta(a.vector3(), b.vector3());
}
inline double deltaEta(const FourMomentum& v, double eta2) {
return deltaEta(v.vector3(), eta2);
}
inline double deltaEta(double eta1, const FourMomentum& v) {
return deltaEta(eta1, v.vector3());
}
inline double deltaEta(const FourVector& a, const FourVector& b) {
return deltaEta(a.vector3(), b.vector3());
}
inline double deltaEta(const FourVector& v, double eta2) {
return deltaEta(v.vector3(), eta2);
}
inline double deltaEta(double eta1, const FourVector& v) {
return deltaEta(eta1, v.vector3());
}
inline double deltaEta(const FourVector& a, const FourMomentum& b) {
return deltaEta(a.vector3(), b.vector3());
}
inline double deltaEta(const FourMomentum& a, const FourVector& b) {
return deltaEta(a.vector3(), b.vector3());
}
inline double deltaEta(const FourVector& a, const Vector3& b) {
return deltaEta(a.vector3(), b);
}
inline double deltaEta(const Vector3& a, const FourVector& b) {
return deltaEta(a, b.vector3());
}
inline double deltaEta(const FourMomentum& a, const Vector3& b) {
return deltaEta(a.vector3(), b);
}
inline double deltaEta(const Vector3& a, const FourMomentum& b) {
return deltaEta(a, b.vector3());
}
inline std::string toString(const FourVector& lv) {
ostringstream out;
out << "(" << (fabs(lv.t()) < 1E-30 ? 0.0 : lv.t())
<< "; " << (fabs(lv.x()) < 1E-30 ? 0.0 : lv.x())
<< ", " << (fabs(lv.y()) < 1E-30 ? 0.0 : lv.y())
<< ", " << (fabs(lv.z()) < 1E-30 ? 0.0 : lv.z())
<< ")";
return out.str();
}
inline std::ostream& operator<<(std::ostream& out, const FourVector& lv) {
out << toString(lv);
return out;
}
}
#endif
Rivet::FourMomentum::setPy
FourMomentum & setPy(double py)
Set y-component of momentum .
Definition: Vector4.hh:376
Rivet
Definition: MC_JetAnalysis.hh:9
Rivet::boostVector
Vector3 boostVector(const FourMomentum &v)
Calculate the velocity boost vector of a momentum 4-vector.
Definition: Vector4.hh:573
Rivet::FourVector::angle
double angle(const Vector3 &v3) const
Angle between this vector and another (3-vector)
Definition: Vector4.hh:72
Rivet::FourMomentum::operator+=
FourMomentum & operator+=(const FourMomentum &v)
Subtract from this 4-vector. NB time as well as space components are subtracted.
Definition: Vector4.hh:478
Rivet::rapidity
double rapidity(double E, double pz)
Calculate a rapidity value from the supplied energy E and longitudinal momentum pz.
Definition: MathUtils.hh:481
Rivet::FourMomentum::setPz
FourMomentum & setPz(double pz)
Set z-component of momentum .
Definition: Vector4.hh:379
Rivet::FourVector::operator*=
FourVector & operator*=(double a)
Multiply by a scalar.
Definition: Vector4.hh:163
Rivet::FourMomentum::boostVector
Vector3 boostVector() const
Calculate the boost vector (in units of ).
Definition: Vector4.hh:425
Rivet::theta
double theta(const Vector3 &v)
Synonym for polarAngle.
Definition: Vector3.hh:290
Rivet::perp
double perp(const Vector3 &v)
Synonym for polarRadius.
Definition: Vector3.hh:266
Rivet::FourMomentum::E
double E() const
Get energy (time component of momentum).
Definition: Vector4.hh:355
Rivet::FourVector::angle
double angle(const FourVector &v) const
Angle between this vector and another.
Definition: Vector4.hh:67
Rivet::FourVector::polarRadius2
double polarRadius2() const
Square of the projection of the 3-vector on to the plane This is a more efficient function than pola...
Definition: Vector4.hh:79
Rivet::FourVector::eta
double eta() const
Synonym for pseudorapidity.
Definition: Vector4.hh:134
Rivet::Et2
double Et2(const FourMomentum &v)
Calculate the transverse energy squared, of a momentum 4-vector.
Definition: Vector4.hh:564
Rivet::FourVector::dot
double dot(const FourVector &v) const
Contract two 4-vectors, with metric signature (+ - - -).
Definition: Vector4.hh:153
Rivet::FourMomentum::operator*=
FourMomentum & operator*=(double a)
Multiply by a scalar.
Definition: Vector4.hh:466
Rivet::FourMomentum::setE
FourMomentum & setE(double E)
Set energy (time component of momentum).
Definition: Vector4.hh:370
Rivet::FourVector::vector3
Vector3 vector3() const
Get the spatial part of the 4-vector as a 3-vector.
Definition: Vector4.hh:139
Rivet::phi
double phi(const Vector3 &v, const PhiMapping mapping=ZERO_2PI)
Synonym for azimuthalAngle.
Definition: Vector3.hh:281
Rivet::polarRadius
double polarRadius(const Vector3 &v)
Calculate transverse length of a 3-vector.
Definition: Vector3.hh:262
Rivet::FourVector::polarRadius
double polarRadius() const
Projection of 3-vector on to the plane.
Definition: Vector4.hh:94
Rivet::FourMomentum::mass2
double mass2() const
Get the squared mass (the Lorentz self-invariant).
Definition: Vector4.hh:395
Rivet::Vector3::rho
double rho() const
Synonym for polarRadius.
Definition: Vector3.hh:118
Rivet::FourVector::phi
double phi(const PhiMapping mapping=ZERO_2PI) const
Synonym for azimuthalAngle.
Definition: Vector4.hh:114
Rivet::polarRadius2
double polarRadius2(const Vector3 &v)
Calculate transverse length sq. of a 3-vector.
Definition: Vector3.hh:249
Rivet::FourVector::rho2
double rho2() const
Synonym for polarRadius2.
Definition: Vector4.hh:89
Rivet::FourMomentum::operator-=
FourMomentum & operator-=(const FourMomentum &v)
Subtract from this 4-vector. NB time as well as space components are subtracted.
Definition: Vector4.hh:484
Rivet::Vector3::pseudorapidity
double pseudorapidity() const
Definition: Vector3.hh:151
Rivet::FourMomentum::pT
double pT() const
Calculate the transverse momentum .
Definition: Vector4.hh:410
Rivet::FourVector::perp2
double perp2() const
Synonym for polarRadius2.
Definition: Vector4.hh:84
Rivet::FourVector::polarAngle
double polarAngle() const
Angle subtended by the 3-vector and the z-axis.
Definition: Vector4.hh:119
Rivet::FourVector::perp
double perp() const
Synonym for polarRadius.
Definition: Vector4.hh:99
Rivet::FourVector::rho
double rho() const
Synonym for polarRadius.
Definition: Vector4.hh:104
Rivet::FourMomentum::setPx
FourMomentum & setPx(double px)
Set x-component of momentum .
Definition: Vector4.hh:373
Rivet::FourMomentum::byEAscending
Struct for sorting by increasing energy.
Definition: Vector4.hh:441
Rivet::Vector3::rho2
double rho2() const
Synonym for polarRadius2.
Definition: Vector3.hh:104
Rivet::Vector3::perp
double perp() const
Synonym for polarRadius.
Definition: Vector3.hh:113
Rivet::PhiMapping
PhiMapping
Enum for range of to be mapped into.
Definition: MathHeader.hh:63
Rivet::Vector3::phi
double phi(const PhiMapping mapping=ZERO_2PI) const
Synonym for azimuthalAngle.
Definition: Vector3.hh:133
Rivet::FourMomentum::py
double py() const
Get y-component of momentum .
Definition: Vector4.hh:364
Rivet::FourMomentum::mass
double mass() const
Get the mass (the Lorentz self-invariant).
Definition: Vector4.hh:384
Rivet::polarAngle
double polarAngle(const Vector3 &v)
Calculate polar angle of a 3-vector.
Definition: Vector3.hh:286
Rivet::azimuthalAngle
double azimuthalAngle(const Vector3 &v, const PhiMapping mapping=ZERO_2PI)
Calculate azimuthal angle of a 3-vector. Returns a number in (-pi, pi] or in [0, 2pi) according to th...
Definition: Vector3.hh:277
Rivet::Vector< 4 >::set
Vector< N > & set(const size_t index, const double value)
Set indexed value.
Definition: VectorN.hh:52
Rivet::LorentzTransform
Object implementing Lorentz transform calculations and boosts.
Definition: LorentzTrans.hh:21
Rivet::rho
double rho(const Vector3 &v)
Synonym for polarRadius.
Definition: Vector3.hh:270
Rivet::angle
double angle(const Vector3 &a, const Vector3 &b)
Angle (in radians) between two 3-vectors.
Definition: Vector3.hh:244
Rivet::FourVector
Specialisation of VectorN to a general (non-momentum) Lorentz 4-vector.
Definition: Vector4.hh:20
Rivet::FourVector::contract
double contract(const FourVector &v) const
Contract two 4-vectors, with metric signature (+ - - -).
Definition: Vector4.hh:147
Rivet::invariant
double invariant(const FourVector &lv)
Definition: Vector4.hh:244
Rivet::FourMomentum::p
Vector3 p() const
Get 3-momentum part, .
Definition: Vector4.hh:358
Rivet::Vector
A minimal base class for -dimensional vectors.
Definition: VectorN.hh:13
Rivet::FourMomentum::pT2
double pT2() const
Calculate the squared transverse momentum .
Definition: Vector4.hh:405
Rivet::FourVector::pseudorapidity
double pseudorapidity() const
Pseudorapidity (defined purely by the 3-vector components)
Definition: Vector4.hh:129
Rivet::Vector3::polarAngle
double polarAngle() const
Angle subtended by the vector and the z-axis.
Definition: Vector3.hh:138
Rivet::Vector3::theta
double theta() const
Synonym for polarAngle.
Definition: Vector3.hh:145
Rivet::FourVector::operator*
double operator*(const FourVector &v) const
Contract two 4-vectors, with metric signature (+ - - -).
Definition: Vector4.hh:158
Rivet::RapScheme
RapScheme
Enum for rapidity variable to be used in calculating , applying rapidity cuts, etc.
Definition: MathHeader.hh:60
Rivet::FourMomentum::operator/=
FourMomentum & operator/=(double a)
Divide by a scalar.
Definition: Vector4.hh:472
Rivet::Vector3::perp2
double perp2() const
Synonym for polarRadius2.
Definition: Vector3.hh:99
Rivet::sign
int sign(double val)
Find the sign of a number.
Definition: MathUtils.hh:187
Rivet::Et
double Et(const FourMomentum &v)
Calculate the transverse energy of a momentum 4-vector.
Definition: Vector4.hh:568
Rivet::FourMomentum::operator-
FourMomentum operator-() const
Multiply all components (time and space) by -1.
Definition: Vector4.hh:490
Rivet::FourMomentum::Et
double Et() const
Calculate the transverse energy .
Definition: Vector4.hh:420
Rivet::FourMomentum::px
double px() const
Get x-component of momentum .
Definition: Vector4.hh:361
Rivet::toString
std::string toString(const AnalysisInfo &ai)
String representation.
Definition: AnalysisInfo.cc:234
Rivet::eta
double eta(const Vector3 &v)
Synonym for pseudorapidity.
Definition: Vector3.hh:299
Rivet::FourVector::operator-=
FourVector & operator-=(const FourVector &v)
Subtract from this 4-vector. NB time as well as space components are subtracted.
Definition: Vector4.hh:181
Rivet::FourVector::azimuthalAngle
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:109
Rivet::Vector3::azimuthalAngle
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:123
Rivet::mass
double mass(const FourMomentum &v)
Get the mass (the Lorentz self-invariant) of a momentum 4-vector.
Definition: Vector4.hh:539
Rivet::Vector3
Three-dimensional specialisation of Vector.
Definition: Vector3.hh:26
Rivet::pT2
double pT2(const FourMomentum &v)
Calculate the squared transverse momentum of a momentum 4-vector.
Definition: Vector4.hh:554
Rivet::rho2
double rho2(const Vector3 &v)
Synonym for polarRadius2.
Definition: Vector3.hh:257
Rivet::FourVector::operator+=
FourVector & operator+=(const FourVector &v)
Add to this 4-vector.
Definition: Vector4.hh:175
Rivet::FourMomentum::byEDescending
Struct for sorting by decreasing energy.
Definition: Vector4.hh:454
Rivet::Vector3::eta
double eta() const
Synonym for pseudorapidity.
Definition: Vector3.hh:156
Rivet::operator<<
std::ostream & operator<<(std::ostream &os, const AnalysisInfo &ai)
Stream an AnalysisInfo as a text description.
Definition: AnalysisInfo.hh:239
Rivet::FourMomentum::pz
double pz() const
Get z-component of momentum .
Definition: Vector4.hh:367
Rivet::FourMomentum::Et2
double Et2() const
Calculate the transverse energy .
Definition: Vector4.hh:415
Rivet::FourVector::operator/=
FourVector & operator/=(double a)
Divide by a scalar.
Definition: Vector4.hh:169
Rivet::FourMomentum::rapidity
double rapidity() const
Calculate the rapidity.
Definition: Vector4.hh:400
Rivet::FourMomentum
Specialized version of the FourVector with momentum/energy functionality.
Definition: Vector4.hh:324
Rivet::pT
double pT(const FourMomentum &v)
Calculate the transverse momentum of a momentum 4-vector.
Definition: Vector4.hh:559
Rivet::contract
double contract(const FourVector &a, const FourVector &b)
Contract two 4-vectors, with metric signature (+ - - -).
Definition: Vector4.hh:197
Rivet::perp2
double perp2(const Vector3 &v)
Synonym for polarRadius2.
Definition: Vector3.hh:253
Rivet::pseudorapidity
double pseudorapidity(const Vector3 &v)
Calculate pseudorapidity of a 3-vector.
Definition: Vector3.hh:295
Rivet::mass2
double mass2(const FourMomentum &v)
Get the squared mass (the Lorentz self-invariant) of a momentum 4-vector.
Definition: Vector4.hh:544
Rivet::FourVector::operator-
FourVector operator-() const
Multiply all components (space and time) by -1.
Definition: Vector4.hh:187
Rivet::FourVector::theta
double theta() const
Synonym for polarAngle.
Definition: Vector4.hh:124