Last active
September 17, 2019 18:42
-
-
Save aminnj/c06bede0f8693ea0ffd612e269be4013 to your computer and use it in GitHub Desktop.
Dump a subset of a cmssw pset recursively
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pset_rawsim_onlyhlt import process | |
def recurse_coll(item,already_dumped=[]): | |
if hasattr(item,"_seq"): | |
print("process.{} = {}\n".format(item.label(),item.dumpPython())) | |
for thing in item._seq._collection: | |
for x in recurse_coll(thing): yield x | |
if hasattr(item,"_Parameterizable__parameterNames"): | |
if not item.label() in already_dumped: | |
print("process.{} = {}\n".format(item.label(),item.dumpPython())) | |
for thing in item.parameters_().items(): | |
for x in recurse_coll(thing): yield x | |
already_dumped.append(item.label()) | |
if type(item) in [tuple]: | |
pk,pv = item | |
if pv.configTypeName() == "InputTag": | |
label = pv.value().split(":",1)[0] | |
if hasattr(process,label): | |
for x in recurse_coll(getattr(process,label)): yield x | |
else: | |
yield pk,pv | |
maincoll = process.ScoutingCaloMuonOutput | |
_ = list(recurse_coll(maincoll)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also run
edmConfigDump
on the pset and copy in the lines liketo the beginning of the output of the gist script output. Also make sure the sequence is defined at the bottom (move if necessary). Then you should be able to use
edmConfigToHTML
.