CMS 3D CMS Logo

Functions
GeneralSetup Namespace Reference

Functions

def setup (process, global_tag, zero_tesla=False, geometry="")
 

Function Documentation

◆ setup()

def GeneralSetup.setup (   process,
  global_tag,
  zero_tesla = False,
  geometry = "" 
)
General setup of an alignment process.

Arguments:
- `process`: cms.Process object
- `global_tag`: global tag to be used
- `zero_tesla`: if 'True' the B-field map for 0T is enforced
- `geometry`: geometry to be used (default is an empty string for the standard geometry)

Definition at line 4 of file GeneralSetup.py.

References print().

4 def setup(process, global_tag, zero_tesla=False, geometry=""):
5  """General setup of an alignment process.
6 
7  Arguments:
8  - `process`: cms.Process object
9  - `global_tag`: global tag to be used
10  - `zero_tesla`: if 'True' the B-field map for 0T is enforced
11  - `geometry`: geometry to be used (default is an empty string for the standard geometry)
12  """
13 
14  # MessageLogger for convenient output
15  # --------------------------------------------------------------------------
16  process.load('Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.myMessageLogger_cff')
17 
18  # Load the magnetic field configuration
19  # --------------------------------------------------------------------------
20  if zero_tesla:
21  # For 0T MC samples or data
22  process.load("Configuration.StandardSequences.MagneticField_0T_cff")
23  else:
24  process.load('Configuration.StandardSequences.MagneticField_cff')
25 
26  # Load the geometry
27  # --------------------------------------------------------------------------
28  if geometry == "":
29  # Default geometry
30  print(f"Using Geometry from DB")
31  process.load('Configuration.Geometry.GeometryRecoDB_cff')
32  else:
33  # Check if the geometry string matches the format "Extended<X>", e.g. ExtendedRun4D110
34  if re.match(r"^Extended\w+$", geometry):
35  # Dynamically load the specified geometry
36  geometry_module = f"Configuration.Geometry.Geometry{geometry}Reco_cff"
37  try:
38  process.load(geometry_module)
39  print(f"Using Geometry: {geometry_module}")
40  except Exception as e:
41  print(f"Error: Unable to load the geometry module '{geometry_module}'.\n{e}")
42  raise
43  else:
44  raise ValueError(f"Invalid geometry format: '{geometry}'. Expected format is 'Extended<X>'.")
45 
46  # Load the conditions (GlobalTag)
47  # --------------------------------------------------------------------------
48  process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
49 
50  from Configuration.AlCa.GlobalTag import GlobalTag
51  process.GlobalTag = GlobalTag(process.GlobalTag, global_tag)
52  print("Using Global Tag:", process.GlobalTag.globaltag._value)
53 
54  return process # Not required since the cms.Process object is modified in place
55 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def setup(process, global_tag, zero_tesla=False, geometry="")
Definition: GeneralSetup.py:4