Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 #ifndef RIVET_IdentifiedFinalState_HH
0003 #define RIVET_IdentifiedFinalState_HH
0004 
0005 #include "Rivet/Projections/FinalState.hh"
0006 
0007 namespace Rivet {
0008 
0009 
0010   /// @brief Produce a final state which only contains specified particle IDs.
0011   class IdentifiedFinalState : public FinalState {
0012   public:
0013 
0014     /// @name Constructors
0015     /// @{
0016 
0017     /// Constructor with a FinalState and optional list of PDG ID codes.
0018     IdentifiedFinalState(const FinalState& fsp, const vector<PdgId>& pids=vector<PdgId>());
0019 
0020     /// Constructor with a FinalState and a single PDG ID code.
0021     IdentifiedFinalState(const FinalState& fsp, PdgId pid);
0022 
0023     /// Construction using optional Cuts object and optional list of PDG ID codes
0024     IdentifiedFinalState(const Cut& c=Cuts::open(), const vector<PdgId>& pids=vector<PdgId>());
0025 
0026     /// Construction using list of PDG ID codes and an optional Cuts object
0027     IdentifiedFinalState(const vector<PdgId>& pids, const Cut& c=Cuts::open());
0028 
0029     /// Construction using Cuts object and a single PDG ID code
0030     IdentifiedFinalState(const Cut& c, PdgId pid);
0031 
0032     /// Construction using a single PDG ID code and an optional Cuts object
0033     IdentifiedFinalState(PdgId pid, const Cut& c=Cuts::open());
0034 
0035 
0036     /// Clone on the heap.
0037     RIVET_DEFAULT_PROJ_CLONE(IdentifiedFinalState);
0038 
0039     /// @}
0040 
0041     /// Import to avoid warnings about overload-hiding
0042     using Projection::operator =;
0043 
0044 
0045     /// Get the list of particle IDs to accept.
0046     const set<PdgId>& acceptedIds() const {
0047       return _pids;
0048     }
0049 
0050     /// Add an accepted particle ID.
0051     IdentifiedFinalState& acceptId(PdgId pid) {
0052       _pids.insert(pid);
0053       return *this;
0054     }
0055 
0056     /// Add a set of accepted particle IDs.
0057     IdentifiedFinalState& acceptIds(const vector<PdgId>& pids) {
0058       for (const PdgId pid : pids) _pids.insert(pid);
0059       return *this;
0060     }
0061 
0062     /// Add an accepted particle ID and its antiparticle.
0063     IdentifiedFinalState& acceptIdPair(PdgId pid) {
0064       _pids.insert(pid);
0065       _pids.insert(-pid);
0066       return *this;
0067     }
0068 
0069     /// Add a set of accepted particle IDs and their antiparticles.
0070     IdentifiedFinalState& acceptIdPairs(const vector<PdgId>& pids) {
0071       for (const PdgId pid : pids) {
0072         _pids.insert(pid);
0073         _pids.insert(-pid);
0074       }
0075       return *this;
0076     }
0077 
0078     /// Accept all neutrinos (convenience method).
0079     IdentifiedFinalState& acceptNeutrinos() {
0080       acceptIdPair(PID::NU_E);
0081       acceptIdPair(PID::NU_MU);
0082       acceptIdPair(PID::NU_TAU);
0083       return *this;
0084     }
0085 
0086     /// Accept all charged leptons (convenience method).
0087     IdentifiedFinalState& acceptChLeptons() {
0088       acceptIdPair(PID::ELECTRON);
0089       acceptIdPair(PID::MUON);
0090       acceptIdPair(PID::TAU);
0091       return *this;
0092     }
0093 
0094     /// Reset the list of particle IDs to accept.
0095     void reset() {
0096       _pids.clear();
0097     }
0098 
0099     // The remaining particles
0100     virtual const Particles& remainingParticles() const {
0101       return _remainingParticles;
0102     }
0103 
0104 
0105     /// Apply the projection on the supplied event.
0106     void project(const Event& e);
0107 
0108     /// Compare projections.
0109     CmpState compare(const Projection& p) const;
0110 
0111 
0112   protected:
0113 
0114     /// The accepted final-state particle IDs.
0115     set<PdgId> _pids;
0116 
0117     // A vector of all other particles in the final state
0118     Particles _remainingParticles;
0119 
0120   };
0121 
0122 
0123 }
0124 
0125 #endif