diff --git a/Control/AthenaMonitoring/AthenaMonitoring/GenericMonitoringTool.h b/Control/AthenaMonitoring/AthenaMonitoring/GenericMonitoringTool.h index 26205ba8626197778abc00271ad6a1aa853313c2..8e47b3f46438defc9f646b08579099311f004496 100644 --- a/Control/AthenaMonitoring/AthenaMonitoring/GenericMonitoringTool.h +++ b/Control/AthenaMonitoring/AthenaMonitoring/GenericMonitoringTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef AthenaMonitoring_GenericMonitoringTool_h @@ -66,27 +66,28 @@ class GenericMonitoringTool : public AthAlgTool { public: - static const InterfaceID& interfaceID(); GenericMonitoringTool(const std::string & type, const std::string & name, const IInterface* parent); - virtual ~GenericMonitoringTool(); - - virtual StatusCode initialize(); - virtual std::vector<Monitored::HistogramFiller*> getHistogramsFillers(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables); + virtual StatusCode initialize() override; + + /// Retrieve the histogram fillers + std::vector<Monitored::HistogramFiller*> getHistogramsFillers(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables); + /// Book histograms StatusCode book(); - /** - * Overrride configured booking path - **/ - void setPath( const std::string& newPath ); + /// Overrride configured booking path + void setPath( const std::string& newPath ); + private: ServiceHandle<ITHistSvc> m_histSvc { this, "THistSvc", "THistSvc/THistSvc", "Histogramming svc" }; - Gaudi::Property<std::string> m_histoPath { this, "HistPath", "/EXPERT/", "Histogram base path" }; + Gaudi::Property<std::string> m_histoPath { this, "HistPath", {}, "Directory for histograms [name of parent if not set]" }; Gaudi::Property<std::vector<std::string> > m_histograms { this, "Histograms", {}, "Definitions of histograms"}; Gaudi::Property<bool> m_explicitBooking { this, "ExplicitBooking", false, "Do not create histograms automatically in initialize but wait until the method book is called." }; - std::vector<Monitored::HistogramFiller*> m_fillers; //!< list of fillers + + std::vector<Monitored::HistogramFiller*> m_fillers; //!< list of fillers }; -/* + +/** * Helper class to declare an empty monitoring ToolHandle * * This can be used in case an empty monitoring tool needs to be declared in the constructor: diff --git a/Control/AthenaMonitoring/python/GenericMonitoringTool.py b/Control/AthenaMonitoring/python/GenericMonitoringTool.py index 2b2a2658f7124391af73b066e4d68136463d3c70..d1f6f1f5a88e5dc8858c133dcb4d2c965548dc13 100644 --- a/Control/AthenaMonitoring/python/GenericMonitoringTool.py +++ b/Control/AthenaMonitoring/python/GenericMonitoringTool.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # from AthenaMonitoring.AthenaMonitoringConf import GenericMonitoringTool as _GenericMonitoringTool @@ -16,7 +16,7 @@ class GenericMonitoringTool(_GenericMonitoringTool): # For full details see the GenericMonitoringTool documentation. # @param varname one (1D) or two (2D) variable names separated by comma # @param type histogram type -# @param path top-level histrogram directory +# @param path top-level histogram directory (e.g. EXPERT, SHIFT, etc.) # @param title Histogram title and optional axis title (same syntax as in TH constructor) # @param opt Histrogram options (see GenericMonitoringTool) # @param labels List of bin labels (for a 2D histogram, sequential list of x- and y-axis labels) diff --git a/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx b/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx index c75a9dbe247f91e674d79b79eb02075e792dcc5e..d254b7596edf63763d2aed5eeded3b52e8bb972e 100644 --- a/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx +++ b/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include <map> @@ -12,26 +12,17 @@ #include "AthenaMonitoring/GenericMonitoringTool.h" #include "AthenaMonitoring/HistogramDef.h" -using namespace std; using namespace Monitored; -const InterfaceID& GenericMonitoringTool::interfaceID() { - static InterfaceID GenericMonitoringTool_ID("GenericMonitoringTool", 1, 0); - - return GenericMonitoringTool_ID; -} GenericMonitoringTool::GenericMonitoringTool(const std::string & type, const std::string & name, const IInterface* parent) - : AthAlgTool(type, name, parent) { - declareInterface<GenericMonitoringTool>(this); + : AthAlgTool(type, name, parent) { } -GenericMonitoringTool::~GenericMonitoringTool() { } - StatusCode GenericMonitoringTool::initialize() { ATH_CHECK(m_histSvc.retrieve()); if ( not m_explicitBooking ) { - ATH_MSG_DEBUG("Proceeding to histograms booking"); + ATH_MSG_DEBUG("Proceeding to histogram booking"); return book(); } return StatusCode::SUCCESS; @@ -46,12 +37,12 @@ StatusCode GenericMonitoringTool::book() { m_histoPath = named ? named->name() : name(); } - ATH_MSG_DEBUG("Booking hostograms in path:" << m_histoPath << ":"); + ATH_MSG_DEBUG("Booking histograms in path: " << m_histoPath.value()); HistogramFillerFactory factory(m_histSvc, m_histoPath); m_fillers.reserve(m_histograms.size()); - for (const string& item : m_histograms) { + for (const std::string& item : m_histograms) { ATH_MSG_DEBUG( "Configuring monitoring for: " << item ); HistogramDef def = HistogramDef::parse(item); @@ -61,7 +52,7 @@ StatusCode GenericMonitoringTool::book() { if (filler != nullptr) { m_fillers.push_back(filler); } else { - ATH_MSG_WARNING( "The histogram filler can not be instantiated for: " << def.name ); + ATH_MSG_WARNING( "The histogram filler cannot be instantiated for: " << def.name ); } } else { ATH_MSG_ERROR( "Unparsable histogram definition: " << item ); @@ -81,12 +72,12 @@ StatusCode GenericMonitoringTool::book() { return StatusCode::SUCCESS; } -vector<HistogramFiller*> GenericMonitoringTool::getHistogramsFillers(vector<reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables) { - vector<HistogramFiller*> result; +std::vector<HistogramFiller*> GenericMonitoringTool::getHistogramsFillers(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables) { + std::vector<HistogramFiller*> result; for (auto filler : m_fillers) { auto fillerVariables = filler->histogramVariablesNames(); - vector<reference_wrapper<Monitored::IMonitoredVariable>> variables; + std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> variables; for (auto fillerVariable : fillerVariables) { for (auto monValue : monitoredVariables) {