ATLAS Offline Software
Public Member Functions | List of all members
python.L1TriggerConfigAccess.L1MenuAccess Class Reference
Inheritance diagram for python.L1TriggerConfigAccess.L1MenuAccess:
Collaboration diagram for python.L1TriggerConfigAccess.L1MenuAccess:

Public Member Functions

def __init__ (self, filename=None, jsonString=None, dbalias=None, smkey=None, useCrest=False, crestServer="")
 
def itemNames (self)
 
def itemsWithCtpid (self)
 
def items (self, includeKeys=[])
 
def thresholdTypes (self)
 
def thresholds (self, thresholdType=None, fulldict=False)
 
def thresholdNames (self, thresholdType=None)
 
def thresholdExtraInfo (self, thresholdType)
 
def topoAlgorithmTypes (self)
 
def topoAlgorithms (self, topoAlgoType=None)
 
def topoAlgorithmNames (self, topoAlgoType=None)
 
def boardNames (self)
 
def boards (self)
 
def board (self, boardName)
 
def connectorNames (self)
 
def connectors (self)
 
def connector (self, connectorName)
 
def ctp (self)
 
def ctpInputs (self, inputType)
 
def 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__()

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

Definition at line 14 of file L1TriggerConfigAccess.py.

14  def __init__(self, filename = None, jsonString = None, dbalias = None, smkey = None, useCrest=False, crestServer=""):
15  """
16  accessor needs to be initialized with either a filename or the dbalias and smkey
17  """
18  super().__init__(ConfigType.L1MENU, mainkey = "items",
19  jsonString = jsonString, filename = filename, dbalias = dbalias, dbkey = smkey,
20  useCrest=useCrest, crestServer=crestServer)
21  self.loader.setQuery({
22  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
23  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
24  })
25  self.load()
26  if smkey is not None:
27  log.info(f"Loaded L1 menu {self.name()} with {len(self)} items from {dbalias} with smk {smkey}{' using CREST' if useCrest else ''}")
28  elif filename is not None:
29  log.info(f"Loaded L1 menu {self.name()} with {len(self)} chains from file {filename}")
30 

Member Function Documentation

◆ board()

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

Definition at line 114 of file L1TriggerConfigAccess.py.

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

◆ boardNames()

def python.L1TriggerConfigAccess.L1MenuAccess.boardNames (   self)

Definition at line 108 of file L1TriggerConfigAccess.py.

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

◆ boards()

def python.L1TriggerConfigAccess.L1MenuAccess.boards (   self)

Definition at line 111 of file L1TriggerConfigAccess.py.

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

◆ connector()

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

Definition at line 123 of file L1TriggerConfigAccess.py.

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

◆ connectorNames()

def python.L1TriggerConfigAccess.L1MenuAccess.connectorNames (   self)

Definition at line 117 of file L1TriggerConfigAccess.py.

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

◆ connectors()

def python.L1TriggerConfigAccess.L1MenuAccess.connectors (   self)

Definition at line 120 of file L1TriggerConfigAccess.py.

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

◆ ctp()

def python.L1TriggerConfigAccess.L1MenuAccess.ctp (   self)

Definition at line 126 of file L1TriggerConfigAccess.py.

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

◆ ctpInputs()

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

Definition at line 129 of file L1TriggerConfigAccess.py.

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

◆ itemNames()

def python.L1TriggerConfigAccess.L1MenuAccess.itemNames (   self)

Definition at line 31 of file L1TriggerConfigAccess.py.

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

◆ items()

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

Definition at line 37 of file L1TriggerConfigAccess.py.

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

◆ itemsWithCtpid()

def python.L1TriggerConfigAccess.L1MenuAccess.itemsWithCtpid (   self)

Definition at line 34 of file L1TriggerConfigAccess.py.

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

◆ printSummary()

def python.L1TriggerConfigAccess.L1MenuAccess.printSummary (   self)

Definition at line 134 of file L1TriggerConfigAccess.py.

134  def printSummary(self):
135  print("L1 menu %s" % self.name())
136  print("Number of items: %i" % len(self))
137  print("Number of threshold types: %i" % len(self.thresholdTypes()) )
138  print("Number of thresholds: %i" % len(self.thresholds()) )
139  print("Number of topo algorithms: %i" % len(self.topoAlgorithms()))
140  print("Number of boards: %i (%i are legacy boards)" % ( len(self.boards()), sum(["legacy" in b for b in self.boards().values()]) ))
141  print("Number of connectors: %i (%i are legacy connetors)" % ( len(self.connectors()), sum(["legacy" in c for c in self.connectors().values()]) ))
142  print("CTP has %i optical, %i electrical, and %i CTPIN inputs" % ( len(self.ctpInputs("optical")), len(self.ctpInputs("electrical")),
143  len(reduce(
144  lambda s1,i: s1.union(self.ctpInputs("ctpin")[f"slot{i}"].values()),
145  [7,8,9], set()) - set([""]) )))
146 
147 
148 
149 

◆ thresholdExtraInfo()

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

Definition at line 81 of file L1TriggerConfigAccess.py.

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

◆ thresholdNames()

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

Definition at line 73 of file L1TriggerConfigAccess.py.

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

◆ thresholds()

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

Definition at line 52 of file L1TriggerConfigAccess.py.

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

◆ thresholdTypes()

def python.L1TriggerConfigAccess.L1MenuAccess.thresholdTypes (   self)

Definition at line 45 of file L1TriggerConfigAccess.py.

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

◆ topoAlgorithmNames()

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

Definition at line 103 of file L1TriggerConfigAccess.py.

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

◆ topoAlgorithms()

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

Definition at line 93 of file L1TriggerConfigAccess.py.

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

◆ topoAlgorithmTypes()

def python.L1TriggerConfigAccess.L1MenuAccess.topoAlgorithmTypes (   self)

Definition at line 90 of file L1TriggerConfigAccess.py.

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

The documentation for this class was generated from the following file:
reduce
void reduce(HepMC::GenEvent *ge, std::vector< HepMC::GenParticlePtr > toremove)
Remove unwanted particles from the event, collapsing the graph structure consistently.
Definition: FixHepMC.cxx:81
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
TriggerTest.ctp
ctp
Retrieve trigger EDM objects.
Definition: TriggerTest.py:14
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798