Belle II Software development
|
Class to build, validate and sort a particle decay chain. More...
#include <MCParticleGraph.h>
Classes | |
class | GraphParticle |
Class to represent Particle data in graph. More... | |
class | ParticleSorter |
Class to go over all the particles in the Graph an sort them in a sensible way. More... | |
Public Types | |
enum | GraphOptions { c_setNothing = 0 , c_setDecayVertex = 1 , c_setDecayTime = 2 , c_setDecayInfo = c_setDecayVertex | c_setDecayTime , c_checkCyclic = 4 , c_clearParticles = 8 } |
Possible options for generating the MCParticle list. More... | |
typedef std::pair< unsigned int, unsigned int > | DecayLine |
Type representing a decay in the graph. | |
Public Member Functions | |
BELLE2_DEFINE_EXCEPTION (CyclicReferenceError, "Cyclic decay, cannot continue") | |
The exception is thrown if a cyclic reference in the graph was detected. | |
BELLE2_DEFINE_EXCEPTION (NotSameGraphError, "Particles not from same graph") | |
The exception is thrown if two particles do not belong to the same graph. | |
BELLE2_DEFINE_EXCEPTION (NonContinousDaughtersError, "Can not represent decay graph, non continuous indices for daughters") | |
The exception is thrown if a non-physical decay was detected in the graph. | |
BELLE2_DEFINE_EXCEPTION (DaughterHasMotherError, "A daughter particle was already assigned to a mother. A particle can't have two mothers!") | |
The exception is thrown if a daughter already has a mother assigned to it. | |
BELLE2_DEFINE_EXCEPTION (OutOfRangeError, "Index out of range") | |
The exception is thrown if the specified index is out of range. | |
MCParticleGraph () | |
Constructor. | |
virtual | ~MCParticleGraph () |
Destructor. | |
GraphParticle & | addParticle () |
Add new particle to the graph. | |
void | addDecay (GraphParticle &mother, GraphParticle &daughter) |
Add decay information between two particles. | |
GraphParticle & | operator[] (size_t i) |
Return reference to added particle with range check. | |
size_t | size () const |
Return the number of particles in the graph. | |
void | generateList (const std::string &name="", int options=c_setNothing) |
Generates the MCParticle list and stores it in the StoreArray with the given name. | |
void | loadList (const std::string &name="") |
Load the MCParticle list given by name into the Graph. | |
void | clear () |
Reset particles and decay information to make the class reusable. | |
Protected Attributes | |
MemoryPool< GraphParticle > | m_particles |
internal list of particles | |
std::set< DecayLine > | m_decays |
internal set of decay lines | |
Class to build, validate and sort a particle decay chain.
Several particles can be added with addParticle(). Decay information between these particles can be added using addDecay(), MCParticleGraph::Particle::decaysInto() and MCParticleGraph::Particle::comesFrom().
Once all all particles and decays are added and their parameters set, call generateList() to fill the specified StoreArray with the resulting MCParticle list. The decay chain will be checked for cyclic references and a runtime_error will be thrown in that case. The particle will be sorted breadth first: First all primary particles, then all particles first generation and so on.
Definition at line 37 of file MCParticleGraph.h.
typedef std::pair<unsigned int, unsigned int> DecayLine |
Type representing a decay in the graph.
Definition at line 56 of file MCParticleGraph.h.
enum GraphOptions |
Possible options for generating the MCParticle list.
Definition at line 59 of file MCParticleGraph.h.
|
inline |
|
inlinevirtual |
Destructor.
Frees the allocated spaces
Definition at line 214 of file MCParticleGraph.h.
void generateList | ( | const std::string & | name = "" , |
int | options = c_setNothing |
||
) |
Generates the MCParticle list and stores it in the StoreArray with the given name.
The graph will be checked for validity. If a cyclic reference is detected, a runtime_error is thrown. Similar, if the decay chain cannot be represented with continuous daughter indices, a runtime_error is raised. This can happen for artificial kinds of decays (eg: a->b,c,d; b->c,e;) but should not happen in physical cases.
name | Name of the StoreArray for the MCParticle list |
options | Additional options which steer the creation of the StoreArray. |
Definition at line 209 of file MCParticleGraph.cc.
void loadList | ( | const std::string & | name = "" | ) |
Load the MCParticle list given by name into the Graph.
name | Name of the StoreArray for the MCParticle list |
Definition at line 239 of file MCParticleGraph.cc.
|
inline |
Return reference to added particle with range check.
Definition at line 236 of file MCParticleGraph.h.
|
inline |
Return the number of particles in the graph.
Definition at line 242 of file MCParticleGraph.h.
|
protected |
internal set of decay lines
Definition at line 283 of file MCParticleGraph.h.
|
protected |
internal list of particles
Definition at line 282 of file MCParticleGraph.h.