Belle II Software development
SelectionVariableNamesToFunctions.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#include <string>
11#include <unordered_map>
12
13#include <tracking/trackFindingVXD/filterMap/filterFramework/Filter.h>
14
15namespace Belle2 {
29 template <
30 class Variable,
31 class Range,
32 class ... Options
33 >
34 std::unordered_map<std::string, typename Variable::functionType>
36 {
37 // Note: Variable::value is the pointer to the function that return the values
38 return std::unordered_map< std::string, typename Variable::functionType>
39 ({ {Variable::name(), Variable::value } });
40 };
41
42
48 template <
49 class someFilter,
50 class ...options >
51 std::unordered_map<std::string, typename someFilter::functionType>
53 someFilter, options... >)
54 {
55 return SelectionVariableNamesToFunctions(someFilter());
56 }
57
58
65 template <
66 class FilterA,
67 class FilterB,
68 class ...options
69 >
70 std::unordered_map<std::string, typename FilterA::functionType>
72 FilterA, FilterB, options...>)
73 {
74 auto result = SelectionVariableNamesToFunctions(FilterA());
75 auto resultB = SelectionVariableNamesToFunctions(FilterB());
76 result.insert(resultB.begin(), resultB.end());
77 return result;
78 }
79
80
87 template <
88 class FilterA,
89 class FilterB,
90 class ...options
91 >
92 std::unordered_map<std::string, typename FilterA::functionType>
94 FilterA, FilterB, options...>)
95 {
96 auto result = SelectionVariableNamesToFunctions(FilterA());
97 auto resultB = SelectionVariableNamesToFunctions(FilterB());
98 result.insert(resultB.begin(), resultB.end());
99 return result;
100 }
102}
This class is used to select pairs, triplets... of objects.
Definition: Filter.h:34
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...
Abstract base class for different kinds of events.