Skip to content
Snippets Groups Projects
Commit ae6684cc authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

CaloRec: enable flake8 and fix code

parent c2c02599
No related branches found
No related tags found
No related merge requests found
...@@ -55,7 +55,7 @@ atlas_add_test( CaloBCIDLumiCondAlg_test ...@@ -55,7 +55,7 @@ atlas_add_test( CaloBCIDLumiCondAlg_test
LINK_LIBRARIES CaloRecLib CaloLumiConditions LArRawConditions IdDictParser TestTools ) LINK_LIBRARIES CaloRecLib CaloLumiConditions LArRawConditions IdDictParser TestTools )
# Install files from the package: # Install files from the package:
atlas_install_python_modules( python/*.py ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
atlas_install_joboptions( share/*.py share/*.txt ) atlas_install_joboptions( share/*.py share/*.txt )
......
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
def CaloBCIDAvgAlgDefault(): def CaloBCIDAvgAlgDefault():
from CaloRec.CaloRecConf import CaloBCIDAvgAlg from CaloRec.CaloRecConf import CaloBCIDAvgAlg
from AthenaCommon.AlgSequence import AlgSequence from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence() topSequence = AlgSequence()
if not hasattr(topSequence,"CaloBCIDAvgAlg"): if not hasattr(topSequence,"CaloBCIDAvgAlg"):
from IOVDbSvc.CondDB import conddb from IOVDbSvc.CondDB import conddb # noqa: F401
from LArRecUtils.LArMCSymCondAlg import LArMCSymCondAlgDefault from LArRecUtils.LArMCSymCondAlg import LArMCSymCondAlgDefault
LArMCSymCondAlgDefault() LArMCSymCondAlgDefault()
from CaloRec.CaloBCIDLumiCondAlgDefault import CaloBCIDLumiCondAlgDefault from CaloRec.CaloBCIDLumiCondAlgDefault import CaloBCIDLumiCondAlgDefault
......
...@@ -11,9 +11,6 @@ ...@@ -11,9 +11,6 @@
# addClusterToCaloCellAOD("MuonClusterCollection") # addClusterToCaloCellAOD("MuonClusterCollection")
def addClusterToCaloCellAOD(clustersInputName): def addClusterToCaloCellAOD(clustersInputName):
from AthenaCommon.Logging import logging
mlog = logging.getLogger( 'addClusterToCaloCellAOD' )
from AthenaCommon.AlgSequence import AlgSequence from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence() topSequence = AlgSequence()
...@@ -29,9 +26,9 @@ def addClusterToCaloCellAOD(clustersInputName): ...@@ -29,9 +26,9 @@ def addClusterToCaloCellAOD(clustersInputName):
# Include all TileGap3 cells. # Include all TileGap3 cells.
from CaloRec.CaloRecConf import CaloThinCellsBySamplingAlg from CaloRec.CaloRecConf import CaloThinCellsBySamplingAlg
salg = CaloThinCellsBySamplingAlg ('CaloThinCellsBySamplingAlg_TileGap3', salg = CaloThinCellsBySamplingAlg ('CaloThinCellsBySamplingAlg_TileGap3',
StreamName = 'StreamAOD', StreamName = 'StreamAOD',
SamplingCellsName = ['TileGap3'], SamplingCellsName = ['TileGap3'],
Cells = 'AllCalo') Cells = 'AllCalo')
if salg not in topSequence: if salg not in topSequence:
topSequence += salg topSequence += salg
......
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# specifies Tower/TopoCluster -> TopoTower # specifies Tower/TopoCluster -> TopoTower
from AthenaCommon.JobProperties import jobproperties as jp from AthenaCommon.JobProperties import jobproperties as jp
...@@ -19,7 +19,7 @@ class CaloTopoTowerGetter ( Configured ) : ...@@ -19,7 +19,7 @@ class CaloTopoTowerGetter ( Configured ) :
# get handle to upstream CaloCells # get handle to upstream CaloCells
theCaloCellGetter = self.getInputGetter\ theCaloCellGetter = self.getInputGetter\
(jp.CaloRecFlags.clusterCellGetterName()) (jp.CaloRecFlags.clusterCellGetterName())
# ----- get handle to upstream tower objects # ----- get handle to upstream tower objects
try: try:
from CaloRec.CaloTowerCmbGetter import CaloTowerCmbGetter from CaloRec.CaloTowerCmbGetter import CaloTowerCmbGetter
...@@ -28,15 +28,15 @@ class CaloTopoTowerGetter ( Configured ) : ...@@ -28,15 +28,15 @@ class CaloTopoTowerGetter ( Configured ) :
mlog.error("could not get handle to CaloTowerCmbGetter Quit") mlog.error("could not get handle to CaloTowerCmbGetter Quit")
print(traceback.format_exc()) print(traceback.format_exc())
return False return False
if not theCaloTowerCmbGetter.usable(): if not theCaloTowerCmbGetter.usable():
if not self.ignoreConfigError(): if not self.ignoreConfigError():
mlog.error("CaloTowerCmbGetter unusable. Quit.") mlog.error("CaloTowerCmbGetter unusable. Quit.")
return False return False
else: else:
mlog.error("CaloTowerCmbGetter unusable. Continue nevertheless") mlog.error("CaloTowerCmbGetter unusable. Continue nevertheless")
# ------ get handle to upstream topo cluster object # ------ get handle to upstream topo cluster object
try: try:
from CaloRec.CaloClusterTopoGetter import CaloClusterTopoGetter from CaloRec.CaloClusterTopoGetter import CaloClusterTopoGetter
...@@ -52,7 +52,7 @@ class CaloTopoTowerGetter ( Configured ) : ...@@ -52,7 +52,7 @@ class CaloTopoTowerGetter ( Configured ) :
return False return False
else: else:
mlog.error("theCaloClusterTopoGetter unusable. Continue nevertheless") mlog.error("theCaloClusterTopoGetter unusable. Continue nevertheless")
# ------ get handle to upstream topo cluster object # ------ get handle to upstream topo cluster object
try: try:
from CaloRec.CaloClusterTopoGetter import CaloClusterTopoGetter from CaloRec.CaloClusterTopoGetter import CaloClusterTopoGetter
...@@ -63,14 +63,14 @@ class CaloTopoTowerGetter ( Configured ) : ...@@ -63,14 +63,14 @@ class CaloTopoTowerGetter ( Configured ) :
mlog.error("could not get handle to CaloCell2TopoClusterMapperGetter Quit") mlog.error("could not get handle to CaloCell2TopoClusterMapperGetter Quit")
print(traceback.format_exc()) print(traceback.format_exc())
return False return False
if not theCaloCell2TopoClusterMapperGetter.usable(): if not theCaloCell2TopoClusterMapperGetter.usable():
if not self.ignoreConfigError(): if not self.ignoreConfigError():
mlog.error("theCaloCell2TopoClusterMapperGetter unusable. Quit.") mlog.error("theCaloCell2TopoClusterMapperGetter unusable. Quit.")
return False return False
else: else:
mlog.error("theCaloCell2TopoClusterMapperGetter unusable. Continue nevertheless") mlog.error("theCaloCell2TopoClusterMapperGetter unusable. Continue nevertheless")
# now configure the algorithm, part of this could be done in a separate class # now configure the algorithm, part of this could be done in a separate class
# cannot have same name # cannot have same name
try: try:
...@@ -94,7 +94,7 @@ class CaloTopoTowerGetter ( Configured ) : ...@@ -94,7 +94,7 @@ class CaloTopoTowerGetter ( Configured ) :
return False return False
theCaloTopoTowerAlgorithm.TowerBuilderTools+= [ theCaloTopoTowerBuilderTool.getFullName() ] theCaloTopoTowerAlgorithm.TowerBuilderTools+= [ theCaloTopoTowerBuilderTool.getFullName() ]
######################## ########################
# extra cuts which can be applied at the topo tower level # extra cuts which can be applied at the topo tower level
...@@ -103,7 +103,7 @@ class CaloTopoTowerGetter ( Configured ) : ...@@ -103,7 +103,7 @@ class CaloTopoTowerGetter ( Configured ) :
theCaloTopoTowerAlgorithm.ClusterContainerName = theCaloClusterTopoGetter.outputKey() theCaloTopoTowerAlgorithm.ClusterContainerName = theCaloClusterTopoGetter.outputKey()
theCaloTopoTowerAlgorithm.CellContainerName = theCaloCellGetter.outputKey() theCaloTopoTowerAlgorithm.CellContainerName = theCaloCellGetter.outputKey()
theCaloTopoTowerAlgorithm.Cell2ClusterMapName = theCaloCell2TopoClusterMapperGetter.outputKey() theCaloTopoTowerAlgorithm.Cell2ClusterMapName = theCaloCell2TopoClusterMapperGetter.outputKey()
# sets output key # sets output key
theCaloTopoTowerAlgorithm.OutputTowerContainerName =self.outputKey() theCaloTopoTowerAlgorithm.OutputTowerContainerName =self.outputKey()
...@@ -136,12 +136,12 @@ class CaloTopoTowerGetter ( Configured ) : ...@@ -136,12 +136,12 @@ class CaloTopoTowerGetter ( Configured ) :
topSequence += theCaloTopoTowerAlgorithm topSequence += theCaloTopoTowerAlgorithm
return True return True
def caloTowerAlgorithmHandle(self): def caloTowerAlgorithmHandle(self):
return self._CaloTopoTowerAlgorithmHandle return self._CaloTopoTowerAlgorithmHandle
# would work only if one output object type # would work only if one output object type
def outputKey(self): def outputKey(self):
return self._output[self._outputType] return self._output[self._outputType]
......
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