ATLAS Offline Software
Functions | Variables
python.hypoToolDisplay Namespace Reference

Functions

def toolname (tool)
 
def tool_label (tool, do_dot=False)
 
def hypoToolToDot (node_labels, connections, toolname, dotdir)
 
def hypoToolDisplay (tool, do_dot=False, dotdir='')
 

Variables

 logger
 

Function Documentation

◆ hypoToolDisplay()

def python.hypoToolDisplay.hypoToolDisplay (   tool,
  do_dot = False,
  dotdir = '' 
)

Definition at line 72 of file hypoToolDisplay.py.

72 def hypoToolDisplay(tool, do_dot=False, dotdir=''):
73 
74  analyser = HypoToolAnalyser(tool)
75  node_table, connections = analyser.tables()
76 
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))
81 
82  s.append('\nconnections:\n')
83 
84  for k, v in connections.items():
85  s.append('%3d: %s' % (k, str(v)))
86 
87  text = '\n'.join(s)
88  logger.info(text)
89 
90 
91  if do_dot:
92  node_labels = {k:tool_label(v, do_dot) for k, v in node_table.items()}
93  hypoToolToDot(node_labels, connections, tool.name, dotdir)
94 
95 
96 

◆ hypoToolToDot()

def python.hypoToolDisplay.hypoToolToDot (   node_labels,
  connections,
  toolname,
  dotdir 
)
Produce a dot file to visualise the nested AlgTools used
to configure a jet hypo AlgTool.

Definition at line 42 of file hypoToolDisplay.py.

42 def hypoToolToDot(node_labels, connections, toolname, dotdir):
43  """ Produce a dot file to visualise the nested AlgTools used
44  to configure a jet hypo AlgTool."""
45 
46  text = ['digraph G{']
47  for k, l in connections.items():
48  for n in l:
49  text.append('%d -> %d;' % (k, n))
50 
51  text.append('\n')
52 
53  for k, label in node_labels.items():
54  description = '[shape=box, label="%s"];' % label
55  text.append('%d %s' % (k, description))
56 
57  text.append('}')
58 
59  text = '\n'.join(text)
60 
61  if not dotdir:
62  dotdir = os.environ['HOME']
63 
64  outfn = os.path.join(dotdir, toolname+'.dot')
65 
66 
67  with open(outfn, 'w') as fh:
68  logger.debug('writing dot file to ' + outfn)
69  fh.write(text)
70 
71 

◆ tool_label()

def python.hypoToolDisplay.tool_label (   tool,
  do_dot = False 
)
make a label for a dot node consisting of the non-child attributes
of an AlgTool

Definition at line 18 of file hypoToolDisplay.py.

18 def tool_label(tool, do_dot=False):
19  """make a label for a dot node consisting of the non-child attributes
20  of an AlgTool"""
21 
22 
23  indent = ' '
24  if do_dot:
25  label = toolname(tool)
26  else:
27  label = indent + toolname(tool)
28  for k, v in tool._properties.items():
29  # if v.__class__.__name__ == 'TrigJetHypoToolHelperNoGrouper':
30  # continue
31 
32  if v.__class__.__name__ == 'PrivateToolHandleArray':
33  continue
34  else:
35  if do_dot:
36  label += '\\n%s %s' % (k, str(v))
37  else:
38  label += '\n%s%s %s' % (indent, k, str(v))
39  return label
40 
41 

◆ toolname()

def python.hypoToolDisplay.toolname (   tool)
string containing class/instance name for and AlgTool

Definition at line 13 of file hypoToolDisplay.py.

13 def toolname(tool):
14  """string containing class/instance name for and AlgTool"""
15 
16  return '%s/%s' % (tool.__class__.__name__, tool.name)
17 

Variable Documentation

◆ logger

python.hypoToolDisplay.logger

Definition at line 9 of file hypoToolDisplay.py.

python.hypoToolDisplay.tool_label
def tool_label(tool, do_dot=False)
Definition: hypoToolDisplay.py:18
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.hypoToolDisplay.toolname
def toolname(tool)
Definition: hypoToolDisplay.py:13
Trk::open
@ open
Definition: BinningType.h:40
python.hypoToolDisplay.hypoToolDisplay
def hypoToolDisplay(tool, do_dot=False, dotdir='')
Definition: hypoToolDisplay.py:72
str
Definition: BTagTrackIpAccessor.cxx:11
python.hypoToolDisplay.hypoToolToDot
def hypoToolToDot(node_labels, connections, toolname, dotdir)
Definition: hypoToolDisplay.py:42