ATLAS Offline Software
Loading...
Searching...
No Matches
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"
21
23
24
25
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;
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
Header file for AthHistogramAlgorithm.
This tool does no particular tasks.
HistoDefinitionTool * retrieveTool(const std::string &n)
ToolHandleArray< HistoDefinitionTool > & histos
HistoRetriever(ToolHandleArray< HistoDefinitionTool > &h)
std::string afterlastdot(const std::string &s)