38 from sys
import stderr, argv
40 from os.path
import basename
43 stderr.write(
"Writing plot to %s\n" % (filename,))
44 dot = popen(
"dot -Tpng > %s" % (filename,),
"w")
46 dot.write(
"digraph G { \n rankdir=\"LR\" \n")
51 if isinstance(v, (cms.EDProducer, cms.EDFilter, cms.EDAnalyzer)):
55 def greptags(ps,basename=""):
57 for pn, pv
in ps.parameters_().items():
58 type = pv.configTypeName()
59 if type ==
'InputTag' : ret.append( (basename+pn, pv.configValue()) )
60 elif type ==
'VInputTag' : ret += [ (
"%s%s[%d]"%(basename,pn,i+1),v.configValue())
for i,v
in enumerate(pv.value()) ]
61 elif type ==
'PSet' : ret += greptags(pv, basename+pn+
'.')
62 elif type ==
'VPset' :
63 for r1
in [greptags(pvi, basename+pn+
'.')
for pvi
in pv.value()]: ret += r1
65 def escapeParValue(name):
return sub(
r":.*",
"", name)
68 dot.write(
"%s [ shape=rect style=filled fillcolor=%s label=\"%s\" ]" % (m.label(),
'green',m.label()) +
"\n")
71 deps[m.label()] = tags;
72 if not alls.has_key(m.label()): alls[m.label()]=
True
74 tve = escapeParValue(tv)
75 if not alls.has_key(tve): alls[tve]=
True
77 if printOuter: names = alls.keys()
80 ne = escapeParValue(n)
81 if not deps.has_key(ne):
82 dot.write(
"%s [ shape=rect style=filled fillcolor=%s label=\"%s\" ]" % (ne,
'yellow',ne) +
"\n")
84 for tn,tv
in deps[ne]:
85 tve = escapeParValue(tv)
86 if printOuter
or deps.has_key(tve):
88 if printLinkNames: style =
" [label=\"%s\" ]" %(tn,)
89 dot.write(
"%s -> %s%s\n"%(tve,ne,style))