Belle II Software  release-08-01-10
DecayTree< T > Class Template Reference

This is a helper class for the MCDecayFinderModule. More...

#include <DecayTree.h>

Collaboration diagram for DecayTree< T >:

Public Member Functions

 DecayTree ()
 Default constructor.
 
 ~DecayTree ()
 Destructor.
 
std::vector< DecayTree< T > * > getDaughters () const
 Return list of decay daughters. More...
 
T * getObj () const
 Return the decaying object itself, e.g. More...
 
void setObj (T *obj)
 Set the decaying object, e.g. More...
 
void append (DecayTree< T > *t)
 Add a daughter, which is a DecayTree itself. More...
 
 DecayTree (const std::string &decaystring, bool removeRadiativeGammaFlag=false)
 Create a new Decay tree from a decaystring.
 
 DecayTree (const DecayTree &tree)
 Copy constructor Required because we need to rebuild the node cache.
 
DecayTreeoperator= (const DecayTree &tree)
 Assign operator Required because we need to rebuild the node cache.
 
std::vector< DecayNodebuild_tree (const std::string &decaystring, bool removeRadiativeGammaFlag)
 Recursively build a new tree. More...
 
bool find_decay (const DecayTree &tree) const
 Check if the decay tree contains the given decay tree. More...
 
std::string to_string () const
 Output string representation of DecayTree.
 
int getMatchSymbolPosition () const
 Returns position of match symbol.
 
bool isValid () const
 Returns if the decay tree is valid (constructed from a decay string which has a match)
 
const DecayNodegetDecayNode (unsigned int n) const
 Returns n-th node as const. More...
 
DecayNodegetDecayNode (unsigned int n)
 Returns n-th node. More...
 
size_t getNumberOfDecayNodes () const
 Return number of nodes in this tree.
 

Private Member Functions

void build_cache (DecayNode &node)
 Build nodes_cache in order of appearance in the decay string for fast access. More...
 

Private Attributes

T * m_myObject
 The decaying object, e.g. More...
 
std::vector< DecayTree< T > * > m_daughters
 Decay daughters of m_myObject.
 
bool m_valid
 True if the tree is valid (invalid can happen if is constructed from a node with "No match")
 
size_t m_i
 Current position in the building of the DecayTree.
 
unsigned int m_token_count
 Count current tokens.
 
int m_match_symbol_position
 Position of the token with the match symbol ^.
 
DecayNode m_root_node
 root DecayNode
 
std::vector< DecayNode * > m_nodes_cache
 Vector of decay nodes of the particles in the order of their appearance in the decay string for fast access.
 

Detailed Description

template<class T>
class Belle2::DecayTree< T >

This is a helper class for the MCDecayFinderModule.

Consists of a tree of DecayNodes Can be constructed from the output of the ParticleMCDecayString module.

It is designed to hold MCParticle objects when trying to match a given DecayString.

Definition at line 20 of file DecayTree.h.

Member Function Documentation

◆ build_cache()

void build_cache ( DecayNode node)
private

Build nodes_cache in order of appearance in the decay string for fast access.

Parameters
nodecurrent node

Definition at line 60 of file DecayTree.cc.

61 {
62  m_nodes_cache.push_back(&node);
63  for (auto& daughter : node.daughters) {
64  build_cache(daughter);
65  }
66 }
std::vector< DecayNode > daughters
daughter decay nodes
Definition: DecayNode.h:48
std::vector< DecayNode * > m_nodes_cache
Vector of decay nodes of the particles in the order of their appearance in the decay string for fast ...
Definition: DecayTree.h:106
void build_cache(DecayNode &node)
Build nodes_cache in order of appearance in the decay string for fast access.
Definition: DecayTree.cc:60

◆ build_tree()

std::vector< DecayNode > build_tree ( const std::string &  decaystring,
bool  removeRadiativeGammaFlag 
)

Recursively build a new tree.

Parameters
decaystringas outputted by the ParticleMCDecayString module (after splitting by | )
removeRadiativeGammaFlagremove radiative photons from decay string. Handle with care: In the decay B+ --> e+ nu_e gamma, the gamma would be removed although this might be your signal.

Definition at line 69 of file DecayTree.cc.

◆ find_decay()

bool find_decay ( const DecayTree< T > &  tree) const

Check if the decay tree contains the given decay tree.

Parameters
treeDecayTree describing the decay

Definition at line 129 of file DecayTree.cc.

◆ getDecayNode() [1/2]

DecayNode & getDecayNode ( unsigned int  n)

Returns n-th node.

Parameters
nnth node

Definition at line 134 of file DecayTree.cc.

◆ getDecayNode() [2/2]

const DecayNode & getDecayNode ( unsigned int  n) const

Returns n-th node as const.

Parameters
nnth node

Definition at line 139 of file DecayTree.cc.

Member Data Documentation

◆ m_myObject

T* m_myObject
private

The decaying object, e.g.

MCParticle.

Definition at line 23 of file DecayTree.h.


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