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

Class to go over all the particles in the Graph an sort them in a sensible way. More...

Collaboration diagram for MCParticleGraph::ParticleSorter:

Public Member Functions

 ParticleSorter (MemoryPool< MCParticleGraph::GraphParticle > &particles, TClonesArray *plist, bool setVertex, bool setTime)
 ParticleSorter constructor. More...
 
void setStartIndex (int index)
 Set the starting index for the particle graph. More...
 
template<class Graph >
void sort (Graph &g)
 Sort the particles and generate MCParticle list. More...
 
template<class Vertex , class Graph >
void finish_vertex (Vertex v, Graph &g)
 Go through the daughters of the vertex. More...
 
template<class Vertex , class Graph >
void find_daughters (Vertex v, Graph &g, MCParticleGraph::GraphParticle &mother)
 Find the daughters of the given vertex. More...
 
void setVertexTime (MCParticleGraph::GraphParticle &m, const MCParticleGraph::GraphParticle &d)
 Set the vertex and time information of the mother particle. More...
 

Protected Attributes

int m_index
 The latest index given to a particle.
 
MemoryPool< MCParticleGraph::GraphParticle > & m_particles
 Reference to the list of particles which should be sorted.
 
TClonesArray * m_plist
 The final array of sorted particles which is stored in the DataStore.
 
bool m_setVertex
 True if the vertex information should be saved.
 
bool m_setTime
 True if the production time information should be saved.
 
vector< bool > m_seen
 Vector of the particles that were already seen while sorting the graph.
 
std::queue< unsigned int > m_vqueue
 The list of the vertices that will be visited.
 

Detailed Description

Class to go over all the particles in the Graph an sort them in a sensible way.

All particles will be assigned an index, starting at 1. If an particle has its ignore flag set, then it will get assigned the index of its last, unignored parent. The particles will be sorted by depth: First all primary particles, then all direct daughters of the first primary particle, all direct daughters of the second primary particle and so forth.

Definition at line 49 of file MCParticleGraph.cc.

Constructor & Destructor Documentation

◆ ParticleSorter()

ParticleSorter ( MemoryPool< MCParticleGraph::GraphParticle > &  particles,
TClonesArray *  plist,
bool  setVertex,
bool  setTime 
)
inline

ParticleSorter constructor.

Parameters
particlesReference to the list of particles which should be sorted.
plistThe final array of sorted particles which is stored in the DataStore.
setVertexSet to true if the vertex information should be saved.
setTimeSet to true if the production time information should be saved.

Definition at line 60 of file MCParticleGraph.cc.

Member Function Documentation

◆ find_daughters()

void find_daughters ( Vertex  v,
Graph &  g,
MCParticleGraph::GraphParticle mother 
)
inline

Find the daughters of the given vertex.

Parameters
vThe vertex whose daughters are investigated.
gThe graph in which the vertex lives.
motherReference to the mother particle.

Definition at line 129 of file MCParticleGraph.cc.

◆ finish_vertex()

void finish_vertex ( Vertex  v,
Graph &  g 
)
inline

Go through the daughters of the vertex.

Add the found particles to the final particle list.

Parameters
vThe vertex whose daughters are investigated.
gThe graph in which the vertex lives.

Definition at line 102 of file MCParticleGraph.cc.

◆ setStartIndex()

void setStartIndex ( int  index)
inline

Set the starting index for the particle graph.

Normally this is 0 so the first real particle has an id of 1 but this can be used if there are already particles present so the first particle will have id N+1

Parameters
indexnumber of particles already present

Definition at line 68 of file MCParticleGraph.cc.

◆ setVertexTime()

void setVertexTime ( MCParticleGraph::GraphParticle m,
const MCParticleGraph::GraphParticle d 
)
inline

Set the vertex and time information of the mother particle.

Parameters
mReference to the mother particle whose vertex and time information should be set.
dReference to the daughter particle.

Definition at line 180 of file MCParticleGraph.cc.

◆ sort()

void sort ( Graph &  g)
inline

Sort the particles and generate MCParticle list.

Parameters
gThe graph which should be sorted and transformed to a list of particles.

Definition at line 74 of file MCParticleGraph.cc.


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