Rivet: /Users/chrisg/software/rivet/include/Rivet/Projections/FastJets.hh Source File

| Rivet 3.1.9

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
110 FastJets(const FinalState& fsp,
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
125 FastJets(const FinalState& fsp,
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
153 DEFAULT_RIVET_PROJ_CLONE(FastJets);
154
156
157
159 using Projection::operator =;
160
161
164
166 static PseudoJets mkClusterInputs(const Particles& fsparticles, const Particles& tagparticles=Particles());
168 static Jet mkJet(const PseudoJet& pj, const Particles& fsparticles, const Particles& tagparticles=Particles());
170 static Jets mkJets(const PseudoJets& pjs, const Particles& fsparticles, const Particles& tagparticles=Particles());
171
173
174
176 void reset();
177
178
181
186 void useJetArea(fastjet::AreaDefinition* adef) {
187 _adef.reset(adef);
188 }
189
191 void clearJetArea() {
192 _adef.reset();
193 }
194
196
197
200
205 void addTrf(fastjet::Transformer* trf) {
206 _trfs.push_back(shared_ptr<fastjet::Transformer>(trf));
207 }
208
213 template<typename TRFS, typename TRF=typename TRFS::value_type>
214 typename std::enable_if<Derefable<TRF>::value, void>::type
215 addTrfs(const TRFS& trfs) {
216 for (auto& trf : trfs) addTrf(trf);
217 }
218
220 void clearTrfs() {
221 _trfs.clear();
222 }
223
227 Jet trimJet(const Jet& input, const fastjet::Filter& trimmer) const;
228
230
231
233
234
236 Jets _jets() const;
237
240 PseudoJets pseudoJets(double ptmin=0.0) const;
242 PseudoJets pseudojets(double ptmin=0.0) const { return pseudoJets(ptmin); }
243
246 PseudoJets pseudoJetsByPt(double ptmin=0.0) const {
247 return sorted_by_pt(pseudoJets(ptmin));
248 }
250 PseudoJets pseudojetsByPt(double ptmin=0.0) const { return pseudoJetsByPt(ptmin); }
251
254 PseudoJets pseudoJetsByE(double ptmin=0.0) const {
255 return sorted_by_E(pseudoJets(ptmin));
256 }
258 PseudoJets pseudojetsByE(double ptmin=0.0) const { return pseudoJetsByE(ptmin); }
259
262 PseudoJets pseudoJetsByRapidity(double ptmin=0.0) const {
263 return sorted_by_rapidity(pseudoJets(ptmin));
264 }
266 PseudoJets pseudojetsByRapidity(double ptmin=0.0) const { return pseudoJetsByRapidity(ptmin); }
267
269
270
272
273
276 const shared_ptr<fastjet::ClusterSequence> clusterSeq() const {
277 return _cseq;
278 }
279
282 const shared_ptr<fastjet::ClusterSequenceArea> clusterSeqArea() const {
283 return areaDef() ? dynamic_pointer_cast<fastjet::ClusterSequenceArea>(_cseq) : nullptr;
284 }
285
287 const fastjet::JetDefinition& jetDef() const {
288 return _jdef;
289 }
290
295 const shared_ptr<fastjet::AreaDefinition> areaDef() const {
296 return _adef;
297 }
298
300
301
302 protected:
303
305 void _initBase();
306 void _initJdef(Algo alg, double rparameter, double seed_threshold);
307
308 protected:
309
311 void project(const Event& e);
312
314 CmpState compare(const Projection& p) const;
315
316 public:
317
319 void calc(const Particles& fsparticles, const Particles& tagparticles=Particles());
320
321
322 protected:
323
325 fastjet::JetDefinition _jdef;
326
328 std::shared_ptr<fastjet::AreaDefinition> _adef;
329
331 std::shared_ptr<fastjet::ClusterSequence> _cseq;
332
334 std::shared_ptr<fastjet::JetDefinition::Plugin> _plugin;
335
337 std::vector< std::shared_ptr<fastjet::Transformer> > _trfs;
338
340 mutable std::map<int, vector<double> > _yscales;
341
343 Particles _fsparticles, _tagparticles;
344
345 };
346
347}
348
349#endif
Rivet::Event
Representation of a HepMC event, and enabler of Projection caching.
Definition Event.hh:22
Rivet::FastJets
Project out jets found using the FastJet package jet algorithms.
Definition FastJets.hh:28
Rivet::FastJets::mkJet
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...
Rivet::FastJets::compare
CmpState compare(const Projection &p) const
Compare projections.
Rivet::FastJets::pseudojetsByE
PseudoJets pseudojetsByE(double ptmin=0.0) const
Alias.
Definition FastJets.hh:258
Rivet::FastJets::FastJets
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
Rivet::FastJets::Algo
Algo
Definition FastJets.hh:33
Rivet::FastJets::clearTrfs
void clearTrfs()
Don't apply any jet transformers.
Definition FastJets.hh:220
Rivet::FastJets::FastJets
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
Rivet::FastJets::pseudojetsByRapidity
PseudoJets pseudojetsByRapidity(double ptmin=0.0) const
Alias.
Definition FastJets.hh:266
Rivet::FastJets::FastJets
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
Rivet::FastJets::FastJets
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
Rivet::FastJets::addTrfs
std::enable_if< Derefable< TRF >::value, void >::type addTrfs(const TRFS &trfs)
Add a list of grooming transformers.
Definition FastJets.hh:215
Rivet::FastJets::clearJetArea
void clearJetArea()
Don't calculate a jet area.
Definition FastJets.hh:191
Rivet::FastJets::mkJets
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.
Rivet::FastJets::clusterSeq
const shared_ptr< fastjet::ClusterSequence > clusterSeq() const
Definition FastJets.hh:276
Rivet::FastJets::DEFAULT_RIVET_PROJ_CLONE
DEFAULT_RIVET_PROJ_CLONE(FastJets)
Clone on the heap.
Rivet::FastJets::pseudojets
PseudoJets pseudojets(double ptmin=0.0) const
Alias.
Definition FastJets.hh:242
Rivet::FastJets::pseudoJets
PseudoJets pseudoJets(double ptmin=0.0) const
Rivet::FastJets::FastJets
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
Rivet::FastJets::pseudoJetsByRapidity
PseudoJets pseudoJetsByRapidity(double ptmin=0.0) const
Definition FastJets.hh:262
Rivet::FastJets::pseudoJetsByE
PseudoJets pseudoJetsByE(double ptmin=0.0) const
Definition FastJets.hh:254
Rivet::FastJets::pseudoJetsByPt
PseudoJets pseudoJetsByPt(double ptmin=0.0) const
Definition FastJets.hh:246
Rivet::FastJets::calc
void calc(const Particles &fsparticles, const Particles &tagparticles=Particles())
Do the calculation locally (no caching).
Rivet::FastJets::clusterSeqArea
const shared_ptr< fastjet::ClusterSequenceArea > clusterSeqArea() const
Definition FastJets.hh:282
Rivet::FastJets::project
void project(const Event &e)
Perform the projection on the Event.
Rivet::FastJets::useJetArea
void useJetArea(fastjet::AreaDefinition *adef)
Use provided jet area definition.
Definition FastJets.hh:186
Rivet::FastJets::FastJets
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
Rivet::FastJets::mkClusterInputs
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...
Rivet::FastJets::FastJets
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
Rivet::FastJets::jetDef
const fastjet::JetDefinition & jetDef() const
Return the jet definition.
Definition FastJets.hh:287
Rivet::FastJets::addTrf
void addTrf(fastjet::Transformer *trf)
Add a grooming transformer (base class of fastjet::Filter, etc.)
Definition FastJets.hh:205
Rivet::FastJets::pseudojetsByPt
PseudoJets pseudojetsByPt(double ptmin=0.0) const
Alias.
Definition FastJets.hh:250
Rivet::FastJets::trimJet
Jet trimJet(const Jet &input, const fastjet::Filter &trimmer) const
Trim (filter) a jet, keeping tag and constituent info in the resulting jet.
Rivet::FastJets::reset
void reset()
Reset the projection. Jet def, etc. are unchanged.
Rivet::FastJets::areaDef
const shared_ptr< fastjet::AreaDefinition > areaDef() const
Return the area definition.
Definition FastJets.hh:295
Rivet::FinalState
Project out all final-state particles in an event. Probably the most important projection in Rivet!
Definition FinalState.hh:12
Rivet::JetFinder
Abstract base class for projections which can return a set of Jets.
Definition JetFinder.hh:15
Rivet::JetFinder::Muons
Muons
Enum for the treatment of muons: whether to include all, some, or none in jet-finding.
Definition JetFinder.hh:19
Rivet::JetFinder::Invisibles
Invisibles
Enum for the treatment of invisible particles: whether to include all, some, or none in jet-finding.
Definition JetFinder.hh:22
Rivet::Jet
Representation of a clustered jet of particles.
Definition Jet.hh:48
Rivet::Jets
Specialised vector of Jet objects.
Definition Jet.hh:23
Rivet::Particles
Specialised vector of Particle objects.
Definition Particle.hh:25
Rivet::Projection
Base class for all Rivet projections.
Definition Projection.hh:29
Rivet::Kin::p
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:684
Rivet
Definition MC_Cent_pPb.hh:10
Rivet::PseudoJets
std::vector< PseudoJet > PseudoJets
Definition RivetFastJet.hh:30