Skip to content
Snippets Groups Projects
Commit 2fc1a4af authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'trigmontool_legacy' into 'master'

TrigGenericMonitoringTool: copy defineHistogram from AthenaMonitoring

See merge request atlas/athena!20311
parents abeb2fac 46f80d7c
No related branches found
No related tags found
No related merge requests found
# 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 AthenaCommon.Logging import logging from AthenaCommon.Logging import logging
log = logging.getLogger('TrigGenericMonitoringToolConfig.py') log = logging.getLogger('TrigGenericMonitoringToolConfig.py')
...@@ -19,8 +19,42 @@ else: ...@@ -19,8 +19,42 @@ else:
as TrigGenericMonitoringTool as TrigGenericMonitoringTool
log.info("Using thread-safe TrigGenericMonitoringTool") log.info("Using thread-safe TrigGenericMonitoringTool")
from AthenaMonitoring.GenericMonitoringTool import defineHistogram as __defineHistogram
defineHistogram = __defineHistogram ## Generate histogram definition string for the `TrigGenericMonitoringTool.Histograms` property
#
# For full details see the TrigGenericMonitoringTool documentation.
# @param varname one (1D) or two (2D) variable names separated by comma
# @param type histogram type
# @param path top-level histrogram directory
# @param title Histogram title and optional axis title (same syntax as in TH constructor)
# @param opt Histrogram options (see TrigGenericMonitoringTool)
# @param labels List of bin labels (for a 2D histogram, sequential list of x- and y-axis labels)
def defineHistogram(varname, type='TH1F', path='EXPERT',
title=None,
xbins=100, xmin=0, xmax=1,
ybins=None, ymin=None, ymax=None, zmin=None, zmax=None, opt='', labels=None):
if title is None: title=varname
coded = "%s, %s, %s, %s, %d, %f, %f" % (path, type, varname, title, xbins, xmin, xmax)
if ybins is not None:
coded += ",%d, %f, %f" % (ybins, ymin, ymax)
if zmin is not None:
coded += ", %f, %f" % (zmin, zmax)
if ybins is None and ymin is not None:
coded += ", %f, %f" % (ymin, ymax)
if isinstance(labels, list) and len(labels)>0:
coded += ',' + ':'.join(labels) + ':'
# For backwards compatibility
elif labels is not None:
labels = labels.strip() # remove spurious white-spaces
if len(labels)>0:
if labels[-1]!=':': labels += ':' # C++ parser expects at least one ":"
coded += ",%s " % labels
coded += ", %s" % opt
return coded
class TrigGenericMonitoringToolConfig(TrigGenericMonitoringTool): class TrigGenericMonitoringToolConfig(TrigGenericMonitoringTool):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment