rivet is hosted by Hepforge, IPPP Durham
FinalState.hh
Go to the documentation of this file.
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 #include "Rivet/Cuts.hh"
00009 
00010 
00011 namespace Rivet {
00012 
00013 
00014   /// @brief Project out all final-state particles in an event.
00015   /// Probably the most important projection in Rivet!
00016   class FinalState : public Projection {
00017   public:
00018 
00019     /// @name Standard constructors and destructors.
00020     //@{
00021     /// @deprecated Keep for backwards compatibility for now
00022     /// The default constructor. May specify the minimum and maximum
00023     /// pseudorapidity \f$ \eta \f$ and the min \f$ p_T \f$ (in GeV).
00024     FinalState(double mineta,
00025                double maxeta,
00026                double minpt = 0.0);
00027 
00028     /// Construction using Cuts object
00029     FinalState(Cut c = Cuts::open());
00030 
00031     /// Clone on the heap.
00032     virtual const Projection* clone() const {
00033       return new FinalState(*this);
00034     }
00035 
00036     //@}
00037 
00038 
00039     /// Get the final-state particles.
00040     virtual const Particles& particles() const { return _theParticles; }
00041 
00042     /// Get the final-state particles, ordered by supplied sorting function object.
00043     template <typename F>
00044     const Particles& particles(F sorter) const {
00045       std::sort(_theParticles.begin(), _theParticles.end(), sorter);
00046       return _theParticles;
00047     }
00048 
00049     /// Get the final-state particles, ordered by decreasing \f$ p_T \f$.
00050     const Particles& particlesByPt() const {
00051       return particles(cmpMomByPt);
00052     }
00053 
00054     /// Get the final-state particles, ordered by decreasing \f$ p \f$.
00055     const Particles& particlesByP() const {
00056       return particles(cmpMomByP);
00057     }
00058 
00059     /// Get the final-state particles, ordered by decreasing \f$ E \f$.
00060     const Particles& particlesByE() const {
00061       return particles(cmpMomByE);
00062     }
00063 
00064     /// Get the final-state particles, ordered by decreasing \f$ E_T \f$.
00065     const Particles& particlesByEt() const {
00066       return particles(cmpMomByEt);
00067     }
00068 
00069     /// Get the final-state particles, ordered by increasing \f$ \eta \f$.
00070     const Particles& particlesByEta() const {
00071       return particles(cmpMomByAscPseudorapidity);
00072     }
00073 
00074     /// Get the final-state particles, ordered by increasing \f$ |\eta| \f$.
00075     const Particles& particlesByModEta() const {
00076       return particles(cmpMomByAscAbsPseudorapidity);
00077     }
00078 
00079     /// Get the final-state particles, ordered by increasing \f$ y \f$.
00080     const Particles& particlesByRapidity() const {
00081       return particles(cmpMomByAscRapidity);
00082     }
00083 
00084     /// Get the final-state particles, ordered by increasing \f$ |y| \f$.
00085     const Particles& particlesByModRapidity() const {
00086       return particles(cmpMomByAscAbsRapidity);
00087     }
00088 
00089     /// Access the projected final-state particles.
00090     virtual size_t size() const { return _theParticles.size(); }
00091 
00092     /// Is this final state empty?
00093     virtual bool empty() const { return _theParticles.empty(); }
00094     /// @deprecated Is this final state empty?
00095     virtual bool isEmpty() const { return _theParticles.empty(); }
00096 
00097     /// Minimum-\f$ p_\perp \f$ requirement.
00098     //virtual double ptMin() const { return _ptmin; }
00099 
00100 
00101   public:
00102 
00103     typedef Particle entity_type;
00104     typedef Particles collection_type;
00105 
00106     /// Template-usable interface common to JetAlg.
00107     const collection_type& entities() const {
00108       return particles();
00109     }
00110 
00111 
00112   protected:
00113 
00114     /// Apply the projection to the event.
00115     virtual void project(const Event& e);
00116 
00117     /// Compare projections.
00118     virtual int compare(const Projection& p) const;
00119 
00120     /// Decide if a particle is to be accepted or not.
00121     bool accept(const Particle& p) const;
00122 
00123 
00124   protected:
00125     /// The applicable cuts
00126     Cut _cuts;
00127 
00128     /// The final-state particles.
00129     mutable Particles _theParticles;
00130 
00131   };
00132 
00133 
00134 }
00135 
00136 #endif