Rivet  1.8.0
FinalState.hh
1 // -*- C++ -*-
2 #ifndef RIVET_FinalState_HH
3 #define RIVET_FinalState_HH
4 
5 #include "Rivet/Projection.hh"
6 #include "Rivet/Particle.hh"
7 #include "Rivet/Event.hh"
8 
9 namespace Rivet {
10 
11 
14  class FinalState : public Projection {
15  public:
16 
18 
19 
20 
21  FinalState(double mineta = -MAXRAPIDITY,
22  double maxeta = MAXRAPIDITY,
23  double minpt = 0.0*GeV);
24 
27  FinalState(const vector<pair<double, double> >& etaRanges,
28  double minpt = 0.0*GeV);
29 
31  virtual const Projection* clone() const {
32  return new FinalState(*this);
33  }
34 
36 
37 
39  virtual const ParticleVector& particles() const { return _theParticles; }
40 
42  template <typename F>
43  const ParticleVector& particles(F sorter) const {
44  std::sort(_theParticles.begin(), _theParticles.end(), sorter);
45  return _theParticles;
46  }
47 
49  const ParticleVector& particlesByPt() const {
50  return particles(cmpParticleByPt);
51  }
52 
54  const ParticleVector& particlesByP() const {
55  return particles(cmpParticleByP);
56  }
57 
59  const ParticleVector& particlesByE() const {
60  return particles(cmpParticleByE);
61  }
62 
64  const ParticleVector& particlesByEt() const {
65  return particles(cmpParticleByEt);
66  }
67 
69  const ParticleVector& particlesByEta() const {
71  }
72 
76  }
77 
79  virtual size_t size() const { return _theParticles.size(); }
80 
82  virtual bool empty() const { return _theParticles.empty(); }
84  virtual bool isEmpty() const { return _theParticles.empty(); }
85 
87  virtual double ptMin() const { return _ptmin; }
88 
89 
90  public:
91 
92  typedef Particle entity_type;
93  typedef ParticleVector collection_type;
94 
96  const collection_type& entities() const {
97  return particles();
98  }
99 
100 
101  protected:
102 
104  virtual void project(const Event& e);
105 
107  virtual int compare(const Projection& p) const;
108 
110  bool accept(const Particle& p) const;
111 
112 
113  protected:
114 
116  vector<pair<double,double> > _etaRanges;
117 
119  double _ptmin;
120 
122  mutable ParticleVector _theParticles;
123 
124  };
125 
126 
127 }
128 
129 #endif