84 """ Generates JSON given the ChainProps and sequences
87 menuDict = {
"filetype":
"hltmenu",
95 from TriggerMenuMT.HLT.Menu
import StreamInfo
96 for chain
in chainDicts:
99 for streamName
in chain[
"stream"]:
100 streamTag = StreamInfo.getStreamTag(streamName)
102 if streamTag
is None:
103 __log.error(
'Stream %s does not have StreamTags defined excluding from JSON', streamName)
106 chainStreamTags.append(streamName)
108 if streamName
not in menuDict[
"streams"]:
109 menuDict[
"streams"][streamName] = {
111 "type": streamTag.type(),
112 "obeyLB": streamTag.obeysLumiBlock(),
113 "forceFullEventBuilding": streamTag.forceFullEventBuilding()
119 [ l1Thresholds.append(p[
'L1threshold'])
for p
in chain[
'chainParts'] ]
122 chainName = chain[
"chainName"]
123 menuDict[
"chains"][chainName] = {
124 "counter": chain[
"chainCounter"],
125 "nameHash": chain[
"chainNameHash"],
126 "legMultiplicities": chain[
"chainMultiplicities"],
127 "l1item": chain[
"L1item"],
128 "l1thresholds": l1Thresholds,
129 "groups": chain[
"groups"],
130 "streams": chainStreamTags,
141 __log.info(
"Writing HLT Menu JSON to %s", fileName )
142 with open( fileName,
'w' )
as fp:
143 json.dump( menuDict, fp, indent=4, sort_keys=
False )