ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetMonitoring
JetMonitoring
ToolHandleHistoHelper.h
Go to the documentation of this file.
1
// -*- c++ -*-
2
3
/*
4
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
#ifndef JETMONITORING_TOOLHANDLEHISTOHELPER_H
8
#define JETMONITORING_TOOLHANDLEHISTOHELPER_H
19
#include "GaudiKernel/ToolHandle.h"
20
#include "
JetMonitoring/HistoDefinitionTool.h
"
21
22
namespace
ToolHandleHistoHelper
{
23
24
25
26
struct
HistoRetriever
{
27
28
std::string
afterlastdot
(
const
std::string& s){
29
size_t
i = s.find_last_of(
"."
);
30
return
s.substr( i+1, s.size() );
31
}
32
33
HistoRetriever
(ToolHandleArray<HistoDefinitionTool>&
h
) :
histos
(
h
) {}
34
35
HistoDefinitionTool
*
retrieveTool
(
const
std::string & n){
36
for
(
auto
toolH :
histos
){
37
//std::cout << " xxxx compare "<< afterlastdot( toolH->name() ) << " to "<< n <<std::endl;
38
if
(
afterlastdot
(toolH->name()) == n )
return
toolH.operator->();
39
}
40
return
NULL;
41
}
42
43
template
<
typename
T >
44
T*
build
(
const
std::string & n){
45
std::string name =
"hdef_"
; name+=n;
46
HistoDefinitionTool
* tool =
retrieveTool
(name);
47
if
(!tool )
return
NULL;
48
return
tool->build<T>();
49
}
50
51
52
ToolHandleArray<HistoDefinitionTool>&
histos
;
53
};
54
55
56
}
57
58
59
#endif
HistoDefinitionTool.h
h
Header file for AthHistogramAlgorithm.
HistoDefinitionTool
This tool does no particular tasks.
Definition
HistoDefinitionTool.h:31
ToolHandleHistoHelper
Definition
ToolHandleHistoHelper.h:22
ToolHandleHistoHelper::HistoRetriever::build
T * build(const std::string &n)
Definition
ToolHandleHistoHelper.h:44
ToolHandleHistoHelper::HistoRetriever::retrieveTool
HistoDefinitionTool * retrieveTool(const std::string &n)
Definition
ToolHandleHistoHelper.h:35
ToolHandleHistoHelper::HistoRetriever::histos
ToolHandleArray< HistoDefinitionTool > & histos
Definition
ToolHandleHistoHelper.h:52
ToolHandleHistoHelper::HistoRetriever::HistoRetriever
HistoRetriever(ToolHandleArray< HistoDefinitionTool > &h)
Definition
ToolHandleHistoHelper.h:33
ToolHandleHistoHelper::HistoRetriever::afterlastdot
std::string afterlastdot(const std::string &s)
Definition
ToolHandleHistoHelper.h:28
Generated on
for ATLAS Offline Software by
1.17.0