A set of ParticleType objects, with defined order.
More...
#include <Const.h>
A set of ParticleType objects, with defined order.
Allows easy iteration over a set of particles, e.g. to print indices and PDG codes:
B2INFO("index -> PDG code");
B2INFO(pdgIter.getIndex() << " -> " << pdgIter.getPDGCode());
}
B2INFO(pdgIter.getIndex() << " -> " << pdgIter.getPDGCode());
}
Provides a type-safe way to pass members of the chargedStableSet set.
A set of ParticleType objects, with defined order.
static const ParticleSet chargedStableSet
set of charged stable particles
ParticleSets can be created by merging ParticleType objects or other ParticleSets:
static const ChargedStable muon
muon particle
static const ParticleType photon
photon particle
static const ChargedStable electron
electron particle
Definition at line 517 of file Const.h.
◆ ParticleSet()
Copy constructor to make sure particles belong to correct set.
Definition at line 523 of file Const.h.
524 {
525 for (const ParticleType& pdgIter : other) add(pdgIter);
526 }
◆ add()
Add a copy of the given ParticleType to this set.
If the set already contains the given particle, it remains unchanged.
Definition at line 414 of file UnitConst.cc.
415{
417 return;
419}
bool contains(const ParticleType &p) const
Returns true if and only if the set contains 'p'.
std::vector< ParticleType > m_particles
Actual particles.
◆ at()
Return particle at given index, or end() if out of range.
Definition at line 549 of file Const.h.
550 {
551 if (index < m_particles.size())
552 return m_particles[index];
553 return invalidParticle;
554 }
◆ begin()
Returns first particle.
Definition at line 557 of file Const.h.
558 {
559 if (m_particles.empty())
560 return end();
561 return m_particles[0];
562 }
◆ contains()
Returns true if and only if the set contains 'p'.
Definition at line 421 of file UnitConst.cc.
◆ end()
Returns an invalid particle to check if iteration should be stopped.
Definition at line 565 of file Const.h.
566 {
567 return invalidParticle;
568 }
◆ find()
Returns particle in set with given PDG code, or invalidParticle if not found.
Definition at line 571 of file Const.h.
572 {
573 for (ParticleType pdgIter : *this) {
574 if (pdgIter.getPDGCode() == pdg)
575 return m_particles[pdgIter.getIndex()];
576 }
577
578 return invalidParticle;
579 }
◆ operator=()
Assignment operator.
Definition at line 529 of file Const.h.
530 {
531 m_particles.clear();
532 for (const ParticleType& pdgIter : other) add(pdgIter);
533 return *this;
534 }
◆ size()
unsigned int size |
( |
| ) |
const |
|
inline |
Returns number of particles in this set.
Definition at line 546 of file Const.h.
546{ return m_particles.size(); }
◆ m_particles
Actual particles.
Definition at line 581 of file Const.h.
The documentation for this class was generated from the following files: