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 /// Project only 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() 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 // /// Check if a particle of a particular ID was found in the current event 00045 // bool hasParticleId(const PdgId pid) const; 00046 00047 // /// Get a particle of a particular ID (check it exists first) 00048 // bool get(const PdgId pid) const; 00049 00050 00051 protected: 00052 00053 /// Apply the projection on the supplied event. 00054 void project(const Event& e); 00055 00056 /// Compare projections. 00057 int compare(const Projection& p) const; 00058 00059 /// Check if the particle's ID is in the list 00060 bool inList(const Particle& particle) const; 00061 00062 private: 00063 00064 /// IDs of the leading particles to be selected 00065 std::set<long>_ids; 00066 00067 }; 00068 00069 } 00070 00071 #endif