Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-14 00:06:15

0001 from Configuration.PyReleaseValidation.upgradeWorkflowComponents import upgradeProperties as properties
0002 from Configuration.AlCa.autoCond import autoCond
0003 from Configuration.StandardSequences.Eras import eras
0004 
0005 DEFAULT_VERSION = "Run4D121"
0006 
0007 def get_era_and_conditions(version_key):
0008     """Retrieve the era and global tag for a given version key.
0009 
0010     Args:
0011         version_key (str): The version key to look up.
0012 
0013     Returns:
0014         tuple: A tuple containing the global tag and era object.
0015 
0016     Raises:
0017         KeyError: If the version key or global tag is not found.
0018     """
0019     # Ensure the version key exists in the properties for Run4
0020     if version_key not in properties['Run4']:
0021         raise KeyError(f"Version key '{version_key}' not found in properties['Run4'].")
0022 
0023     # Retrieve the global tag key
0024     global_tag_key = properties['Run4'][version_key]['GT']
0025     print(f"Global tag key from properties: {global_tag_key}")
0026 
0027     # Validate the existence of the global tag in autoCond
0028     global_tag_name = global_tag_key.replace("auto:", "")
0029     if global_tag_name not in autoCond:
0030         raise KeyError(f"Global tag key '{global_tag_key}' not found in autoCond.")
0031 
0032     # Retrieve the era key and get the corresponding era object
0033     era_key = properties['Run4'][version_key]['Era']
0034     print(f"Constructed era key from properties: {era_key}")
0035     era = getattr(eras, era_key)
0036 
0037     return global_tag_key, era