rivet is hosted by Hepforge, IPPP Durham
Rivet 3.1.6
FastJets.hh
1// -*- C++ -*-
2#ifndef RIVET_FastJets_HH
3#define RIVET_FastJets_HH
4
5#include "Rivet/Jet.hh"
6#include "Rivet/Particle.hh"
7#include "Rivet/Projection.hh"
8#include "Rivet/Projections/JetAlg.hh"
9#include "Rivet/Projections/FinalState.hh"
10#include "Rivet/Tools/RivetFastJet.hh"
11
12#include "fastjet/SISConePlugin.hh"
13#include "fastjet/ATLASConePlugin.hh"
14#include "fastjet/CMSIterativeConePlugin.hh"
15#include "fastjet/CDFJetCluPlugin.hh"
16#include "fastjet/CDFMidPointPlugin.hh"
17#include "fastjet/D0RunIIConePlugin.hh"
18#include "fastjet/TrackJetPlugin.hh"
19#include "fastjet/JadePlugin.hh"
20
21#include "Rivet/Projections/PxConePlugin.hh"
22#include "Rivet/Tools/TypeTraits.hh"
23
24namespace Rivet {
25
26
28 class FastJets : public JetAlg {
29 public:
30
33 enum Algo { KT=0,
34 AKT=1, ANTIKT=1,
35 CA=2, CAM=2, CAMBRIDGE=2,
36 SISCONE, PXCONE,
37 ATLASCONE, CMSCONE,
38 CDFJETCLU, CDFMIDPOINT, D0ILCONE,
39 JADE, DURHAM, TRACKJET, GENKTEE ,
40 KTET, ANTIKTET };
41
42
45
49 FastJets(const FinalState& fsp,
50 const fastjet::JetDefinition& jdef,
51 JetAlg::Muons usemuons=JetAlg::Muons::ALL,
52 JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE,
53 fastjet::AreaDefinition* adef=nullptr)
54 : JetAlg(fsp, usemuons, useinvis), _jdef(jdef), _adef(adef)
55 {
56 _initBase();
57 }
58
62 FastJets(const FinalState& fsp,
63 const fastjet::JetDefinition& jdef,
64 fastjet::AreaDefinition* adef,
65 JetAlg::Muons usemuons=JetAlg::Muons::ALL,
66 JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE)
67 : FastJets(fsp, jdef, usemuons, useinvis, adef)
68 { }
69
73 FastJets(const FinalState& fsp,
74 fastjet::JetAlgorithm type,
75 fastjet::RecombinationScheme recom, double rparameter,
76 JetAlg::Muons usemuons=JetAlg::Muons::ALL,
77 JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE,
78 fastjet::AreaDefinition* adef=nullptr)
79 : FastJets(fsp, fastjet::JetDefinition(type, rparameter, recom), usemuons, useinvis, adef)
80 { }
81
85 FastJets(const FinalState& fsp,
86 fastjet::JetAlgorithm type,
87 fastjet::RecombinationScheme recom, double rparameter,
88 fastjet::AreaDefinition* adef,
89 JetAlg::Muons usemuons=JetAlg::Muons::ALL,
90 JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE)
91 : FastJets(fsp, type, recom, rparameter, usemuons, useinvis, adef)
92 { }
93
97 FastJets(const FinalState& fsp,
98 fastjet::JetDefinition::Plugin* plugin,
99 JetAlg::Muons usemuons=JetAlg::Muons::ALL,
100 JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE,
101 fastjet::AreaDefinition* adef=nullptr)
102 : FastJets(fsp, fastjet::JetDefinition(plugin), usemuons, useinvis, adef)
103 {
104 _plugin.reset(plugin);
105 }
106
111 fastjet::JetDefinition::Plugin* plugin,
112 fastjet::AreaDefinition* adef,
113 JetAlg::Muons usemuons=JetAlg::Muons::ALL,
114 JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE)
115 : FastJets(fsp, plugin, usemuons, useinvis, adef)
116 { }
117
126 Algo alg, double rparameter,
127 JetAlg::Muons usemuons=JetAlg::Muons::ALL,
128 JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE,
129 fastjet::AreaDefinition* adef=nullptr,
130 double seed_threshold=1.0)
131 : JetAlg(fsp, usemuons, useinvis)
132 {
133 _initBase();
134 _initJdef(alg, rparameter, seed_threshold);
135 }
136
137
138 // /// Same thing as above, but without an FS (for when we want to pass the particles directly to the calc method)
139 // /// @todo Does this work properly, without internal HeavyQuarks etc.?
140 // FastJets(Algo alg, double rparameter, double seed_threshold=1.0) { _initJdef(alg, rparameter, seed_threshold); }
141 // /// Same thing as above, but without an FS (for when we want to pass the particles directly to the calc method)
142 // /// @todo Does this work properly, without internal HeavyQuarks etc.?
143 // FastJets(fastjet::JetAlgorithm type, fastjet::RecombinationScheme recom, double rparameter) { _initJdef(type, recom, rparameter); }
144 // /// Same thing as above, but without an FS (for when we want to pass the particles directly to the calc method)
145 // /// @todo Does this work properly, without internal HeavyQuarks etc.?
146 // FastJets(fastjet::JetDefinition::Plugin* plugin) : _jdef(plugin), _plugin(plugin) {
147 // // _plugin.reset(plugin);
148 // // _jdef = fastjet::JetDefinition(plugin);
149 // }
150
151
154
156
157
160
162 static PseudoJets mkClusterInputs(const Particles& fsparticles, const Particles& tagparticles=Particles());
164 static Jet mkJet(const PseudoJet& pj, const Particles& fsparticles, const Particles& tagparticles=Particles());
166 static Jets mkJets(const PseudoJets& pjs, const Particles& fsparticles, const Particles& tagparticles=Particles());
167
169
170
172 void reset();
173
174
177
182 void useJetArea(fastjet::AreaDefinition* adef) {
183 _adef.reset(adef);
184 }
185
188 _adef.reset();
189 }
190
192
193
196
201 void addTrf(fastjet::Transformer* trf) {
202 _trfs.push_back(shared_ptr<fastjet::Transformer>(trf));
203 }
204
209 template<typename TRFS, typename TRF=typename TRFS::value_type>
210 typename std::enable_if<Derefable<TRF>::value, void>::type
211 addTrfs(const TRFS& trfs) {
212 for (auto& trf : trfs) addTrf(trf);
213 }
214
216 void clearTrfs() {
217 _trfs.clear();
218 }
219
223 Jet trimJet(const Jet& input, const fastjet::Filter& trimmer) const;
224
226
227
229
230
232 Jets _jets() const;
233
236 PseudoJets pseudoJets(double ptmin=0.0) const;
238 PseudoJets pseudojets(double ptmin=0.0) const { return pseudoJets(ptmin); }
239
242 PseudoJets pseudoJetsByPt(double ptmin=0.0) const {
243 return sorted_by_pt(pseudoJets(ptmin));
244 }
246 PseudoJets pseudojetsByPt(double ptmin=0.0) const { return pseudoJetsByPt(ptmin); }
247
250 PseudoJets pseudoJetsByE(double ptmin=0.0) const {
251 return sorted_by_E(pseudoJets(ptmin));
252 }
254 PseudoJets pseudojetsByE(double ptmin=0.0) const { return pseudoJetsByE(ptmin); }
255
258 PseudoJets pseudoJetsByRapidity(double ptmin=0.0) const {
259 return sorted_by_rapidity(pseudoJets(ptmin));
260 }
262 PseudoJets pseudojetsByRapidity(double ptmin=0.0) const { return pseudoJetsByRapidity(ptmin); }
263
265
266
268
269
272 const shared_ptr<fastjet::ClusterSequence> clusterSeq() const {
273 return _cseq;
274 }
275
278 const shared_ptr<fastjet::ClusterSequenceArea> clusterSeqArea() const {
279 return areaDef() ? dynamic_pointer_cast<fastjet::ClusterSequenceArea>(_cseq) : nullptr;
280 }
281
283 const fastjet::JetDefinition& jetDef() const {
284 return _jdef;
285 }
286
291 const shared_ptr<fastjet::AreaDefinition> areaDef() const {
292 return _adef;
293 }
294
296
297
298 private:
299
301 void _initBase();
302 void _initJdef(Algo alg, double rparameter, double seed_threshold);
303
304 protected:
305
307 void project(const Event& e);
308
310 CmpState compare(const Projection& p) const;
311
312 public:
313
315 void calc(const Particles& fsparticles, const Particles& tagparticles=Particles());
316
317
318 private:
319
321 fastjet::JetDefinition _jdef;
322
324 std::shared_ptr<fastjet::AreaDefinition> _adef;
325
327 std::shared_ptr<fastjet::ClusterSequence> _cseq;
328
330 std::shared_ptr<fastjet::JetDefinition::Plugin> _plugin;
331
333 std::vector< std::shared_ptr<fastjet::Transformer> > _trfs;
334
336 mutable std::map<int, vector<double> > _yscales;
337
339 Particles _fsparticles, _tagparticles;
340
341 };
342
343}
344
345#endif
Representation of a HepMC event, and enabler of Projection caching.
Definition: Event.hh:22
Project out jets found using the FastJet package jet algorithms.
Definition: FastJets.hh:28
static Jet mkJet(const PseudoJet &pj, const Particles &fsparticles, const Particles &tagparticles=Particles())
Make a Rivet Jet from a PseudoJet holding a user_index code for lookup of Rivet fsparticle or tagpart...
CmpState compare(const Projection &p) const
Compare projections.
PseudoJets pseudojetsByE(double ptmin=0.0) const
Alias.
Definition: FastJets.hh:254
FastJets(const FinalState &fsp, fastjet::JetAlgorithm type, fastjet::RecombinationScheme recom, double rparameter, fastjet::AreaDefinition *adef, JetAlg::Muons usemuons=JetAlg::Muons::ALL, JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE)
Definition: FastJets.hh:85
Algo
Definition: FastJets.hh:33
void clearTrfs()
Don't apply any jet transformers.
Definition: FastJets.hh:216
FastJets(const FinalState &fsp, const fastjet::JetDefinition &jdef, fastjet::AreaDefinition *adef, JetAlg::Muons usemuons=JetAlg::Muons::ALL, JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE)
Definition: FastJets.hh:62
PseudoJets pseudojetsByRapidity(double ptmin=0.0) const
Alias.
Definition: FastJets.hh:262
FastJets(const FinalState &fsp, fastjet::JetAlgorithm type, fastjet::RecombinationScheme recom, double rparameter, JetAlg::Muons usemuons=JetAlg::Muons::ALL, JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE, fastjet::AreaDefinition *adef=nullptr)
Definition: FastJets.hh:73
FastJets(const FinalState &fsp, fastjet::JetDefinition::Plugin *plugin, fastjet::AreaDefinition *adef, JetAlg::Muons usemuons=JetAlg::Muons::ALL, JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE)
Explicitly pass in an externally-constructed plugin, with reordered args for easier specification of ...
Definition: FastJets.hh:110
std::enable_if< Derefable< TRF >::value, void >::type addTrfs(const TRFS &trfs)
Add a list of grooming transformers.
Definition: FastJets.hh:211
void clearJetArea()
Don't calculate a jet area.
Definition: FastJets.hh:187
static Jets mkJets(const PseudoJets &pjs, const Particles &fsparticles, const Particles &tagparticles=Particles())
Convert a whole list of PseudoJets to a list of Jets, with mkJet-style unpacking.
const shared_ptr< fastjet::ClusterSequence > clusterSeq() const
Definition: FastJets.hh:272
DEFAULT_RIVET_PROJ_CLONE(FastJets)
Clone on the heap.
PseudoJets pseudojets(double ptmin=0.0) const
Alias.
Definition: FastJets.hh:238
PseudoJets pseudoJets(double ptmin=0.0) const
FastJets(const FinalState &fsp, Algo alg, double rparameter, JetAlg::Muons usemuons=JetAlg::Muons::ALL, JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE, fastjet::AreaDefinition *adef=nullptr, double seed_threshold=1.0)
Convenience constructor using Rivet enums for most common jet algs (including some plugins).
Definition: FastJets.hh:125
PseudoJets pseudoJetsByRapidity(double ptmin=0.0) const
Definition: FastJets.hh:258
PseudoJets pseudoJetsByE(double ptmin=0.0) const
Definition: FastJets.hh:250
PseudoJets pseudoJetsByPt(double ptmin=0.0) const
Definition: FastJets.hh:242
void calc(const Particles &fsparticles, const Particles &tagparticles=Particles())
Do the calculation locally (no caching).
const shared_ptr< fastjet::ClusterSequenceArea > clusterSeqArea() const
Definition: FastJets.hh:278
void project(const Event &e)
Perform the projection on the Event.
void useJetArea(fastjet::AreaDefinition *adef)
Use provided jet area definition.
Definition: FastJets.hh:182
FastJets(const FinalState &fsp, fastjet::JetDefinition::Plugin *plugin, JetAlg::Muons usemuons=JetAlg::Muons::ALL, JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE, fastjet::AreaDefinition *adef=nullptr)
Explicitly pass in an externally-constructed plugin.
Definition: FastJets.hh:97
static PseudoJets mkClusterInputs(const Particles &fsparticles, const Particles &tagparticles=Particles())
Make PseudoJets for input to a ClusterSequence, with user_index codes for constituent- and tag-partic...
FastJets(const FinalState &fsp, const fastjet::JetDefinition &jdef, JetAlg::Muons usemuons=JetAlg::Muons::ALL, JetAlg::Invisibles useinvis=JetAlg::Invisibles::NONE, fastjet::AreaDefinition *adef=nullptr)
Definition: FastJets.hh:49
const fastjet::JetDefinition & jetDef() const
Return the jet definition.
Definition: FastJets.hh:283
void addTrf(fastjet::Transformer *trf)
Add a grooming transformer (base class of fastjet::Filter, etc.)
Definition: FastJets.hh:201
PseudoJets pseudojetsByPt(double ptmin=0.0) const
Alias.
Definition: FastJets.hh:246
Jet trimJet(const Jet &input, const fastjet::Filter &trimmer) const
Trim (filter) a jet, keeping tag and constituent info in the resulting jet.
void reset()
Reset the projection. Jet def, etc. are unchanged.
const shared_ptr< fastjet::AreaDefinition > areaDef() const
Return the area definition.
Definition: FastJets.hh:291
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:15
Muons
Enum for the treatment of muons: whether to include all, some, or none in jet-finding.
Definition: JetFinder.hh:19
Invisibles
Enum for the treatment of invisible particles: whether to include all, some, or none in jet-finding.
Definition: JetFinder.hh:22
Representation of a clustered jet of particles.
Definition: Jet.hh:48
Specialised vector of Jet objects.
Definition: Jet.hh:23
Specialised vector of Particle objects.
Definition: Particle.hh:25
Base class for all Rivet projections.
Definition: Projection.hh:29
double p(const ParticleBase &p)
Unbound function access to p.
Definition: ParticleBaseUtils.hh:653
Definition: MC_Cent_pPb.hh:10
std::vector< PseudoJet > PseudoJets
Definition: RivetFastJet.hh:30