rivet is hosted by Hepforge, IPPP Durham
Rivet  2.7.0
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 #include "Rivet/Projections/PxConePlugin.hh"
21 //#include "fastjet/PxConePlugin.hh"
22 
23 namespace Rivet {
24 
25 
27  class FastJets : public JetAlg {
28  public:
29 
32  enum JetAlgName { KT, CAM, SISCONE, ANTIKT, PXCONE,
33  ATLASCONE, CMSCONE,
34  CDFJETCLU, CDFMIDPOINT, D0ILCONE,
35  JADE, DURHAM, TRACKJET, GENKTEE };
36 
37 
39 
40 
44  FastJets(const FinalState& fsp,
45  const fastjet::JetDefinition& jdef,
46  JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS,
47  JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES,
48  fastjet::AreaDefinition* adef=nullptr)
49  : JetAlg(fsp, usemuons, useinvis), _jdef(jdef), _adef(adef)
50  {
51  _initBase();
52  }
53 
57  FastJets(const FinalState& fsp,
58  const fastjet::JetDefinition& jdef,
59  fastjet::AreaDefinition* adef,
60  JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS,
61  JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES)
62  : FastJets(fsp, jdef, usemuons, useinvis, adef)
63  { }
64 
68  FastJets(const FinalState& fsp,
69  fastjet::JetAlgorithm type,
70  fastjet::RecombinationScheme recom, double rparameter,
71  JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS,
72  JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES,
73  fastjet::AreaDefinition* adef=nullptr)
74  : FastJets(fsp, fastjet::JetDefinition(type, rparameter, recom), usemuons, useinvis, adef)
75  { }
76 
80  FastJets(const FinalState& fsp,
81  fastjet::JetAlgorithm type,
82  fastjet::RecombinationScheme recom, double rparameter,
83  fastjet::AreaDefinition* adef,
84  JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS,
85  JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES)
86  : FastJets(fsp, type, recom, rparameter, usemuons, useinvis, adef)
87  { }
88 
92  FastJets(const FinalState& fsp,
93  fastjet::JetDefinition::Plugin* plugin,
94  JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS,
95  JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES,
96  fastjet::AreaDefinition* adef=nullptr)
97  : FastJets(fsp, fastjet::JetDefinition(plugin), usemuons, useinvis, adef)
98  {
99  _plugin.reset(plugin);
100  }
101 
105  FastJets(const FinalState& fsp,
106  fastjet::JetDefinition::Plugin* plugin,
107  fastjet::AreaDefinition* adef,
108  JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS,
109  JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES)
110  : FastJets(fsp, plugin, usemuons, useinvis, adef)
111  { }
112 
120  FastJets(const FinalState& fsp,
121  JetAlgName alg, double rparameter,
122  JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS,
123  JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES,
124  fastjet::AreaDefinition* adef=nullptr,
125  double seed_threshold=1.0)
126  : JetAlg(fsp, usemuons, useinvis)
127  {
128  _initBase();
129  _initJdef(alg, rparameter, seed_threshold);
130  }
131 
132 
133  // /// Same thing as above, but without an FS (for when we want to pass the particles directly to the calc method)
134  // /// @todo Does this work properly, without internal HeavyQuarks etc.?
135  // FastJets(JetAlgName alg, double rparameter, double seed_threshold=1.0) { _initJdef(alg, rparameter, seed_threshold); }
136  // /// Same thing as above, but without an FS (for when we want to pass the particles directly to the calc method)
137  // /// @todo Does this work properly, without internal HeavyQuarks etc.?
138  // FastJets(fastjet::JetAlgorithm type, fastjet::RecombinationScheme recom, double rparameter) { _initJdef(type, recom, rparameter); }
139  // /// Same thing as above, but without an FS (for when we want to pass the particles directly to the calc method)
140  // /// @todo Does this work properly, without internal HeavyQuarks etc.?
141  // FastJets(fastjet::JetDefinition::Plugin* plugin) : _jdef(plugin), _plugin(plugin) {
142  // // _plugin.reset(plugin);
143  // // _jdef = fastjet::JetDefinition(plugin);
144  // }
145 
146 
149 
151 
152 
154 
155 
157  static PseudoJets mkClusterInputs(const Particles& fsparticles, const Particles& tagparticles=Particles());
159  static Jet mkJet(const PseudoJet& pj, const Particles& fsparticles, const Particles& tagparticles=Particles());
161  static Jets mkJets(const PseudoJets& pjs, const Particles& fsparticles, const Particles& tagparticles=Particles());
162 
164 
165 
167  void reset();
168 
169 
174  void useJetArea(fastjet::AreaDefinition* adef) {
175  _adef.reset(adef);
176  }
177 
178 
180 
181 
183  Jets _jets() const;
184 
186  PseudoJets pseudoJets(double ptmin=0.0) const;
188  PseudoJets pseudojets(double ptmin=0.0) const { return pseudoJets(ptmin); }
189 
191  PseudoJets pseudoJetsByPt(double ptmin=0.0) const {
192  return sorted_by_pt(pseudoJets(ptmin));
193  }
195  PseudoJets pseudojetsByPt(double ptmin=0.0) const { return pseudoJetsByPt(ptmin); }
196 
198  PseudoJets pseudoJetsByE(double ptmin=0.0) const {
199  return sorted_by_E(pseudoJets(ptmin));
200  }
202  PseudoJets pseudojetsByE(double ptmin=0.0) const { return pseudoJetsByE(ptmin); }
203 
205  PseudoJets pseudoJetsByRapidity(double ptmin=0.0) const {
206  return sorted_by_rapidity(pseudoJets(ptmin));
207  }
209  PseudoJets pseudojetsByRapidity(double ptmin=0.0) const { return pseudoJetsByRapidity(ptmin); }
210 
212  Jet trimJet(const Jet& input, const fastjet::Filter& trimmer) const;
213 
215 
216 
218 
219 
222  const shared_ptr<fastjet::ClusterSequence> clusterSeq() const {
223  return _cseq;
224  }
225 
228  const shared_ptr<fastjet::ClusterSequenceArea> clusterSeqArea() const {
229  return areaDef() ? dynamic_pointer_cast<fastjet::ClusterSequenceArea>(_cseq) : nullptr;
230  }
231 
233  const fastjet::JetDefinition& jetDef() const {
234  return _jdef;
235  }
236 
241  const shared_ptr<fastjet::AreaDefinition> areaDef() const {
242  return _adef;
243  }
244 
246 
247 
248  private:
249 
251  void _initBase();
252  void _initJdef(JetAlgName alg, double rparameter, double seed_threshold);
253 
254  protected:
255 
257  void project(const Event& e);
258 
260  int compare(const Projection& p) const;
261 
262  public:
263 
265  void calc(const Particles& fsparticles, const Particles& tagparticles=Particles());
266 
267 
268  private:
269 
271  fastjet::JetDefinition _jdef;
272 
274  std::shared_ptr<fastjet::AreaDefinition> _adef;
275 
277  std::shared_ptr<fastjet::ClusterSequence> _cseq;
278 
280  std::shared_ptr<fastjet::JetDefinition::Plugin> _plugin;
281 
283  mutable std::map<int, vector<double> > _yscales;
284 
286  Particles _fsparticles, _tagparticles;
287 
288  };
289 
290 }
291 
292 #endif
Definition: ALICE_2010_I880049.cc:13
const shared_ptr< fastjet::ClusterSequenceArea > clusterSeqArea() const
Definition: FastJets.hh:228
PseudoJets pseudojetsByE(double ptmin=0.0) const
Alias.
Definition: FastJets.hh:202
FastJets(const FinalState &fsp, const fastjet::JetDefinition &jdef, fastjet::AreaDefinition *adef, JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS, JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES)
Definition: FastJets.hh:57
DEFAULT_RIVET_PROJ_CLONE(FastJets)
Clone on the heap.
FastJets(const FinalState &fsp, fastjet::JetAlgorithm type, fastjet::RecombinationScheme recom, double rparameter, fastjet::AreaDefinition *adef, JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS, JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES)
Definition: FastJets.hh:80
PseudoJets pseudojetsByRapidity(double ptmin=0.0) const
Alias.
Definition: FastJets.hh:209
FastJets(const FinalState &fsp, const fastjet::JetDefinition &jdef, JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS, JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES, fastjet::AreaDefinition *adef=nullptr)
Definition: FastJets.hh:44
const shared_ptr< fastjet::ClusterSequence > clusterSeq() const
Definition: FastJets.hh:222
void project(const Event &e)
Perform the projection on the Event.
Definition: FastJets.cc:144
void useJetArea(fastjet::AreaDefinition *adef)
Use provided jet area definition.
Definition: FastJets.hh:174
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. ...
Definition: FastJets.cc:135
PseudoJets pseudoJets(double ptmin=0.0) const
Get the pseudo jets (unordered).
Definition: FastJets.cc:211
const shared_ptr< fastjet::AreaDefinition > areaDef() const
Return the area definition.
Definition: FastJets.hh:241
Project out jets found using the FastJet package jet algorithms.
Definition: FastJets.hh:27
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...
Definition: FastJets.cc:105
Definition: Event.hh:22
PseudoJets pseudoJetsByE(double ptmin=0.0) const
Get the pseudo jets, ordered by .
Definition: FastJets.hh:198
FastJets(const FinalState &fsp, JetAlgName alg, double rparameter, JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS, JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES, 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:120
Definition: OPAL_2004_I631361_qq.cc:11
PseudoJets pseudojets(double ptmin=0.0) const
Alias.
Definition: FastJets.hh:188
MuonsStrategy
Enum for the treatment of muons: whether to include all, some, or none in jet-finding.
Definition: JetAlg.hh:19
Project out all final-state particles in an event. Probably the most important projection in Rivet! ...
Definition: FinalState.hh:12
PseudoJets pseudojetsByPt(double ptmin=0.0) const
Alias.
Definition: FastJets.hh:195
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...
Definition: FastJets.cc:82
std::vector< PseudoJet > PseudoJets
Definition: RivetFastJet.hh:24
const fastjet::JetDefinition & jetDef() const
Return the jet definition.
Definition: FastJets.hh:233
InvisiblesStrategy
Enum for the treatment of invisible particles: whether to include all, some, or none in jet-finding...
Definition: JetAlg.hh:22
FastJets(const FinalState &fsp, fastjet::JetDefinition::Plugin *plugin, JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS, JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES, fastjet::AreaDefinition *adef=nullptr)
Explicitly pass in an externally-constructed plugin.
Definition: FastJets.hh:92
void reset()
Reset the projection. Jet def, etc. are unchanged.
Definition: FastJets.cc:188
void calc(const Particles &fsparticles, const Particles &tagparticles=Particles())
Do the calculation locally (no caching).
Definition: FastJets.cc:167
Representation of a clustered jet of particles.
Definition: Jet.hh:18
FastJets(const FinalState &fsp, fastjet::JetAlgorithm type, fastjet::RecombinationScheme recom, double rparameter, JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS, JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES, fastjet::AreaDefinition *adef=nullptr)
Definition: FastJets.hh:68
PseudoJets pseudoJetsByRapidity(double ptmin=0.0) const
Get the pseudo jets, ordered by rapidity.
Definition: FastJets.hh:205
Base class for all Rivet projections.
Definition: Projection.hh:29
FastJets(const FinalState &fsp, fastjet::JetDefinition::Plugin *plugin, fastjet::AreaDefinition *adef, JetAlg::MuonsStrategy usemuons=JetAlg::ALL_MUONS, JetAlg::InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES)
Explicitly pass in an externally-constructed plugin, with reordered args for easier specification of ...
Definition: FastJets.hh:105
int compare(const Projection &p) const
Compare projections.
Definition: FastJets.cc:67
PseudoJets pseudoJetsByPt(double ptmin=0.0) const
Get the pseudo jets, ordered by .
Definition: FastJets.hh:191
JetAlgName
Definition: FastJets.hh:32
Jet trimJet(const Jet &input, const fastjet::Filter &trimmer) const
Trim (filter) a jet, keeping tag and constituent info in the resulting jet.
Definition: FastJets.cc:203
Abstract base class for projections which can return a set of Jets.
Definition: JetAlg.hh:15