Rivet 3.1.9
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
15
16
18
19 DecayedParticles(const ParticleFinder & particles) {
20 setName("DecayedParticles");
21 declare(particles, "PARTICLES");
22 }
23
26
28 using Projection::operator =;
29
31 virtual ~DecayedParticles() { }
33
34 public :
35
38 _stable.insert(pid);
39 return *this;
40 }
41
45 const Particles & decaying() const {return _decaying;}
46
50 const vector<unsigned int> & nStable() const {return _nStable;}
51
55 const vector<map<PdgId,Particles> > & decayProducts() const {return _products;}
56
60 bool modeMatches(size_t imode,unsigned int nstable, map<PdgId,unsigned int> prod) const {
61 // same no of stable particles
62 if(nstable!=_nStable[imode]) return false;
63 for (const auto & kv : prod ) {
64 // check if same decay products
65 map<PdgId,Particles>::const_iterator iloc = _products[imode].find(kv.first);
66 // same type of product
67 if (iloc == _products[imode].end()) return false;
68 // and same number
69 if(iloc->second.size()!=kv.second) return false;
70 }
71 // pass all the tests
72 return true;
73 }
74
75 protected:
76
78 virtual void project(const Event& e);
79
81 virtual CmpState compare(const Projection& p) const;
82
83 private :
84
88 void findDecayProducts(const Particle & mother, unsigned int & nstable,
89 map<PdgId,Particles> & products);
90
91 private :
92
96 set<PdgId> _stable;
97
101 Particles _decaying;
102
106 vector<unsigned int> _nStable;
107
111 vector<map<PdgId,Particles> > _products;
112 };
113
114
115}
116
117#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:55
const vector< unsigned int > & nStable() const
Definition DecayedParticles.hh:50
virtual void project(const Event &e)
Apply the projection to the event.
DecayedParticles()
Constructor.
Definition DecayedParticles.hh:17
DecayedParticles & addStable(PdgId pid)
Add a particle to be considered stable when finding the decay products.
Definition DecayedParticles.hh:37
DEFAULT_RIVET_PROJ_CLONE(DecayedParticles)
Clone on the heap.
bool modeMatches(size_t imode, unsigned int nstable, map< PdgId, unsigned int > prod) const
Definition DecayedParticles.hh:60
const Particles & decaying() const
Definition DecayedParticles.hh:45
virtual ~DecayedParticles()
Virtual destructor.
Definition DecayedParticles.hh:31
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:53
Specialised vector of Particle objects.
Definition Particle.hh:25
const PROJ & declare(const PROJ &proj, const std::string &name)
Register a contained projection (user-facing version)
Definition ProjectionApplier.hh:170
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:142
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:684
int pid(const Particle &p)
Unbound function access to PID code.
Definition ParticleUtils.hh:23
Definition MC_Cent_pPb.hh:10