ATLAS Offline Software
Loading...
Searching...
No Matches
GeoModelConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5from AthenaConfiguration.Enums import ProductionStep
6from AthenaCommon import Logging
7
8
9def 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
16def 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 nThreads = 0
41
43 try:
44 nThreads = flags.Concurrency.NumThreads
45 except Exception:
46 pass
47 gms=CompFactory.GeoModelSvc(AtlasVersion=flags.GeoModel.AtlasVersion,
48 SQLiteDB=flags.GeoModel.SQLiteDB,
49 SQLiteDBFullPath=flags.GeoModel.SQLiteDBFullPath,
50 EMECStandard=flags.GeoModel.EMECStandard,
51 IgnoreTagDifference=flags.GeoModel.IgnoreTagDifference,
52 SupportedGeometry=int(relversion[0]),
53 nThreads = nThreads)
54 if flags.Common.ProductionStep == ProductionStep.Simulation:
55
56 gms.AlignCallbacks = False
57 result.addService(gms, primary=True, create=True)
58
59 return result
60
61
62if __name__ == "__main__":
63 from AthenaConfiguration.AllConfigFlags import initConfigFlags
64 from AthenaConfiguration.TestDefaults import defaultGeometryTags
65
66 flags = initConfigFlags()
67 flags.Input.Files = []
68 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
69 flags.lock()
70
71 acc = GeoModelCfg(flags)
72 with open("test.pkl", "wb") as f:
73 acc.store(f)
74
75 Logging.log.info("All OK")
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177
GeoDbTagSvcCfg(flags, name="GeoDbTagSvc", **kwargs)