3 from TrigHLTJetHypo.HypoToolAnalyser
import HypoToolAnalyser
7 from AthenaCommon.Logging
import logging
9 logger = logging.getLogger( __name__)
11 logger.setLevel(DEBUG)
14 """string containing class/instance name for and AlgTool"""
16 return '%s/%s' % (tool.__class__.__name__, tool.name)
19 """make a label for a dot node consisting of the non-child attributes
28 for k, v
in tool._properties.items():
32 if v.__class__.__name__ ==
'PrivateToolHandleArray':
36 label +=
'\\n%s %s' % (k,
str(v))
38 label +=
'\n%s%s %s' % (indent, k,
str(v))
43 """ Produce a dot file to visualise the nested AlgTools used
44 to configure a jet hypo AlgTool."""
47 for k, l
in connections.items():
49 text.append(
'%d -> %d;' % (k, n))
53 for k, label
in node_labels.items():
54 description =
'[shape=box, label="%s"];' % label
55 text.append(
'%d %s' % (k, description))
59 text =
'\n'.
join(text)
62 dotdir = os.environ[
'HOME']
64 outfn = os.path.join(dotdir, toolname+
'.dot')
67 with open(outfn,
'w')
as fh:
68 logger.debug(
'writing dot file to ' + outfn)
74 analyser = HypoToolAnalyser(tool)
75 node_table, connections = analyser.tables()
77 node_labels = {k:
tool_label(v, do_dot=
False)
for k, v
in node_table.items()}
78 s = [tool.name,
'\n:']
79 for k, v
in node_labels.items():
80 s.append(
'\n%3d\n%s' % (k, v))
82 s.append(
'\nconnections:\n')
84 for k, v
in connections.items():
85 s.append(
'%3d: %s' % (k,
str(v)))
92 node_labels = {k:
tool_label(v, do_dot)
for k, v
in node_table.items()}