ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.L1.Base.L1Menu2JSON.L1MenuJSONConverter Class Reference
Inheritance diagram for python.L1.Base.L1Menu2JSON.L1MenuJSONConverter:
Collaboration diagram for python.L1.Base.L1Menu2JSON.L1MenuJSONConverter:

Public Member Functions

def __init__ (self, l1menu=None, outputFile=None, bgsOutputFile=None, inputFile=None)
 
def writeJSON (self, pretty=False)
 
def generateJSON (self)
 
def generateJsonBunchgroupset (self)
 

Public Attributes

 menu
 
 inputFile
 
 outputFile
 
 bgsOutputFile
 

Detailed Description

Definition at line 7 of file L1Menu2JSON.py.

Constructor & Destructor Documentation

◆ __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 ):
10  self.menu = l1menu
11  self.inputFile = inputFile
12  self.outputFile = outputFile
13  self.bgsOutputFile = bgsOutputFile
14 

Member Function Documentation

◆ generateJSON()

def python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.generateJSON (   self)

Definition at line 42 of file L1Menu2JSON.py.

42  def generateJSON(self):
43  # import json
44  from collections import OrderedDict as odict
45  confObj = odict()
46 
47  confObj["filetype"] = "l1menu"
48 
49  confObj["name"] = self.menu.menuName
50 
51  confObj["run"] = 3 # will be useful for later (we also record this for Run 1 and 2)
52 
53  # items
54  confObj["items"] = self.menu.items.json()
55 
56  # thresholds
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) ] )
63 
64  # run 3 thresholds
65  confObj["thresholds"].update( self.menu.thresholds.json() )
66 
67  # legacy calo thresholds
68  confObj["thresholds"]["legacyCalo"] = self.menu.thresholds.jsonLegacy()
69 
70  # topo algorithms
71  confObj["topoAlgorithms"] = self.menu.topoAlgos.json()
72 
73  # board definition
74  confObj["boards"] = self.menu.boards.json()
75 
76  # connectors definition
77  confObj["connectors"] = self.menu.connectors.json()
78 
79  # CTP input cabling definition
80  confObj["ctp"] = self.menu.ctp.json()
81 
82  return confObj
83 
84 

◆ 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
87  confObj = odict()
88 
89  confObj["filetype"] = "bunchgroupset"
90 
91  confObj["name"] = self.menu.menuName
92 
93  # bunchgroups
94  confObj["bunchGroups"] = self.menu.ctp.bunchGroupSet.json()
95 
96  return confObj

◆ writeJSON()

def python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.writeJSON (   self,
  pretty = False 
)

Definition at line 15 of file L1Menu2JSON.py.

15  def writeJSON(self,pretty=False):
16 
17  if not self.outputFile:
18  log.warning("Can't write json file since no name was provided")
19  return
20 
21  # L1Menu json
22  confObj = self.generateJSON()
23  with open( self.outputFile, mode="wt" ) as fh:
24  import json
25  json.dump(confObj, fh, indent = 4 if pretty else None, separators=(',', ': '))
26  fh.write("\n")
27  log.info("Wrote %s", self.outputFile)
28 
29  if self.bgsOutputFile is not None:
30  confObj = self.generateJsonBunchgroupset()
31  with open( self.bgsOutputFile, mode="wt" ) as fh:
32  import json
33  json.dump(confObj, fh, indent = 4 if pretty else None, separators=(',', ': '))
34  fh.write("\n")
35  log.info("Wrote %s", self.bgsOutputFile)
36 
37 
38  return self.outputFile
39 
40 
41 

Member Data Documentation

◆ bgsOutputFile

python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.bgsOutputFile

Definition at line 13 of file L1Menu2JSON.py.

◆ inputFile

python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.inputFile

Definition at line 11 of file L1Menu2JSON.py.

◆ menu

python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.menu

Definition at line 10 of file L1Menu2JSON.py.

◆ outputFile

python.L1.Base.L1Menu2JSON.L1MenuJSONConverter.outputFile

Definition at line 12 of file L1Menu2JSON.py.


The documentation for this class was generated from the following file:
python.TrfUtils.writeJSON
def writeJSON(fname, data)
Definition: TrfUtils.py:27
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
Trk::open
@ open
Definition: BinningType.h:40
dqt_zlumi_pandas.update
update
Definition: dqt_zlumi_pandas.py:42
HLTMenuJSON.generateJSON
def generateJSON(flags, chainDicts, HLTAllSteps)
Definition: HLTMenuJSON.py:83