ATLAS Offline Software
Functions
python.GeoModelConfigFlags Namespace Reference

Functions

def createGeoModelConfigFlags (analysis=False)
 

Function Documentation

◆ createGeoModelConfigFlags()

def python.GeoModelConfigFlags.createGeoModelConfigFlags (   analysis = False)

Definition at line 7 of file GeoModelConfigFlags.py.

7 def createGeoModelConfigFlags(analysis=False):
8  gcf=AthConfigFlags()
9 
10  def __getTrigTag(flags):
11  from TriggerJobOpts.TriggerConfigFlags import trigGeoTag
12  return trigGeoTag(flags)
13 
14  gcf.addFlag("GeoModel.AtlasVersion", lambda flags :
15  (__getTrigTag(flags) if flags.Trigger.doLVL1 or flags.Trigger.doHLT else None) or
16  GetFileMD(flags.Input.Files).get("GeoAtlas", None), help='ATLAS Geometry version tag')
17 
18  # Special handling of analysis releases where we only want AtlasVersion and Run
19  if analysis:
20  def _deduce_LHCPeriod(prevFlags):
21  import logging
22  log = logging.getLogger("GeoModelConfigFlags")
23  log.info('Deducing LHC Run period from the geometry tag name "%s" as database access is not available in analysis releases', prevFlags.GeoModel.AtlasVersion)
24  if not prevFlags.GeoModel.AtlasVersion:
25  raise ValueError('No geometry tag specified')
26 
27  if prevFlags.GeoModel.AtlasVersion.startswith("ATLAS-R1"):
28  period = LHCPeriod.Run1
29  elif prevFlags.GeoModel.AtlasVersion.startswith("ATLAS-R2"):
30  period = LHCPeriod.Run2
31  elif prevFlags.GeoModel.AtlasVersion.startswith("ATLAS-R3"):
32  period = LHCPeriod.Run3
33  elif prevFlags.GeoModel.AtlasVersion.startswith("ATLAS-P2-RUN4"):
34  period = LHCPeriod.Run4
35  else:
36  raise ValueError(f'Can not deduce LHC Run period from "{prevFlags.GeoModel.AtlasVersion}", please set "flags.GeoModel.Run" manually.')
37 
38  log.info('Using LHC Run period "%s"', period.value)
39  return period
40 
41  gcf.addFlag("GeoModel.Run", # Run deduced from other metadata
42  _deduce_LHCPeriod, type=LHCPeriod, help='LHC Run period')
43  return gcf
44 
45  def _deduce_LHCPeriod(prevFlags):
46  if prevFlags.GeoModel.AtlasVersion:
47  return LHCPeriod(DetDescrInfo(prevFlags.GeoModel.AtlasVersion,prevFlags.GeoModel.SQLiteDB,prevFlags.GeoModel.SQLiteDBFullPath)['Common']['Run'])
48 
49  if prevFlags.Input.isMC:
50  raise ValueError('No geometry tag specified')
51 
52  if 2022 <= prevFlags.Input.DataYear:
53  return LHCPeriod.Run3
54  if 2015 <= prevFlags.Input.DataYear <= 2018:
55  return LHCPeriod.Run2
56  if 2010 <= prevFlags.Input.DataYear <= 2013:
57  return LHCPeriod.Run1
58 
59  raise RuntimeError('Can not determine LHC period from the data project name')
60 
61  gcf.addFlag("GeoModel.Run", _deduce_LHCPeriod, type=LHCPeriod, help='LHC Run period')
62 
63  gcf.addFlag('GeoModel.Layout', 'atlas', help='Geometry layout') # replaces global.GeoLayout
64 
65  gcf.addFlag("GeoModel.Align.Dynamic",
66  lambda prevFlags : prevFlags.GeoModel.Run >= LHCPeriod.Run2 and not prevFlags.Input.isMC, help='Flag for using dynamic alignment')
67  # TODO: dynamic alignment is for now enabled by default for data overlay
68  # to disable, add 'and prevFlags.Common.ProductionStep not in [ProductionStep.Simulation, ProductionStep.Overlay]'
69 
70  def _deduce_LegacyConditionsAccess(prevFlags):
71  if prevFlags.Common.Project is Project.AthSimulation:
72  return True
73  if prevFlags.Common.ProductionStep is not ProductionStep.Simulation:
74  return False
75  from SimulationConfig.SimEnums import LArParameterization
76  if prevFlags.Sim.ISF.Simulator.usesFastCaloSim() or prevFlags.Sim.LArParameterization is LArParameterization.FastCaloSim:
77  return False
78  return True
79 
80  gcf.addFlag("GeoModel.Align.LegacyConditionsAccess", _deduce_LegacyConditionsAccess,
81  help='Flag for using the legacy conditions access infrastructure')
82  # Mainly for G4 which still loads alignment on initialize
83 
84  gcf.addFlag("GeoModel.Type",
85  lambda prevFlags : DetDescrInfo(prevFlags.GeoModel.AtlasVersion,prevFlags.GeoModel.SQLiteDB,prevFlags.GeoModel.SQLiteDBFullPath)['Common']['GeoType'],
86  help='Geometry type in {ITKLoI, ITkLoI-VF, etc...}')
87 
88  gcf.addFlag("GeoModel.IBLLayout",
89  lambda prevFlags : DetDescrInfo(prevFlags.GeoModel.AtlasVersion,prevFlags.GeoModel.SQLiteDB,prevFlags.GeoModel.SQLiteDBFullPath)['Pixel']['IBLlayout'],
90  help='IBL layer layout in {"planar", "3D", "noIBL"}')
91 
92  gcf.addFlag('GeoModel.EMECStandard',False, help='Flag for activating the EMEC description with standard Geant4 shapes: G4GenericTrap')
93 
94  gcf.addFlag('GeoModel.SQLiteDB',False, help='Flag for activating GeoModel initialization from SQLite Geometry DB')
95 
96  gcf.addFlag('GeoModel.SQLiteDBFullPath','', help='Override default location of the SQLite Geometry DB')
97 
98  gcf.addFlag('GeoModel.IgnoreTagDifference',False, help='Ignore geometry tag difference between the configured value and the value read from the input file metadata')
99 
100  return gcf
python.AutoConfigFlags.GetFileMD
def GetFileMD(filenames, allowEmpty=True, maxLevel='peeker')
Definition: AutoConfigFlags.py:65
python.TriggerConfigFlags.trigGeoTag
def trigGeoTag(flags)
Definition: TriggerConfigFlags.py:27
python.GeoModelConfigFlags.createGeoModelConfigFlags
def createGeoModelConfigFlags(analysis=False)
Definition: GeoModelConfigFlags.py:7
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
python.AutoConfigFlags.DetDescrInfo
def DetDescrInfo(geoTag, sqliteDB, sqliteDBFullPath)
Definition: AutoConfigFlags.py:133