A set of ParticleType objects, with defined order.
More...
#include <Const.h>
|
| static ParticleType | end () |
| | Returns an invalid particle to check if iteration should be stopped.
|
| |
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 518 of file Const.h.
◆ ParticleSet()
Copy constructor to make sure particles belong to correct set.
Definition at line 524 of file Const.h.
525 {
526 for (const ParticleType& pdgIter : other) add(pdgIter);
527 }
◆ 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 550 of file Const.h.
551 {
552 if (index < m_particles.size())
553 return m_particles[index];
554 return invalidParticle;
555 }
◆ begin()
Returns first particle.
Definition at line 558 of file Const.h.
559 {
560 if (m_particles.empty())
561 return end();
562 return m_particles[0];
563 }
◆ 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 566 of file Const.h.
567 {
568 return invalidParticle;
569 }
◆ find()
Returns particle in set with given PDG code, or invalidParticle if not found.
Definition at line 572 of file Const.h.
573 {
574 for (const ParticleType& pdgIter : *this) {
575 if (pdgIter.getPDGCode() == pdg)
576 return m_particles[pdgIter.getIndex()];
577 }
578
579 return invalidParticle;
580 }
◆ operator=()
Assignment operator.
Definition at line 530 of file Const.h.
531 {
532 m_particles.clear();
533 for (const ParticleType& pdgIter : other) add(pdgIter);
534 return *this;
535 }
◆ size()
| unsigned int size |
( |
| ) |
const |
|
inline |
Returns number of particles in this set.
Definition at line 547 of file Const.h.
547{ return m_particles.size(); }
◆ m_particles
Actual particles.
Definition at line 582 of file Const.h.
The documentation for this class was generated from the following files: