Rivet API documentation

Rivet 4.1.3
JetFinder.hh
1// -*- C++ -*-
2#ifndef RIVET_JetFinder_HH
3#define RIVET_JetFinder_HH
4
5#include "Rivet/Jet.hh"
6#include "Rivet/Particle.hh"
7#include "Rivet/Projection.hh"
8#include "Rivet/Projections/FinalState.hh"
9#include "Rivet/Projections/VisibleFinalState.hh"
10
11namespace Rivet {
12
13
15 enum class JetMuons { NONE, DECAY, ALL };
16
18 enum class JetInvisibles { NONE, DECAY, ALL };
19
20
22 struct JetScheme {
23 JetScheme(JetAlg a,
24 double rparam,
25 JetMuons usemuons = JetMuons::ALL,
26 JetInvisibles useinvis = JetInvisibles::NONE)
27 : alg(a), R(rparam), muons(usemuons), invis(useinvis) { }
28
31 : JetScheme(JetAlg::ANTIKT, 0.4) { }
32
34 JetAlg alg;
35 double R;
36 JetMuons muons = JetMuons::ALL;
37 JetInvisibles invis = JetInvisibles::NONE;
38 };
39
40
42 class JetFinder : public Projection {
43 public:
44
47 JetMuons usemuons = JetMuons::ALL,
48 JetInvisibles useinvis = JetInvisibles::NONE);
49
51 JetFinder() = default;
52
54 virtual unique_ptr<Projection> clone() const = 0;
55
57 virtual ~JetFinder() = default;
58
60 using Projection::operator=;
61
62
68
75 void useMuons(JetMuons usemuons = JetMuons::ALL) {
76 _useMuons = usemuons;
77 }
78
85 void useInvisibles(JetInvisibles useinvis = JetInvisibles::DECAY) {
86 _useInvisibles = useinvis;
87 }
88
90
91
94
97 virtual Jets jets(const Cut& c = Cuts::open()) const {
98 return select(_jets(), c);
99 }
100
103 virtual Jets jets(const JetSelector& selector) const {
104 return select(_jets(), selector);
105 }
106
107
110 Jets jets(const Cut& c, const JetSorter& sorter) const {
112 return sortBy(jets(c), sorter);
113 }
114
117 Jets jets(const JetSorter& sorter, const Cut& c = Cuts::open()) const {
119 return jets(c, sorter);
120 }
121
124 Jets jets(const JetSelector& selector, const JetSorter& sorter) const {
126 return sortBy(jets(selector), sorter);
127 }
128
131 Jets jets(const JetSorter& sorter, const JetSelector selector) const {
132 return jets(selector, sorter);
133 }
134
135
141 Jets jetsByPt(const Cut& c = Cuts::open()) const {
142 return jets(c, cmpMomByPt);
143 }
144
150 Jets jetsByPt(const JetSelector& selector) const {
151 return jets(selector, cmpMomByPt);
152 }
153
155
156
157 protected:
158
160 virtual Jets _jets() const = 0;
161
162
163 public:
164
166 size_t size() const {
167 return jets().size();
168 }
169
170 size_t size(const Cut& c) const {
171 return jets(c).size();
172 }
173
174 size_t size(const JetSelector& s) const {
175 return jets(s).size();
176 }
177
179 bool empty() const {
180 return size() == 0;
181 }
182
183 bool empty(const Cut& c) const {
184 return size(c) == 0;
185 }
186
187 bool empty(const JetSelector& s) const {
188 return size(s) == 0;
189 }
190
192 virtual void reset() = 0;
193
194 typedef Jet entity_type;
195 typedef Jets collection_type;
196
198 collection_type entities() const {
199 return jets();
200 }
201
202 // /// Do the calculation locally (no caching).
203 // virtual void calc(const Particles& constituents, const Particles& tagparticles=Particles()) = 0;
204
205
206 protected:
207
209 virtual void project(const Event& e) = 0;
210
212 virtual CmpState compare(const Projection& p) const = 0;
213
214
215 protected:
216
218 JetMuons _useMuons;
219
221 JetInvisibles _useInvisibles;
222 };
223
224
225}
226
227#endif
Project out all final-state particles in an event. Probably the most important projection in Rivet!
Definition FinalState.hh:12
Jets jetsByPt(const Cut &c=Cuts::open()) const
Definition JetFinder.hh:141
size_t size(const Cut &c) const
Count the jets after a Cut is applied.
Definition JetFinder.hh:170
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:166
size_t size(const JetSelector &s) const
Count the jets after a selection functor is applied.
Definition JetFinder.hh:174
Jets jets(const JetSelector &selector, const JetSorter &sorter) const
Definition JetFinder.hh:124
Jets jets(const Cut &c, const JetSorter &sorter) const
Definition JetFinder.hh:110
virtual Jets jets(const Cut &c=Cuts::open()) const
Definition JetFinder.hh:97
JetFinder(const FinalState &fs, JetMuons usemuons=JetMuons::ALL, JetInvisibles useinvis=JetInvisibles::NONE)
Constructor.
virtual Jets jets(const JetSelector &selector) const
Definition JetFinder.hh:103
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:75
bool empty(const JetSelector &s) const
Is this jet finder empty after a selection functor is applied?
Definition JetFinder.hh:187
Jets jets(const JetSorter &sorter, const JetSelector selector) const
Definition JetFinder.hh:131
Jets jetsByPt(const JetSelector &selector) const
Definition JetFinder.hh:150
Jets jets(const JetSorter &sorter, const Cut &c=Cuts::open()) const
Definition JetFinder.hh:117
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:183
collection_type entities() const
Template-usable interface common to FinalState.
Definition JetFinder.hh:198
void useInvisibles(JetInvisibles useinvis=JetInvisibles::DECAY)
Include (some) invisible particles in jet construction.
Definition JetFinder.hh:85
bool empty() const
Is this jet finder empty?
Definition JetFinder.hh:179
JetFinder()=default
Default constructor.
Representation of a clustered jet of particles.
Definition Jet.hh:47
Specialised vector of Jet objects.
Definition Jet.hh:21
Projection()
The default constructor.
friend class Event
Event is a friend.
Definition Projection.hh:33
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:183
function< bool(const Jet &, const Jet &)> JetSorter
std::function instantiation for functors taking two Jets and returning a bool
Definition JetUtils.hh:46
function< bool(const Jet &)> JetSelector
std::function instantiation for functors taking a Jet and returning a bool
Definition JetUtils.hh:44
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:1428
bool cmpMomByPt(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by decreasing pT.
Definition Vector4.hh:1333
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:819
const Cut & open()
Fully open cut singleton, accepts everything.
Definition LHCbCommon.hh:9
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
JetAlg alg
Params.
Definition JetFinder.hh:34
JetScheme()
Default constructor just for STL storage.
Definition JetFinder.hh:30