38 from sys
import stderr, argv
40 from os.path
import basename
42 import FWCore.ParameterSet.Config
as cms
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")
49 class visitor(object):
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 m.label()
not in alls: alls[m.label()]=
True
74 tve = escapeParValue(tv)
75 if tve
not in alls: alls[tve]=
True
77 if printOuter: names = alls.keys()
80 ne = escapeParValue(n)
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 tve
in deps:
88 if printLinkNames: style =
" [label=\"%s\" ]" %(tn,)
89 dot.write(
"%s -> %s%s\n"%(tve,ne,style))