Belle II Software  release-08-01-10
MCParticleGraph Class Reference

Class to build, validate and sort a particle decay chain. More...

#include <MCParticleGraph.h>

Collaboration diagram for MCParticleGraph:

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. More...
 
GraphParticleaddParticle ()
 Add new particle to the graph. More...
 
void addDecay (GraphParticle &mother, GraphParticle &daughter)
 Add decay information between two particles. More...
 
GraphParticleoperator[] (size_t i)
 Return reference to added particle with range check. More...
 
size_t size () const
 Return the number of particles in the graph. More...
 
void generateList (const std::string &name="", int options=c_setNothing)
 Generates the MCParticle list and stores it in the StoreArray with the given name. More...
 
void loadList (const std::string &name="")
 Load the MCParticle list given by name into the Graph. More...
 
void clear ()
 Reset particles and decay information to make the class reusable. More...
 

Protected Attributes

MemoryPool< GraphParticlem_particles
 internal list of particles
 
std::set< DecayLinem_decays
 internal set of decay lines
 

Detailed Description

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.

Member Enumeration Documentation

◆ GraphOptions

Possible options for generating the MCParticle list.

Enumerator
c_setNothing 

Do nothing special.

c_setDecayVertex 

Set the decay vertex to the production vertex of the last daughter (ordered by production time)

c_setDecayTime 

Set decay time to the largest production time of the daughters.

c_setDecayInfo 

Set decay time and vertex.

c_checkCyclic 

Check for cyclic dependencies.

c_clearParticles 

Clear the particle list before adding the graph.

Definition at line 59 of file MCParticleGraph.h.

Constructor & Destructor Documentation

◆ ~MCParticleGraph()

virtual ~MCParticleGraph ( )
inlinevirtual

Destructor.

Frees the allocated spaces

Definition at line 214 of file MCParticleGraph.h.

Member Function Documentation

◆ generateList()

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.

Parameters
nameName of the StoreArray for the MCParticle list
optionsAdditional options which steer the creation of the StoreArray.
See also
class MCParticle

Definition at line 209 of file MCParticleGraph.cc.

◆ loadList()

void loadList ( const std::string &  name = "")

Load the MCParticle list given by name into the Graph.

Parameters
nameName of the StoreArray for the MCParticle list
See also
class MCParticle

Definition at line 239 of file MCParticleGraph.cc.

◆ operator[]()

GraphParticle& operator[] ( size_t  i)
inline

Return reference to added particle with range check.

Returns
A reference to the particle given by its index.

Definition at line 236 of file MCParticleGraph.h.

◆ size()

size_t size ( ) const
inline

Return the number of particles in the graph.

Returns
The number of particles in the graph.

Definition at line 242 of file MCParticleGraph.h.


The documentation for this class was generated from the following files: