11#include <framework/core/FrameworkExceptions.h>
12#include <framework/core/MemoryPool.h>
13#include <mdst/dataobjects/MCParticle.h>
48 BELLE2_DEFINE_EXCEPTION(NonContinousDaughtersError,
"Can not represent decay graph, non continuous indices for daughters");
51 "A daughter particle was already assigned to a mother. A particle can't have two mothers!");
56 typedef std::pair<unsigned int, unsigned int>
DecayLine;
230 void addDecay(GraphParticle& mother, GraphParticle& daughter);
264 void loadList(
const std::string& name =
"");
280 class ParticleSorter;
304 if (
this != mother.
m_graph ||
this != daughter.m_graph)
throw NotSameGraphError();
307 daughter.m_primary =
false;
Class to represent Particle data in graph.
unsigned int m_vertexId
vertex id in the graph
GraphParticle & operator=(const MCParticle &particle)
Assign the values of an existing MCParticle to this GraphParticle.
int m_trackID
The track ID from geant4 that created this particle.
void comesFrom(GraphParticle &mother)
Tells the graph that this particle is a decay product of mother.
void setIndex(int index)
Set the 1-based index of the particle.
void decaysInto(GraphParticle &daughter)
Tells the graph that this particle decays into daughter.
GraphParticle(TClonesArray *, const MCParticle &)
Hide MCParticle "almost copy" constructor.
void setTrackID(int trackID)
Set the track ID for the particle.
GraphParticle()=delete
No default constructor.
void setFirstDaughter(int daughter)
Set the 1-based index of the first daughter, 0 means no daughters.
int getTrackID() const
Returns the track ID assigned to this MCParticle.
void setLastDaughter(int daughter)
Set the 1-based index of the last daughter, 0 means no daughters.
void setIgnore(bool ignore=true)
Set or remove the ignore flag.
bool getIgnore() const
Get the ignore flag.
MCParticleGraph * m_graph
internal pointer to the graph this particle belongs to
GraphParticle(MCParticleGraph *graph, unsigned int vertexId)
Internally used constructor.
bool m_primary
Is this a primary particle ?
GraphParticle(const GraphParticle &)=delete
No copy constructor.
bool m_ignore
ignore particle when writing MCParticle list ?
Class to go over all the particles in the Graph an sort them in a sensible way.
Class to build, validate and sort a particle decay chain.
BELLE2_DEFINE_EXCEPTION(OutOfRangeError, "Index out of range")
The exception is thrown if the specified index is out of range.
BELLE2_DEFINE_EXCEPTION(NotSameGraphError, "Particles not from same graph")
The exception is thrown if two particles do not belong to the same graph.
virtual ~MCParticleGraph()
Destructor.
GraphOptions
Possible options for generating the MCParticle list.
@ 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_setNothing
Do nothing special.
@ c_checkCyclic
Check for cyclic dependencies.
@ c_clearParticles
Clear the particle list before adding the graph.
@ c_setDecayInfo
Set decay time and vertex.
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.
size_t size() const
Return the number of particles in the graph.
GraphParticle & operator[](size_t i)
Return reference to added particle with range check.
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.
std::pair< unsigned int, unsigned int > DecayLine
Type representing a decay in the graph.
BELLE2_DEFINE_EXCEPTION(CyclicReferenceError, "Cyclic decay, cannot continue")
The exception is thrown if a cyclic reference in the graph was detected.
void loadList(const std::string &name="")
Load the MCParticle list given by name into the Graph.
std::set< DecayLine > m_decays
internal set of decay lines
MemoryPool< GraphParticle > m_particles
internal list of particles
void generateList(const std::string &name="", int options=c_setNothing)
Generates the MCParticle list and stores it in the StoreArray with the given name.
MCParticleGraph()
Constructor.
A Class to store the Monte Carlo particle information.
int m_lastDaughter
1-based index of last daughter particle in collection, 0 if no daughters
int m_firstDaughter
1-based index of first daughter particle in collection, 0 if no daughters
int m_index
transient pointer to particle list
TClonesArray * m_plist
Internal pointer to DataStore Array containing particles belonging to this collection.
Class to provide a constant access time memory pool for one kind of objects.
RelationsInterface & operator=(const RelationsInterface &relationsInterface)
Assignment operator.
void addDecay(GraphParticle &mother, GraphParticle &daughter)
Add decay information between two particles.
void clear()
Reset particles and decay information to make the class reusable.
GraphParticle & addParticle()
Add new particle to the graph.
Abstract base class for different kinds of events.