|
|
|||
File indexing completed on 2025-12-15 10:28:00
0001 // -*- C++ -*- 0002 #ifndef RIVET_PrimaryParticles_HH 0003 #define RIVET_PrimaryParticles_HH 0004 0005 #include "Rivet/Projections/ParticleFinder.hh" 0006 #include "Rivet/Tools/Cuts.hh" 0007 0008 namespace Rivet { 0009 0010 0011 /// @brief Project out primary particles according to definition 0012 /// 0013 /// Mimic an experimental primary-particle definition by projecting 0014 /// out according to particle ID. The projection can be further 0015 /// specialized to accommodate specific experimental definitions. 0016 /// 0017 /// @author Christian Holm Christensen <cholm@nbi.dk> 0018 class PrimaryParticles : public ParticleFinder { 0019 public: 0020 0021 using ParticleFinder::operator =; 0022 0023 /// Constructor 0024 /// 0025 /// @param pids List of PDG IDs which are considered primary 0026 /// @param c Normal particle cuts 0027 PrimaryParticles(std::initializer_list<int> pids, const Cut& c=Cuts::open()) 0028 : ParticleFinder(c), _pdgIds(pids) 0029 { 0030 setName("PrimaryParticles"); 0031 } 0032 0033 // Clone on the heap. 0034 RIVET_DEFAULT_PROJ_CLONE(PrimaryParticles); 0035 0036 /// Import to avoid warnings about overload-hiding 0037 using Projection::operator =; 0038 0039 0040 /// Copy constructor 0041 PrimaryParticles(const PrimaryParticles& other) : 0042 ParticleFinder(other), _pdgIds(other._pdgIds) { 0043 } 0044 0045 /// Compare to another projection 0046 /// 0047 /// @param p Projection to compare to. 0048 /// 0049 /// @return Equivalent if the projection @a p is of the same type as this, 0050 /// the cuts are equal, and the list of PDG IDs is the same. 0051 virtual CmpState compare(const Projection& p) const 0052 { 0053 const PrimaryParticles* other = dynamic_cast<const PrimaryParticles*>(&p); 0054 if (!other) return CmpState::NEQ; 0055 if (_cuts != other->_cuts || _pdgIds != other->_pdgIds) return CmpState::NEQ; 0056 return CmpState::EQ; 0057 } 0058 0059 0060 protected: 0061 0062 /// Do the projection. 0063 /// 0064 /// @param e Event to project from 0065 virtual void project(const Event& e); 0066 0067 /// @name Internally used member functions 0068 /// @{ 0069 /// 0070 /// Check if the particle is a primary. 0071 /// 0072 /// @param p Pointer to a HepMC particle 0073 /// 0074 /// @return true if the particle @a p is considered primary 0075 virtual bool isPrimary(ConstGenParticlePtr p) const; 0076 0077 /// Check if the particle should be ignored, via its status code 0078 virtual bool isIgnored(ConstGenParticlePtr p) const; 0079 0080 /// Check PDG ID of particle @a p is in the list of accepted primaries 0081 /// 0082 /// @param p Particle to investigate. 0083 /// 0084 /// @return true if the particle PDG ID is in the list of known primary PDG IDs. 0085 virtual bool isPrimaryPID(ConstGenParticlePtr p) const; 0086 0087 /// Check if a particle @a p has decayed. 0088 /// 0089 /// @param p Pointer to HepMC particle 0090 /// 0091 /// @return true if the particle has decayed according to the 0092 /// status flag of the particle @a p 0093 virtual bool hasDecayed(ConstGenParticlePtr p) const; 0094 0095 /// Check if a particle is a beam (remnant) particle. 0096 /// 0097 /// @param p Particle to check 0098 /// 0099 /// @return true if the particle @a p is a (remnant) beam particle 0100 virtual bool isBeam(ConstGenParticlePtr p) const; 0101 0102 /// Get the immediate ancestor of a particle. 0103 /// 0104 /// @param p Particle for which to get the immediate ancestor 0105 /// 0106 /// @return Pointer to immediate ancestor or null if there's no ancestor. 0107 ConstGenParticlePtr ancestor(ConstGenParticlePtr p) const; 0108 0109 /// Get the immediate ancestor of a particle, which is @e not an 0110 /// ignored particle. 0111 /// 0112 /// @param p Particle for which to get the immediate ancestor 0113 /// 0114 /// @return Pointer to immediate ancestor or null if there's no ancestor. 0115 ConstGenParticlePtr ancestor(ConstGenParticlePtr p, bool) const; 0116 0117 /// Particle types to test for 0118 vector<int> _pdgIds; 0119 0120 }; 0121 0122 0123 } 0124 0125 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|