Rivet  3.1.3
JetFinder.hh
1 // -*- C++ -*-
2 #ifndef RIVET_JetFinder_HH
3 #define RIVET_JetFinder_HH
4 
5 #include "Rivet/Projection.hh"
6 #include "Rivet/Projections/FinalState.hh"
7 #include "Rivet/Projections/VisibleFinalState.hh"
8 #include "Rivet/Particle.hh"
9 #include "Rivet/Jet.hh"
10 
11 namespace Rivet {
12 
13 
15  class JetFinder : public Projection {
16  public:
17 
19  enum class Muons { NONE, DECAY, ALL };
20 
22  enum class Invisibles { NONE, DECAY, ALL };
23 
24 
25 
27  JetFinder(const FinalState& fs,
28  Muons usemuons = Muons::ALL,
29  Invisibles useinvis = Invisibles::NONE);
30 
32  JetFinder() = default;
33 
35  virtual unique_ptr<Projection> clone() const = 0;
36 
38  virtual ~JetFinder() = default;
39 
40 
45 
46 
53  void useMuons(Muons usemuons = Muons::ALL) {
54  _useMuons = usemuons;
55  }
56 
63  void useInvisibles(Invisibles useinvis = Invisibles::DECAY) {
64  _useInvisibles = useinvis;
65  }
66 
68  DEPRECATED("make an explicit choice from Invisibles::{NONE,DECAY,ALL}. This boolean call does not allow for ALL")
69  void useInvisibles(bool useinvis) {
70  _useInvisibles = useinvis ? Invisibles::DECAY : Invisibles::NONE;
71  }
72 
74 
75 
77 
78 
81  virtual Jets jets(const Cut& c=Cuts::open()) const {
82  return filter_select(_jets(), c);
83  }
84 
87  virtual Jets jets(const JetSelector& selector) const {
88  return filter_select(_jets(), selector);
89  }
90 
91 
94  Jets jets(const Cut& c, const JetSorter& sorter) const {
96  return sortBy(jets(c), sorter);
97  }
98 
101  Jets jets(const JetSorter& sorter, const Cut& c=Cuts::open()) const {
103  return jets(c, sorter);
104  }
105 
108  Jets jets(const JetSelector& selector, const JetSorter& sorter) const {
110  return sortBy(jets(selector), sorter);
111  }
112 
115  Jets jets(const JetSorter& sorter, const JetSelector selector) const {
116  return jets(selector, sorter);
117  }
118 
119 
125  Jets jetsByPt(const Cut& c=Cuts::open()) const {
126  return jets(c, cmpMomByPt);
127  }
128 
134  Jets jetsByPt(const JetSelector& selector) const {
135  return jets(selector, cmpMomByPt);
136  }
137 
144  Jets jetsByPt(double ptmin) const {
145  return jets(Cuts::pT >= ptmin, cmpMomByPt);
146  }
147 
149 
150 
151  protected:
152 
154  virtual Jets _jets() const = 0;
155 
156 
157  public:
158 
160  size_t size() const { return jets().size(); }
162  size_t size(const Cut& c) const { return jets(c).size(); }
164  size_t size(const JetSelector& s) const { return jets(s).size(); }
165 
167  bool empty() const { return size() == 0; }
169  bool empty(const Cut& c) const { return size(c) == 0; }
171  bool empty(const JetSelector& s) const { return size(s) == 0; }
172 
174  virtual void reset() = 0;
175 
176  typedef Jet entity_type;
177  typedef Jets collection_type;
178 
180  collection_type entities() const { return jets(); }
181 
182  // /// Do the calculation locally (no caching).
183  // virtual void calc(const Particles& constituents, const Particles& tagparticles=Particles()) = 0;
184 
185 
186  protected:
187 
189  virtual void project(const Event& e) = 0;
190 
192  virtual CmpState compare(const Projection& p) const = 0;
193 
194 
195  protected:
196 
198  Muons _useMuons;
199 
201  Invisibles _useInvisibles;
202 
203 
204  };
205 
206 
207 }
208 
209 #endif
Definition: MC_Cent_pPb.hh:10
virtual ~JetFinder()=default
Destructor.
void useInvisibles(Invisibles useinvis=Invisibles::DECAY)
Include (some) invisible particles in jet construction.
Definition: JetFinder.hh:63
Jets filter_select(const Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
Definition: JetUtils.hh:160
function< bool(const Jet &)> JetSelector
std::function instantiation for functors taking a Jet and returning a bool
Definition: JetUtils.hh:44
bool empty(const JetSelector &s) const
Is this jet finder empty after a selection functor is applied?
Definition: JetFinder.hh:171
bool cmpMomByPt(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by decreasing pT.
Definition: Vector4.hh:1342
const Cut & open()
Fully open cut singleton, accepts everything.
Jets jets(const JetSorter &sorter, const Cut &c=Cuts::open()) const
Definition: JetFinder.hh:101
collection_type entities() const
Template-usable interface common to FinalState.
Definition: JetFinder.hh:180
size_t size() const
Count the jets.
Definition: JetFinder.hh:160
virtual void project(const Event &e)=0
Perform the projection on the Event.
bool empty(const Cut &c) const
Is this jet finder empty after a Cut is applied?
Definition: JetFinder.hh:169
Jets jetsByPt(double ptmin) const
Definition: JetFinder.hh:144
Representation of a HepMC event, and enabler of Projection caching.
Definition: Event.hh:22
Jets jetsByPt(const Cut &c=Cuts::open()) const
Definition: JetFinder.hh:125
Jets jets(const JetSorter &sorter, const JetSelector selector) const
Definition: JetFinder.hh:115
virtual void reset()=0
Clear the projection.
bool empty() const
Is this jet finder empty?
Definition: JetFinder.hh:167
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:1437
Abstract base class for projections which can return a set of Jets.
Definition: JetFinder.hh:15
size_t size(const JetSelector &s) const
Count the jets after a selection functor is applied.
Definition: JetFinder.hh:164
Jets jetsByPt(const JetSelector &selector) const
Definition: JetFinder.hh:134
Invisibles
Enum for the treatment of invisible particles: whether to include all, some, or none in jet-finding...
Definition: JetFinder.hh:22
void useMuons(Muons usemuons=Muons::ALL)
Include (some) muons in jet construction.
Definition: JetFinder.hh:53
Jets jets(const JetSelector &selector, const JetSorter &sorter) const
Definition: JetFinder.hh:108
function< bool(const Jet &, const Jet &)> JetSorter
std::function instantiation for functors taking two Jets and returning a bool
Definition: JetUtils.hh:46
virtual Jets jets(const JetSelector &selector) const
Definition: JetFinder.hh:87
Project out all final-state particles in an event. Probably the most important projection in Rivet! ...
Definition: FinalState.hh:12
virtual unique_ptr< Projection > clone() const =0
Clone on the heap.
size_t size(const Cut &c) const
Count the jets after a Cut is applied.
Definition: JetFinder.hh:162
virtual Jets jets(const Cut &c=Cuts::open()) const
Definition: JetFinder.hh:81
JetFinder()=default
Default constructor.
Representation of a clustered jet of particles.
Definition: Jet.hh:18
Base class for all Rivet projections.
Definition: Projection.hh:29
virtual CmpState compare(const Projection &p) const =0
Compare projections.
Jets jets(const Cut &c, const JetSorter &sorter) const
Definition: JetFinder.hh:94
Muons
Enum for the treatment of muons: whether to include all, some, or none in jet-finding.
Definition: JetFinder.hh:19