rivet is hosted by Hepforge, IPPP Durham
Rivet  2.7.0
PrimaryParticles.hh
Go to the documentation of this file.
1 // -*- C++ -*-
8 #ifndef RIVET_PrimaryParticles_HH
9 #define RIVET_PrimaryParticles_HH
10 
11 #include <Rivet/Projections/ParticleFinder.hh>
12 #include <Rivet/Tools/Cuts.hh>
13 
14 namespace Rivet
15 {
21  //
23  {
24  public:
36  PrimaryParticles(std::initializer_list<int> pdgIds,
37  const Cut& c=Cuts::open()) :
38  ParticleFinder(c), _pdgIds(pdgIds) {
39  setName("PrimaryParticles");
40  }
41  // Clone on the heap.
42  DEFAULT_RIVET_PROJ_CLONE(PrimaryParticles);
43 
50  ParticleFinder(other), _pdgIds(other._pdgIds) {
51  }
61  virtual int compare(const Projection& p) const
62  {
63  const PrimaryParticles* other = dynamic_cast<const PrimaryParticles*>(&p);
64  if (!other) return UNDEFINED;
65  if (_cuts != other->_cuts || _pdgIds != other->_pdgIds) return UNDEFINED;
66  return EQUIVALENT;
67 
68  }
69  protected:
75  virtual void project(const Event& e);
76 
88  virtual bool isPrimary(const HepMC::GenParticle* p) const;
93  virtual bool isIgnored(const HepMC::GenParticle* p) const;
103  virtual bool isPrimaryPID(const HepMC::GenParticle* p) const;
104  /*
105  * Check if a particle @a p has decayed.
106  *
107  * @param p Pointer to HepMC particle
108  *
109  * @return true if the particle has decayed according to the
110  * status flag of the particle @a p
111  */
112  virtual bool hasDecayed(const HepMC::GenParticle* p) const;
120  virtual bool isBeam(const HepMC::GenParticle* p) const;
121  /*
122  * Get the immediate ancestor of a particle.
123  *
124  * @param p Particle for which to get the immediate ancestor
125  *
126  * @return Pointer to immediate ancestor or null if there's no ancestor.
127  */
128  const HepMC::GenParticle* ancestor(const HepMC::GenParticle* p) const;
129  /*
130  * Get the immediate ancestor of a particle, which is @e not an
131  * ignored particle.
132  *
133  * @param p Particle for which to get the immediate ancestor
134  *
135  * @return Pointer to immediate ancestor or null if there's no ancestor.
136  */
137  const HepMC::GenParticle* ancestor(const HepMC::GenParticle* p, bool) const;
139  std::vector<int> _pdgIds;
140  };
141 }
142 #endif
void setName(const std::string &name)
Used by derived classes to set their name.
Definition: Projection.hh:133
Definition: ALICE_2010_I880049.cc:13
PrimaryParticles(const PrimaryParticles &other)
Definition: PrimaryParticles.hh:49
virtual bool isPrimaryPID(const HepMC::GenParticle *p) const
Definition: PrimaryParticles.cc:48
Project out primary particles according to definition. A Rivet projection that mimics an experimental...
Definition: PrimaryParticles.hh:22
virtual void project(const Event &e)
Definition: PrimaryParticles.cc:19
Base class for projections which return subsets of an event&#39;s particles.
Definition: ParticleFinder.hh:11
virtual int compare(const Projection &p) const
Definition: PrimaryParticles.hh:61
Definition: Event.hh:22
const Cut & open()
Fully open cut singleton, accepts everything.
Definition: Cuts.cc:81
virtual bool isBeam(const HepMC::GenParticle *p) const
Definition: PrimaryParticles.cc:56
virtual bool isPrimary(const HepMC::GenParticle *p) const
Definition: PrimaryParticles.cc:29
virtual bool isIgnored(const HepMC::GenParticle *p) const
Definition: PrimaryParticles.cc:43
Base class for all Rivet projections.
Definition: Projection.hh:29
PrimaryParticles(std::initializer_list< int > pdgIds, const Cut &c=Cuts::open())
Definition: PrimaryParticles.hh:36