JetAlg.hh
// -*- C++ -*-
#ifndef RIVET_JetAlg_HH
#define RIVET_JetAlg_HH
#include "Rivet/Projection.hh"
#include "Rivet/Projections/FinalState.hh"
#include "Rivet/Projections/VisibleFinalState.hh"
#include "Rivet/Particle.hh"
#include "Rivet/Jet.hh"
namespace Rivet {
inline bool cmpMomByPt(const FourMomentum& a, const FourMomentum& b) {
return a.pT() > b.pT();
}
inline bool cmpMomByAscPt(const FourMomentum& a, const FourMomentum& b) {
return a.pT() < b.pT();
}
inline bool cmpMomByP(const FourMomentum& a, const FourMomentum& b) {
return a.vector3().mod() > b.vector3().mod();
}
inline bool cmpMomByAscP(const FourMomentum& a, const FourMomentum& b) {
return a.vector3().mod() < b.vector3().mod();
}
inline bool cmpMomByEt(const FourMomentum& a, const FourMomentum& b) {
return a.Et() > b.Et();
}
inline bool cmpMomByAscEt(const FourMomentum& a, const FourMomentum& b) {
return a.Et() < b.Et();
}
inline bool cmpMomByE(const FourMomentum& a, const FourMomentum& b) {
return a.E() > b.E();
}
inline bool cmpMomByAscE(const FourMomentum& a, const FourMomentum& b) {
return a.E() < b.E();
}
inline bool cmpMomByDescPseudorapidity(const FourMomentum& a, const FourMomentum& b) {
return a.pseudorapidity() > b.pseudorapidity();
}
inline bool cmpMomByAscPseudorapidity(const FourMomentum& a, const FourMomentum& b) {
return a.pseudorapidity() < b.pseudorapidity();
}
inline bool cmpMomByDescAbsPseudorapidity(const FourMomentum& a, const FourMomentum& b) {
return fabs(a.pseudorapidity()) > fabs(b.pseudorapidity());
}
inline bool cmpMomByAscAbsPseudorapidity(const FourMomentum& a, const FourMomentum& b) {
return fabs(a.pseudorapidity()) < fabs(b.pseudorapidity());
}
inline bool cmpMomByDescRapidity(const FourMomentum& a, const FourMomentum& b) {
return a.rapidity() > b.rapidity();
}
inline bool cmpMomByAscRapidity(const FourMomentum& a, const FourMomentum& b) {
return a.rapidity() < b.rapidity();
}
inline bool cmpMomByDescAbsRapidity(const FourMomentum& a, const FourMomentum& b) {
return fabs(a.rapidity()) > fabs(b.rapidity());
}
inline bool cmpMomByAscAbsRapidity(const FourMomentum& a, const FourMomentum& b) {
return fabs(a.rapidity()) < fabs(b.rapidity());
}
class JetAlg : public Projection {
public:
JetAlg(const FinalState& fs);
JetAlg() {};
virtual const Projection* clone() const = 0;
virtual ~JetAlg() { }
void useInvisibles(bool useinvis=true) {
_useInvisibles = useinvis;
}
virtual Jets jets(double ptmin=0.0, double ptmax=MAXDOUBLE,
double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE,
RapScheme rapscheme=PSEUDORAPIDITY) const {
const Jets rawjets = _jets(ptmin);
Jets rtn;
MSG_DEBUG("Raw jet size (with pTmin cut = " << ptmin/GeV << "GeV) = " << rawjets.size());
foreach (const Jet& j, rawjets) {
const FourMomentum pj = j.momentum();
if (!inRange(pj.pT(), ptmin, ptmax)) continue;
if (rapscheme == PSEUDORAPIDITY && !inRange(pj.eta(), rapmin, rapmax)) continue;
if (rapscheme == RAPIDITY && !inRange(pj.rapidity(), rapmin, rapmax)) continue;
rtn += j;
}
return rtn;
}
template <typename F>
Jets jets(F sorter, double ptmin, double ptmax,
double rapmin, double rapmax,
RapScheme rapscheme) const {
Jets js = jets(ptmin, ptmax, rapmin, rapmax, rapscheme);
if (sorter != 0) {
std::sort(js.begin(), js.end(), sorter);
}
return js;
}
Jets jetsByPt(double ptmin=0.0, double ptmax=MAXDOUBLE,
double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE,
RapScheme rapscheme=PSEUDORAPIDITY) const {
return jets(cmpJetsByPt, ptmin, ptmax, rapmin, rapmax, rapscheme);
}
Jets jetsByP(double ptmin=0.0, double ptmax=MAXDOUBLE,
double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE,
RapScheme rapscheme=PSEUDORAPIDITY) const {
return jets(cmpJetsByP, ptmin, ptmax, rapmin, rapmax, rapscheme);
}
Jets jetsByE(double ptmin=0.0, double ptmax=MAXDOUBLE,
double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE,
RapScheme rapscheme=PSEUDORAPIDITY) const {
return jets(cmpJetsByE, ptmin, ptmax, rapmin, rapmax, rapscheme);
}
Jets jetsByEt(double ptmin=0.0, double ptmax=MAXDOUBLE,
double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE,
RapScheme rapscheme=PSEUDORAPIDITY) const {
return jets(cmpJetsByEt, ptmin, ptmax, rapmin, rapmax, rapscheme);
}
protected:
virtual Jets _jets(double ptmin) const = 0;
public:
virtual size_t size() const = 0;
virtual void reset() = 0;
typedef Jet entity_type;
typedef Jets collection_type;
collection_type entities() const { return jets(); }
virtual void calc(const ParticleVector& ps) = 0;
protected:
virtual void project(const Event& e) = 0;
virtual int compare(const Projection& p) const = 0;
protected:
bool _useInvisibles;
};
}
#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::JetAlg::entities
collection_type entities() const
Template-usable interface common to FinalState.
Definition: JetAlg.hh:174
Rivet
Definition: MC_JetAnalysis.hh:9
Rivet::JetAlg::project
virtual void project(const Event &e)=0
Perform the projection on the Event.
Rivet::inRange
bool inRange(NUM value, NUM low, NUM high, RangeBoundary lowbound=CLOSED, RangeBoundary highbound=OPEN)
Determine if value is in the range low to high, for floating point numbers.
Definition: MathUtils.hh:109
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::JetAlg::jetsByEt
Jets jetsByEt(double ptmin=0.0, double ptmax=MAXDOUBLE, double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE, RapScheme rapscheme=PSEUDORAPIDITY) const
Definition: JetAlg.hh:146
Rivet::FourVector::eta
double eta() const
Synonym for pseudorapidity.
Definition: Vector4.hh:134
Rivet::Jet::momentum
const FourMomentum & momentum() const
Get equivalent single momentum four-vector.
Definition: Jet.hh:105
Rivet::Jets
std::vector< Jet > Jets
Typedef for a collection of Jet objects.
Definition: Jet.hh:177
Rivet::JetAlg::reset
virtual void reset()=0
Clear the projection.
Rivet::FourMomentum::pT
double pT() const
Calculate the transverse momentum .
Definition: Vector4.hh:410
Rivet::JetAlg::jets
Jets jets(F sorter, double ptmin, double ptmax, double rapmin, double rapmax, RapScheme rapscheme) const
Definition: JetAlg.hh:110
Rivet::Event
Definition: Event.hh:22
Rivet::JetAlg::useInvisibles
void useInvisibles(bool useinvis=true)
Include invisible particles in jet construction. The default behaviour is that jets are only construc...
Definition: JetAlg.hh:85
Rivet::JetAlg::jetsByPt
Jets jetsByPt(double ptmin=0.0, double ptmax=MAXDOUBLE, double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE, RapScheme rapscheme=PSEUDORAPIDITY) const
Definition: JetAlg.hh:122
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::JetAlg::~JetAlg
virtual ~JetAlg()
Destructor.
Definition: JetAlg.hh:77
Rivet::JetAlg::jetsByE
Jets jetsByE(double ptmin=0.0, double ptmax=MAXDOUBLE, double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE, RapScheme rapscheme=PSEUDORAPIDITY) const
Definition: JetAlg.hh:138
Rivet::JetAlg::jets
virtual Jets jets(double ptmin=0.0, double ptmax=MAXDOUBLE, double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE, RapScheme rapscheme=PSEUDORAPIDITY) const
Definition: JetAlg.hh:91
Rivet::JetAlg::compare
virtual int compare(const Projection &p) const =0
Compare projections.
Rivet::FinalState
Project out all final-state particles in an event. Probably the most important projection in Rivet! ...
Definition: FinalState.hh:14
Rivet::RapScheme
RapScheme
Enum for rapidity variable to be used in calculating , applying rapidity cuts, etc.
Definition: MathHeader.hh:60
Rivet::JetAlg::size
virtual size_t size() const =0
Number of jets.
Rivet::JetAlg::calc
virtual void calc(const ParticleVector &ps)=0
Do the calculation locally (no caching).
Rivet::Jet
Representation of a clustered jet of particles.
Definition: Jet.hh:12
Rivet::JetAlg::jetsByP
Jets jetsByP(double ptmin=0.0, double ptmax=MAXDOUBLE, double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE, RapScheme rapscheme=PSEUDORAPIDITY) const
Definition: JetAlg.hh:130
Rivet::Projection
Base class for all Rivet projections.
Definition: Projection.hh:28
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::JetAlg
Abstract base class for projections which can return a set of Jets.
Definition: JetAlg.hh:65
Rivet::JetAlg::clone
virtual const Projection * clone() const =0
Clone on the heap.