rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.0
JetFinder.hh
1// -*- C++ -*-
2#ifndef RIVET_JetFinder_HH
3#define RIVET_JetFinder_HH
4
5#include "Rivet/Projection.hh"
6#include "Rivet/Projections/FinalState.hh"
7#include "Rivet/Projections/VisibleFinalState.hh"
8#include "Rivet/Particle.hh"
9#include "Rivet/Jet.hh"
10
11namespace Rivet {
12
13
15 enum class JetMuons { NONE, DECAY, ALL };
16
18 enum class JetInvisibles { NONE, DECAY, ALL };
19
20
21
23 class JetFinder : public Projection {
24 public:
25
28 JetMuons usemuons = JetMuons::ALL,
29 JetInvisibles useinvis = JetInvisibles::NONE);
30
32 JetFinder() = default;
33
35 virtual unique_ptr<Projection> clone() const = 0;
36
38 virtual ~JetFinder() = default;
39
41 using Projection::operator =;
42
43
49
56 void useMuons(JetMuons usemuons = JetMuons::ALL) {
57 _useMuons = usemuons;
58 }
59
66 void useInvisibles(JetInvisibles useinvis = JetInvisibles::DECAY) {
67 _useInvisibles = useinvis;
68 }
69
71
72
75
78 virtual Jets jets(const Cut& c=Cuts::open()) const {
79 return select(_jets(), c);
80 }
81
84 virtual Jets jets(const JetSelector& selector) const {
85 return select(_jets(), selector);
86 }
87
88
91 Jets jets(const Cut& c, const JetSorter& sorter) const {
93 return sortBy(jets(c), sorter);
94 }
95
98 Jets jets(const JetSorter& sorter, const Cut& c=Cuts::open()) const {
100 return jets(c, sorter);
101 }
102
105 Jets jets(const JetSelector& selector, const JetSorter& sorter) const {
107 return sortBy(jets(selector), sorter);
108 }
109
112 Jets jets(const JetSorter& sorter, const JetSelector selector) const {
113 return jets(selector, sorter);
114 }
115
116
122 Jets jetsByPt(const Cut& c=Cuts::open()) const {
123 return jets(c, cmpMomByPt);
124 }
125
131 Jets jetsByPt(const JetSelector& selector) const {
132 return jets(selector, cmpMomByPt);
133 }
134
136
137
138 protected:
139
141 virtual Jets _jets() const = 0;
142
143
144 public:
145
147 size_t size() const { return jets().size(); }
149 size_t size(const Cut& c) const { return jets(c).size(); }
151 size_t size(const JetSelector& s) const { return jets(s).size(); }
152
154 bool empty() const { return size() == 0; }
156 bool empty(const Cut& c) const { return size(c) == 0; }
158 bool empty(const JetSelector& s) const { return size(s) == 0; }
159
161 virtual void reset() = 0;
162
163 typedef Jet entity_type;
164 typedef Jets collection_type;
165
167 collection_type entities() const { return jets(); }
168
169 // /// Do the calculation locally (no caching).
170 // virtual void calc(const Particles& constituents, const Particles& tagparticles=Particles()) = 0;
171
172
173 protected:
174
176 virtual void project(const Event& e) = 0;
177
179 virtual CmpState compare(const Projection& p) const = 0;
180
181
182 protected:
183
185 JetMuons _useMuons;
186
188 JetInvisibles _useInvisibles;
189
190
191 };
192
193
194}
195
196#endif
Representation of a HepMC event, and enabler of Projection caching.
Definition Event.hh:22
Project out all final-state particles in an event. Probably the most important projection in Rivet!
Definition FinalState.hh:12
Abstract base class for projections which can return a set of Jets.
Definition JetFinder.hh:23
Jets jetsByPt(const Cut &c=Cuts::open()) const
Definition JetFinder.hh:122
size_t size(const Cut &c) const
Count the jets after a Cut is applied.
Definition JetFinder.hh:149
virtual CmpState compare(const Projection &p) const =0
Compare projections.
virtual void project(const Event &e)=0
Perform the projection on the Event.
size_t size() const
Count the jets.
Definition JetFinder.hh:147
size_t size(const JetSelector &s) const
Count the jets after a selection functor is applied.
Definition JetFinder.hh:151
Jets jets(const JetSelector &selector, const JetSorter &sorter) const
Definition JetFinder.hh:105
Jets jets(const Cut &c, const JetSorter &sorter) const
Definition JetFinder.hh:91
virtual Jets jets(const Cut &c=Cuts::open()) const
Definition JetFinder.hh:78
JetFinder(const FinalState &fs, JetMuons usemuons=JetMuons::ALL, JetInvisibles useinvis=JetInvisibles::NONE)
Constructor.
virtual Jets jets(const JetSelector &selector) const
Definition JetFinder.hh:84
virtual unique_ptr< Projection > clone() const =0
Clone on the heap.
void useMuons(JetMuons usemuons=JetMuons::ALL)
Include (some) muons in jet construction.
Definition JetFinder.hh:56
bool empty(const JetSelector &s) const
Is this jet finder empty after a selection functor is applied?
Definition JetFinder.hh:158
Jets jets(const JetSorter &sorter, const JetSelector selector) const
Definition JetFinder.hh:112
Jets jetsByPt(const JetSelector &selector) const
Definition JetFinder.hh:131
Jets jets(const JetSorter &sorter, const Cut &c=Cuts::open()) const
Definition JetFinder.hh:98
virtual ~JetFinder()=default
Destructor.
virtual void reset()=0
Clear the projection.
bool empty(const Cut &c) const
Is this jet finder empty after a Cut is applied?
Definition JetFinder.hh:156
collection_type entities() const
Template-usable interface common to FinalState.
Definition JetFinder.hh:167
void useInvisibles(JetInvisibles useinvis=JetInvisibles::DECAY)
Include (some) invisible particles in jet construction.
Definition JetFinder.hh:66
bool empty() const
Is this jet finder empty?
Definition JetFinder.hh:154
JetFinder()=default
Default constructor.
Representation of a clustered jet of particles.
Definition Jet.hh:42
Specialised vector of Jet objects.
Definition Jet.hh:21
Base class for all Rivet projections.
Definition Projection.hh:29
Jets select(const Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
Definition JetUtils.hh:152
function< bool(const Jet &)> JetSelector
std::function instantiation for functors taking a Jet and returning a bool
Definition JetUtils.hh:41
function< bool(const Jet &, const Jet &)> JetSorter
std::function instantiation for functors taking two Jets and returning a bool
Definition JetUtils.hh:43
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:1415
bool cmpMomByPt(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by decreasing pT.
Definition Vector4.hh:1320
const Cut & open()
Fully open cut singleton, accepts everything.
Definition MC_CENT_PPB_Projections.hh:10
JetInvisibles
Enum for the treatment of invisible particles: whether to include all, some, or none in jet-finding.
Definition JetFinder.hh:18
JetMuons
Enum for the treatment of muons: whether to include all, some, or none in jet-finding.
Definition JetFinder.hh:15