3 from AthenaCommon.Logging
import logging
4 log = logging.getLogger(__name__)
9 def __init__(self, l1menu = None, outputFile = None, bgsOutputFile = None, inputFile = None ):
18 log.warning(
"Can't write json file since no name was provided")
25 json.dump(confObj, fh, indent = 4
if pretty
else None, separators=(
',',
': '))
33 json.dump(confObj, fh, indent = 4
if pretty
else None, separators=(
',',
': '))
44 from collections
import OrderedDict
as odict
47 confObj[
"filetype"] =
"l1menu"
49 confObj[
"name"] = self.
menu.menuName
54 confObj[
"items"] = self.
menu.items.json()
57 confObj[
"thresholds"] = odict()
58 confObj[
"thresholds"][
"internal"] = odict()
59 confObj[
"thresholds"][
"internal"][
"type"] =
"internal"
60 confObj[
"thresholds"][
"internal"][
"names"] = [
"BGRP%i" % bg.internalNumber
for bg
in self.
menu.ctp.bunchGroupSet.bunchGroups] + \
61 [
"RNDM%i" % i
for i
in range(0,len(self.
menu.ctp.random.names)) ]
62 confObj[
"thresholds"][
"internal"][
"randoms"] = odict( [ (
"RNDM%i" %i , {
"cut" : c })
for i,c
in enumerate( self.
menu.ctp.random.cuts) ] )
65 confObj[
"thresholds"].
update( self.
menu.thresholds.json() )
68 confObj[
"thresholds"][
"legacyCalo"] = self.
menu.thresholds.jsonLegacy()
71 confObj[
"topoAlgorithms"] = self.
menu.topoAlgos.json()
74 confObj[
"boards"] = self.
menu.boards.json()
77 confObj[
"connectors"] = self.
menu.connectors.json()
80 confObj[
"ctp"] = self.
menu.ctp.json()
86 from collections
import OrderedDict
as odict
89 confObj[
"filetype"] =
"bunchgroupset"
91 confObj[
"name"] = self.
menu.menuName
94 confObj[
"bunchGroups"] = self.
menu.ctp.bunchGroupSet.json()