Skip to content
Snippets Groups Projects
Commit bfd1ede8 authored by Edward Moyse's avatar Edward Moyse
Browse files

Merge branch 'flake8_geomodel' into 'master'

AtlasGeoModel: enable flake8 and fix/remove code

See merge request atlas/athena!37821
parents 786b5be8 3a1c70bd
No related branches found
No related tags found
No related merge requests found
Showing
with 65 additions and 108 deletions
################################################################################
# Package: AtlasGeoModel
################################################################################
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Declare the package name:
atlas_subdir( AtlasGeoModel )
# Install files from the package:
atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/*.py )
atlas_install_scripts( test/*.py )
atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
atlas_install_scripts( test/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
if( NOT GENERATIONBASE )
atlas_add_test( EVNT_InputGeo_test
......
# 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 AthenaCommon.DetFlags import DetFlags
from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags
if ( DetFlags.detdescr.Muon_on() ):
from AthenaCommon import CfgGetter
from AthenaCommon.AppMgr import ToolSvc,ServiceMgr,theApp
from AthenaCommon.AppMgr import ServiceMgr,theApp
from AGDD2GeoSvc.AGDD2GeoSvcConf import AGDDtoGeoSvc
AGDD2Geo = AGDDtoGeoSvc()
if not "MuonAGDDTool/MuonSpectrometer" in AGDD2Geo.Builders.__str__():
if "MuonAGDDTool/MuonSpectrometer" not in AGDD2Geo.Builders.__str__():
AGDD2Geo.Builders += [CfgGetter.getPrivateTool("MuonSpectrometer", checkType=True)]
if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()):
if not "NSWAGDDTool/NewSmallWheel" in AGDD2Geo.Builders.__str__():
if "NSWAGDDTool/NewSmallWheel" not in AGDD2Geo.Builders.__str__():
AGDD2Geo.Builders += [CfgGetter.getPrivateTool("NewSmallWheel", checkType=True)]
theApp.CreateSvc += ["AGDDtoGeoSvc"]
......
# 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 AthenaCommon import Logging
......@@ -126,10 +126,10 @@ class AtlasGeoDBInterface:
# Check if the geometry tag was found in the DB
if self.dbGeoTagId=="":
Logging.log.error("The geometry tag "+self.dbGeoTag+" could not be found in the database.")
Logging.log.error("The geometry tag %s could not be found in the database.", self.dbGeoTag)
Logging.log.error("Its name might be misspelled and/or the script might access a local DB that is not up to date.")
import sys
sys.exit();
sys.exit()
# Get node ids for the geometry tag
tagIdList=[int(self.dbGeoTagId)] # start with the geometry tag Id
......@@ -137,7 +137,7 @@ class AtlasGeoDBInterface:
# Loop while child tags are found
while not bStopLoop :
query0 = self.dbSchema.newQuery();
query0 = self.dbSchema.newQuery()
query0.addToOutputList('C.NODE_NAME',"nodename")
query0.addToOutputList('A.TAG_NAME',"tagname")
......@@ -177,7 +177,7 @@ class AtlasGeoDBInterface:
upLeafName=leafName.upper()
# check if table is defined in the current geometry
if not leafName in self.TagAndNodeVersionDict:
if leafName not in self.TagAndNodeVersionDict:
dbId=[]
dbContent={}
paramName=[]
......
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
## @file: AtlasGeoModel/python/GeoModelInit.py
## @brief: Encapsulate GeoModel configuration
......@@ -13,24 +13,24 @@ def _setupGeoModel():
import DetDescrCnvSvc.DetStoreConfig
svcMgr.DetDescrCnvSvc.IdDictFromRDB = True
except ImportError:
import DetDescrCnvSvc.DetStoreConfig
import DetDescrCnvSvc.DetStoreConfig # noqa: F401
svcMgr.DetDescrCnvSvc.IdDictFromRDB = True
# Conditions DB setup and TagInfo
from IOVDbSvc.CondDB import conddb
import EventInfoMgt.EventInfoMgtInit
from IOVDbSvc.CondDB import conddb # noqa: F401
import EventInfoMgt.EventInfoMgtInit # noqa: F401
if ( jobproperties.Global.DataSource() == "geant3" ):
from AtlasGeoModel import GeoModelInitDC1
from AtlasGeoModel import GeoModelInitDC1 # noqa: F401
elif ( jobproperties.Global.DetGeo() == "ctbh8" ):
from AtlasGeoModel import GeoModelInitCTB
from AtlasGeoModel import GeoModelInitCTB # noqa: F401
elif ( jobproperties.Global.DetGeo() == "ctbh6" ):
from AtlasGeoModel import GeoModelInitH6
from AtlasGeoModel import GeoModelInitH6 # noqa: F401
else:
from AtlasGeoModel import GeoModelInitStandard
from AtlasGeoModel import GeoModelInitStandard # noqa: F401
pass
......
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.AppMgr import ServiceMgr
from AthenaCommon.AppMgr import theApp
......@@ -7,7 +7,6 @@ from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
ServiceMgr += GeoModelSvc()
theApp.CreateSvc += [ "GeoModelSvc"]
from AtlasGeoModel import InDetGMCTB
from AtlasGeoModel import TileGMCTB
from AtlasGeoModel import LArGM
from AtlasGeoModel import InDetGMCTB # noqa: F401
from AtlasGeoModel import TileGMCTB # noqa: F401
from AtlasGeoModel import LArGM # noqa: F401
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.AppMgr import ServiceMgr
from AthenaCommon.AppMgr import theApp
......@@ -7,5 +7,5 @@ from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
ServiceMgr += GeoModelSvc()
theApp.CreateSvc += [ "GeoModelSvc"]
from AtlasGeoModel import InDetGM
from AtlasGeoModel import MuonGM
from AtlasGeoModel import InDetGM # noqa: F401
from AtlasGeoModel import MuonGM # noqa: F401
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.AppMgr import ServiceMgr
from AthenaCommon.AppMgr import theApp
......@@ -35,4 +35,4 @@ elif (SimFlags.SimLayout.get_Value()=="tb_LArH6_2004"):
# as long as not created anywhere else in GeoModel :
from CaloDetMgrDetDescrCnv import CaloDetMgrDDCnv
from CaloDetMgrDetDescrCnv import CaloDetMgrDDCnv # noqa: F401
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.AppMgr import ServiceMgr
from AthenaCommon.AppMgr import theApp
......@@ -8,10 +8,9 @@ ServiceMgr += GeoModelSvc()
theApp.CreateSvc += [ "GeoModelSvc"]
# Load the detectors. These job option fragments look at DetFlags
from AtlasGeoModel import InDetGM
from AtlasGeoModel import LArGM
from AtlasGeoModel import TileGM
from AtlasGeoModel import MuonGM
from AtlasGeoModel import ForDetGM
from AtlasGeoModel import MiscGM
from AtlasGeoModel import InDetGM # noqa: F401
from AtlasGeoModel import LArGM # noqa: F401
from AtlasGeoModel import TileGM # noqa: F401
from AtlasGeoModel import MuonGM # noqa: F401
from AtlasGeoModel import ForDetGM # noqa: F401
from AtlasGeoModel import MiscGM # noqa: F401
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# InDet GeoModel initialization
#
from AthenaCommon.GlobalFlags import globalflags
from AthenaCommon.JobProperties import jobproperties
from AthenaCommon.DetFlags import DetFlags
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags
from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags
if InDetGeometryFlags.isSLHC():
#SLHC specific code
from AthenaCommon.AppMgr import ToolSvc
# Treat CTB separately
if ( jobproperties.Global.DetGeo() == "ctbh8" or jobproperties.Global.DetGeo() == "ctbh6" ):
from AtlasGeoModel import InDetGMCTB
from AtlasGeoModel import InDetGMCTB # noqa: F401
elif ( DetFlags.detdescr.ID_on() ):
from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
......@@ -31,7 +27,6 @@ elif ( DetFlags.detdescr.ID_on() ):
GeoModelSvc.DetectorTools += [ CfgGetter.getPrivateTool("PixelDetectorTool", checkType=True) ]
if (DetFlags.detdescr.BCM_on() ) :
from AthenaCommon.AppMgr import ToolSvc
from BCM_GeoModel.BCM_GeoModelConf import InDetDD__BCM_Builder
bcmTool = InDetDD__BCM_Builder()
GeoModelSvc.DetectorTools['PixelDetectorTool'].BCM_Tool = bcmTool
......@@ -51,7 +46,6 @@ elif ( DetFlags.detdescr.ID_on() ):
else:
from SCT_SLHC_GeoModel.SCT_SLHC_GeoModelConf import SCT_SLHC_DetectorTool
sctSLHCTool = SCT_SLHC_DetectorTool()
sctSLHCTool.ServiceBuilderTool = InDetServMatBuilderToolSLHC
GeoModelSvc.DetectorTools += [ sctSLHCTool ]
else:
# Current atlas specific code
......@@ -71,10 +65,8 @@ elif ( DetFlags.detdescr.ID_on() ):
#SLHC specific code
servMatTool = InDetServMatTool()
GeoModelSvc.DetectorTools += [ servMatTool ]
servMatTool.ServiceBuilderTool = InDetServMatBuilderToolSLHC
else:
GeoModelSvc.DetectorTools += [ InDetServMatTool() ]
# Make alignable
from InDetCondFolders import InDetAlignFolders
from InDetCondFolders import InDetAlignFolders # noqa: F401
# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# InDet GeoModel initialization
......@@ -70,21 +70,21 @@ class InDetGMFlags(CommonGMFlags, object):
self.__dict__["IBL"] = False
self.__dict__["SLHC"] = False
if _layout in ['IBL'] : self.__dict__["IBL"] = True
if self.__dict__["IBL"] == False: self.__dict__["IBLlayout"]="noIBL"
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 : "+self.__dict__["geomTag"]+" ------------------------------------")
Logging.log.info("VersionName = "+self.__dict__["VersionName"])
Logging.log.info("Layout = "+self.__dict__["Layout"])
Logging.log.info("DBM = "+self.__dict__["DBM"])
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 : "+self.__dict__["SLHC"])
Logging.log.info("IBL flag : "+self.__dict__["IBL"])
Logging.log.info("IBL layout : "+ self.__dict__["IBLlayout"])
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"])
# -------------------------------------------------------------------------------------
......@@ -169,14 +169,14 @@ class InDetGeometryFlags_JobProperties(JobPropertyContainer):
def dump(self):
Logging.log.info("VersionName = "+self.GeoVersionName())
Logging.log.info("Layout = "+self.GeoLayout())
Logging.log.info("DBM = "+self.isDBM())
Logging.log.info("VersionName = %s", self.GeoVersionName())
Logging.log.info("Layout = %s", self.GeoLayout())
Logging.log.info("DBM = %s", self.isDBM())
Logging.log.info("SLHC flag : "+self.isSLHC())
Logging.log.info("IBL flag : "+self.isIBL())
Logging.log.info("IBL layout : "+self.IBLLayout())
Logging.log.info("Dynamic alignment : "+self.useDynamicAlignFolders())
Logging.log.info("SLHC flag : %s", self.isSLHC())
Logging.log.info("IBL flag : %s", self.isIBL())
Logging.log.info("IBL layout : %s", self.IBLLayout())
Logging.log.info("Dynamic alignment : %s", self.useDynamicAlignFolders())
jobproperties.add_Container(InDetGeometryFlags_JobProperties)
......
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# LAr GeoModel initialization
......@@ -13,10 +13,10 @@ if ( DetFlags.detdescr.LAr_on() ):
GeoModelSvc.DetectorTools += [ LArDetectorToolNV() ]
# as long as not created anywhere else in GeoModel :
from CaloDetMgrDetDescrCnv import CaloDetMgrDDCnv
from CaloDetMgrDetDescrCnv import CaloDetMgrDDCnv # noqa: F401
# apply possible alignments
if ( jobproperties.Global.DetGeo() == "atlas" or
jobproperties.Global.DetGeo() == "commis" ):
from LArConditionsCommon import LArAlignable
from LArConditionsCommon import LArAlignable # noqa: F401
GeoModelSvc.DetectorTools[ "LArDetectorToolNV" ].ApplyAlignments = True
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
from __future__ import print_function
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobproperties
from AtlasGeoModel.CommonGMJobProperties import CommonGMFlags, CommonGeometryFlags
from AtlasGeoModel.CommonGMJobProperties import CommonGMFlags
# -------------------------------------------------------------------------------------
# Muon geometry flags initialization
......
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.JobProperties import jobproperties
from AthenaCommon.DetFlags import DetFlags
......@@ -56,5 +56,5 @@ relversion = rel_metadata['release'].split('.')
if len(relversion) < 3:
relversion = rel_metadata['base release'].split('.')
Logging.log.info("SetGeometryVersion.py obtained major release version %s" % relversion[0])
Logging.log.info("SetGeometryVersion.py obtained major release version %s", relversion[0])
GeoModelSvc.SupportedGeometry = int(relversion[0])
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# Configure GeoModel tools to build minimal geometry fo reconstruction
......@@ -19,4 +19,4 @@ if ( DetFlags.detdescr.Tile_on() ):
# Build Muon dead materials using AGDD2Geo
#
from AtlasGeoModel import Agdd2Geo
from AtlasGeoModel import Agdd2Geo # noqa: F401
print "AtlasGeoModel/GeoModelBuildAll.py is OBSOLETE"
from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit
print "AtlasGeoModel/GeoModelCommon.py is OBSOLETE"
from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit
printfunc ("AtlasGeoModel/GeoModelInit.py is OBSOLETE")
from AtlasGeoModel import GeoModelInit
print "AtlasGeoModel/GeoModelInitCTB.py is OBSOLETE"
from AtlasGeoModel import GeoModelInitCTB
print "AtlasGeoModel/GeoModelInitDC1.py is OBSOLETE"
from AtlasGeoModel import GeoModelInitDC1
print "AtlasGeoModel/GeoModelInitH6.py is OBSOLETE"
from AtlasGeoModel import GeoModelInitH6
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment