File indexing completed on 2024-11-25 02:29:03
0001 import re
0002
0003 def setup(process, global_tag, zero_tesla=False, geometry=""):
0004 """General setup of an alignment process.
0005
0006 Arguments:
0007 - `process`: cms.Process object
0008 - `global_tag`: global tag to be used
0009 - `zero_tesla`: if 'True' the B-field map for 0T is enforced
0010 - `geometry`: geometry to be used (default is an empty string for the standard geometry)
0011 """
0012
0013
0014
0015 process.load('Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.myMessageLogger_cff')
0016
0017
0018
0019 if zero_tesla:
0020
0021 process.load("Configuration.StandardSequences.MagneticField_0T_cff")
0022 else:
0023 process.load('Configuration.StandardSequences.MagneticField_cff')
0024
0025
0026
0027 if geometry == "":
0028
0029 print(f"Using Geometry from DB")
0030 process.load('Configuration.Geometry.GeometryRecoDB_cff')
0031 else:
0032
0033 if re.match(r"^Extended\w+$", geometry):
0034
0035 geometry_module = f"Configuration.Geometry.Geometry{geometry}Reco_cff"
0036 try:
0037 process.load(geometry_module)
0038 print(f"Using Geometry: {geometry_module}")
0039 except Exception as e:
0040 print(f"Error: Unable to load the geometry module '{geometry_module}'.\n{e}")
0041 raise
0042 else:
0043 raise ValueError(f"Invalid geometry format: '{geometry}'. Expected format is 'Extended<X>'.")
0044
0045
0046
0047 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0048
0049 from Configuration.AlCa.GlobalTag import GlobalTag
0050 process.GlobalTag = GlobalTag(process.GlobalTag, global_tag)
0051 print("Using Global Tag:", process.GlobalTag.globaltag._value)
0052
0053 return process