ATLAS Offline Software
Loading...
Searching...
No Matches
python.L1TriggerConfigAccess.L1MenuAccess Class Reference
Inheritance diagram for python.L1TriggerConfigAccess.L1MenuAccess:
Collaboration diagram for python.L1TriggerConfigAccess.L1MenuAccess:

Public Member Functions

 __init__ (self, str filename="", str jsonString="", str dbalias="", int smkey=0, bool useCrest=False, str crestServer="")
 itemNames (self)
 itemsWithCtpid (self)
 items (self, includeKeys=[])
 thresholdTypes (self)
 thresholds (self, thresholdType=None, fulldict=False)
 thresholdNames (self, thresholdType=None)
 thresholdExtraInfo (self, thresholdType)
 topoAlgorithmTypes (self)
 topoAlgorithms (self, topoAlgoType=None)
 topoAlgorithmNames (self, topoAlgoType=None)
 boardNames (self)
 boards (self)
 board (self, boardName)
 connectorNames (self)
 connectors (self)
 connector (self, connectorName)
 ctp (self)
 ctpInputs (self, inputType)
 printSummary (self)

Detailed Description

this class provides access to the L1Menu
the methods are self-explanatory for people with knowledge of the configuration

Definition at line 9 of file L1TriggerConfigAccess.py.

Constructor & Destructor Documentation

◆ __init__()

python.L1TriggerConfigAccess.L1MenuAccess.__init__ ( self,
str filename = "",
str jsonString = "",
str dbalias = "",
int smkey = 0,
bool useCrest = False,
str crestServer = "" )
accessor needs to be initialized with either a filename or the dbalias and smkey

Definition at line 14 of file L1TriggerConfigAccess.py.

15 useCrest: bool = False, crestServer: str = ""):
16 """
17 accessor needs to be initialized with either a filename or the dbalias and smkey
18 """
19 super().__init__(ConfigType.L1MENU, mainkey = "items",
20 jsonString = jsonString, filename = filename, dbalias = dbalias, dbkey = smkey,
21 useCrest=useCrest, crestServer=crestServer)
22 self.loader.setQuery({
23 2: "SELECT L1MT.L1TM_DATA FROM {schema}.SUPER_MASTER_TABLE SMT, {schema}.L1_MENU L1MT WHERE L1MT.L1TM_ID=SMT.SMT_L1_MENU_ID AND SMT.SMT_ID=:dbkey", # for new db schema
24 1: "SELECT L1MT.L1MT_MENU FROM {schema}.SUPER_MASTER_TABLE SMT, {schema}.L1_MASTER_TABLE L1MT WHERE L1MT.L1MT_ID=SMT.SMT_L1_MASTER_TABLE_ID AND SMT.SMT_ID=:dbkey" # for current db schema
25 })
26 self.load()
27 if smkey is not None:
28 log.info(f"Loaded L1 menu {self.name()} with {len(self)} items from {dbalias} with smk {smkey}{' using CREST' if useCrest else ''}")
29 elif filename is not None:
30 log.info(f"Loaded L1 menu {self.name()} with {len(self)} chains from file {filename}")
31

Member Function Documentation

◆ board()

python.L1TriggerConfigAccess.L1MenuAccess.board ( self,
boardName )

Definition at line 115 of file L1TriggerConfigAccess.py.

115 def board(self, boardName):
116 return self["boards"][boardName]
117

◆ boardNames()

python.L1TriggerConfigAccess.L1MenuAccess.boardNames ( self)

Definition at line 109 of file L1TriggerConfigAccess.py.

109 def boardNames(self):
110 return iter(self["boards"])
111

◆ boards()

python.L1TriggerConfigAccess.L1MenuAccess.boards ( self)

Definition at line 112 of file L1TriggerConfigAccess.py.

112 def boards(self):
113 return self["boards"]
114

◆ connector()

python.L1TriggerConfigAccess.L1MenuAccess.connector ( self,
connectorName )

Definition at line 124 of file L1TriggerConfigAccess.py.

124 def connector(self, connectorName):
125 return self["connectors"][connectorName]
126

◆ connectorNames()

python.L1TriggerConfigAccess.L1MenuAccess.connectorNames ( self)

Definition at line 118 of file L1TriggerConfigAccess.py.

118 def connectorNames(self):
119 return iter(self["connectors"])
120

◆ connectors()

python.L1TriggerConfigAccess.L1MenuAccess.connectors ( self)

Definition at line 121 of file L1TriggerConfigAccess.py.

121 def connectors(self):
122 return self["connectors"]
123

◆ ctp()

python.L1TriggerConfigAccess.L1MenuAccess.ctp ( self)

Definition at line 127 of file L1TriggerConfigAccess.py.

127 def ctp(self):
128 return self["ctp"]
129

◆ ctpInputs()

python.L1TriggerConfigAccess.L1MenuAccess.ctpInputs ( self,
inputType )
 inputType should be 'optical', 'electrical' or 'ctpin'

Definition at line 130 of file L1TriggerConfigAccess.py.

130 def ctpInputs(self, inputType):
131 """ inputType should be 'optical', 'electrical' or 'ctpin'
132 """
133 return self["ctp"]["inputs"][inputType]
134

◆ itemNames()

python.L1TriggerConfigAccess.L1MenuAccess.itemNames ( self)

Definition at line 32 of file L1TriggerConfigAccess.py.

32 def itemNames(self):
33 return self["items"].keys()
34

◆ items()

python.L1TriggerConfigAccess.L1MenuAccess.items ( self,
includeKeys = [] )

Definition at line 38 of file L1TriggerConfigAccess.py.

38 def items(self, includeKeys = [] ):
39 if includeKeys:
40 """ reduce returned dictionary """
41 items = self["items"]
42 return { x : {k : items[x][k] for k in includeKeys if k in items[x]} for x in items }
43 else:
44 return self["items"]
45

◆ itemsWithCtpid()

python.L1TriggerConfigAccess.L1MenuAccess.itemsWithCtpid ( self)

Definition at line 35 of file L1TriggerConfigAccess.py.

35 def itemsWithCtpid(self ):
36 return self.items( includeKeys = ['ctpid'] )
37

◆ printSummary()

python.L1TriggerConfigAccess.L1MenuAccess.printSummary ( self)

Definition at line 135 of file L1TriggerConfigAccess.py.

135 def printSummary(self):
136 print("L1 menu %s" % self.name())
137 print("Number of items: %i" % len(self))
138 print("Number of threshold types: %i" % len(self.thresholdTypes()) )
139 print("Number of thresholds: %i" % len(self.thresholds()) )
140 print("Number of topo algorithms: %i" % len(self.topoAlgorithms()))
141 print("Number of boards: %i (%i are legacy boards)" % ( len(self.boards()), sum(["legacy" in b for b in self.boards().values()]) ))
142 print("Number of connectors: %i (%i are legacy connetors)" % ( len(self.connectors()), sum(["legacy" in c for c in self.connectors().values()]) ))
143 print("CTP has %i optical, %i electrical, and %i CTPIN inputs" % ( len(self.ctpInputs("optical")), len(self.ctpInputs("electrical")),
144 len(reduce(
145 lambda s1,i: s1.union(self.ctpInputs("ctpin")[f"slot{i}"].values()),
146 [7,8,9], set()) - set([""]) )))
147
148
149
150
static void reduce(HepMC::GenEvent *ge, HepMC::GenParticle *gp)
Remove an unwanted particle from the event, collapsing the graph structure consistently.
Definition FixHepMC.cxx:39
void print(char *figname, TCanvas *c1)
STL class.

◆ thresholdExtraInfo()

python.L1TriggerConfigAccess.L1MenuAccess.thresholdExtraInfo ( self,
thresholdType )

Definition at line 82 of file L1TriggerConfigAccess.py.

82 def thresholdExtraInfo(self, thresholdType):
83 if thresholdType in self["thresholds"]:
84 thrDef = self["thresholds"][thresholdType]
85 elif thresholdType in self["thresholds"]["legacyCalo"]:
86 thrDef = self["thresholds"]["legacyCalo"][thresholdType]
87 else:
88 raise KeyError("Threshold type %s not known in thresholds section of the menu" % thresholdType)
89 return {k:thrDef[k] for k in thrDef if k not in ("thresholds", "type")}
90

◆ thresholdNames()

python.L1TriggerConfigAccess.L1MenuAccess.thresholdNames ( self,
thresholdType = None )

Definition at line 74 of file L1TriggerConfigAccess.py.

74 def thresholdNames(self, thresholdType = None):
75 if thresholdType == "internal":
76 return self["thresholds"]["internal"]["names"]
77 elif thresholdType is None:
78 return list(self.thresholds().keys()) + self.thresholdNames("internal")
79 else:
80 return list(self.thresholds(thresholdType).keys())
81

◆ thresholds()

python.L1TriggerConfigAccess.L1MenuAccess.thresholds ( self,
thresholdType = None,
fulldict = False )
When setting fulldict the full dictionary is returned, else just thresholds

Definition at line 53 of file L1TriggerConfigAccess.py.

53 def thresholds(self, thresholdType = None, fulldict = False):
54 """
55 When setting fulldict the full dictionary is returned, else just thresholds
56 """
57 if thresholdType:
58 if thresholdType == "internal":
59 return {}
60 if thresholdType in self["thresholds"]:
61 if fulldict:
62 return self["thresholds"][thresholdType]
63 else:
64 return self["thresholds"][thresholdType]["thresholds"]
65 if thresholdType in self["thresholds"]["legacyCalo"]:
66 return self["thresholds"]["legacyCalo"][thresholdType]["thresholds"]
67 raise RuntimeError("Threshold type %s not known in thresholds section of the menu" % thresholdType)
68 else:
69 thrs = {}
70 for thrType in self.thresholdTypes():
71 thrs.update( self.thresholds(thrType) )
72 return thrs
73

◆ thresholdTypes()

python.L1TriggerConfigAccess.L1MenuAccess.thresholdTypes ( self)

Definition at line 46 of file L1TriggerConfigAccess.py.

46 def thresholdTypes(self):
47 thrTypes = list(self["thresholds"].keys())
48 if "legacyCalo" in thrTypes:
49 thrTypes.remove("legacyCalo")
50 thrTypes += list(self["thresholds"]["legacyCalo"].keys())
51 return thrTypes
52

◆ topoAlgorithmNames()

python.L1TriggerConfigAccess.L1MenuAccess.topoAlgorithmNames ( self,
topoAlgoType = None )

Definition at line 104 of file L1TriggerConfigAccess.py.

104 def topoAlgorithmNames(self, topoAlgoType = None):
105 allAlgs = self.topoAlgorithms(topoAlgoType)
106 return allAlgs.keys()
107
108

◆ topoAlgorithms()

python.L1TriggerConfigAccess.L1MenuAccess.topoAlgorithms ( self,
topoAlgoType = None )

Definition at line 94 of file L1TriggerConfigAccess.py.

94 def topoAlgorithms(self, topoAlgoType = None):
95 if topoAlgoType:
96 return self["topoAlgorithms"][topoAlgoType]
97 else:
98 d = {}
99 for x in self["topoAlgorithms"].values():
100 for gr in x.values():
101 d.update(gr)
102 return d
103

◆ topoAlgorithmTypes()

python.L1TriggerConfigAccess.L1MenuAccess.topoAlgorithmTypes ( self)

Definition at line 91 of file L1TriggerConfigAccess.py.

91 def topoAlgorithmTypes(self):
92 return self["topoAlgorithms"].keys()
93

The documentation for this class was generated from the following file: