rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.0
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 {return _decaying;}
48
52 const vector<unsigned int> & nStable() const {return _nStable;}
53
57 const vector<map<PdgId,Particles> > & decayProducts() const {return _products;}
58
62 bool modeMatches(size_t imode,unsigned int nstable, map<PdgId,unsigned int> prod) const {
63 // same no of stable particles
64 if (nstable!=_nStable[imode]) return false;
65 for (const auto & kv : prod ) {
66 // check if same decay products
67 map<PdgId,Particles>::const_iterator iloc = _products[imode].find(kv.first);
68 // same type of product
69 if (iloc == _products[imode].end()) return false;
70 // and same number
71 if(iloc->second.size()!=kv.second) return false;
72 }
73 // pass all the tests
74 return true;
75 }
76
77 protected:
78
80 virtual void project(const Event& e);
81
83 virtual CmpState compare(const Projection& p) const;
84
85 private :
86
90 void findDecayProducts(const Particle & mother, unsigned int & nstable,
91 map<PdgId,Particles> & products);
92
93 private :
94
98 set<PdgId> _stable;
99
103 Particles _decaying;
104
108 vector<unsigned int> _nStable;
109
113 vector<map<PdgId,Particles> > _products;
114 };
115
116
117}
118
119#endif
Find the decay products of particles in the projection for subsquent analyses.
Definition DecayedParticles.hh:11
virtual CmpState compare(const Projection &p) const
Compare projections.
const vector< map< PdgId, Particles > > & decayProducts() const
Definition DecayedParticles.hh:57
const vector< unsigned int > & nStable() const
Definition DecayedParticles.hh:52
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
bool modeMatches(size_t imode, unsigned int nstable, map< PdgId, unsigned int > prod) const
Definition DecayedParticles.hh:62
const Particles & decaying() const
Definition DecayedParticles.hh:47
virtual ~DecayedParticles()
Virtual destructor.
Definition DecayedParticles.hh:32
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
Particle representation, either from a HepMC::GenEvent or reconstructed.
Definition Particle.hh:45
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:175
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
int pid(const Particle &p)
Unbound function access to PID code.
Definition ParticleUtils.hh:23
Definition MC_CENT_PPB_Projections.hh:10