3 from AthenaConfiguration.AthConfigFlags
import AthConfigFlags
4 from AthenaConfiguration.AutoConfigFlags
import GetFileMD, DetDescrInfo
5 from AthenaConfiguration.Enums
import LHCPeriod, ProductionStep, Project
10 def __getTrigTag(flags):
11 from TriggerJobOpts.TriggerConfigFlags
import trigGeoTag
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')
20 def _deduce_LHCPeriod(prevFlags):
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')
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
36 raise ValueError(f
'Can not deduce LHC Run period from "{prevFlags.GeoModel.AtlasVersion}", please set "flags.GeoModel.Run" manually.')
38 log.info(
'Using LHC Run period "%s"', period.value)
41 gcf.addFlag(
"GeoModel.Run",
42 _deduce_LHCPeriod, type=LHCPeriod, help=
'LHC Run period')
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'])
49 if prevFlags.Input.isMC:
50 raise ValueError(
'No geometry tag specified')
52 if 2022 <= prevFlags.Input.DataYear:
54 if 2015 <= prevFlags.Input.DataYear <= 2018:
56 if 2010 <= prevFlags.Input.DataYear <= 2013:
59 raise RuntimeError(
'Can not determine LHC period from the data project name')
61 gcf.addFlag(
"GeoModel.Run", _deduce_LHCPeriod, type=LHCPeriod, help=
'LHC Run period')
63 gcf.addFlag(
'GeoModel.Layout',
'atlas', help=
'Geometry layout')
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')
70 def _deduce_LegacyConditionsAccess(prevFlags):
71 if prevFlags.Common.Project
is Project.AthSimulation:
73 if prevFlags.Common.ProductionStep
is not ProductionStep.Simulation:
75 from SimulationConfig.SimEnums
import LArParameterization
76 if prevFlags.Sim.ISF.Simulator.usesFastCaloSim()
or prevFlags.Sim.LArParameterization
is LArParameterization.FastCaloSim:
80 gcf.addFlag(
"GeoModel.Align.LegacyConditionsAccess", _deduce_LegacyConditionsAccess,
81 help=
'Flag for using the legacy conditions access infrastructure')
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...}')
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"}')
92 gcf.addFlag(
'GeoModel.EMECStandard',
False, help=
'Flag for activating the EMEC description with standard Geant4 shapes: G4GenericTrap')
94 gcf.addFlag(
'GeoModel.SQLiteDB',
False, help=
'Flag for activating GeoModel initialization from SQLite Geometry DB')
96 gcf.addFlag(
'GeoModel.SQLiteDBFullPath',
'', help=
'Override default location of the SQLite Geometry DB')
98 gcf.addFlag(
'GeoModel.IgnoreTagDifference',
False, help=
'Ignore geometry tag difference between the configured value and the value read from the input file metadata')