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

The DecayDescriptor stores information about a decay tree or parts of a decay tree. More...

#include <DecayDescriptor.h>

Collaboration diagram for DecayDescriptor:

Public Member Functions

 operator DecayDescriptor * ()
 Dereference operator.
 
 DecayDescriptor ()
 Default ctor.
 
 DecayDescriptor (const DecayDescriptor &)=default
 Want the default copy ctor.
 
DecayDescriptoroperator= (const DecayDescriptor &)=default
 Want the default assignment operator.
 
std::vector< std::vector< std::pair< int, std::string > > > getHierarchyOfSelected ()
 Function to get hierarchy of selected particles and their names (for python use)
 
std::vector< std::vector< std::pair< int, std::string > > > getHierarchyOfSelected (const std::vector< std::pair< int, std::string >> &currentPath)
 Helper function to get hierarchy of selected particles and their names. More...
 
bool init (const std::string &str)
 Initialise the DecayDescriptor from given string. More...
 
bool init (const DecayString &s)
 Initialise the DecayDescriptor from a given DecayString. More...
 
int match (const Particle *p)
 Check if the DecayDescriptor matches with the given Particle. More...
 
int match (const MCParticle *p)
 See match(const Particle* p).
 
int getMatchedDaughter ()
 Particle daughter ID set by previous call of match(const Particle*) function.
 
void resetMatch ()
 Reset results from previous call of the match() function.
 
std::vector< const Particle * > getSelectionParticles (const Particle *particle)
 Get a vector of pointers with selected daughters in the decay tree.
 
std::vector< std::string > getSelectionNames ()
 Return list of human readable names of selected particles. More...
 
std::vector< int > getSelectionPDGCodes ()
 Return list of PDG codes of selected particles.
 
const DecayDescriptorParticlegetMother () const
 return mother.
 
int getNDaughters () const
 return number of direct daughters.
 
const DecayDescriptorgetDaughter (int i) const
 return i-th daughter (0 based index).
 
int getProperty () const
 return property of the particle.
 
bool isIgnoreRadiatedPhotons () const
 Check if additional radiated photons shall be ignored.
 
bool isIgnoreIntermediate () const
 Check if intermediate resonances/particles shall be ignored.
 
bool isIgnoreMassive () const
 Check if missing massive final state particles shall be ignored.
 
bool isIgnoreNeutrino () const
 Check if missing neutrinos shall be ignored.
 
bool isIgnoreGamma () const
 Check if missing gammas shall be ignored.
 
bool isIgnoreBrems () const
 Check if added Brems gammas shall be ignored.
 
bool isSelfConjugated () const
 Is the decay or the particle self conjugated.
 
bool isInitOK () const
 Check if the object initialized correctly.
 
bool getSelectionParticlesAndNames (const Particle *particle, std::vector< const Particle * > &selparticles, std::vector< std::string > &selnames)
 Takes as input argument a (reconstructed) Particle, tries to match with this DecayDescriptorElement and returns true when matched.
 

Static Public Attributes

static const DecayDescriptors_NULL = DecayDescriptor()
 Singleton object representing NULL.
 

Private Member Functions

template<class T >
int match (const T *p, int iDaughter_p)
 Internally called by match(Particle*) and match(MCParticle*) function.
 

Private Attributes

DecayDescriptorParticle m_mother
 Mother of the decay ('left side').
 
int m_iDaughter_p
 ID of the Daughter Particle* matched to this DecayDescriptor. More...
 
std::vector< DecayDescriptorm_daughters
 Direct daughters of the decaying particle.
 
int m_properties
 Particle property. More...
 
bool m_isNULL
 Is this the NULL object?
 
std::vector< std::vector< std::pair< int, std::string > > > m_hierarchy
 Collection of hierarchy paths of selected particles. More...
 
bool m_isInitOK
 Is this object initialized correctly?
 

Detailed Description

The DecayDescriptor stores information about a decay tree or parts of a decay tree.

It contains the mother <-> daughter relations.

User documentation is located at analysis/doc/DecayDescriptor.rst Please modify in accordingly to introduced changes.

Definition at line 33 of file DecayDescriptor.h.

Member Function Documentation

◆ getHierarchyOfSelected()

std::vector< std::vector< std::pair< int, std::string > > > getHierarchyOfSelected ( const std::vector< std::pair< int, std::string >> &  currentPath)

Helper function to get hierarchy of selected particles and their names.

Called iteratively and get hierarchy path of a particle as an argument

Definition at line 416 of file DecayDescriptor.cc.

418 {
419  if (m_mother.isSelected()) m_hierarchy.push_back(currentPath);
420  for (std::size_t i = 0; i < m_daughters.size(); i++) {
421  std::vector<std::pair<int, std::string>> newPath = currentPath;
422  newPath.emplace_back(i, m_daughters[i].getMother()->getNameSimple());
423  std::vector<std::vector<std::pair<int, std::string>>> foundPathes = m_daughters[i].getHierarchyOfSelected(newPath);
424  for (auto& path : foundPathes) m_hierarchy.push_back(path);
425  }
426  std::vector<std::vector<std::pair<int, std::string>>> hierarchy = m_hierarchy;
427  return hierarchy;
428 }
bool isSelected() const
Is the particle selected in the decay string?
const DecayDescriptorParticle * getMother() const
return mother.
DecayDescriptorParticle m_mother
Mother of the decay ('left side').
std::vector< DecayDescriptor > m_daughters
Direct daughters of the decaying particle.
std::vector< std::vector< std::pair< int, std::string > > > m_hierarchy
Collection of hierarchy paths of selected particles.

◆ getSelectionNames()

vector< string > getSelectionNames ( )

Return list of human readable names of selected particles.

Example for the case that all particles are selected in B+ -> (anti-D0 -> K^- pi^+) pi^+: ["B", "D0", "D0_K", "D_pi", "pi"]

Definition at line 342 of file DecayDescriptor.cc.

◆ init() [1/2]

bool init ( const DecayString s)

Initialise the DecayDescriptor from a given DecayString.

The DecayString struct is obtained from the parser called in the init(const std::string) function.

Definition at line 58 of file DecayDescriptor.cc.

◆ init() [2/2]

bool init ( const std::string &  str)

Initialise the DecayDescriptor from given string.

Typically, the string is a parameter of an analysis module.

Definition at line 46 of file DecayDescriptor.cc.

◆ match()

int match ( const Particle p)
inline

Check if the DecayDescriptor matches with the given Particle.

0 = no match 1 = matches DecayDescriptor 2 = matches charge conjugated DecayDescriptor 3 = matches DeacyDescriptor AND charge conjugated DecayDescriptor -1, -2, -3 : same, but match is not unambiguous.

Definition at line 108 of file DecayDescriptor.h.

108 {return match<Particle>(p, -1);}

Member Data Documentation

◆ m_hierarchy

std::vector<std::vector<std::pair<int, std::string> > > m_hierarchy
private

Collection of hierarchy paths of selected particles.

Hierarchy path is vector of pairs of relative daughter numbers and particle names. For instance, in decay B+ -> [ D+ -> ^K+ pi0 ] pi0 decay path of K+ is [(0, B), (0, D), (0 K)] Every selected particle has its own hierarchy path and they are stored as a vector in this variable: For the decayString B+ -> [ D+ -> ^K+ pi0 ] ^pi0 m_hierarchy, once filled, is [[(0, B), (0, D), (0, K)], [(0, B), (1, pi0)]]

Definition at line 63 of file DecayDescriptor.h.

◆ m_iDaughter_p

int m_iDaughter_p
private

ID of the Daughter Particle* matched to this DecayDescriptor.

If this DecayDescriptor was not matched, the value is -1.

Definition at line 39 of file DecayDescriptor.h.

◆ m_properties

int m_properties
private

Particle property.

Flags are defined in Particle::PropertyFlags

Definition at line 43 of file DecayDescriptor.h.


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