From 0b57f5139defc79c74f575727e2d41b3a1332a97 Mon Sep 17 00:00:00 2001
From: scott snyder <sss@karma>
Date: Sun, 5 Jul 2020 20:59:12 -0400
Subject: [PATCH] CaloClusterCorrection: Cluster correction configuration
 updates.

Remove CaloRunClusterCorrection, and remove the remnants of it
from the configuration.

Allow reading configuration parameters from a pool file again.

Allow configuring using the global tag again.

Now the sequence of tools is always configured statically, though
their parameters may change during the run.

Switch cluster correction configuration to use new-style configuration,
and new (CompFactory) configurables.

Add a unit test for cluster correction configuration.

Fix flake8 warnings.
Other cleanups.
---
 .../CaloClusterCorrection/CMakeLists.txt      |    7 +-
 .../python/CaloClusterBadChannelListCorr.py   |   11 +-
 .../python/CaloClusterListBadChannel.py       |   16 +-
 .../python/CaloClusterRemoveBad.py            |   28 +-
 .../python/CaloClusterRemoveDuplicates.py     |   16 +-
 .../python/CaloComputeSWcellWeights.py        |   19 +-
 .../python/CaloSwCalibHitsCalibration.py      |   19 +-
 .../python/CaloSwCalibHitsCalibration_v1.py   |    6 +-
 .../python/CaloSwCalibHitsCalibration_v2.py   |    6 +-
 .../python/CaloSwCalibHitsCalibration_v5.py   |    6 +-
 .../python/CaloSwCalibHitsCalibration_v5_1.py |    6 +-
 .../python/CaloSwCalibHitsCalibration_v6.py   |    6 +-
 .../CaloSwCalibHitsCalibration_v6leakdata.py  |    6 +-
 .../python/CaloSwCalibHitsCalibration_v8.py   |    6 +-
 .../CaloSwCalibHitsCalibration_v8leakdata.py  |    6 +-
 .../python/CaloSwCalibHitsCalibration_v9.py   |    6 +-
 .../CaloSwCalibHitsCalibration_v9leakdata.py  |    6 +-
 .../python/CaloSwClcon.py                     |   23 +-
 .../python/CaloSwClcon_dc2.py                 |    6 +-
 .../python/CaloSwClcon_dc2new.py              |    6 +-
 .../python/CaloSwClcon_g3.py                  |    9 +-
 .../python/CaloSwClusterUpdate.py             |   24 +-
 .../python/CaloSwCorrections.py               |  317 +++--
 .../python/CaloSwDeadOTX_back.py              |   30 +-
 .../python/CaloSwDeadOTX_back_v1.py           |    6 +-
 .../python/CaloSwDeadOTX_ps.py                |   30 +-
 .../python/CaloSwDeadOTX_ps_v1.py             |    6 +-
 .../python/CaloSwEtamod.py                    |   23 +-
 .../python/CaloSwEtamod_v2.py                 |    8 +-
 .../python/CaloSwEtamod_v4.py                 |    6 +-
 .../python/CaloSwEtaoff.py                    |   32 +-
 .../python/CaloSwEtaoff_g3.py                 |    8 +-
 .../python/CaloSwEtaoff_v2.py                 |    8 +-
 .../python/CaloSwEtaoff_v3.py                 |    8 +-
 .../python/CaloSwEtaoff_v4.py                 |    8 +-
 .../python/CaloSwEtaoff_v4_1.py               |    8 +-
 .../python/CaloSwEtaoff_v5.py                 |    8 +-
 .../python/CaloSwEtaphimod_v2_rfac.py         |    4 +-
 .../CaloClusterCorrection/python/CaloSwGap.py |   27 +-
 .../python/CaloSwGap_v2.py                    |    6 +-
 .../python/CaloSwGap_v3.py                    |    6 +-
 .../python/CaloSwGap_v4.py                    |    6 +-
 .../python/CaloSwGap_v5.py                    |    6 +-
 .../python/CaloSwGap_v6.py                    |    6 +-
 .../python/CaloSwLayers.py                    |   21 +-
 .../python/CaloSwLongWeights.py               |   23 +-
 .../python/CaloSwLongWeights_904.py           |    6 +-
 .../python/CaloSwLongWeights_atlfast_v1.py    |    4 +-
 .../python/CaloSwLongWeights_old.py           |    6 +-
 .../python/CaloSwLongWeights_pi0_v1.py        |    4 +-
 .../python/CaloSwLongWeights_v3.py            |    6 +-
 .../python/CaloSwLongWeights_v4.py            |    6 +-
 .../python/CaloSwLongWeights_v5.py            |    4 +-
 .../python/CaloSwLongWeights_v6.py            |    4 +-
 .../python/CaloSwPhimod.py                    |   23 +-
 .../python/CaloSwPhimod_v2.py                 |    8 +-
 .../python/CaloSwPhimod_v4.py                 |    6 +-
 .../python/CaloSwPhimod_v4data.py             |    6 +-
 .../python/CaloSwPhioff.py                    |   21 +-
 .../python/CaloSwPhioff_g3.py                 |    7 +-
 .../python/CaloSwPhioff_v2.py                 |    7 +-
 .../python/CaloSwPhioff_v3.py                 |    8 +-
 .../python/CaloSwPhioff_v4.py                 |    8 +-
 .../python/CaloSwPhioff_v4data.py             |    7 +-
 .../python/CaloSwPhioff_v5.py                 |    8 +-
 .../python/CaloSwPhioff_v5data.py             |    2 +-
 .../python/CaloSwRfac.py                      |   21 +-
 .../python/CaloSwRfac_v3.py                   |    6 +-
 .../python/CaloSwRfac_v4.py                   |    6 +-
 .../python/CaloSwRfac_v5.py                   |    6 +-
 .../python/CaloSwTime.py                      |   28 +-
 .../python/CaloSwTransitionRegionsCorr.py     |   33 +-
 .../python/CaloSwTransitionRegionsCorr_v1.py  |    6 +-
 .../python/CaloSwTransitionRegionsCorr_v5.py  |    6 +-
 .../CaloSwTransitionRegionsCorr_v5_1.py       |    6 +-
 .../python/CaloTopoEMClusterUpdate.py         |   19 +-
 .../python/CaloTopoEMCorrections.py           |  193 ++-
 .../python/CaloTopoEMetaoff.py                |   21 +-
 .../python/CaloTopoEMetaoffSW.py              |   21 +-
 .../python/CaloTopoEMgap.py                   |   21 +-
 .../python/CaloTopoEMlayers.py                |   22 +-
 .../python/CaloTopoEMlongWeights.py           |   21 +-
 .../python/CaloTopoEMmoments.py               |   37 +-
 .../python/CaloTopoEMphimod.py                |   22 +-
 .../python/CaloTopoEMphioff.py                |   19 +-
 .../python/MakeHierTags.py                    |   27 +-
 .../python/StandardCellWeightCalib.py         |    9 +-
 .../CaloClusterCorrection/python/common.py    |  558 ++++----
 .../CaloClusterCorrection/python/compat.py    |   58 +
 .../CaloClusterCorrection/python/constants.py |    4 +-
 .../python/linkDummyTags.py                   |    8 +-
 .../share/CaloSwCorrectionsToPool.py          |    8 +-
 .../share/CaloTopoEMCorrectionsToPool.py      |    8 +-
 .../share/config_test.ref                     |   26 +
 .../src/CaloClusterRemoveBad.cxx              |    3 -
 .../src/CaloClusterRemoveBad.h                |    5 +-
 .../src/CaloClusterRemoveDuplicates.cxx       |    3 -
 .../src/CaloClusterRemoveDuplicates.h         |    5 +-
 .../src/CaloComputeSWcellWeights.cxx          |    4 +-
 .../src/CaloComputeSWcellWeights.h            |    5 +-
 .../src/CaloRunClusterCorrections.cxx         |  872 -------------
 .../src/CaloRunClusterCorrections.h           |  395 ------
 .../CaloClusterCorrection_entries.cxx         |    2 -
 .../CaloClusterCorrection/test/config_t.py    | 1128 +++++++++++++++++
 104 files changed, 2302 insertions(+), 2346 deletions(-)
 create mode 100644 Calorimeter/CaloClusterCorrection/python/compat.py
 create mode 100644 Calorimeter/CaloClusterCorrection/share/config_test.ref
 delete mode 100644 Calorimeter/CaloClusterCorrection/src/CaloRunClusterCorrections.cxx
 delete mode 100644 Calorimeter/CaloClusterCorrection/src/CaloRunClusterCorrections.h
 create mode 100644 Calorimeter/CaloClusterCorrection/test/config_t.py

diff --git a/Calorimeter/CaloClusterCorrection/CMakeLists.txt b/Calorimeter/CaloClusterCorrection/CMakeLists.txt
index c25ec3234ed0..fc63dd903088 100644
--- a/Calorimeter/CaloClusterCorrection/CMakeLists.txt
+++ b/Calorimeter/CaloClusterCorrection/CMakeLists.txt
@@ -28,7 +28,12 @@ atlas_add_test( interpolate_test
                 INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
                 LINK_LIBRARIES ${Boost_LIBRARIES} CaloClusterCorrectionLib )
 
+atlas_add_test( config_test
+                SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/config_t.py
+                ENVIRONMENT FRONTIER_SERVER=$ENV{FRONTIER_SERVER}
+                LOG_IGNORE_PATTERN "Current filenames|by peeking" )
+
 # 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 )
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloClusterBadChannelListCorr.py b/Calorimeter/CaloClusterCorrection/python/CaloClusterBadChannelListCorr.py
index 3bb425f293bb..1b7b29a733de 100644
--- a/Calorimeter/CaloClusterCorrection/python/CaloClusterBadChannelListCorr.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloClusterBadChannelListCorr.py
@@ -1,12 +1,11 @@
-# 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 AthenaConfiguration.ComponentFactory import CompFactory
 
 def CaloClusterBadChannelListCorr() :
 
-      from CaloBadChannelTool.CaloBadChannelToolConf import CaloBadChanTool 
-      theCaloBadChannelTool = CaloBadChanTool()
+      theCaloBadChannelTool = CompFactory.CaloBadChanTool() # CaloBadChannelTool
 
-      from CaloClusterCorrection.CaloClusterCorrectionConf import CaloClusterBadChannelList
-      corr = CaloClusterBadChannelList()
-      #ToolSvc += corr
+      corr = CompFactory.CaloClusterBadChannelList() # CaloClusterCorrection
       corr.badChannelTool = theCaloBadChannelTool
       return corr
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloClusterListBadChannel.py b/Calorimeter/CaloClusterCorrection/python/CaloClusterListBadChannel.py
index 7e729068e730..51882d0820d3 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloClusterListBadChannel.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloClusterListBadChannel.py
@@ -1,9 +1,11 @@
-# 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 CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_NOPOOL, CALOCORR_DEFAULT_KEY
+from CaloClusterCorrection.common import makecorr
 
-from CaloClusterCorrection import CaloClusterCorrectionConf 
-cls = CaloClusterCorrectionConf.CaloClusterBadChannelList
+cls = CompFactory.CaloClusterBadChannelList # CaloClusterCorrection
 
 CaloClusterListBadChannel_versions = [
     ['',              cls,
@@ -11,7 +13,8 @@ CaloClusterListBadChannel_versions = [
       CALOCORR_NOPOOL]],
     ]
 
-def make_CaloClusterListBadChannel (corrclass,
+def make_CaloClusterListBadChannel (flags,
+                                    corrclass,
                                     name = None,
                                     suffix = None,
                                     version = None,
@@ -20,7 +23,8 @@ def make_CaloClusterListBadChannel (corrclass,
                                     confclass = None,
                                     **kw):
 
-    return  makecorr(versions= CaloClusterListBadChannel_versions,
+    return  makecorr(flags,
+                     versions= CaloClusterListBadChannel_versions,
                      name = name,
                      basename = 'listBadChannels',
                      suffix = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloClusterRemoveBad.py b/Calorimeter/CaloClusterCorrection/python/CaloClusterRemoveBad.py
index cbae62648d1d..ad56df9f3f05 100644
--- a/Calorimeter/CaloClusterCorrection/python/CaloClusterRemoveBad.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloClusterRemoveBad.py
@@ -1,28 +1,32 @@
-# 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: CaloClusterCorrection/python/CaloClusterRemoveBad.py
 # Created: July 2010 Hong Ma
 # Purpose: Steering module for bad cluster removal 
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_NOPOOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
-cls = CaloClusterCorrectionConf.CaloClusterRemoveBad
+cls = CompFactory.CaloClusterRemoveBad # CaloCusterCorrection
 CaloClusterRemoveBad_versions = [
     ['',              cls,
      ['CaloClusterRemoveBad.CaloClusterRemoveBad_parms',
       CALOCORR_NOPOOL]],
     ]
 
-def make_CaloClusterRemoveBad (name = None,
-                                      suffix = None,
-                                      version = None,
-                                      key = CALOCORR_DEFAULT_KEY,
-                                      source = None,
-                                      confclass = None,
-                                      **kw):
-    return makecorr (versions = CaloClusterRemoveBad_versions,
+def make_CaloClusterRemoveBad (flags,
+                               name = None,
+                               suffix = None,
+                               version = None,
+                               key = CALOCORR_DEFAULT_KEY,
+                               source = None,
+                               confclass = None,
+                               **kw):
+    return makecorr (flags,
+                     versions = CaloClusterRemoveBad_versions,
                      name = name,
                      basename = 'removebad',
                      suffix = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloClusterRemoveDuplicates.py b/Calorimeter/CaloClusterCorrection/python/CaloClusterRemoveDuplicates.py
index 9680f3a9cb61..585a1fae053d 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloClusterRemoveDuplicates.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloClusterRemoveDuplicates.py
@@ -1,28 +1,32 @@
-# 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: CaloClusterCorrection/python/CaloClusterRemoveDuplicates.py
 # Created: May, 2008, M. Cooke
 # Purpose: Steering module for duplicate removal tool
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_NOPOOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
-cls = CaloClusterCorrectionConf.CaloClusterRemoveDuplicates
+cls = CompFactory.CaloClusterRemoveDuplicates # CaloClusterCorrection
 CaloClusterRemoveDuplicates_versions = [
     ['',              cls,
      ['CaloClusterRemoveDuplicates.CaloClusterRemoveDuplicates_parms',
       CALOCORR_NOPOOL]],
     ]
 
-def make_CaloClusterRemoveDuplicates (name = None,
+def make_CaloClusterRemoveDuplicates (flags,
+                                      name = None,
                                       suffix = None,
                                       version = None,
                                       key = CALOCORR_DEFAULT_KEY,
                                       source = None,
                                       confclass = None,
                                       **kw):
-    return makecorr (versions = CaloClusterRemoveDuplicates_versions,
+    return makecorr (flags,
+                     versions = CaloClusterRemoveDuplicates_versions,
                      name = name,
                      basename = 'removeduplicates',
                      suffix = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloComputeSWcellWeights.py b/Calorimeter/CaloClusterCorrection/python/CaloComputeSWcellWeights.py
index a200ac127e1e..5b3b314a3ba0 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloComputeSWcellWeights.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloComputeSWcellWeights.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloComputeSWcellWeights.py,v 1.4 2007-10-17 21:05:52 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloComputeSWcellWeights.py
 # Created: Nov 2006, sss
@@ -17,15 +15,17 @@
 # Following this, the layer variables need to be recalculated.
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_NOPOOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-cls = CaloClusterCorrectionConf.CaloComputeSWcellWeights
+cls = CompFactory.CaloComputeSWcellWeights # CaloClusterCorrection
 CaloComputeSWcellWeights_versions = [
     ['',              cls,
      ['CaloComputeSWcellWeights.CaloComputeSWcellWeights_parms',
@@ -35,6 +35,7 @@ CaloComputeSWcellWeights_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -52,14 +53,16 @@ CaloComputeSWcellWeights_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloComputeSWcellWeights (name = None,
+def make_CaloComputeSWcellWeights (flags,
+                                   name = None,
                                    suffix = None,
                                    version = None,
                                    key = CALOCORR_DEFAULT_KEY,
                                    source = None,
                                    confclass = None,
                                    **kw):
-    return makecorr (versions = CaloComputeSWcellWeights_versions,
+    return makecorr (flags,
+                     versions = CaloComputeSWcellWeights_versions,
                      name = name,
                      basename = 'weightsEM',
                      suffix = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration.py b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration.py
index 7371a5924a2e..0a9d099d5b40 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration.py
@@ -1,4 +1,4 @@
-# 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: CaloClusterCorrection/python/CaloSwCalibHitsCalibration.py
@@ -14,15 +14,17 @@
 #
 
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import sw_valid_keys as keys
-cls = CaloClusterCorrectionConf.CaloSwCalibHitsCalibration
+from CaloClusterCorrection.constants import sw_valid_keys as keys
+cls = CompFactory.CaloSwCalibHitsCalibration # CaloClusterCorrection
 CaloSwCalibHitsCalibration_versions = [
 
     # 12.0.3 simulation and reconstruction, with ideal (calib0) geometry.
@@ -120,6 +122,7 @@ CaloSwCalibHitsCalibration_versions = [
         
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -137,7 +140,8 @@ CaloSwCalibHitsCalibration_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwCalibHitsCalibration (name = None,
+def make_CaloSwCalibHitsCalibration (flags,
+                                     name = None,
                                      suffix = None,
                                      version = None,
                                      key = CALOCORR_DEFAULT_KEY,
@@ -145,7 +149,8 @@ def make_CaloSwCalibHitsCalibration (name = None,
                                      confclass = None,
                                      **kw):
     # Make the tool.
-    return makecorr (versions  = CaloSwCalibHitsCalibration_versions,
+    return makecorr (flags,
+                     versions  = CaloSwCalibHitsCalibration_versions,
                      name      = name,
                      basename  = 'calhits',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v1.py b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v1.py
index e4b3aadd1d19..f36f521d08e2 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v1.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v1.py
@@ -1,4 +1,4 @@
-# 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: CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v1.py
@@ -27,7 +27,7 @@
 # 5) CaloSWCalHitsEfront_slope_v1_gam
 #######################################################################
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 
@@ -1972,7 +1972,7 @@ samplings_depths = [
 [ 2.4625 , 0.0 , 3.4   , 19.525 , 36.25  ],
 [ 2.4825 , 0.0 , 3.475 , 19.925 , 36.875 ]
 
-];
+]
 
 #######################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v2.py b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v2.py
index f97325d16c51..f15c609e49e0 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v2.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v2.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 #######################################################################
@@ -28,7 +28,7 @@
 # 5) CaloSWCalHitsEfront_slope_v2_gam
 #######################################################################
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 
@@ -1935,7 +1935,7 @@ samplings_depths = [
 [ 2.4625 , 0.0 , 3.77207 , 15.3194 , 31.8341 ],
 [ 2.4875 , 0.0 , 3.83388 , 15.5645 , 32.2648 ],
 
-];
+]
 
 #######################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v5.py b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v5.py
index 4b6b88ca73db..6181160594f4 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v5.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v5.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 #######################################################################
@@ -29,7 +29,7 @@
 # 5) CaloSWCalHitsEfront_slope_v5_gam
 #######################################################################
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 
@@ -1938,7 +1938,7 @@ samplings_depths = [
 [ 2.4625 , 0.0 , 3.4   , 19.525 , 36.25  ],
 [ 2.4825 , 0.0 , 3.475 , 19.925 , 36.875 ]
 
-];
+]
 
 #######################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v5_1.py b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v5_1.py
index f77b5fd2fb49..f13829451273 100644
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v5_1.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v5_1.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 #######################################################################
@@ -30,7 +30,7 @@
 # 5) CaloSWCalHitsEfront_slope_v5_1_gam
 #######################################################################
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 
@@ -1938,7 +1938,7 @@ samplings_depths = [
 [ 2.4375 , 0.0  , 3.84839   , 15.3758 , 31.5893  ],
 [ 2.4625 , 0.0  , 3.7751    , 15.3528 , 31.7805  ],
 [ 2.4875 , 0.0  , 3.82319   , 15.5724 , 32.3008  ]
-];
+]
 
 #######################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v6.py b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v6.py
index 1265c413b84d..6f286f3f046c 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v6.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v6.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 #######################################################################
@@ -33,7 +33,7 @@
 # Where YY is "conv" for converted or "unconv" for unconverted
 #######################################################################
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 
@@ -2683,7 +2683,7 @@ samplings_depths = [
 [ 2.4375 , 0.0  , 3.84839   , 15.3758 , 31.5893  ],
 [ 2.4625 , 0.0  , 3.7751    , 15.3528 , 31.7805  ],
 [ 2.4875 , 0.0  , 3.82319   , 15.5724 , 32.3008  ]
-];
+]
 
 #######################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v6leakdata.py b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v6leakdata.py
index 5d14ca11c5b1..b578eaf159f6 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v6leakdata.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v6leakdata.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 #######################################################################
@@ -36,7 +36,7 @@
 # Where YY is "conv" for converted or "unconv" for unconverted
 #######################################################################
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 
@@ -2686,7 +2686,7 @@ samplings_depths = [
 [ 2.4375 , 0.0  , 3.84839   , 15.3758 , 31.5893  ],
 [ 2.4625 , 0.0  , 3.7751    , 15.3528 , 31.7805  ],
 [ 2.4875 , 0.0  , 3.82319   , 15.5724 , 32.3008  ]
-];
+]
 
 #######################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v8.py b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v8.py
index 36f9a01aa550..21018faf63c8 100644
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v8.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v8.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 #######################################################################
@@ -37,7 +37,7 @@
 # R. Turra.
 #######################################################################
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 
@@ -2736,7 +2736,7 @@ samplings_depths = [
 [ 2.4375 , 0.0  , 4.5959   , 15.9977 , 32.1175  ],
 [ 2.4625 , 0.0  , 4.68513   , 16.2385 , 32.5042  ],
 [ 2.4875 , 0.0  , 4.7232   , 16.4144 , 33.028  ]
-];
+]
 
 #######################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v8leakdata.py b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v8leakdata.py
index f816bf8a4811..4f78cdfef5ed 100644
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v8leakdata.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v8leakdata.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 #######################################################################
@@ -41,7 +41,7 @@
 # R. Turra.
 #######################################################################
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 
@@ -2739,7 +2739,7 @@ samplings_depths = [
 [ 2.4375 , 0.0  , 4.5959   , 15.9977 , 32.1175  ],
 [ 2.4625 , 0.0  , 4.68513   , 16.2385 , 32.5042  ],
 [ 2.4875 , 0.0  , 4.7232   , 16.4144 , 33.028  ]
-];
+]
 
 #######################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v9.py b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v9.py
index 0cc3c5c5b180..d7340559bed9 100644
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v9.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v9.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 #######################################################################
@@ -41,7 +41,7 @@
 # R. Turra.
 #######################################################################
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 
@@ -2740,7 +2740,7 @@ samplings_depths = [
 [ 2.4375 , 0.0  , 4.5959   , 15.9977 , 32.1175  ],
 [ 2.4625 , 0.0  , 4.68513   , 16.2385 , 32.5042  ],
 [ 2.4875 , 0.0  , 4.7232   , 16.4144 , 33.028  ]
-];
+]
 
 #######################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v9leakdata.py b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v9leakdata.py
index 03b6e241c2ed..eaa353bfd4da 100644
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v9leakdata.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwCalibHitsCalibration_v9leakdata.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 #######################################################################
@@ -41,7 +41,7 @@
 # R. Turra.
 #######################################################################
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 
@@ -2739,7 +2739,7 @@ samplings_depths = [
 [ 2.4375 , 0.0  , 4.5959   , 15.9977 , 32.1175  ],
 [ 2.4625 , 0.0  , 4.68513   , 16.2385 , 32.5042  ],
 [ 2.4875 , 0.0  , 4.7232   , 16.4144 , 33.028  ]
-];
+]
 
 #######################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwClcon.py b/Calorimeter/CaloClusterCorrection/python/CaloSwClcon.py
index 143987badc56..f599f1d0abf0 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwClcon.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwClcon.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwClcon.py,v 1.8 2009-04-19 02:41:06 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwClcon.py
 # Created: Nov 2006, sss
@@ -20,16 +18,18 @@
 #
 
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import sw_valid_keys as keys
-cls_g3 = CaloClusterCorrectionConf.CaloSwClcon_g3
-cls_v2 = CaloClusterCorrectionConf.CaloSwClcon_v2
+from CaloClusterCorrection.constants import sw_valid_keys as keys
+cls_g3 = CompFactory.CaloSwClcon_g3 # CaloClusterCorrection
+cls_v2 = CompFactory.CaloSwClcon_v2 # CaloClusterCorrection
 CaloSwClcon_versions = [
 
     # The original G3-based correction, translated from the
@@ -55,6 +55,7 @@ CaloSwClcon_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -72,7 +73,8 @@ CaloSwClcon_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwClcon (name = None,
+def make_CaloSwClcon (flags,
+                      name = None,
                       suffix = None,
                       version = None,
                       key = CALOCORR_DEFAULT_KEY,
@@ -80,7 +82,8 @@ def make_CaloSwClcon (name = None,
                       confclass = None,
                       **kw):
     # Make the tool.
-    return makecorr (versions  = CaloSwClcon_versions,
+    return makecorr (flags,
+                     versions  = CaloSwClcon_versions,
                      name      = name,
                      basename  = 'clcon',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwClcon_dc2.py b/Calorimeter/CaloClusterCorrection/python/CaloSwClcon_dc2.py
index e7fb313f8b3b..a4bd7f2810c5 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwClcon_dc2.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwClcon_dc2.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwClcon_dc2.py,v 1.3 2008-01-25 04:14:21 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwClcon_dc2.py
 # Created: Nov 2006, sss
@@ -17,7 +15,7 @@
 # 
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_CLUSTER
 from AthenaCommon.SystemOfUnits import GeV
 
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwClcon_dc2new.py b/Calorimeter/CaloClusterCorrection/python/CaloSwClcon_dc2new.py
index 258715b0ea49..90004ba47cd6 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwClcon_dc2new.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwClcon_dc2new.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwClcon_dc2new.py,v 1.3 2008-01-25 04:14:21 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwClcon_dc2new.py
 # Created: Nov 2006, sss
@@ -17,7 +15,7 @@
 # 
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_CLUSTER
 from AthenaCommon.SystemOfUnits import GeV
 
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwClcon_g3.py b/Calorimeter/CaloClusterCorrection/python/CaloSwClcon_g3.py
index 11dd9e2b3605..087b65c2e32e 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwClcon_g3.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwClcon_g3.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwClcon_g3.py,v 1.3 2009-04-21 21:16:21 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwClcon_g3.py
 # Created: Nov 2006, sss
@@ -12,10 +10,7 @@
 #
 
 
-import string
-
-
-    # 3x3 cluster size corrections
+# 3x3 cluster size corrections
 qclcon_g3_correction_33 = \
     [ 1.078375, 1.073588, 1.068029, 1.067124, 1.065353, 1.063478,
       1.063487, 1.064091, 1.064620, 1.065535, 1.065928, 1.064441,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwClusterUpdate.py b/Calorimeter/CaloClusterCorrection/python/CaloSwClusterUpdate.py
index 0893dc3743cf..11ba25a19cb5 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwClusterUpdate.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwClusterUpdate.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwClusterUpdate.py,v 1.3 2009-04-25 17:57:00 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwClusterUpdate.py
 # Created: Nov 2006, sss
@@ -15,30 +13,34 @@
 # leaves the total cluster energy unchanged.
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-cls = CaloClusterCorrectionConf.CaloClusterUpdate
+cls = CompFactory.CaloClusterUpdate # CaloClusterCorrection
+from CaloClusterCorrection.constants import sw_valid_keys as keys
 CaloSwClusterUpdate_versions = [
     # This version doesn't recalculate the total cluster energy.
     ['dont_update_e', cls,
      ['CaloSwClusterUpdate.CaloSwClusterUpdate_dont_update_e_parms',
-      'caloswcorr_pool', CALOCORR_COOL]],
+      'caloswcorr_pool', CALOCORR_COOL], keys],
 
     # This version does recalculate the total cluster energy.
     ['',              cls,
      ['CaloSwClusterUpdate.CaloSwClusterUpdate_parms',
-      'caloswcorr_pool', CALOCORR_COOL]],
+      'caloswcorr_pool', CALOCORR_COOL], keys],
     ]
 
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -56,14 +58,16 @@ CaloSwClusterUpdate_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwClusterUpdate (name = None,
+def make_CaloSwClusterUpdate (flags,
+                              name = None,
                               suffix = None,
                               version = None,
                               key = CALOCORR_DEFAULT_KEY,
                               source = None,
                               confclass = None,
                               **kw):
-    return makecorr (versions = CaloSwClusterUpdate_versions,
+    return makecorr (flags,
+                     versions = CaloSwClusterUpdate_versions,
                      name = name,
                      basename = 'larupdate',
                      suffix = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwCorrections.py b/Calorimeter/CaloClusterCorrection/python/CaloSwCorrections.py
index 189f170d9518..d3e798b8c129 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwCorrections.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwCorrections.py
@@ -1,20 +1,19 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwCorrections.py,v 1.40 2009-04-30 20:29:53 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwCorrections.py
 # Created: Nov 2006, sss
 # Purpose: Top-level configuration file for EM cluster corrections.
 #
-# The main entry point here is make_CaloSwCorrections, which returns
+# The main entry point here is make_CaloSwCorrectionsCfg, which returns
+# ComponentAccumulator with
 # a list of correction tools.  It can be used either `le menu' --- selecting
 # a predefined list of correction tools, or `a la carte' --- explicitly
 # specifying the list of tools you want to run.
 #
 # The simplest way of using it is like this:
 #
-#   make_CaloSwCorrections (key)
+#   ca = make_CaloSwCorrectionsCfg (flags, key)
 #
 # Here, `key' is a string that denotes the type of cluster which you
 # are correcting.  It should be something like `ele55' for 5x5 electrons,
@@ -29,7 +28,7 @@
 # By default, the latest version of the corrections appropriate to the
 # geometry being used will be chosen.  You can override this selection
 # by supplying the `version' argument.  It may also be overridden
-# with caloClusterCorrectionFlags.CaloSwWhichCorrection.
+# with Calo.ClusterCorrection.CaloSwWhichCorrection.
 # For the list of known version
 # names, see the variable `CaloSwCorrection_versions' below.
 # In particular, using version `none' turns off the corrections.
@@ -39,7 +38,7 @@
 # the version to be used for individual correction by adding
 # parameters of the form CORRECTION_version.  For example:
 #
-#   make_CaloSwCorrections (key, version='v4', lwc_version='v3')
+#   make_CaloSwCorrectionsCfg (flags ,key, version='v4', lwc_version='v3')
 #
 # uses the `v4' corrections, except that we use version `v3' of the
 # layer weight corrections.  You can also specify CORRECTION_key
@@ -47,7 +46,7 @@
 # and CORRECTION_XXX to override any individual parameter
 # of a correction.  For example:
 #
-#   make_CaloSwCorrections (key, lwc_degree=2)
+#   make_CaloSwCorrectionsCfg (flags, key, lwc_degree=2)
 #
 # makes the full standard set of corrections, except that the interpolation
 # degree for the layer weights correction is changed to 2.
@@ -55,13 +54,13 @@
 # You can explicitly specify a list of corrections to run with the
 # `corrlist' argument.  For example,
 #
-#   make_CaloSwCorrections (key, corrlist=[[layers], [update], [gap]])
+#   make_CaloSwCorrectionsCfg (flags, key, corrlist=[[layers], [update], [gap]])
 #
 # runs only the `layers', `update', and `gap' corrections.  The names
 # used here, like `layers' should be functions defined with this
 # signature:
 #
-#    def layers (cells_name, suffix, version, key, source, **kw):
+#    def layers (flags, cells_name, suffix, version, key, source, **kw):
 #
 # Definitions for all the standard corrections are contained in this file.
 # Note that the names of these functions are what are used to recognize
@@ -81,9 +80,10 @@
 # settings may be specified as following (name, value) tuples
 # in the list.  For example:
 #
-#   make_CaloSwCorrections (key, corrlist=[[layers],
-#                                          [update],
-#                                          [gap, 'v3', ('degree', 2)]])
+#   make_CaloSwCorrectionsCfg (flags,
+#                              key, corrlist=[[layers],
+#                                             [update],
+#                                             [gap, 'v3', ('degree', 2)]])
 #
 # says to use version `v3' of the gap correction, and in addition,
 # to override the interpolation degree to be 2.
@@ -92,27 +92,27 @@
 # list will be augmented so that cells will be weighted to avoid
 # double-counting the energy of cells that are in more than one cluster.
 # This may also be enabled by adding the string `_wt' to the end
-# of the correction version name, or by setting the DoSlidingWindowCellWeights
-# flag.
+# of the correction version name, or by setting the
+# Calo.ClusterCorrections.doSlidingWindowCellWeights flag.
 #
 # Similarly, if the parameter `remdup' is set to True, then the standard
 # correction list will be augmented so that if there are multiple clusters
 # too close together, all but one will be removed.
 # This may also be enabled by adding the string `_remdup' to the end
 # of the correction version name, or by setting the
-# DoSlidingWindowRemoveDuplicates flag.
+# Calo.ClusterCorrection.doSlidingWindowRemoveDuplicates flag.
 #
 # Also, if the parameter `rembad' is set to True, then the standard
 # correction list will be augmented so that clusters deemed to be
 # bad (below an energy threshold) will be removed.
 # This may also be enabled by adding the string `_rembad' to the end
 # of the correction version name, or by setting the
-# DoSlidingWindowRemoveBad flag.
+# Calo.ClusterCorrection.doSlidingWindowRemoveBad flag.
 #
 # There are three ways in which a correction can get configured: from
 # job options, from pool, or from cool.  You can specify which ones
-# to use by adding the `source' argument to make_CaloSwCorrections.
-# This is one of the following (defined in common.py):
+# to use by adding the `source' argument to make_CaloSwCorrectionsCfg.
+# This is one of the following (defined in constants.py):
 #
 #  - CALOCORR_JO: Configure from job options
 #  - CALOCORR_POOL: Configure from a pool file
@@ -123,7 +123,7 @@
 #
 # This parameter may be specified as a list of any of these values; in that
 # case, all the possibilities will be tried in order.  The default is taken
-# from caloClusterCorrectionFlags.DefaultSource
+# from Calo.ClusterCorrection.defaultSource
 # if it hasn't been explicitly set.  The usual setting is to try first
 # cool, then pool, then job options.  (Note that there are a couple
 # corrections which are not saved to pool/cool and can thus only
@@ -136,112 +136,122 @@
 # with a string of the form `MODULE.NAME'.
 #
 
-import sys
-import re
-from CaloClusterCorrection.CaloClusterCorrectionFlags \
-     import caloClusterCorrectionFlags
-from CaloClusterCorrection.CaloComputeSWcellWeights \
-     import make_CaloComputeSWcellWeights
-from CaloClusterCorrection.CaloSwLayers      import make_CaloSwLayers
-from CaloClusterCorrection.CaloSwRfac        import make_CaloSwRfac
-from CaloClusterCorrection.CaloSwEtaoff      import make_CaloSwEtaoff
-from CaloClusterCorrection.CaloSwPhioff      import make_CaloSwPhioff
-from CaloClusterCorrection.CaloSwEtamod      import make_CaloSwEtamod
-from CaloClusterCorrection.CaloSwPhimod      import make_CaloSwPhimod
-from CaloClusterCorrection.CaloSwClusterUpdate \
-     import make_CaloSwClusterUpdate
-from CaloClusterCorrection.CaloSwGap         import make_CaloSwGap
-from CaloClusterCorrection.CaloSwLongWeights import make_CaloSwLongWeights
-from CaloClusterCorrection.CaloSwCalibHitsCalibration import make_CaloSwCalibHitsCalibration
-from CaloClusterCorrection.CaloSwDeadOTX_ps import make_CaloSwDeadOTX_ps
-from CaloClusterCorrection.CaloSwDeadOTX_back import make_CaloSwDeadOTX_back
-from CaloClusterCorrection.CaloSwTransitionRegionsCorr import make_CaloSwTransitionRegionsCorr
-from CaloClusterCorrection.CaloClusterListBadChannel   import make_CaloClusterListBadChannel
-from CaloClusterCorrection.CaloSwClcon       import make_CaloSwClcon
-from CaloClusterCorrection.CaloSwTime        import make_CaloSwTime
-from CaloClusterCorrection.common            import *
-from CaloClusterCorrection.CaloClusterCorrectionFlags \
-     import caloClusterCorrectionFlags
-
-from CaloClusterCorrection.CaloClusterRemoveDuplicates import make_CaloClusterRemoveDuplicates
-from CaloClusterCorrection.CaloClusterRemoveBad import make_CaloClusterRemoveBad
+# Need to be sure that we always get run3 configurables in the imported
+# steering modules.
+from AthenaCommon.Configurable import Configurable
+
+try:
+    _wasRun3 = Configurable.configurableRun3Behavior
+    Configurable.configurableRun3Behavior = True
+
+    import re
+    from CaloClusterCorrection.CaloComputeSWcellWeights \
+         import make_CaloComputeSWcellWeights
+    from CaloClusterCorrection.CaloSwLayers      import make_CaloSwLayers
+    from CaloClusterCorrection.CaloSwRfac        import make_CaloSwRfac
+    from CaloClusterCorrection.CaloSwEtaoff      import make_CaloSwEtaoff
+    from CaloClusterCorrection.CaloSwPhioff      import make_CaloSwPhioff
+    from CaloClusterCorrection.CaloSwEtamod      import make_CaloSwEtamod
+    from CaloClusterCorrection.CaloSwPhimod      import make_CaloSwPhimod
+    from CaloClusterCorrection.CaloSwClusterUpdate \
+         import make_CaloSwClusterUpdate
+    from CaloClusterCorrection.CaloSwGap         import make_CaloSwGap
+    from CaloClusterCorrection.CaloSwLongWeights import make_CaloSwLongWeights
+    from CaloClusterCorrection.CaloSwCalibHitsCalibration import make_CaloSwCalibHitsCalibration
+    from CaloClusterCorrection.CaloSwDeadOTX_ps import make_CaloSwDeadOTX_ps
+    from CaloClusterCorrection.CaloSwDeadOTX_back import make_CaloSwDeadOTX_back
+    from CaloClusterCorrection.CaloSwTransitionRegionsCorr import make_CaloSwTransitionRegionsCorr
+    from CaloClusterCorrection.CaloClusterListBadChannel   import make_CaloClusterListBadChannel
+    from CaloClusterCorrection.CaloSwClcon       import make_CaloSwClcon
+    from CaloClusterCorrection.CaloSwTime        import make_CaloSwTime
+    from CaloClusterCorrection.constants         import \
+         CALOCORR_SW, EMB1, EME1, EMB2, EME2
+    from CaloClusterCorrection.common            import CaloClusterCorrSetup
+    from CaloClusterCorrection.compat            import makeFlags, unpackCA
+    
+    from CaloClusterCorrection.CaloClusterRemoveDuplicates import make_CaloClusterRemoveDuplicates
+    from CaloClusterCorrection.CaloClusterRemoveBad import make_CaloClusterRemoveBad
+
+finally:
+    Configurable.configurableRun3Behavior = _wasRun3
+
 
 ##############################################################################
 # Here we define wrapper functions to set up all of the standard corrections.
 # In the case where a correction has multiple versions for different
 # samplings, we define multiple wrappers here.
 # These are the names to use in the correction list and in the
-# arguments to make_CaloSwCorrection.
+# arguments to make_CaloSwCorrectionCfg.
 #
 
-def layers (cells_name, *args, **kw):
-    return make_CaloSwLayers (None, cells_name=cells_name, *args, **kw)
+def layers (flags, cells_name, *args, **kw):
+    return make_CaloSwLayers (flags, None, cells_name=cells_name, *args, **kw)
 
-def weight (cells_name, *args, **kw):
-    return make_CaloComputeSWcellWeights (None, *args, **kw)
+def weight (flags, cells_name, *args, **kw):
+    return make_CaloComputeSWcellWeights (flags, None, *args, **kw)
 
-def rfac (cells_name, *args, **kw):
-    return make_CaloSwRfac (None, *args, **kw)
+def rfac (flags, cells_name, *args, **kw):
+    return make_CaloSwRfac (flags, None, *args, **kw)
 
-def etaoff_b1 (cells_name, *args, **kw):
-    return make_CaloSwEtaoff (EMB1, None, *args, **kw)
+def etaoff_b1 (flags, cells_name, *args, **kw):
+    return make_CaloSwEtaoff (flags, EMB1, None, *args, **kw)
 
-def etaoff_b2 (cells_name, *args, **kw):
-    return make_CaloSwEtaoff (EMB2, None, *args, **kw)
+def etaoff_b2 (flags, cells_name, *args, **kw):
+    return make_CaloSwEtaoff (flags, EMB2, None, *args, **kw)
 
-def etaoff_e1 (cells_name, *args, **kw):
-    return make_CaloSwEtaoff (EME1, None, *args, **kw)
+def etaoff_e1 (flags, cells_name, *args, **kw):
+    return make_CaloSwEtaoff (flags, EME1, None, *args, **kw)
 
-def etaoff_e2 (cells_name, *args, **kw):
-    return make_CaloSwEtaoff (EME2, None, *args, **kw)
+def etaoff_e2 (flags, cells_name, *args, **kw):
+    return make_CaloSwEtaoff (flags, EME2, None, *args, **kw)
 
-def phioff_b2 (cells_name, *args, **kw):
-    return make_CaloSwPhioff (EMB2, None, *args, **kw)
+def phioff_b2 (flags, cells_name, *args, **kw):
+    return make_CaloSwPhioff (flags, EMB2, None, *args, **kw)
 
-def phioff_e2 (cells_name, *args, **kw):
-    return make_CaloSwPhioff (EME2, None, *args, **kw)
+def phioff_e2 (flags, cells_name, *args, **kw):
+    return make_CaloSwPhioff (flags, EME2, None, *args, **kw)
 
-def phimod (cells_name, *args, **kw):
-    return make_CaloSwPhimod (None, *args, **kw)
+def phimod (flags, cells_name, *args, **kw):
+    return make_CaloSwPhimod (flags, None, *args, **kw)
 
-def etamod (cells_name, *args, **kw):
-    return make_CaloSwEtamod (None, *args, **kw)
+def etamod (flags, cells_name, *args, **kw):
+    return make_CaloSwEtamod (flags, None, *args, **kw)
 
-def update (cells_name, *args, **kw):
-    return make_CaloSwClusterUpdate (None, *args, **kw)
+def update (flags, cells_name, *args, **kw):
+    return make_CaloSwClusterUpdate (flags, None, *args, **kw)
 
-def gap (cells_name, *args, **kw):
-    return make_CaloSwGap (None, cells_name=cells_name, *args, **kw)
+def gap (flags, cells_name, *args, **kw):
+    return make_CaloSwGap (flags, None, cells_name=cells_name, *args, **kw)
 
-def lwc (cells_name, *args, **kw):
-    return make_CaloSwLongWeights (None, *args, **kw)
+def lwc (flags, cells_name, *args, **kw):
+    return make_CaloSwLongWeights (flags, None, *args, **kw)
 
-def calhits (cells_name, *args, **kw):
-    return make_CaloSwCalibHitsCalibration (None, *args, **kw)
+def calhits (flags, cells_name, *args, **kw):
+    return make_CaloSwCalibHitsCalibration (flags, None, *args, **kw)
 
-def trcorr (cells_name, *args, **kw):
-    return make_CaloSwTransitionRegionsCorr (None, *args, **kw)
+def trcorr (flags, cells_name, *args, **kw):
+    return make_CaloSwTransitionRegionsCorr (flags, None, *args, **kw)
 
-def deadOTXps (cells_name, *args, **kw):
-    return make_CaloSwDeadOTX_ps ( None, *args, **kw )
+def deadOTXps (flags, cells_name, *args, **kw):
+    return make_CaloSwDeadOTX_ps (flags, None, *args, **kw )
 
-def deadOTXback (cells_name, *args, **kw):
-    return make_CaloSwDeadOTX_back ( None, *args, **kw )
+def deadOTXback (flags, cells_name, *args, **kw):
+    return make_CaloSwDeadOTX_back (flags, None, *args, **kw )
 
-def clcon (cells_name, *args, **kw):
-    return make_CaloSwClcon (None, *args, **kw)
+def clcon (flags, cells_name, *args, **kw):
+    return make_CaloSwClcon (flags, None, *args, **kw)
 
-def removeduplicates (cells_name, *args, **kw):
-    return make_CaloClusterRemoveDuplicates (None, *args, **kw)
+def removeduplicates (flags, cells_name, *args, **kw):
+    return make_CaloClusterRemoveDuplicates (flags, None, *args, **kw)
 
-def removebad (cells_name, *args, **kw):
-    return make_CaloClusterRemoveBad (None, *args, **kw)
+def removebad (flags, cells_name, *args, **kw):
+    return make_CaloClusterRemoveBad (flags, None, *args, **kw)
 
-def listBadChannel (cells_name, *args, **kw):
-    return make_CaloClusterListBadChannel (CALOCORR_SW, None, *args, **kw)
+def listBadChannel (flags, cells_name, *args, **kw):
+    return make_CaloClusterListBadChannel (flags, CALOCORR_SW, None, *args, **kw)
 
-def time (cells_name, *args, **kw):
-    return make_CaloSwTime (None, *args, **kw)
+def time (flags, cells_name, *args, **kw):
+    return make_CaloSwTime (flags, None, *args, **kw)
 
 
 ##############################################################################
@@ -261,8 +271,8 @@ def _version_match (version, fragment):
 class CaloSwCorrectionsSetup (CaloClusterCorrSetup):
 
     name = "EM sliding-window"
-    version_override_flag = caloClusterCorrectionFlags.CaloSwWhichCorrection
-    correction_generation_flag = caloClusterCorrectionFlags.CaloSwGeneration
+    version_override_flag_name = 'caloSwWhichCorrection'
+    correction_generation_flag_name = 'caloSwGeneration'
     correction_generation_default = "00-02-13"
 
     ##########################################################################
@@ -506,8 +516,8 @@ class CaloSwCorrectionsSetup (CaloClusterCorrSetup):
                     [etamod,    'v4',          502],
                     [time,                     801],
                     [listBadChannel,           820]],
-		      
-	
+                      
+        
         # Calibration hits and transition region corrections updated
         # for release 14.0.0 geometry (ATLAS-CSC-05-00-00).
         # Other corrections still based on 12.
@@ -1107,10 +1117,8 @@ class CaloSwCorrectionsSetup (CaloClusterCorrSetup):
     ##########################################################################
     # Code to handle cell weighting.
     #
-    def make_corrections (self, **kw_in):
-        kw = {}
-        if caloClusterCorrectionFlags.CaloSwCorrectionArgs.statusOn:
-            kw = caloClusterCorrectionFlags.CaloSwCorrectionArgs().copy()
+    def make_corrections (self, flags, **kw_in):
+        kw = flags.Calo.ClusterCorrection.caloSwCorrectionArgs
         kw.update (kw_in)
 
         for kk in ['weighting', 'remdup', 'rembad']:
@@ -1118,32 +1126,34 @@ class CaloSwCorrectionsSetup (CaloClusterCorrSetup):
                 setattr (self, kk, kw[kk])
                 del kw[kk]
         
-        return CaloClusterCorrSetup.make_corrections (self, **kw)
+        return CaloClusterCorrSetup.make_corrections (self, flags, **kw)
 
 
-    def lookup_version (self, version):
+    def lookup_version (self, flags, version, corrclass):
         # Special cases:
         #  If the version name includes `_wt', turn on weighting.
         (self.weighting, version) = _version_match (version, 'wt')
 
-        #  If the version name includes with `_remdup',
+        #  If the version name includes `_remdup',
         #  turn on duplicate removal.
         (self.remdup, version) = _version_match (version, 'remdup')
 
-        #  If the version name includes with `_rembad',
+        #  If the version name includes `_rembad',
         #  turn on bad cluster removal.
         (self.rembad, version) = _version_match (version, 'rembad')
 
         # Now, find the standard list of corrections to use.
         (vcorrlist, version) = CaloClusterCorrSetup.lookup_version (self,
-                                                                    version)
+                                                                    flags,
+                                                                    version,
+                                                                    corrclass)
 
         # Check global flags.
-        if caloClusterCorrectionFlags.DoSlidingWindowCellWeights():
+        if flags.Calo.ClusterCorrection.doSlidingWindowCellWeights:
             self.weighting = 1
-        if caloClusterCorrectionFlags.DoSlidingWindowRemoveDuplicates():
+        if flags.Calo.ClusterCorrection.doSlidingWindowRemoveDuplicates:
             self.remdup = 1
-        if caloClusterCorrectionFlags.DoSlidingWindowRemoveBad():
+        if flags.Calo.ClusterCorrection.doSlidingWindowRemoveBad:
             self.rembad = 1
 
         # If weighting or rembad is turned on, make the appropriate additions
@@ -1154,7 +1164,7 @@ class CaloSwCorrectionsSetup (CaloClusterCorrSetup):
                 if c[0] == layers:
                     ilayers = i
                     break
-            if ilayers != None:
+            if ilayers is not None:
                 vcorrlist = vcorrlist[:]
                 if self.rembad:
                     vcorrlist.insert (ilayers + 1, [removebad, 121])
@@ -1182,11 +1192,12 @@ CaloSwCorrections = CaloSwCorrectionsSetup()
 
 
 ##############################################################################
-# Main entry point to create a list of correction tools.
+# Main entry point to create a list of correction tools
 #
 
 #
-# Create and return a list of correction tools.
+# Create and return a CA of correction tools.
+# FLAGS are the configuration flags.
 # KEY is a string that specifies the correction type.
 # SUFFIX is a string to add to the end of each tool name.
 # VERSION specifies which version of corrections to use.
@@ -1203,17 +1214,19 @@ CaloSwCorrections = CaloSwCorrectionsSetup()
 #
 # For more detailed information, see the comments at the start of this file.
 #
-def make_CaloSwCorrections (key = None,
-                            suffix = '',
-                            version = None,
-                            corrlist = None,
-                            cells_name = None,
-                            source = None,
-                            weighting = False,
-                            remdup = False,
-                            rembad = False,
-                            **kw):
-    return CaloSwCorrections.make_corrections (corrclass = CALOCORR_SW,
+def make_CaloSwCorrectionsCfg (flags,
+                               key = None,
+                               suffix = '',
+                               version = None,
+                               corrlist = None,
+                               cells_name = None,
+                               source = None,
+                               weighting = False,
+                               remdup = False,
+                               rembad = False,
+                               **kw):
+    return CaloSwCorrections.make_corrections (flags,
+                                               corrclass = CALOCORR_SW,
                                                key = key,
                                                suffix = suffix,
                                                version = version,
@@ -1228,8 +1241,58 @@ def make_CaloSwCorrections (key = None,
 
 
 ##############################################################################
-# Compatibility hacks.
+# Backwards compatibility:
+# Main entry point to create a list of correction tools (old configuration)
+#
+
+#
+# Create and return a list of correction tools.
+# KEY is a string that specifies the correction type.
+# SUFFIX is a string to add to the end of each tool name.
+# VERSION specifies which version of corrections to use.
+# CORRLIST can be used to explicitly specify which corrections to run.
+# CELLS_NAME is the SG key to use to find the calorimeter cells,
+# for those corrections that require it.
+# SOURCE specifies the source(s) from which tools are configured.
+# See above for details.
+# None means to use the default.
+# If WEIGHTING is true, then cells are weighted to avoid
+# double-counting energy for cells that are shared between clusters.
+# If REMDUP is true, then in groups of clusters that are very close
+# together, we drop all but one.
+#
+# For more detailed information, see the comments at the start of this file.
 #
+def make_CaloSwCorrections (key = None,
+                            suffix = '',
+                            version = None,
+                            corrlist = None,
+                            cells_name = None,
+                            source = None,
+                            weighting = False,
+                            remdup = False,
+                            rembad = False,
+                            **kw):
+    try:
+        wasRun3 = Configurable.configurableRun3Behavior
+        Configurable.configurableRun3Behavior = True
+        ca = CaloSwCorrections.make_corrections (makeFlags(),
+                                                 corrclass = CALOCORR_SW,
+                                                 key = key,
+                                                 suffix = suffix,
+                                                 version = version,
+                                                 corrlist = corrlist,
+                                                 cells_name = cells_name,
+                                                 source = source,
+                                                 weighting = weighting,
+                                                 remdup = remdup,
+                                                 rembad = rembad,
+                                                 **kw)
+    finally:
+        Configurable.configurableRun3Behavior = wasRun3
+    return unpackCA (ca)
+
+
 
 #
 # Creating an instance of this class gives you something which
@@ -1243,7 +1306,7 @@ class CaloSwCorrections_compat:
         self.version = version
         return
     def set (self, alg, suffix='', corrlist ='ele55', key = None):
-        if type (corrlist) == type (''):
+        if isinstance (corrlist, str):
             key = corrlist
             corrlist = None
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_back.py b/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_back.py
index 0a35839f1f0f..7c222d07b55e 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_back.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_back.py
@@ -6,15 +6,16 @@
 # Purpose: Steering module for dead OTX correction in the back
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import sw_valid_keys as keys
-cls = CaloClusterCorrectionConf.CaloSwDeadOTX_back
+cls = CompFactory.CaloSwDeadOTX_back # CaloClusterCorrection
 CaloSwDeadOTX_back_versions = [
 #
     ['v1', cls, ['CaloSwDeadOTX_back_v1.' +
@@ -31,6 +32,7 @@ CaloSwDeadOTX_back_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -47,19 +49,21 @@ CaloSwDeadOTX_back_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwDeadOTX_back(name = None,
-                    suffix = None,
-                    version = None,
-                    key = CALOCORR_DEFAULT_KEY,
-                    source = None,
-                    confclass = None,
-                    **kw):
+def make_CaloSwDeadOTX_back(flags,
+                            name = None,
+                            suffix = None,
+                            version = None,
+                            key = CALOCORR_DEFAULT_KEY,
+                            source = None,
+                            confclass = None,
+                            **kw):
 
-    from CaloTools.CaloToolsConf import CaloAffectedTool
+    CaloAffectedTool = CompFactory.CaloAffectedTool # CaloTools
     theAffectedTool = CaloAffectedTool("CaloAffectedForDeadOTX_back")
 
     # Make the tool.
-    return makecorr (versions  = CaloSwDeadOTX_back_versions,
+    return makecorr (flags,
+                     versions  = CaloSwDeadOTX_back_versions,
                      name      = name,
                      basename  = 'deadOTXback',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_back_v1.py b/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_back_v1.py
index 5a1b5c1297ba..acb792f18e8c 100644
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_back_v1.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_back_v1.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 ##########################################################################
@@ -15,7 +15,7 @@
 #
 #######################################################################
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 
@@ -443,7 +443,7 @@ samplings_depths = [
 [ 2.4375 , 0.0  , 4.5959   , 15.9977 , 32.1175  ],
 [ 2.4625 , 0.0  , 4.68513   , 16.2385 , 32.5042  ],
 [ 2.4875 , 0.0  , 4.7232   , 16.4144 , 33.028  ]
-];
+]
 
 #######################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_ps.py b/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_ps.py
index 57c226f9eab5..b6b42570378e 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_ps.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_ps.py
@@ -6,15 +6,16 @@
 # Purpose: Steering module for dead OTX correction in the PS
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import sw_valid_keys as keys
-cls = CaloClusterCorrectionConf.CaloSwDeadOTX_ps
+cls = CompFactory.CaloSwDeadOTX_ps # CaloClusterCorrection
 CaloSwDeadOTX_ps_versions = [
 #
     ['v1', cls, ['CaloSwDeadOTX_ps_v1.' +
@@ -31,6 +32,7 @@ CaloSwDeadOTX_ps_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -47,19 +49,21 @@ CaloSwDeadOTX_ps_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwDeadOTX_ps(name = None,
-                    suffix = None,
-                    version = None,
-                    key = CALOCORR_DEFAULT_KEY,
-                    source = None,
-                    confclass = None,
-                    **kw):
+def make_CaloSwDeadOTX_ps(flags,
+                          name = None,
+                          suffix = None,
+                          version = None,
+                          key = CALOCORR_DEFAULT_KEY,
+                          source = None,
+                          confclass = None,
+                          **kw):
 
-    from CaloTools.CaloToolsConf import CaloAffectedTool
+    CaloAffectedTool = CompFactory.CaloAffectedTool # CaloTools
     theAffectedTool = CaloAffectedTool("CaloAffectedToolForDeadOTX_ps")
 
     # Make the tool.
-    return makecorr (versions     = CaloSwDeadOTX_ps_versions,
+    return makecorr (flags,
+                     versions     = CaloSwDeadOTX_ps_versions,
                      name         = name,
                      basename     = 'deadOTXps',
                      suffix       = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_ps_v1.py b/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_ps_v1.py
index a5055ffef931..a82165e7b6e4 100644
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_ps_v1.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwDeadOTX_ps_v1.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 ##########################################################################
@@ -16,7 +16,7 @@
 #
 #######################################################################
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 CaloSWCalHitsEfrontOff_ele_NoPS_v1 = [
@@ -1060,7 +1060,7 @@ samplings_depths = [
 [ 2.4375 , 0.0  , 4.5959   , 15.9977 , 32.1175  ],
 [ 2.4625 , 0.0  , 4.68513   , 16.2385 , 32.5042  ],
 [ 2.4875 , 0.0  , 4.7232   , 16.4144 , 33.028  ]
-];
+]
 
 #######################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwEtamod.py b/Calorimeter/CaloClusterCorrection/python/CaloSwEtamod.py
index 8a0802a3d4e9..119fe8ff37b8 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwEtamod.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwEtamod.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwEtamod.py,v 1.9 2008-01-25 04:14:21 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwEtamod.py
 # Created: Nov 2006, sss
@@ -23,16 +21,18 @@
 #
 
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import sw_valid_keys as keys
-cls_g3 = CaloClusterCorrectionConf.CaloSwEtamod_g3
-cls_v2 = CaloClusterCorrectionConf.CaloSwEtamod_v2
+from CaloClusterCorrection.constants import sw_valid_keys as keys
+cls_g3 = CompFactory.CaloSwEtamod_g3 # CaloClusterCorrection
+cls_v2 = CompFactory.CaloSwEtamod_v2 # CaloClusterCorrection
 CaloSwEtamod_versions = [
 
     # The original G3-based correction, translated from the
@@ -64,6 +64,7 @@ CaloSwEtamod_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -81,7 +82,8 @@ CaloSwEtamod_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwEtamod (name = None,
+def make_CaloSwEtamod (flags,
+                       name = None,
                        suffix = None,
                        version = None,
                        key = CALOCORR_DEFAULT_KEY,
@@ -89,7 +91,8 @@ def make_CaloSwEtamod (name = None,
                        confclass = None,
                        **kw):
     # Make the tool.
-    return makecorr (versions  = CaloSwEtamod_versions,
+    return makecorr (flags,
+                     versions  = CaloSwEtamod_versions,
                      name      = name,
                      basename  = 'etamod',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwEtamod_v2.py b/Calorimeter/CaloClusterCorrection/python/CaloSwEtamod_v2.py
index 7ad1d86fd73a..d1186027f6e7 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwEtamod_v2.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwEtamod_v2.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwEtamod_v2.py,v 1.1 2006-11-14 14:51:28 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwEtamod_v2.py
 # Created: Nov 2006, sss
@@ -26,9 +24,9 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 from AthenaCommon.SystemOfUnits import GeV
-from CaloClusterCorrection.CaloSwEtaphimod_v2_rfac import *
+from CaloClusterCorrection.CaloSwEtaphimod_v2_rfac import CaloSwEtaphimod_v2_rfac
 
 
 # Energies at which corrections were tabulated.
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwEtamod_v4.py b/Calorimeter/CaloClusterCorrection/python/CaloSwEtamod_v4.py
index adf235c13beb..29895952bccc 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwEtamod_v4.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwEtamod_v4.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwEtamod_v4.py,v 1.1 2006-11-17 16:46:56 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwEtamod_v4.py
 # Created: Nov 2006, sss
@@ -15,7 +13,7 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 from AthenaCommon.SystemOfUnits import GeV
 
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff.py b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff.py
index 650df39bbb22..67485251cddd 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwEtaoff.py,v 1.10 2008-01-25 04:14:21 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwEtaoff.py
 # Created: Nov 2006, sss
@@ -20,20 +18,23 @@
 #
 
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW, \
+     EMB1, EME1, EMB2, EME2
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import sw_valid_keys as keys
-cls_g3 = {EMB1 : CaloClusterCorrectionConf.CaloSwEta1b_g3,
-          EMB2 : CaloClusterCorrectionConf.CaloSwEta2b_g3,
-          EME1 : CaloClusterCorrectionConf.CaloSwEta1e_g3,
-          EME2 : CaloClusterCorrectionConf.CaloSwEta2e_g3}
-cls_v2 = CaloClusterCorrectionConf.CaloSwEtaoff_v2
-cls_v3 = CaloClusterCorrectionConf.CaloSwEtaoff_v3
+from CaloClusterCorrection.constants import sw_valid_keys as keys
+cls_g3 = {EMB1 : CompFactory.CaloSwEta1b_g3,  # CaloClusterCorrection
+          EMB2 : CompFactory.CaloSwEta2b_g3,  # CaloClusterCorrection
+          EME1 : CompFactory.CaloSwEta1e_g3,  # CaloClusterCorrection
+          EME2 : CompFactory.CaloSwEta2e_g3}  # CaloClusterCorrection
+cls_v2 = CompFactory.CaloSwEtaoff_v2  # CaloClusterCorrection
+cls_v3 = CompFactory.CaloSwEtaoff_v3  # CaloClusterCorrection
 CaloSwEtaoff_versions = [
 
     # The original G3-based correction, translated from the
@@ -84,6 +85,7 @@ CaloSwEtaoff_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  SAMPLING is the calorimeter sampling (EMB1, EMB2, EME1, EME2) to which
 #   this correction will be applied.
 #  NAME is the base name for this tool.  If defaulted, a name will
@@ -103,7 +105,8 @@ CaloSwEtaoff_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwEtaoff (sampling,
+def make_CaloSwEtaoff (flags,
+                       sampling,
                        name = None,
                        suffix = None,
                        version = None,
@@ -112,7 +115,8 @@ def make_CaloSwEtaoff (sampling,
                        confclass = None,
                        **kw):
     # Make the tool.
-    return makecorr (versions  = CaloSwEtaoff_versions,
+    return makecorr (flags,
+                     versions  = CaloSwEtaoff_versions,
                      name      = name,
                      basename  = 'etaoff',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_g3.py b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_g3.py
index 2c5f9567e6d0..b279a77156ff 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_g3.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_g3.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwEtaoff_g3.py,v 1.3 2009-04-19 02:41:06 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwEtaoff_g3.py
 # Created: Nov 2006, sss
@@ -12,7 +10,9 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import \
+     CALOCORR_EMB1, CALOCORR_EMB2, CALOCORR_EME1, CALOCORR_EME2, \
+     EMB1, EME1, EMB2, EME2
 
 
 #############################################################################
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v2.py b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v2.py
index c74927e64dac..e32c4679c69d 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v2.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v2.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwEtaoff_v2.py,v 1.1 2006-11-10 03:47:26 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwEtaoff_v2.py
 # Created: Nov 2006, sss
@@ -16,7 +14,9 @@
 # See CaloSwEtaoff_v2.h for more details.
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import \
+     CALOCORR_EMB1, CALOCORR_EMB2, CALOCORR_EME1, CALOCORR_EME2, \
+     EMB1, EME1, EMB2, EME2
 from AthenaCommon.SystemOfUnits import GeV
 
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v3.py b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v3.py
index 9ecc4cf286d6..31d3887b147f 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v3.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v3.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwEtaoff_v3.py,v 1.5 2006-11-10 03:47:26 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwEtaoff_v3.py
 # Created: Nov 2006, sss
@@ -15,7 +13,9 @@
 # See CaloSwEtaoff_v3.h for more details.
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import \
+     CALOCORR_EMB1, CALOCORR_EMB2, CALOCORR_EME1, CALOCORR_EME2, \
+     EMB1, EME1, EMB2, EME2
 from AthenaCommon.SystemOfUnits import GeV
 
 ###############################################################################
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v4.py b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v4.py
index ea8f17975619..e831829c977b 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v4.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v4.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwEtaoff_v4.py,v 1.1 2006-11-10 03:47:26 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwEtaoff_v4.py
 # Created: Nov 2006, sss
@@ -15,7 +13,9 @@
 # See CaloSwEtaoff_v3.h for more details.
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import \
+     CALOCORR_EMB1, CALOCORR_EMB2, CALOCORR_EME1, CALOCORR_EME2, \
+     EMB1, EME1, EMB2, EME2
 from AthenaCommon.SystemOfUnits import GeV
 
 ###############################################################################
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v4_1.py b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v4_1.py
index 10fcd874ed98..0da014c6b12b 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v4_1.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v4_1.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwEtaoff_v4_1.py,v 1.2 2007-02-01 22:20:54 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwEtaoff_v4_1.py
 # Created: Jan 2007, sss
@@ -20,7 +18,9 @@
 # See CaloSwEtaoff_v3.h for more details.
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import \
+     CALOCORR_EMB1, CALOCORR_EMB2, CALOCORR_EME1, CALOCORR_EME2, \
+     EMB1, EME1, EMB2, EME2
 from AthenaCommon.SystemOfUnits import GeV
 
 ###############################################################################
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v5.py b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v5.py
index 9dcd7e3e4bb8..e0069fe9b30c 100644
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v5.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaoff_v5.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwEtaoff_v5.py 579330 2014-01-21 12:59:55Z ehill $
 #
 # File: CaloClusterCorrection/python/CaloSwEtaoff_v5.py
 # Created: November 19 2013, Ewan Hill
@@ -19,7 +17,9 @@
 # See CaloSwEtaoff_v3.h for more details.
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import \
+     CALOCORR_EMB1, CALOCORR_EMB2, CALOCORR_EME1, CALOCORR_EME2, \
+     EMB1, EME1, EMB2, EME2
 from AthenaCommon.SystemOfUnits import GeV
 
 ###############################################################################
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaphimod_v2_rfac.py b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaphimod_v2_rfac.py
index c832c600aca2..132d7f0820ad 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwEtaphimod_v2_rfac.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwEtaphimod_v2_rfac.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwEtaphimod_v2_rfac.py,v 1.1 2006-11-14 14:51:28 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwEtaphimod_v2_rfac.py
 # Created: Nov 2006, sss
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwGap.py b/Calorimeter/CaloClusterCorrection/python/CaloSwGap.py
index afce2701df0c..2fcf981012f6 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwGap.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwGap.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwGap.py,v 1.7 2007-10-17 21:05:52 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwGap.py
 # Created: Nov 2006, sss
@@ -19,17 +17,19 @@
 #
 
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import sw_valid_keys as keys
-cls_g3 = CaloClusterCorrectionConf.CaloSwGap_g3
-cls_v2 = CaloClusterCorrectionConf.CaloSwGap_v2
-cls_v3 = CaloClusterCorrectionConf.CaloSwGap_v3
+from CaloClusterCorrection.constants import sw_valid_keys as keys
+cls_g3 = CompFactory.CaloSwGap_g3  # CaloClusterCorrection
+cls_v2 = CompFactory.CaloSwGap_v2  # CaloClusterCorrection
+cls_v3 = CompFactory.CaloSwGap_v3  # CaloClusterCorrection
 CaloSwGap_versions = [
     # The original G3-based gap correction, translated from the
     # original fortran version.
@@ -75,6 +75,7 @@ CaloSwGap_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -95,7 +96,8 @@ CaloSwGap_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwGap (name = None,
+def make_CaloSwGap (flags,
+                    name = None,
                     suffix = None,
                     version = None,
                     key = CALOCORR_DEFAULT_KEY,
@@ -104,11 +106,12 @@ def make_CaloSwGap (name = None,
                     cells_name = None,
                     **kw):
 
-    if cells_name != None:
+    if cells_name is not None:
         kw['cells_name'] = cells_name
 
     # Make the tool.
-    return makecorr (versions  = CaloSwGap_versions,
+    return makecorr (flags,
+                     versions  = CaloSwGap_versions,
                      name      = name,
                      basename  = 'gap',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v2.py b/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v2.py
index 1c4f01c05c0d..7ae26c94b3fb 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v2.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v2.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwGap_v2.py,v 1.2 2006-11-16 07:07:45 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwGap_v2.py
 # Created: Nov 2006, sss
@@ -112,7 +110,7 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_CLUSTER
 
 
 #############################################################################
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v3.py b/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v3.py
index cd9f809294d1..bf6d8f7058fa 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v3.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v3.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwGap_v3.py,v 1.3 2006-11-10 03:47:27 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwGap_v3.py
 # Created: Nov 2006, sss
@@ -21,7 +19,7 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_CLUSTER
 
 #############################################################################
 # Gap energy correction for versions 12.x.x and later
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v4.py b/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v4.py
index b28383216dd5..38dd18bcf0e3 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v4.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v4.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwGap_v4.py,v 1.1 2006-11-10 03:47:27 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwGap_v4.py
 # Created: Nov 2006, sss
@@ -13,7 +11,7 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_CLUSTER
 
 #############################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v5.py b/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v5.py
index ef4c8af6daae..f43d9fd8b932 100644
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v5.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v5.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwGap_v5.py,v 1.1 2012-03-03 laplace Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwGap_v5.py
 # Created: March 2012, SL
@@ -18,7 +16,7 @@
 # - for now, use the electron corrections for the photons as well
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #############################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v6.py b/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v6.py
index bafca69d52f7..773b7b05d0fb 100644
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v6.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwGap_v6.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwGap_v6.py,v 1.1 2012-03-03 laplace Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwGap_v6.py
 # Created: March 2012, SL
@@ -20,7 +18,7 @@
 #                         "bad phi" regions with TG3 cells missing
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #############################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwLayers.py b/Calorimeter/CaloClusterCorrection/python/CaloSwLayers.py
index 2cd29dfdad21..744e67b20dc0 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwLayers.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwLayers.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwLayers.py,v 1.7 2009-03-16 12:28:40 lcarmina Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwLayers.py
 # Created: Nov 2006, sss
@@ -24,15 +22,17 @@
 # are recalculated based on these cells.
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_NOPOOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 import string
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-cls = CaloClusterCorrectionConf.CaloFillRectangularCluster
+cls = CompFactory.CaloFillRectangularCluster # CaloClusterCorrection
 CaloSwLayers_versions = [
     ['wt', cls, ['CaloSwLayers.CaloSwLayersWt_parms', CALOCORR_NOPOOL]],
     ['',   cls, ['CaloSwLayers.CaloSwLayers_parms',   CALOCORR_NOPOOL]],
@@ -41,6 +41,7 @@ CaloSwLayers_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -61,7 +62,8 @@ CaloSwLayers_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwLayers (name = None,
+def make_CaloSwLayers (flags,
+                       name = None,
                        suffix = None,
                        version = None,
                        key = CALOCORR_DEFAULT_KEY,
@@ -70,10 +72,11 @@ def make_CaloSwLayers (name = None,
                        cells_name = None,
                        **kw):
 
-    if cells_name != None:
+    if cells_name is not None:
         kw['cells_name'] = cells_name
 
-    return makecorr (versions = CaloSwLayers_versions,
+    return makecorr (flags,
+                     versions = CaloSwLayers_versions,
                      name = name,
                      basename = 'layers',
                      suffix = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights.py b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights.py
index 443981133b88..652b51e01b25 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwLongWeights.py,v 1.10 2009-04-22 17:26:22 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwLongWeights.py
 # Created: Nov 2006, sss
@@ -24,15 +22,17 @@
 #
 
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import sw_valid_keys as keys
-cls = CaloClusterCorrectionConf.CaloSwLongWeights
+from CaloClusterCorrection.constants import sw_valid_keys as keys
+cls = CompFactory.CaloSwLongWeights # CaloClusterCorrection
 CaloSwLongWeights_versions = [
 
     # From SP and KL.  The original version.
@@ -93,13 +93,14 @@ CaloSwLongWeights_versions = [
     ['atlfast_v1', cls,
      ['CaloSwLongWeights_atlfast_v1.CaloSwLongWeights_atlfast_v1_parms',
       'caloswcorr_pool', CALOCORR_COOL], keys],
-	  		  
+                          
 
     ]
 
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -117,7 +118,8 @@ CaloSwLongWeights_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwLongWeights (name = None,
+def make_CaloSwLongWeights (flags,
+                            name = None,
                             suffix = None,
                             version = None,
                             key = CALOCORR_DEFAULT_KEY,
@@ -125,7 +127,8 @@ def make_CaloSwLongWeights (name = None,
                             confclass = None,
                             **kw):
     # Make the tool.
-    return makecorr (versions  = CaloSwLongWeights_versions,
+    return makecorr (flags,
+                     versions  = CaloSwLongWeights_versions,
                      name      = name,
                      basename  = 'lwc',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_904.py b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_904.py
index 3b505a08bd46..37507dd56811 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_904.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_904.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwLongWeights_904.py,v 1.1 2006-11-10 03:47:27 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwLongWeights_904.py
 # Created: Nov 2006, sss
@@ -12,7 +10,7 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 # Stathes's weights from 9.0.4 MC, 5x5 cluster size.
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_atlfast_v1.py b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_atlfast_v1.py
index 6b64413642f5..2a9dcf1ade6b 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_atlfast_v1.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_atlfast_v1.py
@@ -1,4 +1,4 @@
-# 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: CaloClusterCorrection/python/CaloSwLongWeights_atlfast_v1.py
@@ -10,7 +10,7 @@
 # 
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 # 5x5 cluster size electrons.
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_old.py b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_old.py
index 9705fdb4edc2..e899b20f7181 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_old.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_old.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwLongWeights_old.py,v 1.3 2008-01-25 04:14:21 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwLongWeights_old.py
 # Created: Nov 2006, sss
@@ -21,7 +19,7 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 # The old layer weights corrections, that were used in release 9 + 10.0.0.
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_pi0_v1.py b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_pi0_v1.py
index 392bc7b3a13f..64ad8ce4d8db 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_pi0_v1.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_pi0_v1.py
@@ -1,4 +1,4 @@
-# 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: CaloClusterCorrection/python/CaloSwLongWeights_pi0v1.py
 # Created:  Feb 2010  GU
@@ -8,7 +8,7 @@
 #  should be applied to low energy 3x5 seeded by EM topo
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 #######################################################################
 #######################################################################
 # 3x5 cluster size photons.
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v3.py b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v3.py
index 1d6955eacfe5..dff4e2a208b2 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v3.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v3.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwLongWeights_v3.py,v 1.2 2006-11-10 03:47:27 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwLongWeights_v3.py
 # Created: Nov 2006, sss
@@ -21,7 +19,7 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 # 5x5 cluster size electrons.
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v4.py b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v4.py
index f4b9014f933a..5a8114337536 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v4.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v4.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwLongWeights_v4.py,v 1.3 2008-01-25 04:14:21 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwLongWeights_v3.py
 # Created: Nov 2006, sss
@@ -18,7 +16,7 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 # 5x5 cluster size electrons.
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v5.py b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v5.py
index 01827c1d3e5f..b5a6d9831795 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v5.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v5.py
@@ -1,4 +1,4 @@
-# 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: CaloClusterCorrection/python/CaloSwLongWeights_v5.py
 # Created: July 2008, NK, SP
@@ -7,7 +7,7 @@
 # These corrections were derived by Nicolas Kerschen and Stathes Paganis
 # The geometry is ATLAS-CSC-05-00-00
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #######################################################################
 # 5x5 cluster size electrons.
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v6.py b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v6.py
index 8c3979d08824..7e13a7f0a79f 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v6.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwLongWeights_v6.py
@@ -1,4 +1,4 @@
-# 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: CaloClusterCorrection/python/CaloSwLongWeights_v6.py
 # Created: July 2008, NK, SP
@@ -8,7 +8,7 @@
 # The geometry is ATLAS-CSC-05-00-00
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 #######################################################################
 # 5x5 cluster size electrons.
 CaloSwLongWeights_v6_ele55 = [
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod.py b/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod.py
index b2db0c038067..d446d273b895 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwPhimod.py,v 1.8 2008-01-25 04:14:21 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwPhimod.py
 # Created: Nov 2006, sss
@@ -42,16 +40,18 @@
 #
 
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import sw_valid_keys as keys
-cls_g3 = CaloClusterCorrectionConf.CaloSwPhimod_g3
-cls_v2 = CaloClusterCorrectionConf.CaloSwPhimod_v2
+from CaloClusterCorrection.constants import sw_valid_keys as keys
+cls_g3 = CompFactory.CaloSwPhimod_g3  # CaloClusterCorrection
+cls_v2 = CompFactory.CaloSwPhimod_v2  # CaloClusterCorrection
 CaloSwPhimod_versions = [
 
     # The original G3-based correction, translated from the
@@ -88,6 +88,7 @@ CaloSwPhimod_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -105,7 +106,8 @@ CaloSwPhimod_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwPhimod (name = None,
+def make_CaloSwPhimod (flags,
+                       name = None,
                        suffix = None,
                        version = None,
                        key = CALOCORR_DEFAULT_KEY,
@@ -113,7 +115,8 @@ def make_CaloSwPhimod (name = None,
                        confclass = None,
                        **kw):
     # Make the tool.
-    return makecorr (versions  = CaloSwPhimod_versions,
+    return makecorr (flags,
+                     versions  = CaloSwPhimod_versions,
                      name      = name,
                      basename  = 'phimod',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod_v2.py b/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod_v2.py
index 7dec6e6eec26..16a921d17cb8 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod_v2.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod_v2.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwPhimod_v2.py,v 1.1 2006-11-14 14:51:28 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwPhimod_v2.py
 # Created: Nov 2006, sss
@@ -26,9 +24,9 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 from AthenaCommon.SystemOfUnits import GeV
-from CaloClusterCorrection.CaloSwEtaphimod_v2_rfac import *
+from CaloClusterCorrection.CaloSwEtaphimod_v2_rfac import CaloSwEtaphimod_v2_rfac
 
 # Energies at which corrections were tabulated.
 CaloSw_sample_energies = [50*GeV, 100*GeV, 200*GeV]
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod_v4.py b/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod_v4.py
index cca1cf110147..3733358c6ead 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod_v4.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod_v4.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwPhimod_v4.py,v 1.1 2006-11-20 03:18:40 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwPhimod_v4.py
 # Created: Nov 2006, sss
@@ -15,7 +13,7 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 from AthenaCommon.SystemOfUnits import GeV
 
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod_v4data.py b/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod_v4data.py
index 9f878db6b1cc..e3af7d150598 100644
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod_v4data.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwPhimod_v4data.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id$
 #
 # File: CaloClusterCorrection/python/CaloSwPhimod_v4_data.py
 # Created: Sep 2010, sss
@@ -20,7 +18,6 @@
 # this correction identical under a phi -> -phi transformation.
 #
 
-from CaloClusterCorrection.common import *
 from CaloClusterCorrection.CaloSwPhimod_v4 import CaloSwPhimod_v4_parms
 
 
@@ -39,6 +36,7 @@ def _flip_phi (corr):
     
 def _copy_parms (src, dst):
     for (k, v) in src.__dict__.items():
+        if k[0] == '_': continue
         if k == 'correction':
             v = _flip_phi (v)
         setattr (dst, k, v)
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff.py b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff.py
index 325394b1d741..f24a627febbb 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwPhioff.py,v 1.7 2007-10-17 21:05:52 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwPhioff.py
 # Created: Nov 2006, sss
@@ -17,15 +15,17 @@
 #
 
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import sw_valid_keys as keys
-cls = CaloClusterCorrectionConf.CaloSwPhioff_v2
+from CaloClusterCorrection.constants import sw_valid_keys as keys
+cls = CompFactory.CaloSwPhioff_v2  # CaloClusterCorrection
 CaloSwPhioff_versions = [
 
     # The original G3-based correction, translated from the
@@ -72,6 +72,7 @@ CaloSwPhioff_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  SAMPLING is the calorimeter sampling (EMB1, EMB2, EME1, EME2) to which
 #   this correction will be applied.
 #  NAME is the base name for this tool.  If defaulted, a name will
@@ -91,7 +92,8 @@ CaloSwPhioff_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwPhioff (sampling,
+def make_CaloSwPhioff (flags,
+                       sampling,
                        name = None,
                        suffix = None,
                        version = None,
@@ -100,7 +102,8 @@ def make_CaloSwPhioff (sampling,
                        confclass = None,
                        **kw):
     # Make the tool.
-    return makecorr (versions  = CaloSwPhioff_versions,
+    return makecorr (flags,
+                     versions  = CaloSwPhioff_versions,
                      name      = name,
                      basename  = 'phioff',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_g3.py b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_g3.py
index 75dbd1e9fdb1..927496acc0f5 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_g3.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_g3.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwPhioff_g3.py,v 1.2 2006-11-16 07:07:45 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwPhioff_g3.py
 # Created: Nov 2006, sss
@@ -12,7 +10,8 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import \
+     CALOCORR_EMB2, CALOCORR_EME2, EMB2, EME2
 
 
 #############################################################################
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v2.py b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v2.py
index f7e7d1a7e419..8e6439c3a03e 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v2.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v2.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwPhioff_v2.py,v 1.2 2006-11-16 07:07:45 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwPhioff_v2.py
 # Created: Nov 2006, sss
@@ -14,7 +12,8 @@
 # This was added in LArClusterRec-02-05-12, in 8.6.0.
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import \
+     CALOCORR_EMB2, CALOCORR_EME2, EMB2, EME2
 from AthenaCommon.SystemOfUnits import GeV
 import math
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v3.py b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v3.py
index 6808861c5923..ae801d6a27ae 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v3.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v3.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwPhioff_v3.py,v 1.6 2008-01-25 04:14:21 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwPhioff_v3.py
 # Created: Nov 2006, sss
@@ -13,8 +11,8 @@
 # This correction was in CaloClusterCorrection-00-02-58, in 12.0.3.
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import \
+     CALOCORR_EMB2, CALOCORR_EME2, EMB2, EME2
 from AthenaCommon.SystemOfUnits import GeV
 
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v4.py b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v4.py
index 7d8984e038cc..41035a94fc32 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v4.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v4.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwPhioff_v4.py,v 1.2 2008-01-25 04:14:21 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwPhioff_v4.py
 # Created: Nov 2006, sss
@@ -13,8 +11,8 @@
 # This correction was in CaloClusterCorrection-xxx, in 12.0.4.
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import \
+     CALOCORR_EMB2, CALOCORR_EME2, EMB2, EME2
 from AthenaCommon.SystemOfUnits import GeV
 
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v4data.py b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v4data.py
index 9549b451043b..7e79a85ead51 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v4data.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v4data.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id$
 #
 # File: CaloClusterCorrection/python/CaloSwPhioff_v4_data.py
 # Created: Sep 2010, sss
@@ -14,7 +12,7 @@
 # in the barrel.
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import EME2, EMB2
 from CaloClusterCorrection.CaloSwPhioff_v4 import \
      CaloSwPhioff_v4_b2_parms, CaloSwPhioff_v4_e2_parms
 
@@ -33,6 +31,7 @@ def _flip_phi (corr):
     
 def _copy_parms (src, dst):
     for (k, v) in src.__dict__.items():
+        if k[0] == '_': continue
         if k == 'correction':
             v = _flip_phi (v)
         setattr (dst, k, v)
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v5.py b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v5.py
index 8998397e10ba..52cb5548bf1a 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v5.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v5.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwPhioff_v5.py,v 1.2 2013-11-30 ehill
 #
 # File: CaloClusterCorrection/python/CaloSwPhioff_v5.py
 # Created: Nov 2013, Ewan Hill
@@ -13,8 +11,8 @@
 # This correction was in CaloClusterCorrection-xxx, in ??????.
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import \
+     CALOCORR_EMB2, CALOCORR_EME2, EMB2, EME2
 from AthenaCommon.SystemOfUnits import GeV
 
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v5data.py b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v5data.py
index 6a11bc7ed176..82a3bd565073 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v5data.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwPhioff_v5data.py
@@ -12,7 +12,7 @@
 # in the barrel.
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import EMB2, EME2
 from CaloClusterCorrection.CaloSwPhioff_v5 import \
      CaloSwPhioff_v5_b2_parms, CaloSwPhioff_v5_e2_parms
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwRfac.py b/Calorimeter/CaloClusterCorrection/python/CaloSwRfac.py
index cfa848526e1a..eda1ca2c0543 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwRfac.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwRfac.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwRfac.py,v 1.8 2008-01-25 04:14:21 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwRfac.py
 # Created: Nov 2006, sss
@@ -28,15 +26,17 @@
 #
 
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import sw_valid_keys as keys
-cls = CaloClusterCorrectionConf.CaloScaleCluster
+from CaloClusterCorrection.constants import sw_valid_keys as keys
+cls = CompFactory.CaloScaleCluster  # CaloClusterCorrection
 CaloSwRfac_versions = [
     # From 11.0.41 simulation and 12.0.0 reconstruction.
     # In CaloClusterCorrection-00-02-38, 12.0.0.
@@ -64,6 +64,7 @@ CaloSwRfac_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -81,7 +82,8 @@ CaloSwRfac_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwRfac (name = None,
+def make_CaloSwRfac (flags,
+                     name = None,
                      suffix = None,
                      version = None,
                      key = CALOCORR_DEFAULT_KEY,
@@ -89,7 +91,8 @@ def make_CaloSwRfac (name = None,
                      confclass = None,
                      **kw):
     # Make the tool.
-    return makecorr (versions  = CaloSwRfac_versions,
+    return makecorr (flags,
+                     versions  = CaloSwRfac_versions,
                      name      = name,
                      basename  = 'rfac',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwRfac_v3.py b/Calorimeter/CaloClusterCorrection/python/CaloSwRfac_v3.py
index 0b7b13309170..acf607369dac 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwRfac_v3.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwRfac_v3.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwRfac_v3.py,v 1.4 2006-11-10 03:47:27 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwRfac_v3.py
 # Created: Nov 2006, sss
@@ -11,7 +9,7 @@
 # E=100 GeV electrons/photons were used.
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #
 # The correction is tabulated as a function of eta separately for
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwRfac_v4.py b/Calorimeter/CaloClusterCorrection/python/CaloSwRfac_v4.py
index 16279a5cac73..24656e0bb1c1 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwRfac_v4.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwRfac_v4.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwRfac_v4.py,v 1.1 2006-11-10 03:47:27 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwRfac_v4.py
 # Created: Nov 2006, sss
@@ -14,7 +12,7 @@
 # It was added in CaloClusterCorrection-00-02-61, in 12.0.4.
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #
 # The correction is tabulated as a function of eta separately for
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwRfac_v5.py b/Calorimeter/CaloClusterCorrection/python/CaloSwRfac_v5.py
index b0013c0185d8..796aa943cb32 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwRfac_v5.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwRfac_v5.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwRfac_v5.py 579330 2014-01-21 12:59:55Z ehill $
 #
 # File: CaloClusterCorrection/python/CaloSwRfac_v5.py
 # Created: Nov 2013, Ewan Hill
@@ -15,7 +13,7 @@
 # It was added in CaloClusterCorrection-00-??-??, in ??.?.?.
 #
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COMBINED2
 
 #
 # The correction is tabulated as a function of eta separately for
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwTime.py b/Calorimeter/CaloClusterCorrection/python/CaloSwTime.py
index 2fb6ea86f630..5e309587fff2 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwTime.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwTime.py
@@ -1,28 +1,32 @@
-# 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: CaloClusterCorrection/python/CaloSwTime.py
 # Created: May, 2008, M. Cooke
 # Purpose: Steering module for duplicate removal tool
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_NOPOOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
-cls = CaloClusterCorrectionConf.CaloSwTime
+cls = CompFactory.CaloSwTime  # CaloClusterCorrection
 CaloSwTime_versions = [
     ['',              cls,
      ['CaloSwTime.CaloSwTime_parms',
       CALOCORR_NOPOOL]],
     ]
 
-def make_CaloSwTime (name = None,
-                                      suffix = None,
-                                      version = None,
-                                      key = CALOCORR_DEFAULT_KEY,
-                                      source = None,
-                                      confclass = None,
-                                      **kw):
-    return makecorr (versions = CaloSwTime_versions,
+def make_CaloSwTime (flags,
+                     name = None,
+                     suffix = None,
+                     version = None,
+                     key = CALOCORR_DEFAULT_KEY,
+                     source = None,
+                     confclass = None,
+                     **kw):
+    return makecorr (flags,
+                     versions = CaloSwTime_versions,
                      name = name,
                      basename = 'time',
                      suffix = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr.py b/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr.py
index afffaa75cb12..ee4c86e9272e 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwTransitionRegionsCorr.py,v 1.5 2009-04-22 17:26:22 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwTransitionRegionsCorr.py
 # Created: Dec, 2007, L. Carminati
@@ -15,15 +13,17 @@
 #
 
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import sw_valid_keys as keys
-cls = CaloClusterCorrectionConf.CaloSwTransitionRegionsCorr
+from CaloClusterCorrection.constants import sw_valid_keys as keys
+cls = CompFactory.CaloSwTransitionRegionsCorr  # CaloClusterCorrection
 CaloSwTransitionRegionsCorr_versions = [
 
     # 12.0.3 simulation and reconstruction, with ideal (calib0) geometry.
@@ -45,6 +45,7 @@ CaloSwTransitionRegionsCorr_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -61,16 +62,18 @@ CaloSwTransitionRegionsCorr_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloSwTransitionRegionsCorr (name = None,
-                    suffix = None,
-                    version = None,
-                    key = CALOCORR_DEFAULT_KEY,
-                    source = None,
-                    confclass = None,
-                    **kw):
+def make_CaloSwTransitionRegionsCorr (flags,
+                                      name = None,
+                                      suffix = None,
+                                      version = None,
+                                      key = CALOCORR_DEFAULT_KEY,
+                                      source = None,
+                                      confclass = None,
+                                      **kw):
 
     # Make the tool.
-    return makecorr (versions  = CaloSwTransitionRegionsCorr_versions,
+    return makecorr (flags,
+                     versions  = CaloSwTransitionRegionsCorr_versions,
                      name      = name,
                      basename  = 'trcorr',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr_v1.py b/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr_v1.py
index 8d68c830cb46..8affb74ab1e6 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr_v1.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr_v1.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwTransitionRegionsCorr_v1.py,v 1.2 2008-01-25 04:14:21 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwTransitionRegionCorr_v1.py
 # Created: Dec, 2007, L. Carminati
@@ -9,7 +7,7 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_CLUSTER
 
 #############################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr_v5.py b/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr_v5.py
index b27bcd795dae..be28e9a6e2dc 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr_v5.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr_v5.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwTransitionRegionsCorr_v5.py,v 1.2 2008-07-29 15:45:02 lcarmina Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwTransitionRegionCorr_v5.py
 # Created: Dec, 2007, L. Carminati
@@ -9,7 +7,7 @@
 #
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_CLUSTER
 
 #############################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr_v5_1.py b/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr_v5_1.py
index dc9bdc4741ae..b91ef34650c8 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr_v5_1.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloSwTransitionRegionsCorr_v5_1.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloSwTransitionRegionsCorr_v5_1.py,v 1.1 2009-03-05 08:44:06 lcarmina Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwTransitionRegionCorr_v5_1.py
 # Created: Dec, 2007, L. Carminati
@@ -10,7 +8,7 @@
 #          This version implement some fixes for eta=0 and eta=0.8 
 
 
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_CLUSTER
 
 #############################################################################
 
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMClusterUpdate.py b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMClusterUpdate.py
index 59eacb6e3439..8dc31d245972 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMClusterUpdate.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMClusterUpdate.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloTopoEMClusterUpdate.py,v 1.3 2009-04-25 17:57:00 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloTopoEMClusterUpdate.py
 # Created: Nov 2006, sss
@@ -15,15 +13,17 @@
 # leaves the total cluster energy unchanged.
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_EMTOPO
+from CaloClusterCorrection.common import makecorr
 
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-cls = CaloClusterCorrectionConf.CaloClusterUpdate
+cls = CompFactory.CaloClusterUpdate  # CaloClusterCorrection
 CaloTopoEMClusterUpdate_versions = [
     # This version doesn't recalculate the total cluster energy.
     ['dont_update_e', cls,
@@ -39,6 +39,7 @@ CaloTopoEMClusterUpdate_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -56,14 +57,16 @@ CaloTopoEMClusterUpdate_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloTopoEMClusterUpdate (name = None,
+def make_CaloTopoEMClusterUpdate (flags,
+                                  name = None,
                                   suffix = None,
                                   version = None,
                                   key = CALOCORR_DEFAULT_KEY,
                                   source = None,
                                   confclass = None,
                                   **kw):
-    return makecorr (versions = CaloTopoEMClusterUpdate_versions,
+    return makecorr (flags,
+                     versions = CaloTopoEMClusterUpdate_versions,
                      name = name,
                      basename = 'larupdate',
                      suffix = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMCorrections.py b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMCorrections.py
index 0daad8ca803c..3670202000d4 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMCorrections.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMCorrections.py
@@ -1,20 +1,18 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloTopoEMCorrections.py,v 1.16 2009-04-30 20:29:53 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloSwCorrections.py
 # Created: Mar 2007, sss
 # Purpose: Top-level configuration file for EM topo cluster corrections.
 #
-# The main entry point here is make_CaloTopoEMCorrections, which returns
+# The main entry point here is make_CaloTopoEMCorrectionsCfg, which returns
 # a list of correction tools.  It can be used either `le menu' --- selecting
 # a predefined list of correction tools, or `a la carte' --- explicitly
 # specifying the list of tools you want to run.
 #
 # The simplest way of using it is like this:
 #
-#   make_CaloTopoEMCorrections (key)
+#   make_CaloTopoEMCorrectionsCfg (flags, key)
 #
 # Here, `key' is a string that denotes the type of cluster which you
 # are correcting.  It should be something like `ele420' for 4-2-0 electrons,
@@ -28,7 +26,7 @@
 # By default, the latest version of the corrections appropriate to the
 # geometry being used will be chosen.  You can override this selection
 # by supplying the `version' argument.  It may also be overridden
-# with caloClusterCorrectionFlags.CaloTopoEMWhichCorrection.
+# with Calo.ClusterCorrection.CaloTopoEMWhichCorrection.
 # For the list of known version
 # names, see the variable `CaloTopoEMCorrection_versions' below.
 # In particular, using version `none' turns off the corrections.
@@ -38,7 +36,7 @@
 # the version to be used for individual correction by adding
 # parameters of the form CORRECTION_version.  For example:
 #
-#   make_CaloTopoEMCorrections (key, version='v4', lwc_version='v3')
+#   make_CaloTopoEMCorrectionsCfg (flags, key, version='v4', lwc_version='v3')
 #
 # uses the `v4' corrections, except that we use version `v3' of the
 # layer weight corrections.  You can also specify CORRECTION_key
@@ -46,7 +44,7 @@
 # and CORRECTION_XXX to override any individual parameter
 # of a correction.  For example:
 #
-#   make_CaloTopoEMCorrections (key, lwc_degree=2)
+#   make_CaloTopoEMCorrectionsCfg (flags, key, lwc_degree=2)
 #
 # makes the full standard set of corrections, except that the interpolation
 # degree for the layer weights correction is changed to 2.
@@ -54,13 +52,13 @@
 # You can explicitly specify a list of corrections to run with the
 # `corrlist' argument.  For example,
 #
-#   make_CaloTopoEMCorrections (key, corrlist=[[layers], [update], [gap]])
+#   make_CaloTopoEMCorrectionsCfg (flags, key, corrlist=[[layers], [update], [gap]])
 #
 # runs only the `layers', `update', and `gap' corrections.  The names
 # used here, like `layers' should be functions defined with this
 # signature:
 #
-#    def layers (cells_name, suffix, version, key, source, **kw):
+#    def layers (flags, cells_name, suffix, version, key, source, **kw):
 #
 # Definitions for all the standard corrections are contained in this file.
 # Note that the names of these functions are what are used to recognize
@@ -80,17 +78,18 @@
 # settings may be specified as following (name, value) tuples
 # in the list.  For example:
 #
-#   make_CaloTopoEMCorrections (key, corrlist=[[layers],
-#                                              [update],
-#                                              [gap, 'v3', ('degree', 2)]])
+#   make_CaloTopoEMCorrectionsCfg (flags,
+#                                  key, corrlist=[[layers],
+#                                                 [update],
+#                                                 [gap, 'v3', ('degree', 2)]])
 #
 # says to use version `v3' of the gap correction, and in addition,
 # to override the interpolation degree to be 2.
 #
 # There are three ways in which a correction can get configured: from
 # job options, from pool, or from cool.  You can specify which ones
-# to use by adding the `source' argument to make_CaloTopoEMCorrections.
-# This is one of the following (defined in common.py):
+# to use by adding the `source' argument to make_CaloTopoEMCorrectionsCfg.
+# This is one of the following (defined in constants.py):
 #
 #  - CALOCORR_JO: Configure from job options
 #  - CALOCORR_POOL: Configure from a pool file
@@ -101,7 +100,7 @@
 #
 # This parameter may be specified as a list of any of these values; in that
 # case, all the possibilities will be tried in order.  The default is taken
-# from caloClusterCorrectionFlags.DefaultSource
+# from Calo.ClusterCorrection.defaultSource
 # if it hasn't been explicitly set.  The usual setting is to try first
 # cool, then pool, then job options.  (Note that there are a couple
 # corrections which are not saved to pool/cool and can thus only
@@ -114,22 +113,33 @@
 # with a string of the form `MODULE.NAME'.
 #
 
-import sys
-from CaloClusterCorrection.CaloTopoEMmoments  import make_CaloTopoEMmoments
-from CaloClusterCorrection.CaloTopoEMlayers   import make_CaloTopoEMlayers
-from CaloClusterCorrection.CaloTopoEMetaoff   import make_CaloTopoEMetaoff
-from CaloClusterCorrection.CaloTopoEMetaoffSW import make_CaloTopoEMetaoffSW
-from CaloClusterCorrection.CaloTopoEMphioff   import make_CaloTopoEMphioff
-from CaloClusterCorrection.CaloTopoEMphimod   import make_CaloTopoEMphimod
-from CaloClusterCorrection.CaloTopoEMClusterUpdate \
-     import make_CaloTopoEMClusterUpdate
-from CaloClusterCorrection.CaloTopoEMgap      import make_CaloTopoEMgap
-from CaloClusterCorrection.CaloClusterListBadChannel   import make_CaloClusterListBadChannel
-from CaloClusterCorrection.CaloTopoEMlongWeights \
-     import make_CaloTopoEMlongWeights
-from CaloClusterCorrection.common import *
-from CaloClusterCorrection.CaloClusterCorrectionFlags \
-     import caloClusterCorrectionFlags
+# Need to be sure that we always get run3 configurables in the imported
+# steering modules.
+from AthenaCommon.Configurable import Configurable
+
+try:
+    _wasRun3 = Configurable.configurableRun3Behavior
+    Configurable.configurableRun3Behavior = True
+
+    from CaloClusterCorrection.CaloTopoEMmoments  import make_CaloTopoEMmoments
+    from CaloClusterCorrection.CaloTopoEMlayers   import make_CaloTopoEMlayers
+    from CaloClusterCorrection.CaloTopoEMetaoff   import make_CaloTopoEMetaoff
+    from CaloClusterCorrection.CaloTopoEMetaoffSW import make_CaloTopoEMetaoffSW
+    from CaloClusterCorrection.CaloTopoEMphioff   import make_CaloTopoEMphioff
+    from CaloClusterCorrection.CaloTopoEMphimod   import make_CaloTopoEMphimod
+    from CaloClusterCorrection.CaloTopoEMClusterUpdate \
+         import make_CaloTopoEMClusterUpdate
+    from CaloClusterCorrection.CaloTopoEMgap      import make_CaloTopoEMgap
+    from CaloClusterCorrection.CaloClusterListBadChannel   import make_CaloClusterListBadChannel
+    from CaloClusterCorrection.CaloTopoEMlongWeights \
+         import make_CaloTopoEMlongWeights
+    from CaloClusterCorrection.constants         import CALOCORR_EMTOPO, EMB1, EME1
+    from CaloClusterCorrection.common            import CaloClusterCorrSetup
+    from CaloClusterCorrection.compat            import makeFlags, unpackCA
+
+finally:
+    Configurable.configurableRun3Behavior = _wasRun3
+    
      
 
 
@@ -138,43 +148,43 @@ from CaloClusterCorrection.CaloClusterCorrectionFlags \
 # In the case where a correction has multiple versions for different
 # samplings, we define multiple wrappers here.
 # These are the names to use in the correction list and in the
-# arguments to make_CaloTopoEMCorrection.
+# arguments to make_CaloTopoEMCorrectionCfg.
 #
 
-def moments (cells_name, *args, **kw):
-    return make_CaloTopoEMmoments (None, *args, **kw)
+def moments (flags, cells_name, *args, **kw):
+    return make_CaloTopoEMmoments (flags, None, *args, **kw)
 
-def layers (cells_name, *args, **kw):
-    return make_CaloTopoEMlayers (None, cells_name=cells_name, *args, **kw)
+def layers (flags, cells_name, *args, **kw):
+    return make_CaloTopoEMlayers (flags, None, cells_name=cells_name, *args, **kw)
 
-def etaoff_sw_b1 (cells_name, *args, **kw):
-    return make_CaloTopoEMetaoffSW (EMB1, None, *args, **kw)
+def etaoff_sw_b1 (flags, cells_name, *args, **kw):
+    return make_CaloTopoEMetaoffSW (flags, EMB1, None, *args, **kw)
 
-def etaoff_sw_e1 (cells_name, *args, **kw):
-    return make_CaloTopoEMetaoffSW (EME1, None, *args, **kw)
+def etaoff_sw_e1 (flags, cells_name, *args, **kw):
+    return make_CaloTopoEMetaoffSW (flags, EME1, None, *args, **kw)
 
 # Eta offset in sampling 2.
-def etaoff_2 (cells_name, *args, **kw):
-    return make_CaloTopoEMetaoff (None, *args, **kw)
+def etaoff_2 (flags, cells_name, *args, **kw):
+    return make_CaloTopoEMetaoff (flags, None, *args, **kw)
 
 # Phi offset in sampling 2.
-def phioff (cells_name, *args, **kw):
-    return make_CaloTopoEMphioff (None, *args, **kw)
+def phioff (flags, cells_name, *args, **kw):
+    return make_CaloTopoEMphioff (flags, None, *args, **kw)
 
-def phimod (cells_name, *args, **kw):
-    return make_CaloTopoEMphimod (None, *args, **kw)
+def phimod (flags, cells_name, *args, **kw):
+    return make_CaloTopoEMphimod (flags, None, *args, **kw)
 
-def update (cells_name, *args, **kw):
-    return make_CaloTopoEMClusterUpdate (None, *args, **kw)
+def update (flags, cells_name, *args, **kw):
+    return make_CaloTopoEMClusterUpdate (flags, None, *args, **kw)
 
-def lwc (cells_name, *args, **kw):
-    return make_CaloTopoEMlongWeights (None, *args, **kw)
+def lwc (flags, cells_name, *args, **kw):
+    return make_CaloTopoEMlongWeights (flags, None, *args, **kw)
 
-def gap (cells_name, *args, **kw):
-    return make_CaloTopoEMgap (None, *args, **kw)
+def gap (flags, cells_name, *args, **kw):
+    return make_CaloTopoEMgap (flags, None, *args, **kw)
 
-def listBadChannel (cells_name, *args, **kw):
-    return make_CaloClusterListBadChannel (CALOCORR_EMTOPO, None, *args, **kw)
+def listBadChannel (flags, cells_name, *args, **kw):
+    return make_CaloClusterListBadChannel (flags, CALOCORR_EMTOPO, None, *args, **kw)
 
 
 ##############################################################################
@@ -185,8 +195,8 @@ def listBadChannel (cells_name, *args, **kw):
 class CaloTopoEMCorrectionsSetup (CaloClusterCorrSetup):
 
     name = "EM topo"
-    version_override_flag= caloClusterCorrectionFlags.CaloTopoEMWhichCorrection
-    correction_generation_flag= caloClusterCorrectionFlags.CaloTopoEMGeneration
+    version_override_flag_name = 'caloTopoEMWhichCorrection'
+    correction_generation_flag_name = 'caloTopoEMGeneration'
     correction_generation_default = "00-02-00"
 
     ##########################################################################
@@ -289,13 +299,12 @@ class CaloTopoEMCorrectionsSetup (CaloClusterCorrSetup):
 
 
     # Handle CaloTopoEMCorrectionArgs.
-    def make_corrections (self, **kw_in):
+    def make_corrections (self, flags, **kw_in):
         kw = {}
-        if caloClusterCorrectionFlags.CaloTopoEMCorrectionArgs.statusOn:
-            kw = caloClusterCorrectionFlags.CaloTopoEMCorrectionArgs().copy()
+        kw = flags.Calo.ClusterCorrection.caloTopoEMCorrectionArgs
         kw.update (kw_in)
 
-        return CaloClusterCorrSetup.make_corrections (self, **kw)
+        return CaloClusterCorrSetup.make_corrections (self, flags, **kw)
 
 
 CaloTopoEMCorrections = CaloTopoEMCorrectionsSetup()
@@ -305,6 +314,45 @@ CaloTopoEMCorrections = CaloTopoEMCorrectionsSetup()
 # Main entry point to create a list of correction tools.
 #
 
+#
+# Create and return a CA of correction tools.
+# FLAGS are the configuration flags.
+# KEY is a string that specifies the correction type.
+# SUFFIX is a string to add to the end of each tool name.
+# VERSION specifies which version of corrections to use.
+# CORRLIST can be used to explicitly specify which corrections to run.
+# CELLS_NAME is the SG key to use to find the calorimeter cells,
+# for those corrections that require it.
+# SOURCE specifies the source(s) from which tools are configured.
+# See above for details.
+# None means to use the default.
+#
+# For more detailed information, see the comments at the start of this file.
+#
+def make_CaloTopoEMCorrectionsCfg (flags,
+                                   key = None,
+                                   suffix = '',
+                                   version = None,
+                                   corrlist = None,
+                                   cells_name = None,
+                                   source = None,
+                                   **kw):
+    return CaloTopoEMCorrections.make_corrections (flags,
+                                                   corrclass = CALOCORR_EMTOPO,
+                                                   key = key,
+                                                   suffix = suffix,
+                                                   version = version,
+                                                   corrlist = corrlist,
+                                                   cells_name = cells_name,
+                                                   source = source,
+                                                   **kw)
+
+
+##############################################################################
+# Backwards compatibility:
+# Main entry point to create a list of correction tools (old configuration)
+#
+
 #
 # Create and return a list of correction tools.
 # KEY is a string that specifies the correction type.
@@ -326,11 +374,18 @@ def make_CaloTopoEMCorrections (key = None,
                                 cells_name = None,
                                 source = None,
                                 **kw):
-    return CaloTopoEMCorrections.make_corrections (corrclass = CALOCORR_EMTOPO,
-                                                   key = key,
-                                                   suffix = suffix,
-                                                   version = version,
-                                                   corrlist = corrlist,
-                                                   cells_name = cells_name,
-                                                   source = source,
-                                                   **kw)
+    try:
+        wasRun3 = Configurable.configurableRun3Behavior
+        Configurable.configurableRun3Behavior = True
+        ca = CaloTopoEMCorrections.make_corrections (makeFlags(),
+                                                     corrclass = CALOCORR_EMTOPO,
+                                                     key = key,
+                                                     suffix = suffix,
+                                                     version = version,
+                                                     corrlist = corrlist,
+                                                     cells_name = cells_name,
+                                                     source = source,
+                                                     **kw)
+    finally:
+        Configurable.configurableRun3Behavior = wasRun3
+    return unpackCA (ca)
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMetaoff.py b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMetaoff.py
index 393cc904694c..f271f8fc17fe 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMetaoff.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMetaoff.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloTopoEMetaoff.py,v 1.4 2007-10-17 21:05:53 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloTopoEMetaoff.py
 # Created: Mar 2007, sss, from earlier job options.
@@ -9,15 +7,17 @@
 # for TopoEM clusters.
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_EMTOPO, CALOCORR_COMBINED2
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import topoem_valid_keys as keys
-cls = CaloClusterCorrectionConf.CaloTopoEMsshape
+from CaloClusterCorrection.constants import topoem_valid_keys as keys
+cls = CompFactory.CaloTopoEMsshape  # CaloClusterCorrection
 CaloTopoEMetaoff_versions = [
 
     # v1 --- from the original job options file.
@@ -29,6 +29,7 @@ CaloTopoEMetaoff_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -46,7 +47,8 @@ CaloTopoEMetaoff_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloTopoEMetaoff (name = None,
+def make_CaloTopoEMetaoff (flags,
+                           name = None,
                            suffix = None,
                            version = None,
                            key = CALOCORR_DEFAULT_KEY,
@@ -54,7 +56,8 @@ def make_CaloTopoEMetaoff (name = None,
                            confclass = None,
                            **kw):
     # Make the tool.
-    return makecorr (versions  = CaloTopoEMetaoff_versions,
+    return makecorr (flags,
+                     versions  = CaloTopoEMetaoff_versions,
                      name      = name,
                      basename  = 'topoetaoff',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMetaoffSW.py b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMetaoffSW.py
index a7f9d9c309de..1385ca4ae4af 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMetaoffSW.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMetaoffSW.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloTopoEMetaoffSW.py,v 1.1 2009-04-23 05:24:30 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloTopoEMetaoffSW.py
 # Created: Apr, 2009, sss
@@ -12,15 +10,17 @@
 # We need to get a copy of it under the topoem hierarchy.
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_EMTOPO
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import topoem_valid_keys as keys
-cls_v2 = CaloClusterCorrectionConf.CaloSwEtaoff_v2
+from CaloClusterCorrection.constants import topoem_valid_keys as keys
+cls_v2 = CompFactory.CaloSwEtaoff_v2   # CaloClusterCorrection
 CaloTopoEMetaoffSW_versions = [
 
     # Copied from SW.
@@ -35,6 +35,7 @@ CaloTopoEMetaoffSW_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  SAMPLING is the calorimeter sampling (EMB1, EMB2, EME1, EME2) to which
 #   this correction will be applied, or None.
 #  NAME is the base name for this tool.  If defaulted, a name will
@@ -54,7 +55,8 @@ CaloTopoEMetaoffSW_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloTopoEMetaoffSW (sampling,
+def make_CaloTopoEMetaoffSW (flags,
+                             sampling,
                              name = None,
                              suffix = None,
                              version = None,
@@ -63,7 +65,8 @@ def make_CaloTopoEMetaoffSW (sampling,
                              confclass = None,
                              **kw):
     # Make the tool.
-    return makecorr (versions  = CaloTopoEMetaoffSW_versions,
+    return makecorr (flags,
+                     versions  = CaloTopoEMetaoffSW_versions,
                      name      = name,
                      basename  = 'topoetaoffsw',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMgap.py b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMgap.py
index 0376ab066155..3d96931e5dba 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMgap.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMgap.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloTopoEMgap.py,v 1.5 2009-04-20 16:59:16 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloTopoEMgap.py
 # Created: Mar 2007, sss, from earlier job options.
@@ -9,15 +7,17 @@
 # for TopoEM clusters.
 #
 
-from CaloClusterCorrection        import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_EMTOPO, CALOCORR_CLUSTER
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import topoem_valid_keys as keys
-cls = CaloClusterCorrectionConf.CaloTopoEMGap
+from CaloClusterCorrection.constants import topoem_valid_keys as keys
+cls = CompFactory.CaloTopoEMGap   # CaloClusterCorrection
 CaloTopoEMgap_versions = [
 
     # v1 --- from the original DC3 job options file.
@@ -29,6 +29,7 @@ CaloTopoEMgap_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -46,7 +47,8 @@ CaloTopoEMgap_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloTopoEMgap (name = None,
+def make_CaloTopoEMgap (flags,
+                        name = None,
                         suffix = None,
                         version = None,
                         key = CALOCORR_DEFAULT_KEY,
@@ -54,7 +56,8 @@ def make_CaloTopoEMgap (name = None,
                         confclass = None,
                         **kw):
     # Make the tool.
-    return makecorr (versions  = CaloTopoEMgap_versions,
+    return makecorr (flags,
+                     versions  = CaloTopoEMgap_versions,
                      name      = name,
                      basename  = 'topogap',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMlayers.py b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMlayers.py
index d6d0e3def156..1b3fa90bd8af 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMlayers.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMlayers.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloTopoEMlayers.py,v 1.3 2007-10-19 15:13:05 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloTopoEMlayers.py
 # Created: Mar 2007, sss, from old job options.
@@ -13,14 +11,16 @@
 #
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_NOPOOL, CALOCORR_DEFAULT_KEY, CALOCORR_EMTOPO
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-cls = CaloClusterCorrectionConf.CaloTopoEMlayers
+cls = CompFactory.CaloTopoEMlayers  # CaloClusterCorrection
 CaloTopoEMlayers_versions = [
     ['',   cls, ['CaloTopoEMlayers.CaloTopoEMlayers_parms',  CALOCORR_NOPOOL]],
     ]
@@ -28,6 +28,7 @@ CaloTopoEMlayers_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -36,6 +37,7 @@ CaloTopoEMlayers_versions = [
 #  KEY is a string to specify the type of cluster to which the correction
 #   applies.  The convention is to use `ele55' for 5x5 electron clusters,
 #   `gam35' for 3x5 photon clusters, and so on.
+
 #  SOURCE tells from where we should read the calibration constants.
 #   See common.py for a description of the possibilities.
 #   None means to use the default.
@@ -48,7 +50,8 @@ CaloTopoEMlayers_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloTopoEMlayers (name = None,
+def make_CaloTopoEMlayers (flags,
+                           name = None,
                            suffix = None,
                            version = None,
                            key = CALOCORR_DEFAULT_KEY,
@@ -57,10 +60,11 @@ def make_CaloTopoEMlayers (name = None,
                            cells_name = None,
                            **kw):
 
-    if cells_name != None:
+    if cells_name is not None:
         kw['cells_name'] = cells_name
 
-    return makecorr (versions = CaloTopoEMlayers_versions,
+    return makecorr (flags,
+                     versions = CaloTopoEMlayers_versions,
                      name = name,
                      basename = 'layers',
                      suffix = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMlongWeights.py b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMlongWeights.py
index 839a7ed855af..11c339cdc49d 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMlongWeights.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMlongWeights.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloTopoEMlongWeights.py,v 1.5 2009-04-20 16:59:16 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloTopoEMlongWeights.py
 # Created: Mar 2007, sss, from earlier job options.
@@ -9,15 +7,17 @@
 # for TopoEM clusters.
 #
 
-from CaloClusterCorrection        import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import  \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_EMTOPO, CALOCORR_COMBINED2
+from CaloClusterCorrection.common import makecorr
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import topoem_valid_keys as keys
-cls = CaloClusterCorrectionConf.CaloTopoEMLongWeights
+from CaloClusterCorrection.constants import topoem_valid_keys as keys
+cls = CompFactory.CaloTopoEMLongWeights   # CaloClusterCorrection
 CaloTopoEMlongWeights_versions = [
 
     # v1 --- from the original DC3 job options file.
@@ -29,6 +29,7 @@ CaloTopoEMlongWeights_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -46,7 +47,8 @@ CaloTopoEMlongWeights_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloTopoEMlongWeights (name = None,
+def make_CaloTopoEMlongWeights (flags,
+                                name = None,
                                 suffix = None,
                                 version = None,
                                 key = CALOCORR_DEFAULT_KEY,
@@ -54,7 +56,8 @@ def make_CaloTopoEMlongWeights (name = None,
                                 confclass = None,
                                 **kw):
     # Make the tool.
-    return makecorr (versions  = CaloTopoEMlongWeights_versions,
+    return makecorr (flags,
+                     versions  = CaloTopoEMlongWeights_versions,
                      name      = name,
                      basename  = 'topolw',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMmoments.py b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMmoments.py
index 6d6c00be6f4d..a42b6ed47547 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMmoments.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMmoments.py
@@ -1,7 +1,5 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloTopoEMmoments.py,v 1.4 2008-12-04 08:05:51 menke Exp $
 #
 # File: CaloClusterCorrection/python/CaloTopoEMmoments.py
 # Created: Mar 2007, sss, from old job options.
@@ -12,8 +10,10 @@
 #
 #
 
-from CaloRec                      import CaloRecConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_NOPOOL, CALOCORR_DEFAULT_KEY, CALOCORR_EMTOPO
+from CaloClusterCorrection.common import makecorr
 from AthenaCommon.SystemOfUnits   import deg
 
 from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg
@@ -23,7 +23,7 @@ CaloNoiseCondAlg()
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-cls = CaloRecConf.CaloClusterMomentsMaker
+cls = CompFactory.CaloClusterMomentsMaker  # CaloRec
 CaloTopoEMmoments_versions = [
     ['',  cls, ['CaloTopoEMmoments.CaloTopoEMmoments_parms', CALOCORR_NOPOOL]],
     ]
@@ -31,6 +31,7 @@ CaloTopoEMmoments_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -48,7 +49,8 @@ CaloTopoEMmoments_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloTopoEMmoments (name = None,
+def make_CaloTopoEMmoments (flags,
+                            name = None,
                             suffix = None,
                             version = None,
                             key = CALOCORR_DEFAULT_KEY,
@@ -57,7 +59,8 @@ def make_CaloTopoEMmoments (name = None,
                             cells_name = None,
                             **kw):
 
-    return makecorr (versions = CaloTopoEMmoments_versions,
+    return makecorr (flags,
+                     versions = CaloTopoEMmoments_versions,
                      name = name,
                      basename = 'EMTopoMoments',
                      suffix = suffix,
@@ -99,23 +102,3 @@ class CaloTopoEMmoments_parms:
         ,"ENG_POS"
         ,"SIGNIFICANCE"
         ]
-
-    AODMomentsNames = [
-        "FIRST_PHI" 
-        ,"FIRST_ETA"
-        ,"SECOND_R" 
-        ,"SECOND_LAMBDA"
-        ,"CENTER_MAG"
-        ,"CENTER_LAMBDA"
-        ,"FIRST_ENG_DENS"
-        ,"SECOND_ENG_DENS"
-        ,"LATERAL"
-        ,"LONGITUDINAL"
-        ,"ENG_FRAC_MAX"
-        ,"ISOLATION"
-        ,"ENG_BAD_CELLS"
-        ,"N_BAD_CELLS"
-        ,"BADLARQ_FRAC"
-        ,"ENG_POS"
-        ,"SIGNIFICANCE"
-        ]
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMphimod.py b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMphimod.py
index 5410ef247727..0ea03817bd07 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMphimod.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMphimod.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloTopoEMphimod.py,v 1.4 2007-10-17 21:05:53 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloTopoEMphimod.py
 # Created: Mar 2007, sss, from earlier job options.
@@ -9,15 +7,18 @@
 # for TopoEM clusters.
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_EMTOPO, CALOCORR_COMBINED2
+from CaloClusterCorrection.common import makecorr
+     
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import topoem_valid_keys as keys
-cls = CaloClusterCorrectionConf.CaloTopoEMphimod
+from CaloClusterCorrection.constants import topoem_valid_keys as keys
+cls = CompFactory.CaloTopoEMphimod   # CaloClusterCorrection
 CaloTopoEMphimod_versions = [
 
     # v1 --- from the original job options file.
@@ -29,6 +30,7 @@ CaloTopoEMphimod_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -46,7 +48,8 @@ CaloTopoEMphimod_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloTopoEMphimod (name = None,
+def make_CaloTopoEMphimod (flags,
+                           name = None,
                            suffix = None,
                            version = None,
                            key = CALOCORR_DEFAULT_KEY,
@@ -54,7 +57,8 @@ def make_CaloTopoEMphimod (name = None,
                            confclass = None,
                            **kw):
     # Make the tool.
-    return makecorr (versions  = CaloTopoEMphimod_versions,
+    return makecorr (flags,
+                     versions  = CaloTopoEMphimod_versions,
                      name      = name,
                      basename  = 'topophimod',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMphioff.py b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMphioff.py
index 96411505240e..c4a1d497d0a4 100755
--- a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMphioff.py
+++ b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMphioff.py
@@ -1,7 +1,5 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: CaloTopoEMphioff.py,v 1.5 2008-01-25 04:14:22 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/CaloTopoEMphioff.py
 # Created: Mar 2007, sss, from earlier job options.
@@ -9,16 +7,18 @@
 # for TopoEM clusters.
 #
 
-from CaloClusterCorrection import CaloClusterCorrectionConf
-from CaloClusterCorrection.common import *
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection.constants import \
+     CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_EMTOPO, CALOCORR_COMBINED2
+from CaloClusterCorrection.common import makecorr
 import math
 
 #
 # This table lists all available versions of this correction.
 # See common.py for a description of the contents.
 #
-from CaloClusterCorrection.common import topoem_valid_keys as keys
-cls = CaloClusterCorrectionConf.CaloTopoEMphioff
+from CaloClusterCorrection.constants import topoem_valid_keys as keys
+cls = CompFactory.CaloTopoEMphioff  # CaloClusterCorrection
 CaloTopoEMphioff_versions = [
 
     # v1 --- from the original job options file.
@@ -35,6 +35,7 @@ CaloTopoEMphioff_versions = [
 
 #
 # Create a new tool instance.
+#  FLAGS is the configuration flags instance.
 #  NAME is the base name for this tool.  If defaulted, a name will
 #   be constructed from the name of the correction, the version, and the key.
 #  If SUFFIX is not None, it will be added onto the end of the tool name.
@@ -52,7 +53,8 @@ CaloTopoEMphioff_versions = [
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def make_CaloTopoEMphioff (name = None,
+def make_CaloTopoEMphioff (flags,
+                           name = None,
                            suffix = None,
                            version = None,
                            key = CALOCORR_DEFAULT_KEY,
@@ -60,7 +62,8 @@ def make_CaloTopoEMphioff (name = None,
                            confclass = None,
                            **kw):
     # Make the tool.
-    return makecorr (versions  = CaloTopoEMphioff_versions,
+    return makecorr (flags,
+                     versions  = CaloTopoEMphioff_versions,
                      name      = name,
                      basename  = 'topophioff',
                      suffix    = suffix,
diff --git a/Calorimeter/CaloClusterCorrection/python/MakeHierTags.py b/Calorimeter/CaloClusterCorrection/python/MakeHierTags.py
index 0d7c733bd9e0..ff511d1f89de 100644
--- a/Calorimeter/CaloClusterCorrection/python/MakeHierTags.py
+++ b/Calorimeter/CaloClusterCorrection/python/MakeHierTags.py
@@ -1,7 +1,5 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: MakeHierTags.py,v 1.5 2009-04-30 20:29:53 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/MakeHierTags.py
 # Created: Apr 2009, sss
@@ -21,7 +19,8 @@ from __future__ import print_function
 
 from PyCool import cool
 import CoolConvUtilities.AtlCoolLib as AtlCoolLib
-from CaloClusterCorrection.common import *
+from CaloClusterCorrection.constants import CALOCORR_COOL, CALOCORR_JO
+from CaloClusterCorrection.common import split_version_spec
 import sys
 
 
@@ -30,7 +29,7 @@ class MakeHierTags:
         self.corrtop = corrtop
         self.dryrun = dryrun
         self.domagic = domagic
-        dbsvc = cool.DatabaseSvcFactory.databaseService()
+        cool.DatabaseSvcFactory.databaseService()
 
         if dbfile.endswith ('.db'):
             connstring = "sqlite://;schema=%s;dbname=OFLP200" % dbfile
@@ -71,7 +70,7 @@ class MakeHierTags:
 
 
     def run (self, generation=None):
-        if generation == None:
+        if generation is None:
             generation = self.corrtop.correction_generation_default
         if generation != '':
             generation = generation + '-'
@@ -89,12 +88,12 @@ class MakeHierTags:
         htag = None
         for toolspec in toollist:
             toolfunc = toolspec[0]
-            if len(toolspec) >= 2 and type(toolspec[1]) == type(''):
+            if len(toolspec) >= 2 and isinstance(toolspec[1], str):
                 toolversion = toolspec[1]
             else:
                 toolversion = ''
 
-            if not toolfunc in self.funcmap:
+            if toolfunc not in self.funcmap:
                 print ("WARNING: skipping tagging for tool", toolfunc.__name__)
                 continue
             folder = self.funcmap[toolfunc]
@@ -102,7 +101,7 @@ class MakeHierTags:
             (dum1, dum2, corrclass, basename) = folder.split ('/')
 
             htmp = corrclass + '-' + generation + version
-            if htag == None:
+            if htag is None:
                 htag = htmp
                 print (htag)
             else:
@@ -114,7 +113,7 @@ class MakeHierTags:
 
             self.set_tag (folder, tag, htag)
 
-        if htag == None:
+        if htag is None:
             return
 
         for folder in self.folders:
@@ -131,7 +130,7 @@ class MakeHierTags:
             for g in geom_strings:
                 (globver, tryhier) = self.corrtop.geom_match('MakeHierTags', g)
                 if globver[0] == '@': continue
-                (vlist, version) = self.corrtop.lookup_version (globver)
+                (vlist, version) = self.corrtop.lookup_version (globver, None)
                 for f in self.folders:
                     self.make_magic_target (f, g, vlist, generation)
                 print ("Made magic targets for", g)
@@ -201,21 +200,21 @@ class MakeHierTags:
             return
 
         oldtag = self.tags.get ((folder, htag))
-        if oldtag == None:
+        if oldtag is None:
             self.tags[(folder,htag)] = tag
             if not self.db.existsFolder(folder):
                 print ("ERROR: Folder %s doesn't exist" % folder)
                 sys.exit(1)
             dbf = self.db.getFolder(folder)
             if check:
-                if not tag in dbf.listTags():
+                if tag not in dbf.listTags():
                     print ("ERROR: Tag %s doesn't exist in folder %s"
                            % (tag,folder))
                     sys.exit(1)
             try:
-                zz=dbf.findTagRelation(htag) # will throw if htag doesn't exist
+                dbf.findTagRelation(htag) # will throw if htag doesn't exist
                 dbf.deleteTagRelation(htag)
-            except:
+            except Exception:
                 pass
             dbf.createTagRelation (htag, tag)
             #print ('set_tag', folder, tag, htag)
diff --git a/Calorimeter/CaloClusterCorrection/python/StandardCellWeightCalib.py b/Calorimeter/CaloClusterCorrection/python/StandardCellWeightCalib.py
index 1c372020eb3f..fc65f22a61e6 100644
--- a/Calorimeter/CaloClusterCorrection/python/StandardCellWeightCalib.py
+++ b/Calorimeter/CaloClusterCorrection/python/StandardCellWeightCalib.py
@@ -5,6 +5,7 @@
 #--
 #-- Note the input for this calibration is jet driven. The fitted default
 
+from AthenaConfiguration.ComponentFactory import CompFactory
 from AthenaCommon.Logging import logging
 from AthenaCommon.GlobalFlags import globalflags
 
@@ -165,20 +166,20 @@ class H1Calibration(object):
                 if 'Topo' in input: return  H1Calibration.getCalibDBParams('Cone',0.4,'H1Topo',onlyCellWeight,isMC)
                 else:               return  H1Calibration.getCalibDBParams('Cone',0.4,'H1Tower',onlyCellWeight,isMC)
             # else try to find a good fall back
-            _logger.warning("getCalibDBParams: no dedicated calibration for %s %s %s"%(finder,mainparam,input))
+            _logger.warning("getCalibDBParams: no dedicated calibration for %s %s %s", finder,mainparam,input)
             if finder not in [ 'Kt', 'Cone' ]    : finder = 'Cone'     # fall back to ATLAS Cone
             if input  not in [ 'Topo', 'Tower' ] : input  = 'Tower'    # fall back to Tower
             if finder == 'Kt' : l = [ 0.4, 0.6 ]
             else:               l = [ 0.4, 0.7 ]
             (m,mainparam) = min( [ (abs(p-mainparam),p) for p in l ] ) # main parameter optimization (??)
-            _logger.warning("getCalibDBParams: defaulted calibration to %s %s %s"%(finder,mainparam,input))
+            _logger.warning("getCalibDBParams: defaulted calibration to %s %s %s", finder,mainparam,input)
             return H1Calibration.getCalibDBParams(finder,mainparam,input,onlyCellWeight,isMC)
     #-- load DB folder
     @staticmethod
     def loadCaloFolder(folder,tag,isMC=False):
         from IOVDbSvc.CondDB       import conddb
         from AthenaCommon.AppMgr   import ServiceMgr
-        from IOVDbSvc.IOVDbSvcConf import IOVDbSvc
+        IOVDbSvc = CompFactory.IOVDbSvc  # IOVDbSvc
         ServiceMgr += IOVDbSvc()
         IOVDbSvc = ServiceMgr.IOVDbSvc
         if isMC:
@@ -203,7 +204,7 @@ def getCellWeightTool(finder="Cone",mainparam=0.4,input="Topo", onlyCellWeight=F
     input/str      : input objects triggers calibration weights
     mainparam/float: size parameter for jet
     """
-    from CaloClusterCorrection.CaloClusterCorrectionConf import H1WeightToolCSC12Generic
+    H1WeightToolCSC12Generic = CompFactory.H1WeightToolCSC12Generic  # CaloClusterCorrection
     
     if globalflags.DataSource()=='data':
       isMC=False
diff --git a/Calorimeter/CaloClusterCorrection/python/common.py b/Calorimeter/CaloClusterCorrection/python/common.py
index f71b6117e59e..03557911a233 100755
--- a/Calorimeter/CaloClusterCorrection/python/common.py
+++ b/Calorimeter/CaloClusterCorrection/python/common.py
@@ -1,7 +1,5 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id: common.py,v 1.39 2009-05-20 20:48:52 ssnyder Exp $
 #
 # File: CaloClusterCorrection/python/common.py
 # Created: Nov 2006, sss
@@ -10,21 +8,17 @@
 
 from __future__ import print_function
 
+from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
+from AthenaConfiguration.ComponentFactory import CompFactory
 from AthenaCommon.Logging import logging
-from AthenaCommon.AppMgr import ServiceMgr
-from AthenaCommon.JobProperties import jobproperties
-from AthenaCommon.GlobalFlags   import globalflags
-from AthenaCommon.Configurable  import Configurable
-from IOVDbSvc.CondDB import conddb
 from fnmatch import fnmatchcase
-import sys
-import string
 
 from CaloClusterCorrection.poolfiles import poolfiles
-from CaloClusterCorrection.CaloClusterCorrectionConf import \
-     CaloRunClusterCorrections, CaloDummyCorrection
 
-from CaloClusterCorrection.constants import *
+from CaloClusterCorrection.constants import \
+     CALOCORR_JO, CALOCORR_POOL, CALOCORR_COOL, \
+     CALOCORR_NOPOOL, CALOCORR_TOPOOL, CALOCORR_DEFAULT_KEY, \
+     sampnames
 
 # Used for reporting configuration errors.
 class CaloCorrectionConfigError (Exception):
@@ -42,63 +36,6 @@ _alltools = {}
 
 
 
-class MetatoolPropDummy:
-    def __init__ (self, obj):
-        self.obj = obj
-    def __getitem__ (self, i):
-        return self.obj.__dict__.get (i, '')
-        return ''
-    def has_key (self, k):
-        if k == 'isDummy':
-            return False
-        return True
-    def __contains__ (self, k):
-        return self.has_key (k)
-    
-class MetatoolHelper:
-    def __init__ (self, confclass, name):
-        self.__dict__["clsname"] = confclass.__name__
-        self.__dict__["name"] = name
-        self.__dict__["prefix"] = ""
-        self.__dict__["DBHandleKey"] = None
-        self.__dict__["props"] = {}
-        self.__dict__["_propdum"] = MetatoolPropDummy (self)
-        return
-
-
-    def getName (self):
-        return self.name
-
-    def __setattr__ (self, k, v):
-        if k in self.__dict__:
-            self.__dict__[k] = v
-        else:
-            if isinstance (v, Configurable):
-                v = v.getFullName()
-            self.props[k] = str(v)
-        return
-
-
-    def properties (self):
-        return self._propdum
-
-
-    def corrspec (self):
-        if self.DBHandleKey == None:
-            location = '+' + self.clsname
-        elif self.DBHandleKey.find ('/') >= 0:
-            location = '@' + self.DBHandleKey
-        else:
-            location = self.DBHandleKey
-        spec = [self.name,
-                location,
-                self.prefix]
-        for (k, v) in self.props.items():
-            spec += [k, v]
-        spec.append ("")
-        return spec
-
-
 ###########################################################################
 # Code to handle creating the list of correction tools.
 #
@@ -109,12 +46,13 @@ class MetatoolHelper:
 #  name:                  A short descriptive name of the type of cluster
 #                         (to be written to the log file)
 #
-#  version_override_flag: A job property.
+#  version_override_flag_name:
+#                         Name of flag.
 #                         If set, it overrides the selected correction
 #                         version.
 #
-#  correction_generation_flag:
-#                         A job property.
+#  correction_generation_flag_name:
+#                         Name of flag.
 #                         If set, this gives the correction generation
 #                         string that's embedded in tags written to the
 #                         database.  This string should be changed for
@@ -148,11 +86,11 @@ class MetatoolHelper:
 #                         It may also be `@', in which case the global
 #                         version string is used instead.
 #
-#                         ORDER is an integer.  When the metatool is used,
-#                         tools will be executed in increasing order
-#                         of the ORDER parameter.  Note that a given
-#                         tool/version must have the same ORDER each
-#                         time it's used.
+#                         ORDER is an integer, giving the order in which
+#                         the tools are intended to run.
+#                         Not currently used (they were used by the metatool),
+#                         but retained in case we want to use this
+#                         for checking.
 #
 #                         The remainder of the list should be a set
 #                         of (NAME,VALUE) tuples giving correction parameters
@@ -189,29 +127,52 @@ def split_version_spec (cspec):
     version = ''
     order = 0
     ii = 1
-    if ii < len(cspec) and type(cspec[ii]) == type(''):
+    if ii < len(cspec) and isinstance (cspec[ii], str):
         version = cspec[ii]
         ii += 1
-    if ii < len(cspec) and type(cspec[ii]) == type(1):
+    if ii < len(cspec) and isinstance (cspec[ii], int):
         order = cspec[ii]
         ii += 1
     extra_args = cspec[ii:]
     return (func, version, order, extra_args)
 
 
+# Given a cool tag (or GLOBAL for the currently-configured global tag),
+# return the version of the correction set to use.
+def _find_version_from_cool_tag (flags, coolTag, corrclass):
+    if coolTag == 'GLOBAL':
+        coolTag = flags.IOVDb.GlobalTag
+
+    if flags.Input.isMC:    
+        folderset = "/CALO/Ofl/" + corrclass
+        connstring = 'COOLOFL_CALO/OFLP200'
+    else:   
+        folderset = "/CALO/" + corrclass
+        connstring = 'COOLONL_CALO/' + flags.IOVDb.DatabaseInstance
+
+    from CoolConvUtilities import AtlCoolLib
+    db = AtlCoolLib.indirectOpen (connstring, readOnly=True, oracle=True)
+    ff = db.getFolderSet (folderset)
+    t = ff.resolveTag (coolTag)
+    #  CaloOflSwClusterCorrections.00-02-12-calhits-v9
+    l = t.split ('-')
+    return '-'.join (l[4:])
+
+
 class CaloClusterCorrSetup:
     # Must be overridden in derived classes.  See above for their meaning.
     # name = XXX
-    # version_override_flag = XXX
-    # correction_generation_flag = XXX
+    # version_override_flag_name = XXX
+    # correction_generation_flag_name = XXX
     # correction_generation_default = XXX
     # versions = XXX
     # geom_versions = XXX
     # newest_version = XXX
 
     #
-    # Create and return a list of correction tools.
-    # CORRCLASS is the correction class string, as defined above.
+    # Create and return a CA of correction tools.
+    # FLAGS is the configuration flags.
+    # CORRCLASS is the correction class string, as defined in constants.py.
     # KEY is a string that specifies the correction type.
     # SUFFIX is a string to add to the end of each tool name.
     # VERSION specifies which version of corrections to use.
@@ -221,16 +182,14 @@ class CaloClusterCorrSetup:
     # in the version table, we look for one with a version of `@'.
     # If no match for that is found, the last entry in the table
     # will be used.
-    # If VERSION starts with `@', USE_METATOOL must be enabled.
     # CORRLIST can be used to explicitly specify which corrections to run.
     # CELLS_NAME is the SG key to use to find the calorimeter cells,
     # for those corrections that require it.
     # SOURCE specifies the source(s) from which tools are configured.
     # None means to use the default.
-    # If USE_METATOOL is true, then instead of making the list of tools here,
-    # return a single CaloRunClusterCorrections tool.
     #
     def make_corrections (self,
+                          flags,
                           corrclass,
                           key = None,
                           suffix = '',
@@ -238,7 +197,6 @@ class CaloClusterCorrSetup:
                           corrlist = None,
                           cells_name = None,
                           source = None,
-                          use_metatool = False,
                           **kw):
 
         # Make a logger.
@@ -248,39 +206,38 @@ class CaloClusterCorrSetup:
 
         # First, find the appropriate overall version string to use,
         # if it wasn't specified explicitly.
-        if version == None:
+        if version is None:
             # First see if the flag was set to override the version.
             # at the top-level.
-            if self.version_override_flag.statusOn:
-                version = self.version_override_flag()
+            v = getattr (flags.Calo.ClusterCorrection, self.version_override_flag_name)
+            if v:
+                version = v
 
-        if version == None:
+        if version is None:
             # No explicitly specified version.
             # Try to guess it from the data source + geometry string.
             # Otherwise, use the latest version.
-            geom = jobproperties.Global.DetDescrVersion()
-            datasource = globalflags.DataSource()
+            geom = flags.GeoModel.AtlasVersion
+            datasource = 'geant4' if flags.Input.isMC else 'data'
             (version, tryhier) = self.geom_match (datasource, geom)
 
-        #if version[0] == '@' and not use_metatool:
-        #    raise CaloCorrectionConfigError ('COOL tag requested but not metatool.')
-            
         # Get the correction generation.
-        generation = self.get_generation()
+        generation = self.get_generation(flags)
 
         # Use the default source if one wasn't specified.
-        if source == None:
-            from CaloClusterCorrection.CaloClusterCorrectionFlags \
-                 import caloClusterCorrectionFlags
-            source = caloClusterCorrectionFlags.DefaultSource()
+        if source is None:
+            source = flags.Calo.ClusterCorrection.defaultSource
 
-        if type(source) != type([]):
+        if not isinstance (source, list):
             source = [source]
         if CALOCORR_COOL not in source:
             tryhier = False
 
         if tryhier and version[0] != '@':
-            version = "@%s-%s%s" % (corrclass, generation, version)
+            cl = corrclass
+            if flags.Input.isMC:
+                cl = cl[0:4] + 'Ofl' + cl[4:]
+            version = "@%s-%s%s" % (cl, generation, version)
 
         # Only use COOL if we're actually trying to resolve a COOL tag.
         # Otherwise we can run into problems: it looks like `ununsed'
@@ -289,21 +246,18 @@ class CaloClusterCorrSetup:
             if CALOCORR_COOL in source:
                 source.remove (CALOCORR_COOL)
 
-        (vcorrlist, version) = self.lookup_version (version)
+        (vcorrlist, version) = self.lookup_version (flags, version, corrclass)
 
         # Default to the standard list if no explicit correction list.
-        if corrlist == None:
+        if corrlist is None:
             corrlist = vcorrlist
-            preserve_order = False
-        else:
-            # If list was given explicitly, don't reorder it.
-            preserve_order = True
 
         log.info ("%s corrections for %s (%s) using version %s" %
                   (self.name, key, suffix, version))
 
         # Now, walk through the list of corrections.
-        out = []
+        out = ComponentAccumulator()
+        tools = []
         for cspec in corrlist:
             (func, this_version, this_order, extra_args) = \
                    split_version_spec (cspec)
@@ -353,31 +307,32 @@ class CaloClusterCorrSetup:
                     this_args[k[len(corrname)+1:]] = v
 
             # Make the tool.
-            tool = func (this_cells_name,
-                         this_suffix,
-                         this_version,
-                         this_key,
-                         this_source,
-                         generation = generation,
-                         use_metatool = use_metatool,
-                         order = this_order,
-                         **this_args)
-            out.append (tool)
-
-        if use_metatool:
-            out = [self.make_metatool (suffix + key, out, preserve_order)]
-
+            ca = func (flags,
+                       this_cells_name,
+                       this_suffix,
+                       this_version,
+                       this_key,
+                       this_source,
+                       generation = generation,
+                       order = this_order,
+                       **this_args)
+            tools.append (out.popToolsAndMerge (ca))
+
+        out.setPrivateTools (tools)
         return out
 
 
     # Look up a specific correction version; return the correction
     # list and the version.  Broken out to allow overriding, for
     # any special version-name handling needed.
-    def lookup_version (self, version):
+    def lookup_version (self, flags, version, corrclass):
         vcorrlist = self.versions.get (version)
-        if vcorrlist == None and version.startswith ('@'):
-            vcorrlist = self.versions.get ('@')
-        if vcorrlist == None:
+        if vcorrlist is None and version.startswith ('@'):
+            findvers = _find_version_from_cool_tag (flags, version[1:], corrclass)
+            vcorrlist = self.versions.get (findvers)
+            if vcorrlist is None:
+                vcorrlist = self.versions.get ('@')
+        if vcorrlist is None:
             raise CaloCorrectionConfigError\
                   ("Can't find global correction version %s." % version)
         return (vcorrlist, version)
@@ -405,10 +360,11 @@ class CaloClusterCorrSetup:
 
     # Get the correction generation, with a `-' appended if appropriate.
     @classmethod
-    def get_generation (cls):
+    def get_generation (cls, flags):
         generation = cls.correction_generation_default
-        if cls.correction_generation_flag.statusOn:
-            generation = cls.correction_generation_flag()
+        gen2 = getattr (flags.Calo.ClusterCorrection, cls.correction_generation_flag_name)
+        if gen2:
+            generation = gen2
         if generation != '':
             generation = generation + '-'
         return generation
@@ -417,17 +373,21 @@ class CaloClusterCorrSetup:
     #####################################################################
     # Code for writing to pool.
     # Make a set of corrections for writing to pool.
-    def make_ForPool (self, keys, corrclass):
+
+    def make_ForPool (self, flags, keys, corrclass):
         # Map from SG key to a list of tool instances.
         sgkeys = {}
 
-        # Map from tool names to instances.
-        tools = {}
+        # Names of all tools made so far
+        tool_names = set()
 
         # Map from (func, version) to (order, globversion).
         # For consistency checking.
         ordermap = {}
 
+        result = ComponentAccumulator()
+        tools = []
+
         # Go through each version, and make corrections.
         for (v,l) in self.versions.items():
             if v.startswith ('@'): continue
@@ -454,37 +414,53 @@ class CaloClusterCorrSetup:
                           ("Tool %s has order %d in %s but order %d in %s!" %
                            (func.__name__, order, v,
                             ordermap[okey][0], ordermap[okey][1]))
-                
+
                 # Find the list of valid keys for this tool.
-                valid_keys = func (None,
+                valid_keys = func (flags,
+                                   None,
                                    version = version,
                                    key = '@VALID_KEYS')
-                if valid_keys == None:
+                if valid_keys is None:
                     valid_keys = keys
                 for key in valid_keys:
-                    self.maybe_make_correction_for_pool (sgkeys, tools, key, c,
-                                                         corrclass)
+                    ca = self.maybe_make_correction_for_pool (flags,
+                                                              sgkeys,
+                                                              tool_names,
+                                                              key, c,
+                                                              corrclass)
+                    if ca:
+                        tools.append (ca.popPrivateTools())
+                        result.merge (ca)
+
+        result.setPrivateTools (tools)
 
-        return sgkeys
+        return (sgkeys, result)
 
 
-    def maybe_make_correction_for_pool (self, sgkeys, tools, key, cspec,
+    def maybe_make_correction_for_pool (self, flags,
+                                        sgkeys, tool_names, key, cspec,
                                         corrclass):
         (func, version, order, extra_args) = split_version_spec (cspec)
         name = func.__name__ + '_' + version + '_' + key
-        if name in tools:
-            return
-        tool = func (None, '', version, key, CALOCORR_TOPOOL,
-                     generation = self.get_generation(),
-                     order = order)
-        if tool != None and folder(tool).find ('/' + corrclass + '/') >= 0:
-            tools[name] = tool
+        if name in tool_names:
+            return None
+        ca = func (flags,
+                   None, '', version, key, CALOCORR_TOPOOL,
+                   generation = self.get_generation (flags),
+                   order = order)
+        if ca is None:
+            return None
+        tool = ca.popPrivateTools()
+        if tool is not None and folder(tool).find ('/' + corrclass + '/') >= 0:
+            tool_names.add (name)
             sgkeys.setdefault (sgkey(tool), []).append (tool)
-        return
+        ca.setPrivateTools (tool)
+        return ca
 
 
     # Add a dummy correction object to each folder.
     def add_dummies (self, sgkeys, valid_keys, generation):
+        CaloDummyCorrection = CompFactory.CaloDummyCorrection # CaloClusterCorrection
         toolnames = {}
         for sgkey in sgkeys.keys():
             ll = sgkey.split ('-')
@@ -509,17 +485,17 @@ class CaloClusterCorrSetup:
 
 
     # Configure algorithms for writing to pool.
-    def config_for_pool (self, keys, corrclass):
-        from CaloRec.CaloRecMakers import make_CaloClusterCorrDBWriter
-        from AthenaCommon.AlgSequence import AlgSequence
-        topalg = AlgSequence ("TopAlg")
+    def config_for_pool (self, flags, keys, corrclass):
+        result = ComponentAccumulator()
 
         corr_output_list = []
         tag_list = []
 
-        generation = self.get_generation()
+        generation = self.get_generation (flags)
 
-        sgkeys = self.make_ForPool (keys, corrclass)
+        (sgkeys, ca) = self.make_ForPool (flags, keys, corrclass)
+        ca.popPrivateTools()
+        result.merge (ca)
         self.add_dummies (sgkeys, keys, generation)
 
         for (sgkey, tools) in sgkeys.items():
@@ -527,8 +503,12 @@ class CaloClusterCorrSetup:
             name = 'write_' + sgkey
             name = name.replace ('.', '_')
 
-            alg = make_CaloClusterCorrDBWriter (name, sgkey, tools)
-            topalg += alg
+            # In CaloRec
+            alg = CompFactory.CaloClusterCorrDBWriter (name,
+                                                       key = sgkey,
+                                                       ClusterCorrectionTools = tools)
+            result.addEventAlgo (alg)
+                                                       
 
             corr_output_list.append ('CaloRec::ToolConstants#' +
                                      sgkey + '#' +
@@ -539,53 +519,14 @@ class CaloClusterCorrSetup:
         print (corr_output_list)
         print (tag_list)
 
-        return (corr_output_list, tag_list)
-
-
-    # Given a list of MetatoolHelper objects, construct an appropriate
-    # Configurable for a CaloRunClusterCorrections tool to run
-    # the desired corrections.
-    def make_metatool (self, suffix, tools, preserve_order):
-        name = 'CaloRunClusterCorrections' + suffix
-        if name in _alltools:
-            nsuff = 2
-            while (name + str (nsuff)) in _alltools:
-                nsuff += 1
-            name = name + str (nsuff)
-        _alltools[name] = (None, None, None)
-        metatool = CaloRunClusterCorrections (name)
-        specs = sum ([t.corrspec() for t in tools], [])
-        metatool.CorrSpecs = specs
-        metatool.PreserveOrder = preserve_order
-        log = logging.getLogger ('CaloClusterCorrection')
-        log.debug (" making metatool %s" % metatool.getName())
-        log.debug ("  specs: %s", specs)
-
-        # # If we're running this to make the trigger DB, turn on
-        # # NoClearProps.  But try to avoid importing trigger packages
-        # # if they haven't already been read.
-        # import sys
-        # if sys.modules.has_key ('TriggerJobOpts.TriggerFlags'):
-        #     TriggerFlags = sys.modules['TriggerJobOpts.TriggerFlags']
-        #     if hasattr (TriggerFlags, 'TriggerFlags'):
-        #         TriggerFlags = TriggerFlags.TriggerFlags
-        #         if hasattr (TriggerFlags, 'Online'):
-        #             Online = TriggerFlags.Online
-        #             if Online.doDBConfig():
-        #                 metatool.NoClearProps = True
-
-        # Ok, clearing the properties was an interesting idea, but in the
-        # usual configuration it won't save very much, and it causes problems
-        # with trying to clone algorithms for Hive.  Just disable it for now.
-        metatool.NoClearProps = True
-            
-        return metatool
+        return (corr_output_list, tag_list, result)
 
 
 ###########################################################################
 
 #
 # Create a correction tool.
+# FLAGS is the corrections flag object.
 # VERSIONS is a table listing all the available versions of the corrections.
 # It is a list of 4-element lists.  The last row should correspond to the
 # most recent version of the correction.
@@ -658,7 +599,6 @@ class CaloClusterCorrSetup:
 # in the version table, we look for one with a version of `@'.
 # If no match for that is found, the last entry in the table
 # will be used.
-# If VERSION starts with `@', USE_METATOOL must be enabled.
 #
 # KEY is a string to specify the type of cluster to which the correction
 # applies.  The convention is to use `ele55' for 5x5 electron clusters,
@@ -694,15 +634,13 @@ class CaloClusterCorrSetup:
 #
 # GENERATION is the generation string to embed in COOL tags.
 #
-# If USE_METATOOL is true, then instead of making a Configurable,
-# return a MetatoolHelper object.
-#
 # ORDER specifies the relative order in which this tool should be executed.
 #
 # Additional keyword arguments may be passed to override any tool
 # parameters/constants.
 #
-def makecorr (versions,
+def makecorr (flags,
+              versions,
               name,
               basename,
               suffix,
@@ -713,12 +651,11 @@ def makecorr (versions,
               confclass,
               corrclass,
               generation = '',
-              use_metatool = False,
               order = 0,
               **kw):
 
     # If no version specified, use the last one in the table.
-    if version == None:
+    if version is None:
         version = versions[-1][0]
 
     # Try to find the requested version.
@@ -749,10 +686,8 @@ def makecorr (versions,
         return valid_keys
 
     # Use the default source if one wasn't specified.
-    if source == None:
-        from CaloClusterCorrection.CaloClusterCorrectionFlags \
-             import caloClusterCorrectionFlags
-        source = caloClusterCorrectionFlags.DefaultSource()
+    if source is None:
+        source = flags.Calo.ClusterCorrection.defaultSource
 
     # Test to see if this correction specifies nopool.
     nopool = CALOCORR_NOPOOL in v[2]
@@ -762,11 +697,7 @@ def makecorr (versions,
         return None
 
     # Find the SG key and cool tag.
-    # If the tag is specified in the version, then we must be using
-    # the metatool, and the SG key doesn't get specified.
-    # Otherwise, the tag name is the same as the SG key.
     if version.startswith ('@'):
-        #assert use_metatool
         sgkey = None
         if version == '@GLOBAL':
             fulltag = version
@@ -785,7 +716,7 @@ def makecorr (versions,
         fulltag = "%s.%s%s" % (corrclass, generation, tmp)
 
     # The cool folder name.
-    if globalflags.DataSource() == 'data':    
+    if not flags.Input.isMC:
        folder = "/CALO/%s/%s" % (corrclass, basename)
     else:   
        folder = "/CALO/Ofl/%s/%s" % (corrclass, basename)
@@ -794,7 +725,7 @@ def makecorr (versions,
     prefix = key + sampnames[sampling] + "."
   
     # Construct a default tool name if one isn't specified.
-    if name == None:
+    if name is None:
         name = basename
         name = name + sampnames[sampling]
         if version != '':
@@ -807,7 +738,7 @@ def makecorr (versions,
             name = name + "_" + key
 
     # Add a suffix if given.
-    if suffix != None:
+    if suffix is not None:
         name = name + suffix
 
     # If we're not writing to pool, we need to make sure the name's unique.
@@ -819,26 +750,24 @@ def makecorr (versions,
     _alltools[name] = (folder, fulltag, sgkey)
 
     # If no class was explicitly specified, take it from the table.
-    if confclass == None:
+    if confclass is None:
         confclass = v[1]
 
     # It may be sampling-dependent.
-    if type (confclass) == type ({}) and sampling != None:
+    if isinstance (confclass, dict) and sampling is not None:
         confclass = confclass[sampling]
 
+    result = ComponentAccumulator()
+
     # Create the tool!
-    if use_metatool:
-        corr = MetatoolHelper (confclass, name)
-    else:
-        _maybe_patchclass (confclass)
-        corr = confclass (name)
+    corr = confclass (name)
 
     # Set the prefix for all pool-capable tools.
     if not nopool:
         corr.prefix = prefix
 
     # Try to find a source from which to configure it.
-    if type(source) != type([]):
+    if not isinstance (source, list):
         source = [source]
     avail = v[2]
     wherefrom = None
@@ -851,21 +780,25 @@ def makecorr (versions,
                 wherefrom = sel[0]
                 break
 
-        # elif s == CALOCORR_POOL:
-        #     sel = [x for x in avail if _is_pool_source (x)]
-        #     if len (sel) > 0 and _config_from_pool (corr, sel[0], sgkey):
-        #         if not use_metatool:
-        #             _mung_prefix (corr, key, valid_keys)
-        #         wherefrom = sel[0]
-        #         break
+        elif s == CALOCORR_POOL:
+            sel = [x for x in avail if _is_pool_source (x)]
+            if len (sel) > 0:
+                ca2 = _config_from_pool (flags, corr, sel[0], sgkey)
+                if ca2:
+                    result.merge (ca2)
+                    _mung_prefix (corr, key, valid_keys)
+                    wherefrom = sel[0]
+                    break
 
         elif s == CALOCORR_COOL:
             sel = [x for x in avail if _is_cool_source (x)]
-            if len (sel) > 0 and config_from_cool (corr, folder, fulltag):
-                if not use_metatool:
+            if len (sel) > 0:
+                ca2 = _config_from_cool (flags, corr, folder, fulltag)
+                if ca2:
+                    result.merge (ca2)
                     _mung_prefix (corr, key, valid_keys)
-                wherefrom = 'cool'
-                break
+                    wherefrom = 'cool'
+                    break
 
         elif _is_jo_source (s):
             if _config_from_jo (corr, s, key, sampling, valid_keys, order):
@@ -873,13 +806,14 @@ def makecorr (versions,
                 break
 
         elif _is_pool_source (s):
-            if _config_from_pool (corr, s, sgkey):
-                if not use_metatool:
-                    _mung_prefix (corr, key, valid_keys)
+            ca2 = _config_from_pool (flags, corr, s, sgkey)
+            if ca2:
+                result.merge (ca2)
+                _mung_prefix (corr, key, valid_keys)
                 wherefrom = s
                 break
 
-    if wherefrom == None:
+    if wherefrom is None:
         raise CaloCorrectionConfigError \
               ("Can't find any source to configure tool `%s'.  Sources: %s" %
                (name, source))
@@ -891,19 +825,12 @@ def makecorr (versions,
     # If any other keyword arguments were passed, make those assignments.
     # This will override anything otherwise read from JO/pool.
     for (k, val) in kw.items():
-        if val != None:
-            _setprop (corr, k, val)
+        if val is not None:
+            setattr (corr, k, val)
 
     # Done!
-    return corr
-
-
-# Helper for setting a correction tool property/constant.
-def _setprop (obj, k, val):
-    if type(val) == type([]) and type(obj.properties()[k]) != type([]):
-        val = str(val)
-    setattr (obj, k, val)
-    return
+    result.setPrivateTools (corr)
+    return result
 
 
 # Test to see if S looks like a job options source.
@@ -942,13 +869,13 @@ def _config_from_jo (corr, jo, key, sampling, valid_keys, order):
     parms = getattr (mod, paramclass)
 
     # It may be sampling-dependent.
-    if type (parms) == type ({}) and sampling != None:
+    if isinstance (parms, dict) and sampling is not None:
         parms = parms[sampling]
 
-    if order != 0 and 'order' in corr.properties():
-        _setprop (corr, 'order', order)
-    if 'isDummy' in corr.properties():
-        _setprop (corr, 'isDummy', 0)
+    if order != 0 and hasattr (corr, 'order'):
+        setattr (corr, 'order', order)
+    if hasattr (corr, 'isDummy'):
+        setattr (corr, 'isDummy', 0)
 
     log = logging.getLogger ('CaloClusterCorrection')
 
@@ -981,50 +908,48 @@ def _config_from_jo (corr, jo, key, sampling, valid_keys, order):
                 # Can't look up a key in val --- just use val as-is.
                 pass
 
-            _setprop (corr, k, val)
+            setattr (corr, k, val)
     return True
 
 
 # Configure a correction tool from POOL.
-def _config_from_pool (corr, poolfile, sgkey):
+def _config_from_pool (flags, corr, poolfile, sgkey):
     if not poolfile or not poolfiles[poolfile]:
         return False
     
-    # Tell the tool to look in pool for this key.
-    corr.DBHandleKey = sgkey
+    ca = ComponentAccumulator()
 
     # If this is the first time we've seen this file,
     # add it to CondProxyProvider.
-    # Pick up the provider by looking in the top-level global scope.
-    global ServiceMgr
     if poolfile not in  _poolfiles_seen:
-        _poolfiles_seen[poolfile] = 1
-        try:
-            ServiceMgr.CondProxyProvider.InputCollections += \
-                                                          [poolfiles[poolfile]]
-        except AttributeError:
-            # CondProxyProvider hasn't been made yet?
-            from EventSelectorAthenaPool.EventSelectorAthenaPoolConf \
-                 import CondProxyProvider
-            ServiceMgr += CondProxyProvider()
-            ServiceMgr.ProxyProviderSvc.ProviderNames += ["CondProxyProvider"]
-            ServiceMgr.CondProxyProvider.InputCollections += \
-                                                          [poolfiles[poolfile]]
-    return True
+        from EventSelectorAthenaPool.CondProxyProviderConfig import CondProxyProviderCfg
+        ca.merge (CondProxyProviderCfg (flags, [poolfiles[poolfile]]))
+
+    # Tell the tool to look in pool for this key.
+    corr.DBHandleKey = sgkey
+
+    # Set up a conditions algorithm to convert from the data in DetectorStore
+    # to a conditions object.
+    ToolConstantsCondAlg = CompFactory.ToolConstantsCondAlg # CaloRec
+
+    name = 'ToolConstantsCondAlg_' + sgkey.replace ('.', '_')
+    alg = ToolConstantsCondAlg (name,
+                                DetStoreKey = sgkey,
+                                ToolConstantsKey = sgkey)
+    ca.addCondAlgo (alg)
+    return ca
 
 
 # Configure a correction tool from COOL.
-def config_from_cool (corr, folder, tag):
+def _config_from_cool (flags, corr, folder, tag):
     # Folder name has form /CALO/CORRCLASS/NAME
     # Find the subdetector name string to use.
     fsplit = folder.split ('/')
-    if fsplit[1] == 'Ofl':
-       corrclass = folder.split ('/')[3]
+    if fsplit[2] == 'Ofl':
+       corrclass = folder.split ('/')[4]
     else:   
-       corrclass = folder.split ('/')[2]
-    from CaloClusterCorrection.CaloClusterCorrectionFlags \
-         import caloClusterCorrectionFlags
-    sndict = caloClusterCorrectionFlags.DBSubdetName()
+       corrclass = folder.split ('/')[3]
+    sndict = flags.Calo.ClusterCorrection.dbSubdetName
     subdetname = sndict.get (corrclass)
     if not subdetname:
         subdetname = sndict.get (None)
@@ -1033,21 +958,26 @@ def config_from_cool (corr, folder, tag):
 
     # We can't use more than one tag from a folder.
     oldtag = _folders_used.get (folder)
-    if oldtag != None and oldtag != tag:
+    if oldtag is not None and oldtag != tag:
         return False
 
+    ca = ComponentAccumulator()
+
     _folders_used[folder] = tag
-    if oldtag == None:
-        if tag != '@GLOBAL':
-            folder = folder + ' <tag>%s</tag>' % tag
+    if oldtag is None:
+        from IOVDbSvc.IOVDbSvcConfig import addFolders
+        tagstr = '' if tag =='@GLOBAL' else tag
         sdsuffix = '_OFL' if 'Ofl' in folder else ''
-        conddb.addFolder (subdetname + sdsuffix,
-                          folder,
-                          className = 'CaloRec::ToolConstants')
+        ca.merge (addFolders (flags,
+                              folder,
+                              detDb = subdetname + sdsuffix,
+                              className = 'CaloRec::ToolConstants',
+                              tag = tagstr))
+                               
         log = logging.getLogger ('CaloClusterCorrection')
         log.debug ("Adding cool folder `%s' for subdetector name %s" %
                    (folder, subdetname))
-    return True
+    return ca
 
 
 # When we're reading from pool/cool, the prefix _must_ be one that
@@ -1059,9 +989,9 @@ def _matchlen (a, b):
         i = i+1
     return i
 def _longest_match (key, valid_keys):
-    if type(valid_keys) != type([]):
+    if not isinstance (valid_keys, list):
         valid_keys = [valid_keys]
-    if valid_keys == None or key in valid_keys:
+    if valid_keys is None or key in valid_keys:
         return key
     new_key = valid_keys[0]
     for k in valid_keys[1:]:
@@ -1069,7 +999,7 @@ def _longest_match (key, valid_keys):
             new_key = k
     return new_key
 def _mung_prefix (corr, key, valid_keys):
-    if valid_keys == None or key in valid_keys: return
+    if valid_keys is None or key in valid_keys: return
 
     # Find the best match.
     new_key = _longest_match (key, valid_keys)
@@ -1094,47 +1024,3 @@ def sgkey (tool):
 
 
 
-##############################################################################
-# Hack around a problem with the interaction between Configurable
-# and reading tool constants from pool.
-#
-# When ToolWithConstantsMixin reads constants from pool, we still want
-# to allow overriding the constants from job options.  So, if TWCM sees
-# a setProperty call for a given property, it assumes that this is being
-# overridden from JO, and will use what's set in the setProperty call
-# instead of what's read from pool.
-#
-# This worked fine for non-Configurable setup.  However, when one uses
-# Configurable to set up ones class, it ends up setting _all_ the properties,
-# even those that are still defaulted.  So, what we end up seeing
-# is that TWCM::setProperty gets called for _all_ properties with
-# the default --- i.e., null --- values, so the values read from pool
-# never get used.
-#
-# The code here patches the Configurable classes for the corrections
-# so that setup() does not transport to C++ those properties that
-# were defaulted.
-#
-
-from AthenaCommon.Configurable import Configurable
-def _calocorr_setup (self):
-    save_properties = {}
-    try:
-        for (k, v) in list(self._properties.items()):
-            if self in v.history and len (v.history[self]) >= 1:
-                pass
-            else:
-                save_properties[k] = v
-                del self._properties[k]
-        Configurable.setup (self)
-    finally:
-        for (k, v) in save_properties.items():
-            self._properties[k] = v
-    return
-
-def _maybe_patchclass (cls):
-    if '_calocorr_patched' in cls.__dict__:
-        return
-    cls.setup = _calocorr_setup
-    cls._calocorr_patched = 1
-    return
diff --git a/Calorimeter/CaloClusterCorrection/python/compat.py b/Calorimeter/CaloClusterCorrection/python/compat.py
new file mode 100644
index 000000000000..b39ea3799756
--- /dev/null
+++ b/Calorimeter/CaloClusterCorrection/python/compat.py
@@ -0,0 +1,58 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+#
+# File: CaloClusterCorrection/python/compat.py
+# Created: Aug 2020, sss
+# Purpose: Backwards-compatbility helpers.
+#
+# Helpers for configuring cluster corrections using old configuration.
+#
+
+
+from AthenaConfiguration.ComponentAccumulator import \
+     conf2toConfigurable, appendCAtoAthena
+import string
+
+
+#
+# Return a new-style configuration flags object containing information
+# from old flags.
+#
+def makeFlags():
+    from AthenaConfiguration.AllConfigFlags import ConfigFlags
+    ConfigFlags.loadAllDynamicFlags()
+    flags = ConfigFlags.clone()
+
+    from CaloClusterCorrection.CaloClusterCorrectionFlags \
+         import caloClusterCorrectionFlags
+
+    for name in dir(caloClusterCorrectionFlags):
+        if name[0] not in string.ascii_uppercase:
+            continue
+        flag = getattr (caloClusterCorrectionFlags, name)
+        if not flag.isDefault():
+            if name == 'DBSubdetName':
+                name2 = 'dbSubdetName'
+            else:
+                name2 = name[0].lower() + name[1:]
+            val = flag.get_Value()
+            setattr (flags.Calo.ClusterCorrection, name2, val)
+
+    from AthenaCommon.JobProperties import jobproperties
+    from AthenaCommon.GlobalFlags   import globalflags
+
+    flags.GeoModel.AtlasVersion = jobproperties.Global.DetDescrVersion()
+    flags.Input.isMC = globalflags.DataSource() != 'data'
+    flags.IOVDb.GlobalTag = globalflags.ConditionsTag()
+
+    return flags
+
+
+#
+# Apply the results of a ComponentAccumulator to Athena.
+# Returns the list of configured correction tools.
+#
+def unpackCA (ca):
+    tools = [conf2toConfigurable(c) for c in  ca.popPrivateTools()]
+    appendCAtoAthena (ca)
+    return tools
diff --git a/Calorimeter/CaloClusterCorrection/python/constants.py b/Calorimeter/CaloClusterCorrection/python/constants.py
index 99236261486b..8db368c1e8cb 100644
--- a/Calorimeter/CaloClusterCorrection/python/constants.py
+++ b/Calorimeter/CaloClusterCorrection/python/constants.py
@@ -1,7 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-#
-# $Id$
 #
 # File: CaloClusterCorrection/python/constants.py
 # Created: Nov 2009, sss
diff --git a/Calorimeter/CaloClusterCorrection/python/linkDummyTags.py b/Calorimeter/CaloClusterCorrection/python/linkDummyTags.py
index dece0a043470..5204f4775bd2 100644
--- a/Calorimeter/CaloClusterCorrection/python/linkDummyTags.py
+++ b/Calorimeter/CaloClusterCorrection/python/linkDummyTags.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
 # File: CaloClusterCorrection/python/linkDummyTags.py
@@ -23,8 +23,8 @@ def get_htags (folder):
     htags = []
     for t in tags:
         try:
-            rtag = subf.resolveTag(t)
-        except:
+            subf.resolveTag(t)
+        except Exception:
             htags.append (t)
 
     tags = subf.listTags()
@@ -40,7 +40,7 @@ def link_tag (f, htag, dtag):
     try:
         f.findTagRelation(htag)
         f.deleteTagRelation(htag)
-    except:
+    except Exception:
         pass
     f.createTagRelation (htag, dtag)
     print ('Linked', htag)
diff --git a/Calorimeter/CaloClusterCorrection/share/CaloSwCorrectionsToPool.py b/Calorimeter/CaloClusterCorrection/share/CaloSwCorrectionsToPool.py
index 08ba9b226721..042050500d0a 100755
--- a/Calorimeter/CaloClusterCorrection/share/CaloSwCorrectionsToPool.py
+++ b/Calorimeter/CaloClusterCorrection/share/CaloSwCorrectionsToPool.py
@@ -20,9 +20,13 @@ CaloSwCorrKeys = ['ele55', 'ele35', 'ele37',
 from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections
 from CaloClusterCorrection.common import CALOCORR_SW
 
-(corr_output_list, tag_list) =\
-                   CaloSwCorrections.config_for_pool (CaloSwCorrKeys,
+from CaloClusterCorrection.compat import makeFlags
+from AthenaConfiguration.ComponentAccumulator import appendCAtoAthena
+(corr_output_list, tag_list, ca) =\
+                   CaloSwCorrections.config_for_pool (makeFlags(),
+                                                      CaloSwCorrKeys,
                                                       CALOCORR_SW)
+appendCAtoAthena (ca)
 
 # include the basic setup for the conditions output stream
 pool_file = CALOCORR_POOLFILE
diff --git a/Calorimeter/CaloClusterCorrection/share/CaloTopoEMCorrectionsToPool.py b/Calorimeter/CaloClusterCorrection/share/CaloTopoEMCorrectionsToPool.py
index 9b81f152a164..cf915f2e378e 100755
--- a/Calorimeter/CaloClusterCorrection/share/CaloTopoEMCorrectionsToPool.py
+++ b/Calorimeter/CaloClusterCorrection/share/CaloTopoEMCorrectionsToPool.py
@@ -19,9 +19,13 @@ CaloTopoEMCorrKeys = ['ele633', 'ele420', 'gam633']
 from CaloClusterCorrection.CaloTopoEMCorrections import CaloTopoEMCorrections
 from CaloClusterCorrection.common import CALOCORR_EMTOPO
 
-(corr_output_list, tag_list) =\
-                   CaloTopoEMCorrections.config_for_pool (CaloTopoEMCorrKeys,
+from CaloClusterCorrection.compat import makeFlags
+from AthenaConfiguration.ComponentAccumulator import appendCAtoAthena
+(corr_output_list, tag_list, ca) =\
+                   CaloTopoEMCorrections.config_for_pool (makeFlags(),
+                                                          CaloTopoEMCorrKeys,
                                                           CALOCORR_EMTOPO)
+appendCAtoAthena (ca)
 
 # include the basic setup for the conditions output stream
 pool_file = CALOCORR_POOLFILE
diff --git a/Calorimeter/CaloClusterCorrection/share/config_test.ref b/Calorimeter/CaloClusterCorrection/share/config_test.ref
new file mode 100644
index 000000000000..a1c732ce440b
--- /dev/null
+++ b/Calorimeter/CaloClusterCorrection/share/config_test.ref
@@ -0,0 +1,26 @@
+Py:Athena            INFO using release [?-22.0.0] [?] [?/?] -- built on [?]
+Py:CaloClusterCorrection    INFO EM sliding-window corrections for ele35 () using version v12_calh
+Py:AutoConfigFlags    INFO Obtaining metadata of auto-configuration by peeking into /home/sss/nobackup/referencefiles/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1
+Py:MetaReader        INFO Current mode used: peeker
+Py:MetaReader        INFO Current filenames: ['/home/sss/nobackup/referencefiles/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1']
+Py:CaloClusterCorrection    INFO EM sliding-window corrections for gam35_conv () using version @GLOBAL
+Py:CaloClusterCorrection    INFO EM sliding-window corrections for gam35 () using version @GLOBAL
+Py:CaloClusterCorrection    INFO EM sliding-window corrections for gam35 () using version v6_lwc
+Py:CaloClusterCorrection    INFO EM sliding-window corrections for gam35 () using version v6_lwc
+Py:CaloClusterCorrection    INFO EM sliding-window corrections for gam35 () using version @CaloOflSwClusterCorrections-00-02-01-v6_calh
+PrivateToolHandleArray    WARNING CaloDummyCorrection('larupdatee-dummy', prefix='e.') with instance name 'larupdatee-dummy' already in list. Not adding CaloDummyCorrection('larupdatee-dummy', prefix='e.')
+PrivateToolHandleArray    WARNING CaloDummyCorrection('etaoffe-dummy', prefix='e.') with instance name 'etaoffe-dummy' already in list. Not adding CaloDummyCorrection('etaoffe-dummy', prefix='e.')
+PrivateToolHandleArray    WARNING CaloDummyCorrection('phioffe-dummy', prefix='e.') with instance name 'phioffe-dummy' already in list. Not adding CaloDummyCorrection('phioffe-dummy', prefix='e.')
+PrivateToolHandleArray    WARNING CaloDummyCorrection('phimode-dummy', prefix='e.') with instance name 'phimode-dummy' already in list. Not adding CaloDummyCorrection('phimode-dummy', prefix='e.')
+PrivateToolHandleArray    WARNING CaloDummyCorrection('etamode-dummy', prefix='e.') with instance name 'etamode-dummy' already in list. Not adding CaloDummyCorrection('etamode-dummy', prefix='e.')
+PrivateToolHandleArray    WARNING CaloDummyCorrection('clcone-dummy', prefix='e.') with instance name 'clcone-dummy' already in list. Not adding CaloDummyCorrection('clcone-dummy', prefix='e.')
+PrivateToolHandleArray    WARNING CaloDummyCorrection('gape-dummy', prefix='e.') with instance name 'gape-dummy' already in list. Not adding CaloDummyCorrection('gape-dummy', prefix='e.')
+PrivateToolHandleArray    WARNING CaloDummyCorrection('lwce-dummy', prefix='e.') with instance name 'lwce-dummy' already in list. Not adding CaloDummyCorrection('lwce-dummy', prefix='e.')
+PrivateToolHandleArray    WARNING CaloDummyCorrection('rface-dummy', prefix='e.') with instance name 'rface-dummy' already in list. Not adding CaloDummyCorrection('rface-dummy', prefix='e.')
+PrivateToolHandleArray    WARNING CaloDummyCorrection('calhitse-dummy', prefix='e.') with instance name 'calhitse-dummy' already in list. Not adding CaloDummyCorrection('calhitse-dummy', prefix='e.')
+PrivateToolHandleArray    WARNING CaloDummyCorrection('trcorre-dummy', prefix='e.') with instance name 'trcorre-dummy' already in list. Not adding CaloDummyCorrection('trcorre-dummy', prefix='e.')
+PrivateToolHandleArray    WARNING CaloDummyCorrection('deadOTXpse-dummy', prefix='e.') with instance name 'deadOTXpse-dummy' already in list. Not adding CaloDummyCorrection('deadOTXpse-dummy', prefix='e.')
+PrivateToolHandleArray    WARNING CaloDummyCorrection('deadOTXbacke-dummy', prefix='e.') with instance name 'deadOTXbacke-dummy' already in list. Not adding CaloDummyCorrection('deadOTXbacke-dummy', prefix='e.')
+Final OutputList:
+['CaloRec::ToolConstants#CaloSwClusterCorrections.larupdate#/CALO/CaloSwClusterCorrections/larupdate', 'CaloRec::ToolConstants#CaloSwClusterCorrections.etaoff-g3#/CALO/CaloSwClusterCorrections/etaoff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phioff-g3#/CALO/CaloSwClusterCorrections/phioff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phimod-g3#/CALO/CaloSwClusterCorrections/phimod', 'CaloRec::ToolConstants#CaloSwClusterCorrections.etamod-g3#/CALO/CaloSwClusterCorrections/etamod', 'CaloRec::ToolConstants#CaloSwClusterCorrections.larupdate-dont_update_e#/CALO/CaloSwClusterCorrections/larupdate', 'CaloRec::ToolConstants#CaloSwClusterCorrections.clcon-g3#/CALO/CaloSwClusterCorrections/clcon', 'CaloRec::ToolConstants#CaloSwClusterCorrections.gap-g3#/CALO/CaloSwClusterCorrections/gap', 'CaloRec::ToolConstants#CaloSwClusterCorrections.etaoff-v2#/CALO/CaloSwClusterCorrections/etaoff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phioff-v2#/CALO/CaloSwClusterCorrections/phioff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phimod-v2#/CALO/CaloSwClusterCorrections/phimod', 'CaloRec::ToolConstants#CaloSwClusterCorrections.etamod-v2#/CALO/CaloSwClusterCorrections/etamod', 'CaloRec::ToolConstants#CaloSwClusterCorrections.gap-v2#/CALO/CaloSwClusterCorrections/gap', 'CaloRec::ToolConstants#CaloSwClusterCorrections.clcon-dc2#/CALO/CaloSwClusterCorrections/clcon', 'CaloRec::ToolConstants#CaloSwClusterCorrections.lwc-old#/CALO/CaloSwClusterCorrections/lwc', 'CaloRec::ToolConstants#CaloSwClusterCorrections.lwc-904#/CALO/CaloSwClusterCorrections/lwc', 'CaloRec::ToolConstants#CaloSwClusterCorrections.clcon-dc2new#/CALO/CaloSwClusterCorrections/clcon', 'CaloRec::ToolConstants#CaloSwClusterCorrections.lwc-904gap#/CALO/CaloSwClusterCorrections/lwc', 'CaloRec::ToolConstants#CaloSwClusterCorrections.gap-v3#/CALO/CaloSwClusterCorrections/gap', 'CaloRec::ToolConstants#CaloSwClusterCorrections.lwc-v3#/CALO/CaloSwClusterCorrections/lwc', 'CaloRec::ToolConstants#CaloSwClusterCorrections.rfac-v3#/CALO/CaloSwClusterCorrections/rfac', 'CaloRec::ToolConstants#CaloSwClusterCorrections.etaoff-v3#/CALO/CaloSwClusterCorrections/etaoff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phioff-v3#/CALO/CaloSwClusterCorrections/phioff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.gap-v3_1#/CALO/CaloSwClusterCorrections/gap', 'CaloRec::ToolConstants#CaloSwClusterCorrections.lwc-v3_1#/CALO/CaloSwClusterCorrections/lwc', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phimod-v3#/CALO/CaloSwClusterCorrections/phimod', 'CaloRec::ToolConstants#CaloSwClusterCorrections.etamod-v3#/CALO/CaloSwClusterCorrections/etamod', 'CaloRec::ToolConstants#CaloSwClusterCorrections.rfac-v4#/CALO/CaloSwClusterCorrections/rfac', 'CaloRec::ToolConstants#CaloSwClusterCorrections.etaoff-v4#/CALO/CaloSwClusterCorrections/etaoff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phioff-v4#/CALO/CaloSwClusterCorrections/phioff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.gap-v4#/CALO/CaloSwClusterCorrections/gap', 'CaloRec::ToolConstants#CaloSwClusterCorrections.lwc-v4#/CALO/CaloSwClusterCorrections/lwc', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phimod-v4#/CALO/CaloSwClusterCorrections/phimod', 'CaloRec::ToolConstants#CaloSwClusterCorrections.etamod-v4#/CALO/CaloSwClusterCorrections/etamod', 'CaloRec::ToolConstants#CaloSwClusterCorrections.etaoff-v4_1#/CALO/CaloSwClusterCorrections/etaoff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.calhits-v1#/CALO/CaloSwClusterCorrections/calhits', 'CaloRec::ToolConstants#CaloSwClusterCorrections.calhits-v2#/CALO/CaloSwClusterCorrections/calhits', 'CaloRec::ToolConstants#CaloSwClusterCorrections.trcorr-v1#/CALO/CaloSwClusterCorrections/trcorr', 'CaloRec::ToolConstants#CaloSwClusterCorrections.lwc-v5#/CALO/CaloSwClusterCorrections/lwc', 'CaloRec::ToolConstants#CaloSwClusterCorrections.lwc-v6#/CALO/CaloSwClusterCorrections/lwc', 'CaloRec::ToolConstants#CaloSwClusterCorrections.calhits-v5#/CALO/CaloSwClusterCorrections/calhits', 'CaloRec::ToolConstants#CaloSwClusterCorrections.trcorr-v5#/CALO/CaloSwClusterCorrections/trcorr', 'CaloRec::ToolConstants#CaloSwClusterCorrections.calhits-v5_1#/CALO/CaloSwClusterCorrections/calhits', 'CaloRec::ToolConstants#CaloSwClusterCorrections.trcorr-v5_1#/CALO/CaloSwClusterCorrections/trcorr', 'CaloRec::ToolConstants#CaloSwClusterCorrections.calhits-v6#/CALO/CaloSwClusterCorrections/calhits', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phioff-v4data#/CALO/CaloSwClusterCorrections/phioff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phimod-v4data#/CALO/CaloSwClusterCorrections/phimod', 'CaloRec::ToolConstants#CaloSwClusterCorrections.calhits-v6leakdata#/CALO/CaloSwClusterCorrections/calhits', 'CaloRec::ToolConstants#CaloSwClusterCorrections.deadOTXps-v1#/CALO/CaloSwClusterCorrections/deadOTXps', 'CaloRec::ToolConstants#CaloSwClusterCorrections.deadOTXback-v1#/CALO/CaloSwClusterCorrections/deadOTXback', 'CaloRec::ToolConstants#CaloSwClusterCorrections.calhits-v8#/CALO/CaloSwClusterCorrections/calhits', 'CaloRec::ToolConstants#CaloSwClusterCorrections.calhits-v8leakdata#/CALO/CaloSwClusterCorrections/calhits', 'CaloRec::ToolConstants#CaloSwClusterCorrections.calhits-v9#/CALO/CaloSwClusterCorrections/calhits', 'CaloRec::ToolConstants#CaloSwClusterCorrections.calhits-v9leakdata#/CALO/CaloSwClusterCorrections/calhits', 'CaloRec::ToolConstants#CaloSwClusterCorrections.gap-v5#/CALO/CaloSwClusterCorrections/gap', 'CaloRec::ToolConstants#CaloSwClusterCorrections.gap-v6#/CALO/CaloSwClusterCorrections/gap', 'CaloRec::ToolConstants#CaloSwClusterCorrections.rfac-v5#/CALO/CaloSwClusterCorrections/rfac', 'CaloRec::ToolConstants#CaloSwClusterCorrections.etaoff-v5#/CALO/CaloSwClusterCorrections/etaoff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phioff-v5#/CALO/CaloSwClusterCorrections/phioff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phioff-v5data#/CALO/CaloSwClusterCorrections/phioff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.lwc-atlfast_v1#/CALO/CaloSwClusterCorrections/lwc', 'CaloRec::ToolConstants#CaloSwClusterCorrections.lwc-pi0_v1#/CALO/CaloSwClusterCorrections/lwc', 'CaloRec::ToolConstants#CaloSwClusterCorrections.larupdate-dummy#/CALO/CaloSwClusterCorrections/larupdate', 'CaloRec::ToolConstants#CaloSwClusterCorrections.etaoff-dummy#/CALO/CaloSwClusterCorrections/etaoff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phioff-dummy#/CALO/CaloSwClusterCorrections/phioff', 'CaloRec::ToolConstants#CaloSwClusterCorrections.phimod-dummy#/CALO/CaloSwClusterCorrections/phimod', 'CaloRec::ToolConstants#CaloSwClusterCorrections.etamod-dummy#/CALO/CaloSwClusterCorrections/etamod', 'CaloRec::ToolConstants#CaloSwClusterCorrections.clcon-dummy#/CALO/CaloSwClusterCorrections/clcon', 'CaloRec::ToolConstants#CaloSwClusterCorrections.gap-dummy#/CALO/CaloSwClusterCorrections/gap', 'CaloRec::ToolConstants#CaloSwClusterCorrections.lwc-dummy#/CALO/CaloSwClusterCorrections/lwc', 'CaloRec::ToolConstants#CaloSwClusterCorrections.rfac-dummy#/CALO/CaloSwClusterCorrections/rfac', 'CaloRec::ToolConstants#CaloSwClusterCorrections.calhits-dummy#/CALO/CaloSwClusterCorrections/calhits', 'CaloRec::ToolConstants#CaloSwClusterCorrections.trcorr-dummy#/CALO/CaloSwClusterCorrections/trcorr', 'CaloRec::ToolConstants#CaloSwClusterCorrections.deadOTXps-dummy#/CALO/CaloSwClusterCorrections/deadOTXps', 'CaloRec::ToolConstants#CaloSwClusterCorrections.deadOTXback-dummy#/CALO/CaloSwClusterCorrections/deadOTXback']
+['CaloSwClusterCorrections.00-02-13-larupdate', 'CaloSwClusterCorrections.00-02-13-etaoff-g3', 'CaloSwClusterCorrections.00-02-13-phioff-g3', 'CaloSwClusterCorrections.00-02-13-phimod-g3', 'CaloSwClusterCorrections.00-02-13-etamod-g3', 'CaloSwClusterCorrections.00-02-13-larupdate-dont_update_e', 'CaloSwClusterCorrections.00-02-13-clcon-g3', 'CaloSwClusterCorrections.00-02-13-gap-g3', 'CaloSwClusterCorrections.00-02-13-etaoff-v2', 'CaloSwClusterCorrections.00-02-13-phioff-v2', 'CaloSwClusterCorrections.00-02-13-phimod-v2', 'CaloSwClusterCorrections.00-02-13-etamod-v2', 'CaloSwClusterCorrections.00-02-13-gap-v2', 'CaloSwClusterCorrections.00-02-13-clcon-dc2', 'CaloSwClusterCorrections.00-02-13-lwc-old', 'CaloSwClusterCorrections.00-02-13-lwc-904', 'CaloSwClusterCorrections.00-02-13-clcon-dc2new', 'CaloSwClusterCorrections.00-02-13-lwc-904gap', 'CaloSwClusterCorrections.00-02-13-gap-v3', 'CaloSwClusterCorrections.00-02-13-lwc-v3', 'CaloSwClusterCorrections.00-02-13-rfac-v3', 'CaloSwClusterCorrections.00-02-13-etaoff-v3', 'CaloSwClusterCorrections.00-02-13-phioff-v3', 'CaloSwClusterCorrections.00-02-13-gap-v3_1', 'CaloSwClusterCorrections.00-02-13-lwc-v3_1', 'CaloSwClusterCorrections.00-02-13-phimod-v3', 'CaloSwClusterCorrections.00-02-13-etamod-v3', 'CaloSwClusterCorrections.00-02-13-rfac-v4', 'CaloSwClusterCorrections.00-02-13-etaoff-v4', 'CaloSwClusterCorrections.00-02-13-phioff-v4', 'CaloSwClusterCorrections.00-02-13-gap-v4', 'CaloSwClusterCorrections.00-02-13-lwc-v4', 'CaloSwClusterCorrections.00-02-13-phimod-v4', 'CaloSwClusterCorrections.00-02-13-etamod-v4', 'CaloSwClusterCorrections.00-02-13-etaoff-v4_1', 'CaloSwClusterCorrections.00-02-13-calhits-v1', 'CaloSwClusterCorrections.00-02-13-calhits-v2', 'CaloSwClusterCorrections.00-02-13-trcorr-v1', 'CaloSwClusterCorrections.00-02-13-lwc-v5', 'CaloSwClusterCorrections.00-02-13-lwc-v6', 'CaloSwClusterCorrections.00-02-13-calhits-v5', 'CaloSwClusterCorrections.00-02-13-trcorr-v5', 'CaloSwClusterCorrections.00-02-13-calhits-v5_1', 'CaloSwClusterCorrections.00-02-13-trcorr-v5_1', 'CaloSwClusterCorrections.00-02-13-calhits-v6', 'CaloSwClusterCorrections.00-02-13-phioff-v4data', 'CaloSwClusterCorrections.00-02-13-phimod-v4data', 'CaloSwClusterCorrections.00-02-13-calhits-v6leakdata', 'CaloSwClusterCorrections.00-02-13-deadOTXps-v1', 'CaloSwClusterCorrections.00-02-13-deadOTXback-v1', 'CaloSwClusterCorrections.00-02-13-calhits-v8', 'CaloSwClusterCorrections.00-02-13-calhits-v8leakdata', 'CaloSwClusterCorrections.00-02-13-calhits-v9', 'CaloSwClusterCorrections.00-02-13-calhits-v9leakdata', 'CaloSwClusterCorrections.00-02-13-gap-v5', 'CaloSwClusterCorrections.00-02-13-gap-v6', 'CaloSwClusterCorrections.00-02-13-rfac-v5', 'CaloSwClusterCorrections.00-02-13-etaoff-v5', 'CaloSwClusterCorrections.00-02-13-phioff-v5', 'CaloSwClusterCorrections.00-02-13-phioff-v5data', 'CaloSwClusterCorrections.00-02-13-lwc-atlfast_v1', 'CaloSwClusterCorrections.00-02-13-lwc-pi0_v1', 'CaloSwClusterCorrections.00-02-13-larupdate-dummy', 'CaloSwClusterCorrections.00-02-13-etaoff-dummy', 'CaloSwClusterCorrections.00-02-13-phioff-dummy', 'CaloSwClusterCorrections.00-02-13-phimod-dummy', 'CaloSwClusterCorrections.00-02-13-etamod-dummy', 'CaloSwClusterCorrections.00-02-13-clcon-dummy', 'CaloSwClusterCorrections.00-02-13-gap-dummy', 'CaloSwClusterCorrections.00-02-13-lwc-dummy', 'CaloSwClusterCorrections.00-02-13-rfac-dummy', 'CaloSwClusterCorrections.00-02-13-calhits-dummy', 'CaloSwClusterCorrections.00-02-13-trcorr-dummy', 'CaloSwClusterCorrections.00-02-13-deadOTXps-dummy', 'CaloSwClusterCorrections.00-02-13-deadOTXback-dummy']
diff --git a/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveBad.cxx b/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveBad.cxx
index 9e99d4f3d3c4..7d82941633cf 100755
--- a/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveBad.cxx
+++ b/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveBad.cxx
@@ -35,9 +35,6 @@ CaloClusterRemoveBad::CaloClusterRemoveBad(const std::string& type,
   // Energy threshold for cluster removal.
   declareProperty ("EMin", m_eThreshold = 0.0,
                    "Energy threshold for cluster removal.");
-
-  // Not used, but required to use this with CaloRunClusterCorrections.
-  declareProperty ("order",    m_order = 0);
 }
 
 
diff --git a/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveBad.h b/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveBad.h
index 9870d1ecf44c..f3c5c7a4962d 100755
--- a/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveBad.h
+++ b/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveBad.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef CALOCLUSTERCORRECTION_CALOCLUSTERREMOVEBAD_H
@@ -67,9 +67,6 @@ public:
   
   // property, energy threshold below which a cluster will be rejected.
   float  m_eThreshold ; 
-
-  // Not used, but required to use this with CaloRunClusterCorrections.
-  int m_order;
 };
 
 #endif
diff --git a/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveDuplicates.cxx b/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveDuplicates.cxx
index cae9b28be7cf..68d66f1f72c6 100755
--- a/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveDuplicates.cxx
+++ b/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveDuplicates.cxx
@@ -35,9 +35,6 @@ CaloClusterRemoveDuplicates::CaloClusterRemoveDuplicates(const std::string& type
 { 
   declareProperty ("deta_cut", m_deta_cut = 0.05 );
   declareProperty ("dphi_cut", m_dphi_cut = 0.05 );
-
-  // Not used, but required to use this with CaloRunClusterCorrections.
-  declareProperty ("order",    m_order = 0);
 }
 
 StatusCode
diff --git a/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveDuplicates.h b/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveDuplicates.h
index fc7b7ff65198..ce2605ec9089 100755
--- a/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveDuplicates.h
+++ b/Calorimeter/CaloClusterCorrection/src/CaloClusterRemoveDuplicates.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef CALOCLUSTERCORRECTION_CALOCLUSTERREMOVEDUPLICATES_H
@@ -47,9 +47,6 @@ class CaloClusterRemoveDuplicates :  public AthAlgTool, virtual public CaloClust
   // If two cluster are within deta_cut and dphi_cut, lower ET one will be removed
   float m_deta_cut;
   float m_dphi_cut;
-
-  // Not used, but required to use this with CaloRunClusterCorrections.
-  int m_order;
 };
 
 #endif
diff --git a/Calorimeter/CaloClusterCorrection/src/CaloComputeSWcellWeights.cxx b/Calorimeter/CaloClusterCorrection/src/CaloComputeSWcellWeights.cxx
index 8bef5210d9b9..9ce12cd1e73f 100755
--- a/Calorimeter/CaloClusterCorrection/src/CaloComputeSWcellWeights.cxx
+++ b/Calorimeter/CaloClusterCorrection/src/CaloComputeSWcellWeights.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /********************************************************************
@@ -39,8 +39,6 @@ CaloComputeSWcellWeights::CaloComputeSWcellWeights(const std::string& type,
                                                    const IInterface* parent)
   : AthAlgTool(type, name, parent)
 { 
-  // Not used, but required to use this with CaloRunClusterCorrections.
-  declareProperty ("order", m_order = 0);
 }
 
 // Make Corrections for SW cell weights 
diff --git a/Calorimeter/CaloClusterCorrection/src/CaloComputeSWcellWeights.h b/Calorimeter/CaloClusterCorrection/src/CaloComputeSWcellWeights.h
index 5051f2c863de..37047d20001f 100755
--- a/Calorimeter/CaloClusterCorrection/src/CaloComputeSWcellWeights.h
+++ b/Calorimeter/CaloClusterCorrection/src/CaloComputeSWcellWeights.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 //Dear emacs, this is -*-c++-*-
@@ -45,9 +45,6 @@ class CaloComputeSWcellWeights : public AthAlgTool, virtual public CaloClusterCo
  private:
 
   CaloComputeSWcellWeights();
-
-  // Not used, but required to use this with CaloRunClusterCorrections.
-  int m_order;
 };
 
 #endif
diff --git a/Calorimeter/CaloClusterCorrection/src/CaloRunClusterCorrections.cxx b/Calorimeter/CaloClusterCorrection/src/CaloRunClusterCorrections.cxx
deleted file mode 100644
index f7e66be66c4f..000000000000
--- a/Calorimeter/CaloClusterCorrection/src/CaloRunClusterCorrections.cxx
+++ /dev/null
@@ -1,872 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
- * @file  CaloRunClusterCorrections.cxx
- * @author scott snyder <snyder@bnl.gov>
- * @date Apr, 2009
- * @brief Meta-tool to construct and run a list of correction tools.
- *
- * See the header file for a complete description.
- */
-
-
-#include "CaloRunClusterCorrections.h"
-#include "CaloClusterCorrection/CaloClusterCorrectionCommon.h"
-#include "CaloRec/ToolWithConstantsMixin.h"
-#include "CaloUtils/CaloClusterStoreHelper.h"
-#include "xAODCaloEvent/CaloClusterContainer.h"
-#include "xAODCaloEvent/CaloCluster.h"
-#include "AthenaKernel/errorcheck.h"
-#include "CxxUtils/Array.h"
-#include "AthenaKernel/getMessageSvc.h"
-#include "Gaudi/Property.h"
-#include "GaudiKernel/MsgStream.h"
-#include "GaudiKernel/IToolSvc.h"
-#include <set>
-
-
-using xAOD::CaloCluster;
-
-namespace {
-
-
-/// Return the number of characters A and B have in common at the start.
-size_t match_len (const std::string& a, const std::string& b)
-{
-  size_t len = 0;
-  while (len < a.size() && len < b.size() && a[len] == b[len])
-    ++len;
-  return len;
-}
-
-
-} // anonymous namespace
-
-
-/**
- * @brief Constructor.
- * @param type The type of the tool.
- * @param name The name of the tool.
- * @param parent The parent algorithm of the tool.
- */
-CaloRunClusterCorrections::CaloRunClusterCorrections (const std::string& type,
-                                                      const std::string& name,
-                                                      const IInterface* parent)
-  : CaloClusterProcessor (type, name, parent),
-    m_jos       ("JobOptionsSvc", name),
-    m_toolsvc   ("ToolSvc",       name),
-    m_coolInlineTool("Blob2ToolConstants",this)
-{
-  declareProperty ("CorrSpecs",     m_corrspecs);
-  declareProperty ("KeepList",      m_keeplist);
-  declareProperty ("PreserveOrder", m_preserveOrder = false);
-  declareProperty ("NoClearProps",  m_noClearProps = false);
-
-  declareProperty ("JobOptionsSvc", m_jos);
-  declareProperty ("ToolSvc",       m_toolsvc);
-  declareProperty ("COOLFolder",    m_folderName);
-}
-
-
-/**
- * @brief Standard initialize method.
- */
-StatusCode CaloRunClusterCorrections::initialize ATLAS_NOT_THREAD_SAFE /*Can Register callbacks but no need to be thread safe*/ ()
-{
-  // Fetch services used.
-  CHECK( m_jos.retrieve() );
-  CHECK( m_toolsvc.retrieve() );
-
-  // Parse input properties.
-  CHECK( parseCorrspecs() );
-  CHECK( parseKeeplist() );
-
-  // Create tools that don't depend on DB.
-  CHECK( createTools() );
-
-  // Set up callbacks for tools do depend on the DB.
-  // Note: we _must_ return @c SUCCESS after doing this, or we may
-  // cause a crash.
-  registerCallbacks();
-
-  ATH_CHECK( m_affKey.initialize() );
-  ATH_CHECK( m_LArBCKey.initialize() );
-  ATH_CHECK( m_TileBCKey.initialize() );
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief Standard finalize method.
- */
-StatusCode CaloRunClusterCorrections::finalize()
-{
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief Execute on a single cluster.
- * @param The cluster to process.
- * @param ctx The event context.
- *
- * This will iterate over all correction tools and call them on the
- * cluster.
- *
- * Warning: Any defined tools that cannot process single clusters
- * (only cluster collections) will be skipped!
- */
-StatusCode CaloRunClusterCorrections::execute (const EventContext& ctx,
-                                               CaloCluster* cluster) const
-{
-  // Loop over tools and run each one on the cluster.
-  for (unsigned int itool = 0;
-       itool < m_toolorder.size();
-       ++itool)
-  {
-    const Tool& tool = m_tools[m_toolorder[itool]];
-    if (tool.clusproc)
-      CHECK( tool.clusproc->execute (ctx, cluster) );
-    else {
-      REPORT_MESSAGE (MSG::WARNING)
-        << "Tool " << tool.name
-        << " is not defined for individual clusters; skipped!";
-    }
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief Execute on an entire collection of clusters.
- * @param The container of clusters.
- * @param ctx The event context.
- *
- * This will iterate over all correction tools and call them on the
- * cluster collection.
- */
-StatusCode
-CaloRunClusterCorrections::execute (const EventContext& ctx,
-                                    xAOD::CaloClusterContainer* collection) const
-{
-  // Loop over correction tools.
-  for (unsigned int itool = 0;
-       itool < m_toolorder.size();
-       ++itool)
-  {
-    const Tool& tool = m_tools[m_toolorder[itool]];
-
-    // See if we should store an intermediate cluster container before
-    // the next correction.
-    if (!tool.save_container.empty()) {
-      xAOD::CaloClusterContainer* interimCont=CaloClusterStoreHelper::makeContainer(&(*evtStore()),tool.save_container,msg());
-      CaloClusterStoreHelper::copyContainer(collection,interimCont);
-      CHECK(CaloClusterStoreHelper::finalizeClusters(&(*evtStore()),interimCont, tool.save_container, msg()));
-    }
-    
-    CHECK( tool.collproc->execute (ctx, collection) );
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief Change the name of the CaloCellContainer used by this tool.
- * @param name The new container name.
- */
-StatusCode
-CaloRunClusterCorrections::setCaloCellContainerName
-  (const std::string& name)
-{
-  for (size_t itool = 0; itool < m_tools.size(); ++itool) {
-    ISetCaloCellContainerName* setter = m_tools[itool].setcellcontname;
-    if (setter)
-      CHECK (setter->setCaloCellContainerName (name) );
-  }
-  return StatusCode::SUCCESS;
-}
-
-
-//****************************************************************************
-
-
-/**
- * @brief Parse the supplied correction specification and create
- *        the Tools vector.  Do not actually create the tools yet.
- */
-StatusCode CaloRunClusterCorrections::parseCorrspecs ATLAS_NOT_THREAD_SAFE ()
-{
-  size_t ispec = 0;
-  while (ispec < m_corrspecs.size()) {
-    // Starting a new tool.
-    Tool tool;
-    tool.collproc = nullptr;
-    tool.clusproc = nullptr;
-    tool.setcellcontname = nullptr;
-
-    // -- Name.
-    tool.name = m_corrspecs[ispec++];
-    std::string fullname = this->name() + "." + tool.name;
-
-    // -- Key or class.
-    if (ispec >= m_corrspecs.size()) {
-      REPORT_ERROR(StatusCode::FAILURE)
-        << "Malformed corrections spec: missing location.";
-      return StatusCode::FAILURE;
-    }
-
-    tool.use_callback = false;
-    if (m_corrspecs[ispec][0] == '+') {
-      // Initializing from JO.
-      tool.clsname = m_corrspecs[ispec].substr (1);
-    }
-    else if (m_corrspecs[ispec][0] == '@') {
-      // Initializing directly from detector store (POOL).
-      tool.sgkey = m_corrspecs[ispec].substr (1);
-    }
-    else {
-      // Initializing from COOL.
-      // The SG key here is the same as the folder name.
-      tool.sgkey = m_corrspecs[ispec];
-      tool.use_callback = true;
-    }
-
-    if (tool.clsname.empty() && tool.sgkey.empty()) {
-      REPORT_ERROR(StatusCode::FAILURE)
-        << "Malformed corrections spec: missing key-or-classname.";
-      return StatusCode::FAILURE;
-    }
-
-    // Set tool properties needed to access the detector store.
-    // We don't want the tool itself to register a callback; we'll
-    // do that ourselves and forward callbacks as appropriate.
-    if (!tool.sgkey.empty()) {
-      m_jos->set (fullname + ".detStoreKey", tool.sgkey);
-      m_jos->set (fullname + ".useCallback", Gaudi::Utils::toString(false));
-      m_jos->set (fullname + ".COOLFolder",  m_folderName);
-    }
-
-    ++ispec;
-
-    // -- Prefix.
-    if (ispec >= m_corrspecs.size()) {
-      REPORT_ERROR(StatusCode::FAILURE)
-        << "Malformed corrections spec: missing prefix.";
-      return StatusCode::FAILURE;
-    }
-    tool.prefix = m_corrspecs[ispec++];
-    tool.resolved_prefix = tool.prefix;
-    if (!tool.prefix.empty())
-      m_jos->set (fullname + ".prefix", tool.prefix);
-
-    // -- Put properties in the JO service.
-    while (ispec < m_corrspecs.size()) {
-      std::string key = m_corrspecs[ispec++];
-      if (key.empty()) break;
-
-      if (ispec >= m_corrspecs.size()) {
-        REPORT_ERROR(StatusCode::FAILURE)
-          << "Malformed corrections spec for tool " << tool.name
-          << ": No value for key " << key;
-        return StatusCode::FAILURE;
-      }
-
-      m_jos->set (fullname + "." + key, m_corrspecs[ispec++]);
-    }
-
-    // Done with this tool.
-    m_tools.push_back (tool);
-    REPORT_MESSAGE(MSG::DEBUG) << "Done parsing for tool" << tool.name;
-  }
-
-  // We don't need the property value any more, and it can be pretty long.
-  // Clear it out to reclaim memory.
-  if (!m_noClearProps) {
-    m_jos->set (this->name() + ".CorrSpecs", "");
-  }
-  m_corrspecs.clear();
-
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief Parse the supplied @c KeepList property.
- */
-StatusCode CaloRunClusterCorrections::parseKeeplist()
-{
-  for (size_t ikeep = 0; ikeep < m_keeplist.size(); ikeep++) {
-    // Get the next tool name from the property.
-    std::string toolname = m_keeplist[ikeep++];
-
-    // Check that a following element exists.
-    if (ikeep >= m_keeplist.size()) {
-      REPORT_ERROR(StatusCode::FAILURE)
-        << "Malformed KeepList property.";
-      return StatusCode::FAILURE;
-    }
-
-    // Find the tool in our vector.
-    Tool* tool = nullptr;
-    for (size_t itool = 0; itool < m_tools.size(); itool++) {
-      if (m_tools[itool].name == toolname) {
-        tool = &m_tools[itool];
-        break;
-      }
-
-      // Tool names are generally like `trcorr_GLOBAL_gam35'.
-      // Also try matching on the base part of the name, before
-      // the first underscore.
-      std::string::size_type pos = m_tools[itool].name.find ('_');
-      if (pos != std::string::npos &&
-          m_tools[itool].name.substr (0, pos) == toolname)
-      {
-        tool = &m_tools[itool];
-        break;
-      }
-    }
-
-    if (tool) {
-      // Save the requested container name.
-      tool->save_container = m_keeplist[ikeep];
-    }
-    else {
-      REPORT_MESSAGE(MSG::WARNING)
-        << "Didn't find correction tool " << toolname
-        << " while reading KeepList.";
-    }
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief Create all tools that we can during initialization.
- *        Set up to create remaining tools during a callback.
- */
-StatusCode CaloRunClusterCorrections::createTools ATLAS_NOT_THREAD_SAFE /*Binds to callback*/()
-{
-  // Set to true if creation of any tools is deferred to a callback.
-  bool any_cb = false;
-
-  // Loop over tools.
-  for (size_t itool = 0; itool < m_tools.size(); itool++) {
-    Tool& tool = m_tools[itool];
-    const Tool& ctool = tool;
-    REPORT_MESSAGE(MSG::DEBUG) << "Start creating tool " << tool.name;
-    if (tool.sgkey.empty()) {
-      // No pool constants --- we should have been given the class name.
-      // Create the tool immediately.
-      REPORT_MESSAGE(MSG::DEBUG) << "No Pool constants"; 
-      CHECK( makeTool (tool) );
-    }
-    else if (tool.use_callback) {
-      REPORT_MESSAGE(MSG::DEBUG) << "With callback";
-      // Reading this tool from COOL.
-      any_cb = true;
-
-      // Set up a callback function.
-      // The tool will be actually created there.
-
-      // But only register once for each db object!
-      if (std::find (m_registeredDBObjects.begin(),
-                     m_registeredDBObjects.end(),
-                     tool.sgkey) ==
-          m_registeredDBObjects.end())
-      {
-        m_registeredDBObjects.push_back (tool.sgkey);
-        // Note: Don't actually register the callback here.
-        // The reason is that if initialize() fails later on,
-        // then this CaloRunClusterCorrections tool will end up
-        // being deleted, leaving a dangling callback reference.
-        // (Also note that there's no way to delete a callback
-        // once it's been registered.)
-        // So defer the callback registration until after all other
-        // initialization steps have succeeded.
-      }
-      else {
-        // Already set up the callback.  Just bind the handle.
-        tool.use_callback = false;
-	REPORT_MESSAGE(MSG::DEBUG) << "Callback already registered";
-        CHECK( detStore()->bind (ctool.dbconstants, tool.sgkey) );
-      }
-    }
-    else {
-      // Otherwise, configuring directly from the detector store.
-      // Read the payload now to find the class name and create the tool.
-      REPORT_MESSAGE(MSG::DEBUG) << "Constants from DetStore"; 
-      CHECK( detStore()->bind (ctool.dbconstants, tool.sgkey) );
-      CHECK( fixPrefix (tool) );
-      CHECK( clsnameFromDBConstants (tool) );
-      CHECK( makeTool (tool) );
-    }
-  }
-
-  // Put the corrections in the proper order.
-  CHECK( orderCorrections (any_cb) );
-
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief Register correction callbacks.
- *
- * Note that we cannot return @c FAILURE after the first callback
- * has been registered (see comment in @c createTools).
- */
-void
-CaloRunClusterCorrections::registerCallbacks ATLAS_NOT_THREAD_SAFE /*Registers callback*/ ()
-{
-  if (!m_folderName.empty()) { //COOL inline storage
-
-    StatusCode sc=m_coolInlineTool.retrieve(); 
-    if (sc.isFailure()) {
-      REPORT_ERROR(sc) << "Can't retrieve Blob2ToolConstants Tool";
-    }
-      
-
-    //std::vector<std::string> sgkeys;
-    std::vector<Tool>::const_iterator it=m_tools.begin();
-    std::vector<Tool>::const_iterator it_e=m_tools.end();
-    for (;it!=it_e;++it) {
-      sc=m_coolInlineTool->addFolder(m_folderName,it->sgkey);
-      if (sc.isFailure()) {
-	REPORT_ERROR(sc) << "Can't add folder to Blob2ToolConstants Tool";
-      }
-    }
-    sc=detStore()->regFcn(&Blob2ToolConstants::fillObjects,
-			  &(*m_coolInlineTool),
-			  &CaloRunClusterCorrections::updateTools,
-			  this,
-                          true);
-    
-    if (sc.isFailure()) {
-      REPORT_ERROR(sc)
-	<< "Can't register callback for COOL inline storage ";
-      //return sc;
-    }
-  }
-  else { //payload stored in POOL file
-    for (unsigned int itool = 0; itool < m_tools.size(); itool++) {
-      const Tool& ctool = m_tools[itool];
-      if (ctool.use_callback) {
-	StatusCode sc =
-	  detStore()->regFcn(&CaloRunClusterCorrections::updateTools,
-			     this,
-			     ctool.dbconstants,
-			     ctool.sgkey,
-                             true);
-	if (sc.isFailure()) {
-	  // Note that once we've started registering callbacks,
-	  // we cannot return FAILURE from initialize() --- otherwise,
-	  // we'll be left with a dangling callback.
-	  REPORT_ERROR(sc)
-	    << "Can't register callback for tool " << ctool.name;
-	}
-      }
-    }
-  }
-}
-
-
-/**
- * @brief Actually create a tool.
- * @param tool The tool to create.
- */
-StatusCode CaloRunClusterCorrections::makeTool (Tool& tool)
-{
-  // Release any old tool.
-  if (tool.collproc)
-    tool.collproc->release();
-
-  // Get the tool.
-  CHECK( m_toolsvc->retrieveTool (tool.clsname,
-                                  tool.name,
-                                  tool.collproc,
-                                  this) );
-
-  // Downcast as a other interfaces.
-  tool.clusproc = dynamic_cast<CaloClusterProcessor*> (tool.collproc);
-  tool.setcellcontname = 
-    dynamic_cast<ISetCaloCellContainerName*> (tool.collproc);
-
-  
-  REPORT_MESSAGE(MSG::DEBUG) << "Done making tool " << tool.name;
-
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief DB callback function.
- * @param i (Unused)
- * @param keys List of DB folders with changes.
- *
- * This is called when tool constants read from the DB have changed
- * (or after the DB is accessed for the first time).
- */
-StatusCode
-CaloRunClusterCorrections::updateTools ATLAS_NOT_THREAD_SAFE /*callbacks*/ (IOVSVC_CALLBACK_ARGS_P( i, keys))
-{
-  REPORT_MESSAGE(MSG::DEBUG) << "In IOV Callback method updateTools";
-
-  if (!m_folderName.empty()) {
-    //COOL-inline case
-    if (std::find(keys.begin(),keys.end(),m_folderName)==keys.end()) {
-       REPORT_MESSAGE(MSG::DEBUG)
-	 << "The cool folder we care about (" << m_folderName<< ") is not in the list of keys. Do nothing." << endmsg;
-       return StatusCode::SUCCESS;
-    }
-    else
-       REPORT_MESSAGE(MSG::DEBUG)
-	 << "Found cool folder " << m_folderName << " in the list of keys." << endmsg;
-  }
-
-    for (size_t itool = 0; itool < m_tools.size(); ++itool) {
-      Tool& tool = m_tools[itool];
-      const Tool& ctool = m_tools[itool];
-      if (!tool.sgkey.empty()) { // && tool.use_callback) {
-        // Found a tool that needs updating.
-
-        // Verify that we have the constants.
-	//        if (!ctool.dbconstants.isValid()) {
-	if (detStore()->retrieve(ctool.dbconstants,ctool.sgkey).isFailure()) {
-          REPORT_ERROR(StatusCode::FAILURE)
-            << "Constants for tool " << tool.name << " are not valid.";
-          return StatusCode::FAILURE;
-        }
-
-        // If the class name has changed, recreate the tool.
-        // This will also create the tool the first time,
-        // since tool.clsname should be blank then.
-        if (ctool.dbconstants->clsname() != tool.clsname) {
-          CHECK( fixPrefix (tool) );
-          CHECK( clsnameFromDBConstants (tool) );
-          CHECK( makeTool (tool) );
-        }
-        else {
-          // Otherwise, just update the constants.
-          CaloRec::ToolWithConstantsMixin* mixin =
-            dynamic_cast<CaloRec::ToolWithConstantsMixin*> (tool.collproc);
-          if (mixin)
-            CHECK( mixin->processConstantsFromDB (i, keys) );
-          else {
-            REPORT_ERROR(StatusCode::FAILURE)
-              << "Attempted to read constants from database for tool "
-              << tool.name << " that does not derive from "
-              << "CaloRec::ToolWithConstantsMixin.";
-            return StatusCode::FAILURE;
-          }
-        }// end else create tool
-      }//end if found tool to update
-    }//end loop over tools
-
-  // Put the corrections in the proper order.
-  CHECK( orderCorrections (false) );
-
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief Initialize the clsname member of the tool structure.
- * @param tool The tool on which to operate.
- *
- * Fetch the class name from the @c ToolConstants structure.
- * If needed, this will expand ${} constructions; these are available
- * to allow tools which use difference C++ classes for different
- * layers/regions to share the same @c ToolConstants structure.
- *
- * ${LAYER} in the class name will be expanded to either `1' or `2',
- * and ${BE} will be expanded to either `b' or `e', depending on the
- * setting of the @c region property.
- */
-StatusCode 
-CaloRunClusterCorrections::clsnameFromDBConstants ATLAS_NOT_THREAD_SAFE (Tool& tool)
-{
-  const Tool& ctool = tool;
-  const CaloRec::ToolConstants& tc = *ctool.dbconstants;
-  tool.clsname = tc.clsname();
-
-  std::string::size_type ipos = 0;
-  while ((ipos = tool.clsname.find ('$', ipos)) != std::string::npos) {
-    if (tool.clsname.substr (ipos, 8) == "${LAYER}") {
-      int region;
-      CHECK( getConstant (tool, "region", region) );
-      const char* out = "X";
-      switch (region) {
-      case CaloClusterCorrectionCommon::EMB1:
-      case CaloClusterCorrectionCommon::EME1:
-        out = "1";
-        break;
-      case CaloClusterCorrectionCommon::EMB2:
-      case CaloClusterCorrectionCommon::EME2:
-        out = "2";
-        break;
-      default:
-        REPORT_ERROR(StatusCode::FAILURE)
-          << "Bad region code expanding ${LAYER} for tool " << tool.name;
-        return StatusCode::FAILURE;
-      }
-      tool.clsname.replace (ipos, 8, out);
-    }
-    else if (tool.clsname.substr (ipos, 5) == "${BE}") {
-      int region;
-      CHECK( getConstant (tool, "region", region) );
-      const char* out = "X";
-      switch (region) {
-      case CaloClusterCorrectionCommon::EMB2:
-      case CaloClusterCorrectionCommon::EMB1:
-        out = "b";
-        break;
-      case CaloClusterCorrectionCommon::EME1:
-      case CaloClusterCorrectionCommon::EME2:
-        out = "e";
-        break;
-      default:
-        REPORT_ERROR(StatusCode::FAILURE)
-          << "Bad region code expanding ${BE} for tool " << tool.name;
-        return StatusCode::FAILURE;
-      }
-      tool.clsname.replace (ipos, 5, out);
-    }
-    else
-      ++ipos;
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief Initialize @c resolved_prefix for a tool.
- * @param tool The tool on which to operate.
- *
- * If the prefix that was specified at configuration time does not
- * exist in the @c ToolConstants structure, use instead the longest
- * matching prefix.
- */
-StatusCode CaloRunClusterCorrections::fixPrefix ATLAS_NOT_THREAD_SAFE (Tool& tool)
-{
-  const Tool& ctool = tool;
-  using Maptype = CaloRec::ToolConstants::Maptype;
-  const Maptype& map = ctool.dbconstants->map();
-  if (map.empty()) {
-    // If there are no constants, then the prefix setting can't matter...
-    return StatusCode::SUCCESS;
-  }
-
-  std::string prefix = tool.prefix;
-
-  Maptype::const_iterator it = map.lower_bound (prefix);
-
-  if (it == map.end() || it->first.substr (0, prefix.size()) != prefix) {
-    // Prefix not found.  Try to find a match among the existing prefixes.
-
-    // Strip a trailing dot and region code off the prefix.
-    std::string tail;
-    std::string::size_type len = prefix.size();
-    if (len > 0 && prefix[len-1] == '.') {
-      tail = ".";
-      prefix.erase (len-1);
-      --len;
-    }
-
-    if (len >= 2) {
-      std::string tmp = prefix.substr (len-2, 2);
-      if (tmp == "b1" || tmp == "b2" || tmp == "e1" || tmp == "e2") {
-        tail = tmp + tail;
-        prefix.erase (len-2);
-        len -= 2;
-      }
-    }
-
-    // Extract matching prefixes; find the longest match.
-    int longest_len = -1;
-    std::string best_match;
-    for (it = map.begin(); it != map.end(); it++) {
-      std::string::size_type ipos = it->first.find (tail);
-      if (ipos != std::string::npos) {
-        int this_len = match_len (it->first, prefix);
-        if (this_len > longest_len) {
-          longest_len = this_len;
-          best_match = it->first.substr(0, ipos);
-        }
-      }
-    }
-
-    if (longest_len < 0) {
-      REPORT_ERROR(StatusCode::FAILURE)
-        << "No matches for prefix " << tool.prefix
-        << " for tool " << tool.name;
-      return StatusCode::FAILURE;
-    }
-
-    prefix = best_match + tail;
-
-    // Warn if the match isn't long enough.
-    if (longest_len < 3) {
-      REPORT_MESSAGE(MSG::WARNING)
-        << "No good match for prefix " << tool.prefix
-        << " for tool " << tool.name
-        << "; using " << prefix;
-    }
-
-    REPORT_MESSAGE(MSG::DEBUG)
-      << "For tool " << tool.name << " using prefix " << prefix
-      << " instead of requested prefix " << tool.prefix;
-  }
-
-  // Set the prefix.
-  std::string fullname = this->name() + "." + tool.name;
-  m_jos->set (fullname + ".prefix", prefix);
-  tool.resolved_prefix = prefix;
-
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief Fill in @c m_toolorder to run corrections in the proper order.
- */
-StatusCode
-CaloRunClusterCorrections::orderCorrections ATLAS_NOT_THREAD_SAFE (bool allowMissing)
-{
-  // Clear out any previous setting.
-  m_toolorder.clear();
-  m_toolorder.reserve (m_tools.size());
-
-  // Loop over tools.
-  for (size_t itool = 0; itool < m_tools.size(); itool++) {
-    Tool& tool = m_tools[itool];
-    const Tool& ctool = tool;
-    if (m_preserveOrder) {
-      // If PreserveOrder was requested, execute tools in the exact order
-      // in which they were listed.  Don't check for dummies either.
-      tool.order = itool;
-      m_toolorder.push_back (itool);
-    }
-    else if (tool.sgkey.empty()) {
-      // Tool is being initialized from JO.  Find the order property from JOS.
-      const std::string fullname = this->name() + "." + tool.name;
-      tool.order = std::stoi(m_jos->get(fullname + ".order", "-1"));
-
-      // It's an error if it wasn't set.
-      if (tool.order == -1) {
-        REPORT_ERROR(StatusCode::FAILURE)
-          << "Tool " << tool.name
-          << " initialized from JO has no `order' property set.";
-        return StatusCode::FAILURE;
-      }
-
-      // We want to sort this tool.
-      m_toolorder.push_back (itool);
-    }
-    else if (tool.collproc) {
-      // Initializing from detector store or cool.
-      // First check to see if this is a dummy.
-      int isDummy;
-      CHECK( getConstant (ctool, "isDummy", isDummy) );
-      if (isDummy != 0) {
-        // It's a dummy.  Skip this tool.
-        tool.order = -1;
-      }
-      else {
-        // Get the order parameter and sort this tool.
-        int order;
-        CHECK( getConstant (ctool, "order", order) );
-        tool.order = order;
-        m_toolorder.push_back (itool);
-      }
-    }
-    else if (!allowMissing) {
-      // We don't have any valid constants for this tool.
-      REPORT_ERROR(StatusCode::FAILURE)
-        << "Tool " << tool.name << " has no valid constants.";
-      return StatusCode::FAILURE;
-    }
-  }
-
-  // Put the list of tool indices in the proper order.
-  std::sort (m_toolorder.begin(),
-             m_toolorder.end(),
-             ToolorderSort (m_tools));
-
-  // Make a debugging dump of the results of the sort.
-  std::string names;
-  for (size_t ii = 0; ii < m_toolorder.size(); ii++)
-    names += m_tools[m_toolorder[ii]].name + " ";
-  REPORT_MESSAGE(MSG::DEBUG)
-    << "Sorted tools: " << names;
-
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief Sorting helper: constructor.
- * @param the_tools The vector of Tool structs.
- */
-CaloRunClusterCorrections::ToolorderSort::ToolorderSort
-  (const std::vector<Tool>& the_tools)
-  : tools (the_tools)
-{
-}
-
-
-/**
- * @brief Sorting helper: comparison.
- * @param a Index of first tool to compare.
- * @param b Index of second tool to compare.
- */
-bool CaloRunClusterCorrections::ToolorderSort::operator() (int a, int b) const
-{
-  return tools[a].order < tools[b].order;
-}
-
-
-/**
- * @brief Helper to get integer constant from a @c ToolConstants structure.
- * @param tool The tool for which to retrieve the constant.
- * @param pname The constant name (without prefix).
- * @param out[out] The retrieved parameter.
- */
-StatusCode
-CaloRunClusterCorrections::getConstant ATLAS_NOT_THREAD_SAFE (const Tool& tool,
-                                                              const std::string& pname,
-                                                              int& out)
-{
-  if (!tool.dbconstants.isValid()) {
-    REPORT_ERROR(StatusCode::FAILURE)
-      << "DB Constants for tool " << tool.name << " are not valid.";
-    return StatusCode::FAILURE;
-  }
-
-  try {
-    const CxxUtils::Arrayrep& rep =
-      tool.dbconstants->getrep (name(), tool.resolved_prefix + pname);
-    const CxxUtils::Array<0> arr (rep);
-    out = static_cast<int> (arr);
-  }
-  catch (const std::exception& e) {
-    REPORT_ERROR(StatusCode::FAILURE)
-      << "Caught exception retrieving property "
-      << tool.resolved_prefix + pname
-      << " for tool " << tool.name << ": " << e.what();
-    std::ostringstream oss;
-    tool.dbconstants->writeConstants (oss, tool.name);
-    REPORT_ERROR(StatusCode::FAILURE)
-      << " " << oss.str();
-    return StatusCode::FAILURE;
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-
diff --git a/Calorimeter/CaloClusterCorrection/src/CaloRunClusterCorrections.h b/Calorimeter/CaloClusterCorrection/src/CaloRunClusterCorrections.h
deleted file mode 100644
index d6c32bd81538..000000000000
--- a/Calorimeter/CaloClusterCorrection/src/CaloRunClusterCorrections.h
+++ /dev/null
@@ -1,395 +0,0 @@
-// This file's extension implies that it's C, but it is really -*- C++ -*-.
-
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-/* @file  CaloRunClusterCorrections.h
- * @author scott snyder <snyder@bnl.gov>
- * @date Apr, 2009
- * @brief Meta-tool to construct and run a list of correction tools.
- */
-
-
-#ifndef CALORUNCLUSTERCORRECTIONS_H
-#define CALORUNCLUSTERCORRECTIONS_H
-
-
-#include "CaloRec/CaloClusterProcessor.h"
-#include "CaloConditions/ToolConstants.h"
-#include "CaloInterface/ISetCaloCellContainerName.h"
-#include "StoreGate/DataHandle.h" 
-#include "AthenaKernel/IOVSvcDefs.h"
-#include <vector>
-#include <string>
-#include <set>
-
-#include "Gaudi/Interfaces/IOptionsSvc.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "CaloRec/Blob2ToolConstants.h"
-
-#include "CaloConditions/CaloAffectedRegionInfoVec.h"
-#include "TileConditions/TileBadChannels.h"
-#include "LArRecConditions/LArBadChannelCont.h"
-#include "StoreGate/ReadCondHandleKey.h"
-
-#include "CxxUtils/checker_macros.h"
-
-class MsgStream;
-class IToolSvc;
-
-
-/*
- * @brief Meta-tool to construct and run a list of correction tools.
- *
- * The cluster corrections consist of a set of individual correction
- * tools, each with a specific version, and run in a specific order.
- * We want to be able to configure this set of corrections entirely
- * from the database, given only only a global database tag.  Since the
- * set of tools run, their versions (including the proper C++ class to use),
- * and the order in which they run all can depend on the global correction
- * version, we cannot create the individual correction tools from
- * job options.  Instead, we must be able to defer that until the
- * database is accessed.
- *
- * This is handled by this `metatool'.  Rather than create individual
- * correction tools, the job configuration creates an instance of this
- * tool (which is itself a correction tool).  The job configuration
- * supplies this tool with a description of how to determine which
- * tools to create; in general, this will involve looking in the database.
- * During initialization, this tool will then figure out which tools
- * need to be run and will create them.
- *
- * Consider first the case of reading from the database.  We get a list
- * of all possible correction tools that may be used; for each of these
- * we get the corresponding database folder and the prefix to use to find
- * this tool's properties in the @c ToolConstants objects (as well as any
- * property overrides).
- *
- * For each tool, we look up the its data in the corresponding database
- * folder; this will be a @c ToolConstants object.  Now, the first issue
- * is that in order to know in which folders we need to look, all possible
- * correction tools need to be specified during job configuration; but
- * in general, only some of those tools will be used for any given tag.
- * For the folders that aren't used for a tag, that tag will be bound
- * to a dummy @c ToolConstants object; i.e., it will have the @c isDummy
- * property set to @c True.  In this way, the unused tools can be skipped.
- *
- * We also need to know the order in which to execute tools.  Each tool
- * has an `order' property, which is an integer.  Tools should be executed
- * in increasing order of this parameter.
- *
- * In addition to being read from the database, tools may be initialized
- * directly from the detector store (i.e., from a pool file) or entirely
- * from job options.
- *
- * The needed configuration is communicated to this tool via the @c CorrSpecs
- * property.  This is a vector of strings with this layout:
- *   Each tool is defined by:
- *     TOOLNAME LOCATION PREFIX PARM-NAME PARM-VAL ... ""
- *
- *   First element is the name of the tool to create.
- *
- *   For the second element:
- *     - If it starts with `+', it should be followed by the C++
- *       name of the class to create.
- *     - If it starts with `@', it should be followed by the SG
- *       detector store key, to be read directly from pool
- *       (i.e., don't use callbacks).
- *     - Otherwise, it should be a COOL folder name.
- *
- *   Third element is the prefix for this tool's constants in the
- *   ToolConstants structure.  (Can be blank if no ToolConstants
- *   structure is being used.)
- *
- *   This is then followed by a set of property name/value pairs.
- *   These override anything read from the detector store.
- *   The list is terminated with an empty string.
- *
- *   Such lists for all corrections are concatenated.
- *
- * Additional properties of interest include:
- *
- *   @c KeepList This allows one to preserve in SG intermediate results
- *               from running the corrections.  This is a vector of strings.
- *               These come in pairs; the first of a pair gives a correction
- *               tool name and the second a SG container name.  Before the
- *               named tool executes, the cluster list will be saved to SG
- *               with the specified name.
- *
- *               In addition to full tool names, which are usually of the
- *               form `larupdate_GLOBAL_gam37', one can also specify just
- *               the base part of the tool name; that is, before the
- *               first underscore.
- *
- *               Note that this only operates when the correction is called
- *               for a list of clusters; it won't work if the correction
- *               is called for individual clusters.
- *
- *   @c PreserveOrder If true, corrections will be executed strictly in the
- *                    order in which they're listed in @c CorrSpecs
- *                    (ignoring the @c order properties of the tools).
- *
- * Service/tool names used may also be overridden through properties.
- */
-class CaloRunClusterCorrections
-  : public CaloClusterProcessor,
-    public ISetCaloCellContainerName
-{
-public:
-  /**
-   * @brief Constructor.
-   * @param type The type of the tool.
-   * @param name The name of the tool.
-   * @param parent The parent algorithm of the tool.
-   */
-  CaloRunClusterCorrections (const std::string& type,
-                             const std::string& name,
-                             const IInterface* parent);
-
-
-  /// Standard initialize method.
-  virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE /*Can Register callbacks but no need to be thread safe*/ () override;
-
-
-  /// Standard finalize method.
-  virtual StatusCode finalize() override;
-
-  using CaloClusterProcessor::execute;
-
-  /**
-   * @brief Execute on a single cluster.
-   * @param The cluster to process.
-   * @param ctx The event context.
-   *
-   * Warning: Any defined tools that cannot process single clusters
-   * (only cluster collections) will be skipped!
-   */
-  virtual StatusCode execute (const EventContext& ctx,
-                              xAOD::CaloCluster* cluster) const override;
-
-
-  /**
-   * @brief Execute on an entire collection of clusters.
-   * @param The container of clusters.
-   * @param ctx The event context.
-   *
-   * This will iterate over all the clusters in @c collection
-   * and call @c execute on each one individually.
-   */
-  virtual StatusCode execute (const EventContext& ctx,
-                              xAOD::CaloClusterContainer* collection) const override;
-
-
-  /**
-   * @brief Change the name of the CaloCellContainer used by this tool.
-   * @param name The new container name.
-   */
-  virtual StatusCode setCaloCellContainerName (const std::string& name) override;
-
-
-private:
-  /// Internal structure to hold information about a correction tool.
-  struct Tool {
-    // Not thread-safe due to the use of DataHandle.
-    Tool() ATLAS_CTORDTOR_NOT_THREAD_SAFE = default;
-    Tool(const Tool&) ATLAS_CTORDTOR_NOT_THREAD_SAFE = default;
-    ~Tool() ATLAS_CTORDTOR_NOT_THREAD_SAFE = default;
-
-    /// The name of the tool.
-    std::string name;
-
-    /// Key of this tool in the detector store.
-    /// Empty if being initialized from JO.
-    std::string sgkey;
-
-    /// Name of the C++ class for this tool.
-    std::string clsname;
-
-    /// Prefix to use in the @c ToolConstants structure,
-    /// as specified in @c CorrSpecs.
-    std::string prefix;
-
-    /// Actual @c ToolConstants prefix to use (after resolving the request
-    /// among those prefixes actually existing).
-    std::string resolved_prefix;
-
-    /// Order in which this tool should be executed.
-    /// Set to -1 for a dummy tool.
-    int order;
-
-    /// True if we should set up a callback for this tool.
-    bool use_callback;
-
-    /// If non-empty, copy cluster list and save to SG with this name
-    /// before running this tool.
-    std::string save_container;
-
-    /// Handle to the constants structure.
-    // Note1: Don't access this until the vector<Tool> is complete.
-    // Note2: This must always be accessed via a const reference.
-    DataHandle<CaloRec::ToolConstants> dbconstants;
-
-    /// Pointer to the correction tool.
-    CaloClusterCollectionProcessor* collproc;
-
-    /// Pointer to the correction tool as a @c CaloClusterProcessor,
-    /// or 0 if that interface isn't supported by this tool.
-    CaloClusterProcessor* clusproc;
-
-    /// Pointer to the correction tool as an @c ISetCaloCellContainerName,
-    /// or 0 if that interface isn't supported by this tool.
-    ISetCaloCellContainerName* setcellcontname;
-  };
-
-
-  /// Helper for ordering tools.
-  struct ToolorderSort {
-    ToolorderSort (const std::vector<Tool>& the_tools);
-    bool operator() (int a, int b) const;
-    const std::vector<Tool>& tools;
-  };
-
-
-  /**
-   * @brief Parse the supplied correction specification and create
-   *        the Tools vector.  Do not actually create the tools yet.
-   */
-  StatusCode parseCorrspecs ATLAS_NOT_THREAD_SAFE ();
-
-
-  /**
-   * @brief Parse the supplied @c KeepList property.
-   */
-  StatusCode parseKeeplist();
-
-
-  /**
-   * @brief Create all tools that we can during initialization.
-   *        Set up to create remaining tools during a callback.
-   */
-  StatusCode createTools ATLAS_NOT_THREAD_SAFE /*Binds to CallBack*/ ();
-
-
-  /**
-   * @brief Register correction callbacks.
-   *
-   * Note that we cannot return @c FAILURE after the first callback
-   * has been registered (see comment in @c createTools).
-   */
-  void registerCallbacks ATLAS_NOT_THREAD_SAFE /*Registers callback*/ ();
-
-
-  /**
-   * @brief Actually create a tool.
-   * @param tool The tool to create.
-   */
-  StatusCode makeTool (Tool& tool);
-
-
-  /**
-   * @brief DB callback function.
-   * @param i (Unused)
-   * @param keys List of DB folders with changes.
-   *
-   * This is called when tool constants read from the DB have changed
-   * (or after the DB is accessed for the first time).
-   */
-  StatusCode updateTools ATLAS_NOT_THREAD_SAFE /*callbacks*/ (IOVSVC_CALLBACK_ARGS);   
-
-
-
-  /**
-   * @brief Initialize the clsname member of the tool structure.
-   * @param tool The tool on which to operate.
-   *
-   * Fetch the class name from the @c ToolConstants structure.
-   * If needed, this will expand ${} constructions; these are available
-   * to allow tools which use difference C++ classes for different
-   * layers/regions to share the same @c ToolConstants structure.
-   *
-   * ${LAYER} in the classname will be expanded to either `1' or `2',
-   * and ${BE} will be expanded to either `b' or `e', depending on the
-   * setting of the @c region property.
-   */
-  StatusCode clsnameFromDBConstants ATLAS_NOT_THREAD_SAFE (Tool& tool);
-
-
-  /**
-   * @brief Initialize @c resolved_prefix for a tool.
-   * @param tool The tool on which to operate.
-   *
-   * If the prefix that was specified at configuration time does not
-   * exist in the @c ToolConstants structure, use instead the longest
-   * matching prefix.
-   */
-  StatusCode fixPrefix ATLAS_NOT_THREAD_SAFE (Tool& tool);
-
-
-  /**
-   * @brief Fill in @c m_toolorder to run corrections in the proper order.
-   */
-  StatusCode orderCorrections ATLAS_NOT_THREAD_SAFE (bool allowMissing);
-
-
-  /**
-   * @brief Helper to get integer constant from a @c ToolConstants structure.
-   * @param tool The tool for which to retrieve the constant.
-   * @param pname The constant name (without prefix).
-   * @param out[out] The retrieved parameter.
-   */
-  StatusCode getConstant ATLAS_NOT_THREAD_SAFE (const Tool& tool,
-                                                const std::string& pname,
-                                                int& out);
-
-  //-----------
-  // Properties
-
-  /// Correction specifications.  See above for format.
-  std::vector<std::string> m_corrspecs;
-
-  /// List of intermediate results to preserve.  See above for format.
-  std::vector<std::string> m_keeplist;
-
-  /// If true, execute tools exactly in the specified order
-  /// (ignore order information from DB).
-  bool m_preserveOrder;
-
-  /// If true, don't clear out the values of long properties.
-  bool m_noClearProps;
-
-  /// The job options service.
-  ServiceHandle<Gaudi::Interfaces::IOptionsSvc> m_jos;
-
-  /// The tool service.
-  ServiceHandle<IToolSvc> m_toolsvc;
-
-  /// Information about tools we're managing.
-  std::vector<Tool> m_tools;
-
-  /// Vector of indices into the @c m_tools list.
-  /// The tools will be executed in the order of appearance in this list.
-  std::vector<int> m_toolorder;
-
-  /// List of folders for which we've already registered callbacks.
-  std::vector<std::string> m_registeredDBObjects;
-
-  /// COOL folder name in case of COOL inline storage
-  std::string  m_folderName;
-
-  /// AlgTool to convert COOL inline data into ToolConstants objects
-  ToolHandle<Blob2ToolConstants> m_coolInlineTool;
-
-  // FIXME: Dependencies don't get propagated from dynamically-created
-  // correction tools.  Hardcode this dependency as a workaround.
-  SG::ReadCondHandleKey<CaloAffectedRegionInfoVec> m_affKey{this,
-     "LArAffectedRegionKey", "LArAffectedRegionInfo", "SG key for affected regions cond object"};
-  SG::ReadCondHandleKey<LArBadChannelCont> m_LArBCKey { this, 
-      "LArBadChanKey","LArBadChannel","SG Key of LArBadChannelCont object"};
-  SG::ReadCondHandleKey<TileBadChannels> m_TileBCKey{this,
-      "TileBadChanKey", "TileBadChannels", "Input Tile bad channel status"};
-
-};
-
-
-#endif // not CALORUNCLUSTERCORRECTIONS_H
diff --git a/Calorimeter/CaloClusterCorrection/src/components/CaloClusterCorrection_entries.cxx b/Calorimeter/CaloClusterCorrection/src/components/CaloClusterCorrection_entries.cxx
index a20f094759b0..7daea0b61ea7 100644
--- a/Calorimeter/CaloClusterCorrection/src/components/CaloClusterCorrection_entries.cxx
+++ b/Calorimeter/CaloClusterCorrection/src/components/CaloClusterCorrection_entries.cxx
@@ -49,7 +49,6 @@
 #include "../CaloClusterRemoveDuplicates.h"
 #include "../CaloClusterRemoveBad.h"
 
-#include "../CaloRunClusterCorrections.h"
 #include "../CaloDummyCorrection.h"
 
 
@@ -104,6 +103,5 @@ DECLARE_COMPONENT( CaloClusterBadChannelList )
 DECLARE_COMPONENT( CaloClusterRemoveDuplicates )
 DECLARE_COMPONENT( CaloClusterRemoveBad )
 
-DECLARE_COMPONENT( CaloRunClusterCorrections )
 DECLARE_COMPONENT( CaloDummyCorrection )
 
diff --git a/Calorimeter/CaloClusterCorrection/test/config_t.py b/Calorimeter/CaloClusterCorrection/test/config_t.py
new file mode 100644
index 000000000000..6492bbff88db
--- /dev/null
+++ b/Calorimeter/CaloClusterCorrection/test/config_t.py
@@ -0,0 +1,1128 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+#
+# File: CaloClusterCorrection/test/config_t.py
+# Created: Aug, 2020
+# Purpose: Regression tests CaloCluterCorrection configuration
+#
+
+from __future__ import print_function
+
+
+from PyUtils import coverage
+c = coverage.Coverage ('CaloClusterCorrection.common')
+
+
+from AthenaConfiguration.ComponentFactory import CompFactory
+from CaloClusterCorrection import common
+from CaloClusterCorrection.CaloSwCorrections import make_CaloSwCorrectionsCfg
+
+class TestTool:
+    def __init__ (self, name, **kw):
+        self.name = name
+        self.args = kw
+        return
+
+    def check (self, config):
+        assert self.__class__.__name__ == config.__class__.__name__
+        if self.name != config.getName():
+            print ('name mismatch: ', self.__class__.__name__, self.name, config.getName())
+        assert self.name == config.getName()
+        props = config._properties.copy()
+        for k, v in self.args.items():
+            assert k in props
+            if isinstance (v, TestTool):
+                v.check (props[k])
+            else:
+                p = props[k]
+                if isinstance (v, list):
+                    p = list(p)
+                    if v and isinstance (v[0], list):
+                        p = [list(x) for x in p]
+                if p != v:
+                    print ('match fail: ', self.__class__.__name__, self.name, k, p, v)
+                assert p == v
+            del props[k]
+        assert not props
+        return
+
+
+def checkTools (tools, expected):
+    for i in range(min (len(tools), len(expected))):
+        expected[i].check (tools[i])
+    assert len(tools) == len(expected)
+    return
+        
+
+class CaloFillRectangularCluster (TestTool): pass
+class CaloClusterRemoveBad (TestTool): pass
+class CaloScaleCluster (TestTool): pass
+class CaloSwEtaoff_v3 (TestTool): pass
+class CaloSwPhioff_v2 (TestTool): pass
+class CaloClusterUpdate (TestTool): pass
+class CaloSwGap_v2 (TestTool): pass
+class CaloSwGap_v3 (TestTool): pass
+class CaloSwCalibHitsCalibration (TestTool): pass
+class CaloSwTransitionRegionsCorr (TestTool): pass
+class CaloSwDeadOTX_ps (TestTool): pass
+class CaloSwDeadOTX_back (TestTool): pass
+class CaloSwPhimod_v2 (TestTool): pass
+class CaloSwEtamod_v2 (TestTool): pass
+class CaloSwTime (TestTool): pass
+class CaloClusterBadChannelList (TestTool): pass
+class CaloAffectedTool (TestTool): pass
+class CaloTopoEMGap (TestTool): pass
+class ToolConstantsCondAlg (TestTool): pass
+class ProxyProviderSvc (TestTool): pass
+class CondProxyProvider (TestTool): pass
+class CondInputLoader (TestTool): pass
+class IOVDbSvc (TestTool): pass
+class PoolSvc (TestTool): pass
+class CondSvc (TestTool): pass
+
+
+# Default corrections, with fixed version.
+def test1 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {}
+
+    flags = flags_in.clone()
+    flags.lock()
+
+    ca = make_CaloSwCorrectionsCfg (flags, version = 'v12_calh', key = 'ele35')
+    tools = ca.popPrivateTools()
+
+    checkTools \
+      (tools,
+       [CaloFillRectangularCluster ('layers_ele35',
+                                    order=100,
+                                    isDummy=False,
+                                    fill_cluster=True,
+                                    eta_size=3,
+                                    phi_size=5),
+        CaloClusterRemoveBad ('removebad_ele35', EMin=0.0),
+        CaloScaleCluster ('rfac_v5_ele35',
+                          prefix='ele35.',
+                          DBHandleKey='CaloSwClusterCorrections.rfac-v5'),
+        CaloSwEtaoff_v3 ('etaoffb1_v5_ele35',
+                         prefix='ele35b1.',
+                         DBHandleKey='CaloSwClusterCorrections.etaoff-v5'),
+        CaloSwEtaoff_v3 ('etaoffe1_v5_ele35',
+                         prefix='ele35e1.',
+                         DBHandleKey='CaloSwClusterCorrections.etaoff-v5'),
+        CaloSwEtaoff_v3 ('etaoffb2_v5_ele35',
+                         prefix='ele35b2.',
+                         DBHandleKey='CaloSwClusterCorrections.etaoff-v5'),
+        CaloSwEtaoff_v3 ('etaoffe2_v5_ele35',
+                         prefix='ele35e2.',
+                         DBHandleKey='CaloSwClusterCorrections.etaoff-v5'),
+        CaloSwPhioff_v2 ('phioffb2_v5_ele35',
+                         prefix='ele35b2.',
+                         DBHandleKey='CaloSwClusterCorrections.phioff-v5'),
+        CaloSwPhioff_v2 ('phioffe2_v5_ele35',
+                         prefix='ele35e2.',
+                         DBHandleKey='CaloSwClusterCorrections.phioff-v5'),
+        CaloClusterUpdate ('larupdate_ele35',
+                           prefix='ele35.',
+                           DBHandleKey='CaloSwClusterCorrections.larupdate'),
+        CaloSwGap_v3 ('gap_v6_ele35',
+                      prefix='ele35.',
+                      DBHandleKey='CaloSwClusterCorrections.gap-v6'),
+        CaloSwCalibHitsCalibration ('calhits_v9_ele35',
+                                    prefix='ele35.',
+                                    DBHandleKey='CaloSwClusterCorrections.calhits-v9'),
+        CaloSwTransitionRegionsCorr ('trcorr_v5_1_ele35',
+                                     prefix='ele35.',
+                                     DBHandleKey='CaloSwClusterCorrections.trcorr-v5_1'),
+        CaloSwDeadOTX_ps ('deadOTXps_v1_ele35',
+                          prefix='ele35.',
+                          DBHandleKey='CaloSwClusterCorrections.deadOTXps-v1',
+                          AffectedTool=CaloAffectedTool('CaloAffectedToolForDeadOTX_ps')),
+        CaloSwDeadOTX_back ('deadOTXback_v1_ele35',
+                            prefix='ele35.',
+                            DBHandleKey='CaloSwClusterCorrections.deadOTXback-v1',
+                            AffectedTool=CaloAffectedTool('CaloAffectedForDeadOTX_back')),
+        CaloSwPhimod_v2 ('phimod_v4_ele35',
+                         prefix='ele35.',
+                         DBHandleKey='CaloSwClusterCorrections.phimod-v4'),
+        CaloSwEtamod_v2 ('etamod_v4_ele35',
+                         prefix='ele35.',
+                         DBHandleKey='CaloSwClusterCorrections.etamod-v4'),
+        CaloSwTime ('time_ele35',
+                    order=801,
+                    isDummy=False),
+        CaloClusterBadChannelList ('listBadChannels_ele35',
+                                   order=820,
+                                   isDummy=False),
+        ])
+
+
+    checkTools \
+      (ca._conditionsAlgs,
+       [ToolConstantsCondAlg ('ToolConstantsCondAlg_CaloSwClusterCorrections_rfac-v5',
+                              DetStoreKey='CaloSwClusterCorrections.rfac-v5',
+                              ToolConstantsKey='CaloSwClusterCorrections.rfac-v5'),
+        ToolConstantsCondAlg ('ToolConstantsCondAlg_CaloSwClusterCorrections_etaoff-v5',
+                              DetStoreKey='CaloSwClusterCorrections.etaoff-v5',
+                              ToolConstantsKey='CaloSwClusterCorrections.etaoff-v5'),
+        ToolConstantsCondAlg ('ToolConstantsCondAlg_CaloSwClusterCorrections_phioff-v5',
+                              DetStoreKey='CaloSwClusterCorrections.phioff-v5',
+                              ToolConstantsKey='CaloSwClusterCorrections.phioff-v5'),
+        ToolConstantsCondAlg ('ToolConstantsCondAlg_CaloSwClusterCorrections_larupdate',
+                              DetStoreKey='CaloSwClusterCorrections.larupdate',
+                              ToolConstantsKey='CaloSwClusterCorrections.larupdate'),
+        ToolConstantsCondAlg ('ToolConstantsCondAlg_CaloSwClusterCorrections_gap-v6',
+                              DetStoreKey='CaloSwClusterCorrections.gap-v6',
+                              ToolConstantsKey='CaloSwClusterCorrections.gap-v6'),
+        ToolConstantsCondAlg ('ToolConstantsCondAlg_CaloSwClusterCorrections_calhits-v9',
+                              DetStoreKey='CaloSwClusterCorrections.calhits-v9',
+                              ToolConstantsKey='CaloSwClusterCorrections.calhits-v9'),
+        ToolConstantsCondAlg ('ToolConstantsCondAlg_CaloSwClusterCorrections_trcorr-v5_1',
+                              DetStoreKey='CaloSwClusterCorrections.trcorr-v5_1',
+                              ToolConstantsKey='CaloSwClusterCorrections.trcorr-v5_1'),
+        ToolConstantsCondAlg ('ToolConstantsCondAlg_CaloSwClusterCorrections_deadOTXps-v1',
+                              DetStoreKey='CaloSwClusterCorrections.deadOTXps-v1',
+                              ToolConstantsKey='CaloSwClusterCorrections.deadOTXps-v1'),
+        ToolConstantsCondAlg('ToolConstantsCondAlg_CaloSwClusterCorrections_deadOTXback-v1',
+                             DetStoreKey='CaloSwClusterCorrections.deadOTXback-v1',
+                             ToolConstantsKey='CaloSwClusterCorrections.deadOTXback-v1'),
+        ToolConstantsCondAlg ('ToolConstantsCondAlg_CaloSwClusterCorrections_phimod-v4',
+                              DetStoreKey='CaloSwClusterCorrections.phimod-v4',
+                              ToolConstantsKey='CaloSwClusterCorrections.phimod-v4'),
+        ToolConstantsCondAlg ('ToolConstantsCondAlg_CaloSwClusterCorrections_etamod-v4',
+                              DetStoreKey='CaloSwClusterCorrections.etamod-v4',
+                              ToolConstantsKey='CaloSwClusterCorrections.etamod-v4'),
+        ])
+
+
+    checkTools \
+      (ca.getServices(),
+       [ProxyProviderSvc ('ProxyProviderSvc',
+                          ProviderNames=['CondProxyProvider']),
+        CondProxyProvider ('CondProxyProvider',
+                           InputCollections=['FID:BC292F26-AE73-9041-BF5C-BCE6C5C651EC']),
+        ])
+
+
+    ca.wasMerged()
+    return
+
+
+# Default corrections, global COOL tag, MC.
+def test2 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {}
+
+    flags = flags_in.clone()
+    flags.Input.isMC = True
+    flags.IOVDb.GlobalTag = 'OFLCOND-RUN12-SDR-31'
+    flags.Input.Files = defaultTestFiles.RDO
+    flags.lock()
+
+    ca = make_CaloSwCorrectionsCfg (flags, version = '@GLOBAL',
+                                    key = 'gam35_conv')
+    tools = ca.popPrivateTools()
+
+    checkTools \
+      (tools,
+       [CaloFillRectangularCluster ('layers_gam35_conv',
+                                    order=100,
+                                    isDummy=False,
+                                    fill_cluster=True,
+                                    eta_size=3,
+                                    phi_size=5),
+        CaloClusterRemoveBad ('removebad_gam35_conv', EMin=0.0),
+        CaloScaleCluster ('rfac_v5_gam35_conv',
+                          prefix='gam35.',
+                          DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/rfac'),
+        CaloSwEtaoff_v3 ('etaoffb1_v5_gam35_conv',
+                         prefix='gam35b1.',
+                         DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/etaoff'),
+        CaloSwEtaoff_v3 ('etaoffe1_v5_gam35_conv',
+                         prefix='gam35e1.',
+                         DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/etaoff'),
+        CaloSwEtaoff_v3 ('etaoffb2_v5_gam35_conv', prefix='gam35b2.',
+                         DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/etaoff'),
+        CaloSwEtaoff_v3 ('etaoffe2_v5_gam35_conv', prefix='gam35e2.',
+                         DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/etaoff'),
+        CaloSwPhioff_v2 ('phioffb2_v5data_gam35_conv', prefix='gam35b2.',
+                         DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/phioff'),
+        CaloSwPhioff_v2 ('phioffe2_v5data_gam35_conv',
+                         prefix='gam35e2.',
+                         DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/phioff'),
+        CaloClusterUpdate ('larupdate_gam35_conv',
+                           prefix='gam35.',
+                           DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/larupdate'),
+        CaloSwGap_v3 ('gap_v6_gam35_conv',
+                      prefix='gam35.',
+                      DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/gap'),
+        CaloSwCalibHitsCalibration ('calhits_v9_gam35_conv',
+                                    prefix='gam35_conv.',
+                                    DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/calhits'),
+        CaloSwTransitionRegionsCorr ('trcorr_v5_1_gam35_conv',
+                                     prefix='gam35.',
+                                     DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/trcorr'),
+        CaloSwDeadOTX_ps ('deadOTXps_v1_gam35_conv',
+                          prefix='gam35_conv.',
+                          DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/deadOTXps',
+                          AffectedTool=CaloAffectedTool('CaloAffectedToolForDeadOTX_ps')),
+        CaloSwDeadOTX_back ('deadOTXback_v1_gam35_conv',
+                            prefix='gam35_conv.',
+                            DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/deadOTXback',
+                            AffectedTool=CaloAffectedTool('CaloAffectedForDeadOTX_back')),
+        CaloSwPhimod_v2 ('phimod_v4_gam35_conv',
+                         prefix='gam35.',
+                         DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/phimod'),
+        CaloSwEtamod_v2 ('etamod_v4_gam35_conv',
+                         prefix='gam35.',
+                         DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/etamod'),
+        CaloSwTime ('time_gam35_conv',
+                    order=801,
+                    isDummy=False),
+        CaloClusterBadChannelList ('listBadChannels_gam35_conv',
+                                   order=820,
+                                   isDummy=False),
+        ])
+
+    checkTools \
+      (ca._conditionsAlgs,
+       [CondInputLoader ('CondInputLoader',
+                         Load=[['CaloRec::ToolConstants',
+                                '/CALO/Ofl/CaloSwClusterCorrections/rfac'],
+                               ['CaloRec::ToolConstants',
+                                '/CALO/Ofl/CaloSwClusterCorrections/etaoff'],
+                               ['CaloRec::ToolConstants',
+                                '/CALO/Ofl/CaloSwClusterCorrections/phioff'],
+                               ['CaloRec::ToolConstants',
+                                '/CALO/Ofl/CaloSwClusterCorrections/larupdate'],
+                               ['CaloRec::ToolConstants',
+                                '/CALO/Ofl/CaloSwClusterCorrections/gap'],
+                               ['CaloRec::ToolConstants',
+                                '/CALO/Ofl/CaloSwClusterCorrections/calhits'],
+                               ['CaloRec::ToolConstants',
+                                '/CALO/Ofl/CaloSwClusterCorrections/trcorr'],
+                               ['CaloRec::ToolConstants',
+                                '/CALO/Ofl/CaloSwClusterCorrections/deadOTXps'],
+                               ['CaloRec::ToolConstants',
+                                '/CALO/Ofl/CaloSwClusterCorrections/deadOTXback'],
+                               ['CaloRec::ToolConstants',
+                                '/CALO/Ofl/CaloSwClusterCorrections/phimod'],
+                               ['CaloRec::ToolConstants',
+                                '/CALO/Ofl/CaloSwClusterCorrections/etamod']]),
+        ])
+            
+
+    exp = IOVDbSvc ('IOVDbSvc',
+                    dbConnection='sqlite://;schema=mycool.db;dbname=OFLP200',
+                    DBInstance='OFLP200',
+                    CacheAlign=3,
+                    GlobalTag='OFLCOND-RUN12-SDR-31',
+                    Folders = ['/CALO/Ofl/CaloSwClusterCorrections/rfac<tag>CaloSwClusterCorrections.00-02-13-rfac-v5</tag><db>COOLOFL_CALO/OFLP200</db>',
+                               '/CALO/Ofl/CaloSwClusterCorrections/etaoff<tag>CaloSwClusterCorrections.00-02-13-etaoff-v5</tag><db>COOLOFL_CALO/OFLP200</db>',
+                               '/CALO/Ofl/CaloSwClusterCorrections/phioff<tag>CaloSwClusterCorrections.00-02-13-phioff-v5data</tag><db>COOLOFL_CALO/OFLP200</db>',
+                               '/CALO/Ofl/CaloSwClusterCorrections/larupdate<tag>CaloSwClusterCorrections.00-02-13-larupdate</tag><db>COOLOFL_CALO/OFLP200</db>',
+                               '/CALO/Ofl/CaloSwClusterCorrections/gap<tag>CaloSwClusterCorrections.00-02-13-gap-v6</tag><db>COOLOFL_CALO/OFLP200</db>',
+                               '/CALO/Ofl/CaloSwClusterCorrections/calhits<tag>CaloSwClusterCorrections.00-02-13-calhits-v9</tag><db>COOLOFL_CALO/OFLP200</db>',
+                               '/CALO/Ofl/CaloSwClusterCorrections/trcorr<tag>CaloSwClusterCorrections.00-02-13-trcorr-v5_1</tag><db>COOLOFL_CALO/OFLP200</db>',
+                               '/CALO/Ofl/CaloSwClusterCorrections/deadOTXps<tag>CaloSwClusterCorrections.00-02-13-deadOTXps-v1</tag><db>COOLOFL_CALO/OFLP200</db>',
+                               '/CALO/Ofl/CaloSwClusterCorrections/deadOTXback<tag>CaloSwClusterCorrections.00-02-13-deadOTXback-v1</tag><db>COOLOFL_CALO/OFLP200</db>',
+                               '/CALO/Ofl/CaloSwClusterCorrections/phimod<tag>CaloSwClusterCorrections.00-02-13-phimod-v4</tag><db>COOLOFL_CALO/OFLP200</db>',
+                               '/CALO/Ofl/CaloSwClusterCorrections/etamod<tag>CaloSwClusterCorrections.00-02-13-etamod-v4</tag><db>COOLOFL_CALO/OFLP200</db>'])
+    exp.check (ca.getService ('IOVDbSvc'))
+
+    ca.wasMerged()
+    return
+
+
+# Correction subset, version defaulted, with overrides.
+def test3 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {}
+    
+    flags = flags_in.clone()
+    flags.Input.ProjectName = 'data18'
+    flags.lock()
+
+    from CaloClusterCorrection.CaloSwCorrections import layers, update, gap, calhits
+    from CaloClusterCorrection.constants import CALOCORR_JO, CALOCORR_POOL
+    from CaloClusterCorrection.poolfiles import poolfiles
+    ca = make_CaloSwCorrectionsCfg (flags, key = 'gam35',
+                                    corrlist = [[layers],
+                                                [update],
+                                                [gap, 'v3', ('degree', 2)],
+                                                [calhits],
+                                                ],
+                                    layers_suffix = 'lsuff',
+                                    layers_key = 'gam35_conv',
+                                    layers_cells_name = 'xcells',
+                                    layers_source = 'CaloSwLayers.CaloSwLayers_parms',
+                                    gap_source = 'caloswcorr_pool',
+                                    layers_order = 101,
+                                    calhits_version = 'v8',
+                                    calhits_update_sampling_energies = True)
+    tools = ca.popPrivateTools()
+    checkTools \
+      (tools[:4],
+       [CaloFillRectangularCluster ('layers_gam35_convlsuff',
+                                    order=101,
+                                    isDummy=False,
+                                    fill_cluster=True,
+                                    eta_size=3,
+                                    phi_size=5,
+                                    cells_name = 'xcells'),
+        CaloClusterUpdate ('larupdate_GLOBAL_gam35',
+                           prefix='gam35.',
+                           DBHandleKey='/CALO/CaloSwClusterCorrections/larupdate'),
+        CaloSwGap_v2 ('gap_v3_gam35',
+                      prefix='gam35.',
+                      DBHandleKey='CaloSwClusterCorrections.gap-v3',
+                      degree=2),
+        CaloSwCalibHitsCalibration ('calhits_v8_gam35',
+                                    prefix='gam35_conv.',
+                                    DBHandleKey='/CALO/CaloSwClusterCorrections/calhits',
+                                    update_sampling_energies=True),
+        ])
+
+    exp = IOVDbSvc ('IOVDbSvc',
+                    dbConnection='sqlite://;schema=mycool.db;dbname=CONDBR2',
+                    DBInstance='CONDBR2',
+                    CacheAlign=3,
+                    GlobalTag='CONDBR2-BLKPA-2017-05',
+                    Folders=['/CALO/CaloSwClusterCorrections/larupdate<tag></tag><db>COOLONL_CALO/CONDBR2</db>',
+                             '/CALO/CaloSwClusterCorrections/calhits<tag>CaloSwClusterCorrections.00-02-13-calhits-v8</tag><db>COOLONL_CALO/CONDBR2</db>'])
+
+    exp.check (ca.getService ('IOVDbSvc'))
+
+    ca.wasMerged()
+
+    return
+
+
+# makecorr details 1
+def test4 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {}
+    
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.constants import CALOCORR_SW
+    from CaloClusterCorrection.common import makecorr
+    from CaloClusterCorrection.CaloSwGap import CaloSwGap_versions
+    from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections
+
+    ca = makecorr (flags,
+                   CaloSwGap_versions,
+                   None,  # name
+                   'gap',
+                   None,  # suffix
+                   '@xvers', # version
+                   'ele35',  # key
+                   None, # sampling
+                   None, # source
+                   None, # confclass
+                   CALOCORR_SW)
+    tools = ca.popPrivateTools()
+    exp = CaloSwGap_v3 ('gap_xvers_ele35',
+                        prefix='ele35.',
+                        DBHandleKey='/CALO/CaloSwClusterCorrections/gap')
+    exp.check (tools)
+    ca.wasMerged()
+
+    exp = IOVDbSvc('IOVDbSvc',
+                   dbConnection='sqlite://;schema=mycool.db;dbname=CONDBR2',
+                   DBInstance='CONDBR2',
+                   CacheAlign=3,
+                   GlobalTag='CONDBR2-BLKPA-2017-05',
+                   Folders=['/CALO/CaloSwClusterCorrections/gap<tag>xvers</tag><db>COOLONL_CALO/CONDBR2</db>'])
+    exp.check (ca.getService ('IOVDbSvc'))
+
+
+    return
+                                     
+
+
+# makecorr details 2
+def test5 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {}
+    
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.constants import CALOCORR_SW
+    from CaloClusterCorrection.common import makecorr, CaloCorrectionConfigError
+    from CaloClusterCorrection.CaloSwGap import CaloSwGap_versions
+    from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections
+
+    try:
+        makecorr (flags,
+                  CaloSwGap_versions,
+                  None,  # name
+                  'gap',
+                  None,  # suffix
+                  'lsdkfjsdklfj', # version
+                  'ele35',  # key
+                  None, # sampling
+                  None, # source
+                  None, # confclass
+                  CALOCORR_SW)
+        assert 0
+    except CaloCorrectionConfigError as e:
+        assert e.args[0] == "Can't find version `lsdkfjsdklfj' for correction named `gap'."
+
+    return
+                                     
+
+# makecorr details 3
+def test6 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {}
+    
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.constants import CALOCORR_SW
+    from CaloClusterCorrection.common import makecorr, CaloCorrectionConfigError
+    from CaloClusterCorrection.CaloSwGap import CaloSwGap_versions
+    from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections
+
+    try:
+        makecorr (flags,
+                  CaloSwGap_versions,
+                  None,  # name
+                  'gap',
+                  None,  # suffix
+                  None, #version
+                  'ele35',  # key
+                  None, # sampling
+                  'asdasd', # source
+                  None, # confclass
+                  CALOCORR_SW)
+        assert 0
+    except CaloCorrectionConfigError as e:
+        assert e.args[0] == "Can't find any source to configure tool `gap_v6_ele35'.  Sources: ['asdasd']"
+
+    return
+                                     
+
+# makecorr details 4
+def test7 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {}
+    
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.constants import CALOCORR_SW
+    from CaloClusterCorrection.common import makecorr
+    from CaloClusterCorrection.CaloSwGap import CaloSwGap_versions
+    from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections
+
+    ca = makecorr (flags,
+                   CaloSwGap_versions,
+                   None,  # name
+                   'gap',
+                   None,  # suffix
+                   '@GLOBAL', # version
+                   'ele35',  # key
+                   None, # sampling
+                   None, # source
+                   None, # confclass
+                   CALOCORR_SW)
+    tools = ca.popPrivateTools()
+    exp = CaloSwGap_v3('gap_GLOBAL_ele35',
+                       prefix='ele35.',
+                       DBHandleKey='/CALO/CaloSwClusterCorrections/gap')
+    exp.check (tools)
+
+    ca.wasMerged()
+    exp = IOVDbSvc ('IOVDbSvc',
+                    dbConnection='sqlite://;schema=mycool.db;dbname=CONDBR2',
+                    DBInstance='CONDBR2',
+                    CacheAlign=3,
+                    GlobalTag='CONDBR2-BLKPA-2017-05',
+                    Folders=['/CALO/CaloSwClusterCorrections/gap<tag></tag><db>COOLONL_CALO/CONDBR2</db>'])
+    exp.check (ca.getService ('IOVDbSvc'))
+
+    return
+                                     
+
+
+# makecorr details 5
+def test8 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {}
+    
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.constants import CALOCORR_SW, CALOCORR_COOL
+    from CaloClusterCorrection.common import makecorr
+    from CaloClusterCorrection.CaloSwGap import CaloSwGap_versions
+    from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections
+
+    cls_v2 = CompFactory.CaloSwGap_v2  # CaloClusterCorrection
+    ca = makecorr (flags,
+                   [['@', cls_v2, [CALOCORR_COOL], ['ele35']]],
+                   None,  # name
+                   'gap',
+                   None,  # suffix
+                   '@xvers', # version
+                   'ele35',  # key
+                   None, # sampling
+                   None, # source
+                   None, # confclass
+                   CALOCORR_SW)
+    tools = ca.popPrivateTools()
+    exp = CaloSwGap_v2 ('gap_xvers_ele35',
+                        prefix='ele35.',
+                        DBHandleKey='/CALO/CaloSwClusterCorrections/gap')
+    exp.check (tools)
+
+    ca.wasMerged()
+    exp = IOVDbSvc ('IOVDbSvc',
+                    dbConnection='sqlite://;schema=mycool.db;dbname=CONDBR2',
+                    DBInstance='CONDBR2',
+                    CacheAlign=3,
+                    GlobalTag='CONDBR2-BLKPA-2017-05',
+                    Folders=['/CALO/CaloSwClusterCorrections/gap<tag>xvers</tag><db>COOLONL_CALO/CONDBR2</db>'])
+    exp.check (ca.getService ('IOVDbSvc'))
+
+    return
+                                     
+
+
+# makecorr details 6
+def test9 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {}
+    
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.constants import CALOCORR_SW, CALOCORR_COOL
+    from CaloClusterCorrection.common import makecorr
+    from CaloClusterCorrection.CaloSwGap import CaloSwGap_versions
+    from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections
+
+    ca = makecorr (flags,
+                   CaloSwGap_versions,
+                   None,  # name
+                   'gap',
+                   None,  # suffix
+                   '@xvers', # version
+                   '@VALID_KEYS',  # key
+                   None, # sampling
+                   None, # source
+                   None, # confclass
+                   CALOCORR_SW)
+    assert (ca == ['ele55', 'ele35', 'ele37', 'gam55', 'gam35', 'gam37'])
+    return
+                                     
+
+
+# makecorr details 7
+def test10 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {}
+    
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.constants import CALOCORR_SW, CALOCORR_NOPOOL, CALOCORR_TOPOOL
+    from CaloClusterCorrection.common import makecorr
+    from CaloClusterCorrection.CaloSwGap import CaloSwGap_versions
+    from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections
+
+    cls_v2 = CompFactory.CaloSwGap_v2  # CaloClusterCorrection
+    ca = makecorr (flags,
+                   [['@', cls_v2, [CALOCORR_NOPOOL], ['ele35']]],
+                   None,  # name
+                   'gap',
+                   None,  # suffix
+                   '@xvers', # version
+                   'ele35',  # key
+                   None, # sampling
+                   CALOCORR_TOPOOL, # source
+                   None, # confclass
+                   CALOCORR_SW)
+    assert (ca is None)
+
+    return
+
+
+# makecorr details 8
+def test11 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {'gapb2_GLOBAL_ele35' : 1}
+    
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.constants import CALOCORR_SW, EMB1, EMB2, CALOCORR_COOL
+    from CaloClusterCorrection.common import makecorr
+    from CaloClusterCorrection.CaloSwGap import CaloSwGap_versions
+    from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections
+
+    cls_v2 = CompFactory.CaloSwGap_v2  # CaloClusterCorrection
+    cls_v3 = CompFactory.CaloSwGap_v3  # CaloClusterCorrection
+    ca = makecorr (flags,
+                   [['@', {EMB1 : cls_v2, EMB2: cls_v3}, [CALOCORR_COOL], ['ele35']]],
+                   None,  # name
+                   'gap',
+                   None,  # suffix
+                   '@GLOBAL', # version
+                   'ele35',  # key
+                   EMB2, # sampling
+                   None, # source
+                   None, # confclass
+                   CALOCORR_SW)
+    tools = ca.popPrivateTools()
+    exp = CaloSwGap_v3 ('gapb2_GLOBAL_ele352',
+                        prefix='ele35b2.',
+                        DBHandleKey='/CALO/CaloSwClusterCorrections/gap')
+    exp.check (tools)
+    ca.wasMerged()
+
+    ca = makecorr (flags,
+                   CaloSwGap_versions,
+                   None,  # name
+                   'gap',
+                   None,  # suffix
+                   '@GLOBAL', # version
+                   'ele35',  # key
+                   EMB2, # sampling
+                   None, # source
+                   None, # confclass
+                   CALOCORR_SW)
+    tools = ca.popPrivateTools()
+    exp = CaloSwGap_v3 ('gapb2_GLOBAL_ele353',
+                        prefix='ele35b2.',
+                        DBHandleKey='/CALO/CaloSwClusterCorrections/gap')
+    exp.check (tools)
+    ca.wasMerged()
+
+    return
+                                     
+                                     
+# makecorr details 9
+def test12 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {'gapb2_GLOBAL_ele35' : 1}
+    
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.constants import CALOCORR_SW, EMB1, EMB2, CALOCORR_JO
+    from CaloClusterCorrection.common import makecorr
+    from CaloClusterCorrection.CaloSwPhioff import CaloSwPhioff_versions
+    from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections
+
+    ca = makecorr (flags,
+                   CaloSwPhioff_versions,
+                   None,  # name
+                   'phioff',
+                   None,  # suffix
+                   None, # version
+                   'ele35',  # key
+                   EMB2, # sampling
+                   CALOCORR_JO, # source
+                   None, # confclass
+                   CALOCORR_SW)
+    tools = ca.popPrivateTools()
+    tools.correction = [[[]]]
+    tools.energies = []
+    exp = CaloSwPhioff_v2 ('phioffb2_v5data_ele35',
+                           prefix='ele35b2.',
+                           isDummy=False,
+                           region=1,
+                           correction_coef=0.001,
+                           interp_barriers=[0.8],
+                           degree=3,
+                           flip_phi=True,
+                           energy_degree=2,
+                           energies=[], correction=[[[]]])
+    exp.check (tools)
+    ca.wasMerged()
+
+    return
+
+
+# makecorr details 10  (config_from_jo)
+def test13 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {'gapb2_GLOBAL_ele35' : 1}
+    
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.constants import CALOCORR_SW, CALOCORR_EMTOPO, EMB1, EMB2, CALOCORR_JO
+    from CaloClusterCorrection.common import makecorr
+    from CaloClusterCorrection.CaloSwGap import CaloSwGap_versions
+    from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections
+
+    ca = makecorr (flags,
+                   CaloSwGap_versions,
+                   None,  # name
+                   'gap',
+                   None,  # suffix
+                   None, # version
+                   'ele35_conv',  # key
+                   EMB2, # sampling
+                   CALOCORR_JO, # source
+                   None, # confclass
+                   CALOCORR_SW)
+    tools = ca.popPrivateTools()
+    tools.correctionGoodPhi = []
+    tools.correctionBadPhi = []
+    exp = CaloSwGap_v3 ('gapb2_v6_ele35_conv',
+                        prefix='ele35_convb2.',
+                        isDummy=False,
+                        correctionGoodPhi=[],
+                        correctionBadPhi=[],
+                        etamin_crack=1.425,
+                        etamax_crack=1.55,
+                        degree=3,
+                        use_raw_eta=False,
+                        use_raw_eta_boundaries=True,
+                        region=4)
+    exp.check (tools)
+    ca.wasMerged()
+
+
+    from CaloClusterCorrection.CaloTopoEMgap import CaloTopoEMgap_versions
+    ca = makecorr (flags,
+                   CaloTopoEMgap_versions,
+                   None,  # name
+                   'gap',
+                   None,  # suffix
+                   None, # version
+                   'ele633_conv',  # key
+                   EMB2, # sampling
+                   CALOCORR_JO, # source
+                   None, # confclass
+                   CALOCORR_EMTOPO)
+    tools = ca.popPrivateTools()
+    tools.correction = [[]]
+    exp = CaloTopoEMGap ('gapb2_v1_ele633_conv',
+                         prefix='ele633_convb2.',
+                         isDummy=False,
+                         region=5,
+                         etamin_crack=1.425,
+                         etamax_crack=1.55,
+                         degree=3,
+                         use_raw_eta=False,
+                         correction=[[]])
+    exp.check (tools)
+    ca.wasMerged()
+
+    from CaloClusterCorrection.common import _config_from_jo
+    corr = CompFactory.CaloSwPhioff_v2 ('foo')
+    _config_from_jo (corr, 'CaloSwPhioff_v5data.CaloSwPhioff_v5data_parms',
+                     'gam33_conv', EMB2, [], 101)
+    corr.correction = [[[]]]
+    corr.energies = []
+    exp = CaloSwPhioff_v2 ('foo',
+                           order=101,
+                           isDummy=False,
+                           region=1,
+                           correction_coef=0.001,
+                           interp_barriers=[0.8],
+                           degree=3,
+                           flip_phi=True,
+                           energy_degree=2,
+                           energies=[], correction=[[[]]])
+    exp.check (corr)
+    return
+                                     
+
+# config_from_pool
+def test14 (flags_in):
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.common import _config_from_pool
+    corr = CompFactory.CaloSwPhioff_v2 ('foo')
+
+    ca = _config_from_pool (flags, corr, None, None)
+    assert ca is False
+    return
+                                     
+
+# config_from_cool
+def test15 (flags_in):
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.common import _config_from_cool
+    corr = CompFactory.CaloSwPhioff_v2 ('foo')
+
+    ca = _config_from_cool (flags, corr, '/CALO/Ofl/CaloSwClusterCorrections/phioff', 'tag1')
+    exp = CaloSwPhioff_v2 ('foo',
+                           DBHandleKey='/CALO/Ofl/CaloSwClusterCorrections/phioff')
+    exp.check (corr)
+
+    exp = IOVDbSvc ('IOVDbSvc',
+                    dbConnection='sqlite://;schema=mycool.db;dbname=CONDBR2',
+                    DBInstance='CONDBR2',
+                    CacheAlign=3,
+                    GlobalTag='CONDBR2-BLKPA-2017-05',
+                    Folders=['/CALO/Ofl/CaloSwClusterCorrections/phioff<tag>tag1</tag><db>COOLOFL_CALO/CONDBR2</db>'])
+    exp.check (ca.getService ('IOVDbSvc'))
+
+    ca.wasMerged()
+
+    ca = _config_from_cool (flags, corr, '/CALO/Ofl/CaloSwClusterCorrections/phioff', 'tag2')
+    assert ca is False
+
+    return
+
+
+# longest_match
+def test16 (flags_in):
+    from CaloClusterCorrection.common import _longest_match
+
+    assert _longest_match ('a', 'abc') == 'abc'
+    assert _longest_match ('a', ['b', 'a', 'd']) == 'a'
+    assert _longest_match ('abc', ['a', 'ab', 'ad']) == 'ab'
+
+    return
+
+
+# make_corrections details
+def test17 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {}
+    
+    flags = flags_in.clone()
+    flags.Input.ProjectName = 'data18'
+    flags.Calo.ClusterCorrection.caloSwWhichCorrection = 'v6_lwc'
+    flags.lock()
+
+    from CaloClusterCorrection.CaloSwCorrections import layers, update, gap, calhits
+    from CaloClusterCorrection.constants import CALOCORR_JO, CALOCORR_POOL
+    from CaloClusterCorrection.poolfiles import poolfiles
+    ca = make_CaloSwCorrectionsCfg (flags, key = 'gam35',
+                                    corrlist = [[gap]])
+    tools = ca.popPrivateTools()
+
+    checkTools \
+      (tools,
+       [CaloSwGap_v2 ('gap_v4_gam35',
+                      prefix='gam35.',
+                      DBHandleKey='CaloSwClusterCorrections.gap-v4')
+        ])
+
+    ca.wasMerged()
+
+    return
+
+
+# make_corrections details
+def test18 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {}
+    
+    flags = flags_in.clone()
+    flags.Input.ProjectName = 'data18'
+    flags.lock()
+
+    from CaloClusterCorrection.CaloSwCorrections import layers, update, gap, calhits
+    from CaloClusterCorrection.constants import CALOCORR_JO, CALOCORR_POOL, CALOCORR_COOL
+    from CaloClusterCorrection.poolfiles import poolfiles
+    ca = make_CaloSwCorrectionsCfg (flags, key = 'gam35',
+                                    corrlist = [[gap]],
+                                    version = 'v6_lwc',
+                                    source = CALOCORR_POOL)
+    tools = ca.popPrivateTools()
+
+    checkTools \
+      (tools,
+       [CaloSwGap_v2 ('gap_v4_gam35',
+                      prefix='gam35.',
+                      DBHandleKey='CaloSwClusterCorrections.gap-v4')
+        ])
+
+    ca.wasMerged()
+
+    return
+
+
+# make_corrections details
+def test19 (flags_in):
+    common._poolfiles_seen = {}
+    common._folders_used = {}
+    common._alltools = {}
+    
+    flags = flags_in.clone()
+    flags.Input.isMC = True
+    flags.GeoModel.AtlasVersion = 'ATLAS-CSC-05-xx'
+    flags.IOVDb.GlobalTag = 'OFLCOND-RUN12-SDR-31'
+    flags.Calo.ClusterCorrection.caloSwGeneration = '00-02-01'
+    flags.lock()
+
+    from CaloClusterCorrection.CaloSwCorrections import layers, update, gap, calhits
+    from CaloClusterCorrection.constants import CALOCORR_JO, CALOCORR_POOL, CALOCORR_COOL
+    from CaloClusterCorrection.poolfiles import poolfiles
+    ca = make_CaloSwCorrectionsCfg (flags, key = 'gam35',
+                                    corrlist = [[gap]],
+                                    source = [CALOCORR_POOL, CALOCORR_COOL])
+    tools = ca.popPrivateTools()
+    checkTools \
+      (tools,
+       [CaloSwGap_v2 ('gap_v4_gam35',
+                      prefix='gam35.',
+                      DBHandleKey='CaloSwClusterCorrections.gap-v4')
+        ])
+    ca.wasMerged()
+
+    return
+
+
+# lookup_version
+def test20 (flags_in):
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections, layers, update, removebad
+    from CaloClusterCorrection.constants import CALOCORR_SW
+
+    vlist = CaloSwCorrections.lookup_version (flags, 'none', CALOCORR_SW)
+
+    from CaloClusterCorrection.common import CaloCorrectionConfigError
+    try:
+        vlist = CaloSwCorrections.lookup_version (flags, 'alsdjk', CALOCORR_SW)
+        assert 0
+    except CaloCorrectionConfigError as e:
+        assert e.args[0] == "Can't find global correction version alsdjk."
+    return
+
+
+# geom_match
+def test21 (flags_in):
+    from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections
+
+    ret = CaloSwCorrections.geom_match ('geant4', 'CSC-01')
+    assert ret == ('v4_1_calh', True)
+
+    ret = CaloSwCorrections.geom_match ('geant4', 'asdasd')
+    assert ret == ('@GLOBAL', True)
+
+    from CaloClusterCorrection.common import CaloClusterCorrSetup
+    class TestCorr (CaloClusterCorrSetup):
+        geom_versions = [ ['foo', 'NOHIER#bar'] ]
+    testCorr = TestCorr()
+    ret = testCorr.geom_match ('geant4', 'foo')
+    assert ret == ('bar', False)
+
+    return
+
+
+# writing to pool
+def test22 (flags_in):
+    flags = flags_in.clone()
+    flags.lock()
+
+    from CaloClusterCorrection.CaloSwCorrections import CaloSwCorrections
+    from CaloClusterCorrection.constants import CALOCORR_SW
+
+    (corr_output_list, tag_list, ca) = \
+                       CaloSwCorrections.config_for_pool (flags,
+                                                          'ele35',
+                                                          CALOCORR_SW)
+    ca.wasMerged()
+    # FIXME: validate return?
+    return
+    
+    
+# make_ForPool details
+def test23 (flags_in):
+    flags = flags_in.clone()
+    flags.lock()
+
+    def f1(*args, **kw): pass
+    def f2(*args, **kw): pass
+
+    from CaloClusterCorrection.common import CaloClusterCorrSetup
+    class TestCorr1 (CaloClusterCorrSetup):
+        correction_generation_default = '00-00-00'
+        correction_generation_flag_name = 'caloSwGeneration'
+        versions = {
+            'a' : [[f1, 200],
+                   [f2, 100]]}
+    testCorr1 = TestCorr1()
+    from CaloClusterCorrection.common import CaloCorrectionConfigError
+    try:
+        testCorr1.make_ForPool (flags, ['asd'], 'asd')
+        assert 0
+    except CaloCorrectionConfigError as e:
+        assert e.args[0] == "Tools for global version a are not in order! 100(f2) < 200(f1)"
+
+    class TestCorr2 (CaloClusterCorrSetup):
+        correction_generation_default = '00-00-00'
+        correction_generation_flag_name = 'caloSwGeneration'
+        versions = {
+            'a' : [[f1, 100],
+                   [f2, 200]],
+            'b' : [[f1, 100],
+                   [f2, 201]],
+            }
+    testCorr2 = TestCorr2()
+    try:
+        testCorr2.make_ForPool (flags, ['asd'], 'asd')
+        assert 0
+    except CaloCorrectionConfigError as e:
+        assert e.args[0] == "Tool f2 has order 201 in b but order 200 in a!"
+    return
+
+
+from AthenaConfiguration.TestDefaults import defaultTestFiles
+from AthenaCommon.Configurable import Configurable
+Configurable.configurableRun3Behavior = 1
+
+from AthenaConfiguration.AllConfigFlags import ConfigFlags
+ConfigFlags.loadAllDynamicFlags()
+ConfigFlags.Input.Files = defaultTestFiles.RAW
+
+test1 (ConfigFlags)
+test2 (ConfigFlags)
+test3 (ConfigFlags)
+test4 (ConfigFlags)
+test5 (ConfigFlags)
+test6 (ConfigFlags)
+test7 (ConfigFlags)
+test8 (ConfigFlags)
+test9 (ConfigFlags)
+test10 (ConfigFlags)
+test11 (ConfigFlags)
+test12 (ConfigFlags)
+test13 (ConfigFlags)
+test14 (ConfigFlags)
+test15 (ConfigFlags)
+test16 (ConfigFlags)
+test17 (ConfigFlags)
+test18 (ConfigFlags)
+test19 (ConfigFlags)
+test20 (ConfigFlags)
+test21 (ConfigFlags)
+test22 (ConfigFlags)
+test23 (ConfigFlags)
+
+
+c.analyze()
-- 
GitLab