Rivet
1.8.0
|
00001 // -*- C++ -*- 00002 #ifndef RIVET_FinalState_HH 00003 #define RIVET_FinalState_HH 00004 00005 #include "Rivet/Projection.hh" 00006 #include "Rivet/Particle.hh" 00007 #include "Rivet/Event.hh" 00008 00009 namespace Rivet { 00010 00011 00014 class FinalState : public Projection { 00015 public: 00016 00018 00019 00020 00021 FinalState(double mineta = -MAXRAPIDITY, 00022 double maxeta = MAXRAPIDITY, 00023 double minpt = 0.0*GeV); 00024 00027 FinalState(const vector<pair<double, double> >& etaRanges, 00028 double minpt = 0.0*GeV); 00029 00031 virtual const Projection* clone() const { 00032 return new FinalState(*this); 00033 } 00034 00036 00037 00039 virtual const ParticleVector& particles() const { return _theParticles; } 00040 00042 template <typename F> 00043 const ParticleVector& particles(F sorter) const { 00044 std::sort(_theParticles.begin(), _theParticles.end(), sorter); 00045 return _theParticles; 00046 } 00047 00049 const ParticleVector& particlesByPt() const { 00050 return particles(cmpParticleByPt); 00051 } 00052 00054 const ParticleVector& particlesByP() const { 00055 return particles(cmpParticleByP); 00056 } 00057 00059 const ParticleVector& particlesByE() const { 00060 return particles(cmpParticleByE); 00061 } 00062 00064 const ParticleVector& particlesByEt() const { 00065 return particles(cmpParticleByEt); 00066 } 00067 00069 const ParticleVector& particlesByEta() const { 00070 return particles(cmpParticleByAscPseudorapidity); 00071 } 00072 00074 const ParticleVector& particlesByModEta() const { 00075 return particles(cmpParticleByAscAbsPseudorapidity); 00076 } 00077 00079 virtual size_t size() const { return _theParticles.size(); } 00080 00082 virtual bool empty() const { return _theParticles.empty(); } 00084 virtual bool isEmpty() const { return _theParticles.empty(); } 00085 00087 virtual double ptMin() const { return _ptmin; } 00088 00089 00090 public: 00091 00092 typedef Particle entity_type; 00093 typedef ParticleVector collection_type; 00094 00096 const collection_type& entities() const { 00097 return particles(); 00098 } 00099 00100 00101 protected: 00102 00104 virtual void project(const Event& e); 00105 00107 virtual int compare(const Projection& p) const; 00108 00110 bool accept(const Particle& p) const; 00111 00112 00113 protected: 00114 00116 vector<pair<double,double> > _etaRanges; 00117 00119 double _ptmin; 00120 00122 mutable ParticleVector _theParticles; 00123 00124 }; 00125 00126 00127 } 00128 00129 #endif