ATLAS Offline Software
GeoModelConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaConfiguration.Enums import ProductionStep
6 from AthenaCommon import Logging
7 
8 
9 def GeoDbTagSvcCfg(flags, name = "GeoDbTagSvc", **kwargs):
10  result =ComponentAccumulator()
11  from RDBAccessSvc.RDBAccessSvcConfig import RDBAccessSvcCfg
12  result.merge(RDBAccessSvcCfg(flags))
13 
14  result.addService(CompFactory.GeoDbTagSvc(name, **kwargs))
15  return result
16 def GeoModelCfg(flags):
17  if not flags.GeoModel.AtlasVersion:
18  raise ValueError('No geometry tag specified')
19 
20  from PyUtils.Helpers import release_metadata
21  rel_metadata = release_metadata()
22  relversion = rel_metadata['release'].split('.')
23  if len(relversion) < 3:
24  relversion = rel_metadata['base release'].split('.')
25 
26  result=ComponentAccumulator()
27 
28  from RDBAccessSvc.RDBAccessSvcConfig import RDBAccessSvcCfg
29  result.merge(RDBAccessSvcCfg(flags))
30  #Get DetDescrCnvSvc (for identifier dictionaries (identifier helpers)
31  from DetDescrCnvSvc.DetDescrCnvSvcConfig import DetDescrCnvSvcCfg
32  result.merge(GeoDbTagSvcCfg(flags))
33  result.merge(DetDescrCnvSvcCfg(flags))
34 
35 
36 
37  #TagInfoMgr used by GeoModelSvc but no ServiceHandle. Relies on string-name
38  from EventInfoMgt.TagInfoMgrConfig import TagInfoMgrCfg
39  result.merge(TagInfoMgrCfg(flags))
40 
41  gms=CompFactory.GeoModelSvc(AtlasVersion=flags.GeoModel.AtlasVersion,
42  SQLiteDB=flags.GeoModel.SQLiteDB,
43  SQLiteDBFullPath=flags.GeoModel.SQLiteDBFullPath,
44  EMECStandard=flags.GeoModel.EMECStandard,
45  IgnoreTagDifference=flags.GeoModel.IgnoreTagDifference,
46  SupportedGeometry=int(relversion[0]))
47  if flags.Common.ProductionStep == ProductionStep.Simulation:
48 
49  gms.AlignCallbacks = False
50  result.addService(gms, primary=True, create=True)
51 
52  return result
53 
54 
55 if __name__ == "__main__":
56  from AthenaConfiguration.AllConfigFlags import initConfigFlags
57  from AthenaConfiguration.TestDefaults import defaultGeometryTags
58 
59  flags = initConfigFlags()
60  flags.Input.Files = []
61  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
62  flags.lock()
63 
64  acc = GeoModelCfg(flags)
65  with open("test.pkl", "wb") as f:
66  acc.store(f)
67 
68  Logging.log.info("All OK")
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.Helpers.release_metadata
def release_metadata()
Definition: Tools/PyUtils/python/Helpers.py:143
RDBAccessSvcConfig.RDBAccessSvcCfg
def RDBAccessSvcCfg(flags, name="RDBAccessSvc", **kwargs)
Definition: RDBAccessSvcConfig.py:7
python.TagInfoMgrConfig.TagInfoMgrCfg
def TagInfoMgrCfg(flags, tagValuePairs={})
Definition: TagInfoMgrConfig.py:6
python.DetDescrCnvSvcConfig.DetDescrCnvSvcCfg
def DetDescrCnvSvcCfg(flags, **kwargs)
Definition: DetDescrCnvSvcConfig.py:6
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.GeoModelConfig.GeoDbTagSvcCfg
def GeoDbTagSvcCfg(flags, name="GeoDbTagSvc", **kwargs)
Definition: GeoModelConfig.py:9
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
python.GeoModelConfig.GeoModelCfg
def GeoModelCfg(flags)
Definition: GeoModelConfig.py:16