rivet is hosted by Hepforge, IPPP Durham
Rivet  2.7.0
JetAlg.hh
1 // -*- C++ -*-
2 #ifndef RIVET_JetAlg_HH
3 #define RIVET_JetAlg_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 JetAlg : public Projection {
16  public:
17 
19  enum MuonsStrategy { NO_MUONS, DECAY_MUONS, ALL_MUONS };
20 
22  enum InvisiblesStrategy { NO_INVISIBLES, DECAY_INVISIBLES, ALL_INVISIBLES };
23 
24 
25 
27  JetAlg(const FinalState& fs, MuonsStrategy usemuons=JetAlg::ALL_MUONS, InvisiblesStrategy useinvis=JetAlg::NO_INVISIBLES);
28 
30  JetAlg() {};
31 
33  virtual unique_ptr<Projection> clone() const = 0;
34 
36  virtual ~JetAlg() { }
37 
38 
43 
44 
51  void useMuons(MuonsStrategy usemuons=ALL_MUONS) {
52  _useMuons = usemuons;
53  }
54 
61  void useInvisibles(InvisiblesStrategy useinvis=DECAY_INVISIBLES) {
62  _useInvisibles = useinvis;
63  }
64 
73  void useInvisibles(bool useinvis) {
74  _useInvisibles = useinvis ? DECAY_INVISIBLES : NO_INVISIBLES;
75  }
76 
78 
79 
81 
82 
85  virtual Jets jets(const Cut& c=Cuts::open()) const {
86  return filter_select(_jets(), c);
87  // const Jets rawjets = _jets();
88  // // Just return a copy of rawjets if the cut is open
89  // if (c == Cuts::open()) return rawjets;
90  // // If there is a non-trivial cut...
91  // /// @todo Use an STL erase(remove_if) and lambda function for this
92  // Jets rtn;
93  // rtn.reserve(size());
94  // foreach (const Jet& j, rawjets)
95  // if (c->accept(j)) rtn.push_back(j);
96  // return rtn;
97  }
98 
101  virtual Jets jets(const JetSelector& selector) const {
102  return filter_select(_jets(), selector);
103  }
104 
105 
108  Jets jets(const Cut& c, const JetSorter& sorter) const {
110  return sortBy(jets(c), sorter);
111  }
112 
115  Jets jets(const JetSorter& sorter, const Cut& c=Cuts::open()) const {
117  return jets(c, sorter);
118  }
119 
122  Jets jets(const JetSelector& selector, const JetSorter& sorter) const {
124  return sortBy(jets(selector), sorter);
125  }
126 
129  Jets jets(const JetSorter& sorter, const JetSelector selector) const {
131  return jets(selector, sorter);
132  }
133 
134 
141  Jets jetsByPt(const Cut& c=Cuts::open()) const {
142  return jets(c, cmpMomByPt);
143  }
144 
151  Jets jetsByPt(const JetSelector& selector) const {
152  return jets(selector, cmpMomByPt);
153  }
154 
162  Jets jetsByPt(double ptmin) const {
163  return jets(Cuts::pT >= ptmin, cmpMomByPt);
164  }
165 
167 
168 
169  protected:
170 
172  virtual Jets _jets() const = 0;
173 
174 
175  public:
176 
178  size_t size() const { return jets().size(); }
180  size_t size(const Cut& c) const { return jets(c).size(); }
182  size_t size(const JetSelector& s) const { return jets(s).size(); }
183 
185  bool empty() const { return size() == 0; }
187  bool empty(const Cut& c) const { return size(c) == 0; }
189  bool empty(const JetSelector& s) const { return size(s) == 0; }
190 
192  virtual void reset() = 0;
193 
194  typedef Jet entity_type;
195  typedef Jets collection_type;
196 
198  collection_type entities() const { return jets(); }
199 
200  // /// Do the calculation locally (no caching).
201  // virtual void calc(const Particles& constituents, const Particles& tagparticles=Particles()) = 0;
202 
203 
204  protected:
205 
207  virtual void project(const Event& e) = 0;
208 
210  virtual int compare(const Projection& p) const = 0;
211 
212 
213  protected:
214 
216  MuonsStrategy _useMuons;
217 
219  InvisiblesStrategy _useInvisibles;
220 
221 
222  };
223 
224 
227  using JetFinder = JetAlg;
228 
229 
230 }
231 
232 #endif
Definition: ALICE_2010_I880049.cc:13
bool empty(const Cut &c) const
Is this jet finder empty after a Cut is applied?
Definition: JetAlg.hh:187
virtual void project(const Event &e)=0
Perform the projection on the Event.
virtual Jets jets(const JetSelector &selector) const
Definition: JetAlg.hh:101
Jets jets(const JetSorter &sorter, const JetSelector selector) const
Definition: JetAlg.hh:129
size_t size(const Cut &c) const
Count the jets after a Cut is applied.
Definition: JetAlg.hh:180
bool empty() const
Is this jet finder empty?
Definition: JetAlg.hh:185
virtual void reset()=0
Clear the projection.
Jets jetsByPt(double ptmin) const
Definition: JetAlg.hh:162
Jets jets(const JetSelector &selector, const JetSorter &sorter) const
Definition: JetAlg.hh:122
void useInvisibles(bool useinvis)
Include (some) invisible particles in jet construction.
Definition: JetAlg.hh:73
Definition: Event.hh:22
virtual Jets jets(const Cut &c=Cuts::open()) const
Definition: JetAlg.hh:85
Jets jets(const Cut &c, const JetSorter &sorter) const
Definition: JetAlg.hh:108
Jets jets(const JetSorter &sorter, const Cut &c=Cuts::open()) const
Definition: JetAlg.hh:115
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:143
size_t size() const
Count the jets.
Definition: JetAlg.hh:178
collection_type entities() const
Template-usable interface common to FinalState.
Definition: JetAlg.hh:198
const Cut & open()
Fully open cut singleton, accepts everything.
Definition: Cuts.cc:81
virtual unique_ptr< Projection > clone() const =0
Clone on the heap.
virtual ~JetAlg()
Destructor.
Definition: JetAlg.hh:36
virtual int compare(const Projection &p) const =0
Compare projections.
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
bool cmpMomByPt(const FourMomentum &a, const FourMomentum &b)
Comparison to give a sorting by decreasing pT.
Definition: Vector4.hh:1342
MOMS & sortBy(MOMS &pbs, const CMP &cmp)
Sort a container of momenta by cmp and return by reference for non-const inputs.
Definition: Vector4.hh:1431
InvisiblesStrategy
Enum for the treatment of invisible particles: whether to include all, some, or none in jet-finding...
Definition: JetAlg.hh:22
size_t size(const JetSelector &s) const
Count the jets after a selection functor is applied.
Definition: JetAlg.hh:182
Representation of a clustered jet of particles.
Definition: Jet.hh:18
Jets jetsByPt(const JetSelector &selector) const
Definition: JetAlg.hh:151
Base class for all Rivet projections.
Definition: Projection.hh:29
JetAlg()
Default constructor.
Definition: JetAlg.hh:30
function< bool(const Jet &)> JetSelector
std::function instantiation for functors taking a Jet and returning a bool
Definition: JetUtils.hh:41
Jets jetsByPt(const Cut &c=Cuts::open()) const
Definition: JetAlg.hh:141
void useMuons(MuonsStrategy usemuons=ALL_MUONS)
Include (some) muons in jet construction.
Definition: JetAlg.hh:51
void useInvisibles(InvisiblesStrategy useinvis=DECAY_INVISIBLES)
Include (some) invisible particles in jet construction.
Definition: JetAlg.hh:61
Abstract base class for projections which can return a set of Jets.
Definition: JetAlg.hh:15
function< bool(const Jet &, const Jet &)> JetSorter
std::function instantiation for functors taking two Jets and returning a bool
Definition: JetUtils.hh:43
bool empty(const JetSelector &s) const
Is this jet finder empty after a selection functor is applied?
Definition: JetAlg.hh:189