From 89f3af04c5d2fbdf924f7d18119ca116e1bedb23 Mon Sep 17 00:00:00 2001 From: Peter Onyisi <ponyisi@utexas.edu> Date: Sat, 23 May 2020 23:44:36 -0500 Subject: [PATCH] Add option to not fail the job if no histograms are defined (useful for debugging) --- .../AthenaMonitoringKernel/GenericMonitoringTool.h | 1 + Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h index 946db53bc49..6bd37a0fbec 100644 --- a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h +++ b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/GenericMonitoringTool.h @@ -78,6 +78,7 @@ private: 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." }; + Gaudi::Property<bool> m_failOnEmpty { this, "FailOnEmpty", true, "Fail in initialize() if no histograms defined" }; std::unordered_map<std::string, std::vector<std::shared_ptr<Monitored::HistogramFiller>>> m_fillerMap; //!< map from variables to fillers mutable std::mutex m_fillMutex; diff --git a/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx b/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx index 77dadc9eecd..15bc0bb6aef 100644 --- a/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx +++ b/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx @@ -85,7 +85,7 @@ StatusCode GenericMonitoringTool::book() { ATH_MSG_DEBUG( "Monitoring for variable " << def.name << " prepared" ); } - if ( fillers.empty() ) { + if ( fillers.empty() && m_failOnEmpty ) { std::string hists; for (const auto &h : m_histograms) hists += (h+","); ATH_MSG_ERROR("No monitored variables created based on histogram definition: [" << hists << -- GitLab