Rivet  1.8.3
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 
81  }
82 
86  }
87 
89  virtual size_t size() const { return _theParticles.size(); }
90 
92  virtual bool empty() const { return _theParticles.empty(); }
94  virtual bool isEmpty() const { return _theParticles.empty(); }
95 
97  virtual double ptMin() const { return _ptmin; }
98 
99 
100  public:
101 
102  typedef Particle entity_type;
103  typedef ParticleVector collection_type;
104 
106  const collection_type& entities() const {
107  return particles();
108  }
109 
110 
111  protected:
112 
114  virtual void project(const Event& e);
115 
117  virtual int compare(const Projection& p) const;
118 
120  bool accept(const Particle& p) const;
121 
122 
123  protected:
124 
126  vector<pair<double,double> > _etaRanges;
127 
129  double _ptmin;
130 
132  mutable ParticleVector _theParticles;
133 
134  };
135 
136 
137 }
138 
139 #endif