Commit 83773702 authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'py3.LArG4H6SD-20200224' into 'master'

LArG4H6SD: Python 3 and flake8 fixes

See merge request atlas/athena!30567
parents 03196d9f 9f95bbb5
...@@ -51,3 +51,6 @@ atlas_add_component( LArG4H6SD ...@@ -51,3 +51,6 @@ atlas_add_component( LArG4H6SD
# Install files from the package: # Install files from the package:
atlas_install_python_modules( python/*.py ) atlas_install_python_modules( python/*.py )
atlas_add_test( flake8
SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
POST_EXEC_SCRIPT nopost.sh )
# 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 import CfgMgr from AthenaCommon import CfgMgr
from AthenaCommon.SystemOfUnits import mm, deg,ns from AthenaCommon.SystemOfUnits import mm, deg,ns
...@@ -77,6 +77,7 @@ def getLArG4H62004ActiveSDTool(name="LArG4H62004ActiveSDTool", **kwargs): ...@@ -77,6 +77,7 @@ def getLArG4H62004ActiveSDTool(name="LArG4H62004ActiveSDTool", **kwargs):
return CfgMgr.LArG4__H62004ActiveSDTool(name,**kwargs) return CfgMgr.LArG4__H62004ActiveSDTool(name,**kwargs)
def getLArG4H62004DeadSDTool(name="LArG4H62004DeadSDTool", **kwargs): def getLArG4H62004DeadSDTool(name="LArG4H62004DeadSDTool", **kwargs):
from G4AtlasApps.SimFlags import simFlags
theVolumes = [] theVolumes = []
if simFlags.LArTB_H6Hec.get_Value(): if simFlags.LArTB_H6Hec.get_Value():
theVolumes += [ "LArMgr::LAr::HEC::Module", theVolumes += [ "LArMgr::LAr::HEC::Module",
...@@ -157,6 +158,7 @@ def getLArG4H62004DeadSDTool(name="LArG4H62004DeadSDTool", **kwargs): ...@@ -157,6 +158,7 @@ def getLArG4H62004DeadSDTool(name="LArG4H62004DeadSDTool", **kwargs):
return CfgMgr.LArG4__H62004DeadSDTool(name,**kwargs) return CfgMgr.LArG4__H62004DeadSDTool(name,**kwargs)
def getLArG4H62004InactiveSDTool(name="LArG4H62004InactiveSDTool", **kwargs): def getLArG4H62004InactiveSDTool(name="LArG4H62004InactiveSDTool", **kwargs):
from G4AtlasApps.SimFlags import simFlags
if simFlags.LArTB_H6Hec.get_Value(): if simFlags.LArTB_H6Hec.get_Value():
kwargs.setdefault("HECVolumes", [ kwargs.setdefault("HECVolumes", [
"LArMgr::LAr::HEC::Module::Depth::Absorber", "LArMgr::LAr::HEC::Module::Depth::Absorber",
...@@ -216,7 +218,7 @@ def getLArG4H62004DeadCalibrationCalculator(name="LArG4H62004DeadCalibrationCalc ...@@ -216,7 +218,7 @@ def getLArG4H62004DeadCalibrationCalculator(name="LArG4H62004DeadCalibrationCalc
#---------- #----------
def getLArFCALH62004CalibCalculatorBase(name="LArFCALH62004CalibCalculatorBase", **kwargs): def getLArFCALH62004CalibCalculatorBase(name="LArFCALH62004CalibCalculatorBase", **kwargs):
return CfgGetter.LArFCALH62004CalibCalculatorBase(name, **kwargs) return CfgMgr.LArFCALH62004CalibCalculatorBase(name, **kwargs)
def getLArFCAL1H62004CalibCalculator(name="LArFCAL1H62004CalibCalculator", **kwargs): def getLArFCAL1H62004CalibCalculator(name="LArFCAL1H62004CalibCalculator", **kwargs):
kwargs.setdefault("deltaX", 7.5*mm) kwargs.setdefault("deltaX", 7.5*mm)
......
# 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.Logging import logging from AthenaCommon.Logging import logging
from RecExConfig.Configured import Configured from RecExConfig.Configured import Configured
from RecExConfig.ObjKeyStore import objKeyStore
from AthenaCommon.OldStyleConfig import Algorithm
import traceback import traceback
import sys
# #
# These should probably be in a common library. # These should probably be in a common library.
# #
def _makeconf (cls, name = None, **kwargs): def _makeconf (cls, name = None, **kwargs):
if name != None: if name is not None:
x = cls(name) x = cls(name)
else: else:
x = cls() x = cls()
...@@ -30,25 +27,23 @@ class LArTBH6BeamInfoGetter (Configured): ...@@ -30,25 +27,23 @@ class LArTBH6BeamInfoGetter (Configured):
clsname = self.__class__.__name__ clsname = self.__class__.__name__
mlog = logging.getLogger ('%s:configure : ' % clsname) mlog = logging.getLogger ('%s:configure : ' % clsname)
maindict = sys.modules['__main__'].__dict__
# Create the configurable. # Create the configurable.
try: try:
from LArG4H6SD.LArG4H6SDConf import LArTBH6BeamInfo from LArG4H6SD.LArG4H6SDConf import LArTBH6BeamInfo
theLArTBH6BeamInfo = LArTBH6BeamInfo() theLArTBH6BeamInfo = LArTBH6BeamInfo()
except: except Exception:
mlog.error("could not import LArG4H6SD.LArTBH6BeamInfo") mlog.error("could not import LArG4H6SD.LArTBH6BeamInfo")
print traceback.format_exc() mlog.error (traceback.format_exc())
return False return False
self._LArTBH6BeamInfoHandle = theLArTBH6BeamInfo ; self._LArTBH6BeamInfoHandle = theLArTBH6BeamInfo
theLArTBH6BeamInfo.HitsContainer = ["LArTBFrontHitCollection"] theLArTBH6BeamInfo.HitsContainer = ["LArTBFrontHitCollection"]
theLArTBH6BeamInfo.PrimaryTrackOnly = TRUE theLArTBH6BeamInfo.PrimaryTrackOnly = True
theLArTBH6BeamInfo.PrimaryParticle = 999 theLArTBH6BeamInfo.PrimaryParticle = 999
# now add algorithm to topSequence # now add algorithm to topSequence
from __main__ import topSequence from __main__ import topSequence
topSequence += theLArTBH6BeamInfo; topSequence += theLArTBH6BeamInfo
return True return True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment