CMS 3D CMS Logo

Functions
defaultPhase2ConditionsEra_cff Namespace Reference

Functions

def get_era_and_conditions (version_key)
 

Function Documentation

◆ get_era_and_conditions()

def defaultPhase2ConditionsEra_cff.get_era_and_conditions (   version_key)
Retrieve the era and global tag for a given version key.

Args:
    version_key (str): The version key to look up.

Returns:
    tuple: A tuple containing the global tag and era object.

Raises:
    KeyError: If the version key or global tag is not found.

Definition at line 7 of file defaultPhase2ConditionsEra_cff.py.

References print().

7 def get_era_and_conditions(version_key):
8  """Retrieve the era and global tag for a given version key.
9 
10  Args:
11  version_key (str): The version key to look up.
12 
13  Returns:
14  tuple: A tuple containing the global tag and era object.
15 
16  Raises:
17  KeyError: If the version key or global tag is not found.
18  """
19  # Ensure the version key exists in the properties for 2026
20  if version_key not in properties[2026]:
21  raise KeyError(f"Version key '{version_key}' not found in properties[2026].")
22 
23  # Retrieve the global tag key
24  global_tag_key = properties[2026][version_key]['GT']
25  print(f"Global tag key from properties: {global_tag_key}")
26 
27  # Validate the existence of the global tag in autoCond
28  global_tag_name = global_tag_key.replace("auto:", "")
29  if global_tag_name not in autoCond:
30  raise KeyError(f"Global tag key '{global_tag_key}' not found in autoCond.")
31 
32  # Retrieve the era key and get the corresponding era object
33  era_key = properties[2026][version_key]['Era']
34  print(f"Constructed era key from properties: {era_key}")
35  era = getattr(eras, era_key)
36 
37  return global_tag_key, era
38 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47