Belle II Software light-2406-ragdoll
DecayForest Class Reference

Contains several DecayTree objects, which belong all to the same candidate. More...

#include <DecayForest.h>

Collaboration diagram for DecayForest:

Public Member Functions

 DecayForest (const std::string &full_decaystring, bool save_memory=true, bool removeRadiativeGammaFlag=false)
 Create a DecayForest from a full decaystring outputted by ParticleMCDecayString.
 
const DecayTreegetTree (unsigned int n) const
 Return nth tree (0 is the reconstructed tree)
 
const DecayTreegetReconstructedTree () const
 Get reconstructed tree.
 
const DecayTreegetOriginalTree () const
 Get first valid original tree.
 
unsigned int getNumberOfTrees () const
 Return number of trees.
 
unsigned int getOriginalTreeNumber () const
 Return first valid original tree number.
 

Static Public Member Functions

static int decayHashFloatToInt (float decayHash, float decayHashExtended)
 Convert DecayHashes outputted by ParticleMCDecayString module to an integer.
 

Private Attributes

std::vector< DecayTreeforest
 vector of DecayTrees
 
size_t m_first_valid_original
 The first valid DecayTree.
 

Detailed Description

Contains several DecayTree objects, which belong all to the same candidate.

Definition at line 24 of file DecayForest.h.

Constructor & Destructor Documentation

◆ DecayForest()

DecayForest ( const std::string &  full_decaystring,
bool  save_memory = true,
bool  removeRadiativeGammaFlag = false 
)
explicit

Create a DecayForest from a full decaystring outputted by ParticleMCDecayString.

Parameters
full_decaystringfull decay string
save_memoryby storing only the reconstructed and first valid original DecayTree
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 17 of file DecayForest.cc.

18{
19
21 unsigned int start = 0;
22 for (unsigned int i = 0; i < full_decaystring.size(); ++i) {
23 if (full_decaystring[i] == '|') {
24 forest.emplace_back(full_decaystring.substr(start, i - start), removeRadiativeGammaFlag);
25 start = i + 1;
26 if (save_memory and forest.back().isValid() and forest.size() > 1)
27 break;
28 }
29 }
30
31 if (not(save_memory and forest.back().isValid() and forest.size() > 1))
32 forest.emplace_back(full_decaystring.substr(start, full_decaystring.size() - start), removeRadiativeGammaFlag);
33
34 for (unsigned int j = 1; j < forest.size(); ++j) {
35 if (forest[j].isValid()) {
37 break;
38 }
39 }
40
41}
std::vector< DecayTree > forest
vector of DecayTrees
Definition: DecayForest.h:66
size_t m_first_valid_original
The first valid DecayTree.
Definition: DecayForest.h:67

Member Function Documentation

◆ decayHashFloatToInt()

int decayHashFloatToInt ( float  decayHash,
float  decayHashExtended 
)
static

Convert DecayHashes outputted by ParticleMCDecayString module to an integer.

Definition at line 44 of file DecayForest.cc.

45{
46
47 // Convert unsigned int decay hash into a float keeping the same bit pattern
48 assert(sizeof(float) == sizeof(uint32_t));
49
50 union convert {
51 uint32_t i;
52 float f;
53 };
54 convert bitconverter;
55
56 uint64_t integer = 0;
57
58 bitconverter.f = decayHash;
59 integer = static_cast<uint64_t>(bitconverter.i) << 32;
60 // cppcheck throws false positives here (doesn't understand this use of a union)
61 //
62 // cppcheck-suppress redundantAssignment
63 bitconverter.f = decayHashExtended;
64 integer += bitconverter.i;
65
66 return integer;
67
68}

◆ getNumberOfTrees()

unsigned int getNumberOfTrees ( ) const
inline

Return number of trees.

Definition at line 58 of file DecayForest.h.

58{ return forest.size(); }

◆ getOriginalTree()

const DecayTree & getOriginalTree ( ) const
inline

Get first valid original tree.

Definition at line 48 of file DecayForest.h.

48{ return forest.at(m_first_valid_original); }

◆ getOriginalTreeNumber()

unsigned int getOriginalTreeNumber ( ) const
inline

Return first valid original tree number.

Definition at line 63 of file DecayForest.h.

63{ return m_first_valid_original; }

◆ getReconstructedTree()

const DecayTree & getReconstructedTree ( ) const
inline

Get reconstructed tree.

Definition at line 43 of file DecayForest.h.

43{ return forest.at(0); }

◆ getTree()

const DecayTree & getTree ( unsigned int  n) const
inline

Return nth tree (0 is the reconstructed tree)

Definition at line 38 of file DecayForest.h.

38{ return forest.at(n); }

Member Data Documentation

◆ forest

std::vector<DecayTree> forest
private

vector of DecayTrees

Definition at line 66 of file DecayForest.h.

◆ m_first_valid_original

size_t m_first_valid_original
private

The first valid DecayTree.

Definition at line 67 of file DecayForest.h.


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