From 921bc2454da7608794488909a8928dc691b9472d Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <frank.winklmeier@cern.ch>
Date: Mon, 25 Feb 2019 15:59:44 +0100
Subject: [PATCH] AthenaMonitoring: Put private tool histograms into
 sub-directory

Replace '.' in histogram path with '/'. That makes all histograms of
private tools (MyAlg.MyTool) appear in a sub-directory (MyAlg/MyTool).
Similarly histograms of public tools should appear under ToolSvc, etc.

Side remark: At P1 the online hsitogramming service does not allow the
publication of histograms with '.' in their name.
---
 Control/AthenaMonitoring/src/GenericMonitoringTool.cxx | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx b/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx
index d254b7596ed..102d21391e5 100644
--- a/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx
+++ b/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx
@@ -4,6 +4,7 @@
 
 #include <map>
 #include <mutex>
+#include <algorithm>
 #include <TH1.h>
 #include <TH2.h>
 #include <TProfile.h>
@@ -35,8 +36,11 @@ StatusCode GenericMonitoringTool::book() {
   if (m_histoPath.empty()) {
     auto named = dynamic_cast<const INamedInterface*>(parent());
     m_histoPath = named ? named->name() : name();
-  } 
-  
+  }
+
+  // Replace dot (e.g. MyAlg.MyTool) with slash to create sub-directory
+  std::replace( m_histoPath.begin(), m_histoPath.end(), '.', '/' );
+
   ATH_MSG_DEBUG("Booking histograms in path: " << m_histoPath.value());
 
   HistogramFillerFactory factory(m_histSvc, m_histoPath);
-- 
GitLab