From 9f5f47bd6c985d23257350e2ac2d8e6c5a236baa Mon Sep 17 00:00:00 2001
From: Susumu Oda <susumu.oda@cern.ch>
Date: Tue, 20 Oct 2020 07:13:10 +0000
Subject: [PATCH] Remove obsolete SiRegionSelectorTable,
 TRT_RegionSelectorTable, SCT_CablingToolInc,
 (I)SCT_FillCabling(FromTest/CoraCool)

---
 .../CaloAnaEx/share/CaloAnaExTB.py            |   3 -
 .../RegionSelector/CMakeLists.txt             |   2 +-
 .../RegionSelector/python/RegSelConfig.py     |  30 -
 .../RegionSelector/python/RegSelSvcDefault.py |  30 +-
 .../RegionSelector/src/RegSelSvc.cxx          |   7 -
 .../RegionSelector/src/RegSelSvc.h            |   5 -
 .../InDetRegionSelectorLUT.h                  |   6 +-
 .../SiRegionSelectorTable.h                   |  59 --
 .../TRT_RegionSelectorTable.h                 |  54 --
 .../InDetRegionSelector/doc/packagedoc.h      |   8 +-
 .../InDetRegionSelectorTable_jobOptions.py    |  54 --
 .../src/InDetRegionSelectorLUT.cxx            |  10 +-
 .../src/SiRegionSelectorTable.cxx             | 111 ----
 .../src/TRT_RegionSelectorTable.cxx           | 277 ---------
 .../InDetRegionSelector_entries.cxx           |   4 -
 .../SCT_Cabling/ISCT_FillCabling.h            |  66 ---
 .../SCT_Cabling/SCT_Cabling/SCT_CablingData.h |   5 +-
 .../SCT_Cabling/doc/packagedoc.h              |  27 +-
 .../SCT_Cabling/python/SCT_CablingConfig.py   |   8 +-
 .../SCT_Cabling/python/SCT_CablingConfigDb.py |   4 +-
 .../SCT_Cabling/src/SCT_CablingToolInc.cxx    | 258 ---------
 .../SCT_Cabling/src/SCT_CablingToolInc.h      | 113 ----
 .../src/SCT_FillCablingFromCoraCool.cxx       | 526 ------------------
 .../src/SCT_FillCablingFromCoraCool.h         |  91 ---
 .../src/SCT_FillCablingFromText.cxx           | 253 ---------
 .../SCT_Cabling/src/SCT_FillCablingFromText.h |  84 ---
 .../src/components/SCT_Cabling_entries.cxx    |   6 -
 .../share/TestRegionLUT.py                    |   3 -
 .../RecExTB/scripts/ctb.reco.merge.trf        |   3 -
 .../RecExample/RecExTB/scripts/ctb.reco.trf   |   3 -
 .../share/RecExTB_Combined_2004_jobOptions.py |   3 -
 31 files changed, 15 insertions(+), 2098 deletions(-)
 delete mode 100755 InnerDetector/InDetDetDescr/InDetRegionSelector/InDetRegionSelector/SiRegionSelectorTable.h
 delete mode 100755 InnerDetector/InDetDetDescr/InDetRegionSelector/InDetRegionSelector/TRT_RegionSelectorTable.h
 delete mode 100755 InnerDetector/InDetDetDescr/InDetRegionSelector/src/SiRegionSelectorTable.cxx
 delete mode 100755 InnerDetector/InDetDetDescr/InDetRegionSelector/src/TRT_RegionSelectorTable.cxx
 delete mode 100644 InnerDetector/InDetDetDescr/SCT_Cabling/SCT_Cabling/ISCT_FillCabling.h
 delete mode 100644 InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_CablingToolInc.cxx
 delete mode 100644 InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_CablingToolInc.h
 delete mode 100644 InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromCoraCool.cxx
 delete mode 100644 InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromCoraCool.h
 delete mode 100644 InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromText.cxx
 delete mode 100644 InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromText.h

diff --git a/Calorimeter/CaloExample/CaloAnaEx/share/CaloAnaExTB.py b/Calorimeter/CaloExample/CaloAnaEx/share/CaloAnaExTB.py
index 29cfe895202..91536d55c09 100755
--- a/Calorimeter/CaloExample/CaloAnaEx/share/CaloAnaExTB.py
+++ b/Calorimeter/CaloExample/CaloAnaEx/share/CaloAnaExTB.py
@@ -459,9 +459,6 @@ if InDetTBFlags.SiTBLineFitter or InDetTBFlags.xKalman or InDetTBFlags.iPatRec o
 if doTrigger:
     # prepare LUT for Region Selector
     include("InDetRegionSelector/InDetRegionSelectorTable_jobOptions.py" )
-if InDetTBFlags.iPatRec and not doTrigger:
-    # prepare LUT for Region Selector used in TRT_Rec
-    include("InDetRegionSelector/TRT_RegionSelectorTable_jobOptions.py" )
 
 # -----------------------------
 # Reconstruction
diff --git a/DetectorDescription/RegionSelector/CMakeLists.txt b/DetectorDescription/RegionSelector/CMakeLists.txt
index 7e0e34584e5..091941760b7 100644
--- a/DetectorDescription/RegionSelector/CMakeLists.txt
+++ b/DetectorDescription/RegionSelector/CMakeLists.txt
@@ -7,7 +7,7 @@ atlas_subdir( RegionSelector )
 atlas_add_library( RegionSelectorLib
                    src/*.cxx
                    PUBLIC_HEADERS RegionSelector
-                   LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel GeoModelInterfaces IRegionSelector Identifier RegSelLUT SCT_CablingLib
+                   LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel GeoModelInterfaces IRegionSelector Identifier RegSelLUT
                    PRIVATE_LINK_LIBRARIES AthenaPoolUtilities CxxUtils InDetConditionsSummaryService PathResolver StoreGateLib )
 
 atlas_add_component( RegionSelector
diff --git a/DetectorDescription/RegionSelector/python/RegSelConfig.py b/DetectorDescription/RegionSelector/python/RegSelConfig.py
index a440fb5b439..20dd2bda10b 100644
--- a/DetectorDescription/RegionSelector/python/RegSelConfig.py
+++ b/DetectorDescription/RegionSelector/python/RegSelConfig.py
@@ -36,36 +36,6 @@ def regSelCfg( flags ):
         TileRegionSelectorTable=CompFactory.TileRegionSelectorTable
         regSel.TileRegionSelectorTable = TileRegionSelectorTable(name="TileRegionSelectorTable")
 
-    if flags.Detector.GeometryPixel:
-        regSel.enableID = True
-        regSel.enablePixel = True        
-        SiRegionSelectorTable=CompFactory.SiRegionSelectorTable
-        regSel.PixelRegionLUT_CreatorTool = SiRegionSelectorTable(name        = "PixelRegionSelectorTable",
-                                                                  ManagerName = "Pixel",
-                                                                  OutputFile  = "RoITablePixel.txt",
-                                                                  PrintHashId = True,
-                                                                  PrintTable  = False)
-
-    if flags.Detector.GeometrySCT:
-        regSel.enableID = True
-        regSel.enableSCT = True
-        SiRegionSelectorTable=CompFactory.SiRegionSelectorTable
-        regSel.SCT_RegionLUT_CreatorTool = SiRegionSelectorTable(name        = "SCT_RegionSelectorTable",
-                                                                 ManagerName = "SCT",
-                                                                 OutputFile  = "RoITableSCT.txt",
-                                                                 PrintHashId = True,
-                                                                 PrintTable  = False)
-
-    if flags.Detector.GeometryTRT:
-        regSel.enableID = True
-        regSel.enableTRT = True
-        TRT_RegionSelectorTable=CompFactory.TRT_RegionSelectorTable
-        regSel.TRT_RegionLUT_CreatorTool = TRT_RegionSelectorTable(name = "TRT_RegionSelectorTable",
-                                                                   ManagerName = "TRT",
-                                                                   OutputFile  = "RoITableTRT.txt",
-                                                                   PrintHashId = True,
-                                                                   PrintTable  = False)
-
     # by default, all 'enableX' flags of RegSelSvc are set to True, so turn them off if not needed
     if not flags.Detector.GeometryRPC:
         regSel.enableRPC  = False
diff --git a/DetectorDescription/RegionSelector/python/RegSelSvcDefault.py b/DetectorDescription/RegionSelector/python/RegSelSvcDefault.py
index 9c1a98542ec..3ca86003533 100755
--- a/DetectorDescription/RegionSelector/python/RegSelSvcDefault.py
+++ b/DetectorDescription/RegionSelector/python/RegSelSvcDefault.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
 
 # default configuration of RegSelSvc
 # example of a configuration in class deriving from a Configurable
@@ -42,34 +42,6 @@ class RegSelSvcDefault ( RegSelSvc )  :
       
         from AthenaCommon.DetFlags import DetFlags
 
-        if DetFlags.detdescr.ID_on():
-            if DetFlags.detdescr.pixel_on():
-                from InDetRegionSelector.InDetRegionSelectorConf import SiRegionSelectorTable
-                pixTable = SiRegionSelectorTable(name        = "PixelRegionSelectorTable",
-                                                 ManagerName = "Pixel",
-                                                 OutputFile  = "RoITablePixel.txt",
-                                                 PrintHashId = True,
-                                                 PrintTable  = False)
-                mlog.debug(pixTable)
-        
-            if DetFlags.detdescr.SCT_on():
-                from InDetRegionSelector.InDetRegionSelectorConf import SiRegionSelectorTable
-                sctTable = SiRegionSelectorTable(name        = "SCT_RegionSelectorTable",
-                                                 ManagerName = "SCT",
-                                                 OutputFile  = "RoITableSCT.txt",
-                                                 PrintHashId = True,
-                                                 PrintTable  = False)
-                mlog.debug(sctTable)
-
-            if DetFlags.detdescr.TRT_on():
-                from InDetRegionSelector.InDetRegionSelectorConf import TRT_RegionSelectorTable
-                trtTable = TRT_RegionSelectorTable(name = "TRT_RegionSelectorTable",
-                                                   ManagerName = "TRT",
-                                                   OutputFile  = "RoITableTRT.txt",
-                                                   PrintHashId = True,
-                                                   PrintTable  = False)
-                mlog.debug(trtTable)
-                
         if DetFlags.detdescr.Calo_on():
             from LArRegionSelector.LArRegionSelectorConf import LArRegionSelectorTable
             larTable =  LArRegionSelectorTable(name="LArRegionSelectorTable")
diff --git a/DetectorDescription/RegionSelector/src/RegSelSvc.cxx b/DetectorDescription/RegionSelector/src/RegSelSvc.cxx
index aa6c71ae682..3e5ec0f646c 100755
--- a/DetectorDescription/RegionSelector/src/RegSelSvc.cxx
+++ b/DetectorDescription/RegionSelector/src/RegSelSvc.cxx
@@ -60,12 +60,8 @@ RegSelSvc::RegSelSvc(const std::string& name, ISvcLocator* sl)
     m_disableTRTFromConditions(true),
     m_roiFileName        ("RSOutputTable.txt"),
     m_LArFebRodMapKey    ("/LAR/Identifier/FebRodMap"),
-    m_lutCreatorToolPixel("SiRegionSelectorTable/PixelRegionSelectorTable", this),
-    m_lutCreatorToolSCT  ("SiRegionSelectorTable/SCT_RegionSelectorTable", this),
-    m_lutCreatorToolTRT  ("TRT_RegionSelectorTable", this),
     m_lutCreatorToolLAR  ("LArRegionSelectorTable", this),
     m_lutCreatorToolTile ("TileRegionSelectorTable", this),
-    m_SCTCablingToolInc("SCT_CablingToolInc"),
     m_geoModelSvc("GeoModelSvc",name),
     m_DeltaZ(168),
     m_initRPC(true),
@@ -99,9 +95,6 @@ RegSelSvc::RegSelSvc(const std::string& name, ISvcLocator* sl)
   declareProperty( "enablesTGC",  m_initsTGC,     "enable sTGC map" );
   declareProperty( "WriteTables", m_dumpTable,    "write out maps to files for debugging" );
   declareProperty( "OutputFile",  m_roiFileName,  "base filename used to write maps to" );
-  declareProperty( "PixelRegionLUT_CreatorTool", m_lutCreatorToolPixel);
-  declareProperty( "SCT_RegionLUT_CreatorTool",  m_lutCreatorToolSCT);
-  declareProperty( "TRT_RegionLUT_CreatorTool",  m_lutCreatorToolTRT);
   declareProperty( "LArRegionSelectorTable",     m_lutCreatorToolLAR);
   declareProperty( "TileRegionSelectorTable",    m_lutCreatorToolTile);
   declareProperty( "RPCRegionSelectorTable",     m_lutCreatorToolRPC);
diff --git a/DetectorDescription/RegionSelector/src/RegSelSvc.h b/DetectorDescription/RegionSelector/src/RegSelSvc.h
index aa10fb208b6..3ac2e2a56fe 100755
--- a/DetectorDescription/RegionSelector/src/RegSelSvc.h
+++ b/DetectorDescription/RegionSelector/src/RegSelSvc.h
@@ -24,7 +24,6 @@
 
 #include "RegionSelector/IRegionLUT_Creator.h"
 #include "RegSelLUT/IRegionIDLUT_Creator.h"
-#include "SCT_Cabling/ISCT_CablingTool.h"
 
 #include "GeoModelInterfaces/IGeoModelSvc.h"
 #include "GaudiKernel/MsgStream.h"
@@ -450,12 +449,8 @@ private:
   typedef SimpleProperty< std::vector<uint32_t> > Uint32ArrayProperty;
   
   //! Tools to create the lookup tables in StoreGate
-  ToolHandle<IRegionIDLUT_Creator> m_lutCreatorToolPixel;
-  ToolHandle<IRegionIDLUT_Creator> m_lutCreatorToolSCT;
-  ToolHandle<IRegionIDLUT_Creator> m_lutCreatorToolTRT;
   ToolHandle<IRegionLUT_Creator> m_lutCreatorToolLAR;
   ToolHandle<IRegionLUT_Creator> m_lutCreatorToolTile;
-  ToolHandle< ISCT_CablingTool > m_SCTCablingToolInc; // Retrieve SCT_CablingToolInc in initialize of RegSelSvc so that SCT_RegionSelectorTable can use ready SCT_CablingToolInc in BeginRun incident.
   ServiceHandle< IGeoModelSvc > m_geoModelSvc;
   std::vector<std::string> m_enabledDetectors;
   bool m_errorFlag;
diff --git a/InnerDetector/InDetDetDescr/InDetRegionSelector/InDetRegionSelector/InDetRegionSelectorLUT.h b/InnerDetector/InDetDetDescr/InDetRegionSelector/InDetRegionSelector/InDetRegionSelectorLUT.h
index a552e9a8520..568811d5d6b 100755
--- a/InnerDetector/InDetDetDescr/InDetRegionSelector/InDetRegionSelector/InDetRegionSelectorLUT.h
+++ b/InnerDetector/InDetDetDescr/InDetRegionSelector/InDetRegionSelector/InDetRegionSelectorLUT.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 InDetRegionSelector_InDetRegionSelectorLUT_h
@@ -27,10 +27,6 @@ namespace InDetDD {
   
   private:
     
-    ToolHandle<IRegionIDLUT_Creator> m_lutCreatorToolPixel;
-    ToolHandle<IRegionIDLUT_Creator> m_lutCreatorToolSCT;
-    ToolHandle<IRegionIDLUT_Creator> m_lutCreatorToolTRT;
-  
     bool m_doTests;
 
   };
diff --git a/InnerDetector/InDetDetDescr/InDetRegionSelector/InDetRegionSelector/SiRegionSelectorTable.h b/InnerDetector/InDetDetDescr/InDetRegionSelector/InDetRegionSelector/SiRegionSelectorTable.h
deleted file mode 100755
index f8efee971ae..00000000000
--- a/InnerDetector/InDetDetDescr/InDetRegionSelector/InDetRegionSelector/SiRegionSelectorTable.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
- 
-#ifndef InDetRegionSelector_SiRegionSelectorTable_h
-#define InDetRegionSelector_SiRegionSelectorTable_h
-
-#include "RegSelLUT/IRegionIDLUT_Creator.h"
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "SCT_Cabling/ISCT_CablingTool.h"
-
-#include "GaudiKernel/ToolHandle.h"
-
-#include "PixelConditionsData/PixelCablingCondData.h"
-#include "StoreGate/ReadCondHandleKey.h"
-
-#include <string>
-
-class RegSelSiLUT;
-
-/////////////////////////////////////////////////////////////////////////////
-
-class SiRegionSelectorTable : public AthAlgTool, virtual public IRegionIDLUT_Creator
-{
-
-public:
-  SiRegionSelectorTable (const std::string&, 
-			 const std::string&,
-			 const IInterface*);
-  virtual ~SiRegionSelectorTable();
-  StatusCode initialize();
-  StatusCode finalize();
-  
-  virtual RegSelSiLUT* getLUT();
-
-private:
-  
-  StatusCode createTable (const EventContext& ctx);
-  
-  RegSelSiLUT*   m_regionLUT;
-
-  // Algorithm properties
-  std::string m_managerName;
-  std::string m_roiFileName;
-  bool m_printHashId;
-  bool m_printTable;
-  bool m_noDBM;
-
-  // cablings
-  PublicToolHandle<ISCT_CablingTool>  m_sctCablingToolInc // This class accesses SCT cabling during initialization.
-    {this, "SCT_CablingTool", "SCT_CablingToolInc", "Tool to retrieve SCT Cabling"};
-
-  SG::ReadCondHandleKey<PixelCablingCondData> m_condCablingKey
-    {this, "PixelCablingCondData", "PixelCablingCondData", "Pixel cabling key"};
-
-};
-
-#endif // InDetRegionSelector_SiRegionSelectorTable_h
diff --git a/InnerDetector/InDetDetDescr/InDetRegionSelector/InDetRegionSelector/TRT_RegionSelectorTable.h b/InnerDetector/InDetDetDescr/InDetRegionSelector/InDetRegionSelector/TRT_RegionSelectorTable.h
deleted file mode 100755
index ed5ccaa48ba..00000000000
--- a/InnerDetector/InDetDetDescr/InDetRegionSelector/InDetRegionSelector/TRT_RegionSelectorTable.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef InDetRegionSelector_TRT_RegionSelectorTable_h
-#define InDetRegionSelector_TRT_RegionSelectorTable_h
-
-#include "RegSelLUT/IRegionIDLUT_Creator.h"
-
-
-
-#include "AthenaBaseComps/AthAlgTool.h"
-
-#include <string>
-
-class RegSelSiLUT;
-class TRT_IdentifierConversionTool;
-class ITRT_CablingSvc;
-
-/////////////////////////////////////////////////////////////////////////////
-
-class TRT_RegionSelectorTable : public AthAlgTool, virtual public IRegionIDLUT_Creator
-{
-public:
-  
-  TRT_RegionSelectorTable (const std::string&, 
-			   const std::string&,
-			   const IInterface*);
-  virtual ~TRT_RegionSelectorTable();
-  StatusCode initialize();
-  StatusCode execute();
-  StatusCode finalize();
-  virtual RegSelSiLUT* getLUT();
-
-  
-private:
- 
-  StatusCode createTable();
-
-  ServiceHandle<ITRT_CablingSvc>    m_TRT_IdMapping;  // Identifier mapping Tool
-  //TRT_IdentifierConversionTool* m_TRT_IdMappingOld;  // Identifier conversion Tool. 
-                                                     // Here temporarily until ATLAS mapping 
-                                                     // is put into InDetCabling
-
-  RegSelSiLUT*  m_regionLUT;
-
-  // Algorithm properties
-  std::string m_managerName;
-  std::string m_roiFileName;
-  bool m_printHashId;
-  bool m_printTable;
-};
-
-#endif // InDetRegionSelector_TRT_RegionSelectorTable_h
diff --git a/InnerDetector/InDetDetDescr/InDetRegionSelector/doc/packagedoc.h b/InnerDetector/InDetDetDescr/InDetRegionSelector/doc/packagedoc.h
index 038724ae818..9bd8f41645a 100644
--- a/InnerDetector/InDetDetDescr/InDetRegionSelector/doc/packagedoc.h
+++ b/InnerDetector/InDetDetDescr/InDetRegionSelector/doc/packagedoc.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
 */
 
 /**
@@ -48,11 +48,7 @@ used at both the inner and outer radius.
 
 @section InDetRegionSelector_InDetRegionSelectorClassOverview Class Overview
 
-The package contains the two tools:
-
-  - SiRegionSelectorTable:  Pixel and SCT
-  - TRT_RegionSelectorTable:  For TRT.
-
+The package contains no tool:
 
 @section InDetRegionSelector_InDetRegionSelectorJobOptions Job Options
 
diff --git a/InnerDetector/InDetDetDescr/InDetRegionSelector/share/InDetRegionSelectorTable_jobOptions.py b/InnerDetector/InDetDetDescr/InDetRegionSelector/share/InDetRegionSelectorTable_jobOptions.py
index 80abe731773..0e1a120ca50 100755
--- a/InnerDetector/InDetDetDescr/InDetRegionSelector/share/InDetRegionSelectorTable_jobOptions.py
+++ b/InnerDetector/InDetDetDescr/InDetRegionSelector/share/InDetRegionSelectorTable_jobOptions.py
@@ -17,57 +17,3 @@ topSequence = AlgSequence()
 # get ToolSvc
 ToolSvc = Service( "ToolSvc" )
 
-#
-# SiRegionSelectorTable and TRT_RegionSelectorTable properties
-#
-# ManagerName:      Manager name.
-#
-# For debugging the following is also available
-# OuputFile:        File name of output file. 
-# PrintHashId:	     true: print hash ids, false: print expanded id.
-# PrintTable:       Output table to a text file.
-
-
-# Pixel table
-
-if DetFlags.detdescr.pixel_on():
-    from InDetRegionSelector.InDetRegionSelectorConf import SiRegionSelectorTable
-    PixelRegionSelectorTable = SiRegionSelectorTable(name        = "PixelRegionSelectorTable",
-                                                     ManagerName = "Pixel",
-                                                     OutputFile  = "RoITablePixel.txt",
-                                                     PrintHashId = True,
-                                                     PrintTable  = False)
-    ToolSvc += PixelRegionSelectorTable
-    print      PixelRegionSelectorTable
-else :
-    PixelRegionSelectorTable = None
-
-
-# SCT table
-
-if DetFlags.detdescr.SCT_on():
-    from InDetRegionSelector.InDetRegionSelectorConf import SiRegionSelectorTable
-    SCT_RegionSelectorTable = SiRegionSelectorTable(name        = "SCT_RegionSelectorTable",
-                                                    ManagerName = "SCT",
-                                                    OutputFile  = "RoITableSCT.txt",
-                                                    PrintHashId = True,
-                                                    PrintTable  = False)
-    ToolSvc += SCT_RegionSelectorTable
-    print      SCT_RegionSelectorTable
-else :
-    SCT_RegionSelectorTable = None
-
-
-# TRT table 
-
-if DetFlags.detdescr.TRT_on():
-    from InDetRegionSelector.InDetRegionSelectorConf import TRT_RegionSelectorTable
-    TRT_RegionSelectorTable = TRT_RegionSelectorTable(name        = "TRT_RegionSelectorTable",
-                                                      ManagerName = "TRT",
-                                                      OutputFile  = "RoITableTRT.txt",
-                                                      PrintHashId = True,
-                                                      PrintTable  = False)
-    ToolSvc += TRT_RegionSelectorTable
-    print      TRT_RegionSelectorTable
-else :
-    TRT_RegionSelectorTable = None
diff --git a/InnerDetector/InDetDetDescr/InDetRegionSelector/src/InDetRegionSelectorLUT.cxx b/InnerDetector/InDetDetDescr/InDetRegionSelector/src/InDetRegionSelectorLUT.cxx
index ac581221fab..194d0655124 100755
--- a/InnerDetector/InDetDetDescr/InDetRegionSelector/src/InDetRegionSelectorLUT.cxx
+++ b/InnerDetector/InDetDetDescr/InDetRegionSelector/src/InDetRegionSelectorLUT.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
 */
 
 #include "InDetRegionSelector/InDetRegionSelectorLUT.h"
@@ -21,15 +21,9 @@
 using namespace InDetDD;
 
 InDetRegionSelectorLUT::InDetRegionSelectorLUT(const std::string& name, ISvcLocator* pSvcLocator) :
-  AthAlgorithm(name, pSvcLocator),
-  m_lutCreatorToolPixel("InDetDD::SiRegionSelectorTable/PixelRegionSelectorTable"),
-  m_lutCreatorToolSCT  ("InDetDD::SiRegionSelectorTable/SCT_RegionSelectorTable"),
-  m_lutCreatorToolTRT  ("InDetDD::TRT_RegionSelectorTable/TRT_RegionSelectorTable")
+  AthAlgorithm(name, pSvcLocator)
 {  
   // Get parameter values from jobOptions file
-  declareProperty("PixelRegionLUT_CreatorTool", m_lutCreatorToolPixel);
-  declareProperty("SCT_RegionLUT_CreatorTool",  m_lutCreatorToolSCT);
-  declareProperty("TRT_RegionLUT_CreatorTool",  m_lutCreatorToolTRT);
   declareProperty("DoTests", m_doTests = false);
 }
 
diff --git a/InnerDetector/InDetDetDescr/InDetRegionSelector/src/SiRegionSelectorTable.cxx b/InnerDetector/InDetDetDescr/InDetRegionSelector/src/SiRegionSelectorTable.cxx
deleted file mode 100755
index ba6d489b378..00000000000
--- a/InnerDetector/InDetDetDescr/InDetRegionSelector/src/SiRegionSelectorTable.cxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-  
-#include "InDetRegionSelector/SiRegionSelectorTable.h"
-
-#include "InDetReadoutGeometry/SiDetectorElementCollection.h"
-#include "InDetReadoutGeometry/SiDetectorElement.h"
-#include "InDetReadoutGeometry/SiDetectorManager.h"
-#include "Identifier/IdentifierHash.h"
-#include "InDetIdentifier/SCT_ID.h"
-#include "InDetIdentifier/PixelID.h"
-
-#include "RegSelLUT/StoreGateIDRS_ClassDEF.h" 
-#include "RegSelLUT/RegSelModule.h" 
-#include "RegSelLUT/RegSelSiLUT.h" 
-
-#include "AthenaKernel/ExtendedEventContext.h"
-#include "GaudiKernel/ThreadLocalContext.h"
-
-#include "CLHEP/Units/SystemOfUnits.h"
-
-#include <iostream>
-#include <fstream>
-#include <fstream>
-
-using namespace InDetDD;
-using namespace std;
-
-#define USE_STOREGATE
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-SiRegionSelectorTable::SiRegionSelectorTable(const std::string& type,
-					     const std::string& name,
-					     const IInterface* parent)
-  :  AthAlgTool(type,name,parent),
-     m_regionLUT(nullptr),
-     m_managerName(""),
-     m_roiFileName("RoITable.txt"),
-     m_printHashId(true),
-     m_printTable(false),
-     m_noDBM(true)
-{
-  declareInterface<IRegionIDLUT_Creator>(this);
-  declareProperty("ManagerName", m_managerName);
-
-  // The remaining properties are for debugging purposes.
-  declareProperty("OutputFile",  m_roiFileName);
-  declareProperty("PrintHashId", m_printHashId);
-  declareProperty("PrintTable",  m_printTable);
-  declareProperty("NoDBM",       m_noDBM=true);
-
-}
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
-
-StatusCode 
-SiRegionSelectorTable::initialize(){
-
-  //  MsgStream log(msgSvc(), name());
-  //  log << MSG::INFO << "initialize()" << endmsg;
-  msg(MSG::INFO) << "initialize() " << name() << " " << PACKAGE_VERSION << endmsg;
-
-  msg(MSG::INFO)  << "Tool Properties" << endmsg;
-  msg(MSG::INFO)  << " Detector Manager: " << m_managerName << endmsg;
-  if( msgLvl(MSG::DEBUG) ) {
-    msg(MSG::DEBUG) << " Output File:      " << m_roiFileName <<endmsg;
-    msg(MSG::DEBUG) << " Print hashId:     " << ((m_printHashId) ? "true" : "false") <<endmsg;
-    msg(MSG::DEBUG) << " Print Table:      " << ((m_printTable) ? "true" : "false") <<endmsg;
-  }    
-
-  if (m_managerName.empty()) {
-    msg(MSG::WARNING) << "Tool disabled." << endmsg;
-  } 
- 
-  ATH_MSG_WARNING("So far, this prevents the conditions migration!! The createTable() should NOT be used in the initilization step...");
-
-  return StatusCode::SUCCESS;
-}
-
-
-SiRegionSelectorTable::~SiRegionSelectorTable()
-{
-}
-
-
-// Get the lookup table.
-RegSelSiLUT* SiRegionSelectorTable::getLUT()
-{
-  return m_regionLUT;
-}
-	 
-
-
-
-StatusCode 
-SiRegionSelectorTable::createTable (const EventContext& /* ctx */ )
-{
-  ATH_MSG_INFO( "SiRegionSelectorTable::createTable() - no longer in use" );
-  return StatusCode::SUCCESS;
-}
-
-
-
-StatusCode SiRegionSelectorTable::finalize() {
-  msg(MSG::INFO) << "finalize()" << endmsg;
-  return StatusCode::SUCCESS;
-}
-
diff --git a/InnerDetector/InDetDetDescr/InDetRegionSelector/src/TRT_RegionSelectorTable.cxx b/InnerDetector/InDetDetDescr/InDetRegionSelector/src/TRT_RegionSelectorTable.cxx
deleted file mode 100755
index a9d09c864d4..00000000000
--- a/InnerDetector/InDetDetDescr/InDetRegionSelector/src/TRT_RegionSelectorTable.cxx
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "InDetRegionSelector/TRT_RegionSelectorTable.h"
-
-#include "GaudiKernel/MsgStream.h"
-
-
-#include "CLHEP/Units/SystemOfUnits.h"
-
-#include "TRT_ReadoutGeometry/TRT_BarrelElement.h" 
-#include "TRT_ReadoutGeometry/TRT_EndcapElement.h" 
-#include "InDetIdentifier/TRT_ID.h" 
-#include "Identifier/Identifier.h" 
-#include "Identifier/IdentifierHash.h" 
-#include "TRT_ReadoutGeometry/TRT_DetectorManager.h" 
-#include "TRT_ReadoutGeometry/TRT_Numerology.h" 
-
-#include <iostream>
-#include <fstream>
-#include <string>
-#include <cmath>
-
-#include "RegSelLUT/StoreGateIDRS_ClassDEF.h" 
-
-#include "TRT_Cabling/ITRT_CablingSvc.h"
-
-#include "RegSelLUT/RegSelModule.h" 
-#include "RegSelLUT/RegSelSiLUT.h" 
-
-
-
-using namespace InDetDD;
-
-
-#define USE_STOREGATE
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-TRT_RegionSelectorTable::TRT_RegionSelectorTable(const std::string& type,
-						 const std::string& name,
-						 const IInterface* parent)
-  :  AthAlgTool(type,name,parent),
-     m_TRT_IdMapping("TRT_CablingSvc", name),
-     m_regionLUT(nullptr),
-     m_managerName("TRT"),
-     m_roiFileName("TRTRoITable.txt"),
-     m_printHashId(true),
-     m_printTable(false)
-{
-  declareInterface<IRegionIDLUT_Creator>(this);
-  declareProperty("ManagerName", m_managerName);
-
-  // The remaining properties are for debugging purposes.
-  declareProperty("OutputFile",  m_roiFileName);
-  declareProperty("PrintHashId", m_printHashId);
-  declareProperty("PrintTable",  m_printTable);
-}
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
-
-StatusCode TRT_RegionSelectorTable::initialize(){
-
-  //  MsgStream msglog(msgSvc(), name());
-  msg(MSG::INFO) << "initialize() " << name() << " " << PACKAGE_VERSION << endmsg;
-
-  msg(MSG::INFO)  << "Tool Properties" << endmsg;
-  msg(MSG::INFO)  << " Detector Manager: " << m_managerName << endmsg;
-  if ( msgLvl(MSG::DEBUG) ) {
-    msg(MSG::DEBUG) << " Output File:      " << m_roiFileName <<endmsg;
-    msg(MSG::DEBUG) << " Print hashId:     " << ((m_printHashId) ? "true" : "false") <<endmsg;
-    msg(MSG::DEBUG) << " Print Table:      " << ((m_printTable) ? "true" : "false") <<endmsg;
-  }
-
-  if (m_managerName.empty()) {
-    msg(MSG::WARNING) << "Tool disabled." << endmsg;
-    return StatusCode::FAILURE;
-  } 
- 
-  StatusCode sc;
-
-  sc = createTable();
-  return sc;
-}
-
-TRT_RegionSelectorTable::~TRT_RegionSelectorTable()
-{
-  // table is stored in storegate so nothing to delete.
-#ifndef USE_STOREGATE
-  if ( m_regionLUT ) delete m_regionLUT;
-#endif
-}
-
-// Get the lookup table.
-RegSelSiLUT* TRT_RegionSelectorTable::getLUT()
-{
-  return m_regionLUT;
-}
-
-StatusCode 
-TRT_RegionSelectorTable::createTable()
-{
-  if ( msgLvl(MSG::DEBUG) )  msg(MSG::DEBUG) << "Creating region selector table"  << endmsg;
-  StatusCode sc;
-  // Retrieve manager
-  const TRT_DetectorManager* manager;
-  sc=detStore()->retrieve(manager, m_managerName);
-  if (sc.isFailure()) {
-    msg(MSG::FATAL) << "Could not find the Manager: "<< m_managerName << " !" << endmsg;
-    return StatusCode::FAILURE;
-  } else {
-    if ( msgLvl(MSG::DEBUG) )  msg(MSG::DEBUG) << "Manager found" << endmsg;
-  }
-  
-  // Get Tool Service
-  IToolSvc* toolSvc;
-  if (StatusCode::SUCCESS != service("ToolSvc", toolSvc))    {
-    msg(MSG::ERROR) << " Can't get ToolSvc " << endmsg;
-    return StatusCode::FAILURE;
-  }
-  
-  // Get TRT IdentifierConversionTool
-  sc = m_TRT_IdMapping.retrieve();
-
-  if (sc != StatusCode::SUCCESS){
-    msg(MSG::ERROR) << " Can't get TRTCablingSvc " << endmsg;
-    return StatusCode::FAILURE;
-  }
-  // Get the id helper 
-  const TRT_ID* idHelper = 0;
-  if ( detStore()->retrieve( idHelper, "TRT_ID" ).isFailure() ) {
-    msg(MSG::FATAL) << "Could not get TRT ID helper" << endmsg;
-    return StatusCode::FAILURE;
-  }
-  
-  //-----------------------------------------------------
-  unsigned int maxHash = idHelper->straw_layer_hash_max();
-  // 
-  // Try and iterate over all elements.  
-  // There is no iterator but we can get the elements via the idHash. 
-  // 
-  // MS create the new TRT look up table
-  RegSelSiLUT *rtrt = new RegSelSiLUT(RegSelSiLUT::TRT);
-  const double twoPi=2.*M_PI;
-  for (unsigned int index = 0; index < maxHash; index++) {
-    IdentifierHash idHash = index;
-    Identifier id = idHelper->layer_id(idHash);
-    int idBarrelEndcap = idHelper->barrel_ec(id);
-    int idSide = (idBarrelEndcap > 0);
-    int idLayerWheel = idHelper->layer_or_wheel(id);
-    int idPhiModule = idHelper->phi_module(id);
-    int idStrawLayer = idHelper->straw_layer(id);
-    const TRT_BarrelElement* Belement = nullptr;
-    const TRT_EndcapElement* Eelement = nullptr;
-    Identifier idelement;
-    double InnerRadiusOfStraw = 2.; //hardcoded. No method? (it will NEVER change anyway)
-    double phiMin,phiMax,rz;    
-    if (idHelper->is_barrel(id)) {
-      Belement = manager->getBarrelElement(idSide, idLayerWheel, idPhiModule, idStrawLayer);
-      idelement = Belement->identify();
-      int Nstraws = Belement->nStraws();
-      const int theLastStraw=Nstraws-1;
-      double Length =  Belement->strawLength();
-      double x0 = Belement->strawXPos(0);
-      double x1 = Belement->strawXPos(theLastStraw);
-      double y0 = Belement->strawYPos(0);
-      double y1 = Belement->strawYPos(theLastStraw);
-      double r0 = sqrt(x0*x0 + y0*y0);
-      double r1 = sqrt(x1*x1 + y1*y1);
-      phiMin = atan2(y0,x0) - atan2(InnerRadiusOfStraw,r0); // over 0? 
-      while (phiMin >  M_PI)  phiMin -= twoPi; //isnt there a 'mod' operation alternative??
-      while (phiMin < -M_PI)  phiMin += twoPi;
-      phiMax = atan2(y1,x1) + atan2(InnerRadiusOfStraw,r1); // over 0?
-      while (phiMax >   M_PI) phiMax -= twoPi;
-      while (phiMax <  -M_PI) phiMax += twoPi;
-      double zmin = Belement->strawZPos(theLastStraw) - Length*0.5;
-      double zmax = Belement->strawZPos(theLastStraw) + Length*0.5;
-      double rmin = ( r0<r1 ? r0 : r1 ) - InnerRadiusOfStraw;
-      double rmax = ( r1>r0 ? r1 : r0 ) + InnerRadiusOfStraw;
-      std::vector<uint32_t> vrob;
-      vrob = m_TRT_IdMapping->getRobID(idelement);  
-      for (unsigned int ii=0 ; ii < vrob.size(); ++ii) { 
-        RegSelModule smod( zmin, zmax, rmin, rmax, phiMin, phiMax, idLayerWheel, idSide, vrob[ii], idHash);
-        rtrt->addModule(smod);
-      }
-    } else {
-      Eelement = manager->getEndcapElement(idSide, idLayerWheel, idStrawLayer, idPhiModule);
-      idelement = Eelement->identify();
-      int Nstraws = Eelement->getDescriptor()->nStraws();
-      double pitch = Eelement->getDescriptor()->strawPitch();
-      double phi0  = Eelement->getDescriptor()->startPhi();
-      double length = Eelement->getDescriptor()->strawLength();
-      double radius = Eelement->getDescriptor()->innerRadius ();
-      //check the following line, was HepGeom::Point3D<double>
-      Amg::Vector3D center = Eelement->transform() * Amg::Vector3D(0,0,0);
-      double dphi = atan2(InnerRadiusOfStraw, radius );
-      phiMin = phi0 - dphi;
-      while (phiMin >  M_PI)  phiMin -= twoPi;
-      while (phiMin < -M_PI) phiMin += twoPi;
-      phiMax = phi0 + pitch * (Nstraws-1) + dphi;
-      while (phiMax >   M_PI) phiMax -= twoPi;
-      while (phiMax <  -M_PI) phiMax += twoPi;	    
-      rz = center.z();
-      //why was this variable set twice to different things?.. and then never used?
-      //double R = rz >= 0 ? radius : radius + length;
-      //double R = rz >= 0 ? radius + length : radius ;
-      // MS: infor for new maps
-      double zmin = rz-InnerRadiusOfStraw;
-      double zmax = rz+InnerRadiusOfStraw;
-      double rmin = radius;
-      double rmax = radius+length;
-      std::vector<uint32_t> vrob;
-      // ??????
-      vrob = m_TRT_IdMapping->getRobID(idelement);  
-      for (unsigned int ii=0 ; ii < vrob.size(); ++ii) { 
-        RegSelModule smod( zmin, zmax, rmin, rmax, phiMin, phiMax, idLayerWheel, idSide+2, vrob[ii], idHash);
-        rtrt->addModule(smod);
-      }
-    }
-  }
-
-
-  // MS: new region selector lookup table
-  // initialise and save the new look up table
-  msg(MSG::INFO) << " initialising new trt map " << endmsg;
-  rtrt->initialise();
-
-  // save pointer for access from the ToolSvc
-#ifndef USE_STOREGATE
-  if ( m_regionLUT ) delete m_regionLUT;
-#endif
-  m_regionLUT = rtrt;
-
-#ifdef USE_STOREGATE
-  std::string newtrtKey = "TRTRegSelSiLUT";
-  if ( detStore()->contains< RegSelSiLUT >(newtrtKey) ) {
-    msg(MSG::FATAL) << " TRTRegSelSiLUT " << newtrtKey << " already exists " << endmsg;
-  } else {
-    // create and store LUT
-    sc = detStore()->record(rtrt, newtrtKey, true);
-    if ( sc.isFailure() ) {
-      msg(MSG::ERROR) << " could not register trt RegSelSiLUT" << endmsg;
-      return( StatusCode::FAILURE );
-    } else {
-      msg(MSG::INFO) << "trt RegSelSiLUT successfully saved in detector Store" << endmsg;
-    }
-  }
-#endif
-
-  // write out new new LUT to a file if need be
-  if ( m_printTable ) rtrt->write("NewTRT"+m_roiFileName);
-  
-  // end of MS change
-
-  return StatusCode::SUCCESS;
-}
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
-
-StatusCode TRT_RegionSelectorTable::execute() {
-
-  return StatusCode::SUCCESS;
-}
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
-
-StatusCode TRT_RegionSelectorTable::finalize() {
-
-  //  MsgStream msglog(msgSvc(), name());
-  msg(MSG::INFO) << "finalize()" << endmsg;
-  
-  return StatusCode::SUCCESS;
-}
-
diff --git a/InnerDetector/InDetDetDescr/InDetRegionSelector/src/components/InDetRegionSelector_entries.cxx b/InnerDetector/InDetDetDescr/InDetRegionSelector/src/components/InDetRegionSelector_entries.cxx
index ec058789048..a7ba3367e60 100644
--- a/InnerDetector/InDetDetDescr/InDetRegionSelector/src/components/InDetRegionSelector_entries.cxx
+++ b/InnerDetector/InDetDetDescr/InDetRegionSelector/src/components/InDetRegionSelector_entries.cxx
@@ -1,12 +1,8 @@
 #include "InDetRegionSelector/InDetRegionSelectorLUT.h"
-#include "InDetRegionSelector/SiRegionSelectorTable.h"
-#include "InDetRegionSelector/TRT_RegionSelectorTable.h"
 #include "../SiRegSelCondAlg.h"
 #include "../TRT_RegSelCondAlg.h"
 
 DECLARE_COMPONENT( InDetDD::InDetRegionSelectorLUT )
-DECLARE_COMPONENT( SiRegionSelectorTable )
-DECLARE_COMPONENT( TRT_RegionSelectorTable )
 DECLARE_COMPONENT( SiRegSelCondAlg )
 DECLARE_COMPONENT( TRT_RegSelCondAlg )
 
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/SCT_Cabling/ISCT_FillCabling.h b/InnerDetector/InDetDetDescr/SCT_Cabling/SCT_Cabling/ISCT_FillCabling.h
deleted file mode 100644
index a0efacbb9cd..00000000000
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/SCT_Cabling/ISCT_FillCabling.h
+++ /dev/null
@@ -1,66 +0,0 @@
-
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef ISCT_FillCabling_H
-#define ISCT_FillCabling_H
-/**   
- *   @file ISCT_Fill_Cabling.h
- *
- *   @brief Interface for tools which fill an SCT cabling object
- *
- *   @author Shaun Roe
- *   @date 05/10/2008
- */
-
-//Gaudi includes
-#include "GaudiKernel/IAlgTool.h"
-
-//STL includes
-#include <string>
-
-//fwd declarations
-class SCT_CablingData;
-class StatusCode;
- 
-/**
- *    @class ISCT_FillCabling
- *    @brief Interface base class for objects which fill the SCT Cabling.
- *
- */
-class ISCT_FillCabling: virtual public IAlgTool {
- public:
-  /// Virtual destructor
-  virtual ~ISCT_FillCabling() = default;
-  
-  /// InterfaceID re-implemented from IInterface
-  DeclareInterfaceID(ISCT_FillCabling, 1, 0);
-
-  /** May set the data source to textFile, database etc
-   * @param[in] @c string name of datasource
-   */
-  virtual StatusCode setDataSource(const std::string& dataSource) = 0;
-  
-  /** Get the data source
-   * @return @c string name of datasource
-   */
-  virtual std::string getDataSource() const = 0;
-  
-  /** Get the cabling maps
-   * @return @c cabling map object
-   */
-  virtual SCT_CablingData getMaps() const = 0;
-  
-  /** Report whether the map was filled
-   * @return @c bool
-   */
-  virtual bool filled() const = 0;
-  
-  /** Report whether the object can fill its data during the initialize phase
-   * @return @c bool
-   */
-  virtual bool canFillDuringInitialize() const = 0;
-};//end of class
-
-#endif // ISCT_FillCabling_H
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/SCT_Cabling/SCT_CablingData.h b/InnerDetector/InDetDetDescr/SCT_Cabling/SCT_Cabling/SCT_CablingData.h
index 2af13032ac6..555d7d62da7 100644
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/SCT_Cabling/SCT_CablingData.h
+++ b/InnerDetector/InDetDetDescr/SCT_Cabling/SCT_Cabling/SCT_CablingData.h
@@ -25,10 +25,9 @@
 
 /**
  * @class SCT_CablingData
- * A class to hold the data necessary for SCT_CablingTool and SCT_CablingToolInc.
+ * A class to hold the data necessary for SCT_CablingTool.
  * This class is filled by
- * SCT_CablingCondAlgFromCoraCool or SCT_CablingCondAlgFromText for SCT_CablingTool, and
- * SCT_CablingCondAlgFromCoraCool or SCT_FillCablingFromText for SCT_CablingToolInc.
+ * SCT_CablingCondAlgFromCoraCool or SCT_CablingCondAlgFromText for SCT_CablingTool.
  **/
 
 class SCT_CablingData {
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/doc/packagedoc.h b/InnerDetector/InDetDetDescr/SCT_Cabling/doc/packagedoc.h
index f6c6d4464f8..a0579c038dd 100644
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/doc/packagedoc.h
+++ b/InnerDetector/InDetDetDescr/SCT_Cabling/doc/packagedoc.h
@@ -28,34 +28,19 @@ HLT.
    accessor methods for the data structures it reads using SG::ReadCondHandle.
    The data are prepared by SCT_CablingCondAlgFromCoraCool or SCT_CablingCondAlgFromText.
    
-   - SCT_CablingToolInc: Inheriting from ISCT_CablingTool, IIncidentListener and
-   AthAlgTool: Provides accessor methods for the data structures it holds using
-   incident of ISCT_FillCabling. This class is now used only by RegSelSvc.
-   
-   - ISCT_FillCabling: Interface for the SCT_Fillxxxx classes which are used to fill the data structures
-   in SCT_CablingToolInc.
-   
-   - SCT_FillCablingFromCoraCool: Inheriting from ISCT_FillCabling and AthAlgTool, this is used to fill the
-   cabling from the database, in CoraCool or Cool Vector Payload format.
-   
-   - SCT_FillCablingFromText: Inheriting from ISCT_FillCabling and AthAlgTool, this is used to fill the 
-   cabling data from a text file.
-   
    - SCT_OnlineId: A stand-alone class for the online id, which is an encoding of the rod and fibre used
    to readout a particular module.
    
    - SCT_SerialNumber: A stand-alone class for the serial number, which is a 14 digit code associated with
    each SCT module at its manufactire.
 
-   - SCT_CablingData: A class to hold the data necessary for SCT_CablingTool and SCT_CablingToolInc.
+   - SCT_CablingData: A class to hold the data necessary for SCT_CablingTool.
    This class is filled by SCT_CablingCondAlgFromCoraCool or SCT_CablingCondAlgFromText for
-   SCT_CablingTool, and SCT_CablingCondAlgFromCoraCool or SCT_FillCablingFromText for SCT_CablingToolInc.
+   SCT_CablingTool.
 
-   - SCT_CablingCondAlgFromCoraCool: A condition algorithm for SCT_CablingTool and corresponds to
-   SCT_FillCablingFromCoraCool for SCT_CablingToolInc. This is used to fill the cabling from the database.
+   - SCT_CablingCondAlgFromCoraCool: A condition algorithm for SCT_CablingTool. This is used to fill the cabling from the database.
 
-   - SCT_CablingCondAlgFromText: A condition algorithm for SCT_CablingTool and corresponds to
-   SCT_FillCablingFromText for SCT_CablingToolInc. This is used to fill the cabling from a text file.
+   - SCT_CablingCondAlgFromText: A condition algorithm for SCT_CablingTool. This is used to fill the cabling from a text file.
 
    - SCT_TestCablingAlg: A test algorithm which instantiates the cabling service and loops over all possible
    modules, calling methods to show the online Id and serial number for each one.
@@ -66,9 +51,5 @@ HLT.
    
 @section SCT_Cabling_SCT_CablingToolDetail SCT_CablingTool in Detail
   SCT_CablingTool is accessed by clients through its ISCT_CablingTool interface. This provides access only to the 'getter' methods. The cabling data are prepared by a condition algorithm (SCT_CablingCondAlgFromCoraCool or SCT_CablingCondAlgFromText)from the database or a text file and the data are read by SCT_CablingTool using SG::ReadCondHandle.
-  
-@section SCT_Cabling_SCT_CablingToolIncDetail SCT_CablingToolInc in Detail
-  SCT_CablingToolInc is accessed by clients through its ISCT_CablingTool interface. This provides access only to the 'getter' methods. In addition, it inherits from the IIncidentListener so that it can fill data (if appropriate) at the BeginRun incident. The 'setter' method is only accessible to users of the full class, in this case the fillers: SCT_FillCablingFromText and SCT_FillCablingFromCoraCool. These share a common baseclass and they are passed a pointer to the full SCT_CablingSvc to enable them to fill it. The decision as to which filler is to be instantiated is made by job options: the property 'DataSource' may be set to CORACOOL, in which case the database filler is used, or to a text filename, in which case the text filler is used. The filler classes may report whether they can fill during the initialize phase, or need to wait for 'BeginRun'. This class is now used only by RegSelSvc. Retrieve SCT_CablingToolInc in initialize of RegSelSvc so that SCT_RegionSelectorTable can use ready SCT_CablingToolInc in BeginRun incident.
-
    
    **/
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/python/SCT_CablingConfig.py b/InnerDetector/InDetDetDescr/SCT_Cabling/python/SCT_CablingConfig.py
index aa66ef5a4cf..15565a74327 100644
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/python/SCT_CablingConfig.py
+++ b/InnerDetector/InDetDetDescr/SCT_Cabling/python/SCT_CablingConfig.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
 
 # https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/ConfiguredFactory
 
@@ -66,12 +66,6 @@ def getSCT_CablingCondAlgFromCoraCool(name="SCT_CablingCondAlgFromCoraCool", **k
     kwargs.setdefault("ReadKeyGeo", folderPath+"Geog")
     return CfgMgr.SCT_CablingCondAlgFromCoraCool(name, **kwargs)
 
-def getSCT_CablingToolInc(name="SCT_CablingToolInc", **kwargs):
-    return CfgMgr.SCT_CablingToolInc(name, **kwargs)
-
-def getSCT_FillCablingFromCoraCool(name="SCT_FillCablingFromCoraCool", **kwargs):
-    return CfgMgr.SCT_FillCablingFromCoraCool(name, **kwargs)
-
 
 # https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/AthenaJobConfigRun3
 
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/python/SCT_CablingConfigDb.py b/InnerDetector/InDetDetDescr/SCT_Cabling/python/SCT_CablingConfigDb.py
index af8aaf583f9..ac8c8ee46e9 100644
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/python/SCT_CablingConfigDb.py
+++ b/InnerDetector/InDetDetDescr/SCT_Cabling/python/SCT_CablingConfigDb.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/ConfiguredFactory
 
@@ -6,5 +6,3 @@ from AthenaCommon.CfgGetter import addTool, addAlgorithm
 
 addTool("SCT_Cabling.SCT_CablingConfig.getSCT_CablingTool", "SCT_CablingTool")
 addAlgorithm("SCT_Cabling.SCT_CablingConfig.getSCT_CablingCondAlgFromCoraCool", "SCT_CablingCondAlgFromCoraCool")
-addTool("SCT_Cabling.SCT_CablingConfig.getSCT_CablingToolInc", "SCT_CablingToolInc")
-addTool("SCT_Cabling.SCT_CablingConfig.getSCT_FillCablingFromCoraCool", "SCT_FillCablingFromCoraCool")
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_CablingToolInc.cxx b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_CablingToolInc.cxx
deleted file mode 100644
index 1cabe552768..00000000000
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_CablingToolInc.cxx
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
- * @file SCT_CablingToolInc.cxx
- * Implementation file for SCT cabling tool using incident
- * @author Shaun Roe
- * @date 20 October, 2008
- **/
-
-#include "SCT_CablingToolInc.h"
- 
-//this package
-#include "SCT_Cabling/SCT_OnlineId.h"
-#include "SCT_Cabling/SCT_SerialNumber.h"
-#include "SCT_CablingUtilities.h"
-
-//Indet
-#include "InDetIdentifier/SCT_ID.h"
-#include "Identifier/Identifier.h"
-
-//Gaudi includes
-#include "GaudiKernel/StatusCode.h"
-#include "GaudiKernel/IIncidentSvc.h"
-
-//constants in file scope
-static const std::string coracool("CORACOOL");
-static const std::string coolVectorPayload("COOLVECTOR");
-static const std::string file("SCT_Sept08Cabling_svc.dat");
-static const std::string defaultSource(coracool);
-//invalid identifiers to return in case of error
-static const SCT_OnlineId invalidId;
-static const IdentifierHash invalidHash;
-static const SCT_SerialNumber invalidSn;
-
-//Utility functions at file scope
-namespace {
-  //make a number even
-  IdentifierHash even(const IdentifierHash& hash) {
-    return (hash>>1) << 1;
-  }
-}
-
-// Constructor
-SCT_CablingToolInc::SCT_CablingToolInc(const std::string& type, const std::string& name, const IInterface* parent) :
-  base_class(type, name, parent) {
-  declareProperty("DataSource", m_cablingDataSource=defaultSource);
-}
-
-//
-void
-SCT_CablingToolInc::handle(const Incident& runIncident) {
-  ATH_MSG_INFO("Cabling event handler called.");
-  if (runIncident.type()==IncidentType::BeginRun) {
-    if (not empty()) {
-      ATH_MSG_INFO("Cabling data was already filled");
-    } else {
-      if (not m_usingDatabase) {
-        m_data = m_cablingFillerText->getMaps();
-      } else {
-        m_data = m_cablingFillerCoraCool->getMaps();
-      }
-    }
-  } else if (runIncident.type()==IncidentType::EndRun) {
-    m_data.invalidate();
-    ATH_MSG_INFO("Cabling has been emptied");
-  }
-}
-
-//
-StatusCode
-SCT_CablingToolInc::initialize() {
-  ATH_MSG_INFO("Initialize SCT cabling " << PACKAGE_VERSION);
-  const std::string cablingDataSource = m_cablingDataSource.value();
-  m_usingDatabase=(cablingDataSource == coracool) or (cablingDataSource == coolVectorPayload) or (cablingDataSource == file);
-  //select which tool name to use
-  bool filled{false};
-  if (not m_usingDatabase) {
-    m_cablingFillerCoraCool.disable();
-    ATH_CHECK(m_cablingFillerText.retrieve());
-    ATH_CHECK(m_cablingFillerText->setDataSource(m_cablingDataSource.value()));
-    if (m_cablingFillerText->canFillDuringInitialize()) {
-      m_data = m_cablingFillerText->getMaps();
-      filled = true;
-    }
-  } else {
-    m_cablingFillerText.disable();
-    ATH_CHECK(m_cablingFillerCoraCool.retrieve());
-    ATH_CHECK(m_cablingFillerCoraCool->setDataSource(m_cablingDataSource.value()));
-    if (m_cablingFillerCoraCool->canFillDuringInitialize()) {
-      m_data = m_cablingFillerCoraCool->getMaps();
-      filled = true;
-    }
-  }
-
-  if (not filled) { // register a handler to fill on the 'BeginRun' incident.
-    ServiceHandle<IIncidentSvc> incidentSvc("IncidentSvc", name());
-    ATH_CHECK(incidentSvc.retrieve());
-    const long priority(1); // Default is 0. To be called before RegSelSvc, a value slightly higher than the default value is necessary.
-    incidentSvc->addListener(this, IncidentType::BeginRun, priority);
-    incidentSvc->addListener(this, IncidentType::EndRun);
-  }
-  //
-  ATH_CHECK(detStore()->retrieve(m_idHelper, "SCT_ID"));
-  return StatusCode::SUCCESS;
-}
-
-// 
-StatusCode
-SCT_CablingToolInc::finalize() {
-  ATH_MSG_INFO("Thank-you for using the SCT_CablingToolInc, version "<<PACKAGE_VERSION);
-  ATH_MSG_INFO("The cabling data source was "<< ((not m_usingDatabase) ? m_cablingFillerText->getDataSource() : m_cablingFillerCoraCool->getDataSource()));
-  return StatusCode::SUCCESS;
-}
-
-//
-unsigned int
-SCT_CablingToolInc::size() const {
-  return m_data.getHashEntries();
-}
-
-unsigned int
-SCT_CablingToolInc::size(const EventContext& /*ctx*/) const {
-  return size();
-}
-
-//
-bool
-SCT_CablingToolInc::empty() const {
-  return (size()==0);
-}
-
-bool
-SCT_CablingToolInc::empty(const EventContext& /*ctx*/) const {
-  return empty();
-}
-
-//
-IdentifierHash 
-SCT_CablingToolInc::getHashFromOnlineId(const SCT_OnlineId& onlineId, const bool withWarnings) const {
-  //is it valid at all?
-  if (not onlineId.is_valid()) {
-    if (withWarnings) ATH_MSG_WARNING("Invalid online id ("<<std::hex<<onlineId<<") "<<std::dec);
-    return invalidHash;
-  }
-  //is it specifically valid for the given datasource?
-  if (not onlineId.is_valid(m_usingDatabase)) {
-    const std::string alternative=m_usingDatabase?"text file cabling":"cabling from database";
-    if (withWarnings) ATH_MSG_WARNING("Invalid online id ("<<std::hex<<onlineId<<") try using the "<<alternative<<std::dec);
-    return invalidHash;
-  }
-
-  return m_data.getHashFromOnlineId(onlineId);
-}
-
-IdentifierHash 
-SCT_CablingToolInc::getHashFromOnlineId(const SCT_OnlineId& onlineId, const EventContext& /*ctx*/, const bool withWarnings) const {
-  return getHashFromOnlineId(onlineId, withWarnings);
-}
-
-//
-SCT_OnlineId 
-SCT_CablingToolInc::getOnlineIdFromHash(const IdentifierHash& hash) const {
-  return m_data.getOnlineIdFromHash(hash);
-}
-
-SCT_OnlineId 
-SCT_CablingToolInc::getOnlineIdFromHash(const IdentifierHash& hash, const EventContext& /*ctx*/) const {
-  return getOnlineIdFromHash(hash);
-}
-
-//
-SCT_OnlineId
-SCT_CablingToolInc::getOnlineIdFromOfflineId(const Identifier& offlineId) const {
-  if (not offlineId.is_valid()) return invalidId;
-  IdentifierHash hash(m_idHelper->wafer_hash(offlineId));
-  return getOnlineIdFromHash(hash);
-}
-
-SCT_OnlineId
-SCT_CablingToolInc::getOnlineIdFromOfflineId(const Identifier& offlineId, const EventContext& /*ctx*/) const {
-  return getOnlineIdFromOfflineId(offlineId);
-}
-
-//
-std::uint32_t
-SCT_CablingToolInc::getRobIdFromHash(const IdentifierHash& hash) const {
-  return getOnlineIdFromHash(hash).rod();
-}
-
-std::uint32_t
-SCT_CablingToolInc::getRobIdFromHash(const IdentifierHash& hash, const EventContext& /*ctx*/) const {
-  return getRobIdFromHash(hash);
-}
-
-//
-std::uint32_t
-SCT_CablingToolInc::getRobIdFromOfflineId(const Identifier& offlineId) const {
-  return getOnlineIdFromOfflineId(offlineId).rod();
-}
-
-std::uint32_t
-SCT_CablingToolInc::getRobIdFromOfflineId(const Identifier& offlineId, const EventContext& /*ctx*/) const {
-  return getRobIdFromOfflineId(offlineId);
-}
-
-//
-IdentifierHash
-SCT_CablingToolInc::getHashFromSerialNumber(const SCT_SerialNumber& sn) const {
-  if (not sn.isWellFormed()) return invalidHash;
-  return m_data.getHashFromSerialNumber(sn);
-}
-
-IdentifierHash
-SCT_CablingToolInc::getHashFromSerialNumber(const SCT_SerialNumber& sn, const EventContext& /*ctx*/) const {
-  return getHashFromSerialNumber(sn);
-}
-
-SCT_SerialNumber
-SCT_CablingToolInc::getSerialNumberFromHash(const IdentifierHash& hash) const {
-  if (not hash.is_valid()) return invalidSn;
-  //hash must be even
-  IdentifierHash evenHash{even(hash)};
-  return m_data.getSerialNumberFromHash(evenHash);
-}
-
-SCT_SerialNumber
-SCT_CablingToolInc::getSerialNumberFromHash(const IdentifierHash& hash, const EventContext& /*ctx*/) const {
-  return getSerialNumberFromHash(hash);
-}
-
-void
-SCT_CablingToolInc::getAllRods(std::vector<std::uint32_t>& usersVector) const {
-  m_data.getRods(usersVector);
-}
-
-void
-SCT_CablingToolInc::getAllRods(std::vector<std::uint32_t>& usersVector, const EventContext& /*ctx*/) const {
-  getAllRods(usersVector);
-}
-
-void
-SCT_CablingToolInc::getHashesForRod(std::vector<IdentifierHash>& usersVector, const std::uint32_t rodId) const {
-  SCT_OnlineId firstPossibleId(rodId,SCT_OnlineId::FIRST_FIBRE);
-  const bool withWarnings(false);
-  for (SCT_OnlineId i(firstPossibleId);i!=SCT_OnlineId::INVALID_ONLINE_ID;++i) {
-    IdentifierHash thisHash(getHashFromOnlineId(i, withWarnings));
-    if (thisHash != invalidHash) {
-      usersVector.push_back(thisHash);
-    }
-  }
-}
-
-void
-SCT_CablingToolInc::getHashesForRod(std::vector<IdentifierHash>& usersVector, const std::uint32_t rodId, const EventContext& /*ctx*/) const {
-  getHashesForRod(usersVector, rodId);
-}
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_CablingToolInc.h b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_CablingToolInc.h
deleted file mode 100644
index a0e3c3cfc0c..00000000000
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_CablingToolInc.h
+++ /dev/null
@@ -1,113 +0,0 @@
-// -*- C++ -*-
-
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef SCT_CablingToolInc_h
-#define SCT_CablingToolInc_h
-/**
- * @file SCT_CablingToolInc.h
- * Header file for  SCT cabling tool using incident
- * @author Shaun Roe
- * @date 20 October, 2008
- **/
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "SCT_Cabling/ISCT_CablingTool.h"
-
-#include "Identifier/IdentifierHash.h"
-#include "SCT_Cabling/ISCT_FillCabling.h"
-#include "SCT_Cabling/SCT_CablingData.h"
-
-//Gaudi includes
-#include "GaudiKernel/ToolHandle.h"
-#include "GaudiKernel/IIncidentListener.h"
-
-//STL includes
-#include <cstdint> //uint32 in std namespace
-#include <string>
-#include <vector>
-
-//fwd declarations
-class Identifier;
-class Incident;
-class InterfaceID;
-class SCT_ID;
-class StatusCode;
-
-/**
- * @class SCT_CablingToolInc, providing mappings of online and offline identifiers and also serial numbers
- **/
-class SCT_CablingToolInc: public extends<AthAlgTool, ISCT_CablingTool, IIncidentListener> {
- public:
-
-  ///Incident listener method
-  virtual void handle(const Incident& beginRunIncident) override;
-    
-  //@name AthAlgTool methods, reimplemented
-  //@{
-  SCT_CablingToolInc(const std::string& type, const std::string& name, const IInterface* parent);
-  virtual ~SCT_CablingToolInc() = default;
-  virtual StatusCode initialize() override;
-  virtual StatusCode finalize() override;
-  //@}
-  
-  //@name ISCT_CablingTool methods implemented, these are visible to clients
-  //@{
-  /// size of the data structure (for the SCT should be 8176, one for each module side)
-  virtual unsigned int size(const EventContext& ctx) const override;
-  virtual unsigned int size() const override;
-    
-  /// is the data structure empty?
-  virtual bool empty(const EventContext& ctx) const override;
-  virtual bool empty() const override;
-    
-  /// return offline hash, given the online Id (used by decoders)
-  virtual IdentifierHash getHashFromOnlineId(const SCT_OnlineId& onlineId, const EventContext& ctx, const bool withWarnings=true) const override;
-  virtual IdentifierHash getHashFromOnlineId(const SCT_OnlineId& onlineId, const bool withWarnings=true) const override;
-   
-  /// return the online Id, given a hash (used by simulation encoders)
-  virtual SCT_OnlineId getOnlineIdFromHash(const IdentifierHash& hash, const EventContext& ctx) const override;
-  virtual SCT_OnlineId getOnlineIdFromHash(const IdentifierHash& hash) const override;
-  
-  /// return the online Id, given an offlineId
-  virtual SCT_OnlineId getOnlineIdFromOfflineId(const Identifier& offlineId, const EventContext& ctx) const override;
-  virtual SCT_OnlineId getOnlineIdFromOfflineId(const Identifier& offlineId) const override;
-  
-  /// return the rob/rod Id, given a hash (used by simulation encoders)
-  virtual std::uint32_t getRobIdFromHash(const IdentifierHash& hash, const EventContext& ctx) const override;
-  virtual std::uint32_t getRobIdFromHash(const IdentifierHash& hash) const override;
-    
-  /// return the rob/rod Id, given an offlineId (used by simulation encoders)
-  virtual std::uint32_t getRobIdFromOfflineId(const Identifier& offlineId, const EventContext& ctx) const override;
-  virtual std::uint32_t getRobIdFromOfflineId(const Identifier& offlineId) const override;
-
-  /// get hash from a module serial number, needed in the conditions tool because configurations are stored by module s/n
-  virtual IdentifierHash getHashFromSerialNumber(const SCT_SerialNumber& sn, const EventContext& ctx) const override;
-  virtual IdentifierHash getHashFromSerialNumber(const SCT_SerialNumber& sn) const override;
-
-  /// get module serial number from hash, needed during filling of data structure
-  virtual SCT_SerialNumber getSerialNumberFromHash(const IdentifierHash& hash, const EventContext& ctx) const override;
-  virtual SCT_SerialNumber getSerialNumberFromHash(const IdentifierHash& hash) const override;
-
-  /// fill a users vector with all the RodIds
-  virtual void getAllRods(std::vector<std::uint32_t>& usersVector, const EventContext& ctx) const override;
-  virtual void getAllRods(std::vector<std::uint32_t>& usersVector) const override;
-    
-  /// fill a user's vector with all the hash ids which belong to a given rod
-  virtual void getHashesForRod(std::vector<IdentifierHash>& usersVector, const std::uint32_t rodId, const EventContext& ctx) const override;
-  virtual void getHashesForRod(std::vector<IdentifierHash>& usersVector, const std::uint32_t rodId) const override;
-  //@}
-
- private:
-  SCT_CablingData m_data;
-
-  ToolHandle<ISCT_FillCabling> m_cablingFillerText{"SCT_FillCablingFromText"};
-  ToolHandle<ISCT_FillCabling> m_cablingFillerCoraCool{"SCT_FillCablingFromCoraCool"};
-  StringProperty m_cablingDataSource; //!< the name of the data source
-  const SCT_ID* m_idHelper{nullptr}; //!< helper for offlineId/hash conversions
-  bool m_usingDatabase{true};
-};
-
-#endif // SCT_CablingToolInc_h
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromCoraCool.cxx b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromCoraCool.cxx
deleted file mode 100644
index f765f3b55d7..00000000000
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromCoraCool.cxx
+++ /dev/null
@@ -1,526 +0,0 @@
-/*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**   
- *   @file SCT_FillCablingFromCoraCool.cxx
- *
- *   @brief Fills an SCT cabling object from the database using CoraCool
- *
- *   @author Shaun Roe
- *   @date 13/11/2008
- */
-
-//package includes
-#include "SCT_FillCablingFromCoraCool.h"
-#include "SCT_CablingUtilities.h"
-
-//Athena includes
-#include "Identifier/Identifier.h"
-#include "Identifier/IdentifierHash.h"
-#include "InDetIdentifier/SCT_ID.h"
-#include "SCT_Cabling/SCT_CablingData.h"
-
-//Gaudi includes
-#include "GaudiKernel/StatusCode.h"
-
-//STL
-#include <algorithm>
-#include <iostream>
-#include <set>
-#include <utility>
-
-//Constants at file scope
-//Run1: folder names in COMP200 database
-static const std::string rodFolderName{"/SCT/DAQ/Configuration/ROD"};
-static const std::string rodMurFolderName{"/SCT/DAQ/Configuration/RODMUR"};
-static const std::string murFolderName{"/SCT/DAQ/Configuration/MUR"};
-static const std::string geoFolderName{"/SCT/DAQ/Configuration/Geog"};
-//Run2: folders change name in CONDBR2 database
-static const std::string rodFolderName2{"/SCT/DAQ/Config/ROD"};
-static const std::string rodMurFolderName2{"/SCT/DAQ/Config/RODMUR"};
-static const std::string murFolderName2{"/SCT/DAQ/Config/MUR"};
-static const std::string geoFolderName2{"/SCT/DAQ/Config/Geog"};
-
-//the following applied to run1 (pre Sept 2014)
-//static const unsigned int possibleSlots[]={6,7,8,10,11,12,14,15,16,18,19,20};// strange numbering of slots for the rods, found in DB.
-//...now the 'expanding DAQ' has all slots filled; the TIM sits in slot 13, so...
-//static const unsigned int possibleSlots[]={5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21};
-// earlier uploads were then found to have slots 0-11... how to resolve the two?
-static const int disabledFibre{255};
-static const int defaultLink{128};
-// for run1:
-//static const int slotsPerCrate(12);//max. 12 slots filled with rods in the crate
-//for run 2:
-static const int slotsPerCrate{16};
-static const int fibresPerMur{12};
-static const int fibresPerRod{96};
-static const int mursPerRod{8};
-
-//More look up tables
-//Disk  harnesses
-static const int HO1[]{5,4,3,2,1,0}; //mur on disk C, position 0
-static const int HO2[]{12,11,10,9,8,7}; //diskC position 1
-static const int HM1[]{6,16,15,14,13,-1}; //diskC position 2 (no 6th position)
-static const int HM2[]{22,21,20,19,18,17}; //diskC position 3
-static const int HI1[]{28,30,32,29,31,-1}; //diskC position 4
-static const int HI2[]{26,27,25,23,24,-1}; //diskC position 5
-//
-//Disk 9 quadrant reassignment
-static const int qc[]{-1,3,2,1,0};
-static const int qa[]{-1,2,1,0,3};
-
-//utility functions in file scope
-namespace{
-  enum SubDetectors{ENDCAP_C=-2, BARREL=0, ENDCAP_A=2};
-  // WJM: Reversed ordering for layer 6/(Disk 7) eta 0 on EC C (-2)
-  //Possibly inverted modules in disk 6C (counting 0-8 for disks) at eta=1. At eta=0, all modules are inverted
-  bool isOdd(int value) {
-    return ((value % 2) ==1);
-  }
- 
-  //Endcap Harness fibre-to-position assignments
-  int positionNumber(const unsigned int murPosition, const unsigned int indx) {
-    int number{-1};
-    switch (murPosition){
-    case 0: number = HO1[indx]; break; // 0-5
-    case 1: number = HO2[indx]; break; // 7-12
-    case 2: number = HM1[indx]; break;
-    case 3: number = HM2[indx]; break; // 17-22
-    case 4: number = HI1[indx]; break;
-    case 5: number = HI2[indx]; break;
-    }
-    return number;
-  }
-  
-  //is the quadrant a special quadrant on disk 9?
-  bool specialQuadrant(const unsigned int disk, const unsigned int quadrant) {
-    return ((disk==8) and (quadrant==4));
-  }
-  
-  // special quadrant on disk 9 is not really a quadrant, its 4 positions in the middle of each quadrant
-  int reassignSpecialQuadrant(const int bec, const unsigned int module) {
-    int q{-1};
-    if (module>4) return q;
-    if (bec==ENDCAP_C) {
-      q=qc[module];
-    } else if (bec==ENDCAP_A) {
-      q=qa[module];
-    }
-    return q;
-  }
-  
-  //convert to athena coords; an approx. copy of Bruce Gallop's online code
-  std::pair<int, int>
-    convertToAthenaCoords(const int bec, const unsigned int disk, const unsigned int quadrant, const int harnessPosition, const unsigned int module) {
-    int q{-1};
-    int number{-1};
-    int phi{-1};
-    int eta{-1}, internalPhi{-1};
-    const std::pair<int, int> errorValue{std::make_pair(eta, phi)};
-    if (specialQuadrant(disk, quadrant)) {
-      q=reassignSpecialQuadrant(bec,module);
-      if (-1==q) return errorValue;
-      number = 6;
-    } else {
-      number=positionNumber(harnessPosition, module);
-      q=quadrant;
-    }
-    if ((number <0) or (number>32)) {
-      return errorValue;
-    }
-    if (number<13) {
-      eta=0;
-      internalPhi=q * 13 + number;
-    } else if (number < 23) {
-      eta=1;
-      internalPhi=q * 10 + number -13;
-    } else {
-      eta=2;
-      internalPhi=q * 10 + number -23;
-    }
-    if (bec<0){ //C
-      if (disk==8) { //disk 9 is reversed
-        phi = (internalPhi +14) % 52;
-      } else if (eta==0) {//outer
-        phi = (64-internalPhi) % 52;
-      } else {//inner, middle
-        phi = (49-internalPhi) % 40;
-      }
-    } else { //A
-      if (disk==8) {//disk 9, reversed
-        phi=(64 - internalPhi) % 52;
-      } else if (eta==0) {//outer
-        phi = (52 + 14 +internalPhi) % 52;
-      } else if (eta==1) {//middle
-        phi = (10 + 40 +internalPhi) % 40;
-      } else {//inners
-        phi = (internalPhi + 40 + 11) % 40;
-      }
-    }
-    return std::make_pair(eta, phi);
-  }
-  //valid numbers for an rx1 or rx0Fibre
-  bool
-    validLinkNumber(const int link) {
-    return ((link>-1) and (link<96)) or (link==defaultLink) or (link==disabledFibre);
-  }
-}//end of anonymous namespace
-
-// Constructor
-SCT_FillCablingFromCoraCool::SCT_FillCablingFromCoraCool(const std::string& type, const std::string& name, const IInterface* parent) :
-  base_class(type, name, parent) {
-  //nop
-}
-
-//
-StatusCode
-SCT_FillCablingFromCoraCool::initialize() {
-  return StatusCode::SUCCESS;
-}
-
-//
-StatusCode 
-SCT_FillCablingFromCoraCool::finalize() {
-  return StatusCode::SUCCESS;
-}
-
-//
-StatusCode 
-SCT_FillCablingFromCoraCool::setDataSource(const std::string& dataSource) {
-  //should check for db existence here
-  m_source=dataSource;
-  ATH_MSG_INFO("Reading cabling from "<<m_source);
-  return StatusCode::SUCCESS;
-}
-
-//
-std::string 
-SCT_FillCablingFromCoraCool::getDataSource() const {
-  return m_source;
-}
-
-//
-bool 
-SCT_FillCablingFromCoraCool::filled() const {
-  return m_filled;
-}
-
-//
-SCT_CablingData
-SCT_FillCablingFromCoraCool::getMaps() const {
-  SCT_CablingData data;
-  m_filled=false;
-  if (readDataFromDb(data).isFailure()) {
-    ATH_MSG_FATAL("Could not read cabling from database");
-    return data;
-  }
-  m_filled=true;
-  return data;
-}
-
-//
-StatusCode
-SCT_FillCablingFromCoraCool::readDataFromDb(SCT_CablingData& data) const {
-  const SCT_ID* idHelper{nullptr};
-  if (detStore()->retrieve(idHelper,"SCT_ID").isFailure()) {
-    ATH_MSG_ERROR("SCT mgr failed to retrieve");
-    return StatusCode::FAILURE;
-  }
-  // let's get the ROD AttrLists
-  std::string folder{determineFolder(rodFolderName,rodFolderName2)};
-  enum DBTYPE {COMP200, CONDBR2};
-  const DBTYPE db{(folder==rodFolderName) ? COMP200 : CONDBR2};
-  const CondAttrListVec* pRod = successfulFolderRetrieve(folder);
-  if (!pRod) return StatusCode::FAILURE;
-  // build rod-rob map, and store the crate/slot to RobId mapping
-  CondAttrListVec::const_iterator rodIt{pRod->begin()};
-  CondAttrListVec::const_iterator last_rod{pRod->end()};
-  typedef std::map<int, int> IntMap;
-  IntMap slotMap;
-  //there are now 16 crate slots, but they may be numbered (in the DB) as some non-monotonic sequence
-  //so here we take whatever is in the database and map it onto numbers 0-15
-  {//scope this calculation, only slotMap should emerge
-    //map slots onto 0-15
-    typedef std::set<int> S;
-    S slots;
-    for (; rodIt != last_rod; ++rodIt) {
-      //type of 'slot' changed between COMP200 and CONDBR2:
-      if (db==CONDBR2) {
-        slots.insert(int(rodIt->second["slot"].data<unsigned char>())); //all but 15 inserts will fail, and these 15 should be sorted
-      } else {
-        slots.insert(int(rodIt->second["slot"].data<short>())); //all but 15 inserts will fail, and these 15 should be sorted
-      }
-    }
-    int counter{0};
-    for (S::const_iterator i{slots.begin()};i != slots.end();++i) {
-      slotMap[*i]=counter++;
-    }
-    ATH_MSG_INFO("Number of SCT rod slots inserted: "<<counter);
-  }
-  IntMap crateSlot2RobMap; //local data structure
-  bool allInsertsSucceeded{true};
-  rodIt=pRod->begin();
-  int nrods{0};
-  std::set<int> tempRobSet;
-  for (; rodIt != last_rod; ++rodIt) {
-    const coral::AttributeList& rodAttributes{rodIt->second};
-    //int rod=rodAttributes["SRCid"].data<int>();
-    int rob{rodAttributes["ROB"].data<int>()};
-    if (not tempRobSet.insert(rob).second) ATH_MSG_WARNING("Duplicate rob? :"<<std::hex<<rob<<std::dec);
-    //std::cout<<"shaunROB "<<std::hex<<rob<<std::endl;
-    int crate{(db==CONDBR2) ? static_cast<int>(rodAttributes["crate"].data<unsigned char>()) : (rodAttributes["crate"].data<int>())};
-    int crateSlot{(db==CONDBR2) ? static_cast<int>(rodAttributes["slot"].data<unsigned char>()) : static_cast<int>(rodAttributes["slot"].data<short>())};
-    //see note in header; these may be 0-15, but not necessarily, so we need to map these onto 0-15
-    IntMap::const_iterator pSlot{slotMap.find(crateSlot)};
-    int slot{(pSlot==slotMap.end()) ? -1 : pSlot->second};
-    if (slot==-1) ATH_MSG_ERROR("Failed to find a crate slot in the crate map");
-    int rodPosition{(crate * slotsPerCrate) +slot};//generate identifier using crate and slot for use later
-    //use the return type of insert which is a pair with the second component(bool) indicating whether the insert was successful
-    bool thisInsertSucceeded{crateSlot2RobMap.insert(IntMap::value_type(rodPosition, rob)).second};
-    if (not thisInsertSucceeded) {
-      ATH_MSG_WARNING("Insert (rodPosition, rob) "<<rodPosition<<", "<<rob<<" failed.");
-      ATH_MSG_INFO("map(rod position) is already "<<crateSlot2RobMap[rodPosition]);
-      ATH_MSG_INFO("crate, slot, slots per crate: "<<crate<<", "<<slot<<", "<<slotsPerCrate);
-    }
-    allInsertsSucceeded = thisInsertSucceeded and allInsertsSucceeded;
-    ++nrods;
-  }
-  ATH_MSG_INFO(nrods<<" rods entered, of which "<<tempRobSet.size()<<" are unique.");
-  
-  if (not allInsertsSucceeded) ATH_MSG_WARNING("Some Rod-Rob map inserts failed.");
-
-  /**
-   * Get the geography table which gives where the MURs (harnesses, for endcap) really are.
-   * In fact for the barrel its obvious, so only extract the endcap ones
-   **/
-  IntMap geoMurMap;
-  folder = determineFolder(geoFolderName, geoFolderName2);
-  const CondAttrListVec* pGeo = successfulFolderRetrieve(folder);
-  if (!pGeo) return StatusCode::FAILURE;
-  CondAttrListVec::const_iterator geoIt{pGeo->begin()};
-  CondAttrListVec::const_iterator last_geo{pGeo->end()};
-  for (;geoIt != last_geo;++geoIt) {
-    const coral::AttributeList& geoAttributes{geoIt->second};
-    int mur{(db==COMP200) ? (geoAttributes["MUR"].data<int>()) : static_cast<int>(geoAttributes["MUR"].data<unsigned int>())};
-    int position{(db==COMP200) ? (geoAttributes["position"].data<int>()) : static_cast<int>(geoAttributes["position"].data<short>())};
-    if (mur > 10000) geoMurMap[mur]=position; //only for endcap case
-  }
-  /**
-   * get the RODMUR which gives where the individual MURs are; this is an intermediate step, 
-   * so make a temporary data structure.
-   **/
-  IntMap murPositionMap;
-  folder = determineFolder(rodMurFolderName,rodMurFolderName2);
-  const CondAttrListVec* pRodMur= successfulFolderRetrieve(folder);
-  if (!pRodMur) return StatusCode::FAILURE;
-  CondAttrListVec::const_iterator rodMurIt{pRodMur->begin()};
-  CondAttrListVec::const_iterator last_rodMur{pRodMur->end()};
-  allInsertsSucceeded = true;
-  std::set<int> tempRobSet2;
-  for (; rodMurIt!=last_rodMur; ++rodMurIt) {
-    const coral::AttributeList& rodMurAttributes{rodMurIt->second};
-    int mur{(db==CONDBR2) ? static_cast<int>(rodMurAttributes["MUR"].data<unsigned int>()) : (rodMurAttributes["MUR"].data<int>())};
-    int crate{(db==CONDBR2) ? static_cast<int>(rodMurAttributes["crate"].data<unsigned char>()) : (rodMurAttributes["crate"].data<int>())};
-    int crateSlot{(db==CONDBR2) ? static_cast<int>(rodMurAttributes["rod"].data<unsigned char>()) : (rodMurAttributes["rod"].data<int>())};//slot is int16, others are int32
-    //map slot onto 0-15 range
-    IntMap::const_iterator pSlot{slotMap.find(crateSlot)};
-    int slot{(pSlot==slotMap.end()) ? -1 : pSlot->second};
-    if (slot==-1) ATH_MSG_ERROR("Failed to find a crate slot in the crate map");
-    //
-    int order{(db==CONDBR2) ? static_cast<int>(rodMurAttributes["position"].data<unsigned char>()) : (rodMurAttributes["position"].data<int>())};
-    int fibreOrder{((((crate * slotsPerCrate) + slot ) * mursPerRod) + order) * fibresPerMur};
-    bool thisInsertSucceeded{murPositionMap.insert(IntMap::value_type(mur, fibreOrder)).second};
-    if (not thisInsertSucceeded) ATH_MSG_WARNING("Insert (mur, fibre) "<<mur<<", "<<fibreOrder<<" failed.");
-    allInsertsSucceeded = thisInsertSucceeded and allInsertsSucceeded;
-  }
-  if (not allInsertsSucceeded) ATH_MSG_WARNING("Some MUR-position map inserts failed.");
-  //
-  // let's get the MUR AttrLists
-  folder=determineFolder(murFolderName,murFolderName2);
-  const CondAttrListVec* pMur = successfulFolderRetrieve(folder);
-  if (!pMur) return StatusCode::FAILURE;
-  //build identifier map
-  CondAttrListVec::const_iterator murIt{pMur->begin()};
-  CondAttrListVec::const_iterator last_mur{pMur->end()};
-  int numEntries{0};
-  std::set<int> onlineIdSet, robSet;
-  std::set<Identifier> offlineIdSet;
-  long long lastSerialNumber{0};
-  
-  for (; murIt != last_mur; ++murIt) {
-    const coral::AttributeList& murAttributes{murIt->second};
-    int mur{(db==CONDBR2) ? static_cast<int>(murAttributes["MUR"].data<unsigned int>()) : (murAttributes["MUR"].data<int>())};
-    bool nullMur{murAttributes["moduleID"].isNull() or murAttributes["module"].isNull()};
-    if (9999 == mur or nullMur) continue;
-    int fibreInMur{( (db==CONDBR2) ? static_cast<int>(murAttributes["module"].data<unsigned char>()) : (murAttributes["module"].data<int>()) ) - 1};
-    long long sn{murAttributes["moduleID"].data<long long>()};
-    if (lastSerialNumber==sn) { //old version (<2.6) of Coral/Cool doesn't detect a 'null' value, instead it simply repeats the last known value.
-      continue;
-    }
-    lastSerialNumber=sn;
-    std::string snString{std::to_string(sn)};
-    IntMap::const_iterator pFibre{murPositionMap.find(mur)};
-    int fibreOffset{-1};
-    if (pFibre==murPositionMap.end()) {
-      ATH_MSG_WARNING("Failed to find an MUR position in the cabling");
-    } else {
-      fibreOffset = pFibre->second;
-    }
-    int encodedCrateSlot{fibreOffset / (fibresPerMur * mursPerRod)};
-    int rob{-1};
-    IntMap::const_iterator pCrate{crateSlot2RobMap.find(encodedCrateSlot)};
-    if (pCrate == crateSlot2RobMap.end()) {
-      ATH_MSG_WARNING("Failed to find a crate slot in the cabling, slot "<<encodedCrateSlot);
-    } else {
-      rob=pCrate->second;
-      tempRobSet2.insert(rob);
-    }
-    
-    //cheat to get the geography: use the MUR notation
-    int bec{0},eta{0}, layer{0}, phi{0};
-    std::pair<int, int> etaPhiPair;
-    int harnessPosition{-1};
-    if (mur > 10000) { //its an endcap, so has 5 digits in the mur
-      layer = (mur/10000) - 1; //first digit is the disk number, 1-9, so subtract 1
-      bec = (((mur /1000) % 2)==0) ? ENDCAP_A : ENDCAP_C; //bec is +2 for A if second digit is 0
-      int quadrant{(mur/100) % 10}; //3rd digit is quadrant
-      //eta = ((mur /10) % 10);  //eta of the harness is the 4th digit
-      //int harness = (mur % 10) -1; //last digit is harness, 1 or 2
-      harnessPosition=geoMurMap[mur];
-      etaPhiPair= convertToAthenaCoords(bec,layer, quadrant,  harnessPosition, fibreInMur);
-      eta=etaPhiPair.first;
-      phi=etaPhiPair.second;
-    } else {
-      bec = 0;
-      layer= (mur /1000) - 3;//first digit is layer, 3-6
-      phi= (mur % 100) - 1; //lower 2 digits are phi check whether this wraps around!
-      eta = (((mur / 100) % 10) *2 -1) * (fibreInMur+1);//second digit gives eta sign, 0-> -, 1-> +
-    }
-    int rxLink[2];
-    if (db==CONDBR2) {
-      rxLink[0]=murAttributes["rx0Fibre"].data<unsigned char>();rxLink[1]= murAttributes["rx1Fibre"].data<unsigned char>();
-    } else {
-      rxLink[0]=murAttributes["rx0Fibre"].data<int>();rxLink[1]=murAttributes["rx1Fibre"].data<int>();
-    }
-    if (not (validLinkNumber(rxLink[0]) and validLinkNumber(rxLink[1]))) {
-      ATH_MSG_WARNING("Invalid link number in database in one of these db entries: rx0Fibre="<<rxLink[0]<<", rx1Fibre="<<rxLink[1]);
-      continue;
-    }
-    //normal ordering is like rx0=0, rx1=1; i.e. odd links in rx1.
-    bool normalOrdering{true};
-    if (rxLink[0] != disabledFibre) { //if the first link is not disabled, use that and check its even
-      normalOrdering=(rxLink[0] % 2)==0;
-    } else { //...otherwise use link1 and check its odd
-      normalOrdering=(rxLink[1] % 2)==1;
-    }
-    
-    int possibleLinks[2]{0,0};
-    if (normalOrdering) {
-      possibleLinks[0]=(rxLink[0]!=disabledFibre)?rxLink[0]:(rxLink[1]-1);
-      possibleLinks[1]=(rxLink[1]!=disabledFibre)?rxLink[1]:(rxLink[0]+1);
-    } else {
-      possibleLinks[0]=(rxLink[0]!=disabledFibre)?rxLink[0]:(rxLink[1]+1);
-      possibleLinks[1]=(rxLink[1]!=disabledFibre)?rxLink[1]:(rxLink[0]-1);
-    }
-    for (int side{0}; side!=2; ++side) {
-      if ((-1==phi) and (-1==eta)) {
-        ATH_MSG_WARNING("Invalid eta, phi..skipping insertion to map for module "<<snString<<" (may be already present in map)");
-        continue;
-      }
-      Identifier offlineId{idHelper->wafer_id(bec,layer,phi,eta,side)};
-      int link{rxLink[side]};
-      if (defaultLink==link) {
-        link = (fibreOffset % fibresPerRod) + fibreInMur*2 + side;
-      }
-      if (disabledFibre==link) {
-        int otherLink{rxLink[1-side]};
-        if (otherLink==possibleLinks[0]) link=possibleLinks[1];
-        if (otherLink==possibleLinks[1]) link=possibleLinks[0];
-      }
-      bool flippedModule{isOdd(side)!=isOdd(link)};
-      if (flippedModule) {
-        link = (link==possibleLinks[0]) ? possibleLinks[1] : possibleLinks[0];
-      }
-      int onlineId{(rob & 0xFFFFFF)|(link<<24)};
-      //check uniqueness
-      if (not onlineIdSet.insert(onlineId).second) ATH_MSG_WARNING("Insert of online Id : "<<onlineId<<" failed.");
-      if (not offlineIdSet.insert(offlineId).second) {
-        ATH_MSG_WARNING("Insert of offline Id : "<<offlineId<<" failed.");
-        ATH_MSG_WARNING(bec<<" "<<layer<<" "<<phi<<" "<<eta<<" "<<side);
-        ATH_MSG_INFO("MUR, position "<<mur<<", "<<harnessPosition);
-      } 
-      IdentifierHash offlineIdHash{idHelper->wafer_hash(offlineId)};
-      insert(offlineIdHash, onlineId, SCT_SerialNumber(sn), data);
-      numEntries++;
-    }
-  }
-  const int robLo{*(tempRobSet2.cbegin())};
-  const int robHi{*(tempRobSet2.crbegin())};
-  ATH_MSG_INFO(numEntries<<" entries were made to the identifier map.");
-  ATH_MSG_INFO(tempRobSet2.size()<<" unique rob ids were used, spanning 0x"<<std::hex<<robLo<<" to 0x"<<robHi<<std::dec);
-  if (tempRobSet.size() != tempRobSet2.size()) {
-    ATH_MSG_WARNING("The following existing rods were not inserted : ");
-    std::cout<<std::hex;
-    std::set_difference(tempRobSet.cbegin(),tempRobSet.cend(),
-                        tempRobSet2.cbegin(),tempRobSet2.cend(),
-                        std::ostream_iterator<int>(std::cout,", "));
-    std::cout<<std::dec<<std::endl;
-  }
-  tempRobSet.clear();
-  m_filled=(numEntries not_eq 0);
-  return (numEntries==0) ? (StatusCode::FAILURE) : (StatusCode::SUCCESS);
-}
-
-const CondAttrListVec*
- SCT_FillCablingFromCoraCool::successfulFolderRetrieve(const std::string& folderName) const {
-  const CondAttrListVec* pDataVec = nullptr;
-  if (detStore()->retrieve(pDataVec, folderName).isFailure()) {
-    ATH_MSG_FATAL("Could not retrieve AttrListVec for "<<folderName);
-    return nullptr;
-  }
-  if (0==pDataVec->size()) {
-    ATH_MSG_FATAL("This folders data set appears to be empty: "<<folderName);
-    return nullptr;
-  }
-  return pDataVec;
-}
-
-std::string SCT_FillCablingFromCoraCool::determineFolder(const std::string& option1, const std::string& option2) const {
-  std::string result{""};
-  const bool option1Exists{detStore()->contains<CondAttrListVec>(option1)};
-  const bool option2Exists{detStore()->contains<CondAttrListVec>(option2)};
-  //its only sensible if either of these exists (but not both)
-  const bool nonsense{option1Exists == option2Exists};
-  if (nonsense) {
-    if (not option1Exists) ATH_MSG_ERROR("The folder names "<<option1<<" or "<<option2<<" could not be found");
-    else ATH_MSG_ERROR("Both folders "<<option1<<" and "<<option2<<" have been loaded; cannot determine run1/run2");
-  } else {
-    result = option1Exists ? option1 : option2;
-    ATH_MSG_INFO("SCT_FillCablingFromCoraCool will use the folder "<<result);
-  }
-  return result;
-}
-
-bool
-SCT_FillCablingFromCoraCool::insert(const IdentifierHash& hash, const SCT_OnlineId& onlineId, const SCT_SerialNumber& sn, SCT_CablingData& data) const {
-  if (not sn.isWellFormed()) {
-    ATH_MSG_FATAL("Serial number is not in correct format");
-    return false;
-  }
-  if (not hash.is_valid()) {
-    ATH_MSG_FATAL("Invalid hash: "<<hash);
-    return false;
-  }
-
-  if (not data.setHashForOnlineId(hash, onlineId)) return false;
-  if (not data.setOnlineIdForHash(onlineId, hash)) return false;
-
-  bool successfulInsert{data.setHashForSerialNumber(hash, sn)};
-  successfulInsert &= data.setSerialNumberForHash(sn, hash);
-  // in this form, the data->getHashEntries() will be half the number of hashes
-  if (successfulInsert) {
-    data.setRod(onlineId.rod()); //move this here so insertion only happens for valid onlineId, hash
-  }
-  return true;
-}
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromCoraCool.h b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromCoraCool.h
deleted file mode 100644
index fc03d40d814..00000000000
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromCoraCool.h
+++ /dev/null
@@ -1,91 +0,0 @@
-// -*- C++ -*-
-
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef SCT_FillCablingFromCoraCool_H
-#define SCT_FillCablingFromCoraCool_H
-/**   
- *   @file SCT_FillCablingFromCoraCool.h
- *
- *   @brief Fills an SCT cabling object from the database
- *
- *   @author Shaun Roe
- *   @date 05/11/2008
- */
-
-//Athena includes
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "SCT_Cabling/ISCT_FillCabling.h"
-
-#include "AthenaPoolUtilities/CondAttrListVec.h"
-
-//STL includes
-#include <atomic>
-#include <string>
-
-//fwd declarations
-class IdentifierHash;
-class SCT_CablingData;
-class SCT_OnlineId;
-class SCT_SerialNumber;
-class StatusCode;
-
-/**
- *    @class SCT_FillCablingFromCoraCool
- *    @brief Tool which fills the SCT Cabling from the database, using CoraCool.
- *
- */
-class SCT_FillCablingFromCoraCool: public extends<AthAlgTool, ISCT_FillCabling> {
-public:
-  //@name AthAlgTool methods, reimplemented
-  //@{
-  SCT_FillCablingFromCoraCool(const std::string& type, const std::string& name, const IInterface* parent);
-  virtual ~SCT_FillCablingFromCoraCool() = default;
-  virtual StatusCode initialize();
-  virtual StatusCode finalize();
-  //@}
-  
-  /** May set the data source to textFile, database etc
-   * @param[in] @c string name of datasource
-   */
-  virtual StatusCode setDataSource(const std::string& dataSource);
-  
-  /** Gets the data source
-   * @return @c string name of datasource
-   */
-  virtual std::string getDataSource() const;
-  
-  /**Fill the cabling maps
-   * @return @c cabling map object
-   */
-  virtual SCT_CablingData getMaps() const;
-  
-  /**Report whether the map was filled
-   * @return @c bool
-   */
-  virtual bool filled() const;
-  
-  /**Filling from database cannot be done during intialise.
-   * @return @c bool
-   */
-  virtual bool canFillDuringInitialize() const {return false;}
-private:
-  /// read from db
-  StatusCode readDataFromDb(SCT_CablingData& data) const;
-  /// determine which folder to use; COMP200 style or CONDBR2 style
-  std::string determineFolder(const std::string& option1, const std::string& option2) const;
-  
-  /// retrieve a IOVDbSvc coracool dataset, give error message if it is empty or the pointer is zero
-  const CondAttrListVec*
-  successfulFolderRetrieve(const std::string& folderName) const;
-
-  /// Insert relations among IdentifierHash, SCT_OnlineId and SCT_SerialNumber to SCT_CablingData.
-  bool insert(const IdentifierHash& hash, const SCT_OnlineId& onlineId, const SCT_SerialNumber& sn, SCT_CablingData& data) const;
-
-  mutable std::atomic_bool m_filled{false};
-  std::string m_source;
-};//end of class
-
-#endif
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromText.cxx b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromText.cxx
deleted file mode 100644
index 9bec451af17..00000000000
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromText.cxx
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**   
- *   @file SCT_Fill_CablingFromText.cxx
- *
- *   @brief Fills an SCT cabling object from a plain text source
- *
- *   @author Shaun Roe
- *   @date 13/11/2008
- */
-
-//package includes
-#include "SCT_FillCablingFromText.h"
-#include "SCT_CablingUtilities.h"
-
-//Athena includes
-#include "Identifier/Identifier.h"
-#include "Identifier/IdentifierHash.h"
-#include "InDetIdentifier/SCT_ID.h"
-#include "PathResolver/PathResolver.h"
-#include "SCT_Cabling/SCT_CablingData.h"
-
-//Gaudi includes
-#include "GaudiKernel/StatusCode.h"
-
-//STL includes
-#include <iostream>
-#include <fstream>
-
-//Constants at file scope
-static const std::string atlasTableSignature{"Rod Fibre Bec LayerDisk Eta Phi Side RobId Sn"};
-static const int disabledFibre{255};
-
-//utility functions in file scope
-namespace{
-  //report if string s1 contains s2
-  bool 
-    contains(const std::string& s1, const std::string& s2) {
-    return (s1.find(s2) not_eq std::string::npos);
-  }
-  //fast forward to a line in the file containing the signature string, and return that line
-  //or the empty string if the end of file was reached first.
-  std::string 
-    fastForward(std::ifstream& theFile, const std::string& signature) {
-    std::string inString;
-    bool found{false}, endOfFile{false};
-    do {
-      std::getline(theFile, inString);
-      found=contains(inString, signature);
-      endOfFile = theFile.eof();
-    } while ((not found) and (not endOfFile));
-    return found ? (inString) : (std::string{""});
-  }
-}//end of anonymous namespace
-
-// Constructor
-SCT_FillCablingFromText::SCT_FillCablingFromText(const std::string& type, const std::string& name, const IInterface* parent) :
-  base_class(type, name, parent) {
-  //nop
-}
-
-//
-StatusCode
-SCT_FillCablingFromText::initialize() {
-  return StatusCode::SUCCESS;
-}
-
-//
-StatusCode 
-SCT_FillCablingFromText::finalize() {
-  return StatusCode::SUCCESS;
-}
-
-//
-StatusCode
-SCT_FillCablingFromText::setDataSource(const std::string& dataSource) {
-  m_source=PathResolver::find_file (dataSource, "DATAPATH");
-  if (m_source.empty()) {
-    ATH_MSG_FATAL("The SCT data file for cabling, "<<dataSource<<", was not found.");
-    return StatusCode::FAILURE;
-  }
-  ATH_MSG_INFO("Reading cabling from "<<m_source);
-  return StatusCode::SUCCESS;
-}
-
-//
-std::string
-SCT_FillCablingFromText::getDataSource() const {
-  return m_source;
-}
-
-//
-bool
-SCT_FillCablingFromText::filled() const {
-  return m_filled;
-}
-
-//
-SCT_CablingData
-SCT_FillCablingFromText::getMaps() const {
-  SCT_CablingData data;
-  if (readDataFromFile(data).isFailure()) {
-    ATH_MSG_FATAL("Could not read cabling from file");
-    return data;
-  }
-  m_filled=true;
-  return data;
-}
-
-//
-StatusCode
-SCT_FillCablingFromText::readDataFromFile(SCT_CablingData& data) const {
-  const SCT_ID* idHelper{nullptr};
-  if (detStore()->retrieve(idHelper, "SCT_ID").isFailure()) {
-    ATH_MSG_ERROR("SCT mgr failed to retrieve");
-    return StatusCode::FAILURE;
-  }
-  Identifier offlineId;
-  IdentifierHash offlineIdHash;
-  unsigned int onlineId;
-  int robid{0};
-  std::ifstream fromDataFile{m_source.c_str()};
-  std::string inString;
-  if (not fromDataFile) {
-    ATH_MSG_FATAL("The cable mapping file could not be opened: "<<m_source);
-    return StatusCode::FAILURE;
-  }
-  bool endOfFile{false};
-  inString=fastForward(fromDataFile, atlasTableSignature);
-  if (inString.empty()) {
-    ATH_MSG_FATAL("The end of the datafile was reached before an identifier mapping was found");
-    return StatusCode::FAILURE;
-  }
-  //next line should be the identifier table, start reading it
-  bool endOfTable{false};
-  unsigned int numEntries{0};
-  std::vector<IdentifierHash> disabledFibres;
-  do {
-    std::getline(fromDataFile, inString);
-    if (contains(inString, "- ")) continue;
-    endOfTable=contains(inString, "</textList>");
-    std::istringstream dataLine(inString);
-    if (not endOfTable) {
-      int rod,link,barrelOrEndcap,layer,phi,eta,side,robidFromfile;
-      std::string sn,Link;
-      //enable exceptions on the stream in case there are bad conversions
-      dataLine.exceptions(std::ios_base::badbit|std::ios_base::failbit);
-      try {
-        dataLine>>rod>>Link>>barrelOrEndcap>>layer>>eta>>phi>>side>>std::hex>>robidFromfile>>std::dec>>sn;
-        offlineId = idHelper->wafer_id(barrelOrEndcap,layer,phi,eta,side);
-        offlineIdHash = idHelper->wafer_hash(offlineId);
-      } catch (const std::ios_base::failure&) {
-        ATH_MSG_ERROR("An error occurred while reading the cabling file "<<m_source
-                      <<", it may be badly formatted in the following line: \n"<<inString);
-        continue;
-      } 
-      // Check Link variable looks OK
-      // The maximum value of an int is 2147483647 in decimal and 0x7fffffff in hexadecimal.
-      if (Link.size()==0 or Link.size()>10) {
-        ATH_MSG_ERROR("An error occurred while reading the cabling file "<<m_source
-                      <<", Link ("<<Link<<") cannot be converted to an integer");
-        continue;
-      }
-      // Let's Get the Online Id From the link and the ROD
-      link = std::stoi(Link, nullptr, 0); // 0 means the base used in deterimed by the format in the sequence
-      if (link<0) {
-        ATH_MSG_ERROR("link " << link << " seems invalid. This was obtained from Link " << Link << ". Will not be used.");
-        continue;
-      }
-      if (link==disabledFibre) {
-        ATH_MSG_DEBUG(sn<<": Disabled fibre encountered in text file. Will attempt to place identifier using the other fibre.");
-        offlineId = idHelper->wafer_id(barrelOrEndcap,layer,phi,eta,side);
-        offlineIdHash = idHelper->wafer_hash(offlineId);
-        disabledFibres.push_back(offlineIdHash);
-        continue;
-      }
-      robid = robidFromfile;
-      onlineId = (robid & 0xFFFFFF) | (link<<24);
-      //std::cout<<" "<<offlineIdHash<<" "<<std::hex<<onlineId<<" "<<std::dec<<sn<<std::endl;
-      bool success{insert(offlineIdHash, onlineId, SCT_SerialNumber(sn), data)};
-      if (not success) {
-        ATH_MSG_ERROR("Insertion of fibre failed, "<<offlineIdHash<<", "<<std::hex<<onlineId<<std::dec<<" "<<sn);
-      } else {
-        numEntries++;
-      }
-    }//end of 'if not end of table'
-    endOfFile = fromDataFile.eof();
-  } while ((not endOfTable) and (not endOfFile));
-  
-  //************************************************************************************
-  // For the disabled fibres 
-  //************************************************************************************
-  std::string plural{(disabledFibres.size()==1) ? " was" : "s were"};
-  ATH_MSG_INFO(disabledFibres.size()<<" disabled fibre"<<plural<<" found.");
-  if (not disabledFibres.empty()) {
-    int s,os;
-    std::vector<IdentifierHash>::const_iterator it{disabledFibres.begin()};
-    for (;it not_eq disabledFibres.end();++it) {
-      IdentifierHash offlineIdHash{*it};
-      //even hashes are on side 0, hashes start from 0
-      s=offlineIdHash % 2; //1 or zero
-      os = 1-s; //other side, i.e. the enabled one
-      //find the hash for the other side: if its odd, subtract 1; if its even, add 1.
-      IdentifierHash otherIdHash{offlineIdHash + (s ? -1 : 1)};
-      //and its online id
-      onlineId=data.getOnlineIdFromHash(otherIdHash);
-      int link{static_cast<int>((onlineId>>24) & 0x7F)};
-      bool cableSwapped{(link % 2)!=os}; //if its odd and side is zero, or its even and side is 1.
-      //now find the newlink by incrementing or decrementing the link number from the other side, according to whether we are on
-      //side 0 or side 1 and which order the cabling is going in general (swapped or not swapped)
-      int newlink{(s == 0) ? (link - 1) : (link +1)}; //assumes normal unswapped ordering
-      if (cableSwapped) newlink = (s == 0) ? (link+1) : (link-1); //assumes swapped ordering
-      int newOnlineId{static_cast<int>((onlineId & 0xFFFFFF)|(newlink << 24))};
-      ATH_MSG_DEBUG("new: "<<std::hex<<newOnlineId);
-      //start entering for the disabled fibre:
-      SCT_SerialNumber sn{data.getSerialNumberFromHash(offlineIdHash)};
-      bool success{insert(offlineIdHash, newOnlineId, sn, data)};
-      if (not success) {
-        ATH_MSG_ERROR("Insertion of disabled fibre failed, "<<offlineIdHash<<", "<<std::hex<<newOnlineId<<std::dec<<" "<<sn.str());
-      } else {
-        numEntries++;
-      }
-    }
-  }
-  ATH_MSG_INFO(numEntries<<" entries were made to the identifier map.");
-  m_filled=(numEntries not_eq 0);
-  return (numEntries==0) ? (StatusCode::FAILURE) : (StatusCode::SUCCESS);
-}
-
-bool
-SCT_FillCablingFromText::insert(const IdentifierHash& hash, const SCT_OnlineId& onlineId, const SCT_SerialNumber& sn, SCT_CablingData& data) const {
-  if (not sn.isWellFormed()) {
-    ATH_MSG_FATAL("Serial number is not in correct format");
-    return false;
-  }
-  if (not hash.is_valid()) {
-    ATH_MSG_FATAL("Invalid hash: "<<hash);
-    return false;
-  }
-
-  if (not data.setHashForOnlineId(hash, onlineId)) return false;
-  if (not data.setOnlineIdForHash(onlineId, hash)) return false;
-
-  bool successfulInsert{data.setHashForSerialNumber(hash, sn)};
-  successfulInsert &= data.setSerialNumberForHash(sn, hash);
-  // in this form, the data->getHashEntries() will be half the number of hashes
-  if (successfulInsert) {
-    data.setRod(onlineId.rod()); //move this here so insertion only happens for valid onlineId, hash
-  }
-  return true;
-}
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromText.h b/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromText.h
deleted file mode 100644
index 444cb84aed0..00000000000
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/src/SCT_FillCablingFromText.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// -*- C++ -*-
-
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef SCT_FillCablingFromText_H
-#define SCT_FillCablingFromText_H
-/**   
- *   @file SCT_Fill_CablingFromText.h
- *
- *   @brief Fills an SCT cabling object from a plain text source
- *
- *   @author Shaun Roe
- *   @date 05/11/2008
- */
-
-//Athena includes
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "SCT_Cabling/ISCT_FillCabling.h"
-
-//STL includes
-#include <atomic>
-#include <string>
-
-//fwd declarations
-class IdentifierHash;
-class SCT_CablingData;
-class SCT_OnlineId;
-class SCT_SerialNumber;
-class StatusCode;
- 
-/**
- *    @class SCT_FillCablingFromText
- *    @brief Tool which fills the SCT Cabling from plain text (a file).
- *
- */
-class SCT_FillCablingFromText: public extends<AthAlgTool, ISCT_FillCabling> {
- public:
-  //@name AthAlgTool methods, reimplemented
-  //@{
-  SCT_FillCablingFromText(const std::string& type, const std::string& name, const IInterface* parent);
-  virtual ~SCT_FillCablingFromText() = default;
-  virtual StatusCode initialize();
-  virtual StatusCode finalize();
-  //@}
-
-  /** May set the data source to textFile, database etc
-   * @param[in] @c string name of datasource
-   */
-  virtual StatusCode setDataSource(const std::string& dataSource);
-  
-  /** Gets the data source
-   * @return @c string name of datasource
-   */
-  virtual std::string getDataSource() const;
-  
-  /**Fill the cabling maps
-   * @return @c cabling map object
-   */
-  virtual SCT_CablingData getMaps() const;
-  
-  /**Report whether the map was filled
-   * @return @c bool
-   */
-  virtual bool filled() const;
-  
-  /**Filling from text can be done during intialise, it doesn't need the db to be ready
-   * @return @c bool
-   */
-  virtual bool canFillDuringInitialize() const {return true;}
-
- private:
-  /// Read from a text file
-  StatusCode readDataFromFile(SCT_CablingData& data) const;
-
-  /// Insert relations among IdentifierHash, SCT_OnlineId and SCT_SerialNumber to SCT_CablingData.
-  bool insert(const IdentifierHash& hash, const SCT_OnlineId& onlineId, const SCT_SerialNumber& sn, SCT_CablingData& data) const;
-
-  mutable std::atomic_bool m_filled{false};
-  std::string m_source;
-};//end of class
-
-#endif // SCT_FillCablingFromText_H
diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/src/components/SCT_Cabling_entries.cxx b/InnerDetector/InDetDetDescr/SCT_Cabling/src/components/SCT_Cabling_entries.cxx
index 31ba57676fe..416af005b73 100644
--- a/InnerDetector/InDetDetDescr/SCT_Cabling/src/components/SCT_Cabling_entries.cxx
+++ b/InnerDetector/InDetDetDescr/SCT_Cabling/src/components/SCT_Cabling_entries.cxx
@@ -1,15 +1,9 @@
 #include "../SCT_CablingTool.h"
-#include "../SCT_CablingToolInc.h"
-#include "../SCT_FillCablingFromText.h"
-#include "../SCT_FillCablingFromCoraCool.h"
 #include "../SCT_TestCablingAlg.h"
 #include "../SCT_CablingCondAlgFromCoraCool.h"
 #include "../SCT_CablingCondAlgFromText.h"
 
 DECLARE_COMPONENT( SCT_CablingTool )
-DECLARE_COMPONENT( SCT_CablingToolInc )
-DECLARE_COMPONENT( SCT_FillCablingFromText )
-DECLARE_COMPONENT( SCT_FillCablingFromCoraCool )
 DECLARE_COMPONENT( SCT_TestCablingAlg )
 DECLARE_COMPONENT( SCT_CablingCondAlgFromCoraCool )
 DECLARE_COMPONENT( SCT_CablingCondAlgFromText )
diff --git a/InnerDetector/InDetExample/InDetDetDescrExample/share/TestRegionLUT.py b/InnerDetector/InDetExample/InDetDetDescrExample/share/TestRegionLUT.py
index 21372310453..02b843a2b7f 100755
--- a/InnerDetector/InDetExample/InDetDetDescrExample/share/TestRegionLUT.py
+++ b/InnerDetector/InDetExample/InDetDetDescrExample/share/TestRegionLUT.py
@@ -41,9 +41,6 @@ include("InDetRegionSelector/InDetRegionSelectorTable_jobOptions.py")
 
 from InDetRegionSelector.InDetRegionSelectorConf import InDetDD__InDetRegionSelectorLUT
 InDetRegionSelectorLUT = InDetDD__InDetRegionSelectorLUT(name                       = "InDetRegionSelectorLut",
-                                                         PixelRegionLUT_CreatorTool = PixelRegionSelectorTable,
-                                                         SCT_RegionLUT_CreatorTool  = SCT_RegionSelectorTable,
-                                                         TRT_RegionLUT_CreatorTool  = TRT_RegionSelectorTable,
                                                          DoTests                    = True)
 
 
diff --git a/Reconstruction/RecExample/RecExTB/scripts/ctb.reco.merge.trf b/Reconstruction/RecExample/RecExTB/scripts/ctb.reco.merge.trf
index 9c8280676d1..44ba560e575 100755
--- a/Reconstruction/RecExample/RecExTB/scripts/ctb.reco.merge.trf
+++ b/Reconstruction/RecExample/RecExTB/scripts/ctb.reco.merge.trf
@@ -692,9 +692,6 @@ if InDetTBFlags.CTBTracking or InDetTBFlags.xKalman or InDetTBFlags.iPatRec or I
 if doTrigger:
     # prepare LUT for Region Selector
     include("InDetRegionSelector/InDetRegionSelectorTable_jobOptions.py" )
-if InDetTBFlags.iPatRec and not doTrigger:
-    # prepare LUT for Region Selector used in TRT_Rec
-    include("InDetRegionSelector/TRT_RegionSelectorTable_jobOptions.py" )
 
 # -----------------------------
 # Reconstruction
diff --git a/Reconstruction/RecExample/RecExTB/scripts/ctb.reco.trf b/Reconstruction/RecExample/RecExTB/scripts/ctb.reco.trf
index af6e8eb259a..adffb77040e 100755
--- a/Reconstruction/RecExample/RecExTB/scripts/ctb.reco.trf
+++ b/Reconstruction/RecExample/RecExTB/scripts/ctb.reco.trf
@@ -654,9 +654,6 @@ if InDetTBFlags.CTBTracking or InDetTBFlags.xKalman or InDetTBFlags.iPatRec or I
 if doTrigger:
     # prepare LUT for Region Selector
     include("InDetRegionSelector/InDetRegionSelectorTable_jobOptions.py" )
-if InDetTBFlags.iPatRec and not doTrigger:
-    # prepare LUT for Region Selector used in TRT_Rec
-    include("InDetRegionSelector/TRT_RegionSelectorTable_jobOptions.py" )
 
 # -----------------------------
 # Reconstruction
diff --git a/Reconstruction/RecExample/RecExTB/share/RecExTB_Combined_2004_jobOptions.py b/Reconstruction/RecExample/RecExTB/share/RecExTB_Combined_2004_jobOptions.py
index 86b2cc75ed9..f0a915d419c 100755
--- a/Reconstruction/RecExample/RecExTB/share/RecExTB_Combined_2004_jobOptions.py
+++ b/Reconstruction/RecExample/RecExTB/share/RecExTB_Combined_2004_jobOptions.py
@@ -483,9 +483,6 @@ if doInDet:
    if InDetTBFlags.CTBTracking or InDetTBFlags.xKalman or InDetTBFlags.iPatRec or InDetTBFlags.TRT_LUT:    
       # particle property service
       include( "PartPropSvc/PartPropSvc.py" )
-   if InDetTBFlags.iPatRec and not doTrigger:
-      # prepare LUT for Region Selector used in TRT_Rec
-      include("InDetRegionSelector/TRT_RegionSelectorTable_jobOptions.py" )
 if doTrigger:
     # prepare LUT for Region Selector
     include("InDetRegionSelector/InDetRegionSelectorTable_jobOptions.py" )
-- 
GitLab