rivet is hosted by Hepforge, IPPP Durham
LeadingParticlesFinalState.hh
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_LeadingParticlesFinalState_HH
00003 #define RIVET_LeadingParticlesFinalState_HH
00004 
00005 #include "Rivet/Event.hh"
00006 #include "Rivet/Projection.hh"
00007 #include "Rivet/Projections/FinalState.hh"
00008 
00009 namespace Rivet {
00010 
00011   class Particle;
00012 
00013   /// @brief Get the highest-pT occurrences of FS particles with the specified PDG IDs.
00014   class LeadingParticlesFinalState : public FinalState {
00015 
00016   public:
00017 
00018     /// Constructor: the supplied FinalState projection is assumed to live through the run.
00019     LeadingParticlesFinalState(const FinalState& fsp)
00020       :  FinalState(), _leading_only(false)
00021     {
00022       setName("LeadingParticlesFinalState");
00023       addProjection(fsp, "FS");
00024     }
00025 
00026     /// Clone on the heap.
00027     virtual const Projection *clone() const {
00028       return new LeadingParticlesFinalState(*this);
00029     }
00030 
00031     /// Add a particle ID to the list of leading particles selected
00032     LeadingParticlesFinalState& addParticleId(long id) {
00033       _ids.insert(id);
00034       return *this;
00035     }
00036 
00037     /// Add a particle ID to the list of leading particles selected
00038     LeadingParticlesFinalState& addParticleIdPair(long id) {
00039       _ids.insert(id);
00040       _ids.insert(-id);
00041       return *this;
00042     }
00043 
00044     /// Toggle whether to keep track only of the leading particle of any ID,
00045     /// or the leading particle of all IDs separately
00046     /// Default is the latter (=false)
00047     void setLeadingOnly(const bool& leadingonly) {
00048       _leading_only = leadingonly;
00049     }
00050 
00051     // /// Check if a particle of a particular ID was found in the current event
00052     // bool hasParticleId(const PdgId pid) const;
00053 
00054     // /// Get a particle of a particular ID (check it exists first)
00055     // bool get(const PdgId pid) const;
00056 
00057 
00058   protected:
00059 
00060     /// Apply the projection on the supplied event.
00061     void project(const Event& e);
00062 
00063     /// Compare projections.
00064     int compare(const Projection& p) const;
00065 
00066     /// Check if the particle's ID is in the list
00067     bool inList(const Particle& particle) const;
00068 
00069   private:
00070 
00071     /// IDs of the leading particles to be selected
00072     std::set<long>_ids;
00073     bool _leading_only;
00074 
00075   };
00076 
00077 }
00078 
00079 #endif