ATLAS Offline Software
Static Public Member Functions | Static Private Member Functions | List of all members
python.TriggerCrestUtil.TriggerCrestUtil Class Reference
Collaboration diagram for python.TriggerCrestUtil.TriggerCrestUtil:

Static Public Member Functions

str|None getCrestConnection (str oracle_db)
 
CrestApi getCrestApi (str server)
 
dict[str, dict[str, Any]] getConditionsForTimestamp (str tag, *int timestamp, str server="", CrestApi|None api=None, bool get_time_type=False)
 
list[dict[str, dict[str, Any]]] getConditionsInRange (str tag, *int since, int until, str server="", CrestApi|None api=None, bool get_time_type=False)
 
str getTagTimeType (str tag, *str server="", CrestApi|None api=None)
 
list[strgetAttribs (str tag, *str server="", CrestApi|None api=None)
 
dict getPayloadFromHash (str payload_hash, *str server="", CrestApi|None api=None)
 
dict[str, Any]|None getEORParams (int run, *str server="", CrestApi|None api=None)
 
list[dict[str, dict[str, Any]]] getHLTPrescaleKeys (int run, *str server="", CrestApi|None api=None)
 
list[dict[str, dict[str, Any]]] getL1ConfigKeys (int run, *str server="", CrestApi|None api=None)
 
list[dict[str, dict[str, Any]]] getBunchGroupKey (int run, *str server="", CrestApi|None api=None)
 
dict getHLTConfigKeys (int run, *str server="", CrestApi|None api=None)
 

Static Private Member Functions

None _update_with_time_type (dict[str, Any] result, str time_type, int since)
 
dict _get_payload (payload_hash, api)
 
dict _get_payload_workaround (payload_hash, server)
 
def _get_iovs_for_run (str tag, *int run, CrestApi api)
 
IovSetDto|HTTPResponse _get_iov_for_timestamp (str tag, *int timestamp, CrestApi api)
 
IovSetDto|HTTPResponse _get_iovs_range (*int since, int until, CrestApi api, str tag)
 
tuple[list[Any], dict[Any, Any]] _get_payload_spec (str tag, CrestApi api)
 

Detailed Description

Definition at line 13 of file TriggerCrestUtil.py.

Member Function Documentation

◆ _get_iov_for_timestamp()

IovSetDto | HTTPResponse python.TriggerCrestUtil.TriggerCrestUtil._get_iov_for_timestamp ( str  tag,
*int  timestamp,
CrestApi  api 
)
staticprivate
Helper to retrieve the IOV for a given timestamp

Args:
    tag (str): tag name
    timestamp (int): time-stamp in format run<32+lb or time in nanoseconds since 1.1.1970
    api (CrestApi): Crest API instance.

Returns:
    IovSetDto: set of IOVs (of size 1)

Definition at line 369 of file TriggerCrestUtil.py.

369  def _get_iov_for_timestamp(tag: str, *, timestamp: int, api: CrestApi) -> IovSetDto | HTTPResponse:
370  """Helper to retrieve the IOV for a given timestamp
371 
372  Args:
373  tag (str): tag name
374  timestamp (int): time-stamp in format run<32+lb or time in nanoseconds since 1.1.1970
375  api (CrestApi): Crest API instance.
376 
377  Returns:
378  IovSetDto: set of IOVs (of size 1)
379  """
380  # the upper limit of the iov-search is exclusive, so we need to add 1
381  return api.select_iovs(tag, "0", str(timestamp+1), sort='id.since:DESC', size=1, snapshot=0) # type: ignore
382 

◆ _get_iovs_for_run()

def python.TriggerCrestUtil.TriggerCrestUtil._get_iovs_for_run ( str  tag,
*int  run,
CrestApi  api 
)
staticprivate
Helper to retrieve all IOVs for a run

Definition at line 362 of file TriggerCrestUtil.py.

362  def _get_iovs_for_run(tag: str, *, run: int, api: CrestApi):
363  """Helper to retrieve all IOVs for a run"""
364  run_start = (run << 32) + 1
365  run_end = ((run + 1) << 32) - 1
366  return TriggerCrestUtil._get_iovs_range(since=run_start, until=run_end, api=api, tag=tag)
367 

◆ _get_iovs_range()

IovSetDto | HTTPResponse python.TriggerCrestUtil.TriggerCrestUtil._get_iovs_range ( *int  since,
int  until,
CrestApi  api,
str  tag 
)
staticprivate
Helper to retrieve the IOV in a given range

Args:
    tag (str): tag name
    since (int): start of the range (either run<32+lb or time in nanoseconds since 1.1.1970, inclusive)
    until (int): end of the range (either run<32+lb or time in nanoseconds since 1.1.1970, exclusive)
    api (CrestApi): Crest API instance.

Returns:
    IovSetDto: set of IOVs

Definition at line 384 of file TriggerCrestUtil.py.

384  def _get_iovs_range(*, since: int, until: int, api: CrestApi, tag: str) -> IovSetDto | HTTPResponse:
385  """Helper to retrieve the IOV in a given range
386 
387  Args:
388  tag (str): tag name
389  since (int): start of the range (either run<32+lb or time in nanoseconds since 1.1.1970, inclusive)
390  until (int): end of the range (either run<32+lb or time in nanoseconds since 1.1.1970, exclusive)
391  api (CrestApi): Crest API instance.
392 
393  Returns:
394  IovSetDto: set of IOVs
395  """
396  # the upper limit of the iov-search is exclusive, so we need to add 1 to find the iov which includes 'since'
397  iovs = api.select_iovs(tag, "0", str(since+1), sort='id.since:DESC', size=1, snapshot=0) # type: ignore
398  if cast(int, iovs['size']) < 1:
399  raise RuntimeError(f"Did not get an iov which includes the start of run {since}")
400  firstiov = cast(list, iovs['resources'])[0]
401  all_iovs = api.select_iovs(tag, str(firstiov['since']), str(until), sort='id.since:ASC', snapshot=0) # type: ignore
402  return all_iovs
403 

◆ _get_payload()

dict python.TriggerCrestUtil.TriggerCrestUtil._get_payload (   payload_hash,
  api 
)
staticprivate

Definition at line 337 of file TriggerCrestUtil.py.

337  def _get_payload(payload_hash, api) -> dict:
338  return api.get_payload(hash=payload_hash).decode('utf-8')
339 

◆ _get_payload_spec()

tuple[list[Any], dict[Any, Any]] python.TriggerCrestUtil.TriggerCrestUtil._get_payload_spec ( str  tag,
CrestApi  api 
)
staticprivate
Helper to retrieve the payload spec for a given tag

Definition at line 405 of file TriggerCrestUtil.py.

405  def _get_payload_spec(tag: str, api: CrestApi) -> tuple[list[Any], dict[Any, Any]]:
406  """Helper to retrieve the payload spec for a given tag"""
407  meta: TagMetaSetDto | HTTPResponse = api.find_tag_meta(tag)
408  tag_info = cast(list, meta['resources'])[0]['tag_info']
409  tag_info_dict = json.loads(tag_info)
410  attr_list = []
411  type_dict = {}
412  for d in tag_info_dict['payload_spec']:
413  attr_list += list(d)
414  type_dict.update(d)
415  return attr_list, type_dict
416 
417 

◆ _get_payload_workaround()

dict python.TriggerCrestUtil.TriggerCrestUtil._get_payload_workaround (   payload_hash,
  server 
)
staticprivate

Definition at line 341 of file TriggerCrestUtil.py.

341  def _get_payload_workaround(payload_hash, server) -> dict:
342  import requests
343  import json
344  url = f"{server}/payloads/data"
345  params = {
346  "format": "BLOB",
347  "hash": payload_hash
348  }
349  preq = requests.Request(method='GET', url=url, params=params).prepare()
350  with requests.Session() as session:
351  try:
352  resp = session.send(preq)
353  except requests.ConnectionError as exc:
354  raise RuntimeError(f"Could not connect to CREST server {server}") from exc
355 
356  if resp.status_code != 200:
357  raise RuntimeError(f"Query {payload_hash} to crest failed with status code {resp.status_code}")
358 
359  return json.loads(resp.content)
360 

◆ _update_with_time_type()

None python.TriggerCrestUtil.TriggerCrestUtil._update_with_time_type ( dict[str, Any]  result,
str  time_type,
int  since 
)
staticprivate

Definition at line 323 of file TriggerCrestUtil.py.

323  def _update_with_time_type(result: dict[str, Any], time_type: str, since: int) -> None:
324  result['time_type'] = time_type
325  if time_type == 'run-lumi':
326  result.update({
327  'since_run': since >> 32,
328  'since_lb': since & 0xFFFFFFFF
329  })
330  elif time_type == 'time':
331  result.update({
332  'since_formatted': dt.fromtimestamp(since / 1e9)
333  })
334 
335 

◆ getAttribs()

list[str] python.TriggerCrestUtil.TriggerCrestUtil.getAttribs ( str  tag,
*str   server = "",
CrestApi | None   api = None 
)
static
list of attributes for this tag

Args:
    tag (str): tag name
    server (str, optional): crest server name. Only needed if api is not provided. Defaults to "".
    api (CrestApi, optional): Crest API instance. Defaults to None.

Raises:
    RuntimeError: if both server and api are missing

Returns:
    dict: list of attributes

Definition at line 188 of file TriggerCrestUtil.py.

188  def getAttribs(tag: str, *, server: str = "", api: CrestApi | None = None) -> list[str]:
189  """ list of attributes for this tag
190 
191  Args:
192  tag (str): tag name
193  server (str, optional): crest server name. Only needed if api is not provided. Defaults to "".
194  api (CrestApi, optional): Crest API instance. Defaults to None.
195 
196  Raises:
197  RuntimeError: if both server and api are missing
198 
199  Returns:
200  dict: list of attributes
201  """
202  if server=="" and api is None:
203  log.error("Need either crest_server name or crest api for retrieving the payload")
204  raise RuntimeError("Crest access information missing")
205  if api is None:
206  api = CrestApi(host=server)
207  attr_list, _ = TriggerCrestUtil._get_payload_spec(tag, api)
208  return attr_list
209 

◆ getBunchGroupKey()

list[dict[str, dict[str, Any]]] python.TriggerCrestUtil.TriggerCrestUtil.getBunchGroupKey ( int  run,
*str   server = "",
CrestApi | None   api = None 
)
static

Definition at line 275 of file TriggerCrestUtil.py.

275  def getBunchGroupKey(run: int, *, server: str = "", api: CrestApi | None = None) -> list[dict[str, dict[str, Any]]]:
276  if api is None:
277  api = CrestApi(host=server)
278  run_start = (run << 32)
279  run_end = ((run+1) << 32)-1
280  cond = TriggerCrestUtil.getConditionsInRange("TRIGGERLVL1BunchGroupKey-HEAD", since=run_start, until=run_end, api=api, get_time_type=True)
281  for entry in cond:
282  entry.update(entry.pop('payload')['0'])
283  entry['key'] = entry.pop('Lvl1BunchGroupConfigurationKey')
284  return cond
285 

◆ getConditionsForTimestamp()

dict[str, dict[str, Any]] python.TriggerCrestUtil.TriggerCrestUtil.getConditionsForTimestamp ( str  tag,
*int  timestamp,
str   server = "",
CrestApi | None   api = None,
bool   get_time_type = False 
)
static
Conditions data for tag at a specific timestamp

Conditions data is returned as a dict with 'since' and 'payload' keys.
The 'payload' itself is a dict of channel:'data dicts'. The 'data dict' has attribute names as
keys and the corresponding values. If get_time_type is True, also 'time_type' key is added to 
each IOV dict and the since is further expanded into 'since_run' and 'since_lb' (for run/lb-based 
timestamps) or 'since_formatted' (for time-based timestamps).

Args:
    tag (str): The tag name
    timestamp (int): The timestamp to query (either run<32+lb or time in nanoseconds since 1.1.1970)
    server (str, optional): Crest server name. Only needed if api is not provided. Defaults to "".
    api (_type_, optional): Crest API instance. Defaults to None.
    get_time_type (bool, optional): Whether to retrieve the time type. Defaults to False.

Raises:
    RuntimeError: If both server and api are missing

Returns:
    dict[str, dict[str, any]]: Conditions data

Definition at line 59 of file TriggerCrestUtil.py.

59  def getConditionsForTimestamp(tag: str, *, timestamp: int, server: str = "", api: CrestApi | None = None,
60  get_time_type: bool = False) -> dict[str, dict[str, Any]]:
61  """ Conditions data for tag at a specific timestamp
62 
63  Conditions data is returned as a dict with 'since' and 'payload' keys.
64  The 'payload' itself is a dict of channel:'data dicts'. The 'data dict' has attribute names as
65  keys and the corresponding values. If get_time_type is True, also 'time_type' key is added to
66  each IOV dict and the since is further expanded into 'since_run' and 'since_lb' (for run/lb-based
67  timestamps) or 'since_formatted' (for time-based timestamps).
68 
69  Args:
70  tag (str): The tag name
71  timestamp (int): The timestamp to query (either run<32+lb or time in nanoseconds since 1.1.1970)
72  server (str, optional): Crest server name. Only needed if api is not provided. Defaults to "".
73  api (_type_, optional): Crest API instance. Defaults to None.
74  get_time_type (bool, optional): Whether to retrieve the time type. Defaults to False.
75 
76  Raises:
77  RuntimeError: If both server and api are missing
78 
79  Returns:
80  dict[str, dict[str, any]]: Conditions data
81  """
82  if server=="" and api is None:
83  log.error("Need either crest server name or crest api specified for accessing Crest")
84  raise RuntimeError("Crest access information missing")
85  if api is None:
86  api = CrestApi(host=server)
87  # get the payload specification
88  attr_list, _ = TriggerCrestUtil._get_payload_spec(tag, api)
89  # get the IOVs in the given range
90  iov = TriggerCrestUtil._get_iov_for_timestamp(tag, timestamp=timestamp, api=api)
91 
92  if get_time_type:
93  time_type = TriggerCrestUtil.getTagTimeType(tag, api=api)
94 
95  payload_for_iov = {}
96  payload_hash: str = cast(list, iov['resources'])[0]['payload_hash']
97  since: int = cast(list, iov['resources'])[0]['since']
98  payload = TriggerCrestUtil.getPayloadFromHash(payload_hash, api=api)
99  for channel, data in payload.items():
100  payload_for_iov[channel] = dict(zip(attr_list, data))
101 
102  result: dict[str, Any] = {
103  'since': since,
104  'payload': payload_for_iov
105  }
106  if get_time_type:
107  TriggerCrestUtil._update_with_time_type(result, time_type, since)
108  return result
109 
110 

◆ getConditionsInRange()

list[dict[str, dict[str, Any]]] python.TriggerCrestUtil.TriggerCrestUtil.getConditionsInRange ( str  tag,
*int  since,
int  until,
str   server = "",
CrestApi | None   api = None,
bool   get_time_type = False 
)
static
Conditions data for tag in given range

List goes over the IOVs found. For each IOV, there is a dict with 'since' and 'payload' keys. 
The 'payload' itself is a dict of channel:'data dicts'. The 'data dict' has attribute names as
keys and the corresponding values. If get_time_type is True, also 'time_type' key is added to 
each IOV dict and the since is further expanded into 'since_run' and 'since_lb' (for run/lb-based 
timestamps) or 'since_formatted' (for time-based timestamps).

Args:
    tag (str): tag name
    since (int): start of the range (either run<32+lb or time in nanoseconds since 1.1.1970, inclusive)
    until (int): end of the range (either run<32+lb or time in nanoseconds since 1.1.1970, exclusive)
    server (str, optional): crest server name. Only needed if api is not provided. Defaults to "".
    api (CrestApi, optional): Crest API instance. Defaults to None.
    get_time_type (bool, optional): whether to retrieve the time type. Defaults to False.

Raises:
    RuntimeError: if both server and api are missing

Returns:
    list[dict[str, dict[str, any]]]: conditions data

Definition at line 112 of file TriggerCrestUtil.py.

112  def getConditionsInRange(tag: str, *, since: int, until: int, server: str = "", api: CrestApi | None = None,
113  get_time_type: bool = False) -> list[dict[str, dict[str, Any]]]:
114  """ Conditions data for tag in given range
115 
116  List goes over the IOVs found. For each IOV, there is a dict with 'since' and 'payload' keys.
117  The 'payload' itself is a dict of channel:'data dicts'. The 'data dict' has attribute names as
118  keys and the corresponding values. If get_time_type is True, also 'time_type' key is added to
119  each IOV dict and the since is further expanded into 'since_run' and 'since_lb' (for run/lb-based
120  timestamps) or 'since_formatted' (for time-based timestamps).
121 
122  Args:
123  tag (str): tag name
124  since (int): start of the range (either run<32+lb or time in nanoseconds since 1.1.1970, inclusive)
125  until (int): end of the range (either run<32+lb or time in nanoseconds since 1.1.1970, exclusive)
126  server (str, optional): crest server name. Only needed if api is not provided. Defaults to "".
127  api (CrestApi, optional): Crest API instance. Defaults to None.
128  get_time_type (bool, optional): whether to retrieve the time type. Defaults to False.
129 
130  Raises:
131  RuntimeError: if both server and api are missing
132 
133  Returns:
134  list[dict[str, dict[str, any]]]: conditions data
135  """
136  if server=="" and api is None:
137  log.error("Need either crest server name or crest api specified for accessing Crest")
138  raise RuntimeError("Crest access information missing")
139  if api is None:
140  api = CrestApi(host=server)
141  # get the payload specification
142  attr_list, type_dict = TriggerCrestUtil._get_payload_spec(tag, api)
143  # get the IOVs in the given range
144  all_iovs = TriggerCrestUtil._get_iovs_range(since=since, until=until, api=api, tag=tag)
145 
146  if get_time_type:
147  time_type = TriggerCrestUtil.getTagTimeType(tag, api=api)
148 
149  result: list[dict[str, dict[str, Any]]] = []
150  for iov in cast(Iterable, all_iovs['resources']):
151  payload_for_iov = {}
152  payload_hash = iov['payload_hash']
153  since = iov['since']
154  payload = TriggerCrestUtil.getPayloadFromHash(payload_hash, api=api)
155  for channel, data in payload.items():
156  payload_for_iov[channel] = dict(zip(attr_list, data))
157  entry = {'since': since, 'payload': payload_for_iov}
158  if get_time_type:
159  TriggerCrestUtil._update_with_time_type(entry, time_type, since)
160  result += [entry]
161  return result
162 

◆ getCrestApi()

CrestApi python.TriggerCrestUtil.TriggerCrestUtil.getCrestApi ( str  server)
static
Crest API object

Args:
    server (str): crest server name.

Returns:
    CrestApi: Crest API instance.

Definition at line 47 of file TriggerCrestUtil.py.

47  def getCrestApi(server: str) -> CrestApi:
48  """ Crest API object
49 
50  Args:
51  server (str): crest server name.
52 
53  Returns:
54  CrestApi: Crest API instance.
55  """
56  return CrestApi(host=server)
57 

◆ getCrestConnection()

str | None python.TriggerCrestUtil.TriggerCrestUtil.getCrestConnection ( str  oracle_db)
static
maps from triggerdb or triggerdb-alias to crest connection

See https://its.cern.ch/jira/browse/ATR-32030

Definition at line 16 of file TriggerCrestUtil.py.

16  def getCrestConnection(oracle_db: str) -> str | None:
17  """maps from triggerdb or triggerdb-alias to crest connection
18 
19  See https://its.cern.ch/jira/browse/ATR-32030
20  """
21  db_mapping: dict[str, str] = {
22  "ATLAS_CONF_TRIGGER_RUN3": "CONF_DATA_RUN3",
23  "ATLAS_CONF_TRIGGER_MC_RUN3": "CONF_MC_RUN3",
24  "ATLAS_CONF_TRIGGER_REPR_RUN3": "CONF_REPR_RUN3",
25  "ATLAS_CONF_TRIGGER_RUN4": "CONF_DATA_RUN4",
26  "ATLAS_CONF_TRIGGER_MC_RUN4": "CONF_MC_RUN4",
27  "ATLAS_CONF_TRIGGER_REPR_RUN4": "CONF_REPR_RUN4",
28  "ATLAS_CONF_TRIGGER_LS3_DEV": "CONF_DEV_LS3",
29  "ATLAS_CONF_TRIGGER_LS3_L0": "CONF_DEV_L0",
30  "ATLAS_CONF_TRIGGER_RUN2_NF": "CONF_DATA_RUN2"
31  }
32  alias_mapping: dict[str, str] = {
33  "TRIGGERDB_RUN3": "CONF_DATA_RUN3",
34  "TRIGGERDBREPR_RUN3": "CONF_REPR_RUN3",
35  "TRIGGERDBMC_RUN3": "CONF_MC_RUN3",
36  "TRIGGERDB_RUN4": "CONF_DATA_RUN4",
37  "TRIGGERDBREPR_RUN4": "CONF_REPR_RUN4",
38  "TRIGGERDBMC_RUN4": "CONF_MC_RUN4",
39  "TRIGGERDBLS3_DEV": "CONF_DEV_LS3",
40  "TRIGGERDBLS3_L0": "CONF_DEV_L0",
41  "TRIGGERDB_RUN2_NF": "CONF_DATA_RUN2_NF"
42  }
43  db_mapping.update(alias_mapping)
44  return db_mapping.get(oracle_db, None)
45 

◆ getEORParams()

dict[str, Any] | None python.TriggerCrestUtil.TriggerCrestUtil.getEORParams ( int  run,
*str   server = "",
CrestApi | None   api = None 
)
static

Definition at line 240 of file TriggerCrestUtil.py.

240  def getEORParams(run: int, *, server: str = "", api: CrestApi | None = None) -> dict[str, Any] | None:
241  if api is None:
242  api = CrestApi(host=server)
243  start_of_run = (run << 32)
244  cond_data = TriggerCrestUtil.getConditionsForTimestamp("TDAQRunCtrlEOR-HEAD", timestamp=start_of_run, api=api, get_time_type=False)
245  if not cond_data:
246  log.error("No EOR params found for run %s", run)
247  return None
248  return cond_data['payload']['0']
249 

◆ getHLTConfigKeys()

dict python.TriggerCrestUtil.TriggerCrestUtil.getHLTConfigKeys ( int  run,
*str   server = "",
CrestApi | None   api = None 
)
static

Definition at line 287 of file TriggerCrestUtil.py.

287  def getHLTConfigKeys(run: int, *, server: str = "", api: CrestApi | None = None) -> dict:
288  # helper function to turn the payload of the TRIGGERHLTHltConfigKeys into a dictionary
289  def _parse_info(run, cond):
290  # Format for ConfigSource (see ATR-21550):
291  # Run-4: currently like Run-3
292  # Run-3: TRIGGERDB_RUN3;22.0.101;Athena,22.0.101 --extra_args ...
293  # Run-2: TRIGGERDBR2R,21.1.24,AthenaP1
294  release = 'unknown'
295  if run > 379000: # Run-3
296  confsrc = cond['ConfigSource'].split(';')
297  dbalias = confsrc[0]
298  if len(confsrc) > 2:
299  release = confsrc[2].split(',')[0] + f",{confsrc[1]}"
300  else: # Run-2
301  confsrc = cond['ConfigSource'].split(',', maxsplit=1)
302  dbalias = confsrc[0]
303  if len(confsrc) > 2:
304  release = f"{confsrc[2]},{confsrc[1]}"
305  return {
306  "SMK": cond['MasterConfigurationKey'],
307  "HLTPSK": cond['HltPrescaleConfigurationKey'],
308  "DB": dbalias,
309  "REL": release
310  }
311 
312  if api is None:
313  api = CrestApi(host=server)
314 
315  run_start = (run << 32) + 1
316  cond: dict[str, dict[str, Any]] = TriggerCrestUtil.getConditionsForTimestamp("TRIGGERHLTHltConfigKeys-HEAD", timestamp=run_start, api=api, get_time_type=True)
317  cond.update(cond.pop('payload')['0'])
318  return _parse_info(run, cond)
319 
320 

◆ getHLTPrescaleKeys()

list[dict[str, dict[str, Any]]] python.TriggerCrestUtil.TriggerCrestUtil.getHLTPrescaleKeys ( int  run,
*str   server = "",
CrestApi | None   api = None 
)
static

Definition at line 251 of file TriggerCrestUtil.py.

251  def getHLTPrescaleKeys(run: int, *, server: str = "", api: CrestApi | None = None) -> list[dict[str, dict[str, Any]]]: # -> list[dict[str, dict[str, Any]]]:
252  if api is None:
253  api = CrestApi(host=server)
254  run_start = (run << 32)
255  run_end = ((run + 1) << 32) - 1
256  cond = TriggerCrestUtil.getConditionsInRange("TRIGGERHLTPrescaleKey-HEAD", since=run_start, until=run_end, api=api, get_time_type=True)
257  for entry in cond:
258  entry.update(entry.pop('payload')['0'])
259  entry['key'] = entry.pop('HltPrescaleKey')
260  return cond
261 

◆ getL1ConfigKeys()

list[dict[str, dict[str, Any]]] python.TriggerCrestUtil.TriggerCrestUtil.getL1ConfigKeys ( int  run,
*str   server = "",
CrestApi | None   api = None 
)
static

Definition at line 263 of file TriggerCrestUtil.py.

263  def getL1ConfigKeys(run: int, *, server: str = "", api: CrestApi | None = None) -> list[dict[str, dict[str, Any]]]:
264  if api is None:
265  api = CrestApi(host=server)
266  run_start = (run << 32)
267  run_end = ((run + 1) << 32) - 1
268  cond = TriggerCrestUtil.getConditionsInRange("TRIGGERLVL1Lvl1ConfigKey-HEAD", since=run_start, until=run_end, api=api, get_time_type=True)
269  for entry in cond:
270  entry.update(entry.pop('payload')['0'])
271  entry['key'] = entry.pop('Lvl1PrescaleConfigurationKey')
272  return cond
273 

◆ getPayloadFromHash()

dict python.TriggerCrestUtil.TriggerCrestUtil.getPayloadFromHash ( str  payload_hash,
*str   server = "",
CrestApi | None   api = None 
)
static
Get payload from hash

Args:
    payload_hash (str): hash of the payload
    server (str, optional): crest server name. Defaults to "".
    api (CrestApi, optional): Crest API instance. Defaults to None.

Raises:
    RuntimeError: if both server and api are missing

Returns:
    dict: payload retrieved from the hash

Definition at line 211 of file TriggerCrestUtil.py.

211  def getPayloadFromHash(payload_hash: str, *, server: str = "", api: CrestApi | None = None) -> dict:
212  """ Get payload from hash
213 
214  Args:
215  payload_hash (str): hash of the payload
216  server (str, optional): crest server name. Defaults to "".
217  api (CrestApi, optional): Crest API instance. Defaults to None.
218 
219  Raises:
220  RuntimeError: if both server and api are missing
221 
222  Returns:
223  dict: payload retrieved from the hash
224  """
225  if server == "" and api is None:
226  log.error("Need either crest_server name or crest api for retrieving the payload")
227  raise RuntimeError("Crest access information missing")
228  useWorkAround = True
229  if useWorkAround:
230  if server == "":
231  server = api._host # type: ignore
232  return TriggerCrestUtil._get_payload_workaround(payload_hash, server)
233  else:
234  if api is None:
235  api = CrestApi(host=server)
236  return TriggerCrestUtil._get_payload(payload_hash, api)
237 

◆ getTagTimeType()

str python.TriggerCrestUtil.TriggerCrestUtil.getTagTimeType ( str  tag,
*str   server = "",
CrestApi | None   api = None 
)
static
time type of the tag, either 'run-lumi' or 'time'

Args:
    tag (str): tag name
    server (str, optional): crest server name. Only needed if api is not provided. Defaults to "".
    api (CrestApi, optional): Crest API instance. Defaults to None.

Raises:
    RuntimeError: if both server and api are missing

Returns:
    str: time type of the tag ['run-lumi' or 'time']

Definition at line 164 of file TriggerCrestUtil.py.

164  def getTagTimeType(tag: str, *, server: str = "", api: CrestApi | None = None) -> str:
165  """ time type of the tag, either 'run-lumi' or 'time'
166 
167  Args:
168  tag (str): tag name
169  server (str, optional): crest server name. Only needed if api is not provided. Defaults to "".
170  api (CrestApi, optional): Crest API instance. Defaults to None.
171 
172  Raises:
173  RuntimeError: if both server and api are missing
174 
175  Returns:
176  str: time type of the tag ['run-lumi' or 'time']
177  """
178  if server=="" and api is None:
179  log.error("Need either crest_server name or crest api for retrieving the payload")
180  raise RuntimeError("Crest access information missing")
181  if api is None:
182  api = CrestApi(host=server)
183  tag_info = api.find_tag(tag)
184  time_type: str = tag_info['time_type']
185  return time_type
186 

The documentation for this class was generated from the following file:
AtlasMcWeight::decode
double decode(number_type binnedWeight)
Convert weight from unsigned to double.
Definition: AtlasMcWeight.cxx:32
python.dbgAnalysis.getHLTConfigKeys
def getHLTConfigKeys(runNumber=None, args=None)
Definition: dbgAnalysis.py:214
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
str
Definition: BTagTrackIpAccessor.cxx:11
Trk::split
@ split
Definition: LayerMaterialProperties.h:38