Belle II Software  release-08-01-10
VariablesTTree.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 
9 #pragma once
10 
11 #include <tracking/trackFindingVXD/filterMap/training/VariableTBranch.h>
12 #include <TTree.h>
13 namespace Belle2 {
20  template<typename ... filterLeaves>
23  };
24 
25 
27  template<>
28  class VariablesTTree<> {
30  TTree* m_tree;
31  public:
32 
34  explicit VariablesTTree(TTree* tree): m_tree(tree) {};
35 
37  TTree* getTTree(void) { return m_tree; };
38 
40  template<class Filter>
41  static auto build(const Filter&, TTree* tree) ->
43  { return VariablesTTree<Filter>(tree); };
44  };
45 
46 
48  template<class Variable, class ... other>
49  class VariablesTTree<Filter<Variable, other ...> >:
50  public VariablesTTree<> {
53  public:
55  explicit VariablesTTree(TTree* tree): VariablesTTree<>(tree),
56  m_varTBranch(tree) {};
57 
62  template< class ... SpacePoints >
63  void evaluateOn(const SpacePoints& ... sps)
64  {
65  m_varTBranch.evaluateOn(sps...);
66  }
67  };
68 
69 
71  template<class unaryOperator, class ... args, class ... other>
72  class VariablesTTree<Filter<unaryOperator, Filter<args ...>,
73  other ...> >:
74  public VariablesTTree<> {
77  public:
79  explicit VariablesTTree(TTree* tree): VariablesTTree<>(tree),
80  m_node(tree) {};
81 
86  template<class ... SpacePoints>
87  void evaluateOn(const SpacePoints& ... sps)
88  {
89  m_node.evaluateOn(sps...);
90  }
91  };
92 
93 
95  template<class binaryOperator, class ... argsA, class ... argsB,
96  class ... other>
97  class VariablesTTree<Filter<binaryOperator,
98  Filter<argsA ...>, Filter<argsB ... >,
99  other ...> >:
100  public VariablesTTree<> {
105  public:
107  // member var m_tree is initialized in VariablesTTree<>(tree), which is not recognized by cppcheck
108  // cppcheck-suppress uninitMemberVar
109  explicit VariablesTTree(TTree* tree): VariablesTTree<>(tree),
110  m_nodeA(tree), m_nodeB(tree)
111  {};
112 
117  template<class ... SpacePoints>
118  void evaluateOn(const SpacePoints& ... sps)
119  {
120  m_nodeA.evaluateOn(sps...);
121  m_nodeB.evaluateOn(sps...);
122  }
123  };
125 }
This class is used to select pairs, triplets...
Definition: Filter.h:34
This class contains.
void evaluateOn(const SpacePoints &... sps)
Evaluate the variable for the given SpacePoints.
VariableTBranch< Variable > m_varTBranch
TBranch for the variable.
void evaluateOn(const SpacePoints &... sps)
Evaluate Variable for given SpacePoints.
void evaluateOn(const SpacePoints &... sps)
Evaluate Variable for given SpacePoints.
VariablesTTree< Filter< argsB ... > > m_nodeB
TTree containing filters for the other node B.
VariablesTTree< Filter< argsA ... > > m_nodeA
TTree containing filters for a node A.
void evaluateOn(const SpacePoints &... sps)
Evaluate Variable for given SpacePoints.
VariablesTTree< Filter< args ... > > m_node
TTree containing filters for a node.
static auto build(const Filter &, TTree *tree) -> VariablesTTree< Filter >
Handy function.
TTree * m_tree
Pointer to the TTree; the TTree itself is not owned by this class!
TTree * getTTree(void)
Accessor to the TTree pointer.
VariablesTTree(TTree *tree)
All the variables will be written in.
Dump on a TTree the values of all the variables in a filter.
Abstract base class for different kinds of events.