Belle II Software development
DecayTree.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9#include <vector>
10
11namespace Belle2 {
19 template<class T>
20 class DecayTree {
21 private:
25 std::vector< DecayTree<T>* > m_daughters;
26 public:
28 DecayTree();
30 ~DecayTree();
32 std::vector< DecayTree<T>* > getDaughters() const;
34 T* getObj() const;
36 void setObj(T* obj);
38 void append(DecayTree<T>* t);
39 };
40
42 template <class T>
43 DecayTree<T>::DecayTree() : m_myObject(0), m_daughters() {};
44
46 template <class T>
48 {
49 m_myObject = 0;
50 while (!m_daughters.empty()) {
51 delete m_daughters.back();
52 m_daughters.pop_back();
53 }
54 };
55
57 template <class T>
58 std::vector< DecayTree<T>* > DecayTree<T>::getDaughters() const
59 {
60 return m_daughters;
61 }
62
64 template <class T>
66 {
67 return m_myObject;
68 }
69
71 template <class T>
73 {
74 m_myObject = obj;
75 }
76
78 template <class T>
80 {
81 m_daughters.push_back(t);
82 }
84} // namespace Belle2
This is a helper class for the MCDecayFinderModule.
Definition: DecayTree.h:20
T * m_myObject
The decaying object, e.g.
Definition: DecayTree.h:23
std::vector< DecayTree< T > * > m_daughters
Decay daughters of m_myObject.
Definition: DecayTree.h:25
DecayTree()
Default constructor.
Definition: DecayTree.h:43
~DecayTree()
Destructor.
Definition: DecayTree.h:47
void setObj(T *obj)
Set the decaying object, e.g.
Definition: DecayTree.h:72
void append(DecayTree< T > *t)
Add a daughter, which is a DecayTree itself.
Definition: DecayTree.h:79
T * getObj() const
Return the decaying object itself, e.g.
Definition: DecayTree.h:65
std::vector< DecayTree< T > * > getDaughters() const
Return list of decay daughters.
Definition: DecayTree.h:58
Abstract base class for different kinds of events.