2 from sys
import stderr, argv
4 from os.path
import basename
7 stderr.write(
"Writing plot to %s\n" % (filename,))
8 dot = popen(
"dot -Tpng > %s" % (filename,),
"w")
9 dot.write(
"digraph G { \n rankdir=\"LR\" \n")
14 self._seq = seq.label()
15 self._dot.write(
"%s [ shape=rect style=filled fillcolor=%s label=\"%s\" ]" % (self._seq,
'orange',self._seq) +
"\n" )
17 self._stack.append(self._seq)
18 self._seq = seq.label()
20 if isinstance(v, cms.Sequence):
21 self._dot.write(
"%s [ shape=rect style=filled fillcolor=%s label=\"%s\" ]" % (v.label(),
'orange',v.label()) +
"\n" )
24 if isinstance(v, (cms.EDProducer, cms.EDFilter, cms.EDAnalyzer)):
25 self._dot.write(
"%s [ shape=rect style=filled fillcolor=%s label=\"%s\" ]" % (v.label(),
'green',v.label()) +
"\n" )
28 if isinstance(v, cms.Sequence):
29 self._seq = self._stack.pop()
31 self._dot.write(
"%s -> %s" %(v.label(), self._seq) +
"\n")
32 seq.visit(visitor(seq,dot))
37 from sys
import stderr, argv
39 from os.path
import basename
42 stderr.write(
"Writing plot to %s\n" % (filename,))
43 dot = popen(
"dot -Tpng > %s" % (filename,),
"w")
45 dot.write(
"digraph G { \n rankdir=\"LR\" \n")
50 if isinstance(v, (cms.EDProducer, cms.EDFilter, cms.EDAnalyzer)):
54 def greptags(ps,basename=""):
56 for pn, pv
in ps.parameters_().items():
57 type = pv.configTypeName()
58 if type ==
'InputTag' : ret.append( (basename+pn, pv.configValue()) )
59 elif type ==
'VInputTag' : ret += [ (
"%s%s[%d]"%(basename,pn,i+1),v.configValue())
for i,v
in enumerate(pv.value()) ]
60 elif type ==
'PSet' : ret += greptags(pv, basename+pn+
'.')
61 elif type ==
'VPset' :
62 for r1
in [greptags(pvi, basename+pn+
'.')
for pvi
in pv.value()]: ret += r1
64 def escapeParValue(name):
return sub(
r":.*",
"", name)
67 dot.write(
"%s [ shape=rect style=filled fillcolor=%s label=\"%s\" ]" % (m.label(),
'green',m.label()) +
"\n")
70 deps[m.label()] = tags;
71 if not alls.has_key(m.label()): alls[m.label()]=
True
73 tve = escapeParValue(tv)
74 if not alls.has_key(tve): alls[tve]=
True
76 if printOuter: names = alls.keys()
79 ne = escapeParValue(n)
80 if not deps.has_key(ne):
81 dot.write(
"%s [ shape=rect style=filled fillcolor=%s label=\"%s\" ]" % (ne,
'yellow',ne) +
"\n")
83 for tn,tv
in deps[ne]:
84 tve = escapeParValue(tv)
85 if printOuter
or deps.has_key(tve):
87 if printLinkNames: style =
" [label=\"%s\" ]" %(tn,)
88 dot.write(
"%s -> %s%s\n"%(tve,ne,style))