Jet.hh
// -*- C++ -*-
#ifndef RIVET_Jet_HH
#define RIVET_Jet_HH
#include "Rivet/Rivet.hh"
#include <numeric>
namespace Rivet {
class Jet : public ParticleBase {
public:
Jet() : ParticleBase() { clear(); }
Jet(const vector<Particle>& particles, const FourMomentum& pjet)
: ParticleBase() {
setState(particles, pjet);
}
// /// Set all the jet data, without particle ID information.
// Jet(const vector<FourMomentum>& momenta, const FourMomentum& pjet)
// : ParticleBase() {
// setState(momenta, pjet);
// }
size_t size() const { return _particles.size(); }
// /// Define a Jet::iterator via a typedef.
// typedef vector<FourMomentum>::iterator iterator;
// /// Define a Jet::const_iterator via a typedef.
// typedef vector<FourMomentum>::const_iterator const_iterator;
// /// Get a begin iterator over the particle/track four-momenta in this jet.
// iterator begin() {
// return _momenta.begin();
// }
// /// Get an end iterator over the particle/track four-momenta in this jet.
// iterator end() {
// return _momenta.end();
// }
// /// Get a const begin iterator over the particle/track four-momenta in this jet.
// const_iterator begin() const {
// return _momenta.begin();
// }
// /// Get a const end iterator over the particle/track four-momenta in this jet.
// const_iterator end() const {
// return _momenta.end();
// }
// /// Get the track momenta in this jet.
// vector<FourMomentum>& momenta() {
// return _momenta;
// }
// /// Get the track momenta in this jet (const version).
// const vector<FourMomentum>& momenta() const {
// return _momenta;
// }
vector<Particle>& particles() { return _particles; }
const vector<Particle>& particles() const { return _particles; }
bool containsParticle(const Particle& particle) const;
bool containsParticleId(PdgId pid) const;
bool containsParticleId(const vector<PdgId>& pids) const;
bool containsCharm() const;
bool containsBottom() const;
const FourMomentum& momentum() const { return _momentum; }
double eta() const { return momentum().eta(); }
double phi() const { return momentum().phi(); }
double totalEnergy() const { return momentum().E(); }
double neutralEnergy() const;
double hadronicEnergy() const;
double ptSum() const { return momentum().pT(); }
double EtSum() const { return momentum().Et(); }
Jet& setState(const vector<Particle>& particles, const FourMomentum& pjet);
// /// Set all the jet data, without particle ID information.
// Jet& setState(const vector<FourMomentum>& momenta, const FourMomentum& pjet);
Jet& setMomentum(const FourMomentum& momentum);
Jet& setParticles(const vector<Particle>& particles);
// /// Set the particles collection with momentum information only.
// Jet& setParticles(const vector<FourMomentum>& momenta);
// /// Add a particle/track to this jet.
// Jet& addParticle(const FourMomentum& particle);
// /// Add a particle/track to this jet.
// Jet& addParticle(const Particle& particle);
Jet& clear();
private:
ParticleVector _particles;
// /// The particle momenta.
// /// @todo Eliminate this to ensure consistency.
// std::vector<FourMomentum> _momenta;
FourMomentum _momentum;
};
typedef std::vector<Jet> Jets;
inline bool cmpJetsByPt(const Jet& a, const Jet& b) {
return a.ptSum() > b.ptSum();
}
inline bool cmpJetsByAscPt(const Jet& a, const Jet& b) {
return a.ptSum() < b.ptSum();
}
inline bool cmpJetsByP(const Jet& a, const Jet& b) {
return a.momentum().vector3().mod() > b.momentum().vector3().mod();
}
inline bool cmpJetsByAscP(const Jet& a, const Jet& b) {
return a.momentum().vector3().mod() < b.momentum().vector3().mod();
}
// @brief Compare jets by \f$ E_\perp \f$ (descending - usual sorting for HEP)
inline bool cmpJetsByEt(const Jet& a, const Jet& b) {
return a.EtSum() > b.EtSum();
}
// @brief Compare jets by \f$ E_\perp \f$ (ascending)
inline bool cmpJetsByEtDesc(const Jet& a, const Jet& b) {
return a.EtSum() < b.EtSum();
}
inline bool cmpJetsByE(const Jet& a, const Jet& b) {
return a.momentum().E() > b.momentum().E();
}
inline bool cmpJetsByAscE(const Jet& a, const Jet& b) {
return a.momentum().E() < b.momentum().E();
}
inline bool cmpJetsByDescPseudorapidity(const Jet& a, const Jet& b) {
return a.momentum().pseudorapidity() > b.momentum().pseudorapidity();
}
inline bool cmpJetsByAscPseudorapidity(const Jet& a, const Jet& b) {
return a.momentum().pseudorapidity() < b.momentum().pseudorapidity();
}
inline bool cmpJetsByDescAbsPseudorapidity(const Jet& a, const Jet& b) {
return fabs(a.momentum().pseudorapidity()) > fabs(b.momentum().pseudorapidity());
}
inline bool cmpJetsByAscAbsPseudorapidity(const Jet& a, const Jet& b) {
return fabs(a.momentum().pseudorapidity()) < fabs(b.momentum().pseudorapidity());
}
inline bool cmpJetsByDescRapidity(const Jet& a, const Jet& b) {
return a.momentum().rapidity() > b.momentum().rapidity();
}
inline bool cmpJetsByAscRapidity(const Jet& a, const Jet& b) {
return a.momentum().rapidity() < b.momentum().rapidity();
}
inline bool cmpJetsByDescAbsRapidity(const Jet& a, const Jet& b) {
return fabs(a.momentum().rapidity()) > fabs(b.momentum().rapidity());
}
inline bool cmpJetsByAscAbsRapidity(const Jet& a, const Jet& b) {
return fabs(a.momentum().rapidity()) < fabs(b.momentum().rapidity());
}
inline double deltaR(const Jet& j1, const Jet& j2,
RapScheme scheme = PSEUDORAPIDITY) {
return deltaR(j1.momentum(), j2.momentum(), scheme);
}
inline double deltaR(const Jet& j, const Particle& p,
RapScheme scheme = PSEUDORAPIDITY) {
return deltaR(j.momentum(), p.momentum(), scheme);
}
inline double deltaR(const Particle& p, const Jet& j,
RapScheme scheme = PSEUDORAPIDITY) {
return deltaR(p.momentum(), j.momentum(), scheme);
}
inline double deltaR(const Jet& j, const FourMomentum& v,
RapScheme scheme = PSEUDORAPIDITY) {
return deltaR(j.momentum(), v, scheme);
}
inline double deltaR(const Jet& j, const FourVector& v,
RapScheme scheme = PSEUDORAPIDITY) {
return deltaR(j.momentum(), v, scheme);
}
inline double deltaR(const Jet& j, const Vector3& v) {
return deltaR(j.momentum(), v);
}
inline double deltaR(const Jet& j, double eta, double phi) {
return deltaR(j.momentum(), eta, phi);
}
inline double deltaR(const FourMomentum& v, const Jet& j,
RapScheme scheme = PSEUDORAPIDITY) {
return deltaR(v, j.momentum(), scheme);
}
inline double deltaR(const FourVector& v, const Jet& j,
RapScheme scheme = PSEUDORAPIDITY) {
return deltaR(v, j.momentum(), scheme);
}
inline double deltaR(const Vector3& v, const Jet& j) {
return deltaR(v, j.momentum());
}
inline double deltaR(double eta, double phi, const Jet& j) {
return deltaR(eta, phi, j.momentum());
}
inline double deltaPhi(const Jet& j1, const Jet& j2) {
return deltaPhi(j1.momentum(), j2.momentum());
}
inline double deltaPhi(const Jet& j, const Particle& p) {
return deltaPhi(j.momentum(), p.momentum());
}
inline double deltaPhi(const Particle& p, const Jet& j) {
return deltaPhi(p.momentum(), j.momentum());
}
inline double deltaPhi(const Jet& j, const FourMomentum& v) {
return deltaPhi(j.momentum(), v);
}
inline double deltaPhi(const Jet& j, const FourVector& v) {
return deltaPhi(j.momentum(), v);
}
inline double deltaPhi(const Jet& j, const Vector3& v) {
return deltaPhi(j.momentum(), v);
}
inline double deltaPhi(const Jet& j, double phi) {
return deltaPhi(j.momentum(), phi);
}
inline double deltaPhi(const FourMomentum& v, const Jet& j) {
return deltaPhi(v, j.momentum());
}
inline double deltaPhi(const FourVector& v, const Jet& j) {
return deltaPhi(v, j.momentum());
}
inline double deltaPhi(const Vector3& v, const Jet& j) {
return deltaPhi(v, j.momentum());
}
inline double deltaPhi(double phi, const Jet& j) {
return deltaPhi(phi, j.momentum());
}
inline double deltaEta(const Jet& j1, const Jet& j2) {
return deltaEta(j1.momentum(), j2.momentum());
}
inline double deltaEta(const Jet& j, const Particle& p) {
return deltaEta(j.momentum(), p.momentum());
}
inline double deltaEta(const Particle& p, const Jet& j) {
return deltaEta(p.momentum(), j.momentum());
}
inline double deltaEta(const Jet& j, const FourMomentum& v) {
return deltaEta(j.momentum(), v);
}
inline double deltaEta(const Jet& j, const FourVector& v) {
return deltaEta(j.momentum(), v);
}
inline double deltaEta(const Jet& j, const Vector3& v) {
return deltaEta(j.momentum(), v);
}
inline double deltaEta(const Jet& j, double eta) {
return deltaEta(j.momentum(), eta);
}
inline double deltaEta(const FourMomentum& v, const Jet& j) {
return deltaEta(v, j.momentum());
}
inline double deltaEta(const FourVector& v, const Jet& j) {
return deltaEta(v, j.momentum());
}
inline double deltaEta(const Vector3& v, const Jet& j) {
return deltaEta(v, j.momentum());
}
inline double deltaEta(double eta, const Jet& j) {
return deltaEta(eta, j.momentum());
}
}
#endif
Rivet::cmpJetsByEt
bool cmpJetsByEt(const Jet &a, const Jet &b)
Use this so that highest is at the front of the list.
Definition: Jet.hh:205
Rivet
Definition: MC_JetAnalysis.hh:9
Rivet::Jet::size
size_t size() const
Number of particles in this jet.
Definition: Jet.hh:39
Rivet::FourMomentum::pT
double pT() const
Calculate the transverse momentum .
Definition: Vector4.hh:410
Rivet::cmpJetsByAscRapidity
bool cmpJetsByAscRapidity(const Jet &a, const Jet &b)
Compare jets by (ascending) Use this so that lowest is at the front of the list.
Definition: Jet.hh:254
Rivet::FourVector::eta
double eta() const
Synonym for pseudorapidity.
Definition: Vector4.hh:134
Rivet::cmpJetsByAscE
bool cmpJetsByAscE(const Jet &a, const Jet &b)
Compare jets by (ascending) Use this so that lowest is at the front of the list.
Definition: Jet.hh:221
Rivet::cmpJetsByE
bool cmpJetsByE(const Jet &a, const Jet &b)
Compare jets by (descending - usual sorting for HEP) Use this so that highest is at the front of th...
Definition: Jet.hh:216
Rivet::cmpJetsByP
bool cmpJetsByP(const Jet &a, const Jet &b)
Compare jets by descending momentum, .
Definition: Jet.hh:195
Rivet::FourMomentum::Et
double Et() const
Calculate the transverse energy .
Definition: Vector4.hh:420
Rivet::Jet::containsParticleId
bool containsParticleId(PdgId pid) const
Check whether this jet contains a certain particle type.
Definition: Jet.cc:67
Rivet::Jet::neutralEnergy
double neutralEnergy() const
Get the energy carried in this jet by neutral particles.
Definition: Jet.cc:88
Rivet::cmpJetsByDescAbsRapidity
bool cmpJetsByDescAbsRapidity(const Jet &a, const Jet &b)
Compare jets by (descending) Use this so that highest is at the front of the list.
Definition: Jet.hh:260
Rivet::Jet::containsBottom
bool containsBottom() const
Check whether this jet contains a bottom-flavoured hadron (or decay products from one)...
Definition: Jet.cc:129
Rivet::Jets
std::vector< Jet > Jets
Typedef for a collection of Jet objects.
Definition: Jet.hh:177
Rivet::Jet::phi
double phi() const
Get the unweighted average for this jet. (caches)
Definition: Jet.hh:111
Rivet::Jet::particles
vector< Particle > & particles()
Get the particles in this jet.
Definition: Jet.hh:78
Rivet::Jet::Jet
Jet(const vector< Particle > &particles, const FourMomentum &pjet)
Set all the jet data, with full particle information.
Definition: Jet.hh:21
Rivet::FourMomentum::rapidity
double rapidity() const
Calculate the rapidity.
Definition: Vector4.hh:400
Rivet::Particle
Representation of particles from a HepMC::GenEvent.
Definition: Particle.hh:16
Rivet::FourVector::pseudorapidity
double pseudorapidity() const
Pseudorapidity (defined purely by the 3-vector components)
Definition: Vector4.hh:129
Rivet::Jet::setState
Jet & setState(const vector< Particle > &particles, const FourMomentum &pjet)
Set all the jet data, with full particle information.
Definition: Jet.cc:10
Rivet::cmpJetsByEtDesc
bool cmpJetsByEtDesc(const Jet &a, const Jet &b)
Use this so that lowest is at the front of the list.
Definition: Jet.hh:210
Rivet::cmpJetsByAscAbsRapidity
bool cmpJetsByAscAbsRapidity(const Jet &a, const Jet &b)
Compare jets by (ascending) Use this so that lowest is at the front of the list.
Definition: Jet.hh:265
Rivet::cmpJetsByAscPt
bool cmpJetsByAscPt(const Jet &a, const Jet &b)
Compare jets by (ascending) Use this so that lowest is at the front of the list.
Definition: Jet.hh:190
Rivet::Jet::clear
Jet & clear()
Reset this jet as empty.
Definition: Jet.cc:146
Rivet::cmpJetsByAscP
bool cmpJetsByAscP(const Jet &a, const Jet &b)
Compare jets by ascending momentum, .
Definition: Jet.hh:199
Rivet::cmpJetsByPt
bool cmpJetsByPt(const Jet &a, const Jet &b)
Compare jets by (descending - usual sorting for HEP) Use this so that highest is at the front of th...
Definition: Jet.hh:185
Rivet::Jet::setMomentum
Jet & setMomentum(const FourMomentum &momentum)
Set the effective 4-momentum of the jet.
Definition: Jet.cc:24
Rivet::Jet::momentum
const FourMomentum & momentum() const
Get equivalent single momentum four-vector.
Definition: Jet.hh:105
Rivet::Jet::eta
double eta() const
Get the unweighted average for this jet. (caches)
Definition: Jet.hh:108
Rivet::FourVector
Specialisation of VectorN to a general (non-momentum) Lorentz 4-vector.
Definition: Vector4.hh:20
Rivet::cmpJetsByDescRapidity
bool cmpJetsByDescRapidity(const Jet &a, const Jet &b)
Compare jets by (descending) Use this so that highest is at the front of the list.
Definition: Jet.hh:249
Rivet::Particle::momentum
const FourMomentum & momentum() const
The momentum of this Particle.
Definition: Particle.hh:68
Rivet::Jet::containsParticle
bool containsParticle(const Particle &particle) const
Check whether this jet contains a particular particle.
Definition: Jet.cc:58
Rivet::Jet::EtSum
double EtSum() const
Get the sum of the values of the constituent tracks. (caches)
Definition: Jet.hh:126
Rivet::cmpJetsByDescPseudorapidity
bool cmpJetsByDescPseudorapidity(const Jet &a, const Jet &b)
Compare jets by (descending) Use this so that highest is at the front of the list.
Definition: Jet.hh:227
Rivet::ParticleBase
Base class for particle-like things like Particle and Jet.
Definition: ParticleBase.hh:11
Rivet::Jet::particles
const vector< Particle > & particles() const
Get the particles in this jet (const version)
Definition: Jet.hh:81
Rivet::FourMomentum::E
double E() const
Get energy (time component of momentum).
Definition: Vector4.hh:355
Rivet::RapScheme
RapScheme
Enum for rapidity variable to be used in calculating , applying rapidity cuts, etc.
Definition: MathHeader.hh:60
Rivet::FourVector::vector3
Vector3 vector3() const
Get the spatial part of the 4-vector as a 3-vector.
Definition: Vector4.hh:139
Rivet::Jet::ptSum
double ptSum() const
Get the sum of the values of the constituent tracks. (caches)
Definition: Jet.hh:123
Rivet::Jet
Representation of a clustered jet of particles.
Definition: Jet.hh:12
Rivet::FourVector::phi
double phi(const PhiMapping mapping=ZERO_2PI) const
Synonym for azimuthalAngle.
Definition: Vector4.hh:114
Rivet::Vector3
Three-dimensional specialisation of Vector.
Definition: Vector3.hh:26
Rivet::Jet::setParticles
Jet & setParticles(const vector< Particle > &particles)
Set the particles collection with full particle information.
Definition: Jet.cc:30
Rivet::Jet::containsCharm
bool containsCharm() const
Check whether this jet contains a charm-flavoured hadron (or decay products from one).
Definition: Jet.cc:112
Rivet::cmpJetsByAscAbsPseudorapidity
bool cmpJetsByAscAbsPseudorapidity(const Jet &a, const Jet &b)
Compare jets by (ascending) Use this so that lowest is at the front of the list.
Definition: Jet.hh:243
Rivet::cmpJetsByAscPseudorapidity
bool cmpJetsByAscPseudorapidity(const Jet &a, const Jet &b)
Compare jets by (ascending) Use this so that lowest is at the front of the list.
Definition: Jet.hh:232
Rivet::FourMomentum
Specialized version of the FourVector with momentum/energy functionality.
Definition: Vector4.hh:324
Rivet::Jet::hadronicEnergy
double hadronicEnergy() const
Get the energy carried in this jet by hadrons.
Definition: Jet.cc:100
Rivet::Jet::totalEnergy
double totalEnergy() const
Get the total energy of this jet.
Definition: Jet.hh:114
Rivet::Vector::mod
double mod() const
Calculate the modulus of a vector. .
Definition: VectorN.hh:87
Rivet::cmpJetsByDescAbsPseudorapidity
bool cmpJetsByDescAbsPseudorapidity(const Jet &a, const Jet &b)
Compare jets by (descending) Use this so that highest is at the front of the list.
Definition: Jet.hh:238