Rivet API documentation

Rivet 4.1.3
DecayedParticles.hh
1// -*- C++ -*-
2#ifndef RIVET_DecayedParticles_HH
3#define RIVET_DecayedParticles_HH
4
5#include "Rivet/Projections/ParticleFinder.hh"
6
7namespace Rivet {
8
9
12 public:
13
16
19
20 DecayedParticles(const ParticleFinder& particles) {
21 setName("DecayedParticles");
22 declare(particles, "PARTICLES");
23 }
24
27
29 using Projection::operator=;
30
32 virtual ~DecayedParticles() { }
33
35
36 public:
37
40 _stable.insert(pid);
41 return *this;
42 }
43
47 const Particles& decaying() const {
48 return _decaying;
49 }
50
54 const vector<unsigned int>& nStable() const {
55 return _nStable;
56 }
57
61 const vector<map<PdgId, Particles>>& decayProducts() const {
62 return _products;
63 }
64
68 bool modeMatches(size_t imode, unsigned int nstable, const map<PdgId, unsigned int>& prod) const {
69 // same no of stable particles
70 if (nstable != _nStable[imode]) return false;
71 for (const auto& kv : prod) {
72 // check if same decay products
73 map<PdgId, Particles>::const_iterator iloc = _products[imode].find(kv.first);
74 // same type of product
75 if (iloc == _products[imode].end()) return false;
76 // and same number
77 if (iloc->second.size() != kv.second) return false;
78 }
79 // pass all the tests
80 return true;
81 }
82
83 protected:
84
86 virtual void project(const Event& e);
87
89 virtual CmpState compare(const Projection& p) const;
90
91 private:
92
96 void findDecayProducts(const Particle& mother,
97 unsigned int& nstable,
98 map<PdgId, Particles>& products) const;
99
100 private:
101
105 set<PdgId> _stable;
106
110 Particles _decaying;
111
115 vector<unsigned int> _nStable;
116
120 vector<map<PdgId, Particles>> _products;
121 };
122
123
124}
125
126#endif
virtual CmpState compare(const Projection &p) const
Compare projections.
const vector< map< PdgId, Particles > > & decayProducts() const
Definition DecayedParticles.hh:61
const vector< unsigned int > & nStable() const
Definition DecayedParticles.hh:54
virtual void project(const Event &e)
Apply the projection to the event.
RIVET_DEFAULT_PROJ_CLONE(DecayedParticles)
Clone on the heap.
DecayedParticles()
Constructor.
Definition DecayedParticles.hh:18
DecayedParticles & addStable(PdgId pid)
Add a particle to be considered stable when finding the decay products.
Definition DecayedParticles.hh:39
const Particles & decaying() const
Definition DecayedParticles.hh:47
bool modeMatches(size_t imode, unsigned int nstable, const map< PdgId, unsigned int > &prod) const
Definition DecayedParticles.hh:68
virtual ~DecayedParticles()
Virtual destructor.
Definition DecayedParticles.hh:32
Base class for projections which return subsets of an event's particles.
Definition ParticleFinder.hh:11
Particle representation, either from a HepMC::GenEvent or reconstructed.
Definition Particle.hh:50
Specialised vector of Particle objects.
Definition Particle.hh:21
const PROJ & declare(const PROJ &proj, const std::string &name) const
Register a contained projection (user-facing version).
Definition ProjectionApplier.hh:205
Projection()
The default constructor.
friend class Event
Event is a friend.
Definition Projection.hh:33
void setName(const std::string &name)
Used by derived classes to set their name.
Definition Projection.hh:146
STL iterator class.
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:819
int pid(const Particle &p)
Unbound function access to PID code.
Definition ParticleUtils.hh:23
Definition LHCbCommon.hh:9