Definition at line 7 of file L1Menu2JSON.py.
◆ __init__()
def python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.__init__ |
( |
|
self, |
|
|
|
l1menu = None , |
|
|
|
outputFile = None , |
|
|
|
bgsOutputFile = None , |
|
|
|
inputFile = None |
|
) |
| |
Definition at line 9 of file L1Menu2JSON.py.
9 def __init__(self, l1menu = None, outputFile = None, bgsOutputFile = None, inputFile = None ):
11 self.inputFile = inputFile
12 self.outputFile = outputFile
13 self.bgsOutputFile = bgsOutputFile
◆ generateJSON()
def python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.generateJSON |
( |
|
self | ) |
|
Definition at line 42 of file L1Menu2JSON.py.
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()
◆ generateJsonBunchgroupset()
def python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.generateJsonBunchgroupset |
( |
|
self | ) |
|
Definition at line 85 of file L1Menu2JSON.py.
85 def generateJsonBunchgroupset(self):
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()
◆ writeJSON()
def python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.writeJSON |
( |
|
self, |
|
|
|
pretty = False |
|
) |
| |
Definition at line 15 of file L1Menu2JSON.py.
17 if not self.outputFile:
18 log.warning(
"Can't write json file since no name was provided")
22 confObj = self.generateJSON()
23 with open( self.outputFile, mode=
"wt" )
as fh:
25 json.dump(confObj, fh, indent = 4
if pretty
else None, separators=(
',',
': '))
27 log.info(
"Wrote %s", self.outputFile)
29 if self.bgsOutputFile
is not None:
30 confObj = self.generateJsonBunchgroupset()
31 with open( self.bgsOutputFile, mode=
"wt" )
as fh:
33 json.dump(confObj, fh, indent = 4
if pretty
else None, separators=(
',',
': '))
35 log.info(
"Wrote %s", self.bgsOutputFile)
38 return self.outputFile
◆ bgsOutputFile
python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.bgsOutputFile |
◆ inputFile
python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.inputFile |
◆ menu
python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.menu |
◆ outputFile
python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.outputFile |
The documentation for this class was generated from the following file: