Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-05-12 09:05:02

0001 // -*- C++ -*-
0002 #ifndef RIVET_LeadingParticlesFinalState_HH
0003 #define RIVET_LeadingParticlesFinalState_HH
0004 
0005 #include "Rivet/Event.hh"
0006 #include "Rivet/Projection.hh"
0007 #include "Rivet/Projections/FinalState.hh"
0008 
0009 namespace Rivet {
0010 
0011 
0012   /// @brief Get the highest-pT occurrences of FS particles with the specified PDG IDs.
0013   class LeadingParticlesFinalState : public FinalState {
0014   public:
0015 
0016     /// Constructor: the supplied FinalState projection is assumed to live through the run.
0017     LeadingParticlesFinalState(const FinalState& fsp)
0018       :  FinalState(), _leading_only(false)
0019     {
0020       setName("LeadingParticlesFinalState");
0021       declare(fsp, "FS");
0022     }
0023 
0024     /// Clone on the heap.
0025     RIVET_DEFAULT_PROJ_CLONE(LeadingParticlesFinalState);
0026 
0027     /// Import to avoid warnings about overload-hiding
0028     using Projection::operator =;
0029 
0030 
0031     /// Add a particle ID to the list of leading particles selected
0032     LeadingParticlesFinalState& addParticleId(PdgId id) {
0033       _ids.insert(id);
0034       return *this;
0035     }
0036 
0037     /// Add a particle ID to the list of leading particles selected
0038     LeadingParticlesFinalState& addParticleIds(vector<PdgId> ids) {
0039       for (PdgId id : ids) _ids.insert(id);
0040       return *this;
0041     }
0042 
0043     /// Add a particle ID to the list of leading particles selected
0044     LeadingParticlesFinalState& addParticleIdPair(PdgId id) {
0045       _ids.insert(id);
0046       _ids.insert(-id);
0047       return *this;
0048     }
0049 
0050     /// Toggle whether to keep track only of the leading particle of any ID,
0051     /// or the leading particle of all IDs separately
0052     /// Default is the latter (=false)
0053     void setLeadingOnly(bool leadingonly) {
0054       _leading_only = leadingonly;
0055     }
0056 
0057     // /// Check if a particle of a particular ID was found in the current event
0058     // bool hasParticleId(const PdgId pid) const;
0059 
0060     // /// Get a particle of a particular ID (check it exists first)
0061     // bool get(const PdgId pid) const;
0062 
0063 
0064     /// Apply the projection on the supplied event.
0065     void project(const Event& e);
0066 
0067     /// Compare projections.
0068     CmpState compare(const Projection& p) const;
0069 
0070 
0071   protected:
0072 
0073     /// IDs of the leading particles to be selected
0074     std::set<long> _ids;
0075     bool _leading_only;
0076 
0077   };
0078 
0079 
0080 }
0081 
0082 #endif