ATLAS Offline Software
Public Member Functions | Static Public Attributes | List of all members
python.HLTTriggerConfigAccess.HLTMonitoringAccess Class Reference
Inheritance diagram for python.HLTTriggerConfigAccess.HLTMonitoringAccess:
Collaboration diagram for python.HLTTriggerConfigAccess.HLTMonitoringAccess:

Public Member Functions

def __init__ (self, filename=None, jsonString=None, dbalias=None, smkey=None, monikey=None, useCrest=False, crestServer="")
 
def monitoringDict (self)
 
def monitoredChains (self, signatures="", monLevels="", wildcard="")
 
def monitoringLevels (self, signatures=None)
 
def printSummary (self)
 

Static Public Attributes

 maxsize
 

Detailed Description

this class provides access to the HLT monitoring json

Definition at line 143 of file HLTTriggerConfigAccess.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 147 of file HLTTriggerConfigAccess.py.

147  def __init__(self, filename = None, jsonString = None, dbalias = None, smkey = None, monikey = None,
148  useCrest=False, crestServer=""):
149  """
150  accessor needs to be initialized with either a filename or the dbalias and hlpskey
151  """
152  super().__init__(ConfigType.HLTMON, mainkey = "signatures",
153  jsonString = jsonString, filename = filename, dbalias = dbalias, dbkey = smkey if smkey else monikey,
154  useCrest=useCrest, crestServer=crestServer)
155  self.loader.setQuery({
156  7: (
157  "SELECT HMG.HMG_DATA FROM {schema}.HLT_MONITORING_GROUPS HMG, {schema}.SUPER_MASTER_TABLE SMT WHERE HMG.HMG_IN_USE=1 "
158  "AND SMT.SMT_HLT_MENU_ID = HMG.HMG_HLT_MENU_ID AND SMT.SMT_ID=:dbkey ORDER BY HMG.HMG_ID DESC"
159  )
160  } if smkey else {
161  7: "SELECT HMG.HMG_DATA FROM {schema}.HLT_MONITORING_GROUPS HMG WHERE HMG.HMG_ID=:dbkey"
162  })
163  self.load()
164  if smkey is not None:
165  log.info(f"Loaded HLT monitoring {self.name()} with {len(self)} signatures from {dbalias} with smk {smkey}{' using CREST' if useCrest else ''}")
166  elif filename is not None:
167  log.info(f"Loaded HLT monitoring {self.name()} with {len(self)} signatures from file {filename}")
168 
169 

Member Function Documentation

◆ monitoredChains()

def python.HLTTriggerConfigAccess.HLTMonitoringAccess.monitoredChains (   self,
  signatures = "",
  monLevels = "",
  wildcard = "" 
)
return list of all monitored shifter chains for given signature and for a given monitoring level

signatures - monitored signature or list of signatures for which to return the chains
     empty string means all signatures
monLevels - levels of monitoring (shifter, t0 (expert), val (validation))
wildcard - regexp pattern to match the chains' names

if monitoring level is not defined return all the chains for given signature
if signature is not defined return all the chains for given monitoring level
if both monitoring level and signature are not defined, raturn all chains

return can be filtered by wildcard

Definition at line 177 of file HLTTriggerConfigAccess.py.

177  def monitoredChains(self, signatures="", monLevels="", wildcard=""):
178  """
179  return list of all monitored shifter chains for given signature and for a given monitoring level
180 
181  signatures - monitored signature or list of signatures for which to return the chains
182  empty string means all signatures
183  monLevels - levels of monitoring (shifter, t0 (expert), val (validation))
184  wildcard - regexp pattern to match the chains' names
185 
186  if monitoring level is not defined return all the chains for given signature
187  if signature is not defined return all the chains for given monitoring level
188  if both monitoring level and signature are not defined, raturn all chains
189 
190  return can be filtered by wildcard
191  """
192  chains = set()
193 
194  if signatures=="": # empty string means all signatures
195  signatures = set(self)
196 
197  # turn input (str,list) into a set of signature names
198  if isinstance(signatures, str):
199  signatures = set([signatures])
200  signatures = set(signatures)
201 
202  # warn about requested signatures that don't have a monitoring entry and remove from the request
203  noMonAvailable = signatures.difference(self)
204  if noMonAvailable:
205  log.warning("These monitoring signatures are requested but not available in HLT monitoring: %s", ', '.join(noMonAvailable))
206  signatures.intersection_update(self) # ignore non-existing signatures
207 
208  # turn input (str,list) into a set of monLevels
209  if isinstance(monLevels, str):
210  monLevels = set([monLevels])
211  monLevels = set(monLevels)
212 
213  for signature in signatures:
214  for chainName, targets in self["signatures"][signature].items():
215  if monLevels.intersection(targets+[""]): # if there is an overlap between requested and configured
216  chains.add(chainName)
217 
218  try:
219  import re
220  r = re.compile(wildcard)
221  chains = filter(r.search, chains)
222  except re.error as exc:
223  log.warning("Wildcard regex: %r is not correct!", exc)
224 
225  # Create set first to ensure uniquness of elements
226  return list(chains)
227 
228 

◆ monitoringDict()

def python.HLTTriggerConfigAccess.HLTMonitoringAccess.monitoringDict (   self)
return stored monitoring dictionary

Definition at line 170 of file HLTTriggerConfigAccess.py.

170  def monitoringDict(self):
171  """
172  return stored monitoring dictionary
173  """
174  return self["signatures"]
175 
176 

◆ monitoringLevels()

def python.HLTTriggerConfigAccess.HLTMonitoringAccess.monitoringLevels (   self,
  signatures = None 
)
return all monitoring levels
If one ore more signatures are specified, return only monitoring levels for those

Definition at line 230 of file HLTTriggerConfigAccess.py.

230  def monitoringLevels(self, signatures = None):
231  """
232  return all monitoring levels
233  If one ore more signatures are specified, return only monitoring levels for those
234  """
235  if signatures is None:
236  signatures = set(self)
237  if isinstance(signatures, str):
238  signatures = set([signatures])
239  signatures = set(signatures)
240  levels = set()
241  for signatureName, chains in self["signatures"].items():
242  if signatureName in signatures:
243  levels = reduce( lambda x, y: x.union(y), chains.values(), levels )
244  return levels
245 
246 

◆ printSummary()

def python.HLTTriggerConfigAccess.HLTMonitoringAccess.printSummary (   self)

Definition at line 247 of file HLTTriggerConfigAccess.py.

247  def printSummary(self):
248  print("HLT monitoring groups %s" % self.name())
249  print("Signatures (%i): %s" % (len(self), ", ".join(self)) )
250  print("Monitoring levels (%i): %s" % (len(self.monitoringLevels()), ", ".join(self.monitoringLevels())))

Member Data Documentation

◆ maxsize

python.HLTTriggerConfigAccess.HLTMonitoringAccess.maxsize
static

Definition at line 229 of file HLTTriggerConfigAccess.py.


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
covarianceTool.filter
filter
Definition: covarianceTool.py:514
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
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
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