5 #ifndef AthenaMonitoringKernel_MonitoredGroup_h
6 #define AthenaMonitoringKernel_MonitoredGroup_h
13 #include "GaudiKernel/ToolHandle.h"
65 template <
typename... T>
66 Group(
const ToolHandle<GenericMonitoringTool>&
tool, T&&... monitoredGroup)
72 Group(
const ToolHandle<GenericMonitoringTool>&
tool,
const std::vector<std::reference_wrapper<IMonitoredVariable>>& monitoredGroup)
78 Group(
const ToolHandle<GenericMonitoringTool>&
tool, std::vector<std::reference_wrapper<IMonitoredVariable>>&& monitoredGroup)
89 catch (
const GaudiException&) {
107 if (
m_tool.empty() )
return;
122 ToolHandle<GenericMonitoringTool>
m_tool;
127 template <
typename... T>
137 template <
typename T =
int>
138 int findToolIndex(
const ToolHandleArray<GenericMonitoringTool>& toolArray,
const std::string&
name ) {
139 auto it = std::find_if(toolArray.begin(),toolArray.end(),[&](
const auto&
r) {return r.name()==name;});
140 return it!=toolArray.end()
142 :
throw std::runtime_error(
"The tool "+
name+
" could not be found in the tool array.");
147 template<
typename V,
typename std::enable_if_t<std::is_
integral_v<V>>* =
nullptr>
148 std::vector<V>
buildToolMap(ToolHandleArray<GenericMonitoringTool>
tools,
const std::string& baseName,
int nHist) {
149 std::vector<int> indexArray;
150 for (
int iHist=0; iHist<nHist; iHist++ ) {
158 template<
typename V,
typename std::enable_if_t<!std::is_
integral_v<V>>* =
nullptr,
typename...T>
159 std::vector<V>
buildToolMap(ToolHandleArray<GenericMonitoringTool>
tools,
const std::string& baseName,
int nHist, T... dimensions) {
160 std::vector<V> indexArray;
161 for (
int iHist=0; iHist<nHist; iHist++ ) {
163 indexArray.push_back(buildToolMap<typename V::value_type>(
tools,
groupName,dimensions...));
169 template<
typename V,
typename std::enable_if_t<std::is_
integral_v<V>>* =
nullptr>
170 std::map<std::string,int>
buildToolMap(ToolHandleArray<GenericMonitoringTool>
tools,
const std::string& baseName,
const std::vector<std::string>&
labels) {
171 std::map<std::string,int> indexMap;
180 template<
typename V,
typename std::enable_if_t<!std::is_
integral_v<V>>* =
nullptr,
typename...T>
181 std::map<std::string,V>
buildToolMap(ToolHandleArray<GenericMonitoringTool>
tools,
const std::string& baseName,
const std::vector<std::string>&
labels, T... dimensions) {
182 std::map<std::string,V> indexMap;