Rivet API documentation

Rivet 4.1.3
Jet.hh
1// -*- C++ -*-
2#ifndef RIVET_Jet_HH
3#define RIVET_Jet_HH
4
5#include "Rivet/Jet.fhh"
6#include "Rivet/Particle.hh"
7#include "Rivet/Config/RivetCommon.hh"
8#include "Rivet/Math/LorentzTrans.hh"
9#include "Rivet/Tools/Cuts.hh"
10#include "Rivet/Tools/RivetFastJet.hh"
11#include "Rivet/Tools/Utils.hh"
12#include <numeric>
13
14namespace Rivet {
15
16
21 class Jets : public std::vector<Jet> {
22 public:
23
24 using base = std::vector<Jet>; //< using-declarations don't like template syntax
25 using base::base; //< import base-class constructors
26 Jets();
27 Jets(const std::vector<Jet>& vjs);
28 FourMomenta moms() const;
29 PseudoJets pseudojets() const;
30 operator FourMomenta() const {
31 return moms();
32 }
33 operator PseudoJets() const {
34 return pseudojets();
35 }
36 Jets& operator+=(const Jet& j);
37 Jets& operator+=(const Jets& js);
38 };
39
40 Jets operator+(const Jets& a, const Jets& b);
41
42
44
45
47 class Jet : public ParticleBase {
48 public:
49
52
54 Jet(const fastjet::PseudoJet& pj,
55 const Particles& particles = Particles(),
56 const Particles& tags = Particles()) {
58 }
59
61 Jet(const FourMomentum& pjet,
62 const Particles& particles = Particles(),
63 const Particles& tags = Particles()) {
64 setState(pjet, particles, tags);
65 }
66
68 Jet() {
69 clear();
70 }
71
73
74
77
79 size_t size() const {
80 return _particles.size();
81 }
82
85 return _particles;
86 }
87
88 const Particles& particles() const {
89 return _particles;
90 }
91
92 const Particles particles(const Cut& c) const {
93 return select(_particles, c);
94 }
95
96 const Particles particles(const ParticleSelector& s) const {
97 return select(_particles, s);
98 }
99
102 return particles();
103 }
104
105 const Particles& constituents() const {
106 return particles();
107 }
108
109 const Particles constituents(const Cut& c) const {
110 return particles(c);
111 }
112
113 const Particles constituents(const ParticleSelector& s) const {
114 return particles(s);
115 }
116
118 bool containsParticle(const Particle& particle) const;
120 bool containsPID(const Particle& particle) const {
121 return containsParticle(particle);
122 }
123
125 bool containsParticleId(PdgId pid) const;
127 bool containsPID(PdgId pid) const {
128 return containsParticleId(pid);
129 }
130
132 bool containsParticleId(const vector<PdgId>& pids) const;
134 bool containsPID(const vector<PdgId>& pids) const {
135 return containsParticleId(pids);
136 }
137
139
140
146
149 return _tags;
150 }
151
152 const Particles& tags() const {
153 return _tags;
154 }
155
158 Particles tags(const ParticleSelector& f, double dRmax = -1) const {
159 const Particles filttags = select(tags(), f);
160 // Return, via dR filter if requested
161 return dRmax < 0 ? filttags : select(filttags, deltaRLess(this->mom(), dRmax));
162 }
163
166 Particles tags(const Cut& c, double dRmax = -1) const;
167
168
175 Particles bTags(const Cut& c = Cuts::open(), double dRmax = -1) const;
176
183 Particles bTags(const ParticleSelector& f, double dRmax = -1) const {
184 return select(bTags(), f);
185 }
186
188 bool bTagged(const Cut& c = Cuts::open(), double dRmax = -1) const {
189 return !bTags(c).empty();
190 }
191
193 bool bTagged(const ParticleSelector& f, double dRmax = -1) const {
194 return !bTags(f).empty();
195 }
196
197
204 Particles cTags(const Cut& c = Cuts::open(), double dRmax = -1) const;
205
212 Particles cTags(const ParticleSelector& f, double dRmax = -1) const {
213 return select(cTags(), f);
214 }
215
217 bool cTagged(const Cut& c = Cuts::open(), double dRmax = -1) const {
218 return !cTags(c).empty();
219 }
220
222 bool cTagged(const ParticleSelector& f, double dRmax = -1) const {
223 return !cTags(f).empty();
224 }
225
226
233 Particles tauTags(const Cut& c = Cuts::open(), double dRmax = -1) const;
234
241 Particles tauTags(const ParticleSelector& f, double dRmax = -1) const {
242 return select(tauTags(), f);
243 }
244
246 bool tauTagged(const Cut& c = Cuts::open(), double dRmax = -1) const {
247 return !tauTags(c).empty();
248 }
249
251 bool tauTagged(const ParticleSelector& f, double dRmax = -1) const {
252 return !tauTags(f).empty();
253 }
254
255
257
259
260
263
265 const FourMomentum& momentum() const {
266 return _momentum;
267 }
268
273
275 double totalEnergy() const {
276 return momentum().E();
277 }
278
280 double neutralEnergy() const;
281
283 double hadronicEnergy() const;
284
286
287
290
292 const fastjet::PseudoJet& pseudojet() const {
293 return _pseudojet;
294 }
295
297 operator const fastjet::PseudoJet&() const {
298 return pseudojet();
299 }
300
302
303
306
311 Jet& setState(const fastjet::PseudoJet& pj,
312 const Particles& particles = Particles(),
313 const Particles& tags = Particles());
314
317
322 Jet& setConstituents(const Particles& particles) {
323 return setParticles(particles);
324 }
325
328
330
331
332 private:
333
335 fastjet::PseudoJet _pseudojet;
336
339 Particles _particles;
340
342 Particles _tags;
343
345 mutable FourMomentum _momentum;
346
347 // /// Provide but hide the equality operators, to avoid implicit comparison via fastjet::PseudoJet
348 // bool operator == (const Jet&) const;
349 // bool operator != (const Jet&) const;
350 };
351
352
355
357 std::ostream& operator<<(std::ostream& os, const Jet& j);
358
360
361
362}
363
364
365#include "Rivet/Tools/JetUtils.hh"
366
367#endif
Specialized version of the FourVector with momentum/energy functionality.
Definition Vector4.hh:363
double E() const
Get energy (time component of momentum).
Definition Vector4.hh:590
Representation of a clustered jet of particles.
Definition Jet.hh:47
double hadronicEnergy() const
Get the energy carried in this jet by hadrons.
bool containsParticleId(const vector< PdgId > &pids) const
Check whether this jet contains at least one of certain particle types.
const fastjet::PseudoJet & pseudojet() const
Access the internal FastJet3 PseudoJet (as a const reference).
Definition Jet.hh:292
const Particles particles(const ParticleSelector &s) const
Get the particles in this jet which pass a filtering functor (const).
Definition Jet.hh:96
Jet & transformBy(const LorentzTransform &lt)
size_t size() const
Number of particles in this jet.
Definition Jet.hh:79
Jet(const fastjet::PseudoJet &pj, const Particles &particles=Particles(), const Particles &tags=Particles())
Constructor from a FastJet PseudoJet, with optional full particle constituents information.
Definition Jet.hh:54
const Particles constituents(const Cut &c) const
Get the particles in this jet which pass a cut (FastJet-like alias, const).
Definition Jet.hh:109
bool cTagged(const Cut &c=Cuts::open(), double dRmax=-1) const
Does this jet have at least one c-tag? (with optional Cut and dR restriction).
Definition Jet.hh:217
Jet & setParticles(const Particles &particles)
Set the particles collection with full particle information.
bool containsParticleId(PdgId pid) const
Check whether this jet contains a certain particle type.
Particles tags(const Cut &c, double dRmax=-1) const
Particles which have been tag-matched to this jet and pass a Cut or dR requirement.
const Particles & constituents() const
Get the particles in this jet (FastJet-like alias, const version).
Definition Jet.hh:105
Jet(const FourMomentum &pjet, const Particles &particles=Particles(), const Particles &tags=Particles())
Set the jet data, with optional full particle information.
Definition Jet.hh:61
Jet & clear()
Reset this jet as empty.
bool tauTagged(const ParticleSelector &f, double dRmax=-1) const
Does this jet have at least one tau-tag (with optional selector function and dR restriction).
Definition Jet.hh:251
Particles cTags(const ParticleSelector &f, double dRmax=-1) const
Get the c (and not b) particles which have been tag-matched to this jet.
Definition Jet.hh:212
const Particles constituents(const ParticleSelector &s) const
Get the particles in this jet which pass a filtering functor (FastJet-like alias, const).
Definition Jet.hh:113
const Particles & tags() const
Particles which have been tag-matched to this jet (const version).
Definition Jet.hh:152
Particles & particles()
Get the particles in this jet.
Definition Jet.hh:84
Jet & setState(const FourMomentum &mom, const Particles &particles, const Particles &tags=Particles())
Set all the jet data, with optional full particle constituent and tag information.
bool containsPID(PdgId pid) const
Nicer alias for containsParticleId.
Definition Jet.hh:127
bool tauTagged(const Cut &c=Cuts::open(), double dRmax=-1) const
Does this jet have at least one tau-tag (with optional Cut and dR restriction).
Definition Jet.hh:246
const Particles particles(const Cut &c) const
Get the particles in this jet which pass a cut (const).
Definition Jet.hh:92
Jet & setState(const fastjet::PseudoJet &pj, const Particles &particles=Particles(), const Particles &tags=Particles())
Set the jet data from a FastJet PseudoJet, with optional particle constituents and tags lists.
const FourMomentum & momentum() const
Get equivalent single momentum four-vector.
Definition Jet.hh:265
Jet()
Default constructor – only for STL storability.
Definition Jet.hh:68
Particles bTags(const Cut &c=Cuts::open(), double dRmax=-1) const
Get the b particles tag-matched to this jet.
Particles & constituents()
Get the particles in this jet (FastJet-like alias).
Definition Jet.hh:101
bool containsPID(const Particle &particle) const
Nicer alias for containsParticleId.
Definition Jet.hh:120
Particles & tags()
Particles which have been tag-matched to this jet.
Definition Jet.hh:148
Particles bTags(const ParticleSelector &f, double dRmax=-1) const
Get the b particles tag-matched to this jet (with optional selector function and dR restriction).
Definition Jet.hh:183
bool bTagged(const Cut &c=Cuts::open(), double dRmax=-1) const
Does this jet have at least one b-tag? (with optional Cut and dR restriction).
Definition Jet.hh:188
Particles tauTags(const Cut &c=Cuts::open(), double dRmax=-1) const
Get the tau particles tag-matched to this jet.
Particles tags(const ParticleSelector &f, double dRmax=-1) const
Particles which have been tag-matched to this jet and pass a selector function or dR requirement.
Definition Jet.hh:158
bool cTagged(const ParticleSelector &f, double dRmax=-1) const
Does this jet have at least one c-tag? (with optional selector function and dR restriction).
Definition Jet.hh:222
Particles cTags(const Cut &c=Cuts::open(), double dRmax=-1) const
Get the c (and not b) particles tag-matched to this jet.
const Particles & particles() const
Get the particles in this jet (const version).
Definition Jet.hh:88
double neutralEnergy() const
Get the energy carried in this jet by neutral particles.
bool bTagged(const ParticleSelector &f, double dRmax=-1) const
Does this jet have at least one b-tag? (with optional selector function and dR restriction).
Definition Jet.hh:193
double totalEnergy() const
Get the total energy of this jet.
Definition Jet.hh:275
bool containsParticle(const Particle &particle) const
Check whether this jet contains a particular particle.
Particles tauTags(const ParticleSelector &f, double dRmax=-1) const
Get the tau particles tag-matched to this jet.
Definition Jet.hh:241
bool containsPID(const vector< PdgId > &pids) const
Nicer alias for containsParticleId.
Definition Jet.hh:134
Specialised vector of Jet objects.
Definition Jet.hh:21
Object implementing Lorentz transform calculations and boosts.
Definition LorentzTrans.hh:21
const FourMomentum & mom() const
Get the equivalent momentum four-vector (const) (alias).
Definition ParticleBase.hh:39
ParticleBase()
Default constructor.
Definition ParticleBase.hh:17
Particle representation, either from a HepMC::GenEvent or reconstructed.
Definition Particle.hh:50
Specialised vector of Particle objects.
Definition Particle.hh:21
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
int pid(const Particle &p)
Unbound function access to PID code.
Definition ParticleUtils.hh:23
PdgIdPair pids(const ParticlePair &pp)
Get the PDG ID codes of a ParticlePair.
Definition ParticleUtils.hh:804
const Cut & open()
Fully open cut singleton, accepts everything.
Definition LHCbCommon.hh:9
std::ostream & operator<<(std::ostream &os, const AnalysisInfo &ai)
Stream an AnalysisInfo as a text description.
Definition AnalysisInfo.hh:463
std::vector< PseudoJet > PseudoJets
Definition RivetFastJet.hh:30