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