rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.0
PrimaryParticles.hh
1// -*- C++ -*-
2#ifndef RIVET_PrimaryParticles_HH
3#define RIVET_PrimaryParticles_HH
4
5#include "Rivet/Projections/ParticleFinder.hh"
6#include "Rivet/Tools/Cuts.hh"
7
8namespace Rivet {
9
10
20 public:
21
22 using ParticleFinder::operator =;
23
28 PrimaryParticles(std::initializer_list<int> pids, const Cut& c=Cuts::open()) :
29 ParticleFinder(c), _pdgIds(pids) {
30 setName("PrimaryParticles");
31 }
32
33 // Clone on the heap.
34 RIVET_DEFAULT_PROJ_CLONE(PrimaryParticles);
35
37 using Projection::operator =;
38
39
42 ParticleFinder(other), _pdgIds(other._pdgIds) {
43 }
44
51 virtual CmpState compare(const Projection& p) const
52 {
53 const PrimaryParticles* other = dynamic_cast<const PrimaryParticles*>(&p);
54 if (!other) return CmpState::NEQ;
55 if (_cuts != other->_cuts || _pdgIds != other->_pdgIds) return CmpState::NEQ;
56 return CmpState::EQ;
57 }
58
59
60 protected:
61
65 virtual void project(const Event& e);
66
75 virtual bool isPrimary(ConstGenParticlePtr p) const;
76
78 virtual bool isIgnored(ConstGenParticlePtr p) const;
79
85 virtual bool isPrimaryPID(ConstGenParticlePtr p) const;
86
93 virtual bool hasDecayed(ConstGenParticlePtr p) const;
94
100 virtual bool isBeam(ConstGenParticlePtr p) const;
101
107 ConstGenParticlePtr ancestor(ConstGenParticlePtr p) const;
108
115 ConstGenParticlePtr ancestor(ConstGenParticlePtr p, bool) const;
116
118 vector<int> _pdgIds;
119
120 };
121
122
123}
124
125#endif
Representation of a HepMC event, and enabler of Projection caching.
Definition Event.hh:22
Base class for projections which return subsets of an event's particles.
Definition ParticleFinder.hh:11
Project out primary particles according to definition.
Definition PrimaryParticles.hh:19
ConstGenParticlePtr ancestor(ConstGenParticlePtr p, bool) const
virtual bool isIgnored(ConstGenParticlePtr p) const
Check if the particle should be ignored, via its status code.
virtual bool isBeam(ConstGenParticlePtr p) const
virtual bool isPrimaryPID(ConstGenParticlePtr p) const
PrimaryParticles(std::initializer_list< int > pids, const Cut &c=Cuts::open())
Definition PrimaryParticles.hh:28
virtual bool hasDecayed(ConstGenParticlePtr p) const
PrimaryParticles(const PrimaryParticles &other)
Copy constructor.
Definition PrimaryParticles.hh:41
ConstGenParticlePtr ancestor(ConstGenParticlePtr p) const
virtual void project(const Event &e)
virtual CmpState compare(const Projection &p) const
Definition PrimaryParticles.hh:51
Base class for all Rivet projections.
Definition Projection.hh:29
void setName(const std::string &name)
Used by derived classes to set their name.
Definition Projection.hh:148
PdgIdPair pids(const ParticlePair &pp)
Get the PDG ID codes of a ParticlePair.
Definition ParticleUtils.hh:717
const Cut & open()
Fully open cut singleton, accepts everything.
Definition MC_CENT_PPB_Projections.hh:10