diff --git a/Control/AthenaConfiguration/python/AutoConfigFlags.py b/Control/AthenaConfiguration/python/AutoConfigFlags.py
index 65eddb4ba189fdb5f351eb209e49363b6d85f930..b18ebd491b5880941135c1d867e4f99ccda54f41 100644
--- a/Control/AthenaConfiguration/python/AutoConfigFlags.py
+++ b/Control/AthenaConfiguration/python/AutoConfigFlags.py
@@ -1,21 +1,16 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from PyUtils.MetaReader import read_metadata
 from AtlasGeoModel.AtlasGeoDBInterface import AtlasGeoDBInterface
+from AthenaCommon.Logging import logging
+from functools import lru_cache
 
-#Module level cache of file-metadata:
-_fileMetaData=dict()
-
-#Module level cache of DDDB cursor
-_dbGeomCursor = 0
-
-#Module level dictionary of DDDB information:
-_detDescrInfo = dict()
+msg = logging.getLogger('AutoConfigFlags')
 
+# Module level cache of file-metadata:
+_fileMetaData = dict()
 
 def GetFileMD(filenames):
-    from AthenaCommon.Logging import logging
-    msg = logging.getLogger('AutoConfigFlags')
     filename=filenames[0]
     if filename == '_ATHENA_GENERIC_INPUTFILE_NAME_':
         raise RuntimeError('Input file name not set, instead _ATHENA_GENERIC_INPUTFILE_NAME_ found. Cannot read metadata.')
@@ -31,171 +26,31 @@ def GetFileMD(filenames):
     return _fileMetaData[filename]
 
 
-def initializeGeometryParameters():
-    # ----------------------------------------------------------------------------
-    # Connect to database
-
-    bVerbose = False
-    _dbGeomCursor = AtlasGeoDBInterface(_detDescrInfo["geomTag"],bVerbose)
-    _dbGeomCursor.ConnectAndBrowseGeoDB()
-
-    # ----------------------------------------------------------------------------
-    # Read version name, layout and dbm from AtlasCommon table
-
-    dbId,dbCommon,dbParam = _dbGeomCursor.GetCurrentLeafContent("AtlasCommon")
-
-    _run = "UNDEFINED"
-    _geotype = "UNDEFINED"
-    _stripgeotype = "UNDEFINED"
-    if len(dbId)>0:
-        key=dbId[0]
-        if "CONFIG" in dbParam :
-            _run = dbCommon[key][dbParam.index("CONFIG")]
-        if "GEOTYPE" in dbParam :
-            _geotype = dbCommon[key][dbParam.index("GEOTYPE")]
-        if "STRIPGEOTYPE" in dbParam :
-            _stripgeotype = dbCommon[key][dbParam.index("STRIPGEOTYPE")]
-
-    _detDescrInfo["Run"]=_run
-    _detDescrInfo["GeoType"]=_geotype
-    _detDescrInfo["StripGeoType"]=_stripgeotype
-
-    # ----------------------------------------------------------------------------
-    # Read version name, layout and dbm from PixelSwitches table
-
-    dbId,dbSwitches,dbParam = _dbGeomCursor.GetCurrentLeafContent("PixelSwitches")
-
-    _versionName="UNDEFINED"
-    _layout="UNDEFINED"
-    _dbm = False
-
-    if len(dbId)>0:
-        key=dbId[0]
-        if "VERSIONNAME" in dbParam:
-            _versionName = dbSwitches[key][dbParam.index("VERSIONNAME")]
-        if "LAYOUT" in dbParam :
-            _layout = dbSwitches[key][dbParam.index("LAYOUT")]
-        if "BUILDDBM" in dbParam :
-            _dbm = (dbSwitches[key][dbParam.index("BUILDDBM")] != 0)
-
-
-    _detDescrInfo["VersionName"] = _versionName
-    _detDescrInfo["Layout"] = _layout
-    _detDescrInfo["DBM"] = _dbm
-
-    # ----------------------------------------------------------------------------
-    # IBL layout
-
-    dbId,dbLayers,dbParam = _dbGeomCursor.GetCurrentLeafContent("PixelLayer")
-    IBLStaveIndex = -1
-    IBLgeoLayout = -1
-    _IBLlayout = "noIBL"
-    if len(dbId)>0:
-        key=dbId[0]
-        if "STAVEINDEX" in dbParam and dbLayers[key][dbParam.index("STAVEINDEX")] not in ["NULL",None]:
-            IBLStaveIndex = int(dbLayers[key][dbParam.index("STAVEINDEX")])
-
-        if IBLStaveIndex>-1:
-            dbId,dbStaves,dbParam = _dbGeomCursor.GetCurrentLeafContent("PixelStave")
-
-            if len(dbId)>0 and IBLStaveIndex<=len(dbStaves.keys()):
-                key=dbId[IBLStaveIndex]
-                if "LAYOUT" in dbParam and dbStaves[key][dbParam.index("LAYOUT")] not in ["NULL",None]:
-                    IBLgeoLayout = int(dbStaves[key][dbParam.index("LAYOUT")])
-                    if IBLgeoLayout in [3,4] :
-                        _IBLlayout = "planar"
-                    elif IBLgeoLayout in [5] :
-                        _IBLlayout = "3D"
-
-    _detDescrInfo["IBLlayout"]=_IBLlayout
-
-    # ----------------------------------------------------------------------------
-    # IBL and SLHC parameters
-
-    _detDescrInfo["IBL"] = False
-    _detDescrInfo["SLHC"] = False
-    if _layout in ['IBL'] :
-        _detDescrInfo["IBL"] = True
-    if _detDescrInfo["IBL"] is False:
-        _detDescrInfo["IBLlayout"] = "noIBL"
-    if _layout not in ['SLHC'] and ( _detDescrInfo["Run"] in ["RUN2", "RUN3"] ) :
-        _detDescrInfo["IBL"] = True
-    if _layout in ['SLHC'] :
-        _detDescrInfo["SLHC"] = True
-
-    # ----------------------------------------------------------------------------
-    # Read version name, layout and dbm from LArSwitches table
-
-    dbId,dbSwitches,dbParam = _dbGeomCursor.GetCurrentLeafContent("LArSwitches")
-    _sagging = None
-    _barrelOn = None
-    _endcapOn = None
-    _FCalFlag="UNDEFINED"
-    _detAbsorber = None
-    _detAbsorber_EC = None
-
-    if len(dbId)>0:
-        key=dbId[0]
-        if "SAGGING" in dbParam:
-            _sagging = dbSwitches[key][dbParam.index("SAGGING")]
-        if "BARREL_ON" in dbParam:
-            _barrelOn = dbSwitches[key][dbParam.index("BARREL_ON")]
-        if "ENDCAP_ON" in dbParam :
-            _endcapOn = dbSwitches[key][dbParam.index("ENDCAP_ON")]
-        if "DETAILED_ABSORBER" in dbParam :
-            _detAbsorber = dbSwitches[key][dbParam.index("DETAILED_ABSORBER")]
-        if "DETAILED_ABSORBER_EC" in dbParam :
-            _detAbsorber_EC = dbSwitches[key][dbParam.index("DETAILED_ABSORBER_EC")]
-        if "FCAL_GEOTYPE" in dbParam :
-            _FCalFlag = dbSwitches[key][dbParam.index("FCAL_GEOTYPE")]
-
-    _detDescrInfo["Sagging"] = _sagging
-    _detDescrInfo["BarrelOn"] = _barrelOn
-    _detDescrInfo["EndcapOn"] = _endcapOn
-    _detDescrInfo["FCal_GeoType"] = _FCalFlag
-    _detDescrInfo["DetAbs"] = _detAbsorber
-    _detDescrInfo["DetAbs_EC"] = _detAbsorber_EC
-
-
-    # ------------------------------------------------------------------------
-    # Muon geometry flag initi
-
-    dbId,dbSwitches,dbParam = _dbGeomCursor.GetCurrentLeafContent("MuonSwitches")
-    _layoutName=None
-    _hasCsc=True
-    _hasStgc=True
-    _hasMM=True
-
-    if len(dbId)>0:
-        key=dbId[0]
-        if "LAYOUTNAME" in dbParam:
-            _layoutName = dbSwitches[key][dbParam.index("LAYOUTNAME")]
-        if "HASCSC" in dbParam:
-            _hasCsc = dbSwitches[key][dbParam.index("HASCSC")]
-        if "HASSTGC" in dbParam:
-            _hasStgc = dbSwitches[key][dbParam.index("HASSTGC")]
-        if "HASMM" in dbParam:
-            _hasMM = dbSwitches[key][dbParam.index("HASMM")]
-
-    _detDescrInfo["MuonLayout"] = (_layoutName if _layoutName else "UNDEFINED")
-    if _hasCsc == 0:
-        _detDescrInfo["HasCSC"] = False
-    else:
-        _detDescrInfo["HasCSC"] = True
-    if _hasStgc == 0:
-        _detDescrInfo["HasSTGC"] = False
-    else:
-        _detDescrInfo["HasSTGC"] = True
-    if _hasMM == 0:
-        _detDescrInfo["HasMM"] = False
-    else:
-        _detDescrInfo["HasMM"] = True
-
-    return
+def _initializeGeometryParameters(geoTag):
+    """Read geometry database for all detetors"""
+
+    from AtlasGeoModel import CommonGeoDB
+    from PixelGeoModel import PixelGeoDB
+    from LArGeoAlgsNV import LArGeoDB
+    from MuonGeoModel import MuonGeoDB
+
+    dbGeomCursor = AtlasGeoDBInterface(geoTag)
+    dbGeomCursor.ConnectAndBrowseGeoDB()
 
+    # FIXME: geometry parameter names need to be unique across systems!
+    params = {}
+    params.update(CommonGeoDB.InitializeGeometryParameters(dbGeomCursor))
+    params.update(PixelGeoDB.InitializeGeometryParameters(dbGeomCursor))
+    params.update(LArGeoDB.InitializeGeometryParameters(dbGeomCursor))
+    params.update(MuonGeoDB.InitializeGeometryParameters(dbGeomCursor))
+
+    return params
+
+
+@lru_cache(maxsize=4)  # maxsize=1 should be enough for most jobs
 def GetDetDescrInfo(geoTag):
-    if _dbGeomCursor == 0:
-        # set geometry tag name
-        _detDescrInfo["geomTag"] = geoTag
-        initializeGeometryParameters()
-    return _detDescrInfo
+    """Query geometry DB for detector description"""
+
+    detDescrInfo = _initializeGeometryParameters(geoTag)
+    detDescrInfo["geomTag"] = geoTag
+    return detDescrInfo
diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/CommonGMJobProperties.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/CommonGMJobProperties.py
index a7e30e39ab8f3d50101f176f79164a9584c87dc7..f2c1b1a4e582e0a82598f569b573d218db258b9f 100644
--- a/DetectorDescription/GeoModel/AtlasGeoModel/python/CommonGMJobProperties.py
+++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/CommonGMJobProperties.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 # Common Geometry job property base class
@@ -8,66 +8,7 @@ from AthenaCommon.GlobalFlags import globalflags
 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobproperties
 from AthenaCommon import Logging
 from AtlasGeoModel.AtlasGeoDBInterface import AtlasGeoDBInterface
-
-class CommonGMFlags:
-
-    def __init__(self, geoTag="none"):
-
-        self.__dict__={}
-
-        # set geometry tag name
-        self.__dict__["geomTag"]= globalflags.DetDescrVersion()
-        if geoTag!="none": self.__dict__["geomTag"] = geoTag
-        
-        self.dbGeomCursor = 0
-        self.connectToDB()
-    
-        self.InitializeGeometryParameters()
-
-
-    def connectToDB(self):
-
-        bVerbose=False
-        self.dbGeomCursor = AtlasGeoDBInterface(self.__dict__["geomTag"],bVerbose)
-        self.dbGeomCursor.ConnectAndBrowseGeoDB()
-
-        return
-
-
-    def InitializeGeometryParameters(self):
-
-        # ----------------------------------------------------------------------------    
-        # Read versionname, layout and dbm from AtlasCommon table
-
-        dbId,dbCommon,dbParam = self.dbGeomCursor.GetCurrentLeafContent("AtlasCommon")
-
-        _run = "UNDEFINED"
-        _geotype = "UNDEFINED"
-        _stripgeotype = "UNDEFINED"
-        if len(dbId)>0:
-            key=dbId[0] 
-            if "CONFIG" in dbParam : _run = dbCommon[key][dbParam.index("CONFIG")]
-            if "GEOTYPE" in dbParam : _geotype = dbCommon[key][dbParam.index("GEOTYPE")]
-            if "STRIPGEOTYPE" in dbParam : _stripgeotype = dbCommon[key][dbParam.index("STRIPGEOTYPE")]
-        
-        self.__dict__["Run"]=_run
-        self.__dict__["GeoType"]=_geotype
-        self.__dict__["StripGeoType"]=_stripgeotype
-
-
-    def getValue(self,name):
-
-        return self.__dict__[name]
-
-
-    def dump(self):
-
-        Logging.log.info("Geometry tag CommonGMFlags : "+self.__dict__["geomTag"]+" ------------------------------------")
-
-        Logging.log.info("RUN flag      : "+self.__dict__["Run"])
-        Logging.log.info("GeoType flag  : "+self.__dict__["GeoType"])
-        Logging.log.info("Strip GeoType flag  : "+self.__dict__["StripGeoType"])
-
+from AtlasGeoModel import CommonGeoDB
 
 # ------------------------------------------------------------------------------------------------------------------
 #  Geometry jobproperties defined for the common geometry (invented by the ID - no calo and muon specific flags ...)
@@ -100,16 +41,18 @@ class CommonGeometryFlags_JobProperties(JobPropertyContainer):
         return
 
 
-    def setupValuesFromDB(self,geoTagName="none"):
-        
-        CommonGeoFlags = CommonGMFlags(geoTagName)
+    def setupValuesFromDB(self, geoTagName=None):
+
+        dbGeomCursor = AtlasGeoDBInterface(geoTagName or globalflags.DetDescrVersion())
+        dbGeomCursor.ConnectAndBrowseGeoDB()
+        params = CommonGeoDB.InitializeGeometryParameters(dbGeomCursor)
 
-        self.Run.set_Value_and_Lock(CommonGeoFlags.getValue("Run"))
-        self.GeoType.set_Value_and_Lock(CommonGeoFlags.getValue("GeoType"))
-        self.StripGeoType.set_Value_and_Lock(CommonGeoFlags.getValue("StripGeoType"))
+        self.Run.set_Value_and_Lock(params["Run"])
+        self.GeoType.set_Value_and_Lock(params["GeoType"])
+        self.StripGeoType.set_Value_and_Lock(params["StripGeoType"])
 
 
-    def reset(self,geoTagName="none"):
+    def reset(self):
         
         self.Run.unlock()
         self.GeoType.unlock()
@@ -118,9 +61,9 @@ class CommonGeometryFlags_JobProperties(JobPropertyContainer):
 
     def dump(self):
 
-        Logging.log.info("RUN flag      :"+self.Run())
-        Logging.log.info("GeoType flag  : "+self.GeoType())
-        Logging.log.info("Strip geoType flag  : "+self.StripGeoType())
+        Logging.log.info("RUN flag      : %s", self.Run())
+        Logging.log.info("GeoType flag  : %s", self.GeoType())
+        Logging.log.info("Strip geoType flag  : %s", self.StripGeoType())
 
 
 jobproperties.add_Container(CommonGeometryFlags_JobProperties)
diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/CommonGeoDB.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/CommonGeoDB.py
new file mode 100644
index 0000000000000000000000000000000000000000..210f66f70daf5766fd9abe08e92a73dc0a29f577
--- /dev/null
+++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/CommonGeoDB.py
@@ -0,0 +1,24 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+def InitializeGeometryParameters(dbGeomCursor):
+   """Read version name, layout and dbm from AtlasCommon table.
+
+   dbGeomCursor: AtlasGeoDBInterface instance
+   """
+
+   dbId, dbCommon, dbParam = dbGeomCursor.GetCurrentLeafContent("AtlasCommon")
+
+   params = {"Run" : "UNDEFINED",
+             "GeoType" : "UNDEFINED",
+             "StripGeoType" : "UNDEFINED"}
+
+   if len(dbId)>0:
+      key = dbId[0]
+      if "CONFIG" in dbParam :
+         params["Run"] = dbCommon[key][dbParam.index("CONFIG")]
+      if "GEOTYPE" in dbParam :
+         params["GeoType"] = dbCommon[key][dbParam.index("GEOTYPE")]
+      if "STRIPGEOTYPE" in dbParam :
+         params["StripGeoType"] = dbCommon[key][dbParam.index("STRIPGEOTYPE")]
+
+   return params
diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGMJobProperties.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGMJobProperties.py
index ff17d174aaed3eb2bc92e2cf5f1ddd7ef6ceaa65..0ab5213672eb049e9e6ab0686a0d143ba9bf5ef0 100755
--- a/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGMJobProperties.py
+++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGMJobProperties.py
@@ -3,89 +3,12 @@
 #
 # InDet GeoModel initialization
 #
+from AthenaCommon.GlobalFlags import globalflags
 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobproperties
-from AtlasGeoModel.CommonGMJobProperties import CommonGMFlags, CommonGeometryFlags
+from AtlasGeoModel.AtlasGeoDBInterface import AtlasGeoDBInterface
+from PixelGeoModel import PixelGeoDB
 from AthenaCommon import Logging
 
-# -------------------------------------------------------------------------------------
-#  InDet geometry flags initialization
-# -------------------------------------------------------------------------------------
-
-class InDetGMFlags(CommonGMFlags, object):
-
-    def __init__(self, geoTag="none"):
-
-        super(InDetGMFlags, self).__init__()
-
-    def InitializeGeometryParameters(self):
-
-        # ----------------------------------------------------------------------------    
-        # Read versionname, layout and dbm from PixelSwicthes table
-
-        dbId,dbSwitches,dbParam = self.dbGeomCursor.GetCurrentLeafContent("PixelSwitches")
-
-        _versionName="UNDEFINED"
-        _layout="UNDEFINED"
-        _dbm = False
-
-        if len(dbId)>0:
-            key=dbId[0] 
-            if "VERSIONNAME" in dbParam: _versionName = dbSwitches[key][dbParam.index("VERSIONNAME")]
-            if "LAYOUT" in dbParam : _layout = dbSwitches[key][dbParam.index("LAYOUT")]
-            if "BUILDDBM" in dbParam : _dbm = (dbSwitches[key][dbParam.index("BUILDDBM")] != 0)
-
-
-        self.__dict__["VersionName"] = _versionName
-        self.__dict__["Layout"] = _layout
-        self.__dict__["DBM"] = _dbm
-
-
-        # ----------------------------------------------------------------------------    
-        # IBL layout
-
-        dbId,dbLayers,dbParam = self.dbGeomCursor.GetCurrentLeafContent("PixelLayer")
-        IBLStaveIndex = -1
-        IBLgeoLayout = -1
-        _IBLlayout = "noIBL"
-        if len(dbId)>0:
-            key=dbId[0] 
-            if "STAVEINDEX" in dbParam and dbLayers[key][dbParam.index("STAVEINDEX")] not in ["NULL",None]:
-                IBLStaveIndex = int(dbLayers[key][dbParam.index("STAVEINDEX")])
-
-            if IBLStaveIndex>-1:
-                dbId,dbStaves,dbParam = self.dbGeomCursor.GetCurrentLeafContent("PixelStave")
-
-                if len(dbId)>0 and IBLStaveIndex<=len(dbStaves.keys()):
-                    key=dbId[IBLStaveIndex] 
-                    if "LAYOUT" in dbParam and dbStaves[key][dbParam.index("LAYOUT")] not in ["NULL",None]:
-                        IBLgeoLayout = int(dbStaves[key][dbParam.index("LAYOUT")])
-                        if IBLgeoLayout in [3,4] : _IBLlayout = "planar"
-                        elif IBLgeoLayout in [5] : _IBLlayout = "3D"
-
-        self.__dict__["IBLlayout"]=_IBLlayout
-
-        # ----------------------------------------------------------------------------    
-        # IBL and SLHC parameters
-
-        self.__dict__["IBL"] = False
-        self.__dict__["SLHC"] = False
-        if _layout in ['IBL'] : self.__dict__["IBL"] = True
-        if self.__dict__["IBL"] is False: self.__dict__["IBLlayout"]="noIBL"
-        if _layout not in ['SLHC'] and ( CommonGeometryFlags.Run() in ["RUN2", "RUN3"] ) : self.__dict__["IBL"] = True
-        if _layout in ['SLHC'] : self.__dict__["SLHC"] = True
-
-
-    def dump(self):
-
-        Logging.log.info("Geometry tag InDetGMFlags : %s", self.__dict__["geomTag"]+" ------------------------------------")
-        Logging.log.info("VersionName = %s", self.__dict__["VersionName"])
-        Logging.log.info("Layout      = %s", self.__dict__["Layout"])
-        Logging.log.info("DBM         = %s", self.__dict__["DBM"])
-
-        Logging.log.info("SLHC flag : %s", self.__dict__["SLHC"])
-        Logging.log.info("IBL flag   : %s", self.__dict__["IBL"])
-        Logging.log.info("IBL layout : %s", self.__dict__["IBLlayout"])
-
 
 # -------------------------------------------------------------------------------------
 #  Geometry jobproperties defined for the InDet geometry
@@ -144,16 +67,18 @@ class InDetGeometryFlags_JobProperties(JobPropertyContainer):
         JobPropertyContainer.__init__(self,context)
         return
 
-    def setupValuesFromDB(self,geoTagName="none"):
-        
-        InDetGeoFlags = InDetGMFlags(geoTagName)
-
-        self.isSLHC.set_Value_and_Lock( InDetGeoFlags.getValue("SLHC") )
-        self.isIBL.set_Value_and_Lock(InDetGeoFlags.getValue("IBL"))
-        self.isDBM.set_Value_and_Lock(InDetGeoFlags.getValue("DBM"))
-        self.IBLLayout.set_Value_and_Lock(InDetGeoFlags.getValue("IBLlayout"))
-        self.GeoVersionName.set_Value_and_Lock(InDetGeoFlags.getValue("VersionName"))
-        self.GeoLayout.set_Value_and_Lock(InDetGeoFlags.getValue("Layout"))
+    def setupValuesFromDB(self,geoTagName=None):
+
+        dbGeomCursor = AtlasGeoDBInterface(geoTagName or globalflags.DetDescrVersion())
+        dbGeomCursor.ConnectAndBrowseGeoDB()
+        params = PixelGeoDB.InitializeGeometryParameters(dbGeomCursor)
+
+        self.isSLHC.set_Value_and_Lock(params["SLHC"] )
+        self.isIBL.set_Value_and_Lock(params["IBL"] )
+        self.isDBM.set_Value_and_Lock(params["DBM"])
+        self.IBLLayout.set_Value_and_Lock(params["IBLlayout"])
+        self.GeoVersionName.set_Value_and_Lock(params["VersionName"])
+        self.GeoLayout.set_Value_and_Lock(params["Layout"])
 
     def reset(self,geoTagName="none"):
         
diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/LArGMJobProperties.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/LArGMJobProperties.py
index b7ec52a70b2d0d586ea3765ee5d92e79e4a3cd0d..5d62b732834e6c99c88c7180ff87c5dcc8852c50 100755
--- a/DetectorDescription/GeoModel/AtlasGeoModel/python/LArGMJobProperties.py
+++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/LArGMJobProperties.py
@@ -1,63 +1,13 @@
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 # LAr GeoModel initialization
 #
+from AthenaCommon.GlobalFlags import globalflags
 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobproperties
-from AtlasGeoModel.CommonGMJobProperties import CommonGMFlags
 from AthenaCommon import Logging
-
-# -------------------------------------------------------------------------------------
-#  LAr geometry flags initialization
-# -------------------------------------------------------------------------------------
-
-class LArGMFlags(CommonGMFlags, object):
-
-    def __init__(self, geoTag="none"):
-
-        super(LArGMFlags, self).__init__()
-
-    def InitializeGeometryParameters(self):
-
-        # ----------------------------------------------------------------------------    
-        # Read versionname, layout and dbm from PixelSwicthes table
-
-        dbId,dbSwitches,dbParam = self.dbGeomCursor.GetCurrentLeafContent("LArSwitches")
-        _sagging = None
-        _barrelOn = None
-        _endcapOn = None
-        _FCalFlag="UNDEFINED"
-        _detAbsorber = None
-        _detAbsorber_EC = None
-
-        if len(dbId)>0:
-            key=dbId[0] 
-            if "SAGGING" in dbParam: _sagging = dbSwitches[key][dbParam.index("SAGGING")]
-            if "BARREL_ON" in dbParam: _barrelOn = dbSwitches[key][dbParam.index("BARREL_ON")]
-            if "ENDCAP_ON" in dbParam : _endcapOn = dbSwitches[key][dbParam.index("ENDCAP_ON")]
-            if "DETAILED_ABSORBER" in dbParam : _detAbsorber = dbSwitches[key][dbParam.index("DETAILED_ABSORBER")]
-            if "DETAILED_ABSORBER_EC" in dbParam :_detAbsorber_EC = dbSwitches[key][dbParam.index("DETAILED_ABSORBER_EC")]
-            if "FCAL_GEOTYPE" in dbParam : _FCalFlag = dbSwitches[key][dbParam.index("FCAL_GEOTYPE")]
-
-
-        self.__dict__["Sagging"] = _sagging
-        self.__dict__["BarrelOn"] = _barrelOn
-        self.__dict__["EndcapOn"] = _endcapOn
-        self.__dict__["FCal_GeoType"] = _FCalFlag
-        self.__dict__["DetAbs"] = _detAbsorber
-        self.__dict__["DetAbs_EC"] = _detAbsorber_EC
-
-    def dump(self):
-
-        Logging.log.info("Geometry tag LArGMFlags : "+self.__dict__["geomTag"]+" ------------------------------------")
-        Logging.log.info("Sagging              = "+self.__dict__["Sagging"])
-        Logging.log.info("BarrelOn             = "+self.__dict__["BarrelOn"])
-        Logging.log.info("EndcapON             = "+self.__dict__["EndcapOn"])
-        Logging.log.info("Detailed Absorber    = "+self.__dict__["DetAbs"])
-        Logging.log.info("Detailed Absorber EC = "+self.__dict__["DetAbs_EC"])
-        Logging.log.info("FCal geotype         = "+self.__dict__["FCal_GeoType"])
-
-
+from AtlasGeoModel.AtlasGeoDBInterface import AtlasGeoDBInterface
+from LArGeoAlgsNV import LArGeoDB
 
 # -------------------------------------------------------------------------------------
 #  Geometry jobproperties defined for the InDet geometry
@@ -108,19 +58,21 @@ class LArGeometryFlags_JobProperties(JobPropertyContainer):
         JobPropertyContainer.__init__(self,context)
         return
 
-    def setupValuesFromDB(self,geoTagName="none"):
-        
-        LArGeoFlags = LArGMFlags(geoTagName)
+    def setupValuesFromDB(self,geoTagName=None):
+
+        dbGeomCursor = AtlasGeoDBInterface(geoTagName or globalflags.DetDescrVersion())
+        dbGeomCursor.ConnectAndBrowseGeoDB()
+        params = LArGeoDB.InitializeGeometryParameters(dbGeomCursor)
 
-        self.Sagging.set_Value_and_Lock( LArGeoFlags.getValue("Sagging"))
-        self.BarrelOn.set_Value_and_Lock( LArGeoFlags.getValue("BarrelOn"))
-        self.EndcapOn.set_Value_and_Lock(LArGeoFlags.getValue("EndcapOn"))
-        self.DetailedAbsorber.set_Value_and_Lock(LArGeoFlags.getValue("DetAbs"))
-        self.DetailedAbsorber_EC.set_Value_and_Lock(LArGeoFlags.getValue("DetAbs_EC"))
-        self.FCalGeoType.set_Value_and_Lock(LArGeoFlags.getValue("FCal_GeoType"))
+        self.Sagging.set_Value_and_Lock(params["Sagging"])
+        self.BarrelOn.set_Value_and_Lock(params["BarrelOn"])
+        self.EndcapOn.set_Value_and_Lock(params["EndcapOn"])
+        self.DetailedAbsorber.set_Value_and_Lock(params["DetAbs"])
+        self.DetailedAbsorber_EC.set_Value_and_Lock(params["DetAbs_EC"])
+        self.FCalGeoType.set_Value_and_Lock(params["FCal_GeoType"])
 
 
-    def reset(self,geoTagName="none"):
+    def reset(self):
 
         self.Sagging.unlock()
         self.BarrelOn.unlock()
@@ -131,13 +83,13 @@ class LArGeometryFlags_JobProperties(JobPropertyContainer):
 
     def dump(self):
 
-        Logging.log.info("Sagging              = "+self.Sagging())
-        Logging.log.info("Barrel_On            = "+self.BarrelOn())
-        Logging.log.info("Endcap_On            = "+self.EndcapOn())
-        Logging.log.info("Detailed absorber    = "+self.DetailedAbsorber())
-        Logging.log.info("Detailed absorber EC = "+self.DetailedAbsorber_EC())
+        Logging.log.info("Sagging              = %s", self.Sagging())
+        Logging.log.info("Barrel_On            = %s", self.BarrelOn())
+        Logging.log.info("Endcap_On            = %s", self.EndcapOn())
+        Logging.log.info("Detailed absorber    = %s", self.DetailedAbsorber())
+        Logging.log.info("Detailed absorber EC = %s", self.DetailedAbsorber_EC())
 
-        Logging.log.info("FCal GeoType         = "+self.FCalGeoType())
+        Logging.log.info("FCal GeoType         = %s", self.FCalGeoType())
 
 
 jobproperties.add_Container(LArGeometryFlags_JobProperties)
diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/MuonGMJobProperties.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/MuonGMJobProperties.py
index 9e73288340537a78dda7d00775eec80072b4e7aa..c30e056e9d8efb927c6e9f22aead9b4af195ec41 100755
--- a/DetectorDescription/GeoModel/AtlasGeoModel/python/MuonGMJobProperties.py
+++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/MuonGMJobProperties.py
@@ -1,44 +1,13 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
+from AthenaCommon.GlobalFlags import globalflags
 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobproperties
-from AtlasGeoModel.CommonGMJobProperties import CommonGMFlags
+from AtlasGeoModel.AtlasGeoDBInterface import AtlasGeoDBInterface
+from MuonGeoModel import MuonGeoDB
 
 # -------------------------------------------------------------------------------------
-#  Muon geometry flags initialization
+#  Muon geometry flags
 # -------------------------------------------------------------------------------------
-class MuonGMFlags(CommonGMFlags, object):
-
-    def __init__(self, geoTag="none"):
-        super(MuonGMFlags, self).__init__()
-
-    def InitializeGeometryParameters(self):
-        dbId,dbSwitches,dbParam = self.dbGeomCursor.GetCurrentLeafContent("MuonSwitches")
-        _layoutName=None
-        _hasCsc=True
-        _hasStgc=True
-        _hasMM=True
-        if len(dbId)>0:
-            key=dbId[0] 
-            if "LAYOUTNAME" in dbParam: _layoutName = dbSwitches[key][dbParam.index("LAYOUTNAME")]
-            if "HASCSC" in dbParam: _hasCsc = dbSwitches[key][dbParam.index("HASCSC")]
-            if "HASSTGC" in dbParam: _hasStgc = dbSwitches[key][dbParam.index("HASSTGC")]
-            if "HASMM" in dbParam: _hasMM = dbSwitches[key][dbParam.index("HASMM")]
-            
-        self.__dict__["Layout"] = (_layoutName if _layoutName else "UNDEFINED")
-        if _hasCsc == 0: self.__dict__["HasCSC"] = False
-        else: self.__dict__["HasCSC"] = True
-        if _hasStgc == 0: self.__dict__["HasSTGC"] = False
-        else: self.__dict__["HasSTGC"] = True
-        if _hasMM == 0: self.__dict__["HasMM"] = False
-        else: self.__dict__["HasMM"] = True
-
-    def dump(self):
-        print ("MuonGMFlags:")
-        print ("Layout      = ",self.__dict__["Layout"])
-        print ("HasCSC      = ",self.__dict__["HasCSC"])
-        print ("HasSTGC     = ",self.__dict__["HasSTGC"])
-        print ("HasMM       = ",self.__dict__["HasMM"])
-
 
 class GeoLayout(JobProperty):
      """ geometry layout """
@@ -70,14 +39,18 @@ class MuonGeometryFlags_JobProperties(JobPropertyContainer):
     def __init__(self, context=""):
         JobPropertyContainer.__init__(self,context)
         return
-    def setupValuesFromDB(self,geoTagName="none"):
-        MuonGeoFlags = MuonGMFlags(geoTagName)
-        self.GeoLayout.set_Value_and_Lock(MuonGeoFlags.getValue("Layout"))
-        self.hasCSC.set_Value_and_Lock(MuonGeoFlags.getValue("HasCSC"))
-        self.hasSTGC.set_Value_and_Lock(MuonGeoFlags.getValue("HasSTGC"))
-        self.hasMM.set_Value_and_Lock(MuonGeoFlags.getValue("HasMM"))
-
-    def reset(self,geoTagName="none"):
+    def setupValuesFromDB(self,geoTagName=None):
+
+        dbGeomCursor = AtlasGeoDBInterface(geoTagName or globalflags.DetDescrVersion())
+        dbGeomCursor.ConnectAndBrowseGeoDB()
+        params = MuonGeoDB.InitializeGeometryParameters(dbGeomCursor)
+
+        self.GeoLayout.set_Value_and_Lock(params["Layout"])
+        self.hasCSC.set_Value_and_Lock(params["HasCSC"])
+        self.hasSTGC.set_Value_and_Lock(params["HasSTGC"])
+        self.hasMM.set_Value_and_Lock(params["HasMM"])
+
+    def reset(self):
         self.GeoLayout.unlock()
         self.hasCSC.unlock()
         self.hasSTGC.unlock()
diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/python/PixelGeoDB.py b/InnerDetector/InDetDetDescr/PixelGeoModel/python/PixelGeoDB.py
new file mode 100644
index 0000000000000000000000000000000000000000..56e73c5b99b182aad569dede3049d42ecdb59648
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/PixelGeoModel/python/PixelGeoDB.py
@@ -0,0 +1,63 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags
+
+def InitializeGeometryParameters(dbGeomCursor):
+    """Read geometry parameters for Pixel
+
+    dbGeomCursor: AtlasGeoDBInterface instance
+    """
+
+    # ----------------------------------------------------------------------------
+    # Read versionname, layout and dbm from PixelSwitches table
+
+    dbId,dbSwitches,dbParam = dbGeomCursor.GetCurrentLeafContent("PixelSwitches")
+
+    params = {"VersionName" : "UNDEFINED",
+              "Layout" : "UNDEFINED",
+              "DBM" : False }
+
+    if len(dbId)>0:
+        key=dbId[0]
+        if "VERSIONNAME" in dbParam:
+            params["VersionName"] = dbSwitches[key][dbParam.index("VERSIONNAME")]
+        if "LAYOUT" in dbParam :
+            params["Layout"] = dbSwitches[key][dbParam.index("LAYOUT")]
+        if "BUILDDBM" in dbParam :
+            params["DBM"] = (dbSwitches[key][dbParam.index("BUILDDBM")] != 0)
+
+
+    # ----------------------------------------------------------------------------
+    # IBL layout
+
+    dbId,dbLayers,dbParam = dbGeomCursor.GetCurrentLeafContent("PixelLayer")
+    IBLStaveIndex = -1
+    IBLgeoLayout = -1
+    params["IBLlayout"] = "noIBL"
+    if len(dbId)>0:
+        key=dbId[0]
+        if "STAVEINDEX" in dbParam and dbLayers[key][dbParam.index("STAVEINDEX")] not in ["NULL",None]:
+            IBLStaveIndex = int(dbLayers[key][dbParam.index("STAVEINDEX")])
+
+        if IBLStaveIndex>-1:
+            dbId,dbStaves,dbParam = dbGeomCursor.GetCurrentLeafContent("PixelStave")
+
+            if len(dbId)>0 and IBLStaveIndex<=len(dbStaves.keys()):
+                key=dbId[IBLStaveIndex]
+                if "LAYOUT" in dbParam and dbStaves[key][dbParam.index("LAYOUT")] not in ["NULL",None]:
+                    IBLgeoLayout = int(dbStaves[key][dbParam.index("LAYOUT")])
+                    if IBLgeoLayout in [3,4] : params["IBLlayout"] = "planar"
+                    elif IBLgeoLayout in [5] : params["IBLlayout"] = "3D"
+
+    # ----------------------------------------------------------------------------
+    # IBL and SLHC parameters
+
+    params["IBL"] = (params["Layout"] == 'IBL')
+    params["SLHC"] = (params["Layout"] == 'SLHC')
+
+    if params["IBL"] is False:
+       params["IBLlayout"] = "noIBL"
+    if params["Layout"]!='SLHC' and ( CommonGeometryFlags.Run() in ["RUN2", "RUN3"] ) :
+       params["IBL"] = True
+
+    return params
diff --git a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/python/LArGeoDB.py b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/python/LArGeoDB.py
new file mode 100644
index 0000000000000000000000000000000000000000..c4c73a58fc7641dd34bea85fe37c7ab0248efc1d
--- /dev/null
+++ b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/python/LArGeoDB.py
@@ -0,0 +1,32 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+def InitializeGeometryParameters(dbGeomCursor):
+    """Read versionname, layout and dbm from LArSwitches table
+
+    dbGeomCursor: AtlasGeoDBInterface instance
+    """
+
+    dbId, dbSwitches, dbParam = dbGeomCursor.GetCurrentLeafContent("LArSwitches")
+    params = {"Sagging" : None,
+              "BarrelOn" : None,
+              "EndcapOn" : None,
+              "FCal_GeoType" : "UNDEFINED",
+              "DetAbs" : None,
+              "DetAbs_EC" : None}
+
+    if len(dbId)>0:
+        key=dbId[0]
+        if "SAGGING" in dbParam:
+            params["Sagging"] = dbSwitches[key][dbParam.index("SAGGING")]
+        if "BARREL_ON" in dbParam:
+            params["BarrelOn"] = dbSwitches[key][dbParam.index("BARREL_ON")]
+        if "ENDCAP_ON" in dbParam :
+            params["EndcapOn"] = dbSwitches[key][dbParam.index("ENDCAP_ON")]
+        if "DETAILED_ABSORBER" in dbParam :
+            params["DetAbs"] = dbSwitches[key][dbParam.index("DETAILED_ABSORBER")]
+        if "DETAILED_ABSORBER_EC" in dbParam :
+            params["DetAbs_EC"] = dbSwitches[key][dbParam.index("DETAILED_ABSORBER_EC")]
+        if "FCAL_GEOTYPE" in dbParam :
+            params["FCal_GeoType"] = dbSwitches[key][dbParam.index("FCAL_GEOTYPE")]
+
+    return params
diff --git a/MuonSpectrometer/MuonGeoModel/CMakeLists.txt b/MuonSpectrometer/MuonGeoModel/CMakeLists.txt
index 60291bf4cd65a74ce7edb8fe0514955a8176cdc3..8969a97dd2aa252730405aaac0a3a3fb9c2f9748 100644
--- a/MuonSpectrometer/MuonGeoModel/CMakeLists.txt
+++ b/MuonSpectrometer/MuonGeoModel/CMakeLists.txt
@@ -21,5 +21,5 @@ atlas_add_component( MuonGeoModel
                      LINK_LIBRARIES ${GEOMODELCORE_LIBRARIES} AthenaKernel StoreGateLib SGtests GeoModelUtilities GaudiKernel MuonCondInterface MuonReadoutGeometry MuonGMdbObjects AthenaPoolUtilities AGDDKernel IdDictDetDescr MuonAGDDDescription MuonDetDescrUtils MuonIdHelpersLib MuonGeoModelLib AmdcDbLib )
 
 # Install files from the package:
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/*.py )
-
diff --git a/MuonSpectrometer/MuonGeoModel/python/MuonGeoDB.py b/MuonSpectrometer/MuonGeoModel/python/MuonGeoDB.py
new file mode 100644
index 0000000000000000000000000000000000000000..dbf9dc3b1d95d1f1f4c66a6fd055718b6e222ee7
--- /dev/null
+++ b/MuonSpectrometer/MuonGeoModel/python/MuonGeoDB.py
@@ -0,0 +1,25 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+def InitializeGeometryParameters(dbGeomCursor):
+    """Read muon geometry parameters
+
+    dbGeomCursor: AtlasGeoDBInterface instance
+    """
+    dbId, dbSwitches, dbParam = dbGeomCursor.GetCurrentLeafContent("MuonSwitches")
+    params = {"Layout" : "UNDEFINED",
+              "HasCSC" : True,
+              "HasSTGC" : True,
+              "HasMM" : True}
+
+    if len(dbId)>0:
+        key=dbId[0]
+        if "LAYOUTNAME" in dbParam:
+            params["Layout"] = dbSwitches[key][dbParam.index("LAYOUTNAME")]
+        if "HASCSC" in dbParam:
+            params["HasCSC"] = (dbSwitches[key][dbParam.index("HASCSC")] != 0)
+        if "HASSTGC" in dbParam:
+            params["HasSTGC"] = (dbSwitches[key][dbParam.index("HASSTGC")] !=0)
+        if "HASMM" in dbParam:
+            params["HasMM"] = (dbSwitches[key][dbParam.index("HASMM")] != 0)
+
+    return params