Belle II Software  release-05-02-19
SelectionVariableNamesToFunctions.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2013 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Eugenio Paoloni *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 #include <string>
13 #include <unordered_map>
14 
15 #include <tracking/trackFindingVXD/filterMap/filterFramework/Filter.h>
16 
17 namespace Belle2 {
31  template <
32  class Variable,
33  class Range,
34  class ... Options
35  >
36  std::unordered_map<std::string, typename Variable::functionType>
38  {
39  // Note: Variable::value is the pointer to the function that return the values
40  return std::unordered_map< std::string, typename Variable::functionType>
41  ({ {Variable::name(), Variable::value } });
42  };
43 
44 
50  template <
51  class someFilter,
52  class ...options >
53  std::unordered_map<std::string, typename someFilter::functionType>
55  someFilter, options... >)
56  {
57  return SelectionVariableNamesToFunctions(someFilter());
58  }
59 
60 
67  template <
68  class FilterA,
69  class FilterB,
70  class ...options
71  >
72  std::unordered_map<std::string, typename FilterA::functionType>
74  FilterA, FilterB, options...>)
75  {
76  auto result = SelectionVariableNamesToFunctions(FilterA());
77  auto resultB = SelectionVariableNamesToFunctions(FilterB());
78  result.insert(resultB.begin(), resultB.end());
79  return result;
80  }
81 
82 
89  template <
90  class FilterA,
91  class FilterB,
92  class ...options
93  >
94  std::unordered_map<std::string, typename FilterA::functionType>
96  FilterA, FilterB, options...>)
97  {
98  auto result = SelectionVariableNamesToFunctions(FilterA());
99  auto resultB = SelectionVariableNamesToFunctions(FilterB());
100  result.insert(resultB.begin(), resultB.end());
101  return result;
102  }
104 }
Belle2::SelectionVariableNamesToFunctions
std::unordered_map< std::string, typename Variable::functionType > SelectionVariableNamesToFunctions(Belle2::Filter< Variable, Range, Options... >)
Return a map from the SelectionVariable name to the SelectionVariable function of the Variable used i...
Definition: SelectionVariableNamesToFunctions.h:45
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::Filter
This class is used to select pairs, triplets...
Definition: Filter.h:44