diff --git a/AtlasTest/ControlTest/share/FortranAlgorithm.ref b/AtlasTest/ControlTest/share/FortranAlgorithm.ref
index eee75dad968c6b17211489e4b1b277acafd84232..aa8ed1629804537c840c6d159f317bcdab71acfb 100644
--- a/AtlasTest/ControlTest/share/FortranAlgorithm.ref
+++ b/AtlasTest/ControlTest/share/FortranAlgorithm.ref
@@ -1,36 +1,32 @@
-Fri Mar 17 15:16:35 CET 2017
+Sat Jun 27 03:51:50 CEST 2020
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [AthenaExternals-22.0.0] [x86_64-slc6-gcc49-opt] [private/private] -- built on [2017-03-16 21:31]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
-[?1034hPy:Athena            INFO including file "AthenaCommon/Execution.py"
+Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "AthExFortranAlgorithm/FortranAlgorithmOptions.py"
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
-Py:ConfigurableDb    INFO Read module info for 5282 configurables from 2 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
+ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v28r1)
-                                          running on p05614910w96644.cern.ch on Fri Mar 17 15:16:49 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
+                                          running on lxplus755.cern.ch on Sat Jun 27 03:52:02 2020
 ====================================================================================================================================
-ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
-StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 2252 CLIDRegistry entries for module ALL
-ChronoStatSvc        INFO  Number of skipped events for MemStat-1
+ClassIDSvc           INFO  getRegistryEntries: read 7027 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
 FortranAlgorithm     INFO calling initialize_()
-HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr       INFO Application Manager Started successfully
-ClassIDSvc           INFO  getRegistryEntries: read 767 CLIDRegistry entries for module ALL
 AthenaEventLoopMgr   INFO   ===>>>  start of run 1    <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #1, run #1 0 events processed so far  <<<===
 FortranAlgorithm     INFO calling execute_()
@@ -48,12 +44,6 @@ FortranAlgorithm     INFO calling finalize_()
 IncidentProcAlg2     INFO Finalize
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
-*****Chrono*****     INFO ****************************************************************************************************
-*****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc        INFO Time User   : Tot=   90 [ms]                                             #=  1
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
 ApplicationMgr       INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/AtlasTest/ControlTest/share/StoreGateDFlow.ref b/AtlasTest/ControlTest/share/StoreGateDFlow.ref
index f8b56d3a97f108c5f2049b61c2f0615044652ddc..12d0575924c489e2148c3e40fe5cbc3ae287dd8f 100644
--- a/AtlasTest/ControlTest/share/StoreGateDFlow.ref
+++ b/AtlasTest/ControlTest/share/StoreGateDFlow.ref
@@ -1,44 +1,39 @@
-Fri Feb  8 22:42:38 CET 2019
+Sat Jun 27 03:47:03 CEST 2020
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [WorkDir-22.0.1] [x86_64-centos7-gcc8-opt] [atlas-work3/7a299cc93d6] -- built on [2019-02-08T2103]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "AthExStoreGateExample/dflow_jobo.py"
-Py:ConfigurableDb    INFO Read module info for 5454 configurables from 41 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r5)
-                                          running on lxplus054.cern.ch on Fri Feb  8 22:42:52 2019
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
+                                          running on lxplus755.cern.ch on Sat Jun 27 03:47:16 2020
 ====================================================================================================================================
-ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
-StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 3045 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 7027 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
-ClassIDSvc           INFO  getRegistryEntries: read 769 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 216 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 705 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 218 CLIDRegistry entries for module ALL
 xAODMaker::Even...   INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
 xAODMaker::Even...   INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
 xAODMaker::Even...WARNING Beam conditions service not available
 xAODMaker::Even...WARNING Will not fill beam spot information into xAOD::EventInfo
-xAODMaker::Even...   INFO Luminosity information not available
-xAODMaker::Even...   INFO Will take information from the EventInfo object
 ClassIDSvc           INFO  getRegistryEntries: read 423 CLIDRegistry entries for module ALL
 dflow_alg1           INFO Initializing dflow_alg1...
 dflow_alg2           INFO Initializing dflow_alg2...
 dflow_alg3           INFO Initializing dflow_alg3...
-HistogramPersis...WARNING Histograms saving not required.
 EventSelector        INFO  Enter McEventSelector Initialization 
 AthenaEventLoopMgr   INFO Setup EventSelector service EventSelector
 ApplicationMgr       INFO Application Manager Initialized successfully
@@ -58,24 +53,24 @@ dflow_alg1           INFO myint handle...
 dflow_alg1           INFO name: [dflow_int]
 dflow_alg1           INFO store [StoreGateSvc_Impl]
 dflow_alg1           INFO clid: [244260744]
-dflow_alg1           INFO ptr: 0x2d759978
+dflow_alg1           INFO ptr: 0x187506f0
 dflow_alg1           INFO val: 0
 dflow_alg1           INFO modify myint by value...
-dflow_alg1           INFO ptr: 0x2d759978
+dflow_alg1           INFO ptr: 0x187506f0
 dflow_alg1           INFO val: 20
 dflow_alg2           INFO ================================
 dflow_alg2           INFO myint r-handle...
 dflow_alg2           INFO name: [dflow_int]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
-dflow_alg2           INFO ptr: 0x2d759978
+dflow_alg2           INFO ptr: 0x187506f0
 dflow_alg2           INFO val: 20
 dflow_alg2           INFO myint w-handle...
 dflow_alg2           INFO name: [dflow_int2]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
 dflow_alg2           INFO val: 1020
-dflow_alg2           INFO cptr: 0x2d759ac0
+dflow_alg2           INFO cptr: 0x18750630
 dflow_alg2           INFO ints w-handle...
 dflow_alg2           INFO size:2
 dflow_alg2           INFO val[0]= 10
@@ -85,13 +80,13 @@ dflow_alg3           INFO myint r-handle...
 dflow_alg3           INFO name: [dflow_int2]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [244260744]
-dflow_alg3           INFO ptr: 0x2d759ac0
+dflow_alg3           INFO ptr: 0x18750630
 dflow_alg3           INFO val: 1020
 dflow_alg3           INFO ints r-handle...
 dflow_alg3           INFO name: [dflow_ints]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [22592129]
-dflow_alg3           INFO ptr: 0x30af6fe0
+dflow_alg3           INFO ptr: 0x18fbcc80
 dflow_alg3           INFO ints w-handle...
 dflow_alg3           INFO size:4
 dflow_alg3           INFO val[0]= 10
@@ -140,24 +135,24 @@ dflow_alg1           INFO myint handle...
 dflow_alg1           INFO name: [dflow_int]
 dflow_alg1           INFO store [StoreGateSvc_Impl]
 dflow_alg1           INFO clid: [244260744]
-dflow_alg1           INFO ptr: 0x2d759bf8
+dflow_alg1           INFO ptr: 0x187505d0
 dflow_alg1           INFO val: 1
 dflow_alg1           INFO modify myint by value...
-dflow_alg1           INFO ptr: 0x2d759bf8
+dflow_alg1           INFO ptr: 0x187505d0
 dflow_alg1           INFO val: 21
 dflow_alg2           INFO ================================
 dflow_alg2           INFO myint r-handle...
 dflow_alg2           INFO name: [dflow_int]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
-dflow_alg2           INFO ptr: 0x2d759bf8
+dflow_alg2           INFO ptr: 0x187505d0
 dflow_alg2           INFO val: 21
 dflow_alg2           INFO myint w-handle...
 dflow_alg2           INFO name: [dflow_int2]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
 dflow_alg2           INFO val: 1021
-dflow_alg2           INFO cptr: 0x2d759f18
+dflow_alg2           INFO cptr: 0x18750590
 dflow_alg2           INFO ints w-handle...
 dflow_alg2           INFO size:2
 dflow_alg2           INFO val[0]= 10
@@ -167,13 +162,13 @@ dflow_alg3           INFO myint r-handle...
 dflow_alg3           INFO name: [dflow_int2]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [244260744]
-dflow_alg3           INFO ptr: 0x2d759f18
+dflow_alg3           INFO ptr: 0x18750590
 dflow_alg3           INFO val: 1021
 dflow_alg3           INFO ints r-handle...
 dflow_alg3           INFO name: [dflow_ints]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [22592129]
-dflow_alg3           INFO ptr: 0x2ffe4880
+dflow_alg3           INFO ptr: 0x18fbcac0
 dflow_alg3           INFO ints w-handle...
 dflow_alg3           INFO size:4
 dflow_alg3           INFO val[0]= 10
@@ -221,24 +216,24 @@ dflow_alg1           INFO myint handle...
 dflow_alg1           INFO name: [dflow_int]
 dflow_alg1           INFO store [StoreGateSvc_Impl]
 dflow_alg1           INFO clid: [244260744]
-dflow_alg1           INFO ptr: 0x2d759858
+dflow_alg1           INFO ptr: 0x18750440
 dflow_alg1           INFO val: 2
 dflow_alg1           INFO modify myint by value...
-dflow_alg1           INFO ptr: 0x2d759858
+dflow_alg1           INFO ptr: 0x18750440
 dflow_alg1           INFO val: 22
 dflow_alg2           INFO ================================
 dflow_alg2           INFO myint r-handle...
 dflow_alg2           INFO name: [dflow_int]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
-dflow_alg2           INFO ptr: 0x2d759858
+dflow_alg2           INFO ptr: 0x18750440
 dflow_alg2           INFO val: 22
 dflow_alg2           INFO myint w-handle...
 dflow_alg2           INFO name: [dflow_int2]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
 dflow_alg2           INFO val: 1022
-dflow_alg2           INFO cptr: 0x2d759ac0
+dflow_alg2           INFO cptr: 0x18750630
 dflow_alg2           INFO ints w-handle...
 dflow_alg2           INFO size:2
 dflow_alg2           INFO val[0]= 10
@@ -248,13 +243,13 @@ dflow_alg3           INFO myint r-handle...
 dflow_alg3           INFO name: [dflow_int2]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [244260744]
-dflow_alg3           INFO ptr: 0x2d759ac0
+dflow_alg3           INFO ptr: 0x18750630
 dflow_alg3           INFO val: 1022
 dflow_alg3           INFO ints r-handle...
 dflow_alg3           INFO name: [dflow_ints]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [22592129]
-dflow_alg3           INFO ptr: 0x309d4a40
+dflow_alg3           INFO ptr: 0x18fbd1e0
 dflow_alg3           INFO ints w-handle...
 dflow_alg3           INFO size:4
 dflow_alg3           INFO val[0]= 10
@@ -302,24 +297,24 @@ dflow_alg1           INFO myint handle...
 dflow_alg1           INFO name: [dflow_int]
 dflow_alg1           INFO store [StoreGateSvc_Impl]
 dflow_alg1           INFO clid: [244260744]
-dflow_alg1           INFO ptr: 0x2d759d30
+dflow_alg1           INFO ptr: 0x18750210
 dflow_alg1           INFO val: 3
 dflow_alg1           INFO modify myint by value...
-dflow_alg1           INFO ptr: 0x2d759d30
+dflow_alg1           INFO ptr: 0x18750210
 dflow_alg1           INFO val: 23
 dflow_alg2           INFO ================================
 dflow_alg2           INFO myint r-handle...
 dflow_alg2           INFO name: [dflow_int]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
-dflow_alg2           INFO ptr: 0x2d759d30
+dflow_alg2           INFO ptr: 0x18750210
 dflow_alg2           INFO val: 23
 dflow_alg2           INFO myint w-handle...
 dflow_alg2           INFO name: [dflow_int2]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
 dflow_alg2           INFO val: 1023
-dflow_alg2           INFO cptr: 0x2d759f18
+dflow_alg2           INFO cptr: 0x18750590
 dflow_alg2           INFO ints w-handle...
 dflow_alg2           INFO size:2
 dflow_alg2           INFO val[0]= 10
@@ -329,13 +324,13 @@ dflow_alg3           INFO myint r-handle...
 dflow_alg3           INFO name: [dflow_int2]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [244260744]
-dflow_alg3           INFO ptr: 0x2d759f18
+dflow_alg3           INFO ptr: 0x18750590
 dflow_alg3           INFO val: 1023
 dflow_alg3           INFO ints r-handle...
 dflow_alg3           INFO name: [dflow_ints]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [22592129]
-dflow_alg3           INFO ptr: 0x30af6ac0
+dflow_alg3           INFO ptr: 0x18fbcb40
 dflow_alg3           INFO ints w-handle...
 dflow_alg3           INFO size:4
 dflow_alg3           INFO val[0]= 10
@@ -383,24 +378,24 @@ dflow_alg1           INFO myint handle...
 dflow_alg1           INFO name: [dflow_int]
 dflow_alg1           INFO store [StoreGateSvc_Impl]
 dflow_alg1           INFO clid: [244260744]
-dflow_alg1           INFO ptr: 0x2d759c50
+dflow_alg1           INFO ptr: 0x18750258
 dflow_alg1           INFO val: 4
 dflow_alg1           INFO modify myint by value...
-dflow_alg1           INFO ptr: 0x2d759c50
+dflow_alg1           INFO ptr: 0x18750258
 dflow_alg1           INFO val: 24
 dflow_alg2           INFO ================================
 dflow_alg2           INFO myint r-handle...
 dflow_alg2           INFO name: [dflow_int]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
-dflow_alg2           INFO ptr: 0x2d759c50
+dflow_alg2           INFO ptr: 0x18750258
 dflow_alg2           INFO val: 24
 dflow_alg2           INFO myint w-handle...
 dflow_alg2           INFO name: [dflow_int2]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
 dflow_alg2           INFO val: 1024
-dflow_alg2           INFO cptr: 0x2d759ac0
+dflow_alg2           INFO cptr: 0x18750630
 dflow_alg2           INFO ints w-handle...
 dflow_alg2           INFO size:2
 dflow_alg2           INFO val[0]= 10
@@ -410,13 +405,13 @@ dflow_alg3           INFO myint r-handle...
 dflow_alg3           INFO name: [dflow_int2]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [244260744]
-dflow_alg3           INFO ptr: 0x2d759ac0
+dflow_alg3           INFO ptr: 0x18750630
 dflow_alg3           INFO val: 1024
 dflow_alg3           INFO ints r-handle...
 dflow_alg3           INFO name: [dflow_ints]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [22592129]
-dflow_alg3           INFO ptr: 0x30af66c0
+dflow_alg3           INFO ptr: 0x18fbd140
 dflow_alg3           INFO ints w-handle...
 dflow_alg3           INFO size:4
 dflow_alg3           INFO val[0]= 10
@@ -464,24 +459,24 @@ dflow_alg1           INFO myint handle...
 dflow_alg1           INFO name: [dflow_int]
 dflow_alg1           INFO store [StoreGateSvc_Impl]
 dflow_alg1           INFO clid: [244260744]
-dflow_alg1           INFO ptr: 0x2d759780
+dflow_alg1           INFO ptr: 0x18750570
 dflow_alg1           INFO val: 5
 dflow_alg1           INFO modify myint by value...
-dflow_alg1           INFO ptr: 0x2d759780
+dflow_alg1           INFO ptr: 0x18750570
 dflow_alg1           INFO val: 25
 dflow_alg2           INFO ================================
 dflow_alg2           INFO myint r-handle...
 dflow_alg2           INFO name: [dflow_int]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
-dflow_alg2           INFO ptr: 0x2d759780
+dflow_alg2           INFO ptr: 0x18750570
 dflow_alg2           INFO val: 25
 dflow_alg2           INFO myint w-handle...
 dflow_alg2           INFO name: [dflow_int2]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
 dflow_alg2           INFO val: 1025
-dflow_alg2           INFO cptr: 0x2d759f18
+dflow_alg2           INFO cptr: 0x18750590
 dflow_alg2           INFO ints w-handle...
 dflow_alg2           INFO size:2
 dflow_alg2           INFO val[0]= 10
@@ -491,13 +486,13 @@ dflow_alg3           INFO myint r-handle...
 dflow_alg3           INFO name: [dflow_int2]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [244260744]
-dflow_alg3           INFO ptr: 0x2d759f18
+dflow_alg3           INFO ptr: 0x18750590
 dflow_alg3           INFO val: 1025
 dflow_alg3           INFO ints r-handle...
 dflow_alg3           INFO name: [dflow_ints]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [22592129]
-dflow_alg3           INFO ptr: 0x309dcce0
+dflow_alg3           INFO ptr: 0x18fb2aa0
 dflow_alg3           INFO ints w-handle...
 dflow_alg3           INFO size:4
 dflow_alg3           INFO val[0]= 10
@@ -545,24 +540,24 @@ dflow_alg1           INFO myint handle...
 dflow_alg1           INFO name: [dflow_int]
 dflow_alg1           INFO store [StoreGateSvc_Impl]
 dflow_alg1           INFO clid: [244260744]
-dflow_alg1           INFO ptr: 0x2d759978
+dflow_alg1           INFO ptr: 0x187506a0
 dflow_alg1           INFO val: 6
 dflow_alg1           INFO modify myint by value...
-dflow_alg1           INFO ptr: 0x2d759978
+dflow_alg1           INFO ptr: 0x187506a0
 dflow_alg1           INFO val: 26
 dflow_alg2           INFO ================================
 dflow_alg2           INFO myint r-handle...
 dflow_alg2           INFO name: [dflow_int]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
-dflow_alg2           INFO ptr: 0x2d759978
+dflow_alg2           INFO ptr: 0x187506a0
 dflow_alg2           INFO val: 26
 dflow_alg2           INFO myint w-handle...
 dflow_alg2           INFO name: [dflow_int2]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
 dflow_alg2           INFO val: 1026
-dflow_alg2           INFO cptr: 0x2d759ac0
+dflow_alg2           INFO cptr: 0x18750630
 dflow_alg2           INFO ints w-handle...
 dflow_alg2           INFO size:2
 dflow_alg2           INFO val[0]= 10
@@ -572,13 +567,13 @@ dflow_alg3           INFO myint r-handle...
 dflow_alg3           INFO name: [dflow_int2]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [244260744]
-dflow_alg3           INFO ptr: 0x2d759ac0
+dflow_alg3           INFO ptr: 0x18750630
 dflow_alg3           INFO val: 1026
 dflow_alg3           INFO ints r-handle...
 dflow_alg3           INFO name: [dflow_ints]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [22592129]
-dflow_alg3           INFO ptr: 0x30af6fe0
+dflow_alg3           INFO ptr: 0x18961020
 dflow_alg3           INFO ints w-handle...
 dflow_alg3           INFO size:4
 dflow_alg3           INFO val[0]= 10
@@ -626,24 +621,24 @@ dflow_alg1           INFO myint handle...
 dflow_alg1           INFO name: [dflow_int]
 dflow_alg1           INFO store [StoreGateSvc_Impl]
 dflow_alg1           INFO clid: [244260744]
-dflow_alg1           INFO ptr: 0x2d759bf8
+dflow_alg1           INFO ptr: 0x187506f0
 dflow_alg1           INFO val: 7
 dflow_alg1           INFO modify myint by value...
-dflow_alg1           INFO ptr: 0x2d759bf8
+dflow_alg1           INFO ptr: 0x187506f0
 dflow_alg1           INFO val: 27
 dflow_alg2           INFO ================================
 dflow_alg2           INFO myint r-handle...
 dflow_alg2           INFO name: [dflow_int]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
-dflow_alg2           INFO ptr: 0x2d759bf8
+dflow_alg2           INFO ptr: 0x187506f0
 dflow_alg2           INFO val: 27
 dflow_alg2           INFO myint w-handle...
 dflow_alg2           INFO name: [dflow_int2]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
 dflow_alg2           INFO val: 1027
-dflow_alg2           INFO cptr: 0x2d759f18
+dflow_alg2           INFO cptr: 0x18750590
 dflow_alg2           INFO ints w-handle...
 dflow_alg2           INFO size:2
 dflow_alg2           INFO val[0]= 10
@@ -653,13 +648,13 @@ dflow_alg3           INFO myint r-handle...
 dflow_alg3           INFO name: [dflow_int2]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [244260744]
-dflow_alg3           INFO ptr: 0x2d759f18
+dflow_alg3           INFO ptr: 0x18750590
 dflow_alg3           INFO val: 1027
 dflow_alg3           INFO ints r-handle...
 dflow_alg3           INFO name: [dflow_ints]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [22592129]
-dflow_alg3           INFO ptr: 0x309d4960
+dflow_alg3           INFO ptr: 0x18fbcd80
 dflow_alg3           INFO ints w-handle...
 dflow_alg3           INFO size:4
 dflow_alg3           INFO val[0]= 10
@@ -707,24 +702,24 @@ dflow_alg1           INFO myint handle...
 dflow_alg1           INFO name: [dflow_int]
 dflow_alg1           INFO store [StoreGateSvc_Impl]
 dflow_alg1           INFO clid: [244260744]
-dflow_alg1           INFO ptr: 0x2d759858
+dflow_alg1           INFO ptr: 0x187505d0
 dflow_alg1           INFO val: 8
 dflow_alg1           INFO modify myint by value...
-dflow_alg1           INFO ptr: 0x2d759858
+dflow_alg1           INFO ptr: 0x187505d0
 dflow_alg1           INFO val: 28
 dflow_alg2           INFO ================================
 dflow_alg2           INFO myint r-handle...
 dflow_alg2           INFO name: [dflow_int]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
-dflow_alg2           INFO ptr: 0x2d759858
+dflow_alg2           INFO ptr: 0x187505d0
 dflow_alg2           INFO val: 28
 dflow_alg2           INFO myint w-handle...
 dflow_alg2           INFO name: [dflow_int2]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
 dflow_alg2           INFO val: 1028
-dflow_alg2           INFO cptr: 0x2d759ac0
+dflow_alg2           INFO cptr: 0x18750630
 dflow_alg2           INFO ints w-handle...
 dflow_alg2           INFO size:2
 dflow_alg2           INFO val[0]= 10
@@ -734,13 +729,13 @@ dflow_alg3           INFO myint r-handle...
 dflow_alg3           INFO name: [dflow_int2]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [244260744]
-dflow_alg3           INFO ptr: 0x2d759ac0
+dflow_alg3           INFO ptr: 0x18750630
 dflow_alg3           INFO val: 1028
 dflow_alg3           INFO ints r-handle...
 dflow_alg3           INFO name: [dflow_ints]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [22592129]
-dflow_alg3           INFO ptr: 0x30af7140
+dflow_alg3           INFO ptr: 0x6403800
 dflow_alg3           INFO ints w-handle...
 dflow_alg3           INFO size:4
 dflow_alg3           INFO val[0]= 10
@@ -788,24 +783,24 @@ dflow_alg1           INFO myint handle...
 dflow_alg1           INFO name: [dflow_int]
 dflow_alg1           INFO store [StoreGateSvc_Impl]
 dflow_alg1           INFO clid: [244260744]
-dflow_alg1           INFO ptr: 0x2d759d30
+dflow_alg1           INFO ptr: 0x18750440
 dflow_alg1           INFO val: 9
 dflow_alg1           INFO modify myint by value...
-dflow_alg1           INFO ptr: 0x2d759d30
+dflow_alg1           INFO ptr: 0x18750440
 dflow_alg1           INFO val: 29
 dflow_alg2           INFO ================================
 dflow_alg2           INFO myint r-handle...
 dflow_alg2           INFO name: [dflow_int]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
-dflow_alg2           INFO ptr: 0x2d759d30
+dflow_alg2           INFO ptr: 0x18750440
 dflow_alg2           INFO val: 29
 dflow_alg2           INFO myint w-handle...
 dflow_alg2           INFO name: [dflow_int2]
 dflow_alg2           INFO store [StoreGateSvc_Impl]
 dflow_alg2           INFO clid: [244260744]
 dflow_alg2           INFO val: 1029
-dflow_alg2           INFO cptr: 0x2d759f18
+dflow_alg2           INFO cptr: 0x18750590
 dflow_alg2           INFO ints w-handle...
 dflow_alg2           INFO size:2
 dflow_alg2           INFO val[0]= 10
@@ -815,13 +810,13 @@ dflow_alg3           INFO myint r-handle...
 dflow_alg3           INFO name: [dflow_int2]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [244260744]
-dflow_alg3           INFO ptr: 0x2d759f18
+dflow_alg3           INFO ptr: 0x18750590
 dflow_alg3           INFO val: 1029
 dflow_alg3           INFO ints r-handle...
 dflow_alg3           INFO name: [dflow_ints]
 dflow_alg3           INFO store [StoreGateSvc_Impl]
 dflow_alg3           INFO clid: [22592129]
-dflow_alg3           INFO ptr: 0x30af6ac0
+dflow_alg3           INFO ptr: 0x18fbc660
 dflow_alg3           INFO ints w-handle...
 dflow_alg3           INFO size:4
 dflow_alg3           INFO val[0]= 10
@@ -865,12 +860,6 @@ IncidentProcAlg2     INFO Finalize
 EventSelector        INFO finalize
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
-*****Chrono*****     INFO ****************************************************************************************************
-*****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc        INFO Time User   : Tot=  120 [ms]                                             #=  1
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
 ApplicationMgr       INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/AtlasTest/ControlTest/share/StoreGateGen.ref b/AtlasTest/ControlTest/share/StoreGateGen.ref
index 19ef0e761acc65617254c9e5f83fab2656284cb1..7a568f53481ca4056773b44d44e81ea03f76e465 100644
--- a/AtlasTest/ControlTest/share/StoreGateGen.ref
+++ b/AtlasTest/ControlTest/share/StoreGateGen.ref
@@ -1,31 +1,30 @@
-Wed Sep  4 16:52:27 CEST 2019
+Sat Jun 27 03:36:37 CEST 2020
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [WorkDir-22.0.5] [x86_64-centos7-gcc8-opt] [dvbase.AthContainers-20190902/498e6d57a471] -- built on [2019-09-04T1645]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "AthExStoreGateExample/StoreGateExample_Gen_jobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5534 configurables from 10 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v32r1)
-                                          running on lxplus776.cern.ch on Wed Sep  4 16:52:37 2019
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
+                                          running on lxplus755.cern.ch on Sat Jun 27 03:36:51 2020
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
-StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 3273 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 7027 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
-ClassIDSvc           INFO  getRegistryEntries: read 925 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1095 CLIDRegistry entries for module ALL
 WriteData            INFO in initialize()
 StoreGateSvc        DEBUG Property update for OutputLevel : new value = 1
 StoreGateSvc        DEBUG Service base class initialized successfully
@@ -38,70 +37,69 @@ StoreGateSvc_Impl VERBOSE ServiceLocatorHelper::service: found service EventPers
 StoreGateSvc_Impl VERBOSE ServiceLocatorHelper::service: found service ClassIDSvc
 ReadData             INFO in initialize()
 ReadData             INFO Data Object producer: WriteData
-HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr       INFO Application Manager Started successfully
 AthenaEventLoopMgr   INFO   ===>>>  start of run 1    <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #1, run #1 0 events processed so far  <<<===
 WriteData            INFO in execute()
-StoreGateSvc        DEBUG Recorded object @0x121291c0 with key  of type MyDataObj(CLID 8000)
- in DataObject @0x142df220
+StoreGateSvc        DEBUG Recorded object @0x15e42cc0 with key  of type MyDataObj(CLID 8000)
+ in DataObject @0x17e88320
  object not modifiable when retrieved
 WriteData         WARNING we expect  an error message here
 StoreGateSvc_Impl WARNING  setupProxy:: error setting up proxy for key  and clid 8000
- Pre-existing valid DataProxy @0x1260b7c0 found in Store for key  with clid 8000
+ Pre-existing valid DataProxy @0x15ef12c0 found in Store for key  with clid 8000
 ClassIDSvc           INFO  getRegistryEntries: read 423 CLIDRegistry entries for module ALL
-StoreGateSvc_Impl WARNING record_impl: Problem setting up the proxy for object @0x12129440
- recorded with key  of type MyDataObj (CLID 8000) in DataObject @0x142df270
+StoreGateSvc_Impl WARNING record_impl: Problem setting up the proxy for object @0x5b1ff40
+ recorded with key  of type MyDataObj (CLID 8000) in DataObject @0x17e883c0
 WriteData         WARNING end of error message
-StoreGateSvc        DEBUG Recorded object @0x12128440 with key WriteData of type MyDataObj(CLID 8000)
- in DataObject @0x142df810
+StoreGateSvc        DEBUG Recorded object @0x5b1feb0 with key WriteData of type MyDataObj(CLID 8000)
+ in DataObject @0x17e63590
  object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x14bcc6c0 with key  of type DataVector<MyContObj>(CLID 9967)
- in DataObject @0x14b36f50
+StoreGateSvc        DEBUG Recorded object @0x17efa240 with key  of type DataVector<MyContObj>(CLID 9967)
+ in DataObject @0x17cfb650
  object not modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x142cb960 with key  of type std::vector<float>(CLID 202242136)
- in DataObject @0x142df9a0
+StoreGateSvc        DEBUG Recorded object @0x17e39800 with key  of type std::vector<float>(CLID 202242136)
+ in DataObject @0x17e639a0
  object not modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x142e4d80 with key  of type std::map<std::string,float>(CLID 193758082)
- in DataObject @0x142dfa90
+StoreGateSvc        DEBUG Recorded object @0x17ed78f0 with key  of type std::map<std::string,float>(CLID 193758082)
+ in DataObject @0x17e639f0
  object not modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x121287c0 with key dobj2 of type MyDataObj(CLID 8000)
- in DataObject @0x142dfb30
+StoreGateSvc        DEBUG Recorded object @0x5b1fe60 with key dobj2 of type MyDataObj(CLID 8000)
+ in DataObject @0x17e88460
  object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x142cb7e0 with key WriteData of type std::list< ElementLink< std::vector<float> > >(CLID 9984)
- in DataObject @0x142dfbd0
+StoreGateSvc        DEBUG Recorded object @0x17e39980 with key WriteData of type std::list< ElementLink< std::vector<float> > >(CLID 9984)
+ in DataObject @0x17e88190
  object not modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x142cb760 with key  of type std::vector< ElementLink<MapStringFloat> >(CLID 9983)
- in DataObject @0x142de370
+StoreGateSvc        DEBUG Recorded object @0x17e39a00 with key  of type std::vector< ElementLink<MapStringFloat> >(CLID 9983)
+ in DataObject @0x17e88140
  object not modifiable when retrieved
 WriteData            INFO  registered all data objects
 WriteData            INFO  StoreGate structure before returning from execute 
 <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> 
 SGImplSvc(StoreGateSvc_Impl)::dump():
 Found 2 proxies for ClassID 1434 (BaseClass): 
- flags: (  valid,   locked,  reset) --- data: 0x142df220 --- key: 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142df810 --- key: WriteData
+ flags: (  valid,   locked,  reset) --- data: 0x17e88320 --- key: 
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e63590 --- key: WriteData
 Found 1 proxy for ClassID 2101 (EventInfo): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142de870 --- key: 
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e63810 --- key: 
 Found 3 proxies for ClassID 8000 (MyDataObj): 
- flags: (  valid,   locked,  reset) --- data: 0x142df220 --- key: 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142df810 --- key: WriteData
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142dfb30 --- key: dobj2
+ flags: (  valid,   locked,  reset) --- data: 0x17e88320 --- key: 
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e63590 --- key: WriteData
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e88460 --- key: dobj2
 Found 1 proxy for ClassID 9967 (DataVector<MyContObj>): 
- flags: (  valid,   locked,  reset) --- data: 0x14b36f50 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17cfb650 --- key: 
 Found 1 proxy for ClassID 9983 (std::vector< ElementLink<MapStringFloat> >): 
- flags: (  valid,   locked,  reset) --- data: 0x142de370 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17e88140 --- key: 
 Found 1 proxy for ClassID 9984 (std::list< ElementLink< std::vector<float> > >): 
- flags: (  valid,   locked,  reset) --- data: 0x142dfbd0 --- key: WriteData
+ flags: (  valid,   locked,  reset) --- data: 0x17e88190 --- key: WriteData
 Found 1 proxy for ClassID 33347479 (SG::AuxVectorBase): 
- flags: (  valid,   locked,  reset) --- data: 0x14b36f50 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17cfb650 --- key: 
 Found 1 proxy for ClassID 55596997 (EventContext): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142df040 --- key: EventContext
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e63ea0 --- key: EventContext
 Found 1 proxy for ClassID 193758082 (std::map<std::string,float>): 
- flags: (  valid,   locked,  reset) --- data: 0x142dfa90 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17e639f0 --- key: 
 Found 1 proxy for ClassID 202242136 (std::vector<float>): 
- flags: (  valid,   locked,  reset) --- data: 0x142df9a0 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17e639a0 --- key: 
 <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> 
 
 ReadData             INFO in execute()
@@ -127,73 +125,73 @@ ReadData             INFO ListVecLinks::linked element 3
 StoreGateSvc        DEBUG retrieve(default): Retrieved const pointer to default object 
  of type std::vector< ElementLink<MapStringFloat> >(CLID 9983)
 ReadData             INFO Retrieved vector of links
-ReadData             INFO VectorMapLinks::linked element: key uno - value 1 - stored as 0x144fa73c
-ReadData             INFO VectorMapLinks::linked element: key due - value 2 - stored as 0x144fa77c
+ReadData             INFO VectorMapLinks::linked element: key uno - value 1 - stored as 0x1793163c
+ReadData             INFO VectorMapLinks::linked element: key due - value 2 - stored as 0x1793167c
 ReadData             INFO  retrieve as BaseClass, print its address: 
-ReadData             INFO 0x121291c0
-ReadData             INFO 0x12128440
+ReadData             INFO 0x15e42cc0
+ReadData             INFO 0x5b1feb0
 ReadData             INFO  EventInfo :  event: 1 run: 1
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #1, run #1 1 events processed so far  <<<===
 StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #2, run #1 1 events processed so far  <<<===
 WriteData            INFO in execute()
-StoreGateSvc        DEBUG Recorded object @0x121287c0 with key  of type MyDataObj(CLID 8000)
- in DataObject @0x142dfb30
+StoreGateSvc        DEBUG Recorded object @0x5b1fe60 with key  of type MyDataObj(CLID 8000)
+ in DataObject @0x17e88460
  object not modifiable when retrieved
 WriteData         WARNING we expect  an error message here
 StoreGateSvc_Impl WARNING  setupProxy:: error setting up proxy for key  and clid 8000
- Pre-existing valid DataProxy @0x1260b7c0 found in Store for key  with clid 8000
-StoreGateSvc_Impl WARNING record_impl: Problem setting up the proxy for object @0x12129770
- recorded with key  of type MyDataObj (CLID 8000) in DataObject @0x142dfa90
+ Pre-existing valid DataProxy @0x15ef12c0 found in Store for key  with clid 8000
+StoreGateSvc_Impl WARNING record_impl: Problem setting up the proxy for object @0x15e423e0
+ recorded with key  of type MyDataObj (CLID 8000) in DataObject @0x17e639f0
 WriteData         WARNING end of error message
-StoreGateSvc        DEBUG Recorded object @0x12128440 with key WriteData of type MyDataObj(CLID 8000)
- in DataObject @0x142ded70
+StoreGateSvc        DEBUG Recorded object @0x5b1feb0 with key WriteData of type MyDataObj(CLID 8000)
+ in DataObject @0x17e63cc0
  object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x14bcc6c0 with key  of type DataVector<MyContObj>(CLID 9967)
- in DataObject @0x14b36f50
+StoreGateSvc        DEBUG Recorded object @0x17efa240 with key  of type DataVector<MyContObj>(CLID 9967)
+ in DataObject @0x17cfb650
  object not modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x142cb8c0 with key  of type std::vector<float>(CLID 202242136)
- in DataObject @0x142df9a0
+StoreGateSvc        DEBUG Recorded object @0x17e39880 with key  of type std::vector<float>(CLID 202242136)
+ in DataObject @0x17e639a0
  object not modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x142e4d80 with key  of type std::map<std::string,float>(CLID 193758082)
- in DataObject @0x142df220
+StoreGateSvc        DEBUG Recorded object @0x17ed78f0 with key  of type std::map<std::string,float>(CLID 193758082)
+ in DataObject @0x17e88320
  object not modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x12129440 with key dobj2 of type MyDataObj(CLID 8000)
- in DataObject @0x142df040
+StoreGateSvc        DEBUG Recorded object @0x5b1ff40 with key dobj2 of type MyDataObj(CLID 8000)
+ in DataObject @0x17e63ea0
  object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x142c7cc0 with key WriteData of type std::list< ElementLink< std::vector<float> > >(CLID 9984)
- in DataObject @0x142de870
+StoreGateSvc        DEBUG Recorded object @0x17e611a0 with key WriteData of type std::list< ElementLink< std::vector<float> > >(CLID 9984)
+ in DataObject @0x17e63810
  object not modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x142cb6e0 with key  of type std::vector< ElementLink<MapStringFloat> >(CLID 9983)
- in DataObject @0x142df270
+StoreGateSvc        DEBUG Recorded object @0x17e39a80 with key  of type std::vector< ElementLink<MapStringFloat> >(CLID 9983)
+ in DataObject @0x17e883c0
  object not modifiable when retrieved
 WriteData            INFO  registered all data objects
 WriteData            INFO  StoreGate structure before returning from execute 
 <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> 
 SGImplSvc(StoreGateSvc_Impl)::dump():
 Found 2 proxies for ClassID 1434 (BaseClass): 
- flags: (  valid,   locked,  reset) --- data: 0x142dfb30 --- key: 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142ded70 --- key: WriteData
+ flags: (  valid,   locked,  reset) --- data: 0x17e88460 --- key: 
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e63cc0 --- key: WriteData
 Found 1 proxy for ClassID 2101 (EventInfo): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142de370 --- key: 
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e88140 --- key: 
 Found 3 proxies for ClassID 8000 (MyDataObj): 
- flags: (  valid,   locked,  reset) --- data: 0x142dfb30 --- key: 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142ded70 --- key: WriteData
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142df040 --- key: dobj2
+ flags: (  valid,   locked,  reset) --- data: 0x17e88460 --- key: 
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e63cc0 --- key: WriteData
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e63ea0 --- key: dobj2
 Found 1 proxy for ClassID 9967 (DataVector<MyContObj>): 
- flags: (  valid,   locked,  reset) --- data: 0x14b36f50 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17cfb650 --- key: 
 Found 1 proxy for ClassID 9983 (std::vector< ElementLink<MapStringFloat> >): 
- flags: (  valid,   locked,  reset) --- data: 0x142df270 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17e883c0 --- key: 
 Found 1 proxy for ClassID 9984 (std::list< ElementLink< std::vector<float> > >): 
- flags: (  valid,   locked,  reset) --- data: 0x142de870 --- key: WriteData
+ flags: (  valid,   locked,  reset) --- data: 0x17e63810 --- key: WriteData
 Found 1 proxy for ClassID 33347479 (SG::AuxVectorBase): 
- flags: (  valid,   locked,  reset) --- data: 0x14b36f50 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17cfb650 --- key: 
 Found 1 proxy for ClassID 55596997 (EventContext): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142dfbd0 --- key: EventContext
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e88190 --- key: EventContext
 Found 1 proxy for ClassID 193758082 (std::map<std::string,float>): 
- flags: (  valid,   locked,  reset) --- data: 0x142df220 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17e88320 --- key: 
 Found 1 proxy for ClassID 202242136 (std::vector<float>): 
- flags: (  valid,   locked,  reset) --- data: 0x142df9a0 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17e639a0 --- key: 
 <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> 
 
 ReadData             INFO in execute()
@@ -219,73 +217,73 @@ ReadData             INFO ListVecLinks::linked element 3
 StoreGateSvc        DEBUG retrieve(default): Retrieved const pointer to default object 
  of type std::vector< ElementLink<MapStringFloat> >(CLID 9983)
 ReadData             INFO Retrieved vector of links
-ReadData             INFO VectorMapLinks::linked element: key uno - value 1 - stored as 0x14b3ce3c
-ReadData             INFO VectorMapLinks::linked element: key due - value 2 - stored as 0x14b3ce7c
+ReadData             INFO VectorMapLinks::linked element: key uno - value 1 - stored as 0x1616d33c
+ReadData             INFO VectorMapLinks::linked element: key due - value 2 - stored as 0x1616d37c
 ReadData             INFO  retrieve as BaseClass, print its address: 
-ReadData             INFO 0x121287c0
-ReadData             INFO 0x12128440
+ReadData             INFO 0x5b1fe60
+ReadData             INFO 0x5b1feb0
 ReadData             INFO  EventInfo :  event: 2 run: 1
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 2 events processed so far  <<<===
 StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #3, run #1 2 events processed so far  <<<===
 WriteData            INFO in execute()
-StoreGateSvc        DEBUG Recorded object @0x12129440 with key  of type MyDataObj(CLID 8000)
- in DataObject @0x142df040
+StoreGateSvc        DEBUG Recorded object @0x5b1ff40 with key  of type MyDataObj(CLID 8000)
+ in DataObject @0x17e63ea0
  object not modifiable when retrieved
 WriteData         WARNING we expect  an error message here
 StoreGateSvc_Impl WARNING  setupProxy:: error setting up proxy for key  and clid 8000
- Pre-existing valid DataProxy @0x1260b7c0 found in Store for key  with clid 8000
-StoreGateSvc_Impl WARNING record_impl: Problem setting up the proxy for object @0x121291c0
- recorded with key  of type MyDataObj (CLID 8000) in DataObject @0x142df220
+ Pre-existing valid DataProxy @0x15ef12c0 found in Store for key  with clid 8000
+StoreGateSvc_Impl WARNING record_impl: Problem setting up the proxy for object @0x15e42cc0
+ recorded with key  of type MyDataObj (CLID 8000) in DataObject @0x17e88320
 WriteData         WARNING end of error message
-StoreGateSvc        DEBUG Recorded object @0x12128440 with key WriteData of type MyDataObj(CLID 8000)
- in DataObject @0x142df810
+StoreGateSvc        DEBUG Recorded object @0x5b1feb0 with key WriteData of type MyDataObj(CLID 8000)
+ in DataObject @0x17e63590
  object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x14bcc6c0 with key  of type DataVector<MyContObj>(CLID 9967)
- in DataObject @0x14b36f50
+StoreGateSvc        DEBUG Recorded object @0x17efa240 with key  of type DataVector<MyContObj>(CLID 9967)
+ in DataObject @0x17cfb650
  object not modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x142cba00 with key  of type std::vector<float>(CLID 202242136)
- in DataObject @0x142df9a0
+StoreGateSvc        DEBUG Recorded object @0x17e39760 with key  of type std::vector<float>(CLID 202242136)
+ in DataObject @0x17e639a0
  object not modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x142e4d80 with key  of type std::map<std::string,float>(CLID 193758082)
- in DataObject @0x142dfb30
+StoreGateSvc        DEBUG Recorded object @0x17ed78f0 with key  of type std::map<std::string,float>(CLID 193758082)
+ in DataObject @0x17e88460
  object not modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x12129770 with key dobj2 of type MyDataObj(CLID 8000)
- in DataObject @0x142dfbd0
+StoreGateSvc        DEBUG Recorded object @0x15e423e0 with key dobj2 of type MyDataObj(CLID 8000)
+ in DataObject @0x17e88190
  object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x142c7460 with key WriteData of type std::list< ElementLink< std::vector<float> > >(CLID 9984)
- in DataObject @0x142de370
+StoreGateSvc        DEBUG Recorded object @0x17e61120 with key WriteData of type std::list< ElementLink< std::vector<float> > >(CLID 9984)
+ in DataObject @0x17e88140
  object not modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x142c7d00 with key  of type std::vector< ElementLink<MapStringFloat> >(CLID 9983)
- in DataObject @0x142dfa90
+StoreGateSvc        DEBUG Recorded object @0x17e60ac0 with key  of type std::vector< ElementLink<MapStringFloat> >(CLID 9983)
+ in DataObject @0x17e639f0
  object not modifiable when retrieved
 WriteData            INFO  registered all data objects
 WriteData            INFO  StoreGate structure before returning from execute 
 <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> 
 SGImplSvc(StoreGateSvc_Impl)::dump():
 Found 2 proxies for ClassID 1434 (BaseClass): 
- flags: (  valid,   locked,  reset) --- data: 0x142df040 --- key: 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142df810 --- key: WriteData
+ flags: (  valid,   locked,  reset) --- data: 0x17e63ea0 --- key: 
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e63590 --- key: WriteData
 Found 1 proxy for ClassID 2101 (EventInfo): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142df270 --- key: 
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e883c0 --- key: 
 Found 3 proxies for ClassID 8000 (MyDataObj): 
- flags: (  valid,   locked,  reset) --- data: 0x142df040 --- key: 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142df810 --- key: WriteData
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142dfbd0 --- key: dobj2
+ flags: (  valid,   locked,  reset) --- data: 0x17e63ea0 --- key: 
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e63590 --- key: WriteData
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e88190 --- key: dobj2
 Found 1 proxy for ClassID 9967 (DataVector<MyContObj>): 
- flags: (  valid,   locked,  reset) --- data: 0x14b36f50 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17cfb650 --- key: 
 Found 1 proxy for ClassID 9983 (std::vector< ElementLink<MapStringFloat> >): 
- flags: (  valid,   locked,  reset) --- data: 0x142dfa90 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17e639f0 --- key: 
 Found 1 proxy for ClassID 9984 (std::list< ElementLink< std::vector<float> > >): 
- flags: (  valid,   locked,  reset) --- data: 0x142de370 --- key: WriteData
+ flags: (  valid,   locked,  reset) --- data: 0x17e88140 --- key: WriteData
 Found 1 proxy for ClassID 33347479 (SG::AuxVectorBase): 
- flags: (  valid,   locked,  reset) --- data: 0x14b36f50 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17cfb650 --- key: 
 Found 1 proxy for ClassID 55596997 (EventContext): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x142de870 --- key: EventContext
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x17e63810 --- key: EventContext
 Found 1 proxy for ClassID 193758082 (std::map<std::string,float>): 
- flags: (  valid,   locked,  reset) --- data: 0x142dfb30 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17e88460 --- key: 
 Found 1 proxy for ClassID 202242136 (std::vector<float>): 
- flags: (  valid,   locked,  reset) --- data: 0x142df9a0 --- key: 
+ flags: (  valid,   locked,  reset) --- data: 0x17e639a0 --- key: 
 <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> 
 
 ReadData             INFO in execute()
@@ -311,11 +309,11 @@ ReadData             INFO ListVecLinks::linked element 3
 StoreGateSvc        DEBUG retrieve(default): Retrieved const pointer to default object 
  of type std::vector< ElementLink<MapStringFloat> >(CLID 9983)
 ReadData             INFO Retrieved vector of links
-ReadData             INFO VectorMapLinks::linked element: key uno - value 1 - stored as 0x144fa73c
-ReadData             INFO VectorMapLinks::linked element: key due - value 2 - stored as 0x144fa77c
+ReadData             INFO VectorMapLinks::linked element: key uno - value 1 - stored as 0x1793163c
+ReadData             INFO VectorMapLinks::linked element: key due - value 2 - stored as 0x1793167c
 ReadData             INFO  retrieve as BaseClass, print its address: 
-ReadData             INFO 0x12129440
-ReadData             INFO 0x12128440
+ReadData             INFO 0x5b1ff40
+ReadData             INFO 0x5b1feb0
 ReadData             INFO  EventInfo :  event: 3 run: 1
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #3, run #1 3 events processed so far  <<<===
 StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
@@ -331,12 +329,6 @@ StoreGateSvc_Impl VERBOSE Finalizing StoreGateSvc_Impl - package version StoreGa
 StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=1
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
-*****Chrono*****     INFO ****************************************************************************************************
-*****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc        INFO Time User   : Tot=   60 [ms]                                             #=  1
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
 ApplicationMgr       INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/AtlasTest/ControlTest/share/StoreGateReentrant.ref b/AtlasTest/ControlTest/share/StoreGateReentrant.ref
index 0a3c16121996ffd5a9bdf07b23fa27d528771639..5104751ec7a0088ff4ec7f87bc7bc690f409baa4 100644
--- a/AtlasTest/ControlTest/share/StoreGateReentrant.ref
+++ b/AtlasTest/ControlTest/share/StoreGateReentrant.ref
@@ -1,31 +1,30 @@
-Wed Sep  4 16:52:24 CEST 2019
+Sat Jun 27 03:47:03 CEST 2020
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [WorkDir-22.0.5] [x86_64-centos7-gcc8-opt] [dvbase.AthContainers-20190902/498e6d57a471] -- built on [2019-09-04T1645]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "AthExStoreGateExample/StoreGateExample_Reentrant_jobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5534 configurables from 10 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v32r1)
-                                          running on lxplus776.cern.ch on Wed Sep  4 16:52:34 2019
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
+                                          running on lxplus755.cern.ch on Sat Jun 27 03:47:16 2020
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
-StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 3273 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 7027 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
-ClassIDSvc           INFO  getRegistryEntries: read 925 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1095 CLIDRegistry entries for module ALL
 WriteDataReentrant   INFO in initialize()
 StoreGateSvc        DEBUG Property update for OutputLevel : new value = 1
 StoreGateSvc        DEBUG Service base class initialized successfully
@@ -38,7 +37,6 @@ StoreGateSvc_Impl VERBOSE ServiceLocatorHelper::service: found service EventPers
 StoreGateSvc_Impl VERBOSE ServiceLocatorHelper::service: found service ClassIDSvc
 ClassIDSvc           INFO  getRegistryEntries: read 423 CLIDRegistry entries for module ALL
 ReadDataReentrant    INFO in initialize()
-HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr       INFO Application Manager Started successfully
 AthenaEventLoopMgr   INFO   ===>>>  start of run 1    <<<===
@@ -46,9 +44,9 @@ AthenaEventLoopMgr   INFO   ===>>>  start processing event #1, run #1 0 events p
 WriteDataReentrant   INFO in execute()
 WriteDataReentrantWARNING we expect  an error message here
 StoreGateSvc_Impl WARNING  setupProxy:: error setting up proxy for key dobj and clid 8000
- Pre-existing valid DataProxy @0x11776b40 found in Store for key dobj with clid 8000
-StoreGateSvc_Impl WARNING record_impl: Problem setting up the proxy for object @0x11294b80
- recorded with key dobj of type MyDataObj (CLID 8000) in DataObject @0x1344f270
+ Pre-existing valid DataProxy @0x16fb5180 found in Store for key dobj with clid 8000
+StoreGateSvc_Impl WARNING record_impl: Problem setting up the proxy for object @0x16f06670
+ recorded with key dobj of type MyDataObj (CLID 8000) in DataObject @0x18f4c3c0
 VarHandle(Store...  ERROR FILE:LINE (StatusCode SG::VarHandleBase::record_impl(std::unique_ptr<DataObject>, void*, bool, bool)): code FAILURE: recordObject failed
 WriteDataReentrantWARNING end of error message
 WriteDataReentrant   INFO  registered all data objects
@@ -56,33 +54,33 @@ WriteDataReentrant   INFO  StoreGate structure before returning from execute
 <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> 
 SGImplSvc(StoreGateSvc_Impl)::dump():
 Found 2 proxies for ClassID 1434 (BaseClass): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344e690 --- key: WriteDataReentrant
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f220 --- key: dobj
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25c70 --- key: WriteDataReentrant
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f4c320 --- key: dobj
 Found 1 proxy for ClassID 2101 (EventInfo): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344e870 --- key: 
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25810 --- key: 
 Found 6 proxies for ClassID 8000 (MyDataObj): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344e690 --- key: WriteDataReentrant
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f220 --- key: dobj
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f950 --- key: dobj2
- flags: (  valid,   locked,  reset) --- data: 0x1344e640 --- key: x1
- flags: (  valid,   locked,  reset) --- data: 0x1344e460 --- key: x2
- flags: (  valid,   locked,  reset) --- data: 0x1344e370 --- key: x3
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25c70 --- key: WriteDataReentrant
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f4c320 --- key: dobj
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f258b0 --- key: dobj2
+ flags: (  valid,   locked,  reset) --- data: 0x18f4c000 --- key: x1
+ flags: (  valid,   locked,  reset) --- data: 0x18f4c0a0 --- key: x2
+ flags: (  valid,   locked,  reset) --- data: 0x18f4c140 --- key: x3
 Found 1 proxy for ClassID 9967 (DataVector<MyContObj>): 
- flags: (  valid,   locked,  reset) --- data: 0x13ca6cb0 --- key: cobj
+ flags: (  valid,   locked,  reset) --- data: 0x1722f2d0 --- key: cobj
 Found 1 proxy for ClassID 9983 (std::vector< ElementLink<MapStringFloat> >): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f810 --- key: linkvec
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25590 --- key: linkvec
 Found 1 proxy for ClassID 9984 (std::list< ElementLink< std::vector<float> > >): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f8b0 --- key: WriteDataReentrant
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25680 --- key: WriteDataReentrant
 Found 1 proxy for ClassID 33347479 (SG::AuxVectorBase): 
- flags: (  valid,   locked,  reset) --- data: 0x13ca6cb0 --- key: cobj
+ flags: (  valid,   locked,  reset) --- data: 0x1722f2d0 --- key: cobj
 Found 1 proxy for ClassID 55596997 (EventContext): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f040 --- key: EventContext
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25ea0 --- key: EventContext
 Found 1 proxy for ClassID 193758082 (std::map<std::string,float>): 
- flags: (  valid,   locked,  reset) --- data: 0x1344ed70 --- key: mkey
+ flags: (  valid,   locked,  reset) --- data: 0x18f25cc0 --- key: mkey
 Found 1 proxy for ClassID 202242136 (std::vector<float>): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344fae0 --- key: vFloat
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f4c280 --- key: vFloat
 Found 1 proxy for ClassID 289238765 (TestDataObject): 
- flags: (  valid,   locked,  reset) --- data: 0x1344e820 --- key: testobj
+ flags: (  valid,   locked,  reset) --- data: 0x18f25c20 --- key: testobj
 <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> 
 
 ReadDataReentrant    INFO in execute()
@@ -93,17 +91,17 @@ ReadDataReentrant    INFO pVec [1] = 2
 ReadDataReentrant    INFO pVec [2] = 3
 ReadDataReentrant    INFO ListVecLinks::linked element 1
 ReadDataReentrant    INFO ListVecLinks::linked element 3
-ReadDataReentrant    INFO VectorMapLinks::linked element: key uno - value 1 - stored as 0x13ca0d3c
-ReadDataReentrant    INFO VectorMapLinks::linked element: key due - value 2 - stored as 0x13ca0d7c
+ReadDataReentrant    INFO VectorMapLinks::linked element: key uno - value 1 - stored as 0x1722d0bc
+ReadDataReentrant    INFO VectorMapLinks::linked element: key due - value 2 - stored as 0x1722d0fc
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #1, run #1 1 events processed so far  <<<===
 StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #2, run #1 1 events processed so far  <<<===
 WriteDataReentrant   INFO in execute()
 WriteDataReentrantWARNING we expect  an error message here
 StoreGateSvc_Impl WARNING  setupProxy:: error setting up proxy for key dobj and clid 8000
- Pre-existing valid DataProxy @0x11776b40 found in Store for key dobj with clid 8000
-StoreGateSvc_Impl WARNING record_impl: Problem setting up the proxy for object @0x11294480
- recorded with key dobj of type MyDataObj (CLID 8000) in DataObject @0x1344ed70
+ Pre-existing valid DataProxy @0x16fb5180 found in Store for key dobj with clid 8000
+StoreGateSvc_Impl WARNING record_impl: Problem setting up the proxy for object @0x6be3ea0
+ recorded with key dobj of type MyDataObj (CLID 8000) in DataObject @0x18f25cc0
 VarHandle(Store...  ERROR FILE:LINE (StatusCode SG::VarHandleBase::record_impl(std::unique_ptr<DataObject>, void*, bool, bool)): code FAILURE: recordObject failed
 WriteDataReentrantWARNING end of error message
 WriteDataReentrant   INFO  registered all data objects
@@ -111,33 +109,33 @@ WriteDataReentrant   INFO  StoreGate structure before returning from execute
 <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> 
 SGImplSvc(StoreGateSvc_Impl)::dump():
 Found 2 proxies for ClassID 1434 (BaseClass): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f9a0 --- key: WriteDataReentrant
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f950 --- key: dobj
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f259a0 --- key: WriteDataReentrant
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f258b0 --- key: dobj
 Found 1 proxy for ClassID 2101 (EventInfo): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f810 --- key: 
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25590 --- key: 
 Found 6 proxies for ClassID 8000 (MyDataObj): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f9a0 --- key: WriteDataReentrant
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f950 --- key: dobj
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f040 --- key: dobj2
- flags: (  valid,   locked,  reset) --- data: 0x1344fae0 --- key: x1
- flags: (  valid,   locked,  reset) --- data: 0x1344fb30 --- key: x2
- flags: (  valid,   locked,  reset) --- data: 0x1344e370 --- key: x3
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f259a0 --- key: WriteDataReentrant
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f258b0 --- key: dobj
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25ea0 --- key: dobj2
+ flags: (  valid,   locked,  reset) --- data: 0x18f4c280 --- key: x1
+ flags: (  valid,   locked,  reset) --- data: 0x18f4c460 --- key: x2
+ flags: (  valid,   locked,  reset) --- data: 0x18f4c140 --- key: x3
 Found 1 proxy for ClassID 9967 (DataVector<MyContObj>): 
- flags: (  valid,   locked,  reset) --- data: 0x13ca6cb0 --- key: cobj
+ flags: (  valid,   locked,  reset) --- data: 0x1722f2d0 --- key: cobj
 Found 1 proxy for ClassID 9983 (std::vector< ElementLink<MapStringFloat> >): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f270 --- key: linkvec
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f4c3c0 --- key: linkvec
 Found 1 proxy for ClassID 9984 (std::list< ElementLink< std::vector<float> > >): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344e870 --- key: WriteDataReentrant
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25810 --- key: WriteDataReentrant
 Found 1 proxy for ClassID 33347479 (SG::AuxVectorBase): 
- flags: (  valid,   locked,  reset) --- data: 0x13ca6cb0 --- key: cobj
+ flags: (  valid,   locked,  reset) --- data: 0x1722f2d0 --- key: cobj
 Found 1 proxy for ClassID 55596997 (EventContext): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f8b0 --- key: EventContext
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25680 --- key: EventContext
 Found 1 proxy for ClassID 193758082 (std::map<std::string,float>): 
- flags: (  valid,   locked,  reset) --- data: 0x1344e820 --- key: mkey
+ flags: (  valid,   locked,  reset) --- data: 0x18f25c20 --- key: mkey
 Found 1 proxy for ClassID 202242136 (std::vector<float>): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344e640 --- key: vFloat
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f4c000 --- key: vFloat
 Found 1 proxy for ClassID 289238765 (TestDataObject): 
- flags: (  valid,   locked,  reset) --- data: 0x1344f9f0 --- key: testobj
+ flags: (  valid,   locked,  reset) --- data: 0x18f25a90 --- key: testobj
 <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> 
 
 ReadDataReentrant    INFO in execute()
@@ -148,17 +146,17 @@ ReadDataReentrant    INFO pVec [1] = 2
 ReadDataReentrant    INFO pVec [2] = 3
 ReadDataReentrant    INFO ListVecLinks::linked element 1
 ReadDataReentrant    INFO ListVecLinks::linked element 3
-ReadDataReentrant    INFO VectorMapLinks::linked element: key uno - value 1 - stored as 0x13ca983c
-ReadDataReentrant    INFO VectorMapLinks::linked element: key due - value 2 - stored as 0x13ca987c
+ReadDataReentrant    INFO VectorMapLinks::linked element: key uno - value 1 - stored as 0x1723153c
+ReadDataReentrant    INFO VectorMapLinks::linked element: key due - value 2 - stored as 0x1723157c
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 2 events processed so far  <<<===
 StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #3, run #1 2 events processed so far  <<<===
 WriteDataReentrant   INFO in execute()
 WriteDataReentrantWARNING we expect  an error message here
 StoreGateSvc_Impl WARNING  setupProxy:: error setting up proxy for key dobj and clid 8000
- Pre-existing valid DataProxy @0x11776b40 found in Store for key dobj with clid 8000
-StoreGateSvc_Impl WARNING record_impl: Problem setting up the proxy for object @0x11294f30
- recorded with key dobj of type MyDataObj (CLID 8000) in DataObject @0x1344e820
+ Pre-existing valid DataProxy @0x16fb5180 found in Store for key dobj with clid 8000
+StoreGateSvc_Impl WARNING record_impl: Problem setting up the proxy for object @0x16f07020
+ recorded with key dobj of type MyDataObj (CLID 8000) in DataObject @0x18f25c20
 VarHandle(Store...  ERROR FILE:LINE (StatusCode SG::VarHandleBase::record_impl(std::unique_ptr<DataObject>, void*, bool, bool)): code FAILURE: recordObject failed
 WriteDataReentrantWARNING end of error message
 WriteDataReentrant   INFO  registered all data objects
@@ -166,33 +164,33 @@ WriteDataReentrant   INFO  StoreGate structure before returning from execute
 <<<<<<<<<<<<<<<<< Data Store Dump >>>>>>>>>>>>>>> 
 SGImplSvc(StoreGateSvc_Impl)::dump():
 Found 2 proxies for ClassID 1434 (BaseClass): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f220 --- key: WriteDataReentrant
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f040 --- key: dobj
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f4c320 --- key: WriteDataReentrant
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25ea0 --- key: dobj
 Found 1 proxy for ClassID 2101 (EventInfo): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f270 --- key: 
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f4c3c0 --- key: 
 Found 6 proxies for ClassID 8000 (MyDataObj): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f220 --- key: WriteDataReentrant
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f040 --- key: dobj
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f8b0 --- key: dobj2
- flags: (  valid,   locked,  reset) --- data: 0x1344e640 --- key: x1
- flags: (  valid,   locked,  reset) --- data: 0x1344e460 --- key: x2
- flags: (  valid,   locked,  reset) --- data: 0x1344e370 --- key: x3
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f4c320 --- key: WriteDataReentrant
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25ea0 --- key: dobj
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25680 --- key: dobj2
+ flags: (  valid,   locked,  reset) --- data: 0x18f4c000 --- key: x1
+ flags: (  valid,   locked,  reset) --- data: 0x18f4c0a0 --- key: x2
+ flags: (  valid,   locked,  reset) --- data: 0x18f4c140 --- key: x3
 Found 1 proxy for ClassID 9967 (DataVector<MyContObj>): 
- flags: (  valid,   locked,  reset) --- data: 0x13ca6cb0 --- key: cobj
+ flags: (  valid,   locked,  reset) --- data: 0x1722f2d0 --- key: cobj
 Found 1 proxy for ClassID 9983 (std::vector< ElementLink<MapStringFloat> >): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344ed70 --- key: linkvec
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25cc0 --- key: linkvec
 Found 1 proxy for ClassID 9984 (std::list< ElementLink< std::vector<float> > >): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344f810 --- key: WriteDataReentrant
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25590 --- key: WriteDataReentrant
 Found 1 proxy for ClassID 33347479 (SG::AuxVectorBase): 
- flags: (  valid,   locked,  reset) --- data: 0x13ca6cb0 --- key: cobj
+ flags: (  valid,   locked,  reset) --- data: 0x1722f2d0 --- key: cobj
 Found 1 proxy for ClassID 55596997 (EventContext): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344e870 --- key: EventContext
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f25810 --- key: EventContext
 Found 1 proxy for ClassID 193758082 (std::map<std::string,float>): 
- flags: (  valid,   locked,  reset) --- data: 0x1344f9f0 --- key: mkey
+ flags: (  valid,   locked,  reset) --- data: 0x18f25a90 --- key: mkey
 Found 1 proxy for ClassID 202242136 (std::vector<float>): 
- flags: (  valid, UNLOCKED,  reset) --- data: 0x1344fae0 --- key: vFloat
+ flags: (  valid, UNLOCKED,  reset) --- data: 0x18f4c280 --- key: vFloat
 Found 1 proxy for ClassID 289238765 (TestDataObject): 
- flags: (  valid,   locked,  reset) --- data: 0x1344e690 --- key: testobj
+ flags: (  valid,   locked,  reset) --- data: 0x18f25c70 --- key: testobj
 <<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>> 
 
 ReadDataReentrant    INFO in execute()
@@ -203,8 +201,8 @@ ReadDataReentrant    INFO pVec [1] = 2
 ReadDataReentrant    INFO pVec [2] = 3
 ReadDataReentrant    INFO ListVecLinks::linked element 1
 ReadDataReentrant    INFO ListVecLinks::linked element 3
-ReadDataReentrant    INFO VectorMapLinks::linked element: key uno - value 1 - stored as 0x13ca0d3c
-ReadDataReentrant    INFO VectorMapLinks::linked element: key due - value 2 - stored as 0x13ca0d7c
+ReadDataReentrant    INFO VectorMapLinks::linked element: key uno - value 1 - stored as 0x1722d0bc
+ReadDataReentrant    INFO VectorMapLinks::linked element: key due - value 2 - stored as 0x1722d0fc
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #3, run #1 3 events processed so far  <<<===
 StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
 StoreGateSvc      VERBOSE Stop StoreGateSvc
@@ -219,12 +217,6 @@ StoreGateSvc_Impl VERBOSE Finalizing StoreGateSvc_Impl - package version StoreGa
 StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=1
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
-*****Chrono*****     INFO ****************************************************************************************************
-*****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc        INFO Time User   : Tot=   60 [ms]                                             #=  1
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
 ApplicationMgr       INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/AtlasTest/ControlTest/share/test_handleTest.ref b/AtlasTest/ControlTest/share/test_handleTest.ref
index 4887374ef49e9e39fb3f76a1e8c598db9b68467b..6e53c9baa67898ba1c550ca1da027b4cd26fc943 100644
--- a/AtlasTest/ControlTest/share/test_handleTest.ref
+++ b/AtlasTest/ControlTest/share/test_handleTest.ref
@@ -1,39 +1,37 @@
-Mon Oct  7 11:13:32 EDT 2019
+Sat Jun 27 03:36:53 CEST 2020
+Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [?-21.0.0] [?] [?/?] -- built on [?]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "AthExStoreGateExample/HandleTest_jobOptions.py"
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
-Py:ConfigurableDb    INFO Read module info for 820 configurables from 2 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
-# setting LC_ALL to "C"
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99)
-                                          running on karma on Mon Oct  7 11:13:35 2019
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
+                                          running on lxplus755.cern.ch on Sat Jun 27 03:37:03 2020
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
-StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 3699 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 7027 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
-ClassIDSvc           INFO  getRegistryEntries: read 751 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 705 CLIDRegistry entries for module ALL
 xAODMaker::Even...   INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
-ClassIDSvc           INFO  getRegistryEntries: read 829 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 830 CLIDRegistry entries for module ALL
 xAODMaker::Even...   INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
 xAODMaker::Even...WARNING Beam conditions service not available
 xAODMaker::Even...WARNING Will not fill beam spot information into xAOD::EventInfo
 ClassIDSvc           INFO  getRegistryEntries: read 423 CLIDRegistry entries for module ALL
 testalg2          WARNING Implicit circular data dependency detected for id  ( 'MyDataObj' , 'StoreGateSvc+obj' ) 
-HistogramPersis...WARNING Histograms saving not required.
 EventSelector        INFO  Enter McEventSelector Initialization 
 AthenaEventLoopMgr   INFO Setup EventSelector service EventSelector
 ApplicationMgr       INFO Application Manager Initialized successfully
@@ -48,12 +46,6 @@ IncidentProcAlg2     INFO Finalize
 EventSelector        INFO finalize
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
-*****Chrono*****     INFO ****************************************************************************************************
-*****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc        INFO Time User   : Tot=   90 [ms]                                             #=  1
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
 ApplicationMgr       INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/AtlasTest/ControlTest/share/test_interactive_athena.ref b/AtlasTest/ControlTest/share/test_interactive_athena.ref
index 0fe86f693d01963dfcfa141e129ed8e649891008..161461ebda64a4a60369eba707a8961ac0a9fd6b 100644
--- a/AtlasTest/ControlTest/share/test_interactive_athena.ref
+++ b/AtlasTest/ControlTest/share/test_interactive_athena.ref
@@ -1,27 +1,25 @@
-Fri Aug 24 22:12:38 CEST 2018
+Sat Jun 27 03:19:59 CEST 2020
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [AthenaWorkDir-22.0.1] [x86_64-slc6-gcc62-opt] [atlas-work3/62743ef4d17] -- built on [2018-08-24T1729]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "ControlTest/test_interactive_athena.py"
-Py:ConfigurableDb    INFO Read module info for 5508 configurables from 48 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
-[?1034hApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
+ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r3)
-                                          running on lxplus087.cern.ch on Fri Aug 24 22:12:55 2018
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
+                                          running on lxplus755.cern.ch on Sat Jun 27 03:20:10 2020
 ====================================================================================================================================
-ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
-StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 2918 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 7027 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
@@ -29,7 +27,6 @@ PyComponentMgr       INFO Initializing PyComponentMgr...
 pyalg                INFO Initializing pyalg...
 Py:pyalg             INFO initialize...
 Py:pyalg             INFO initialize... [ok]
-HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr       INFO Application Manager Started successfully
 AthenaEventLoopMgr   INFO   ===>>>  start of run 1    <<<===
@@ -89,8 +86,8 @@ Py:pyalg             INFO --> evt: 10/11
 Py:pyalg             INFO execute... [ok]
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #11, run #1 11 events processed so far  <<<===
 test lock
-ClassIDSvc           INFO  getRegistryEntries: read 1520 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 393 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1280 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 174 CLIDRegistry entries for module ALL
 done test lock
 ApplicationMgr       INFO Application Manager Stopped successfully
 IncidentProcAlg1     INFO Finalize
@@ -102,12 +99,6 @@ IncidentProcAlg2     INFO Finalize
 PyComponentMgr       INFO Finalizing PyComponentMgr...
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
-*****Chrono*****     INFO ****************************************************************************************************
-*****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc        INFO Time User   : Tot= 2.73  [s]                                             #=  1
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
 ================================================================================
 test [OK]
diff --git a/Calorimeter/CaloG4Sim/CMakeLists.txt b/Calorimeter/CaloG4Sim/CMakeLists.txt
index 1d6c8725c1e9e98c35f31db8908198a276b0e4ce..a67dfcaee804de23434b9e09439a80bea7934e45 100644
--- a/Calorimeter/CaloG4Sim/CMakeLists.txt
+++ b/Calorimeter/CaloG4Sim/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( CaloG4Sim )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools
-                          PRIVATE
-                          Control/CxxUtils
-                          Simulation/G4Sim/MCTruth )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Calorimeter/CaloRec/src/CaloClusterCorrDBWriter.cxx b/Calorimeter/CaloRec/src/CaloClusterCorrDBWriter.cxx
index 2e95fc970ff4c679c8efb820954fc41049ce9d8c..0e0f94f410db36dd421486bb81e21bed1becf0a3 100644
--- a/Calorimeter/CaloRec/src/CaloClusterCorrDBWriter.cxx
+++ b/Calorimeter/CaloRec/src/CaloClusterCorrDBWriter.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 //-----------------------------------------------------------------------
@@ -55,7 +55,7 @@ StatusCode CaloClusterCorrDBWriter::initialize()
   // allocate tools derived from ToolsWithConstants
   std::vector<std::string>::const_iterator firstTool=m_correctionToolNames.begin();
   std::vector<std::string>::const_iterator lastTool =m_correctionToolNames.end();
-  for ( ; firstTool != lastTool; firstTool++ ) {
+  for ( ; firstTool != lastTool; ++firstTool ) {
     IAlgTool* algToolPtr;
     ListItem  clusAlgoTool(*firstTool);
     StatusCode scTool = p_toolSvc->retrieveTool(clusAlgoTool.type(),
diff --git a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx
index f8265012137791c30e6ff08a2a26fab87a81c796..4f704e4a5e00d08f8940b95964c99477b43f08f5 100644
--- a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx
+++ b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx
@@ -39,6 +39,7 @@
 #include <algorithm>
 #include <iterator>
 #include <sstream>
+#include <memory>
 
 #include "xAODCaloEvent/CaloClusterKineHelper.h"
 
@@ -581,7 +582,7 @@ CaloTopoClusterMaker::execute(const EventContext& ctx,
   //Create temporary list of proto-clusters 
   //Clusters below Et cut will be dropped. 
   //The remaining clusters will be sorted in E_t before storing 
-  std::vector<CaloProtoCluster*> sortClusters;
+  std::vector<std::unique_ptr<CaloProtoCluster> > sortClusters;
   sortClusters.reserve (myHashClusters.size());
 
   for (HashCluster* tmpCluster : myHashClusters) {
@@ -595,25 +596,24 @@ CaloTopoClusterMaker::execute(const EventContext& ctx,
 	addCluster = true;
     }
     if ( addCluster) {
-      CaloProtoCluster* myCluster = new CaloProtoCluster(cellCollLink);
+      std::unique_ptr<CaloProtoCluster> myCluster = std::make_unique<CaloProtoCluster>(cellCollLink);
+      //CaloProtoCluster* myCluster = new CaloProtoCluster(cellCollLink);
       myCluster->getCellLinks()->reserve(tmpCluster->size());
 
       for (CaloTopoTmpClusterCell* cell : *tmpCluster) {
-	size_t iCell = cell->getCaloCell();
+	const size_t iCell = cell->getCaloCell();
 	myCluster->addCell(iCell,1.);
       }
-      float cl_et = myCluster->et();
+      const float cl_et = myCluster->et();
       if ( (m_seedCutsInAbsE ? std::abs(cl_et) : cl_et) > m_clusterEtorAbsEtCut ) {
-	sortClusters.push_back(myCluster);
+	sortClusters.push_back(std::move(myCluster));
       } 
-      else {
-	delete myCluster;
-      }
     }
   }
 
   // Sort the clusters according to Et 
-  std::sort(sortClusters.begin(),sortClusters.end(),[](CaloProtoCluster* pc1, CaloProtoCluster* pc2) {
+  std::sort(sortClusters.begin(),sortClusters.end(),[](const std::unique_ptr<CaloProtoCluster>& pc1, 
+						       const std::unique_ptr<CaloProtoCluster>& pc2) {
       //As in CaloUtils/CaloClusterEtSort. 
       //assign to volatile to avoid excess precison on in FP unit on x386 machines
       volatile double et1(pc1->et());
@@ -625,11 +625,10 @@ CaloTopoClusterMaker::execute(const EventContext& ctx,
  // add to cluster container
   clusColl->reserve(sortClusters.size());
 
-  for (CaloProtoCluster* protoCluster: sortClusters) {
+  for (const auto& protoCluster: sortClusters) {
     xAOD::CaloCluster* xAODCluster=new xAOD::CaloCluster();
     clusColl->push_back(xAODCluster);
     xAODCluster->addCellLink(protoCluster->releaseCellLinks());//Hand over ownership to xAOD::CaloCluster
-    delete protoCluster;
     xAODCluster->setClusterSize(m_clusterSize);
     CaloClusterKineHelper::calculateKine(xAODCluster,false,true); //No weight at this point! 
   }
diff --git a/Calorimeter/CaloRec/src/CaloTopoClusterSplitter.cxx b/Calorimeter/CaloRec/src/CaloTopoClusterSplitter.cxx
index 25d7f92f76b69e9d83a5170ba8a1083c46219e87..732694e5738a72e9ad1088ca1f1c5ce5ff3654b9 100644
--- a/Calorimeter/CaloRec/src/CaloTopoClusterSplitter.cxx
+++ b/Calorimeter/CaloRec/src/CaloTopoClusterSplitter.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 //-----------------------------------------------------------------------
@@ -37,6 +37,7 @@
 #include <algorithm>
 #include <iterator>
 #include <sstream>
+#include <memory>
 
 
 using HepGeom::Vector3D;
@@ -119,7 +120,7 @@ StatusCode CaloTopoClusterSplitter::initialize()
   //--- check sampling names to use
   std::vector<std::string>::iterator samplingIter = m_samplingNames.begin(); 
   std::vector<std::string>::iterator samplingIterEnd = m_samplingNames.end(); 
-  for(; samplingIter!=samplingIterEnd; samplingIter++) { 
+  for(; samplingIter!=samplingIterEnd; ++samplingIter) { 
     if ( *samplingIter == "PreSamplerB" ) 
       m_validSamplings.insert(CaloCell_ID::PreSamplerB);
     else if ( *samplingIter == "EMB1" ) 
@@ -183,7 +184,7 @@ StatusCode CaloTopoClusterSplitter::initialize()
 
   msg(MSG::INFO) << "Samplings to consider for local maxima:";
   samplingIter = m_samplingNames.begin(); 
-  for(; samplingIter!=samplingIterEnd; samplingIter++)  
+  for(; samplingIter!=samplingIterEnd; ++samplingIter)  
     msg() << " " << *samplingIter;
   msg() << endmsg;
 
@@ -191,7 +192,7 @@ StatusCode CaloTopoClusterSplitter::initialize()
   m_maxSampling=0;
   std::set<int>::const_iterator vSamplingIter = m_validSamplings.begin(); 
   std::set<int>::const_iterator vSamplingIterEnd = m_validSamplings.end(); 
-  for(; vSamplingIter!=vSamplingIterEnd; vSamplingIter++) {
+  for(; vSamplingIter!=vSamplingIterEnd; ++vSamplingIter) {
     if ( (*vSamplingIter) > m_maxSampling ) 
       m_maxSampling = (*vSamplingIter);
     if ( (*vSamplingIter) < m_minSampling ) 
@@ -200,14 +201,14 @@ StatusCode CaloTopoClusterSplitter::initialize()
 
   m_useSampling.resize(m_maxSampling-m_minSampling+1,false);
 
-  for(vSamplingIter = m_validSamplings.begin(); vSamplingIter!=vSamplingIterEnd; vSamplingIter++) {
+  for(vSamplingIter = m_validSamplings.begin(); vSamplingIter!=vSamplingIterEnd; ++vSamplingIter) {
     m_useSampling[(*vSamplingIter)-m_minSampling] = true;
   }
 
   //--- check sampling names to use
   samplingIter = m_secondarySamplingNames.begin(); 
   samplingIterEnd = m_secondarySamplingNames.end(); 
-  for(; samplingIter!=samplingIterEnd; samplingIter++) { 
+  for(; samplingIter!=samplingIterEnd; ++samplingIter) { 
     if ( *samplingIter == "PreSamplerB" ) 
       m_validSecondarySamplings.insert(CaloCell_ID::PreSamplerB);
     else if ( *samplingIter == "EMB1" ) 
@@ -271,7 +272,7 @@ StatusCode CaloTopoClusterSplitter::initialize()
 
   msg(MSG::INFO) << "Secondary samplings to consider for local maxima:";
   samplingIter = m_secondarySamplingNames.begin(); 
-  for(; samplingIter!=samplingIterEnd; samplingIter++)  
+  for(; samplingIter!=samplingIterEnd; ++samplingIter)  
     msg() << " " << *samplingIter;
   msg() << endmsg;
 
@@ -279,7 +280,7 @@ StatusCode CaloTopoClusterSplitter::initialize()
   m_maxSecondarySampling=0;
   vSamplingIter = m_validSecondarySamplings.begin(); 
   vSamplingIterEnd = m_validSecondarySamplings.end(); 
-  for(; vSamplingIter!=vSamplingIterEnd; vSamplingIter++) {
+  for(; vSamplingIter!=vSamplingIterEnd; ++vSamplingIter) {
     if ( (*vSamplingIter) > m_maxSecondarySampling ) 
       m_maxSecondarySampling = (*vSamplingIter);
     if ( (*vSamplingIter) < m_minSecondarySampling ) 
@@ -288,7 +289,7 @@ StatusCode CaloTopoClusterSplitter::initialize()
 
   m_useSecondarySampling.resize(m_maxSecondarySampling-m_minSecondarySampling+1,false);
 
-  for(vSamplingIter = m_validSecondarySamplings.begin(); vSamplingIter!=vSamplingIterEnd; vSamplingIter++) {
+  for(vSamplingIter = m_validSecondarySamplings.begin(); vSamplingIter!=vSamplingIterEnd; ++vSamplingIter) {
     m_useSecondarySampling[(*vSamplingIter)-m_minSecondarySampling] = true;
   }
 
@@ -363,7 +364,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
   }
 
 
-  for (; clusCollIter != clusCollIterEnd; clusCollIter++, iClusterNumber++ ){
+  for (; clusCollIter != clusCollIterEnd; ++clusCollIter, ++iClusterNumber ){
     xAOD::CaloCluster* parentCluster = (*clusCollIter);
     CaloClusterCellLink* cellLinks=parentCluster->getOwnCellLinks();
     if (!cellLinks) {
@@ -582,7 +583,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
 		    
 		    // loop over all seed cells and check if cells match
 		    for(;hashCellIter!=hashCellIterEnd 
-			  && isLocalMax;hashCellIter++) {
+			  && isLocalMax;++hashCellIter) {
 		      if ( cellVector[(unsigned int)nId - m_hashMin] 
 			   == (*hashCellIter) )
                       {
@@ -639,7 +640,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
 		    
 		    // loop over all seed cells and check if cells match
 		    for(;hashCellIter!=hashCellIterEnd 
-			  && isLocalMax;hashCellIter++) {
+			  && isLocalMax;++hashCellIter) {
 		      if ( cellVector[(unsigned int)nId - m_hashMin] 
 			   == (*hashCellIter) )
                       {
@@ -693,7 +694,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
   hashCellIterEnd=mySeedCells.end();
   
   // loop over all seed cells and set them Used
-  for(;hashCellIter!=hashCellIterEnd;hashCellIter++) {
+  for(;hashCellIter!=hashCellIterEnd;++hashCellIter) {
     hashCellIter->getCaloTopoTmpClusterCell()->setUsed();
     HashCluster *myCluster = hashCellIter->getCaloTopoTmpClusterCell()->getCaloTopoTmpHashCluster();
     myCluster->setContainsLocalMax();
@@ -711,7 +712,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
     hashCellIterEnd=mySeedCells.end();
 
     // loop over all current neighbor cells (for Seed Growing Algo)
-    for(;hashCellIter!=hashCellIterEnd;hashCellIter++) {
+    for(;hashCellIter!=hashCellIterEnd;++hashCellIter) {
       msg(MSG::DEBUG) << " SeedCell [" 
 		      << hashCellIter->getCaloTopoTmpClusterCell()->getSubDet() 
 		      << "|" 
@@ -731,7 +732,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
     hashCellIterEnd=mySeedCells.end();
     
     // loop over all current neighbor cells (for Seed Growing Algo)
-    for(;hashCellIter!=hashCellIterEnd;hashCellIter++) {
+    for(;hashCellIter!=hashCellIterEnd;++hashCellIter) {
       CaloTopoSplitterClusterCell* pClusCell = hashCellIter->getCaloTopoTmpClusterCell();
       IdentifierHash hashid = pClusCell->getID();
       HashCluster *myCluster = pClusCell->getCaloTopoTmpHashCluster();
@@ -819,13 +820,14 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
 	      // myNextCell list it is a shared cell, added to the
 	      // list of shared cells and removed from the cluster it
 	      // first was added to
+              // cppcheck-suppress invalidContainer; false positive
 	      while ( !isRemoved && nextCellIter != nextCellIterEnd ) {
 		if ( (*nextCellIter) == neighborCell ) {
-		  myNextCells.erase(nextCellIter);
+		  nextCellIter = myNextCells.erase(nextCellIter);
 		  isRemoved=true;
 		}
 		else
-		  nextCellIter++;
+		  ++nextCellIter;
 	      }
 	      if ( isRemoved ) {
 		pNCell->setShared();
@@ -849,7 +851,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
 		// with other local maxima
 		HashCluster::iterator clusCellIter=toKill->begin();
 		HashCluster::iterator clusCellIterEnd = toKill->end();
-		for(;clusCellIter!=clusCellIterEnd;clusCellIter++) {
+		for(;clusCellIter!=clusCellIterEnd;++clusCellIter) {
 		  clusCellIter->setCaloTopoTmpHashCluster(toKeep);
 		}
 		toKeep->add(*toKill);
@@ -898,7 +900,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
       hashCellIterEnd=mySeedCells.end();
     
       // loop over all current neighbor cells (for Seed Growing Algo)
-      for(;hashCellIter!=hashCellIterEnd;hashCellIter++) {
+      for(;hashCellIter!=hashCellIterEnd;++hashCellIter) {
 	CaloTopoSplitterClusterCell* pClusCell = hashCellIter->getCaloTopoTmpClusterCell();
 	IdentifierHash hashid = pClusCell->getID();
 	HashCluster *myCluster = pClusCell->getCaloTopoTmpHashCluster();
@@ -1009,7 +1011,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
     // all weights
     hashCellIter= sharedCellList.begin();
     hashCellIterEnd=sharedCellList.end();
-    for(;hashCellIter!=hashCellIterEnd;hashCellIter++) {
+    for(;hashCellIter!=hashCellIterEnd;++hashCellIter) {
       CaloTopoSplitterClusterCell* pClusCell = hashCellIter->getCaloTopoTmpClusterCell();
       float e1 = (pClusCell->getCaloTopoTmpHashCluster())->getEnergy();
       float e2 = (pClusCell->getSecondCaloTopoTmpHashCluster())->getEnergy();
@@ -1037,7 +1039,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
     // respective clusters
     hashCellIter= sharedCellList.begin();
     hashCellIterEnd=sharedCellList.end();
-    for(;hashCellIter!=hashCellIterEnd;hashCellIter++) {
+    for(;hashCellIter!=hashCellIterEnd;++hashCellIter) {
       CaloTopoSplitterClusterCell* pClusCell = hashCellIter->getCaloTopoTmpClusterCell();
       HashCluster *firstCluster = pClusCell->getCaloTopoTmpHashCluster();
       HashCluster *secondCluster = pClusCell->getSecondCaloTopoTmpHashCluster();
@@ -1051,25 +1053,22 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
   
   // create cluster list for the purpose of sorting in E_t before storing 
   // in the cluster collection
-  std::vector<CaloProtoCluster*> myCaloClusters;
+  std::vector<std::unique_ptr<CaloProtoCluster> > myCaloClusters;
   myCaloClusters.reserve (500);
-  std::vector<CaloProtoCluster*> myRestClusters;
-  myRestClusters.resize(clusColl->size(),0);  // this has a 0 pointer as default!
+  std::vector<std::unique_ptr<CaloProtoCluster> > myRestClusters;
+  myRestClusters.resize(clusColl->size());  // this has a 0 pointer as default!
   std::vector<HashCluster *>::iterator hashClusIter = myHashClusters.begin();
   std::vector<HashCluster *>::iterator hashClusIterEnd=myHashClusters.end();
   for (;hashClusIter!=hashClusIterEnd;++hashClusIter) {
     HashCluster * tmpCluster = (*hashClusIter);
     if ( tmpCluster->size() > 1 ) {
       // local maximum implies at least 2 cells are in the cluster ...
-      //      CaloCluster *myCluster = new CaloCluster();
-      //xAOD::CaloCluster *myCluster = CaloClusterStoreHelper::makeCluster(myCellColl);
-      CaloProtoCluster* myCluster=new CaloProtoCluster(myCellCollLink);
-
-      ATH_MSG_DEBUG("[CaloCluster@" << myCluster << "] created in <myCaloClusters>.");
+      std::unique_ptr<CaloProtoCluster> myCluster = std::make_unique<CaloProtoCluster>(myCellCollLink);
+      ATH_MSG_DEBUG("[CaloCluster@" << myCluster.get() << "] created in <myCaloClusters>.");
       HashCluster::iterator clusCellIter=tmpCluster->begin();
       HashCluster::iterator clusCellIterEnd=tmpCluster->end();
       myCluster->getCellLinks()->reserve(tmpCluster->size());
-      for(;clusCellIter!=clusCellIterEnd;clusCellIter++) {
+      for(;clusCellIter!=clusCellIterEnd;++clusCellIter) {
 	CaloTopoSplitterClusterCell *pClusCell =  *clusCellIter;
 	xAOD::CaloCluster::cell_iterator itrCell = pClusCell->getCellIterator();
 	double myWeight = itrCell.weight();//pClusCell->getParentCluster()->getCellWeight(itrCell);
@@ -1082,9 +1081,9 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
 	myCluster->addCell(itrCell.index(),myWeight);
       }
       //CaloClusterKineHelper::calculateKine(myCluster);
-      ATH_MSG_DEBUG("[CaloCluster@" << myCluster << "] size: " << myCluster->size());
+      ATH_MSG_DEBUG("[CaloCluster@" << myCluster.get() << "] size: " << myCluster->size());
       //myCluster->setClusterSize(clusterSize);
-      myCaloClusters.push_back(myCluster);
+      myCaloClusters.push_back(std::move(myCluster));
     }
     else if ( tmpCluster->size() == 1 ) {
       // either cells belonging to a cluster with no local maximum
@@ -1096,21 +1095,21 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
 	// any local max are copied anyways
 	
 	if (!myRestClusters[tmpCluster->getParentClusterIndex()]) {
-	  myRestClusters[tmpCluster->getParentClusterIndex()] = new CaloProtoCluster(myCellColl);
+	  myRestClusters[tmpCluster->getParentClusterIndex()] = std::make_unique<CaloProtoCluster>(myCellColl);
 	}
-	ATH_MSG_DEBUG("[CaloCluster@" << myRestClusters[tmpCluster->getParentClusterIndex()]  
+	ATH_MSG_DEBUG("[CaloCluster@" << myRestClusters[tmpCluster->getParentClusterIndex()].get()  
 		      << "] created in <myRestClusters>");
 	myRestClusters[tmpCluster->getParentClusterIndex()]->getCellLinks()->reserve(tmpCluster->size());
 	HashCluster::iterator clusCellIter=tmpCluster->begin();
 	HashCluster::iterator clusCellIterEnd=tmpCluster->end();
-	for(;clusCellIter!=clusCellIterEnd;clusCellIter++) {
+	for(;clusCellIter!=clusCellIterEnd;++clusCellIter) {
 	  CaloTopoSplitterClusterCell *pClusCell =  *clusCellIter;
 	  xAOD::CaloCluster::cell_iterator itrCell = pClusCell->getCellIterator();
 	  const double myWeight = itrCell.weight();
 	  myRestClusters[tmpCluster->getParentClusterIndex()]->addCell(itrCell.index(),myWeight);
 	}
 	//CaloClusterKineHelper::calculateKine(myRestClusters[tmpCluster->getParentClusterIndex()]);
-	ATH_MSG_DEBUG("[CaloCluster@" << myRestClusters[tmpCluster->getParentClusterIndex()] 
+	ATH_MSG_DEBUG("[CaloCluster@" << myRestClusters[tmpCluster->getParentClusterIndex()].get()
 		      << "] size: " << myRestClusters[tmpCluster->getParentClusterIndex()]->size());
 	//myRestClusters[tmpCluster->getParentClusterIndex()]->setClusterSize(clusterSize);
       }
@@ -1121,26 +1120,26 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
   // to the list
   iClusterNumber = 0;
   clusCollIter    = clusColl->begin();
-  for (; clusCollIter != clusCollIterEnd; clusCollIter++,iClusterNumber++){
+  for (; clusCollIter != clusCollIterEnd; ++clusCollIter,++iClusterNumber){
     const xAOD::CaloCluster* parentCluster = (*clusCollIter);
     if ( !hasLocalMaxVector[iClusterNumber] ) {
       //xAOD::CaloCluster *myClone = new xAOD::CaloCluster(*parentCluster);
-      myCaloClusters.push_back(new CaloProtoCluster(parentCluster->getCellLinks()));
-      ATH_MSG_DEBUG("[CaloProtoCluster@" << myCaloClusters.back() << "] with " << myCaloClusters.back()->size() 
-		    << "cells cloned from " << parentCluster << " with " << parentCluster->size()
-		    <<" cells");
+      myCaloClusters.push_back(std::make_unique<CaloProtoCluster>(parentCluster->getCellLinks()));
+      ATH_MSG_DEBUG("[CaloProtoCluster@" << myCaloClusters.back().get() << "] with " 
+		    << myCaloClusters.back()->size() << "cells cloned from " 
+		    << parentCluster << " with " << parentCluster->size() <<" cells");
     }
     else if (myRestClusters[iClusterNumber]) {
-      myCaloClusters.push_back(myRestClusters[iClusterNumber]);
-      ATH_MSG_DEBUG("[CaloCluster@" << myRestClusters[iClusterNumber]
+      ATH_MSG_DEBUG("[CaloCluster@" << myRestClusters[iClusterNumber].get()
 		    << "] pushed into <myCaloClusters> with "
 		    << myRestClusters[iClusterNumber]->size() << " cells");
+      myCaloClusters.push_back(std::move(myRestClusters[iClusterNumber]));
     }
   }
 
-  // Sort the clusters according to Et 
   //CaloClusterEtSort::compare compareEt;
-  std::sort(myCaloClusters.begin(),myCaloClusters.end(),[](CaloProtoCluster* pc1, CaloProtoCluster* pc2) {
+  std::sort(myCaloClusters.begin(),myCaloClusters.end(),[](const std::unique_ptr<CaloProtoCluster>& pc1, 
+							   const std::unique_ptr<CaloProtoCluster>& pc2) {
       //As in CaloUtils/CaloClusterEtSort. 
       //assign to volatile to avoid excess precison on in FP unit on x386 machines
       volatile double et1(pc1->et());
@@ -1158,11 +1157,10 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx,
   int nTot(0);
   float eMax(0.);
   // add to cluster container.
-  for(CaloProtoCluster* protoCluster : myCaloClusters) {
+  for(const auto& protoCluster : myCaloClusters) {
     xAOD::CaloCluster* xAODCluster=new xAOD::CaloCluster();
     clusColl->push_back(xAODCluster);
     xAODCluster->addCellLink(protoCluster->releaseCellLinks());//Hand over ownership to xAOD::CaloCluster
-    delete protoCluster;
     xAODCluster->setClusterSize(clusterSize);
     CaloClusterKineHelper::calculateKine(xAODCluster);
     ATH_MSG_DEBUG("CaloCluster@" << xAODCluster << " pushed into "
diff --git a/Calorimeter/CaloRec/test/CaloBCIDCoeffsCondAlg_test.cxx b/Calorimeter/CaloRec/test/CaloBCIDCoeffsCondAlg_test.cxx
index 3e5368b82fd4c362c9d20b9449c11526dc9d0d18..01bbaa30e939c38cffc840b066480be251f6dc75 100644
--- a/Calorimeter/CaloRec/test/CaloBCIDCoeffsCondAlg_test.cxx
+++ b/Calorimeter/CaloRec/test/CaloBCIDCoeffsCondAlg_test.cxx
@@ -51,6 +51,9 @@ public:
   LArOnlineIDTest();
   ~LArOnlineIDTest();
 
+  LArOnlineIDTest (const LArOnlineIDTest&) = delete;
+  LArOnlineIDTest& operator= (const LArOnlineIDTest&) = delete;
+
   const LArOnlineID&  onlineID() const { return *m_helper; }
 
 
diff --git a/Calorimeter/CaloRec/test/CaloBCIDLumiCondAlg_test.cxx b/Calorimeter/CaloRec/test/CaloBCIDLumiCondAlg_test.cxx
index d72b6acda6275f881069216c9c9d42fad9651f66..d081e08cba6d0a5767b2c082d42618957377e0bf 100644
--- a/Calorimeter/CaloRec/test/CaloBCIDLumiCondAlg_test.cxx
+++ b/Calorimeter/CaloRec/test/CaloBCIDLumiCondAlg_test.cxx
@@ -71,6 +71,9 @@ public:
   LArOnlineIDTest();
   ~LArOnlineIDTest();
 
+  LArOnlineIDTest (const LArOnlineIDTest&) = delete;
+  LArOnlineIDTest& operator= (const LArOnlineIDTest&) = delete;
+
   const LArOnlineID&  onlineID() const { return *m_helper; }
 
 
diff --git a/Control/AthToolSupport/AsgTools/AsgTools/AsgToolMacros.h b/Control/AthToolSupport/AsgTools/AsgTools/AsgToolMacros.h
index 2dae16aa79a0bbf079169c9f8f46318214e52dc0..76d834d01f148866635afb9051d71aba1d29847c 100644
--- a/Control/AthToolSupport/AsgTools/AsgTools/AsgToolMacros.h
+++ b/Control/AthToolSupport/AsgTools/AsgTools/AsgToolMacros.h
@@ -53,16 +53,19 @@ public: \
 // Macros are provided for 0, 1 or 2 interfaces.
 // Need work here to make this work for an arbitrary number of interfaces.
 
+// Extra std::string around the ptrToString calls below needed to work around
+// problem with cppcheck 2.0,
+// which gets confused about the return type of ptrToString.
 #define ASG_TOOL_CLASS0(CLASSNAME) \
 public: \
   CLASSNAME(const std::string& type, const std::string& myname, const IInterface* parent) \
-: CLASSNAME(asg::ptrToString(parent)+"#"+type+"/"+myname) {                  \
+: CLASSNAME(std::string(asg::ptrToString(parent))+"#"+type+"/"+myname) { \
   }
 
 #define ASG_TOOL_CLASS(CLASSNAME, INT1) \
 public: \
   CLASSNAME(const std::string& type, const std::string& myname, const IInterface* parent) \
-: CLASSNAME(asg::ptrToString(parent)+"#"+type+"/"+myname) {                  \
+: CLASSNAME(std::string(asg::ptrToString(parent))+"#"+type+"/"+myname) { \
     declareInterface<INT1>(this); \
   }
 
@@ -71,7 +74,7 @@ public: \
 #define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2) \
 public: \
   CLASSNAME(const std::string& type, const std::string& myname, const IInterface* parent) \
-: CLASSNAME(asg::ptrToString(parent)+"#"+type+"/"+myname) {                  \
+: CLASSNAME(std::string(asg::ptrToString(parent))+"#"+type+"/"+myname) { \
     declareInterface<INT1>(this); \
     declareInterface<INT2>(this); \
   }
@@ -79,7 +82,7 @@ public: \
 #define ASG_TOOL_CLASS3(CLASSNAME, INT1, INT2, INT3) \
 public: \
   CLASSNAME(const std::string& type, const std::string& myname, const IInterface* parent) \
-: CLASSNAME(asg::ptrToString(parent)+"#"+type+"/"+myname) {                  \
+: CLASSNAME(std::string(asg::ptrToString(parent))+"#"+type+"/"+myname) { \
     declareInterface<INT1>(this); \
     declareInterface<INT2>(this); \
     declareInterface<INT3>(this); \
diff --git a/Control/AthToolSupport/AsgTools/Root/AsgTool.cxx b/Control/AthToolSupport/AsgTools/Root/AsgTool.cxx
index efa3316b0d218c97f1349c480e6ed56d28684570..b15e294cbaa44eba0e2337b9383f5bbe7d472804 100644
--- a/Control/AthToolSupport/AsgTools/Root/AsgTool.cxx
+++ b/Control/AthToolSupport/AsgTools/Root/AsgTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // System include(s):
@@ -21,7 +21,7 @@ std::string ptrToString (const void* p)
 {
   char buf[80];
   snprintf (buf, 80, "%p", p);
-  return buf;
+  return std::string(buf);
 }
 
 std::string getType (const std::string& s)
diff --git a/Control/AthToolSupport/AsgTools/Root/ToolStore.cxx b/Control/AthToolSupport/AsgTools/Root/ToolStore.cxx
index 0d831126476c2d838cae9edac9f50192d6cc4161..2fc1543c6452cb5b87e10736d3b1819f82bdffe6 100644
--- a/Control/AthToolSupport/AsgTools/Root/ToolStore.cxx
+++ b/Control/AthToolSupport/AsgTools/Root/ToolStore.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // System include(s):
@@ -97,7 +97,7 @@ namespace asg {
       if( itool != s_tools.end() )
         return itool->second;
 
-      if (name.find ("ToolSvc.") != 0) {
+      if (name.substr(0, 8) != "ToolSvc.") {
         itool = s_tools.find( "ToolSvc." + name );
         if( itool != s_tools.end() )
           return itool->second;
diff --git a/Control/AthenaConfiguration/python/AtlasSemantics.py b/Control/AthenaConfiguration/python/AtlasSemantics.py
index 6ae78fcf504112c2708c2281625926f1a7dfbe51..5a6f7ad51ffa1fe28730b871d86544e7a34588f1 100644
--- a/Control/AthenaConfiguration/python/AtlasSemantics.py
+++ b/Control/AthenaConfiguration/python/AtlasSemantics.py
@@ -31,6 +31,22 @@ class AppendListSemantics(GaudiConfig2.semantics.SequenceSemantics):
         a.extend(b)
         return a
 
+class MapMergeNoReplaceSemantics(GaudiConfig2.semantics.MappingSemantics):
+    '''
+    Extend the mapping-semantics with a merge-method that merges two mappings as long as they do not have different values for the same key
+    Use 'mapMergeNoReplace<T>' as fifth parameter of the Gaudi::Property<T> constructor
+    to invoke this merging method.
+    '''
+    __handled_types__ = (re.compile(r"^mapMergeNoReplace<.*>$"),)
+    def __init__(self, cpp_type, name=None):
+        super(MapMergeNoReplaceSemantics, self).__init__(cpp_type, name)
+
+    def merge(self,a,b):
+        for k,v in b.iteritems():
+            if k in a and not v == a[k]:
+                raise ValueError('conflicting values in map under key %r and %r %r' % (k, v, a[k]))
+            a[k] = v
+        return a
 
 class VarHandleSematics(GaudiConfig2.semantics.StringSemantics):
     '''
@@ -205,12 +221,13 @@ GaudiConfig2.semantics.SEMANTICS.append(ToolHandleArraySemantics)
 GaudiConfig2.semantics.SEMANTICS.append(PublicHandleSemantics)
 GaudiConfig2.semantics.SEMANTICS.append(PublicHandleArraySemantics)
 GaudiConfig2.semantics.SEMANTICS.append(SubAlgoSemantics)
+GaudiConfig2.semantics.SEMANTICS.append(MapMergeNoReplaceSemantics)
 
 
 #For some obscure reason, _ListHelper object never compare equal. Therefore PropertySemantics merge() method fails
 def _sequencemerge(instance,a,b):
     if a.data != b.data:
-        raise ValueError('cannot merge values %r and %r' % (a, b))
+        raise ValueError('cannot merge sequence of values %r and %r' % (a, b))
     else:
         return a
     
diff --git a/Control/AthenaExamples/AthExHelloWorld/share/AthExHelloWorld.ref b/Control/AthenaExamples/AthExHelloWorld/share/AthExHelloWorld.ref
index 129cfd100cc89946a313d53aad834b0a51bc182c..588d9b72275da21fec75f1409705dafbe9736414 100644
--- a/Control/AthenaExamples/AthExHelloWorld/share/AthExHelloWorld.ref
+++ b/Control/AthenaExamples/AthExHelloWorld/share/AthExHelloWorld.ref
@@ -1,32 +1,36 @@
-Tue May 15 15:22:57 CEST 2018
+Sat Jun 27 03:57:01 CEST 2020
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [WorkDir-22.0.1] [x86_64-slc6-gcc62-opt] [start_stop/7f27402b7e] -- built on [2018-05-15T1307]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "AthExHelloWorld/HelloWorldOptions.py"
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
-Py:ConfigurableDb    INFO Read module info for 5478 configurables from 5 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
-[?1034hApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
+ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r2)
-                                          running on pc-tbed-pub-26.cern.ch on Tue May 15 15:23:07 2018
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
+                                          running on lxplus755.cern.ch on Sat Jun 27 03:57:12 2020
 ====================================================================================================================================
-ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
-StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 2322 CLIDRegistry entries for module ALL
-ChronoStatSvc        INFO  Number of skipped events for MemStat-1
+ClassIDSvc           INFO  getRegistryEntries: read 7027 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
+ClassIDSvc           INFO  getRegistryEntries: read 705 CLIDRegistry entries for module ALL
+xAODMaker::Even...   INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
+ClassIDSvc           INFO  getRegistryEntries: read 159 CLIDRegistry entries for module ALL
+xAODMaker::Even...   INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
+xAODMaker::Even...WARNING Beam conditions service not available
+xAODMaker::Even...WARNING Will not fill beam spot information into xAOD::EventInfo
+ClassIDSvc           INFO  getRegistryEntries: read 423 CLIDRegistry entries for module ALL
 HelloWorld           INFO initialize()
 HelloWorld           INFO   MyInt =    42
 HelloWorld           INFO   MyBool =   1
@@ -54,14 +58,12 @@ HelloWorld           INFO   MyPrivateHelloTool = HelloTool
 HelloWorld           INFO   MyPublicHelloTool = HelloTool
 HelloWorld           INFO MyPrivateHelloTool: Retrieved tool HelloTool
 HelloWorld           INFO MyPublicHelloTool: Retrieved tool HelloTool
-HistogramPersis...WARNING Histograms saving not required.
 EventSelector        INFO  Enter McEventSelector Initialization 
 AthenaEventLoopMgr   INFO Setup EventSelector service EventSelector
 ApplicationMgr       INFO Application Manager Initialized successfully
 HelloWorld           INFO start()
 ApplicationMgr       INFO Application Manager Started successfully
 EventPersistenc...   INFO Added successfully Conversion service:McCnvSvc
-ClassIDSvc           INFO  getRegistryEntries: read 986 CLIDRegistry entries for module ALL
 AthenaEventLoopMgr   INFO   ===>>>  start of run 0    <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #0, run #0 0 events processed so far  <<<===
 HelloWorld           INFO execute()
@@ -181,12 +183,6 @@ IncidentProcAlg2     INFO Finalize
 EventSelector        INFO finalize
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
-*****Chrono*****     INFO ****************************************************************************************************
-*****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc        INFO Time User   : Tot=  100 [ms]                                             #=  1
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
 ApplicationMgr       INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/Control/AthenaExamples/AthExHelloWorld/share/AthExHelloWorldMT_1.ref b/Control/AthenaExamples/AthExHelloWorld/share/AthExHelloWorldMT_1.ref
index b7883440fabdde1bc1c9cdd1fc392f3be7190515..dc58ee004249ae55b14718cb2ac1e03242ca176e 100644
--- a/Control/AthenaExamples/AthExHelloWorld/share/AthExHelloWorldMT_1.ref
+++ b/Control/AthenaExamples/AthExHelloWorld/share/AthExHelloWorldMT_1.ref
@@ -1,7 +1,7 @@
-Wed Jun  3 15:38:42 PDT 2020
+Sat Jun 27 03:56:25 CEST 2020
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [WorkDir-22.0.15] [x86_64-centos7-gcc8-opt] [Unknown/07d2aec7427] -- built on [2020-06-03T1534]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO configuring AthenaHive with [1] concurrent threads and [1] concurrent events
@@ -9,7 +9,7 @@ Py:AlgScheduler      INFO setting up AvalancheSchedulerSvc/AvalancheSchedulerSvc
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "AthExHelloWorld/HelloWorldOptions.py"
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
-Py:ConfigurableDb    INFO Read module info for 5530 configurables from 17 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
@@ -17,13 +17,13 @@ MessageSvc           INFO Activating in a separate thread
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
                                                    Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
-                                          running on zeus on Wed Jun  3 15:38:48 2020
+                                          running on lxplus755.cern.ch on Sat Jun 27 03:56:37 2020
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr                                      INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 AthDictLoaderSvc                                    INFO in initialize...
 AthDictLoaderSvc                                    INFO acquired Dso-registry
-ClassIDSvc                                          INFO  getRegistryEntries: read 3835 CLIDRegistry entries for module ALL
+ClassIDSvc                                          INFO  getRegistryEntries: read 7399 CLIDRegistry entries for module ALL
 CoreDumpSvc                                         INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc                                         INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaHiveEventLoopMgr                              INFO Initializing AthenaHiveEventLoopMgr - package version AthenaServices-00-00-00
@@ -194,7 +194,7 @@ ToolSvc.PublicHello                        9   0    INFO my message to the world
 HelloWorld                                 9   0    INFO Let the tool MyPrivateHelloTool say something:
 HelloWorld.HelloTool                       9   0    INFO my message to the world: A Private Message!
 AthenaHiveEventLoopMgr                     9   0    INFO   ===>>>  done processing event #9, run #0 on slot 0,  10 events processed so far  <<<===
-AthenaHiveEventLoopMgr                     9   0    INFO ---> Loop Finished (seconds): 0.0119807
+AthenaHiveEventLoopMgr                     9   0    INFO ---> Loop Finished (seconds): 0.0215921
 HelloWorld                                          INFO stop()
 ApplicationMgr                                      INFO Application Manager Stopped successfully
 IncidentProcAlg1                                    INFO Finalize
@@ -206,12 +206,6 @@ AvalancheSchedulerSvc                               INFO Joining Scheduler threa
 EventDataSvc                                        INFO Finalizing EventDataSvc - package version StoreGate-00-00-00
 AthDictLoaderSvc                                    INFO in finalize...
 ToolSvc                                             INFO Removing all tools created by ToolSvc
-*****Chrono*****                                    INFO ****************************************************************************************************
-*****Chrono*****                                    INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****                                    INFO ****************************************************************************************************
-ChronoStatSvc                                       INFO Time User   : Tot=   80 [ms]                                             #=  1
-*****Chrono*****                                    INFO ****************************************************************************************************
-ChronoStatSvc.finalize()                            INFO  Service finalized successfully 
 ApplicationMgr                                      INFO Application Manager Finalized successfully
 ApplicationMgr                                      INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/Control/AthenaExamples/AthExHelloWorld/share/AthExHelloWorldMT_2.ref b/Control/AthenaExamples/AthExHelloWorld/share/AthExHelloWorldMT_2.ref
index 69758b5cba10fc552e283dd9079539f499ba7e3b..10b7ac00d61df8ac7466fc7654f71721df010e24 100644
--- a/Control/AthenaExamples/AthExHelloWorld/share/AthExHelloWorldMT_2.ref
+++ b/Control/AthenaExamples/AthExHelloWorld/share/AthExHelloWorldMT_2.ref
@@ -1,7 +1,7 @@
-Wed Jun  3 15:38:51 PDT 2020
+Sat Jun 27 03:55:21 CEST 2020
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [WorkDir-22.0.15] [x86_64-centos7-gcc8-opt] [Unknown/07d2aec7427] -- built on [2020-06-03T1534]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO configuring AthenaHive with [2] concurrent threads and [2] concurrent events
@@ -9,7 +9,7 @@ Py:AlgScheduler      INFO setting up AvalancheSchedulerSvc/AvalancheSchedulerSvc
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "AthExHelloWorld/HelloWorldOptions.py"
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
-Py:ConfigurableDb    INFO Read module info for 5530 configurables from 17 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
@@ -17,13 +17,13 @@ MessageSvc           INFO Activating in a separate thread
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
                                                    Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
-                                          running on zeus on Wed Jun  3 15:38:57 2020
+                                          running on lxplus755.cern.ch on Sat Jun 27 03:55:32 2020
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr                                      INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 AthDictLoaderSvc                                    INFO in initialize...
 AthDictLoaderSvc                                    INFO acquired Dso-registry
-ClassIDSvc                                          INFO  getRegistryEntries: read 3835 CLIDRegistry entries for module ALL
+ClassIDSvc                                          INFO  getRegistryEntries: read 7399 CLIDRegistry entries for module ALL
 CoreDumpSvc                                         INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc                                         INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaHiveEventLoopMgr                              INFO Initializing AthenaHiveEventLoopMgr - package version AthenaServices-00-00-00
@@ -105,8 +105,9 @@ HelloWorld                                 1   1    INFO Let the tool MyPrivateH
 HelloWorld.HelloTool                       1   1    INFO my message to the world: A Private Message!
 ClassIDSvc                                 0   0    INFO  getRegistryEntries: read 108 CLIDRegistry entries for module ALL
 AthenaHiveEventLoopMgr                     0   0    INFO   ===>>>  done processing event #0, run #0 on slot 0,  1 events processed so far  <<<===
-AthenaHiveEventLoopMgr                     2   0    INFO   ===>>>  start processing event #2, run #0 on slot 0,  1 events processed so far  <<<===
 AthenaHiveEventLoopMgr                     1   1    INFO   ===>>>  done processing event #1, run #0 on slot 1,  2 events processed so far  <<<===
+AthenaHiveEventLoopMgr                     2   0    INFO   ===>>>  start processing event #2, run #0 on slot 0,  2 events processed so far  <<<===
+AthenaHiveEventLoopMgr                     3   1    INFO   ===>>>  start processing event #3, run #0 on slot 1,  2 events processed so far  <<<===
 HelloWorld                                 2   0    INFO execute()
 HelloWorld                                 2   0    INFO An INFO message
 HelloWorld                                 2   0 WARNING A WARNING message
@@ -116,8 +117,6 @@ HelloWorld                                 2   0    INFO Let the tool MyPublicHe
 ToolSvc.PublicHello                        2   0    INFO my message to the world: A Public Message!
 HelloWorld                                 2   0    INFO Let the tool MyPrivateHelloTool say something:
 HelloWorld.HelloTool                       2   0    INFO my message to the world: A Private Message!
-AthenaHiveEventLoopMgr                     3   1    INFO   ===>>>  start processing event #3, run #0 on slot 1,  2 events processed so far  <<<===
-AthenaHiveEventLoopMgr                     2   0    INFO   ===>>>  done processing event #2, run #0 on slot 0,  3 events processed so far  <<<===
 HelloWorld                                 3   1    INFO execute()
 HelloWorld                                 3   1    INFO An INFO message
 HelloWorld                                 3   1 WARNING A WARNING message
@@ -127,7 +126,9 @@ HelloWorld                                 3   1    INFO Let the tool MyPublicHe
 ToolSvc.PublicHello                        3   1    INFO my message to the world: A Public Message!
 HelloWorld                                 3   1    INFO Let the tool MyPrivateHelloTool say something:
 HelloWorld.HelloTool                       3   1    INFO my message to the world: A Private Message!
+AthenaHiveEventLoopMgr                     2   0    INFO   ===>>>  done processing event #2, run #0 on slot 0,  3 events processed so far  <<<===
 AthenaHiveEventLoopMgr                     4   0    INFO   ===>>>  start processing event #4, run #0 on slot 0,  3 events processed so far  <<<===
+AthenaHiveEventLoopMgr                     3   1    INFO   ===>>>  done processing event #3, run #0 on slot 1,  4 events processed so far  <<<===
 HelloWorld                                 4   0    INFO execute()
 HelloWorld                                 4   0    INFO An INFO message
 HelloWorld                                 4   0 WARNING A WARNING message
@@ -137,7 +138,6 @@ HelloWorld                                 4   0    INFO Let the tool MyPublicHe
 ToolSvc.PublicHello                        4   0    INFO my message to the world: A Public Message!
 HelloWorld                                 4   0    INFO Let the tool MyPrivateHelloTool say something:
 HelloWorld.HelloTool                       4   0    INFO my message to the world: A Private Message!
-AthenaHiveEventLoopMgr                     3   1    INFO   ===>>>  done processing event #3, run #0 on slot 1,  4 events processed so far  <<<===
 AthenaHiveEventLoopMgr                     5   1    INFO   ===>>>  start processing event #5, run #0 on slot 1,  4 events processed so far  <<<===
 AthenaHiveEventLoopMgr                     4   0    INFO   ===>>>  done processing event #4, run #0 on slot 0,  5 events processed so far  <<<===
 HelloWorld                                 5   1    INFO execute()
@@ -150,6 +150,7 @@ ToolSvc.PublicHello                        5   1    INFO my message to the world
 HelloWorld                                 5   1    INFO Let the tool MyPrivateHelloTool say something:
 HelloWorld.HelloTool                       5   1    INFO my message to the world: A Private Message!
 AthenaHiveEventLoopMgr                     6   0    INFO   ===>>>  start processing event #6, run #0 on slot 0,  5 events processed so far  <<<===
+AthenaHiveEventLoopMgr                     5   1    INFO   ===>>>  done processing event #5, run #0 on slot 1,  6 events processed so far  <<<===
 HelloWorld                                 6   0    INFO execute()
 HelloWorld                                 6   0    INFO An INFO message
 HelloWorld                                 6   0 WARNING A WARNING message
@@ -159,7 +160,6 @@ HelloWorld                                 6   0    INFO Let the tool MyPublicHe
 ToolSvc.PublicHello                        6   0    INFO my message to the world: A Public Message!
 HelloWorld                                 6   0    INFO Let the tool MyPrivateHelloTool say something:
 HelloWorld.HelloTool                       6   0    INFO my message to the world: A Private Message!
-AthenaHiveEventLoopMgr                     5   1    INFO   ===>>>  done processing event #5, run #0 on slot 1,  6 events processed so far  <<<===
 AthenaHiveEventLoopMgr                     7   1    INFO   ===>>>  start processing event #7, run #0 on slot 1,  6 events processed so far  <<<===
 AthenaHiveEventLoopMgr                     6   0    INFO   ===>>>  done processing event #6, run #0 on slot 0,  7 events processed so far  <<<===
 HelloWorld                                 7   1    INFO execute()
@@ -172,6 +172,7 @@ ToolSvc.PublicHello                        7   1    INFO my message to the world
 HelloWorld                                 7   1    INFO Let the tool MyPrivateHelloTool say something:
 HelloWorld.HelloTool                       7   1    INFO my message to the world: A Private Message!
 AthenaHiveEventLoopMgr                     8   0    INFO   ===>>>  start processing event #8, run #0 on slot 0,  7 events processed so far  <<<===
+AthenaHiveEventLoopMgr                     7   1    INFO   ===>>>  done processing event #7, run #0 on slot 1,  8 events processed so far  <<<===
 HelloWorld                                 8   0    INFO execute()
 HelloWorld                                 8   0    INFO An INFO message
 HelloWorld                                 8   0 WARNING A WARNING message
@@ -181,7 +182,6 @@ HelloWorld                                 8   0    INFO Let the tool MyPublicHe
 ToolSvc.PublicHello                        8   0    INFO my message to the world: A Public Message!
 HelloWorld                                 8   0    INFO Let the tool MyPrivateHelloTool say something:
 HelloWorld.HelloTool                       8   0    INFO my message to the world: A Private Message!
-AthenaHiveEventLoopMgr                     7   1    INFO   ===>>>  done processing event #7, run #0 on slot 1,  8 events processed so far  <<<===
 AthenaHiveEventLoopMgr                     9   1    INFO   ===>>>  start processing event #9, run #0 on slot 1,  8 events processed so far  <<<===
 AthenaHiveEventLoopMgr                     8   0    INFO   ===>>>  done processing event #8, run #0 on slot 0,  9 events processed so far  <<<===
 HelloWorld                                 9   1    INFO execute()
@@ -194,7 +194,7 @@ ToolSvc.PublicHello                        9   1    INFO my message to the world
 HelloWorld                                 9   1    INFO Let the tool MyPrivateHelloTool say something:
 HelloWorld.HelloTool                       9   1    INFO my message to the world: A Private Message!
 AthenaHiveEventLoopMgr                     9   1    INFO   ===>>>  done processing event #9, run #0 on slot 1,  10 events processed so far  <<<===
-AthenaHiveEventLoopMgr                     9   1    INFO ---> Loop Finished (seconds): 0.00976964
+AthenaHiveEventLoopMgr                     9   1    INFO ---> Loop Finished (seconds): 0.0145363
 HelloWorld                                          INFO stop()
 ApplicationMgr                                      INFO Application Manager Stopped successfully
 IncidentProcAlg1                                    INFO Finalize
@@ -206,13 +206,6 @@ AvalancheSchedulerSvc                               INFO Joining Scheduler threa
 EventDataSvc                                        INFO Finalizing EventDataSvc - package version StoreGate-00-00-00
 AthDictLoaderSvc                                    INFO in finalize...
 ToolSvc                                             INFO Removing all tools created by ToolSvc
-*****Chrono*****                                    INFO ****************************************************************************************************
-*****Chrono*****                                    INFO WARNING: MT job; statistics are unreliable
-*****Chrono*****                                    INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****                                    INFO ****************************************************************************************************
-ChronoStatSvc                                       INFO Time User   : Tot=   80 [ms]                                             #=  1
-*****Chrono*****                                    INFO ****************************************************************************************************
-ChronoStatSvc.finalize()                            INFO  Service finalized successfully 
 ApplicationMgr                                      INFO Application Manager Finalized successfully
 ApplicationMgr                                      INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/Control/AthenaExamples/AthExJobOptions/share/BasicJobOptions.ref b/Control/AthenaExamples/AthExJobOptions/share/BasicJobOptions.ref
index 698cc76231cab5898a3df674bbea273b80510bd5..586d2d4f1c576c7adfb6377a80765051b2ca2b77 100644
--- a/Control/AthenaExamples/AthExJobOptions/share/BasicJobOptions.ref
+++ b/Control/AthenaExamples/AthExJobOptions/share/BasicJobOptions.ref
@@ -1,12 +1,12 @@
-Wed Jun  3 15:41:40 PDT 2020
+Sat Jun 27 04:01:54 CEST 2020
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [WorkDir-22.0.15] [x86_64-centos7-gcc8-opt] [Unknown/07d2aec7427] -- built on [2020-06-03T1534]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "AthExJobOptions/AthExJobOptions_BasicJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5530 configurables from 17 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 Py:Athena            INFO Can't set int to string property (this is correct)
 Py:Athena            INFO Can't set non-existing property (this is correct)
@@ -389,13 +389,13 @@ ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to leve
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
                                                    Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
-                                          running on zeus on Wed Jun  3 15:41:45 2020
+                                          running on lxplus755.cern.ch on Sat Jun 27 04:02:04 2020
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr                     INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 AthDictLoaderSvc                   INFO in initialize...
 AthDictLoaderSvc                   INFO acquired Dso-registry
-ClassIDSvc                         INFO  getRegistryEntries: read 3463 CLIDRegistry entries for module ALL
+ClassIDSvc                         INFO  getRegistryEntries: read 7027 CLIDRegistry entries for module ALL
 CoreDumpSvc                        INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc                        INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr                 INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
@@ -674,12 +674,6 @@ QotdSvc                            INFO Finalizing QotdSvc...
 ConcreteSvc                        INFO Finalizing ConcreteSvc...
 AthDictLoaderSvc                   INFO in finalize...
 ToolSvc                            INFO Removing all tools created by ToolSvc
-*****Chrono*****                   INFO ****************************************************************************************************
-*****Chrono*****                   INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****                   INFO ****************************************************************************************************
-ChronoStatSvc                      INFO Time User   : Tot=   40 [ms]                                             #=  1
-*****Chrono*****                   INFO ****************************************************************************************************
-ChronoStatSvc.finalize()           INFO  Service finalized successfully 
 ApplicationMgr                     INFO Application Manager Finalized successfully
 ApplicationMgr                     INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/Control/AthenaExamples/AthExJobOptions/share/CustomToolJobOptions.ref b/Control/AthenaExamples/AthExJobOptions/share/CustomToolJobOptions.ref
index e9366ecd654f099bece5428a7df5bbbf6f89fbea..bbd63539ec779d1e5210b3d43c109a33035b52d8 100644
--- a/Control/AthenaExamples/AthExJobOptions/share/CustomToolJobOptions.ref
+++ b/Control/AthenaExamples/AthExJobOptions/share/CustomToolJobOptions.ref
@@ -1,14 +1,14 @@
-Wed Jun  3 15:45:12 PDT 2020
+Sat Jun 27 04:24:31 CEST 2020
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [WorkDir-22.0.15] [x86_64-centos7-gcc8-opt] [Unknown/07d2aec7427] -- built on [2020-06-03T1534]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "AthExJobOptions/AthExJobOptions_CustomToolJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5530 configurables from 17 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
-{'TheTool': <ToolUsingTool/YourTopAlg.ToolUsingTool at 0x7fde69481c50>, 'ErrorMax': '<no value>', 'RndmFactor': '<no value>', 'PublicToolList': PublicToolHandleArray(['ConcreteTool/Tool4','ToolUsingTool/Tool5','ToolSpace::TemplatedTool<double>/Tool6']), 'AuditExecute': '<no value>', 'EmptyPublicTool': PublicToolHandle(''), 'AuditReinitialize': '<no value>', 'EmptyPrivateTool': PrivateToolHandle(''), 'InputKey': '<no value>', 'AuditRestart': '<no value>', 'MonitorService': '<no value>', 'Enable': '<no value>', 'Timeline': '<no value>', 'AuditFinalize': '<no value>', 'PrivateToolList': PrivateToolHandleArray(['ConcreteTool/Tool1','ToolUsingTool/Tool2','ToolSpace::TemplatedTool<double>/Tool3']), 'NeededResources': [], 'Cardinality': '<no value>', 'FilterCircularDependencies': '<no value>', 'Blocking': '<no value>', 'ExtraOutputs': [], 'OutputKey': '<no value>', 'AuditInitialize': '<no value>', 'OutputLevel': '<no value>', 'ExtraInputs': [], 'AuditStop': '<no value>', 'DetStore': ServiceHandle('StoreGateSvc/DetectorStore'), 'TheSvc': ServiceHandle('ConcreteSvc'), 'EvtStore': ServiceHandle('StoreGateSvc'), 'AuditStart': '<no value>', 'RegisterForContextService': '<no value>', 'AuditAlgorithms': '<no value>', 'ThePublicTool': PublicToolHandle('ConcreteTool'), 'ErrorCounter': '<no value>'}
+{'TheTool': <ToolUsingTool/YourTopAlg.ToolUsingTool at 0x7f013fa43450>, 'ErrorMax': '<no value>', 'RndmFactor': '<no value>', 'PublicToolList': PublicToolHandleArray(['ConcreteTool/Tool4','ToolUsingTool/Tool5','ToolSpace::TemplatedTool<double>/Tool6']), 'AuditExecute': '<no value>', 'EmptyPublicTool': PublicToolHandle(''), 'AuditReinitialize': '<no value>', 'EmptyPrivateTool': PrivateToolHandle(''), 'InputKey': '<no value>', 'AuditRestart': '<no value>', 'MonitorService': '<no value>', 'Enable': '<no value>', 'Timeline': '<no value>', 'AuditFinalize': '<no value>', 'PrivateToolList': PrivateToolHandleArray(['ConcreteTool/Tool1','ToolUsingTool/Tool2','ToolSpace::TemplatedTool<double>/Tool3']), 'NeededResources': [], 'Cardinality': '<no value>', 'FilterCircularDependencies': '<no value>', 'Blocking': '<no value>', 'ExtraOutputs': [], 'OutputKey': '<no value>', 'AuditInitialize': '<no value>', 'OutputLevel': '<no value>', 'ExtraInputs': [], 'AuditStop': '<no value>', 'DetStore': ServiceHandle('StoreGateSvc/DetectorStore'), 'TheSvc': ServiceHandle('ConcreteSvc'), 'EvtStore': ServiceHandle('StoreGateSvc'), 'AuditStart': '<no value>', 'RegisterForContextService': '<no value>', 'AuditAlgorithms': '<no value>', 'ThePublicTool': PublicToolHandle('ConcreteTool'), 'ErrorCounter': '<no value>'}
 /***** Algorithm AthSequencer/TopAlg ***************************************************************
 |-Atomic                     = False
 |-AuditAlgorithms            = False
@@ -303,13 +303,13 @@ ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to leve
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
                                                    Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
-                                          running on zeus on Wed Jun  3 15:45:19 2020
+                                          running on lxplus755.cern.ch on Sat Jun 27 04:24:45 2020
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 3463 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 7027 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
@@ -498,12 +498,6 @@ IncidentProcAlg2     INFO Finalize
 ConcreteSvc          INFO Finalizing ConcreteSvc...
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
-*****Chrono*****     INFO ****************************************************************************************************
-*****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc        INFO Time User   : Tot=   50 [ms]                                             #=  1
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
 ApplicationMgr       INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/Control/AthenaExamples/AthExJobOptions/share/CustomTopAlgorithmJobOptions.ref b/Control/AthenaExamples/AthExJobOptions/share/CustomTopAlgorithmJobOptions.ref
index 8d9d4990363cad996ef3f34a98062949198b2c56..d83f9be46c556ed037a78ad2bfcbfa4a53ae2fd8 100644
--- a/Control/AthenaExamples/AthExJobOptions/share/CustomTopAlgorithmJobOptions.ref
+++ b/Control/AthenaExamples/AthExJobOptions/share/CustomTopAlgorithmJobOptions.ref
@@ -1,7 +1,7 @@
-Wed Jun  3 16:34:00 PDT 2020
+Sat Jun 27 04:03:44 CEST 2020
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [WorkDir-22.0.15] [x86_64-centos7-gcc8-opt] [Unknown/07d2aec7427] -- built on [2020-06-03T1607]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
@@ -91,20 +91,20 @@ Py:Athena            INFO including file "AthExJobOptions/AthExJobOptions_Custom
 | \----- (End of Algorithm TopAlgorithm/MyCustomAlg) -------------------------------------------------
 \----- (End of Algorithm AthSequencer/TopAlg) ------------------------------------------------------
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
-Py:ConfigurableDb    INFO Read module info for 5530 configurables from 19 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
                                                    Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
-                                          running on zeus on Wed Jun  3 16:34:07 2020
+                                          running on lxplus755.cern.ch on Sat Jun 27 04:03:57 2020
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 3463 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 7027 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
@@ -196,12 +196,6 @@ IncidentProcAlg2     INFO Finalize
 ConcreteSvc          INFO Finalizing ConcreteSvc...
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
-*****Chrono*****     INFO ****************************************************************************************************
-*****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc        INFO Time User   : Tot=   40 [ms]                                             #=  1
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
 ApplicationMgr       INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/Control/AthenaKernel/AthenaKernel/CondCont.h b/Control/AthenaKernel/AthenaKernel/CondCont.h
index 0585ac969b7e6991c5e203ac6888b9c12abcc3e5..b2759dc66b1b1f3c03c23e13e937a786f537b3b6 100644
--- a/Control/AthenaKernel/AthenaKernel/CondCont.h
+++ b/Control/AthenaKernel/AthenaKernel/CondCont.h
@@ -442,29 +442,37 @@ public:
     {
       return t >= r.m_start && t< r.m_stop;
     }
-    // Check whether R1 overlaps R2, given that r1.m_start < r2.m_start.
-    // We first tried checking that r1.m_stop > r2.m_start.
-    // However, it turns out that IOVDbSvc can in fact return IOV ranges
-    // that do overlap like this, at least for timestamp folders.
-    // That's because the range returned by IOVDbSvc is bounded by
-    // the range of the cache which is set from the particular query.
-    // The only sort of overlap that should really cause a problem, though,
-    // is if one range is entirely contained within another.
-    // I don't think IOVDbSvc should do _that_, so we check for that here.
-    bool overlap (const RangeKey& r1, const RangeKey& r2) const
-    { return r1.m_stop > r2.m_stop; }
-    int extendRange (RangeKey& r, const RangeKey& newRange) const
-    {
-      if (r.m_start != newRange.m_start) {
-        return -1;
-      }
-      if (newRange.m_stop > r.m_stop) {
-        r.m_stop = newRange.m_stop;
-        r.m_range = newRange.m_range;
-        return 1;
-      }
-      return 0;
-    }
+
+
+    /**
+     * @brief Test if two ranges overlap, and adjust if needed.
+     * @param ctx Event context passed to emplace().
+     * @param oldRange An existing range in the container.
+     * @param newRange New range being added.
+     *
+     * Returns one of:
+     *   0 -- no overlap between the ranges; NEWRANGE is unmodified.
+     *   1 -- ranges overlap.  NEWRANGE has been adjusted to avoid the overlap.
+     *        If the start of NEWRANGE is changed, it must
+     *        only be moved forward (increased), never backwards.
+     *  -1 -- duplicate: NEWRANGE is entirely inside OLDRANGE.
+     *        Delete the new range.         
+     */
+    int overlap (const EventContext& ctx,
+                 const RangeKey& oldRange, RangeKey& newRange) const;
+
+
+    /**
+     * @brief Possibly extend an existing range at the end.
+     * @param range THe existing range.
+     * @param newRange Range being added.
+     *
+     * Returns one of:
+     *   0 -- no change was made to RANGE.
+     *   1 -- RANGE was extended. 
+     *  -1 -- newRange is a duplicate.
+     */
+    int extendRange (RangeKey& range, const RangeKey& newRange) const;
   };
 
 
diff --git a/Control/AthenaKernel/share/CondCont_test.ref b/Control/AthenaKernel/share/CondCont_test.ref
index 3f1909bcca877f4e7068e182d7a5929b98894339..3b8d0b5f893a4b7f1c061a81304fc33c39f8821b 100644
--- a/Control/AthenaKernel/share/CondCont_test.ref
+++ b/Control/AthenaKernel/share/CondCont_test.ref
@@ -14,6 +14,7 @@ UNKNOWN_CLASS:c...  ERROR CondContBase::insertBase: EventIDRange {[40,l:2] - [t:
 UNKNOWN_CLASS:c...  ERROR CondCont<T>::insert: Not most-derived class; CLID used: 932847546; container CLID: 932847547
 test3
 test4
+test5
 UNKNOWN_CLASS:c...  ERROR CondContMixedBase::insertMixed: Run+lbn part of new range doesn't match existing range, or can't extend. New: {[2,t:150,l:10] - [2,t:150,l:15]}; existing: {[2,t:100,l:10] - [2,t:103.500000000,l:20]}
 UNKNOWN_CLASS:c...  ERROR CondContMixedBase::findMixed: No valid timestamp in key used with mixed container.
 UNKNOWN_CLASS:c...  ERROR CondContBase::findBase: Non-Run/LBN key used in Run/LBN container.
diff --git a/Control/AthenaKernel/src/CondCont.cxx b/Control/AthenaKernel/src/CondCont.cxx
index ecbaf4b02fb8a5d019e3b0745beac8166c3e5d7b..3580c36d33f3f9b81547d99a1c27bd785cc32569 100644
--- a/Control/AthenaKernel/src/CondCont.cxx
+++ b/Control/AthenaKernel/src/CondCont.cxx
@@ -11,6 +11,7 @@
 
 #include "AthenaKernel/CondCont.h"
 #include "AthenaKernel/getMessageSvc.h"
+#include "AthenaKernel/ExtendedEventContext.h"
 #include "CxxUtils/AthUnlikelyMacros.h"
 #include "CxxUtils/checker_macros.h"
 #include "GaudiKernel/MsgStream.h"
@@ -21,6 +22,169 @@
 std::string CondContBase::s_cleanerSvcName = "Athena::ConditionsCleanerSvc";
 
 
+/**
+ * @brief Test if two ranges overlap, and adjust if needed.
+ * @param ctx Event context passed to emplace().
+ * @param oldRange An existing range in the container.
+ * @param newRange New range being added.
+ *
+ * Returns one of:
+ *   0 -- no overlap between the ranges; NEWRANGE is unmodified.
+ *   1 -- ranges overlap.  NEWRANGE has been adjusted to avoid the overlap.
+ *        If the start of NEWRANGE is changed, it must
+ *        only be moved forward (increased), never backwards.
+ *  -1 -- duplicate: NEWRANGE is entirely inside OLDRANGE.
+ *        Delete the new range.         
+ */
+int CondContBase::Compare::overlap (const EventContext& ctx,
+                                    const RangeKey& oldRange,
+                                    RangeKey& newRange) const
+{
+  //                              |--- oldRange ---|
+  //  |--- newRange ---|
+  if (newRange.m_stop <= oldRange.m_start) {
+    return 0;
+  }
+        
+  //  |--- oldRange ---|
+  //                        |--- newRange ---|
+  if (oldRange.m_stop <= newRange.m_start) {
+    return 0;
+  }
+
+  //   |---     oldRange    ---|
+  //      |--- newRange ---|
+  if (newRange.m_start >= oldRange.m_start &&
+      newRange.m_stop <= oldRange.m_stop)
+  {
+    return -1;
+  }
+
+  // Current IOV key.
+  key_type cur;
+  if (newRange.m_range.start().isTimeStamp()) {
+    cur = keyFromTimestamp (ctx.eventID());
+  }
+  else {
+    EventIDBase eid = ctx.eventID();
+    if (ctx.hasExtension()) {
+      EventIDBase::number_type conditionsRun =
+        Atlas::getExtendedEventContext (ctx).conditionsRun();
+      if (conditionsRun != EventIDBase::UNDEFNUM) {
+        eid.set_run_number (conditionsRun);
+      }
+    }
+    cur = keyFromRunLBN (eid);
+  }
+
+  // Either this:
+  //      |---     oldRange    ---|
+  //                 |--- newRange ---|
+  //
+  // Or this
+  //      |---     oldRange    ---|
+  //  |---               newRange ---|
+  //  with the current IOV key after the end of oldRange.
+  //
+  // In either case, we start the start of newRange to the end of oldRange.
+  if (newRange.m_stop > oldRange.m_stop &&
+      (newRange.m_start >= oldRange.m_start ||
+       cur > oldRange.m_stop))
+  {
+    newRange.m_start = oldRange.m_stop;
+    if (oldRange.m_range.stop().isTimeStamp()) {
+      // If this is a mixed key, we need to copy only the timestamp part.
+      EventIDBase oldId = oldRange.m_range.stop();
+      EventIDBase newId = newRange.m_range.start();
+      newRange.m_range = EventIDRange (EventIDBase (newId.run_number(),
+                                                    newId.event_number(),
+                                                    oldId.time_stamp(),
+                                                    oldId.time_stamp_ns_offset(),
+                                                    newId.lumi_block(),
+                                                    newId.bunch_crossing_id()),
+                                       newRange.m_range.stop());
+    }
+    else {
+      newRange.m_range = EventIDRange (oldRange.m_range.stop(),
+                                       newRange.m_range.stop());
+    }
+  }
+
+
+  //              |---     oldRange    ---|
+  //      |--- newRange  ---|
+  else if (newRange.m_start < oldRange.m_start &&
+           newRange.m_stop > oldRange.m_start)
+  {
+    // Change the end of newRange to the start of oldRange.
+    newRange.m_stop = oldRange.m_start;
+    if (oldRange.m_range.start().isTimeStamp()) {
+      // If this is a mixed key, we need to copy only the timestamp part.
+      EventIDBase oldId = oldRange.m_range.start();
+      EventIDBase newId = newRange.m_range.stop();
+      newRange.m_range = EventIDRange (newRange.m_range.start(),
+                                       EventIDBase (newId.run_number(),
+                                                    newId.event_number(),
+                                                    oldId.time_stamp(),
+                                                    oldId.time_stamp_ns_offset(),
+                                                    newId.lumi_block(),
+                                                    newId.bunch_crossing_id()));
+    }
+    else {
+      newRange.m_range = EventIDRange (newRange.m_range.start(),
+                                       oldRange.m_range.start());
+    }
+  }
+
+  // Should have handled all cases by now!
+  else {
+    std::abort();
+  }
+
+  return 1;
+}
+
+
+/**
+ * @brief Possibly extend an existing range at the end.
+ * @param range THe existing range.
+ * @param newRange Range being added.
+ *
+ * Returns one of:
+ *   0 -- no change was made to RANGE.
+ *   1 -- RANGE was extended. 
+ *  -1 -- newRange is a duplicate.
+ */
+int CondContBase::Compare::extendRange (RangeKey& range,
+                                        const RangeKey& newRange) const
+{
+  //      |--- range ---|
+  //  |--- newRange ....
+  if (newRange.m_start < range.m_start) {
+    return 0;
+  }
+
+  //      |--- range ---|
+  //                         |--- newRange ....
+  if (newRange.m_start > range.m_stop) {
+    return 0;
+  }
+
+  //      |--- range ----------------|
+  //         |--- newRange ---|
+  if (newRange.m_stop <= range.m_stop) {
+    return -1;
+  }
+
+  //      |--- range ----|
+  //         |--- newRange ---|
+  range.m_stop = newRange.m_stop;
+  range.m_range = EventIDRange (range.m_range.start(),
+                                newRange.m_range.stop());
+  return 1;
+}
+
+
 /**
  * @brief Name of the category.
  */
diff --git a/Control/AthenaKernel/test/CondCont_test.cxx b/Control/AthenaKernel/test/CondCont_test.cxx
index 4ff0fea9694329eeb9e31585ff9bc4f75fcbe2bb..d4931ddcd3ecc0c550fb65a6da524a4014dbdca4 100644
--- a/Control/AthenaKernel/test/CondCont_test.cxx
+++ b/Control/AthenaKernel/test/CondCont_test.cxx
@@ -366,6 +366,12 @@ void test1 (TestRCUSvc& rcusvc)
   sc = cc_rl.insert (EventIDRange (runlbn (10, 35), runlbn (10, 39)),
                      std::make_unique<B> (40));
   assert (sc.isSuccess()); 
+  assert (CondContBase::Category::isDuplicate (sc));
+  assert (!CondContBase::Category::isOverlap (sc));
+
+  sc = cc_rl.insert (EventIDRange (runlbn (10, 35), runlbn (10, 45)),
+                     std::make_unique<B> (41));
+  assert (sc.isSuccess()); 
   assert (!CondContBase::Category::isDuplicate (sc));
   assert (CondContBase::Category::isOverlap (sc));
 
@@ -441,8 +447,14 @@ void test3 (TestRCUSvc& rcusvc)
   assert (cc.extendLastRange (EventIDRange (runlbn (10, 30), runlbn (10, 33))).isSuccess());
   assert (dump_cc(cc) == "{[10,l:15] - [10,l:20]} [1]\n{[10,l:30] - [10,l:37]} [2]\n");
 
-  assert (cc.extendLastRange (EventIDRange (runlbn (10, 31), runlbn (10, 33))).isFailure());
+  assert (cc.extendLastRange (EventIDRange (runlbn (10, 25), runlbn (10, 33))).isFailure());
+  assert (dump_cc(cc) == "{[10,l:15] - [10,l:20]} [1]\n{[10,l:30] - [10,l:37]} [2]\n");
+
+  assert (cc.extendLastRange (EventIDRange (runlbn (10, 31), runlbn (10, 33))).isSuccess());
   assert (dump_cc(cc) == "{[10,l:15] - [10,l:20]} [1]\n{[10,l:30] - [10,l:37]} [2]\n");
+
+  assert (cc.extendLastRange (EventIDRange (runlbn (10, 32), runlbn (10,40))).isSuccess());
+  assert (dump_cc(cc) == "{[10,l:15] - [10,l:20]} [1]\n{[10,l:30] - [10,l:40]} [2]\n");
 }
 
 
@@ -458,10 +470,128 @@ public:
 };
 
 
-// Testing mixed keys.
+// Testing overlaps keys.
 void test4 (TestRCUSvc& rcusvc)
 {
   std::cout << "test4\n";
+
+  SG::DataProxy proxy;
+  DataObjID id ("cls", "key");
+  EventContext ctx_rl;
+  EventContext ctx_ts;
+
+  ctx_rl.setEventID (EventIDBase (runlbn (1, 25)));
+  ctx_ts.setEventID (EventIDBase (timestamp (25)));
+
+  CondCont<B> cc_rl (rcusvc, id, &proxy);
+  CondCont<B> cc_ts (rcusvc, id, &proxy);
+
+  //=============
+
+  assert (cc_rl.insert (EventIDRange (runlbn (1, 10), runlbn (1, 20)),
+                        std::make_unique<B>(1), ctx_rl).isSuccess());
+  assert (dump_cc(cc_rl) == "{[1,l:10] - [1,l:20]} [1]\n");
+  assert (cc_ts.insert (EventIDRange (timestamp (10), timestamp (20)),
+                        std::make_unique<B>(1), ctx_ts).isSuccess());
+  assert (dump_cc(cc_ts) == "{[0,0,t:10] - [t:20]} [1]\n");
+
+  //=============
+
+  assert (cc_rl.insert (EventIDRange (runlbn (1, 50), runlbn (1, 60)),
+                        std::make_unique<B>(2), ctx_rl).isSuccess());
+  assert (dump_cc(cc_rl) == "{[1,l:10] - [1,l:20]} [1]\n{[1,l:50] - [1,l:60]} [2]\n");
+  assert (cc_ts.insert (EventIDRange (timestamp (50), timestamp (60)),
+                        std::make_unique<B>(2),  ctx_ts).isSuccess());
+  assert (dump_cc(cc_ts) == "{[0,0,t:10] - [t:20]} [1]\n{[0,0,t:50] - [t:60]} [2]\n");
+
+  //=============
+
+  StatusCode sc;
+
+  sc = cc_rl.insert (EventIDRange (runlbn (1, 12), runlbn (1, 18)),
+                     std::make_unique<B>(3), ctx_rl);
+  assert (sc.isSuccess()); 
+  assert (CondContBase::Category::isDuplicate (sc));
+  assert (!CondContBase::Category::isOverlap (sc));
+  assert (dump_cc(cc_rl) == "{[1,l:10] - [1,l:20]} [1]\n{[1,l:50] - [1,l:60]} [2]\n");
+
+  sc = cc_ts.insert (EventIDRange (timestamp (12), timestamp (18)),
+                     std::make_unique<B>(3), ctx_rl);
+  assert (sc.isSuccess()); 
+  assert (CondContBase::Category::isDuplicate (sc));
+  assert (!CondContBase::Category::isOverlap (sc));
+  assert (dump_cc(cc_ts) == "{[0,0,t:10] - [t:20]} [1]\n{[0,0,t:50] - [t:60]} [2]\n");
+
+  //=============
+
+  sc = cc_rl.insert (EventIDRange (runlbn (1, 8), runlbn (1, 30)),
+                     std::make_unique<B>(4), ctx_rl);
+  assert (sc.isSuccess()); 
+  assert (!CondContBase::Category::isDuplicate (sc));
+  assert (CondContBase::Category::isOverlap (sc));
+  assert (dump_cc(cc_rl) == "{[1,l:10] - [1,l:20]} [1]\n{[1,l:20] - [1,l:30]} [4]\n{[1,l:50] - [1,l:60]} [2]\n");
+
+  sc = cc_ts.insert (EventIDRange (timestamp (8), timestamp (30)),
+                     std::make_unique<B>(4), ctx_rl);
+  assert (sc.isSuccess()); 
+  assert (!CondContBase::Category::isDuplicate (sc));
+  assert (CondContBase::Category::isOverlap (sc));
+  assert (dump_cc(cc_ts) == "{[0,0,t:10] - [t:20]} [1]\n{[0,0,t:20,l:0] - [t:30]} [4]\n{[0,0,t:50] - [t:60]} [2]\n");
+
+  //=============
+
+  sc = cc_rl.insert (EventIDRange (runlbn (1, 6), runlbn (1, 40)),
+                     std::make_unique<B>(5), ctx_rl);
+  assert (sc.isSuccess()); 
+  assert (!CondContBase::Category::isDuplicate (sc));
+  assert (CondContBase::Category::isOverlap (sc));
+  assert (dump_cc(cc_rl) == "{[1,l:10] - [1,l:20]} [1]\n{[1,l:20] - [1,l:30]} [4]\n{[1,l:30] - [1,l:40]} [5]\n{[1,l:50] - [1,l:60]} [2]\n");
+
+  sc = cc_ts.insert (EventIDRange (timestamp (6), timestamp (40)),
+                     std::make_unique<B>(5), ctx_rl);
+  assert (sc.isSuccess()); 
+  assert (!CondContBase::Category::isDuplicate (sc));
+  assert (CondContBase::Category::isOverlap (sc));
+  assert (dump_cc(cc_ts) == "{[0,0,t:10] - [t:20]} [1]\n{[0,0,t:20,l:0] - [t:30]} [4]\n{[0,0,t:30,l:0] - [t:40]} [5]\n{[0,0,t:50] - [t:60]} [2]\n");
+
+  //=============
+
+  sc = cc_rl.insert (EventIDRange (runlbn (1, 6), runlbn (1, 15)),
+                     std::make_unique<B>(6), ctx_rl);
+  assert (sc.isSuccess()); 
+  assert (!CondContBase::Category::isDuplicate (sc));
+  assert (CondContBase::Category::isOverlap (sc));
+  assert (dump_cc(cc_rl) == "{[1,l:6] - [1,l:10]} [6]\n{[1,l:10] - [1,l:20]} [1]\n{[1,l:20] - [1,l:30]} [4]\n{[1,l:30] - [1,l:40]} [5]\n{[1,l:50] - [1,l:60]} [2]\n");
+
+  sc = cc_ts.insert (EventIDRange (timestamp (6), timestamp (15)),
+                     std::make_unique<B>(6), ctx_rl);
+  assert (sc.isSuccess()); 
+  assert (!CondContBase::Category::isDuplicate (sc));
+  assert (CondContBase::Category::isOverlap (sc));
+  assert (dump_cc(cc_ts) == "{[0,0,t:6] - [t:10]} [6]\n{[0,0,t:10] - [t:20]} [1]\n{[0,0,t:20,l:0] - [t:30]} [4]\n{[0,0,t:30,l:0] - [t:40]} [5]\n{[0,0,t:50] - [t:60]} [2]\n");
+
+  //=============
+
+  sc = cc_rl.insert (EventIDRange (runlbn (1, 35), runlbn (1, 45)),
+                     std::make_unique<B>(9), ctx_rl);
+  assert (sc.isSuccess()); 
+  assert (!CondContBase::Category::isDuplicate (sc));
+  assert (CondContBase::Category::isOverlap (sc));
+  assert (dump_cc(cc_rl) == "{[1,l:6] - [1,l:10]} [6]\n{[1,l:10] - [1,l:20]} [1]\n{[1,l:20] - [1,l:30]} [4]\n{[1,l:30] - [1,l:40]} [5]\n{[1,l:40] - [1,l:45]} [9]\n{[1,l:50] - [1,l:60]} [2]\n");
+
+  sc = cc_ts.insert (EventIDRange (timestamp (35), timestamp (45)),
+                     std::make_unique<B>(9), ctx_rl);
+  assert (sc.isSuccess()); 
+  assert (!CondContBase::Category::isDuplicate (sc));
+  assert (CondContBase::Category::isOverlap (sc));
+  assert (dump_cc(cc_ts) == "{[0,0,t:6] - [t:10]} [6]\n{[0,0,t:10] - [t:20]} [1]\n{[0,0,t:20,l:0] - [t:30]} [4]\n{[0,0,t:30,l:0] - [t:40]} [5]\n{[0,0,t:40,l:0] - [t:45]} [9]\n{[0,0,t:50] - [t:60]} [2]\n");
+}
+
+
+// Testing mixed keys.
+void test5 (TestRCUSvc& rcusvc)
+{
+  std::cout << "test5\n";
   DataObjID id ("cls", "key");
 
   std::vector<B*> bptrs;
@@ -584,6 +714,13 @@ void test4 (TestRCUSvc& rcusvc)
   sc = cc.insert (EventIDRange (mixed (2, 10, 125),
                                 mixed (2, 20, 127)),
                   std::unique_ptr<B> (bptrs.back()));
+  assert (CondContBase::Category::isDuplicate (sc));
+
+
+  bptrs.push_back (new B (11));
+  sc = cc.insert (EventIDRange (mixed (2, 10, 125),
+                                mixed (2, 20, 135)),
+                  std::unique_ptr<B> (bptrs.back()));
   assert (CondContBase::Category::isOverlap (sc));
 
 
@@ -627,8 +764,9 @@ void test4 (TestRCUSvc& rcusvc)
   exp2 << "{[2,t:100,l:10] - [2,t:103.500000000,l:20]} " << bptrs[3] << "\n";
   exp2 << "{[2,t:103.500000000,l:10] - [2,t:110,l:20]} " << bptrs[4] << "\n";
   exp2 << "{[2,t:120,l:10] - [2,t:130,l:20]} " << bptrs[5] << "\n";
-  exp2 << "{[2,t:125,l:10] - [2,t:127,l:20]} " << bptrs[6] << "\n";
-  exp2 << "{[20,t:120,l:10] - [20,t:130,l:40]} " << bptrs[7] << "\n";
+  exp2 << "{[2,t:130,l:10] - [2,t:135,l:20]} " << bptrs[6] << "\n";
+  exp2 << "{[20,t:120,l:10] - [20,t:130,l:40]} " << bptrs[8] << "\n";
+  //                                                  xxx 
   //std::cout << "ss2: " << ss2.str() << "\nexp2: " << exp2.str() << "\n";
   assert (ss2.str() == exp2.str());
 }
@@ -1065,6 +1203,7 @@ int main ATLAS_NOT_THREAD_SAFE ()
   test2 (rcusvc);
   test3 (rcusvc);
   test4 (rcusvc);
+  test5 (rcusvc);
   testThread (rcusvc);
   testThreadMixed (rcusvc);
   return 0;
diff --git a/Control/AthenaMonitoring/AthenaMonitoring/LogFileMsgStream.h b/Control/AthenaMonitoring/AthenaMonitoring/LogFileMsgStream.h
index ed0b95f2cfe6cd9c2747e862c873fcb422a6dda4..b2790bc4b112b32d400cbd3b519f07c78171adaa 100755
--- a/Control/AthenaMonitoring/AthenaMonitoring/LogFileMsgStream.h
+++ b/Control/AthenaMonitoring/AthenaMonitoring/LogFileMsgStream.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 LOGFILEMSGSTREAM_H
@@ -68,7 +68,7 @@ class LogFileMsgStream : public MsgStream {
     return MsgStream::doOutput();
   }
   
-  void setFormat(std::string str) {
+  void setFormat(const std::string& str) {
     m_FormatString=str;
   }
   
diff --git a/Control/AthenaMonitoring/src/AthenaMon.cxx b/Control/AthenaMonitoring/src/AthenaMon.cxx
index 5c3469369c8a99a63d0b00fd8da89da69c327636..fde82b4bd63511bad60eb3dd8011abef53171572 100755
--- a/Control/AthenaMonitoring/src/AthenaMon.cxx
+++ b/Control/AthenaMonitoring/src/AthenaMon.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // ********************************************************************
@@ -56,7 +56,7 @@ StatusCode AthenaMon::initialize()
     return StatusCode::FAILURE;
   }
 
-  for (; it < m_monToolNames.end(); it++) {
+  for (; it < m_monToolNames.end(); ++it) {
  
     std::string toolname(*it);
     IMonitorToolBase* p_tool;
@@ -107,7 +107,7 @@ StatusCode AthenaMon::execute()
   //Invoke all declared alg monitoring tools to fill their histograms
   std::vector<IMonitorToolBase*>::iterator it = m_monTools.begin();
   
-  for (; it < m_monTools.end(); it++)  {
+  for (; it < m_monTools.end(); ++it)  {
     if((*it)->preSelector())
       if((*it)->fillHists().isFailure())  {
 	log << MSG::WARNING << "Error Filling Histograms" << endmsg;
@@ -118,7 +118,7 @@ StatusCode AthenaMon::execute()
     //Invoke periodically all declared alg monitoring tools to check their histograms
     it = m_monTools.begin();
     
-    for (; it < m_monTools.end(); it++)  {
+    for (; it < m_monTools.end(); ++it)  {
       log << MSG::INFO << "calling checkHists of tool " << endmsg;
       StatusCode sc = (*it)->checkHists(false);
       if(sc.isFailure())  {
@@ -142,7 +142,7 @@ StatusCode AthenaMon::finalize()
   //Invoke all declared alg monitoring tools to finalize their histograms
   std::vector<IMonitorToolBase*>::iterator it = m_monTools.begin();
   
-  for (; it < m_monTools.end(); it++)  {
+  for (; it < m_monTools.end(); ++it)  {
     log << MSG::INFO << "finalizing tool " << endmsg;
     StatusCode sc = (*it)->finalHists();
     if(sc.isFailure())  {
@@ -153,7 +153,7 @@ StatusCode AthenaMon::finalize()
   //Invoke all declared alg monitoring tools to check their histograms
   it = m_monTools.begin();
   
-  for (; it < m_monTools.end(); it++)  {
+  for (; it < m_monTools.end(); ++it)  {
     log << MSG::INFO << "calling checkHists of tool " << endmsg;
     StatusCode sc = (*it)->checkHists(true);
     if(sc.isFailure())  {
@@ -176,7 +176,7 @@ StatusCode AthenaMon::start()
     return StatusCode::SUCCESS;
   
   std::vector<IMonitorToolBase*>::iterator it = m_monTools.begin();
-  for (; it < m_monTools.end(); it++)
+  for (; it < m_monTools.end(); ++it)
     if((*it)->bookHists().isFailure())
       log << MSG::WARNING << "Error Filling Histograms" << endmsg;
   
@@ -190,7 +190,7 @@ StatusCode AthenaMon::stop()
   log << MSG::INFO << "stop()" << endmsg;
   
   std::vector<IMonitorToolBase*>::iterator it = m_monTools.begin();
-  for (; it < m_monTools.end(); it++)
+  for (; it < m_monTools.end(); ++it)
     if((*it)->runStat().isFailure())
       log << MSG::WARNING << "Error calling runStat" << endmsg;
   
diff --git a/Control/AthenaMonitoring/src/MonitorToolBase.cxx b/Control/AthenaMonitoring/src/MonitorToolBase.cxx
index 66d602d0ef7936a063bc822e91ef420df687af00..f6dee072487b6db43ff4d3b3f8733be9ebf9f50b 100755
--- a/Control/AthenaMonitoring/src/MonitorToolBase.cxx
+++ b/Control/AthenaMonitoring/src/MonitorToolBase.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
 */
 
 // ********************************************************************
@@ -166,7 +166,7 @@ MonitorToolBase::setupOutputStreams(std::vector<std::string> Mapping
 	  m_map_THistSvc_streamnames[itr->substr(0,location)]=itr->substr(location);
 	}
       itr->erase(0,location);
-      itr++;
+      ++itr;
     }
   
   if(m_map_THistSvc_streamnames.size()>0)
@@ -175,7 +175,7 @@ MonitorToolBase::setupOutputStreams(std::vector<std::string> Mapping
 	  << "Using following mapping of mnemonics to streams (in alphabetical order):"
 	  << endmsg;
       for( map_type::const_iterator iter = m_map_THistSvc_streamnames.begin();
-	   iter != m_map_THistSvc_streamnames.end(); iter++ )
+	   iter != m_map_THistSvc_streamnames.end(); ++iter )
 	log << MSG::INFO 
 	    << std::setw(20)
 	    << iter->first << " writes to "
diff --git a/Control/AthenaServices/CMakeLists.txt b/Control/AthenaServices/CMakeLists.txt
index 901d90d7ebf89293822f3f11813f9faea0ad80a9..f4db16f2b5439c81d8c61d05c298437ef53827e3 100644
--- a/Control/AthenaServices/CMakeLists.txt
+++ b/Control/AthenaServices/CMakeLists.txt
@@ -55,40 +55,33 @@ atlas_add_test( AthenaOutputStream_test
    src/OutputStreamSequencerSvc.cxx src/MetaDataSvc.cxx
    INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
    LINK_LIBRARIES TestTools AsgTools AthenaKernel SGTools StoreGateLib GaudiKernel AthenaBaseComps PersistentDataModel
-   LOG_IGNORE_PATTERN "^AthenaRootStrea... +(INFO|DEBUG)|^SGAudSvc +(INFO|DEBUG)|of type DataHistory|DEBUG Recorded object|object modifiable when retrieved|^ToolSvc +DEBUG Service base class initialized|^ServiceManager +DEBUG Initializing service|^IncidentSvc *DEBUG Adding .* listener|DecisionSvc +DEBUG|^IoComponentMgr +(INFO|DEBUG)|DBReplicaSvc|^HistogramPersis.*DEBUG|^ItemListSvc +(INFO|DEBUG)|Info File PoolFileCatalog.xml does not exist|DataModelCompatSvc::initialize|^ProxyProviderSvc +DEBUG|^DataModelCompatSvc +DEBUG|^AthenaOutputStreamVERBOSE|^AthenaOutputStream +DEBUG|^TimelineSvc +DEBUG"
-   ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" )
+   LOG_IGNORE_PATTERN "^AthenaRootStrea... +(INFO|DEBUG)|^SGAudSvc +(INFO|DEBUG)|of type DataHistory|DEBUG Recorded object|object modifiable when retrieved|^ToolSvc +DEBUG Service base class initialized|^ServiceManager +DEBUG Initializing service|^IncidentSvc *DEBUG Adding .* listener|DecisionSvc +DEBUG|^IoComponentMgr +(INFO|DEBUG)|DBReplicaSvc|^HistogramPersis.*DEBUG|^ItemListSvc +(INFO|DEBUG)|Info File PoolFileCatalog.xml does not exist|DataModelCompatSvc::initialize|^ProxyProviderSvc +DEBUG|^DataModelCompatSvc +DEBUG|^AthenaOutputStreamVERBOSE|^AthenaOutputStream +DEBUG|^TimelineSvc +DEBUG" )
 # Avoid spurious ubsan warnings.
 set_target_properties( AthenaServices_AthenaOutputStream_test PROPERTIES ENABLE_EXPORTS True )
 
 atlas_add_test( FPEControlSvc_test
    SOURCES test/FPEControlSvc_test.cxx
-   LINK_LIBRARIES TestTools AthenaKernel GaudiKernel
-   ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" )
+   LINK_LIBRARIES TestTools AthenaKernel GaudiKernel )
 
 atlas_add_test( AthenaEventLoopMgr_test
    SOURCES test/AthenaEventLoopMgr_test.cxx
-   LINK_LIBRARIES TestTools AsgTools AthenaKernel GaudiKernel EventInfo AthenaBaseComps
-   ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" )
+   LINK_LIBRARIES TestTools AsgTools AthenaKernel GaudiKernel EventInfo AthenaBaseComps )
 
 atlas_add_test( ConditionsCleanerSvc_test
   SOURCES test/ConditionsCleanerSvc_test.cxx
-  LINK_LIBRARIES TestTools AthenaKernel GaudiKernel AthenaBaseComps
-  ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" )
+  LINK_LIBRARIES TestTools AthenaKernel GaudiKernel AthenaBaseComps )
 
 atlas_add_test( RCUSvc_test
    SOURCES test/RCUSvc_test.cxx
-   LINK_LIBRARIES TestTools AsgTools AthenaKernel GaudiKernel EventInfo AthenaBaseComps
-   ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" )
+   LINK_LIBRARIES TestTools AsgTools AthenaKernel GaudiKernel EventInfo AthenaBaseComps )
 
 atlas_add_test( DelayedConditionsCleanerSvc_test
    SOURCES test/DelayedConditionsCleanerSvc_test.cxx
-   LINK_LIBRARIES TestTools AsgTools AthenaKernel GaudiKernel EventInfo AthenaBaseComps
-   ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" )
+   LINK_LIBRARIES TestTools AsgTools AthenaKernel GaudiKernel EventInfo AthenaBaseComps )
 
 atlas_add_test( ThinningCacheTool_test
    SOURCES test/ThinningCacheTool_test.cxx
-   LINK_LIBRARIES TestTools AsgTools AthenaKernel GaudiKernel EventInfo AthenaBaseComps
-   ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" )
+   LINK_LIBRARIES TestTools AsgTools AthenaKernel GaudiKernel EventInfo AthenaBaseComps )
 
 atlas_add_test( TestStopRun
    SCRIPT test/TestStopRun.sh
@@ -126,7 +119,14 @@ atlas_install_joboptions( share/AthTPCnvSvc_test.py
    share/AthDictLoaderSvc_test.py
    share/ReadAthenaPoolSeek_jobOptions.py
    share/AthenaJobOptionsSvc_jobOptions.py
-   share/test_tpcnvdb.py )
+   share/test_tpcnvdb.py 
+   share/AthenaOutputStream_test.txt 
+   share/FPEControlSvc_test.txt 
+   share/AthenaEventLoopMgr_test.txt 
+   share/ConditionsCleanerSvc_test.txt
+   share/RCUSvc_test.txt
+   share/DelayedConditionsCleanerSvc_test.txt
+   share/ThinningCacheTool_test.txt )
 
 # Need to make sure that python file installation happens before genconf
 # in order for our custom __init__.py to be installed correctly.
diff --git a/Control/AthenaServices/src/DelayedConditionsCleanerSvc.h b/Control/AthenaServices/src/DelayedConditionsCleanerSvc.h
index 2850c027cbb92b26c16dca896e0910442822ca93..0bf87fcaf6184272c1add35b300e3bc7516666c8 100644
--- a/Control/AthenaServices/src/DelayedConditionsCleanerSvc.h
+++ b/Control/AthenaServices/src/DelayedConditionsCleanerSvc.h
@@ -1,6 +1,6 @@
 // This file's extension implies that it's C, but it's really -*- C++ -*-.
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 /*
  */
@@ -48,7 +48,7 @@ class DelayedConditionsCleanerSvcProps;
  * On each event (@c event interface) we put the current IOV keys
  * (run+LBN and timestamp) into ring buffers (of size RingSize).
  * If the topmost entry of the priority queue has come due, then we
- * pull of that entry and other entries due up to LookAhead events later.
+ * pull off that entry and other entries due up to LookAhead events later.
  * We then do a trim operation on each of the conditions containers,
  * removing conditions objects from the oldest first that do not
  * match any of the IOV keys in the ring buffer.
diff --git a/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx b/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx
index c212f922819a213977fa74707e05f506da08c4a8..018985b108d762d2242866025b19897210f7fbd0 100644
--- a/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx
+++ b/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx
@@ -1,8 +1,6 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
-
-// $Id$
 /**
  * @file AthenaServices/test/AthenaEventLoopMgr_test.cxx
  * @author scott snyder
@@ -350,7 +348,7 @@ int main()
 {
   errorcheck::ReportMessage::hideErrorLocus();
   ISvcLocator* svcloc = nullptr;
-  if (!Athena_test::initGaudi("AthenaEventLoopMgr_test.txt", svcloc)) {
+  if (!Athena_test::initGaudi("AthenaServices/AthenaEventLoopMgr_test.txt", svcloc)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
   }  
diff --git a/Control/AthenaServices/test/AthenaOutputStream_test.cxx b/Control/AthenaServices/test/AthenaOutputStream_test.cxx
index 6be34c90d457f1971654a82ec765f06da7062a8f..ed398a82172b7bd360fad70c90c748e3b39355e6 100644
--- a/Control/AthenaServices/test/AthenaOutputStream_test.cxx
+++ b/Control/AthenaServices/test/AthenaOutputStream_test.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
 */
 
 /** @file AthenaOutputStream_test.cxx
@@ -42,7 +42,7 @@ int main() {
   const std::string appName = "AthenaOutputStream_test";
   cout << "*** " << appName << " starts ***" <<endl;
   ISvcLocator* pSvcLoc(nullptr);
-  if (!initGaudi("AthenaOutputStream_test.txt", pSvcLoc)) {
+  if (!initGaudi("AthenaServices/AthenaOutputStream_test.txt", pSvcLoc)) {
     cerr << "This test can not be run" << endl;
     return 0;
   }  
diff --git a/Control/AthenaServices/test/ConditionsCleanerSvc_test.cxx b/Control/AthenaServices/test/ConditionsCleanerSvc_test.cxx
index 75c8216289f76de7150bff291990250445f3d145..e83a86518f10ad31520b427baab2eb83e2a9f6a2 100644
--- a/Control/AthenaServices/test/ConditionsCleanerSvc_test.cxx
+++ b/Control/AthenaServices/test/ConditionsCleanerSvc_test.cxx
@@ -1,8 +1,6 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
-/*
- */
 /**
  * @file AthenaServices/test/ConditionsCleanerSvc_test.cxx
  * @author scott snyder
@@ -181,7 +179,7 @@ int main()
 {
   std::cout << "ConditionsCleanerSvc_test\n";
   ISvcLocator* svcloc = nullptr;
-  if (!Athena_test::initGaudi("ConditionsCleanerSvc_test.txt", svcloc)) {
+  if (!Athena_test::initGaudi("AthenaServices/ConditionsCleanerSvc_test.txt", svcloc)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
   }  
diff --git a/Control/AthenaServices/test/DelayedConditionsCleanerSvc_test.cxx b/Control/AthenaServices/test/DelayedConditionsCleanerSvc_test.cxx
index 733e97a056dfca41908c8ef2d4a5f1a165cdb338..b6c305affd2998b977c213822fcbfeba52a542b6 100644
--- a/Control/AthenaServices/test/DelayedConditionsCleanerSvc_test.cxx
+++ b/Control/AthenaServices/test/DelayedConditionsCleanerSvc_test.cxx
@@ -26,7 +26,7 @@
 #include "GaudiKernel/Service.h"
 #include "tbb/global_control.h"
 #include "tbb/concurrent_queue.h"
-#include "tbb/task.h"
+#include "tbb/task_group.h"
 #include <list>
 #include <algorithm>
 #include <iostream>
@@ -490,47 +490,17 @@ void CCS::checkFin (bool threaded) const
 }
 
 
-class EventTask
-  : public tbb::task
-{
-public:
-  EventTask (const EventContext& ctx,
-             CCS& ccs,
-             Athena::IRCUSvc& rcu,
-             work_queue_t& wqueue);
-
-  tbb::task* execute() override;
-
-
-private:
-  EventContext m_ctx;
-  CCS& m_ccs;
-  IIncidentListener& m_rcu;
-  work_queue_t& m_wqueue;
-};
-
-
-EventTask::EventTask (const EventContext& ctx,
-                      CCS& ccs,
-                      Athena::IRCUSvc& rcu,
-                      work_queue_t& wqueue)
-  : m_ctx (ctx),
-    m_ccs (ccs),
-    m_rcu (dynamic_cast<IIncidentListener&>(rcu)),
-    m_wqueue (wqueue)
-{
-}
-
-
-tbb::task* EventTask::execute()
+void eventTask (const EventContext& ctx,
+                CCS& ccs,
+                Athena::IRCUSvc& rcu,
+                work_queue_t& wqueue)
 {
-  m_ccs.load (m_ctx);
-  m_ccs.check (m_ctx);
+  ccs.load (ctx);
+  ccs.check (ctx);
 
-  Incident inc ("test", IncidentType::EndEvent, m_ctx);
-  m_rcu.handle (inc);
-  m_wqueue.push (m_ctx.slot());
-  return nullptr;
+  Incident inc ("test", IncidentType::EndEvent, ctx);
+  dynamic_cast<IIncidentListener&>(rcu).handle (inc);
+  wqueue.push (ctx.slot());
 }
 
 
@@ -599,6 +569,7 @@ void Tester::event_loop (CCS& ccs, const std::vector<size_t>& evnums)
     m_ready.push (i);
   }
 
+  tbb::task_group tg;
   size_t nev = evnums.size();
   for (size_t ievt=0; ievt < nev; ievt++) {
     size_t slot;
@@ -608,9 +579,7 @@ void Tester::event_loop (CCS& ccs, const std::vector<size_t>& evnums)
 
     assert (m_cleaner.event (ctx, m_allowAsync).isSuccess() );
 
-    tbb::task* t = new (tbb::task::allocate_root())
-      EventTask (ctx, ccs, m_rcu, m_ready);
-    tbb::task::enqueue (*t);
+    tg.run ([&, ctx] { eventTask (ctx, ccs, m_rcu, m_ready); });
   }
 
   // Wait for all tasks to complete.
@@ -618,6 +587,7 @@ void Tester::event_loop (CCS& ccs, const std::vector<size_t>& evnums)
     size_t slot;
     m_ready.pop (slot);
   }
+  tg.wait();
 
   ccs.checkFin (true);
 }
@@ -653,7 +623,7 @@ int main()
   errorcheck::ReportMessage::hideErrorLocus();
   std::cout << "DelayedConditionsCleanerSvc_test\n";
   ISvcLocator* svcloc = 0;
-  if (!Athena_test::initGaudi("DelayedConditionsCleanerSvc_test.txt", svcloc)) {
+  if (!Athena_test::initGaudi("AthenaServices/DelayedConditionsCleanerSvc_test.txt", svcloc)) {
     std::cerr << "This test can not be run" << std::endl;
     return 1;
   }  
diff --git a/Control/AthenaServices/test/FPEControlSvc_test.cxx b/Control/AthenaServices/test/FPEControlSvc_test.cxx
index a9324bd9b5ead4a69978842643269b0c1fd90ba7..c6882aec71f30d10ec4abbed0cdc72b5b7d6ff25 100644
--- a/Control/AthenaServices/test/FPEControlSvc_test.cxx
+++ b/Control/AthenaServices/test/FPEControlSvc_test.cxx
@@ -54,7 +54,7 @@ int main()
 {
   errorcheck::ReportMessage::hideErrorLocus();
   ISvcLocator* svcloc = nullptr;
-  if (!Athena_test::initGaudi("FPEControlSvc_test.txt", svcloc)) {
+  if (!Athena_test::initGaudi("AthenaServices/FPEControlSvc_test.txt", svcloc)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
   }  
diff --git a/Control/AthenaServices/test/RCUSvc_test.cxx b/Control/AthenaServices/test/RCUSvc_test.cxx
index 2b56e9f6817015c6e56a0b9942cef511cb806041..e82f1db85944c7ecf5e5bef4ad9ca93e8b754444 100644
--- a/Control/AthenaServices/test/RCUSvc_test.cxx
+++ b/Control/AthenaServices/test/RCUSvc_test.cxx
@@ -1,8 +1,6 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
-
-// $Id$
 /**
  * @file  AthenaServices/test/RCUSvc_test.cxx
  * @author scott snyder
@@ -250,7 +248,7 @@ int main()
 {
   errorcheck::ReportMessage::hideErrorLocus();
   ISvcLocator* svcloc = 0;
-  if (!Athena_test::initGaudi("RCUSvc_test.txt", svcloc)) {
+  if (!Athena_test::initGaudi("AthenaServices/RCUSvc_test.txt", svcloc)) {
     std::cerr << "This test can not be run" << std::endl;
     return 1;
   }  
diff --git a/Control/AthenaServices/test/ThinningCacheTool_test.cxx b/Control/AthenaServices/test/ThinningCacheTool_test.cxx
index 7ac2329aa38f18cc4dc2bf4ffc423be6f5a4ef47..6f84c3cd1b856d4eb9628213b848b6c30bf3f88c 100644
--- a/Control/AthenaServices/test/ThinningCacheTool_test.cxx
+++ b/Control/AthenaServices/test/ThinningCacheTool_test.cxx
@@ -150,7 +150,7 @@ int main()
 {
   std::cout << "AthenaServices/ThinningCacheTool_test\n";
   ISvcLocator* svcloc = nullptr;
-  if (!Athena_test::initGaudi("ThinningCacheTool_test.txt", svcloc)) {
+  if (!Athena_test::initGaudi("AthenaServices/ThinningCacheTool_test.txt", svcloc)) {
     std::cerr << "This test can not be run" << std::endl;
     return 1;
   }  
diff --git a/Control/CxxUtils/CxxUtils/ConcurrentRangeMap.h b/Control/CxxUtils/CxxUtils/ConcurrentRangeMap.h
index 2be024807c89af7230a13086dfb1b38aa1949f42..b4aaaef30ceeedca30744ec356b91638a8894281 100644
--- a/Control/CxxUtils/CxxUtils/ConcurrentRangeMap.h
+++ b/Control/CxxUtils/CxxUtils/ConcurrentRangeMap.h
@@ -76,10 +76,26 @@ namespace CxxUtils {
  *  bool operator() (const KEY& k1,   const RANGE& r2) const;
  *  bool operator() (const RANGE& r1, const RANGE& r2) const;
  *  bool inRange (const KEY& k, const RANGE& r) const;
- *  // Test if two ranges overlap.  You may assume that operator() (r1, r2)
- *  // has returned true.
- *  bool overlap (const RANGE& r1, const RANGE& r2) const;
+ *
+ *  // Test if two ranges overlap, and adjust if needed.
+ *  // OLDRANGE is an existing range in the container, and NEWRANGE
+ *  // is a new one being added.  Return one of:
+ *  //   0 -- no overlap between the ranges; NEWRANGE is unmodified.
+ *  //   1 -- ranges overlap.  NEWRANGE has been adjusted to avoid the overlap.
+ *  //        If the start of NEWRANGE is changed, it must
+ *  //        only be moved forward (increased), never backwards.
+ *  //  -1 -- duplicate: NEWRANGE is entirely inside OLDRANGE.
+ *  //        Delete the new range.         
+ *  bool overlap (const Context_t& ctx,
+ *                const RANGE& oldRange, RANGE& newRange) const;
+ *
+ *  // Possibly extend an existing range at the end.
+ *  // RANGE is the existing range, and NEWRANGE is the range
+ *  // being added.  Returns one of:
  *  // Required only for extendLastRange --- which see.
+ *  //   0 -- no change was made to RANGE.
+ *  //   1 -- RANGE was extended. 
+ *  //  -1 -- newRange is a duplicate.
  *  int extendRange (Range& range, const Range& newRange) const;
  @endcode
  *
@@ -362,22 +378,7 @@ public:
    * This will make a new version of implementation data.
    *
    * The semantics of what it means to extend a range are given by the
-   * @c extendRange method of the @c COMPARE object:
-   *
-   *@code
-   *  int extendRange (Range& range, const Range& newRange) const;
-   @endif
-   *
-   * This is called with the existing range and the end range, and returns
-   * a flag.  -1 indicates an error, 0 indicates that no change
-   * was made to the range, and 1 indicates that the range was extended.
-   * It should generally be safe to extend a range by making the end later.
-   * Suggested semantics are:
-   *  - Return -1 if the start keys don't match.
-   *  - If the end value of @c newRange is later then then end value of @c range,
-   *    then update the end value of @c range to match @c newRange and
-   *    return 1.
-   *  - Otherwise do nothing and return 0.
+   * @c extendRange method of the @c COMPARE object (see above).
    *
    * Returns -1 if there was an error; 1 if the last range was extended;
    * and 0 if nothing was changed.
@@ -533,14 +534,14 @@ private:
   /**
    * @brief Extend the range of the last entry of the map.
    * @param Lock object.
-   * @param newRange New range to use for the last entry.
+   * @param extendedRange New range to use for the last entry.
    * @param ctx Execution context.
    *
    * Implementation of @c extendLastRange; see there for details.
    * Must be called with the lock held.
    */
   int extendImpl (lock_t& lock,
-                  const RANGE& newRange,
+                  const RANGE& extendedRange,
                     const typename Updater_t::Context_t& ctx);
 
 
diff --git a/Control/CxxUtils/CxxUtils/ConcurrentRangeMap.icc b/Control/CxxUtils/CxxUtils/ConcurrentRangeMap.icc
index 4567618245f015f9011c6afb1bd61e61b8dad069..e02a2ff0118ecfe4925f6a53f0bb3161d9d8eef6 100644
--- a/Control/CxxUtils/CxxUtils/ConcurrentRangeMap.icc
+++ b/Control/CxxUtils/CxxUtils/ConcurrentRangeMap.icc
@@ -196,15 +196,16 @@ CONCURRENTRANGEMAP::emplace (const RANGE& range,
   // Check if the element to be inserted is greater than all existing entries.
   bool pastEnd = (!last || m_compare (last->first, range));
 
-  // Make sure the new element is not a duplicate of the last.  Fail if so.
-  if (last && !pastEnd && !m_compare (range, last->first)) {
-    // Duplicate of the last entry.
-    if (tryExtend) {
-      if (extendImpl (lock, range, ctx) > 0) {
-        return EmplaceResult::EXTENDED;
-      }
+  // See if we want to extend the last entry.  Also check for duplicates.
+  if (last && !pastEnd) {
+    RANGE extendedRange = last->first;
+    int flag = m_compare.extendRange (extendedRange, range);
+    if (tryExtend && flag > 0 && extendImpl (lock, extendedRange, ctx) > 0) {
+      return EmplaceResult::EXTENDED;
+    }
+    if (flag < 0) {
+      return EmplaceResult::DUPLICATE;
     }
-    return EmplaceResult::DUPLICATE;
   }
 
   // Can we add this to the end?
@@ -213,8 +214,22 @@ CONCURRENTRANGEMAP::emplace (const RANGE& range,
   value_type* end = last ? last+1 : begin;
   if (pastEnd && end < m_impl->data() + m_impl->capacity())
   {
-    // Yes --- copy the data to the container.
-    end->first = range;
+    // Yes, we can add it to the end.
+    // Check for overlap with the previous range.
+    EmplaceResult ret = EmplaceResult::SUCCESS;
+    RANGE newRange = range;
+    if (end > begin) {
+      int flag = m_compare.overlap (ctx, (end-1)->first, newRange);
+      if (flag < 0) {
+        return EmplaceResult::DUPLICATE;
+      }
+      else if (flag > 0) {
+        ret = EmplaceResult::OVERLAP;
+      }
+    }
+
+    // Copy the data to the container.
+    end->first = newRange;
     end->second = ptr.release();
 
     std::atomic_thread_fence (std::memory_order_seq_cst);
@@ -225,11 +240,7 @@ CONCURRENTRANGEMAP::emplace (const RANGE& range,
     ++m_nInserts;
     m_maxSize = std::max (m_maxSize, static_cast<size_t> (end+1 - begin));
 
-    // Check for overlap with the previous range.
-    if (end > begin && m_compare.overlap ((end-1)->first, range)) {
-      return EmplaceResult::OVERLAP;
-    }
-    return EmplaceResult::SUCCESS;
+    return ret;
   }
 
   // No --- need to make a new implementation object and copy.
@@ -252,44 +263,78 @@ CONCURRENTRANGEMAP::emplace (const RANGE& range,
   // Separate out the case where the new item goes at the end,
   // since we can do that faster.
   if (pastEnd) {
-    new_end = std::copy (begin, end, new_end);
-    new_end->first = range;
-    new_end->second = ptr.release();
-    ++new_end;
+    // Check for overlap with the previous range.
+    RANGE newRange = range;
+    int flag = 0;
+    if (end) {
+      flag = m_compare.overlap (ctx, (end-1)->first, newRange);
+    }
+    if (flag < 0) {
+      ret = EmplaceResult::DUPLICATE;
+    }
+    else {
+      if (flag > 0) {
+        ret = EmplaceResult::OVERLAP;
+      }
+
+      new_end = std::copy (begin, end, new_end);
+      new_end->first = newRange;
+      new_end->second = ptr.release();
 
-    if (end > begin && m_compare.overlap ((end-1)->first, range)) {
-      ret = EmplaceResult::OVERLAP;
+      ++new_end;
     }
-        
   }
   else {
     // Otherwise we need to search for the proper place to insert the new entry.
-    while (begin < end) {
-      if (ptr && m_compare (range, begin->first)) {
-        // Make sure this isn't a duplicate.
+    RANGE newRange = range;
+    for (; begin < end; *new_end++ = *begin++) {
+      if (ptr && m_compare (newRange, begin->first)) {
+        // Check for overlap / duplicate
         if (begin > m_begin) {
-          if (!m_compare ((begin-1)->first, range)) {
+          int flag = m_compare.overlap (ctx, (begin-1)->first, newRange);
+          if (flag > 0) {
+            ret = EmplaceResult::OVERLAP;
+            // The range start may have been adjusted forward.  Make sure
+            // that we're still at the insertion point.
+            if (!m_compare (newRange, begin->first)) {
+              continue;
+            }
+          }
+          else if (flag < 0) {
             // Duplicate entry; fail.  Everything allocated is held by unique_ptr,
             // so should be cleaned up properly.
             return EmplaceResult::DUPLICATE;
           }
-          else if (m_compare.overlap ((begin-1)->first, range)) {
-            ret = EmplaceResult::OVERLAP;
-          }
         }
-        if (m_compare.overlap (range, begin->first)) {
+
+        int flag = m_compare.overlap (ctx, begin->first, newRange);
+        if (flag > 0) {
           ret = EmplaceResult::OVERLAP;
+          // The range start may have been adjusted forward.  Make sure
+          // that we're still at the insertion point.
+          if (!m_compare (newRange, begin->first)) {
+            continue;
+          }
+        }
+        else if (flag < 0) {
+          // Duplicate entry; fail.  Everything allocated is held by unique_ptr,
+          // so should be cleaned up properly.
+          return EmplaceResult::DUPLICATE;
         }
 
-        new_end->first = range;
+        new_end->first = newRange;
         new_end->second = ptr.release();
         ++new_end;
       }
-      *new_end++ = *begin++;
     }
 
-    // Must have dealt with the new element by now.
-    assert (!ptr);
+    if (ptr) {
+      // Possible to get here if overlap() moved the start of the range
+      // forward past all existing ranges.
+      new_end->first = newRange;
+      new_end->second = ptr.release();
+      ++new_end;
+    }
   }
 
   // Install the new implementation.
@@ -371,22 +416,7 @@ CONCURRENTRANGEMAP::erase (const key_query_type& key,
  * This will make a new version of implementation data.
  *
  * The semantics of what it means to extend a range are given by the
- * @c extendRange method of the @c COMPARE object:
- *
- *@code
- *  int extendRange (Range& range, const Range& newRange) const;
- @endif
- *
- * This is called with the existing range and the end range, and returns
- * a flag.  -1 indicates an error, 0 indicates that no change
- * was made to the range, and 1 indicates that the range was extended.
- * It should generally be safe to extend a range by making the end later.
- * Suggested semantics are:
- *  - Return -1 if the start keys don't match.
- *  - If the end value of @c newRange is later then then end value of @c range,
- *    then update the end value of @c range to match @c newRange and
- *    return 1.
- *  - Otherwise do nothing and return 0.
+ * @c extendRange method of the @c COMPARE object (see above).
  *
  * Returns -1 if there was an error; 1 if the last range was extended;
  * and 0 if nothing was changed.
@@ -398,7 +428,19 @@ CONCURRENTRANGEMAP::extendLastRange (const RANGE& newRange,
                                      /*= Updater_t::defaultContext()*/)
 {
   lock_t lock (m_mutex);
-  return extendImpl (lock, newRange, ctx);
+  value_type* last = m_last;
+  if (!last) {
+    return -1;
+  }
+  RANGE extendedRange = last->first;
+  int flag = m_compare.extendRange (extendedRange, newRange);
+  if (flag > 0) {
+    return extendImpl (lock, extendedRange, ctx);
+  }
+  if (flag == 0) {
+    return -1;
+  }
+  return 0;
 }
 
 
@@ -446,7 +488,7 @@ CONCURRENTRANGEMAP::updateRanges (std::function<void (RANGE&)> rangeUpdater,
 /**
  * @brief Extend the range of the last entry of the map.
  * @param Lock object.
- * @param newRange New range to use for the last entry.
+ * @param extendedRange New range to use for the last entry.
  * @param ctx Execution context.
  *
  * Implementation of @c extendLastRange; see there for details.
@@ -455,26 +497,13 @@ CONCURRENTRANGEMAP::updateRanges (std::function<void (RANGE&)> rangeUpdater,
 T_CONCURRENTRANGEMAP
 int
 CONCURRENTRANGEMAP::extendImpl (lock_t& /*lock*/,
-                                const RANGE& newRange,
+                                const RANGE& extendedRange,
                                 const typename Updater_t::Context_t& ctx)
 {
   // Return if the container's empty.
   value_type* last = m_last;
   if (last == nullptr) return -1;
 
-  // Test the range.
-  RANGE extendedRange = last->first;
-  int flag = m_compare.extendRange (extendedRange, newRange);
-
-  if (flag < 0) {
-    // Error.
-    return -1;
-  }
-  else if (flag == 0) {
-    // No-op.
-    return 0;
-  }
-
   // Make a new implementation object and copy data.
   size_t capacity = m_impl->capacity();
   auto new_impl = std::make_unique<Impl> (m_delete, capacity);
diff --git a/Control/CxxUtils/test/ConcurrentBitset_test.cxx b/Control/CxxUtils/test/ConcurrentBitset_test.cxx
index 52fd06c484e3cc5ab97600f712fc2a22a86711fa..b650109d6c9ef7bc623606bba163d0de8c0aec5f 100644
--- a/Control/CxxUtils/test/ConcurrentBitset_test.cxx
+++ b/Control/CxxUtils/test/ConcurrentBitset_test.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 /*
  */
@@ -863,7 +863,7 @@ CKHSAdapter::CKHSAdapter()
 CKHSAdapter::CKHSAdapter (const CKHSAdapter& other)
   : CKHSAdapter()
 {
-  ck_hs_iterator it { nullptr, 0};
+  ck_hs_iterator it { nullptr, 0, nullptr};
   void* obj;
   ck_hs_t* hs_nc ATLAS_THREAD_SAFE = const_cast<ck_hs_t*>(&other.m_hs);
   while (ck_hs_next (hs_nc, &it, &obj)) {
diff --git a/Control/CxxUtils/test/ConcurrentRangeMap_test.cxx b/Control/CxxUtils/test/ConcurrentRangeMap_test.cxx
index 5e190c6fc78b519b6d64cde1a7eb59e775ac7920..6399a7f10afa6bb988e9cb754dc3080d3123c4c6 100644
--- a/Control/CxxUtils/test/ConcurrentRangeMap_test.cxx
+++ b/Control/CxxUtils/test/ConcurrentRangeMap_test.cxx
@@ -19,6 +19,7 @@
 #include <cassert>
 #include <iostream>
 #include <cstdlib>
+#include <sstream>
 
 
 const int nslots = 4;
@@ -28,6 +29,8 @@ const int ninflight = 10;
 
 typedef unsigned int Time;
 
+typedef int Context_t;
+
 
 struct Range
 {
@@ -48,18 +51,85 @@ struct RangeCompare
   { return r1.m_begin < r2.m_begin; }
   bool inRange (const Time t, const Range& r) const
   { return t >= r.m_begin && t < r.m_end; }
-  bool overlap (const Range& r1, const Range& r2) const
-  { return r1.m_end > r2.m_begin; }
 
-  int extendRange (Range& r, const Range& newRange) const
+
+  // 1 -- overlap, newRange truncated
+  // 0 -- no overlap
+  // -1 -- duplicate, discard newRange
+  int overlap (const Context_t& /*ctx*/,
+               const Range& oldRange, Range& newRange) const
   {
-    if (r.m_begin != newRange.m_begin) {
+    //                              |--- oldRange ---|
+    //  |--- newRange ---|
+    if (newRange.m_end <= oldRange.m_begin) {
+      return 0;
+    }
+        
+    //  |--- oldRange ---|
+    //                        |--- newRange ---|
+    if (oldRange.m_end <= newRange.m_begin) {
+      return 0;
+    }
+
+    //   |---     oldRange    ---|
+    //      |--- newRange ---|
+    if (newRange.m_begin >= oldRange.m_begin &&
+        newRange.m_end <= oldRange.m_end)
+    {
       return -1;
     }
-    if (newRange.m_end <= r.m_end) {
+    
+    //              |---     oldRange    ---|
+    //      |--- newRange                           ---|
+    if (newRange.m_begin < oldRange.m_begin &&
+        newRange.m_end > oldRange.m_end)
+    {
+      newRange.m_begin = oldRange.m_end;
+    }
+
+    //              |---     oldRange    ---|
+    //      |--- newRange ---|
+    else if (newRange.m_begin < oldRange.m_begin &&
+        newRange.m_end > oldRange.m_begin)
+    {
+      newRange.m_end = oldRange.m_begin;
+    }
+
+    //      |---     oldRange    ---|
+    //                 |--- newRange ---|
+    else if (newRange.m_begin < oldRange.m_end) {
+      newRange.m_begin = oldRange.m_end;
+    }
+
+    return 1;
+  }
+
+  //  1 -> range was extended
+  // -1 -> duplicate
+  //  0 -- no change
+  int extendRange (Range& range, const Range& newRange) const
+  {
+    //      |--- range ---|
+    //  |--- newRange ....
+    if (newRange.m_begin < range.m_begin) {
+      return 0;
+    }
+
+    //      |--- range ---|
+    //                         |--- newRange ....
+    if (newRange.m_begin > range.m_end) {
       return 0;
     }
-    r.m_end = newRange.m_end;
+
+    //      |--- range ----------------|
+    //         |--- newRange ---|
+    if (newRange.m_end <= range.m_end) {
+      return -1;
+    }
+
+    //      |--- range ----|
+    //         |--- newRange ---|
+    range.m_end = newRange.m_end;
     return 1;
   }
 };
@@ -92,7 +162,7 @@ template <class T>
 class TestUpdater
 {
 public:
-  typedef int Context_t;
+  using Context_t = ::Context_t;
 
   TestUpdater()
     : m_p (nullptr),
@@ -159,6 +229,16 @@ typedef CxxUtils::ConcurrentRangeMap<Range, Time, Payload, RangeCompare,
   TestMap;
 
 
+std::string str (const TestMap& m)
+{
+  std::ostringstream ss;
+  for (const auto& p : m.range()) {
+    ss << p.first.m_begin << ".." << p.first.m_end << "->" << p.second->m_x << " ";
+  }
+  return ss.str();
+}
+
+
 void test1a()
 {
   std::cout << "test1a\n";
@@ -177,7 +257,7 @@ void test1a()
 
     assert (map.emplace (Range (10, 20), std::make_unique<Payload> (100, &phist)) ==
             TestMap::EmplaceResult::SUCCESS);
-    // 10..20->100 - -
+    assert (str(map) == "10..20->100 "); // + 2 empty
     assert (map.capacity() == 3);
     assert (map.size() == 1);
     assert (!map.empty());
@@ -202,7 +282,7 @@ void test1a()
 
     assert (map.emplace (Range (25, 30), std::make_unique<Payload> (200, &phist)) ==
             TestMap::EmplaceResult::SUCCESS);
-    // 10..20->100 25..30->200 -
+    assert (str(map) == "10..20->100 25..30->200 "); // + 1 empty
     assert (map.capacity() == 3);
     assert (map.size() == 2);
     r = map.range();
@@ -224,7 +304,7 @@ void test1a()
 
     assert (map.emplace (Range (30, 40), std::make_unique<Payload> (300, &phist)) ==
             TestMap::EmplaceResult::SUCCESS);
-    // 10..20->100 25..30->200 30..40->300
+    assert (str(map) == "10..20->100 25..30->200 30..40->300 "); // + 0 empty
     assert (map.capacity() == 3);
     assert (map.size() == 3);
     r = map.range();
@@ -248,7 +328,7 @@ void test1a()
 
     assert (map.emplace (Range (50, 60), std::make_unique<Payload> (400, &phist)) ==
             TestMap::EmplaceResult::SUCCESS);
-    // 10..20->100 25..30->200 30..40->300 50..60->400 - -
+    assert (str(map) == "10..20->100 25..30->200 30..40->300 50..60->400 "); // + 2 empty
     assert (map.capacity() == 6);
     assert (map.size() == 4);
     r = map.range();
@@ -274,7 +354,7 @@ void test1a()
 
     assert (map.emplace (Range (40, 45), std::make_unique<Payload> (500, &phist)) ==
             TestMap::EmplaceResult::SUCCESS);
-    // 10..20->100 25..30->200 30..40->300 40..45->500 50..60->400 - - -
+    assert (str(map) == "10..20->100 25..30->200 30..40->300 40..45->500 50..60->400 "); // + 3 empty
     assert (map.capacity() == 8);
     assert (map.size() == 5);
     r = map.range();
@@ -304,7 +384,7 @@ void test1a()
     //======
 
     map.erase (15);
-    // - 25..30->200 30..40->300 40..45->500 50..60->400 - - -
+    assert (str(map) == "25..30->200 30..40->300 40..45->500 50..60->400 "); // + 3 empty + 1 empty at start
     assert (map.capacity() == 8);
     assert (map.size() == 4);
     r = map.range();
@@ -330,7 +410,7 @@ void test1a()
     //======
 
     map.erase (25);
-    // - - 30..40->300 40..45->500 50..60->400 - - -
+    assert (str(map) == "30..40->300 40..45->500 50..60->400 "); // + 3 empty + 2 empty at start
     assert (map.capacity() == 8);
     assert (map.size() == 3);
     r = map.range();
@@ -355,7 +435,7 @@ void test1a()
     //======
 
     map.erase (40);
-    // 30..40->300 50..60->400 - - - - - -
+    assert (str(map) == "30..40->300 50..60->400 "); // + 6 empty
     assert (map.capacity() == 8);
     assert (map.size() == 2);
     r = map.range();
@@ -379,7 +459,7 @@ void test1a()
     //======
 
     map.erase (35);
-    // - 50..60->400 - - - - - -
+    assert (str(map) == "50..60->400 "); // + 6 empty + 1 empty at start
     assert (map.capacity() == 8);
     assert (map.size() == 1);
     r = map.range();
@@ -395,7 +475,7 @@ void test1a()
     //======
 
     map.erase (50);
-    // - - + - - - - - -
+    assert (str(map) == ""); // + 6 empty + 2 empty at start
     assert (map.capacity() == 8);
     assert (map.size() == 0);
     r = map.range();
@@ -410,7 +490,7 @@ void test1a()
 
     assert (map.emplace (Range (70, 75), std::make_unique<Payload> (600, &phist)) ==
             TestMap::EmplaceResult::SUCCESS);
-    // - - 70..75->600 - - - - -
+    assert (str(map) == "70..75->600 "); // + 5 empty + 2 empty at start
     assert (map.capacity() == 8);
     assert (map.size() == 1);
     r = map.range();
@@ -434,7 +514,7 @@ void test1a()
             TestMap::EmplaceResult::SUCCESS);
     assert (map.emplace (Range (93, 96), std::make_unique<Payload> (650, &phist)) ==
             TestMap::EmplaceResult::SUCCESS);
-    // - - 70..75->600 75..80->610 80..85->620 85..90->630 90..93->640 93..96->650
+    assert (str(map) == "70..75->600 75..80->610 80..85->620 85..90->630 90..93->640 93..96->650 "); // + 2 empty at start
     assert (map.capacity() == 8);
     assert (map.size() == 6);
     r = map.range();
@@ -465,7 +545,7 @@ void test1a()
     map.erase (80);
     map.erase (85);
     map.erase (90);
-    // - - - - - - - 93..96->650
+    assert (str(map) == "93..96->650 "); // + 7 empty at start
     assert (map.capacity() == 8);
     assert (map.size() == 1);
     r = map.range();
@@ -483,7 +563,7 @@ void test1a()
 
     assert (map.emplace (Range (97, 99), std::make_unique<Payload> (660, &phist)) ==
             TestMap::EmplaceResult::SUCCESS);
-    // 93..96->650 97..99->660 - - - - - -
+    assert (str(map) == "93..96->650 97..99->660 "); // + 6 empty
     assert (map.capacity() == 8);
     assert (map.size() == 2);
     r = map.range();
@@ -503,7 +583,7 @@ void test1a()
 
     assert (map.extendLastRange (Range (97, 110)) == 1);
     
-    // 93..96->650 97..110->660 - - - - - -
+    assert (str(map) == "93..96->650 97..110->660 "); // + 6 empty
     assert (map.capacity() == 8);
     assert (map.size() == 2);
     r = map.range();
@@ -525,7 +605,7 @@ void test1a()
 
     assert (map.extendLastRange (Range (97, 105)) == 0);
     
-    // 93..96->650 97..110->660 - - - - - -
+    assert (str(map) == "93..96->650 97..110->660 "); // + 6 empty
     assert (map.capacity() == 8);
     assert (map.size() == 2);
     r = map.range();
@@ -545,8 +625,9 @@ void test1a()
 
     //======
 
-    assert ( map.extendLastRange (Range (98, 120)) < 0 );
-    // 93..96->650 97..110->660 - - - - - -
+    assert (map.extendLastRange (Range (95, 120)) < 0);
+    
+    assert (str(map) == "93..96->650 97..110->660 "); // + 6 empty
     assert (map.capacity() == 8);
     assert (map.size() == 2);
     r = map.range();
@@ -566,10 +647,31 @@ void test1a()
 
     //======
 
+    assert ( map.extendLastRange (Range (98, 120)) == 1 );
+    assert (str(map) == "93..96->650 97..120->660 "); // + 6 empty
+    assert (map.capacity() == 8);
+    assert (map.size() == 2);
+    r = map.range();
+    assert (r.size() == 2);
+    assert (r.begin()->second->m_x == 650);
+    assert ((r.begin()+1)->second->m_x == 660);
+    assert ((r.begin()+1)->first.m_begin == 97);
+    assert ((r.begin()+1)->first.m_end == 120);
+    assert (map.find (92) == nullptr);
+    assert (map.find (94)->second->m_x == 650);
+    assert (map.find (115)->second->m_x == 660);
+
+    assert (!phist.empty());
+
+    assert (map.nInserts() == 12);
+    assert (map.maxSize()  == 6);
+
+    //======
+
     assert (map.emplace (Range (97, 150),
                          std::make_unique<Payload> (670, &phist), true) ==
             TestMap::EmplaceResult::EXTENDED);
-    // 93..96->650 97..150->660 - - - - - -
+    assert (str(map) == "93..96->650 97..150->660 "); // + 6 empty
     assert (map.capacity() == 8);
     assert (map.size() == 2);
     r = map.range();
@@ -620,7 +722,7 @@ void test1b()
           TestMap::EmplaceResult::SUCCESS);
   assert (map.emplace (Range (40, 45), std::make_unique<Payload> (500, &phist)) ==
           TestMap::EmplaceResult::SUCCESS);
-  // 10..20->100 25..30->200 30..40->300 40..45->500 50..60->400
+  assert (str(map) == "10..20->100 25..30->200 30..40->300 40..45->500 50..60->400 ");
 
   assert (map.size() == 5);
 
@@ -668,41 +770,53 @@ void test1c()
   TestMap map (TestMap::Updater_t(), delfcn, 3);
   assert (map.emplace (Range (10, 40), std::make_unique<Payload> (100, &phist)) ==
           TestMap::EmplaceResult::SUCCESS);
-  // 10..40->100
+  assert (str(map) == "10..40->100 ");
 
   assert (map.emplace (Range (5, 15), std::make_unique<Payload> (101, &phist)) ==
           TestMap::EmplaceResult::OVERLAP);
-  // 5..15->101 10..40->100
+  assert (str(map) == "5..10->101 10..40->100 ");
 
   assert (map.emplace (Range (35, 50), std::make_unique<Payload> (102, &phist)) ==
           TestMap::EmplaceResult::OVERLAP);
-  // 5..15->101 10..40->100  35..50->102
+  assert (str(map) == "5..10->101 10..40->100 40..50->102 ");
 
   map.erase (10);
   assert (map.emplace (Range (20, 30), std::make_unique<Payload> (103, &phist)) ==
           TestMap::EmplaceResult::SUCCESS);
-  // 5..15->101  20..30->103  35..50->102
+  assert (str(map) == "5..10->101 20..30->103 40..50->102 ");
 
-  assert (map.emplace (Range (12, 17), std::make_unique<Payload> (104, &phist)) ==
+  assert (map.emplace (Range (8, 17), std::make_unique<Payload> (104, &phist)) ==
           TestMap::EmplaceResult::OVERLAP);
-  // 5..15->101  12..17->104  20..30->103  35..50->102
+  assert (str(map) == "5..10->101 10..17->104 20..30->103 40..50->102 ");
 
   assert (map.emplace (Range (19, 25), std::make_unique<Payload> (105, &phist)) ==
           TestMap::EmplaceResult::OVERLAP);
-  // 5..15->101  12..17->104  19..25->105  20..30->103  35..50->102
+  assert (str(map) == "5..10->101 10..17->104 19..20->105 20..30->103 40..50->102 ");
 
   assert (map.emplace (Range (28, 37), std::make_unique<Payload> (106, &phist)) ==
           TestMap::EmplaceResult::OVERLAP);
-  // 5..15->101  12..17->104  19..25->105  20..30->103  28..37->106  35..50->102
+  assert (str(map) == "5..10->101 10..17->104 19..20->105 20..30->103 30..37->106 40..50->102 ");
+
+  map.erase (10);
+  map.erase (20);
+  assert (str(map) == "5..10->101 19..20->105 30..37->106 40..50->102 ");
+
+  assert (map.emplace (Range (15, 25), std::make_unique<Payload> (107, &phist)) ==
+          TestMap::EmplaceResult::OVERLAP);
+  assert (str(map) == "5..10->101 19..20->105 20..25->107 30..37->106 40..50->102 ");
+
+  assert (map.emplace (Range (38, 60), std::make_unique<Payload> (108, &phist)) ==
+          TestMap::EmplaceResult::OVERLAP);
+  assert (str(map) == "5..10->101 19..20->105 20..25->107 30..37->106 40..50->102 50..60->108 ");
 
   TestMap::const_iterator_range r = map.range();
   assert (r.size() == 6);
-  assert ((r.begin()+0)->first == Range ( 5, 15));
-  assert ((r.begin()+1)->first == Range (12, 17));
-  assert ((r.begin()+2)->first == Range (19, 25));
-  assert ((r.begin()+3)->first == Range (20, 30));
-  assert ((r.begin()+4)->first == Range (28, 37));
-  assert ((r.begin()+5)->first == Range (35, 50));
+  assert ((r.begin()+0)->first == Range ( 5, 10));
+  assert ((r.begin()+1)->first == Range (19, 20));
+  assert ((r.begin()+2)->first == Range (20, 25));
+  assert ((r.begin()+3)->first == Range (30, 37));
+  assert ((r.begin()+4)->first == Range (40, 50));
+  assert ((r.begin()+5)->first == Range (50, 60));
 }
 
 
diff --git a/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle1.ref b/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle1.ref
index f501ecef6b4ccb472d621b0ba9b5c671f942dc40..6fcb1184575d11de5b35fa744aded81fcc5a4769 100644
--- a/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle1.ref
+++ b/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle1.ref
@@ -1,44 +1,47 @@
-Mon Jan 29 12:05:13 EST 2018
-WARNING: TCMALLOCDIR not defined, will use libc malloc
+Sat Jun 27 18:32:57 CEST 2020
+Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [?-21.0.0] [i686-slc5-gcc43-dbg] [?/?] -- built on [?]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "DataModelRunTests/xAODTestDecorHandle1_jo.py"
-Py:ConfigurableDb    INFO Read module info for 468 configurables from 2 genConfDb files
-Py:ConfigurableDb    INFO No duplicates have been found: that's good !
+Py:Athena            INFO including file "DataModelRunTests/commonTrailer.py"
+Py:Athena            INFO including file "DataModelRunTests/setCatalog.py"
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
-# setting LC_ALL to "C"
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
+Py:ConfigurableDb    INFO No duplicates have been found: that's good !
+ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99)
-                                          running on karma on Mon Jan 29 12:05:17 2018
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
+                                          running on lxplus755.cern.ch on Sat Jun 27 18:33:12 2020
 ====================================================================================================================================
-ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
-StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 2455 CLIDRegistry entries for module ALL
-ChronoStatSvc        INFO  Number of skipped events for MemStat-1
+ClassIDSvc           INFO  getRegistryEntries: read 7027 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
-ClassIDSvc           INFO  getRegistryEntries: read 7558 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 65 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 374 CLIDRegistry entries for module ALL
-HistogramPersis...WARNING Histograms saving not required.
+ClassIDSvc           INFO  getRegistryEntries: read 705 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1415 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 4610 CLIDRegistry entries for module ALL
+xAODMaker::Even...   INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
+xAODMaker::Even...   INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
+xAODMaker::Even...WARNING Beam conditions service not available
+xAODMaker::Even...WARNING Will not fill beam spot information into xAOD::EventInfo
+ClassIDSvc           INFO  getRegistryEntries: read 423 CLIDRegistry entries for module ALL
 EventSelector        INFO  Enter McEventSelector Initialization 
 AthenaEventLoopMgr   INFO Setup EventSelector service EventSelector
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr       INFO Application Manager Started successfully
 EventPersistenc...   INFO Added successfully Conversion service:McCnvSvc
-ClassIDSvc           INFO  getRegistryEntries: read 108 CLIDRegistry entries for module ALL
 AthenaEventLoopMgr   INFO   ===>>>  start of run 0    <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #0, run #0 0 events processed so far  <<<===
+ClassIDSvc           INFO  getRegistryEntries: read 108 CLIDRegistry entries for module ALL
 xAODTestReadDecor    INFO cvec.dInt1: 401 402 403 404 405 406 407 408 409 410
 xAODTestReadDecor    INFO cinfo.dInt1: 3000
 xAODTestReadDecor    INFO cinfo.dInt1Base: 3001
@@ -164,7 +167,6 @@ IncidentProcAlg2     INFO Finalize
 EventSelector        INFO finalize
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
-ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
 ApplicationMgr       INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle1MT.ref b/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle1MT.ref
index 5666e9bb99f365290702e246eee2eb9a3d089328..eaa9eb5ba873de7faa40ccb48aeaafc1f3e4e177 100644
--- a/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle1MT.ref
+++ b/Control/DataModelTest/DataModelRunTests/share/xAODTestDecorHandle1MT.ref
@@ -1,7 +1,7 @@
-Wed Jun  3 16:04:05 PDT 2020
+Sat Jun 27 04:58:32 CEST 2020
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [WorkDir-22.0.15] [x86_64-centos7-gcc8-opt] [Unknown/07d2aec7427] -- built on [2020-06-03T1534]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO configuring AthenaHive with [1] concurrent threads and [1] concurrent events
@@ -12,7 +12,7 @@ Py:Athena            INFO including file "DataModelRunTests/xAODTestDecorHandle1
 Py:Athena            INFO including file "DataModelRunTests/commonTrailer.py"
 Py:Athena            INFO including file "DataModelRunTests/setCatalog.py"
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
-Py:ConfigurableDb    INFO Read module info for 5530 configurables from 17 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
@@ -20,19 +20,19 @@ MessageSvc           INFO Activating in a separate thread
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
                                                    Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
-                                          running on zeus on Wed Jun  3 16:04:13 2020
+                                          running on lxplus755.cern.ch on Sat Jun 27 04:58:42 2020
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr                                      INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 AthDictLoaderSvc                                    INFO in initialize...
 AthDictLoaderSvc                                    INFO acquired Dso-registry
-ClassIDSvc                                          INFO  getRegistryEntries: read 3835 CLIDRegistry entries for module ALL
+ClassIDSvc                                          INFO  getRegistryEntries: read 7399 CLIDRegistry entries for module ALL
 CoreDumpSvc                                         INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc                                         INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaHiveEventLoopMgr                              INFO Initializing AthenaHiveEventLoopMgr - package version AthenaServices-00-00-00
 ClassIDSvc                                     0    INFO  getRegistryEntries: read 1128 CLIDRegistry entries for module ALL
-ClassIDSvc                                     0    INFO  getRegistryEntries: read 1401 CLIDRegistry entries for module ALL
-ClassIDSvc                                     0    INFO  getRegistryEntries: read 6325 CLIDRegistry entries for module ALL
+ClassIDSvc                                     0    INFO  getRegistryEntries: read 1415 CLIDRegistry entries for module ALL
+ClassIDSvc                                     0    INFO  getRegistryEntries: read 4610 CLIDRegistry entries for module ALL
 xAODMaker::EventInfoCnvAlg                     0    INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
 xAODMaker::EventInfoCnvAlg.EventInfoC...       0    INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
 xAODMaker::EventInfoCnvAlg.EventInfoC...       0 WARNING Beam conditions service not available
@@ -233,7 +233,7 @@ xAODTestReadDecor                         19   0    INFO cinfo.dInt1: 60000
 xAODTestReadDecor                         19   0    INFO cinfo.dInt1Base: 60001
 xAODTestReadDecor                         19   0    INFO cinfo.dInt1: 60000
 AthenaHiveEventLoopMgr                    19   0    INFO   ===>>>  done processing event #19, run #0 on slot 0,  20 events processed so far  <<<===
-AthenaHiveEventLoopMgr                    19   0    INFO ---> Loop Finished (seconds): 0.0308177
+AthenaHiveEventLoopMgr                    19   0    INFO ---> Loop Finished (seconds): 0.0376902
 ApplicationMgr                                      INFO Application Manager Stopped successfully
 IncidentProcAlg1                                    INFO Finalize
 SGInputLoader                                       INFO Finalizing SGInputLoader...
@@ -243,7 +243,6 @@ AvalancheSchedulerSvc                               INFO Joining Scheduler threa
 EventDataSvc                                        INFO Finalizing EventDataSvc - package version StoreGate-00-00-00
 AthDictLoaderSvc                                    INFO in finalize...
 ToolSvc                                             INFO Removing all tools created by ToolSvc
-ChronoStatSvc.finalize()                            INFO  Service finalized successfully 
 ApplicationMgr                                      INFO Application Manager Finalized successfully
 ApplicationMgr                                      INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/Control/DataModelTest/DataModelTestDataCommon/DataModelTestDataCommon/BAux.h b/Control/DataModelTest/DataModelTestDataCommon/DataModelTestDataCommon/BAux.h
index af06a7e7b648867ae0b8c2b008831acfe47093dd..7f313bd8370fef075afc09621953a970ebbdd4dc 100644
--- a/Control/DataModelTest/DataModelTestDataCommon/DataModelTestDataCommon/BAux.h
+++ b/Control/DataModelTest/DataModelTestDataCommon/DataModelTestDataCommon/BAux.h
@@ -1,10 +1,8 @@
 // This file's extension implies that it's C, but it's really -*- C++ -*-.
 
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
-
-// $Id$
 /**
  * @file DataModelTestDataCommon/BAux.h
  * @author scott snyder <snyder@bnl.gov>
@@ -31,6 +29,7 @@ struct BAux
   int m_x;
 
   /// Flag that we should _not_ use the xAOD pool converter for this type.
+  // cppcheck-suppress duplInheritedMember
   static constexpr bool supportsThinning = false;
 };
 
diff --git a/Control/DataModelTest/DataModelTestDataCommon/src/CondReaderAlg.cxx b/Control/DataModelTest/DataModelTestDataCommon/src/CondReaderAlg.cxx
index 4eb72456a4e0f260c449ee60a7712be0a02ae08d..22d503a5efb871c5f2a53cc987ea15f7c674d149 100644
--- a/Control/DataModelTest/DataModelTestDataCommon/src/CondReaderAlg.cxx
+++ b/Control/DataModelTest/DataModelTestDataCommon/src/CondReaderAlg.cxx
@@ -1,9 +1,6 @@
 /*
   Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
-/*
- */
-// $Id$
 /**
  * @file DataModelTestDataCommon/src/CondReaderAlg.cxx
  * @author scott snyder <snyder@bnl.gov>
@@ -113,6 +110,7 @@ StatusCode CondReaderAlg::execute (const EventContext& ctx) const
     for (size_t i = 0; i < m_spins; i++) {
       {
         SG::ReadCondHandle<AthenaAttributeList> attrList (m_attrListKey, ctx);
+        // cppcheck-suppress internalAstError;  work around cppcheck 2.0 parse failure
         xx += (**attrList)[xint].template data<int>();
       }
       {
diff --git a/Control/PerformanceMonitoring/PerfMonAna/CMakeLists.txt b/Control/PerformanceMonitoring/PerfMonAna/CMakeLists.txt
index 704b336ba5ea0452902d27306dea02508f315651..4427629d39627b13bd5dc75965d1dcb2d3b569b3 100644
--- a/Control/PerformanceMonitoring/PerfMonAna/CMakeLists.txt
+++ b/Control/PerformanceMonitoring/PerfMonAna/CMakeLists.txt
@@ -24,4 +24,3 @@ atlas_add_alias( pmontree "pmontree.py" )
 atlas_add_alias( perfrtt "perfrtt.py" )
 atlas_add_alias( perfmon "perfmon.py" )
 atlas_add_alias( perf-dpmon "perf-dpmon.py" )
-atlas_add_alias( perfmonmt-plotter "perfmonmt-plotter.py" )
diff --git a/Control/PerformanceMonitoring/PerfMonAna/bin/perfmonmt-printer.py b/Control/PerformanceMonitoring/PerfMonAna/bin/perfmonmt-printer.py
new file mode 100755
index 0000000000000000000000000000000000000000..507fbaf6c16ae399520209a58d10ca9a2ab82f4a
--- /dev/null
+++ b/Control/PerformanceMonitoring/PerfMonAna/bin/perfmonmt-printer.py
@@ -0,0 +1,184 @@
+#! /usr/bin/env python
+
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+import json
+import argparse
+
+# Print Header
+def printHeader():
+    print('='*105)
+    print('{0:^105}'.format('PerfMonMTSvc Report'))
+    print('='*105)
+    print('{0:<105}'.format('IMPORTANT : PLEASE NOTE THAT THIS SERVICE IS CURRENTLY IN R&D PHASE.'))
+    print('{0:<105}'.format('            FOR FURTHER INFORMATION/QUERIES PLEASE GET IN TOUCH WITH THE SPOT TEAM.'))
+    print('='*105)
+
+# Print Footer
+def printFooter():
+    print('='*105)
+    print('{0:^105}'.format('ALL DONE!'))
+    print('='*105)
+
+# Print Component Level Data in Descending Order
+def printComponentLevelInfo(execOnly = True, orderBy = 'cpuTime', maxComps = -1):
+    if 'componentLevel' not in data:
+        return
+    print('='*105)
+    print('{0:^105}'.format('Component Level Monitoring'))
+    print('='*105)
+    print('{0:<18}{1:<10}{2:<20}{3:<20}{4:<20}{5:<20}'.format('Step',
+                                                              'Count',
+                                                              'CPU Time [ms]',
+                                                              'Vmem [kB]',
+                                                              'Malloc [kB]',
+                                                              'Component'))
+    print('='*105)
+    steps = ['Initialize', 'Execute', 'Finalize', 'Callback', 'preLoadProxy']
+    if execOnly:
+        steps = ['Execute']
+    ncomps = 0
+    for step in steps:
+        for entry in sorted(data['componentLevel'][step],
+                            key=lambda x: data['componentLevel'][step][x][orderBy], reverse = True):
+            print('{0:<18}{1:<10}{2:<20.2f}{3:<20}{4:<20}{5:<20}'.format(step,
+                                                                        data['componentLevel'][step][entry]['count'],
+                                                                        data['componentLevel'][step][entry]['cpuTime'],
+                                                                        data['componentLevel'][step][entry]['vmem'],
+                                                                        data['componentLevel'][step][entry]['malloc'],
+                                                                        entry))
+            ncomps += 1
+            if (ncomps == maxComps):
+                break
+        print('='*105)
+
+# Event Level Data in Ascending Order
+def printEventLevelInfo():
+    if 'eventLevel' not in data:
+        return
+    print('='*105)
+    print('{0:^105}'.format('Event Level Monitoring'))
+    print('='*105)
+    print('{0:^15}{1:^15}{2:^15}{3:^15}{4:^15}{5:^15}{6:^15}'.format('Event',
+                                                                     'CPU [s]',
+                                                                     'Wall [s]',
+                                                                     'Vmem [kB]',
+                                                                     'Rss [kB]',
+                                                                     'Pss [kB]',
+                                                                     'Swap [kB]'))
+    print('='*105)
+    for entry in sorted(data['eventLevel'], key=float):
+        print('{0:^15}{1:^15.2f}{2:^15.2f}{3:^15}{4:^15}{5:^15}{6:^15}'.format(entry,
+                                                                               data['eventLevel'][entry]['cpuTime']*0.001,
+                                                                               data['eventLevel'][entry]['wallTime']*0.001,
+                                                                               data['eventLevel'][entry]['vmem'],
+                                                                               data['eventLevel'][entry]['rss'],
+                                                                               data['eventLevel'][entry]['pss'],
+                                                                               data['eventLevel'][entry]['swap']))
+# Snapshots Summary
+def printSnapshotsInfo():
+    if 'summary' not in data:
+        return
+    if 'snapshotLevel' not in data['summary']:
+        return
+    print('='*105)
+    print('{0:^105}'.format('Snapshots Summary'))
+    print('='*105)
+    print('{0:<14}{1:<13}{2:<13}{3:<13}{4:<13}{5:<13}{6:<13}{7:<13}'.format('Step',
+                                                                            'dCPU [s]',
+                                                                            'dWall [s]',
+                                                                            '<CPU>',
+                                                                            'dVmem [kB]',
+                                                                            'dRss [kB]',
+                                                                            'dPss [kB]',
+                                                                            'dSwap [kB]'))
+    print('-'*105)
+    for entry in ['Configure','Initialize','Execute','Finalize']:
+        print('{0:<14}{1:<13.2f}{2:<13.2f}{3:<13.2f}{4:<13}{5:<13}{6:<13}{7:<13}'.format(entry,
+                                                                                         data['summary']['snapshotLevel'][entry]['dCPU']*0.001,
+                                                                                         data['summary']['snapshotLevel'][entry]['dWall']*0.001,
+                                                                                         data['summary']['snapshotLevel'][entry]['cpuUtil'],
+                                                                                         data['summary']['snapshotLevel'][entry]['dVmem'],
+                                                                                         data['summary']['snapshotLevel'][entry]['dRss'],
+                                                                                         data['summary']['snapshotLevel'][entry]['dPss'],
+                                                                                         data['summary']['snapshotLevel'][entry]['dSwap']))
+    print('*'*105)
+    print('{0:<40}{1:<}'.format('Number of events processed:',
+                                  data['summary']['nEvents']))
+    print('{0:<40}{1:<.0f}'.format('CPU usage per event[ms]:',
+                                  float(data['summary']['snapshotLevel']['Execute']['dCPU'])/float(data['summary']['nEvents'])))
+    print('{0:<40}{1:<.3f}'.format('Events per second:',
+                                  float(data['summary']['nEvents'])/float(data['summary']['snapshotLevel']['Execute']['dWall']*0.001)))
+    print('*'*105)
+    print('{0:<40}{1:<.2f} GB'.format('Max Vmem:',
+                                     float(data['summary']['peaks']['vmemPeak'])/1024./1024.))
+    print('{0:<40}{1:<.2f} GB'.format('Max Rss:',
+                                     float(data['summary']['peaks']['rssPeak'])/1024./1024))
+    print('{0:<40}{1:<.2f} GB'.format('Max Pss:',
+                                      float(data['summary']['peaks']['pssPeak'])/1024./1024.))
+    print('*'*105)
+    print('{0:<40}{1:<.2f} MB'.format('Leak estimate per event Vmem:',
+                                 float(data['summary']['leakEstimates']['vmemLeak'])/1024.))
+    print('{0:<40}{1:<.2f} MB'.format('Leak estimate per event Pss:',
+                                 float(data['summary']['leakEstimates']['pssLeak'])/1024.))
+    print('  >> Estimated using the last {0} measurements from the Event Level Monitoring'.format(data['summary']['leakEstimates']['nPoints']))
+    print('  >> Events prior to the first 25 are omitted...')
+
+# Print System Info
+def printSystemInfo():
+    print('='*105)
+    print('{0:^105}'.format('System Information'))
+    print('='*105)
+    print('{0:<40}{1:<}'.format('CPU Model:',data['summary']['sysInfo']['cpuModel'].lstrip()))
+    print('{0:<40}{1:<}'.format('Number of Available Cores:',data['summary']['sysInfo']['coreNum']))
+    print('='*105)
+
+# Main function
+if '__main__' in __name__:
+
+    # Parse the user input
+    parser = argparse.ArgumentParser(description = 'Script to print tables using PerfMonMTSvc JSON')
+
+    parser.add_argument('-i', '--input', type = str, required = True,
+                        help = 'PerfMonMTSvc JSON file')
+    parser.add_argument('-l', '--level', nargs = '?', default = 'All',
+                        choices = ['All', 'SummaryLevel', 'EventLevel', 'ComponentLevel'],
+                        help = 'Sets the level of detail in the printout')
+    parser.add_argument('-e', '--exec-only', dest = 'exec_only', action = 'store_true',
+                        help = 'Print only the execute step for the components')
+    parser.add_argument('-o', '--order-by', dest = 'order_by', nargs = '?', default = 'cpuTime',
+                        choices = ['cpuTime', 'vmem', 'malloc'],
+                        help = 'Order components by a specific metric')
+    parser.add_argument('-m', '--max-components', dest = 'max_comps', type = int, default = -1,
+                        help = 'The maximum number of compoments to be printed '
+                        '(default: -1)')
+
+    args = parser.parse_args()
+
+    # Load the data and print the requested information
+    with(open(args.input)) as json_file:
+
+        data = json.load(json_file)
+
+        # Print Header
+        printHeader()
+
+        # Print Component Level Data
+        if args.level in ['All', 'ComponentLevel']:
+            printComponentLevelInfo(args.exec_only,
+                                    args.order_by,
+                                    args.max_comps)
+
+        # Print Event Level Data
+        if args.level in ['All', 'EventLevel']:
+            printEventLevelInfo()
+
+        # Print Snapshots Summary
+        if args.level in ['All', 'SummaryLevel']:
+            printSnapshotsInfo()
+
+        # Print System Information
+        if args.level in ['All']:
+            printSystemInfo()
+        # Print Footer
+        printFooter()
diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx
index adc829f41103336b980df256d3e87bcf136b57b1..82c788c2cb3bcb2caca82995e0e0a05326b0d4b3 100644
--- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx
+++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx
@@ -360,7 +360,9 @@ void PerfMonMTSvc::report2Log_Description() const {
   if (m_reportResultsToJSON) {
     ATH_MSG_INFO("*** Full set of information can also be found in: " << m_jsonFileName.toString());
     ATH_MSG_INFO("*** In order to make plots using the results run the following commands:");
-    ATH_MSG_INFO("*** $ perfmonmt-plotter -i " << m_jsonFileName.toString());
+    ATH_MSG_INFO("*** $ perfmonmt-plotter.py -i " << m_jsonFileName.toString());
+    ATH_MSG_INFO("*** In order to print tables using the results run the following commands:");
+    ATH_MSG_INFO("*** $ perfmonmt-printer.py -i " << m_jsonFileName.toString());
     ATH_MSG_INFO("=======================================================================================");
   }
 }
@@ -402,7 +404,7 @@ void PerfMonMTSvc::report2Log_ComponentLevel() {
       }
       counter++;
 
-      ATH_MSG_INFO(format("%1% %|15t|%2% %|25t|%3% %|40t|%4% %|55t|%5% %|75t|%6%") % it.first.stepName %
+      ATH_MSG_INFO(format("%1% %|15t|%2% %|25t|%3$.2f %|40t|%4$.0f %|55t|%5$.0f %|75t|%6%") % it.first.stepName %
                    it.second->getCallCount() % it.second->getDeltaCPU() % it.second->getDeltaVmem() %
                    it.second->getDeltaMalloc() % it.first.compName);
     }
@@ -440,7 +442,7 @@ void PerfMonMTSvc::report2Log_EventLevel() {
                " measurements are explicitly printed)");
   ATH_MSG_INFO("=======================================================================================");
 
-  ATH_MSG_INFO(format("%1% %|16t|%2$.2f %|28t|%3$.2f %|40t|%4% %|52t|%5% %|64t|%6% %|76t|%7%") % "Event" % "CPU [s]" %
+  ATH_MSG_INFO(format("%1% %|16t|%2% %|28t|%3% %|40t|%4% %|52t|%5% %|64t|%6% %|76t|%7%") % "Event" % "CPU [s]" %
                "Wall [s]" % "Vmem [kB]" % "Rss [kB]" % "Pss [kB]" % "Swap [kB]");
 
   ATH_MSG_INFO("---------------------------------------------------------------------------------------");
@@ -574,6 +576,10 @@ void PerfMonMTSvc::report2JsonFile_Summary(nlohmann::json& j) const {
 
   }
 
+  // Report the total number of events
+  const long nEvents = m_eventCounter;
+  j["summary"]["nEvents"] = nEvents;
+
   // Report Peaks
   const long vmemPeak = m_measurement_events.vmemPeak;
   const long rssPeak = m_measurement_events.rssPeak;
diff --git a/Control/RngComps/share/TestSeedRunEvent.ref b/Control/RngComps/share/TestSeedRunEvent.ref
index 4aca51bf29c05ebc53b3ece70021c02bd2ae09bd..9e99663e8b14bbc87cb86cce867bb9e0663673a2 100644
--- a/Control/RngComps/share/TestSeedRunEvent.ref
+++ b/Control/RngComps/share/TestSeedRunEvent.ref
@@ -1,39 +1,33 @@
-Wed Jun 14 10:08:30 CEST 2017
+Sat Jun 27 04:52:40 CEST 2020
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [WorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [atlas-work3e/1fc7a429dc] -- built on [2017-06-14T0050]
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "RngComps/TestSeedRunEvent.py"
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
-Py:ConfigurableDb    INFO Read module info for 5328 configurables from 13 genConfDb files
-Py:ConfigurableDb WARNING Found 1 duplicates among the 13 genConfDb files :
-Py:ConfigurableDb WARNING --------------------------------------------------
-Py:ConfigurableDb WARNING   -<component name>: <module> - [ <duplicates> ]
-Py:ConfigurableDb WARNING --------------------------------------------------
-Py:ConfigurableDb WARNING   -DumpDecisions: DecisionHandling.DecisionHandlingConf - ['ViewAlgs.ViewAlgsConf']
-Py:ConfigurableDb WARNING Fix your cmt/requirements file !!
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
+Py:ConfigurableDb    INFO No duplicates have been found: that's good !
+ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v28r2)
-                                          running on lxplus034.cern.ch on Wed Jun 14 10:08:52 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
+                                          running on lxplus755.cern.ch on Sat Jun 27 04:52:51 2020
 ====================================================================================================================================
-ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
-StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 2348 CLIDRegistry entries for module ALL
-ChronoStatSvc        INFO  Number of skipped events for MemStat-1
+ClassIDSvc           INFO  getRegistryEntries: read 7027 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
 AtRanTestAlg        DEBUG Property update for OutputLevel : new value = 2
 AtRanTestAlg         INFO  Initializing 
 AtRanluxGenSvc      DEBUG Property update for OutputLevel : new value = 1
+AtRanluxGenSvc      DEBUG Service base class initialized successfully
 AtRanluxGenSvc       INFO Initializing AtRanluxGenSvc - package version RngComps-00-00-00
  INITIALISING RANDOM NUMBER STREAMS. 
 AtRanluxGenSvc       INFO will be reseeded for every event
@@ -74,6 +68,7 @@ AtLuxNoOffTestAlg   DEBUG Data Deps for AtLuxNoOffTestAlg
 AtRndTestAlg        DEBUG Property update for OutputLevel : new value = 2
 AtRndTestAlg         INFO  Initializing 
 AtRndmGenSvc        DEBUG Property update for OutputLevel : new value = 1
+AtRndmGenSvc        DEBUG Service base class initialized successfully
 AtRndmGenSvc         INFO Initializing AtRndmGenSvc - package version RngComps-00-00-00
  INITIALISING RANDOM NUMBER STREAMS. 
 AtRndmGenSvc         INFO will be reseeded for every event
@@ -114,6 +109,7 @@ AtNoOffTestAlg      DEBUG Data Deps for AtNoOffTestAlg
 OldTestAlg          DEBUG Property update for OutputLevel : new value = 2
 OldTestAlg           INFO  Initializing 
 LuxOld              DEBUG Property update for OutputLevel : new value = 1
+LuxOld              DEBUG Service base class initialized successfully
 LuxOld               INFO Initializing LuxOld - package version RngComps-00-00-00
  INITIALISING RANDOM NUMBER STREAMS. 
 LuxOld            VERBOSE Seeds property: stream LUX seeds 1 2, luxury level 3, reseeding offset 0
@@ -128,6 +124,7 @@ OldTestAlg          DEBUG Data Deps for OldTestAlg
 NoReseedTestAlg     DEBUG Property update for OutputLevel : new value = 2
 NoReseedTestAlg      INFO  Initializing 
 RndNoReseed         DEBUG Property update for OutputLevel : new value = 1
+RndNoReseed         DEBUG Service base class initialized successfully
 RndNoReseed          INFO Initializing RndNoReseed - package version RngComps-00-00-00
  INITIALISING RANDOM NUMBER STREAMS. 
 RndNoReseed       VERBOSE Seeds property: stream RNDM seeds 11 12, reseeding offset 0
@@ -142,6 +139,7 @@ NoReseedTestAlg     DEBUG Data Deps for NoReseedTestAlg
 MarsTestAlg         DEBUG Property update for OutputLevel : new value = 2
 MarsTestAlg          INFO  Initializing 
 AtDSFMTGenSvc       DEBUG Property update for OutputLevel : new value = 1
+AtDSFMTGenSvc       DEBUG Service base class initialized successfully
 AtDSFMTGenSvc        INFO Initializing AtDSFMTGenSvc - package version RngComps-00-00-00
  INITIALISING RANDOM NUMBER STREAMS. 
 AtDSFMTGenSvc        INFO will be reseeded for every event
@@ -169,10 +167,8 @@ AtDSFMTGenSvc       DEBUG Reseeding stream TEST with 3060891399
 MarsTestAlg         DEBUG input handles: 0
 MarsTestAlg         DEBUG output handles: 0
 MarsTestAlg         DEBUG Data Deps for MarsTestAlg
-HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr       INFO Application Manager Started successfully
-ClassIDSvc           INFO  getRegistryEntries: read 889 CLIDRegistry entries for module ALL
 AthenaEventLoopMgr   INFO   ===>>>  start of run 1    <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #1, run #1 0 events processed so far  <<<===
 AtRanluxGenSvc      DEBUG  Handle EndEvent 
@@ -846,15 +842,6 @@ AtDSFMTGenSvc       DEBUG  Stream =  TEST 3630501711 10 1224982045 1072996689 11
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #10, run #1 10 events processed so far  <<<===
 ApplicationMgr       INFO Application Manager Stopped successfully
 IncidentProcAlg1     INFO Finalize
-AtRanTestAlg        DEBUG Calling destructor
-AtLuxWithOffTes...  DEBUG Calling destructor
-AtLuxNoOffTestAlg   DEBUG Calling destructor
-AtRndTestAlg        DEBUG Calling destructor
-AtWithOffTestAlg    DEBUG Calling destructor
-AtNoOffTestAlg      DEBUG Calling destructor
-OldTestAlg          DEBUG Calling destructor
-NoReseedTestAlg     DEBUG Calling destructor
-MarsTestAlg         DEBUG Calling destructor
 IncidentProcAlg2     INFO Finalize
 AtDSFMTGenSvc        INFO  FINALISING 
 AtDSFMTGenSvc       DEBUG  wrote seeds to AtDSFMTGenSvc.out
@@ -868,12 +855,6 @@ AtRanluxGenSvc       INFO  FINALISING
 AtRanluxGenSvc      DEBUG  wrote seeds to AtRanluxGenSvc.out
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
-*****Chrono*****     INFO ****************************************************************************************************
-*****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc        INFO Time User   : Tot=  180 [ms]                                             #=  1
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
 ApplicationMgr       INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/Control/StoreGate/StoreGate/StoreGateSvc.h b/Control/StoreGate/StoreGate/StoreGateSvc.h
index cf011a6bff0d98a2df3d29b1affcac14fe8fffb4..8b120b425cc546cbb941cc3f6ec8cbf15a5763a4 100644
--- a/Control/StoreGate/StoreGate/StoreGateSvc.h
+++ b/Control/StoreGate/StoreGate/StoreGateSvc.h
@@ -106,7 +106,6 @@ class IOVSvc;
 class IOVSvcTool;
 class PileUpMergeSvc;
 class SGDeleteAlg;
-class ThinningSvc;
 class ActiveStoreSvc;
 class CondSvc;
 namespace SG { 
@@ -860,7 +859,6 @@ private:
   void clearProxyPayload(SG::DataProxy*);
 
   ///access typeless_record
-  friend class ThinningSvc;
   friend class SG::VarHandleBase;
   friend 
   PyObject* 
diff --git a/Control/StoreGate/StoreGate/tools/SGImplSvc.h b/Control/StoreGate/StoreGate/tools/SGImplSvc.h
index 7b4034c2ab5548be3a99b3cdf5a324ce2ce529bb..61ed99f9a37118c83954d8018e5f652a78bb6cc4 100644
--- a/Control/StoreGate/StoreGate/tools/SGImplSvc.h
+++ b/Control/StoreGate/StoreGate/tools/SGImplSvc.h
@@ -94,7 +94,6 @@ class IOVSvc;
 class IOVSvcTool;
 class PileUpMergeSvc;
 class SGDeleteAlg;
-class ThinningSvc;
 class ActiveStoreSvc;
 namespace SG { 
   class VarHandleBase; 
@@ -615,7 +614,6 @@ private:
   friend class PileUpMergeSvc;      // FIXME needs to call tRange
   friend class StoreGateSvc;
   ///access typeless_record
-  friend class ThinningSvc;
   friend class SG::VarHandleBase;                                                      
 
   ///DEPRECATED: Return a _pointer_ to the DataStore
diff --git a/Control/xAODRootAccess/xAODRootAccess/tools/TAuxVectorFactory.h b/Control/xAODRootAccess/xAODRootAccess/tools/TAuxVectorFactory.h
index 01b496bb08e482ee04f5a67c84341c1e3f1de537..847271d437d5243041129a83edf4d2d4c6953256 100644
--- a/Control/xAODRootAccess/xAODRootAccess/tools/TAuxVectorFactory.h
+++ b/Control/xAODRootAccess/xAODRootAccess/tools/TAuxVectorFactory.h
@@ -36,6 +36,9 @@ namespace xAOD {
       /// Destructor
       virtual ~TAuxVectorFactory();
 
+      TAuxVectorFactory (const TAuxVectorFactory&) = delete;
+      TAuxVectorFactory& operator= (const TAuxVectorFactory&) = delete;
+
       /// @name Functions implementing the SG::IAuxTypeVectorFactory interface
       /// @{
 
diff --git a/DetectorDescription/AGDD/AGDDHandlers/src/chamberPositionerHandler.cxx b/DetectorDescription/AGDD/AGDDHandlers/src/chamberPositionerHandler.cxx
index bade2c73a3a101955c16c6bd116f9d3ee80ff3ec..6e97fea80fe17db1f2e6366a2cd2c2901b134d27 100644
--- a/DetectorDescription/AGDD/AGDDHandlers/src/chamberPositionerHandler.cxx
+++ b/DetectorDescription/AGDD/AGDDHandlers/src/chamberPositionerHandler.cxx
@@ -1,11 +1,13 @@
 /*
-  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 "AGDDHandlers/chamberPositionerHandler.h"
 #include "AGDDKernel/AGDDDetectorStore.h"
 #include "AGDDKernel/AGDDDetectorPositioner.h"
 #include "AGDDKernel/AGDDDetector.h"
+#include "GeoModelKernel/Units.h"
+
 #include <iostream>
 
 #include "CLHEP/Vector/Rotation.h"
@@ -47,9 +49,6 @@ void chamberPositionerHandler::ElementHandle()
 	int etaIndex=getAttributeAsInt("etaIndex",0);
 	
 	double dPhi=360./iWedge;
-	
-
-	const double degrad=M_PI/180.;
 
 	if (iSectors.size()!= (unsigned int) iWedge) throw;
 	
@@ -66,15 +65,15 @@ void chamberPositionerHandler::ElementHandle()
 			if (type=="ENDCAP") 
 			{
 				//	fix to ensure right order of planes			
-				crot.rotateZ(180.*degrad);
+				crot.rotateZ(180.*GeoModelKernelUnits::degree);
 				//
-				crot.rotateY(90*degrad);
-				crot.rotateZ(Wedge*degrad);
+				crot.rotateY(90*GeoModelKernelUnits::degree);
+				crot.rotateZ(Wedge*GeoModelKernelUnits::degree);
 			}
 			else 
-				crot.rotateZ(Wedge*degrad);
- 			double x=radius*cos(Wedge*degrad);
- 			double y=radius*sin(Wedge*degrad);
+				crot.rotateZ(Wedge*GeoModelKernelUnits::degree);
+ 			double x=radius*cos(Wedge*GeoModelKernelUnits::degree);
+ 			double y=radius*sin(Wedge*GeoModelKernelUnits::degree);
  			double zpos=zPos;
  			cvec=CLHEP::Hep3Vector(x,y,zpos);
  			AGDDDetectorPositioner *p __attribute__((__unused__));
@@ -101,16 +100,16 @@ void chamberPositionerHandler::ElementHandle()
             if (type=="ENDCAP")
             {
 				//	fix to ensure right order of planes			
-				crot.rotateZ(180.*degrad);
+				crot.rotateZ(180.*GeoModelKernelUnits::degree);
 				//
-                crot.rotateY(90*degrad);
-                crot.rotateZ(-Wedge*degrad);
-				crot.rotateX(180.*degrad);
+                crot.rotateY(90*GeoModelKernelUnits::degree);
+                crot.rotateZ(-Wedge*GeoModelKernelUnits::degree);
+				crot.rotateX(180.*GeoModelKernelUnits::degree);
             }
             else
-                crot.rotateZ(Wedge*degrad);
-            double x=radius*cos(Wedge*degrad);
-            double y=radius*sin(Wedge*degrad);
+                crot.rotateZ(Wedge*GeoModelKernelUnits::degree);
+            double x=radius*cos(Wedge*GeoModelKernelUnits::degree);
+            double y=radius*sin(Wedge*GeoModelKernelUnits::degree);
             double zpos=zPos;
             cvec=CLHEP::Hep3Vector(x,y,-zpos);
             AGDDDetectorPositioner *p __attribute__((__unused__));
diff --git a/DetectorDescription/AGDD/AGDDHandlers/src/mposPhiHandler.cxx b/DetectorDescription/AGDD/AGDDHandlers/src/mposPhiHandler.cxx
index 76c2c276d3569893c2119e4fef6e3060c8108792..e9f4caf82d941a3ba2d9a7c9439673c8dc5930df 100644
--- a/DetectorDescription/AGDD/AGDDHandlers/src/mposPhiHandler.cxx
+++ b/DetectorDescription/AGDD/AGDDHandlers/src/mposPhiHandler.cxx
@@ -1,9 +1,11 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "AGDDHandlers/mposPhiHandler.h"
 #include "AGDDKernel/AGDDPositioner.h"
+#include "GeoModelKernel/Units.h"
+
 #include <iostream>
 
 #include "CLHEP/Vector/Rotation.h"
@@ -54,30 +56,26 @@ void mposPhiHandler::ElementHandle()
 	CLHEP::HepRotation crot;
 	
 	vvv=getAttributeAsVector("rot",res);
-	const double deg=M_PI/180.;
 	if (res) 
 	{
-		crot.rotateX(vvv[0]*deg);
-		crot.rotateY(vvv[1]*deg);
-		crot.rotateZ(vvv[2]*deg);
+		crot.rotateX(vvv[0]*GeoModelKernelUnits::degree);
+		crot.rotateY(vvv[1]*GeoModelKernelUnits::degree);
+		crot.rotateZ(vvv[2]*GeoModelKernelUnits::degree);
 	}
-
-	const double degrad=M_PI/180.;
 	
 	for (int i=0;i<icopy;i++)
 	{
 		CLHEP::Hep2Vector position(rad,lateral_displacement);
 	    CLHEP::Hep3Vector cvec;
-//	    CLHEP::HepRotation crot;
 		double phi=phi0+dphi*i;
-		position.rotate(phi*degrad);
+		position.rotate(phi*GeoModelKernelUnits::degree);
 
 		double x=position.x();
 		double y=position.y();
 		
 		cvec=CLHEP::Hep3Vector(x,y,zpos);
-		if (s!="false"&&i>0) crot.rotateZ(dphi*degrad);
-		if (s!="false"&&i==0) crot.rotateZ(phi0*degrad);
+		if (s!="false"&&i>0) crot.rotateZ(dphi*GeoModelKernelUnits::degree);
+		if (s!="false"&&i==0) crot.rotateZ(phi0*GeoModelKernelUnits::degree);
 
 		p=new AGDDPositioner(volume,crot,cvec);
 	}
diff --git a/DetectorDescription/AGDD/AGDDHandlers/src/mposWedgeHandler.cxx b/DetectorDescription/AGDD/AGDDHandlers/src/mposWedgeHandler.cxx
index a7ac2f0d92263283e84d5050b92f0145aebbdcf7..c28ff18092f35800ce3a1c8cda20a4cc9d77ad58 100644
--- a/DetectorDescription/AGDD/AGDDHandlers/src/mposWedgeHandler.cxx
+++ b/DetectorDescription/AGDD/AGDDHandlers/src/mposWedgeHandler.cxx
@@ -1,9 +1,11 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "AGDDHandlers/mposWedgeHandler.h"
 #include "AGDDKernel/AGDDPositioner.h"
+#include "GeoModelKernel/Units.h"
+
 #include <iostream>
 
 #include "CLHEP/Vector/Rotation.h"
@@ -25,8 +27,6 @@ void mposWedgeHandler::ElementHandle()
 	
 	CLHEP::Hep3Vector cvec;
 	CLHEP::HepRotation crot;
-
-	const double degrad=M_PI/180.;
 	
 	double radius=0;
 	for (int i=0;i<iWedge;i++)
@@ -35,9 +35,9 @@ void mposWedgeHandler::ElementHandle()
 		if ((int)iSectors[i]==0) continue;
 	    CLHEP::Hep3Vector cvec;
 	    CLHEP::HepRotation crot;
-		crot.rotateZ(Wedge*degrad);
-		double x=radius*cos(Wedge*degrad);
-		double y=radius*sin(Wedge*degrad);
+		crot.rotateZ(Wedge*GeoModelKernelUnits::degree);
+		double x=radius*cos(Wedge*GeoModelKernelUnits::degree);
+		double y=radius*sin(Wedge*GeoModelKernelUnits::degree);
 		double zpos=0;
 		cvec=CLHEP::Hep3Vector(x,y,zpos);
 
diff --git a/DetectorDescription/AGDD/AGDDHandlers/src/posRPhiZHandler.cxx b/DetectorDescription/AGDD/AGDDHandlers/src/posRPhiZHandler.cxx
index d00ae111d6ae396ce59952038dc4c19cb378a7a6..03769f0c1f5f5fa54609d138ac288ece3a56e203 100644
--- a/DetectorDescription/AGDD/AGDDHandlers/src/posRPhiZHandler.cxx
+++ b/DetectorDescription/AGDD/AGDDHandlers/src/posRPhiZHandler.cxx
@@ -1,9 +1,11 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "AGDDHandlers/posRPhiZHandler.h"
 #include "AGDDKernel/AGDDPositioner.h"
+#include "GeoModelKernel/Units.h"
+
 #include <iostream>
 
 #include "CLHEP/Vector/Rotation.h"
@@ -25,8 +27,6 @@ void posRPhiZHandler::ElementHandle()
 	radius=vvv[0];
 	phi=vvv[1];
 	zpos=vvv[2];
-
-	const double degrad=M_PI/180.;
 	
 	CLHEP::Hep3Vector cvec;
 	CLHEP::HepRotation crot;
@@ -35,14 +35,14 @@ void posRPhiZHandler::ElementHandle()
         if (res) 
         {
                 crot=CLHEP::HepRotation();
-                crot.rotateX(vvv[0]*degrad);
-                crot.rotateY(vvv[1]*degrad);
-                crot.rotateZ(vvv[2]*degrad);
+                crot.rotateX(vvv[0]*GeoModelKernelUnits::degree);
+                crot.rotateY(vvv[1]*GeoModelKernelUnits::degree);
+                crot.rotateZ(vvv[2]*GeoModelKernelUnits::degree);
         }
 
-	crot.rotateZ(phi*degrad);
-	double x=radius*cos(phi*degrad);
-	double y=radius*sin(phi*degrad);
+	crot.rotateZ(phi*GeoModelKernelUnits::degree);
+	double x=radius*cos(phi*GeoModelKernelUnits::degree);
+	double y=radius*sin(phi*GeoModelKernelUnits::degree);
 	cvec=CLHEP::Hep3Vector(x,y,zpos);
 
 	p=new AGDDPositioner(volume,crot,cvec);
diff --git a/DetectorDescription/AGDD/AGDDHandlers/src/posXYZHandler.cxx b/DetectorDescription/AGDD/AGDDHandlers/src/posXYZHandler.cxx
index b8648ea7f7ffeac1401fcf3c9fe6e12c4d9e7fee..86be3de8a991b329d9f15cbc10d24ccd9135b964 100644
--- a/DetectorDescription/AGDD/AGDDHandlers/src/posXYZHandler.cxx
+++ b/DetectorDescription/AGDD/AGDDHandlers/src/posXYZHandler.cxx
@@ -1,10 +1,12 @@
 /*
-  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 "AGDDHandlers/posXYZHandler.h"
 #include "AGDDKernel/AGDDPositioner.h"
 #include "AGDDHandlers/globals.h"
+#include "GeoModelKernel/Units.h"
+
 #include <iostream>
 
 #include "CLHEP/Vector/Rotation.h"
@@ -13,12 +15,10 @@
 
 posXYZHandler::posXYZHandler(std::string s):XMLHandler(s)
 {
-//	std::cout<<"Creating handler for posXYZ"<<std::endl;
 }
 
 void posXYZHandler::ElementHandle()
 {
-//	std::cout<<"handling for posXYZ";
 	bool res,posRet,rotRet;
 	std::string volume=getAttributeAsString("volume",res);
 	std::string  sym=getAttributeAsString("sym",res);
@@ -32,13 +32,12 @@ void posXYZHandler::ElementHandle()
 		cvec =CLHEP::Hep3Vector(X_Y_Z[0],X_Y_Z[1],X_Y_Z[2]);
 	}
 	std::vector<double> rot=getAttributeAsVector("rot",rotRet);
-	const double deg=M_PI/180.;
 	if (rotRet) 
 	{
 		crot=CLHEP::HepRotation();
-		crot.rotateX(rot[0]*deg);
-		crot.rotateY(rot[1]*deg);
-		crot.rotateZ(rot[2]*deg);
+		crot.rotateX(rot[0]*GeoModelKernelUnits::degree);
+		crot.rotateY(rot[1]*GeoModelKernelUnits::degree);
+		crot.rotateZ(rot[2]*GeoModelKernelUnits::degree);
 	}
 	if (s_printFlag) {
 		std::cout<<"   posXYV "<<volume;
diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/CMakeLists.txt b/DetectorDescription/GeoModel/GeoModelUtilities/CMakeLists.txt
index 30bc1109b79107e11505a35ef31a9a3197755054..b5d5ef95e328a36f556013a650bc3857959b07e1 100644
--- a/DetectorDescription/GeoModel/GeoModelUtilities/CMakeLists.txt
+++ b/DetectorDescription/GeoModel/GeoModelUtilities/CMakeLists.txt
@@ -66,3 +66,16 @@ atlas_add_library( GeoModelUtilities
                    INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${GEOMODELCORE_INCLUDE_DIRS}
                    LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} ${GEOMODELCORE_LIBRARIES} )
 endif()
+
+# Code in this file makes heavy use of eigen and runs orders of magnitude
+# more slowly without optimization.  So force this to be optimized even
+# in debug builds.  If you need to debug it you might want to change this.
+# Specifying optimization via an attribute on the particular
+# function didn't work, because that still didn't allow inlining.
+if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
+  set_source_files_properties(
+     ${CMAKE_CURRENT_SOURCE_DIR}/src/GeoVisitVolumes.cxx
+     PROPERTIES
+     COMPILE_FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}"
+     COMPILE_DEFINITIONS "FLATTEN" )
+endif()
diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoVisitVolumes.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoVisitVolumes.cxx
index 73b88e4353677bebb237bb7e05a3271bc8e25c2d..e1cb4ef40a8f433a920292f61426a0c1408594c6 100644
--- a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoVisitVolumes.cxx
+++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoVisitVolumes.cxx
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration.
+ * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
  */
 /**
  * @file GeoModelUtilities/src/GeoVisitVolumes.cxx
@@ -102,6 +102,14 @@ void GeoVisitVolumes::handleSerialDenominator (const GeoSerialDenominator *sD)
 }
 
 
+#if defined(FLATTEN) && defined(__GNUC__)
+// We compile this package with optimization, even in debug builds; otherwise,
+// the heavy use of Eigen makes it too slow.  However, from here we may call
+// to out-of-line Eigen code that is linked from other DSOs; in that case,
+// it would not be optimized.  Avoid this by forcing all Eigen code
+// to be inlined here if possible.
+__attribute__ ((flatten))
+#endif
 void GeoVisitVolumes::handleSerialTransformer (const GeoSerialTransformer  *sT)
 {
   const GeoVPhysVol* vol = &*sT->getVolume();
diff --git a/DetectorDescription/IdDict/CMakeLists.txt b/DetectorDescription/IdDict/CMakeLists.txt
index 005d4a5c3ea9c788aa3dc1f07e2964a2d5ffb253..30002ee5b0378ba8ef20afb692aeae57f6fa7a51 100644
--- a/DetectorDescription/IdDict/CMakeLists.txt
+++ b/DetectorDescription/IdDict/CMakeLists.txt
@@ -16,3 +16,16 @@ atlas_add_library( IdDict
                    PUBLIC_HEADERS IdDict
                    LINK_LIBRARIES Identifier )
 
+
+# Code in this file makes heavy use of eigen and runs orders of magnitude
+# more slowly without optimization.  So force this to be optimized even
+# in debug builds.  If you need to debug it you might want to change this.
+# Specifying optimization via an attribute on the particular
+# function didn't work, because that still didn't allow inlining.
+if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
+  set_source_files_properties(
+     ${CMAKE_CURRENT_SOURCE_DIR}/src/IdDictMgr.cxx
+     PROPERTIES
+     COMPILE_FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}"
+     COMPILE_DEFINITIONS "FLATTEN" )
+endif()
diff --git a/DetectorDescription/IdDict/src/IdDictMgr.cxx b/DetectorDescription/IdDict/src/IdDictMgr.cxx
index a6256fce4f876b70cdf9302d819032cf8db63515..0cfc90a3b7de7268af09c8dcee09575846ddba74 100755
--- a/DetectorDescription/IdDict/src/IdDictMgr.cxx
+++ b/DetectorDescription/IdDict/src/IdDictMgr.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // $Header: /build/atlas/cvs/atlas/offline/DetectorDescription/IdDict/src/IdDictMgr.cxx,v 1.43 2008-12-09 09:49:43 dquarrie Exp $  
@@ -1498,6 +1498,14 @@ int IdDictDictionary::reset (size_t index1,
    *  Unpack the bits32 id to an expanded Identifier, considering the  
    *  provided prefix (result will include the prefix) 
    */ 
+#if defined(FLATTEN) && defined(__GNUC__)
+// We compile this package with optimization, even in debug builds; otherwise,
+// the heavy use of Eigen makes it too slow.  However, from here we may call
+// to out-of-line Eigen code that is linked from other DSOs; in that case,
+// it would not be optimized.  Avoid this by forcing all Eigen code
+// to be inlined here if possible.
+__attribute__ ((flatten))
+#endif
 int
 IdDictDictionary::unpack (const Identifier& id, 
 			  const ExpandedIdentifier& prefix,
diff --git a/DetectorDescription/RegionSelector/python/RegSelToolConfig.py b/DetectorDescription/RegionSelector/python/RegSelToolConfig.py
index 82bbf82c5ae8cd9210c14793f8c2d950ed444606..a55964df9e6a754f8bc8776a77bae9a17965de0d 100644
--- a/DetectorDescription/RegionSelector/python/RegSelToolConfig.py
+++ b/DetectorDescription/RegionSelector/python/RegSelToolConfig.py
@@ -69,7 +69,8 @@ def _makeRegSelTool( detector, enable, CondAlgConstructor ):
 
 
 
-# inner detector toold
+# inner detector tools
+
 def makeRegSelTool_Pixel() :
     from AthenaCommon.DetFlags import DetFlags
     enabled = DetFlags.detdescr.pixel_on()
@@ -175,8 +176,6 @@ def makeRegSelTool_TILE() :
 
 ##### new JO counterparts
 
-# muon spectrometer
-
 def regSelToolCfg(flags, detector, CondAlg, CablingConfigCfg=0):
     from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
     ca = ComponentAccumulator()
@@ -186,6 +185,13 @@ def regSelToolCfg(flags, detector, CondAlg, CablingConfigCfg=0):
     ca.addCondAlgo(_createRegSelCondAlg(detector, CondAlg))
     return ca
 
+# inner detector
+
+def regSelTool_SCT_Cfg(flags):
+    return regSelToolCfg(flags, "SCT", CompFactory.SiRegSelCondAlg)
+
+# muon spectrometer
+
 def regSelTool_MDT_Cfg(flags):
     from MuonConfig.MuonCablingConfig import MDTCablingConfigCfg
     return regSelToolCfg(flags, "MDT", CompFactory.MDT_RegSelCondAlg, MDTCablingConfigCfg)
diff --git a/Event/ByteStreamCnvSvc/ByteStreamCnvSvc/ByteStreamCnvSvc.h b/Event/ByteStreamCnvSvc/ByteStreamCnvSvc/ByteStreamCnvSvc.h
index f8123fe9aaa23c7325f4628a471e3900a628b29a..3afd7827940a8d42569143d13f9bd0500366d821 100644
--- a/Event/ByteStreamCnvSvc/ByteStreamCnvSvc/ByteStreamCnvSvc.h
+++ b/Event/ByteStreamCnvSvc/ByteStreamCnvSvc/ByteStreamCnvSvc.h
@@ -82,6 +82,14 @@ private:
 
    /// @brief common FEA, indexed by string key
    std::map<std::string, FullEventAssemblerBase*> m_feaMap;
+
+   /// Cache for serialised event header data
+   std::vector<std::unique_ptr<uint32_t[]>> m_serialiseCache;
+
+   /// Add new array to the cache
+   uint32_t* newCachedArray(const size_t size) {
+      return m_serialiseCache.emplace_back(std::make_unique<uint32_t[]>(size)).get();
+   }
 };
 
 // Implementation of template method:
diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamCnvSvc.cxx b/Event/ByteStreamCnvSvc/src/ByteStreamCnvSvc.cxx
index f70cabf4a83156eed6d6dd7df5a7e480641af595..c3182d8eeb70865350c39ef83b78ef3d0a169ddc 100644
--- a/Event/ByteStreamCnvSvc/src/ByteStreamCnvSvc.cxx
+++ b/Event/ByteStreamCnvSvc/src/ByteStreamCnvSvc.cxx
@@ -20,6 +20,16 @@
 
 #include <algorithm>
 
+namespace {
+   /// Convert set<uint32_t> to set<SubDetector>
+   std::set<eformat::SubDetector> detsOnline(const std::set<uint32_t>& detsOffline) {
+      std::set<eformat::SubDetector> out;
+      for (const uint32_t detid : detsOffline)
+         out.insert(static_cast<eformat::SubDetector>(detid));
+      return out;
+   }
+}
+
 /// Standard constructor
 ByteStreamCnvSvc::ByteStreamCnvSvc(const std::string& name, ISvcLocator* pSvcLocator)
   : ByteStreamCnvSvcBase(name, pSvcLocator),
@@ -110,7 +120,7 @@ StatusCode ByteStreamCnvSvc::connectOutput(const std::string& /*t*/) {
    if (lvl1_id == 0) {
       lvl1_id = event;
    }
-   uint32_t lvl1_type = evtInfo->level1TriggerType();
+   uint8_t lvl1_type = evtInfo->level1TriggerType();
    uint64_t global_id = event;
    uint16_t lumi_block = evtInfo->lumiBlock();
    uint16_t bc_id = evtInfo->bcid();
@@ -119,112 +129,75 @@ StatusCode ByteStreamCnvSvc::connectOutput(const std::string& /*t*/) {
    // create an empty RawEvent
    eformat::helper::SourceIdentifier sid = eformat::helper::SourceIdentifier(eformat::FULL_SD_EVENT, nevt);
    m_rawEventWrite = new RawEventWrite(sid.code(), bc_time_sec, bc_time_ns, global_id, run_type, run_no, lumi_block, lvl1_id, bc_id, lvl1_type);
-   return(StatusCode::SUCCESS);
-}
 
-StatusCode ByteStreamCnvSvc::commitOutput(const std::string& outputConnection, bool /*b*/) {
-   ATH_MSG_DEBUG("In flushOutput " << outputConnection);
-
-   if (m_ioSvcMap.size() == 0) {
-      ATH_MSG_ERROR("ByteStreamCnvSvc not configure for output");
-      return(StatusCode::FAILURE);
+   // set stream tags
+   std::vector<eformat::helper::StreamTag> on_streamTags;
+   for (const auto& sTag : evtInfo->streamTags()) {
+      on_streamTags.emplace_back(sTag.name(), sTag.type(), sTag.obeysLumiblock(), sTag.robs(), detsOnline(sTag.dets()));
    }
-   writeFEA();
-
-   // Get EventInfo
-   const xAOD::EventInfo* evtInfo{nullptr};
-   ATH_CHECK( m_evtStore->retrieve(evtInfo) );
-
-   // Try to get TrigDecision
-   const xAOD::TrigDecision* trigDecision{nullptr};
-   if(m_evtStore->retrieve(trigDecision)!=StatusCode::SUCCESS) {
-     ATH_MSG_WARNING("Failed to retrieve xAOD::TrigDecision. Will write empty trigger decision vectors");
-     trigDecision = nullptr;
+   uint32_t nStreamTagWords = eformat::helper::size_word(on_streamTags);
+   uint32_t* sTagBuff = newCachedArray(nStreamTagWords);
+   eformat::helper::encode(on_streamTags, nStreamTagWords, sTagBuff);
+   m_rawEventWrite->stream_tag(nStreamTagWords, sTagBuff);
+
+   // try to get TrigDecision
+   const xAOD::TrigDecision *trigDecision{nullptr};
+   if (m_evtStore->retrieve(trigDecision, "xTrigDecision") != StatusCode::SUCCESS) {
+      ATH_MSG_DEBUG("Failed to retrieve xAOD::TrigDecision. Leaving empty trigger decision vectors");
+      return StatusCode::SUCCESS;
    }
 
-   // change trigger info in Header
-   uint32_t *l1Buff{nullptr};
-   uint32_t *l2Buff{nullptr};
-   uint32_t *efBuff{nullptr};
-   uint32_t *encTag{nullptr};
-
-   m_rawEventWrite->lvl1_id(evtInfo->extendedLevel1ID());
-   m_rawEventWrite->lvl1_trigger_type((uint8_t)(evtInfo->level1TriggerType()));
-
    // LVL1 info
-   uint32_t l1Size{0};
-   if(trigDecision) {
-     const std::vector<uint32_t>& tbp = trigDecision->tbp();
-     const std::vector<uint32_t>& tap = trigDecision->tap();
-     const std::vector<uint32_t>& tav = trigDecision->tav();
-     size_t l1TotSize = tbp.size()+tap.size()+tav.size();
-     if(l1TotSize>0) {
-       l1Buff = new uint32_t[l1TotSize];
-       for(uint32_t tb : tbp) {
-	 l1Buff[l1Size++] = tb;
-       }
-       for(uint32_t tb : tap) {
-	 l1Buff[l1Size++] = tb;
-       }
-       for(uint32_t tb : tav) {
-	 l1Buff[l1Size++] = tb;
-       }
-     }
+   const std::vector<uint32_t> &tbp = trigDecision->tbp();
+   const std::vector<uint32_t> &tap = trigDecision->tap();
+   const std::vector<uint32_t> &tav = trigDecision->tav();
+   const size_t l1TotSize = tbp.size() + tap.size() + tav.size();
+   if (l1TotSize > 0) {
+      uint32_t* l1Buff = newCachedArray(l1TotSize);
+      size_t l1Size{0};
+      for (const uint32_t tb : tbp) {
+         l1Buff[l1Size++] = tb;
+      }
+      for (const uint32_t tb : tap) {
+         l1Buff[l1Size++] = tb;
+      }
+      for (const uint32_t tb : tav) {
+         l1Buff[l1Size++] = tb;
+      }
+      m_rawEventWrite->lvl1_trigger_info(l1TotSize, l1Buff);
    }
-   m_rawEventWrite->lvl1_trigger_info(l1Size, l1Buff);
 
    // LVL2 info
-   uint32_t l2Size{0};
-   if(trigDecision) {
-     const std::vector<uint32_t>& lvl2PP = trigDecision->lvl2PassedPhysics();
-     if(lvl2PP.size()>0) {
-       l2Buff = new uint32_t[lvl2PP.size()];
-       for(uint32_t tb : lvl2PP) {
-	 l2Buff[l2Size++] = tb;
-       }
-     }
+   const std::vector<uint32_t>& lvl2PP = trigDecision->lvl2PassedPhysics();
+   if (lvl2PP.size() > 0) {
+      uint32_t* l2Buff = newCachedArray(lvl2PP.size());
+      std::copy(lvl2PP.begin(), lvl2PP.end(), l2Buff);
+      m_rawEventWrite->lvl2_trigger_info(lvl2PP.size(), l2Buff);
    }
-   m_rawEventWrite->lvl2_trigger_info(l2Size, l2Buff);
 
    // EF info
-   uint32_t efSize{0};
-   if(trigDecision) {
-     const std::vector<uint32_t>& efPP = trigDecision->efPassedPhysics();
-     if(efPP.size()>0) {
-       efBuff = new uint32_t[efPP.size()];
-       for(uint32_t tb : efPP) {
-	 efBuff[efSize++] = tb;
-       }
-     }
+   const std::vector<uint32_t>& efPP = trigDecision->efPassedPhysics();
+   if (efPP.size() > 0) {
+      uint32_t* efBuff = newCachedArray(efPP.size());
+      std::copy(efPP.begin(), efPP.end(), efBuff);
+      m_rawEventWrite->event_filter_info(efPP.size(), efBuff);
    }
-   m_rawEventWrite->event_filter_info(efSize, efBuff);
 
-   // stream tag
-   std::vector<eformat::helper::StreamTag> on_streamTags;
-   const std::vector<xAOD::EventInfo::StreamTag>& off_streamTags = evtInfo->streamTags();
-   for(const auto& sTag : off_streamTags) {
-     // convert offline -> online
-     eformat::helper::StreamTag tmpTag;
-     tmpTag.name = sTag.name();
-     tmpTag.type = sTag.type();
-     tmpTag.obeys_lumiblock = sTag.obeysLumiblock();
-     for(uint32_t rob : sTag.robs()) {
-       tmpTag.robs.insert(rob);
-     }
-     for(uint32_t det : sTag.dets()) {
-       tmpTag.dets.insert((eformat::SubDetector)det);
-     }
-     on_streamTags.push_back(tmpTag);
+   return(StatusCode::SUCCESS);
+}
+
+StatusCode ByteStreamCnvSvc::commitOutput(const std::string& outputConnection, bool /*b*/) {
+   ATH_MSG_DEBUG("In flushOutput " << outputConnection);
+
+   if (m_ioSvcMap.size() == 0) {
+      ATH_MSG_ERROR("ByteStreamCnvSvc not configure for output");
+      return(StatusCode::FAILURE);
    }
-   // encode
-   uint32_t encSize = eformat::helper::size_word(on_streamTags);
-   encTag = new uint32_t[encSize];
-   eformat::helper::encode(on_streamTags, encSize, encTag);
-   m_rawEventWrite->stream_tag(encSize, encTag);
+   writeFEA();
 
    // convert RawEventWrite to RawEvent
    uint32_t rawSize = m_rawEventWrite->size_word();
-   OFFLINE_FRAGMENTS_NAMESPACE::DataType* buffer = new OFFLINE_FRAGMENTS_NAMESPACE::DataType[rawSize];
+   uint32_t* buffer = newCachedArray(rawSize);
    uint32_t count = eformat::write::copy(*(m_rawEventWrite->bind()), buffer, rawSize);
    if (count != rawSize) {
       ATH_MSG_ERROR("Memcopy failed");
@@ -252,19 +225,16 @@ StatusCode ByteStreamCnvSvc::commitOutput(const std::string& outputConnection, b
          return(StatusCode::FAILURE);
       }
    }
-   // delete
-   delete [] buffer; buffer = 0;
+   // delete RawEventWrite
    delete m_rawEventWrite; m_rawEventWrite = 0;
-   delete [] l1Buff; l1Buff = 0;
-   delete [] l2Buff; l2Buff = 0;
-   delete [] efBuff; efBuff = 0;
-   delete [] encTag; encTag = 0;
    // delete FEA
    for (std::map<std::string, FullEventAssemblerBase*>::const_iterator it = m_feaMap.begin(),
 	   itE = m_feaMap.end(); it != itE; it++) {
       delete it->second;
    }
    m_feaMap.clear();
+   // delete cache
+   m_serialiseCache.clear();
    return(StatusCode::SUCCESS);
 }
 
diff --git a/Event/EventInfoMgt/python/TagInfoMgrConfig.py b/Event/EventInfoMgt/python/TagInfoMgrConfig.py
index a918a398f001859a0160c43d4acc95a4399a6ad4..5c2cec609bf1381e1fc03e1590bf114a72bb1b2a 100644
--- a/Event/EventInfoMgt/python/TagInfoMgrConfig.py
+++ b/Event/EventInfoMgt/python/TagInfoMgrConfig.py
@@ -47,7 +47,12 @@ if __name__ == "__main__":
 
     ConfigFlags.Input.Files = defaultTestFiles.RAW
     ConfigFlags.lock()
-    acc, tagInfoMgr = TagInfoMgrCfg( ConfigFlags )
-    print (tagInfoMgr)
+
+    acc, tagInfoMgr = TagInfoMgrCfg( ConfigFlags, {"SomeKey": "SomeValue"} )
+    acc2,_ =  TagInfoMgrCfg( ConfigFlags, {"OtherKey":"OtherValue", "SomeKey": "SomeValue"} )
+    acc.merge(acc2)
+
+    assert "SomeKey" in acc.getService("TagInfoMgr").ExtraTagValuePairs
+    assert "OtherKey" in acc.getService("TagInfoMgr").ExtraTagValuePairs
     acc.store( open( "test.pkl", "wb" ) )
     print("All OK")
diff --git a/Event/EventInfoMgt/src/TagInfoMgr.h b/Event/EventInfoMgt/src/TagInfoMgr.h
index 432fdd8bcd864ef0e7dad7b74b215c00ac602701..09a29d7c3125f202b14266f37feb6d227096ac74 100755
--- a/Event/EventInfoMgt/src/TagInfoMgr.h
+++ b/Event/EventInfoMgt/src/TagInfoMgr.h
@@ -196,7 +196,7 @@ private:
 
     /// Extra tags/values pairs added in my jobOptions
     Gaudi::Property<std::map<std::string,std::string> >
-      m_extraTagValuePairs{this,"ExtraTagValuePairs",{},"key/value pairs to be added"};
+        m_extraTagValuePairs{this,"ExtraTagValuePairs",{},"key/value pairs to be added", "mapMergeNoReplace<T,T>"};
 
     /// Extra tags/values pairs added in via interface
     std::map<std::string,std::string> m_extraTagValuePairsViaInterface;
diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocRecoInterfaces/AFP_LocRecoInterfaces/IAFPSiDLocRecoTool.h b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocRecoInterfaces/AFP_LocRecoInterfaces/IAFPSiDLocRecoTool.h
deleted file mode 100644
index 957ad4afda5dcdfa27cbf2d9073ab75253850cdd..0000000000000000000000000000000000000000
--- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocRecoInterfaces/AFP_LocRecoInterfaces/IAFPSiDLocRecoTool.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-     Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef AFP_LOCRECO_IAFPSIDLOCRECOTOOL_H
-#define AFP_LOCRECO_IAFPSIDLOCRECOTOOL_H 1
-
-/// @file   IAFPSiDLocRecoTool.h
-/// @author Grzegorz Gach <gach@agh.edu.pl>
-/// @date   2017-03-01
-/// 
-/// @brief  Header file for interface IAFPSiDLocRecoTool
-
-
-// STL includes
-
-// FrameWork includes
-#include "GaudiKernel/IAlgTool.h"
-#include "AthContainers/DataVector.h"
-
-static const InterfaceID IID_IAFPSiDLocRecoTool("IAFPSiDLocRecoTool", 1, 0);
-
-/// Interface for AFP tools that reconstruct tracks from silicon detector hits
-class IAFPSiDLocRecoTool : virtual public ::IAlgTool
-{ 
-
- public: 
-  /// Empty destructor
-  virtual ~IAFPSiDLocRecoTool() {}
-
-  static const InterfaceID& interfaceID();
-
-  /// @brief run tracks reconstruction
-  /// 
-  /// The method that does the actual tracks reconstruction. It reads
-  /// silicon detector hits from StoreGate, reconstructs tracks and
-  /// saves result to StoreGate.
-  virtual StatusCode reconstructTracks() = 0;
-
-}; 
-
-inline const InterfaceID& IAFPSiDLocRecoTool::interfaceID() 
-{ 
-   return IID_IAFPSiDLocRecoTool; 
-}
-
-
-#endif //> !AFP_LOCRECO_IAFPSiDLOCRECOTOOL_H
diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocRecoInterfaces/CMakeLists.txt b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocRecoInterfaces/CMakeLists.txt
deleted file mode 100644
index a705d71bec2a4ce263075a263536bb82acab2dcc..0000000000000000000000000000000000000000
--- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_LocRecoInterfaces/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-################################################################################
-# Package: AFP_LocRecoInterfaces
-################################################################################
-
-# Declare the package name:
-atlas_subdir( AFP_LocRecoInterfaces )
-
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthContainers
-                          GaudiKernel )
-
-# Install files from the package:
-atlas_install_headers( AFP_LocRecoInterfaces )
-
diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h b/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h
index 09dc38efc2587e571950282af40c84d4da3c97c6..d34e18abb05e3164b4e6e3b386a73ad7a3fd7284 100644
--- a/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h
+++ b/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h
@@ -48,6 +48,7 @@ namespace Print {
 inline void line(std::ostream& os,const GenParticle& p){p.print(os);}
 inline void line(std::ostream& os,const GenParticle* p){p->print(os);}
 }
+inline std::ostream& operator<<( std::ostream& os, const GenParticle* p ) { if (p) return os<<(*p); else return os;} 
 }
 #endif
 #endif
diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h b/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h
index a90b6c53159f7756c41a0aaa8b16a936753b9cee..501c2b58832f86546fae45b4a96cdabb3d72bb2e 100644
--- a/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h
+++ b/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h
@@ -47,6 +47,7 @@ inline GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos = HepMC::FourVe
 }
 inline int barcode(ConstGenVertexPtr p){ return p->barcode();}
 inline void* raw_pointer(GenVertexPtr p){ return p;}
+inline std::ostream& operator<<( std::ostream& os, const GenVertex* v ) { if (v) return os<<(*v); else return os;} 
 }
 #endif
 #endif
diff --git a/Generators/HforTool/HforTool/HforTool.h b/Generators/HforTool/HforTool/HforTool.h
index 5e3c8fba7535fe7d89cf7c8e0031e48a22a6e356..659e2c9994942f4786910c9e751b8d2cef1be7c0 100644
--- a/Generators/HforTool/HforTool/HforTool.h
+++ b/Generators/HforTool/HforTool/HforTool.h
@@ -123,11 +123,11 @@ private:
   void findHFQuarks();
 
   /// Specific fn for finding HF quarks in HERWIG6 event record
-  void findHFQuarksHerwig(const std::map< int,std::vector<const HepMC::GenParticle*> >& finalstate_q);
+  void findHFQuarksHerwig(const std::map< int,std::vector<HepMC::ConstGenParticlePtr> >& finalstate_q);
   /// Specific fn for finding HF quarks in PYTHIA6 event record
-  void findHFQuarksPythia(const std::map< int,std::vector<const HepMC::GenParticle*> >& finalstate_q);
+  void findHFQuarksPythia(const std::map< int,std::vector<HepMC::ConstGenParticlePtr> >& finalstate_q);
   /// If we don't know the shower generator, use this to set all to "unknown"
-  void findHFQuarksUnknown(const std::map< int,std::vector<const HepMC::GenParticle*> >& finalstate_q);
+  void findHFQuarksUnknown(const std::map< int,std::vector<HepMC::ConstGenParticlePtr> >& finalstate_q);
 
   void jetBasedRemoval();
   void angularBasedRemoval();
diff --git a/Generators/HforTool/src/HforTool.cxx b/Generators/HforTool/src/HforTool.cxx
index b296e319517922be3e12b4eb1c22540ea6dde9a2..a72dc7b1af1973af8f0a1c4f0c227a9d02e5b0c6 100644
--- a/Generators/HforTool/src/HforTool.cxx
+++ b/Generators/HforTool/src/HforTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /////////////////////////////////////////////////////////////
@@ -10,6 +10,8 @@
 //               Michiel Sanders, Ludwig-Maximilans-Universitaet Muenchen
 //
 /////////////////////////////////////////////////////////////
+#include <cmath>
+#include <set>
 
 #include "GaudiKernel/Property.h"
 
@@ -23,9 +25,6 @@
 #include "EventInfo/EventInfo.h"
 #include "EventInfo/EventType.h"
 
-#include <cmath>
-#include <set>
-
 
 HforTool::HforTool(const std::string& type, const std::string& name, const IInterface* parent)
 	: AthAlgTool(type, name, parent),
@@ -80,7 +79,6 @@ StatusCode HforTool::execute() {
 
         testSampleType();
 
- 	//checkSampleType();
  	if (m_sampleType == "") {
 	  ATH_MSG_DEBUG("Used sample doesn't need any heavy flavor overlap removal!");
 	  return StatusCode::FAILURE;
@@ -224,7 +222,6 @@ void HforTool::findHFQuarks() {
   m_Quarks_unknown.clear() ;
   m_ShowerGenerator.clear() ;
 
-  // AtlasReconstruction/15.6.6/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/src/JetQuarkLabel.cxx
   // get the McEventCollection from StoreGate
 
   // if we don't know yet which store gate key to use, find it here
@@ -274,51 +271,44 @@ void HforTool::findHFQuarks() {
     m_ShowerGenerator = "HERWIG" ;
   if ( !m_ShowerGenerator.size() ) {
     if ( m_DefaultShowerGenerator.size() ) {
-      ATH_MSG_INFO("Shower generator type not found in the event; using "
-		    << m_DefaultShowerGenerator << " instead") ;
+      ATH_MSG_INFO("Shower generator type not found in the event; using "<< m_DefaultShowerGenerator << " instead") ;
       m_ShowerGenerator = m_DefaultShowerGenerator ;
     } else {
-      ATH_MSG_WARNING("Shower generator type unknown ("
-		      << gen1 << "," << gen2 << "," << gen3 << ")") ;
+      ATH_MSG_WARNING("Shower generator type unknown ("<< gen1 << "," << gen2 << "," << gen3 << ")") ;
       return ;
     }
   }
 
   // vectors with the initial and final state b/c quarks; ie, initial or final
   // in the parton shower; ignore b/c quarks from b/c-hadron decays
-  std::map< int,std::vector<const HepMC::GenParticle*> > finalstate_q ;
+  std::map< int,std::vector<HepMC::ConstGenParticlePtr> > finalstate_q ;
 
   // get the GenEvent, assume it's the first one in the McEventCollection
-  HepMC::GenEvent::particle_const_iterator pitr = evt->particles_begin();
-  for (; pitr != evt->particles_end(); ++pitr) {
-    int pdg = (*pitr)->pdg_id();
+  for (auto  bcpart: *evt) {
+    int pdg = bcpart->pdg_id();
     int apdg = std::abs(pdg) ;
     if (apdg == 5 || apdg == 4) { // b or c quark
-      const HepMC::GenParticlePtr bcpart = (*pitr) ;
-      ATH_MSG_DEBUG("pdg = " << pdg << ": " << *bcpart);
+      ATH_MSG_DEBUG("pdg = " << pdg << ": " << bcpart);
 
       // find the production vertex and parents
-      HepMC::GenVertexPtr prodvtx = bcpart->production_vertex() ;
+      auto prodvtx = bcpart->production_vertex() ;
       bool hasbchadronparent(false) ;
       bool hasmpiparent(false) ;
       bool hastopparent(false) ;
       bool hasWparent(false) ;
       if ( prodvtx ) {
-	ATH_MSG_DEBUG("  prod vtx: " << *prodvtx);
-
+	ATH_MSG_DEBUG("  prod vtx: " << prodvtx);
 	// check that there is no b/c-hadron as a parent
 	// also find mpi and top parents
-	HepMC::GenVertex::particle_iterator pin =
-	  prodvtx->particles_begin(HepMC::parents) ;
-	for (; pin != prodvtx->particles_end(HepMC::parents) && !hasbchadronparent; pin++) {
+	for (auto pin = prodvtx->particles_begin(HepMC::parents); pin != prodvtx->particles_end(HepMC::parents) && !hasbchadronparent; pin++) 
+        {
 	  ATH_MSG_DEBUG("    incoming: " << *(*pin));
 	  int pdgin(abs((*pin)->pdg_id())) ;
 
 	  if ( (pdgin%10000)/1000 == apdg || (pdgin%1000)/100 == apdg )
 	    hasbchadronparent = true ;
 	  // also reject the c-quarks from a b-quark/hadron decay
-	  if ( apdg == 4 && ( pdgin == 5 || (pdgin%10000)/1000 == 5 ||
-			      (pdgin%1000)/100 == 5 ) )
+	  if ( apdg == 4 && ( pdgin == 5 || (pdgin%10000)/1000 == 5 ||(pdgin%1000)/100 == 5 ) )
 	    hasbchadronparent = true ;
 	  // Herwig specific
 	  if ( pdgin == 0 && (*pin)->status() == 120 )
@@ -343,14 +333,13 @@ void HforTool::findHFQuarks() {
       auto decayvtx = bcpart->end_vertex() ;
       bool hasbcquarkdaughter(false) ;
       if ( !hasbchadronparent && decayvtx ) {
-	ATH_MSG_DEBUG("  decay vtx: " << *decayvtx);
+	ATH_MSG_DEBUG("  decay vtx: " << decayvtx);
 
 	// check whether there are only non-b/c-quark daughters
-	HepMC::GenVertex::particle_iterator pout =
-	  decayvtx->particles_begin(HepMC::children) ;
-	for (; pout != decayvtx->particles_end(HepMC::children) && !hasbcquarkdaughter; pout++) {
-	  ATH_MSG_DEBUG("    outgoing: " << *(*pout));
-	  int pdgout(abs((*pout)->pdg_id())) ;
+	for (auto pout = decayvtx->particles_begin(HepMC::children) ; pout != decayvtx->particles_end(HepMC::children) && !hasbcquarkdaughter; pout++)
+        {
+	  ATH_MSG_DEBUG("    outgoing: " << (*pout));
+	  int pdgout(std::abs((*pout)->pdg_id())) ;
 	    if ( pdgout == apdg )
 	      hasbcquarkdaughter = true ;
 	}
@@ -360,7 +349,7 @@ void HforTool::findHFQuarks() {
 
 	// if no b/c-hadron parent and no b/c-quark daughter, keep it!
       if (!hasbchadronparent && !hasbcquarkdaughter) {
-	ATH_MSG_DEBUG("  final state b/c-quark, barcode = "<< bcpart->barcode());
+	ATH_MSG_DEBUG("  final state b/c-quark, barcode = "<< HepMC::barcode(bcpart));
 	finalstate_q[apdg].push_back(bcpart) ;
       }
 
@@ -376,8 +365,8 @@ void HforTool::findHFQuarks() {
     } // particle is a b or a c quark
 
   } // loop over all particles in the GenEvent
-
-  // the rest of the classification depends on whether the shower
+  
+    // the rest of the classification depends on whether the shower
   // was generated with Pythia or with Herwig
   if ( m_ShowerGenerator == "HERWIG" )
     findHFQuarksHerwig(finalstate_q) ;
@@ -385,18 +374,13 @@ void HforTool::findHFQuarks() {
     findHFQuarksPythia(finalstate_q) ;
     // print out vtx -5 (the Alpgen ME process) if there are HF quarks and
     // only in DEBUG mode
+    // Actually it does not make much sense.
     if ( msgLvl(MSG::DEBUG) && finalstate_q.size() ) {
       ATH_MSG_DEBUG("print out vertex -5") ;
-      auto vtx5(evt->barcode_to_vertex(-5)) ;
+      auto vtx5=HepMC::barcode_to_vertex(evt,-5) ;
       if (vtx5) {
-	for ( HepMC::GenVertex::particle_iterator pin =
-		vtx5->particles_begin(HepMC::parents) ;
-	      pin != vtx5->particles_end(HepMC::parents); pin++)
-	  ATH_MSG_DEBUG("    incoming: " << *(*pin));
-	for ( HepMC::GenVertex::particle_iterator pout =
-		vtx5->particles_begin(HepMC::children) ;
-	      pout != vtx5->particles_end(HepMC::children); pout++)
-	  ATH_MSG_DEBUG("    outgoing: " << *(*pout));
+	for ( auto pin = vtx5->particles_begin(HepMC::parents) ; pin != vtx5->particles_end(HepMC::parents); pin++)      ATH_MSG_DEBUG("    incoming: " << (*pin));
+	for ( auto pout = vtx5->particles_begin(HepMC::children) ; pout != vtx5->particles_end(HepMC::children); pout++) ATH_MSG_DEBUG("    outgoing: " << (*pout));
       }
     } // print out vtx -5 if there are HF quarks and in DEBUG mode
   } // Pythia shower
@@ -415,7 +399,7 @@ void HforTool::findHFQuarks() {
 ////////////////////////////////////////////////////////////////////////
 // Find the specifics for HF quarks in a Herwig shower
 void HforTool::findHFQuarksHerwig
-  (const std::map< int,std::vector<const HepMC::GenParticle*> >
+  (const std::map< int,std::vector<HepMC::ConstGenParticlePtr> >
    & finalstate_q )
 ////////////////////////////////////////////////////////////////////////
 {
@@ -429,8 +413,8 @@ void HforTool::findHFQuarksHerwig
 
     // second loop over the final state quarks
     for ( auto bcpart: ipdg.second) {
-      ATH_MSG_DEBUG("final state b/c " << *bcpart);
-      auto prodvtx(bcpart->production_vertex()) ;
+      ATH_MSG_DEBUG("final state b/c " << bcpart);
+      auto prodvtx=bcpart->production_vertex() ;
       bool isMPI(false) ;
       bool isGS(false) ;
       bool isME(false) ;
@@ -450,7 +434,7 @@ void HforTool::findHFQuarksHerwig
 	for (auto  pin=prodvtx_particles_begin;  pin!= prodvtx_particles_end && !iscquarkfromb && !isPDF ; pin++ ) {
 	  int apdgin = std::abs((*pin)->pdg_id()) ;
 	  if (apdgin != apdg ) {
-	    ATH_MSG_DEBUG("  non b/c parent " << *(*pin));
+	    ATH_MSG_DEBUG("  non b/c parent " << (*pin));
 	    // if MPI as a non-b parent, label it
 	    if ( apdgin == 0 && (*pin)->status() == 120 ) {
 	      ATH_MSG_DEBUG("  MPI !!");
@@ -487,7 +471,7 @@ void HforTool::findHFQuarksHerwig
 	      isWDecay = true ;
 	    }
 	  } else {
-	    ATH_MSG_DEBUG("  b/c parent " << *(*pin));
+	    ATH_MSG_DEBUG("  b/c parent " << (*pin));
 	    // if the status of a b-quark is 123 or 124, then it is a ME b-quark
 	    if ( (*pin)->status() == 123 || (*pin)->status() == 124 ) {
 	      ATH_MSG_DEBUG("  ME !!");
@@ -544,7 +528,7 @@ void HforTool::findHFQuarksHerwig
 ////////////////////////////////////////////////////////////////////////
 // Find the specifics for HF quarks in a Pythia shower
 void HforTool::findHFQuarksPythia
-  (const std::map< int,std::vector<const HepMC::GenParticle*> >
+  (const std::map< int,std::vector<HepMC::ConstGenParticlePtr> >
    & finalstate_q)
 ////////////////////////////////////////////////////////////////////////
 {
@@ -560,14 +544,12 @@ void HforTool::findHFQuarksPythia
     // included in the event record with stat=3 particles
     // the partons that we need are *not* these ones, but if
     // these stat=3 partons exist, then the correct partons are in the event too
-    std::set<const HepMC::GenParticle*> MEParton ;
-    std::set<const HepMC::GenParticle*> PDFParton ;
-
+    std::set<HepMC::ConstGenParticlePtr> MEParton ;
+    std::set<HepMC::ConstGenParticlePtr> PDFParton ;
     // loop over the stat=3 final state quarks
     for ( auto bcpart: ipdg.second) {
       if ( bcpart->status() == 3 ) {
-	ATH_MSG_DEBUG("final state b/c (stat=3) " << *bcpart
-		      << ", m = " << bcpart->momentum().m() );
+	ATH_MSG_DEBUG("final state b/c (stat=3) " << bcpart << ", m = " << bcpart->momentum().m() );
 	// if this parton has no descendants, then it's a ME parton
 	if ( !bcpart->end_vertex() ) {
 	  ATH_MSG_DEBUG("  ME parton") ;
@@ -575,14 +557,13 @@ void HforTool::findHFQuarksPythia
 	  MEParton.insert(bcpart) ;
 	  // if there is a direct stat=3 ancestor with the same flavour,
 	  // then there is PDF parton too (eg, qc->q'Wc)
-	  auto prodvtx(bcpart->production_vertex()) ;
+	  auto prodvtx=bcpart->production_vertex() ;
 	  if ( prodvtx ) {
-	    HepMC::GenVertex::particle_iterator pin =
-	      prodvtx->particles_begin(HepMC::parents) ;
-	    for (; pin != prodvtx->particles_end(HepMC::parents); pin++) {
-	      ATH_MSG_DEBUG("    incoming: " << *(*pin));
+	    for (auto pin=prodvtx->particles_begin(HepMC::parents); pin != prodvtx->particles_end(HepMC::parents); pin++) 
+            {
+	      ATH_MSG_DEBUG("    incoming: " << (*pin));
 	      int pdgin((*pin)->pdg_id()) ;
-	      if ( abs(pdgin) == apdg && (*pin)->status() == 3 ) {
+	      if ( std::abs(pdgin) == apdg && (*pin)->status() == 3 ) {
 		ATH_MSG_DEBUG("   PDF parton") ;
 		PDFParton.insert((*pin)) ;
 	      }
@@ -602,9 +583,8 @@ void HforTool::findHFQuarksPythia
     // loop over the other final state quarks
     for ( auto bcpart: ipdg.second) {
       if ( bcpart->status() != 3 ) {
-	ATH_MSG_DEBUG("final state b/c " << *bcpart
-		      << ", m = " << bcpart->momentum().m() );
-	auto prodvtx(bcpart->production_vertex()) ;
+	ATH_MSG_DEBUG("final state b/c " << bcpart << ", m = " << bcpart->momentum().m() );
+	auto prodvtx=bcpart->production_vertex() ;
 	bool isTopDecay(false) ;
 	bool isWDecay(false) ; // subset of top-decays, for hadronic top-decays
 	bool iscquarkfromb(false) ;
@@ -618,29 +598,26 @@ void HforTool::findHFQuarksPythia
 	if ( prodvtx ) {
 	  // check whether there is a proton ancestor,
 	  // and how many ancestors there are
-	  HepMC::GenVertex::particle_iterator pin = prodvtx->particles_begin(HepMC::ancestors) ;
-	  for ( ; pin != prodvtx->particles_end(HepMC::ancestors) && !iscquarkfromb ; pin++ ) {
+          for ( auto pin = prodvtx->particles_begin(HepMC::ancestors); pin != prodvtx->particles_end(HepMC::ancestors) && !iscquarkfromb ; pin++ ) 
+          {
 	    int apdgin = std::abs((*pin)->pdg_id()) ;
 	    if ( apdgin != apdg ) {
-	      ATH_MSG_DEBUG("  non b/c ancestor " << *(*pin));
+	      ATH_MSG_DEBUG("  non b/c ancestor " << (*pin));
 	      // proton parent
 	      if ( apdgin == 2212 ) {
-		// ATH_MSG_DEBUG("  Proton!") ;
 		hasPAncestor = true ;
 	      }
 	      // count number of ancestors
 	      nAncestors += 1 ;
 
 	      // c quark from a b quark (in b-hadron decays)
-	      if ( apdg == 4 && ( apdgin == 5 || (apdgin%10000)/1000 == 5 ||
-				  (apdgin%1000)/100 == 5 ) ) {
+	      if ( apdg == 4 && ( apdgin == 5 || (apdgin%10000)/1000 == 5 || (apdgin%1000)/100 == 5 ) ) {
 		ATH_MSG_WARNING("  c quark from b quark or b hadron");
 		iscquarkfromb = true ;
 	      }
 	      // b quark from a b-hadron decay
 	      // (b directly from b-hadron already rejected)
-	      if ( apdg == 5 && ( (apdgin%10000)/1000 == 5 ||
-				  (apdgin%1000)/100 == 5 ) ) {
+	      if ( apdg == 5 && ( (apdgin%10000)/1000 == 5 || (apdgin%1000)/100 == 5 ) ) {
 		ATH_MSG_WARNING("  b quark from b hadron");
 		iscquarkfromb = true ;
 	      }
@@ -655,7 +632,7 @@ void HforTool::findHFQuarksPythia
 		isWDecay = true ;
 	      }
 	    } else {
-	      ATH_MSG_DEBUG("  b/c or ME/PDF parent " << *(*pin));
+	      ATH_MSG_DEBUG("  b/c or ME/PDF parent " << (*pin));
 	    } // b/c or non-b/c quark as parent
 
 	  } // loop over all ancestors
@@ -695,22 +672,15 @@ void HforTool::findHFQuarksPythia
 	      //    prod vtx of stat=3 PDF parton, and opposite pdgid
 
 	      // first check that showered ME/PDF parton has prod. vtx -3 or -4
-	      HepMC::GenVertexPtr pvtx34(prodvtx) ;
-	      bool bc34(pvtx34->barcode()==-3 || pvtx34->barcode()==-4) ;
+	      auto pvtx34=prodvtx ;
+	      bool bc34=(HepMC::barcode(pvtx34)==-3 || HepMC::barcode(pvtx34)==-4) ;
 	      if ( !bc34 ) {
-		// ATH_MSG_DEBUG("Production vtx with barcode not -3 or -4") ;
-		HepMC::GenVertex::particle_iterator pin =
-		  prodvtx->particles_begin(HepMC::ancestors) ;
-		for (;pin!=prodvtx->particles_end(HepMC::ancestors)&&!bc34 ;
-		     pin++ ) {
+                for (auto pin=prodvtx->particles_begin(HepMC::ancestors);pin!=prodvtx->particles_end(HepMC::ancestors)&&!bc34 ; pin++ ) 
+                {
 		  int bcpv(-1) ;
 		  if ( (*pin)->production_vertex() )
-		    bcpv = (*pin)->production_vertex()->barcode() ;
-		  // ATH_MSG_DEBUG("  ancestor particle barcode "
-		  //		<<(*pin)->barcode() << ", prodvtx "
-		  //		<< bcpv) ;
+		    bcpv = HepMC::barcode((*pin)->production_vertex()) ;
 		  if ( (*pin)->pdg_id() == pdg && (bcpv==-3 || bcpv==-4) ) {
-		    // ATH_MSG_DEBUG("  found vtx with barcode -3 or -4") ;
 		    pvtx34 = (*pin)->production_vertex() ;
 		    bc34 = true ;
 		  }
@@ -731,14 +701,12 @@ void HforTool::findHFQuarksPythia
 		// ME parton
 		bool isME(false) ;
 		for ( auto ime:  MEParton) { if (isME) break;
-		  HepMC::GenVertex* mepvtx(ime->production_vertex()) ;
+		  auto mepvtx=ime->production_vertex() ;
 		  // check the prod.vertices of the parents
 		  if ( mepvtx ) {
-		    HepMC::GenVertex::particle_iterator pin =
-		      mepvtx->particles_begin(HepMC::parents) ;
-		    for (; pin != mepvtx->particles_end(HepMC::parents); pin++) {
-		      if ( (*pin)->production_vertex() == pvtx34 &&
-			   ime->pdg_id() == pdg ) {
+                  for (auto  pin = mepvtx->particles_begin(HepMC::parents) ; pin != mepvtx->particles_end(HepMC::parents); pin++) 
+                  {
+		      if ( (*pin)->production_vertex() == pvtx34 && ime->pdg_id() == pdg ) {
 			ATH_MSG_DEBUG("  -> ME parton") ;
 			nid += 1 ;
 			isME = true ;
@@ -780,20 +748,15 @@ void HforTool::findHFQuarksPythia
     // print out wrongly identified PDF/GS partons
     if ( msgLvl(MSG::WARNING) ) {
       if ( m_Quarks_PDF[apdg].size() != PDFParton.size() ) {
-	ATH_MSG_WARNING("Mismatch in number of id-d PDF partons, apdg = "
-			<< apdg ) ;
+	ATH_MSG_WARNING("Mismatch in number of id-d PDF partons, apdg = "<< apdg ) ;
 	ATH_MSG_DEBUG("PDF partons from ME:") ;
 	for ( auto ipdf: PDFParton) {
 	  const HepMC::FourVector & mom(ipdf->momentum()) ;
-	  ATH_MSG_DEBUG(mom.px()<<", "<< mom.py()<<", "<<mom.pz()<<
-			"  pT = "<<mom.perp()/1000.<<", eta = "<<mom.eta()) ;
+	  ATH_MSG_DEBUG(mom.px()<<", "<< mom.py()<<", "<<mom.pz()<<"  pT = "<<mom.perp()/1000.<<", eta = "<<mom.eta()) ;
 	}
 	ATH_MSG_DEBUG("PDF partons identified:") ;
-	for ( std::vector<HepMC::FourVector>::const_iterator iq =
-		m_Quarks_PDF[apdg].begin(); iq!=m_Quarks_PDF[apdg].end();iq++) {
-	  const HepMC::FourVector & mom((*iq)) ;
-	  ATH_MSG_DEBUG(mom.px()<<", "<< mom.py()<<", "<<mom.pz()<<
-			"  pT = "<<mom.perp()/1000.<<", eta = "<<mom.eta()) ;
+	for ( auto mom:  m_Quarks_PDF[apdg]) {
+	  ATH_MSG_DEBUG(mom.px()<<", "<< mom.py()<<", "<<mom.pz()<<"  pT = "<<mom.perp()/1000.<<", eta = "<<mom.eta());
 	}
 
 	// Could move the pdf parton with smaller eta to gs, but only if
@@ -810,7 +773,7 @@ void HforTool::findHFQuarksPythia
 ////////////////////////////////////////////////////////////////////////
 // Label all the final state partons to "unknown"
 void HforTool::findHFQuarksUnknown
-  (const std::map< int,std::vector<const HepMC::GenParticle*> >
+  (const std::map< int,std::vector<HepMC::ConstGenParticlePtr> >
    & finalstate_q )
 ////////////////////////////////////////////////////////////////////////
 {
@@ -826,29 +789,27 @@ void HforTool::findHFQuarksUnknown
 
     // second loop over the final state quarks
     for ( auto  bcpart: ipdg.second) {
-      ATH_MSG_DEBUG("final state b/c " << *bcpart);
+      ATH_MSG_DEBUG("final state b/c " << bcpart);
       // still filter out the b/c partons directly from a b/c/bhadron
       // or from top or W decay
-      HepMC::GenVertexPtr prodvtx(bcpart->production_vertex()) ;
+      auto prodvtx=bcpart->production_vertex();
       bool isTopDecay(false) ;
       bool isWDecay(false) ; // subset of top-decays, for hadronic top-decays
       bool iscquarkfromb(false) ;
       if ( prodvtx ) {
-	HepMC::GenVertex::particle_iterator pin = prodvtx->particles_begin(HepMC::ancestors) ;
-	for ( ; pin != prodvtx->particles_end(HepMC::ancestors) && !iscquarkfromb ; pin++ ) {
+	for ( auto pin = prodvtx->particles_begin(HepMC::ancestors); pin != prodvtx->particles_end(HepMC::ancestors) && !iscquarkfromb ; pin++ ) 
+        {
 	  int apdgin = std::abs((*pin)->pdg_id()) ;
 	  if (apdgin != apdg ) {
-	    ATH_MSG_DEBUG("  non b/c parent " << *(*pin));
+	    ATH_MSG_DEBUG("  non b/c parent " << (*pin));
 	    // c quark from a b quark (in b-hadron decays)
-	    if ( apdg == 4 && ( apdgin == 5 || (apdgin%10000)/1000 == 5 ||
-				(apdgin%1000)/100 == 5 ) ) {
+	    if ( apdg == 4 && ( apdgin == 5 || (apdgin%10000)/1000 == 5 ||(apdgin%1000)/100 == 5 ) ) {
 	      ATH_MSG_DEBUG("  c quark from b quark or b hadron");
 	      iscquarkfromb = true ;
 	    }
 	    // b quark from a b-hadron decay
 	    // (b directly from b-hadron already rejected)
-	    if ( apdg == 5 && ( (apdgin%10000)/1000 == 5 ||
-				(apdgin%1000)/100 == 5 ) ) {
+	    if ( apdg == 5 && ( (apdgin%10000)/1000 == 5 ||(apdgin%1000)/100 == 5 ) ) {
 	      ATH_MSG_DEBUG("  b quark from b hadron");
 	      iscquarkfromb = true ;
 	    }
@@ -921,18 +882,13 @@ void HforTool::jetBasedRemoval()
   StatusCode sc = evtStore()->retrieve( aod_jets, m_JetContainer );
   if ( sc.isFailure() ) {
     ATH_MSG_WARNING("No ESD/AOD/DPD jet container found: key = " <<m_JetContainer);
-    // return StatusCode::SUCCESS ;
     return ;
   }
   m_jets = aod_jets;
   ATH_MSG_DEBUG(" Size of Jet Collection " << aod_jets->size());
-  //	JetCollection::const_iterator jetItr  = aod_jets->begin();
-  //	JetCollection::const_iterator jetItrE = aod_jets->end();
-
 
   ATH_MSG_DEBUG("There are " << m_jets->size()<<" jets in this event");
-  for ( JetCollection::const_iterator jetItr  = m_jets->begin();
-	jetItr != m_jets->end(); jetItr++ ) {
+  for ( JetCollection::const_iterator jetItr  = m_jets->begin(); jetItr != m_jets->end(); jetItr++ ) {
 
 
     const Jet* thisjet = *jetItr;
@@ -1077,16 +1033,8 @@ void HforTool::jetBasedRemoval()
       m_result = "kill";
 
   }
-
-
-
-
-
-
 }
 
-
-
 ////////////////////////////////////////////////////////////////////////
 // Do the angular based overlap removal
 void HforTool::angularBasedRemoval()
@@ -1372,14 +1320,8 @@ void HforTool::checkSampleType()
        )
     m_sampleType = "isBB";
 
-
-
-
-
 }
 
-
 HforTool::~HforTool() {
 }
 
-
diff --git a/Generators/Pythia8B_i/src/CheckCloningFactor.cxx b/Generators/Pythia8B_i/src/CheckCloningFactor.cxx
index 3bd135e3c063d1da0cf44ebfa8d3a647b2de25c1..9909fe430d8abd6764d587b5c160ae9b4c53eb08 100644
--- a/Generators/Pythia8B_i/src/CheckCloningFactor.cxx
+++ b/Generators/Pythia8B_i/src/CheckCloningFactor.cxx
@@ -41,7 +41,7 @@ StatusCode CheckCloningFactor::execute() {
     
     // Loop over all events in McEventCollection
     McEventCollection::const_iterator itr;
-    std::vector<HepMC::GenParticlePtr> bQuarks;
+    std::vector<HepMC::ConstGenParticlePtr> bQuarks;
     for (itr = mcCollptr->begin(); itr!=mcCollptr->end(); ++itr) {
         // Loop over all particles in the event and find the b-quarks
         const HepMC::GenEvent* genEvt = (*itr);
@@ -53,22 +53,19 @@ StatusCode CheckCloningFactor::execute() {
             }
         }
     }
-    
+    //Unfortunately it is not clear what should happen in the case of absence of b quarks. To prevent bad things we return false.
+    if ( bQuarks.size()==0) return StatusCode::FAILURE;
     // Loop over the b-quarks and find the one with higest pt
-    std::vector<HepMC::GenParticlePtr>::iterator bItr;
+    std::vector<HepMC::ConstGenParticlePtr>::iterator recordedBQuarkIt;
     double lastPt(-1.0);
-    int index(0), highestIndex(-1);
-    for (bItr = bQuarks.begin(); bItr!=bQuarks.end(); ++bItr, ++index) {
-        double et=(*bItr)->momentum().perp();
-        if (et>lastPt) {
-            highestIndex = index;
-            lastPt = et;
-        }
+    for (auto bItr = bQuarks.begin(); bItr!=bQuarks.end(); ++bItr) {
+        double thisPt=(*bItr)->momentum().perp();
+        if (thisPt>lastPt) { recordedBQuarkIt=bItr; }
     }
-    const HepMC::GenParticlePtr recordedBQuark = bQuarks[highestIndex];
-    double b_pt = recordedBQuark->momentum().perp();
-    double b_rapid = recordedBQuark->momentum().pseudoRapidity();
-    double b_phi = recordedBQuark->momentum().phi();
+    auto BQMom=(*recordedBQuarkIt)->momentum();
+    double b_pt = BQMom.perp();
+    double b_rapid = BQMom.pseudoRapidity();
+    double b_phi = BQMom.phi();
     
     unsigned int nAccumulatedEvents = bqKinematics[0].size();
     bool isUnique(true);
@@ -76,9 +73,9 @@ StatusCode CheckCloningFactor::execute() {
         double pt = (bqKinematics[0])[i];
         double rap = (bqKinematics[1])[i];
         double phi = (bqKinematics[2])[i];
-        if ((abs(pt-b_pt)<m_tolerance) &&
-            (abs(rap-b_rapid)<m_tolerance) &&
-            (abs(phi-b_phi)<m_tolerance) ) isUnique=false;
+        if ((std::abs(pt-b_pt)<m_tolerance) &&
+            (std::abs(rap-b_rapid)<m_tolerance) &&
+            (std::abs(phi-b_phi)<m_tolerance) ) isUnique=false;
         if (!isUnique) break;
     }
     
diff --git a/Generators/Rivet_i/CMakeLists.txt b/Generators/Rivet_i/CMakeLists.txt
index bb2dd4140e6f377fc56ac1108db8a2f71ff30a3d..0de8be8d8d8632bbd08c5a5238f7b6528d701d88 100644
--- a/Generators/Rivet_i/CMakeLists.txt
+++ b/Generators/Rivet_i/CMakeLists.txt
@@ -20,7 +20,7 @@ atlas_add_component( Rivet_i
     ${RIVET_INCLUDE_DIRS} ${YODA_INCLUDE_DIRS}
    LINK_LIBRARIES ${FASTJET_LIBRARIES} ${ROOT_LIBRARIES} AtlasHepMCLib
    ${RIVET_LIBRARIES} ${YODA_LIBRARIES} AthenaBaseComps GaudiKernel
-   AthenaKernel GeneratorObjects PathResolver EventInfo )
+   AthenaKernel GeneratorObjects GenInterfaces PathResolver EventInfo )
 
 # Install file(s) from the package.
 atlas_install_scripts( share/setupRivet )
diff --git a/Generators/Rivet_i/src/Rivet_i.cxx b/Generators/Rivet_i/src/Rivet_i.cxx
index 144388d7b6f9b37f4c3ed48e26ebdcd657605cdc..6d49035b639a1219fc7fbdb0152d886d322b55dd 100644
--- a/Generators/Rivet_i/src/Rivet_i.cxx
+++ b/Generators/Rivet_i/src/Rivet_i.cxx
@@ -10,6 +10,7 @@
 #include "AtlasHepMC/GenEvent.h"
 
 #include "GeneratorObjects/McEventCollection.h"
+#include "GenInterfaces/IHepMCWeightSvc.h"
 #include "AthenaKernel/errorcheck.h"
 #include "PathResolver/PathResolver.h"
 
@@ -37,6 +38,7 @@ using namespace std;
 
 Rivet_i::Rivet_i(const std::string& name, ISvcLocator* pSvcLocator) :
   AthAlgorithm(name, pSvcLocator),
+  m_hepMCWeightSvc("HepMCWeightSvc", name),
   m_analysisHandler(0),
   m_init(false)
 {
@@ -53,6 +55,8 @@ Rivet_i::Rivet_i(const std::string& name, ISvcLocator* pSvcLocator) :
   declareProperty("IgnoreBeamCheck", m_ignorebeams=false);
   declareProperty("DoRootHistos", m_doRootHistos=false);
   declareProperty("SkipWeights", m_skipweights=false);
+  //declareProperty("MatchWeights", m_matchWeights="");
+  //declareProperty("UnmatchWeights", m_unmatchWeights="");
   declareProperty("WeightCap", m_weightcap=-1.0);
 }
 
@@ -122,6 +126,8 @@ StatusCode Rivet_i::initialize() {
   assert(m_analysisHandler);
   m_analysisHandler->setIgnoreBeams(m_ignorebeams); //< Whether to do beam ID/energy consistency checks
   m_analysisHandler->skipMultiWeights(m_skipweights); //< Whether to skip weights or not
+  //m_analysisHandler->selectMultiWeights(m_matchWeights); //< Only run on a subset of the multi-weights
+  //m_analysisHandler->deselectMultiWeights(m_unmatchWeights); //< Veto a subset of the multi-weights
   if (m_weightcap>0) m_analysisHandler->setWeightCap(m_weightcap);
 
   // Set Rivet native log level to match Athena
@@ -250,47 +256,33 @@ const HepMC::GenEvent* Rivet_i::checkEvent(const HepMC::GenEvent* event) {
     modEvent->set_event_number(eventNumber);
   }
 
+  // weight-name cleaning
 #ifdef HEPMC3
-std::vector<std::string>  old_names=event->weight_names();
-std::vector<std::string>  new_names;
-std::string str;
-for ( auto s: old_names) { str+=s; str+=" ";}
-    std::vector<std::pair<std::string,std::string> > w_subs = {
-      {" nominal ",""},
-      {" set = ","_"},
-      {" = ","_"},
-      {"=",""},
-      {",",""},
-      {".",""},
-      {":",""},
-      {" ","_"},
-      {"#","num"},
-      {"\n","_"},
-      {"/","over"}
-    };
-    std::regex re("(([^()]+))"); // Regex for stuff enclosed by parentheses ()
-    for (std::sregex_iterator i = std::sregex_iterator(str.begin(), str.end(), re);
-         i != std::sregex_iterator(); ++i ) {
-      std::smatch m = *i;
-      std::vector<std::string> temp = ::split(m.str(), "[,]");
-      if (temp.size() == 2 || temp.size() == 3) {
-        std::string wname = temp[0];
-        if (temp.size() == 3)  wname += "," + temp[1];
-        double value = old_wc[wname];
-        for (const auto& sub : w_subs) {
-          size_t start_pos = wname.find(sub.first);
-          while (start_pos != std::string::npos) {
-            wname.replace(start_pos, sub.first.length(), sub.second);
-            start_pos = wname.find(sub.first);
-          }
-        }
-        new_wc[wname];
-        new_wc.back() = value;
+  std::vector<std::string>  w_names = event->weight_names();
+  std::vector<std::pair<std::string,std::string> > w_subs = {
+    {" nominal ",""},
+    {" set = ","_"},
+    {" = ","_"},
+    {"=",""},
+    {",",""},
+    {".",""},
+    {":",""},
+    {" ","_"},
+    {"#","num"},
+    {"\n","_"},
+    {"/","over"}
+  };
+  for (std::string& wname : w_names) {
+    for (const auto& sub : w_subs) {
+      size_t start_pos = wname.find(sub.first);
+      while (start_pos != std::string::npos) {
+        wname.replace(start_pos, sub.first.length(), sub.second);
+        start_pos = wname.find(sub.first);
       }
     }
-modEvent->run_info()->set_weight_names(new_names);
+  }
+  modEvent->run_info()->set_weight_names(w_names);
 #else
-  // weight-name cleaning
   const HepMC::WeightContainer& old_wc = event->weights();
   std::ostringstream stream;
   old_wc.print(stream);
@@ -299,6 +291,12 @@ modEvent->run_info()->set_weight_names(new_names);
   // then it doesn't use named weights
   // --> no need for weight-name cleaning
   if (str.size() > 1) {
+    vector<string> orig_order(m_hepMCWeightSvc->weightNames().size());
+    for (const auto& item : m_hepMCWeightSvc->weightNames()) {
+      orig_order[item.second] = item.first;
+    }
+    map<string, double> new_name_to_value;
+    map<string, string> old_name_to_new_name;
     HepMC::WeightContainer& new_wc = modEvent->weights();
     new_wc.clear();
     vector<pair<string,string> > w_subs = {
@@ -322,6 +320,7 @@ modEvent->run_info()->set_weight_names(new_names);
       if (temp.size() == 2 || temp.size() == 3) {
         string wname = temp[0];
         if (temp.size() == 3)  wname += "," + temp[1];
+        string old_name = string(wname);
         double value = old_wc[wname];
         for (const auto& sub : w_subs) {
           size_t start_pos = wname.find(sub.first);
@@ -330,10 +329,14 @@ modEvent->run_info()->set_weight_names(new_names);
             start_pos = wname.find(sub.first);
           }
         }
-        new_wc[wname];
-        new_wc.back() = value;
+        new_name_to_value[wname] = value;
+        old_name_to_new_name[old_name] = wname;
       }
     }
+    for (const string& old_name : orig_order) {
+      const string& new_name = old_name_to_new_name[old_name];
+      new_wc[ new_name ] = new_name_to_value[new_name];
+    }
     // end of weight-name cleaning
   }
 #endif
diff --git a/Generators/Rivet_i/src/Rivet_i.h b/Generators/Rivet_i/src/Rivet_i.h
index 37143176d27d26a9905a8516dc5decfc24d6db36..dd236df9e71a0c9dbedfc5bf6913f735eea978b4 100644
--- a/Generators/Rivet_i/src/Rivet_i.h
+++ b/Generators/Rivet_i/src/Rivet_i.h
@@ -15,6 +15,7 @@
 #include <string>
 
 class ISvcLocator;
+class IHepMCWeightSvc;
 //class ITHistSvc;
 
 
@@ -55,6 +56,9 @@ private:
   /// A pointer to the THistSvc
   //ServiceHandle<ITHistSvc> m_histSvc;
 
+  /// A pointer to the HepMCWeightSvc
+  ServiceHandle<IHepMCWeightSvc> m_hepMCWeightSvc;
+
   /// The stream name for storing the output plots under (default "/Rivet")
   std::string m_stream;
 
@@ -106,6 +110,12 @@ private:
   ///Skip variation weights and only run nominal
   bool m_skipweights;
 
+  /// String of weight names (or regex) to select multiweights
+  //std::string m_matchWeights;
+
+  /// String of weight names (or regex) to veto multiweights
+  //std::string m_unmatchWeights;
+
   ///Weight cap to set allowed maximum for weights 
   double m_weightcap;
 
diff --git a/HLT/Trigger/TrigControl/TrigPSC/CMakeLists.txt b/HLT/Trigger/TrigControl/TrigPSC/CMakeLists.txt
index 7c9ffd16fe32049c0fe4e8cd659239c1a98dd859..52b83e0ba48c70ecf96d4143aa32ada18335ec6d 100644
--- a/HLT/Trigger/TrigControl/TrigPSC/CMakeLists.txt
+++ b/HLT/Trigger/TrigControl/TrigPSC/CMakeLists.txt
@@ -17,7 +17,7 @@ atlas_add_library( TrigPSC
                    INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS}
                    PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${Python_INCLUDE_DIRS}
                    LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} GaudiKernel
-                   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${Python_LIBRARIES} RDBAccessSvcLib TrigKernel PathResolver TrigConfBase )
+                   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${Python_LIBRARIES} TrigKernel PathResolver TrigConfBase )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
diff --git a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/CMakeLists.txt b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/CMakeLists.txt
index b80a8b0b6652b66c15dd57344b7dddce6184e216..362e9962a104683f891fe00a0f20237b7738150d 100644
--- a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/CMakeLists.txt
+++ b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/CMakeLists.txt
@@ -11,6 +11,7 @@ atlas_depends_on_subdirs( PUBLIC
                           GaudiKernel
                           PRIVATE
                           Control/AthenaBaseComps
+                          Control/CxxUtils
                           Event/EventInfo
                           Event/xAOD/xAODEventInfo
                           InnerDetector/InDetConditions/BeamSpotConditionsData
@@ -40,12 +41,12 @@ atlas_add_library( InDetBeamSpotFinderLib
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
                    DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${CLHEP_LIBRARIES} xAODTracking GaudiKernel TrigAnalysisInterfaces
-                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps EventInfo xAODEventInfo TrkEventPrimitives VxVertex AtlasDetDescr Identifier TrkFitterInterfaces TrkFitterUtils TrkParameters TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkTrack TrkVertexFitterInterfaces )
+                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps CxxUtils EventInfo xAODEventInfo TrkEventPrimitives VxVertex AtlasDetDescr Identifier TrkFitterInterfaces TrkFitterUtils TrkParameters TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkTrack TrkVertexFitterInterfaces )
 
 atlas_add_component( InDetBeamSpotFinder
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} xAODTracking GaudiKernel AthenaBaseComps EventInfo xAODEventInfo TrkEventPrimitives VxVertex AtlasDetDescr Identifier TrkFitterInterfaces TrkFitterUtils TrkParameters TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkTrack TrkVertexFitterInterfaces InDetBeamSpotFinderLib )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} xAODTracking GaudiKernel AthenaBaseComps CxxUtils EventInfo xAODEventInfo TrkEventPrimitives VxVertex AtlasDetDescr Identifier TrkFitterInterfaces TrkFitterUtils TrkParameters TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkTrack TrkVertexFitterInterfaces InDetBeamSpotFinderLib )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
diff --git a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/InDetBeamSpotFinder/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/InDetBeamSpotFinder/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..23b7ee599a776ff4c099f32b1f7c47ef0f859d06
--- /dev/null
+++ b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/InDetBeamSpotFinder/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder
diff --git a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotFinder.cxx b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotFinder.cxx
index bceb21714d8d9a5f4f9573ea029c2067ec0e8046..1e1d303a001587190440c636b49fd832e3dadc17 100644
--- a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotFinder.cxx
+++ b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotFinder.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 "InDetBeamSpotFinder.h"
@@ -109,7 +109,7 @@ BeamSpot::Event InDet::InDetBeamSpotFinder::readEvent(const xAOD::EventInfo & ev
   event.eventTime    = eventInfo.timeStamp();
   event.eventTime_NS = eventInfo.timeStampNSOffset();
   event.eventNumber  = eventInfo.eventNumber();
-  const DataHandle<EventInfo> BSeventInfo; 
+  const EventInfo* BSeventInfo; 
   //This is required for pseudo lumiblocks 
   if( evtStore()->retrieve(BSeventInfo) != StatusCode::SUCCESS){
     ATH_MSG_ERROR("Cannot get event info.");
diff --git a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotVertex.cxx b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotVertex.cxx
index d364e694928b014275a4e21eeb1c6bfb2438ed2b..c87bff1107f1923c20ce05c31a1677cf6b34c97b 100644
--- a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotVertex.cxx
+++ b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotVertex.cxx
@@ -4,17 +4,19 @@
 
 #include "InDetBeamSpotVertex.h"
 #include "GaudiKernel/ITHistSvc.h"
-
+#include "CxxUtils/checker_macros.h"
 #include "VxVertex/VxCandidate.h"
 #include "VxVertex/VxContainer.h"
 #include <random>
 #include <cmath>
 #include <algorithm>
+#include <mutex>
 
 using namespace InDet;
 
 namespace BeamSpot {
-  const std::vector<  BeamSpot::VrtHolder > * vertexData;
+  std::mutex mutex;
+  const std::vector<  BeamSpot::VrtHolder > * vertexData ATLAS_THREAD_SAFE;
   void myFCN_LLsolver( Int_t &, Double_t *, Double_t &, Double_t *, Int_t); // FCN for LL
   void myFCN_LLsolverNorm( Int_t &, Double_t *, Double_t &, Double_t *, Int_t); // FCN for LL
   double norm_xMin(-1e8), norm_xMax(1e8), norm_yMin(-1e8), norm_yMax(1e8) , norm_zMin(-1e8), norm_zMax(1e8);
@@ -369,7 +371,7 @@ bool InDetBeamSpotVertex::solveLL() {
   arglist[0] = 2;
   minuit->mnexcm("SET STR",arglist,1,errFlag);
 
-
+  std::lock_guard<std::mutex> lock(BeamSpot::mutex); // To protect global BeamSpot::vertexData
   // Insert the likelihood function
   // need to make the data accessible to it
   BeamSpot::vertexData = &m_vertexData;
@@ -511,7 +513,6 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() {
     ATH_MSG_INFO( "No vertices found" );
     return false;
   }
-  static int rCount(0); // counter used for recussive mode
 
   
   // determine simple means
@@ -728,7 +729,7 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() {
     m_getLLres = llSolve; // allow the log-likelihood accessor values to returned, if sucessful
   }
 
-  if ( llSolve and rCount > 0 ) {
+  if ( llSolve and m_rCount > 0 ) {
     ATH_MSG_INFO( "Log-Likelihood fit converged in outlier removal. Exiting outlier removal." );
     return true;
   }
@@ -858,7 +859,7 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() {
   } // for
   
   // if no vertices removed and ll fit still fails, then we continue to have a problem ... 
-  if (fCount == 0 && m_useLL && !llSolve && rCount !=0 ) { // if first iteration, we have another iteration later.
+  if (fCount == 0 && m_useLL && !llSolve && m_rCount !=0 ) { // if first iteration, we have another iteration later.
     ATH_MSG_WARNING( "No vertices removed and fit still fails - most likely final result will fail"  );
     
     // this is our 'last-ditch approach'. Split the collection of vertices into two 'random' sets and solve for each.
@@ -946,19 +947,19 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() {
   
   
   // recursive mode
-  ATH_MSG_DEBUG( " Recursive debug: Loop: " << rCount << ". Number of failed vertices: " << fCount );
+  ATH_MSG_DEBUG( " Recursive debug: Loop: " << m_rCount << ". Number of failed vertices: " << fCount );
   
-  ++rCount;
-  if ( fCount > 0 || ( fCount == 0 && rCount == 1 && !llSolve)) { // if failed vertices or, no failed, first iteration, and no succesful fit
-    if ( rCount > m_maxOutlierLoops) {
-      ATH_MSG_WARNING( "OutlierRemoval: Reached maximum number of recursive loops: " << rCount 
+  ++m_rCount;
+  if ( fCount > 0 || ( fCount == 0 && m_rCount == 1 && !llSolve)) { // if failed vertices or, no failed, first iteration, and no succesful fit
+    if ( m_rCount > m_maxOutlierLoops) {
+      ATH_MSG_WARNING( "OutlierRemoval: Reached maximum number of recursive loops: " << m_rCount 
         << ". No more iterations performed." );
     } else {
-      ATH_MSG_DEBUG( "OutlierRemoval: Entering recursive loop: " << rCount );
+      ATH_MSG_DEBUG( "OutlierRemoval: Entering recursive loop: " << m_rCount );
       applyOutlierRemoval();
     } // if entering loop
   } // if fails > 0
-  --rCount;
+  --m_rCount;
   return true;
 } // outlier removal
 
diff --git a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotVertex.h b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotVertex.h
index 3b9c719d8d386df1c10b58c8f6d5327be399ee33..e9a6265a077149e73974692b9c250c2b3e1e1873 100644
--- a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotVertex.h
+++ b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotVertex.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef INDET_INDETBEAMSPOTVERTEX_H
@@ -19,6 +19,7 @@
 #include "TMinuit.h"
 #include "TMath.h"
 #include "TTree.h"
+#include <atomic>
 #include <string>
 #include <vector>
 #include <map>
@@ -199,6 +200,7 @@ namespace InDet {
     
     int m_nUsed;
 
+    mutable std::atomic<int> m_rCount{0}; // counter used for recussive mode
   };
 }
 #endif
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/doWriteNtuple.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/doWriteNtuple.C
index 4548e8ebea800a04d55e42c1d98ba81c0ac0ad82..ada36714f4ff6b20144e21f23c356aa6e4d4891f 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/doWriteNtuple.C
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/doWriteNtuple.C
@@ -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
 */
 
 void doWriteNtuple(int nParticles, bool useTrackEstimate )
@@ -21,7 +21,7 @@ void doWriteNtuple(int nParticles, bool useTrackEstimate )
   
   // split by ','
   std::vector<std::string> fileList;
-  for (size_t i=0,n; i <= argStr.length(); i=n+1)
+  for (size_t i=0, n=0; i <= argStr.length(); i=n+1)
     {
       n = argStr.find_first_of(',',i);
       if (n == string::npos)
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixMapDBWriter.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixMapDBWriter.h
index f90cbf9b3503fdf2421582680b9591f3488545c8..9f1b8cfc17bbf14adbfb76f50cd60fd3d5f26b05 100755
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixMapDBWriter.h
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixMapDBWriter.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef PIXELCONDITIONSSERVICES_PIXMAPDBWRITER_H
@@ -61,7 +61,7 @@ class PixMapDBWriter : public AthAlgorithm{
   SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_pixelDetEleCollKey{this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"};
 
   std::vector< std::pair< std::string, std::vector<int> > > m_pixelMapping;
-  std::vector<int> getPositionFromDCSID (std::string DCSID);
+  std::vector<int> getPositionFromDCSID (const std::string& DCSID);
   std::string getDCSIDFromPosition (int barrel_ec, int layer, int module_phi, int module_eta);
 
   std::vector<std::string> &splitter(const std::string &s, char delim, std::vector<std::string> &elems) {
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/NoiseMapBuilder.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/NoiseMapBuilder.cxx
index ed97603f243535f4134d59aed73c5b1c2e283448..ecf3ed5321b93487c28fb93a21b028d7443bd2b2 100755
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/NoiseMapBuilder.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/NoiseMapBuilder.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // PixelCalibAlgs
@@ -340,7 +340,7 @@ StatusCode NoiseMapBuilder::execute(){
 
   // loop in RDO container
   for(PixelRDO_Container::const_iterator coll=pixelRDOs->begin(); 
-      coll!=pixelRDOs->end(); coll++){
+      coll!=pixelRDOs->end(); ++coll){
 
     const InDetRawDataCollection<PixelRDORawData>* PixelRDOCollection(*coll);
     if(PixelRDOCollection != 0){
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixMapDBWriter.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixMapDBWriter.cxx
index cc254d89bfab71883ca5525d9b915b66d81023f3..04d482b9e1fbd2b5ca5cb9e12cb50479f57e65e1 100755
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixMapDBWriter.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixMapDBWriter.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // PixelCalibAlgs
@@ -683,7 +683,7 @@ std::string PixMapDBWriter::getDCSIDFromPosition (int barrel_ec, int layer, int
   return std::string("Error!");
 }
 
-std::vector<int> PixMapDBWriter::getPositionFromDCSID (std::string DCSID){
+std::vector<int> PixMapDBWriter::getPositionFromDCSID (const std::string& DCSID){
   for(unsigned int ii = 0; ii < m_pixelMapping.size(); ii++) {
     if (m_pixelMapping[ii].first == DCSID)
     return m_pixelMapping[ii].second;
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelBarrelSurvey.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelBarrelSurvey.cxx
index 432d3e75cf78f430e1a1da57a6504fb07a370e5f..c4888073914929efe276a6d35dd2cd209c83a0f1 100755
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelBarrelSurvey.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelBarrelSurvey.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "PixelCalibAlgs/PixelBarrelSurvey.h"
@@ -164,7 +164,7 @@ StatusCode PixelBarrelSurvey::execute() {
 	disto[j]=theStave->module[i].disto[j];
       m_distorsions->add(hashID,disto);
     }
-    theStave++;
+    ++theStave;
   }
   delete[] disto;
   
@@ -240,7 +240,7 @@ StatusCode PixelBarrelSurvey::finalize() {
     distfile << std::hex << "0x" << id;
     for ( int j=0; j<m_distorsions->size(); j++) distfile << " " << disto[j];
     distfile << std::endl;
-    i++;
+    ++i;
   }
   outfile.close();
   distfile.close();
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx
index 2c75e5570af92b1c0a2a4a1e8638d70f3c43b08f..b65cb83002c793470330c5bfbf8a8a7928dbda29 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx
@@ -86,6 +86,7 @@ StatusCode PixelChargeToTConversion::execute(){
       const PixelID* pixelIDp=dynamic_cast<const PixelID*>(aid);
       if (!pixelIDp){
         ATH_MSG_ERROR("Could not get PixelID pointer");
+        return StatusCode::FAILURE;
       } 
       const PixelID& pixelID = *pixelIDp;
 
diff --git a/InnerDetector/InDetCalibTools/TRT_CalibTools/CMakeLists.txt b/InnerDetector/InDetCalibTools/TRT_CalibTools/CMakeLists.txt
index f2ca44f8da80b6050b133656c2cfa0077e189c03..51fc055dd0e61315d142bdcec142f98494c0758e 100644
--- a/InnerDetector/InDetCalibTools/TRT_CalibTools/CMakeLists.txt
+++ b/InnerDetector/InDetCalibTools/TRT_CalibTools/CMakeLists.txt
@@ -15,6 +15,7 @@ atlas_depends_on_subdirs( PUBLIC
                           PRIVATE
                           Commission/CommissionEvent
                           Control/AthenaBaseComps
+                          Control/CxxUtils
                           Control/StoreGate
                           DetectorDescription/AtlasDetDescr
                           Event/EventPrimitives
@@ -45,7 +46,7 @@ atlas_add_component( TRT_CalibTools
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} Identifier GaudiKernel InDetRawData CommissionEvent AthenaBaseComps StoreGateLib AtlasDetDescr EventPrimitives xAODEventInfo xAODTracking TRT_ConditionsData TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetPrepRawData InDetRIO_OnTrack TrkEventPrimitives TrkParameters TrkPrepRawData TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkToolInterfaces TRT_DriftFunctionToolLib )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} Identifier GaudiKernel InDetRawData CommissionEvent AthenaBaseComps CxxUtils StoreGateLib AtlasDetDescr EventPrimitives xAODEventInfo xAODTracking TRT_ConditionsData TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetPrepRawData InDetRIO_OnTrack TrkEventPrimitives TrkParameters TrkPrepRawData TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkToolInterfaces TRT_DriftFunctionToolLib )
 
 # Install files from the package:
 atlas_install_headers( TRT_CalibTools )
diff --git a/InnerDetector/InDetCalibTools/TRT_CalibTools/TRT_CalibTools/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetCalibTools/TRT_CalibTools/TRT_CalibTools/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..db7ac5366debb050e0451e41680ab9edea5d4b43
--- /dev/null
+++ b/InnerDetector/InDetCalibTools/TRT_CalibTools/TRT_CalibTools/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetCalibTools/TRT_CalibTools
diff --git a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/Calibrator.cxx b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/Calibrator.cxx
index 7e40708a0360151be608eebdc94955c8d8db1764..ef19c98e73aec5d6b3795c5d36030ac767c3cd79 100644
--- a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/Calibrator.cxx
+++ b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/Calibrator.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /********************************************************************
@@ -15,6 +15,7 @@ PURPOSE: Class for calibrating a TRT sub-level
 ********************************************************************/
 
 #include "Calibrator.h"
+#include "CxxUtils/checker_macros.h"
 #include <TH1F.h>
 #include <TH2F.h>
 #include <TH1D.h>
@@ -28,7 +29,6 @@ PURPOSE: Class for calibrating a TRT sub-level
 #include <fstream>
 #include <cmath>
 
-
 caldata::caldata(){
   res = -999; 
   resMean = -999;
@@ -565,8 +565,9 @@ int Calibrator::UpdateOldConstants(){
   } 
 }
 
-float Calibrator::FitRt(std::string key, std::string opt, TH2F* rtHist, TDirectory* dir){
-  
+float Calibrator::FitRt ATLAS_NOT_THREAD_SAFE (std::string key, std::string opt, TH2F* rtHist, TDirectory* dir){
+  // Global gStyle is used.
+
   float rtpars[4];
 
   //create r-m_t and m_t-r graphs
@@ -697,8 +698,8 @@ float Calibrator::FitRt(std::string key, std::string opt, TH2F* rtHist, TDirecto
 }
 
 
-float Calibrator::FitTimeResidual(std::string key, TH1F* tresHist){
-  
+float Calibrator::FitTimeResidual ATLAS_NOT_THREAD_SAFE (std::string key, TH1F* tresHist){
+  // Global gStyle is used.
 
   float mean = tresHist->GetMean();
   float rms = tresHist->GetRMS();
@@ -785,7 +786,8 @@ float Calibrator::FitTimeResidual(std::string key, TH1F* tresHist){
   }
 
 
-float Calibrator::FitResidual(std::string key, TH1F* resHist){
+float Calibrator::FitResidual ATLAS_NOT_THREAD_SAFE (std::string key, TH1F* resHist){
+  // Global gStyle is used.
 
   float mean = resHist->GetMean();
   //float rms = resHist->GetRMS();
@@ -805,7 +807,8 @@ float Calibrator::FitResidual(std::string key, TH1F* resHist){
 
 }
 
-TDirectory* Calibrator::Calibrate(TDirectory* dir, std::string key, std::string opt, caldata * caldata_above){
+TDirectory* Calibrator::Calibrate ATLAS_NOT_THREAD_SAFE (TDirectory* dir, std::string key, std::string opt, caldata * caldata_above){
+  // Thread unsafe FitResidual, FitRt, FitTimeResidual are used.
 
   //set some bool flags
   bool calrt=opt.find("R")!=std::string::npos;
diff --git a/InnerDetector/InDetConditions/BeamSpotConditionsData/BeamSpotConditionsData/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetConditions/BeamSpotConditionsData/BeamSpotConditionsData/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..de56bf07c697d952021de0a106abef09e44fcb69
--- /dev/null
+++ b/InnerDetector/InDetConditions/BeamSpotConditionsData/BeamSpotConditionsData/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetConditions/BeamSpotConditionsData
diff --git a/InnerDetector/InDetConditions/InDetBeamSpotService/CMakeLists.txt b/InnerDetector/InDetConditions/InDetBeamSpotService/CMakeLists.txt
index 6cbda96dfd6aedea19c1f78053cb04cf58609601..1a35e84ad97ef58f95594496e873184e81aee4f4 100644
--- a/InnerDetector/InDetConditions/InDetBeamSpotService/CMakeLists.txt
+++ b/InnerDetector/InDetConditions/InDetBeamSpotService/CMakeLists.txt
@@ -22,6 +22,7 @@ atlas_depends_on_subdirs(
    ${extra_dep}
    PRIVATE
    Control/AthenaBaseComps
+   Control/CxxUtils
    Control/StoreGate
    Database/AthenaPOOL/AthenaPoolUtilities
    Event/EventPrimitives )
@@ -39,7 +40,7 @@ atlas_add_library( InDetBeamSpotServiceLib
 atlas_add_component( InDetBeamSpotService
    src/*.h src/*.cxx src/components/*.cxx
    INCLUDE_DIRS ${CORAL_INCLUDE_DIRS}
-   LINK_LIBRARIES ${CORAL_LIBRARIES} GeoPrimitives GaudiKernel AthenaBaseComps
+   LINK_LIBRARIES ${CORAL_LIBRARIES} GeoPrimitives GaudiKernel AthenaBaseComps CxxUtils
    StoreGateLib AthenaPoolUtilities EventPrimitives InDetBeamSpotServiceLib
    ${extra_lib} )
 
diff --git a/InnerDetector/InDetConditions/InDetBeamSpotService/InDetBeamSpotService/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetConditions/InDetBeamSpotService/InDetBeamSpotService/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..50087198bb107b120a1ebe79b40d24f0c036538a
--- /dev/null
+++ b/InnerDetector/InDetConditions/InDetBeamSpotService/InDetBeamSpotService/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetConditions/InDetBeamSpotService
diff --git a/InnerDetector/InDetConditions/InDetBeamSpotService/src/BeamCondSvc.cxx b/InnerDetector/InDetConditions/InDetBeamSpotService/src/BeamCondSvc.cxx
index 805a42a936f71c1f1bb5712aa0c4122790484b0f..4461f7664470b3c76fffaab2effb2ad2b4935d3d 100644
--- a/InnerDetector/InDetConditions/InDetBeamSpotService/src/BeamCondSvc.cxx
+++ b/InnerDetector/InDetConditions/InDetBeamSpotService/src/BeamCondSvc.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
 */
 
 // BeamCondSvc.cxx - service giving beamspot data
@@ -7,6 +7,7 @@
 
 #include "AthenaPoolUtilities/AthenaAttributeList.h"
 #include "CoralBase/AttributeListException.h"
+#include "CxxUtils/checker_macros.h"
 #include "EventPrimitives/EventPrimitives.h"
 #include "BeamCondSvc.h"
 
@@ -61,7 +62,9 @@ StatusCode BeamCondSvc::queryInterface(const InterfaceID& riid, void** ppvInterf
   return StatusCode::SUCCESS;
 }
 
-StatusCode BeamCondSvc::initialize()
+StatusCode BeamCondSvc::initialize ATLAS_NOT_THREAD_SAFE ()
+// Non-thread-safe function 'AthenaAttributeList::AthenaAttributeList(const coral::AttributeListSpecification&)' called
+// Non-thread-safe function 'StatusCode StoreGateSvc::regFcn(...' called
 {
   // service initialisation - get parameters, setup default cache
   // and register for condDB callbacks if needed
@@ -132,7 +135,9 @@ void BeamCondSvc::initCache(int status, float x, float y, float z,
 #endif
 }
 
-bool BeamCondSvc::fillRec() const {
+bool BeamCondSvc::fillRec ATLAS_NOT_THREAD_SAFE () const {
+  // Non-thread-safe function 'AthenaAttributeList::AthenaAttributeList(const coral::AttributeListSpecification&)' called
+
   // fill beamspot information from jobOptions into TDS AttributeList
   // for registration into conditions database
   // for use in updating database only
diff --git a/InnerDetector/InDetConditions/InDetCondFolders/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetConditions/InDetCondFolders/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..8040a9385ec185d650492c4423eb1088a6c84f41
--- /dev/null
+++ b/InnerDetector/InDetConditions/InDetCondFolders/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetConditions/InDetCondFolders
diff --git a/InnerDetector/InDetConditions/InDetConditionsAthenaPool/InDetConditionsAthenaPool/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetConditions/InDetConditionsAthenaPool/InDetConditionsAthenaPool/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..feda1953db522b7bf30f873a82cb05d3e41003a6
--- /dev/null
+++ b/InnerDetector/InDetConditions/InDetConditionsAthenaPool/InDetConditionsAthenaPool/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetConditions/InDetConditionsAthenaPool
diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt
index 5a4c7df61d8102172fad8603b8c8b18a53bf3e22..3b8fbef05ef5728cbe397e9b17ce05b02a59c098 100644
--- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt
+++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt
@@ -5,34 +5,6 @@
 # Declare the package name:
 atlas_subdir( PixelConditionsAlgorithms )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PUBLIC
-   Commission/CommissionEvent
-   Control/AthenaBaseComps
-   Control/AthenaKernel
-   Database/AthenaPOOL/AthenaPoolUtilities
-   GaudiKernel
-   InnerDetector/InDetConditions/InDetByteStreamErrors
-   InnerDetector/InDetConditions/InDetConditionsSummaryService
-   InnerDetector/InDetConditions/PixelConditionsData
-   InnerDetector/InDetConditions/PixelConditionsTools
-   PRIVATE
-   Control/SGTools
-   Control/StoreGate
-   Database/RDBAccessSvc
-   Database/CoralDB
-   DetectorDescription/GeoModel/GeoModelInterfaces
-   DetectorDescription/GeoModel/GeoModelUtilities
-   DetectorDescription/Identifier
-   DetectorDescription/DetDescrCond/DetDescrConditions
-   InnerDetector/InDetDetDescr/InDetIdentifier
-   InnerDetector/InDetDetDescr/InDetReadoutGeometry
-   InnerDetector/InDetDetDescr/PixelReadoutGeometry
-   InnerDetector/InDetDetDescr/PixelCabling
-   Tools/PathResolver
-   Tracking/TrkDetDescr/TrkGeometry )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( COOL COMPONENTS CoolKernel )
diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/CMakeLists.txt b/InnerDetector/InDetConditions/PixelConditionsTools/CMakeLists.txt
index 31ad2e8a32ea2f509900901113260148135790d9..bd396954966df723c10d7119462de5a57fa21ea3 100644
--- a/InnerDetector/InDetConditions/PixelConditionsTools/CMakeLists.txt
+++ b/InnerDetector/InDetConditions/PixelConditionsTools/CMakeLists.txt
@@ -13,6 +13,7 @@ atlas_depends_on_subdirs( PUBLIC
   InnerDetector/InDetConditions/InDetConditionsSummaryService
   PRIVATE
   Control/AthenaBaseComps
+  Control/CxxUtils
   Control/SGTools
   Database/AthenaPOOL/AthenaPoolUtilities
   Database/RegistrationServices
@@ -44,7 +45,7 @@ atlas_add_component( PixelConditionsTools
                      src/components/*.cxx
                      INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS}
                      LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} PixelConditionsToolsLib AthenaKernel GeoPrimitives GaudiKernel AthenaBaseComps 
-                     SGTools AthenaPoolUtilities DetDescrConditions Identifier PixelCablingLib PixelConditionsData InDetIdentifier 
+                     CxxUtils SGTools AthenaPoolUtilities DetDescrConditions Identifier PixelCablingLib PixelConditionsData InDetIdentifier 
                      GeoModelUtilities InDetReadoutGeometry PathResolver PixelGeoModelLib InDetByteStreamErrors  )
 
 # Install files from the package:
diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/PixelConditionsTools/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetConditions/PixelConditionsTools/PixelConditionsTools/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..f11e02535b09f106a60934c5bccee58fc11ec0f1
--- /dev/null
+++ b/InnerDetector/InDetConditions/PixelConditionsTools/PixelConditionsTools/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetConditions/PixelConditionsTools
diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelByteStreamErrorsTool.h b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelByteStreamErrorsTool.h
index 64b8a6b94ea0098314af50055e3e05c0cbb4e348..a957f7a58dcb9a69faaa431282553fa1b390e49a 100644
--- a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelByteStreamErrorsTool.h
+++ b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelByteStreamErrorsTool.h
@@ -18,6 +18,7 @@
 #include "GaudiKernel/ServiceHandle.h"
 
 //Athena includes
+#include "CxxUtils/checker_macros.h"
 #include "Identifier/Identifier.h"
 #include "Identifier/IdentifierHash.h"
 #include "InDetIdentifier/PixelID.h"
@@ -28,7 +29,8 @@
 #include "StoreGate/ReadHandleKey.h"
 #include "StoreGate/WriteHandleKey.h"
 
-class PixelByteStreamErrorsTool: public AthAlgTool, public IPixelByteStreamErrorsTool {
+class ATLAS_NOT_THREAD_SAFE PixelByteStreamErrorsTool: // This class currently has many mutable memebers without mutex guard or atomicity.
+public AthAlgTool, public IPixelByteStreamErrorsTool {
   public:
     static InterfaceID& interfaceID();
 
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DCSConditionsStatCondAlg.cxx b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DCSConditionsStatCondAlg.cxx
index 0d61c20abd1678a77e60c2f9c7686c691082d06e..1b0da809c475ccc99c538f98a79258c92fb13414 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DCSConditionsStatCondAlg.cxx
+++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DCSConditionsStatCondAlg.cxx
@@ -37,7 +37,7 @@ StatusCode SCT_DCSConditionsStatCondAlg::initialize() {
     }
   }
 
-  if (m_useHV.value()) {
+  if (m_useDefaultHV.value()) {
     m_hvLowLimit = m_useHVLowLimit;
     m_hvUpLimit = m_useHVUpLimit;
     m_chanstatCut = m_useHVChanCut;
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DCSConditionsStatCondAlg.h b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DCSConditionsStatCondAlg.h
index 1f36dc56b9becc80c811ab0c426c7b0f1f18d7f4..7afb429279f543f0d61144351330b11c093d118e 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DCSConditionsStatCondAlg.h
+++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_DCSConditionsStatCondAlg.h
@@ -61,7 +61,7 @@ class SCT_DCSConditionsStatCondAlg : public AthReentrantAlgorithm
   StringProperty m_chanstatCut{this, "StateCut", "NORM"};
   FloatProperty m_hvLowLimit{this, "HVCutLow", 0.0};
   FloatProperty m_hvUpLimit{this, "HVCutUp", 1000000.0};
-  BooleanProperty m_useHV{this, "UseDefaultHV", false};
+  BooleanProperty m_useDefaultHV{this, "UseDefaultHV", false};
   FloatProperty m_useHVLowLimit{this, "useHVLow", 19.};
   FloatProperty m_useHVUpLimit{this, "useHVUp", 1000000.0};
   StringProperty m_useHVChanCut{this, "useHVChan", "LOOSE"};
diff --git a/InnerDetector/InDetConfig/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetConfig/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..302e4ee56f4c43f8b91f0d4319fe2af3ac7cb2e7
--- /dev/null
+++ b/InnerDetector/InDetConfig/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetConfig
diff --git a/InnerDetector/InDetCosmics/InDetCosmicsEventPhase/InDetCosmicsEventPhase/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetCosmics/InDetCosmicsEventPhase/InDetCosmicsEventPhase/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..f0690478c10d70bfdfb3d0cac0da85dc9637b3a5
--- /dev/null
+++ b/InnerDetector/InDetCosmics/InDetCosmicsEventPhase/InDetCosmicsEventPhase/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetCosmics/InDetCosmicsEventPhase
diff --git a/InnerDetector/InDetCosmics/InDetCosmicsEventPhase/InDetCosmicsEventPhase/TRT_TrackTimingTool.h b/InnerDetector/InDetCosmics/InDetCosmicsEventPhase/InDetCosmicsEventPhase/TRT_TrackTimingTool.h
index 807d846c966a3cc37b5f11a854a15640e10262e5..11a3af643ec00813b72a447f03ad138e069db24b 100644
--- a/InnerDetector/InDetCosmics/InDetCosmicsEventPhase/InDetCosmicsEventPhase/TRT_TrackTimingTool.h
+++ b/InnerDetector/InDetCosmics/InDetCosmicsEventPhase/InDetCosmicsEventPhase/TRT_TrackTimingTool.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -89,9 +89,6 @@ class TRT_TrackTimingTool : virtual public ITRT_TrackTimingTool, public AthAlgTo
     /** private debugging function for commissioning phase */
     void debugMissingMeasurements(const Trk::Track& trk) const;
 
-    /** debug printing function */
-    void print(const Trk::Track* track, float time) const;
-
   }; 
 
 }
diff --git a/InnerDetector/InDetCosmics/InDetCosmicsEventPhase/src/TRT_TrackTimingTool.cxx b/InnerDetector/InDetCosmics/InDetCosmicsEventPhase/src/TRT_TrackTimingTool.cxx
index 8fa0b2a2d0817591c13418124ffb0bd5a84693fe..e29c89414aad8d0430974be8939c1be45db340ee 100644
--- a/InnerDetector/InDetCosmics/InDetCosmicsEventPhase/src/TRT_TrackTimingTool.cxx
+++ b/InnerDetector/InDetCosmics/InDetCosmicsEventPhase/src/TRT_TrackTimingTool.cxx
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
  */
 
 ///////////////////////////////////////////////////////////////////
@@ -145,8 +145,6 @@ const {
   }
 
 
-//  print(track_ptr, time); // result testing function
-
   if (newtrack) delete newtrack;
 
   return timeMeasurementsVector;
@@ -320,55 +318,3 @@ void InDet::TRT_TrackTimingTool::debugMissingMeasurements(const Trk::Track& trac
 
   return;
 }
-
-//===============================================================================
-
-void InDet::TRT_TrackTimingTool::print(const Trk::Track* track, float time) const {
-  const Trk::Perigee* trackPar = track->perigeeParameters();
-
-  if (!trackPar) {
-    ATH_MSG_WARNING("missing perigee parameters, can not print results");
-    return;
-  }
-
-  double eta = trackPar->eta();
-  double pT = trackPar->pT() / GeV;
-
-  int nHits = 0;
-  float time_check = getTrackTimeFromDriftRadius(track, nHits);
-
-  const float correctionLargeEta = -0.31; // ns
-  float correction = (1.3 * eta * eta - 1.9) * eta * eta;
-  if (fabs(eta) > 1. && correction > correctionLargeEta) correction = correctionLargeEta;
-  if (m_doEtaCorrection && time_check != 0.) time_check -= correction;
-
-  static int last_event = 0; // code to remove duplicates - do not print if this track was already called
-  if (last_event == 0) {
-    FILE* f = fopen("tmp.txt", "w");
-    fclose(f);
-  } // first call, reset file
-  static std::vector<double> pT_list;
-
-  SG::ReadHandle<xAOD::EventInfo> eventInfo(m_EventInfoKey);
-  if (not eventInfo.isValid()) {
-    (msg(MSG::ERROR) << "Could not get event info" << endmsg);
-    return;
-  }
-
-  int event = (int) eventInfo->eventNumber();
-  if (event != last_event) {
-    last_event = event;
-    pT_list.clear();
-  } else {
-    for (unsigned int i = 0; i < pT_list.size(); i++)
-      if (fabs(pT_list[i] - pT) < 0.0001) return; // skip this track, and the track is already on the list anyway
-  }
-  pT_list.push_back(pT);
-
-
-  FILE* f = fopen("tmp.txt", "a");
-  fprintf(f, "%d %f %f %f %f %f\n", nHits, pT, eta, time, time_check, correction);
-  fclose(f);
-
-  return;
-}
diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/InDetDetectorManager.h b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/InDetDetectorManager.h
index ec30e328f79d69888803ab2e11dfd82349b54619..82a1b04a230d30eda86937b91f6e73faf4cb8bff 100755
--- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/InDetDetectorManager.h
+++ b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/InDetDetectorManager.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -41,9 +41,6 @@ class AtlasDetectorID;
 class GeoVAlignmentStore;
 class CondAttrListCollection;
 
-// mutable Athena::MsgStreamMember issues warnings.
-ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
-
 namespace InDetDD {
 
   typedef std::map<std::string, const void*> RawAlignmentObjects;
@@ -188,7 +185,7 @@ namespace InDetDD {
       virtual const AtlasDetectorID* getIdHelper() const = 0;
     
       //Declaring private message stream member.
-      mutable Athena::MsgStreamMember           m_msg;
+      mutable Athena::MsgStreamMember           m_msg ATLAS_THREAD_SAFE;
       
       Version                                   m_version;
       std::map<std::string, LevelInfo>          m_keys;
diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiCommonItems.h b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiCommonItems.h
index 97132da6c1d2abf7b8786865864662f244dc9f04..1ef3a759fa9366e546effdf145a81be318562509 100755
--- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiCommonItems.h
+++ b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiCommonItems.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -25,11 +25,6 @@ class AtlasDetectorID;
 
 #include <mutex>
 
-/**
- * mutable Athena::MsgStreamMember issues warnings.
- */
-ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
-
 namespace InDetDD {
 
   /**
@@ -92,7 +87,7 @@ namespace InDetDD {
     /**
      * Message stream member
      */
-    mutable Athena::MsgStreamMember m_msg;
+    mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
           
     /**
      * IdHelper
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..630143af358f2432cf13c7636d6fe22c350f1d07
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetDetDescr/InDetServMatGeoModel
diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/CMakeLists.txt b/InnerDetector/InDetDetDescr/TRT_Cabling/CMakeLists.txt
index 5b39e52926f576a16cfbff8c21355670ec96d8e2..d40a987d849b3635d72850d7fe5ed99b8eaf0fde 100644
--- a/InnerDetector/InDetDetDescr/TRT_Cabling/CMakeLists.txt
+++ b/InnerDetector/InDetDetDescr/TRT_Cabling/CMakeLists.txt
@@ -10,6 +10,7 @@ atlas_depends_on_subdirs( PUBLIC
                           GaudiKernel
                           PRIVATE
                           Control/AthenaBaseComps
+                          Control/CxxUtils
                           DetectorDescription/Identifier
                           InnerDetector/InDetDetDescr/InDetIdentifier
                           InnerDetector/InDetDetDescr/InDetReadoutGeometry
@@ -31,7 +32,7 @@ atlas_add_component( TRT_Cabling
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} GaudiKernel AthenaBaseComps Identifier InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry PathResolver TRT_CablingLib )
+                     LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} GaudiKernel AthenaBaseComps CxxUtils Identifier InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry PathResolver TRT_CablingLib )
 
 # Install files from the package:
 atlas_install_runtime( share/*.dat )
diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/TRT_Cabling/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetDetDescr/TRT_Cabling/TRT_Cabling/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..220d89a8d1d23de13f8031e5a810f0bbfe15a040
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/TRT_Cabling/TRT_Cabling/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetDetDescr/TRT_Cabling
diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.cxx b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.cxx
index b7d262256aca01fa4ef8d1368537f426390326c3..fc34a7f05e23fffbc5cadcaef5bbe755a2c16db8 100644
--- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.cxx
+++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.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
 */
 
 /*
@@ -47,6 +47,7 @@
 #include "eformat/SourceIdentifier.h"  // change to new eformat v3
 #include "PathResolver/PathResolver.h"
 
+#include "CxxUtils/checker_macros.h"
 
 using eformat::helper::SourceIdentifier; 
 using namespace std;
@@ -78,7 +79,7 @@ const InterfaceID& TRT_FillCablingData_DC3::interfaceID( )
 
 
   // Initialisation
-StatusCode TRT_FillCablingData_DC3::initialize( )
+StatusCode TRT_FillCablingData_DC3::initialize ATLAS_NOT_THREAD_SAFE ( ) // thread unsafe TRT_FillCablingData_DC3::defineTables is used.
 {
   ATH_MSG_INFO( "TRT_FillCablingData_DC3::initialize" ); 
 
@@ -172,7 +173,7 @@ void TRT_FillCablingData_DC3::defineParameters()
 
 
   // Fill Tables with IDs for all straws
-void TRT_FillCablingData_DC3::defineTables()
+void TRT_FillCablingData_DC3::defineTables ATLAS_NOT_THREAD_SAFE () // thread unsafe std::exit is used.
 {
    ATH_MSG_INFO( "In defineTables" ); 
 
diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.h b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.h
index a858272455c75d7276cbfc85883b8ac1e879b846..119bfff7999742b23606da12be6a1a769da56fee 100644
--- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.h
+++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.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
 */
 
 //
@@ -30,7 +30,6 @@
 #include <vector>
 #include <stdint.h> 
 
-
 class TRT_FillCablingData_DC3: public AthAlgTool {
 
  public:
diff --git a/InnerDetector/InDetDigitization/FastTRT_Digitization/FastTRT_Digitization/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetDigitization/FastTRT_Digitization/FastTRT_Digitization/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..0f09b48b797a7ac694398ea52e17df03a2fd04e9
--- /dev/null
+++ b/InnerDetector/InDetDigitization/FastTRT_Digitization/FastTRT_Digitization/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetDigitization/FastTRT_Digitization
diff --git a/InnerDetector/InDetDigitization/FastTRT_Digitization/src/TRTFastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastTRT_Digitization/src/TRTFastDigitizationTool.cxx
index fc367b698b431706a2c456b0f3c06a3c17efd08c..181fdab20d6d246fadef487f5fcaa75ab6b88a4a 100644
--- a/InnerDetector/InDetDigitization/FastTRT_Digitization/src/TRTFastDigitizationTool.cxx
+++ b/InnerDetector/InDetDigitization/FastTRT_Digitization/src/TRTFastDigitizationTool.cxx
@@ -804,7 +804,7 @@ double TRTFastDigitizationTool::getProbHT( int particleEncoding, float kineticEn
 
   } // end of switch
 
-  static Trk::ParticleMasses particleMasses;
+  static const Trk::ParticleMasses particleMasses;
   float pTrk = sqrt( kineticEnergy * kineticEnergy + 2. * kineticEnergy * particleMasses.mass[ hypothesis ] );
   if ( pTrk < 250. || pTrk > 7000000. ) return 0.;
 
diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.cxx b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.cxx
index e065036d12263b480933869594ad0c4901bea890..832189b6bf5beb824d7875b93bdd39ed12d16685 100644
--- a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.cxx
+++ b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.cxx
@@ -73,7 +73,30 @@ StatusCode SCT_FrontEnd::initialize() {
   ATH_MSG_INFO("m_Threshold             (Threshold)           = " << m_Threshold);
   ATH_MSG_INFO("m_timeOfThreshold       (TimeOfThreshold)     = " << m_timeOfThreshold);
   ATH_MSG_INFO("m_data_compression_mode (DataCompressionMode) = " << m_data_compression_mode);
-  ATH_MSG_INFO("m_data_readout_mode     (DataReadOutMode)     = " <<  m_data_readout_mode);
+  ATH_MSG_INFO("m_data_readout_mode     (DataReadOutMode)     = " << m_data_readout_mode);
+
+  // Check configuration. If it is invalid, abort this job.
+  if (not (m_data_compression_mode==Level_X1X or
+           m_data_compression_mode==Edge_01X or
+           m_data_compression_mode==AnyHit_1XX_X1X_XX1)) {
+    ATH_MSG_FATAL("m_data_compression_mode = " << m_data_compression_mode
+                  << " is invalid. Abort this job!!!");
+    return StatusCode::FAILURE;
+  }
+  if (not (m_data_readout_mode==Condensed or m_data_readout_mode==Expanded)) {
+    ATH_MSG_FATAL("m_data_readout_mode = " << m_data_readout_mode
+                  << " is invalid. Abort this job!!!");
+    return StatusCode::FAILURE;
+  }
+  if ((m_data_compression_mode==Level_X1X or m_data_compression_mode==AnyHit_1XX_X1X_XX1)
+      and m_data_readout_mode==Condensed) {
+    ATH_MSG_FATAL("m_data_compression_mode = " << m_data_compression_mode 
+                  << (m_data_compression_mode==Level_X1X ? " (Level_X1X)" : " (AnyHit_1XX_X1X_XX1)")
+                  << " requires timing information."
+                  << " However, m_data_readout_mode = " << m_data_readout_mode
+                  << " (Condensed) does not keep timing information. Abort this job!!!");
+    return StatusCode::FAILURE;
+  }
 
   return StatusCode::SUCCESS;
 }
@@ -93,18 +116,13 @@ StatusCode SCT_FrontEnd::initVectors(int strips, SCT_FrontEndData& data) const {
   data.m_GainFactor.assign(strips, 0.0);
   data.m_NoiseFactor.assign(strips, 0.0);
 
-  if (m_data_compression_mode == 1 and m_data_readout_mode == 0) {
-    data.m_Analogue[0].reserve(1);
-    data.m_Analogue[1].reserve(strips);
-  } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) {
+  if (m_data_readout_mode == Condensed) {
     data.m_Analogue[0].reserve(strips);
     data.m_Analogue[1].reserve(strips);
-  } else if (m_data_compression_mode == 3 or m_data_readout_mode == 1) {
+  } else { // Expanded
     data.m_Analogue[0].reserve(strips);
     data.m_Analogue[1].reserve(strips);
     data.m_Analogue[2].reserve(strips);
-  } else {
-    return StatusCode::FAILURE;
   }
 
   return StatusCode::SUCCESS;
@@ -193,12 +211,10 @@ StatusCode SCT_FrontEnd::prepareGainAndOffset(SiChargedDiodeCollection& collecti
             data.m_NoiseFactor[i] = Noise * mode;
 
             // Fill the noise and offset values into the Analogue
-            if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode X1X
-              data.m_Analogue[1][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
-            } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01X
+            if (m_data_readout_mode == Condensed) {
               data.m_Analogue[0][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
               data.m_Analogue[1][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
-            } else if (m_data_compression_mode == 3 or m_data_readout_mode == 1) { // any hit mode (1XX|X1X|XX1) or expanded read out mode
+            } else { // Expanded
               data.m_Analogue[0][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
               data.m_Analogue[1][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
               data.m_Analogue[2][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
@@ -315,12 +331,10 @@ StatusCode SCT_FrontEnd::prepareGainAndOffset(SiChargedDiodeCollection& collecti
             data.m_NoiseFactor[i] = noiseByChipVect[chip];
 
             // Fill the noise and offset values into the Analogue
-            if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode X1X
-              data.m_Analogue[1][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
-            } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01X
+            if (m_data_readout_mode == Condensed) {
               data.m_Analogue[0][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
               data.m_Analogue[1][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
-            } else if (m_data_compression_mode == 3 or m_data_readout_mode == 1) { // any hit mode (1XX|X1X|XX1) or expanded read out mode
+            } else { // Expanded
               data.m_Analogue[0][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
               data.m_Analogue[1][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
               data.m_Analogue[2][i] = data.m_Offset[i] + data.m_NoiseFactor[i] * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
@@ -346,7 +360,7 @@ StatusCode SCT_FrontEnd::randomNoise(SiChargedDiodeCollection& collection, const
   int nNoisyStrips = 0;
   double mode = 1.;
 
-  const bool noise_expanded_mode = (m_data_compression_mode == 3 and m_data_readout_mode == 1);
+  const bool noise_expanded_mode = (m_data_compression_mode == AnyHit_1XX_X1X_XX1 and m_data_readout_mode == Expanded);
 
   // Will give 3 times as much noise occupancy if running in any hit expanded mode
   if (noise_expanded_mode) {
@@ -465,7 +479,7 @@ StatusCode SCT_FrontEnd::randomNoise(SiChargedDiodeCollection& collection, const
   std::vector<int> nNoisyStrips(n_chips, 0);
   double mode = 1.;
 
-  const bool noise_expanded_mode = (m_data_compression_mode == 3 and m_data_readout_mode == 1);
+  const bool noise_expanded_mode = (m_data_compression_mode == AnyHit_1XX_X1X_XX1 and m_data_readout_mode == Expanded);
 
   // Will give 3 times as much noise occupancy if running in any hit expanded mode
   if (noise_expanded_mode) {
@@ -583,16 +597,12 @@ void SCT_FrontEnd::process(SiChargedDiodeCollection& collection, CLHEP::HepRando
   data.m_StripHitsOnWafer.assign(m_strip_max, 0);
 
   // Containes the charge for each bin on each hit strip
-  if (m_data_compression_mode == 1 and m_data_readout_mode == 0) {
-    for (int i = 0; i < m_strip_max; ++i) {
-      data.m_Analogue[1][i] = 0.0;
-    }
-  } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) {
+  if (m_data_readout_mode == Condensed) {
     for (int i = 0; i < m_strip_max; ++i) {
       data.m_Analogue[0][i] = 0.0;
       data.m_Analogue[1][i] = 0.0;
     }
-  } else if (m_data_compression_mode == 3 or m_data_readout_mode == 1) {
+  } else { // Expanded
     for (int i = 0; i < m_strip_max; ++i) {
       data.m_Analogue[0][i] = 0.0;
       data.m_Analogue[1][i] = 0.0;
@@ -658,7 +668,7 @@ StatusCode SCT_FrontEnd::doSignalChargeForHits(SiChargedDiodeCollection& collect
 
   // set up number of needed bins depending on the compression mode
   short bin_max = 0;
-  if (m_data_readout_mode == 0) {
+  if (m_data_readout_mode == Condensed) {
     bin_max = m_data_compression_mode;
   } else {
     bin_max = 3;
@@ -681,19 +691,7 @@ StatusCode SCT_FrontEnd::doSignalChargeForHits(SiChargedDiodeCollection& collect
 
         const list_t &ChargesOnStrip = diode.totalCharge().chargeComposition();
 
-        if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode X1X
-          // Amplifier response
-          data.m_Analogue[1][strip] += data.m_GainFactor[strip] * m_sct_amplifier->response(ChargesOnStrip, m_timeOfThreshold);
-
-          // Add Crosstalk signal for neighboring strip
-          response[0] = m_sct_amplifier->crosstalk(ChargesOnStrip, m_timeOfThreshold);
-          if (strip + 1 < m_strip_max) {
-            data.m_Analogue[1][strip + 1] += data.m_GainFactor[strip + 1] * response[0];
-          }
-          if (strip > 0) {
-            data.m_Analogue[1][strip - 1] += data.m_GainFactor[strip - 1] * response[0];
-          }
-        } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01X
+        if (m_data_readout_mode == Condensed) {
           // Amplifier response
           m_sct_amplifier->response(ChargesOnStrip, m_timeOfThreshold, response);
           for (short bin = 0; bin < bin_max; ++bin) {
@@ -709,7 +707,7 @@ StatusCode SCT_FrontEnd::doSignalChargeForHits(SiChargedDiodeCollection& collect
               data.m_Analogue[bin][strip - 1] += data.m_GainFactor[strip - 1] * response[bin];
             }
           }
-        } else if (m_data_compression_mode == 3 or m_data_readout_mode == 1) { // any hit mode (1XX|X1X|XX1) or expanded read out mode
+        } else { // Expanded
           // Amplifier response
           m_sct_amplifier->response(ChargesOnStrip, m_timeOfThreshold, response);
           for (short bin = 0; bin < bin_max; ++bin) {
@@ -750,18 +748,7 @@ StatusCode SCT_FrontEnd::doThresholdCheckForRealHits(SiChargedDiodeCollection& c
     if (roCell.isValid()) {
       int strip = roCell.strip();
       if (strip > -1 and strip < m_strip_max) {
-        if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode X1X
-          if (data.m_Analogue[1][strip] < m_Threshold) {
-            SiHelper::belowThreshold(diode, true);   // Below strip diode signal threshold
-            data.m_StripHitsOnWafer[strip] = -1;
-          } else if (((0x10 & diode.flag()) == 0x10) or ((0x4 & diode.flag()) == 0x4)) {
-            // previously a crazy strip number could have screwed things up here.
-            data.m_StripHitsOnWafer[strip] = -1;
-          } else {
-            data.m_StripHitsOnWafer[strip] = 1;
-            SiHelper::SetTimeBin(diode, 2, &msg()); // set timebin info
-          }
-        } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01X
+        if (m_data_readout_mode == Condensed) {
           if ((data.m_Analogue[0][strip] >= m_Threshold or data.m_Analogue[1][strip] < m_Threshold)) {
             SiHelper::belowThreshold(diode, true);   // Below strip diode signal threshold
             data.m_StripHitsOnWafer[strip] = -1;
@@ -772,7 +759,7 @@ StatusCode SCT_FrontEnd::doThresholdCheckForRealHits(SiChargedDiodeCollection& c
             data.m_StripHitsOnWafer[strip] = 1;
             SiHelper::SetTimeBin(diode, 2, &msg()); // set timebin info
           }
-        } else if (m_data_compression_mode == 3 or m_data_readout_mode == 1) { // Check hit pattern
+        } else { // Expanded
           int have_hit_bin = 0;
           if (data.m_Analogue[0][strip] >= m_Threshold) {
             have_hit_bin = 4;
@@ -786,7 +773,7 @@ StatusCode SCT_FrontEnd::doThresholdCheckForRealHits(SiChargedDiodeCollection& c
           if (((0x10 & diode.flag()) == 0x10) || ((0x4 & diode.flag()) == 0x4)) {
             // previously a crazy strip number could have screwed things up here.
             data.m_StripHitsOnWafer[strip] = -1;
-          } else if (m_data_compression_mode == 1) { // !< level and expanded mode
+          } else if (m_data_compression_mode == Level_X1X) { // !< level and expanded mode
             if (have_hit_bin == 2 or have_hit_bin == 3 or have_hit_bin == 6 or have_hit_bin == 7) {
               data.m_StripHitsOnWafer[strip] = 1;
               SiHelper::SetTimeBin(diode, have_hit_bin, &msg());
@@ -794,7 +781,7 @@ StatusCode SCT_FrontEnd::doThresholdCheckForRealHits(SiChargedDiodeCollection& c
               SiHelper::belowThreshold(diode, true); // Below strip diode signal threshold
               data.m_StripHitsOnWafer[strip] = -1;
             }
-          } else if (m_data_compression_mode == 2) { // !< edge and expanded mode
+          } else if (m_data_compression_mode == Edge_01X) { // !< edge and expanded mode
             if (have_hit_bin == 2 or have_hit_bin == 3) {
               data.m_StripHitsOnWafer[strip] = 1;
               SiHelper::SetTimeBin(diode, have_hit_bin, &msg());
@@ -802,13 +789,13 @@ StatusCode SCT_FrontEnd::doThresholdCheckForRealHits(SiChargedDiodeCollection& c
               SiHelper::belowThreshold(diode, true); // Below strip diode signal threshold
               data.m_StripHitsOnWafer[strip] = -1;
             }
-          } else if (m_data_compression_mode == 3) { // !< any hit mode
+          } else if (m_data_compression_mode == AnyHit_1XX_X1X_XX1) { // !< any hit mode
             if (have_hit_bin == 0) {
               SiHelper::belowThreshold(diode, true); // Below strip diode signal threshold
               data.m_StripHitsOnWafer[strip] = -1;
             } else {
               data.m_StripHitsOnWafer[strip] = 1;
-              if (m_data_readout_mode == 1) { // !< check for exp mode or not
+              if (m_data_readout_mode == Expanded) { // !< check for exp mode or not
                 SiHelper::SetTimeBin(diode, have_hit_bin, &msg());
               } else {
                 SiHelper::SetTimeBin(diode, 2, &msg());
@@ -839,16 +826,7 @@ StatusCode SCT_FrontEnd::doThresholdCheckForCrosstalkHits(SiChargedDiodeCollecti
     }
     if (data.m_Analogue[1][strip] > 0) { // Better way of doing this?!
                                     // set data.m_StripHitsOnWafer to x in prepareGainAndOffset
-      if (m_data_compression_mode == 1 and m_data_readout_mode == 0) { // level mode X1X
-        if (data.m_Analogue[1][strip] < m_Threshold) {
-          data.m_StripHitsOnWafer[strip] = -2; // Below threshold
-        } else {
-          data.m_StripHitsOnWafer[strip] = 2; // Crosstalk+Noise hit
-          if (StatusCode::SUCCESS != addNoiseDiode(collection, strip, 2)) {
-            ATH_MSG_ERROR("Can't add noise hit diode to collection");
-          }
-        }
-      } else if (m_data_compression_mode == 2 and m_data_readout_mode == 0) { // edge mode 01X
+      if (m_data_readout_mode == Condensed) {
         if ((data.m_Analogue[0][strip] >= m_Threshold or data.m_Analogue[1][strip] < m_Threshold)) {
           data.m_StripHitsOnWafer[strip] = -2; // Below threshold
         } else {
@@ -857,7 +835,7 @@ StatusCode SCT_FrontEnd::doThresholdCheckForCrosstalkHits(SiChargedDiodeCollecti
             ATH_MSG_ERROR("Can't add noise hit diode to collection");
           }
         }
-      } else if (m_data_compression_mode == 3 or m_data_readout_mode == 1) {
+      } else { // Expanded
         int have_hit_bin = 0;
         if (data.m_Analogue[0][strip] >= m_Threshold) {
           have_hit_bin = 4;
@@ -868,7 +846,7 @@ StatusCode SCT_FrontEnd::doThresholdCheckForCrosstalkHits(SiChargedDiodeCollecti
         if (data.m_Analogue[2][strip] >= m_Threshold) {
           have_hit_bin += 1;
         }
-        if (m_data_compression_mode == 1) { // !< level and expanded mode
+        if (m_data_compression_mode == Level_X1X) { // !< level and expanded mode
           if (have_hit_bin == 2 or have_hit_bin == 3 or have_hit_bin == 6 or have_hit_bin == 7) {
             data.m_StripHitsOnWafer[strip] = 2; // Crosstalk+Noise hit
             if (StatusCode::SUCCESS != addNoiseDiode(collection, strip, have_hit_bin)) {
@@ -877,7 +855,7 @@ StatusCode SCT_FrontEnd::doThresholdCheckForCrosstalkHits(SiChargedDiodeCollecti
           } else {
             data.m_StripHitsOnWafer[strip] = -2; // Below threshold
           }
-        } else if (m_data_compression_mode == 2) { // !< edge and expanded mode
+        } else if (m_data_compression_mode == Edge_01X) { // !< edge and expanded mode
           if (have_hit_bin == 2 or have_hit_bin == 3) {
             data.m_StripHitsOnWafer[strip] = 2; // Noise hit
             if (StatusCode::SUCCESS != addNoiseDiode(collection, strip, have_hit_bin)) {
@@ -886,12 +864,12 @@ StatusCode SCT_FrontEnd::doThresholdCheckForCrosstalkHits(SiChargedDiodeCollecti
           } else {
             data.m_StripHitsOnWafer[strip] = -2; // Below threshold
           }
-        } else if (m_data_compression_mode == 3) { // !< any hit mode
+        } else if (m_data_compression_mode == AnyHit_1XX_X1X_XX1) { // !< any hit mode
           if (have_hit_bin == 0) {
             data.m_StripHitsOnWafer[strip] = -2; // Below threshold
           } else {
             data.m_StripHitsOnWafer[strip] = 2; // !< Crosstalk+Noise hit
-            if (m_data_readout_mode == 1) { // !< check for exp mode or not
+            if (m_data_readout_mode == Expanded) { // !< check for exp mode or not
               if (StatusCode::SUCCESS != addNoiseDiode(collection, strip, have_hit_bin)) {
                 ATH_MSG_ERROR("Can't add noise hit diode to collection");
               }
@@ -920,7 +898,7 @@ StatusCode SCT_FrontEnd::doClustering(SiChargedDiodeCollection& collection, SCT_
 
   Identifier hitStrip;
 
-  if (m_data_readout_mode == 0) {
+  if (m_data_readout_mode == Condensed) {
     do {
       if (data.m_StripHitsOnWafer[strip] > 0) {
         // ====== First step: Get the cluster size
diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.h b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.h
index fd09f24cc844490a6831e0dc026e88e8ff5ca16b..f514d165ac757ae00df7d7c72706219708cea0cf 100644
--- a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.h
+++ b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_FrontEnd.h
@@ -105,6 +105,9 @@ class  SCT_FrontEnd : public extends<AthAlgTool, ISCT_FrontEnd> {
 
  private:
 
+  enum CompressionMode { Level_X1X=1, Edge_01X=2, AnyHit_1XX_X1X_XX1=3 }; // Used for m_data_compression_mode (DataCompressionMode)
+  enum ReadOutMode { Condensed=0, Expanded=1 }; // Used for m_data_readout_mode (DataReadOutMode)
+
   FloatProperty m_NoiseBarrel{this, "NoiseBarrel", 1500.0, "Noise factor, Barrel  (in the case of no use of calibration data)"};
   FloatProperty m_NoiseBarrel3{this, "NoiseBarrel3", 1541.0, "Noise factor, Barrel3  (in the case of no use of calibration data)"};
   FloatProperty m_NoiseInners{this, "NoiseInners", 1090.0, "Noise factor, EC Inners  (in the case of no use of calibration data)"};
@@ -124,8 +127,8 @@ class  SCT_FrontEnd : public extends<AthAlgTool, ISCT_FrontEnd> {
   FloatProperty m_OGcorr{this, "OffsetGainCorrelation", 0.00001, "Gain/offset correlation for the strips"};
   FloatProperty m_Threshold{this, "Threshold", 1.0, "Threshold"};
   FloatProperty m_timeOfThreshold{this, "TimeOfThreshold", 30.0, "Threshold time"};
-  ShortProperty m_data_compression_mode{this, "DataCompressionMode", 1, "Front End Data Compression Mode: 1 is level mode X1X (default), 2 is edge mode 01X, 3 is any hit mode (1XX|X1X|XX1)"};
-  ShortProperty m_data_readout_mode{this, "DataReadOutMode", 0, "Front End Data Read out mode Mode: 0 is condensed mode and 1 is expanded mode"};
+  ShortProperty m_data_compression_mode{this, "DataCompressionMode", Edge_01X, "Front End Data Compression Mode: 1 is level mode X1X (default), 2 is edge mode 01X, 3 is any hit mode (1XX|X1X|XX1)"};
+  ShortProperty m_data_readout_mode{this, "DataReadOutMode", Condensed, "Front End Data Read out mode Mode: 0 is condensed mode and 1 is expanded mode"};
   BooleanProperty m_useCalibData{this, "UseCalibData", true, "Flag to set the use of calibration data for noise, Gain,offset etc."};
 
   ToolHandle<ISCT_Amp> m_sct_amplifier{this, "SCT_Amp", "SCT_Amp", "Handle the Amplifier tool"}; //!< Handle the Amplifier tool
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetDigitization/TRT_Digitization/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..ab973ecc9bb9307ebeaf18c7ab449403f9b48f1b
--- /dev/null
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetDigitization/TRT_Digitization
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/CMakeLists.txt b/InnerDetector/InDetDigitization/TRT_Digitization/CMakeLists.txt
index 5fe6725f6bc37d3a19729d370a0e4537271b2bf2..f199a3bcb639619d73eff36c8a5cc17e3c533d3c 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/CMakeLists.txt
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/CMakeLists.txt
@@ -12,6 +12,7 @@ atlas_depends_on_subdirs( PUBLIC
 			  Control/StoreGate
                           Control/AthenaBaseComps
                           Control/AthenaKernel
+                          Control/CxxUtils
                           Control/PileUpTools
                           Database/AthenaPOOL/AthenaPoolUtilities
                           DetectorDescription/GeoModel/GeoModelInterfaces
@@ -44,7 +45,7 @@ atlas_add_component( TRT_Digitization
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} GaudiKernel AthenaBaseComps AthenaKernel PileUpToolsLib AthenaPoolUtilities GeoModelUtilities GeoPrimitives Identifier EventInfo GeneratorObjects TRT_ConditionsData TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetRawData InDetSimData InDetSimEvent HitManagement MagFieldElements MagFieldConditions)
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} GaudiKernel AthenaBaseComps AthenaKernel CxxUtils PileUpToolsLib AthenaPoolUtilities GeoModelUtilities GeoPrimitives Identifier EventInfo GeneratorObjects TRT_ConditionsData TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetRawData InDetSimData InDetSimEvent HitManagement MagFieldElements MagFieldConditions TRT_PAI_ProcessLib )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.h
index 2a4956db3a87ec9d03ee80a64eae0f23eb421127..d08869fc927d24b8dc95fd589b676e19ba9cdd3a 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.h
@@ -1,21 +1,26 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRT_DIGITIZATION_TRTDIGCONDBASE_H
 #define TRT_DIGITIZATION_TRTDIGCONDBASE_H
 
-#include "CLHEP/Random/RandomEngine.h"
-#include <set>
-#include <map>
-#include "Identifier/Identifier.h"
 #include "AthenaKernel/MsgStreamMember.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "GaudiKernel/ServiceHandle.h"
+#include "CxxUtils/checker_macros.h"
+#include "Identifier/Identifier.h"
 #include "TRT_ConditionsServices/ITRT_StrawStatusSummaryTool.h" // added by Sasha for Argon
 
-class TRT_ID;
+#include "GaudiKernel/ServiceHandle.h"
+#include "GaudiKernel/ToolHandle.h"
+
+#include "CLHEP/Random/RandomEngine.h"
 
+#include <atomic>
+#include <map>
+#include <mutex>
+#include <set>
+
+class TRT_ID;
 
 namespace InDetDD {
   class TRT_DetectorManager;
@@ -172,9 +177,10 @@ private:
   /** Iterator pointing to last straw in straw state map */
   std::map<int,StrawState>::const_iterator m_it_hitid_to_StrawState_End;
   /** Iterator used for caching (ought to be called _Previous) */
-  mutable std::map<int,StrawState>::const_iterator m_it_hitid_to_StrawState_Last;
+  mutable std::map<int,StrawState>::const_iterator m_it_hitid_to_StrawState_Last ATLAS_THREAD_SAFE; // Guarded by m_mutex
+  mutable std::mutex m_mutex;
 
-  mutable float m_averageNoiseLevel; /**< Average noise level */
+  mutable std::atomic<float> m_averageNoiseLevel; /**< Average noise level */
   double m_crosstalk_noiselevel;
   double m_crosstalk_noiselevel_other_end;
 
@@ -185,7 +191,7 @@ private:
   std::map<int,StrawState>::iterator m_all_it_hitid_to_StrawState_previous;
 
 protected:
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 
   int m_UseGasMix;
   ToolHandle<ITRT_StrawStatusSummaryTool> m_sumTool; // added by Sasha for Argon
@@ -195,13 +201,13 @@ protected:
 ////////////////
 /// INLINES ////
 ////////////////
-//Fixme: cache last access!!
 
 //___________________________________________________________________________
 inline void TRTDigCondBase::getStrawData( const int& hitID,
                                           double& lowthreshold,
                                           double& noiseamplitude ) const {
   //fixme: do we actually benefit from this caching?
+  std::lock_guard<std::mutex> lock(m_mutex);
   if (m_it_hitid_to_StrawState_Last->first != hitID)
     m_it_hitid_to_StrawState_Last = m_hitid_to_StrawState.find(hitID);
 
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.cxx
index c599109f7c8163951ac4f0d3a49bde5ac19fefec..d87795874cf05536fef5258d57338fd5e35ec529 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /////////////////////////////////////////////////////////////////
@@ -17,18 +17,22 @@
 //                                                             //
 /////////////////////////////////////////////////////////////////
 #include "TRTDigSettings.h"
+
 #include "TRT_ReadoutGeometry/TRT_DetectorManager.h"
-#include "CLHEP/Units/SystemOfUnits.h"
-#include "CLHEP/Units/PhysicalConstants.h" //For speed of light
-#include "GaudiKernel/Algorithm.h"         //For adding properties to an algorithm
-#include "GaudiKernel/AlgTool.h"           //For adding properties to an algtool
-#include <iostream>
-#include <limits>
 
 //Geomodel
 #include "GeoModelUtilities/DecodeVersionKey.h"
 #include "GeoModelInterfaces/IGeoModelSvc.h"
 
+#include "GaudiKernel/Algorithm.h"         //For adding properties to an algorithm
+#include "GaudiKernel/AlgTool.h"           //For adding properties to an algtool
+
+#include "CLHEP/Units/SystemOfUnits.h"
+#include "CLHEP/Units/PhysicalConstants.h" //For speed of light
+
+#include <iostream>
+#include <limits>
+
 // RDBAccessSvc (Interface to the DD database) has been removed since
 // TRT_Digitization-01-00-11 because the fetched values are correctly
 // hard-coded already. See TRT_Digitization-01-00-10 for an example of
@@ -318,10 +322,10 @@ void TRTDigSettings::defineNewVariable(std::string name, double * datamember,std
 
   //sanity checks:
   if (m_intboolparMap.find(name)!=m_intboolparMap.end() || m_doubleparMap.find(name)!=m_doubleparMap.end()) {
-    std::cout << "TRTDigSettings: Multiple definitions of "<<name<<std::endl; exit(1);
+    msg(MSG::FATAL) << "TRTDigSettings: Multiple definitions of "<<name<<endmsg; return;
   }
   if (lowrange > highrange || lowrange*unitval<=m_propertyNotSetMagicNumber ) {
-    std::cout << "TRTDigSettings: Problem in range of par "<<name<<std::endl; exit(1);
+    msg(MSG::FATAL) << "TRTDigSettings: Problem in range of par "<<name<<endmsg; return;
   }
 
   doubleparameter p;
@@ -342,10 +346,10 @@ void TRTDigSettings::defineNewUIntVariable(std::string name,unsigned int * datam
                                            unsigned int lowrange, unsigned int highrange) {
   //sanity checks:
   if (m_intboolparMap.find(name)!=m_intboolparMap.end() || m_doubleparMap.find(name)!=m_doubleparMap.end()) {
-    std::cout << "TRTDigSettings: Multiple definitions of "<<name<<std::endl; exit(1);
+    msg(MSG::FATAL) << "TRTDigSettings: Multiple definitions of "<<name<<endmsg; return;
   }
   if (lowrange > highrange ) {
-    std::cout << "TRTDigSettings: Problem in range of par "<<name<<std::endl; exit(1);
+    msg(MSG::FATAL) << "TRTDigSettings: Problem in range of par "<<name<<endmsg; return;
   }
 
   intboolparameter p;
@@ -367,10 +371,10 @@ void TRTDigSettings::defineNewIntVariable(std::string name,int * datamember,std:
                                           int lowrange, int highrange) {
   //sanity checks:
   if (m_intboolparMap.find(name)!=m_intboolparMap.end() || m_doubleparMap.find(name)!=m_doubleparMap.end()) {
-    std::cout << "TRTDigSettings: Multiple definitions of "<<name<<std::endl; exit(1);
+    msg(MSG::FATAL) << "TRTDigSettings: Multiple definitions of "<<name<<endmsg; return;
   }
   if (lowrange > highrange || lowrange<=m_propertyNotSetMagicNumber_int ) {
-    std::cout << "TRTDigSettings: Problem in range of par "<<name<<std::endl; exit(1);
+    msg(MSG::FATAL) << "TRTDigSettings: Problem in range of par "<<name<<endmsg; return;
   }
 
   intboolparameter p;
@@ -391,7 +395,7 @@ void TRTDigSettings::defineNewIntVariable(std::string name,int * datamember,std:
 void TRTDigSettings::defineNewBoolVariable(std::string name,bool * datamember,std::string description) {
   //sanity checks:
   if (m_intboolparMap.find(name)!=m_intboolparMap.end() || m_doubleparMap.find(name)!=m_doubleparMap.end()) {
-    std::cout << "TRTDigSettings: Multiple definitions of "<<name<<std::endl; exit(1);
+    msg(MSG::FATAL) << "TRTDigSettings: Multiple definitions of "<<name<<endmsg; return;
   }
 
   intboolparameter p;
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.h
index 119ccc2e85b30516836e02aed530a5c1b7a53f26..31495bf0c14d2066255ed9d6d70e53b324c17cc9 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /////////////////////////////////////////////////////////////////
@@ -18,11 +18,12 @@
 #ifndef TRT_DIGITIZATION_TRTDIGSETTINGS_H
 #define TRT_DIGITIZATION_TRTDIGSETTINGS_H
 
-#include <vector>
+#include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
+
 #include <map>
 #include <string>
-
-#include "AthenaKernel/MsgStreamMember.h"
+#include <vector>
 
 class Algorithm;
 class AlgTool;
@@ -427,7 +428,7 @@ private:
   double m_propertyNotSetMagicNumber;
   int m_propertyNotSetMagicNumber_int;
 
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 
 };
 
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx
index ed406a39a096f7f2e23535805d669d3a387ab406..761d23472f31b5f8167107892e98928c0fa4c671 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx
@@ -61,6 +61,8 @@
 #include "CLHEP/Random/RandomEngine.h"
 #include "CLHEP/Random/RandGaussZiggurat.h"
 
+#include "CxxUtils/checker_macros.h"
+
 //#include "driftCircle.h" // local copy for debugging and development
 
 //_____________________________________________________________________________
@@ -87,7 +89,7 @@ TRTDigitizationTool::~TRTDigitizationTool() {
 }
 
 //_____________________________________________________________________________
-StatusCode TRTDigitizationTool::initialize()
+StatusCode TRTDigitizationTool::initialize ATLAS_NOT_THREAD_SAFE ()
 {
 
   ATH_MSG_DEBUG ( name()<<"::initialize() begin" );
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsNoise.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsNoise.h
index d36041f6291192e6f71eff26719249b6a4bb34ef..21fce2b6fb3d816d1d6bf7ffcf5691d877132c8d 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsNoise.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsNoise.h
@@ -1,15 +1,17 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRT_DIGITIZATION_TRTELECTRONICSNOISE_H
 #define TRT_DIGITIZATION_TRTELECTRONICSNOISE_H
 
-#include <vector>
-
 #include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 
 #include "CLHEP/Random/RandomEngine.h"
+
+#include <vector>
+
 class TRTDigSettings;
 
 /**
@@ -113,7 +115,7 @@ private:
   double m_fractionOfSlowNoise;
   unsigned int m_nbins_periodic;
 
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 
   /**
    * Initialize signal shaping.
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.cxx
index 72002d3071644ae6276ae84b2666c0fc44a5d606..93698f29eda62fd1a1ca0726adb4fd7dcb63ea86 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TRTElectronicsProcessing.h"
@@ -305,9 +305,8 @@ void TRTElectronicsProcessing::ProcessDeposits( const std::vector<TRTElectronics
   // Only attempt this if the digit is non-zero
   if ( m_settings->isOverlay() && digit ) { //doing overlay
     digit += (1<<31);//flag digit a "MC" one
-    static bool first = true;
-    if (first){
-      first=false;
+    if (m_first){
+      m_first=false;
       msg(MSG::DEBUG) << "ACH666: Flagging digits as MC (for overlay)" << endmsg;
     }
   }
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.h
index 86f5e1698f328e06f87e347c4ae23841923a584e..3482fff78b523c62c4344538487e380625ca34f3 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.h
@@ -1,19 +1,23 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRT_DIGITIZATION_TRTELECTRONICSPROCESSING_H
 #define TRT_DIGITIZATION_TRTELECTRONICSPROCESSING_H
 
-#include <vector>
+#include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 
-class TRTDigit;
-class TRTElectronicsNoise;
-#include "CLHEP/Random/RandomEngine.h"
 #include "GaudiKernel/ServiceHandle.h"
-#include "AthenaKernel/MsgStreamMember.h"
+
+#include "CLHEP/Random/RandomEngine.h"
+
+#include <atomic>
+#include <vector>
 
 class TRTDigSettings;
+class TRTDigit;
+class TRTElectronicsNoise;
 
 /**
  * Electronics Processing
@@ -164,8 +168,9 @@ private:
   int* m_lowThresholdDiscriminator;  /**< Signal after discrimination */
   int* m_highThresholdDiscriminator; /**< Signal after discrimination */
 
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 
+  mutable std::atomic<bool> m_first{true};
 };
 
 #endif
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.h
index c4db4c5288cf6cf39b6df8687ac69e21e6cb00e5..a96dd173c5675ef92e34941095b6c3c028ff92fe 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.h
@@ -1,26 +1,29 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRT_DIGITIZATION_TRTNOISE_H
 #define TRT_DIGITIZATION_TRTNOISE_H
 
-#include <vector>
-#include <set>
-
 #include "TRTDigit.h"
 
-#include "GaudiKernel/ServiceHandle.h"
-#include "GaudiKernel/ToolHandle.h"
+#include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 #include "TRT_ConditionsServices/ITRT_StrawNeighbourSvc.h"
 #include "TRT_ConditionsServices/ITRT_StrawStatusSummaryTool.h"
 
-class TRTDigCondBase;
-class TRTElectronicsProcessing;
-class TRTElectronicsNoise;
-#include "AthenaKernel/MsgStreamMember.h"
+#include "GaudiKernel/ServiceHandle.h"
+#include "GaudiKernel/ToolHandle.h"
+
 #include "CLHEP/Random/RandomEngine.h"
+
+#include <set>
+#include <vector>
+
 class Identifier;
+class TRTDigCondBase;
+class TRTElectronicsNoise;
+class TRTElectronicsProcessing;
 class TRT_ID;
 
 namespace InDetDD {
@@ -204,7 +207,7 @@ private:
                                              float & new_min_lt2na,
                                              float & new_max_lt2na,
                                              const unsigned int& number_new_bins );
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 
   Identifier getStrawIdentifier (int hitID);
 
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.h
index fd4702e88957f16d243e5fffd8e76c9e3b665f19..e307288fb28b4d52bc0ee8a60413b87769c4da11 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTProcessingOfStraw.h
@@ -5,30 +5,34 @@
 #ifndef TRT_DIGITIZATION_TRTPROCESSINGOFSTRAW_H
 #define TRT_DIGITIZATION_TRTPROCESSINGOFSTRAW_H
 
+#include "AthenaKernel/MsgStreamMember.h"
+
+#include "CxxUtils/checker_macros.h"
+
 //Hit classes
 #include "HitManagement/TimedHitCollection.h"
-#include "InDetSimEvent/TRTUncompressedHit.h"
 //Particle Table
 #include "HepPDT/ParticleDataTable.hh"
 
-#include <vector>
-
-#include "TRTElectronicsProcessing.h"
-
-#include "CLHEP/Random/RandomEngine.h"
-#include "GeoPrimitives/GeoPrimitives.h"
-
-#include "AthenaKernel/MsgStreamMember.h"
-
 #include "InDetIdentifier/TRT_ID.h"
-#include "TRT_ConditionsServices/ITRT_StrawStatusSummaryTool.h"
-#include "TRT_ConditionsServices/ITRT_CalDbTool.h"
+
+#include "InDetSimEvent/TRTUncompressedHit.h"
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // MagField cache
 #include "MagFieldElements/AtlasFieldCache.h"
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
+#include "TRT_ConditionsServices/ITRT_StrawStatusSummaryTool.h"
+#include "TRT_ConditionsServices/ITRT_CalDbTool.h"
+
+#include "TRTElectronicsProcessing.h"
+
+#include "GeoPrimitives/GeoPrimitives.h"
+
+#include "CLHEP/Random/RandomEngine.h"
+
+#include <vector>
 
 class TRTDigit;
 class TRTTimeCorrection;
@@ -234,7 +238,7 @@ private:
 
   Amg::Vector3D getGlobalPosition( int hitID, const TimedHitPtr<TRTUncompressedHit> *theHit );
 
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 
 protected:
   const TRT_ID* m_id_helper;
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.h
index c4c2dd98a61d803ea1fe9e5923c4928bbef0f83d..28f5e15ca3290a95cc9d797f76f00b642eb73bf5 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.h
@@ -1,15 +1,16 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRT_DIGITIZATION_TRTTIMECORRECTION_H
 #define TRT_DIGITIZATION_TRTTIMECORRECTION_H
 
-#include <vector>
-#include "TRT_ConditionsServices/ITRT_CalDbTool.h"
 #include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 #include "Identifier/Identifier.h"
+#include "TRT_ConditionsServices/ITRT_CalDbTool.h"
 
+#include <vector>
 
 namespace InDetDD {
   class TRT_DetectorManager;
@@ -145,7 +146,7 @@ private:
 
   const ITRT_CalDbTool* m_trtcaldbtool;
 
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 
 };
 
diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx
index 69623dbdc040f5e9fbe70d5cb239e92abd9b5031..5d84f189a375a88f3bf2047515d775c9e77e73fd 100644
--- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx
+++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "SCTRawDataProvider.h"
@@ -39,8 +39,9 @@ StatusCode SCTRawDataProvider::initialize()
     m_cabling.disable();
   }
   else {
-    // Retrieve Cabling service
+    // Retrieve Cabling tool
     ATH_CHECK(m_cabling.retrieve());
+    m_regionSelector.disable();
   }
 
   //Initialize
@@ -105,8 +106,8 @@ StatusCode SCTRawDataProvider::execute(const EventContext& ctx) const
     for (const TrigRoiDescriptor* roi : *roiCollection) {
       superRoI.push_back(roi);
     }
-    m_regionSelector->DetROBIDListUint(SCT, superRoI, listOfROBs);
-    m_regionSelector->DetHashIDList(SCT, superRoI, hashIDs);
+    m_regionSelector->ROBIDList(superRoI, listOfROBs);
+    m_regionSelector->HashIDList(superRoI, hashIDs);
     m_robDataProvider->getROBData(listOfROBs, vecROBFrags);
   }
 
diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h
index 737c7a71f74d5ff794cd83694c47a60e9978a0b7..6f86b678b14b1e4e38646d0506a4775a0c21b648 100644
--- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h
+++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h
@@ -17,7 +17,7 @@
 
 #include "StoreGate/ReadHandleKey.h"
 #include "StoreGate/WriteHandleKey.h"
-#include "IRegionSelector/IRegSelSvc.h"
+#include "IRegionSelector/IRegSelTool.h"
 #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
@@ -62,16 +62,16 @@ class SCTRawDataProvider : public AthReentrantAlgorithm
 
  private:
 
-  /** Region Selector service for Athena. */
-  ServiceHandle<IRegSelSvc> m_regionSelector{this,
-                                             "RegSelSvc",
-                                             "RegSelSvc"};
-
   /** ROB Data Provider for accessing ROB data. */
   ServiceHandle<IROBDataProviderSvc> m_robDataProvider{this,
                                                        "ROBDataProviderSvc",
                                                        "ROBDataProviderSvc"};
 
+  /** Region Selector tool for Athena. */
+  ToolHandle<IRegSelTool> m_regionSelector{this,
+                                           "RegSelTool",
+                                           "RegSelTool/RegSel_SCT"};
+
   /** Tool to fill Collections of SCT RDO Containers. */
   ToolHandle<ISCTRawDataProviderTool> m_rawDataTool{this,
                                                     "ProviderTool",
diff --git a/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/CMakeLists.txt b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/CMakeLists.txt
index e86580b4de7cbf8e5175d2d6b6b21185df2764ae..5c04aa542f3c53cf97dfc36711a997730bbcdebf 100644
--- a/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/CMakeLists.txt
+++ b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/CMakeLists.txt
@@ -12,6 +12,8 @@ atlas_depends_on_subdirs( PUBLIC
                           Event/ByteStreamData
                           InnerDetector/InDetRawEvent/InDetRawData
                           PRIVATE
+                          Control/AthenaKernel
+                          Control/CxxUtils
                           Control/StoreGate
                           Database/AthenaPOOL/AthenaPoolUtilities
                           Event/ByteStreamCnvSvcBase
@@ -37,7 +39,7 @@ atlas_add_component( TRT_RawDataByteStreamCnv
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${CORAL_LIBRARIES} ${ROOT_LIBRARIES} ${COOL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps Identifier ByteStreamData ByteStreamData_test InDetRawData StoreGateLib SGtests AthenaPoolUtilities ByteStreamCnvSvcBaseLib GaudiKernel TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry PathResolver IRegionSelector TrigSteeringEvent TRT_CablingLib )
+                     LINK_LIBRARIES ${CORAL_LIBRARIES} ${ROOT_LIBRARIES} ${COOL_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps Identifier ByteStreamData ByteStreamData_test InDetRawData AthenaKernel CxxUtils StoreGateLib SGtests AthenaPoolUtilities ByteStreamCnvSvcBaseLib GaudiKernel TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry PathResolver IRegionSelector TrigSteeringEvent TRT_CablingLib )
 
 # Install files from the package:
 atlas_install_headers( TRT_RawDataByteStreamCnv )
diff --git a/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/TRT_RawDataByteStreamCnv/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/TRT_RawDataByteStreamCnv/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..a0119e0dee67c295c992fd52f2956d5107540791
--- /dev/null
+++ b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/TRT_RawDataByteStreamCnv/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv
diff --git a/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/src/TRT_RodDecoder.cxx b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/src/TRT_RodDecoder.cxx
index 8d98a5277484c1aef45af2d0185b963f51b70794..fdbfed9102d96b6550abbeb799d3ab4d85ec9be6 100644
--- a/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/src/TRT_RodDecoder.cxx
+++ b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/src/TRT_RodDecoder.cxx
@@ -248,10 +248,11 @@ StatusCode TRT_RodDecoder::finalize() {
  * ----------------------------------------------------------
  */
 StatusCode
-TRT_RodDecoder::fillCollection ( const ROBFragment* robFrag,
+TRT_RodDecoder::fillCollection ATLAS_NOT_THREAD_SAFE ( const ROBFragment* robFrag,
 				 TRT_RDO_Container* rdoIdc,
 				 TRT_BSErrContainer* bsErr,
 				 const std::vector<IdentifierHash>* vecHash )
+// Non-thread-safe function 'StatusCode TRT_RodDecoder::update()' called
 {
 
   std::lock_guard<std::mutex> lock(m_cacheMutex);
@@ -271,8 +272,6 @@ TRT_RodDecoder::fillCollection ( const ROBFragment* robFrag,
   //		<< robid << " L1ID = " << robFrag->rod_lvl1_id()
   //		<< MSG::dec );
 
-  static int  err_count                = 0;
-
   /*
    * Save non-zero rob status to TRT BS Conditions Services
    */
@@ -292,14 +291,19 @@ TRT_RodDecoder::fillCollection ( const ROBFragment* robFrag,
        * This is a hack to only print once per event.  It will work the
        * vast majority of the time, but it may miss an occasional event.
        */
-      static uint32_t Last_print_L1ID = 0xffffffff;
-      static uint32_t Last_print_BCID = 0xffffffff;
 
-      if ( (Last_print_L1ID != robFrag->rod_lvl1_id()) || 
-      	   (Last_print_BCID != robFrag->rod_bc_id()) )
+      const EventContext& ctx{Gaudi::Hive::currentContext()};
+      CacheEntry* ent{m_cache.get(ctx)};
+      if (ent->m_evt!=ctx.evt()) { // New event in this slot
+        ent->reset();
+        ent->m_evt = ctx.evt();
+      }
+
+      if ( (ent->Last_print_L1ID != robFrag->rod_lvl1_id()) || 
+      	   (ent->Last_print_BCID != robFrag->rod_bc_id()) )
       {
-	Last_print_L1ID = robFrag->rod_lvl1_id();
-	Last_print_BCID = robFrag->rod_bc_id();
+	ent->Last_print_L1ID = robFrag->rod_lvl1_id();
+	ent->Last_print_BCID = robFrag->rod_bc_id();
 
 	ATH_MSG_INFO( "Non-Zero ROB status word for ROB " 
 		      << MSG::hex 
@@ -324,18 +328,18 @@ TRT_RodDecoder::fillCollection ( const ROBFragment* robFrag,
 				 vecHash );  
     else
     {
-      if ( err_count < 100 )
+      if ( m_err_count_fillCollection < 100 )
       {
 	ATH_MSG_WARNING( "Rod Version: " << RodBlockVersion		\
 			 << ", but Compression Table not loaded!  ROD ID = " \
 			 << MSG::hex << robid << MSG::dec );
-	err_count++;
+	m_err_count_fillCollection++;
       }
-      else if ( 100 == err_count )
+      else if ( 100 == m_err_count_fillCollection )
       {
 	ATH_MSG_WARNING( "Too many Rod Version messages.  "	\
 			 << "Turning message off." );
-	err_count++;
+	m_err_count_fillCollection++;
       }
       
       sc = StatusCode::FAILURE;
@@ -707,8 +711,6 @@ TRT_RodDecoder::int_fillMinimalCompress( const ROBFragment *robFrag,
 					TRT_RDO_Container* rdoIdc,
 					const std::vector<IdentifierHash>* vecHash)
 {
-  static int err_count = 0;
-  
   uint32_t robid = robFrag->rod_source_id();
   
   // get the ROD version. It could be used to decode the data in one
@@ -775,14 +777,14 @@ TRT_RodDecoder::int_fillMinimalCompress( const ROBFragment *robFrag,
 	    //  ATH_MSG_WARNING( "vint[" << in_ptr << "] = " << MSG::hex << vint[in_ptr] << MSG::dec );
 	  }
 	  if ( v ) {
-	    if ( err_count < 100 ) {
+	    if ( m_err_count_int_fillMinimalCompress < 100 ) {
 	       ATH_MSG_WARNING( "Invalid ByteStream, ROD ID = " \
 				<< MSG::hex << robid << MSG::dec );
-	      err_count++;
-	    } else if ( 100 == err_count ) {
+	      m_err_count_int_fillMinimalCompress++;
+	    } else if ( 100 == m_err_count_int_fillMinimalCompress ) {
 	       ATH_MSG_WARNING( "Too many Invalid ByteStream messages  " \
 				<< "Turning message off." );
-	      err_count++;
+	      m_err_count_int_fillMinimalCompress++;
 	    }
 	    return StatusCode::RECOVERABLE;
 	  }
@@ -938,8 +940,6 @@ TRT_RodDecoder::int_fillFullCompress( const ROBFragment *robFrag,
 				      t_CompressTable* Ctable,
 				      const std::vector<IdentifierHash>* vecHash)
 {
-  static int err_count = 0;
-
   int phase;
   for ( phase=0; phase<2; phase++ )
   {
@@ -1033,17 +1033,17 @@ TRT_RodDecoder::int_fillFullCompress( const ROBFragment *robFrag,
       word = Ctable->m_syms[idx];
     else
     {
-      if ( err_count < 100 ) 
+      if ( m_err_count_int_fillFullCompress < 100 ) 
       {
 	ATH_MSG_WARNING( "Invalid ByteStream, ROD ID = "		\
 			 << MSG::hex << robid << MSG::dec );
-	err_count++;
+	m_err_count_int_fillFullCompress++;
       }
-      else if ( 100 == err_count ) 
+      else if ( 100 == m_err_count_int_fillFullCompress ) 
       {
 	ATH_MSG_WARNING( "Too many Invalid ByteStream messages  "	\
 			 << "Turning message off." );
-	err_count++;
+	m_err_count_int_fillFullCompress++;
       }
 
       return StatusCode::RECOVERABLE;
@@ -1700,7 +1700,8 @@ TableFilename
  * Read Compression Table from DB on IOV change
  */
 StatusCode
-TRT_RodDecoder::update()
+TRT_RodDecoder::update ATLAS_NOT_THREAD_SAFE ()
+// Non-thread-safe function 'AthenaAttributeList::AthenaAttributeList(const coral::AttributeList&)' called
 {  
 
   /*
diff --git a/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/src/TRT_RodDecoder.h b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/src/TRT_RodDecoder.h
index 9d7103b9527732130ed046b74fd677d6e7a89217..0a0d47657d6584da455bc365c9f182c2606f145c 100644
--- a/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/src/TRT_RodDecoder.h
+++ b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/src/TRT_RodDecoder.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 TRT_RAWDATABYTESTREAM_TRT_RODDECODER_H
@@ -61,12 +61,19 @@
  */
 #include "InDetIdentifier/TRT_ID.h"
 
+/*
+ * For cache
+ */
+#include "AthenaKernel/SlotSpecificObj.h"
+#include "CxxUtils/checker_macros.h"
+
 /*
  * STL
  */
-#include <vector>
+#include <atomic>
 #include <map>
-
+#include <mutex>
+#include <vector>
 
 // the tool to decode a ROB frament
 
@@ -155,6 +162,10 @@ public:
 
    uint32_t m_Nrdos;              // Number of RDOs created
 
+   mutable std::atomic<int> m_err_count_fillCollection{0};
+   mutable std::atomic<int> m_err_count_int_fillMinimalCompress{0};
+   mutable std::atomic<int> m_err_count_int_fillFullCompress{0};
+
    // This replaces the IOVCALLBACK
    SG::ReadCondHandleKey<CondAttrListCollection> m_CompressKey{this,"keyName","/TRT/Onl/ROD/Compress","in-key"};
    mutable std::mutex m_cacheMutex;
@@ -178,7 +189,19 @@ private:
 
    StatusCode ReadCompressTableFile( std::string TableFilename );
    StatusCode ReadCompressTableDB( std::string Tag );
- 
+
+   // Struct for event cache
+   struct CacheEntry {
+     EventContext::ContextEvt_t m_evt{EventContext::INVALID_CONTEXT_EVT};
+     uint32_t Last_print_L1ID = 0xffffffff;
+     uint32_t Last_print_BCID = 0xffffffff;
+     void reset() {
+       Last_print_L1ID = 0xffffffff;
+       Last_print_BCID = 0xffffffff;
+     }
+   };
+   mutable SG::SlotSpecificObj<CacheEntry> m_cache ATLAS_THREAD_SAFE; // Guarded by m_cacheMutex
+
 };
 
 #endif
diff --git a/InnerDetector/InDetExample/InDetRecExample/python/ConfiguredNewTrackingCuts.py b/InnerDetector/InDetExample/InDetRecExample/python/ConfiguredNewTrackingCuts.py
index 558c5376729c6485d36f79674d1829966580b50e..03800a50999144a60392305eeda607b69e3b3a6c 100755
--- a/InnerDetector/InDetExample/InDetRecExample/python/ConfiguredNewTrackingCuts.py
+++ b/InnerDetector/InDetExample/InDetRecExample/python/ConfiguredNewTrackingCuts.py
@@ -221,6 +221,21 @@ class ConfiguredNewTrackingCuts :
       self.__maxPrimaryImpact        = 5.0 * Units.mm #based on studies by T.Strebler
 
     if self.__indetflags.cutLevel() >= 17:
+      # Tuning of the search road and strip seed IP in the track finder.
+      # Designed to speed up reconstruction at minimal performance impact. 
+      self.__roadWidth              = 12
+      self.__maxdImpactSSSSeeds     = 5.0 * Units.mm
+
+    if self.__indetflags.cutLevel() >= 18:
+      # Further tuning of the pattern recognition designed to 
+      # speed up reconstruction compared to 17 with minimal additional 
+      # impact. Kept as separate level pending cross-check of 
+      # seed confirmation robustness with end-of-run-3 radiation
+      # damage. 
+      self.__keepAllConfirmedSeeds  = True
+      self.__maxSeedsPerSP          = 1
+
+    if self.__indetflags.cutLevel() >= 19:
       print('--------> FATAL ERROR, cut level undefined, abort !')
       import sys
       sys.exit()
@@ -356,12 +371,12 @@ class ConfiguredNewTrackingCuts :
       self.__minPT              = 1.0 * Units.GeV                                                                                    
       self.__maxEta             = 3                                                                                                        
       self.__maxPrimaryImpact   = 300.0 * Units.mm
-      self.__maxZImpact         = 750 * Units.mm    
+      self.__maxZImpact         = 500 * Units.mm    
       self.__maxSecondaryImpact = 300.0 * Units.mm  
       self.__minSecondaryPt     = 1000.0 * Units.MeV 
       self.__minClusters        = 8                  
       self.__minSiNotShared     = 6                 
-      self.__maxShared          = 2   # cut is now on number of shared modules                                                                                  
+      self.__maxShared          = 2   # cut is now on number of shared modules   
       self.__minPixel           = 0
       self.__maxHoles           = 2
       self.__maxPixelHoles      = 1
@@ -374,10 +389,13 @@ class ConfiguredNewTrackingCuts :
       self.__maxTracksPerSharedPRD   = 2
       self.__Xi2max                  = 9.0  
       self.__Xi2maxNoAdd             = 25.0 
-      self.__roadWidth               = 10. 
+      self.__roadWidth               = 5. 
       self.__nWeightedClustersMin    = 8   
       self.__maxdImpactSSSSeeds      = 300.0
       self.__doZBoundary             = True
+      self.__keepAllConfirmedSeeds   = True
+      self.__maxSeedsPerSP           = 1
+
 
     # --- mode for high-d0 tracks down to 100 MeV (minPT, minClusters, minSecondaryPt cuts loosened to MinBias level)
     if mode == "LowPtLargeD0":
diff --git a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py
index 6763a49094d6e71886b3bc727cdbd66dc1b9bd38..740a6bebad07d9d1cd48dc9b35a985e9412084f3 100644
--- a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py
+++ b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py
@@ -302,8 +302,8 @@ class cutLevel(InDetFlagsJobProperty):
     """
     statusOn     = True
     allowedTypes = ['int']
-    allowedValues= [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
-    StoredValue  = 16
+    allowedValues= [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]
+    StoredValue  = 18
 
 class doBremRecovery(InDetFlagsJobProperty):
     """Turn on running of Brem Recover in tracking"""
diff --git a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
index 74ce2050aab70f8bd8a5762d5b826d09ce3b4c9c..3e35f6f2984935505a73acd67057922cee790213 100644
--- a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
+++ b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
@@ -94,10 +94,14 @@ class  ConfiguredNewTrackingSiPattern:
             InDetSiSpacePointsSeedMaker.maxdImpactSSS = NewTrackingCuts.maxdImpactSSSSeeds()
             InDetSiSpacePointsSeedMaker.maxSeedsForSpacePoint = NewTrackingCuts.MaxSeedsPerSP()
             InDetSiSpacePointsSeedMaker.alwaysKeepConfirmedSeeds = NewTrackingCuts.KeepAllConfirmedSeeds()
-            
+
          if NewTrackingCuts.mode() == "R3LargeD0":
             InDetSiSpacePointsSeedMaker.usePixel = False
             InDetSiSpacePointsSeedMaker.etaMax = NewTrackingCuts.maxEta() 
+            InDetSiSpacePointsSeedMaker.maxSeedsForSpacePoint = NewTrackingCuts.MaxSeedsPerSP()
+            InDetSiSpacePointsSeedMaker.alwaysKeepConfirmedSeeds = NewTrackingCuts.KeepAllConfirmedSeeds()
+            InDetSiSpacePointsSeedMaker.maxdRadius = 150
+            InDetSiSpacePointsSeedMaker.seedScoreBonusConfirmationSeed = -2000  #let's be generous
 
          if usePrdAssociationTool:
             # not all classes have that property !!!
diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py
index a826109ac606f7fb201466dd07131b18d1922b68..d704aad67091b077217690e65ecbef8e207bdb15 100755
--- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py
+++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py
@@ -899,41 +899,7 @@ if (InDetFlags.doVertexFinding() or InDetFlags.doVertexFindingForMonitoring()) o
   #
   # -----------------------------------------
 
-  if (not (InDetFlags.primaryVertexSetup() == 'IterativeFinding') and
-      not (InDetFlags.primaryVertexSetup() == 'AdaptiveMultiFinding') and
-      not (InDetFlags.primaryVertexSetup() == 'DefaultVKalVrtFinding') and
-      not (InDetFlags.primaryVertexSetup() == 'MedImgMultiFinding' ) and
-      not (InDetFlags.primaryVertexSetup() == 'GaussIterativeFinding' ) and
-      not (InDetFlags.primaryVertexSetup() == 'GaussAdaptiveMultiFinding' ) ):
-    #
-    # --- load primary vertex finder tool
-    #
-    do_multi_vtx = InDetPrimaryVertexingCuts.enableMultipleVertices()
-    from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetPriVxFinderTool
-    InDetPriVxFinderTool = InDet__InDetPriVxFinderTool(name              = "InDetPriVxFinderTool",
-                                                       PriVxSeedFinder   = getInDetMultiSeedFinder() if do_multi_vtx else None,
-                                                       TrackSelector     = InDetTrackSelectorTool,
-                                                       VertexFitterTool  = InDetVxFitterTool,
-                                                       maxChi2PerTrack   = InDetPrimaryVertexingCuts.MaxChi2PerTrack(),
-                                                       chi2CutMethod     = InDetPrimaryVertexingCuts.chi2CutMethod(),
-                                                       enableMultipleVertices = do_multi_vtx,
-                                                       useBeamConstraint = InDetFlags.useBeamConstraint())
-
-  elif (InDetFlags.primaryVertexSetup() == 'MedImgMultiFinding') :
-    #
-    # --- load Medical Imaging seeded multi vertex finder
-    #
-    from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetMultiPriVxFinderTool
-    InDetPriVxFinderTool = InDet__InDetMultiPriVxFinderTool( name                        = "InDetMedImgMultiPriVxFinderTool",
-                                                            VertexFitterTool             = InDetVxFitterTool,
-                                                            TrackSelector                = InDetTrackSelectorTool,
-                                                            SeedFinder                   = InDetVtxSeedFinder,
-                                                            ImpactPoint3dEstimator       = InDetImpactPoint3dEstimator,
-                                                            useBeamConstraint            = InDetFlags.useBeamConstraint(),
-                                                            significanceCutSeeding       = 12,
-                                                            maxVertices                  = 200)
-
-  elif ( (InDetFlags.primaryVertexSetup() == 'IterativeFinding') or
+  if ( (InDetFlags.primaryVertexSetup() == 'IterativeFinding') or
          (InDetFlags.primaryVertexSetup() == 'GaussIterativeFinding' ) ):
     #
     # --- load adaptive primary vertex finder
@@ -965,20 +931,9 @@ if (InDetFlags.doVertexFinding() or InDetFlags.doVertexFindingForMonitoring()) o
                                                                     TrackSelector     = InDetTrackSelectorTool,
                                                                     useBeamConstraint = InDetFlags.useBeamConstraint(),
                                                                     selectiontype     = 0,
-								    TracksMaxZinterval = 3,#mm 
+                                                                    TracksMaxZinterval = 3,#mm 
                                                                     do3dSplitting     = InDetFlags.doPrimaryVertex3DFinding())
 
-  elif InDetFlags.primaryVertexSetup() == 'DefaultVKalVrtFinding':
-    #
-    # --- load vkal vertex finder tool
-    #
-    from InDetVKalPriVxFinderTool.InDetVKalPriVxFinderTool import InDet__InDetVKalPriVxFinderTool
-    InDetPriVxFinderTool = InDet__InDetVKalPriVxFinderTool(name                   = "InDetVKalPriVxFinder",
-                                                           TrackSummaryTool       = InDetTrackSummaryTool,
-                                                           FitterTool             = InDetVxFitterTool,
-                                                           BeamConstraint         = 0)
-    if InDetFlags.useBeamConstraint():
-      InDetPriVxFinderTool.BeamConstraint = 1
 
   ToolSvc += InDetPriVxFinderTool
   if (InDetFlags.doPrintConfigurables()):
diff --git a/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt
index e0e58635a7ff62e60aabf8d93d396441b025d0a9..4fdadae06b4abf9f7cebfc1e78a95e25d702c45e 100644
--- a/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt
@@ -5,17 +5,6 @@
 # Declare the package name:
 atlas_subdir( BCM_G4_SD )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          GaudiKernel
-                          InnerDetector/InDetSimEvent
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/MCTruth
-                          AtlasTest/TestTools
-                           )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt
index 974288bee1f7737981036646c7922bfd1b567248..d1a06d3dce1c3b9a37c3e1de8633fe378e2909f6 100644
--- a/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( BLM_G4_SD )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/StoreGate
-                          GaudiKernel
-                          InnerDetector/InDetSimEvent
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/MCTruth
-                          AtlasTest/TestTools
-                           )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
@@ -34,8 +24,6 @@ atlas_add_component( BLM_G4_SD
                      INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                      LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth BLM_G4_SDLib )
 
-
-
 atlas_add_test( BLM_G4_SDToolConfig_test
                 SCRIPT test/BLM_G4_SDToolConfig_test.py
                 PROPERTIES TIMEOUT 300 )
@@ -47,8 +35,6 @@ atlas_add_test( BLMSensorSD_gtest
                 LINK_LIBRARIES TestTools BLM_G4_SDLib ${GTEST_LIBRARIES} ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth
               )
 
-
-
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
 atlas_install_joboptions( share/optionForTest.txt )
diff --git a/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt b/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt
index 9852c3b21a78d2957a759ba481166d8b77af8a8c..78b27e8cf51b797462134be935fc5982212660c5 100644
--- a/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( PixelG4_SD )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/StoreGate
-                          GaudiKernel
-                          InnerDetector/InDetSimEvent
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/MCTruth
-                          AtlasTest/TestTools
-                           )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
@@ -28,7 +18,6 @@ atlas_add_library( PixelG4_SDLib
                    INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth )
 
-
 atlas_add_component( PixelG4_SD
                      src/components/*.cxx
                      INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
diff --git a/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt
index 082c907a02f1a684de68aa912c38fa295ddd9c71..4ebd128dd22e4e65d401f6433e9cf75d8704ad57 100644
--- a/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( SCT_G4_SD )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/StoreGate
-                          GaudiKernel
-                          InnerDetector/InDetSimEvent
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/MCTruth
-                          AtlasTest/TestTools
-                           )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt b/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt
index 912ea2f30323815b792f912e452e556e15ad7620..0dac0e4616010a328cf7f5827c16f2bccf338191 100644
--- a/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt
+++ b/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt
@@ -5,12 +5,6 @@
 # Declare the package name:
 atlas_subdir( TRT_G4Utilities )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          PRIVATE
-                          Tools/PathResolver )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
@@ -35,4 +29,3 @@ atlas_add_test( ut_TRT_G4UtilitiesTest
    PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS}
    LINK_LIBRARIES ${Boost_LIBRARIES} TRT_G4Utilities )
 
-
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt
index 1f8999c3f0a037b26e184cce2fb781b68db0044d..4e70daec0f73f43435efb86e91eb3b259604fe44 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt
@@ -5,18 +5,6 @@
 # Declare the package name:
 atlas_subdir( TRT_G4_SD )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          GaudiKernel
-                          InnerDetector/InDetG4/TRT_G4Utilities
-                          InnerDetector/InDetSimEvent
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/MCTruth
-                          AtlasTest/TestTools
-                           )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
@@ -35,7 +23,6 @@ atlas_add_component( TRT_G4_SD
                      INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                      LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel StoreGateLib SGtests GaudiKernel TRT_G4Utilities InDetSimEvent G4AtlasToolsLib MCTruth TRT_G4_SDLib )
 
-
 atlas_add_test( TRT_G4_SDToolConfig_test
                 SCRIPT test/TRT_G4_SDToolConfig_test.py
                 PROPERTIES TIMEOUT 300 )
@@ -47,7 +34,6 @@ atlas_add_test( TRTSensitiveDetector_gtest
                 LINK_LIBRARIES TestTools TRT_G4_SDLib ${GTEST_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel CxxUtils StoreGateLib SGtests GaudiKernel TRT_G4Utilities InDetSimEvent G4AtlasToolsLib MCTruth
               )
 
-
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
 atlas_install_joboptions( share/optionForTest.txt )
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..824ee39b82f5e6c25abe9589e279b44246d4b8f9
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetMonitoring/InDetAlignmentMonitoring
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h
index fd9910e6a3daf83a816c2fcfbfdaa26d091f143d..01e2dd54d11476cafd7b618f6a4541e0b2ddc3ee 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef IDAlignMonPVBiases_H
@@ -156,9 +156,9 @@ private:
   //TTree* m_Tree;
   //std::string m_TreeName;
 
-  mutable unsigned int            m_runNumber;
-  mutable unsigned int            m_evtNumber;
-  mutable unsigned int            m_lumi_block;
+  unsigned int            m_runNumber;
+  unsigned int            m_evtNumber;
+  unsigned int            m_lumi_block;
 
   double m_charge;
   double m_pt;
diff --git a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..ec7b5ca089d51de240445e899774768f66b3bcfe
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetMonitoring/InDetDiMuonMonitoring
diff --git a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/CMakeLists.txt
index d68394414689d5bcc182eaa86ccaa2d397bd28a9..7766fc20014b05bcf0deb19269740c46737a4c34 100644
--- a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/CMakeLists.txt
+++ b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/CMakeLists.txt
@@ -12,6 +12,7 @@ atlas_depends_on_subdirs( PUBLIC
                           Event/xAOD/xAODTracking
                           GaudiKernel
                           PRIVATE
+                          Control/CxxUtils
                           Control/StoreGate )
 
 # External dependencies:
@@ -23,7 +24,7 @@ atlas_add_component( InDetDiMuonMonitoring
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GEOMODELCORE_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaMonitoringLib xAODMuon xAODTracking GaudiKernel StoreGateLib SGtests )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaMonitoringLib xAODMuon xAODTracking GaudiKernel CxxUtils StoreGateLib SGtests )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
diff --git a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx
index ba1da34f5f486168c1bbe32f24b2ea8e79bb011b..588a84b2b44f21be9b28eed0f132376e8bf24b51 100644
--- a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx
+++ b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx
@@ -7,6 +7,8 @@
 
 #include "DiMuMon.h"
 
+#include "CxxUtils/checker_macros.h"
+
 #include <math.h>
 
 #include "TF1.h"
@@ -241,7 +243,8 @@ StatusCode DiMuMon::bookHistograms()
 }
 
 
-StatusCode DiMuMon::fillHistograms()
+StatusCode DiMuMon::fillHistograms ATLAS_NOT_THREAD_SAFE ()
+// const_cast is used.
 {
 
   const double muonMass = 105.66*Gaudi::Units::MeV;
@@ -449,7 +452,8 @@ StatusCode DiMuMon::fillHistograms()
 }
 
 
-StatusCode DiMuMon::procHistograms()
+StatusCode DiMuMon::procHistograms ATLAS_NOT_THREAD_SAFE ()
+// Thread unsafe DiMuMon::iterativeGausFit is used.
 {
 
 
@@ -481,7 +485,8 @@ StatusCode DiMuMon::procHistograms()
 }
 
 
-void DiMuMon::iterativeGausFit (TH2F* hin, std::vector<TH1F*> hout, int mode){
+void DiMuMon::iterativeGausFit ATLAS_NOT_THREAD_SAFE (TH2F* hin, std::vector<TH1F*> hout, int mode){
+  // Global gStyle is used.
   // a canvas may be needed when implmenting this into the post-processing file
   TString hname =  hin->GetName();
   TString psName = hname + m_triggerChainName + ".ps";
diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..f100eb8b183bbd2859b8c91d5b94cdb6054ecc25
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetMonitoring/InDetGlobalMonitoring
diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBCMTool.cxx b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBCMTool.cxx
index 3fbd71a2b278ec1730e8b1e5d23a9b81afcb9711..2d2661de03016d833937e1b1dccafaf8c6900e3c 100755
--- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBCMTool.cxx
+++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBCMTool.cxx
@@ -1,4 +1,3 @@
-
 /*
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
@@ -46,14 +45,13 @@ using namespace TMath;
 #define BCM_LVL1A 18
 
 //Some variables
-static unsigned int bcid_start 				= 0; //to choose the first bcid displayed
-static unsigned int bcids_displayed 			= 3570; //to choose the number of bcids displayed when bcid as x-axis
-static unsigned int bcid_max 				= 0;
-static signed int ecr_start                             = 0;    //to chose the first ECR displayed
-static unsigned int ecrs_displayed                      = 256;  //to chose the number of ecrs displayed when ECR as X-axis
+static const unsigned int bcid_start 				= 0; //to choose the first bcid displayed
+static const unsigned int bcids_displayed 			= 3570; //to choose the number of bcids displayed when bcid as x-axis
+static const signed int ecr_start                             = 0;    //to chose the first ECR displayed
+static const unsigned int ecrs_displayed                      = 256;  //to chose the number of ecrs displayed when ECR as X-axis
 static const unsigned int bc_readout			= 31;   // length of read out per L1A, at the moment 31 BCs re read out
-static unsigned int lb_start 				= 0;
-static unsigned int lb_max				= 5000;
+static const unsigned int lb_start 				= 0;
+static const unsigned int lb_max				= 5000;
 
 // the declare property can be used to make variables accessible through python
 InDetGlobalBCMTool::InDetGlobalBCMTool(
@@ -592,7 +590,7 @@ bool deltat_data::operator<(const deltat_data &data){
 }
 
 bool bcid_select(const deltat_data &data){
-  return (data.bcid <bcid_max);
+  return (data.bcid <data.bcid_max);
 }
 
 StatusCode InDetGlobalBCMTool::fillHistograms(){
@@ -1069,7 +1067,10 @@ StatusCode InDetGlobalBCMTool::fillHistograms(){
 	    }
 	  }//end of bcid if
 	}//end of c loop
-	bcid_max=(positions_A[gain].front()).bcid;
+    // Need to set bcid_max before using bcid_select method
+    for (deltat_data& data : positions_C[gain]) {
+      data.bcid_max = (positions_A[gain].front()).bcid;
+    }
 	positions_C[gain].remove_if(bcid_select);
 	positions_A[gain].pop_front();
       }//end of a loop
diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBCMTool.h b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBCMTool.h
index 639076d4089e8eca3bebad159a35058252c1da4f..d580920fa540c627a44515cce57e2aa9fe6ab741 100755
--- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBCMTool.h
+++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBCMTool.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
 */
 
 /** @file InDetGlobalBCMTool.h
@@ -141,10 +141,11 @@ private:
     class deltat_data{
     public: 
       unsigned int bcid;
+      unsigned int bcid_max;
       unsigned int ecr;
       unsigned int position;
       unsigned int detector;
-	unsigned int lvl1a;
+      unsigned int lvl1a;
       deltat_data();
       bool operator<(const deltat_data &data);
       // deltat_data min(const deltat_data &data);
diff --git a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/python/TRTMonitoringRun3ESD_Alg.py b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/python/TRTMonitoringRun3ESD_Alg.py
index 0409ab0321b3bfd0f42b10d0548e440d945584d1..c8782e93c6d42e220638ee563123d2660f188958 100644
--- a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/python/TRTMonitoringRun3ESD_Alg.py
+++ b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/python/TRTMonitoringRun3ESD_Alg.py
@@ -1,5 +1,5 @@
 #
-#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 #
 
 '''@file TRTMonitoringRun3ESD_Alg.py
@@ -31,6 +31,8 @@ def TRTMonitoringRun3ESD_AlgConfig(inputFlags):
     result.merge(AtlasGeometryCfg(inputFlags))
 
     from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline
+    result.merge(addFoldersSplitOnline(inputFlags, "TRT","/TRT/Onl/Calib/errors2d","/TRT/Calib/errors2d",className="TRTCond::RtRelationMultChanContainer"))
+    result.merge(addFoldersSplitOnline(inputFlags, "TRT","/TRT/Onl/Calib/slopes","/TRT/Calib/slopes",className="TRTCond::RtRelationMultChanContainer"))
     result.merge(addFoldersSplitOnline(inputFlags, "TRT","/TRT/Onl/Calib/RT","/TRT/Calib/RT",className="TRTCond::RtRelationMultChanContainer"))
     result.merge(addFoldersSplitOnline(inputFlags, "TRT","/TRT/Onl/Calib/T0","/TRT/Calib/T0",className="TRTCond::StrawT0MultChanContainer"))
 
diff --git a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3RAW_Alg.cxx b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3RAW_Alg.cxx
index c9f04e4dcb349175b3f68bfde68d686a82d3ef6c..6638d12341b2a47cb06d1a52a0b293008f57f7c9 100644
--- a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3RAW_Alg.cxx
+++ b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3RAW_Alg.cxx
@@ -1199,7 +1199,7 @@ StatusCode TRTMonitoringRun3RAW_Alg::fillTRTEfficiency(const TrackCollection& co
 			continue;
 		}
 
-		const std::unique_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*track)));
+		const std::unique_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->summary(*(*track)));
 		int n_trt_hits = summary->get(Trk::numberOfTRTHits);
 		int n_sct_hits = summary->get(Trk::numberOfSCTHits);
 		int n_pixel_hits = summary->get(Trk::numberOfPixelHits);
@@ -1525,7 +1525,7 @@ StatusCode TRTMonitoringRun3RAW_Alg::fillTRTHits(const TrackCollection& trackCol
 	}
 
 	for (; p_trk != trackCollection.end(); ++p_trk) {
-		const std::unique_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*p_trk)));
+		const std::unique_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->summary(*(*p_trk)));
 		int nTRTHits = summary->get(Trk::numberOfTRTHits);
 
 		if (nTRTHits < m_minTRThits) continue;
diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetMonitoring/TRT_Monitoring/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..6027d28d582c47ddc8f221a22137231328466f82
--- /dev/null
+++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetMonitoring/TRT_Monitoring
diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx
index 44ba700e1ff1a452ae5466c16112952e38eabd4c..72f743fe56e23a3c2f2493921886642fc4f4ee0a 100644
--- a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx
+++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx
@@ -3810,7 +3810,6 @@ StatusCode TRT_Monitoring_Tool::fillTRTEfficiency(const TrackCollection& combTra
 }
 
 
-int maxtimestamp = 0.;
 //----------------------------------------------------------------------------------//
 StatusCode TRT_Monitoring_Tool::fillTRTHighThreshold(const TrackCollection& trackCollection,
                                                      const xAOD::EventInfo& eventInfo) {
@@ -3825,15 +3824,15 @@ StatusCode TRT_Monitoring_Tool::fillTRTHighThreshold(const TrackCollection& trac
 	lumiBlockNumber = eventInfo.lumiBlock();
 	timeStamp = eventInfo.timeStamp();
 
-	if (timeStamp > maxtimestamp) {
-		maxtimestamp = timeStamp;
+	if (timeStamp > m_maxtimestamp) {
+		m_maxtimestamp = timeStamp;
 	}
 
 	int runNumber;
 	runNumber = eventInfo.runNumber();
 	// get Online Luminosity
 	double intLum = (this->lbDuration() * this->lbAverageLuminosity());
-	double timeStampAverage = (maxtimestamp - 0.5 * this->lbDuration());
+	double timeStampAverage = (m_maxtimestamp - 0.5 * this->lbDuration());
 	m_IntLum->SetBinContent(1, intLum);
 	m_LBvsLum->SetBinContent(lumiBlockNumber, intLum);
 	m_LBvsTime->SetBinContent(lumiBlockNumber, timeStampAverage);
diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.h b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.h
index 9a6fe96f17536a3814f0a5916e2ddc8f2525110b..9eaad99c7676fd6993d75d17b18af23e80b46f63 100644
--- a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.h
+++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.h
@@ -1,6 +1,6 @@
 // -*- c++ -*-
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRT_MONITORING_TOOL_H
@@ -25,6 +25,7 @@
 #include "TRT_DriftFunctionTool/ITRT_DriftFunctionTool.h"
 
 // STDLIB
+#include <atomic>
 #include <string>
 #include <vector>
 #include <set>
@@ -610,7 +611,7 @@ private:
 	int m_every_xth_track;
 	std::string m_datatype;
 
-
+	mutable std::atomic<int> m_maxtimestamp{0};
 
 	TProfile_LW* m_hefficiency_eta;
 	TProfile_LW* m_hefficiency_phi;
diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt b/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt
index aab831a248a079e66846610dbe75e84862844c5a..e91dcc7e2dd4924be19a6eb615bf9df7ee11766c 100644
--- a/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt
+++ b/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt
@@ -12,6 +12,7 @@ atlas_depends_on_subdirs( PUBLIC
                           GaudiKernel
                           InnerDetector/InDetRawEvent/InDetRawData
                           PRIVATE
+                          Control/CxxUtils
                           Control/StoreGate
                           DetectorDescription/IdDictParser
                           Generators/GeneratorObjects
@@ -35,12 +36,12 @@ set( _jobOPath "${_jobOPath}:$ENV{JOBOPTSEARCHPATH}" )
 atlas_add_test( PixelOverlay_test
                 SOURCES test/PixelOverlay_test.cxx src/PixelOverlay.cxx
                 INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
-                LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData StoreGateLib SGtests GeneratorObjects InDetIdentifier InDetSimData TrkTrack ${GTEST_LIBRARIES} )
+                LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData CxxUtils StoreGateLib SGtests GeneratorObjects InDetIdentifier InDetSimData TrkTrack ${GTEST_LIBRARIES} )
 
 atlas_add_test( SCTOverlay_test
                 SOURCES test/SCTOverlay_test.cxx src/SCTOverlay.cxx
                 INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
-                LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData StoreGateLib SGtests GeneratorObjects InDetIdentifier InDetSimData TrkTrack IdDictParser ${GTEST_LIBRARIES}
+                LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData CxxUtils StoreGateLib SGtests GeneratorObjects InDetIdentifier InDetSimData TrkTrack IdDictParser ${GTEST_LIBRARIES}
                 ENVIRONMENT "JOBOPTSEARCHPATH=${_jobOPath}" )
 
 
@@ -72,4 +73,4 @@ atlas_add_test( TRTOverlayConfig_test
 atlas_add_test( BCMOverlay_test
                 SOURCES test/BCMOverlay_test.cxx src/BCMOverlay.cxx
                 INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
-                LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel StoreGateLib SGtests GeneratorObjects InDetBCM_RawData InDetSimData ${GTEST_LIBRARIES} )
+                LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel CxxUtils StoreGateLib SGtests GeneratorObjects InDetBCM_RawData InDetSimData ${GTEST_LIBRARIES} )
diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/InDetOverlay/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRawAlgs/InDetOverlay/InDetOverlay/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..2c00276d2a753e730f56c7ab5a0cfd5e96f86672
--- /dev/null
+++ b/InnerDetector/InDetRawAlgs/InDetOverlay/InDetOverlay/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetRawAlgs/InDetOverlay
diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/test/BCMOverlay_test.cxx b/InnerDetector/InDetRawAlgs/InDetOverlay/test/BCMOverlay_test.cxx
index 2d3cee07df4fcb6129ac377b6a56690a0bc0644a..478ee4370358f38568f1e61c200318cead6637ae 100644
--- a/InnerDetector/InDetRawAlgs/InDetOverlay/test/BCMOverlay_test.cxx
+++ b/InnerDetector/InDetRawAlgs/InDetOverlay/test/BCMOverlay_test.cxx
@@ -20,6 +20,10 @@
 // Tested AthAlgorithm
 #include "../InDetOverlay/BCMOverlay.h"
 
+#include "CxxUtils/checker_macros.h"
+ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
+// Use of global g_svcLoc is not thread safe.
+
 namespace OverlayTesting {
 
   // needed every time an AthAlgorithm, AthAlgTool or AthService is instantiated
diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/test/PixelOverlay_test.cxx b/InnerDetector/InDetRawAlgs/InDetOverlay/test/PixelOverlay_test.cxx
index 9a772da8b9c2f11effbf97fa8002220464779e72..f9c383f3725f4e491bcbfcbbe3e47557b2fe6bb9 100644
--- a/InnerDetector/InDetRawAlgs/InDetOverlay/test/PixelOverlay_test.cxx
+++ b/InnerDetector/InDetRawAlgs/InDetOverlay/test/PixelOverlay_test.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -18,6 +18,10 @@
 // Tested AthAlgorithm
 #include "../InDetOverlay/PixelOverlay.h"
 
+#include "CxxUtils/checker_macros.h"
+ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
+// Use of global g_svcLoc is not thread safe.
+
 namespace OverlayTesting {
 
   // needed every time an AthAlgorithm, AthAlgTool or AthService is instantiated
diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/test/SCTOverlay_test.cxx b/InnerDetector/InDetRawAlgs/InDetOverlay/test/SCTOverlay_test.cxx
index e1d6cae11a885e6e170e0aeb2c83cf89c101e040..801b4e92146e18d2d2d3e26d4cadddfc914d1167 100644
--- a/InnerDetector/InDetRawAlgs/InDetOverlay/test/SCTOverlay_test.cxx
+++ b/InnerDetector/InDetRawAlgs/InDetOverlay/test/SCTOverlay_test.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -23,6 +23,10 @@
 #include "IdDictParser/IdDictParser.h"
 #include "GaudiKernel/MsgStream.h"
 
+#include "CxxUtils/checker_macros.h"
+ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
+// Use of global g_svcLoc is not thread safe.
+
 namespace OverlayTesting {
 
   // needed every time an AthAlgorithm, AthAlgTool or AthService is instantiated
diff --git a/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/CMakeLists.txt b/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/CMakeLists.txt
index 51a7228809b56d3da6c015826f918b52c8174330..19e5971aee6ee058803fc7f3e37079f0b6235020 100644
--- a/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/CMakeLists.txt
+++ b/InnerDetector/InDetRecAlgs/InDetLowBetaFinder/CMakeLists.txt
@@ -33,7 +33,7 @@ atlas_add_component( InDetLowBetaFinder
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel TRT_ConditionsServicesLib StoreGateLib SGtests TRT_ConditionsData InDetIdentifier InDetLowBetaInfo InDetRIO_OnTrack TrkParameters xAODTracking TrkRIO_OnTrack TrkTrack MagFieldElements MagFieldConditions )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel TRT_ConditionsServicesLib StoreGateLib SGtests TRT_ConditionsData InDetIdentifier InDetLowBetaInfo InDetRIO_OnTrack TrkParameters xAODTracking TrkRIO_OnTrack TrkTrack MagFieldElements MagFieldConditions TRT_ElectronPidToolsLib )
 
 # Install files from the package:
 atlas_install_headers( InDetLowBetaFinder )
diff --git a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/SCT_Clusterization.h b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/SCT_Clusterization.h
index e4b91ed309ef496be385488b4aeb3d23dff175ed..6f7ae71459124e78355fbfaa1367584af725b45f 100644
--- a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/SCT_Clusterization.h
+++ b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/SCT_Clusterization.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -21,8 +21,8 @@
 #include "InDetRawData/SCT_RDO_Container.h"
 #include "SCT_ConditionsData/SCT_FlaggedCondData.h"
 
-/// Tool/service handle template parameters
-#include "IRegionSelector/IRegSelSvc.h"
+/// Tool handle template parameters
+#include "IRegionSelector/IRegSelTool.h"
 #include "InDetConditionsSummaryService/IInDetConditionsTool.h"
 #include "SiClusterizationTool/ISCT_ClusteringTool.h"
 
@@ -80,7 +80,7 @@ private:
    * @name Service and Tool Handles and ID helper
    */
   //@{
-  ServiceHandle<IRegSelSvc> m_regionSelector; //!< region selector service for HLT
+  ToolHandle<IRegSelTool> m_regionSelector{this, "RegSelTool", "RegSelTool/RegSel_SCT", "region selector tool for HLT"};
   ToolHandle<ISCT_ClusteringTool> m_clusteringTool{this, "clusteringTool", "InDet::SCT_ClusteringTool"};
   ToolHandle<IInDetConditionsTool> m_pSummaryTool{this, "conditionsTool", "SCT_ConditionsSummaryTool/InDetSCT_ConditionsSummaryTool", "Tool to retrieve SCT conditions summary"};
   const SCT_ID* m_idHelper{nullptr};
diff --git a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/SCT_Clusterization.cxx b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/SCT_Clusterization.cxx
index 0392d0aa6d5161b0fba8f77f16f7e6ce85abf6cd..1e1875b42b344217738808e8b02dff9419393893 100644
--- a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/SCT_Clusterization.cxx
+++ b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/SCT_Clusterization.cxx
@@ -24,8 +24,7 @@ namespace InDet {
 
   // Constructor with parameters:
   SCT_Clusterization::SCT_Clusterization(const std::string& name, ISvcLocator* pSvcLocator) :
-    AthReentrantAlgorithm(name, pSvcLocator),
-    m_regionSelector{"RegSelSvc", name}
+    AthReentrantAlgorithm(name, pSvcLocator)
   {
     // Get parameter values from jobOptions file
     declareProperty("ClusterContainerCacheKey", m_clusterContainerCacheKey="");
@@ -61,6 +60,8 @@ namespace InDet {
     if (m_roiSeeded.value()) {
       ATH_CHECK(m_roiCollectionKey.initialize());
       ATH_CHECK(m_regionSelector.retrieve());
+    } else {
+      m_regionSelector.disable();
     }
 
     return StatusCode::SUCCESS;
@@ -161,7 +162,7 @@ namespace InDet {
         std::vector<IdentifierHash> listOfSCTIds;
         for (; roi!=roiE; ++roi) {
 	  listOfSCTIds.clear(); //Prevents needless memory reallocations
-          m_regionSelector->DetHashIDList(SCT, **roi, listOfSCTIds);
+          m_regionSelector->HashIDList(**roi, listOfSCTIds);
           ATH_MSG_VERBOSE(**roi);     
           ATH_MSG_VERBOSE( "REGTEST: SCT : Roi contains " << listOfSCTIds.size() << " det. Elements" );
           for (size_t i{0}; i < listOfSCTIds.size(); i++) {
diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/CMakeLists.txt b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/CMakeLists.txt
index 070893327d2c28f9af601d215e862d5b8013e966..49f9e1098d9c125e637dfc357c8ee2ae1e3a9f99 100644
--- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/CMakeLists.txt
+++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/CMakeLists.txt
@@ -37,5 +37,5 @@ atlas_add_library( SiSPSeededTrackFinderData
                    src/*.cxx
                    PUBLIC_HEADERS SiSPSeededTrackFinderData
                    PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                   LINK_LIBRARIES InDetPrepRawData InDetReadoutGeometry TrkEventPrimitives TrkExInterfaces TrkGeometry TrkPatternParameters TrkTrack TrkToolInterfaces TrkEventUtils MagFieldElements MagFieldConditions
+                   LINK_LIBRARIES InDetPrepRawData InDetReadoutGeometry TrkEventPrimitives TrkExInterfaces TrkGeometry TrkPatternParameters TrkTrack TrkToolInterfaces TrkEventUtils MagFieldElements MagFieldConditions InDetConditionsSummaryService
                    PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} GaudiKernel InDetRIO_OnTrack SiSpacePointsSeed TrkSurfaces TrkMaterialOnTrack TrkPrepRawData TrkRIO_OnTrack TrkSpacePoint)
diff --git a/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/CMakeLists.txt
index 14e6533ee5e2cdb2d743ac33d645461ec0014442..0d8f2528c5206099a35fce1cbdb1b1b6328996a1 100644
--- a/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/CMakeLists.txt
+++ b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/CMakeLists.txt
@@ -9,6 +9,7 @@ atlas_subdir( InDetAmbiTrackSelectionTool )
 atlas_depends_on_subdirs(
    PUBLIC
    Control/AthenaBaseComps
+   Control/AthenaKernel
    GaudiKernel
    Tracking/TrkEvent/TrkRIO_OnTrack
    Tracking/TrkEvent/TrkTrack
@@ -16,6 +17,7 @@ atlas_depends_on_subdirs(
    Tracking/TrkValidation/TrkValInterfaces
    PRIVATE
    Control/AthContainers
+   Control/CxxUtils
    Control/StoreGate
    InnerDetector/InDetDetDescr/InDetIdentifier
    InnerDetector/InDetDetDescr/PixelGeoModel
@@ -38,8 +40,8 @@ find_package( ROOT COMPONENTS Core MathCore )
 atlas_add_component( InDetAmbiTrackSelectionTool
    InDetAmbiTrackSelectionTool/*.h src/*.cxx src/components/*.cxx
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-   LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel TrkRIO_OnTrack
-   TrkTrack TrkToolInterfaces TrkValInterfaces AthContainers StoreGateLib
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel GaudiKernel TrkRIO_OnTrack
+   TrkTrack TrkToolInterfaces TrkValInterfaces AthContainers CxxUtils StoreGateLib
    InDetIdentifier InDetPrepRawData InDetRecToolInterfaces TrkDetElementBase
    TrkSurfaces TrkCaloClusterROI TrkMeasurementBase TrkPrepRawData
    TrkPseudoMeasurementOnTrack TrkTrackSummary TrkParameters PixelGeoModelLib TrkFitterInterfaces)
diff --git a/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..e6c8a8c348b73a2bb09501c784c0fc887d6bdb16
--- /dev/null
+++ b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool
diff --git a/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/InDetDenseEnvAmbiTrackSelectionTool.h b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/InDetDenseEnvAmbiTrackSelectionTool.h
index b74cb5411adf2c4e027b0f545cb5cdf326e69052..4a8ce5c7fefc99016021699a390b7af2ec269cc4 100755
--- a/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/InDetDenseEnvAmbiTrackSelectionTool.h
+++ b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/InDetAmbiTrackSelectionTool/InDetDenseEnvAmbiTrackSelectionTool.h
@@ -1,7 +1,7 @@
 // -*- C++ -*-
 
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -13,8 +13,8 @@
 
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "TrkToolInterfaces/IAmbiTrackSelectionTool.h"
-#include "GaudiKernel/IIncidentSvc.h"
 
+#include "AthenaKernel/SlotSpecificObj.h"
 #include "InDetRecToolInterfaces/ITrtDriftCircleCutTool.h"
 #include "PixelGeoModel/IBLParameterSvc.h"
 #include "StoreGate/ReadHandleKey.h"
@@ -33,6 +33,7 @@
 #include <cmath> //for std::fabs in implementation of structs in this header
 #include <iostream> //for cout in dumpInfo 
 #include <map>
+#include <mutex>
 #include <vector>
 
 class Identifier;
@@ -55,7 +56,7 @@ namespace InDet
       this tool, the tracks have to be deleted by this client.
       
   */  
-  class InDetDenseEnvAmbiTrackSelectionTool : public extends<AthAlgTool, Trk::IAmbiTrackSelectionTool, IIncidentListener>
+  class InDetDenseEnvAmbiTrackSelectionTool : public extends<AthAlgTool, Trk::IAmbiTrackSelectionTool>
   {
   public:
     InDetDenseEnvAmbiTrackSelectionTool(const std::string&,const std::string&,const IInterface*);
@@ -67,8 +68,6 @@ namespace InDet
     virtual StatusCode initialize() override;
     /** standard Athena-Algorithm method */
     virtual StatusCode finalize() override;
-    /** handle for incident service */
-    virtual void handle(const Incident& inc) override;
 
     virtual std::tuple<Trk::Track*,bool> getCleanedOutTrack(const Trk::Track*,
                                                             const Trk::TrackScore score,
@@ -248,7 +247,25 @@ namespace InDet
       };
     };   
      
-     
+    mutable std::mutex m_mutex;
+    struct CacheEntry {
+      EventContext::ContextEvt_t m_evt{EventContext::INVALID_CONTEXT_EVT};
+
+      int m_maxShared;    // Max shared hits -- calulated from  m_maxSharedModules
+      int m_minNotShared; // Min number of hits that are not shared -- can change if we are in ROI
+      int m_minSiHits;    // Min number of hits before we allow split sharing of hits -- can change if we are in ROI
+
+      std::vector<double> m_hadF;
+      std::vector<double> m_hadE;
+      std::vector<double> m_hadR;
+      std::vector<double> m_hadZ;
+
+      std::vector<double> m_emF;
+      std::vector<double> m_emE;
+      std::vector<double> m_emR;
+      std::vector<double> m_emZ;
+    };
+    mutable SG::SlotSpecificObj<CacheEntry> m_cache ATLAS_THREAD_SAFE; // Guarded by m_mutex
       
     /** method to create a new track from a vector of TSOS's */
     Trk::Track* createSubTrack( const std::vector<const Trk::TrackStateOnSurface*>& tsos, const Trk::Track* track ) const ;
@@ -265,19 +282,20 @@ namespace InDet
                                Trk::PRDtoTrackMap &prd_to_track_map,
                                TrackHitDetails& trackHitDetails,
                                TSoS_Details& tsosDetails,
-                               int nCutTRT )const;
+                               int nCutTRT,
+                               CacheEntry* ent) const;
 
     /** Update the pixel clusters split information*/
     void updatePixelClusterInformation(TSoS_Details& tsosDetails) const;
       
     /** Check if the cluster is compatible with a hadronic cluster*/
-    bool isHadCaloCompatible(const Trk::TrackParameters& Tp) const;      
+    bool isHadCaloCompatible(const Trk::TrackParameters& Tp, CacheEntry* ent) const;
 
     /** Check if the cluster is compatible with a EM cluster*/
-    bool isEmCaloCompatible(const Trk::TrackParameters& Tp) const;      
+    bool isEmCaloCompatible(const Trk::TrackParameters& Tp, CacheEntry* ent) const;
       
     /** Fill hadronic & EM cluster map*/
-    void newEvent() const;
+    void newEvent(CacheEntry* ent) const;
       
     /** Returns the number of track that use that hit already
         Need to let it know if that cluster is splittable
@@ -290,7 +308,8 @@ namespace InDet
                                  int& maxiShared,
                                  int& maxothernpixel,
                                  bool& maxotherhasblayer,
-                                 bool& failMinHits) const;
+                                 bool& failMinHits,
+                                 CacheEntry* ent) const;
 
 
     /** Returns the Trackparameters of the two tracks on the n'th TrackStateOnSurface of the first track*/
@@ -308,8 +327,6 @@ namespace InDet
     /** TRT minimum number of drift circles tool- returns allowed minimum number of TRT drift circles */
     PublicToolHandle<ITrtDriftCircleCutTool>  m_selectortool{this, "DriftCircleCutTool", "InDet::InDetTrtDriftCircleCutTool"};
     ServiceHandle<IBLParameterSvc> m_IBLParameterSvc{this, "IBLParameterSvc", "IBLParameterSvc"};
-    /** IncidentSvc to catch begining of event and end of event */   
-    ServiceHandle<IIncidentSvc> m_incidentSvc{this, "IncidentService", "IncidentSvc"};
       
     /**atlas id helper*/
     const SiliconID* m_detID{nullptr};
@@ -320,11 +337,9 @@ namespace InDet
     /** some cut values */
     IntegerProperty m_minHits{this, "minHits", 5, "Min Number of hits on track"};
     IntegerProperty m_minTRT_Hits{this, "minTRTHits", 0, "Min Number of TRT hits on track"};
-    mutable int m_maxShared;        // Max shared hits -- calulated from  m_maxSharedModules
     IntegerProperty m_maxSharedModules{this, "maxShared", 1, "Max number of shared modules"};
     IntegerProperty m_maxSharedModulesInROI{this, "maxSharedModulesInROI", 2, "Max number of shared modules in ROI. Test value for recovering B jet efficiency at high pt"};
     IntegerProperty m_maxTracksPerPRD{this, "maxTracksPerSharedPRD", 2, "Max number of tracks per hit if it is nor split"};
-    mutable int m_minNotShared;     // Min number of hits that are not shared -- can change if we are in ROI
     IntegerProperty m_minNotSharedModules{this, "minNotShared", 6, "Min number of non shared modules"};
     IntegerProperty m_minNotSharedModulesInROI{this, "minNotSharedInROI", 4, "Min number of non shared modules  in ROI. Test value for recovering B jet efficiency at high pt"};
     FloatProperty m_minScoreShareTracks{this, "minScoreShareTracks", 0.0, "Min track score to alow it to share hits"};
@@ -337,7 +352,6 @@ namespace InDet
       
     FloatProperty m_minTrackChi2ForSharedHits{this, "minTrackChi2ForSharedHits", 3, "Min track chi2 to split share hits"};
     IntegerProperty m_minUniqueSCTHits{this, "minUniqueSCTHits", 2, "Min number of hits in the SCT that we need before we allow hit sharing in the SCT"};
-    mutable int m_minSiHits;                 // Min number of hits before we allow split sharing of hits -- can change if we are in ROI
     IntegerProperty m_minSiHitsToAllowSplitting{this, "minSiHitsToAllowSplitting", 9, "Min number of hits before we allow split sharing of hits"};
     IntegerProperty m_minSiHitsToAllowSplittingInROI{this, "minSiHitsToAllowSplittingInROI", 7, "Min number of hits before we allow split sharing of hits In ROI. Test value for recovering B jet efficiency"}; 
     IntegerProperty m_maxPixMultiCluster{this, "maxPixMultiCluster", 4, "Max number of tracks that can be associated to a split cluster"};
@@ -350,23 +364,12 @@ namespace InDet
     FloatProperty m_etaWidth{this, "etaWidth", 0.2};
     SG::ReadHandleKey<CaloClusterROI_Collection> m_inputHadClusterContainerName{this, "InputHadClusterContainerName", "InDetHadCaloClusterROIs"};
       
-    mutable std::vector<double>   m_hadF;
-    mutable std::vector<double>   m_hadE;
-    mutable std::vector<double>   m_hadR;
-    mutable std::vector<double>   m_hadZ;
-
     BooleanProperty m_useEmClusSeed{this, "doEmCaloSeed", false};
     FloatProperty m_minPtEm{this, "minPtConv", 10000., "in MeV"};
     FloatProperty m_phiWidthEm{this, "phiWidthEM", 0.05};
     FloatProperty m_etaWidthEm{this, "etaWidthEM", 0.05};
 
     SG::ReadHandleKey<CaloClusterROI_Collection> m_inputEmClusterContainerName{this, "InputEmClusterContainerName", "InDetCaloClusterROIs"};
-    mutable std::vector<double>   m_emF;
-    mutable std::vector<double>   m_emE;
-    mutable std::vector<double>   m_emR;
-    mutable std::vector<double>   m_emZ;
-
-    mutable bool m_mapFilled{false};
 
     //Track Pair Selection
     BooleanProperty m_doPairSelection{this, "doPairSelection", true};
@@ -379,7 +382,6 @@ namespace InDet
     BooleanProperty m_monitorTracks{this, "MonitorAmbiguitySolving", false, "to track observeration/monitoring (default is false)"};
     BooleanProperty m_doSCTSplitting{this, "doSCTSplitting", false}; //WPM
 
-      
   }; 
 } // end of namespace
 
diff --git a/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/src/InDetDenseEnvAmbiTrackSelectionTool.cxx b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/src/InDetDenseEnvAmbiTrackSelectionTool.cxx
index ca4c988c4689e5818af7bf30760721bc92d3d05a..d479f16b0257ef7906bbb5f294f1dcadd9634362 100755
--- a/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/src/InDetDenseEnvAmbiTrackSelectionTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetAmbiTrackSelectionTool/src/InDetDenseEnvAmbiTrackSelectionTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -10,6 +10,7 @@
 #include "InDetAmbiTrackSelectionTool/InDetDenseEnvAmbiTrackSelectionTool.h"
 
 #include "AthContainers/DataVector.h"
+#include "CxxUtils/checker_macros.h"
 #include "InDetIdentifier/SiliconID.h"
 #include "InDetPrepRawData/PixelCluster.h"
 #include "InDetPrepRawData/SCT_Cluster.h"
@@ -35,10 +36,6 @@ InDet::InDetDenseEnvAmbiTrackSelectionTool::InDetDenseEnvAmbiTrackSelectionTool(
 :
 base_class(t,n,p)
 {
-  // compute the number of shared hits from the number of max shared modules
-  m_maxShared = 2*m_maxSharedModules+1;
-  m_minNotShared = m_minNotSharedModules;
-  m_minSiHits = m_minSiHitsToAllowSplitting;
 }
 
 //================ Initialisation =================================================
@@ -64,11 +61,6 @@ StatusCode InDet::InDetDenseEnvAmbiTrackSelectionTool::initialize()
  
   ATH_CHECK(m_assoTool.retrieve());
 
-  ATH_CHECK(m_incidentSvc.retrieve());
-  
-  // register to the incident service
-  m_incidentSvc->addListener( this, "BeginEvent");
-
   ATH_CHECK(m_inputHadClusterContainerName.initialize(m_useHClusSeed));
   ATH_CHECK(m_inputEmClusterContainerName.initialize(m_useEmClusSeed));
 
@@ -85,69 +77,72 @@ StatusCode InDet::InDetDenseEnvAmbiTrackSelectionTool::finalize()
 }
 
 
-void InDet::InDetDenseEnvAmbiTrackSelectionTool::handle(const Incident& inc) 
-{ 
-  // the cluster ambiguity map
-  if ( inc.type() == IncidentType::BeginEvent ){
-    m_mapFilled =false;
-  }  
-}
-
-
 // @TODO move cluster "map" creation to separate algorithm
-void InDet::InDetDenseEnvAmbiTrackSelectionTool::newEvent() const
+void InDet::InDetDenseEnvAmbiTrackSelectionTool::newEvent(CacheEntry* ent) const
 {
   // Reload ROI's
   if (m_useHClusSeed) {
-    m_hadF.clear();
-    m_hadE.clear();
-    m_hadR.clear();
-    m_hadZ.clear();
+    ent->m_hadF.clear();
+    ent->m_hadE.clear();
+    ent->m_hadR.clear();
+    ent->m_hadZ.clear();
 
     SG::ReadHandle<CaloClusterROI_Collection> calo(m_inputHadClusterContainerName);
     for ( const auto& ccROI : *calo) {
-      m_hadF.push_back( ccROI->globalPosition().phi() );
-      m_hadE.push_back( ccROI->globalPosition().eta() );
-      m_hadR.push_back( ccROI->globalPosition().perp() );
-      m_hadZ.push_back( ccROI->globalPosition().z() );
+      ent->m_hadF.push_back( ccROI->globalPosition().phi() );
+      ent->m_hadE.push_back( ccROI->globalPosition().eta() );
+      ent->m_hadR.push_back( ccROI->globalPosition().perp() );
+      ent->m_hadZ.push_back( ccROI->globalPosition().z() );
     }
   }
 
   // Reload ROI's
   if (m_useEmClusSeed) {
-    m_emF.clear();
-    m_emE.clear();
-    m_emR.clear();
-    m_emZ.clear();
+    ent->m_emF.clear();
+    ent->m_emE.clear();
+    ent->m_emR.clear();
+    ent->m_emZ.clear();
 
     SG::ReadHandle<CaloClusterROI_Collection> calo(m_inputEmClusterContainerName);
     for ( const Trk::CaloClusterROI* ccROI : *calo) {
       if ( ccROI->energy() * sin(ccROI->globalPosition().theta()) < m_minPtEm){
         continue;
       }
-      m_emF.push_back( ccROI->globalPosition().phi() );
-      m_emE.push_back( ccROI->globalPosition().eta() );
-      m_emR.push_back( ccROI->globalPosition().perp() );
-      m_emZ.push_back( ccROI->globalPosition().z() );
+      ent->m_emF.push_back( ccROI->globalPosition().phi() );
+      ent->m_emE.push_back( ccROI->globalPosition().eta() );
+      ent->m_emR.push_back( ccROI->globalPosition().perp() );
+      ent->m_emZ.push_back( ccROI->globalPosition().z() );
     }
   }
-  m_mapFilled = true;
 }
 
 //============================================================================================
-std::tuple<Trk::Track*,bool> InDet::InDetDenseEnvAmbiTrackSelectionTool::getCleanedOutTrack(const Trk::Track* ptrTrack,
+std::tuple<Trk::Track*,bool> InDet::InDetDenseEnvAmbiTrackSelectionTool::getCleanedOutTrack ATLAS_NOT_THREAD_SAFE (const Trk::Track* ptrTrack,
                                                                                             const Trk::TrackScore score,
                                                                                             Trk::PRDtoTrackMap &prd_to_track_map) const
+// This method uses thread unsafe updatePixelClusterInformation method and is not thread safe.
 {
-  //Fill ROI's  
-  if (!m_mapFilled) newEvent();
+  const EventContext& ctx{Gaudi::Hive::currentContext()};
+  std::lock_guard<std::mutex> lock{m_mutex};
+  CacheEntry* ent{m_cache.get(ctx)};
+  if (ent->m_evt!=ctx.evt()) { // New event in this slot
+    // compute the number of shared hits from the number of max shared modules
+    ent->m_maxShared = 2*m_maxSharedModules+1;
+    ent->m_minNotShared = m_minNotSharedModules;
+    ent->m_minSiHits = m_minSiHitsToAllowSplitting;
+
+    //Fill ROI's
+    newEvent(ent);
+
+    ent->m_evt = ctx.evt();
+  }
   
   ATH_MSG_DEBUG ("getcleanedouttrack just got called "); //WPM
 
   // compute the number of shared hits from the number of max shared modules
-  m_maxShared=2*m_maxSharedModules+1;
-  m_minNotShared = m_minNotSharedModules;
-  m_minSiHits = m_minSiHitsToAllowSplitting;
+  ent->m_maxShared = 2*m_maxSharedModules+1;
+  ent->m_minNotShared = m_minNotSharedModules;
+  ent->m_minSiHits = m_minSiHitsToAllowSplitting;
 
   // cut on TRT hits, might use eta dependent cuts here
   int  nCutTRT = m_minTRT_Hits;
@@ -174,7 +169,7 @@ std::tuple<Trk::Track*,bool> InDet::InDetDenseEnvAmbiTrackSelectionTool::getClea
   
   //Decide which hits to keep
   ATH_MSG_DEBUG ("DecideWhichHitsToKeep");
-  bool TrkCouldBeAccepted = decideWhichHitsToKeep( ptrTrack,  score,  prd_to_track_map, trackHitDetails, tsosDetails, nCutTRT );
+  bool TrkCouldBeAccepted = decideWhichHitsToKeep( ptrTrack,  score,  prd_to_track_map, trackHitDetails, tsosDetails, nCutTRT, ent );
   
   ATH_MSG_DEBUG ("DecidedWhichHitsToKeep " << TrkCouldBeAccepted );
     
@@ -233,8 +228,8 @@ std::tuple<Trk::Track*,bool> InDet::InDetDenseEnvAmbiTrackSelectionTool::getClea
        ( !trackHitDetails.hassharedblayer || trackHitDetails.numPixelHoles<=1 )    && // if blayer, at most 1 pixel hole
        !trackHitDetails.hassharedpixel                                           && // no shared pixel hits
        ( ( totalSiHits >= m_minHits      && trackHitDetails.numShared == 0 )       || // no shared and enough hits OR
-         ( totalSiHits >= m_minNotShared && trackHitDetails.numWeightedShared < m_maxShared && // shared hits and enough unique hits and shared hits with good quality
-           ( totalSiHits + std::min(trackHitDetails.numShared,m_maxShared) ) >= m_minHits && score > m_minScoreShareTracks ) ) ) {
+         ( totalSiHits >= ent->m_minNotShared && trackHitDetails.numWeightedShared < ent->m_maxShared && // shared hits and enough unique hits and shared hits with good quality
+           ( totalSiHits + std::min(trackHitDetails.numShared, ent->m_maxShared) ) >= m_minHits && score > m_minScoreShareTracks ) ) ) {
     ATH_MSG_DEBUG ("=> Suggest to keep track with "<<trackHitDetails.numShared<<" shared hits !");
 
 
@@ -249,14 +244,14 @@ std::tuple<Trk::Track*,bool> InDet::InDetDenseEnvAmbiTrackSelectionTool::getClea
     /*
       } else if ( trackHitDetails.numTRT_Unused >= nCutTRT           && // TRT track or no TRT at all (back tracking)
       ( totalSiHits >= m_minHits                           || // we have enough hits OR
-      ( totalSiHits >= m_minNotShared                      && // shared hits and enough unique hits and shared hits with good quality
-      totalSiHits+std::min(trackHitDetails.numShared,m_maxShared) >= m_minHits && score > m_minScoreShareTracks ) ) ) {
+      ( totalSiHits >= ent->m_minNotShared                      && // shared hits and enough unique hits and shared hits with good quality
+      totalSiHits+std::min(trackHitDetails.numShared, ent->m_maxShared) >= m_minHits && score > m_minScoreShareTracks ) ) ) {
     */
   }  else if ( trackHitDetails.numTRT_Unused >= nCutTRT           && // TRT track or no TRT at all (back tracking)
                (
                 ( totalSiHits >= m_minHits                           || // we have enough hits OR
-                  ( totalSiHits >= m_minNotShared                      && // shared hits and enough unique hits and shared hits with good quality
-                    totalSiHits+std::min(trackHitDetails.numShared,m_maxShared) >= m_minHits && score > m_minScoreShareTracks ) ) //That is the traditional statement
+                  ( totalSiHits >= ent->m_minNotShared                      && // shared hits and enough unique hits and shared hits with good quality
+                    totalSiHits+std::min(trackHitDetails.numShared, ent->m_maxShared) >= m_minHits && score > m_minScoreShareTracks ) ) //That is the traditional statement
                 ||  //here comes WPM's addendum, which should allow tracks with many merged sct hits to pass:
                 ( m_doSCTSplitting && totalSiHits+merged_sct >= m_minHits && score > m_minScoreShareTracks )
                 )
@@ -292,7 +287,7 @@ std::tuple<Trk::Track*,bool> InDet::InDetDenseEnvAmbiTrackSelectionTool::getClea
       } else if (tsosDetails.type[index] != SharedHit ) {
         ATH_MSG_VERBOSE ("-> Copy good TSOS");
         newTSOS.push_back(*iTsos);
-      } else if (cntIns + 1 >= m_maxShared) {
+      } else if (cntIns + 1 >= ent->m_maxShared) {
         ATH_MSG_VERBOSE ("-> Too many share hits, dropping outer hit(s)");  
       } else {
         ATH_MSG_VERBOSE ("-> Try to recover a shared hit");
@@ -315,7 +310,7 @@ std::tuple<Trk::Track*,bool> InDet::InDetDenseEnvAmbiTrackSelectionTool::getClea
         
         bool isSplitable = tsosDetails.splitProb1[index] >= m_sharedProbCut || tsosDetails.splitProb2[index] >= m_sharedProbCut2;
         
-        int  numberOfTracksWithThisPrd = checkOtherTracksValidity( rot, isSplitable, prd_to_track_map, maxiShared, maxothernpixel, maxotherhasblayer, otherfailsMinUniqueHits);
+        int  numberOfTracksWithThisPrd = checkOtherTracksValidity( rot, isSplitable, prd_to_track_map, maxiShared, maxothernpixel, maxotherhasblayer, otherfailsMinUniqueHits, ent);
 
 
         // now decide what to do, can we keep the shared hit
@@ -324,7 +319,7 @@ std::tuple<Trk::Track*,bool> InDet::InDetDenseEnvAmbiTrackSelectionTool::getClea
           score > m_minScoreShareTracks                            && // score cut
           (!isPixel || !trackHitDetails.hassharedblayer || trackHitDetails.numPixelHoles <= 0)         && // shared b-layer only if no pixel holes
           !otherfailsMinUniqueHits                                 && //It will not invalidate another track
-          ( maxiShared < m_maxShared || (isPixel && !trackHitDetails.firstisshared) ) && // do not allow other accepted track to exceed the shared limit, if first pixel hit is shared
+          ( maxiShared < ent->m_maxShared || (isPixel && !trackHitDetails.firstisshared) ) && // do not allow other accepted track to exceed the shared limit, if first pixel hit is shared
           (!isPixel || trackHitDetails.thishasblayer == maxotherhasblayer )           && // only allow shared pixel if both have blayer or both not
           (!isPixel || trackHitDetails.numPixelHits >= maxothernpixel )                    ) { // only allow shared pixel if new track as at least as many pixel hits  
         */
@@ -332,7 +327,7 @@ std::tuple<Trk::Track*,bool> InDet::InDetDenseEnvAmbiTrackSelectionTool::getClea
                 score > m_minScoreShareTracks                            && // score cut
                 (!isPixel || !trackHitDetails.hassharedblayer || trackHitDetails.numPixelHoles <= 0)         && // shared b-layer only if no pixel holes
                 !otherfailsMinUniqueHits                                 && //It will not invalidate another track
-                ( maxiShared < m_maxShared || (isPixel && !trackHitDetails.firstisshared) ) && // do not allow other accepted track to exceed the shared limit, if first pixel hit is shared
+                ( maxiShared < ent->m_maxShared || (isPixel && !trackHitDetails.firstisshared) ) && // do not allow other accepted track to exceed the shared limit, if first pixel hit is shared
                 (!isPixel || trackHitDetails.thishasblayer == maxotherhasblayer )           && // only allow shared pixel if both have blayer or both not
                 (!isPixel || trackHitDetails.numPixelHits >= maxothernpixel )  )  ||  ( m_doSCTSplitting && m_detID->is_sct(rot->identify()) && isSplitable )                  ) { //WPM only allow shared pixel if new track as at least as many pixel hits 
 
@@ -406,7 +401,8 @@ int  InDet::InDetDenseEnvAmbiTrackSelectionTool::checkOtherTracksValidity(const
                                                                           int& maxiShared, 
                                                                           int& maxothernpixel, 
                                                                           bool& maxotherhasblayer, 
-                                                                          bool& failMinHits) const
+                                                                          bool& failMinHits,
+                                                                          CacheEntry* ent) const
 {
 
   // find out how many tracks use this hit already
@@ -478,7 +474,7 @@ int  InDet::InDetDenseEnvAmbiTrackSelectionTool::checkOtherTracksValidity(const
     
       ATH_MSG_VERBOSE( "Track " <<  track->second << " will has " << iNotShared << " unique hits and  " <<  iSctUnique << " unique SCT hits.");
       // You are sharing too many hits reject the new track
-      if ( iNotShared  < m_minNotShared ) otherwillFailMinHits = true;
+      if ( iNotShared  < ent->m_minNotShared ) otherwillFailMinHits = true;
       // You are sharing too many shared SCT hits and you don't have enough to share -reject hit.
       if ( iSCT <= m_minUniqueSCTHits && iSCT > iSctUnique   ) otherwillFailSCTuniqueHits = true;    
     }
@@ -724,7 +720,8 @@ bool InDet::InDetDenseEnvAmbiTrackSelectionTool::decideWhichHitsToKeep(const Trk
                                                                        Trk::PRDtoTrackMap &prd_to_track_map,
                                                                        TrackHitDetails& trackHitDetails,
                                                                        TSoS_Details& tsosDetails,
-                                                                       int nCutTRT )const
+                                                                       int nCutTRT,
+                                                                       CacheEntry* ent)const
 {
 
   // Can the track can automatically be accpeted without further checks
@@ -749,13 +746,13 @@ bool InDet::InDetDenseEnvAmbiTrackSelectionTool::decideWhichHitsToKeep(const Trk
     }
 
     if (inROI){ 
-      inROI  = m_useHClusSeed && isHadCaloCompatible(*ptrTrack->trackParameters()->front());
+      inROI  = m_useHClusSeed && isHadCaloCompatible(*ptrTrack->trackParameters()->front(), ent);
     
       // If we are in a ROI change the shared hit cut;
       if (inROI){
-        m_maxShared=2*m_maxSharedModulesInROI+1;
-        m_minNotShared = m_minNotSharedModulesInROI;
-        m_minSiHits = m_minSiHitsToAllowSplittingInROI;
+        ent->m_maxShared = 2*m_maxSharedModulesInROI+1;
+        ent->m_minNotShared = m_minNotSharedModulesInROI;
+        ent->m_minSiHits = m_minSiHitsToAllowSplittingInROI;
       }
     }
   } 
@@ -1060,7 +1057,7 @@ bool InDet::InDetDenseEnvAmbiTrackSelectionTool::decideWhichHitsToKeep(const Trk
         // Check if both tracks are above threshold       
         bool passPt = tpPair.first->pT() > m_minPairTrackPt && tpPair.second->pT() > m_minPairTrackPt;
         //Check if it is in a ROI
-        trackHitDetails.inROI  = m_useEmClusSeed && isEmCaloCompatible( *tpPair.first );
+        trackHitDetails.inROI  = m_useEmClusSeed && isEmCaloCompatible( *tpPair.first, ent );
         //If it is then See if it passes the pair selection
         if ( passPt && (!m_useEmClusSeed || trackHitDetails.inROI) ){
           passPairSelection = isNearbyTrackCandidate(tpPair.first, tpPair.second );    
@@ -1201,9 +1198,9 @@ bool InDet::InDetDenseEnvAmbiTrackSelectionTool::decideWhichHitsToKeep(const Trk
         bool maxotherhasblayer = false;
         bool otherfailsMinUniqueHits = false;
         bool isSplitable = tsosDetails.splitProb1[index] >= m_sharedProbCut || tsosDetails.splitProb2[index] >= m_sharedProbCut2;
-        int numberOfTracksWithThisPrd = checkOtherTracksValidity( tsosDetails.RIO[index], isSplitable, prd_to_track_map, maxiShared, maxothernpixel, maxotherhasblayer, otherfailsMinUniqueHits);
+        int numberOfTracksWithThisPrd = checkOtherTracksValidity( tsosDetails.RIO[index], isSplitable, prd_to_track_map, maxiShared, maxothernpixel, maxotherhasblayer, otherfailsMinUniqueHits, ent);
  
-        if (numberOfTracksWithThisPrd > 0 && ( otherfailsMinUniqueHits || maxiShared >= m_maxShared )){
+        if (numberOfTracksWithThisPrd > 0 && ( otherfailsMinUniqueHits || maxiShared >= ent->m_maxShared )){
           TrkCouldBeAccepted = false;
           ATH_MSG_DEBUG ("reject track; Tracks shared hits will mess up an accepted track");
           tsosDetails.type[index] = RejectedHit;
@@ -1259,7 +1256,8 @@ Trk::Track* InDet::InDetDenseEnvAmbiTrackSelectionTool::createSubTrack( const st
 
 
 //==========================================================================================
-void InDet::InDetDenseEnvAmbiTrackSelectionTool::updatePixelClusterInformation(TSoS_Details& tsosDetails) const
+void InDet::InDetDenseEnvAmbiTrackSelectionTool::updatePixelClusterInformation ATLAS_NOT_THREAD_SAFE (TSoS_Details& tsosDetails) const
+// This method uses const_cast and is not thread safe.
 {
 
   for (unsigned int index(0);  index  < tsosDetails.nTSoS; ++index ){
@@ -1284,16 +1282,17 @@ void InDet::InDetDenseEnvAmbiTrackSelectionTool::updatePixelClusterInformation(T
 
 
 //==========================================================================================
-bool InDet::InDetDenseEnvAmbiTrackSelectionTool::isHadCaloCompatible(const Trk::TrackParameters& Tp) const
+bool InDet::InDetDenseEnvAmbiTrackSelectionTool::isHadCaloCompatible(const Trk::TrackParameters& Tp, CacheEntry* ent) const
 {
   constexpr double pi = M_PI;
   constexpr double pi2 = 2.*M_PI;
-  if (m_hadF.empty()) return false;
 
-  auto f = m_hadF.begin(), fe = m_hadF.end();
-  auto e = m_hadE.begin();
-  auto r = m_hadR.begin();
-  auto z = m_hadZ.begin();
+  if (ent->m_hadF.empty()) return false;
+
+  auto f = ent->m_hadF.begin(), fe = ent->m_hadF.end();
+  auto e = ent->m_hadE.begin();
+  auto r = ent->m_hadR.begin();
+  auto z = ent->m_hadZ.begin();
 
   double F = Tp.momentum().phi();
   double E = Tp.eta();
@@ -1319,17 +1318,18 @@ bool InDet::InDetDenseEnvAmbiTrackSelectionTool::isHadCaloCompatible(const Trk::
 
 
 //==========================================================================================
-bool InDet::InDetDenseEnvAmbiTrackSelectionTool::isEmCaloCompatible(const Trk::TrackParameters& Tp) const
+bool InDet::InDetDenseEnvAmbiTrackSelectionTool::isEmCaloCompatible(const Trk::TrackParameters& Tp, CacheEntry* ent) const
 {
 
   constexpr double pi = M_PI;
   constexpr double pi2 = 2.*M_PI;
-  if (m_emF.empty()) return false;
 
-  auto f = m_emF.begin(), fe = m_emF.end();
-  auto e = m_emE.begin();
-  auto r = m_emR.begin();
-  auto z = m_emZ.begin();
+  if (ent->m_emF.empty()) return false;
+
+  auto f = ent->m_emF.begin(), fe = ent->m_emF.end();
+  auto e = ent->m_emE.begin();
+  auto r = ent->m_emR.begin();
+  auto z = ent->m_emZ.begin();
 
   double F = Tp.momentum().phi();
   double E = Tp.momentum().eta();
diff --git a/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..e1452d570bcaa85ce5511e8173ebbbd16729809d
--- /dev/null
+++ b/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetRecTools/InDetAssociationTools
diff --git a/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/InDetPRD_Provider.h b/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/InDetPRD_Provider.h
index 2bc51be29a4924b2be9f2c0ec230d256605acaa4..736cb72bc16891a85902dfd3da0f9229df4e82c9 100644
--- a/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/InDetPRD_Provider.h
+++ b/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/InDetPRD_Provider.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -90,19 +90,19 @@ namespace InDet {
                                                     
         const PixelID*                              m_pixIdHelper;
         std::string                                 m_pixClusterContainerName;          
-        mutable const PixelClusterContainer*        m_pixClusterContainer;              
+        const PixelClusterContainer*                m_pixClusterContainer;
         // For P->T converter of Pixel Clusters
         SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_pixelDetEleCollKey{this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"};
         
         const SCT_ID*                               m_sctIdHelper;                      
         std::string                                 m_sctClusterContainerName;          
-        mutable const SCT_ClusterContainer*         m_sctClusterContainer;              
+        const SCT_ClusterContainer*                 m_sctClusterContainer;
         // For P->T converter of SCT_Clusters
         SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCTDetEleCollKey{this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"};
         
         const TRT_ID*                               m_trtIdHelper;                      
         std::string                                 m_trtDriftCircleContainerName;      
-        mutable const TRT_DriftCircleContainer*     m_trtDriftCircleContainer;          
+        const TRT_DriftCircleContainer*             m_trtDriftCircleContainer;
 
   };
 
diff --git a/InnerDetector/InDetRecTools/InDetEtaDependentCuts/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/CMakeLists.txt
index dc60da07323b97681a23c1fe29b8b6628a105a2b..a4391bfad7f2db59cab14f05a0761a49a1be0b0f 100644
--- a/InnerDetector/InDetRecTools/InDetEtaDependentCuts/CMakeLists.txt
+++ b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/CMakeLists.txt
@@ -12,12 +12,14 @@ atlas_depends_on_subdirs(  )
 atlas_depends_on_subdirs( PUBLIC
                           Control/AthenaBaseComps
                           Control/AthenaKernel
+                          Control/CxxUtils
                           GaudiKernel )
 
 # External dependencies:
 find_package( CLHEP )
 find_package( Eigen )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
+find_package( Boost COMPONENTS unit_test_framework )
 
 # tag rootMathLibs was not recognized in automatic conversion in cmt2cmake
 
@@ -30,3 +32,11 @@ atlas_add_component( InDetEtaDependentCuts
 
 # Install files from the package:
 atlas_install_headers( InDetEtaDependentCuts )
+atlas_install_joboptions( share/*.txt )
+
+atlas_add_test( InDetEtaDependentCutsSvc_test                
+   SOURCES test/InDetEtaDependentCutsSvc_test.cxx 
+   INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
+   LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaKernel AthenaBaseComps GaudiKernel TestTools CxxUtils InDetRecToolInterfaces
+   POST_EXEC_SCRIPT "nopost.sh" )
+
diff --git a/InnerDetector/InDetRecTools/InDetEtaDependentCuts/InDetEtaDependentCuts/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/InDetEtaDependentCuts/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..9fa5c9efbe646d5c5d2394e42f230d17e7ea286e
--- /dev/null
+++ b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/InDetEtaDependentCuts/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetRecTools/InDetEtaDependentCuts
diff --git a/InnerDetector/InDetRecTools/InDetEtaDependentCuts/InDetEtaDependentCuts/InDetEtaDependentCutsSvc.h b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/InDetEtaDependentCuts/InDetEtaDependentCutsSvc.h
index dd628f66ab0a1baf0c6720b78cc75e2b14ef341c..b9105c840ebd4b5466cebdc0196c6fbbd373a711 100644
--- a/InnerDetector/InDetRecTools/InDetEtaDependentCuts/InDetEtaDependentCuts/InDetEtaDependentCutsSvc.h
+++ b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/InDetEtaDependentCuts/InDetEtaDependentCutsSvc.h
@@ -30,15 +30,15 @@ namespace InDet {
       InDetEtaDependentCutsSvc(const std::string& name, ISvcLocator* sl); 
       
       /// Destructor: 
-      virtual ~InDetEtaDependentCutsSvc(); 
+      virtual ~InDetEtaDependentCutsSvc() override final; 
       
-      virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF); 
+      virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF) final; 
       
-      StatusCode  initialize();
-      StatusCode  finalize();
+      StatusCode  initialize() override final;
+      StatusCode  finalize() override final;
       
-      void getValue(const InDet::CutName cutName, std::vector < double >& cut);
-      void getValue(const InDet::CutName cutName,    std::vector < int >& cut);
+      void getValue(const InDet::CutName cutName, std::vector < double >& cut) override final;
+      void getValue(const InDet::CutName cutName,    std::vector < int >& cut) override final;
       
       template <class T>
       T getValueAtEta(const std::vector< T > cuts, const double eta) const;
@@ -46,18 +46,18 @@ namespace InDet {
       template <class T>    
       void getValue(const InDet::CutName cutName, T& cut, const double eta);
       
-      double  getMaxEta() const;
-      double  getMinPtAtEta           (const double eta) const;
-      double  getMaxZImpactAtEta      (const double eta) const;
-      double  getMaxPrimaryImpactAtEta(const double eta) const;
-      int     getMinSiHitsAtEta       (const double eta) const;
-      int     getMinSiNotSharedAtEta  (const double eta) const;
-      int     getMaxSharedAtEta       (const double eta) const;
-      int     getMinPixelHitsAtEta    (const double eta) const;
-      int     getMaxSiHolesAtEta      (const double eta) const;
-      int     getMaxPixelHolesAtEta   (const double eta) const;
-      int     getMaxSctHolesAtEta     (const double eta) const;
-      int     getMaxDoubleHolesAtEta  (const double eta) const;
+      double  getMaxEta() const override final;
+      double  getMinPtAtEta           (const double eta) const override final;
+      double  getMaxZImpactAtEta      (const double eta) const override final;
+      double  getMaxPrimaryImpactAtEta(const double eta) const override final;
+      int     getMinSiHitsAtEta       (const double eta) const override final;
+      int     getMinSiNotSharedAtEta  (const double eta) const override final;
+      int     getMaxSharedAtEta       (const double eta) const override final;
+      int     getMinPixelHitsAtEta    (const double eta) const override final;
+      int     getMaxSiHolesAtEta      (const double eta) const override final;
+      int     getMaxPixelHolesAtEta   (const double eta) const override final;
+      int     getMaxSctHolesAtEta     (const double eta) const override final;
+      int     getMaxDoubleHolesAtEta  (const double eta) const override final;
       
       
     /////////////////////////////////////////////////////////////////// 
diff --git a/InnerDetector/InDetRecTools/InDetEtaDependentCuts/share/InDetEtaDependentCutsTestJobOpts.txt b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/share/InDetEtaDependentCutsTestJobOpts.txt
new file mode 100644
index 0000000000000000000000000000000000000000..a6c30adcc5e2d503810789f76e83f0b9728d1dce
--- /dev/null
+++ b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/share/InDetEtaDependentCutsTestJobOpts.txt
@@ -0,0 +1,3 @@
+ApplicationMgr.OutputLevel = 5;
+ApplicationMgr.CreateSvc += { "InDet::InDetEtaDependentCutsSvc" };
+MessageSvc.OutputLevel = 5;
diff --git a/InnerDetector/InDetRecTools/InDetEtaDependentCuts/src/InDetEtaDependentCutsSvc.cxx b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/src/InDetEtaDependentCutsSvc.cxx
index 941bc8d3fcd51ea4428767fd9d1380b4e3b319c7..69fddc30421d0b8e729e9709f757706207a5afdb 100644
--- a/InnerDetector/InDetRecTools/InDetEtaDependentCuts/src/InDetEtaDependentCutsSvc.cxx
+++ b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/src/InDetEtaDependentCutsSvc.cxx
@@ -47,13 +47,13 @@ namespace InDet {
       ATH_MSG_INFO ("Initializing " << name() << "...");
       
       if ((m_etaBins.size()-1) <= 0) {
-        ATH_MSG_ERROR( "Wrong inizialisation of eta bins. Check the eta bin values in " << name() );
+        ATH_MSG_ERROR( "Wrong initialisation of eta bins. Check the eta bin values in " << name() );
         return StatusCode::FAILURE;
       }
       
       // expecting eta bins in ascending order
       if (not std::is_sorted(m_etaBins.value().begin(), m_etaBins.value().end())) {
-        ATH_MSG_ERROR( "Wrong inizialisation of eta bins in " << name() << ". Values are not sorted!" );
+        ATH_MSG_ERROR( "Wrong initialisation of eta bins in " << name() << ". Values are not sorted!" );
         return StatusCode::FAILURE;
       }          
       
@@ -140,14 +140,14 @@ namespace InDet {
     }
 
     int InDetEtaDependentCutsSvc::getIndexByEta(const double eta) const {
-      double absEta = std::abs(eta);
+      const double absEta = std::abs(eta);
       if (absEta > m_etaBins.value().back()) {
         ATH_MSG_ERROR("Requesting cut value for eta outside expected range!! ");
         return -1;
       }
       
-      auto pVal =  std::lower_bound(m_etaBins.value().begin(), m_etaBins.value().end(), absEta);
-      int bin = std::distance(m_etaBins.value().begin(), pVal) - 1;
+      const auto pVal =  std::lower_bound(m_etaBins.value().begin(), m_etaBins.value().end(), absEta);
+      const int bin = std::distance(m_etaBins.value().begin(), pVal) - 1;
       ATH_MSG_DEBUG("Checking (abs(eta)/bin) = (" << absEta << "," << bin << ")");
       return bin;
     }
diff --git a/InnerDetector/InDetRecTools/InDetEtaDependentCuts/test/IDEDCSvc_GaudiFixtureBase.h b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/test/IDEDCSvc_GaudiFixtureBase.h
new file mode 100644
index 0000000000000000000000000000000000000000..230e1299f4f63aa466341ea0178d762e4afbbe1e
--- /dev/null
+++ b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/test/IDEDCSvc_GaudiFixtureBase.h
@@ -0,0 +1,40 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+/*
+ */
+/**
+ * @file InDetEtaDependentCuts/test/IDEDC_GaudiFixtureBase.h
+ * @author Shaun Roe
+ * @date June 2020
+ * @brief Base class for initialising Gaudi in fixtures
+ */
+
+#ifndef InDetPhysValMonitoring_IDPVM_GaudiFixtureBase_h
+#define InDetPhysValMonitoring_IDPVM_GaudiFixtureBase_h
+
+
+#include "TestTools/initGaudi.h"
+#include "TInterpreter.h"
+#include "CxxUtils/checker_macros.h"
+#include "CxxUtils/ubsan_suppress.h"
+#include <string>
+
+ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // This is for unit tests and a static variable IDEDC_GaudiFixtureBase::gaudiIsInitialised is used.
+
+struct IDEDC_GaudiFixtureBase{
+  ISvcLocator* svcLoc{};
+  static bool gaudiIsInitialised;
+  const std::string jobOpts{};
+  IDEDC_GaudiFixtureBase(const std::string & jobOptionFile = "InDetEtaDependentCutsTestJobOpts.txt"):jobOpts(jobOptionFile){
+    CxxUtils::ubsan_suppress ([]() { TInterpreter::Instance(); } );
+    if (not gaudiIsInitialised){
+      std::string fullJobOptsName="InDetEtaDependentCuts/" + jobOpts;
+      gaudiIsInitialised=Athena_test::initGaudi(fullJobOptsName, svcLoc);
+    }
+  }
+};
+
+bool IDEDC_GaudiFixtureBase::gaudiIsInitialised=false;
+
+#endif
diff --git a/InnerDetector/InDetRecTools/InDetEtaDependentCuts/test/InDetEtaDependentCutsSvc_test.cxx b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/test/InDetEtaDependentCutsSvc_test.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..014bd39057b303cf241e45f7ad09158833f592e2
--- /dev/null
+++ b/InnerDetector/InDetRecTools/InDetEtaDependentCuts/test/InDetEtaDependentCutsSvc_test.cxx
@@ -0,0 +1,57 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+ * @file InDetEtaDependentCuts/test/InDetEtaDependentCutsSvc_test.cxx
+ * @author Shaun Roe
+ * @date June, 2020
+ * @brief Some tests for InDetEtaDependentCutsSvc 
+ */
+ 
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MAIN
+#define BOOST_TEST_MODULE TEST_ETADEPENDENTCUTSSVC
+
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#include <boost/test/unit_test.hpp>
+#pragma GCC diagnostic pop
+
+#include "IDEDCSvc_GaudiFixtureBase.h"
+#include "../InDetEtaDependentCuts/InDetEtaDependentCutsSvc.h"
+
+#include "CxxUtils/checker_macros.h"
+ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // This is unit test and a static variable is used in IDEDC_GaudiFixtureBase.
+
+static const std::string testJobOptionsFile("InDetEtaDependentCutsTestJobOpts.txt");
+
+struct GaudiKernelFixture:public IDEDC_GaudiFixtureBase{
+  GaudiKernelFixture(const std::string & joFilename):IDEDC_GaudiFixtureBase(joFilename){
+    //nop, everything in base.
+  }
+};
+
+using namespace InDet;
+
+BOOST_AUTO_TEST_SUITE(EtaDependentCutsSvcTest)
+  GaudiKernelFixture g(testJobOptionsFile);
+  const auto & svcLoc=g.svcLoc;
+   ServiceHandle<IInDetEtaDependentCutsSvc> idEDCSvc ("InDet::InDetEtaDependentCutsSvc", "test");
+ 
+   BOOST_AUTO_TEST_CASE( sanityCheck ){
+     const bool svcLocatorIsOk=(svcLoc != nullptr);
+     BOOST_TEST(svcLocatorIsOk);
+   }
+   BOOST_AUTO_TEST_CASE( retrieveSvc ){
+     BOOST_TEST (idEDCSvc.retrieve().isSuccess());
+   }
+   BOOST_AUTO_TEST_CASE( interfaceID ){
+     InterfaceID testId("IInDetEtaDependentCutsSvc",1,0);
+     BOOST_TEST(idEDCSvc->interfaceID()==testId);
+   }
+   BOOST_AUTO_TEST_CASE(publicMethods){
+     BOOST_TEST(idEDCSvc->getMaxEta() == 4.0);
+   }
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..0f7134feef47e83162d57610f792a8958ae97727
--- /dev/null
+++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder
diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/SlidingWindowMultiSeedFinder.h b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/SlidingWindowMultiSeedFinder.h
index 10b914570db634994a3e47a84c52ac5740ffdc8f..ce611cefbadfee492b9671c213a444318f3d2049 100644
--- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/SlidingWindowMultiSeedFinder.h
+++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/SlidingWindowMultiSeedFinder.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 InDetMultipleVertexSeedFinder_SlidingWindowMultiSeedFinder_H
@@ -55,7 +55,7 @@ namespace InDet
     
    float m_clusterLength;
    float m_breakingDistance;
-   mutable float m_addingDistance;
+   float m_addingDistance;
    bool   m_useMaxInCluster;
    int m_ignoreLevel;
    bool m_ignoreBeamSpot;
diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/SlidingWindowMultiSeedFinder.cxx b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/SlidingWindowMultiSeedFinder.cxx
index f4820a4edb4e29e23e1dd0e2d2e10dff7615cee8..a2e3114483555c5f2e61eef79c662f90798f33f8 100644
--- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/SlidingWindowMultiSeedFinder.cxx
+++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/SlidingWindowMultiSeedFinder.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 "InDetMultipleVertexSeedFinder/SlidingWindowMultiSeedFinder.h"
@@ -155,8 +155,8 @@ namespace InDet
 //storing the Z0 of last iteration...
    float prevTrackZ0 = 0.;
    
-  
-   if(m_useMaxInCluster) m_addingDistance = 0.;
+   float addingDistance = m_addingDistance;
+   if(m_useMaxInCluster) addingDistance = 0.;
    for(unsigned int i=0;i<indexOfSorted.size();++i)
    {
     const  Trk::TrackParameters * lexPerigee = m_extrapolator->extrapolate(*preselectedTracks[indexOfSorted[i]],
@@ -168,7 +168,7 @@ namespace InDet
      
     if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Z0 of current  track"<< currentTrackZ0<<endmsg;    
     
-    if((fabs(currentTrackZ0 - lastTrackZ0)>m_clusterLength && fabs(currentTrackZ0 - prevTrackZ0)>m_addingDistance )|| 
+    if((fabs(currentTrackZ0 - lastTrackZ0)>m_clusterLength && fabs(currentTrackZ0 - prevTrackZ0)>addingDistance )|| 
                                                               fabs(currentTrackZ0 - prevTrackZ0)>m_breakingDistance)
     {
   
@@ -191,7 +191,7 @@ namespace InDet
     if(m_useMaxInCluster)
     { 
       float diff = fabs(currentTrackZ0-prevTrackZ0);
-      if(m_addingDistance < diff) m_addingDistance = diff; 
+      if(addingDistance < diff) addingDistance = diff; 
     }//end of  using max in cluster
     prevTrackZ0 = currentTrackZ0;
    }//end of loop over the sorted container, using sorted index
@@ -267,8 +267,9 @@ namespace InDet
    
 //looping over sorted container:  storing the Z0 of last iteration...
    float prevTrackZ0 =0.;
-   
-   if(m_useMaxInCluster) m_addingDistance = 0.;
+
+   float addingDistance = m_addingDistance;
+   if(m_useMaxInCluster) addingDistance = 0.;
    
    for(unsigned int i=0;i<indexOfSorted.size();++i)
    {
@@ -281,7 +282,7 @@ namespace InDet
     if(!i)prevTrackZ0 = currentTrackZ0;    
     
     if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Z0 of current  track"<< currentTrackZ0<<endmsg;   
-    if((fabs(currentTrackZ0 - lastTrackZ0)>m_clusterLength && fabs(currentTrackZ0 - prevTrackZ0)>m_addingDistance )|| 
+    if((fabs(currentTrackZ0 - lastTrackZ0)>m_clusterLength && fabs(currentTrackZ0 - prevTrackZ0)>addingDistance )|| 
                                                               fabs(currentTrackZ0 - prevTrackZ0)>m_breakingDistance)
     {
   
@@ -307,7 +308,7 @@ namespace InDet
     if(m_useMaxInCluster)
     { 
       float diff = fabs(currentTrackZ0-prevTrackZ0);
-      if(m_addingDistance < diff) m_addingDistance = diff; 
+      if(addingDistance < diff) addingDistance = diff; 
     }//end of  using max in cluster
     prevTrackZ0 = currentTrackZ0;
    }//end of loop
@@ -397,8 +398,9 @@ std::vector< std::vector<const Trk::TrackParameters *> > SlidingWindowMultiSeedF
 	
 	//looping over sorted container:  storing the Z0 of last iteration...
 	float prevTrackZ0 =0.;
-	
-	if(m_useMaxInCluster) m_addingDistance = 0.;
+
+        float addingDistance = m_addingDistance;
+	if(m_useMaxInCluster) addingDistance = 0.;
 	
 	for(unsigned int i=0;i<indexOfSorted.size();++i)
 	  {
@@ -411,7 +413,7 @@ std::vector< std::vector<const Trk::TrackParameters *> > SlidingWindowMultiSeedF
 	    if(!i)prevTrackZ0 = currentTrackZ0;    
 	    
 	    if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Z0 of current  track"<< currentTrackZ0<<endmsg;   
-	    if((fabs(currentTrackZ0 - lastTrackZ0)>m_clusterLength && fabs(currentTrackZ0 - prevTrackZ0)>m_addingDistance )|| 
+	    if((fabs(currentTrackZ0 - lastTrackZ0)>m_clusterLength && fabs(currentTrackZ0 - prevTrackZ0)>addingDistance )|| 
 	       fabs(currentTrackZ0 - prevTrackZ0)>m_breakingDistance)
 	      {
 		
@@ -437,7 +439,7 @@ std::vector< std::vector<const Trk::TrackParameters *> > SlidingWindowMultiSeedF
 	    if(m_useMaxInCluster)
 	      { 
 		float diff = fabs(currentTrackZ0-prevTrackZ0);
-		if(m_addingDistance < diff) m_addingDistance = diff; 
+		if(addingDistance < diff) addingDistance = diff; 
 	      }//end of  using max in cluster
 	    prevTrackZ0 = currentTrackZ0;
 	  }//end of loop
diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/CMakeLists.txt
index ef916000b2a2dd731e3565e05993b087b8d0174e..2cdcfe4cd6b858bfcf44e477d8c5bbe4587aac3a 100644
--- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/CMakeLists.txt
+++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/CMakeLists.txt
@@ -46,7 +46,8 @@ atlas_add_component( InDetPriVxFinderTool
                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps xAODTracking 
                      GaudiKernel InDetRecToolInterfaces PATCoreLib TrkParameters TrkParticleBase TrkTrack CxxUtils AthContainers GeoPrimitives 
                      EventPrimitives TrkSurfaces TrkEventPrimitives TrkLinks TrkTrackSummary VxMultiVertex VxVertex 
-                     TrkVertexFitterInterfaces TrkVertexFittersLib BeamSpotConditionsData StoreGateLib)
+                     TrkVertexFitterInterfaces TrkVertexFittersLib BeamSpotConditionsData StoreGateLib
+                     InDetTrackSelectionToolLib )
 
 # Install files from the package:
 atlas_install_headers( InDetPriVxFinderTool )
diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetIterativePriVxFinderTool.h b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetIterativePriVxFinderTool.h
index 81e00e09356c72472952b3620330df4427bc1e0c..ddfe1622be3218e07dcd0dd5b5b8ab473ab64c08 100755
--- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetIterativePriVxFinderTool.h
+++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetIterativePriVxFinderTool.h
@@ -97,16 +97,19 @@ public:
    * a VxContainer.
    */
   using IVertexFinder::findVertex;
-  virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> findVertex(
-    const TrackCollection* trackTES) const override;
- 
-  virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> findVertex(
-    const xAOD::TrackParticleContainer* trackParticles) const override;
+  virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
+  findVertex(const EventContext& ctx,
+             const TrackCollection* trackTES) const override;
+
+  virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
+  findVertex(const EventContext& ctx,
+             const xAOD::TrackParticleContainer* trackParticles) const override;
 
   virtual StatusCode finalize() override;
 
 private:
   std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> findVertex(
+    const EventContext& ctx,
     const std::vector<Trk::ITrackLink*>& trackVector) const;
 
   void removeCompatibleTracks(
diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetMultiPriVxFinderTool.h b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetMultiPriVxFinderTool.h
deleted file mode 100644
index 9d9cebe23f266c0e29a356c82d89bd168883b0f5..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetMultiPriVxFinderTool.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
- *
- * @class InDet::InDetMultiPriVxFinderTool
- *
- * @author Matt Rudolph and Lars Egholm Pedersen
- *
- *
- * Use seed finder multi seeding interface method similarly to iterative vertex finder
- *
- * --------------------------------------------------------
- * Changes:
- *
- * David Shope <david.richard.shope@cern.ch> (2016-04-26)
- *
- * EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex
- *
- *   findVertex will now always return an xAOD::VertexContainer,
- *   even when using a TrackCollection .
- *   as input.
- *
- ***************************************************************************/
-
-#ifndef INDETPRIVXFINDERTOOL_INDETMULTIPRIVXFINDERTOOL_H
-#define INDETPRIVXFINDERTOOL_INDETMULTIPRIVXFINDERTOOL_H
-
-#include "InDetRecToolInterfaces/IVertexFinder.h"
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "TrkTrack/TrackCollection.h" // type def ...
-#include "TrkParameters/TrackParameters.h"
-
-/**
- * Forward declarations 
- */
-#include "BeamSpotConditionsData/BeamSpotData.h"
-#include "xAODTracking/VertexFwd.h"
-#include "xAODTracking/TrackParticleFwd.h"
-#include "xAODTracking/VertexContainerFwd.h"
-#include "xAODTracking/TrackParticleContainerFwd.h"
-
-namespace Trk
-{
- class IVertexFitter;
- class Track;
- class ITrackLink;
- class IVertexSeedFinder;
- class IImpactPoint3dEstimator;
- class IVertexCollectionSortingTool;
- class IVertexCollectionMergingTool;
-
- class IVxCandidateXAODVertex;
-}
-
-namespace InDet
-{
-  class IInDetTrackSelectionTool;
-  
- class InDetMultiPriVxFinderTool : public AthAlgTool, virtual public IVertexFinder
- {
-
-public:
-
-   /**
-    * Constructor
-    */
-   
-   InDetMultiPriVxFinderTool(const std::string& t, const std::string& n, const IInterface*  p);
-   
-   /**
-    * Destructor
-    */
-   
-   virtual ~InDetMultiPriVxFinderTool();
-    
-   virtual StatusCode initialize() override;
-
-   /** 
-    * Finding method.
-    * Has as input a track collection and as output 
-    * a VxContainer.
-    */
-   using IVertexFinder::findVertex;
-
-   virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> findVertex(
-     const TrackCollection* trackTES) const override;
-
-   
-   virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> findVertex(
-     const xAOD::TrackParticleContainer* trackParticles) const override;
-
-   virtual StatusCode finalize() override;
-   
- private:
-   std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> findVertex(
-     const std::vector<Trk::ITrackLink*>& trackVector) const;
-
-   void removeCompatibleTracks(xAOD::Vertex * myxAODVertex,
-                               std::vector<const Trk::TrackParameters*> & perigeesToFit,
-                               std::vector<Trk::ITrackLink*> & seedTracks) const;
-   
-   void removeAllFrom(std::vector<const Trk::TrackParameters*> & perigeesToFit,
-                      std::vector<Trk::ITrackLink*> & seedTracks) const;
-
-   double compatibility(const Trk::TrackParameters & measPerigee,
-                        const xAOD::Vertex & vertex) const;
-
-   void countTracksAndNdf(xAOD::Vertex * myxAODVertex,
-                          double & ndf, int & ntracks) const;
-
-   double distanceAndError(const Trk::TrackParameters* params,
-                           const Amg::Vector3D* vertex,
-                           double& err) const;
-
-   ToolHandle< Trk::IVertexFitter > m_iVertexFitter;
-   ToolHandle< InDet::IInDetTrackSelectionTool > m_trkFilter;
-   ToolHandle< Trk::IVertexSeedFinder > m_SeedFinder;
-   ToolHandle< Trk::IImpactPoint3dEstimator > m_ImpactPoint3dEstimator;
-
-   SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey{
-     this,
-     "BeamSpotKey",
-     "BeamSpotData",
-     "SG key for beam spot"
-   };
-
-   bool m_useBeamConstraint;
-   double m_significanceCutSeeding;
-   double m_maximumChi2cutForSeeding;
-   double m_maxVertices;
-
-   bool m_createSplitVertices;
-   int m_splitVerticesTrkInvFraction; ///< Integer: 1./fraction of tracks to be assigned to the tag split vertex 
-
-   bool m_reassignTracksAfterFirstFit;
-   
-   /// enable merging of vertices after finding
-   //   bool m_doRemerging;
-   
-   void SGError(const std::string& errService);
-
-   /**
-    * Internal method to print the parameters setting
-    */
-
-   virtual void printParameterSettings();
- 
-
-
-
- };//end of class definitions
-}//end of namespace definitions
-#endif
-                                                                                                             
diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetPriVxFinderTool.h b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetPriVxFinderTool.h
deleted file mode 100755
index f92288ac1ef830c157ed1b326f9e57200a2e8518..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetPriVxFinderTool.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-/***************************************************************************
-                          InDetPriVxFinderTool.h  -  Description
-                             -------------------
-    begin   : 27-01-2004
-    authors : Andreas Wildauer (CERN PH-ATC), Fredrik Akesson (CERN PH-ATC)
-    email   : andreas.wildauer@cern.ch, fredrik.akesson@cern.ch
-     changes : 14-02-2006 added inheritance from abstract class IPriVxFinderTool
-                          changed const VxCandidate* to VxCandidate*
-                          (necessary to compile with gcc starting from 3.3.x)
-                          by GP (Freiburg University)
-
-    changes: 18-11-2010  Kirill Prokofiev
-             Development never stops ;).
-             Now adding the split vertices for the HI run
-
-             2016-04-26  David Shope <david.richard.shope@cern.ch>
-
-             EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex
-
-               findVertex will now always return an xAOD::VertexContainer,
-               even when using a TrackCollection.
- ***************************************************************************/
-
-#ifndef INDETPRIVXFINDERTOOL_INDETPRIVXFINDERTOOL_H
-#define INDETPRIVXFINDERTOOL_INDETPRIVXFINDERTOOL_H
-
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "InDetRecToolInterfaces/IVertexFinder.h"
-// cannot be forward declared because of typedef
-#include "TrkParameters/TrackParameters.h"
-#include "TrkTrack/TrackCollection.h"
-
-#include <vector>
-
-/** Primary Vertex Finder Tool.
-  InDetPriVxFinderTool uses the Billoir method to fit a primary vertex in the
-  event. The method includes taking all tracks passing the preselection and to
-  fit them. In a second iteration tracks with a 'too big' chi-squared
-  contribution are left out and the remaining tracks are refitted. The 'too big'
-  contribution (maximum chi-square) can be set by jobOptions. Preselection cuts
-  can be given via jobOptions for d0, z0 and minimum Pt. It is also possible to
-  set a beam constraint to be considered in the fit. this is also done in the
-  jobOptions.
-
-    - \c TracksName: The name of the StoreGate input container from
-      which the tracks are read. The default is "TrkTracks", the container
-      from the legacy converters/ambiguity processor.
-    - \c VxCandidatesOutputName: The name of the StoreGate container where the
-  fit results are put. default is "VxPrimaryCandidate".
-    - \c FitRoutine: The routine which should be used for the fitting. The
-      default is "FastVertexFitter".
-
-    - \c chi2 cut method: Specifies how to chi2 cut on tracks. There are two
-  possibilities: Version 1: (chi2CutMethod = 1)
-          - get rid of all tracks with chi2 > m_maxChi2PerTrack in one go
-          - no refit after removing one track
-          - refit after all tracks with too high chi2 were removed
-      Version 2: (chi2CutMethod = 2)
-          - get rid of tracks one by one starting with the one with highest chi2
-  > m_maxChi2PerTrack
-          - refit after this track has been removed
-            and do a chi2 cut again until all chi2 < m_maxChi2PerTrack
-    - \c maxChi2PerTrack: The maximum chi-squared of a track to be considered
-         in the second iteration of the vertex fitting. default is 10.
-
-    - \c useBeamConstraint: Use beam spot constraint. default is no (0).
-    - \c BeamConstraint_x: Constrained x-position of beam spot. default is 0.
-    - \c BeamConstraint_x: Constrained y-position of beam spot. default is 0.
-    - \c BeamConstraint_x: Constrained z-position of beam spot. default is 0.
-    - \c BeamConstraint_err_x: Error on constrained x-position. default is 0.
-    - \c BeamConstraint_err_y: Error on constrained y-position. default is 0.
-    - \c BeamConstraint_err_z: Error on constrained z-position. default is 5.6
-  cm.
-
-    - \c Track selection cuts:
-          minPt = 1000. CLHEP::MeV: the minimum pt(CLHEP::MeV) of a track.
-          maxZ0 = 150. CLHEP::mm: the maximal z0(CLHEP::mm) of a track.
-          maxD0 =   1. CLHEP::mm; the maximal d0(CLHEP::mm) of a track.
-
-*/
-
-/* Forward declarations */
-
-#include "BeamSpotConditionsData/BeamSpotData.h"
-#include "xAODTracking/TrackParticle.h"
-#include "xAODTracking/TrackParticleContainer.h"
-#include "xAODTracking/Vertex.h"
-#include "xAODTracking/VertexContainer.h"
-namespace Trk {
-class IVertexFitter;
-class Track;
-class IVxCandidateXAODVertex;
-}
-
-namespace InDet {
-class IMultiPVSeedFinder;
-class IInDetTrackSelectionTool;
-
-class InDetPriVxFinderTool
-  : public AthAlgTool
-  , virtual public IVertexFinder
-{
-public:
-  InDetPriVxFinderTool(const std::string& t,
-                       const std::string& n,
-                       const IInterface* p);
-  virtual ~InDetPriVxFinderTool();
-  StatusCode initialize() override;
-
-  using IVertexFinder::findVertex;
-  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> findVertex(
-    const TrackCollection* trackTES) const override;
-
-
-  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> findVertex(
-    const xAOD::TrackParticleContainer* trackParticles) const override;
-
-  virtual StatusCode finalize() override;
-
-private:
-  ToolHandle<InDet::IMultiPVSeedFinder> m_iPriVxSeedFinder;
-  ToolHandle<Trk::IVertexFitter> m_iVertexFitter;
-  ToolHandle<InDet::IInDetTrackSelectionTool> m_trkFilter;
-
-  SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey{
-    this,
-    "BeamSpotKey",
-    "BeamSpotData",
-    "SG key for beam spot"
-  }; //!< pointer to the beam condition service
-
-  /** Define a beam constraint for the fit */
-  bool m_useBeamConstraint; //!<  Use a vertex/beam constraint
-
-  /** choose the chi2 cut method */
-  int m_chi2CutMethod;
-  bool m_enableMultipleVertices;
-  double m_clusterLength;
-  /** The maximum chi-squared per track which is allowed in the fit. */
-  double m_maxChi2PerTrack;
-
-  /** the common finding code (regardless of Track or TrackParticle is
-   * here */
-  // VxContainer* m_findVertex(std::vector< std::vector<const
-  // Trk::TrackParameters*> >& origParameters);
-  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> findVertex(
-    std::vector<std::vector<const Trk::TrackParameters*>>& origParameters)
-    const;
-
-  virtual void sortTracksInChi2(std::vector<int>& indexOfSortedChi2,
-                                xAOD::Vertex* myxAODVertex) const;
-  virtual void sortTracksInZ0(std::vector<const Trk::TrackParameters*> tv,
-                              std::vector<int>& indexOfSortedZ0) const;
-
-  bool m_createSplitVertices;
-  int m_splitVerticesTrkInvFraction; ///< Integer: 1./fraction of tracks to be
-                                     ///< assigned to the tag split vertex
-};
-}
-#endif
diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptiveMultiPriVxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptiveMultiPriVxFinderTool.cxx
index 5701911d59a10ed1c35a92fe7bef6ba4e85656cc..7c31811a3735cfab3ff07f8b02743cd2406bd4f1 100755
--- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptiveMultiPriVxFinderTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptiveMultiPriVxFinderTool.cxx
@@ -2,16 +2,14 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-
 /***************************************************************************
                          InDetAdaptivePriVxFinderTool.cxx  -  Description
                              -------------------
     begin   : 29-05-2006
     authors : Giacinto Piacquadio (Freiburg Univ),
-              this is a modified version of the adaptive primary vertex finder to fit more vertexes at the same time
-    changes :
-          06/12/2006   Kirill.Prokofiev@cern.ch
-          EDM cleanup and switching to the FitQuality use
+              this is a modified version of the adaptive primary vertex finder
+to fit more vertexes at the same time changes : 06/12/2006
+Kirill.Prokofiev@cern.ch EDM cleanup and switching to the FitQuality use
               2007-02-15  bug fix by scott s snyder  <snyder@bnl.gov>
               Fix memory leak.  Don't use a map for sorting.
               2007-10-xx  Giacinto Piacquadio
@@ -22,35 +20,34 @@
 
 ***************************************************************************/
 #include "InDetPriVxFinderTool/InDetAdaptiveMultiPriVxFinderTool.h"
-#include "VxVertex/RecVertex.h"
-#include "VxVertex/Vertex.h"
-#include "TrkTrack/Track.h"
-#include "TrkParameters/TrackParameters.h"
 #include "EventPrimitives/EventPrimitives.h"
 #include "EventPrimitives/EventPrimitivesHelpers.h"
 #include "GeoPrimitives/GeoPrimitives.h"
+#include "TrkParameters/TrackParameters.h"
+#include "TrkTrack/Track.h"
+#include "VxVertex/RecVertex.h"
+#include "VxVertex/Vertex.h"
 
-#include "VxMultiVertex/MvfFitInfo.h"
-#include "VxMultiVertex/MVFVxTrackAtVertex.h"
-#include "VxMultiVertex/TrackToVtxLink.h"
 #include "AthContainers/DataVector.h"
 #include "TrkEventPrimitives/ParamDefs.h"
-#include "TrkTrack/LinkToTrack.h"
 #include "TrkLinks/LinkToXAODTrackParticle.h"
+#include "TrkTrack/LinkToTrack.h"
+#include "VxMultiVertex/MVFVxTrackAtVertex.h"
+#include "VxMultiVertex/MvfFitInfo.h"
+#include "VxMultiVertex/TrackToVtxLink.h"
 
-#include "xAODTracking/Vertex.h"
 #include "xAODTracking/TrackParticle.h"
-#include "xAODTracking/VertexContainer.h"
-#include "xAODTracking/VertexAuxContainer.h"
-#include "xAODTracking/TrackParticleContainer.h"
 #include "xAODTracking/TrackParticleAuxContainer.h"
+#include "xAODTracking/TrackParticleContainer.h"
+#include "xAODTracking/Vertex.h"
+#include "xAODTracking/VertexAuxContainer.h"
+#include "xAODTracking/VertexContainer.h"
 
 #include <cmath>
 #include <map>
 #include <vector>
 
-namespace InDet
-{
+namespace InDet {
 InDetAdaptiveMultiPriVxFinderTool::InDetAdaptiveMultiPriVxFinderTool(
   const std::string& t,
   const std::string& n,
@@ -97,639 +94,734 @@ InDetAdaptiveMultiPriVxFinderTool::InDetAdaptiveMultiPriVxFinderTool(
   declareProperty("do3dSplitting", m_do3dSplitting);
   declareProperty("zBfieldApprox", m_zBfieldApprox);
   declareProperty("maximumVertexContamination", m_maximumVertexContamination);
+}
 
-  }
-
-  StatusCode
-  InDetAdaptiveMultiPriVxFinderTool::initialize() {
-    /* Get the right vertex fitting tool */
-    ATH_CHECK(m_MultiVertexFitter.retrieve());
-
-    ATH_CHECK(m_analyticSeedFinder.retrieve());
+StatusCode
+InDetAdaptiveMultiPriVxFinderTool::initialize()
+{
+  /* Get the right vertex fitting tool */
+  ATH_CHECK(m_MultiVertexFitter.retrieve());
 
-    ATH_CHECK(m_beamSpotKey.initialize());
+  ATH_CHECK(m_analyticSeedFinder.retrieve());
 
-    ATH_CHECK(m_trkFilter.retrieve());
+  ATH_CHECK(m_beamSpotKey.initialize());
 
-    // since some parameters special to an inherited class this method
-    // will be overloaded by the inherited class
-    if (msgLvl(MSG::DEBUG)) printParameterSettings();
+  ATH_CHECK(m_trkFilter.retrieve());
 
-    ATH_MSG_INFO("Initialization successful");
-    return StatusCode::SUCCESS;
-  }
+  // since some parameters special to an inherited class this method
+  // will be overloaded by the inherited class
+  if (msgLvl(MSG::DEBUG))
+    printParameterSettings();
 
-  namespace
-  {
-    struct xAODVertex_pair {
-      double first;
-      xAOD::Vertex* second;
-      xAODVertex_pair(double p1, xAOD::Vertex* p2)
-        : first(p1), second(p2) {}
-      bool
-      operator < (const xAODVertex_pair& other) const
-      {return first > other.first;}
-    };
-  } //anonymous namespace
+  ATH_MSG_INFO("Initialization successful");
+  return StatusCode::SUCCESS;
+}
 
-  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
-  InDetAdaptiveMultiPriVxFinderTool::findVertex(
-    const EventContext& ctx,
-    const TrackCollection* trackTES) const
+namespace {
+struct xAODVertex_pair
+{
+  double first;
+  xAOD::Vertex* second;
+  xAODVertex_pair(double p1, xAOD::Vertex* p2)
+    : first(p1)
+    , second(p2)
+  {}
+  bool operator<(const xAODVertex_pair& other) const
   {
-    SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{ m_beamSpotKey,
-                                                            ctx };
-    const Trk::RecVertex &beamposition(beamSpotHandle->beamVtx());
-
-    std::vector<const Trk::ITrackLink*> selectedTracks;
-
-    typedef DataVector<Trk::Track>::const_iterator TrackDataVecIter;
+    return first > other.first;
+  }
+};
+} // anonymous namespace
 
-    bool selectionPassed;
-    for (TrackDataVecIter itr = (*trackTES).begin(); itr != (*trackTES).end(); itr++) {
-      if (m_useBeamConstraint) {
-        selectionPassed = static_cast<bool>(m_trkFilter->accept(**itr, &beamposition));
-      } else {
-        Trk::Vertex null(Amg::Vector3D(0, 0, 0));
-        selectionPassed = static_cast<bool>(m_trkFilter->accept(**itr, &null)); // TODO: change trkFilter?
-      }
-      if (selectionPassed) {
-        ElementLink<TrackCollection> link;
-        link.setElement(const_cast<Trk::Track*>(*itr));
-        Trk::LinkToTrack* linkTT = new Trk::LinkToTrack(link);
-        linkTT->setStorableObject(*trackTES);
-        selectedTracks.push_back(linkTT);
-      }
+std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
+InDetAdaptiveMultiPriVxFinderTool::findVertex(
+  const EventContext& ctx,
+  const TrackCollection* trackTES) const
+{
+  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{ m_beamSpotKey, ctx };
+  const Trk::RecVertex& beamposition(beamSpotHandle->beamVtx());
+
+  std::vector<const Trk::ITrackLink*> selectedTracks;
+
+  typedef DataVector<Trk::Track>::const_iterator TrackDataVecIter;
+
+  bool selectionPassed;
+  for (TrackDataVecIter itr = (*trackTES).begin(); itr != (*trackTES).end();
+       itr++) {
+    if (m_useBeamConstraint) {
+      selectionPassed =
+        static_cast<bool>(m_trkFilter->accept(**itr, &beamposition));
+    } else {
+      Trk::Vertex null(Amg::Vector3D(0, 0, 0));
+      selectionPassed = static_cast<bool>(
+        m_trkFilter->accept(**itr, &null)); // TODO: change trkFilter?
     }
+    if (selectionPassed) {
+      ElementLink<TrackCollection> link;
+      link.setElement(const_cast<Trk::Track*>(*itr));
+      Trk::LinkToTrack* linkTT = new Trk::LinkToTrack(link);
+      linkTT->setStorableObject(*trackTES);
+      selectedTracks.push_back(linkTT);
+    }
+  }
 
-    ATH_MSG_DEBUG("Of " << trackTES->size() << " tracks "
-                        << selectedTracks.size() << " survived the preselection.");
+  ATH_MSG_DEBUG("Of " << trackTES->size() << " tracks " << selectedTracks.size()
+                      << " survived the preselection.");
 
-    std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
-      returnContainers = findVertex(ctx, selectedTracks);
+  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
+    returnContainers = findVertex(ctx, selectedTracks);
 
-    std::vector<const Trk::ITrackLink*>::iterator ibegin = selectedTracks.begin();
-    std::vector<const Trk::ITrackLink*>::iterator iend = selectedTracks.end();
+  std::vector<const Trk::ITrackLink*>::iterator ibegin = selectedTracks.begin();
+  std::vector<const Trk::ITrackLink*>::iterator iend = selectedTracks.end();
 
-    for (std::vector<const Trk::ITrackLink*>::iterator iiter = ibegin; iiter != iend; ++iiter) {
-      if ((*iiter) != 0) {
-        delete *iiter;
-        *iiter = 0;
-      }
+  for (std::vector<const Trk::ITrackLink*>::iterator iiter = ibegin;
+       iiter != iend;
+       ++iiter) {
+    if ((*iiter) != 0) {
+      delete *iiter;
+      *iiter = 0;
     }
-
-    return returnContainers;
   }
 
-  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
-  InDetAdaptiveMultiPriVxFinderTool::findVertex(
-    const EventContext& ctx,
-    const xAOD::TrackParticleContainer* trackParticles) const
-  {
-    std::vector<const Trk::ITrackLink*> selectedTracks;
-    SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{ m_beamSpotKey,
-                                                            ctx };
-    xAOD::Vertex beamposition;
-    beamposition.makePrivateStore();
-    beamposition.setPosition(beamSpotHandle->beamVtx().position());
-    beamposition.setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-
-    typedef DataVector<xAOD::TrackParticle>::const_iterator TrackParticleDataVecIter;
-
-    bool selectionPassed;
-    for (TrackParticleDataVecIter itr = (*trackParticles).begin(); itr != (*trackParticles).end(); itr++) {
-      if (m_useBeamConstraint) {
-        selectionPassed = static_cast<bool>(m_trkFilter->accept(**itr, &beamposition));
-      } else {
-        xAOD::Vertex null;
-        null.makePrivateStore();
-        null.setPosition(Amg::Vector3D(0, 0, 0));
-        AmgSymMatrix(3) vertexError;
-        vertexError.setZero();
-        null.setCovariancePosition(vertexError);
-        selectionPassed = static_cast<bool>(m_trkFilter->accept(**itr, &null));
-      }
+  return returnContainers;
+}
 
-      if (selectionPassed) {
-        ElementLink<xAOD::TrackParticleContainer> link;
-        link.setElement(const_cast<xAOD::TrackParticle*>(*itr));
-        Trk::LinkToXAODTrackParticle* linkTT = new Trk::LinkToXAODTrackParticle(link);
-        linkTT->setStorableObject(*trackParticles); //@TODO: really?!
-        selectedTracks.push_back(linkTT);
-      }
+std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
+InDetAdaptiveMultiPriVxFinderTool::findVertex(
+  const EventContext& ctx,
+  const xAOD::TrackParticleContainer* trackParticles) const
+{
+  std::vector<const Trk::ITrackLink*> selectedTracks;
+  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{ m_beamSpotKey, ctx };
+  xAOD::Vertex beamposition;
+  beamposition.makePrivateStore();
+  beamposition.setPosition(beamSpotHandle->beamVtx().position());
+  beamposition.setCovariancePosition(
+    beamSpotHandle->beamVtx().covariancePosition());
+
+  typedef DataVector<xAOD::TrackParticle>::const_iterator
+    TrackParticleDataVecIter;
+
+  bool selectionPassed;
+  for (TrackParticleDataVecIter itr = (*trackParticles).begin();
+       itr != (*trackParticles).end();
+       itr++) {
+    if (m_useBeamConstraint) {
+      selectionPassed =
+        static_cast<bool>(m_trkFilter->accept(**itr, &beamposition));
+    } else {
+      xAOD::Vertex null;
+      null.makePrivateStore();
+      null.setPosition(Amg::Vector3D(0, 0, 0));
+      AmgSymMatrix(3) vertexError;
+      vertexError.setZero();
+      null.setCovariancePosition(vertexError);
+      selectionPassed = static_cast<bool>(m_trkFilter->accept(**itr, &null));
     }
 
-    ATH_MSG_DEBUG(
-      "Of " << trackParticles->size() << " tracks " << selectedTracks.size() << " survived the preselection.");
-
-    std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
-      returnContainers = findVertex(ctx, selectedTracks);
-
-    std::vector<const Trk::ITrackLink*>::iterator ibegin = selectedTracks.begin();
-    std::vector<const Trk::ITrackLink*>::iterator iend = selectedTracks.end();
-
-    //clean-up and return
-    for (std::vector<const Trk::ITrackLink*>::iterator iiter = ibegin; iiter != iend; ++iiter) {
-      if ((*iiter) != 0) {
-        delete *iiter;
-        *iiter = 0;
-      }
+    if (selectionPassed) {
+      ElementLink<xAOD::TrackParticleContainer> link;
+      link.setElement(const_cast<xAOD::TrackParticle*>(*itr));
+      Trk::LinkToXAODTrackParticle* linkTT =
+        new Trk::LinkToXAODTrackParticle(link);
+      linkTT->setStorableObject(*trackParticles); //@TODO: really?!
+      selectedTracks.push_back(linkTT);
     }
-
-    return returnContainers;
   }
 
+  ATH_MSG_DEBUG("Of " << trackParticles->size() << " tracks "
+                      << selectedTracks.size()
+                      << " survived the preselection.");
+
   std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
-  InDetAdaptiveMultiPriVxFinderTool::findVertex(
-    const EventContext& ctx,
-    const std::vector<const Trk::ITrackLink*>& trackVector) const
-  {
-    // Prepare objects holding the decoration of xAOD::Vertex with MVF auxdata
-    // For optimization of access speed
-    static const xAOD::Vertex::Decorator<Trk::MvfFitInfo*> MvfFitInfo(
-      "MvfFitInfo");
-    static const xAOD::Vertex::Decorator<bool> isInitialized("isInitialized");
-    static const xAOD::Vertex::Decorator<std::vector<Trk::VxTrackAtVertex*>>
-      VTAV("VTAV");
-
-    if (m_selectiontype == 1) {
-      ATH_MSG_WARNING("Only Selection Type 0 supported for MT");
+    returnContainers = findVertex(ctx, selectedTracks);
+
+  std::vector<const Trk::ITrackLink*>::iterator ibegin = selectedTracks.begin();
+  std::vector<const Trk::ITrackLink*>::iterator iend = selectedTracks.end();
+
+  // clean-up and return
+  for (std::vector<const Trk::ITrackLink*>::iterator iiter = ibegin;
+       iiter != iend;
+       ++iiter) {
+    if ((*iiter) != 0) {
+      delete *iiter;
+      *iiter = 0;
     }
+  }
 
-    //---- Start of preselection of tracks according to perigee parameters ---------------//
-    std::vector<const Trk::ITrackLink*> origTracks = trackVector;
-    std::vector<const Trk::ITrackLink*> seedTracks = trackVector;
-  
-    //now all tracks are in origTracks... std::vector<const Track*> origTracks;
-    std::vector<xAODVertex_pair> myxAODVertices;
-
-    std::vector<Trk::TrackToVtxLink*> myTrackToVtxLinks;
-
-    xAOD::VertexContainer* theVertexContainer = new xAOD::VertexContainer;
-    xAOD::VertexAuxContainer* theVertexAuxContainer = new xAOD::VertexAuxContainer;
-    theVertexContainer->setStore(theVertexAuxContainer);
-
-    Amg::Vector3D actualVertex;
-
-    std::map<const Trk::ITrackLink*, Trk::TrackToVtxLink*> TrackLinkOf;
-    //create a map between ITrackLink* and TrackToVtxLink*
-    std::vector<const Trk::ITrackLink*>::const_iterator trkbegin = origTracks.begin();
-    std::vector<const Trk::ITrackLink*>::const_iterator trkend = origTracks.end();
-
+  return returnContainers;
+}
 
-    for (std::vector<const Trk::ITrackLink*>::const_iterator trkiter = trkbegin; trkiter != trkend; ++trkiter) {
-      Trk::TrackToVtxLink* newTrkToVtxLink(new Trk::TrackToVtxLink(new std::vector<xAOD::Vertex*>));
-      // makePrivateStore() is called for each vertex to add in iteration
-      TrackLinkOf[*trkiter] = newTrkToVtxLink;
-      myTrackToVtxLinks.push_back(newTrkToVtxLink);
-    }
+std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
+InDetAdaptiveMultiPriVxFinderTool::findVertex(
+  const EventContext& ctx,
+  const std::vector<const Trk::ITrackLink*>& trackVector) const
+{
+  // Prepare objects holding the decoration of xAOD::Vertex with MVF auxdata
+  // For optimization of access speed
+  static const xAOD::Vertex::Decorator<Trk::MvfFitInfo*> MvfFitInfo(
+    "MvfFitInfo");
+  static const xAOD::Vertex::Decorator<bool> isInitialized("isInitialized");
+  static const xAOD::Vertex::Decorator<std::vector<Trk::VxTrackAtVertex*>> VTAV(
+    "VTAV");
+
+  if (m_selectiontype == 1) {
+    ATH_MSG_WARNING("Only Selection Type 0 supported for MT");
+  }
 
+  //---- Start of preselection of tracks according to perigee parameters
+  //---------------//
+  std::vector<const Trk::ITrackLink*> origTracks = trackVector;
+  std::vector<const Trk::ITrackLink*> seedTracks = trackVector;
+
+  // now all tracks are in origTracks... std::vector<const Track*> origTracks;
+  std::vector<xAODVertex_pair> myxAODVertices;
+
+  std::vector<Trk::TrackToVtxLink*> myTrackToVtxLinks;
+
+  xAOD::VertexContainer* theVertexContainer = new xAOD::VertexContainer;
+  xAOD::VertexAuxContainer* theVertexAuxContainer =
+    new xAOD::VertexAuxContainer;
+  theVertexContainer->setStore(theVertexAuxContainer);
+
+  Amg::Vector3D actualVertex;
+
+  std::map<const Trk::ITrackLink*, Trk::TrackToVtxLink*> TrackLinkOf;
+  // create a map between ITrackLink* and TrackToVtxLink*
+  std::vector<const Trk::ITrackLink*>::const_iterator trkbegin =
+    origTracks.begin();
+  std::vector<const Trk::ITrackLink*>::const_iterator trkend = origTracks.end();
+
+  for (std::vector<const Trk::ITrackLink*>::const_iterator trkiter = trkbegin;
+       trkiter != trkend;
+       ++trkiter) {
+    Trk::TrackToVtxLink* newTrkToVtxLink(
+      new Trk::TrackToVtxLink(new std::vector<xAOD::Vertex*>));
+    // makePrivateStore() is called for each vertex to add in iteration
+    TrackLinkOf[*trkiter] = newTrkToVtxLink;
+    myTrackToVtxLinks.push_back(newTrkToVtxLink);
+  }
 
-    //prepare iterators for tracks only necessary for seeding
-    std::vector<const Trk::ITrackLink*>::iterator seedtrkbegin = seedTracks.begin();
-    std::vector<const Trk::ITrackLink*>::iterator seedtrkend = seedTracks.end();
-    SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{ m_beamSpotKey,
-                                                            ctx };
-    int iteration = 0;
+  // prepare iterators for tracks only necessary for seeding
+  std::vector<const Trk::ITrackLink*>::iterator seedtrkbegin =
+    seedTracks.begin();
+  std::vector<const Trk::ITrackLink*>::iterator seedtrkend = seedTracks.end();
+  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{ m_beamSpotKey, ctx };
+  int iteration = 0;
 
   int nNoCompatibleTracks(0);
   int nContamintationCut(0);
   int nWithin3sigma(0);
 
-    unsigned int seedtracknumber = seedTracks.size();
-    do {
-      if (seedtracknumber == 0) {
-        ATH_MSG_DEBUG("No tracks available after track selection for seeding. No finding done.");
-        break;
-      }
-      iteration += 1;
-      ATH_MSG_DEBUG("Starting iteration number " << iteration << " with " << seedtracknumber << " seed tracks.");
-      //now use all the perigee parameters you have so far
-      if (m_realMultiVertex) {
-        trkbegin = origTracks.begin();
-        trkend = origTracks.end();
-      } else {
-        trkbegin = seedTracks.begin();
-        trkend = seedTracks.end();
-      }
-      std::vector<const Trk::TrackParameters*> perigeeList;
-      for (std::vector<const Trk::ITrackLink*>::iterator seedtrkAtVtxIter = seedtrkbegin;
-           seedtrkAtVtxIter != seedtrkend; ++seedtrkAtVtxIter) {
-        perigeeList.push_back((*seedtrkAtVtxIter)->parameters());
+  unsigned int seedtracknumber = seedTracks.size();
+  do {
+    if (seedtracknumber == 0) {
+      ATH_MSG_DEBUG("No tracks available after track selection for seeding. No "
+                    "finding done.");
+      break;
+    }
+    iteration += 1;
+    ATH_MSG_DEBUG("Starting iteration number " << iteration << " with "
+                                               << seedtracknumber
+                                               << " seed tracks.");
+    // now use all the perigee parameters you have so far
+    if (m_realMultiVertex) {
+      trkbegin = origTracks.begin();
+      trkend = origTracks.end();
+    } else {
+      trkbegin = seedTracks.begin();
+      trkend = seedTracks.end();
+    }
+    std::vector<const Trk::TrackParameters*> perigeeList;
+    for (std::vector<const Trk::ITrackLink*>::iterator seedtrkAtVtxIter =
+           seedtrkbegin;
+         seedtrkAtVtxIter != seedtrkend;
+         ++seedtrkAtVtxIter) {
+      perigeeList.push_back((*seedtrkAtVtxIter)->parameters());
+    }
+    xAOD::Vertex* constraintVertex = nullptr;
+
+    if (m_useBeamConstraint) {
+      constraintVertex = new xAOD::Vertex();
+      constraintVertex->makePrivateStore();
+      constraintVertex->setPosition(beamSpotHandle->beamVtx().position());
+      constraintVertex->setCovariancePosition(
+        beamSpotHandle->beamVtx().covariancePosition());
+      constraintVertex->setFitQuality(
+        beamSpotHandle->beamVtx().fitQuality().chiSquared(),
+        beamSpotHandle->beamVtx().fitQuality().doubleNumberDoF());
+      std::pair<Amg::Vector3D, Amg::MatrixX> seedConstraintVertex =
+        m_analyticSeedFinder->findAnalyticSeed(perigeeList, constraintVertex);
+      actualVertex = seedConstraintVertex.first;
+      if (m_useSeedConstraint) {
+        constraintVertex->setPosition(seedConstraintVertex.first);
+        constraintVertex->setCovariancePosition(seedConstraintVertex.second);
       }
-      xAOD::Vertex* constraintVertex = nullptr;
-      
-      if (m_useBeamConstraint) {
-        constraintVertex = new xAOD::Vertex();
-        constraintVertex->makePrivateStore();
-        constraintVertex->setPosition(beamSpotHandle->beamVtx().position());
-        constraintVertex->setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-        constraintVertex->setFitQuality(beamSpotHandle->beamVtx().fitQuality().chiSquared(),
-                                        beamSpotHandle->beamVtx().fitQuality().doubleNumberDoF());
-        std::pair<Amg::Vector3D,Amg::MatrixX> seedConstraintVertex = m_analyticSeedFinder->findAnalyticSeed(perigeeList, constraintVertex);
-        actualVertex = seedConstraintVertex.first;
-        if(m_useSeedConstraint){
-          constraintVertex->setPosition(seedConstraintVertex.first);
-          constraintVertex->setCovariancePosition(seedConstraintVertex.second);
+    } else {
+      actualVertex = m_analyticSeedFinder->findSeed(perigeeList);
+      Amg::MatrixX looseConstraintCovariance(3, 3);
+      looseConstraintCovariance.setIdentity();
+      looseConstraintCovariance = looseConstraintCovariance * 1e+8;
+      constraintVertex = new xAOD::Vertex();
+      constraintVertex->makePrivateStore();
+      constraintVertex->setPosition(actualVertex);
+      constraintVertex->setCovariancePosition(looseConstraintCovariance);
+      constraintVertex->setFitQuality(0., -3.);
+    }
+    // TODO: memory leak here with theconstraint when the loop breaks?
+    if (actualVertex.z() == 0.) {
+      ATH_MSG_DEBUG("No seed found: no further primary vertex finding "
+                    "performed on this event");
+      ATH_MSG_DEBUG(perigeeList.size()
+                    << " tracks passed to seed finder, but no seed returned.");
+      // TODO: Do I need this?
+      delete constraintVertex;
+      constraintVertex = nullptr;
+      break;
+    }
+    // new xAOD::Vertex with this
+    xAOD::Vertex* actualcandidate = new xAOD::Vertex;
+    actualcandidate->makePrivateStore();
+    actualcandidate->setVertexType(xAOD::VxType::NotSpecified);
+    // to mimic the initialization present in the old EDM
+    // constructor now add decorations!
+    MvfFitInfo(*actualcandidate) =
+      new Trk::MvfFitInfo(constraintVertex,
+                          new Amg::Vector3D(actualVertex),
+                          new Amg::Vector3D(actualVertex));
+    isInitialized(*actualcandidate) = false;
+    std::vector<Trk::VxTrackAtVertex*> vector_of_tracks(0);
+    VTAV(*actualcandidate) =
+      vector_of_tracks; // TODO: maybe needed before push_back?
+    // now iterate on all tracks and find out if they are sufficiently close to
+    // the found vertex
+
+
+    for (std::vector<const Trk::ITrackLink*>::const_iterator trkiter = trkbegin;
+         trkiter != trkend;
+         ++trkiter) {
+      if (std::fabs(estimateDeltaZ(*(*trkiter)->parameters(), actualVertex)) <
+          m_TracksMaxZinterval) {
+        const double thisTracksSignificance = ipSignificance(
+          (*trkiter)->parameters(), &actualVertex); // calculate significance
+        if (thisTracksSignificance < m_tracksMaxSignificance) {
+          // accessing corresponding link to vertices
+          Trk::TrackToVtxLink* actuallink = TrackLinkOf[*trkiter];
+          std::vector<xAOD::Vertex*>* actualvtxlink = actuallink->vertices();
+          // adding vertex to candidates of track
+          actualvtxlink->push_back(actualcandidate);
+          VTAV(*actualcandidate)
+            .push_back(
+              new Trk::MVFVxTrackAtVertex((*trkiter)->clone(), actuallink));
         }
-      } else {
-        actualVertex = m_analyticSeedFinder->findSeed(perigeeList);
-        Amg::MatrixX looseConstraintCovariance(3, 3);
-        looseConstraintCovariance.setIdentity();
-        looseConstraintCovariance = looseConstraintCovariance * 1e+8;
-        constraintVertex = new xAOD::Vertex();
-        constraintVertex->makePrivateStore();
-        constraintVertex->setPosition(actualVertex);
-        constraintVertex->setCovariancePosition(looseConstraintCovariance);
-        constraintVertex->setFitQuality(0., -3.);
-      }
-      // TODO: memory leak here with theconstraint when the loop breaks?
-      if (actualVertex.z() == 0.) {
-        ATH_MSG_DEBUG("No seed found: no further primary vertex finding performed on this event");
-        ATH_MSG_DEBUG(perigeeList.size() << " tracks passed to seed finder, but no seed returned.");
-        // TODO: Do I need this?
-        delete constraintVertex;
-        constraintVertex = nullptr;
-        break;
       }
-      //new xAOD::Vertex with this
-      xAOD::Vertex* actualcandidate = new xAOD::Vertex;
-      actualcandidate->makePrivateStore();
-      actualcandidate->setVertexType(xAOD::VxType::NotSpecified);
-      // to mimic the initialization present in the old EDM
-      // constructor now add decorations!
-      MvfFitInfo(*actualcandidate) = new Trk::MvfFitInfo(constraintVertex,
-                                                         new Amg::Vector3D(actualVertex),
-                                                         new Amg::Vector3D(actualVertex));
-      isInitialized(*actualcandidate) = false;
-      std::vector<Trk::VxTrackAtVertex*> vector_of_tracks(0);
-      VTAV(*actualcandidate) = vector_of_tracks; // TODO: maybe needed before push_back?
-      //now iterate on all tracks and find out if they are sufficiently close to the found vertex
-
-      ATH_MSG_VERBOSE("Adding tracks to the vertex candidate now");
-
-      for (std::vector<const Trk::ITrackLink*>::const_iterator trkiter = trkbegin; trkiter != trkend; ++trkiter) {
-        if (std::fabs(estimateDeltaZ(*(*trkiter)->parameters(), actualVertex)) < m_TracksMaxZinterval) {
-          const double thisTracksSignificance = ipSignificance((*trkiter)->parameters(),&actualVertex); // calculate significance
-          if ( thisTracksSignificance<m_tracksMaxSignificance)
-          {
-            //accessing corresponding link to vertices
-            Trk::TrackToVtxLink* actuallink = TrackLinkOf[*trkiter];
-            std::vector<xAOD::Vertex*>* actualvtxlink = actuallink->vertices();
-            //adding vertex to candidates of track
-            actualvtxlink->push_back(actualcandidate);
-            ATH_MSG_VERBOSE("Adding an MVFVxTrackAtVertex with tracklink " << actuallink <<
-                            " to the vertex candidate VTAV decoration");
-            VTAV(*actualcandidate).push_back(new Trk::MVFVxTrackAtVertex((*trkiter)->clone(),
-                                                                         actuallink));
-          }
+    }
+    ATH_MSG_DEBUG(
+      VTAV(*actualcandidate).size()
+      << " tracks added to vertex candidate for IP significance less than "
+      << m_tracksMaxSignificance << " within " << m_TracksMaxZinterval
+      << " mm of seed position.");
+    // now consider to recovery from the case where no tracks were added to the
+    // vertex
+    if (VTAV(*actualcandidate).empty()) {
+      // you need to define a new seed (because the old one is probably in
+      // between two ones...)
+      double zdistance = 1e8;
+      const Trk::ITrackLink* nearestTrack = nullptr;
+      for (std::vector<const Trk::ITrackLink*>::const_iterator seedtrkiter =
+             seedtrkbegin;
+           seedtrkiter != seedtrkend;
+           ++seedtrkiter) {
+        if (std::fabs((*seedtrkiter)->parameters()->position()[Trk::z] -
+                      actualVertex.z()) < zdistance) {
+          zdistance =
+            std::fabs((*seedtrkiter)->parameters()->position()[Trk::z] -
+                      actualVertex.z());
+          nearestTrack = *seedtrkiter;
         }
       }
-      ATH_MSG_DEBUG(
-        VTAV(*actualcandidate).size()
-        << " tracks added to vertex candidate for IP significance less than "
-        << m_tracksMaxSignificance << " within " << m_TracksMaxZinterval
-        << " mm of seed position.");
-      //now consider to recovery from the case where no tracks were added to the vertex
-      if (VTAV(*actualcandidate).empty()) {
-        //you need to define a new seed (because the old one is probably in between two ones...)
-        double zdistance = 1e8;
-        const Trk::ITrackLink* nearestTrack = nullptr;
-        for (std::vector<const Trk::ITrackLink*>::const_iterator seedtrkiter = seedtrkbegin;
-             seedtrkiter != seedtrkend; ++seedtrkiter) {
-          if (std::fabs((*seedtrkiter)->parameters()->position()[Trk::z] - actualVertex.z()) < zdistance) {
-            zdistance = std::fabs((*seedtrkiter)->parameters()->position()[Trk::z] - actualVertex.z());
-            nearestTrack = *seedtrkiter;
-          }
-        }
-        if (nearestTrack) {
-          double newz = (nearestTrack->parameters())->position()[Trk::z];
-          xAOD::Vertex* oldcandidate = actualcandidate; // to placehold old pointers
-
-          actualVertex = Amg::Vector3D(0., 0., newz);
-          actualcandidate = new xAOD::Vertex();
-          actualcandidate->makePrivateStore();
-          actualcandidate->setVertexType(xAOD::VxType::NotSpecified);
-          // to mimic the initialization present in the old
-          // EDM constructor
-
-          // TODO: Think about where everything is deleted! Does Trk::MvfFitInfo
-          // destructor and do MVFVxTrackAtVertex
-          // destructors get called when actualcandidate gets deleted?
-          // now add decorations!
-          MvfFitInfo(*actualcandidate) = new Trk::MvfFitInfo(new xAOD::Vertex(*constraintVertex),
-                                                             new Amg::Vector3D(actualVertex),
-                                                             new Amg::Vector3D(actualVertex));
-          isInitialized(*actualcandidate) = false;
-          VTAV(*actualcandidate) = vector_of_tracks; // TODO: maybe needed before push_back?
-         
-          releaseCandidate(oldcandidate);
-
-          for (std::vector<const Trk::ITrackLink*>::const_iterator trkiter = trkbegin; trkiter != trkend; ++trkiter) {
-
-              if (std::fabs(estimateDeltaZ(*(*trkiter)->parameters(), actualVertex)) < m_TracksMaxZinterval) {
-              const double thisTracksSignificance = ipSignificance((*trkiter)->parameters(),&actualVertex); // calculate significance
-              if ( thisTracksSignificance<m_tracksMaxSignificance)
-              {
-                //accessing corresponding link to vertices
-                Trk::TrackToVtxLink* actuallink = TrackLinkOf[*trkiter];
-                std::vector<xAOD::Vertex*>* actualvtxlink = actuallink->vertices();
-                //adding vertex to candidates of track
-                actualvtxlink->push_back(actualcandidate);
-                ATH_MSG_VERBOSE("Adding an MVFVxTrackAtVertex with tracklink " << actuallink <<
-                                " to the vertex candidate VTAV decoration");
-                VTAV(*actualcandidate).push_back(new Trk::MVFVxTrackAtVertex((*trkiter)->clone(),
-                                                                             actuallink));
-              }
+      if (nearestTrack) {
+        double newz = (nearestTrack->parameters())->position()[Trk::z];
+        xAOD::Vertex* oldcandidate =
+          actualcandidate; // to placehold old pointers
+
+        actualVertex = Amg::Vector3D(0., 0., newz);
+        actualcandidate = new xAOD::Vertex();
+        actualcandidate->makePrivateStore();
+        actualcandidate->setVertexType(xAOD::VxType::NotSpecified);
+        // to mimic the initialization present in the old
+        // EDM constructor
+
+        // TODO: Think about where everything is deleted! Does Trk::MvfFitInfo
+        // destructor and do MVFVxTrackAtVertex
+        // destructors get called when actualcandidate gets deleted?
+        // now add decorations!
+        MvfFitInfo(*actualcandidate) =
+          new Trk::MvfFitInfo(new xAOD::Vertex(*constraintVertex),
+                              new Amg::Vector3D(actualVertex),
+                              new Amg::Vector3D(actualVertex));
+        isInitialized(*actualcandidate) = false;
+        VTAV(*actualcandidate) =
+          vector_of_tracks; // TODO: maybe needed before push_back?
+
+        releaseCandidate(oldcandidate);
+
+        for (std::vector<const Trk::ITrackLink*>::const_iterator trkiter =
+               trkbegin;
+             trkiter != trkend;
+             ++trkiter) {
+
+          if (std::fabs(estimateDeltaZ(*(*trkiter)->parameters(),
+                                       actualVertex)) < m_TracksMaxZinterval) {
+            const double thisTracksSignificance =
+              ipSignificance((*trkiter)->parameters(),
+                             &actualVertex); // calculate significance
+            if (thisTracksSignificance < m_tracksMaxSignificance) {
+              // accessing corresponding link to vertices
+              Trk::TrackToVtxLink* actuallink = TrackLinkOf[*trkiter];
+              std::vector<xAOD::Vertex*>* actualvtxlink =
+                actuallink->vertices();
+              // adding vertex to candidates of track
+              actualvtxlink->push_back(actualcandidate);
+              VTAV(*actualcandidate)
+                .push_back(
+                  new Trk::MVFVxTrackAtVertex((*trkiter)->clone(), actuallink));
             }
           }
+        }
 
-          if (VTAV(*actualcandidate).empty()) {
-            ATH_MSG_DEBUG("No tracks found near seed, while at least one track was expected.");
-            delete actualcandidate;
-            break;
-          }
-        } else {
-          ATH_MSG_DEBUG("Nearest track to seed is missing.");
+        if (VTAV(*actualcandidate).empty()) {
+          ATH_MSG_DEBUG("No tracks found near seed, while at least one track "
+                        "was expected.");
           delete actualcandidate;
           break;
         }
+      } else {
+        ATH_MSG_DEBUG("Nearest track to seed is missing.");
+        delete actualcandidate;
+        break;
       }
-      ATH_MSG_VERBOSE("Running addVtxTofit(); The current candidate has " << VTAV(*actualcandidate).size() <<
-                      " tracks in the vector");
-      m_MultiVertexFitter->addVtxTofit(actualcandidate);
-      ATH_MSG_DEBUG("After fit the current candidate has z: " << actualcandidate->position()[Trk::z]);
-      //get link to the tracks (they are now all properly in the std::vector<Trk::VxTrackAtVertex> of the xAOD::Vertex)
-      // TODO: maybe I shouldn't be using xAOD::Vertex vector at all for VxTrackAtVertex...
-      std::vector<Trk::VxTrackAtVertex*>::iterator trkAtVtxbegin = VTAV(*actualcandidate).begin();
-      std::vector<Trk::VxTrackAtVertex*>::iterator trkAtVtxend = VTAV(*actualcandidate).end();
-      //now check that there is at least one track added to the fit
-      //(this is not always the case because only tracks above a certain compatibility threshold are considered)
-      bool atleastonecompatibletrack = false;
-      int numberOfCompatibleTracks = 0;
-      for (std::vector<Trk::VxTrackAtVertex*>::iterator trkAtVtxIter = trkAtVtxbegin;
-           trkAtVtxIter != trkAtVtxend; ++trkAtVtxIter) {
-        ATH_MSG_VERBOSE("Compatibility: " << (*trkAtVtxIter)->vtxCompatibility() <<
-                        " weight " << (*trkAtVtxIter)->weight());
-        if (((*trkAtVtxIter)->vtxCompatibility() < m_maxVertexChi2 && m_useFastCompatibility) ||
-            ((*trkAtVtxIter)->weight() > m_minweight
-             && (*trkAtVtxIter)->trackQuality().chiSquared() < m_maxVertexChi2
-             && !m_useFastCompatibility)) {
-          const Trk::ITrackLink* foundTrack = nullptr;
-          for (std::vector<const Trk::ITrackLink*>::const_iterator seedtrkiter =
-                 seedtrkbegin; seedtrkiter != seedtrkend;
-               ++seedtrkiter) {
-            if ((*seedtrkiter)->parameters() == (*trkAtVtxIter)->trackOrParticleLink()->parameters()) {
-              foundTrack = *seedtrkiter;
-            }
+    }
+    m_MultiVertexFitter->addVtxTofit(actualcandidate);
+    ATH_MSG_DEBUG("After fit the current candidate has z: "
+                  << actualcandidate->position()[Trk::z]);
+    // get link to the tracks (they are now all properly in the
+    // std::vector<Trk::VxTrackAtVertex> of the xAOD::Vertex)
+    // TODO: maybe I shouldn't be using xAOD::Vertex vector at all for
+    // VxTrackAtVertex...
+    std::vector<Trk::VxTrackAtVertex*>::iterator trkAtVtxbegin =
+      VTAV(*actualcandidate).begin();
+    std::vector<Trk::VxTrackAtVertex*>::iterator trkAtVtxend =
+      VTAV(*actualcandidate).end();
+    // now check that there is at least one track added to the fit
+    //(this is not always the case because only tracks above a certain
+    //compatibility threshold are considered)
+    bool atleastonecompatibletrack = false;
+    int numberOfCompatibleTracks = 0;
+    for (std::vector<Trk::VxTrackAtVertex*>::iterator trkAtVtxIter =
+           trkAtVtxbegin;
+         trkAtVtxIter != trkAtVtxend;
+         ++trkAtVtxIter) {
+      if (((*trkAtVtxIter)->vtxCompatibility() < m_maxVertexChi2 &&
+           m_useFastCompatibility) ||
+          ((*trkAtVtxIter)->weight() > m_minweight &&
+           (*trkAtVtxIter)->trackQuality().chiSquared() < m_maxVertexChi2 &&
+           !m_useFastCompatibility)) {
+        const Trk::ITrackLink* foundTrack = nullptr;
+        for (std::vector<const Trk::ITrackLink*>::const_iterator seedtrkiter =
+               seedtrkbegin;
+             seedtrkiter != seedtrkend;
+             ++seedtrkiter) {
+          if ((*seedtrkiter)->parameters() ==
+              (*trkAtVtxIter)->trackOrParticleLink()->parameters()) {
+            foundTrack = *seedtrkiter;
           }
-          if (foundTrack != nullptr) {
-            atleastonecompatibletrack = true;
-            numberOfCompatibleTracks += 1;
-            ATH_MSG_VERBOSE("Found compatible track");
-            if (m_addSingleTrackVertices) {
-              if (m_useBeamConstraint) break;
-              if (numberOfCompatibleTracks > 1 && (!m_useBeamConstraint)) break;
-            } else {
-              if (numberOfCompatibleTracks > 1) break;
-            }
+        }
+        if (foundTrack != nullptr) {
+          atleastonecompatibletrack = true;
+          numberOfCompatibleTracks += 1;
+          if (m_addSingleTrackVertices) {
+            if (m_useBeamConstraint)
+              break;
+            if (numberOfCompatibleTracks > 1 && (!m_useBeamConstraint))
+              break;
+          } else {
+            if (numberOfCompatibleTracks > 1)
+              break;
           }
         }
       }
+    }
 
-      bool newVertexIsFine = false;
-      if (m_addSingleTrackVertices) {
-        if (m_useBeamConstraint) {
-          if (numberOfCompatibleTracks > 0) {
-            newVertexIsFine = true;
-          }
-        } else {
-          if (numberOfCompatibleTracks > 1) {
-            newVertexIsFine = true;
-          }
+    bool newVertexIsFine = false;
+    if (m_addSingleTrackVertices) {
+      if (m_useBeamConstraint) {
+        if (numberOfCompatibleTracks > 0) {
+          newVertexIsFine = true;
         }
       } else {
         if (numberOfCompatibleTracks > 1) {
           newVertexIsFine = true;
         }
       }
+    } else {
+      if (numberOfCompatibleTracks > 1) {
+        newVertexIsFine = true;
+      }
+    }
+    // this now should be so powerful to do everything by itself
+    // problem now is to delete the really compatible tracks to this fit from
+    // the tracks which still remain to be fitted
+    if (atleastonecompatibletrack) {
+      for (std::vector<Trk::VxTrackAtVertex*>::iterator trkAtVtxIter =
+             trkAtVtxbegin;
+           trkAtVtxIter != trkAtVtxend;
+           ++trkAtVtxIter) {
+        // for now using the compatibility at stage before end...
+        ATH_MSG_VERBOSE("The compatibility value of the track "
+                        << *trkAtVtxIter << " is "
+                        << (*trkAtVtxIter)->vtxCompatibility());
+        if (((*trkAtVtxIter)->vtxCompatibility() < m_maxVertexChi2 &&
+             m_useFastCompatibility) ||
+            ((*trkAtVtxIter)->weight() > m_minweight &&
+             (*trkAtVtxIter)->trackQuality().chiSquared() < m_maxVertexChi2 &&
+             !m_useFastCompatibility)) {
+          ATH_MSG_VERBOSE("Eliminating incompatible track");
 
-      ATH_MSG_VERBOSE("newVertexIsFine = " << newVertexIsFine);
-      //this now should be so powerful to do everything by itself
-      //problem now is to delete the really compatible tracks to this fit from the tracks
-      //which still remain to be fitted
-      if (atleastonecompatibletrack) {
-        for (std::vector<Trk::VxTrackAtVertex*>::iterator trkAtVtxIter = trkAtVtxbegin;
-             trkAtVtxIter != trkAtVtxend; ++trkAtVtxIter) {
-          //for now using the compatibility at stage before end...
-          ATH_MSG_VERBOSE("The compatibility value of the track " << *trkAtVtxIter <<
-                          " is " << (*trkAtVtxIter)->vtxCompatibility());
-          if (((*trkAtVtxIter)->vtxCompatibility() < m_maxVertexChi2 && m_useFastCompatibility) ||
-              ((*trkAtVtxIter)->weight() > m_minweight
-               && (*trkAtVtxIter)->trackQuality().chiSquared() < m_maxVertexChi2
-               && !m_useFastCompatibility)) {
-            ATH_MSG_VERBOSE("Eliminating incompatible track");
-
-            std::vector<const Trk::ITrackLink*>::iterator foundTrack = seedtrkend;
-            for (std::vector<const Trk::ITrackLink*>::iterator seedtrkiter = seedtrkbegin; seedtrkiter != seedtrkend;
-                 ++seedtrkiter) {
-              if ((*seedtrkiter)->parameters() == (*trkAtVtxIter)->trackOrParticleLink()->parameters()) {
-                foundTrack = seedtrkiter;
-              }
-            }
-            ATH_MSG_VERBOSE("Trying to find track now");
-            if (foundTrack != seedtrkend) {
-              ATH_MSG_VERBOSE("Track found: eliminating it");
-              seedTracks.erase(foundTrack);
-
-              //update end and begin??? should I? yes, he can copy, regenerate, you don't know!
-              seedtrkbegin = seedTracks.begin();
-              seedtrkend = seedTracks.end();
-
-              ATH_MSG_VERBOSE("Remaining seeds: " << seedTracks.size());
-            }
-          }
-        }
-      } else {//no compatible track found...
-        //in this case put out the highest seeding track which didn't give any good result...
-        double highestcompatibility = 0;
-        Trk::VxTrackAtVertex* trackHighestCompatibility = nullptr;
-
-        ATH_MSG_VERBOSE("Analyzing new vertex");
-
-        for (std::vector<Trk::VxTrackAtVertex*>::iterator trkAtVtxIter = trkAtVtxbegin;
-             trkAtVtxIter != trkAtVtxend; ++trkAtVtxIter) {
-          ATH_MSG_VERBOSE("Checking new track for compatibility");
-          const Trk::ITrackLink* foundTrack = nullptr;
-          for (std::vector<const Trk::ITrackLink*>::const_iterator seedtrkiter =
-                 seedtrkbegin; seedtrkiter != seedtrkend;
-               ++seedtrkiter) {
-            if ((*seedtrkiter)->parameters() == (*trkAtVtxIter)->trackOrParticleLink()->parameters()) {
-              foundTrack = *seedtrkiter;
-            }
-          }
-          if (foundTrack != nullptr) {
-            double compatibility = (*trkAtVtxIter)->vtxCompatibility();
-            ATH_MSG_VERBOSE("New track has compatibility: " << compatibility);
-            if (compatibility > highestcompatibility) {
-              highestcompatibility = compatibility;
-              trackHighestCompatibility = *trkAtVtxIter;
-            }
-          }
-        }
-        ATH_MSG_VERBOSE("Highest compatibility track:" << trackHighestCompatibility <<
-                        "with compatibility: " << highestcompatibility);
-        if (trackHighestCompatibility != nullptr) {
           std::vector<const Trk::ITrackLink*>::iterator foundTrack = seedtrkend;
-          for (std::vector<const Trk::ITrackLink*>::iterator seedtrkiter = seedtrkbegin; seedtrkiter != seedtrkend;
+          for (std::vector<const Trk::ITrackLink*>::iterator seedtrkiter =
+                 seedtrkbegin;
+               seedtrkiter != seedtrkend;
                ++seedtrkiter) {
-            if ((*seedtrkiter)->parameters() == trackHighestCompatibility->trackOrParticleLink()->parameters()) {
+            if ((*seedtrkiter)->parameters() ==
+                (*trkAtVtxIter)->trackOrParticleLink()->parameters()) {
               foundTrack = seedtrkiter;
             }
           }
+          ATH_MSG_VERBOSE("Trying to find track now");
           if (foundTrack != seedtrkend) {
+            ATH_MSG_VERBOSE("Track found: eliminating it");
             seedTracks.erase(foundTrack);
+
+            // update end and begin??? should I? yes, he can copy, regenerate,
+            // you don't know!
             seedtrkbegin = seedTracks.begin();
             seedtrkend = seedTracks.end();
-          } else {
-            ATH_MSG_FATAL("Cannot find previously determined track ");
-            throw;
+
+            ATH_MSG_VERBOSE("Remaining seeds: " << seedTracks.size());
           }
-        } else {
-          //alternative method: delete seed track nearest in z to the seed
-          double zdistance = 1e8;
-          const Trk::ITrackLink* nearestTrack = nullptr;
-          for (std::vector<const Trk::ITrackLink*>::const_iterator seedtrkiter = seedtrkbegin;
-               seedtrkiter != seedtrkend; ++seedtrkiter) {
-            if (std::fabs((*seedtrkiter)->parameters()->position()[Trk::z] - actualVertex.z()) < zdistance) {
-              zdistance = std::fabs((*seedtrkiter)->parameters()->position()[Trk::z] - actualVertex.z());
-              nearestTrack = *seedtrkiter;
-            }
+        }
+      }
+    } else { // no compatible track found...
+      // in this case put out the highest seeding track which didn't give any
+      // good result...
+      double highestcompatibility = 0;
+      Trk::VxTrackAtVertex* trackHighestCompatibility = nullptr;
+
+      ATH_MSG_VERBOSE("Analyzing new vertex");
+
+      for (std::vector<Trk::VxTrackAtVertex*>::iterator trkAtVtxIter =
+             trkAtVtxbegin;
+           trkAtVtxIter != trkAtVtxend;
+           ++trkAtVtxIter) {
+        ATH_MSG_VERBOSE("Checking new track for compatibility");
+        const Trk::ITrackLink* foundTrack = nullptr;
+        for (std::vector<const Trk::ITrackLink*>::const_iterator seedtrkiter =
+               seedtrkbegin;
+             seedtrkiter != seedtrkend;
+             ++seedtrkiter) {
+          if ((*seedtrkiter)->parameters() ==
+              (*trkAtVtxIter)->trackOrParticleLink()->parameters()) {
+            foundTrack = *seedtrkiter;
           }
-          if (nearestTrack != nullptr) {
-            std::vector<const Trk::ITrackLink*>::iterator foundTrackToDelete =
-              std::find(seedtrkbegin, seedtrkend, nearestTrack);
-            if (foundTrackToDelete != seedtrkend) {
-              seedTracks.erase(foundTrackToDelete);
-              seedtrkbegin = seedTracks.begin();
-              seedtrkend = seedTracks.end();
-            } else {
-              ATH_MSG_DEBUG("No nearest track found while it was expected.");
-              break;
-            }
-          } else {
-            ATH_MSG_DEBUG("No further seeding track was found (3 methods used) while it was expected.");
-            break;
+        }
+        if (foundTrack != nullptr) {
+          double compatibility = (*trkAtVtxIter)->vtxCompatibility();
+          ATH_MSG_VERBOSE("New track has compatibility: " << compatibility);
+          if (compatibility > highestcompatibility) {
+            highestcompatibility = compatibility;
+            trackHighestCompatibility = *trkAtVtxIter;
           }
         }
       }
-
-      ///////////////
-      //now break the cycle if you didn't diminish the number of seeds...
-      ATH_MSG_DEBUG("Remaining seeds: " << seedTracks.size() << " previous round " << seedtracknumber);
-      bool deleteLastVertex = false;
-      if (!newVertexIsFine) {
-        deleteLastVertex = true;
-        nNoCompatibleTracks++;
-        ATH_MSG_DEBUG("Vertex has no compatible tracks");
-      } else {
-        double contamination = 0.;
-        double contaminationNum = 0;
-        double contaminationDeNom = 0;
-        std::vector<Trk::VxTrackAtVertex*>::iterator TRKtrkbegin(VTAV(*actualcandidate).begin());
-        std::vector<Trk::VxTrackAtVertex*>::iterator TRKtrkend(VTAV(*actualcandidate).end());
-        for (std::vector<Trk::VxTrackAtVertex*>::iterator TRKtrkiter = TRKtrkbegin; TRKtrkiter != TRKtrkend;
-             ++TRKtrkiter) {
-          double trackWeight = (*TRKtrkiter)->weight();
-          contaminationNum += trackWeight * (1. - trackWeight);
-          contaminationDeNom += trackWeight * trackWeight;
+      if (trackHighestCompatibility != nullptr) {
+        std::vector<const Trk::ITrackLink*>::iterator foundTrack = seedtrkend;
+        for (std::vector<const Trk::ITrackLink*>::iterator seedtrkiter =
+               seedtrkbegin;
+             seedtrkiter != seedtrkend;
+             ++seedtrkiter) {
+          if ((*seedtrkiter)->parameters() ==
+              trackHighestCompatibility->trackOrParticleLink()->parameters()) {
+            foundTrack = seedtrkiter;
+          }
         }
-        if (contaminationDeNom > 0) {
-          contamination = contaminationNum / contaminationDeNom;
+        if (foundTrack != seedtrkend) {
+          seedTracks.erase(foundTrack);
+          seedtrkbegin = seedTracks.begin();
+          seedtrkend = seedTracks.end();
+        } else {
+          ATH_MSG_FATAL("Cannot find previously determined track ");
+          throw;
         }
-        if (contamination > m_maximumVertexContamination) {
-          ATH_MSG_VERBOSE(
-            "Contamination estimator " << contamination << " fails cut of " << m_maximumVertexContamination);
-          deleteLastVertex = true;
-          nContamintationCut++;
-          ATH_MSG_DEBUG("Vertex failed contamination cut");
+      } else {
+        // alternative method: delete seed track nearest in z to the seed
+        double zdistance = 1e8;
+        const Trk::ITrackLink* nearestTrack = nullptr;
+        for (std::vector<const Trk::ITrackLink*>::const_iterator seedtrkiter =
+               seedtrkbegin;
+             seedtrkiter != seedtrkend;
+             ++seedtrkiter) {
+          if (std::fabs((*seedtrkiter)->parameters()->position()[Trk::z] -
+                        actualVertex.z()) < zdistance) {
+            zdistance =
+              std::fabs((*seedtrkiter)->parameters()->position()[Trk::z] -
+                        actualVertex.z());
+            nearestTrack = *seedtrkiter;
+          }
         }
-        //now try to understand if the vertex was merged with another one...
-        const auto & candidatePosition = actualcandidate->position();
-        const auto & candidateZPosition = candidatePosition[Trk::z];
-        const auto & candidatePositionCovariance = actualcandidate->covariancePosition();
-        const auto & candidateZPositionCovariance = candidatePositionCovariance(Trk::z, Trk::z);
-        for (const auto & thisVertex: myxAODVertices) {
-          const auto & thisVertexPosition = (thisVertex.second)->position();
-          const auto & thisVertexZPosition = thisVertexPosition[Trk::z];
-          const auto & thisVertexPositionCovariance = thisVertex.second->covariancePosition();
-          const auto & thisVertexZPositionCovariance = thisVertexPositionCovariance(Trk::z, Trk::z);
-          const auto deltaPosition = thisVertexPosition - candidatePosition;
-          const auto deltaZPosition = thisVertexZPosition - candidateZPosition;
-          const auto sumZCovSq = thisVertexZPositionCovariance + candidateZPositionCovariance;
-          
-          ATH_MSG_VERBOSE("Estimating compatibility of z positions: " << thisVertexZPosition <<" and " << candidateZPosition);
-          //in case of no beam spot constraint you should use the full 3d significance on the distance
-          double dependence = 0;
-          if (!m_do3dSplitting) {
-            if (sumZCovSq > 0. ){
-              dependence = std::fabs(deltaZPosition) / std::sqrt(sumZCovSq);
-            } else {
-              dependence = 0.;
-            }
+        if (nearestTrack != nullptr) {
+          std::vector<const Trk::ITrackLink*>::iterator foundTrackToDelete =
+            std::find(seedtrkbegin, seedtrkend, nearestTrack);
+          if (foundTrackToDelete != seedtrkend) {
+            seedTracks.erase(foundTrackToDelete);
+            seedtrkbegin = seedTracks.begin();
+            seedtrkend = seedTracks.end();
           } else {
-            Amg::MatrixX sumCovariances = thisVertexPositionCovariance + candidatePositionCovariance;
-            sumCovariances = sumCovariances.inverse().eval();
-            Amg::Vector3D hepVectorPosition;
-            hepVectorPosition[0] = deltaPosition.x();
-            hepVectorPosition[1] = deltaPosition.y();
-            hepVectorPosition[2] = deltaPosition.z();
-            dependence = std::sqrt(hepVectorPosition.dot(sumCovariances * hepVectorPosition));
-          }
-          ATH_MSG_VERBOSE("Significance of vertex pair is: " << dependence << "vs. cut at " << m_cutVertexDependence);
-          if (dependence < m_cutVertexDependence) {
-            ATH_MSG_VERBOSE("Deleting last vertex since it was found to be merged with another!");
-            deleteLastVertex = true;
-            nWithin3sigma++;
-            ATH_MSG_DEBUG("Vertex failed significance (cut vertex dependence) test");
+            ATH_MSG_DEBUG("No nearest track found while it was expected.");
             break;
           }
+        } else {
+          ATH_MSG_DEBUG("No further seeding track was found (3 methods used) "
+                        "while it was expected.");
+          break;
         }
       }
-      ATH_MSG_VERBOSE("Decision to delete last vertex: " << deleteLastVertex);
-      ////////////
-      //Ok all tracks in seed were deleted. You can go ahead and discover further vertices...
-      //please clean the track to vertices links before (required by real multivertexfit)
-      if (deleteLastVertex) {
-        std::vector<Trk::VxTrackAtVertex*>::iterator MVFtrkAtVtxBegin = VTAV(*actualcandidate).begin();
-        std::vector<Trk::VxTrackAtVertex*>::iterator MVFtrkAtVtxEnd = VTAV(*actualcandidate).end();
-        for (std::vector<Trk::VxTrackAtVertex*>::iterator MVFtrkIterator = MVFtrkAtVtxBegin;
-             MVFtrkIterator != MVFtrkAtVtxEnd; ++MVFtrkIterator) {
-          ATH_MSG_VERBOSE("Deleting one vertex from tracklink " <<
-                          (static_cast<Trk::MVFVxTrackAtVertex*>(*MVFtrkIterator))->linkToVertices());
-          (static_cast<Trk::MVFVxTrackAtVertex*>(*MVFtrkIterator))->linkToVertices()->vertices()->pop_back();
+    }
+
+    ///////////////
+    // now break the cycle if you didn't diminish the number of seeds...
+    ATH_MSG_DEBUG("Remaining seeds: " << seedTracks.size() << " previous round "
+                                      << seedtracknumber);
+    bool deleteLastVertex = false;
+    if (!newVertexIsFine) {
+      deleteLastVertex = true;
+      nNoCompatibleTracks++;
+      ATH_MSG_DEBUG("Vertex has no compatible tracks");
+    } else {
+      double contamination = 0.;
+      double contaminationNum = 0;
+      double contaminationDeNom = 0;
+      std::vector<Trk::VxTrackAtVertex*>::iterator TRKtrkbegin(
+        VTAV(*actualcandidate).begin());
+      std::vector<Trk::VxTrackAtVertex*>::iterator TRKtrkend(
+        VTAV(*actualcandidate).end());
+      for (std::vector<Trk::VxTrackAtVertex*>::iterator TRKtrkiter =
+             TRKtrkbegin;
+           TRKtrkiter != TRKtrkend;
+           ++TRKtrkiter) {
+        double trackWeight = (*TRKtrkiter)->weight();
+        contaminationNum += trackWeight * (1. - trackWeight);
+        contaminationDeNom += trackWeight * trackWeight;
+      }
+      if (contaminationDeNom > 0) {
+        contamination = contaminationNum / contaminationDeNom;
+      }
+      if (contamination > m_maximumVertexContamination) {
+        deleteLastVertex = true;
+        nContamintationCut++;
+        ATH_MSG_DEBUG("Vertex failed contamination cut");
+      }
+      // now try to understand if the vertex was merged with another one...
+      const auto& candidatePosition = actualcandidate->position();
+      const auto& candidateZPosition = candidatePosition[Trk::z];
+      const auto& candidatePositionCovariance =
+        actualcandidate->covariancePosition();
+      const auto& candidateZPositionCovariance =
+        candidatePositionCovariance(Trk::z, Trk::z);
+      for (const auto& thisVertex : myxAODVertices) {
+        const auto& thisVertexPosition = (thisVertex.second)->position();
+        const auto& thisVertexZPosition = thisVertexPosition[Trk::z];
+        const auto& thisVertexPositionCovariance =
+          thisVertex.second->covariancePosition();
+        const auto& thisVertexZPositionCovariance =
+          thisVertexPositionCovariance(Trk::z, Trk::z);
+        const auto deltaPosition = thisVertexPosition - candidatePosition;
+        const auto deltaZPosition = thisVertexZPosition - candidateZPosition;
+        const auto sumZCovSq =
+          thisVertexZPositionCovariance + candidateZPositionCovariance;
+
+        // in case of no beam spot constraint you should use the full 3d
+        // significance on the distance
+        double dependence = 0;
+        if (!m_do3dSplitting) {
+          if (sumZCovSq > 0.) {
+            dependence = std::fabs(deltaZPosition) / std::sqrt(sumZCovSq);
+          } else {
+            dependence = 0.;
+          }
+        } else {
+          Amg::MatrixX sumCovariances =
+            thisVertexPositionCovariance + candidatePositionCovariance;
+          sumCovariances = sumCovariances.inverse().eval();
+          Amg::Vector3D hepVectorPosition;
+          hepVectorPosition[0] = deltaPosition.x();
+          hepVectorPosition[1] = deltaPosition.y();
+          hepVectorPosition[2] = deltaPosition.z();
+          dependence = std::sqrt(
+            hepVectorPosition.dot(sumCovariances * hepVectorPosition));
+        }
+        if (dependence < m_cutVertexDependence) {
+          deleteLastVertex = true;
+          nWithin3sigma++;
+          ATH_MSG_DEBUG(
+            "Vertex failed significance (cut vertex dependence) test");
+          break;
         }
-        seedtracknumber = seedTracks.size();
-        ATH_MSG_VERBOSE("Redoing fit after scrapping last vertex");
-        m_MultiVertexFitter->addVtxTofit(actualcandidate); // TODO: I think this is fine still, but think about it more
-        releaseCandidate(actualcandidate);
-      } else {
-        seedtracknumber = seedTracks.size();
-        ATH_MSG_VERBOSE("Storing new vertex with " << actualcandidate->vxTrackAtVertex().size() << " tracks");
-        myxAODVertices.emplace_back(0,actualcandidate);
       }
-    } while ((
-               (m_addSingleTrackVertices && !seedTracks.empty()) ||
-               ((!m_addSingleTrackVertices) && seedTracks.size() > 1))
-             && iteration < m_maxIterations);
-    if (iteration >= m_maxIterations) {
-      ATH_MSG_WARNING("Maximum number of iterations (" << m_maxIterations <<
-                      ") reached; to reconstruct more vertices, set maxIterations to a higher value.");
     }
+    ////////////
+    // Ok all tracks in seed were deleted. You can go ahead and discover further
+    // vertices... please clean the track to vertices links before (required by
+    // real multivertexfit)
+    if (deleteLastVertex) {
+      std::vector<Trk::VxTrackAtVertex*>::iterator MVFtrkAtVtxBegin =
+        VTAV(*actualcandidate).begin();
+      std::vector<Trk::VxTrackAtVertex*>::iterator MVFtrkAtVtxEnd =
+        VTAV(*actualcandidate).end();
+      for (std::vector<Trk::VxTrackAtVertex*>::iterator MVFtrkIterator =
+             MVFtrkAtVtxBegin;
+           MVFtrkIterator != MVFtrkAtVtxEnd;
+           ++MVFtrkIterator) {
+        (static_cast<Trk::MVFVxTrackAtVertex*>(*MVFtrkIterator))
+          ->linkToVertices()
+          ->vertices()
+          ->pop_back();
+      }
+      seedtracknumber = seedTracks.size();
+      m_MultiVertexFitter->addVtxTofit(
+        actualcandidate); // TODO: I think this is fine still, but think about
+                          // it more
+      releaseCandidate(actualcandidate);
+    } else {
+      seedtracknumber = seedTracks.size();
+      myxAODVertices.emplace_back(0, actualcandidate);
+    }
+  } while (((m_addSingleTrackVertices && !seedTracks.empty()) ||
+            ((!m_addSingleTrackVertices) && seedTracks.size() > 1)) &&
+           iteration < m_maxIterations);
+  if (iteration >= m_maxIterations) {
+    ATH_MSG_WARNING("Maximum number of iterations ("
+                    << m_maxIterations
+                    << ") reached; to reconstruct more vertices, set "
+                       "maxIterations to a higher value.");
+  }
 
-  ATH_MSG_DEBUG("Vertices deleted for no compatible tracks: " << nNoCompatibleTracks);
-  ATH_MSG_DEBUG("Vertices deleted for contamination cut: " << nContamintationCut);
-  ATH_MSG_DEBUG("Vertices deleted for proximity to previous: " << nWithin3sigma);
+  ATH_MSG_DEBUG(
+    "Vertices deleted for no compatible tracks: " << nNoCompatibleTracks);
+  ATH_MSG_DEBUG(
+    "Vertices deleted for contamination cut: " << nContamintationCut);
+  ATH_MSG_DEBUG(
+    "Vertices deleted for proximity to previous: " << nWithin3sigma);
 
   ATH_MSG_DEBUG("Primary vertex finding complete with "
                 << iteration << " iterations and " << myxAODVertices.size()
@@ -759,285 +851,352 @@ InDetAdaptiveMultiPriVxFinderTool::InDetAdaptiveMultiPriVxFinderTool(
          ++MVFtrkIter) {
       tracksOfVertex->push_back(**MVFtrkIter);
     }
+  }
+  // before filling the container, you have to decide what is your most probable
+  // signal vertex
+  for (std::vector<xAODVertex_pair>::iterator vtxIter = vtxBegin;
+       vtxIter != vtxEnd;
+       ++vtxIter) {
+    (*vtxIter).first = estimateSignalCompatibility((*vtxIter).second);
+  }
+  std::sort(myxAODVertices.begin(), myxAODVertices.end());
+  
+  if (myxAODVertices.empty()) {
+    ATH_MSG_WARNING(
+      "No vertices found: returning a place-holder at the beam spot center.");
+    xAOD::Vertex* beamspotCandidate = new xAOD::Vertex;
+    beamspotCandidate->makePrivateStore();
+    beamspotCandidate->setPosition(beamSpotHandle->beamVtx().position());
+    beamspotCandidate->setCovariancePosition(
+      beamSpotHandle->beamVtx().covariancePosition());
+    beamspotCandidate->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
+    // TODO: I don't need to set fitQuality too do I?
+    myxAODVertices.emplace_back(0, beamspotCandidate);
+  }
+  vtxBegin = myxAODVertices.begin();
+  vtxEnd = myxAODVertices.end();
+  for (std::vector<xAODVertex_pair>::const_iterator vtxIter = vtxBegin;
+       vtxIter != vtxEnd;
+       ++vtxIter) {
+    xAOD::Vertex* cand = vtxIter->second;
+    std::vector<Trk::VxTrackAtVertex*>::iterator MVFtrkBegin =
+      VTAV(*cand).begin();
+    std::vector<Trk::VxTrackAtVertex*>::iterator MVFtrkEnd = VTAV(*cand).end();
+    // TODO: here, I must clean up VTAV decoration separately from vector of
+    // VxTrackAtVertex
+    for (std::vector<Trk::VxTrackAtVertex*>::iterator MVFtrkIter = MVFtrkBegin;
+         MVFtrkIter != MVFtrkEnd;
+         ++MVFtrkIter) {
+      // setting link to TrackToVtxLink to 0 (all TrackToVtxLink will be deleted
+      // some lines later)
+      (static_cast<Trk::MVFVxTrackAtVertex*>(*MVFtrkIter))
+        ->setLinkToVertices(nullptr);
+      delete *MVFtrkIter;
+      *MVFtrkIter = 0;
     }
-    //before filling the container, you have to decide what is your most probable signal vertex
-    for (std::vector<xAODVertex_pair>::iterator vtxIter = vtxBegin; vtxIter != vtxEnd; ++vtxIter) {
-      (*vtxIter).first = estimateSignalCompatibility((*vtxIter).second);
-    }
-    std::sort(myxAODVertices.begin(), myxAODVertices.end());
-    if (msgLvl(MSG::VERBOSE)) {
-      ATH_MSG_VERBOSE("Vertex positions after sorting");
-      for (std::vector<xAODVertex_pair>::iterator vtxIter = vtxBegin; vtxIter != vtxEnd; ++vtxIter) {
-        ATH_MSG_VERBOSE("z position: " << (*vtxIter).second->position().z());
-      }
-    }
-    if (myxAODVertices.empty()) {
-      ATH_MSG_WARNING("No vertices found: returning a place-holder at the beam spot center.");
-      xAOD::Vertex* beamspotCandidate = new xAOD::Vertex;
-      beamspotCandidate->makePrivateStore();
-      beamspotCandidate->setPosition(beamSpotHandle->beamVtx().position());
-      beamspotCandidate->setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-      beamspotCandidate->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-      // TODO: I don't need to set fitQuality too do I?
-      myxAODVertices.emplace_back(0, beamspotCandidate);
-    }
-    vtxBegin = myxAODVertices.begin();
-    vtxEnd = myxAODVertices.end();
-    for (std::vector<xAODVertex_pair>::const_iterator vtxIter = vtxBegin; vtxIter != vtxEnd; ++vtxIter) {
-      xAOD::Vertex* cand = vtxIter->second;
-      std::vector<Trk::VxTrackAtVertex*>::iterator MVFtrkBegin = VTAV(*cand).begin();
-      std::vector<Trk::VxTrackAtVertex*>::iterator MVFtrkEnd = VTAV(*cand).end();
-      // TODO: here, I must clean up VTAV decoration separately from vector of VxTrackAtVertex
-      for (std::vector<Trk::VxTrackAtVertex*>::iterator MVFtrkIter = MVFtrkBegin; MVFtrkIter != MVFtrkEnd;
-           ++MVFtrkIter) {
-        //setting link to TrackToVtxLink to 0 (all TrackToVtxLink will be deleted some lines later)
-        (static_cast<Trk::MVFVxTrackAtVertex*>(*MVFtrkIter))->setLinkToVertices(nullptr);
-        delete *MVFtrkIter;
-        *MVFtrkIter = 0;
-      }
-      //delete VTAV( *cand );
-      delete MvfFitInfo(*cand);
-      std::vector<Trk::VxTrackAtVertex>::iterator trkAtVtxBegin = cand->vxTrackAtVertex().begin();
-      std::vector<Trk::VxTrackAtVertex>::iterator trkAtVtxEnd = cand->vxTrackAtVertex().end();
-      for (std::vector<Trk::VxTrackAtVertex>::iterator trkAtVtxIter = trkAtVtxBegin; trkAtVtxIter != trkAtVtxEnd; ) 
-      {
-        //cleaning up incompatible vertices
-        if (((*trkAtVtxIter).vtxCompatibility() > m_maxVertexChi2 && m_useFastCompatibility) ||
-            (((*trkAtVtxIter).weight() < m_minweight
-              || (*trkAtVtxIter).trackQuality().chiSquared() > m_maxVertexChi2)
-             && !m_useFastCompatibility)) {
-          trkAtVtxIter = cand->vxTrackAtVertex().erase(trkAtVtxIter);
-          trkAtVtxEnd = cand->vxTrackAtVertex().end();
-        } else {
-          ++trkAtVtxIter;
-        }
-      }
-      theVertexContainer->push_back(cand);
-    }
-    // If track links are to xAOD::TrackParticles, set the links directly in xAOD::Vertex with their weights
-    // Needed for weight calculator in sorting tool
-    xAOD::VertexContainer::iterator vxBegin = theVertexContainer->begin();
-    xAOD::VertexContainer::iterator vxEnd = theVertexContainer->end();
-    for (xAOD::VertexContainer::iterator vxIter = vxBegin; vxIter != vxEnd; ++vxIter) {
-      std::vector<Trk::VxTrackAtVertex>* myVxTracksAtVtx = &((*vxIter)->vxTrackAtVertex());
-      if (!myVxTracksAtVtx) continue;
-      std::vector<Trk::VxTrackAtVertex>::iterator tracksBegin = myVxTracksAtVtx->begin();
-      std::vector<Trk::VxTrackAtVertex>::iterator tracksEnd = myVxTracksAtVtx->end();
-      for (std::vector<Trk::VxTrackAtVertex>::iterator tracksIter = tracksBegin;
-           tracksIter != tracksEnd; ++tracksIter) {
-        // only set link if track link is to an xAOD::TrackParticle
-        Trk::LinkToXAODTrackParticle* linkToXAODTP =
-          dynamic_cast<Trk::LinkToXAODTrackParticle*>((*tracksIter).trackOrParticleLink());
-        if (linkToXAODTP) {
-          ATH_MSG_VERBOSE("Iterating over new vertex in fixing xAOD::TrackParticle links... ");
-          (*vxIter)->addTrackAtVertex(*linkToXAODTP, (*tracksIter).weight());
-        } 
+    // delete VTAV( *cand );
+    delete MvfFitInfo(*cand);
+    std::vector<Trk::VxTrackAtVertex>::iterator trkAtVtxBegin =
+      cand->vxTrackAtVertex().begin();
+    std::vector<Trk::VxTrackAtVertex>::iterator trkAtVtxEnd =
+      cand->vxTrackAtVertex().end();
+    for (std::vector<Trk::VxTrackAtVertex>::iterator trkAtVtxIter =
+           trkAtVtxBegin;
+         trkAtVtxIter != trkAtVtxEnd;) {
+      // cleaning up incompatible vertices
+      if (((*trkAtVtxIter).vtxCompatibility() > m_maxVertexChi2 &&
+           m_useFastCompatibility) ||
+          (((*trkAtVtxIter).weight() < m_minweight ||
+            (*trkAtVtxIter).trackQuality().chiSquared() > m_maxVertexChi2) &&
+           !m_useFastCompatibility)) {
+        trkAtVtxIter = cand->vxTrackAtVertex().erase(trkAtVtxIter);
+        trkAtVtxEnd = cand->vxTrackAtVertex().end();
+      } else {
+        ++trkAtVtxIter;
       }
     }
-    std::vector<Trk::TrackToVtxLink*>::iterator begin = myTrackToVtxLinks.begin();
-    std::vector<Trk::TrackToVtxLink*>::iterator end = myTrackToVtxLinks.end();
-    //delete all TrackToVtxLink objects
-    for (std::vector<Trk::TrackToVtxLink*>::iterator iterator = begin; iterator != end; ++iterator) {
-      delete *iterator;
-    }
-    //---- add dummy vertex at the end ------------------------------------------------------//
-    //---- if one or more vertices are already there: let dummy have same position as primary vertex
-    if (!theVertexContainer->empty()) {
-      xAOD::Vertex* primaryVtx = theVertexContainer->front();
-      if (!primaryVtx->vxTrackAtVertex().empty()) {
-        primaryVtx->setVertexType(xAOD::VxType::PriVtx);
-        xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
-        theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its
-                                                        // aux store
-        dummyxAODVertex->setPosition(primaryVtx->position());
-        dummyxAODVertex->setCovariancePosition(primaryVtx->covariancePosition());
-        dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-        dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
-      } else {
-        primaryVtx->setVertexType(xAOD::VxType::NoVtx);
+    theVertexContainer->push_back(cand);
+  }
+  // If track links are to xAOD::TrackParticles, set the links directly in
+  // xAOD::Vertex with their weights Needed for weight calculator in sorting
+  // tool
+  xAOD::VertexContainer::iterator vxBegin = theVertexContainer->begin();
+  xAOD::VertexContainer::iterator vxEnd = theVertexContainer->end();
+  for (xAOD::VertexContainer::iterator vxIter = vxBegin; vxIter != vxEnd;
+       ++vxIter) {
+    std::vector<Trk::VxTrackAtVertex>* myVxTracksAtVtx =
+      &((*vxIter)->vxTrackAtVertex());
+    if (!myVxTracksAtVtx)
+      continue;
+    std::vector<Trk::VxTrackAtVertex>::iterator tracksBegin =
+      myVxTracksAtVtx->begin();
+    std::vector<Trk::VxTrackAtVertex>::iterator tracksEnd =
+      myVxTracksAtVtx->end();
+    for (std::vector<Trk::VxTrackAtVertex>::iterator tracksIter = tracksBegin;
+         tracksIter != tracksEnd;
+         ++tracksIter) {
+
+      // only set link if track link is to an xAOD::TrackParticle
+
+      // why do we need dynamic_cast here?
+      Trk::LinkToXAODTrackParticle* linkToXAODTP =
+        dynamic_cast<Trk::LinkToXAODTrackParticle*>(
+          (*tracksIter).trackOrParticleLink());
+      if (linkToXAODTP) {
+        ATH_MSG_VERBOSE(
+          "Iterating over new vertex in fixing xAOD::TrackParticle links... ");
+        (*vxIter)->addTrackAtVertex(*linkToXAODTP, (*tracksIter).weight());
       }
     }
-    //---- if no vertex is there let dummy be at beam spot
-    else if (theVertexContainer->empty()) {
+  }
+  std::vector<Trk::TrackToVtxLink*>::iterator begin = myTrackToVtxLinks.begin();
+  std::vector<Trk::TrackToVtxLink*>::iterator end = myTrackToVtxLinks.end();
+  // delete all TrackToVtxLink objects
+  for (std::vector<Trk::TrackToVtxLink*>::iterator iterator = begin;
+       iterator != end;
+       ++iterator) {
+    delete *iterator;
+  }
+  //---- add dummy vertex at the end
+  //------------------------------------------------------//
+  //---- if one or more vertices are already there: let dummy have same position
+  //as primary vertex
+  if (!theVertexContainer->empty()) {
+    xAOD::Vertex* primaryVtx = theVertexContainer->front();
+    if (!primaryVtx->vxTrackAtVertex().empty()) {
+      primaryVtx->setVertexType(xAOD::VxType::PriVtx);
       xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
-      theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its
-                                                      // aux store
-      dummyxAODVertex->setPosition(beamSpotHandle->beamVtx().position());
-      dummyxAODVertex->setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
+      theVertexContainer->push_back(
+        dummyxAODVertex); // have to add vertex to container here first so it
+                          // can use its aux store
+      dummyxAODVertex->setPosition(primaryVtx->position());
+      dummyxAODVertex->setCovariancePosition(primaryVtx->covariancePosition());
       dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
       dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
+    } else {
+      primaryVtx->setVertexType(xAOD::VxType::NoVtx);
     }
-    // loop over the pile up to set it as pile up (EXCLUDE first and last vertex: loop from 1 to size-1)
-    for (unsigned int i = 0; i < theVertexContainer->size() - 1; i++) {
-      if (i > 0) {
-        (*theVertexContainer)[i]->setVertexType(xAOD::VxType::PileUp);
-      }
-      ATH_MSG_VERBOSE("Vertex at z =" << (*theVertexContainer)[i]->position().z() <<
-                      " with ntracks: " << (*theVertexContainer)[i]->vxTrackAtVertex().size());
+  }
+  //---- if no vertex is there let dummy be at beam spot
+  else if (theVertexContainer->empty()) {
+    xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
+    theVertexContainer->push_back(
+      dummyxAODVertex); // have to add vertex to container here first so it can
+                        // use its aux store
+    dummyxAODVertex->setPosition(beamSpotHandle->beamVtx().position());
+    dummyxAODVertex->setCovariancePosition(
+      beamSpotHandle->beamVtx().covariancePosition());
+    dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
+    dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
+  }
+  // loop over the pile up to set it as pile up (EXCLUDE first and last vertex:
+  // loop from 1 to size-1)
+  for (unsigned int i = 0; i < theVertexContainer->size() - 1; i++) {
+    if (i > 0) {
+      (*theVertexContainer)[i]->setVertexType(xAOD::VxType::PileUp);
     }
-    return std::make_pair(theVertexContainer, theVertexAuxContainer);
+    ATH_MSG_VERBOSE("Vertex at z ="
+                    << (*theVertexContainer)[i]->position().z()
+                    << " with ntracks: "
+                    << (*theVertexContainer)[i]->vxTrackAtVertex().size());
   }
+  return std::make_pair(theVertexContainer, theVertexAuxContainer);
+}
 
-  double
-  InDetAdaptiveMultiPriVxFinderTool::estimateSignalCompatibility(xAOD::Vertex* mycand) const{
-    // TODO: put this in a better place
-    // Prepare objects holding the decoration of xAOD::Vertex with MVF auxdata
-    // For optimization of access speed
-    static const xAOD::Vertex::Decorator<std::vector<Trk::VxTrackAtVertex*>>
-      VTAV("VTAV");
-
-    std::vector<Trk::VxTrackAtVertex*>::iterator begintracks = VTAV(*mycand).begin();
-    std::vector<Trk::VxTrackAtVertex*>::iterator endtracks = VTAV(*mycand).end();
-
-    if (m_selectiontype == 0) {
-      //use just sum over pt squared
-      //first get all the variables you need for to discriminate between signal and minimum bias event
-
-      double total_pt_squared = 0;
-      int total_num_tracks = 0;
-
-      for (std::vector<Trk::VxTrackAtVertex*>::iterator i = begintracks; i != endtracks; i++) {
-        ATH_MSG_VERBOSE("Compatibility is: " << (*i)->vtxCompatibility() <<
-                        " and chi^2 is: " << (*i)->trackQuality().chiSquared());
-
-        if (((*i)->vtxCompatibility() < m_finalCutMaxVertexChi2 && m_useFastCompatibility) ||
-            ((*i)->weight() > m_minweight
-             && (*i)->trackQuality().chiSquared() < m_finalCutMaxVertexChi2
-             && !m_useFastCompatibility)) {
-          const Trk::TrackParameters* perigee(nullptr);
-          if ((*i)->perigeeAtVertex() != nullptr) {
-            perigee = (*i)->perigeeAtVertex();
-          } else {
-            ATH_MSG_VERBOSE("Only initialPerigee is available");
-            perigee = (*i)->initialPerigee();
-          }
-          if (perigee == nullptr) {
-            ATH_MSG_ERROR("Neutrals are not supported. Skipping track in pT calculation...");
-            continue;
-          }
-          total_pt_squared +=
-            std::pow(std::fabs(1. / perigee->parameters()[Trk::qOverP]) *
-                       sin(perigee->parameters()[Trk::theta]),2);
-          total_num_tracks += 1;
+double
+InDetAdaptiveMultiPriVxFinderTool::estimateSignalCompatibility(
+  xAOD::Vertex* mycand) const
+{
+  // TODO: put this in a better place
+  // Prepare objects holding the decoration of xAOD::Vertex with MVF auxdata
+  // For optimization of access speed
+  static const xAOD::Vertex::Decorator<std::vector<Trk::VxTrackAtVertex*>> VTAV(
+    "VTAV");
+
+  std::vector<Trk::VxTrackAtVertex*>::iterator begintracks =
+    VTAV(*mycand).begin();
+  std::vector<Trk::VxTrackAtVertex*>::iterator endtracks = VTAV(*mycand).end();
+
+  if (m_selectiontype == 0) {
+    // use just sum over pt squared
+    // first get all the variables you need for to discriminate between signal
+    // and minimum bias event
+
+    double total_pt_squared = 0;
+    int total_num_tracks = 0;
+
+    for (std::vector<Trk::VxTrackAtVertex*>::iterator i = begintracks;
+         i != endtracks;
+         i++) {
+
+      if (((*i)->vtxCompatibility() < m_finalCutMaxVertexChi2 &&
+           m_useFastCompatibility) ||
+          ((*i)->weight() > m_minweight &&
+           (*i)->trackQuality().chiSquared() < m_finalCutMaxVertexChi2 &&
+           !m_useFastCompatibility)) {
+        const Trk::TrackParameters* perigee(nullptr);
+        if ((*i)->perigeeAtVertex() != nullptr) {
+          perigee = (*i)->perigeeAtVertex();
+        } else {
+          perigee = (*i)->initialPerigee();
         }
-      }//finishing iterating on VxTrackAtVertex associated to **vtxIter xAOD::Vertex
-
-      return total_pt_squared * std::sqrt((double) total_num_tracks);
-    } if (m_selectiontype == 1) {//use NN
-      ATH_MSG_WARNING("Only Selection Type 0 supported for MT");
-    }
-    return 0;
-  }
+        if (perigee == nullptr) {
+          ATH_MSG_ERROR(
+            "Neutrals are not supported. Skipping track in pT calculation...");
+          continue;
+        }
+        total_pt_squared +=
+          std::pow(std::fabs(1. / perigee->parameters()[Trk::qOverP]) *
+                     sin(perigee->parameters()[Trk::theta]),
+                   2);
+        total_num_tracks += 1;
+      }
+    } // finishing iterating on VxTrackAtVertex associated to **vtxIter
+      // xAOD::Vertex
 
-  StatusCode
-  InDetAdaptiveMultiPriVxFinderTool::finalize() {
-    return StatusCode::SUCCESS;
+    return total_pt_squared * std::sqrt((double)total_num_tracks);
   }
-
-  void
-  InDetAdaptiveMultiPriVxFinderTool::printParameterSettings() {
-    ATH_MSG_DEBUG("Adaptive Multi-Vertex Finder: Parameter settings ");
-    ATH_MSG_DEBUG("Trackselection cuts handled by the TrackSelectorTool: " << m_trkFilter);
-    ATH_MSG_DEBUG("Finder settings: ");
-    ATH_MSG_DEBUG(
-      "Maximum distance to include track in simultaneous vertex fits: TracksMaxZinterval " << m_TracksMaxZinterval);
-    ATH_MSG_DEBUG("Seeding: minimum chi^2 for a track being an outlier:  maxVertexChi2 " << m_maxVertexChi2);
-    ATH_MSG_DEBUG("Signal identification: final cut on track chi2: finalCutMaxVertexChi2 = " <<
-    m_finalCutMaxVertexChi2);
-    ATH_MSG_DEBUG("Activate complete multi vertex fitting feature: realMultiVertex " << m_realMultiVertex);
-    ATH_MSG_DEBUG("Merging vertices: upper cut on significance to merge two vertices: cutVertexDependence = " <<
-                  m_cutVertexDependence);
-    ATH_MSG_DEBUG("Maximum number of iterations (and vertices): maxIterations = " << m_maxIterations);
-    ATH_MSG_DEBUG("Selection type (0 is sqrt(Ntr)*Sum_{tr} pT^2): selectiontype = " << m_selectiontype);
-    ATH_MSG_DEBUG("Use fast compatibility (if false use refitted chi2 instead of approximation): useFastCompatibility = " <<
-                  m_useFastCompatibility);
-    ATH_MSG_DEBUG("MinWeight (if track weight in the fit is lower, don't perform the Kalman Update) = " << m_minweight);
-    ATH_MSG_DEBUG("");
+  if (m_selectiontype == 1) { // use NN
+    ATH_MSG_WARNING("Only Selection Type 0 supported for MT");
   }
+  return 0;
+}
 
-  void
-  InDetAdaptiveMultiPriVxFinderTool::SGError(const std::string& errService) {
-    ATH_MSG_FATAL(errService << " not found. Exiting !");
-  }
+StatusCode
+InDetAdaptiveMultiPriVxFinderTool::finalize()
+{
+  return StatusCode::SUCCESS;
+}
 
-  double
-  InDetAdaptiveMultiPriVxFinderTool::estimateDeltaZ(const Trk::TrackParameters& myPerigee,
-                                                    const Amg::Vector3D& myTransvVertex) const {
-    Amg::Vector3D lp = myTransvVertex;
-
-    Amg::Vector3D expPoint;
-    Amg::Vector3D predStatePosition = myPerigee.position();
-    expPoint[0] = predStatePosition.x();
-    expPoint[1] = predStatePosition.y();
-    expPoint[2] = predStatePosition.z();
-
-    //phi_v and functions
-    double phi_v = myPerigee.parameters()[Trk::phi];
-    double th = myPerigee.parameters()[Trk::theta];
-    double tan_th = std::tan(th);
-    double sin_phi_v = std::sin(phi_v);
-    double cos_phi_v = std::cos(phi_v);
-    double q_ov_p = myPerigee.parameters()[Trk::qOverP];
-
-    //momentum
-    Amg::Vector3D expMomentum;
-    expMomentum[0] = phi_v;
-    expMomentum[1] = th;
-    expMomentum[2] = q_ov_p;
-
-    double X = expPoint[0] - lp.x();
-    double Y = expPoint[1] - lp.y();
-
-    return expPoint[2] - lp.z() - 1. / tan_th * (X * cos_phi_v + Y * sin_phi_v);
-  }
+void
+InDetAdaptiveMultiPriVxFinderTool::printParameterSettings()
+{
+  ATH_MSG_DEBUG("Adaptive Multi-Vertex Finder: Parameter settings ");
+  ATH_MSG_DEBUG(
+    "Trackselection cuts handled by the TrackSelectorTool: " << m_trkFilter);
+  ATH_MSG_DEBUG("Finder settings: ");
+  ATH_MSG_DEBUG("Maximum distance to include track in simultaneous vertex "
+                "fits: TracksMaxZinterval "
+                << m_TracksMaxZinterval);
+  ATH_MSG_DEBUG(
+    "Seeding: minimum chi^2 for a track being an outlier:  maxVertexChi2 "
+    << m_maxVertexChi2);
+  ATH_MSG_DEBUG(
+    "Signal identification: final cut on track chi2: finalCutMaxVertexChi2 = "
+    << m_finalCutMaxVertexChi2);
+  ATH_MSG_DEBUG(
+    "Activate complete multi vertex fitting feature: realMultiVertex "
+    << m_realMultiVertex);
+  ATH_MSG_DEBUG("Merging vertices: upper cut on significance to merge two "
+                "vertices: cutVertexDependence = "
+                << m_cutVertexDependence);
+  ATH_MSG_DEBUG("Maximum number of iterations (and vertices): maxIterations = "
+                << m_maxIterations);
+  ATH_MSG_DEBUG(
+    "Selection type (0 is sqrt(Ntr)*Sum_{tr} pT^2): selectiontype = "
+    << m_selectiontype);
+  ATH_MSG_DEBUG("Use fast compatibility (if false use refitted chi2 instead of "
+                "approximation): useFastCompatibility = "
+                << m_useFastCompatibility);
+  ATH_MSG_DEBUG("MinWeight (if track weight in the fit is lower, don't perform "
+                "the Kalman Update) = "
+                << m_minweight);
+  ATH_MSG_DEBUG("");
+}
+
+void
+InDetAdaptiveMultiPriVxFinderTool::SGError(const std::string& errService)
+{
+  ATH_MSG_FATAL(errService << " not found. Exiting !");
+}
 
-  double InDetAdaptiveMultiPriVxFinderTool::ipSignificance( const Trk::TrackParameters* params, 
-                                                 const Amg::Vector3D * vertex ) const
-  {
-    xAOD::Vertex v;
-    v.makePrivateStore();
-    v.setPosition(*vertex);
-    v.setCovariancePosition(AmgSymMatrix(3)::Zero(3,3));
-    v.setFitQuality(0., 0.);
-
-    double significance = 0.0;
-    const Trk::ImpactParametersAndSigma* ipas = m_ipEstimator->estimate( params, &v );
-    if ( ipas != nullptr )
-    {  
-      if ( ipas->sigmad0 > 0 && ipas->sigmaz0 > 0)
-      {
-        significance = std::sqrt(std::pow(ipas->IPd0 / ipas->sigmad0, 2) +
-                                 std::pow(ipas->IPz0 / ipas->sigmaz0, 2));
-      }
-      delete ipas;
+double
+InDetAdaptiveMultiPriVxFinderTool::estimateDeltaZ(
+  const Trk::TrackParameters& myPerigee,
+  const Amg::Vector3D& myTransvVertex) const
+{
+  Amg::Vector3D lp = myTransvVertex;
+
+  Amg::Vector3D expPoint;
+  Amg::Vector3D predStatePosition = myPerigee.position();
+  expPoint[0] = predStatePosition.x();
+  expPoint[1] = predStatePosition.y();
+  expPoint[2] = predStatePosition.z();
+
+  // phi_v and functions
+  double phi_v = myPerigee.parameters()[Trk::phi];
+  double th = myPerigee.parameters()[Trk::theta];
+  double tan_th = std::tan(th);
+  double sin_phi_v = std::sin(phi_v);
+  double cos_phi_v = std::cos(phi_v);
+  double q_ov_p = myPerigee.parameters()[Trk::qOverP];
+
+  // momentum
+  Amg::Vector3D expMomentum;
+  expMomentum[0] = phi_v;
+  expMomentum[1] = th;
+  expMomentum[2] = q_ov_p;
+
+  double X = expPoint[0] - lp.x();
+  double Y = expPoint[1] - lp.y();
+
+  return expPoint[2] - lp.z() - 1. / tan_th * (X * cos_phi_v + Y * sin_phi_v);
+}
+
+double
+InDetAdaptiveMultiPriVxFinderTool::ipSignificance(
+  const Trk::TrackParameters* params,
+  const Amg::Vector3D* vertex) const
+{
+  xAOD::Vertex v;
+  v.makePrivateStore();
+  v.setPosition(*vertex);
+  v.setCovariancePosition(AmgSymMatrix(3)::Zero(3, 3));
+  v.setFitQuality(0., 0.);
+
+  double significance = 0.0;
+  const Trk::ImpactParametersAndSigma* ipas =
+    m_ipEstimator->estimate(params, &v);
+  if (ipas != nullptr) {
+    if (ipas->sigmad0 > 0 && ipas->sigmaz0 > 0) {
+      significance = std::sqrt(std::pow(ipas->IPd0 / ipas->sigmad0, 2) +
+                               std::pow(ipas->IPz0 / ipas->sigmaz0, 2));
     }
-    return significance;
+    delete ipas;
   }
+  return significance;
+}
 
-  void
-  InDetAdaptiveMultiPriVxFinderTool::releaseCandidate(xAOD::Vertex*& candidate) const {
-    if (candidate == nullptr) return;
-
-    // decorators
-    static const xAOD::Vertex::Decorator< Trk::MvfFitInfo* > MvfFitInfo("MvfFitInfo");
-    static const xAOD::Vertex::Decorator< std::vector< Trk::VxTrackAtVertex* > > VTAV("VTAV");
-
-    if (VTAV.isAvailable(*candidate)) {
-      for (auto tav : VTAV(*candidate)) {
-        if (tav == nullptr) continue;
-        (static_cast<Trk::MVFVxTrackAtVertex*>(tav))->setLinkToVertices(nullptr);
-        delete tav;
-        tav = nullptr;
-      }
-      VTAV(*candidate).clear();
-    }
-
-    if (MvfFitInfo.isAvailable(*candidate) && MvfFitInfo(*candidate) != nullptr) {
-      delete MvfFitInfo(*candidate);
-      MvfFitInfo(*candidate) = nullptr;
+void
+InDetAdaptiveMultiPriVxFinderTool::releaseCandidate(
+  xAOD::Vertex*& candidate) const
+{
+  if (candidate == nullptr)
+    return;
+
+  // decorators
+  static const xAOD::Vertex::Decorator<Trk::MvfFitInfo*> MvfFitInfo(
+    "MvfFitInfo");
+  static const xAOD::Vertex::Decorator<std::vector<Trk::VxTrackAtVertex*>> VTAV(
+    "VTAV");
+
+  if (VTAV.isAvailable(*candidate)) {
+    for (auto tav : VTAV(*candidate)) {
+      if (tav == nullptr)
+        continue;
+      (static_cast<Trk::MVFVxTrackAtVertex*>(tav))->setLinkToVertices(nullptr);
+      delete tav;
+      tav = nullptr;
     }
+    VTAV(*candidate).clear();
+  }
 
-    delete candidate;
-    candidate = nullptr;
+  if (MvfFitInfo.isAvailable(*candidate) && MvfFitInfo(*candidate) != nullptr) {
+    delete MvfFitInfo(*candidate);
+    MvfFitInfo(*candidate) = nullptr;
   }
+
+  delete candidate;
+  candidate = nullptr;
+}
 } // end namespace InDet
diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx
index 911eba162a5f8424d255496671b8c771833a7eb1..4c2e0c0f21edf79ecf258d39f4168fb3a9644b1d 100755
--- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx
@@ -10,159 +10,157 @@
     changes :
               2016-04-26   David Shope <david.richard.shope@cern.ch>
               EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex
-
-                findVertex will now always return an xAOD::VertexContainer,
-                even when using a TrackCollection.
-                as input.
+              findVertex will now always return an xAOD::VertexContainer,
+              even when using a TrackCollection.
+              as input.
 ***************************************************************************/
 #include "InDetPriVxFinderTool/InDetIterativePriVxFinderTool.h"
-#include "CLHEP/Matrix/SymMatrix.h"
-#include "CLHEP/Matrix/Vector.h"
-#include "TrkTrack/Track.h"
-#include "TrkEventPrimitives/FitQuality.h"
-#include "TrkTrackSummary/TrackSummary.h"
-#include "TrkParameters/TrackParameters.h"
-#include "TrkEventPrimitives/ParamDefs.h"
-#include <map>
-#include <vector>
-#include <utility>
-#include "TrkSurfaces/PlaneSurface.h"
 #include "EventPrimitives/EventPrimitives.h"
 #include "EventPrimitives/EventPrimitivesHelpers.h"
 #include "GeoPrimitives/GeoPrimitives.h"
+#include "TrkEventPrimitives/FitQuality.h"
+#include "TrkEventPrimitives/ParamDefs.h"
+#include "TrkParameters/TrackParameters.h"
+#include "TrkSurfaces/PlaneSurface.h"
+#include "TrkTrack/Track.h"
+#include "TrkTrackSummary/TrackSummary.h"
 
-#include "TrkVertexFitterInterfaces/IImpactPoint3dEstimator.h"
 #include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h"
+#include "TrkVertexFitterInterfaces/IImpactPoint3dEstimator.h"
 #include "TrkVertexFitterInterfaces/IVertexSeedFinder.h"
 
-#include "VxVertex/RecVertex.h"
-#include "VxVertex/VxTrackAtVertex.h"
 #include "AthContainers/DataVector.h"
 #include "TrkEventPrimitives/ParamDefs.h"
 #include "TrkVertexFitterInterfaces/IVertexFitter.h"
+#include "VxVertex/RecVertex.h"
+#include "VxVertex/VxTrackAtVertex.h"
 
-#include "TrkTrackLink/ITrackLink.h"
-#include "TrkTrack/LinkToTrack.h"
 #include "TrkLinks/LinkToXAODTrackParticle.h"
+#include "TrkTrack/LinkToTrack.h"
+#include "TrkTrackLink/ITrackLink.h"
 #include "TrkVertexFitterInterfaces/IVertexLinearizedTrackFactory.h"
 
-#include "xAODTracking/Vertex.h"
 #include "xAODTracking/TrackParticle.h"
-#include "xAODTracking/VertexContainer.h"
-#include "xAODTracking/VertexAuxContainer.h"
-#include "xAODTracking/TrackParticleContainer.h"
 #include "xAODTracking/TrackParticleAuxContainer.h"
+#include "xAODTracking/TrackParticleContainer.h"
+#include "xAODTracking/Vertex.h"
+#include "xAODTracking/VertexAuxContainer.h"
+#include "xAODTracking/VertexContainer.h"
 
-//#define INDETADAPTIVEPRIVXFINDERTOOL_DEBUG
-
-
+#include <utility>
+#include <vector>
 
-namespace InDet
+namespace InDet {
+InDetIterativePriVxFinderTool::InDetIterativePriVxFinderTool(
+  const std::string& t,
+  const std::string& n,
+  const IInterface* p)
+  : AthAlgTool(t, n, p)
+  , m_iVertexFitter("Trk::AdaptiveVertexFitter")
+  , m_trkFilter("InDet::InDetTrackSelection")
+  , m_SeedFinder("Trk::ZScanSeedFinder")
+  , m_ImpactPoint3dEstimator("Trk::ImpactPoint3dEstimator")
+  , m_useBeamConstraint(false)
+  , m_significanceCutSeeding(10)
+  , m_maximumChi2cutForSeeding(6. * 6.)
+  , m_maxVertices(25)
+  , m_createSplitVertices(false)
+  , m_splitVerticesTrkInvFraction(2)
+  , m_reassignTracksAfterFirstFit(false)
+  , m_doMaxTracksCut(false)
+  , m_maxTracks(5000)
 {
-  InDetIterativePriVxFinderTool::InDetIterativePriVxFinderTool(const std::string& t, const std::string& n,
-                                                               const IInterface* p)
-    : AthAlgTool(t, n, p),
-    m_iVertexFitter("Trk::AdaptiveVertexFitter"),
-    m_trkFilter("InDet::InDetTrackSelection"),
-    m_SeedFinder("Trk::ZScanSeedFinder"),
-    m_ImpactPoint3dEstimator("Trk::ImpactPoint3dEstimator"),
-    m_useBeamConstraint(false),
-    m_significanceCutSeeding(10),
-    m_maximumChi2cutForSeeding(6. * 6.),
-    m_maxVertices(25),
-    m_createSplitVertices(false),
-    m_splitVerticesTrkInvFraction(2),
-    m_reassignTracksAfterFirstFit(false),
-    m_doMaxTracksCut(false),
-    m_maxTracks(5000) {
-    declareInterface<IVertexFinder>(this);
-
-    declareProperty("VertexFitterTool", m_iVertexFitter);
-    declareProperty("TrackSelector",m_trkFilter);
-    declareProperty("SeedFinder"       , m_SeedFinder);
-    declareProperty("ImpactPoint3dEstimator",m_ImpactPoint3dEstimator);
-    declareProperty("LinearizedTrackFactory",m_LinearizedTrackFactory);
-    declareProperty("useBeamConstraint",m_useBeamConstraint);
-    declareProperty("significanceCutSeeding",m_significanceCutSeeding);
-    declareProperty("maximumChi2cutForSeeding",m_maximumChi2cutForSeeding);
-    declareProperty("maxVertices",m_maxVertices);
-    declareProperty("createSplitVertices",m_createSplitVertices);
-    declareProperty("splitVerticesTrkInvFraction", m_splitVerticesTrkInvFraction, "inverse fraction to split tracks (1:N)");
-    declareProperty("reassignTracksAfterFirstFit",m_reassignTracksAfterFirstFit);
-    declareProperty( "doMaxTracksCut", m_doMaxTracksCut); 
-    declareProperty( "MaxTracks",  m_maxTracks);
+  declareInterface<IVertexFinder>(this);
+
+  declareProperty("VertexFitterTool", m_iVertexFitter);
+  declareProperty("TrackSelector", m_trkFilter);
+  declareProperty("SeedFinder", m_SeedFinder);
+  declareProperty("ImpactPoint3dEstimator", m_ImpactPoint3dEstimator);
+  declareProperty("LinearizedTrackFactory", m_LinearizedTrackFactory);
+  declareProperty("useBeamConstraint", m_useBeamConstraint);
+  declareProperty("significanceCutSeeding", m_significanceCutSeeding);
+  declareProperty("maximumChi2cutForSeeding", m_maximumChi2cutForSeeding);
+  declareProperty("maxVertices", m_maxVertices);
+  declareProperty("createSplitVertices", m_createSplitVertices);
+  declareProperty("splitVerticesTrkInvFraction",
+                  m_splitVerticesTrkInvFraction,
+                  "inverse fraction to split tracks (1:N)");
+  declareProperty("reassignTracksAfterFirstFit", m_reassignTracksAfterFirstFit);
+  declareProperty("doMaxTracksCut", m_doMaxTracksCut);
+  declareProperty("MaxTracks", m_maxTracks);
 }
 
-InDetIterativePriVxFinderTool::~InDetIterativePriVxFinderTool()
-= default;
+InDetIterativePriVxFinderTool::~InDetIterativePriVxFinderTool() = default;
 
-StatusCode InDetIterativePriVxFinderTool::initialize()
+StatusCode
+InDetIterativePriVxFinderTool::initialize()
 {
-    if (m_createSplitVertices && m_useBeamConstraint)
-    {
-      ATH_MSG_FATAL(" Split vertices cannot be obtained if beam spot constraint is true! Change settings...");
-      return StatusCode::FAILURE;
-    }
+  if (m_createSplitVertices && m_useBeamConstraint) {
+    ATH_MSG_FATAL(" Split vertices cannot be obtained if beam spot constraint "
+                  "is true! Change settings...");
+    return StatusCode::FAILURE;
+  }
 
+  /* Get the right vertex fitting tool from ToolSvc */
+  if (m_iVertexFitter.retrieve().isFailure()) {
+    ATH_MSG_FATAL("Failed to retrieve tool " << m_iVertexFitter);
+    return StatusCode::FAILURE;
+  }
 
-    /* Get the right vertex fitting tool from ToolSvc */
-    if (m_iVertexFitter.retrieve().isFailure()) {
-      msg(MSG::FATAL) << "Failed to retrieve tool " << m_iVertexFitter << endmsg;
-      return StatusCode::FAILURE;
-    }
+  if (m_SeedFinder.retrieve().isFailure()) {
+    ATH_MSG_FATAL("Failed to retrieve tool " << m_SeedFinder);
+    return StatusCode::FAILURE;
+  }
 
-    if (m_SeedFinder.retrieve().isFailure()) {
-      msg(MSG::FATAL) << "Failed to retrieve tool " << m_SeedFinder << endmsg;
-      return StatusCode::FAILURE;
-    }
+  if (m_LinearizedTrackFactory.retrieve().isFailure()) {
+    ATH_MSG_FATAL("Failed to retrieve tool " << m_LinearizedTrackFactory);
+    return StatusCode::FAILURE;
+  }
 
-    if ( m_LinearizedTrackFactory.retrieve().isFailure() ) {
-      msg(MSG::FATAL) << "Failed to retrieve tool " << m_LinearizedTrackFactory << endmsg;
-      return StatusCode::FAILURE;
-    }
+  if (m_ImpactPoint3dEstimator.retrieve().isFailure()) {
+    ATH_MSG_FATAL("Failed to retrieve tool " << m_ImpactPoint3dEstimator);
+    return StatusCode::FAILURE;
+  }
 
-    if (m_ImpactPoint3dEstimator.retrieve().isFailure()) {
-      msg(MSG::FATAL) << "Failed to retrieve tool " << m_ImpactPoint3dEstimator << endmsg;
-      return StatusCode::FAILURE;
-    }
+  ATH_CHECK(m_beamSpotKey.initialize());
 
-    ATH_CHECK( m_beamSpotKey.initialize() );
+  if (m_trkFilter.retrieve().isFailure()) {
+    ATH_MSG_ERROR(" Unable to retrieve " << m_trkFilter);
+    return StatusCode::FAILURE;
+  }
 
-    if (m_trkFilter.retrieve().isFailure()) {
-      msg(MSG::ERROR) << " Unable to retrieve " << m_trkFilter << endmsg;
-      return StatusCode::FAILURE;
-    }
+  // since some parameters special to an inherited class this method
+  // will be overloaded by the inherited class
+  printParameterSettings();
 
-    // since some parameters special to an inherited class this method
-    // will be overloaded by the inherited class
-    printParameterSettings();
+  return StatusCode::SUCCESS;
+}
 
-    msg(MSG::INFO) << "Initialization successful" << endmsg;
-    return StatusCode::SUCCESS;
+namespace {
+struct xAODVertex_pair
+{
+  double first;
+  xAOD::Vertex* second;
+  xAODVertex_pair(double p1, xAOD::Vertex* p2)
+    : first(p1)
+    , second(p2)
+  {}
+  bool operator<(const xAODVertex_pair& other) const
+  {
+    return first > other.first;
   }
+};
+} // anonymous namespace
 
-  namespace
-  {
-    struct xAODVertex_pair {
-      double first;
-      xAOD::Vertex* second;
-      xAODVertex_pair(double p1, xAOD::Vertex* p2)
-        : first(p1), second(p2) {}
-      bool
-      operator < (const xAODVertex_pair& other) const
-      {return first > other.first;}
-    };
-  } //anonymous namespace
-
-
-std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> 
-InDetIterativePriVxFinderTool::findVertex(const TrackCollection* trackTES) const
+std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
+InDetIterativePriVxFinderTool::findVertex(const EventContext& ctx,
+                                          const TrackCollection* trackTES) const
 {
 
-  ATH_MSG_DEBUG(" Number of input tracks before track selection: " << trackTES->size());
-
+  ATH_MSG_DEBUG(
+    " Number of input tracks before track selection: " << trackTES->size());
 
-  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
+  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{ m_beamSpotKey, ctx };
   const InDet::BeamSpotData* beamSpot = *beamSpotHandle;
 
   std::vector<Trk::ITrackLink*> selectedTracks;
@@ -170,44 +168,44 @@ InDetIterativePriVxFinderTool::findVertex(const TrackCollection* trackTES) const
   typedef DataVector<Trk::Track>::const_iterator TrackDataVecIter;
 
   bool selectionPassed;
-  for (TrackDataVecIter itr = (*trackTES).begin(); itr != (*trackTES).end(); itr++) {
+  for (TrackDataVecIter itr = (*trackTES).begin(); itr != (*trackTES).end();
+       itr++) {
 
-    if (m_useBeamConstraint && beamSpot != nullptr) 
-    {
-      Trk::RecVertex beamPosition { beamSpot->beamVtx() };
-      selectionPassed=static_cast<bool>(m_trkFilter->accept(**itr, &beamPosition));
+    if (m_useBeamConstraint && beamSpot != nullptr) {
+      Trk::RecVertex beamPosition{ beamSpot->beamVtx() };
+      selectionPassed =
+        static_cast<bool>(m_trkFilter->accept(**itr, &beamPosition));
+    } else {
+      Trk::Vertex null(Amg::Vector3D(0, 0, 0));
+      selectionPassed = static_cast<bool>(m_trkFilter->accept(**itr, &null));
+    }
+    if (selectionPassed) {
+      ElementLink<TrackCollection> link;
+      link.setElement(*itr);
+      Trk::LinkToTrack* linkTT = new Trk::LinkToTrack(link);
+      linkTT->setStorableObject(*trackTES);
+      selectedTracks.push_back(linkTT);
     }
-    else
-    {
-      Trk::Vertex null(Amg::Vector3D(0,0,0));
-      selectionPassed=static_cast<bool>(m_trkFilter->accept(**itr, &null));
-      }
-      if (selectionPassed) {
-        ElementLink<TrackCollection> link;
-        link.setElement(*itr);
-        Trk::LinkToTrack* linkTT = new Trk::LinkToTrack(link);
-        linkTT->setStorableObject(*trackTES);
-        selectedTracks.push_back(linkTT);
-      }
   }
 
+  ATH_MSG_DEBUG("Of " << trackTES->size() << " tracks " << selectedTracks.size()
+                      << " survived the preselection.");
 
-  ATH_MSG_DEBUG("Of " << trackTES->size() << " tracks "
-		<< selectedTracks.size() << " survived the preselection.");
-
-  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> returnContainers = findVertex(selectedTracks);
+  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
+    returnContainers = findVertex(ctx,selectedTracks);
 
   return returnContainers;
 }
 
 std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
 InDetIterativePriVxFinderTool::findVertex(
+  const EventContext& ctx,
   const xAOD::TrackParticleContainer* trackParticles) const
 {
   ATH_MSG_DEBUG(" Number of input tracks before track selection: "
                 << trackParticles->size());
 
-  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{ m_beamSpotKey };
+  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{ m_beamSpotKey, ctx };
   const InDet::BeamSpotData* beamSpot = *beamSpotHandle;
 
   std::vector<Trk::ITrackLink*> selectedTracks;
@@ -254,896 +252,831 @@ InDetIterativePriVxFinderTool::findVertex(
                       << " survived the preselection.");
 
   std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
-    returnContainers = findVertex(selectedTracks);
+    returnContainers = findVertex(ctx, selectedTracks);
 
   return returnContainers;
 }
 
-  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> 
-  InDetIterativePriVxFinderTool::findVertex(const std::vector<Trk::ITrackLink*> & trackVector) const
-  {
-    SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
-    const InDet::BeamSpotData* beamSpot = *beamSpotHandle;
-    //two things need to be added
-    //1) the seeding mechanism
-    //2) the iterative removal of tracks
-
-    std::vector<Trk::ITrackLink*> origTracks = trackVector;
-    std::vector<Trk::ITrackLink*> seedTracks = trackVector;
-
-    // TODO: xAODVertex_pair never seems to be used?
-    std::vector<xAODVertex_pair> myxAODVertices;
-
-    xAOD::VertexContainer* theVertexContainer = new xAOD::VertexContainer;
-    xAOD::VertexAuxContainer* theVertexAuxContainer = new xAOD::VertexAuxContainer;
-    theVertexContainer->setStore(theVertexAuxContainer);
-
-    //bail out early with only Dummy vertex if multiplicity cut is applied and exceeded
-
-    if (m_doMaxTracksCut && (trackVector.size() > m_maxTracks)){ 
-      ATH_MSG_WARNING( trackVector.size() << " tracks - exceeds maximum (" << m_maxTracks << 
-  		     "), skipping vertexing and returning only dummy..." ); 
-      xAOD::Vertex * dummyxAODVertex = new xAOD::Vertex;
-      theVertexContainer->push_back( dummyxAODVertex ); // have to add vertex to container here first so it can use its aux store
-      dummyxAODVertex->setPosition( beamSpot->beamVtx().position() );
-      dummyxAODVertex->setCovariancePosition( beamSpot->beamVtx().covariancePosition() );
-      dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-      dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
-      return std::make_pair(theVertexContainer, theVertexAuxContainer);
-    }
-
-    int iterations = -1;
-    unsigned int seedtracknumber = seedTracks.size();
-
-    //used to store seed info
-    Amg::Vector3D actualVertex;
-
-    //prepare iterators for tracks only necessary for seeding
-    std::vector<Trk::ITrackLink*>::iterator seedBegin;
-    std::vector<Trk::ITrackLink*>::iterator seedEnd;
-
+std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
+InDetIterativePriVxFinderTool::findVertex(
+  const EventContext& ctx,
+  const std::vector<Trk::ITrackLink*>& trackVector) const
+{
+  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{ m_beamSpotKey, ctx };
+  const InDet::BeamSpotData* beamSpot = *beamSpotHandle;
+  // two things need to be added
+  // 1) the seeding mechanism
+  // 2) the iterative removal of tracks
+
+  std::vector<Trk::ITrackLink*> origTracks = trackVector;
+  std::vector<Trk::ITrackLink*> seedTracks = trackVector;
+
+  // TODO: xAODVertex_pair never seems to be used?
+  std::vector<xAODVertex_pair> myxAODVertices;
+
+  xAOD::VertexContainer* theVertexContainer = new xAOD::VertexContainer;
+  xAOD::VertexAuxContainer* theVertexAuxContainer =
+    new xAOD::VertexAuxContainer;
+  theVertexContainer->setStore(theVertexAuxContainer);
+
+  // bail out early with only Dummy vertex if multiplicity cut is applied and
+  // exceeded
+
+  if (m_doMaxTracksCut && (trackVector.size() > m_maxTracks)) {
+    ATH_MSG_WARNING(trackVector.size()
+                    << " tracks - exceeds maximum (" << m_maxTracks
+                    << "), skipping vertexing and returning only dummy...");
+    xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
+    theVertexContainer->push_back(
+      dummyxAODVertex); // have to add vertex to container here first so it can
+                        // use its aux store
+    dummyxAODVertex->setPosition(beamSpot->beamVtx().position());
+    dummyxAODVertex->setCovariancePosition(
+      beamSpot->beamVtx().covariancePosition());
+    dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
+    dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
+    return std::make_pair(theVertexContainer, theVertexAuxContainer);
+  }
 
-    do
-    {
-    
-      seedBegin=seedTracks.begin();
-      seedEnd=seedTracks.end();
+  int iterations = -1;
+  unsigned int seedtracknumber = seedTracks.size();
 
-      if (seedtracknumber==0)
-      {
-        ATH_MSG_DEBUG(" New iteration. No tracks available after track selection for seeding. No finding done.");
-        break;
-      }
+  // used to store seed info
+  Amg::Vector3D actualVertex;
 
-      iterations+=1;
-      ATH_MSG_DEBUG("ITERATION NUMBER " << iterations);
+  // prepare iterators for tracks only necessary for seeding
+  std::vector<Trk::ITrackLink*>::iterator seedBegin;
+  std::vector<Trk::ITrackLink*>::iterator seedEnd;
 
-      //now find a new SEED
+  do {
 
-      std::vector<const Trk::TrackParameters*> perigeeList;
-      for (std::vector<Trk::ITrackLink*>::iterator seedtrkAtVtxIter=seedBegin;
-           seedtrkAtVtxIter!=seedEnd;++seedtrkAtVtxIter) 
-      {
-        perigeeList.push_back((*seedtrkAtVtxIter)->parameters());
-      }
+    seedBegin = seedTracks.begin();
+    seedEnd = seedTracks.end();
 
-      xAOD::Vertex theconstraint;
-    if (m_useBeamConstraint && beamSpot != nullptr) 
-    {
-        theconstraint = xAOD::Vertex(); // Default constructor creates a private store
-        theconstraint.setPosition( beamSpot->beamVtx().position() );
-        theconstraint.setCovariancePosition( beamSpot->beamVtx().covariancePosition() );
-        theconstraint.setFitQuality( beamSpot->beamVtx().fitQuality().chiSquared(), 
-				   beamSpot->beamVtx().fitQuality().doubleNumberDoF() );
-        actualVertex = m_SeedFinder->findSeed(perigeeList,&theconstraint);
-      } else {
-        actualVertex = m_SeedFinder->findSeed(perigeeList);
-        Amg::MatrixX looseConstraintCovariance(3, 3);
-        looseConstraintCovariance.setIdentity();
-        looseConstraintCovariance = looseConstraintCovariance * 1e+8;
-        theconstraint = xAOD::Vertex();
-        theconstraint.setPosition(actualVertex);
-        theconstraint.setCovariancePosition(looseConstraintCovariance);
-        theconstraint.setFitQuality(0., -3.);
-      }
+    if (seedtracknumber == 0) {
+      ATH_MSG_DEBUG(" New iteration. No tracks available after track selection "
+                    "for seeding. No finding done.");
+      break;
+    }
 
-      if (msgLvl(MSG::DEBUG)) {
-        msg(MSG::DEBUG) << " seed at x: " << actualVertex.x() <<
-          " at y: " << actualVertex.y() <<
-          " at z: " << actualVertex.z() << endmsg;
-      }
+    iterations += 1;
+    ATH_MSG_DEBUG("ITERATION NUMBER " << iterations);
 
-      if (actualVertex.z() == 0.) {
-        if (msgLvl(MSG::DEBUG)) {
-          msg(MSG::DEBUG) << "No seed found: no further vertices in event" << endmsg;
-          msg(MSG::DEBUG) << "Number of input tracks: " << perigeeList.size() << " but no seed returned." << endmsg;
-        }
-        break;
-      }
+    // now find a new SEED
 
-      //now question (remove tracks which are too far away??? I think so...)
-      std::vector<const Trk::TrackParameters*> perigeesToFit;
-      std::vector<const Trk::TrackParameters*> perigeesToFitSplitVertex;
+    std::vector<const Trk::TrackParameters*> perigeeList;
+    for (std::vector<Trk::ITrackLink*>::iterator seedtrkAtVtxIter = seedBegin;
+         seedtrkAtVtxIter != seedEnd;
+         ++seedtrkAtVtxIter) {
+      perigeeList.push_back((*seedtrkAtVtxIter)->parameters());
+    }
 
-      int numberOfTracks(perigeeList.size());
+    xAOD::Vertex theconstraint;
+    if (m_useBeamConstraint && beamSpot != nullptr) {
+      theconstraint =
+        xAOD::Vertex(); // Default constructor creates a private store
+      theconstraint.setPosition(beamSpot->beamVtx().position());
+      theconstraint.setCovariancePosition(
+        beamSpot->beamVtx().covariancePosition());
+      theconstraint.setFitQuality(
+        beamSpot->beamVtx().fitQuality().chiSquared(),
+        beamSpot->beamVtx().fitQuality().doubleNumberDoF());
+      actualVertex = m_SeedFinder->findSeed(perigeeList, &theconstraint);
+    } else {
+      actualVertex = m_SeedFinder->findSeed(perigeeList);
+      Amg::MatrixX looseConstraintCovariance(3, 3);
+      looseConstraintCovariance.setIdentity();
+      looseConstraintCovariance = looseConstraintCovariance * 1e+8;
+      theconstraint = xAOD::Vertex();
+      theconstraint.setPosition(actualVertex);
+      theconstraint.setCovariancePosition(looseConstraintCovariance);
+      theconstraint.setFitQuality(0., -3.);
+    }
 
-      std::vector<const Trk::TrackParameters*>::const_iterator perigeeListBegin = perigeeList.begin();
-      std::vector<const Trk::TrackParameters*>::const_iterator perigeeListEnd = perigeeList.end();
+    if (msgLvl(MSG::DEBUG)) {
+      msg(MSG::DEBUG) << " seed at x: " << actualVertex.x()
+                      << " at y: " << actualVertex.y()
+                      << " at z: " << actualVertex.z() << endmsg;
+    }
 
-      int counter = 0;
+    if (actualVertex.z() == 0.) {
+      break;
+    }
 
-      for (std::vector<const Trk::TrackParameters*>::const_iterator perigeeListIter = perigeeListBegin;
-           perigeeListIter != perigeeListEnd; ++perigeeListIter) {
-        if (numberOfTracks <= 2) {
+    // now question (remove tracks which are too far away??? I think so...)
+    std::vector<const Trk::TrackParameters*> perigeesToFit;
+    std::vector<const Trk::TrackParameters*> perigeesToFitSplitVertex;
+
+    int numberOfTracks(perigeeList.size());
+
+    std::vector<const Trk::TrackParameters*>::const_iterator perigeeListBegin =
+      perigeeList.begin();
+    std::vector<const Trk::TrackParameters*>::const_iterator perigeeListEnd =
+      perigeeList.end();
+
+    int counter = 0;
+
+    for (std::vector<const Trk::TrackParameters*>::const_iterator
+           perigeeListIter = perigeeListBegin;
+         perigeeListIter != perigeeListEnd;
+         ++perigeeListIter) {
+      if (numberOfTracks <= 2) {
+        perigeesToFit.push_back(*perigeeListIter);
+        counter += 1;
+      } else if (numberOfTracks <= 4 && !m_createSplitVertices) {
+        perigeesToFit.push_back(*perigeeListIter);
+        counter += 1;
+      } else if (numberOfTracks <= 4 * m_splitVerticesTrkInvFraction &&
+                 m_createSplitVertices) {
+        // few tracks are left, put them into the fit regardless their position!
+        if (counter % m_splitVerticesTrkInvFraction == 0) {
           perigeesToFit.push_back(*perigeeListIter);
           counter += 1;
-        } else if (numberOfTracks <= 4 && !m_createSplitVertices) {
-          perigeesToFit.push_back(*perigeeListIter);
+        } else {
+          perigeesToFitSplitVertex.push_back(*perigeeListIter);
           counter += 1;
-        } else if (numberOfTracks <= 4 * m_splitVerticesTrkInvFraction && m_createSplitVertices) {
-          // few tracks are left, put them into the fit regardless their position!
-          if (counter % m_splitVerticesTrkInvFraction == 0) {
-            perigeesToFit.push_back(*perigeeListIter);
-            counter += 1;
-          } else {
-            perigeesToFitSplitVertex.push_back(*perigeeListIter);
-            counter += 1;
-          }
-        } else { //check first whether it is not too far away!
-          double distance = 0.;
-          try
-          {
-            std::unique_ptr<Trk::PlaneSurface> mySurface = m_ImpactPoint3dEstimator->Estimate3dIP(*perigeeListIter, &actualVertex, distance);
-          }
-          catch (error::ImpactPoint3dEstimatorProblem err)
-          {
-            msg(MSG::WARNING) <<
-            " ImpactPoint3dEstimator failed to find minimum distance between track and vertex seed: " << err.p <<
-            endmsg;
-          }
-
-
-          if (distance < 0) {
-            msg(MSG::WARNING) << " Distance between track and seed vtx is negative: " << distance << endmsg;
-          }
-
-
-          const Trk::TrackParameters* myPerigee = (*perigeeListIter);
-
-          //very approximate error
-          double error = 0.;
-
-          if (myPerigee && myPerigee->covariance()) {
-            error = std::sqrt((*myPerigee->covariance())(Trk::d0, Trk::d0) +
-                              (*myPerigee->covariance())(Trk::z0, Trk::z0));
-          }//end of the security check
-
-          if (error == 0.) {
-            msg(MSG::ERROR) << " Error is zero! " << distance << endmsg;
-            error = 1.;
-          }
-
-          if (msgLvl(MSG::VERBOSE)) {
-            msg(MSG::VERBOSE) << " Distance between track and seed vtx: " << distance << " d/s(d) = " <<
-              distance / error << " err " << error << endmsg;
-          }
-
-
-          if (distance / error < m_significanceCutSeeding) {
-            if (counter % m_splitVerticesTrkInvFraction == 0 || !m_createSplitVertices) {
-              perigeesToFit.push_back(*perigeeListIter);
-              counter += 1;
-            } else {
-              perigeesToFitSplitVertex.push_back(*perigeeListIter);
-              counter += 1;
-            }
-          }
         }
-      }
-
-      if (msgLvl(MSG::VERBOSE)) {
-        msg(MSG::VERBOSE) << " Considering n. " << perigeesToFit.size() << " tracks for the fit. " << endmsg;
-        if (m_createSplitVertices) {
-          msg(MSG::VERBOSE) << " and n. " << perigeesToFitSplitVertex.size() << " tracks for split vertex fit. " <<
-          endmsg;
+      } else { // check first whether it is not too far away!
+        double distance = 0.;
+        try {
+          std::unique_ptr<Trk::PlaneSurface> mySurface =
+            m_ImpactPoint3dEstimator->Estimate3dIP(
+              *perigeeListIter, &actualVertex, distance);
+        } catch (error::ImpactPoint3dEstimatorProblem err) {
+          msg(MSG::WARNING) << " ImpactPoint3dEstimator failed to find minimum "
+                               "distance between track and vertex seed: "
+                            << err.p << endmsg;
         }
-      }
 
-      if (perigeesToFit.empty()) {
-        if (msgLvl(MSG::DEBUG)) {
-          msg(MSG::DEBUG) << " No good seed found. Exiting search for vertices..." << endmsg;
+        if (distance < 0) {
+          msg(MSG::WARNING)
+            << " Distance between track and seed vtx is negative: " << distance
+            << endmsg;
         }
 
-        break;
-      }
+        const Trk::TrackParameters* myPerigee = (*perigeeListIter);
 
+        // very approximate error
+        double error = 0.;
 
-      //now you have perigeeToFit and perigeeToFitSplitVertices
-      //AND HERE YOU DO THE FIT
-      //to reassign vertices you look ino what is already in myVxCandidate
-      //you do it only ONCE!
-
-      xAOD::Vertex* myxAODVertex = nullptr;
-      xAOD::Vertex* myxAODSplitVertex = nullptr;
-
-      if (m_useBeamConstraint && !perigeesToFit.empty()) {
-        myxAODVertex = m_iVertexFitter->fit(perigeesToFit, theconstraint);
-      } else if (!m_useBeamConstraint && perigeesToFit.size() > 1) {
-        myxAODVertex = m_iVertexFitter->fit(perigeesToFit);
-      }
-      if (m_createSplitVertices && perigeesToFitSplitVertex.size() > 1) {
-        myxAODSplitVertex = m_iVertexFitter->fit(perigeesToFitSplitVertex);
-      }
-
-      double ndf = 0.;
-      int ntracks = 0;
-      countTracksAndNdf(myxAODVertex, ndf, ntracks);
+        if (myPerigee && myPerigee->covariance()) {
+          error = std::sqrt((*myPerigee->covariance())(Trk::d0, Trk::d0) +
+                            (*myPerigee->covariance())(Trk::z0, Trk::z0));
+        } // end of the security check
 
-      double ndfSplitVertex = 0.;
-      int ntracksSplitVertex = 0;
-      countTracksAndNdf(myxAODSplitVertex, ndfSplitVertex, ntracksSplitVertex);
-
-      bool goodVertex =
-        myxAODVertex != nullptr &&
-        ((!m_useBeamConstraint && ndf > 0 && ntracks >= 2) ||
-         (m_useBeamConstraint && ndf > 3 && ntracks >= 2));
+        if (error == 0.) {
+          msg(MSG::ERROR) << " Error is zero! " << distance << endmsg;
+          error = 1.;
+        }
 
-      if (msgLvl(MSG::DEBUG)) {
-        msg(MSG::DEBUG) << " xAOD::Vertex is pointer: " << myxAODVertex <<
-          " ndf = " << ndf << " ntracks (with weight>0.01) " << ntracks << " beam constraint " <<
-        (m_useBeamConstraint ? "yes" : "no") << endmsg;
+        if (distance / error < m_significanceCutSeeding) {
+          if (counter % m_splitVerticesTrkInvFraction == 0 ||
+              !m_createSplitVertices) {
+            perigeesToFit.push_back(*perigeeListIter);
+            counter += 1;
+          } else {
+            perigeesToFitSplitVertex.push_back(*perigeeListIter);
+            counter += 1;
+          }
+        }
       }
+    }
 
-      if (!goodVertex) {
-        removeAllFrom(perigeesToFit, seedTracks);
+    if (perigeesToFit.empty()) {
+      ATH_MSG_DEBUG(" No good seed found. Exiting search for vertices...");
+      break;
+    }
 
-        if (msgLvl(MSG::DEBUG)) {
-          msg(MSG::DEBUG) << " Going to new iteration with: " << seedTracks.size() <<
-          " seed tracks after BAD VERTEX. " << endmsg;
-        }
-      } else {
-        if (m_reassignTracksAfterFirstFit && (!m_createSplitVertices)) {
-          if (msgLvl(MSG::VERBOSE)) {
-            msg(MSG::VERBOSE) << " N tracks used for fit before reallocating: " << perigeesToFit.size() << endmsg;
-          }
-          //now you HAVE a good vertex
-          //but you want to add the tracks which you missed...
+    // now you have perigeeToFit and perigeeToFitSplitVertices
+    // AND HERE YOU DO THE FIT
+    // to reassign vertices you look ino what is already in myVxCandidate
+    // you do it only ONCE!
 
-          int numberOfAddedTracks = 0;
+    xAOD::Vertex* myxAODVertex = nullptr;
+    xAOD::Vertex* myxAODSplitVertex = nullptr;
 
-          //iterate on remaining vertices and cross-check if tracks need to be attached
-          //to new vertex
-          xAOD::VertexContainer::iterator vxBegin = theVertexContainer->begin();
-          xAOD::VertexContainer::iterator vxEnd = theVertexContainer->end();
+    if (m_useBeamConstraint && !perigeesToFit.empty()) {
+      myxAODVertex = m_iVertexFitter->fit(perigeesToFit, theconstraint);
+    } else if (!m_useBeamConstraint && perigeesToFit.size() > 1) {
+      myxAODVertex = m_iVertexFitter->fit(perigeesToFit);
+    }
+    if (m_createSplitVertices && perigeesToFitSplitVertex.size() > 1) {
+      myxAODSplitVertex = m_iVertexFitter->fit(perigeesToFitSplitVertex);
+    }
 
-          for (xAOD::VertexContainer::iterator vxIter = vxBegin; vxIter != vxEnd; ++vxIter) {
-            //now iterate on tracks at vertex
+    double ndf = 0.;
+    int ntracks = 0;
+    countTracksAndNdf(myxAODVertex, ndf, ntracks);
 
-            std::vector<Trk::VxTrackAtVertex>* myVxTracksAtVtx = (&(*vxIter)->vxTrackAtVertex());
+    double ndfSplitVertex = 0.;
+    int ntracksSplitVertex = 0;
+    countTracksAndNdf(myxAODSplitVertex, ndfSplitVertex, ntracksSplitVertex);
 
-            if (!myVxTracksAtVtx) continue;
+    bool goodVertex = myxAODVertex != nullptr &&
+                      ((!m_useBeamConstraint && ndf > 0 && ntracks >= 2) ||
+                       (m_useBeamConstraint && ndf > 3 && ntracks >= 2));
 
-            std::vector<Trk::VxTrackAtVertex>::iterator tracksBegin = myVxTracksAtVtx->begin();
-            std::vector<Trk::VxTrackAtVertex>::iterator tracksEnd = myVxTracksAtVtx->end();
+    if (msgLvl(MSG::DEBUG)) {
+      msg(MSG::DEBUG) << " xAOD::Vertex is pointer: " << myxAODVertex
+                      << " ndf = " << ndf << " ntracks (with weight>0.01) "
+                      << ntracks << " beam constraint "
+                      << (m_useBeamConstraint ? "yes" : "no") << endmsg;
+    }
 
-            if (msgLvl(MSG::VERBOSE)) {
-              msg(MSG::VERBOSE) << " Iterating over new vertex to look for tracks to reallocate... " << endmsg;
+    if (!goodVertex) {
+      removeAllFrom(perigeesToFit, seedTracks);
+    } else {
+      if (m_reassignTracksAfterFirstFit && (!m_createSplitVertices)) {
+        // now you HAVE a good vertex
+        // but you want to add the tracks which you missed...
+
+        int numberOfAddedTracks = 0;
+
+        // iterate on remaining vertices and cross-check if tracks need to be
+        // attached to new vertex
+        xAOD::VertexContainer::iterator vxBegin = theVertexContainer->begin();
+        xAOD::VertexContainer::iterator vxEnd = theVertexContainer->end();
+
+        for (xAOD::VertexContainer::iterator vxIter = vxBegin; vxIter != vxEnd;
+             ++vxIter) {
+          // now iterate on tracks at vertex
+
+          std::vector<Trk::VxTrackAtVertex>* myVxTracksAtVtx =
+            (&(*vxIter)->vxTrackAtVertex());
+
+          if (!myVxTracksAtVtx)
+            continue;
+
+          std::vector<Trk::VxTrackAtVertex>::iterator tracksBegin =
+            myVxTracksAtVtx->begin();
+          std::vector<Trk::VxTrackAtVertex>::iterator tracksEnd =
+            myVxTracksAtVtx->end();
+
+          for (std::vector<Trk::VxTrackAtVertex>::iterator tracksIter =
+                 tracksBegin;
+               tracksIter != tracksEnd;) {
+            // only try with tracks which are not too tightly assigned to
+            // another vertex
+            if ((*tracksIter).weight() > 0.01) {
+              ++tracksIter;
+              continue;
             }
 
-            for (std::vector<Trk::VxTrackAtVertex>::iterator tracksIter = tracksBegin;
-                 tracksIter != tracksEnd; ) {
-              //only try with tracks which are not too tightly assigned to another vertex
-              if ((*tracksIter).weight() > 0.01) {
-                ++tracksIter;
-                continue;
-              }
+            const Trk::TrackParameters* trackPerigee =
+              (*tracksIter).initialPerigee();
 
-              const Trk::TrackParameters* trackPerigee = (*tracksIter).initialPerigee();
+            if (trackPerigee == nullptr) {
+              msg(MSG::ERROR) << " Cast to perigee gives 0 pointer " << endmsg;
+            }
 
-              if (trackPerigee == nullptr) {
-                msg(MSG::ERROR) << " Cast to perigee gives 0 pointer " << endmsg;
-              }
+            double chi2_newvtx = compatibility(*trackPerigee, *myxAODVertex);
+            double chi2_oldvtx = compatibility(*trackPerigee, *(*vxIter));
 
-              double chi2_newvtx = compatibility(*trackPerigee, *myxAODVertex);
-              double chi2_oldvtx = compatibility(*trackPerigee, *(*vxIter));
+            bool remove = false;
 
-              if (msgLvl(MSG::VERBOSE)) {
-                msg(MSG::VERBOSE) << "Compatibility to old vtx is : " << chi2_oldvtx <<
-                  " to new vtx is: " << chi2_newvtx << endmsg;
-              }
+            if (chi2_newvtx < chi2_oldvtx) {
+              ATH_MSG_DEBUG(" Found track of old vertex (chi2= "
+                            << chi2_oldvtx
+                            << ") more compatible to new one (chi2= "
+                            << chi2_newvtx << ")");
 
-              bool remove = false;
+              perigeesToFit.push_back(trackPerigee);
+              // but you need to re-add it to the seedTracks too...
 
-              if (chi2_newvtx < chi2_oldvtx) {
-                if (msgLvl(MSG::DEBUG)) {
-                  msg(MSG::DEBUG) << " Found track of old vertex (chi2= " << chi2_oldvtx <<
-                    ") more compatible to new one (chi2= " << chi2_newvtx << ")" << endmsg;
-                }
+              bool isFound = false;
 
-                perigeesToFit.push_back(trackPerigee);
-                //but you need to re-add it to the seedTracks too...
-
-                bool isFound = false;
-
-                std::vector<Trk::ITrackLink*>::iterator origBegin = origTracks.begin();
-                std::vector<Trk::ITrackLink*>::iterator origEnd = origTracks.end();
-
-                for (std::vector<Trk::ITrackLink*>::iterator origIter = origBegin;
-                     origIter != origEnd; ++origIter) {
-                  if ((*origIter)->parameters() == trackPerigee) {
-                    if (msgLvl(MSG::VERBOSE)) {
-                      msg(MSG::VERBOSE) <<
-                      " found the old perigee to be re-added to seedTracks in order to be deleted again!" << endmsg;
-                    }
-                    isFound = true;
-                    seedTracks.push_back(*origIter);
-                    break;
-                  }
-                }
+              std::vector<Trk::ITrackLink*>::iterator origBegin =
+                origTracks.begin();
+              std::vector<Trk::ITrackLink*>::iterator origEnd =
+                origTracks.end();
 
-                if (!isFound) {
-                  msg(MSG::WARNING) << " Cannot find old perigee to re-add back to seed tracks... " << endmsg;
+              for (std::vector<Trk::ITrackLink*>::iterator origIter = origBegin;
+                   origIter != origEnd;
+                   ++origIter) {
+                if ((*origIter)->parameters() == trackPerigee) {
+                  isFound = true;
+                  seedTracks.push_back(*origIter);
+                  break;
                 }
-
-                numberOfAddedTracks += 1;
-
-                remove = true;
               }
-
-
-              if (remove) {
-                //now you have to delete the track from the old vertex...
-                //easy???
-                tracksIter = myVxTracksAtVtx->erase(tracksIter);
-                tracksBegin = myVxTracksAtVtx->begin();
-                tracksEnd = myVxTracksAtVtx->end();
-              } else {
-                ++tracksIter;
+              if (!isFound) {
+                ATH_MSG_WARNING(" Cannot find old perigee to re-add back to "
+                                "seed tracks... ");
               }
-            }//end of iterating on tracks
-          }//end of iterating on already found vertices in event
 
-          if (msgLvl(MSG::VERBOSE)) {
-            msg(MSG::VERBOSE) << " N tracks used for fit after reallocating: " << perigeesToFit.size() << endmsg;
-          }
-          if (msgLvl(MSG::DEBUG)) {
-            if (numberOfAddedTracks > 0) {
-              msg(MSG::DEBUG) << "Added : " << numberOfAddedTracks << " from different vertices " << endmsg;
-            }
-          }
-
-          //now you have to delete the previous xAOD::Vertex, do a new fit, then check if
-          //you still have a good vertex
-
-          if (numberOfAddedTracks > 0) {
-            delete myxAODVertex;
-            myxAODVertex = nullptr;
+              numberOfAddedTracks += 1;
 
-            if (m_useBeamConstraint && !perigeesToFit.empty()) {
-              myxAODVertex = m_iVertexFitter->fit(perigeesToFit, theconstraint);
-            } else if (!m_useBeamConstraint && perigeesToFit.size() > 1) {
-              myxAODVertex = m_iVertexFitter->fit(perigeesToFit);
+              remove = true;
             }
 
-            ndf = 0.;
-            ntracks = 0;
-            countTracksAndNdf(myxAODVertex, ndf, ntracks);
-
-            goodVertex =
-              myxAODVertex != nullptr &&
-              ((!m_useBeamConstraint && ndf > 0 && ntracks >= 2) ||
-               (m_useBeamConstraint && ndf > 3 && ntracks >= 2));
-
-            if (msgLvl(MSG::DEBUG)) {
-              msg(MSG::DEBUG) << " Refitted xAODVertex is pointer: " << myxAODVertex <<
-                " ndf = " << ndf << " ntracks (with weight>0.01) " << ntracks << " beam constraint " <<
-              (m_useBeamConstraint ? "yes" : "no") << endmsg;
+            if (remove) {
+              // now you have to delete the track from the old vertex...
+              // easy???
+              tracksIter = myVxTracksAtVtx->erase(tracksIter);
+              tracksBegin = myVxTracksAtVtx->begin();
+              tracksEnd = myVxTracksAtVtx->end();
+            } else {
+              ++tracksIter;
             }
+          } // end of iterating on tracks
+        }   // end of iterating on already found vertices in event
 
-            if (!goodVertex) {
-              removeAllFrom(perigeesToFit, seedTracks);
+        // now you have to delete the previous xAOD::Vertex, do a new fit, then
+        // check if you still have a good vertex
 
-              if (msgLvl(MSG::DEBUG)) {
-                msg(MSG::DEBUG) << " Going to new iteration with: " << seedTracks.size() <<
-                " seed tracks after BAD VERTEX. " << endmsg;
-              }
-
-              msg(MSG::DEBUG) << " Adding tracks resulted in an invalid vertex. Should be rare. " << endmsg;
-            }
-          }//end if tracks were added...
-        }//end reassign tracks from previous vertices and refitting if needed
+        if (numberOfAddedTracks > 0) {
+          delete myxAODVertex;
+          myxAODVertex = nullptr;
 
-
-        //need to re-ask goodVertex since it can be changed in the mean time
-        if (goodVertex) {
-          if (msgLvl(MSG::VERBOSE)) {
-            msg(MSG::VERBOSE) << "Number of seeds before: " << seedTracks.size() << endmsg;
+          if (m_useBeamConstraint && !perigeesToFit.empty()) {
+            myxAODVertex = m_iVertexFitter->fit(perigeesToFit, theconstraint);
+          } else if (!m_useBeamConstraint && perigeesToFit.size() > 1) {
+            myxAODVertex = m_iVertexFitter->fit(perigeesToFit);
           }
 
-          removeCompatibleTracks(myxAODVertex,
-                                 perigeesToFit,
-                                 seedTracks);
+          ndf = 0.;
+          ntracks = 0;
+          countTracksAndNdf(myxAODVertex, ndf, ntracks);
 
-          if (msgLvl(MSG::VERBOSE)) {
-            msg(MSG::VERBOSE) << "Number of seeds after removal of outliers: " << seedTracks.size() << endmsg;
-          }
-        }
-      }//end else case on if not good Vertex
-
-
-
-
-      bool goodSplitVertex = false;
+          goodVertex = myxAODVertex != nullptr &&
+                       ((!m_useBeamConstraint && ndf > 0 && ntracks >= 2) ||
+                        (m_useBeamConstraint && ndf > 3 && ntracks >= 2));
 
+          ATH_MSG_DEBUG(" Refitted xAODVertex is pointer: " << myxAODVertex
+                        << " ndf = " << ndf << " ntracks (with weight>0.01) "
+                        << ntracks << " beam constraint "
+                        << (m_useBeamConstraint ? "yes" : "no"));
 
-      if (m_createSplitVertices) {
-        goodSplitVertex =
-          myxAODSplitVertex != nullptr &&
-          ndfSplitVertex > 0 && ntracksSplitVertex >= 2;
-
+          if (!goodVertex) {
+            removeAllFrom(perigeesToFit, seedTracks);
+            ATH_MSG_DEBUG(" Adding tracks resulted in an invalid vertex. "
+                          "Should be rare. ");
+          }
+        } // end if tracks were added...
+      }   // end reassign tracks from previous vertices and refitting if needed
 
-        if (msgLvl(MSG::DEBUG)) {
-          msg(MSG::DEBUG) << " xAODSplitVertex is pointer: " << myxAODSplitVertex <<
-            " ndf = " << ndfSplitVertex << " ntracks (with weight>0.01) " << ntracksSplitVertex << endmsg;
-        }
+      // need to re-ask goodVertex since it can be changed in the mean time
+      if (goodVertex) {
+        removeCompatibleTracks(myxAODVertex, perigeesToFit, seedTracks);
+      }
+    } // end else case on if not good Vertex
 
-        if (!goodSplitVertex) {
-          removeAllFrom(perigeesToFitSplitVertex, seedTracks);
+    bool goodSplitVertex = false;
 
-          if (msgLvl(MSG::DEBUG)) {
-            msg(MSG::DEBUG) << " SPLIT VERTEX Going to new iteration with: " << seedTracks.size() <<
-            " seed tracks after BAD Split VERTEX. " << endmsg;
-          }
-        } else {
-          if (msgLvl(MSG::VERBOSE)) {
-            msg(MSG::VERBOSE) << "SPLIT VERTEX Number of seeds before: " << seedTracks.size() << endmsg;
-          }
+    if (m_createSplitVertices) {
+      goodSplitVertex = myxAODSplitVertex != nullptr && ndfSplitVertex > 0 &&
+                        ntracksSplitVertex >= 2;
 
-          removeCompatibleTracks(myxAODSplitVertex,
-                                 perigeesToFitSplitVertex,
-                                 seedTracks);
+      ATH_MSG_DEBUG(" xAODSplitVertex is pointer: "
+                    << myxAODSplitVertex << " ndf = " << ndfSplitVertex
+                    << " ntracks (with weight>0.01) " << ntracksSplitVertex);
 
-          if (msgLvl(MSG::VERBOSE)) {
-            msg(MSG::VERBOSE) << "SPLIT VERTEX Number of seeds after removal of outliers: " << seedTracks.size() <<
-            endmsg;
-          }
-        }//end else if not good Vertex
-      }//end if create split vertices
+      if (!goodSplitVertex) {
+        removeAllFrom(perigeesToFitSplitVertex, seedTracks);
+      } else {
+        removeCompatibleTracks(
+          myxAODSplitVertex, perigeesToFitSplitVertex, seedTracks);
 
+      } // end else if not good Vertex
+    }   // end if create split vertices
 
-      if (!m_createSplitVertices) {
-        if (goodVertex) {
-          theVertexContainer->push_back(myxAODVertex);
-        } else {
-          if (myxAODVertex) {
-            delete myxAODVertex;
-            myxAODVertex = nullptr;
-          }
+    if (!m_createSplitVertices) {
+      if (goodVertex) {
+        theVertexContainer->push_back(myxAODVertex);
+      } else {
+        if (myxAODVertex) {
+          delete myxAODVertex;
+          myxAODVertex = nullptr;
         }
+      }
+    } else {
+      if (goodVertex) {
+        // type does not seem to be set earlier
+        myxAODVertex->setVertexType(xAOD::VxType::PriVtx);
+        theVertexContainer->push_back(myxAODVertex);
       } else {
-        if (goodVertex) {
-          // type does not seem to be set earlier
-          myxAODVertex->setVertexType(xAOD::VxType::PriVtx);
-          theVertexContainer->push_back(myxAODVertex);
-        } else {
-          if (myxAODVertex) {
-            delete myxAODVertex;
-            myxAODVertex = nullptr;
-          }
-
-          xAOD::Vertex * dummyxAODVertex = new xAOD::Vertex;
-          theVertexContainer->push_back( dummyxAODVertex ); // have to add vertex to container here first so it can use its aux store
-          dummyxAODVertex->setPosition( beamSpot->beamVtx().position() );
-          dummyxAODVertex->setCovariancePosition( beamSpot->beamVtx().covariancePosition() );
-          dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-          dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
+        if (myxAODVertex) {
+          delete myxAODVertex;
+          myxAODVertex = nullptr;
         }
-        if (goodSplitVertex) {
-          // type does not seem to be set earlier
-          myxAODSplitVertex->setVertexType(xAOD::VxType::PriVtx);
-          theVertexContainer->push_back(myxAODSplitVertex);
-        } else {
-          if (myxAODSplitVertex) {
-            delete myxAODSplitVertex;
-            myxAODSplitVertex = nullptr;
-          }
 
-          xAOD::Vertex * dummyxAODVertex = new xAOD::Vertex;
-          theVertexContainer->push_back( dummyxAODVertex ); // have to add vertex to container here first so it can use its aux store
-          dummyxAODVertex->setPosition( beamSpot->beamVtx().position() );
-          dummyxAODVertex->setCovariancePosition( beamSpot->beamVtx().covariancePosition() );
-          dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-          dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
-        }
+        xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
+        theVertexContainer->push_back(
+          dummyxAODVertex); // have to add vertex to container here first so it
+                            // can use its aux store
+        dummyxAODVertex->setPosition(beamSpot->beamVtx().position());
+        dummyxAODVertex->setCovariancePosition(
+          beamSpot->beamVtx().covariancePosition());
+        dummyxAODVertex->vxTrackAtVertex() =
+          std::vector<Trk::VxTrackAtVertex>();
+        dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
       }
-    } while (seedTracks.size() > 1 && iterations < m_maxVertices);
+      if (goodSplitVertex) {
+        // type does not seem to be set earlier
+        myxAODSplitVertex->setVertexType(xAOD::VxType::PriVtx);
+        theVertexContainer->push_back(myxAODSplitVertex);
+      } else {
+        if (myxAODSplitVertex) {
+          delete myxAODSplitVertex;
+          myxAODSplitVertex = nullptr;
+        }
 
-    if (iterations >= m_maxVertices) {
-      msg(MSG::WARNING) << "Reached maximum iterations " << endmsg;
+        xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
+        theVertexContainer->push_back(
+          dummyxAODVertex); // have to add vertex to container here first so it
+                            // can use its aux store
+        dummyxAODVertex->setPosition(beamSpot->beamVtx().position());
+        dummyxAODVertex->setCovariancePosition(
+          beamSpot->beamVtx().covariancePosition());
+        dummyxAODVertex->vxTrackAtVertex() =
+          std::vector<Trk::VxTrackAtVertex>();
+        dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
+      }
     }
+  } while (seedTracks.size() > 1 && iterations < m_maxVertices);
 
-    //unfortunately you have still a problem with the track to links!!!
+  if (iterations >= m_maxVertices) {
+    ATH_MSG_WARNING("Reached maximum iterations ");
+  }
 
-    //---- add dummy vertex at the end ------------------------------------------------------//
-    //---- if one or more vertices are already there: let dummy have same position as primary vertex
-    if (!m_createSplitVertices) {
-      if (!theVertexContainer->empty()) {
-        xAOD::Vertex* primaryVtx = theVertexContainer->front();
-        if (!primaryVtx->vxTrackAtVertex().empty()) {
-          primaryVtx->setVertexType((xAOD::VxType::VertexType) Trk::PriVtx);
-          xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
-          theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use
-                                                          // its aux store
-          dummyxAODVertex->setPosition(primaryVtx->position());
-          dummyxAODVertex->setCovariancePosition(primaryVtx->covariancePosition());
-          dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-          dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
-        } else {
-          primaryVtx->setVertexType(xAOD::VxType::NoVtx);
-        }
-      }
-      //---- if no vertex is there let dummy be at beam spot
-
-      else if ( theVertexContainer->empty() )
-      {
-        xAOD::Vertex * dummyxAODVertex = new xAOD::Vertex;
-        theVertexContainer->push_back( dummyxAODVertex ); // have to add vertex to container here first so it can use its aux store
-        dummyxAODVertex->setPosition( beamSpot->beamVtx().position() );
-        dummyxAODVertex->setCovariancePosition( beamSpot->beamVtx().covariancePosition() );
-        dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
+  // unfortunately you have still a problem with the track to links!!!
+
+  //---- add dummy vertex at the end
+  //------------------------------------------------------//
+  //---- if one or more vertices are already there: let dummy have same position
+  //as primary vertex
+  if (!m_createSplitVertices) {
+    if (!theVertexContainer->empty()) {
+      xAOD::Vertex* primaryVtx = theVertexContainer->front();
+      if (!primaryVtx->vxTrackAtVertex().empty()) {
+        primaryVtx->setVertexType((xAOD::VxType::VertexType)Trk::PriVtx);
+        xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
+        theVertexContainer->push_back(
+          dummyxAODVertex); // have to add vertex to container here first so it
+                            // can use its aux store
+        dummyxAODVertex->setPosition(primaryVtx->position());
+        dummyxAODVertex->setCovariancePosition(
+          primaryVtx->covariancePosition());
+        dummyxAODVertex->vxTrackAtVertex() =
+          std::vector<Trk::VxTrackAtVertex>();
         dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
+      } else {
+        primaryVtx->setVertexType(xAOD::VxType::NoVtx);
       }
-      // loop over the pile up to set it as pile up (EXCLUDE first and last vertex, do not do that in split mode)
-      for (unsigned int i = 0; i < theVertexContainer->size() - 1; i++) {
-        if (msgLvl(MSG::DEBUG)) {
-          msg(MSG::DEBUG) << " Vtx: " << i <<
-            " x= " << (*theVertexContainer)[i]->position().x() <<
-            " y= " << (*theVertexContainer)[i]->position().y() <<
-            " z= " << (*theVertexContainer)[i]->position().z() <<
-            " ntracks= " << (*theVertexContainer)[i]->vxTrackAtVertex().size() <<
-            " chi2= " << (*theVertexContainer)[i]->chiSquared()
-                          << " ndf = " << (*theVertexContainer)[i]->numberDoF() << endmsg;
-        }
-
-        if (i > 0) {
-          (*theVertexContainer)[i]->setVertexType(xAOD::VxType::PileUp);
-        }
+    }
+    //---- if no vertex is there let dummy be at beam spot
+
+    else if (theVertexContainer->empty()) {
+      xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
+      theVertexContainer->push_back(
+        dummyxAODVertex); // have to add vertex to container here first so it
+                          // can use its aux store
+      dummyxAODVertex->setPosition(beamSpot->beamVtx().position());
+      dummyxAODVertex->setCovariancePosition(
+        beamSpot->beamVtx().covariancePosition());
+      dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
+      dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
+    }
+    // loop over the pile up to set it as pile up (EXCLUDE first and last
+    // vertex, do not do that in split mode)
+    for (unsigned int i = 0; i < theVertexContainer->size() - 1; i++) {
+
+      ATH_MSG_DEBUG(
+        " Vtx: " << i << " x= " << (*theVertexContainer)[i]->position().x()
+                 << " y= " << (*theVertexContainer)[i]->position().y() << " z= "
+                 << (*theVertexContainer)[i]->position().z() << " ntracks= "
+                 << (*theVertexContainer)[i]->vxTrackAtVertex().size()
+                 << " chi2= " << (*theVertexContainer)[i]->chiSquared()
+                 << " ndf = " << (*theVertexContainer)[i]->numberDoF());
+      if (i > 0) {
+        (*theVertexContainer)[i]->setVertexType(xAOD::VxType::PileUp);
       }
     }
+  }
 
-    xAOD::VertexContainer::iterator vxBegin = theVertexContainer->begin();
-    xAOD::VertexContainer::iterator vxEnd = theVertexContainer->end();
-
-    //prepare iterators for tracks only necessary for seeding
-    std::vector<Trk::ITrackLink*>::iterator origtrkbegin = origTracks.begin();
-    std::vector<Trk::ITrackLink*>::iterator origtrkend = origTracks.end();
-
-    for (xAOD::VertexContainer::iterator vxIter = vxBegin; vxIter != vxEnd; ++vxIter) {
-      std::vector<Trk::VxTrackAtVertex>* myVxTracksAtVtx = &((*vxIter)->vxTrackAtVertex());
-
-      if (!myVxTracksAtVtx) continue;
+  xAOD::VertexContainer::iterator vxBegin = theVertexContainer->begin();
+  xAOD::VertexContainer::iterator vxEnd = theVertexContainer->end();
 
-      std::vector<Trk::VxTrackAtVertex>::iterator tracksBegin = myVxTracksAtVtx->begin();
-      std::vector<Trk::VxTrackAtVertex>::iterator tracksEnd = myVxTracksAtVtx->end();
+  // prepare iterators for tracks only necessary for seeding
+  std::vector<Trk::ITrackLink*>::iterator origtrkbegin = origTracks.begin();
+  std::vector<Trk::ITrackLink*>::iterator origtrkend = origTracks.end();
 
-      if (msgLvl(MSG::VERBOSE)) {
-        msg(MSG::VERBOSE) << " Iterating over new vertex in fixing links... " << endmsg;
-      }
+  for (xAOD::VertexContainer::iterator vxIter = vxBegin; vxIter != vxEnd;
+       ++vxIter) {
+    std::vector<Trk::VxTrackAtVertex>* myVxTracksAtVtx =
+      &((*vxIter)->vxTrackAtVertex());
 
-      bool found = false;
-
-      for (std::vector<Trk::VxTrackAtVertex>::iterator tracksIter = tracksBegin;
-           tracksIter != tracksEnd; ++tracksIter) {
-        if (msgLvl(MSG::VERBOSE)) {
-          msg(MSG::VERBOSE) << " Iterating over new track in fixing links... " << endmsg;
-        }
+    if (!myVxTracksAtVtx)
+      continue;
 
-        //now look for corresponding ITrackLink
-        for (std::vector<Trk::ITrackLink*>::iterator origtrkiter = origtrkbegin;
-             origtrkiter != origtrkend; ++origtrkiter) {
-          if ((*origtrkiter)->parameters() == (*tracksIter).initialPerigee()) {
-            found = true;
+    std::vector<Trk::VxTrackAtVertex>::iterator tracksBegin =
+      myVxTracksAtVtx->begin();
+    std::vector<Trk::VxTrackAtVertex>::iterator tracksEnd =
+      myVxTracksAtVtx->end();
 
-            //assigning the input track to the fitted vertex through VxTrackAtVertices vector
-            (*tracksIter).setOrigTrack(*origtrkiter);
+    bool found = false;
 
-            // See if the trklink is to an xAOD::TrackParticle
-            Trk::LinkToXAODTrackParticle* linkToXAODTP = dynamic_cast<Trk::LinkToXAODTrackParticle*>(*origtrkiter);
+    for (std::vector<Trk::VxTrackAtVertex>::iterator tracksIter = tracksBegin;
+         tracksIter != tracksEnd;
+         ++tracksIter) {
 
-            // If track is an xAOD::TrackParticle, set directly in xAOD::Vertex
-            if (linkToXAODTP) {
-              (*vxIter)->addTrackAtVertex(*linkToXAODTP, (*tracksIter).weight());
-            } //TODO: else write in a warning? (if tracks were Trk::Tracks or Trk::TrackParticleBase)
+      // now look for corresponding ITrackLink
+      for (std::vector<Trk::ITrackLink*>::iterator origtrkiter = origtrkbegin;
+           origtrkiter != origtrkend;
+           ++origtrkiter) {
+        if ((*origtrkiter)->parameters() == (*tracksIter).initialPerigee()) {
+          found = true;
 
-            origTracks.erase(origtrkiter);
-            origtrkbegin = origTracks.begin();
-            origtrkend = origTracks.end();
-            break;
-          }
-        }
-        if (!found) {
-          msg(MSG::ERROR) << " Cannot find vector element to fix links (step 4)! " << endmsg;
+          // assigning the input track to the fitted vertex through
+          // VxTrackAtVertices vector
+          (*tracksIter).setOrigTrack(*origtrkiter);
+
+          // See if the trklink is to an xAOD::TrackParticle
+          
+          //Why we need dynamicC_cast here?
+          Trk::LinkToXAODTrackParticle* linkToXAODTP =
+            dynamic_cast<Trk::LinkToXAODTrackParticle*>(*origtrkiter);
+
+          // If track is an xAOD::TrackParticle, set directly in xAOD::Vertex
+          if (linkToXAODTP) {
+            (*vxIter)->addTrackAtVertex(*linkToXAODTP, (*tracksIter).weight());
+          } // TODO: else write in a warning? (if tracks were Trk::Tracks or
+            // Trk::TrackParticleBase)
+
+          origTracks.erase(origtrkiter);
+          origtrkbegin = origTracks.begin();
+          origtrkend = origTracks.end();
+          break;
         }
-      }//end iterate on tracks at vtx
-    }//end iterate on vertices
-
-    for (std::vector<Trk::ITrackLink*>::iterator origtrkiter = origtrkbegin;
-         origtrkiter != origtrkend; ++origtrkiter) {
-      if ((*origtrkiter) != 0) {
-        delete *origtrkiter;
-        *origtrkiter = 0;
       }
+      if (!found) {
+        ATH_MSG_ERROR(" Cannot find vector element to fix links (step 4)! ");
+      }
+    } // end iterate on tracks at vtx
+  }   // end iterate on vertices
+
+  for (std::vector<Trk::ITrackLink*>::iterator origtrkiter = origtrkbegin;
+       origtrkiter != origtrkend;
+       ++origtrkiter) {
+    if ((*origtrkiter) != 0) {
+      delete *origtrkiter;
+      *origtrkiter = 0;
     }
-
-    return std::make_pair(theVertexContainer, theVertexAuxContainer);
-  }
-
-  StatusCode
-  InDetIterativePriVxFinderTool::finalize() {
-    return StatusCode::SUCCESS;
   }
 
-  void
-  InDetIterativePriVxFinderTool::printParameterSettings() {
-    msg(MSG::INFO) << "VxPrimary initialize(): Parametersettings " << endmsg;
-    msg(MSG::INFO) << "VertexFitter " << m_iVertexFitter << endmsg;
-    msg(MSG::INFO) << endmsg;
-  }
+  return std::make_pair(theVertexContainer, theVertexAuxContainer);
+}
 
-  void
-  InDetIterativePriVxFinderTool::SGError(const std::string& errService) {
-    msg(MSG::FATAL) << errService << " not found. Exiting !" << endmsg;
- }
+StatusCode
+InDetIterativePriVxFinderTool::finalize()
+{
+  return StatusCode::SUCCESS;
+}
 
-  double
-  InDetIterativePriVxFinderTool::compatibility(const Trk::TrackParameters& measPerigee,
-                                               const xAOD::Vertex& vertex) const {
-    Trk::LinearizedTrack* myLinearizedTrack =
-      m_LinearizedTrackFactory->linearizedTrack(&measPerigee, vertex.position());
+void
+InDetIterativePriVxFinderTool::printParameterSettings()
+{
+  ATH_MSG_INFO("VxPrimary initialize(): Parametersettings "
+               << '\n'
+               << "VertexFitter " << m_iVertexFitter << '\n');
+}
 
-    AmgMatrix(2, 2) weightReduced = myLinearizedTrack->expectedCovarianceAtPCA().block<2, 2>(0, 0);
+void
+InDetIterativePriVxFinderTool::SGError(const std::string& errService)
+{
+  msg(MSG::FATAL) << errService << " not found. Exiting !" << endmsg;
+}
 
-    AmgMatrix(2, 2) errorVertexReduced = (myLinearizedTrack->positionJacobian() *
-                                          (vertex.covariancePosition() *
-                                           myLinearizedTrack->positionJacobian().transpose())).block<2, 2>(0, 0);
+double
+InDetIterativePriVxFinderTool::compatibility(
+  const Trk::TrackParameters& measPerigee,
+  const xAOD::Vertex& vertex) const
+{
+  Trk::LinearizedTrack* myLinearizedTrack =
+    m_LinearizedTrackFactory->linearizedTrack(&measPerigee, vertex.position());
 
-    weightReduced += errorVertexReduced;
+  AmgMatrix(2, 2) weightReduced =
+    myLinearizedTrack->expectedCovarianceAtPCA().block<2, 2>(0, 0);
 
-    weightReduced = weightReduced.inverse().eval();
-    Amg::Vector2D trackParameters2D = myLinearizedTrack->expectedParametersAtPCA().block<2, 1>(0, 0);
-    double returnValue = trackParameters2D.dot(weightReduced * trackParameters2D);
+  AmgMatrix(2, 2) errorVertexReduced =
+    (myLinearizedTrack->positionJacobian() *
+     (vertex.covariancePosition() *
+      myLinearizedTrack->positionJacobian().transpose()))
+      .block<2, 2>(0, 0);
 
-    delete myLinearizedTrack;
-    myLinearizedTrack = nullptr;
+  weightReduced += errorVertexReduced;
 
-    return returnValue;
-  }
+  weightReduced = weightReduced.inverse().eval();
+  Amg::Vector2D trackParameters2D =
+    myLinearizedTrack->expectedParametersAtPCA().block<2, 1>(0, 0);
+  double returnValue = trackParameters2D.dot(weightReduced * trackParameters2D);
 
-  void
-  InDetIterativePriVxFinderTool::removeAllFrom(std::vector<const Trk::TrackParameters*>& perigeesToFit,
-                                               std::vector<Trk::ITrackLink*>& seedTracks) const {
-    //remove all perigeesToFit and go on...
+  delete myLinearizedTrack;
+  myLinearizedTrack = nullptr;
 
-    std::vector<Trk::ITrackLink*>::iterator seedBegin = seedTracks.begin();
-    std::vector<Trk::ITrackLink*>::iterator seedEnd = seedTracks.end();
-
-    std::vector<const Trk::TrackParameters*>::iterator perigeesToFitBegin = perigeesToFit.begin();
-    std::vector<const Trk::TrackParameters*>::iterator perigeesToFitEnd = perigeesToFit.end();
+  return returnValue;
+}
 
-    for (std::vector<const Trk::TrackParameters*>::iterator perigeesToFitIter = perigeesToFitBegin;
-         perigeesToFitIter != perigeesToFitEnd; ++perigeesToFitIter) {
-      if (msgLvl(MSG::VERBOSE)) {
-        msg(MSG::VERBOSE) << " Iterating on new track in original perigeesToFit list of BAD VERTEX..." << endmsg;
+void
+InDetIterativePriVxFinderTool::removeAllFrom(
+  std::vector<const Trk::TrackParameters*>& perigeesToFit,
+  std::vector<Trk::ITrackLink*>& seedTracks) const
+{
+  // remove all perigeesToFit and go on...
+
+  std::vector<Trk::ITrackLink*>::iterator seedBegin = seedTracks.begin();
+  std::vector<Trk::ITrackLink*>::iterator seedEnd = seedTracks.end();
+
+  std::vector<const Trk::TrackParameters*>::iterator perigeesToFitBegin =
+    perigeesToFit.begin();
+  std::vector<const Trk::TrackParameters*>::iterator perigeesToFitEnd =
+    perigeesToFit.end();
+
+  for (std::vector<const Trk::TrackParameters*>::iterator perigeesToFitIter =
+         perigeesToFitBegin;
+       perigeesToFitIter != perigeesToFitEnd;
+       ++perigeesToFitIter) {
+
+    bool found = false;
+
+    for (std::vector<Trk::ITrackLink*>::iterator seedIter = seedTracks.begin();
+         seedIter != seedEnd;
+         ++seedIter) {
+      if ((*seedIter)->parameters() == *perigeesToFitIter) {
+        found = true;
+        seedTracks.erase(seedIter);
+        seedBegin = seedTracks.begin();
+        seedEnd = seedTracks.end();
+        break;
       }
+    }
+    if (!found) {
+      ATH_MSG_ERROR(
+        " Cannot find vector element to delete when removing BAD vertex! ");
+    }
+  } // for cycle
+}
 
-      bool found = false;
+void
+InDetIterativePriVxFinderTool::countTracksAndNdf(xAOD::Vertex* myxAODVertex,
+                                                 double& ndf,
+                                                 int& ntracks) const
+{
+  if (myxAODVertex) {
+    ndf = myxAODVertex->numberDoF();
+
+    std::vector<Trk::VxTrackAtVertex> myVxTracksAtVtx =
+      myxAODVertex->vxTrackAtVertex();
+
+    std::vector<Trk::VxTrackAtVertex>::iterator tracksBegin =
+      myVxTracksAtVtx.begin();
+    std::vector<Trk::VxTrackAtVertex>::iterator tracksEnd =
+      myVxTracksAtVtx.end();
+
+    for (std::vector<Trk::VxTrackAtVertex>::iterator tracksIter = tracksBegin;
+         tracksIter != tracksEnd;
+         ++tracksIter) {
+      if ((*tracksIter).weight() > 0.01) {
+        ntracks += 1;
+      }
+    }
+  }
+}
 
-      for (std::vector<Trk::ITrackLink*>::iterator seedIter = seedTracks.begin();
-           seedIter != seedEnd; ++seedIter) {
-        if ((*seedIter)->parameters() == *perigeesToFitIter) {
-          if (msgLvl(MSG::VERBOSE)) {
-            msg(MSG::VERBOSE) << " found and deleted from seeds!" << endmsg;
-          }
-          found = true;
+void
+InDetIterativePriVxFinderTool::removeCompatibleTracks(
+  xAOD::Vertex* myxAODVertex,
+  std::vector<const Trk::TrackParameters*>& perigeesToFit,
+  std::vector<Trk::ITrackLink*>& seedTracks) const
+{
+  // now you have your new vertex with its new tracks
+  // now you have to get the compatibility also of all tracks which DIDN'T
+  // BELONG to the vertex!
+  std::vector<Trk::VxTrackAtVertex>* tracksAtVertex =
+    &(myxAODVertex->vxTrackAtVertex());
+
+  std::vector<Trk::VxTrackAtVertex>::const_iterator tracksAtVertexBegin =
+    tracksAtVertex->begin();
+  std::vector<Trk::VxTrackAtVertex>::const_iterator tracksAtVertexEnd =
+    tracksAtVertex->end();
+
+  std::vector<Trk::ITrackLink*>::iterator seedBegin = seedTracks.begin();
+  std::vector<Trk::ITrackLink*>::iterator seedEnd = seedTracks.end();
+
+  std::vector<const Trk::TrackParameters*>::iterator perigeesToFitBegin =
+    perigeesToFit.begin();
+  std::vector<const Trk::TrackParameters*>::iterator perigeesToFitEnd =
+    perigeesToFit.end();
+
+  for (std::vector<Trk::VxTrackAtVertex>::const_iterator tracksAtVertexIter =
+         tracksAtVertexBegin;
+       tracksAtVertexIter != tracksAtVertexEnd;
+       ++tracksAtVertexIter) {
+
+    bool found = false;
+
+    for (std::vector<Trk::ITrackLink*>::iterator seedIter = seedBegin;
+         seedIter != seedEnd;
+         ++seedIter) {
+      if ((*seedIter)->parameters() == (*tracksAtVertexIter).initialPerigee()) {
+        found = true;
+        if ((*tracksAtVertexIter).weight() > 0.01) {
           seedTracks.erase(seedIter);
           seedBegin = seedTracks.begin();
           seedEnd = seedTracks.end();
-          break;
         }
+        break;
       }
+    }
 
-      if (!found) {
-        msg(MSG::ERROR) << " Cannot find vector element to delete when removing BAD vertex! " << endmsg;
-      }
-    }//for cycle
-  }
-
-  void
-  InDetIterativePriVxFinderTool::countTracksAndNdf(xAOD::Vertex* myxAODVertex,
-                                                   double& ndf, int& ntracks) const {
-    if (myxAODVertex) {
-      ndf = myxAODVertex->numberDoF();
-
-      std::vector<Trk::VxTrackAtVertex> myVxTracksAtVtx = myxAODVertex->vxTrackAtVertex();
-
-      std::vector<Trk::VxTrackAtVertex>::iterator tracksBegin = myVxTracksAtVtx.begin();
-      std::vector<Trk::VxTrackAtVertex>::iterator tracksEnd = myVxTracksAtVtx.end();
+    if (!found) {
+      ATH_MSG_ERROR(" Cannot find vector element to delete (step 1)! ");
+    }
 
-      for (std::vector<Trk::VxTrackAtVertex>::iterator tracksIter = tracksBegin;
-           tracksIter != tracksEnd; ++tracksIter) {
-        if ((*tracksIter).weight() > 0.01) {
-          ntracks += 1;
+    found = false;
+    for (std::vector<const Trk::TrackParameters*>::iterator perigeesToFitIter =
+           perigeesToFitBegin;
+         perigeesToFitIter != perigeesToFitEnd;
+         ++perigeesToFitIter) {
+      if (*perigeesToFitIter == (*tracksAtVertexIter).initialPerigee()) {
+        found = true;
+        if ((*tracksAtVertexIter).weight() > 0.01) {
+          perigeesToFit.erase(perigeesToFitIter);
+          perigeesToFitBegin = perigeesToFit.begin();
+          perigeesToFitEnd = perigeesToFit.end();
         }
+        break;
       }
     }
-  }
 
-  void
-  InDetIterativePriVxFinderTool::removeCompatibleTracks(xAOD::Vertex* myxAODVertex,
-                                                        std::vector<const Trk::TrackParameters*>& perigeesToFit,
-                                                        std::vector<Trk::ITrackLink*>& seedTracks) const {
-    //now you have your new vertex with its new tracks
-    //now you have to get the compatibility also of all tracks which DIDN'T BELONG to the vertex!
-    std::vector<Trk::VxTrackAtVertex>* tracksAtVertex = &(myxAODVertex->vxTrackAtVertex());
+    if (!found) {
+      ATH_MSG_ERROR(" Cannot find vector element to delete (step 2)! ");
+    }
+  } // finishing iterating on tracks at vertex
 
-    std::vector<Trk::VxTrackAtVertex>::const_iterator tracksAtVertexBegin = tracksAtVertex->begin();
-    std::vector<Trk::VxTrackAtVertex>::const_iterator tracksAtVertexEnd = tracksAtVertex->end();
+  std::vector<Trk::VxTrackAtVertex>* myVxTracksAtVertex =
+    &(myxAODVertex->vxTrackAtVertex());
 
-    std::vector<Trk::ITrackLink*>::iterator seedBegin = seedTracks.begin();
-    std::vector<Trk::ITrackLink*>::iterator seedEnd = seedTracks.end();
+  std::vector<Trk::VxTrackAtVertex>::iterator tracksBegin =
+    myVxTracksAtVertex->begin();
+  std::vector<Trk::VxTrackAtVertex>::iterator tracksEnd =
+    myVxTracksAtVertex->end();
 
-    std::vector<const Trk::TrackParameters*>::iterator perigeesToFitBegin = perigeesToFit.begin();
-    std::vector<const Trk::TrackParameters*>::iterator perigeesToFitEnd = perigeesToFit.end();
+  for (std::vector<const Trk::TrackParameters*>::iterator perigeesToFitIter =
+         perigeesToFitBegin;
+       perigeesToFitIter != perigeesToFitEnd;
+       ++perigeesToFitIter) {
+    bool found = false;
 
-    for (std::vector<Trk::VxTrackAtVertex>::const_iterator tracksAtVertexIter = tracksAtVertexBegin;
-         tracksAtVertexIter != tracksAtVertexEnd; ++tracksAtVertexIter) {
-      if (msgLvl(MSG::VERBOSE)) {
-        msg(MSG::VERBOSE) << " new track..." << endmsg;
-      }
+    // compute the chi2 with respect to the last fitted vertex!
+    //(easy since track was NOT used in the last vertex fit...)
 
-      bool found = false;
+    const Trk::TrackParameters* myPerigee = (*perigeesToFitIter);
 
-      for (std::vector<Trk::ITrackLink*>::iterator seedIter = seedBegin;
-           seedIter != seedEnd; ++seedIter) {
-        if ((*seedIter)->parameters() == (*tracksAtVertexIter).initialPerigee()) {
+    if (myPerigee == nullptr) {
+      ATH_MSG_ERROR(" Cast to perigee gives 0 pointer ");
+    }
+
+    double chi2 = compatibility(*myPerigee, *myxAODVertex);
+
+    // check if still sufficiently compatible to previous vertex
+    //(CAN BE VERY LOOSE TO BE CONSERVATIVE AGAINST FAR OUTLIERS)
+    if (chi2 < m_maximumChi2cutForSeeding) {
+      for (std::vector<Trk::ITrackLink*>::iterator seedIter =
+             seedTracks.begin();
+           seedIter != seedEnd;
+           ++seedIter) {
+        if ((*seedIter)->parameters() == *perigeesToFitIter) {
           found = true;
-          if ((*tracksAtVertexIter).weight() > 0.01) {
-            if (msgLvl(MSG::VERBOSE)) {
-              msg(MSG::VERBOSE) << " found and deleted from seeds!" << endmsg;
-            }
-            seedTracks.erase(seedIter);
-            seedBegin = seedTracks.begin();
-            seedEnd = seedTracks.end();
-          }
+          seedTracks.erase(seedIter);
+          seedBegin = seedTracks.begin();
+          seedEnd = seedTracks.end();
           break;
         }
       }
 
       if (!found) {
-        msg(MSG::ERROR) << " Cannot find vector element to delete (step 1)! " << endmsg;
+        ATH_MSG_ERROR(" Cannot find vector element to delete (step 3)! ");
       }
-
-      found = false;
-      for (std::vector<const Trk::TrackParameters*>::iterator perigeesToFitIter = perigeesToFitBegin;
-           perigeesToFitIter != perigeesToFitEnd; ++perigeesToFitIter) {
-        if (*perigeesToFitIter == (*tracksAtVertexIter).initialPerigee()) {
+    } else {
+      // look if the track is attached to the vertex. If this is the case you
+      // should delete the track from the vertex!
+      for (std::vector<Trk::VxTrackAtVertex>::iterator tracksIter = tracksBegin;
+           tracksIter != tracksEnd;
+           ++tracksIter) {
+        if ((*tracksIter).initialPerigee() == *perigeesToFitIter) {
+          // delete *tracksIter;
+          // delete has to happen BEFORE the erase (because the iterator will
+          // point to the next object in the vector AFTER the erase!)
+          myVxTracksAtVertex->erase(tracksIter);
+          tracksBegin = myVxTracksAtVertex->begin();
+          tracksEnd = myVxTracksAtVertex->end();
           found = true;
-
-          if ((*tracksAtVertexIter).weight() > 0.01) {
-            if (msgLvl(MSG::VERBOSE)) {
-              msg(MSG::VERBOSE) << " found and deleted from perigeesToFit!" << endmsg;
-            }
-            perigeesToFit.erase(perigeesToFitIter);
-            perigeesToFitBegin = perigeesToFit.begin();
-            perigeesToFitEnd = perigeesToFit.end();
-          }
           break;
         }
       }
-
-      if (!found) {
-        msg(MSG::ERROR) << " Cannot find vector element to delete (step 2)! " << endmsg;
-      }
-    }//finishing iterating on tracks at vertex
-
-    if (msgLvl(MSG::DEBUG)) {
-      msg(MSG::DEBUG) << " Outliers still to be considered: " << perigeesToFit.size() << endmsg;
     }
-    if (msgLvl(MSG::VERBOSE)) {
-      msg(MSG::VERBOSE) << "Number of seeds after removal of inliers: " << seedTracks.size() << endmsg;
-    }
-
-    std::vector<Trk::VxTrackAtVertex>* myVxTracksAtVertex = &(myxAODVertex->vxTrackAtVertex());
-
-    std::vector<Trk::VxTrackAtVertex>::iterator tracksBegin = myVxTracksAtVertex->begin();
-    std::vector<Trk::VxTrackAtVertex>::iterator tracksEnd = myVxTracksAtVertex->end();
-
-    for (std::vector<const Trk::TrackParameters*>::iterator perigeesToFitIter = perigeesToFitBegin;
-         perigeesToFitIter != perigeesToFitEnd; ++perigeesToFitIter) {
-      bool found = false;
-
-      //compute the chi2 with respect to the last fitted vertex!
-      //(easy since track was NOT used in the last vertex fit...)
-
-      const Trk::TrackParameters* myPerigee = (*perigeesToFitIter);
-
-      if (myPerigee == nullptr) {
-        msg(MSG::ERROR) << " Cast to perigee gives 0 pointer " << endmsg;
-      }
-
-      double chi2 = compatibility(*myPerigee, *myxAODVertex);
-
-      if (msgLvl(MSG::VERBOSE)) {
-        msg(MSG::VERBOSE) << "Compatibility is : " << chi2 << endmsg;
-      }
-
-      //check if still sufficiently compatible to previous vertex
-      //(CAN BE VERY LOOSE TO BE CONSERVATIVE AGAINST FAR OUTLIERS)
-      if (chi2 < m_maximumChi2cutForSeeding) {
-        if (msgLvl(MSG::VERBOSE)) {
-          msg(MSG::VERBOSE) << " Found track with compatibility: " << chi2 <<
-            " to be removed from the seeds... " << endmsg;
-        }
-
-        for (std::vector<Trk::ITrackLink*>::iterator seedIter = seedTracks.begin();
-             seedIter != seedEnd; ++seedIter) {
-          if ((*seedIter)->parameters() == *perigeesToFitIter) {
-            if (msgLvl(MSG::VERBOSE)) {
-              msg(MSG::VERBOSE) << " found and deleted from seeds!" << endmsg;
-            }
-            found = true;
-            seedTracks.erase(seedIter);
-            seedBegin = seedTracks.begin();
-            seedEnd = seedTracks.end();
-            break;
-          }
-        }
-
-        if (!found) {
-          msg(MSG::ERROR) << " Cannot find vector element to delete (step 3)! " << endmsg;
-        }
-      } else {
-        //look if the track is attached to the vertex. If this is the case you should
-        //delete the track from the vertex!
-
-        if (msgLvl(MSG::VERBOSE)) {
-          msg(MSG::VERBOSE) << " Found track with compatibility: " << chi2 <<
-            " to be further considered and thus to be removed from previous vertex if it was there... " << endmsg;
-        }
-
-        bool found = false;
-
-        for (std::vector<Trk::VxTrackAtVertex>::iterator tracksIter = tracksBegin;
-             tracksIter != tracksEnd; ++tracksIter) {
-          if ((*tracksIter).initialPerigee() == *perigeesToFitIter) {
-            if (msgLvl(MSG::VERBOSE)) {
-              msg(MSG::VERBOSE) << " OK, removing track with compatibility:" <<
-              (*tracksIter).trackQuality().chiSquared() <<
-                " or vtx compatibility" << (*tracksIter).vtxCompatibility() <<
-              " which was found attached to the vertex... " << endmsg;
-            }
-            // this delete is no longer needed because objects in myVxTracksAtVertex are no longer pointers - memory
-            // deletion of this VxTrackAtVertex
-            // was already taken care of inside fitter the moment the VxTrackAtVertex was added to the vector stored in
-            // xAOD::Vertex
-            // -David S.
-            //
-            //delete *tracksIter; // delete has to happen BEFORE the erase (because the iterator will point to the next
-            // object in the vector AFTER the erase!)
-            myVxTracksAtVertex->erase(tracksIter);
-            tracksBegin = myVxTracksAtVertex->begin();
-            tracksEnd = myVxTracksAtVertex->end();
-            found = true;
-            break;
-          }
-        }
+  } // iterate on all perigeesToFit
+}
 
-        if (!found) {
-          if (msgLvl(MSG::VERBOSE)) {
-            msg(MSG::VERBOSE) << "Track not found: probably it was already not attached to the vertex" << endmsg;
-          }
-        }
-      }
-    }//iterate on all perigeesToFit
-  }
 } // end namespace InDet
diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetMultiPriVxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetMultiPriVxFinderTool.cxx
deleted file mode 100755
index 17ba30ffc95a6cbe630c5b0f707240ca406947fb..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetMultiPriVxFinderTool.cxx
+++ /dev/null
@@ -1,609 +0,0 @@
-/*
-   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
- */
-
-/***************************************************************************
-                         InDetMultiPriVxFinderTool.cxx  -  Description
-                             -------------------
-    begin   : 01-11-2013
-    authors : Matthew Rudolph, Lars Egholm Peterson
-    changes :
-              2016-04-26   David Shope <david.richard.shope@cern.ch>
-              EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex
-
-                findVertex will now always return an xAOD::VertexContainer,
-                even when using a TrackCollection or a TrackParticleBaseCollection
-                as input.
-
-***************************************************************************/
-#include "InDetPriVxFinderTool/InDetMultiPriVxFinderTool.h"
-#include "CLHEP/Matrix/SymMatrix.h"
-#include "CLHEP/Matrix/Vector.h"
-#include "CLHEP/Vector/ThreeVector.h"
-#include "TrkTrack/Track.h"
-#include "TrkEventPrimitives/FitQuality.h"
-#include "TrkTrackSummary/TrackSummary.h"
-#include "TrkParticleBase/TrackParticleBase.h"
-#include "TrkEventPrimitives/ParamDefs.h"
-#include <map>
-#include <vector>
-#include "TrkSurfaces/PlaneSurface.h"
-
-#include "EventPrimitives/EventPrimitives.h"
-#include "EventPrimitives/EventPrimitivesHelpers.h"
-#include "GeoPrimitives/GeoPrimitives.h"
-
-#include "TrkVertexFitterInterfaces/IImpactPoint3dEstimator.h"
-#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h"
-#include "TrkVertexFitterInterfaces/IVertexSeedFinder.h"
-
-//#include "VxVertex/VxContainer.h"
-#include "VxVertex/RecVertex.h"
-#include "VxVertex/VxTrackAtVertex.h"
-#include "AthContainers/DataVector.h"
-#include "TrkEventPrimitives/ParamDefs.h"
-#include "TrkVertexFitterInterfaces/IVertexFitter.h"
-
-#include "TrkTrackLink/ITrackLink.h"
-#include "TrkTrack/LinkToTrack.h"
-#include "TrkParticleBase/LinkToTrackParticleBase.h"
-#include "TrkLinks/LinkToXAODTrackParticle.h"
-
-
-
-#include "xAODTracking/Vertex.h"
-#include "xAODTracking/TrackParticle.h"
-#include "xAODTracking/VertexContainer.h"
-#include "xAODTracking/VertexAuxContainer.h"
-#include "xAODTracking/TrackParticleContainer.h"
-#include "xAODTracking/TrackParticleAuxContainer.h"
-
-
-namespace InDet
-{
-  InDetMultiPriVxFinderTool::InDetMultiPriVxFinderTool(const std::string& t, const std::string& n, const IInterface* p)
-    : AthAlgTool(t, n, p),
-    m_iVertexFitter("Trk::AdaptiveVertexFitter"),
-    m_trkFilter("InDet::InDetTrackSelection"),
-    m_SeedFinder("Trk::ImagingSeedFinder"),
-    m_ImpactPoint3dEstimator("Trk::ImpactPoint3dEstimator"),
-    m_useBeamConstraint(false),
-    m_significanceCutSeeding(10),
-    m_maximumChi2cutForSeeding(6. * 6.),
-    m_maxVertices(25),
-    m_createSplitVertices(false),
-    m_splitVerticesTrkInvFraction(2),
-    m_reassignTracksAfterFirstFit(false) {
-    declareInterface<IVertexFinder>(this);
-
-    declareProperty("VertexFitterTool", m_iVertexFitter);
-    declareProperty("TrackSelector", m_trkFilter);
-    declareProperty("SeedFinder", m_SeedFinder);
-    declareProperty("ImpactPoint3dEstimator", m_ImpactPoint3dEstimator);
-
-    declareProperty("useBeamConstraint", m_useBeamConstraint);
-    declareProperty("significanceCutSeeding", m_significanceCutSeeding);
-    declareProperty("maximumChi2cutForSeeding", m_maximumChi2cutForSeeding);
-    declareProperty("maxVertices", m_maxVertices);
-    declareProperty("createSplitVertices", m_createSplitVertices);
-    declareProperty("splitVerticesTrkInvFraction", m_splitVerticesTrkInvFraction,
-                    "inverse fraction to split tracks (1:N)");
-    declareProperty("reassignTracksAfterFirstFit", m_reassignTracksAfterFirstFit);
-  }
-
-  InDetMultiPriVxFinderTool::~InDetMultiPriVxFinderTool()
-  = default;
-
-  StatusCode
-  InDetMultiPriVxFinderTool::initialize() {
-    
-    if (m_createSplitVertices && m_useBeamConstraint) {
-      msg(MSG::FATAL) << " Split vertices cannot be obtained if beam spot constraint is true! Change settings..." <<
-      endmsg;
-      return StatusCode::FAILURE;
-    }
-
-    /* Get the right vertex fitting tool from ToolSvc */
-    if (m_iVertexFitter.retrieve().isFailure()) {
-      msg(MSG::FATAL) << "Failed to retrieve tool " << m_iVertexFitter << endmsg;
-      return StatusCode::FAILURE;
-    }
-
-    if (m_SeedFinder.retrieve().isFailure()) {
-      msg(MSG::FATAL) << "Failed to retrieve tool " << m_SeedFinder << endmsg;
-      return StatusCode::FAILURE;
-    }
-
-    if (m_ImpactPoint3dEstimator.retrieve().isFailure()) {
-      msg(MSG::FATAL) << "Failed to retrieve tool " << m_ImpactPoint3dEstimator << endmsg;
-      return StatusCode::FAILURE;
-    }
-
-    ATH_CHECK(m_beamSpotKey.initialize());
-
-    if (m_trkFilter.retrieve().isFailure()) {
-      msg(MSG::ERROR) << " Unable to retrieve " << m_trkFilter << endmsg;
-      return StatusCode::FAILURE;
-    }
-
-
-    // since some parameters special to an inherited class this method
-    // will be overloaded by the inherited class
-    printParameterSettings();
-
-    msg(MSG::INFO) << "Initialization successful" << endmsg;
-    return StatusCode::SUCCESS;
-  }
-
-//Find vertex from TrackCollection
-  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
-  InDetMultiPriVxFinderTool::findVertex(const TrackCollection* trackTES) const
-  {
-    if (msgLvl(MSG::DEBUG)) msg() << " Number of input tracks before track selection: " << trackTES->size() << endmsg;
-
-    std::vector<Trk::ITrackLink*> selectedTracks;
-
-    typedef DataVector<Trk::Track>::const_iterator TrackDataVecIter;
-
-    bool selectionPassed{false};
-    SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
-    const InDet::BeamSpotData* beamdata = nullptr;
-    if(m_useBeamConstraint && beamSpotHandle.isValid()) beamdata = beamSpotHandle.retrieve();
-    
-    for (TrackDataVecIter itr = (*trackTES).begin(); itr != (*trackTES).end(); itr++) {
-      if (m_useBeamConstraint) {
-        // TODO: change trkFilter to allow for this replacement
-        /*
-           xAOD::Vertex beamposition;
-           beamposition.makePrivateStore();
-           beamposition.setPosition(beamdata->beamVtx().position());
-           beamposition.setCovariancePosition(beamdata->beamVtx().covariancePosition());
-         */
-        Trk::RecVertex beamposition(beamdata->beamVtx());
-        selectionPassed = static_cast<bool>(m_trkFilter->accept(**itr, &beamposition));
-      } else {
-        Trk::Vertex null(Amg::Vector3D(0, 0, 0));
-        selectionPassed = static_cast<bool> (m_trkFilter->accept(**itr, &null));
-      }
-      if (selectionPassed) {
-        ElementLink<TrackCollection> link;
-        link.setElement(const_cast<Trk::Track*>(*itr));
-        Trk::LinkToTrack* linkTT = new Trk::LinkToTrack(link);
-        linkTT->setStorableObject(*trackTES);
-        selectedTracks.push_back(linkTT);
-      }
-    }
-
-    if (msgLvl(MSG::DEBUG)) msg() << "Of " << trackTES->size() << " tracks "
-                                  << selectedTracks.size() << " survived the preselection." << endmsg;
-
-    std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> returnContainers = findVertex(selectedTracks);
-
-    return returnContainers;
-  }
-
-  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
-  InDetMultiPriVxFinderTool::findVertex(
-    const xAOD::TrackParticleContainer* trackParticles) const
-  {
-    ATH_MSG_DEBUG(" Number of input tracks before track selection: " << trackParticles->size());
-
-    std::vector<Trk::ITrackLink*> selectedTracks;
-    SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
-    const InDet::BeamSpotData* beamdata = nullptr;
-    if(m_useBeamConstraint && beamSpotHandle.isValid()) beamdata = beamSpotHandle.retrieve();
-    
-    typedef DataVector<xAOD::TrackParticle>::const_iterator TrackParticleDataVecIter;
-
-    bool selectionPassed{false};
-    for (TrackParticleDataVecIter itr = trackParticles->begin(); itr != trackParticles->end(); ++itr) {
-      if (m_useBeamConstraint) {
-        xAOD::Vertex beamposition;
-        beamposition.makePrivateStore();
-        beamposition.setPosition(beamdata->beamVtx().position());
-        beamposition.setCovariancePosition(beamdata->beamVtx().covariancePosition());
-        selectionPassed = static_cast<bool> (m_trkFilter->accept(**itr, &beamposition));
-      } else {
-        xAOD::Vertex null;
-        null.makePrivateStore();
-        null.setPosition(Amg::Vector3D(0, 0, 0));
-        AmgSymMatrix(3) vertexError;
-        vertexError.setZero();
-        null.setCovariancePosition(vertexError);
-        selectionPassed = static_cast<bool>(m_trkFilter->accept(**itr, &null));
-      }
-
-      if (selectionPassed) {
-        ElementLink<xAOD::TrackParticleContainer> link;
-        link.setElement(const_cast<xAOD::TrackParticle*>(*itr));
-        Trk::LinkToXAODTrackParticle* linkTT = new Trk::LinkToXAODTrackParticle(link);
-        linkTT->setStorableObject(*trackParticles);
-        selectedTracks.push_back(linkTT);
-      }
-    }
-
-    ATH_MSG_DEBUG(
-      "Of " << trackParticles->size() << " tracks " << selectedTracks.size() << " survived the preselection.");
-
-    std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> returnContainers = findVertex(selectedTracks);
-
-    return returnContainers;
-  }
-
-  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
-  InDetMultiPriVxFinderTool::findVertex(
-    const std::vector<Trk::ITrackLink*>& trackVector) const
-  {
-    //copy the input vector.  will drop used tracks from here as they are added to vertices
-    // then what is left is used to then delete all unused ITrackLink objects at the end.
-    std::vector<Trk::ITrackLink*> seedTracks = trackVector;
-
-    //actual container that will get the vertices and be returned
-    xAOD::VertexContainer* theVertexContainer = new xAOD::VertexContainer;
-    xAOD::VertexAuxContainer* theVertexAuxContainer = new xAOD::VertexAuxContainer;
-    theVertexContainer->setStore(theVertexAuxContainer);
-
-    //prepare iterators for tracks
-    std::vector<Trk::ITrackLink*>::iterator seedBegin = seedTracks.begin();
-    std::vector<Trk::ITrackLink*>::iterator seedEnd = seedTracks.end();
-
-    //create parameters objects to pass to seed finder
-    std::vector<const Trk::TrackParameters*> perigeeList;
-    for (std::vector<Trk::ITrackLink*>::iterator seedtrkAtVtxIter = seedBegin;
-         seedtrkAtVtxIter != seedEnd; ++seedtrkAtVtxIter) {
-      perigeeList.push_back((*seedtrkAtVtxIter)->parameters());
-    }
-
-    //used to store seed info
-    std::vector<Amg::Vector3D> seedVertices;
-
-    ATH_MSG_VERBOSE("Find multi seeds for fitting");
-
-    //find the list of seeds
-    xAOD::Vertex theconstraint;
-    theconstraint.makePrivateStore();
-    if (m_useBeamConstraint) {
-      SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
-      theconstraint.setPosition(beamSpotHandle->beamVtx().position());
-      theconstraint.setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-      theconstraint.setFitQuality(beamSpotHandle->beamVtx().fitQuality().chiSquared(),
-                                  beamSpotHandle->beamVtx().fitQuality().doubleNumberDoF());
-      seedVertices = m_SeedFinder->findMultiSeeds(perigeeList, &theconstraint);
-    } else {
-      seedVertices = m_SeedFinder->findMultiSeeds(perigeeList);
-    }
-
-    ATH_MSG_VERBOSE("Assign tracks to " << seedVertices.size() << " seeds");
-
-
-    //create track link collections for each seed to then be fit (not going straight to params to allow keeping track of
-    // links without searching later)
-    std::vector< std::vector<Trk::ITrackLink*> > tracksToFitCollection;
-    tracksToFitCollection.resize(seedVertices.size());
-
-    //loop over tracks to assign to seed -- don't automatically iterate because may be deleting them from the vector
-    for (std::vector<Trk::ITrackLink*>::iterator trkit = seedTracks.begin(); trkit != seedTracks.end(); ) {
-      //get its parameters
-      const Trk::TrackParameters* currParams = (*trkit)->parameters();
-      double mindistance = 100.;
-      std::size_t closestSeedIndex = seedVertices.size(); //so if we dont find one we can check later
-      //    std::vector<Trk::Vertex>::iterator closestSeed = seedVertices.end();
-      for (std::size_t seedit = 0; seedit < seedVertices.size(); seedit++) {
-        double error;
-        double distance = distanceAndError(currParams, &seedVertices[seedit], error);
-        ATH_MSG_VERBOSE("dist = " << distance << ", err = " << error);
-        if (distance / error < m_significanceCutSeeding && distance < mindistance) {
-          mindistance = distance;
-          closestSeedIndex = seedit;
-        }
-      } //end loop over seeds to find closest one
-
-      if (closestSeedIndex != seedVertices.size()) {
-        //add to list of tracks in fit collections, drop from seed tracks
-        tracksToFitCollection[closestSeedIndex].push_back(*trkit);
-        trkit = seedTracks.erase(trkit);
-      } else {
-        trkit++; //skip it (will be left in seedTracks for later deletion)
-      }
-    }
-
-    ATH_MSG_VERBOSE("Reassign tracks attached to seeds with 1 track");
-
-    //first look to reassign single tracks
-    // can repeat to attempt to avoid any singletons ?
-    //-->disabled for now
-    unsigned int nsingle;
-    do {
-      nsingle = 0;
-
-      for (std::size_t i = 0; i < tracksToFitCollection.size(); ++i) {
-        if (tracksToFitCollection[i].size() == 1) {
-          nsingle++;
-          //get its parameters
-          const Trk::TrackParameters* currParams = tracksToFitCollection[i][0]->parameters();
-          //look for another seed to attach to
-          double mindistance = 100.;
-          std::size_t closestSeedIndex = seedVertices.size();
-          for (std::size_t j = 0; j < seedVertices.size(); j++) {
-            //skip the one its already assigned to
-            if (j == i) continue;
-
-            double error;
-            double distance = distanceAndError(currParams, &seedVertices[j], error);
-            if (distance / error < m_significanceCutSeeding && distance < mindistance) {
-              mindistance = distance;
-              closestSeedIndex = j;
-            }
-          }
-
-          //add to list of tracks for new vertex if the new vertex already has a track.
-          //then erase from this collection in case another track gets moved here we don't want to have the same track
-          // in 2 places
-          if (closestSeedIndex != seedVertices.size() && !tracksToFitCollection[closestSeedIndex].empty()) {
-            tracksToFitCollection[closestSeedIndex].push_back(tracksToFitCollection[i][0]);
-            tracksToFitCollection[i].clear();
-          } //if didn't find another one to attach to, just leave it there.  if nothing else gets added here will be
-            // skipped and scheduled for deletion at the fitting step
-        } //if only 1 track
-      } //loop over collection of tracks to fit vectors
-    } while (0);
-    //past this point not using seedVertices anymore, just the track collections
-
-    ATH_MSG_VERBOSE("Call the fitter on the track collections");
-
-    //Go through the list and actually fit them
-    for (std::vector< std::vector<Trk::ITrackLink*> >::iterator cit = tracksToFitCollection.begin();
-         cit != tracksToFitCollection.end(); cit++) {
-      //not enough tracks // !!! Move from tracksToFitCollection to seedTracks for deletion
-      if (cit->size() < 2) {
-        for (std::vector<Trk::ITrackLink*>::iterator linkit = cit->begin(); linkit != cit->end(); linkit++) {
-          seedTracks.push_back(*linkit);
-        }
-
-        //empty vertex track collection
-        cit->clear();
-        continue;
-      }
-
-      //create the perigees the fitter actually wants
-      std::vector<const Trk::TrackParameters*> perigeesToFit;
-      for (std::vector<Trk::ITrackLink*>::iterator trkit = cit->begin(); trkit != cit->end(); trkit++) {
-        perigeesToFit.push_back((*trkit)->parameters());
-      }
-
-
-      xAOD::Vertex* myxAODVertex = nullptr;
-      if (m_useBeamConstraint) {
-        myxAODVertex = m_iVertexFitter->fit(perigeesToFit, theconstraint);
-      } else {
-        myxAODVertex = m_iVertexFitter->fit(perigeesToFit);
-      }
-
-
-      double ndf = 0.;
-      int ntracks = 0;
-      countTracksAndNdf(myxAODVertex, ndf, ntracks);
-
-      bool goodVertex =
-        myxAODVertex != nullptr &&
-        ((!m_useBeamConstraint && ndf > 0 && ntracks >= 2) ||
-         (m_useBeamConstraint && ndf > 3 && ntracks >= 2));
-
-      if (goodVertex) {
-        //not going to reassign tracks now so will add the track links
-        std::vector<Trk::VxTrackAtVertex>* myVxTracksAtVtx = &(myxAODVertex->vxTrackAtVertex());
-        if (myVxTracksAtVtx) { //protection, but not sure when this would happen...
-          //not sure if there's any guarantee that all the tracks given to fitter were used, but can at least only
-          // search among those...
-          //if we find out that is guaranteed we can just directly set the links
-          //we will erase links from the small vector, and if there are any left add them back to seedTracks to be
-          // deleted at the end.
-
-          std::vector<Trk::VxTrackAtVertex>::iterator tracksBegin = myVxTracksAtVtx->begin();
-          std::vector<Trk::VxTrackAtVertex>::iterator tracksEnd = myVxTracksAtVtx->end();
-
-          for (std::vector<Trk::VxTrackAtVertex>::iterator tracksIter = tracksBegin; tracksIter != tracksEnd;
-               ++tracksIter) {
-            bool found = false;
-            for (std::vector<Trk::ITrackLink*>::iterator linkit = cit->begin(); linkit != cit->end(); linkit++) {
-              if ((*linkit)->parameters() == (*tracksIter).initialPerigee()) {
-                found = true;
-
-                //assigning the input track to the fitted vertex through VxTrackAtVertices vector
-                (*tracksIter).setOrigTrack(*linkit);
-
-                // See if the trklink is to an xAOD::TrackParticle
-                Trk::LinkToXAODTrackParticle* linkToXAODTP = dynamic_cast<Trk::LinkToXAODTrackParticle*>(*linkit);
-
-                // If track is an xAOD::TrackParticle, set directly in xAOD::Vertex
-                if (linkToXAODTP) {
-                  myxAODVertex->addTrackAtVertex(*linkToXAODTP, (*tracksIter).weight());
-                } 
-                cit->erase(linkit);
-                break; //done looking for that link
-              }
-            }
-            if (!found) {
-              msg(MSG::ERROR) << " Cannot find vector element to fix links (step 4)! " << endmsg;
-            }
-          }
-        }
-
-
-        //its a good vertex and the links are all set, so add it to output
-        theVertexContainer->push_back(myxAODVertex);
-      } else {
-        if (myxAODVertex) {
-          delete myxAODVertex;
-          myxAODVertex = nullptr;
-        }
-      }
-
-      //either bad vertex, so put all the track links back in collection scheduled for deletion
-      // or some of the track links weren't used/ didn't get matched to VxTrackAtVertex collection
-      // either way the ITrackLink pointer not passed to some VxTrackAtVertex belonging to an xAOD::Vertex
-      for (std::vector<Trk::ITrackLink*>::iterator linkit = cit->begin(); linkit != cit->end(); linkit++) {
-        seedTracks.push_back(*linkit);
-      }
-    } //end loop over vector of vector of tracks in which fit was performed
-
-
-    msg(MSG::DEBUG) << " Vtx size: " << theVertexContainer->size() << endmsg;
-    for (size_t i = 0; i < theVertexContainer->size(); i++) {
-      if (msgLvl(MSG::DEBUG)) {
-        msg(MSG::DEBUG) << " Vtx: " << i <<
-          " x= " << (*theVertexContainer)[i]->position().x() <<
-          " y= " << (*theVertexContainer)[i]->position().y() <<
-          " z= " << (*theVertexContainer)[i]->position().z() <<
-          " ntracks= " << (*theVertexContainer)[i]->vxTrackAtVertex().size() <<
-          " chi2= " << (*theVertexContainer)[i]->chiSquared()
-                        << " ndf = " << (*theVertexContainer)[i]->numberDoF()
-                        << endmsg;
-      }
-    }
-
-    //This bit was done in iterative finder -- not sure why but will copy it here too
-    if (!theVertexContainer->empty()) {
-      xAOD::Vertex* primaryVtx = theVertexContainer->front();
-      if (!primaryVtx->vxTrackAtVertex().empty()) {
-        primaryVtx->setVertexType((xAOD::VxType::VertexType) Trk::PriVtx);
-        xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
-        theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its
-                                                        // aux store
-        dummyxAODVertex->setPosition(primaryVtx->position());
-        dummyxAODVertex->setCovariancePosition(primaryVtx->covariancePosition());
-        dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-        dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
-      } else {
-        primaryVtx->setVertexType(xAOD::VxType::NoVtx);
-      }
-    } else if (theVertexContainer->empty()) {  //---- if no vertex is there let dummy be at beam spot
-      xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
-      theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its
-                                                      // aux store
-      SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
-      dummyxAODVertex->setPosition(beamSpotHandle->beamVtx().position());
-      dummyxAODVertex->setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-      dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-      dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
-    }
-
-    // msg(MSG::DEBUG) << " Vtx size, with a dummy vertex: "<<theVertexContainer->size()<< endmsg;
-    // loop over the pile up to set it as pile up (EXCLUDE first and last vertex, do not do that in split mode)
-    for (size_t i = 0; i < theVertexContainer->size() - 1; i++) {
-      if (i > 0) {
-        (*theVertexContainer)[i]->setVertexType(xAOD::VxType::PileUp);
-      }
-    }
-
-    // for (size_t i = 0 ; i < theVertexContainer->size(); i++) {
-    //   if(msgLvl(MSG::DEBUG)) {
-    //     msg(MSG::DEBUG) << " Vtx: " << i <<
-    //       " x= " << (*theVertexContainer)[i]->position().x() <<
-    //       " y= " << (*theVertexContainer)[i]->position().y() <<
-    //       " z= " << (*theVertexContainer)[i]->position().z() <<
-    //       " ntracks= " << (*theVertexContainer)[i]->vxTrackAtVertex().size() <<
-    //       " chi2= " << (*theVertexContainer)[i]->chiSquared()
-    //                << " ndf = " << (*theVertexContainer)[i]->numberDoF() << endmsg;
-
-    //       if((*theVxContainer)[i]->vertexType()==(xAOD::VxType::NoVtx) msg(MSG::DEBUG) << " Vtx: " << i << "dummy"<<
-    // endmsg;
-    //       else  msg(MSG::DEBUG) << " not a dummy vertex "<< endmsg;
-    //   }
-    // }
-
-    //ok so in iterative finder, any ITrackLink in origTracks which is a copy of the vector<ITrackLink*> input that is
-    // NOT used ends up deleted.
-    //but as they are used, the ITrackLink* elements are just erased from the vector so I guess those aren't deleted.
-    // have used seedTrack vector for this above
-
-
-    for (std::vector<Trk::ITrackLink*>::iterator trkit = seedTracks.begin();
-         trkit != seedTracks.end(); ++trkit) {
-      if ((*trkit) != 0) {
-        delete *trkit;
-        *trkit = 0;
-      }
-    }
-
-    //  msg(MSG::DEBUG) << "Returning VertexContainer " << MyTrackVxContainer << endmsg;
-    return std::make_pair(theVertexContainer, theVertexAuxContainer);
-  }
-
-  StatusCode
-  InDetMultiPriVxFinderTool::finalize() {
-    return StatusCode::SUCCESS;
-  }
-
-  void
-  InDetMultiPriVxFinderTool::printParameterSettings() {
-    msg(MSG::INFO) << "VxPrimary initialize(): Parametersettings " << endmsg;
-    msg(MSG::INFO) << "VertexFitter " << m_iVertexFitter << endmsg;
-    msg(MSG::INFO) << endmsg;
-  }
-
-  void
-  InDetMultiPriVxFinderTool::SGError(const std::string& errService) {
-    msg(MSG::FATAL) << errService << " not found. Exiting !" << endmsg;
- }
-
-  void
-  InDetMultiPriVxFinderTool::countTracksAndNdf(xAOD::Vertex* myxAODVertex,
-                                               double& ndf, int& ntracks) const {
-    if (myxAODVertex) {
-      ndf = myxAODVertex->numberDoF();
-
-      std::vector<Trk::VxTrackAtVertex> myVxTracksAtVtx = myxAODVertex->vxTrackAtVertex();
-
-      std::vector<Trk::VxTrackAtVertex>::iterator tracksBegin = myVxTracksAtVtx.begin();
-      std::vector<Trk::VxTrackAtVertex>::iterator tracksEnd = myVxTracksAtVtx.end();
-
-      for (std::vector<Trk::VxTrackAtVertex>::iterator tracksIter = tracksBegin;
-           tracksIter != tracksEnd; ++tracksIter) {
-        if ((*tracksIter).weight() > 0.01) {
-          ntracks += 1;
-        }
-      }
-    }
-  }
-
-  double
-  InDetMultiPriVxFinderTool::distanceAndError(const Trk::TrackParameters* params, const Amg::Vector3D* vertex,
-                                              double& error) const {
-    ATH_MSG_VERBOSE("run distanceAndError( " << params << " , " << vertex << ", &error), " << m_ImpactPoint3dEstimator);
-
-    //find distance safely
-    double distance = 0.;
-    try {
-      std::unique_ptr<Trk::PlaneSurface> mySurface = m_ImpactPoint3dEstimator->Estimate3dIP(params, vertex, distance);
-    }
-    catch (error::ImpactPoint3dEstimatorProblem err) {
-      msg(MSG::WARNING) << " ImpactPoin3dEstimator failed to find minimum distance between track and vertex seed: " <<
-      err.p << endmsg;
-    }
-
-    if (distance < 0) {
-      msg(MSG::WARNING) << " Distance between track and seed vtx is negative: " << distance << endmsg;
-    }
-
-
-    //      const Trk::MeasuredPerigee* myPerigee= dynamic_cast<const Trk::MeasuredPerigee*>(params);
-    //very approximate error
-    error = 0.;
-
-    if (params) {
-      error = std::sqrt((*params->covariance())(Trk::d0, Trk::d0) + (*params->covariance())(Trk::z0, Trk::z0));
-      // error = std::sqrt(myPerigee->localErrorMatrix().covariance()[Trk::d0][Trk::d0]+
-      //          myPerigee->localErrorMatrix().covariance()[Trk::z0][Trk::z0]);
-    }
-
-    if (error == 0.) {
-      msg(MSG::ERROR) << " Error is zero! " << distance << endmsg;
-      error = 1.;
-    }
-    msg(MSG::VERBOSE) << " Distance between track and seed vtx: " << distance << " d/s(d) = " <<
-      distance / error << " err " << error << endmsg;
-
-    return distance;
-  }
-} // end namespace InDet
diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetPriVxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetPriVxFinderTool.cxx
deleted file mode 100755
index 9ac1e16b78b51c75313606e41d317134d2ff3e4b..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetPriVxFinderTool.cxx
+++ /dev/null
@@ -1,662 +0,0 @@
-/*
-   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
- */
-
-/***************************************************************************
-                         InDetPriVxFinderTool.cxx  -  Description
-                             -------------------
-    begin   : 28-01-2004
-    authors : Andreas Wildauer (CERN PH-ATC), Fredrik Akesson (CERN PH-ATC)
-    email   : andreas.wildauer@cern.ch, fredrik.akesson@cern.ch
-    changes :
-              06/12/2006   Kirill.Prokofiev@cern.ch
-              EDM cleanup and switching to the FitQuality use
-
-              2016-04-26   David Shope <david.richard.shope@cern.ch>
-              EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex
-
-                findVertex will now always return an xAOD::VertexContainer,
-                even when using a TrackCollection.
-
-***************************************************************************/
-#include "InDetPriVxFinderTool/InDetPriVxFinderTool.h"
-
-#include <map>
-#include <utility>
-
-#include "TrkEventPrimitives/ParamDefs.h"
-
-#include "TrkTrack/LinkToTrack.h"
-#include "TrkTrack/Track.h"
-#include "TrkParameters/TrackParameters.h"
-
-#include "VxVertex/VxContainer.h"
-#include "VxVertex/VxCandidate.h"
-#include "VxVertex/VxTrackAtVertex.h"
-
-#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h"
-#include "TrkVertexFitterInterfaces/IVertexFitter.h"
-#include "InDetRecToolInterfaces/IMultiPVSeedFinder.h"
-
-#include "TrkLinks/LinkToXAODTrackParticle.h"
-
-#include "GeoPrimitives/GeoPrimitives.h"
-
-#include "xAODTracking/Vertex.h"
-#include "xAODTracking/TrackParticle.h"
-#include "xAODTracking/VertexContainer.h"
-#include "xAODTracking/VertexAuxContainer.h"
-#include "xAODTracking/TrackParticleContainer.h"
-#include "xAODTracking/TrackParticleAuxContainer.h"
-
-namespace InDet
-{
-#if 0
-  namespace {
-    void
-    deleteMeasuredPerigeeIf(bool IsToDelete, const Trk::TrackParameters*& WhatToDelete) {
-      if (IsToDelete) {
-        delete WhatToDelete;
-        WhatToDelete = 0;
-      }
-    }
-  }
-#endif
-
-
-  InDetPriVxFinderTool::InDetPriVxFinderTool (const std::string& t, const std::string& n, const IInterface* p)
-    : AthAlgTool(t, n, p),
-    m_iPriVxSeedFinder("InDet::SlidingWindowMultiSeedFinder"),
-    m_iVertexFitter("Trk::FastVertexFitter"),
-    m_trkFilter("InDet::InDetTrackSelection"),
-    m_useBeamConstraint(false),
-    m_chi2CutMethod(1),
-    m_enableMultipleVertices(true),
-    m_clusterLength(3.),
-    m_maxChi2PerTrack(5.),
-    m_createSplitVertices(false),
-    m_splitVerticesTrkInvFraction(2) {
-    declareInterface<IVertexFinder> (this);//by GP: changed from InDetAdaptivePriVxFinderTool to IPriVxFinderTool
-    declareProperty("PriVxSeedFinder", m_iPriVxSeedFinder);
-    declareProperty("VertexFitterTool", m_iVertexFitter);
-    declareProperty("TrackSelector", m_trkFilter);
-    declareProperty("useBeamConstraint", m_useBeamConstraint);
-    declareProperty("chi2CutMethod", m_chi2CutMethod);
-    declareProperty("maxChi2PerTrack", m_maxChi2PerTrack);
-    declareProperty("enableMultipleVertices", m_enableMultipleVertices);
-    declareProperty("clusterLength", m_clusterLength);
-    declareProperty("createSplitVertices", m_createSplitVertices);
-    declareProperty("splitVerticesTrkInvFraction", m_splitVerticesTrkInvFraction,
-                    "inverse fraction to split tracks (1:N)");
-  }
-
-  InDetPriVxFinderTool::~InDetPriVxFinderTool()
-  = default;
-
-  StatusCode
-  InDetPriVxFinderTool::initialize() {
-    //check if the split was requested and it is still possible to make it
-    if (m_createSplitVertices && m_useBeamConstraint) {
-      ATH_MSG_FATAL(" Split vertices cannot be obtained if beam spot constraint is true! Change settings..." );
-      return StatusCode::FAILURE;
-    }
-
-
-    /* Get the right vertex seed finder tool from ToolSvc */
-    // seed finder only needed if multiple vertex finding is on
-    ATH_CHECK(m_iPriVxSeedFinder.retrieve( DisableTool{!m_enableMultipleVertices} ));
-    ATH_CHECK(m_trkFilter.retrieve(        DisableTool{ m_enableMultipleVertices} ));
-    ATH_CHECK(m_iVertexFitter.retrieve());
-
-    ATH_CHECK(m_beamSpotKey.initialize());
-
-    ATH_MSG_INFO( "Initialization successful" );
-    return StatusCode::SUCCESS;
-  }
-
-  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
-  InDetPriVxFinderTool::findVertex(const TrackCollection* trackTES) const {
-    //    std::cout<<" find vertex called "<<std::endl;
-
-    // TODO: change trkFilter to allow for this replacement
-    /*
-       xAOD::Vertex beamposition;
-       beamposition.makePrivateStore();
-       beamposition.setPosition(beamSpotHandle->beamVtx().position());
-       beamposition.setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-     */
-    SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
-    
-    const Trk::RecVertex &beamposition(beamSpotHandle->beamVtx());
-
-    //---- create a vector of track particle base objects ---------------//
-    std::vector<const Trk::Track*> origTracks;
-    origTracks.clear();
-
-    for (TrackCollection::const_iterator itr = trackTES->begin(); itr != trackTES->end(); itr++) {
-      // if it should not look for multiple vertices it needs to do the track cuts here
-      if (!m_enableMultipleVertices) {
-        if (!m_trkFilter->accept(**itr, &beamposition)) continue;
-      }
-      origTracks.push_back(*itr);
-    }//end of loop over available tracks with pre-selection
-
-    std::vector< std::vector<const Trk::Track*> > seedsVector;
-
-    // put all tracks in one seed if no seeding is wanted
-    //unless the split regime is required
-    if (!m_enableMultipleVertices) {
-      // std::cout<<"single vertex mode called "<<std::endl;
-
-      //in the case of the split vertices, we should make the splitting first.
-      //well, off we go
-      if (m_createSplitVertices) {
-        //checking that we can actually split it at all
-        std::vector<const Trk::Track*> right_seed;
-        std::vector<const Trk::Track*> left_seed;
-
-        unsigned int rem_size = origTracks.size();
-        //loop over all pre-selected tracks
-        for (std::vector<const Trk::Track*>::const_iterator i = origTracks.begin(); i != origTracks.end(); ++i) {
-          if (rem_size % m_splitVerticesTrkInvFraction == 0) right_seed.push_back(*i);
-          else left_seed.push_back(*i);
-          --rem_size;
-        }//end of loop over all the pre-selected tracks
-
-        if (right_seed.size() > 1 && left_seed.size() > 1) {
-          seedsVector.push_back(right_seed);
-          seedsVector.push_back(left_seed);
-
-          // std::cout<<"Seed vectors of sizes created: "<<right_seed.size()<<" and "<<left_seed.size()<<std::endl;
-        }//otherwise making the vector empty and thus no seeds produced at all
-      } else seedsVector.push_back(origTracks); // if not creating split vertices
-    } else { // if not enabling multiple vertices
-      // find vertex seeds
-      seedsVector = m_iPriVxSeedFinder->seeds(origTracks);
-    }
-    if (msgLvl(MSG::DEBUG)) msg() << "Seed vector has " << seedsVector.size() << " seeds." << endmsg;
-
-    // fill track particle seeds into a track parameter base format
-    std::vector< std::vector<const Trk::TrackParameters*> > origParameters;
-    origParameters.clear();
-
-    //this is a loop over all the seeds. Production of the split vertices
-    //after the seeding should be done here..
-    for (unsigned int icluster = 0; icluster < seedsVector.size(); icluster++) {
-      if (msgLvl(MSG::DEBUG)) msg() << "Seed vector " << icluster << " has " << seedsVector[icluster].size() <<
-          " tracks." << endmsg;
-
-      std::vector<const Trk::TrackParameters*> tmpVector;
-      for (unsigned int itrack = 0; itrack < seedsVector[icluster].size(); itrack++) {
-        tmpVector.push_back(seedsVector[icluster].at(itrack)->perigeeParameters());
-      }
-      if (msgLvl(MSG::DEBUG)) msg() << "Orig parameters " << icluster << " has " << tmpVector.size() << " tracks." <<
-        endmsg;
-      origParameters.push_back(tmpVector);
-    }
-
-    if (msgLvl(MSG::DEBUG)) msg() << "Orig parameters has " << origParameters.size() << " seeds." << endmsg;
-
-    //---- do the actual vertex finding on TrackParameters obejcts ---------------//
-    std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> returnContainers = findVertex(origParameters);
-
-    //---- validate the element links ---------------//
-    for (xAOD::VertexContainer::iterator vxContItr = returnContainers.first->begin();
-         vxContItr != returnContainers.first->end(); vxContItr++) {
-      std::vector<Trk::VxTrackAtVertex>* tmpVxTAVtx = &(*vxContItr)->vxTrackAtVertex();
-      for (std::vector<Trk::VxTrackAtVertex>::iterator itr = tmpVxTAVtx->begin(); itr != tmpVxTAVtx->end(); itr++) {
-        const Trk::TrackParameters* initialPerigee = (*itr).initialPerigee();
-        const Trk::Track* correspondingTrack(nullptr);
-        // find the track to that perigee ...
-        for (TrackCollection::const_iterator itr1 = trackTES->begin(); itr1 != trackTES->end(); itr1++) {
-          if (initialPerigee == (*itr1)->perigeeParameters()) {
-            correspondingTrack = (*itr1);
-            continue;
-          }
-        }
-
-        // validate the track link
-        if (correspondingTrack != nullptr) {
-          Trk::LinkToTrack* link = new Trk::LinkToTrack;
-          link->setStorableObject(*trackTES);
-          link->setElement(correspondingTrack);
-          (*itr).setOrigTrack(link);
-        } else if (msgLvl(MSG::WARNING)) msg() <<
-          "No corresponding track found for this initial perigee! Vertex will have no link to the track." << endmsg;
-        // TODO: also mention that links stored directly in xAOD::Vertices are not set because a TrackCollection was
-        // given as input
-      }
-    }
-
-    return returnContainers;
-  }
-  
-  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
-  InDetPriVxFinderTool::findVertex(
-    const xAOD::TrackParticleContainer* trackParticles) const
-  {
-    ATH_MSG_DEBUG(" Number of input tracks before track selection: " << trackParticles->size());
-    SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
-    
-    xAOD::Vertex beamposition;
-    beamposition.makePrivateStore();
-    beamposition.setPosition(beamSpotHandle->beamVtx().position());
-    beamposition.setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-
-    std::vector<const xAOD::TrackParticle*> origTPs;
-    origTPs.clear();
-    std::vector<const Trk::TrackParameters*> origParameters;
-    origParameters.clear();
-
-
-
-    typedef DataVector<xAOD::TrackParticle>::const_iterator TrackParticleDataVecIter;
-    for (TrackParticleDataVecIter itr = trackParticles->begin(); itr != trackParticles->end(); ++itr) {
-      if (!m_enableMultipleVertices) {
-        if (!m_trkFilter->accept(**itr, &beamposition)) continue;
-      }
-      origTPs.push_back(*itr);
-      origParameters.push_back(&(*itr)->perigeeParameters());
-      ATH_MSG_DEBUG("originalPerigee at " << &(*itr)->perigeeParameters());
-    }
-
-    beamposition.releasePrivateStore();
-    std::vector< std::vector<const Trk::TrackParameters*> > seedsVector;
-
-    if (!m_enableMultipleVertices) {
-      //     std::cout<<"single vertex mode called "<<std::endl;
-
-      //in the case of the split vertices, we should make the splitting first.
-      //well, of fwe go
-      if (m_createSplitVertices) {
-        //checking that we can actually split it at all
-        std::vector<const Trk::TrackParameters*> right_seed;
-        std::vector<const Trk::TrackParameters*> left_seed;
-        unsigned int rem_size = origParameters.size();
-        //loop over all pre-selected tracks
-        for (std::vector<const Trk::TrackParameters*>::const_iterator i = origParameters.begin(); i != origParameters.end(); ++i) {
-          if (rem_size % m_splitVerticesTrkInvFraction == 0) right_seed.push_back(*i);
-          else left_seed.push_back(*i);
-          --rem_size;
-        }//end of loop over all the pre-selected tracks
-
-        if (right_seed.size() > 1 && left_seed.size() > 1) {
-          seedsVector.push_back(right_seed);
-          seedsVector.push_back(left_seed);
-        }//otherwise making the vector empty and thus no seeds produced at all
-      } else seedsVector.push_back(origParameters); // if not creating split vertices
-    } else { // if not enabling multiple vertices
-      // find vertex seeds
-      //the seed finder taking TrackParamters is not yet actually implemented... just the interface!
-      seedsVector = m_iPriVxSeedFinder->seeds(origTPs);
-    }
-
-    if (msgLvl(MSG::DEBUG)) msg() << "Seed vector has " << seedsVector.size() << " seeds." << endmsg;
-
-    std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> returnContainers = findVertex(seedsVector);
-
-    //---- validate the element links ---------------//
-    for (xAOD::VertexContainer::iterator vxContItr = returnContainers.first->begin(); vxContItr != returnContainers.first->end(); vxContItr++) {
-      std::vector<Trk::VxTrackAtVertex>* tmpVxTAVtx = &(*vxContItr)->vxTrackAtVertex();
-      //assigning the input tracks to the fitted vertices through VxTrackAtVertices
-      for (std::vector<Trk::VxTrackAtVertex>::iterator itr = tmpVxTAVtx->begin(); itr != tmpVxTAVtx->end(); itr++) {
-        const Trk::TrackParameters* initialPerigee = (*itr).initialPerigee();
-        const xAOD::TrackParticle* correspondingTrack(nullptr);
-        // find the track to that perigee ...
-        for (TrackParticleDataVecIter itr1 = trackParticles->begin(); itr1 != trackParticles->end(); ++itr1) {
-          if (initialPerigee == &(*itr1)->perigeeParameters()) {
-            correspondingTrack = (*itr1);
-            continue;
-          }
-        }
-        // validate the track link
-        if (correspondingTrack != nullptr) {
-          Trk::LinkToXAODTrackParticle* link = new Trk::LinkToXAODTrackParticle;
-          link->setStorableObject(*trackParticles);
-          link->setElement(correspondingTrack);
-          (*itr).setOrigTrack(link);
-        } else if (msgLvl(MSG::WARNING)) msg() << "No corresponding track found for this initial perigee! Vertex will have no link to the track." << endmsg;
-      } //end of loop over vxTrackAtVertices to assign links
-
-      //now set links to xAOD::TrackParticles directly in xAOD::Vertices
-      unsigned int VTAVsize = (*vxContItr)->vxTrackAtVertex().size();
-      for (unsigned int i = 0; i < VTAVsize; ++i) {
-        Trk::VxTrackAtVertex* VTAV = &((*vxContItr)->vxTrackAtVertex().at(i));
-        //TODO: Will this pointer really hold 0 if no VxTrackAtVertex is found?
-        if (not VTAV) {
-          ATH_MSG_WARNING(" Trying to set link to xAOD::TrackParticle. The VxTrackAtVertex is not found");
-          continue;
-        }
-
-        Trk::ITrackLink* trklink = VTAV->trackOrParticleLink();
-
-        // See if the trklink is to an xAOD::TrackParticle
-        Trk::LinkToXAODTrackParticle* linkToXAODTP = dynamic_cast<Trk::LinkToXAODTrackParticle*>(trklink);
-        if (linkToXAODTP) {
-          //Now set the new link to the xAOD vertex
-          (*vxContItr)->addTrackAtVertex(*linkToXAODTP, VTAV->weight());
-        } else {
-          ATH_MSG_WARNING("Skipping track. Trying to set link to something else than xAOD::TrackParticle. Neutrals not supported.");
-        }
-      } //end of loop for setting links to xAOD::TrackParticles directly in xAOD::Vertices
-    } //end loop over fitted vertices
-
-    return returnContainers;
-  }
-
-  std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
-  InDetPriVxFinderTool::findVertex(
-    std::vector<std::vector<const Trk::TrackParameters*>>& zTrackColl) const
-  {
-    //---- Constraint vertex section: if enabled in jobOptions a constraint is assigned --//
-    Amg::Vector3D vertex = Amg::Vector3D(0., 0., 0.); //for fit() we need Amg::Vector3D or Trk::RecVertex
-    std::vector<Trk::VxTrackAtVertex>* trkAtVtx = nullptr;
-    // Finding hot spots of z0's in case of pile up.
-    std::vector<const Trk::TrackParameters*> zTracks;
-    zTracks.clear();
-    // VertexContainer which takes xAOD::Vertex and is stored in StoreGate
-    xAOD::VertexContainer* theVertexContainer = new xAOD::VertexContainer;
-    xAOD::VertexAuxContainer* theVertexAuxContainer = new xAOD::VertexAuxContainer;
-    theVertexContainer->setStore(theVertexAuxContainer);
-    std::map<double, xAOD::Vertex*> vertexMap;
-    std::vector<xAOD::Vertex*> splitVtxVector;
-    double vertexPt;
-    xAOD::Vertex* myxAODVertex = nullptr;
-    SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
-    for (unsigned int i = 0; i < zTrackColl.size(); i++) {
-      // std::cout<<"Inside the loop"<<std::endl;
-      if (msgLvl(MSG::DEBUG)) msg() << "Fitting vertex of Z-Cluster " << i << " with " << zTrackColl[i].size() << " Tracks" << endmsg;
-      myxAODVertex = nullptr;
-      std::vector<const Trk::TrackParameters*> origParameters;
-      origParameters.clear();
-      origParameters = zTrackColl[i];
-      //---- Start of fitting section ------------------------------------------------------//
-      if (origParameters.size() == 1 && m_useBeamConstraint) {
-        xAOD::Vertex theconstraint;
-        theconstraint.makePrivateStore();
-        theconstraint.setPosition(beamSpotHandle->beamVtx().position());
-        theconstraint.setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-        theconstraint.setFitQuality(beamSpotHandle->beamVtx().fitQuality().chiSquared(), beamSpotHandle->beamVtx().fitQuality().doubleNumberDoF());
-        myxAODVertex = m_iVertexFitter->fit(origParameters, theconstraint);
-      } else if (origParameters.size() < 2 && m_createSplitVertices) {
-        // in the case this is a split vertex and it has only one track
-        // we make a dummy vertex and push it back to the container
-        myxAODVertex = new xAOD::Vertex;
-        myxAODVertex->makePrivateStore();
-        myxAODVertex->setPosition(beamSpotHandle->beamVtx().position());
-        myxAODVertex->setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-        myxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-        myxAODVertex->setVertexType(xAOD::VxType::NoVtx);
-      } else if (origParameters.size() > 1) {
-        if (m_useBeamConstraint) {
-          xAOD::Vertex theconstraint;
-          theconstraint.makePrivateStore();
-          theconstraint.setPosition(beamSpotHandle->beamVtx().position());
-          theconstraint.setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-          theconstraint.setFitQuality(beamSpotHandle->beamVtx().fitQuality().chiSquared(), beamSpotHandle->beamVtx().fitQuality().doubleNumberDoF());
-          myxAODVertex = m_iVertexFitter->fit(origParameters, theconstraint);
-        } else {
-          myxAODVertex = m_iVertexFitter->fit(origParameters, vertex);
-        }
-        if (myxAODVertex) {
-          /* Get the vertex position */
-          Amg::Vector3D vertex(myxAODVertex->position());
-          trkAtVtx = &(myxAODVertex->vxTrackAtVertex());
-          /* The fit tool does not return tracks chi2 ordered anymore We have to do it */
-          std::vector<int> indexOfSortedChi2;
-          sortTracksInChi2(indexOfSortedChi2, myxAODVertex);
-          /*
-             If more than 2 tracks were used,
-             do a chi2 selection of tracks used in the fit:
-             Version 1:
-             - get rid of all tracks with chi2 > m_maxChi2PerTrack in one go
-             - no refit after removing one track
-             - refit after all tracks with too high chi2 were removed
-           */
-          if (m_chi2CutMethod == 1 && origParameters.size() > 2) {
-            origParameters.clear();
-            /* At least two tracks are kept anyway  (0 and 1)
-               The others (2, ...) are tested for their chi2 values */
-            // first track
-            Trk::VxTrackAtVertex* tmpVTAV = &(*trkAtVtx) [indexOfSortedChi2[0]];
-            origParameters.push_back(tmpVTAV->initialPerigee());
-            // second track
-            tmpVTAV = &(*trkAtVtx) [indexOfSortedChi2[1]];
-            origParameters.push_back(tmpVTAV->initialPerigee());
-            for (unsigned int i = 2; i < trkAtVtx->size(); ++i) {
-              if ((*trkAtVtx) [indexOfSortedChi2[i]].trackQuality().chiSquared() > m_maxChi2PerTrack) continue;
-              tmpVTAV = &(*trkAtVtx) [indexOfSortedChi2[i]];
-              origParameters.push_back(tmpVTAV->initialPerigee());
-            }
-            // delete old xAOD::Vertex first
-            if (myxAODVertex) {
-              delete myxAODVertex;
-              myxAODVertex = nullptr;
-            }
-            if (msgLvl(MSG::VERBOSE)) msg() << "Second call of fitting tool!" << endmsg;
-            if (m_useBeamConstraint) {
-              xAOD::Vertex theconstraint;
-              theconstraint.makePrivateStore();
-              theconstraint.setPosition(beamSpotHandle->beamVtx().position());
-              theconstraint.setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-              theconstraint.setFitQuality(beamSpotHandle->beamVtx().fitQuality().chiSquared(), beamSpotHandle->beamVtx().fitQuality().doubleNumberDoF());
-              myxAODVertex = m_iVertexFitter->fit(origParameters, theconstraint);
-            } else {
-              myxAODVertex = m_iVertexFitter->fit(origParameters, vertex);
-            }
-            /** This value is never used before it gets overwritten (coverity 111631)
-            if (myxAODVertex) {
-              trkAtVtx = &(myxAODVertex->vxTrackAtVertex());
-            }
-            **/
-          }//end of chi2 cut method 1
-           /*
-              Version 2:
-              - get rid of tracks one by one starting with the one with highest chi2 > m_maxChi2PerTrack
-              - refit after this track has been removed
-              and do a chi2 cut again until all chi2 < m_maxChi2PerTrack
-            */
-          else if (m_chi2CutMethod == 2 && origParameters.size() > 2) {
-            while ((*trkAtVtx) [indexOfSortedChi2[origParameters.size() - 1]].trackQuality().chiSquared() > m_maxChi2PerTrack && origParameters.size() >= 3) {
-              // std::cout<<"Next while iteration "<<std::endl;
-              // no pop back because origParameters vector is not ordered in chi2 anymore
-              origParameters.erase(origParameters.begin() + (*(indexOfSortedChi2.end() - 1)));
-
-              // delete old xAOD::Vertex first
-              delete myxAODVertex;
-              myxAODVertex = nullptr;
-
-
-              if (msgLvl(MSG::VERBOSE)) msg() << "Second call of fitting tool!" << endmsg;
-
-              if (m_useBeamConstraint) {
-                xAOD::Vertex theconstraint;
-                theconstraint.makePrivateStore();
-                theconstraint.setPosition(beamSpotHandle->beamVtx().position());
-                theconstraint.setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-                theconstraint.setFitQuality(beamSpotHandle->beamVtx().fitQuality().chiSquared(), beamSpotHandle->beamVtx().fitQuality().doubleNumberDoF());
-                myxAODVertex = m_iVertexFitter->fit(origParameters, theconstraint);
-              } else {
-                myxAODVertex = m_iVertexFitter->fit(origParameters, vertex);
-              }
-
-              if (myxAODVertex) {
-                trkAtVtx = &(myxAODVertex->vxTrackAtVertex());
-
-                //re-soring tracks to avoid gaps
-                sortTracksInChi2(indexOfSortedChi2, myxAODVertex);
-              } else {
-                //we're down to non-fittable combination. so far, just give up. In future one may
-                // remove 2 worst tracks and re-start, for instance
-                break;
-              } //end of existance of xAOD::Vertex check
-            }//end of while stateme
-          } //end of mode selection
-        } else if (msgLvl(MSG::DEBUG)) msg() << "FastVertexFitter returned zero pointer ... could not fit vertex for this z cluster!" << endmsg;
-      } // end if "more than one track after m_preSelect(...)"
-      else if (msgLvl(MSG::DEBUG)) msg() << "Less than two tracks or fitting without constraint - drop candidate vertex." << endmsg;
-      // end if preselection for first iteration
-      if ((origParameters.size() > 1 || (m_useBeamConstraint && origParameters.size() == 1)) && myxAODVertex && !m_createSplitVertices) {
-        if (msgLvl(MSG::VERBOSE)) msg() << "Storing the fitted vertex." << endmsg;
-        /* Store the primary vertex */
-        trkAtVtx = &(myxAODVertex->vxTrackAtVertex());
-        vertexPt = 0.;
-        for (unsigned int i = 0; i < trkAtVtx->size(); ++i) {
-          const Trk::TrackParameters* tmpTP = dynamic_cast<const Trk::TrackParameters*> ((*(trkAtVtx)) [i].initialPerigee());
-          if (tmpTP) vertexPt += tmpTP->pT();
-        }
-        vertexMap[vertexPt] = myxAODVertex;
-      } else if (m_createSplitVertices) {
-        //storing a split vertex, if did not work - storing a dummy
-        if (myxAODVertex) {
-          myxAODVertex->setVertexType(xAOD::VxType::PriVtx);
-          splitVtxVector.push_back(myxAODVertex);
-        } else {
-          xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
-          dummyxAODVertex->makePrivateStore();
-          dummyxAODVertex->setPosition(beamSpotHandle->beamVtx().position());
-          dummyxAODVertex->setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-          dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-          dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
-          splitVtxVector.push_back(dummyxAODVertex);
-        }//end of successful reconstruction check
-      } else if (myxAODVertex) {
-        delete myxAODVertex;
-        myxAODVertex = nullptr;
-      }
-    }//end of loop over the pre-defined seeds
-    //no sorting for the split vertices  -otherwise, why splitting at all?
-    if (!m_createSplitVertices) {
-      for (std::map<double, xAOD::Vertex*>::reverse_iterator i = vertexMap.rbegin(); i != vertexMap.rend(); i++) {
-        if (msgLvl(MSG::VERBOSE)) msg() << "Sorting the fitted vertices. " << vertexMap.size() << " have been found." << endmsg;
-        theVertexContainer->push_back((*i).second);
-        if (msgLvl(MSG::DEBUG)) { /* Print info only if requested */
-          double xVtxError = sqrt((*i).second->covariancePosition()(0, 0));
-          double yVtxError = sqrt((*i).second->covariancePosition()(1, 1));
-          double zVtxError = sqrt((*i).second->covariancePosition()(2, 2));
-          msg() << "PVtx at ("
-                << (*i).second->position() [0] << "+/-" << xVtxError << ", "
-                << (*i).second->position() [1] << "+/-" << yVtxError << ", "
-                << (*i).second->position() [2] << "+/-" << zVtxError << ") with chi2 = "
-                << (*i).second->chiSquared() << " ("
-                << (*i).second->vxTrackAtVertex().size() << " tracks)" << endmsg;
-        }
-      }//end of sorting loop
-    } else for (std::vector<xAOD::Vertex*>::iterator l_vt = splitVtxVector.begin(); l_vt != splitVtxVector.end(); ++l_vt)
-        theVertexContainer->push_back(*l_vt);
-    //---- add dummy vertex at the end ------------------------------------------------------//
-    //---- if one or more vertices are already there: let dummy have same position as primary vertex
-    if (!theVertexContainer->empty() && !m_createSplitVertices) {
-      xAOD::Vertex* primaryVtx = theVertexContainer->front();
-      primaryVtx->setVertexType(xAOD::VxType::PriVtx);
-      xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
-      theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its
-                                                      // aux store
-      dummyxAODVertex->setPosition(primaryVtx->position());
-      dummyxAODVertex->setCovariancePosition(primaryVtx->covariancePosition());
-      dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-      dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
-    } else if (theVertexContainer->size() == 1 && m_createSplitVertices) {
-      //if there's ony one vertex and we make a split, we create an additional dummy vertex.
-      xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
-      theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its
-                                                      // aux store
-      dummyxAODVertex->setPosition(beamSpotHandle->beamVtx().position());
-      dummyxAODVertex->setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-      dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-      dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
-    }
-    //---- if no vertex is there let dummy be at beam spot
-    else if (theVertexContainer->empty()) {
-      // std::cout<<"Zero size vx container! "<<std::endl;
-      xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex;
-      theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its
-                                                      // aux store
-      dummyxAODVertex->setPosition(beamSpotHandle->beamVtx().position());
-      dummyxAODVertex->setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-      dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-      dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
-      if (m_createSplitVertices) {
-        // adding a second dummy vertex if this was a split run
-        xAOD::Vertex* new_dummyxAODVertex = new xAOD::Vertex;
-        theVertexContainer->push_back(new_dummyxAODVertex); // have to add vertex to container here first so it can use
-                                                            // its aux store
-        new_dummyxAODVertex->setPosition(beamSpotHandle->beamVtx().position());
-        new_dummyxAODVertex->setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition());
-        new_dummyxAODVertex->vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
-        new_dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx);
-      }
-    }
-    // loop over the pile up to set it as pile up (EXCLUDE first and last vertex: loop from 1 to size-1)
-    if (!m_createSplitVertices) {
-      for (unsigned int i = 1; i < theVertexContainer->size() - 1; i++) {
-        (*theVertexContainer)[i]->setVertexType(xAOD::VxType::PileUp);
-      }
-    }
-    return std::make_pair(theVertexContainer, theVertexAuxContainer);
-  } // end m_find vertex ethod
-
-  StatusCode
-  InDetPriVxFinderTool::finalize() {
-    return StatusCode::SUCCESS;
-  }
-
-  void
-  InDetPriVxFinderTool::sortTracksInChi2(std::vector<int>& indexOfSortedChi2,
-                                         xAOD::Vertex* myxAODVertex) const
-  {
-    // we need an index vector here which tells us the right order from smallest to
-    // largest of the chi2PerTrack vector
-    // then loop over the index vector and replace all iRP with iRP = index[i]
-    std::map<double, int> mapOfChi2;
-
-    //  std::cout<<"entering the sort "<<std::endl;
-    //  std::cout<<"vertex pointer is: "<<myVxCandidate<<std::endl;
-    //  if(!myVxCandidate->vxTrackAtVertex()) std::cout<<"empty veretx?? "<<std::endl;
-    //  if(!myVxCandidate->vxTrackAtVertex()->size()) std::cout<<"No tracks ate vertex? "<<std::endl;
-    //  std::cout<<"And the size of the container is: "<<myVxCandidate->vxTrackAtVertex()->size()<<std::endl;
-    for (unsigned int i = 0; i < myxAODVertex->vxTrackAtVertex().size(); ++i) {
-      /* possible bug 1 */
-      // TODO: I don't think vxTrackAtVertexAvailable() does the same thing as a null pointer check!
-      // if(myxAODVertex->vxTrackAtVertexAvailable()) std::cout<<"vxTrackAtVertex is not available! "<<std::endl;
-      // else std::cout<<"non zero pointer 1"<<std::endl;
-      double chi2PerTrack = (myxAODVertex->vxTrackAtVertex()) [i].trackQuality().chiSquared();
-      // std::cout<<"The chi2 valie is "<<chi2PerTrack<<std::endl;
-      mapOfChi2.insert(std::map<double, int>::value_type(chi2PerTrack, i));
-    }
-    // std::cout<<"sort loop done "<<std::endl;
-    indexOfSortedChi2.clear();
-    std::map<double, int>::const_iterator mItr = mapOfChi2.begin();
-
-    for (; mItr != mapOfChi2.end(); ++mItr) {
-      //  std::cout<<"Inside the loop "<<std::endl;
-      indexOfSortedChi2.push_back((*mItr).second);
-    }
-    // std::cout<<"Sorting performed "<<std::endl;
-  } // end of sort method
-
-  void
-  InDetPriVxFinderTool::sortTracksInZ0(
-    std::vector<const Trk::TrackParameters*> tv,
-    std::vector<int>& indexOfSortedZ0) const
-  {
-    // we need an index vector here which tells us the right order from smallest to
-    // largest of the z0 vector
-    // then loop over the index vector and replace all iRP with iRP = index[i]
-    std::map<double, int> mapOfZ0;
-    unsigned int j = 0;
-    for (std::vector<const Trk::TrackParameters*>::const_iterator i = tv.begin(); i != tv.end(); i++) {
-      /* possible bug 1 */
-      const Trk::TrackParameters* tmpTP = dynamic_cast<const Trk::TrackParameters*> (*i);
-      double z0 = tmpTP->position() [Trk::z];
-      mapOfZ0.insert(std::map<double, int>::value_type(z0, j));
-      j++;
-    }
-    indexOfSortedZ0.clear();
-    std::map<double, int>::const_iterator mItr = mapOfZ0.begin();
-    for (; mItr != mapOfZ0.end(); ++mItr) {
-      indexOfSortedZ0.push_back((*mItr).second);
-    }
-  }
-}
-// end namespace InDet
diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/components/InDetPriVxFinderTool_entries.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/components/InDetPriVxFinderTool_entries.cxx
index 222a629eb832f7afce977e2e79ae6489d07854c0..1087122bf352718412d16a8f336ae36c5c8180c4 100644
--- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/components/InDetPriVxFinderTool_entries.cxx
+++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/components/InDetPriVxFinderTool_entries.cxx
@@ -1,14 +1,8 @@
-#include "InDetPriVxFinderTool/InDetPriVxFinderTool.h"
 #include "InDetPriVxFinderTool/InDetIterativePriVxFinderTool.h"
 #include "InDetPriVxFinderTool/InDetAdaptiveMultiPriVxFinderTool.h"
-#include "InDetPriVxFinderTool/InDetMultiPriVxFinderTool.h"
-#include "TrkParticleBase/TrackParticleBase.h"
-
 
 using namespace InDet;
 
-DECLARE_COMPONENT( InDetPriVxFinderTool )
 DECLARE_COMPONENT( InDetIterativePriVxFinderTool )
 DECLARE_COMPONENT( InDetAdaptiveMultiPriVxFinderTool )
-DECLARE_COMPONENT( InDetMultiPriVxFinderTool )
 
diff --git a/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IInDetEtaDependentCutsSvc.h b/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IInDetEtaDependentCutsSvc.h
index 2b94a175475e87525547407f8b6570e3c25b9a8d..2d405b4c6dfd97323cb4a8f4673775a32ce18f1c 100644
--- a/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IInDetEtaDependentCutsSvc.h
+++ b/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IInDetEtaDependentCutsSvc.h
@@ -36,7 +36,7 @@ namespace InDet {
     virtual void getValue(const InDet::CutName cutName,    std::vector < int >& cut) = 0;
 
     template <class T>    
-    void getValue(const InDet::CutName cutName, T& cut, const double eta) {}
+      void getValue(const InDet::CutName /*cutName*/, T& /*cut*/, const double /*eta*/) {}
     
     virtual double  getMaxEta() const                         = 0;
     virtual double  getMinPtAtEta           (const double eta) const = 0;
diff --git a/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..086eb53aa8fe87cb3c041f1d2b254bb8f1b18639
--- /dev/null
+++ b/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool
diff --git a/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool.h b/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool.h
index c98a7975e978aa9f65380191ca26c058be306e6a..c6f3291b1d10beffbb3bf9401f7bab6e41f47a8f 100644
--- a/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool.h
+++ b/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 //Author: Lianyou Shan <lianyou.shan@cern.ch>
 // -*- c++ -*-
@@ -11,14 +11,17 @@
 
 // Framework include(s):
 #include "AsgTools/AsgTool.h"
+// #include "CxxUtils/checker_macros.h" // ATLAS_THREAD_SAFE
 #ifndef XAOD_ANALYSIS
 #include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "TrkToolInterfaces/ITrackSummaryTool.h"
 #endif
 
-#include <map>
+#include <atomic>
 #include <limits>
+#include <map>
+// #include <mutex>
 
 namespace InDet {
 
@@ -86,16 +89,17 @@ namespace InDet {
 
   private:
     bool m_isInitialized = false; // flag whether or not the tool has been initialized, to check erroneous use cases.
-    mutable bool m_warnInit = false; // flag to keep track of whether we have warned about a lack of initialization
+    mutable std::atomic<bool> m_warnInit = false; // flag to keep track of whether we have warned about a lack of initialization
 
     std::unordered_map< std::string, std::shared_ptr<SecVtxTrackAccessor> > m_trackAccessors; //!< list of the accessors that need to be run for each track
 
     // first element is cut family, second is the set of cuts
     std::map< std::string, std::vector< std::unique_ptr<SecVtxTrackCut> > > m_trackCuts; //!< First element is the name of the cut family, second element is the set of cuts
 
-    mutable ULong64_t m_numTracksProcessed = 0; //!< a counter of the number of tracks proccessed
-    mutable ULong64_t m_numTracksPassed = 0; //!< a counter of the number of tracks that passed all cuts
-    mutable std::vector<ULong64_t> m_numTracksPassedCuts; //!< tracks the number of tracks that passed each cut family
+    mutable std::atomic<ULong64_t> m_numTracksProcessed = 0; //!< a counter of the number of tracks proccessed
+    mutable std::atomic<ULong64_t> m_numTracksPassed = 0; //!< a counter of the number of tracks that passed all cuts
+    //    mutable std::vector<ULong64_t> m_numTracksPassedCuts ATLAS_THREAD_SAFE; //!< tracks the number of tracks that passed each cut family Guarded by m_mutex
+    //    mutable std::mutex m_mutex;
 
     constexpr static Double_t LOCAL_MAX_DOUBLE = 1.0e16;
     constexpr static Int_t LOCAL_MAX_INT = std::numeric_limits<Int_t>::max();
diff --git a/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/Root/InDetSecVtxTrackCut.cxx b/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/Root/InDetSecVtxTrackCut.cxx
index 18fce91d811c10ff7623171d6f8c58271d6b66eb..aaa77daa3044d248cec45acc6b2d8977c1235950 100644
--- a/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/Root/InDetSecVtxTrackCut.cxx
+++ b/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/Root/InDetSecVtxTrackCut.cxx
@@ -89,14 +89,16 @@ StatusCode InDet::FuncSummaryValueCut<N>::initialize()
 template <size_t N>
 bool InDet::FuncSummaryValueCut<N>::result() const
 {
+  std::array<uint8_t,N> results; // member variable to store the results
+  
   for (size_t i=0; i<N; ++i) {
     if (!m_summaryAccessors[i]) {
       ATH_MSG_WARNING( "Track summary accessor not valid. Track will not pass this cut." );
       return false;
     }
-    m_results[i] = m_summaryAccessors[i]->getValue();
+    results[i] = m_summaryAccessors[i]->getValue();
   }
-  return m_func(m_results);
+  return m_func(results);
 }
 
 template class InDet::FuncSummaryValueCut<3>;
diff --git a/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/Root/InDetSecVtxTrackCut.h b/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/Root/InDetSecVtxTrackCut.h
index fb09a4457b660323f6fb833e8d3f72397cf79d5f..cd799a9e1f3b9002b6eed10c2a95dd2463d9b9e1 100644
--- a/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/Root/InDetSecVtxTrackCut.h
+++ b/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/Root/InDetSecVtxTrackCut.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 //Author: Lianyou Shan <lianyou.shan@cern.ch>
 // -*- c++ -*-
@@ -64,7 +64,6 @@ class D0minCut : public virtual SecVtxTrackCut {
     std::function<bool(const std::array<uint8_t,N>&)> m_func;
     std::array< xAOD::SummaryType, N> m_summaryTypes;
     std::array< std::shared_ptr<SummaryAccessor>,N > m_summaryAccessors;
-    mutable std::array<uint8_t,N> m_results; // member variable to store the results
   }; // class FuncSummaryValueCut
 
 } // namespace InDet
diff --git a/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/Root/InDetSecVtxTrackSelectionTool.cxx b/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/Root/InDetSecVtxTrackSelectionTool.cxx
index 4ea84ead705d26875f10d255a65414898ec7fbdb..5bdef6ccb254833296a7e862ba80682e72cc2b12 100644
--- a/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/Root/InDetSecVtxTrackSelectionTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetSecVtxTrackSelectionTool/Root/InDetSecVtxTrackSelectionTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 //Author: Lianyou Shan <lianyou.shan@cern.ch>
 
@@ -111,12 +111,13 @@ StatusCode InDet::InDetSecVtxTrackSelectionTool::initialize() {
   }
 
 
+  //  std::lock_guard<std::mutex> lock{m_mutex};
   for (const auto& cutFamily : m_trackCuts) {
     for (const auto& cut : cutFamily.second) {
       ATH_CHECK( cut->initialize() );
     }
     const std::string& cutFamilyName = cutFamily.first;
-    m_numTracksPassedCuts.push_back(0);
+    //    m_numTracksPassedCuts.push_back(0);
     if (m_acceptInfo.addCut( cutFamilyName, "Selection of SecVtx tracks according to " + cutFamilyName ) < 0) {
       ATH_MSG_ERROR( "Failed to add cut family " << cutFamilyName << " because the TAccept object is full." );
       return StatusCode::FAILURE;
@@ -145,6 +146,7 @@ StatusCode InDet::InDetSecVtxTrackSelectionTool::finalize()
   ATH_MSG_INFO( m_numTracksPassed << " / " << m_numTracksProcessed << " = "
 		<< m_numTracksPassed*100./m_numTracksProcessed << "% passed all cuts." );
 /**
+  std::lock_guard<std::mutex> lock{m_mutex};
   for (const auto& cutFamily : m_trackCuts) {
     ULong64_t numPassed = m_numTracksPassedCuts.at(m_acceptInfo.getCutPosition(cutFamily.first));
     ATH_MSG_INFO( numPassed << " = " << numPassed*100./m_numTracksProcessed << "% passed "
@@ -216,6 +218,7 @@ asg::AcceptData InDet::InDetSecVtxTrackSelectionTool::accept( const xAOD::TrackP
     }
   }
 
+  //  std::lock_guard<std::mutex> lock{m_mutex};
   // loop over all cuts
   UShort_t cutFamilyIndex = 0;
   for ( const auto& cutFamily : m_trackCuts ) {
@@ -229,7 +232,7 @@ asg::AcceptData InDet::InDetSecVtxTrackSelectionTool::accept( const xAOD::TrackP
       }
     }
     acceptData.setCutResult( cutFamilyIndex, pass );
-    if (pass) m_numTracksPassedCuts.at(cutFamilyIndex)++; // number of tracks that pass each cut family
+    //    if (pass) m_numTracksPassedCuts.at(cutFamilyIndex)++; // number of tracks that pass each cut family
     cutFamilyIndex++;
   }
 
@@ -288,6 +291,7 @@ InDet::InDetSecVtxTrackSelectionTool::accept( const Trk::Track& /* track */,
 //  m_accept = m_trkFilter->accept( track, vertex ) ;
 //  if ( ! (bool)( m_accept ) ) return m_accept ;
   
+//  std::lock_guard<std::mutex> lock{m_mutex};
   // for faster lookup in setCutResult we will keep track of the index explicitly
   UShort_t cutFamilyIndex = 0;
   for ( const auto& cutFamily : m_trackCuts ) {
@@ -301,7 +305,7 @@ InDet::InDetSecVtxTrackSelectionTool::accept( const Trk::Track& /* track */,
     }
     acceptData.setCutResult( cutFamilyIndex, pass );
     if (pass)
-      m_numTracksPassedCuts.at(cutFamilyIndex)++; // increment the number of tracks that passed this cut family
+      //      m_numTracksPassedCuts.at(cutFamilyIndex)++; // increment the number of tracks that passed this cut family
     cutFamilyIndex++;
   }
   
diff --git a/InnerDetector/InDetRecTools/InDetSecVxFinderTool/InDetSecVxFinderTool/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/InDetSecVxFinderTool/InDetSecVxFinderTool/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..48a8717a3dbbfe199b345ad18fd9bb3985e28804
--- /dev/null
+++ b/InnerDetector/InDetRecTools/InDetSecVxFinderTool/InDetSecVxFinderTool/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetRecTools/InDetSecVxFinderTool
diff --git a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx
index c559257aed067e6b25b361b785fee0afdcecfeae..a4fc7a559f1cdd455b4d62fc7d2e12c188e1999b 100644
--- a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx
@@ -391,7 +391,7 @@ bool InDet::InDetTrackHoleSearchTool::getMapOfHits(const Trk::Track& track,
     while (iterTSOS!=track.trackStateOnSurfaces()->end()
            && (!(*iterTSOS)->type(Trk::TrackStateOnSurface::Measurement)
                || (*iterTSOS)->measurementOnTrack()->associatedSurface().type()!=Trk::Surface::Plane)) {
-      iterTSOS++;
+      ++iterTSOS;
     }
   }
 
diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetVKalVxInJetTool.h b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetVKalVxInJetTool.h
index fdf8c1b8b848fa74ee84e82dca0a7a41476d2143..b6e88bc5a331e3bde70e31a58b2d7bbd1bd98c22 100755
--- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetVKalVxInJetTool.h
+++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetVKalVxInJetTool.h
@@ -405,7 +405,7 @@ namespace InDet {
 //
 //
 
-      void printWrkSet(const std::vector<WrkVrt> * WrkSet, const std::string name ) const;
+      void printWrkSet(const std::vector<WrkVrt> * WrkSet, const std::string& name ) const;
 
 
       StatusCode CutTrk(double,double, double , double , double , 
@@ -443,15 +443,15 @@ namespace InDet {
       double JetProjDist(Amg::Vector3D &SecVrt, const xAOD::Vertex &PrimVrt, const TLorentzVector &JetDir) const;
 
       double VrtVrtDist(const Trk::RecVertex & PrimVrt, const Amg::Vector3D & SecVrt, 
-                                  const std::vector<double> VrtErr,double& Signif ) const;
+                                  const std::vector<double>& VrtErr,double& Signif ) const;
       double VrtVrtDist(const xAOD::Vertex & PrimVrt, const Amg::Vector3D & SecVrt, 
-                                  const std::vector<double> VrtErr,double& Signif ) const;
+                                  const std::vector<double>& VrtErr,double& Signif ) const;
       double VrtVrtDist2D(const xAOD::Vertex & PrimVrt, const Amg::Vector3D & SecVrt, 
-                                  const std::vector<double> VrtErr,double& Signif ) const;
+                                  const std::vector<double>& VrtErr,double& Signif ) const;
       double VrtVrtDist(const Trk::RecVertex & PrimVrt, const Amg::Vector3D & SecVrt, 
-                                  const std::vector<double> SecVrtErr, const TLorentzVector & JetDir) const;
+                                  const std::vector<double>& SecVrtErr, const TLorentzVector & JetDir) const;
       double VrtVrtDist(const xAOD::Vertex & PrimVrt, const Amg::Vector3D & SecVrt, 
-                                  const std::vector<double> SecVrtErr, const TLorentzVector & JetDir) const;
+                                  const std::vector<double>& SecVrtErr, const TLorentzVector & JetDir) const;
       double VrtVrtDist(const Amg::Vector3D & Vrt1, const std::vector<double>& VrtErr1,
                         const Amg::Vector3D & Vrt2, const std::vector<double>& VrtErr2) const;
  
diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSec.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSec.cxx
index ff9afe1b914aa0eeef14dbb7e82a23a86f7a1bf2..1b28eaca35269914d4d07ce8cd0b20005c66fc21 100755
--- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSec.cxx
+++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSec.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // Header include
@@ -706,7 +706,7 @@ namespace InDet{
       std::vector<double> Chi2PerTrk,VKPerigee,CovPerigee,closeVrtSig(0),closeVrtCh2(0);
       //TLorentzVector   Momentum;
       std::vector<double> Impact,ImpactError;
-      double             Chi2, Signif3D, Dist2D, JetVrtDir;
+      double             Signif3D, Dist2D, JetVrtDir;
       long int           Charge;
       int i,j;
       StatusCode sc; sc.setChecked();
@@ -726,7 +726,7 @@ namespace InDet{
       std::vector<int> hitIBL(NTracks,0), hitBL(NTracks,0);
       std::vector<double> TrackSignif(NTracks),TrkSig3D(NTracks);
       std::vector< std::vector<float> > trkScore(NTracks);
-      AmgVector(5) tmpPerigee; tmpPerigee<<0.,0.,0.,0.,0.;
+      AmgVector(5) tmpPerigee; tmpPerigee.setZero();
       for (i=0; i<NTracks; i++) {
          TrkSig3D[i] = m_fitSvc->VKalGetImpact(SelectedTracks[i], PrimVrt.position(), 1, Impact, ImpactError);
          tmpPerigee = GetPerigee(SelectedTracks[i])->parameters(); 
@@ -948,7 +948,7 @@ namespace InDet{
 	          ListSecondTracks.push_back(SelectedTracks[i]);
 	          ListSecondTracks.push_back(SelectedTracks[j]);
 	          closeVrtSig.push_back(Signif3D);
-	          closeVrtCh2.push_back(Chi2);
+	          closeVrtCh2.push_back(tmpVrt.Chi2);
                 }
 	     }
          }
diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSecMulti.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSecMulti.cxx
index 2ed426626b48ef82bee2b6b39438e74f2143432e..0b80fcf4533128670a506e2ee2dd3188f4897ae2 100755
--- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSecMulti.cxx
+++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSecMulti.cxx
@@ -267,7 +267,7 @@ const double c_vrtBCMassLimit=5500.;  // Mass limit to consider a vertex not com
       //printWrkSet(WrkVrtSet,"InitialVrts");
       //for(auto ku : vrtWithCommonTrk)std::cout<<" nCom="<<ku.first<<" v1="<<ku.second.first<<" v2="<<ku.second.second<<'\n';
       //===========================================
-      for(icvrt=vrtWithCommonTrk.rbegin(); icvrt!=vrtWithCommonTrk.rend(); icvrt++){ 
+      for(icvrt=vrtWithCommonTrk.rbegin(); icvrt!=vrtWithCommonTrk.rend(); ++icvrt){ 
           int nTCom=(*icvrt).first;
           int iv=(*icvrt).second.first;
           int jv=(*icvrt).second.second;
@@ -656,7 +656,7 @@ const double c_vrtBCMassLimit=5500.;  // Mass limit to consider a vertex not com
       for(int it=0; it<(int)nonusedTrk.size(); it++){ if(matchSV[it].indVrt==iv){addTrk[matchSV[it].Signif3D]=it;} }
       std::map<double,int>::iterator atrk=addTrk.begin();
       if(addTrk.size()>0){       if(atrk->first<4.){newV.SelTrk.push_back(nonusedTrk[atrk->second]);addedT=true;}}
-      if(addTrk.size()>1){atrk++;if(atrk->first<4.){newV.SelTrk.push_back(nonusedTrk[atrk->second]);}}
+      if(addTrk.size()>1){++atrk;if(atrk->first<4.){newV.SelTrk.push_back(nonusedTrk[atrk->second]);}}
       if(addedT){ if     (xAODwrk)vProb = RefitVertex( newV, xAODwrk->listJetTracks, *state, true);
                   else if(RECwork)vProb = RefitVertex( newV, RECwork->listJetTracks, *state, true); 
                  if(vProb>0.01)GoodVertices[iv]=newV;
@@ -1019,7 +1019,7 @@ const double c_vrtBCMassLimit=5500.;  // Mass limit to consider a vertex not com
 	std::deque<long int>::iterator it;
 //std::cout<<" In Found ="<<SelectedTrack<<", "<<SelectedVertex<<'\n';
 	for(it=(*WrkVrtSet).at(SelectedVertex).SelTrk.begin(); 
-	    it!=(*WrkVrtSet)[SelectedVertex].SelTrk.end();     it++) {
+	    it!=(*WrkVrtSet)[SelectedVertex].SelTrk.end();     ++it) {
 	    if( (*it) == SelectedTrack ) { 
 	       (*WrkVrtSet)[SelectedVertex].SelTrk.erase(it); break;
 	    }     
@@ -1027,7 +1027,7 @@ const double c_vrtBCMassLimit=5500.;  // Mass limit to consider a vertex not com
 	}   
 
 	for(it=(*TrkInVrt).at(SelectedTrack).begin(); 
-	    it!=(*TrkInVrt)[SelectedTrack].end();     it++) {
+	    it!=(*TrkInVrt)[SelectedTrack].end();     ++it) {
 	    if( (*it) == SelectedVertex ) { 
 	       (*TrkInVrt)[SelectedTrack].erase(it); break;
 	    }     
@@ -1036,7 +1036,7 @@ const double c_vrtBCMassLimit=5500.;  // Mass limit to consider a vertex not com
 //Check if track is removed from 2tr vertex => then sharing of track left should also be decreased
         if( (*WrkVrtSet)[SelectedVertex].SelTrk.size() == 1){
 	   long int LeftTrack=(*WrkVrtSet)[SelectedVertex].SelTrk[0];  // track left in 1tr vertex
-	   for(it=(*TrkInVrt).at(LeftTrack).begin();  it!=(*TrkInVrt)[LeftTrack].end();  it++) {
+	   for(it=(*TrkInVrt).at(LeftTrack).begin();  it!=(*TrkInVrt)[LeftTrack].end();  ++it) {
 	      if( (*it) == SelectedVertex ) { 
 	       (*TrkInVrt)[LeftTrack].erase(it); break;
 	      }     
@@ -1377,7 +1377,7 @@ const double c_vrtBCMassLimit=5500.;  // Mass limit to consider a vertex not com
    const
    {
       std::deque<long int>::iterator trk=test.begin();
-      for(trk=test.begin(); trk!=test.end(); trk++)
+      for(trk=test.begin(); trk!=test.end(); ++trk)
          if(std::find(base.begin(), base.end(), (*trk)) == base.end()) return false;  //element not found => test is not part of base
       return true;
    }
diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/CutTrk.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/CutTrk.cxx
index ae1d7c7e3d947fb7515244c3b6eea179e4b7fee5..f8905ae52b22a60b28cf53f216fac31bdea1d8d7 100755
--- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/CutTrk.cxx
+++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/CutTrk.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // Header include
@@ -53,7 +53,7 @@ namespace InDet{
    {    
 
     std::vector<const Rec::TrackParticle*>::const_iterator   i_ntrk;
-    AmgVector(5) VectPerig; VectPerig<<0.,0.,0.,0.,0.;
+    AmgVector(5) VectPerig; VectPerig.setZero();
     const Trk::Perigee* mPer;
     const Trk::FitQuality*     TrkQual;
     std::vector<double> Impact,ImpactError;
diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/Utilities.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/Utilities.cxx
index 59d38fa4a2ab613d4f92842dbc6bb5b324cab2d1..b7069acde9af707b46429c02bcee62e83cd9d7aa 100755
--- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/Utilities.cxx
+++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/Utilities.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // Header include
@@ -73,7 +73,7 @@ namespace InDet{
     return tl;
   }
 
-  void InDetVKalVxInJetTool::printWrkSet(const std::vector<WrkVrt> *, const std::string ) const {
+  void InDetVKalVxInJetTool::printWrkSet(const std::vector<WrkVrt> *, const std::string& ) const {
 /*  void InDetVKalVxInJetTool::printWrkSet(const std::vector<WrkVrt> *WrkVrtSet, const std::string name) const {
     int nGoodV=0;
     for(int iv=0; iv<(int)WrkVrtSet->size(); iv++) {
@@ -127,7 +127,7 @@ namespace InDet{
   }
 
   double InDetVKalVxInJetTool::VrtVrtDist(const Trk::RecVertex & PrimVrt, const Amg::Vector3D & SecVrt, 
-                                          const std::vector<double> SecVrtErr, double& Signif)
+                                          const std::vector<double>& SecVrtErr, double& Signif)
   const
   {
     double distx =  PrimVrt.position().x()- SecVrt.x();
@@ -159,7 +159,7 @@ namespace InDet{
   }
   
   double InDetVKalVxInJetTool::VrtVrtDist(const xAOD::Vertex & PrimVrt, const Amg::Vector3D & SecVrt, 
-                                          const std::vector<double> SecVrtErr, double& Signif)
+                                          const std::vector<double>& SecVrtErr, double& Signif)
   const
   {
     double distx =  PrimVrt.x()- SecVrt.x();
@@ -192,7 +192,7 @@ namespace InDet{
   }
 
   double InDetVKalVxInJetTool::VrtVrtDist2D(const xAOD::Vertex & PrimVrt, const Amg::Vector3D & SecVrt, 
-                                          const std::vector<double> SecVrtErr, double& Signif)
+                                          const std::vector<double>& SecVrtErr, double& Signif)
   const
   {
     double distx =  PrimVrt.x()- SecVrt.x();
@@ -220,7 +220,7 @@ namespace InDet{
 // Significance along jet direction
 //--------------------------------------------------
   double InDetVKalVxInJetTool::VrtVrtDist(const Trk::RecVertex & PrimVrt, const Amg::Vector3D & SecVrt, 
-                                          const std::vector<double> SecVrtErr, const TLorentzVector & JetDir)
+                                          const std::vector<double>& SecVrtErr, const TLorentzVector & JetDir)
   const
   {
     Amg::Vector3D jetDir(JetDir.Vect().Unit().X(), JetDir.Vect().Unit().Y(), JetDir.Vect().Unit().Z());
@@ -258,7 +258,7 @@ namespace InDet{
 // Significance along jet direction
 //--------------------------------------------------
   double InDetVKalVxInJetTool::VrtVrtDist(const xAOD::Vertex & PrimVrt, const Amg::Vector3D & SecVrt, 
-                                          const std::vector<double> SecVrtErr, const TLorentzVector & JetDir)
+                                          const std::vector<double>& SecVrtErr, const TLorentzVector & JetDir)
   const
   {
     Amg::Vector3D jetDir(JetDir.Vect().Unit().X(), JetDir.Vect().Unit().Y(), JetDir.Vect().Unit().Z());
@@ -401,7 +401,7 @@ namespace InDet{
      double sx=SumP.Px()/Norm; double sy=SumP.Py()/Norm; double sz=SumP.Pz()/Norm;
 
      double px=0.,py=0.,pz=0.,ee=0.; double scale;
-     AmgVector(5) VectPerig; VectPerig<<0.,0.,0.,0.,0.;
+     AmgVector(5) VectPerig; VectPerig.setZero();
      for (int i = 0; i < (int)InpTrk.size(); ++i) {
        if( InpTrk[i]== NULL ){ continue; } 
        VectPerig = InpTrk[i]->parameters(); 
@@ -428,7 +428,7 @@ namespace InDet{
      double sx=Dir.x()/Norm; double sy=Dir.y()/Norm; double sz=Dir.z()/Norm;
 
      double px=0.,py=0.,pz=0.,ee=0.; double scale;
-     AmgVector(5) VectPerig; VectPerig<<0.,0.,0.,0.,0.;
+     AmgVector(5) VectPerig; VectPerig.setZero();
      for (int i = 0; i < (int)InpTrk.size(); ++i) {
        if( InpTrk[i] == NULL ){ continue; } 
        VectPerig = InpTrk[i]->parameters(); 
@@ -466,7 +466,7 @@ namespace InDet{
   TLorentzVector InDetVKalVxInJetTool::TotalMom(const std::vector<const Trk::Perigee*>& InpTrk) 
   const
   {
-     AmgVector(5) VectPerig; VectPerig<<0.,0.,0.,0.,0.;
+     AmgVector(5) VectPerig; VectPerig.setZero();
      double px=0.,py=0.,pz=0.,ee=0.;
      for (int i = 0; i < (int)InpTrk.size(); ++i) {
        if( InpTrk[i] == NULL ){ continue; } 
diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..b9f7598d95ed1dd3b4e00515ed10c3f845741aff
--- /dev/null
+++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetRecTools/PixelToTPIDTool
diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixeldEdxAODFix.h b/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixeldEdxAODFix.h
deleted file mode 100644
index 1f0cad39ed3957f2901167e6651b629fcc581ce1..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixeldEdxAODFix.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef PIXELTOTPIDTOOL_PIXELDEDXAODFIX_H
-#define PIXELTOTPIDTOOL_PIXELDEDXAODFIX_H
-
-#include "AthenaBaseComps/AthAlgorithm.h"
-#include "GaudiKernel/ToolHandle.h"
-
-namespace Trk {
-  class ITrackSummaryHelperTool;
-}
-
-namespace InDet {
-  class PixeldEdxAODFix : public AthAlgorithm
-  {
-  public:
-    PixeldEdxAODFix(const std::string &name, ISvcLocator *pSvcLocator);
-    virtual ~PixeldEdxAODFix();
-    StatusCode initialize();
-    StatusCode execute();
-    StatusCode finalize();
-  
-  private:
-    ToolHandle< Trk::ITrackSummaryHelperTool > m_summarytool;
-    std::vector<std::string> m_tpcontainernames;
-  };
-
-}
-
-#endif
diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixeldEdxAODFix.cxx b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixeldEdxAODFix.cxx
deleted file mode 100644
index b2b12a635e909be31c5178b43906fa96ab83a493..0000000000000000000000000000000000000000
--- a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixeldEdxAODFix.cxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "PixelToTPIDTool/PixeldEdxAODFix.h"
-#include "TrkTrackSummary/TrackSummary.h"
-#include "TrkTrackSummary/InDetTrackSummary.h"
-#include "TrkToolInterfaces/ITrackSummaryHelperTool.h"
-#include "Particle/TrackParticleContainer.h"
-#include "Particle/TrackParticle.h"
-#include "TrkTrack/Track.h"
-#include "TrkTrack/TrackStateOnSurface.h"
-
-namespace InDet
-{
-PixeldEdxAODFix::PixeldEdxAODFix(const std::string &name, ISvcLocator *pSvcLocator)
-        : AthAlgorithm (name, pSvcLocator),
-          m_summarytool("") {
-
-  declareProperty("TrackParticleContainers",m_tpcontainernames);
-  declareProperty("SummaryHelperTool",m_summarytool);
-}
-
-PixeldEdxAODFix::~PixeldEdxAODFix() {
-}
-
-StatusCode PixeldEdxAODFix::initialize() {
-  msg(MSG::INFO) << "PixeldEdxAODFix::initialize()" << endmsg;
-  if ( m_summarytool.retrieve().isFailure() ) {
-    msg(MSG:: FATAL) << m_summarytool.propertyName() << ": Failed to retrieve tool " << m_summarytool.type() << endmsg;
-    return StatusCode::FAILURE;
-  } else {
-    msg(MSG::INFO) << m_summarytool.propertyName() << ": Retrieved tool " << m_summarytool.type() << endmsg;
-  }
-  return StatusCode::SUCCESS;
-
-}
-
-StatusCode PixeldEdxAODFix::execute() {
-
-  for (int i=0;i<(int)m_tpcontainernames.size();i++){
-    const Rec::TrackParticleContainer *tpcontainer=0;
-    StatusCode sc=evtStore()->retrieve(tpcontainer,m_tpcontainernames[i]);
-    if (sc.isFailure()){
-      msg(MSG::WARNING) << "Could not retrieve " << m_tpcontainernames[i] << endmsg;
-      return sc;
-    }
-
-    for (Rec::TrackParticleContainer::const_iterator it = tpcontainer->begin(); it != tpcontainer->end(); it++) {
-      const Rec::TrackParticle* particle = *it;
-      Trk::TrackSummary *summ=const_cast<Trk::TrackSummary *>(particle->trackSummary());
-      if (!summ->indetTrackSummary()) continue;
-      std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; 
-      typePattern.set(Trk::TrackStateOnSurface::Perigee); 
-      const Trk::TrackStateOnSurface *pertsos=new Trk::TrackStateOnSurface(0,particle->perigee()->clone(),0,0,typePattern); 
-      DataVector<const Trk::TrackStateOnSurface>*dv=new DataVector<const Trk::TrackStateOnSurface>;
-      dv->push_back(pertsos);
-      Trk::TrackInfo info(Trk::TrackInfo::GlobalChi2Fitter,Trk::pion);
-   
-      Trk::Track tmptrack(info,dv,0);
-      m_summarytool->addDetailedTrackSummary(tmptrack,*summ);
-
-    }
-  }
-  return StatusCode::SUCCESS;
-}
-
-StatusCode PixeldEdxAODFix::finalize() {
-
-  return StatusCode::SUCCESS;
-
-}
-
-}
diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/components/PixelToTPIDTool_entries.cxx b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/components/PixelToTPIDTool_entries.cxx
index 52ee9bda88d7068eeb01323bafff189c7cf38608..2f37c6790bb52e221327a7e7047a0f5ddce729c7 100644
--- a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/components/PixelToTPIDTool_entries.cxx
+++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/components/PixelToTPIDTool_entries.cxx
@@ -1,6 +1,3 @@
 #include "PixelToTPIDTool/PixelToTPIDTool.h"
-#include "PixelToTPIDTool/PixeldEdxAODFix.h"
 
 DECLARE_COMPONENT( InDet::PixelToTPIDTool )
-DECLARE_COMPONENT( InDet::PixeldEdxAODFix )
- 
diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt
index a956ded30719648d2aae19b986ac6c4832af7d9a..5c1639fc50ed9244cbc831e414104b6ed1046c27 100644
--- a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt
+++ b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt
@@ -30,7 +30,6 @@ atlas_depends_on_subdirs(
    Tracking/TrkEvent/TrkParameters
    Tracking/TrkUtilityPackages/TrkNeuralNetworkUtils
    PRIVATE
-   Control/CxxUtils
    Database/AthenaPOOL/AthenaPoolUtilities
    Database/AthenaPOOL/PoolSvc
    Database/APR/FileCatalog
@@ -55,7 +54,7 @@ atlas_add_library( SiClusterizationToolLib
    LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives
    Identifier EventPrimitives GaudiKernel InDetSimData InDetIdentifier
    InDetReadoutGeometry PixelReadoutGeometry SCT_ReadoutGeometry InDetRawData InDetPrepRawData InDetRecToolInterfaces InDetConditionsSummaryService
-   TrkParameters TrkNeuralNetworkUtilsLib CxxUtils PixelConditionsData
+   TrkParameters TrkNeuralNetworkUtilsLib PixelConditionsData
    PixelGeoModelLib PixelCablingLib BeamSpotConditionsData
    PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaPoolUtilities FileCatalog AtlasDetDescr
    TrkSurfaces TrkEventPrimitives VxVertex PixelGeoModelLib PoolSvcLib DetDescrCondToolsLib )
diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h
index b9f73edaaa5cd362ed3670534e6033e91e2c3c33..0f43a64ad1ccecd2974ea4fbd6c15f92a9d44ec6 100644
--- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h
+++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
  #ifndef BTAGTOOL_NnClusterizationFactory_C
@@ -42,9 +42,6 @@
 #include "PixelConditionsData/PixelChargeCalibCondData.h"
 #include "StoreGate/ReadCondHandleKey.h"
 
-#include "CxxUtils/checker_macros.h"
-ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
-
  class TTrainedNetwork;
  class TH1;
  class ICoolHistSvc;
diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx
index 531507c9380d4c67374b0f8da3157c4e549305e9..fee3a5de629f0baef7aa06854e8da32b2d60f097 100644
--- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx
+++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -46,19 +46,6 @@
 #include <cmath>
 #include <regex>
 
-#include "CxxUtils/checker_macros.h"
-ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
-// The following warning message appears four times and the check is disabled for this file.
-// InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx:
-// In member function 'std::vector<double> InDet::NnClusterizationFactory::
-// estimateNumberOfParticles(const InDet::PixelCluster&, Amg::Vector3D&, int, int) const':
-// InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx:307:77:
-// warning: Const discarded from expression '<unknown>' of type
-// const InDet::NnClusterizationFactory* const' within function 'std::vector<double>
-// InDet::NnClusterizationFactory::estimateNumberOfParticles
-// (const InDet::PixelCluster&, Amg::Vector3D&, int, int) const'; may not be thread-safe.
-// std::vector<double> inputData=(this->*m_assembleInput)(input,sizeX,sizeY);
-
 namespace InDet {
 
   const char * const NnClusterizationFactory::s_nnTypeNames[]={
diff --git a/InnerDetector/InDetRecTools/SiCombinatorialTrackFinderTool_xk/src/SiCombinatorialTrackFinder_xk.cxx b/InnerDetector/InDetRecTools/SiCombinatorialTrackFinderTool_xk/src/SiCombinatorialTrackFinder_xk.cxx
index ce6e4f5dae799547bb83efe2854c3258673d2669..a066435c3fcb64a8cd079ec3655ebe5c8fb6e82f 100644
--- a/InnerDetector/InDetRecTools/SiCombinatorialTrackFinderTool_xk/src/SiCombinatorialTrackFinder_xk.cxx
+++ b/InnerDetector/InDetRecTools/SiCombinatorialTrackFinderTool_xk/src/SiCombinatorialTrackFinder_xk.cxx
@@ -42,7 +42,7 @@ InDet::SiCombinatorialTrackFinder_xk::SiCombinatorialTrackFinder_xk
 // Initialisation
 ///////////////////////////////////////////////////////////////////
 
-StatusCode InDet::SiCombinatorialTrackFinder_xk::initialize ATLAS_NOT_THREAD_SAFE ()
+StatusCode InDet::SiCombinatorialTrackFinder_xk::initialize()
 {  
   // Get RungeKutta propagator tool
   //
diff --git a/InnerDetector/InDetRecTools/TRT_DetElementsRoadTool_xk/TRT_DetElementsRoadTool_xk/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/TRT_DetElementsRoadTool_xk/TRT_DetElementsRoadTool_xk/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..5634d78f3f59fe3e78866843a8e4bcfb4fe31e92
--- /dev/null
+++ b/InnerDetector/InDetRecTools/TRT_DetElementsRoadTool_xk/TRT_DetElementsRoadTool_xk/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetRecTools/TRT_DetElementsRoadTool_xk
diff --git a/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/TRT_SegmentToTrackTool/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/TRT_SegmentToTrackTool/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..96aa223261c8a5f3d7dc1635d6f3a6ebc314ef2f
--- /dev/null
+++ b/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/TRT_SegmentToTrackTool/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetRecTools/TRT_SegmentToTrackTool
diff --git a/InnerDetector/InDetRecTools/TRT_TrackSegmentsTool_xk/TRT_TrackSegmentsTool_xk/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/TRT_TrackSegmentsTool_xk/TRT_TrackSegmentsTool_xk/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..1d130be46fe7a3e5ccfd6b4188e741631b7079a3
--- /dev/null
+++ b/InnerDetector/InDetRecTools/TRT_TrackSegmentsTool_xk/TRT_TrackSegmentsTool_xk/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetRecTools/TRT_TrackSegmentsTool_xk
diff --git a/InnerDetector/InDetSimUtils/TRT_PAI_Process/CMakeLists.txt b/InnerDetector/InDetSimUtils/TRT_PAI_Process/CMakeLists.txt
index c2654c23c6f3cf2854e2d94c1c2006659fadaf87..828c31d1135512429582695d072ccdc5148627be 100644
--- a/InnerDetector/InDetSimUtils/TRT_PAI_Process/CMakeLists.txt
+++ b/InnerDetector/InDetSimUtils/TRT_PAI_Process/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( TRT_PAI_Process )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          GaudiKernel
-                          PRIVATE
-                          Control/StoreGate
-                          InnerDetector/InDetDetDescr/InDetReadoutGeometry
-			  InnerDetector/InDetDetDescr/TRT_ReadoutGeometry)
-
 # External dependencies:
 find_package( CLHEP )
 
diff --git a/InnerDetector/InDetSimUtils/TRT_TR_Process/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetSimUtils/TRT_TR_Process/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..a787f60c7f9c1741da0f3c989d20aa9e03e687ae
--- /dev/null
+++ b/InnerDetector/InDetSimUtils/TRT_TR_Process/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetSimUtils/TRT_TR_Process
diff --git a/InnerDetector/InDetSimUtils/TRT_TR_Process/CMakeLists.txt b/InnerDetector/InDetSimUtils/TRT_TR_Process/CMakeLists.txt
index 1bd1d7f7eb4f8bc560361b990049155473cdb8d0..2813e3aa8f75b27fbbbe2b7132e34eeef7b2ba62 100644
--- a/InnerDetector/InDetSimUtils/TRT_TR_Process/CMakeLists.txt
+++ b/InnerDetector/InDetSimUtils/TRT_TR_Process/CMakeLists.txt
@@ -5,20 +5,6 @@
 # Declare the package name:
 atlas_subdir( TRT_TR_Process )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/CxxUtils
-                          Control/StoreGate
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          DetectorDescription/IdDictDetDescr
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Utilities/GeoMaterial2G4
-                          Tools/PathResolver )
-
 # External dependencies:
 find_package( Boost )
 find_package( CLHEP )
diff --git a/InnerDetector/InDetTrigRecTools/InDetTrigToolInterfaces/InDetTrigToolInterfaces/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetTrigRecTools/InDetTrigToolInterfaces/InDetTrigToolInterfaces/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..6a15e54c445f78e9c470c43652accbd79b00018a
--- /dev/null
+++ b/InnerDetector/InDetTrigRecTools/InDetTrigToolInterfaces/InDetTrigToolInterfaces/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetTrigRecTools/InDetTrigToolInterfaces
diff --git a/InnerDetector/InDetTruth/InDetTruthAlgs/CMakeLists.txt b/InnerDetector/InDetTruth/InDetTruthAlgs/CMakeLists.txt
index b0e804c2c0a54b89a31c7fafe43ecc5d4899eedb..1e4faf8284b2d5874defcf84e61d5f6a2cfd7fee 100644
--- a/InnerDetector/InDetTruth/InDetTruthAlgs/CMakeLists.txt
+++ b/InnerDetector/InDetTruth/InDetTruthAlgs/CMakeLists.txt
@@ -23,7 +23,7 @@ atlas_depends_on_subdirs( PUBLIC
 atlas_add_component( InDetTruthAlgs
                      src/*.cxx
                      src/components/*.cxx
-                     LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests GaudiKernel InDetSimData InDetPrepRawData TrkTruthData TrkToolInterfaces TrkTrack EventContainers )
+                     LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests GaudiKernel InDetSimData InDetPrepRawData TrkTruthData TrkToolInterfaces TrkTrack EventContainers InDetTruthInterfaces )
 
 # Install files from the package:
 atlas_install_headers( InDetTruthAlgs )
diff --git a/InnerDetector/InDetTruth/InDetTruthInterfaces/CMakeLists.txt b/InnerDetector/InDetTruth/InDetTruthInterfaces/CMakeLists.txt
index 68a622e4fec1e4ed79c41529df33db497eb7b3c6..804ea1650ca1fa549f71e65966c6bf0ff21ec9c5 100644
--- a/InnerDetector/InDetTruth/InDetTruthInterfaces/CMakeLists.txt
+++ b/InnerDetector/InDetTruth/InDetTruthInterfaces/CMakeLists.txt
@@ -9,6 +9,8 @@ atlas_subdir( InDetTruthInterfaces )
 atlas_depends_on_subdirs( PUBLIC
                           GaudiKernel )
 
-# Install files from the package:
-atlas_install_headers( InDetTruthInterfaces )
-
+atlas_add_library( InDetTruthInterfaces
+                   InDetTruthInterfaces/*.h
+                   INTERFACE
+                   PUBLIC_HEADERS InDetTruthInterfaces
+                   LINK_LIBRARIES GaudiKernel )
diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/InDetPerformanceRTT/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetValidation/InDetPerformanceRTT/InDetPerformanceRTT/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..c0b9ee9c29d24706b83d5fb6e576dbd89bd2f6db
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/InDetPerformanceRTT/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetValidation/InDetPerformanceRTT
diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/InDetPerformanceRTT/IDStandardPerformance.h b/InnerDetector/InDetValidation/InDetPerformanceRTT/InDetPerformanceRTT/IDStandardPerformance.h
index f2ab80bcfdf70de6bb1d0ce05a57e0be40c63602..eafe2ed95f17d93e6ada022b585b62f9719b414f 100755
--- a/InnerDetector/InDetValidation/InDetPerformanceRTT/InDetPerformanceRTT/IDStandardPerformance.h
+++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/InDetPerformanceRTT/IDStandardPerformance.h
@@ -10,6 +10,7 @@
 // AUTHORS: Beate Heinemann, Jean-Francois Arguin
 // **********************************************************************
 
+#include <atomic>
 #include <vector>
 #include <map>
 #include <memory>
@@ -740,7 +741,8 @@ class IDStandardPerformance : public ManagedMonitorToolBase
 
     void FillTrackIncidencePlots(detAreaTypes detArea, int phiWidth, int zWidth, float PixTrkAngle, float PixTrkThetaI);
 
-    const Trk::TrackParameters*  getUnbiasedTrackParameters(const Trk::TrackParameters* trkParameters, const Trk::MeasurementBase* measurement );
+    const Trk::TrackParameters*  getUnbiasedTrackParameters(const Trk::TrackParameters* trkParameters, const Trk::MeasurementBase* measurement,
+                                                            int& isUnbiased);
     void SetSafeMinimumMaximum(TH1* h1, float min, float max);
 
     float m_Pi;
@@ -806,8 +808,7 @@ class IDStandardPerformance : public ManagedMonitorToolBase
         , const InDetDD::SiDetectorElementCollection* elements);
 
 
-    mutable int       m_isUnbiased;  //!< if can get unbiased residuals
-    mutable bool      m_UpdatorWarning; //!< warn only once, if unbiased track states can not be calculated
+    mutable std::atomic<bool> m_UpdatorWarning; //!< warn only once, if unbiased track states can not be calculated
 
 };
 //} // close of namespace
diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/src/IDStandardPerformance.cxx b/InnerDetector/InDetValidation/InDetPerformanceRTT/src/IDStandardPerformance.cxx
index db417ba12db821e7af73581cb3eb4b8ca3e0df4c..de68fadb87ccb6d312ca90344e67f89305905714 100755
--- a/InnerDetector/InDetValidation/InDetPerformanceRTT/src/IDStandardPerformance.cxx
+++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/src/IDStandardPerformance.cxx
@@ -163,7 +163,6 @@ IDStandardPerformance::IDStandardPerformance( const std::string & type, const st
   declareProperty("PixeltracksName",          m_PixeltracksName);
   declareProperty("SCTtracksName",            m_SCTtracksName);
   m_UpdatorWarning = false;
-  m_isUnbiased = 0;
 }
 
 
@@ -3616,10 +3615,9 @@ void IDStandardPerformance::MakeHitPlots(const DataVector<Trk::Track>* trks){
 
     //for each track see if we can get updator tool
     //if (m_updator) {
+    int isUnbiased = 0; // if can get unbiased residuals
     if (! m_updatorHandle.empty()){
-      m_isUnbiased = 1;
-    } else {
-      m_isUnbiased = 0;
+      isUnbiased = 1;
     }
 
     // ----------------------------------------------------------------
@@ -3959,7 +3957,7 @@ void IDStandardPerformance::MakeHitPlots(const DataVector<Trk::Track>* trks){
 
         if (mesb && biasedTrackParameters) {
           // track parameters at outliers are already unbiased by definition
-          const Trk::TrackParameters *trackParameters = (!(*TSOSItr)->type(Trk::TrackStateOnSurface::Outlier)) ? getUnbiasedTrackParameters(biasedTrackParameters,mesb) : biasedTrackParameters;
+          const Trk::TrackParameters *trackParameters = (!(*TSOSItr)->type(Trk::TrackStateOnSurface::Outlier)) ? getUnbiasedTrackParameters(biasedTrackParameters,mesb,isUnbiased) : biasedTrackParameters;
           if (!m_residualPullCalculator.empty()) {
           // fill general residuals and pulls
           // for the residuals and pulls always use the ROT.
@@ -3971,7 +3969,7 @@ void IDStandardPerformance::MakeHitPlots(const DataVector<Trk::Track>* trks){
 	    int phiWidth = -1;
 	    int zWidth   = -1;
 	    // float pullLocY     = -1000.;
-            if (hit && m_isUnbiased && trkpt>m_minTrackPtRes) {
+            if (hit && isUnbiased && trkpt>m_minTrackPtRes) {
 	      // Cluster width determination
 	      if(m_idHelper->is_pixel(surfaceID) ||  m_idHelper->is_sct(surfaceID)) {
 		const InDet::SiCluster* pCluster = dynamic_cast <const InDet::SiCluster*>(hit->prepRawData());
@@ -4041,7 +4039,7 @@ void IDStandardPerformance::MakeHitPlots(const DataVector<Trk::Track>* trks){
 		  PixTrkAngle = ( M_PI / 2 ) - PixTrkAngle;
 		}
 	      detAreaTypes detArea = n_detAreaTypes;
-	      Trk::ResidualPull::ResidualType resType = m_isUnbiased
+	      Trk::ResidualPull::ResidualType resType = isUnbiased
                                                       ? Trk::ResidualPull::Unbiased
                                                       : Trk::ResidualPull::Biased;
               const std::unique_ptr<const Trk::ResidualPull> residualPull(m_residualPullCalculator->residualPull(hit,
@@ -4726,7 +4724,8 @@ void IDStandardPerformance::FillTrackIncidencePlots(detAreaTypes detArea, int ph
 
 const Trk::TrackParameters*
 IDStandardPerformance::getUnbiasedTrackParameters(const Trk::TrackParameters* trkParameters
-                                                , const Trk::MeasurementBase* measurement ) {
+                                                , const Trk::MeasurementBase* measurement
+                                                , int& isUnbiased) {
   const Trk::TrackParameters *unbiasedTrkParameters = 0;
 
   // ------------------------------------
@@ -4736,7 +4735,7 @@ IDStandardPerformance::getUnbiasedTrackParameters(const Trk::TrackParameters* tr
   //const Trk::MeasuredTrackParameters *measuredTrkParameters =
   //dynamic_cast<const Trk::MeasuredTrackParameters*>(trkParameters);
 
-  if (!m_updatorHandle.empty() && (m_isUnbiased==1) ) {
+  if (!m_updatorHandle.empty() && (isUnbiased==1) ) {
     if ( trkParameters->covariance() ) {
       // Get unbiased state
       unbiasedTrkParameters =
@@ -4747,7 +4746,7 @@ IDStandardPerformance::getUnbiasedTrackParameters(const Trk::TrackParameters* tr
       if (!unbiasedTrkParameters) {
     msg(MSG::WARNING) << "Could not get unbiased track parameters, "
         <<"use normal parameters" << endmsg;
-    m_isUnbiased = 0;
+    isUnbiased = 0;
       }
     } else if (!m_UpdatorWarning) {
       // warn only once!
@@ -4755,9 +4754,9 @@ IDStandardPerformance::getUnbiasedTrackParameters(const Trk::TrackParameters* tr
       <<"Unbiased track states can not be calculated "
       <<"(ie. pulls and residuals will be too small)" << endmsg;
       m_UpdatorWarning = true;
-      m_isUnbiased = 0;
+      isUnbiased = 0;
     } else {
-      m_isUnbiased = 0;
+      isUnbiased = 0;
     }// end if no measured track parameter
   }
   return unbiasedTrkParameters;
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValDecoration.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValDecoration.py
index a95f6b552495eeef19ba12e35de1a7bc8c20c6c7..2dc4fc298f19c42e1a0ef6aa45cd8994d76cde6e 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValDecoration.py
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValDecoration.py
@@ -149,7 +149,7 @@ def getInDetRttTruthSelectionTool(**kwargs) :
                             requireStatus1 = True,
                             requireCharged = True,
                             maxBarcode = ( 200*1000 if kwargs.pop("OnlyDressPrimaryTracks",True) else 2**31-1 ),
-                            maxProdVertRadius = 110.,
+                            maxProdVertRadius = 300.,
                             maxEta = 2.5,
                             minPt = 400. )
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml
index e7cc7e5953197a2ae6802f6a9735fc329e83293b..79abfa53da330a99f80bc5d7b41da40c58c90770 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml
@@ -630,6 +630,10 @@
   <x title="p_{T} [GeV]" n="25" lo="0" hi="50"/>
   <y title="Efficiency" lo="0.0" hi="2.0"/>
 </h>
+<h id="efficiency_vs_pt_low" type="TEfficiency" title="Fraction of reco-matched truth track">
+  <x title="p_{T} [GeV]" n="52" lo="0.4" hi="3"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
 <h id="efficiency_vs_phi" type="TEfficiency" title="Fraction of reco-matched truth track">
   <x title="#phi [rads]" n="25" lo="-&PI;" hi="&PI;"/>
   <y title="Efficiency" lo="0.0" hi="2.0"/>
@@ -650,6 +654,14 @@
   <x title="Z [mm]" n="100" lo="-350" hi="350"/>
   <y title="Efficiency" lo="0.0" hi="2.0"/>
 </h>
+<h id="extended_efficiency_vs_d0" type="TEfficiency" title="Fraction of reco-matched truth track">
+  <x title="d_{0} [mm]" n="50" lo="-300" hi="300"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="extended_efficiency_vs_z0" type="TEfficiency" title="Fraction of reco-matched truth track">
+  <x title="z_{0} [mm]" n="50" lo="-750" hi="750"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
 <h id="efficiency_vs_prodR" type="TEfficiency" title="Track Efficiency vs Production Vertex Radius">
   <x title="prod_R [mm]" n="100" lo="0" hi="1500"/>
   <y title="Efficiency" lo="0.0" hi="2.0"/>
@@ -1066,7 +1078,7 @@
 
 <h id="pullHelper_eta_ptqopt" type="TH2F" title="pull vs #eta for p_{T} #times q/p_{T}">
   <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/>
-  <y title="(reco_{q/p_{T}} - truth_{q/p_{T}) / #sigma(q/p_{T})" n="100" lo="-10.0" hi="10.0"/>
+  <y title="(reco_{q/p_{T}} - truth_{q/p_{T}}) / #sigma(q/p_{T})" n="100" lo="-10.0" hi="10.0"/>
 </h>
 
 <h id="pullHelper_eta_theta" type="TH2F" title="pull vs #eta for #theta">
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Efficiency.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Efficiency.cxx
index 8e67ab65728c7a15ed2d026fde9e4e06fb61f858..e62298d7631a5b31d89a632159d4ccb24497d9b7 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Efficiency.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Efficiency.cxx
@@ -14,11 +14,14 @@ InDetPerfPlot_Efficiency::InDetPerfPlot_Efficiency(InDetPlotBase* pParent, const
   InDetPlotBase(pParent, sDir),
   m_efficiency_vs_eta{},
   m_efficiency_vs_pt{},
+  m_efficiency_vs_pt_low{},
   m_efficiency_vs_phi{},
   m_efficiency_vs_d0{},
   m_efficiency_vs_z0{},
   m_efficiency_vs_R{},
   m_efficiency_vs_Z{},
+  m_extended_efficiency_vs_d0{},
+  m_extended_efficiency_vs_z0{},
   m_efficiency_vs_prodR{},
   m_efficiency_vs_prodZ{} {
   // nop
@@ -29,12 +32,15 @@ InDetPerfPlot_Efficiency::initializePlots() {
 
   book(m_efficiency_vs_eta, "efficiency_vs_eta");
   book(m_efficiency_vs_pt, "efficiency_vs_pt");
+  book(m_efficiency_vs_pt_low, "efficiency_vs_pt_low");
   book(m_efficiency_vs_phi, "efficiency_vs_phi");
   book(m_efficiency_vs_d0, "efficiency_vs_d0");
   book(m_efficiency_vs_z0, "efficiency_vs_z0");
   book(m_efficiency_vs_R, "efficiency_vs_R");
   book(m_efficiency_vs_Z, "efficiency_vs_Z");
 
+  book(m_extended_efficiency_vs_d0, "extended_efficiency_vs_d0");
+  book(m_extended_efficiency_vs_z0, "extended_efficiency_vs_z0");
   book(m_efficiency_vs_prodR, "efficiency_vs_prodR");
   book(m_efficiency_vs_prodZ, "efficiency_vs_prodZ");
 
@@ -48,6 +54,7 @@ InDetPerfPlot_Efficiency::fill(const xAOD::TruthParticle& truth, const bool isGo
 
   fillHisto(m_efficiency_vs_eta, eta, isGood);
   fillHisto(m_efficiency_vs_pt, pt, isGood);
+  fillHisto(m_efficiency_vs_pt_low, pt, isGood);
   fillHisto(m_efficiency_vs_phi, phi, isGood);
 
   double d0 = truth.auxdata<float>("d0");
@@ -59,6 +66,8 @@ InDetPerfPlot_Efficiency::fill(const xAOD::TruthParticle& truth, const bool isGo
   fillHisto(m_efficiency_vs_R, R, isGood);
   fillHisto(m_efficiency_vs_Z, Z, isGood);
 
+  fillHisto(m_extended_efficiency_vs_d0, d0, isGood);
+  fillHisto(m_extended_efficiency_vs_z0, z0, isGood);
   if (truth.hasProdVtx()) {
     const xAOD::TruthVertex* vtx = truth.prodVtx();
     double prod_rad = vtx->perp();
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Efficiency.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Efficiency.h
index b07f687e3ae53135b75e066cab249574cdf29f74..e075aedf929f56d62a51c9a543c7f35a9e76e43f 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Efficiency.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Efficiency.h
@@ -33,12 +33,15 @@ public:
 private:
   TEfficiency* m_efficiency_vs_eta;
   TEfficiency* m_efficiency_vs_pt;
+  TEfficiency* m_efficiency_vs_pt_low;
   TEfficiency* m_efficiency_vs_phi;
   TEfficiency* m_efficiency_vs_d0;
   TEfficiency* m_efficiency_vs_z0;
   TEfficiency* m_efficiency_vs_R;
   TEfficiency* m_efficiency_vs_Z;
 
+  TEfficiency* m_extended_efficiency_vs_d0;
+  TEfficiency* m_extended_efficiency_vs_z0;
   TEfficiency* m_efficiency_vs_prodR;
   TEfficiency* m_efficiency_vs_prodZ;
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.cxx
index d7eaa5113295b5f9bbc06bf19e56e1b0698b8015..ab319b3d7957eb849ef90c7c513b80977ad22ca2 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.cxx
@@ -367,7 +367,7 @@ InDetPerfPlot_Resolution::getTrackParameters(const xAOD::TruthParticle& truthprt
     }
   }
   //rescale Pt 
-  if (m_truetrkP[PT] != undefinedValue) m_truetrkP[PT] = truthprt.pt() / Gaudi::Units::GeV;
+  m_truetrkP[PT] = truthprt.pt() / Gaudi::Units::GeV;
   //special cases
   //need both theta and qOverP for qOverPT
   //we didnt check qOverP yet, since the closest named variable (strangely; see header) is ptqopt
@@ -422,4 +422,4 @@ InDetPerfPlot_Resolution::finalizePlots() {
 
   }
 
-}
\ No newline at end of file
+}
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
index 80be6f74dcd152b3ee590798875253f5a00219f1..f88dfc4668250d1026433cfd290e9319653b8072 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
@@ -343,18 +343,20 @@ InDetPhysValMonitoringTool::fillHistograms() {
       //
       //Loop over reco tracks to find the match
       //
+      const xAOD::TrackParticle* matchedTrack = nullptr;
       for (const auto& thisTrack: selectedTracks) { // Inner loop over selected track particles
         const xAOD::TruthParticle* associatedTruth = getAsTruth.getTruth(thisTrack);
         if (associatedTruth && associatedTruth == thisTruth) {
           float prob = getMatchingProbability(*thisTrack);
           if (not std::isnan(prob) && prob > m_lowProb) {
             isEfficient = true;
+            matchedTrack = thisTrack;
             break;
           }
         }
       }
       ATH_MSG_DEBUG("Filling efficiency plots info monitoring plots");
-      m_monPlots->fillEfficiency(*thisTruth, isEfficient, puEvents);
+      m_monPlots->fillEfficiency(*thisTruth, *matchedTrack, isEfficient, puEvents);
     }
   }
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx
index 547002cf1a89e1264ae5d7d63f7b6f7d3cf4a969..f74928bc807cbcaab76769325548c55338640935 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx
@@ -40,6 +40,32 @@ InDetRttPlots::InDetRttPlots(InDetPlotBase* pParent, const std::string& sDir, co
     m_resolutionPlotSecd = std::unique_ptr<InDetPerfPlot_Resolution>(new InDetPerfPlot_Resolution(this, "Tracks/Matched/Resolutions/Secondary"));
     m_hitsMatchedTracksPlots = std::unique_ptr<InDetPerfPlot_Hits>(new InDetPerfPlot_Hits(this, "Tracks/Matched/HitsOnTracks"));
     m_vertexTruthMatchingPlots = std::unique_ptr<InDetPerfPlot_VertexTruthMatching>(new InDetPerfPlot_VertexTruthMatching(this, "Vertices/AllPrimaryVertices", m_iDetailLevel));
+
+    //Split by track author
+    m_effSiSPSeededFinderPlots = std::unique_ptr<InDetPerfPlot_Efficiency>(new InDetPerfPlot_Efficiency(this, "TracksByAuthor/SiSPSeededFinder/Tracks/Efficiency"));
+    m_effInDetExtensionProcessorPlots = std::unique_ptr<InDetPerfPlot_Efficiency>(new InDetPerfPlot_Efficiency(this, "TracksByAuthor/InDetExtensionProcessor/Tracks/Efficiency"));
+    m_effTRTSeededTrackFinderPlots = std::unique_ptr<InDetPerfPlot_Efficiency>(new InDetPerfPlot_Efficiency(this, "TracksByAuthor/TRTSeededTrackFinder/Tracks/Efficiency"));
+    m_effTRTStandalonePlots = std::unique_ptr<InDetPerfPlot_Efficiency>(new InDetPerfPlot_Efficiency(this, "TracksByAuthor/TRTStandalone/Tracks/Efficiency"));
+    m_effSiSpacePointsSeedMaker_LargeD0Plots = std::unique_ptr<InDetPerfPlot_Efficiency>(new InDetPerfPlot_Efficiency(this, "TracksByAuthor/SiSpacePointsSeedMaker_LargeD0/Tracks/Efficiency"));
+
+    m_fakeSiSPSeededFinderPlots = std::unique_ptr<InDetPerfPlot_FakeRate>(new InDetPerfPlot_FakeRate(this, "TracksByAuthor/SiSPSeededFinder/Tracks/FakeRate"));
+    m_fakeInDetExtensionProcessorPlots = std::unique_ptr<InDetPerfPlot_FakeRate>(new InDetPerfPlot_FakeRate(this, "TracksByAuthor/InDetExtensionProcessor/Tracks/FakeRate"));
+    m_fakeTRTSeededTrackFinderPlots = std::unique_ptr<InDetPerfPlot_FakeRate>(new InDetPerfPlot_FakeRate(this, "TracksByAuthor/TRTSeededTrackFinder/Tracks/FakeRate"));
+    m_fakeTRTStandalonePlots = std::unique_ptr<InDetPerfPlot_FakeRate>(new InDetPerfPlot_FakeRate(this, "TracksByAuthor/TRTStandalone/Tracks/FakeRate"));
+    m_fakeSiSpacePointsSeedMaker_LargeD0Plots = std::unique_ptr<InDetPerfPlot_FakeRate>(new InDetPerfPlot_FakeRate(this, "TracksByAuthor/SiSpacePointsSeedMaker_LargeD0/Tracks/FakeRate"));
+
+    m_trkParaSiSPSeededFinderPlots = std::unique_ptr<InDetPerfPlot_TrackParameters>(new InDetPerfPlot_TrackParameters(this, "TracksByAuthor/SiSPSeededFinder/Tracks/Parameters"));
+    m_trkParaInDetExtensionProcessorPlots = std::unique_ptr<InDetPerfPlot_TrackParameters>(new InDetPerfPlot_TrackParameters(this, "TracksByAuthor/InDetExtensionProcessor/Tracks/Parameters"));
+    m_trkParaTRTSeededTrackFinderPlots = std::unique_ptr<InDetPerfPlot_TrackParameters>(new InDetPerfPlot_TrackParameters(this, "TracksByAuthor/TRTSeededTrackFinder/Tracks/Parameters"));
+    m_trkParaTRTStandalonePlots = std::unique_ptr<InDetPerfPlot_TrackParameters>(new InDetPerfPlot_TrackParameters(this, "TracksByAuthor/TRTStandalone/Tracks/Parameters"));
+    m_trkParaSiSpacePointsSeedMaker_LargeD0Plots = std::unique_ptr<InDetPerfPlot_TrackParameters>(new InDetPerfPlot_TrackParameters(this, "TracksByAuthor/SiSpacePointsSeedMaker_LargeD0/Tracks/Parameters"));
+
+    m_resSiSPSeededFinderPlots = std::unique_ptr<InDetPerfPlot_Resolution>(new InDetPerfPlot_Resolution(this, "TracksByAuthor/SiSPSeededFinder/Tracks/Resolution"));
+    m_resInDetExtensionProcessorPlots = std::unique_ptr<InDetPerfPlot_Resolution>(new InDetPerfPlot_Resolution(this, "TracksByAuthor/InDetExtensionProcessor/Tracks/Resolution"));
+    m_resTRTSeededTrackFinderPlots = std::unique_ptr<InDetPerfPlot_Resolution>(new InDetPerfPlot_Resolution(this, "TracksByAuthor/TRTSeededTrackFinder/Tracks/Resolution"));
+    m_resTRTStandalonePlots = std::unique_ptr<InDetPerfPlot_Resolution>(new InDetPerfPlot_Resolution(this, "TracksByAuthor/TRTStandalone/Tracks/Resolution"));
+    m_resSiSpacePointsSeedMaker_LargeD0Plots = std::unique_ptr<InDetPerfPlot_Resolution>(new InDetPerfPlot_Resolution(this, "TracksByAuthor/SiSpacePointsSeedMaker_LargeD0/Tracks/Resolution"));
+
   }
 
   //A lot of Jets... do we need these at all???
@@ -65,6 +91,26 @@ InDetRttPlots::fill(const xAOD::TrackParticle& particle, const xAOD::TruthPartic
     } else if (barcode >= 200000 && prob > 0.7 && m_iDetailLevel >= 200) {
         m_resolutionPlotSecd->fill(particle, truthParticle);
     }
+
+    if(m_iDetailLevel >= 200 and (barcode < 200000 and barcode != 0 and prob > 0.5)){
+      std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo>  patternInfo = particle.patternRecoInfo();
+    
+      bool isSiSpSeededFinder = patternInfo.test(0);
+      bool isInDetExtensionProcessor = patternInfo.test(3);
+      bool isTRTSeededTrackFinder = patternInfo.test(4);
+      bool isTRTStandalone = patternInfo.test(20);
+      bool isSiSpacePointsSeedMaker_LargeD0 = patternInfo.test(49);
+
+      if(isSiSpSeededFinder and not isInDetExtensionProcessor) m_resSiSPSeededFinderPlots->fill(particle, truthParticle);
+      if(isInDetExtensionProcessor and not (isTRTSeededTrackFinder or isSiSpacePointsSeedMaker_LargeD0)) m_resInDetExtensionProcessorPlots->fill(particle, truthParticle);
+      if(isTRTSeededTrackFinder and not isTRTStandalone) m_resTRTSeededTrackFinderPlots->fill(particle, truthParticle);
+      if(isTRTStandalone) m_resTRTStandalonePlots->fill(particle, truthParticle);
+      if(isSiSpacePointsSeedMaker_LargeD0) m_resSiSpacePointsSeedMaker_LargeD0Plots->fill(particle, truthParticle);
+
+    }
+
+
+
   }
  
   if(m_iDetailLevel >= 200){
@@ -85,6 +131,24 @@ InDetRttPlots::fill(const xAOD::TrackParticle& particle) {
   m_hitEffPlot.fill(particle);
   // fill pt plots
   m_trackParameters.fill(particle);
+  if(m_iDetailLevel >= 200){
+    std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo>  patternInfo = particle.patternRecoInfo();
+    
+    bool isSiSpSeededFinder = patternInfo.test(0);
+    bool isInDetExtensionProcessor = patternInfo.test(3);
+    bool isTRTSeededTrackFinder = patternInfo.test(4);
+    bool isTRTStandalone = patternInfo.test(20);
+    bool isSiSpacePointsSeedMaker_LargeD0 = patternInfo.test(49);
+
+    if(isSiSpSeededFinder and not isInDetExtensionProcessor) m_trkParaSiSPSeededFinderPlots->fill(particle);
+    else if(isInDetExtensionProcessor and not (isTRTSeededTrackFinder or isSiSpacePointsSeedMaker_LargeD0)) m_trkParaInDetExtensionProcessorPlots->fill(particle);
+    else if(isTRTSeededTrackFinder and not isTRTStandalone) m_trkParaTRTSeededTrackFinderPlots->fill(particle);
+    else if(isTRTStandalone) m_trkParaTRTStandalonePlots->fill(particle);
+    else if(isSiSpacePointsSeedMaker_LargeD0) m_trkParaSiSpacePointsSeedMaker_LargeD0Plots->fill(particle);
+
+  }
+
+
   m_hitsRecoTracksPlots.fill(particle);
 }
 
@@ -104,8 +168,35 @@ InDetRttPlots::fill(const xAOD::TruthParticle& truthParticle) {
 
 
 void
-InDetRttPlots::fillEfficiency(const xAOD::TruthParticle& truth, const bool isGood, const unsigned int /*nMuEvents*/) {
+InDetRttPlots::fillEfficiency(const xAOD::TruthParticle& truth, const xAOD::TrackParticle& track, const bool isGood, const unsigned int /*nMuEvents*/) {
   m_effPlots.fill(truth, isGood);
+
+  if(m_iDetailLevel >= 200){
+    if(isGood){
+      std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo>  patternInfo = track.patternRecoInfo();
+    
+      bool isSiSpSeededFinder = patternInfo.test(0);
+      bool isInDetExtensionProcessor = patternInfo.test(3);
+      bool isTRTSeededTrackFinder = patternInfo.test(4);
+      bool isTRTStandalone = patternInfo.test(20);
+      bool isSiSpacePointsSeedMaker_LargeD0 = patternInfo.test(49);
+
+      if(isSiSpSeededFinder and not isInDetExtensionProcessor) m_effSiSPSeededFinderPlots->fill(truth, isGood);
+      if(isInDetExtensionProcessor and not (isTRTSeededTrackFinder or isSiSpacePointsSeedMaker_LargeD0)) m_effInDetExtensionProcessorPlots->fill(truth, isGood);
+      if(isTRTSeededTrackFinder and not isTRTStandalone) m_effTRTSeededTrackFinderPlots->fill(truth, isGood);
+      if(isTRTStandalone) m_effTRTStandalonePlots->fill(truth, isGood);
+      if(isSiSpacePointsSeedMaker_LargeD0) m_effSiSpacePointsSeedMaker_LargeD0Plots->fill(truth, isGood);
+    } else {
+      m_effSiSPSeededFinderPlots->fill(truth, isGood);
+      m_effInDetExtensionProcessorPlots->fill(truth, isGood);
+      m_effTRTSeededTrackFinderPlots->fill(truth, isGood);
+      m_effTRTStandalonePlots->fill(truth, isGood);
+      m_effSiSpacePointsSeedMaker_LargeD0Plots->fill(truth, isGood);
+
+    }
+    
+  }
+
 }
 
 //
@@ -116,7 +207,25 @@ void
 InDetRttPlots::fillFakeRate(const xAOD::TrackParticle& track, const bool isFake, const bool isAssociatedTruth){
 
   m_missingTruthFakePlots.fill(track, !isAssociatedTruth);
-  if(isAssociatedTruth) m_fakePlots.fill(track, isFake);
+  if(isAssociatedTruth) {
+    m_fakePlots.fill(track, isFake);
+
+    if(m_iDetailLevel >= 200){
+      std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo>  patternInfo = track.patternRecoInfo();
+      
+      bool isSiSpSeededFinder = patternInfo.test(0);
+      bool isInDetExtensionProcessor = patternInfo.test(3);
+      bool isTRTSeededTrackFinder = patternInfo.test(4);
+      bool isTRTStandalone = patternInfo.test(20);
+      bool isSiSpacePointsSeedMaker_LargeD0 = patternInfo.test(49);
+
+      if(isSiSpSeededFinder and not isInDetExtensionProcessor) m_fakeSiSPSeededFinderPlots->fill(track, isFake); //No extensions 
+      if(isInDetExtensionProcessor and not (isTRTSeededTrackFinder or isSiSpacePointsSeedMaker_LargeD0)) m_fakeInDetExtensionProcessorPlots->fill(track, isFake); //Extensions but not Back-tracking
+      if(isTRTSeededTrackFinder and not isTRTStandalone) m_fakeTRTSeededTrackFinderPlots->fill(track, isFake); //BackTracking
+      if(isTRTStandalone) m_fakeTRTStandalonePlots->fill(track, isFake); //TRT standalone
+      if(isSiSpacePointsSeedMaker_LargeD0) m_fakeSiSpacePointsSeedMaker_LargeD0Plots->fill(track, isFake); //ANT
+    }
+  }
 
 }
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h
index c4302232d859cc4ba1e7067e17b916e5a7769b11..d666f14c5612e63200da194f5afacd550a61acbf 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h
@@ -56,7 +56,7 @@ public:
   ///fill for things needing truth only
   void fill(const xAOD::TruthParticle& particle);
   ///Fill for efficiency plots
-  void fillEfficiency(const xAOD::TruthParticle& truth, const bool isGood, unsigned int /*mu=0*/);
+  void fillEfficiency(const xAOD::TruthParticle& truth, const xAOD::TrackParticle& track, const bool isGood, unsigned int /*mu=0*/);
 
   ///fill for things needing all truth - not just the ones from the reco tracks
   
@@ -97,6 +97,34 @@ private:
   bool m_doTrackInJetPlots;
   std::unique_ptr<InDetPerfPlot_TrkInJet> m_trkInJetPlots;
 
+  //By track authors
+  std::unique_ptr<InDetPerfPlot_Efficiency> m_effSiSPSeededFinderPlots;
+  std::unique_ptr<InDetPerfPlot_Efficiency> m_effInDetExtensionProcessorPlots;
+  std::unique_ptr<InDetPerfPlot_Efficiency> m_effTRTSeededTrackFinderPlots;
+  std::unique_ptr<InDetPerfPlot_Efficiency> m_effTRTStandalonePlots;
+  std::unique_ptr<InDetPerfPlot_Efficiency> m_effSiSpacePointsSeedMaker_LargeD0Plots;
+
+  std::unique_ptr<InDetPerfPlot_FakeRate> m_fakeSiSPSeededFinderPlots;
+  std::unique_ptr<InDetPerfPlot_FakeRate> m_fakeInDetExtensionProcessorPlots;
+  std::unique_ptr<InDetPerfPlot_FakeRate> m_fakeTRTSeededTrackFinderPlots;
+  std::unique_ptr<InDetPerfPlot_FakeRate> m_fakeTRTStandalonePlots;
+  std::unique_ptr<InDetPerfPlot_FakeRate> m_fakeSiSpacePointsSeedMaker_LargeD0Plots;
+
+  std::unique_ptr<InDetPerfPlot_TrackParameters> m_trkParaSiSPSeededFinderPlots;
+  std::unique_ptr<InDetPerfPlot_TrackParameters> m_trkParaInDetExtensionProcessorPlots;
+  std::unique_ptr<InDetPerfPlot_TrackParameters> m_trkParaTRTSeededTrackFinderPlots;
+  std::unique_ptr<InDetPerfPlot_TrackParameters> m_trkParaTRTStandalonePlots;
+  std::unique_ptr<InDetPerfPlot_TrackParameters> m_trkParaSiSpacePointsSeedMaker_LargeD0Plots;
+
+  std::unique_ptr<InDetPerfPlot_Resolution> m_resSiSPSeededFinderPlots;
+  std::unique_ptr<InDetPerfPlot_Resolution> m_resInDetExtensionProcessorPlots;
+  std::unique_ptr<InDetPerfPlot_Resolution> m_resTRTSeededTrackFinderPlots;
+  std::unique_ptr<InDetPerfPlot_Resolution> m_resTRTStandalonePlots;
+  std::unique_ptr<InDetPerfPlot_Resolution> m_resSiSpacePointsSeedMaker_LargeD0Plots;
+
+
+
+
   std::string m_trackParticleTruthProbKey;
   float m_truthProbLowThreshold;
 };
diff --git a/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/CMakeLists.txt b/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/CMakeLists.txt
index 68fb9ca29890175c4ecfd39289285ab1903f587b..1876f3624f686391a16bae96e047f02a59d4084a 100644
--- a/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/CMakeLists.txt
+++ b/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/CMakeLists.txt
@@ -8,6 +8,7 @@ atlas_subdir( InDetTrackClusterAssValidation )
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
                           Control/AthenaBaseComps
+                          Control/CxxUtils
                           Control/StoreGate
                           InnerDetector/InDetRecEvent/InDetPrepRawData
                           Tracking/TrkEvent/TrkSpacePoint
@@ -26,7 +27,7 @@ atlas_add_component( InDetTrackClusterAssValidation
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} 
-                     LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasHepMCLib AthenaBaseComps StoreGateLib SGtests InDetPrepRawData TrkSpacePoint TrkTruthData GaudiKernel TrkRIO_OnTrack TrkTrack )
+                     LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasHepMCLib AthenaBaseComps CxxUtils StoreGateLib SGtests InDetPrepRawData TrkSpacePoint TrkTruthData GaudiKernel TrkRIO_OnTrack TrkTrack )
 
 # Install files from the package:
 atlas_install_headers( InDetTrackClusterAssValidation )
diff --git a/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/InDetTrackClusterAssValidation/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/InDetTrackClusterAssValidation/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..68d571ba6a3b7f0ace9f050c097e77f48176199e
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/InDetTrackClusterAssValidation/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetValidation/InDetTrackClusterAssValidation
diff --git a/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/InDetTrackClusterAssValidation/TrackClusterAssValidation.h b/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/InDetTrackClusterAssValidation/TrackClusterAssValidation.h
index ba6e76b089f780cf65430bf9fa58b4b6377f948b..c1a437ce7e8bb7781813b0ceb74c9eab4636e0cd 100755
--- a/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/InDetTrackClusterAssValidation/TrackClusterAssValidation.h
+++ b/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/InDetTrackClusterAssValidation/TrackClusterAssValidation.h
@@ -6,9 +6,8 @@
 #ifndef TrackClusterAssValidation_H
 #define TrackClusterAssValidation_H
 
-
-
 #include "AthenaBaseComps/AthReentrantAlgorithm.h"
+#include "CxxUtils/checker_macros.h"
 #include "InDetPrepRawData/SiClusterContainer.h"
 #include "InDetPrepRawData/TRT_DriftCircleContainer.h"
 #include "InDetReadoutGeometry/SiDetectorElementCollection.h"
@@ -236,8 +235,8 @@ namespace InDet {
       };
 
       mutable std::mutex                           m_statMutex;
-      mutable std::vector<TrackCollectionStat_t>   m_trackCollectionStat;
-      mutable EventStat_t                          m_eventStat;
+      mutable std::vector<TrackCollectionStat_t>   m_trackCollectionStat ATLAS_THREAD_SAFE; // Guarded by m_statMutex
+      mutable EventStat_t                          m_eventStat ATLAS_THREAD_SAFE; // Guarded by m_statMutex
 
       unsigned int                       m_clcut                  ;
       unsigned int                       m_clcutTRT               ;
diff --git a/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/src/TrackClusterAssValidation.cxx b/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/src/TrackClusterAssValidation.cxx
index 2d5dc5811744c577c8700539bb9fd7459142ee41..e8cb30b7070b6cc58949bd1239de52565d54a32d 100755
--- a/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/src/TrackClusterAssValidation.cxx
+++ b/InnerDetector/InDetValidation/InDetTrackClusterAssValidation/src/TrackClusterAssValidation.cxx
@@ -756,6 +756,8 @@ MsgStream& InDet::TrackClusterAssValidation::dumpevent( MsgStream& out, const In
 
 void InDet::TrackClusterAssValidation::newClustersEvent(const EventContext& ctx,InDet::TrackClusterAssValidation::EventData_t &event_data) const
 {
+  std::lock_guard<std::mutex> lock(m_statMutex);
+
   // Get pixel clusters container
   //
   std::unique_ptr<SG::ReadHandle<SiClusterContainer> >       pixelcontainer;
diff --git a/InnerDetector/InDetValidation/InDetTrackValidation/CMakeLists.txt b/InnerDetector/InDetValidation/InDetTrackValidation/CMakeLists.txt
index 360596cf8666f3380675a8f595a6024aa1606aed..1cad0e19879db9bbbb8977392d20a99101ce8b7a 100644
--- a/InnerDetector/InDetValidation/InDetTrackValidation/CMakeLists.txt
+++ b/InnerDetector/InDetValidation/InDetTrackValidation/CMakeLists.txt
@@ -10,6 +10,7 @@ atlas_depends_on_subdirs(
    PUBLIC
    Control/AthenaBaseComps
    Control/AthenaKernel
+   Control/CxxUtils
    Control/StoreGate
    Event/xAOD/xAODEventInfo
    GaudiKernel
@@ -54,7 +55,7 @@ atlas_add_component( InDetTrackValidation
    InDetTrackValidation/*.h src/*.cxx src/components/*.cxx
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} 
    LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib
-   AthenaBaseComps AthenaKernel StoreGateLib SGtests xAODEventInfo GaudiKernel InDetRawData InDetPrepRawData
+   AthenaBaseComps AthenaKernel CxxUtils StoreGateLib SGtests xAODEventInfo GaudiKernel InDetRawData InDetPrepRawData
    InDetSimEvent TrkParameters TrkSpacePoint TrkTrack TrkValInterfaces AthContainers AtlasDetDescr
    EventPrimitives GeneratorObjects TRT_ConditionsData
    TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry SCT_CablingLib
diff --git a/InnerDetector/InDetValidation/InDetTrackValidation/InDetTrackValidation/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetValidation/InDetTrackValidation/InDetTrackValidation/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..6230983042119ddcf8692c92e22c0f41b9eef901
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetTrackValidation/InDetTrackValidation/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetValidation/InDetTrackValidation
diff --git a/InnerDetector/InDetValidation/InDetTrackValidation/InDetTrackValidation/HoleSearchValidation.h b/InnerDetector/InDetValidation/InDetTrackValidation/InDetTrackValidation/HoleSearchValidation.h
index 770427d5a4a667ba9ef0227f44d4e16d0a7879ab..95b6c6d12bfaa597187a14114d934754feda4fb9 100755
--- a/InnerDetector/InDetValidation/InDetTrackValidation/InDetTrackValidation/HoleSearchValidation.h
+++ b/InnerDetector/InDetValidation/InDetTrackValidation/InDetTrackValidation/HoleSearchValidation.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
 */
 
 //////////////////////////////////////////////////////////////////
@@ -11,6 +11,7 @@
 
 // Gaudi includes
 #include "AthenaBaseComps/AthReentrantAlgorithm.h"
+#include "CxxUtils/checker_macros.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "AthenaKernel/IAtRndmGenSvc.h"
@@ -115,7 +116,7 @@ namespace InDet {
 
     // some information for statistics -> printout in finalize
     mutable std::mutex                                  m_trackStatsMutex;
-    mutable std::vector< std::vector< unsigned int > >  m_trackStats; //!< # tracks as function of [#generated holes, #found holes]
+    mutable std::vector< std::vector< unsigned int > >  m_trackStats ATLAS_THREAD_SAFE; //!< # tracks as function of [#generated holes, #found holes]. Guarded by m_trackStatsMutex
 
   }; // end of class
 
diff --git a/InnerDetector/InDetValidation/PixelRTT/PixelRTT/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetValidation/PixelRTT/PixelRTT/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..82b838f80717b062dc63b8b148dad793793990e1
--- /dev/null
+++ b/InnerDetector/InDetValidation/PixelRTT/PixelRTT/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+InnerDetector/InDetValidation/PixelRTT
diff --git a/InnerDetector/InDetValidation/PixelRTT/src/ResPullValidation.cxx b/InnerDetector/InDetValidation/PixelRTT/src/ResPullValidation.cxx
index a168d64ad974d17439c15b806d9add3cdadb6ea5..e77b1b47899e1c37f2038c22e453641f864bb44f 100644
--- a/InnerDetector/InDetValidation/PixelRTT/src/ResPullValidation.cxx
+++ b/InnerDetector/InDetValidation/PixelRTT/src/ResPullValidation.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
 */
 
 #ifndef ResPullValidation_C
@@ -174,7 +174,7 @@ bool ResPullValidation::Fill(Int_t Layer, Double_t GeVTrkPt, Double_t Angle,
 	else HighPtRes=0.5;
 	if( fabs(Residual) < sqrt((0.5/GeVTrkPt)*(0.5/GeVTrkPt)
 				+ HighPtRes*HighPtRes) ){
-		static std::vector<Double_t> Pars(3);
+                std::vector<Double_t> Pars(3);
 		Pars[1] = ClusterSize;
 		Pars[0] = Layer;
 		m_AngleProfile->Fill(Angle,Residual,Pars);
diff --git a/InnerDetector/InDetValidation/PixelRTT/src/TrackValidation.cxx b/InnerDetector/InDetValidation/PixelRTT/src/TrackValidation.cxx
index c0cacd451cc6ad3a301e8769f01f7b148d53801e..589120816c6f47a5e96c584288ec917d071ad4a3 100644
--- a/InnerDetector/InDetValidation/PixelRTT/src/TrackValidation.cxx
+++ b/InnerDetector/InDetValidation/PixelRTT/src/TrackValidation.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
 */
 
 #ifndef CosmicTrackValidation_C
@@ -146,7 +146,7 @@ bool CosmicTrackValidation::Fill(Int_t Layer, Double_t GeVTrkPt, Double_t Angle,
 	//if( fabs(Residual) < sqrt((0.5/GeVTrkPt)*(0.5/GeVTrkPt) 
         //    + 5*HighPtRes*5*HighPtRes) ){
 		passed = kTRUE;
-		static std::vector<Double_t> Pars(3);
+                std::vector<Double_t> Pars(3);
 		//Pars[1] = ClusterSize;
 		Pars[0] = Layer;
 		m_AngleProfile->Fill(Angle,nhits,Pars);
diff --git a/LArCalorimeter/LArAlignment/LArAlignmentAlgs/CMakeLists.txt b/LArCalorimeter/LArAlignment/LArAlignmentAlgs/CMakeLists.txt
index 564fa1bd6b65d3edfce6d3312f9d0ed9feb1ac12..25a055221bcd69e840d297af5f25b7c84f26b560 100644
--- a/LArCalorimeter/LArAlignment/LArAlignmentAlgs/CMakeLists.txt
+++ b/LArCalorimeter/LArAlignment/LArAlignmentAlgs/CMakeLists.txt
@@ -18,7 +18,7 @@ atlas_depends_on_subdirs( PUBLIC
 atlas_add_component( LArAlignmentAlgs
                      src/*.cxx
                      src/components/*.cxx
-                     LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel DetDescrConditions )
+                     LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel DetDescrConditions RegistrationServicesLib )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
diff --git a/LArCalorimeter/LArCellRec/CMakeLists.txt b/LArCalorimeter/LArCellRec/CMakeLists.txt
index bde13e2f6559e4c93a0d5704f7ec9882de5db2e0..669544d781c6e57f961a01a3df063b0678b1ace1 100644
--- a/LArCalorimeter/LArCellRec/CMakeLists.txt
+++ b/LArCalorimeter/LArCellRec/CMakeLists.txt
@@ -67,9 +67,9 @@ atlas_install_joboptions( share/*.py )
 #  LOG_IGNORE_PATTERN "LArDetectorToolNV|is still valid|no data retrieved|Database being retired|Reading file|Unable to locate catalog|Resolved path|DigitizationFlags|^Domain|created CondCont|no dictionary for class|^ +[+]|Reading LArPedestalMC|IOV callback|^DetectorStore|Cache alignment" )
 
 
-#atlas_add_test( LArCellDeadOTXCorr_test
-#  SCRIPT test/LArCellDeadOTXCorr_test.sh
-#  PROPERTIES TIMEOUT 600
-#  LOG_IGNORE_PATTERN "LArDetectorToolNV|is still valid|no data retrieved|Database being retired|Reading file|Unable to locate catalog|Resolved path|DigitizationFlags|^Domain|created CondCont|no dictionary for class|^ +[+]|Reading LArPedestalMC|IOV callback|^DetectorStore|Cache alignment" )
+atlas_add_test( LArCellDeadOTXCorr_test
+  SCRIPT test/LArCellDeadOTXCorr_test.sh
+  PROPERTIES TIMEOUT 600
+  LOG_IGNORE_PATTERN "LArDetectorToolNV|is still valid|no data retrieved|Database being retired|Reading file|Unable to locate catalog|Resolved path|DigitizationFlags|^Domain|created CondCont|no dictionary for class|^ +[+]|Reading LArPedestalMC|IOV callback|^DetectorStore|Cache alignment|object with key|recorded new|into Conditions" )
 
 
diff --git a/LArCalorimeter/LArCellRec/share/LArCellDeadOTXCorr_test.py b/LArCalorimeter/LArCellRec/share/LArCellDeadOTXCorr_test.py
index d1c5e0bf8d77f064f63bd13b8b61af299e246946..c142444f30e47e3d3a8b8078a95b678ed311af9a 100644
--- a/LArCalorimeter/LArCellRec/share/LArCellDeadOTXCorr_test.py
+++ b/LArCalorimeter/LArCellRec/share/LArCellDeadOTXCorr_test.py
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration.
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
 #
 # File: LArCellRec/share/LArCellDeadOTXCorr_test.py
 # Author: sss
@@ -7,6 +7,7 @@
 # Brief: Unit test for LArCellDeadOTXCorr.
 #
 
+from __future__ import print_function
 
 import ROOT
 ROOT.TH1F
@@ -60,6 +61,34 @@ BADFEBS2 = [[(0, 1, 12,  3), 'deadReadout'],  # tt  0.2 2.5 (below noise)
 ###########################################################################
 
 
+# feb file format:
+# barrel_ec pos_neg feedthrough slot flags
+#  0       1       12      4  deadAll
+#  1       0       16      9 deadReadout deadAll
+# badfebs is a list of (barrel_ec, pos_neg, feedthrough, slot) tuples
+def make_bad_channel_condalg (name, badfebs = []):
+    from LArBadChannelTool.LArBadChannelToolConf import LArBadFebCondAlg
+    febfile = ''
+    if badfebs:
+        febfile = name + '.badfebs'
+        f = open (febfile, 'w')
+        for (feb, err) in badfebs:
+            print (feb[0], feb[1], feb[2], feb[3], err, file=f)
+        f.close()
+    alg = LArBadFebCondAlg ('LArBadFebCondAlg' + name,
+                            ReadKey = '',
+                            WriteKey = name,
+                            InputFileName = febfile)
+
+    from AthenaCommon.AlgSequence import AthSequencer
+    condSeq = AthSequencer("AthCondSeq")
+    condSeq += alg
+    return
+
+
+###########################################################################
+
+
 
 
 def make_calo_cells (detStore):
@@ -241,10 +270,6 @@ class TestAlg (Alg):
         if not self.tool2.retrieve():
             return StatusCode.Failure
 
-        self.cabling = ROOT.ToolHandle(ROOT.LArCablingService)('LArCablingService')
-        if not self.cabling.retrieve():
-            return StatusCode.Failure
-
         self.ttsvc = ROOT.ToolHandle(ROOT.CaloTriggerTowerService)('CaloTriggerTowerService')
         if not self.ttsvc.retrieve():
             return StatusCode.Failure
@@ -252,7 +277,8 @@ class TestAlg (Alg):
         return StatusCode.Success
 
     def execute (self):
-        iev = self.getContext().evt()
+        ctx = self.getContext()
+        iev = ctx.evt()
 
         (t, a) = make_TriggerTowerContainer()
         if not self.evtStore.record (t, 'xAODTriggerTowers', False):
@@ -283,7 +309,7 @@ class TestAlg (Alg):
                 ([34442, 34506, 34570, 34634], 1314.39941406),
                 ]
 
-        if not tool.process (self.ccc):
+        if not tool.process (self.ccc, ctx):
             return StatusCode.Failure
  
         self.check_and_reset_cells (exp_diffs)
@@ -318,15 +344,16 @@ class TestAlg (Alg):
 
     # Print list of FEBS corresponding to each entry in tt_table.
     def print_tt_febs (self):
+        cabling = self.condStore()['LArOnOffIdMap'].find (ctx.eventID())
         for tt in tt_table:
-            emid, hadid, febs = self.tt_to_febs (tt[0], tt[1])
-            print 'tt ', tt[0], tt[1], hex(emid), hex(hadid),
+            emid, hadid, febs = self.tt_to_febs (cabling, tt[0], tt[1])
+            print ('tt ', tt[0], tt[1], hex(emid), hex(hadid), end='')
             for feb, idv in febs.items():
-                print feb, hex(idv),
-            print
+                print (feb, hex(idv), end='')
+            print()
         return
         
-    def tt_to_febs (self, eta, phi):
+    def tt_to_febs (self, cabling, eta, phi):
         lvl1Helper = self.idmgr.getLVL1_ID()
         pos_neg_z = self.pos_neg_z (eta)
         region = self.region_index (eta)
@@ -337,7 +364,7 @@ class TestAlg (Alg):
         febs = {}
         for ttid in (emid, hadid):
             for cellid in self.ttsvc.createCellIDvecTT (ttid):
-                febid = self.cabling.createSignalChannelID (cellid)
+                febid = cabling.createSignalChannelID (cellid)
                 barrel_ec = self.onlineID.barrel_ec (febid)
                 pos_neg = self.onlineID.pos_neg (febid)
                 feedthrough = self.onlineID.feedthrough (febid)
@@ -379,10 +406,18 @@ class TestAlg (Alg):
         return -1
 
 
+from LArCabling.LArCablingAccess import LArOnOffIdMapping
+LArOnOffIdMapping()
+
+make_bad_channel_condalg ('GoodFebs')
+make_bad_channel_condalg ('BadFebs', BADFEBS2)
+
 tool1 = LArCellDeadOTXCorrToolDefault ('tool1')
+tool1.BadFebKey = 'GoodFebs'
 ToolSvc += tool1
 
 tool2 = LArCellDeadOTXCorrToolDefault ('tool2')
+tool2.BadFebKey = 'BadFebs'
 ToolSvc += tool2
 #tool2.useL1CaloDB = True
 
diff --git a/LArCalorimeter/LArCellRec/share/LArCellDeadOTXCorr_test.ref b/LArCalorimeter/LArCellRec/share/LArCellDeadOTXCorr_test.ref
index 14d2c35cacab673fc9801379ad0323ad7ee5b274..1042ca79a9eb3228458b972738137908ae3d7971 100644
--- a/LArCalorimeter/LArCellRec/share/LArCellDeadOTXCorr_test.ref
+++ b/LArCalorimeter/LArCellRec/share/LArCellDeadOTXCorr_test.ref
@@ -1,43 +1,41 @@
-Tue Oct  2 15:11:22 CEST 2018
-Preloading tcmalloc_minimal.so
+Tue Jun 16 23:28:55 EDT 2020
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [WorkDir-22.0.1] [x86_64-slc6-gcc62-opt] [warn_lar/7b7c03e74d] -- built on [2018-10-02T1309]
+Py:Athena            INFO using release [?-22.0.0] [?] [?/?] -- built on [?]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "LArCellRec/LArCellDeadOTXCorr_test.py"
-[?1034hSetGeometryVersion.py obtained major release version 22
+Py:Athena            INFO SetGeometryVersion.py obtained major release version 22
 Py:Athena            INFO including file "IdDictDetDescrCnv/IdDictDetDescrCnv_joboptions.py"
-Py:ConfigurableDb    INFO Read module info for 5500 configurables from 6 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5202 configurables from 2 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
-EventInfoMgtInit: Got release version  Athena-22.0.1
+EventInfoMgtInit: Got release version  sss-22.0.0
 Py:IOVDbSvc.CondDB    INFO Setting up conditions DB access to instance OFLP200
 Py:Athena            INFO including file "CaloIdCnv/CaloIdCnv_joboptions.py"
 Py:Athena            INFO including file "CaloConditions/CaloConditions_jobOptions.py"
 Py:Athena            INFO including file "CaloConditions/LArTTCellMap_ATLAS_jobOptions.py"
 Py:Athena            INFO including file "CaloConditions/CaloTTIdMap_ATLAS_jobOptions.py"
 Py:Athena            INFO including file "LArConditionsCommon/LArConditionsCommon_MC_jobOptions.py"
-ATLAS-R2-2016-01-00-01
+Py:JobPropertyContainer::    INFO ATLAS-R2-2016-01-00-01
 Py:JobPropertyContainer::    INFO  use global tag for all LArElecCalibMC constants 
 Py:Athena            INFO including file "LArConditionsCommon/LArIdMap_MC_jobOptions.py"
 Py:JobPropertyContainer::    INFO  setting folder /LAR/Identifier/OnOffIdMap with tag LARIdentifierOnOffIdMap-012
 Py:JobPropertyContainer::    INFO  setting folder /LAR/Identifier/CalibIdMap with tag LARIdentifierCalibIdMap-012
 Py:JobPropertyContainer::    INFO  setting folder /LAR/Identifier/FebRodMap with tag LARIdentifierFebRodMap-005
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
+# setting LC_ALL to "C"
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r3)
-                                          running on pc-tbed-pub-31.cern.ch on Tue Oct  2 15:11:35 2018
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99)
+                                          running on karma on Tue Jun 16 23:29:01 2020
 ====================================================================================================================================
-ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
-StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 3219 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 4026 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 MetaDataSvc          INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00
@@ -45,32 +43,33 @@ AthenaPoolCnvSvc     INFO Initializing AthenaPoolCnvSvc - package version Athena
 PoolSvc              INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok]
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
-DBReplicaSvc         INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy-wigner.cern.ch:3128) will be considered for COOL data
-DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-10-01T2055/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/dbreplica.config
-DBReplicaSvc         INFO Total of 10 servers found for host pc-tbed-pub-31.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
+DBReplicaSvc         INFO Read replica configuration from /home/sss/atlas/rootaccess/build/share/dbreplica.config
+DBReplicaSvc         INFO No specific match for domain found - use default fallback
+DBReplicaSvc         INFO Total of 1 servers found for host karma [atlas_dd ]
 PoolSvc              INFO Successfully setup replica sorting algorithm
 PoolSvc              INFO Setting up APR FileCatalog and Streams
-PoolSvc           WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables
-PoolSvc           WARNING Unable to locate catalog for apcfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables
-PoolSvc              INFO Resolved path (via ATLAS_POOLCOND_PATH) is /cvmfs/atlas-condb.cern.ch/repo/conditions/poolcond/PoolFileCatalog.xml
+PoolSvc              INFO Resolved path (via DATAPATH) is /home/sss/atlas/DBRelease/current/poolcond/PoolCat_oflcond.xml
+PoolSvc              INFO Resolved path (via DATAPATH) is /home/sss/atlas/DBRelease/current/poolcond/PoolCat_oflcond.xml
+PoolSvc              INFO Resolved path (via ATLAS_POOLCOND_PATH) is /home/sss/atlas/DBRelease/poolcond/PoolFileCatalog.xml
 PoolSvc              INFO POOL WriteCatalog is xmlcatalog_file:PoolFileCatalog.xml
 DbSession            INFO     Open     DbSession    
 Domain[ROOT_All]     INFO >   Access   DbDomain     READ      [ROOT_All] 
+MetaDataSvc          INFO Found MetaDataTools = PublicToolHandleArray([])
 IOVDbSvc             INFO Opened read transaction for POOL PersistencySvc
 IOVDbSvc             INFO Only 5 POOL conditions files will be open at once
-IOVDbSvc             INFO Cache alignment will be done in 3 slices
 IOVDbSvc             INFO Global tag: OFLCOND-RUN12-SDR-35 set from joboptions
 IOVDbSvc             INFO Folder /LAR/Identifier/OnOffIdMap, adding new key tag with value LARIdentifierOnOffIdMap-012
 IOVDbSvc             INFO Folder /LAR/Identifier/CalibIdMap, adding new key tag with value LARIdentifierCalibIdMap-012
 IOVDbSvc             INFO Folder /LAR/Identifier/FebRodMap, adding new key tag with value LARIdentifierFebRodMap-005
-IOVDbSvc             INFO Read from meta data only for folder /TagInfo
+IOVDbFolder          INFO Read from meta data only for folder /TagInfo
 IOVDbSvc             INFO Initialised with 3 connections and 25 folders
 IOVDbSvc             INFO Service IOVDbSvc initialised successfully
+ClassIDSvc           INFO  getRegistryEntries: read 1441 CLIDRegistry entries for module ALL
 IOVDbSvc             INFO preLoadAddresses: Removing folder /TagInfo. It should only be in the file meta data and was not found.
 IOVDbSvc             INFO Opening COOL connection for COOLOFL_LAR/OFLP200
 IOVSvc               INFO No IOVSvcTool associated with store "StoreGateSvc"
 IOVSvc.IOVSvcTool    INFO IOVRanges will be checked at every Event
-ClassIDSvc           INFO  getRegistryEntries: read 2071 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 268 CLIDRegistry entries for module ALL
 IOVDbSvc             INFO Opening COOL connection for COOLOFL_CALO/OFLP200
 IOVDbSvc             INFO Disconnecting from COOLOFL_LAR/OFLP200
 IOVDbSvc             INFO Disconnecting from COOLOFL_CALO/OFLP200
@@ -98,9 +97,9 @@ IOVDbSvc             INFO Added taginfo remove for /LAR/ElecCalibMC/Shape
 IOVDbSvc             INFO Added taginfo remove for /LAR/Identifier/LArTTCellMapAtlas
 IOVDbSvc             INFO Added taginfo remove for /LAR/ElecCalibMC/fSampl
 IOVDbSvc             INFO Added taginfo remove for /LAR/ElecCalibMC/uA2MeV
-ClassIDSvc           INFO  getRegistryEntries: read 22 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 4897 CLIDRegistry entries for module ALL
 ClassIDSvc           INFO  getRegistryEntries: read 18 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 2373 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 35 CLIDRegistry entries for module ALL
 DetDescrCnvSvc       INFO  initializing 
 DetDescrCnvSvc       INFO Found DetectorStore service
 DetDescrCnvSvc       INFO  filling proxies for detector managers 
@@ -135,8 +134,6 @@ DetDescrCnvSvc       INFO  filling address for MDTIDHELPER with CLID 4170 and st
 DetDescrCnvSvc       INFO  filling address for CSCIDHELPER with CLID 4171 and storage type 68 to detector store 
 DetDescrCnvSvc       INFO  filling address for RPCIDHELPER with CLID 4172 and storage type 68 to detector store 
 DetDescrCnvSvc       INFO  filling address for TGCIDHELPER with CLID 4173 and storage type 68 to detector store 
-DetDescrCnvSvc       INFO  filling address for STGCIDHELPER with CLID 4174 and storage type 68 to detector store 
-DetDescrCnvSvc       INFO  filling address for MMIDHELPER with CLID 4175 and storage type 68 to detector store 
 DetDescrCnvSvc       INFO  filling address for CaloLVL1_ID with CLID 108133391 and storage type 68 to detector store 
 DetDescrCnvSvc       INFO  filling address for CaloCell_ID with CLID 123500438 and storage type 68 to detector store 
 DetDescrCnvSvc       INFO  filling address for CaloCell_SuperCell_ID with CLID 128365736 and storage type 68 to detector store 
@@ -146,21 +143,8 @@ GeoModelSvc::RD...WARNING  Getting PixTBMatComponents with default tag
 GeoModelSvc::RD...WARNING  Getting PixTBMaterials with default tag
 GeoModelSvc::RD...WARNING  Getting InDetMatComponents with default tag
 GeoModelSvc::RD...WARNING  Getting InDetMaterials with default tag
-GeoModelSvc.LAr...   INFO Keys for LAr are ATLAS-R2-2016-01-00-01  ATLAS
-GeoModelSvc.LAr...   INFO Building LAr version LAr-Revised-17-01 while ATLAS version is ATLAS-R2-2016-01-00-01
-GeoModelSvc.LAr...   INFO LAr Geometry Options:
-GeoModelSvc.LAr...   INFO   Sagging           = false
-GeoModelSvc.LAr...   INFO   Barrel            = ON
-GeoModelSvc.LAr...   INFO   Endcap            = ON
-BarrelConstruction   INFO Getting primary numbers for ATLAS, ATLAS-R2-2016-01-00-01
-BarrelConstruction   INFO   Makes detailed absorber sandwich  ? 1 1
-BarrelConstruction   INFO   Use sagging in geometry  ? 0
-============== EMEC Construction ===============
-  multi-layered version of absorbers activated, mlabs == 1
-================================================
 EventPersistenc...   INFO Added successfully Conversion service:DetDescrCnvSvc
-ClassIDSvc           INFO  getRegistryEntries: read 3150 CLIDRegistry entries for module ALL
-CaloIDHelper_ID...   INFO in createObj: creating a TileTBID helper object in the detector store
+LArElectrodeIDD...   INFO in createObj: creating a LArElectrodeID helper object in the detector store
 IdDictDetDescrCnv    INFO in initialize
 IdDictDetDescrCnv    INFO in createObj: creating a IdDictManager object in the detector store
 IdDictDetDescrCnv    INFO IdDictName:  IdDictParser/ATLAS_IDS.xml
@@ -181,19 +165,45 @@ IdDictDetDescrCnv    INFO Dictionary LArElectrode         version fullAtlas
 IdDictDetDescrCnv    INFO Dictionary LArHighVoltage       version fullAtlas            DetDescr tag (using default) file 
 IdDictDetDescrCnv    INFO Dictionary MuonSpectrometer     version R.03                 DetDescr tag MuonIdentifier-08         file IdDictParser/IdDictMuonSpectrometer_R.03.xml
 IdDictDetDescrCnv    INFO Dictionary TileCalorimeter      version fullAtlasAndTestBeam DetDescr tag TileIdentifier-00         file IdDictParser/IdDictTileCalorimeter.xml
+LArElectrodeID       INFO  => initialize_from_dictionary()
+AtlasDetectorID      INFO initialize_from_dictionary - OK
+AtlasDetectorID      INFO initialize_from_dictionary - OK
+LArHVLineIDDetD...   INFO in createObj: creating a LArHVLineID helper object in the detector store
+LArHVLineID          INFO  => initialize_from_dictionary()
+AtlasDetectorID      INFO initialize_from_dictionary - OK
+AtlasDetectorID      INFO initialize_from_dictionary - OK
+LArHVLineID          INFO  => initialize_from_dictionary(dict_mgr) =0
+LArHVLineID          INFO Register_dict_tag of LArHighVoltage is OK
+LArHVLineID          INFO setDictVersion of LArHighVoltage is OK
+LArHVLineID          INFO [initLevelsFromDict] m_dict OK ... 
+LArHVLineID          INFO [initialize_from_dictionary] >  HV line range -> 11/1/48:79/0:15 | 11/1/148:179/0:15 | 11/1/80:93/0:7 | 11/1/180:193/0:7 | 11/1/200:231/0:15 | 11/1/232:263/0:15 | 11/1/296,297,306,307/0:15 | 11/1/299,304,305,308,309/0:15 | 11/1/264:279/0:15 | 11/1/280:295/0:15 | 11/1/0:47/0:15 | 11/1/320:322/0:15 | 11/1/100:147/0:15 | 11/1/324,325/0:15 | 11/1/312:315/0:15 | 11/1/316:319/0:15 | 11/1/300:303/0:15 | 11/1/310,311/0:15 | 11/1/323/0:15 | 11/1/326,327/0:15 | 11/1/94:99/0:15 | 11/1/194:199/0:15
+LArHVLineID          INFO [init_hashes()] > Hvline_size= 5008
+GeoModelSvc.LAr...   INFO Keys for LAr are ATLAS-R2-2016-01-00-01  ATLAS
+GeoModelSvc.LAr...   INFO Building LAr version LAr-Revised-17-01 while ATLAS version is ATLAS-R2-2016-01-00-01
+GeoModelSvc.LAr...   INFO LAr Geometry Options:
+GeoModelSvc.LAr...   INFO   Sagging           = false
+GeoModelSvc.LAr...   INFO   Barrel            = ON
+GeoModelSvc.LAr...   INFO   Endcap            = ON
+BarrelConstruction   INFO Getting primary numbers for ATLAS, ATLAS-R2-2016-01-00-01
+BarrelConstruction   INFO   Makes detailed absorber sandwich  ? 1 1
+BarrelConstruction   INFO   Use sagging in geometry  ? 0
+EMECConstruction     INFO multi-layered version of absorbers activated, parameter value is 1
+EMECConstruction     INFO activating LAr::EMEC::Pos::InnerWheel
+EMECConstruction     INFO activating LAr::EMEC::Pos::OuterWheel
+ClassIDSvc           INFO  getRegistryEntries: read 3602 CLIDRegistry entries for module ALL
+CaloIDHelper_ID...   INFO in createObj: creating a TileTBID helper object in the detector store
 TileTBID             INFO initialize_from_dictionary 
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 EndcapDMConstru...   INFO Start building EC electronics geometry
-============== EMEC Construction ===============
-  multi-layered version of absorbers activated, mlabs == 1
-================================================
+EMECConstruction     INFO multi-layered version of absorbers activated, parameter value is 1
+EMECConstruction     INFO activating LAr::EMEC::Neg::InnerWheel
+EMECConstruction     INFO activating LAr::EMEC::Neg::OuterWheel
 EndcapDMConstru...   INFO Start building EC electronics geometry
-GeoModelSvc          INFO GeoModelSvc.LArDetectorToolNV	 SZ= 21940Kb 	 Time = 0.56S
-ClassIDSvc           INFO  getRegistryEntries: read 213 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 65 CLIDRegistry entries for module ALL
+GeoModelSvc          INFO GeoModelSvc.LArDetectorToolNV	 SZ= 17768Kb 	 Time = 0.98S
+ClassIDSvc           INFO  getRegistryEntries: read 66 CLIDRegistry entries for module ALL
 AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
-ClassIDSvc           INFO  getRegistryEntries: read 6725 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 670 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 6729 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 608 CLIDRegistry entries for module ALL
 CondInputLoader      INFO Initializing CondInputLoader...
 CondInputLoader      INFO Adding base classes:
   +  ( 'AthenaAttributeList' , 'ConditionStore+/LAR/BadChannels/MissingFEBs' )   ->
@@ -245,7 +255,7 @@ CondInputLoader      INFO Will create WriteCondHandle dependencies for the follo
     +  ( 'LAruA2MeVMC' , 'ConditionStore+LAruA2MeV' ) 
 PyComponentMgr       INFO Initializing PyComponentMgr...
 testalg1             INFO Initializing testalg1...
-ClassIDSvc           INFO  getRegistryEntries: read 642 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 582 CLIDRegistry entries for module ALL
 CaloIdMgrDetDes...   INFO in createObj: creating a CaloDescrManager object in the detector store
 CaloIDHelper_ID...   INFO in createObj: creating a CaloCell_ID helper object in the detector store
 CaloIDHelper_ID...   INFO in createObj: creating a LArEM_ID helper object in the detector store
@@ -254,15 +264,15 @@ CaloIDHelper_ID...   INFO in createObj: creating a LArHEC_ID helper object in th
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 CaloIDHelper_ID...   INFO in createObj: creating a LArFCAL_ID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
-LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-10-01T2055/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCal2DNeighbors-April2011.txt
-LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-10-01T2055/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCal3DNeighborsNext-April2011.txt
-LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-10-01T2055/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCal3DNeighborsPrev-April2011.txt
+LArFCAL_Base_ID      INFO Reading file /home/sss/atlas/rootaccess/build/share/FCal2DNeighbors-April2011.txt
+LArFCAL_Base_ID      INFO Reading file /home/sss/atlas/rootaccess/build/share/FCal3DNeighborsNext-April2011.txt
+LArFCAL_Base_ID      INFO Reading file /home/sss/atlas/rootaccess/build/share/FCal3DNeighborsPrev-April2011.txt
 CaloIDHelper_ID...   INFO in createObj: creating a LArMiniFCAL_ID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 LArMiniFCAL_ID       INFO  initialize_from_dict - LArCalorimeter dictionary does NOT contain miniFCAL description. Unable to initialize LArMiniFCAL_ID.
 CaloIDHelper_ID...   INFO in createObj: creating a TileID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
-TileNeighbour        INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-10-01T2055/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/TileNeighbour_reduced.txt
+TileNeighbour        INFO Reading file  /home/sss/atlas/rootaccess/build/share/TileNeighbour_reduced.txt
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 CaloIDHelper_ID...   INFO in createObj: creating a CaloDM_ID helper object in the detector store
 CaloDM_ID            INFO initialize_from_dictionary
@@ -280,72 +290,52 @@ CaloIDHelper_ID...   INFO in createObj: creating a LArHEC_SuperCell_ID helper ob
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 CaloIDHelper_ID...   INFO in createObj: creating a LArFCAL_SuperCell_ID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
-LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-10-01T2055/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCalSuperCells2DNeighborsNew-April2014.txt
-LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-10-01T2055/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCalSuperCells3DNeighborsNextNew-April2014.txt
-LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-10-01T2055/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCalSuperCells3DNeighborsPrevNew-April2014.txt
+LArFCAL_Base_ID      INFO Reading file /home/sss/atlas/rootaccess/build/share/FCalSuperCells2DNeighborsNew-April2014.txt
+LArFCAL_Base_ID      INFO Reading file /home/sss/atlas/rootaccess/build/share/FCalSuperCells3DNeighborsNextNew-April2014.txt
+LArFCAL_Base_ID      INFO Reading file /home/sss/atlas/rootaccess/build/share/FCalSuperCells3DNeighborsPrevNew-April2014.txt
 CaloIDHelper_ID...   INFO in createObj: creating a Tile_SuperCell_ID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
-TileNeighbour        INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-10-01T2055/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/TileSuperCellNeighbour.txt
+TileNeighbour        INFO Reading file  /home/sss/atlas/rootaccess/build/share/TileSuperCellNeighbour.txt
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 CaloIdMgrDetDes...   INFO  Finished 
 CaloIdMgrDetDes...   INFO Initializing CaloIdMgr from values in CaloIdMgrDetDescrCnv 
-ClassIDSvc           INFO  getRegistryEntries: read 39 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 36 CLIDRegistry entries for module ALL
 LArOnlineIDDetD...   INFO in createObj: creating a LArOnlineID helper object in the detector store
 LArOnlineID          INFO initialize_from_dictionary
 AtlasDetectorID      INFO initialize_from_dictionary - OK
-ClassIDSvc           INFO  getRegistryEntries: read 283 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 64 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 39 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 68 CLIDRegistry entries for module ALL
 CaloMgrDetDescrCnv   INFO in createObj: creating a Calo Detector Manager object in the detector store
 DetectorStore     WARNING retrieve(default): No valid proxy for default object 
  of type TileDetDescrManager(CLID 2941)
 CaloMgrDetDescrCnvWARNING Could not get the TileDetectorManager. No Calo Elements will be built for Tile
-ClassIDSvc           INFO  getRegistryEntries: read 186 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 4041 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 190 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 5791 CLIDRegistry entries for module ALL
 ToolSvc.tool1        INFO Initializing LArCellDeadOTXCorr
-ClassIDSvc           INFO  getRegistryEntries: read 99 CLIDRegistry entries for module ALL
-IOVSvc.IOVSvcTool    INFO Still in initialize phase, not tiggering callback for Blob2ToolConstants[0x3d2ac900]+7fb4da898e70 bound to CondAttrListCollection[/LAR/CellCorrOfl/deadOTX]
+ClassIDSvc           INFO  getRegistryEntries: read 115 CLIDRegistry entries for module ALL
+IOVSvc.IOVSvcTool    INFO Still in initialize phase, not tiggering callback for Blob2ToolConstants[0x559d86ed5820]+7f99c8a81ed0 bound to CondAttrListCollection[/LAR/CellCorrOfl/deadOTX]
 ToolSvc.Blob2To...   INFO Successfully registered callback for CondAttributeListCollection object with key /LAR/CellCorrOfl/deadOTX
-IOVSvc.IOVSvcTool    INFO Still in initialize phase, not tiggering callback for LArCellDeadOTXCorr[0x3cbec820]+89 bound to /LAR/CellCorrOfl/deadOTX
+IOVSvc.IOVSvcTool    INFO Still in initialize phase, not tiggering callback for LArCellDeadOTXCorr[0x559d82dc1338]+89 bound to /LAR/CellCorrOfl/deadOTX
 ToolSvc.tool1        INFO L1Calo database won't be used. Pedestal values will be constant and equal to 32.
-ClassIDSvc           INFO  getRegistryEntries: read 64 CLIDRegistry entries for module ALL
-IOVSvc.IOVSvcTool    INFO Still in initialize phase, not tiggering callback for LArCablingService[0x2cb71200]+7fb4ded5e650 bound to AthenaAttributeList[/LAR/Identifier/OnOffIdMap]
-ToolSvc.LArCabl...   INFO Successfully installed callback on folder/LAR/Identifier/OnOffIdMap
-ToolSvc.LArCabl...   INFO Successfully installed callback on folder/LAR/Identifier/CalibIdMap
-ToolSvc.LArCabl...   INFO Successfully installed callback on folder/LAR/Identifier/FebRodMap
-ToolSvc.LArCabl...   INFO Sucessfully initialized LArCablingService with 3 callbacks.
 ToolSvc.CaloTri...   INFO  => CaloTriggerTowerService::initialize() 
 LArIdMgrDetDesc...   INFO in createObj: creating a LArDescrManager object in the detector store
 LArIdMgrDetDesc...   INFO Set LArOnlineID helper in LArIdMgr 
-LArHVLineIDDetD...   INFO in createObj: creating a LArHVLineID helper object in the detector store
-LArHVLineID          INFO  => initialize_from_dictionary()
-AtlasDetectorID      INFO initialize_from_dictionary - OK
-AtlasDetectorID      INFO initialize_from_dictionary - OK
-LArHVLineID          INFO  => initialize_from_dictionary(dict_mgr) =0
-LArHVLineID          INFO Register_dict_tag of LArHighVoltage is OK
-LArHVLineID          INFO setDictVersion of LArHighVoltage is OK
-LArHVLineID          INFO [initLevelsFromDict] m_dict OK ... 
-LArHVLineID          INFO [initialize_from_dictionary] >  HV line range -> 11/1/48:79/0:15 | 11/1/148:179/0:15 | 11/1/80:93/0:7 | 11/1/180:193/0:7 | 11/1/200:231/0:15 | 11/1/232:263/0:15 | 11/1/296,297,306,307/0:15 | 11/1/299,304,305,308,309/0:15 | 11/1/264:279/0:15 | 11/1/280:295/0:15 | 11/1/0:47/0:15 | 11/1/320:322/0:15 | 11/1/100:147/0:15 | 11/1/324,325/0:15 | 11/1/312:315/0:15 | 11/1/316:319/0:15 | 11/1/300:303/0:15 | 11/1/310,311/0:15 | 11/1/323/0:15 | 11/1/326,327/0:15 | 11/1/94:99/0:15 | 11/1/194:199/0:15
-LArHVLineID          INFO [init_hashes()] > Hvline_size= 5008
 LArIdMgrDetDesc...   INFO Set LArHVLineID helper in LArIdMgr 
-LArElectrodeIDD...   INFO in createObj: creating a LArElectrodeID helper object in the detector store
-LArElectrodeID       INFO  => initialize_from_dictionary()
-AtlasDetectorID      INFO initialize_from_dictionary - OK
-AtlasDetectorID      INFO initialize_from_dictionary - OK
 LArIdMgrDetDesc...   INFO Set LArElectrodeID helper in LArIdMgr 
 LArIdMgrDetDesc...   INFO Set CaloCell_ID helper in LArIdMgr 
 LArIdMgrDetDesc...   INFO Initializing LArIdMgr from values in LArIdMgrDetDescrCnv 
 ClassIDSvc           INFO  getRegistryEntries: read 59 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 66 CLIDRegistry entries for module ALL
+IOVSvc.IOVSvcTool    INFO Still in initialize phase, not tiggering callback for LArCablingLegacyService[0x559d835a6600]+7f99cdd4d620 bound to AthenaAttributeList[/LAR/Identifier/OnOffIdMap]
+ToolSvc.LArCabl...   INFO Successfully installed callback on folder/LAR/Identifier/OnOffIdMap
+ToolSvc.LArCabl...   INFO Successfully installed callback on folder/LAR/Identifier/CalibIdMap
+ToolSvc.LArCabl...   INFO Successfully installed callback on folder/LAR/Identifier/FebRodMap
+ToolSvc.LArCabl...   INFO Sucessfully initialized LArCablingLegacyService with 3 callbacks.
 ToolSvc.CaloTri...   INFO  ====> ...CaloTriggerTowerService::init() OK 
-ToolSvc.deadotx...   INFO Read 0 lines in total (for all COOL channels and missing FEBs together) 
 ToolSvc.tool2        INFO Initializing LArCellDeadOTXCorr
-IOVSvc.IOVSvcTool    INFO Still in initialize phase, not tiggering callback for LArCellDeadOTXCorr[0x6d3e820]+89 bound to /LAR/CellCorrOfl/deadOTX
+IOVSvc.IOVSvcTool    INFO Still in initialize phase, not tiggering callback for LArCellDeadOTXCorr[0x559d835b79c8]+89 bound to /LAR/CellCorrOfl/deadOTX
 ToolSvc.tool2        INFO L1Calo database won't be used. Pedestal values will be constant and equal to 32.
-ToolSvc.deadotx...   INFO Decoded 3 lines from FEB file deadotx_badchan2.badfebs
-ToolSvc.deadotx...   INFO Read 3 lines in total (for all COOL channels and missing FEBs together) 
-HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
-ClassIDSvc           INFO  getRegistryEntries: read 127 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 63 CLIDRegistry entries for module ALL
 CondInputLoader      INFO created CondCont<AthenaAttributeList> with key 'ConditionStore+/LAR/BadChannels/MissingFEBs'
 CondInputLoader      INFO created CondCont<AthenaAttributeList> with key 'ConditionStore+/LAR/Identifier/CalibIdMap'
 CondInputLoader      INFO created CondCont<AthenaAttributeList> with key 'ConditionStore+/LAR/Identifier/FebRodMap'
@@ -367,101 +357,104 @@ ApplicationMgr       INFO Application Manager Started successfully
 AthenaEventLoopMgr   INFO   ===>>>  start of run 1    <<<===
 EventPersistenc...   INFO Added successfully Conversion service:AthenaPoolCnvSvc
 EventPersistenc...   INFO Added successfully Conversion service:TagInfoMgr
-ClassIDSvc           INFO  getRegistryEntries: read 109 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 111 CLIDRegistry entries for module ALL
 IOVDbSvc             INFO Opening COOL connection for COOLOFL_LAR/OFLP200
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARAlign-IOVDEP-00 for folder /LAR/Align
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LArBadChannelsBadChannels-IOVDEP-06 for folder /LAR/BadChannels/BadChannels
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LArBadChannelsMissingFEBs-IOVDEP-04 for folder /LAR/BadChannels/MissingFEBs
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARCellCorrOflDeadOTX-000-00 for folder /LAR/CellCorrOfl/deadOTX
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCAutoCorr-Apr2010 for folder /LAR/ElecCalibMC/AutoCorr
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LArCellPositionShift-ideal for folder /LAR/LArCellPositionShift
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCDAC2uA-CSC02-J for folder /LAR/ElecCalibMC/DAC2uA
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCHVScaleCorr-IOVDEP-00 for folder /LAR/ElecCalibMC/HVScaleCorr
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCMinBias-IOVDEP-01 for folder /LAR/ElecCalibMC/MinBias
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCMinBiasAverage-IOVDEP-01 for folder /LAR/ElecCalibMC/MinBiasAverage
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCMphysOverMcal-CSC02-I for folder /LAR/ElecCalibMC/MphysOverMcal
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCNoise-Apr2010 for folder /LAR/ElecCalibMC/Noise
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCPedestal-DC3-B-IdFix7 for folder /LAR/ElecCalibMC/Pedestal
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCRamp-CSC02-K for folder /LAR/ElecCalibMC/Ramp
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCShape-Apr2010 for folder /LAR/ElecCalibMC/Shape
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARIdentifierLArTTCellMapAtlas-HadFcalFix2 for folder /LAR/Identifier/LArTTCellMapAtlas
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCfSampl-G496-19213-FTFP_BERT_BIRK for folder /LAR/ElecCalibMC/fSampl
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARuA2MeV-Feb2011 for folder /LAR/ElecCalibMC/uA2MeV
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARAlign-IOVDEP-00 for folder /LAR/Align
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LArBadChannelsBadChannels-IOVDEP-06 for folder /LAR/BadChannels/BadChannels
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LArBadChannelsMissingFEBs-IOVDEP-04 for folder /LAR/BadChannels/MissingFEBs
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARCellCorrOflDeadOTX-000-00 for folder /LAR/CellCorrOfl/deadOTX
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCAutoCorr-Apr2010 for folder /LAR/ElecCalibMC/AutoCorr
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LArCellPositionShift-ideal for folder /LAR/LArCellPositionShift
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCDAC2uA-CSC02-J for folder /LAR/ElecCalibMC/DAC2uA
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCHVScaleCorr-IOVDEP-00 for folder /LAR/ElecCalibMC/HVScaleCorr
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCMinBias-IOVDEP-01 for folder /LAR/ElecCalibMC/MinBias
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCMinBiasAverage-IOVDEP-01 for folder /LAR/ElecCalibMC/MinBiasAverage
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCMphysOverMcal-CSC02-I for folder /LAR/ElecCalibMC/MphysOverMcal
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCNoise-Apr2010 for folder /LAR/ElecCalibMC/Noise
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCPedestal-DC3-B-IdFix7 for folder /LAR/ElecCalibMC/Pedestal
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCRamp-CSC02-K for folder /LAR/ElecCalibMC/Ramp
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCShape-Apr2010 for folder /LAR/ElecCalibMC/Shape
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARIdentifierLArTTCellMapAtlas-HadFcalFix2 for folder /LAR/Identifier/LArTTCellMapAtlas
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARElecCalibMCfSampl-G496-19213-FTFP_BERT_BIRK for folder /LAR/ElecCalibMC/fSampl
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to LARuA2MeV-Feb2011 for folder /LAR/ElecCalibMC/uA2MeV
 IOVDbSvc             INFO Disconnecting from COOLOFL_LAR/OFLP200
 IOVDbSvc             INFO Opening COOL connection for COOLOFL_CALO/OFLP200
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to CALOOflIdentifierCaloTTOnAttrIdMapAtlas-0001 for folder /CALO/Ofl/Identifier/CaloTTOnAttrIdMapAtlas
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to CALOOflIdentifierCaloTTOnOffIdMapAtlas-0002 for folder /CALO/Ofl/Identifier/CaloTTOnOffIdMapAtlas
-IOVDbSvc             INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to CALOOflIdentifierCaloTTPpmRxIdMapAtlas-0000 for folder /CALO/Ofl/Identifier/CaloTTPpmRxIdMapAtlas
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to CALOOflIdentifierCaloTTOnAttrIdMapAtlas-0001 for folder /CALO/Ofl/Identifier/CaloTTOnAttrIdMapAtlas
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to CALOOflIdentifierCaloTTOnOffIdMapAtlas-0002 for folder /CALO/Ofl/Identifier/CaloTTOnOffIdMapAtlas
+IOVDbFolder          INFO HVS tag OFLCOND-RUN12-SDR-35 resolved to CALOOflIdentifierCaloTTPpmRxIdMapAtlas-0000 for folder /CALO/Ofl/Identifier/CaloTTPpmRxIdMapAtlas
 IOVDbSvc             INFO Disconnecting from COOLOFL_CALO/OFLP200
-DbSession            INFO     Open     DbSession    
-Domain[ROOT_All]     INFO >   Access   DbDomain     READ      [ROOT_All] 
 Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] EACFEBD4-9BD2-E211-848A-02163E006B20
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000057.gen.COND/cond09_mc.000057.gen.COND._0001.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000057.gen.COND/cond09_mc.000057.gen.COND._0001.pool.root File version:52200
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000057.gen.COND/cond09_mc.000057.gen.COND._0001.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000057.gen.COND/cond09_mc.000057.gen.COND._0001.pool.root File version:52200
+ToolSvc.CaloTri...   INFO  ====> iovCallBack 
 ToolSvc.LArCabl...   INFO  ====> iovCallBack 
 ToolSvc.LArCabl...   INFO Done reading online/offline identifier mapping
 ToolSvc.LArCabl...   INFO Found 195072 online identifier and 182468 offline identifier. 12604 disconnected channels.
-ToolSvc.CaloTri...   INFO  ====> iovCallBack 
 Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 8667C6F2-1559-DE11-A611-000423D9A21A
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/cond08/cond08_mc.000003.gen.COND/cond08_mc.000003.gen.COND._0064.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond08/cond08_mc.000003.gen.COND/cond08_mc.000003.gen.COND._0064.pool.root File version:52200
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/cond08_mc.000003.gen.COND/cond08_mc.000003.gen.COND._0064.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/cond08_mc.000003.gen.COND/cond08_mc.000003.gen.COND._0064.pool.root File version:52200
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #1, run #1 0 events processed so far  <<<===
 Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 9229AE70-AC4C-DF11-A934-003048D2BC4A
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000009.gen.COND/cond09_mc.000009.gen.COND._0011.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000009.gen.COND/cond09_mc.000009.gen.COND._0011.pool.root File version:52200
-ToolSvc.LArMCSy...   INFO IOV callback
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000009.gen.COND/cond09_mc.000009.gen.COND._0011.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000009.gen.COND/cond09_mc.000009.gen.COND._0011.pool.root File version:52200
 Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 64ADE389-CABD-DD11-8D4C-000423D950B0
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/cond08/cond08_mc.000001.gen.COND/cond08_mc.000001.gen.COND._0053.pool.root
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/cond08_mc.000001.gen.COND/cond08_mc.000001.gen.COND._0053.pool.root
 Warning in <TClass::Init>: no dictionary for class DataHeader_p2 is available
 Warning in <TClass::Init>: no dictionary for class DataHeaderElement_p2 is available
 Warning in <TClass::Init>: no dictionary for class PoolToken_p1 is available
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond08/cond08_mc.000001.gen.COND/cond08_mc.000001.gen.COND._0053.pool.root File version:51800
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/cond08_mc.000001.gen.COND/cond08_mc.000001.gen.COND._0053.pool.root File version:51800
+/home/sss/atlas...   INFO Database being retired...
+Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] EACFEBD4-9BD2-E211-848A-02163E006B20
 Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 7C42BC12-BD96-E011-B8EC-003048F0E01C
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000032.gen.COND/cond09_mc.000032.gen.COND._0001.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000032.gen.COND/cond09_mc.000032.gen.COND._0001.pool.root File version:52600
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000032.gen.COND/cond09_mc.000032.gen.COND._0001.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000032.gen.COND/cond09_mc.000032.gen.COND._0001.pool.root File version:52600
+/home/sss/atlas...   INFO Database being retired...
+Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 8667C6F2-1559-DE11-A611-000423D9A21A
 Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 687EA080-E4B6-DD11-A149-000423D9907C
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/cond08/cond08_mc.000001.gen.COND/cond08_mc.000001.gen.COND._0067.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond08/cond08_mc.000001.gen.COND/cond08_mc.000001.gen.COND._0067.pool.root File version:51800
-/cvmfs/atlas-co...   INFO Database being retired...
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/cond08_mc.000001.gen.COND/cond08_mc.000001.gen.COND._0067.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/cond08_mc.000001.gen.COND/cond08_mc.000001.gen.COND._0067.pool.root File version:51800
+/home/sss/atlas...   INFO Database being retired...
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 9229AE70-AC4C-DF11-A934-003048D2BC4A
 Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] FE8535CE-AD50-DC11-952F-000423D67862
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/oflcond/oflcond.000003.conditions.simul.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0040.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/oflcond/oflcond.000003.conditions.simul.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0040.pool.root File version:51400
-/cvmfs/atlas-co...   INFO Database being retired...
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/oflcond.000003.conditions.simul.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0040.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/oflcond.000003.conditions.simul.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0040.pool.root File version:51400
+/home/sss/atlas...   INFO Database being retired...
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 64ADE389-CABD-DD11-8D4C-000423D950B0
 Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 3CE29BA7-A6DC-DC11-BF61-000423D65662
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/comcond/comcond.000004.lar_conditions.recon.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0044.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/comcond/comcond.000004.lar_conditions.recon.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0044.pool.root File version:51400
-/cvmfs/atlas-co...   INFO Database being retired...
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/oflcond.000003.conditions.simul.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0044.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/oflcond.000003.conditions.simul.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0044.pool.root File version:51400
+/home/sss/atlas...   INFO Database being retired...
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 7C42BC12-BD96-E011-B8EC-003048F0E01C
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000009.gen.COND/cond09_mc.000009.gen.COND._0011.pool.root File version:52200
-/cvmfs/atlas-co...   INFO Database being retired...
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000009.gen.COND/cond09_mc.000009.gen.COND._0011.pool.root File version:52200
+/home/sss/atlas...   INFO Database being retired...
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 687EA080-E4B6-DD11-A149-000423D9907C
 LArPedestalMCCnv     INFO Reading LArPedestalMC (original)
 Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 180A4AF2-F47E-DB11-9E8F-000E0C4DEA2D
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/cmccond/cmccond.000001.conditions.simul.pool.v0000/oflcond.000002.conditions.simul.pool.v0000._0053.pool.root__DQ2-1250193473
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/oflcond.000002.conditions.simul.pool.v0000/oflcond.000002.conditions.simul.pool.v0000._0053.pool.root
 Warning in <TClass::Init>: no dictionary for class DataHeader_p1 is available
 Warning in <TClass::Init>: no dictionary for class DataHeaderElement_p1 is available
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cmccond/cmccond.000001.conditions.simul.pool.v0000/oflcond.000002.conditions.simul.pool.v0000._0053.pool.root__DQ2-1250193473 File version:51000
-Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 303FCBD8-653E-DD11-ABBD-000423D99862
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/oflcond/oflcond.000003.conditions.simul.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0061.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/oflcond/oflcond.000003.conditions.simul.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0061.pool.root File version:51800
-/cvmfs/atlas-co...   INFO Database being retired...
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/oflcond.000002.conditions.simul.pool.v0000/oflcond.000002.conditions.simul.pool.v0000._0053.pool.root File version:51000
+/home/sss/atlas...   INFO Database being retired...
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] FE8535CE-AD50-DC11-952F-000423D67862
-Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] F4885664-6C4D-DF11-A94A-00304867340C
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000009.gen.COND/cond09_mc.000009.gen.COND._0013.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000009.gen.COND/cond09_mc.000009.gen.COND._0013.pool.root File version:52200
-/cvmfs/atlas-co...   INFO Database being retired...
+Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 303FCBD8-653E-DD11-ABBD-000423D99862
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/oflcond.000003.conditions.simul.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0061.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/oflcond.000003.conditions.simul.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0061.pool.root File version:51800
+/home/sss/atlas...   INFO Database being retired...
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 3CE29BA7-A6DC-DC11-BF61-000423D65662
-Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 445FAD9A-5DB3-E14A-81DB-BA6244602734
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000084.gen.COND/cond09_mc.000084.gen.COND._0001.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000084.gen.COND/cond09_mc.000084.gen.COND._0001.pool.root File version:53413
-/cvmfs/atlas-co...   INFO Database being retired...
+Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] F4885664-6C4D-DF11-A94A-00304867340C
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000009.gen.COND/cond09_mc.000009.gen.COND._0013.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000009.gen.COND/cond09_mc.000009.gen.COND._0013.pool.root File version:52200
+/home/sss/atlas...   INFO Database being retired...
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 9229AE70-AC4C-DF11-A934-003048D2BC4A
+Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] 445FAD9A-5DB3-E14A-81DB-BA6244602734
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000084.gen.COND/cond09_mc.000084.gen.COND._0001.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000084.gen.COND/cond09_mc.000084.gen.COND._0001.pool.root File version:53413
+/home/sss/atlas...   INFO Database being retired...
+Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 180A4AF2-F47E-DB11-9E8F-000E0C4DEA2D
 Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] D27D07D4-C135-E011-84A9-003048F0E01E
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000027.gen.COND/cond09_mc.000027.gen.COND._0001.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000027.gen.COND/cond09_mc.000027.gen.COND._0001.pool.root File version:52600
-/cvmfs/atlas-co...   INFO Database being retired...
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000027.gen.COND/cond09_mc.000027.gen.COND._0001.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000027.gen.COND/cond09_mc.000027.gen.COND._0001.pool.root File version:52600
+/home/sss/atlas...   INFO Database being retired...
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 303FCBD8-653E-DD11-ABBD-000423D99862
 LArOnOffMappingAlg   INFO Done reading online/offline identifier mapping
 LArOnOffMappingAlg   INFO Found 195072 online identifier and 182468 offline identifier. 12604 disconnected channels.
@@ -472,50 +465,61 @@ LArFebRodMappin...   INFO Done reading Feb/Rod mapping. Found 1524 Febs and 762
 LArFebRodMappin...   INFO recorded new LArFebRodMap with range {[0,l:0] - [INVALID]} into Conditions Store
 LArBadChannelCo...   INFO Read a total of 0 problematic channels from database
 LArBadFebCondAlg     INFO Read a total of 0 problematic febs from database
-ClassIDSvc           INFO  getRegistryEntries: read 2360 CLIDRegistry entries for module ALL
+LArKnownBadFebAlg    INFO Read a total of 0 problematic febs from database
+LArKnownMNBFebAlg    INFO Read a total of 0 problematic febs from database
+LArMCSymCondAlg      INFO recorded new LArMCSym with range {[0,l:0] - [INVALID]} into Conditions Store
+LArSymCondition...   INFO recorded new LArRampSym with range {[0,l:0] - [INVALID]} into Conditions Store
+LArSymCondition...   INFO recorded new LArAutoCorrSym with range {[0,l:0] - [INVALID]} into Conditions Store
+LArSymCondition...   INFO recorded new LArDAC2uASym with range {[0,l:0] - [INVALID]} into Conditions Store
+LArSymCondition...   INFO recorded new LArNoiseSym with range {[0,l:0] - [INVALID]} into Conditions Store
+LArSymCondition...   INFO recorded new LArfSamplSym with range {[0,l:0] - [INVALID]} into Conditions Store
+LArSymCondition...   INFO recorded new LAruA2MeVSym with range {[0,l:0] - [INVALID]} into Conditions Store
+LArSymCondition...   INFO recorded new LArMinBiasSym with range {[0,l:0] - [222222,l:0]} into Conditions Store
+LArSymCondition...   INFO recorded new LArMinBiasAverageSym with range {[0,l:0] - [222222,l:0]} into Conditions Store
+LArSymCondition...   INFO recorded new LArShapeSym with range {[0,l:0] - [INVALID]} into Conditions Store
+LArSymCondition...   INFO recorded new LArMphysOverMcalSym with range {[0,l:0] - [INVALID]} into Conditions Store
+LArBadFebCondAl...   INFO Read a total of 0 problematic febs from database
+LArBadFebCondAl...   INFO Read a total of 3 problematic febs from database
+ClassIDSvc           INFO  getRegistryEntries: read 1213 CLIDRegistry entries for module ALL
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #1, run #1 1 events processed so far  <<<===
-/cvmfs/atlas-co...   INFO Database being retired...
-Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 8667C6F2-1559-DE11-A611-000423D9A21A
-/cvmfs/atlas-co...   INFO Database being retired...
-Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 180A4AF2-F47E-DB11-9E8F-000E0C4DEA2D
-/cvmfs/atlas-co...   INFO Database being retired...
-Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] EACFEBD4-9BD2-E211-848A-02163E006B20
-Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #2, run #1 1 events processed so far  <<<===
 LArTTCellMapCnv      INFO initialize()
-DbSession            INFO     Open     DbSession    
-Domain[ROOT_All]     INFO >   Access   DbDomain     READ      [ROOT_All] 
 Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] B2E3B2B6-B76C-DF11-A505-000423D5ADDA
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000013.gen.COND/cond09_mc.000013.gen.COND._0001.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000013.gen.COND/cond09_mc.000013.gen.COND._0001.pool.root File version:52200
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000013.gen.COND/cond09_mc.000013.gen.COND._0001.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000013.gen.COND/cond09_mc.000013.gen.COND._0001.pool.root File version:52200
+/home/sss/atlas...   INFO Database being retired...
+Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] F4885664-6C4D-DF11-A94A-00304867340C
 CaloTTOnOffIdMa...   INFO initialize()
 Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] EC2448FE-EFE2-DD11-80D3-000423D98B8C
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/cond08/cond08_mc.000003.gen.COND/cond08_mc.000003.gen.COND._0004.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond08/cond08_mc.000003.gen.COND/cond08_mc.000003.gen.COND._0004.pool.root File version:51800
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/cond08_mc.000003.gen.COND/cond08_mc.000003.gen.COND._0004.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/cond08_mc.000003.gen.COND/cond08_mc.000003.gen.COND._0004.pool.root File version:51800
+/home/sss/atlas...   INFO Database being retired...
+Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 445FAD9A-5DB3-E14A-81DB-BA6244602734
 CaloTTOnAttrIdM...   INFO initialize()
 Domain[ROOT_All]     INFO ->  Access   DbDatabase   READ      [ROOT_All] CE5211E9-F51F-DC11-87A7-000423D6460E
-Domain[ROOT_All]     INFO                           /cvmfs/atlas-condb.cern.ch/repo/conditions/cmccond/comcond.000001.conditions.recon.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0026.pool.root
-RootDatabase.open    INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cmccond/comcond.000001.conditions.recon.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0026.pool.root File version:51400
-AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 2 events processed so far  <<<===
-/cvmfs/atlas-co...   INFO Database being retired...
-/cvmfs/atlas-co...   INFO Database being retired...
-Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 445FAD9A-5DB3-E14A-81DB-BA6244602734
-/cvmfs/atlas-co...   INFO Database being retired...
-/cvmfs/atlas-co...   INFO Database being retired...
-/cvmfs/atlas-co...   INFO Database being retired...
-/cvmfs/atlas-co...   INFO Database being retired...
-Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] F4885664-6C4D-DF11-A94A-00304867340C
-/cvmfs/atlas-co...   INFO Database being retired...
-/cvmfs/atlas-co...   INFO Database being retired...
-/cvmfs/atlas-co...   INFO Database being retired...
-/cvmfs/atlas-co...   INFO Database being retired...
+Domain[ROOT_All]     INFO                           /home/sss/atlas/DBRelease/current/poolcond/oflcond.000003.conditions.simul.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0026.pool.root
+RootDatabase.open    INFO /home/sss/atlas/DBRelease/current/poolcond/oflcond.000003.conditions.simul.pool.v0000/oflcond.000003.conditions.simul.pool.v0000._0026.pool.root File version:51400
+/home/sss/atlas...   INFO Database being retired...
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] D27D07D4-C135-E011-84A9-003048F0E01E
-Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All] 
-/cvmfs/atlas-co...   INFO Database being retired...
-Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] EC2448FE-EFE2-DD11-80D3-000423D98B8C
-/cvmfs/atlas-co...   INFO Database being retired...
+AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 2 events processed so far  <<<===
+/home/sss/atlas...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] CE5211E9-F51F-DC11-87A7-000423D6460E
-/cvmfs/atlas-co...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
+/home/sss/atlas...   INFO Database being retired...
+Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] EC2448FE-EFE2-DD11-80D3-000423D98B8C
+/home/sss/atlas...   INFO Database being retired...
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] B2E3B2B6-B76C-DF11-A505-000423D5ADDA
 Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 ApplicationMgr       INFO Application Manager Stopped successfully
@@ -525,43 +529,43 @@ testalg1             INFO Finalizing testalg1...
 IncidentProcAlg2     INFO Finalize
 PyComponentMgr       INFO Finalizing PyComponentMgr...
 IdDictDetDescrCnv    INFO in finalize
-IOVDbSvc             INFO Folder /LAR/Align (PoolRef) db-read 1/1 objs/chan/bytes 1/1/170 ((     0.64 ))s
-IOVDbSvc             INFO Folder /LAR/BadChannels/BadChannels (AttrListColl) db-read 1/1 objs/chan/bytes 0/8/0 ((     0.55 ))s
-IOVDbSvc             INFO Folder /LAR/BadChannels/MissingFEBs (AttrList) db-read 1/1 objs/chan/bytes 1/1/16 ((     0.46 ))s
-IOVDbSvc             INFO Folder /LAR/CellCorrOfl/deadOTX (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/705 ((     0.65 ))s
-IOVDbSvc             INFO Folder /LAR/Identifier/CalibIdMap (AttrList) db-read 1/2 objs/chan/bytes 1/1/1520148 ((     0.19 ))s
-IOVDbSvc             INFO Folder /LAR/Identifier/FebRodMap (AttrList) db-read 1/2 objs/chan/bytes 1/1/6100 ((     0.01 ))s
-IOVDbSvc             INFO Folder /LAR/Identifier/OnOffIdMap (AttrList) db-read 1/2 objs/chan/bytes 1/1/780292 ((     0.03 ))s
-IOVDbSvc             INFO Folder /CALO/Ofl/Identifier/CaloTTOnAttrIdMapAtlas (PoolRef) db-read 1/1 objs/chan/bytes 1/1/183 ((     1.14 ))s
-IOVDbSvc             INFO Folder /CALO/Ofl/Identifier/CaloTTOnOffIdMapAtlas (PoolRef) db-read 1/1 objs/chan/bytes 1/1/181 ((     0.83 ))s
-IOVDbSvc             INFO Folder /CALO/Ofl/Identifier/CaloTTPpmRxIdMapAtlas (PoolRef) db-read 1/1 objs/chan/bytes 1/1/181 ((     0.76 ))s
-IOVDbSvc             INFO Folder /LAR/ElecCalibMC/AutoCorr (PoolColl) db-read 1/1 objs/chan/bytes 3/3/486 ((     0.02 ))s
-IOVDbSvc             INFO Folder /LAR/LArCellPositionShift (PoolRef) db-read 1/1 objs/chan/bytes 1/1/195 ((     0.02 ))s
-IOVDbSvc             INFO Folder /LAR/ElecCalibMC/DAC2uA (PoolColl) db-read 1/1 objs/chan/bytes 1/1/170 ((     0.02 ))s
-IOVDbSvc             INFO Folder /LAR/ElecCalibMC/HVScaleCorr (PoolColl) db-read 1/1 objs/chan/bytes 12/12/1980 ((     0.02 ))s
-IOVDbSvc             INFO Folder /LAR/ElecCalibMC/MinBias (PoolColl) db-read 1/1 objs/chan/bytes 1/1/174 ((     0.02 ))s
-IOVDbSvc             INFO Folder /LAR/ElecCalibMC/MinBiasAverage (PoolColl) db-read 1/1 objs/chan/bytes 1/1/181 ((     0.02 ))s
-IOVDbSvc             INFO Folder /LAR/ElecCalibMC/MphysOverMcal (PoolColl) db-read 1/1 objs/chan/bytes 3/3/516 ((     0.02 ))s
-IOVDbSvc             INFO Folder /LAR/ElecCalibMC/Noise (PoolColl) db-read 1/1 objs/chan/bytes 3/3/516 ((     0.02 ))s
-IOVDbSvc             INFO Folder /LAR/ElecCalibMC/Pedestal (PoolRef) db-read 1/1 objs/chan/bytes 1/1/167 ((     0.02 ))s
-IOVDbSvc             INFO Folder /LAR/ElecCalibMC/Ramp (PoolColl) db-read 1/1 objs/chan/bytes 3/3/489 ((     0.02 ))s
-IOVDbSvc             INFO Folder /LAR/ElecCalibMC/Shape (PoolColl) db-read 1/1 objs/chan/bytes 3/3/477 ((     0.02 ))s
-IOVDbSvc             INFO Folder /LAR/Identifier/LArTTCellMapAtlas (PoolRef) db-read 1/1 objs/chan/bytes 1/1/173 ((     0.02 ))s
-IOVDbSvc             INFO Folder /LAR/ElecCalibMC/fSampl (PoolColl) db-read 1/1 objs/chan/bytes 1/1/194 ((     0.02 ))s
-IOVDbSvc             INFO Folder /LAR/ElecCalibMC/uA2MeV (PoolColl) db-read 1/1 objs/chan/bytes 1/1/165 ((     0.02 ))s
-IOVDbSvc             INFO Total payload read from COOL: 2313859 bytes in ((      5.52 ))s
+IOVDbFolder          INFO Folder /LAR/Align (PoolRef) db-read 1/1 objs/chan/bytes 1/1/170 ((     0.51 ))s
+IOVDbFolder          INFO Folder /LAR/BadChannels/BadChannels (AttrListColl) db-read 1/1 objs/chan/bytes 0/8/0 ((     0.16 ))s
+IOVDbFolder          INFO Folder /LAR/BadChannels/MissingFEBs (AttrList) db-read 1/1 objs/chan/bytes 1/1/16 ((     0.01 ))s
+IOVDbFolder          INFO Folder /LAR/CellCorrOfl/deadOTX (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/705 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/Identifier/CalibIdMap (AttrList) db-read 1/2 objs/chan/bytes 1/1/1520148 ((     0.01 ))s
+IOVDbFolder          INFO Folder /LAR/Identifier/FebRodMap (AttrList) db-read 1/2 objs/chan/bytes 1/1/6100 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/Identifier/OnOffIdMap (AttrList) db-read 1/2 objs/chan/bytes 1/1/780292 ((     0.03 ))s
+IOVDbFolder          INFO Folder /CALO/Ofl/Identifier/CaloTTOnAttrIdMapAtlas (PoolRef) db-read 1/1 objs/chan/bytes 1/1/183 ((     0.11 ))s
+IOVDbFolder          INFO Folder /CALO/Ofl/Identifier/CaloTTOnOffIdMapAtlas (PoolRef) db-read 1/1 objs/chan/bytes 1/1/181 ((     0.00 ))s
+IOVDbFolder          INFO Folder /CALO/Ofl/Identifier/CaloTTPpmRxIdMapAtlas (PoolRef) db-read 1/1 objs/chan/bytes 1/1/181 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/ElecCalibMC/AutoCorr (PoolRefColl) db-read 1/1 objs/chan/bytes 3/3/486 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/LArCellPositionShift (PoolRef) db-read 1/1 objs/chan/bytes 1/1/195 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/ElecCalibMC/DAC2uA (PoolRefColl) db-read 1/1 objs/chan/bytes 1/1/170 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/ElecCalibMC/HVScaleCorr (PoolRefColl) db-read 1/1 objs/chan/bytes 12/12/1980 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/ElecCalibMC/MinBias (PoolRefColl) db-read 1/1 objs/chan/bytes 1/1/174 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/ElecCalibMC/MinBiasAverage (PoolRefColl) db-read 1/1 objs/chan/bytes 1/1/181 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/ElecCalibMC/MphysOverMcal (PoolRefColl) db-read 1/1 objs/chan/bytes 3/3/516 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/ElecCalibMC/Noise (PoolRefColl) db-read 1/1 objs/chan/bytes 3/3/516 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/ElecCalibMC/Pedestal (PoolRef) db-read 1/1 objs/chan/bytes 1/1/167 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/ElecCalibMC/Ramp (PoolRefColl) db-read 1/1 objs/chan/bytes 3/3/489 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/ElecCalibMC/Shape (PoolRefColl) db-read 1/1 objs/chan/bytes 3/3/477 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/Identifier/LArTTCellMapAtlas (PoolRef) db-read 1/1 objs/chan/bytes 1/1/173 ((     0.02 ))s
+IOVDbFolder          INFO Folder /LAR/ElecCalibMC/fSampl (PoolRefColl) db-read 1/1 objs/chan/bytes 1/1/194 ((     0.00 ))s
+IOVDbFolder          INFO Folder /LAR/ElecCalibMC/uA2MeV (PoolRefColl) db-read 1/1 objs/chan/bytes 1/1/165 ((     0.00 ))s
+IOVDbSvc             INFO  bytes in ((      0.87 ))s
 IOVDbSvc             INFO Connection sqlite://;schema=mycool.db;dbname=OFLP200 : nConnect: 0 nFolders: 0 ReadTime: ((     0.00 ))s
-IOVDbSvc             INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 2 nFolders: 21 ReadTime: ((     2.79 ))s
-IOVDbSvc             INFO Connection COOLOFL_CALO/OFLP200 : nConnect: 2 nFolders: 3 ReadTime: ((     2.73 ))s
+IOVDbSvc             INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 2 nFolders: 21 ReadTime: ((     0.76 ))s
+IOVDbSvc             INFO Connection COOLOFL_CALO/OFLP200 : nConnect: 2 nFolders: 3 ReadTime: ((     0.11 ))s
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
 ToolSvc.CaloTri...   INFO  => CaloTriggerTowerService::finalize() 
 *****Chrono*****     INFO ****************************************************************************************************
 *****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****     INFO ****************************************************************************************************
-cObjR_ALL            INFO Time User   : Tot=  480 [ms] Ave/Min/Max= 12.6(+- 51.6)/    0/  320 [ms] #= 38
-cObj_ALL             INFO Time User   : Tot= 0.76  [s] Ave/Min/Max=0.0317(+-0.0772)/    0/ 0.36  [s] #= 24
-ChronoStatSvc        INFO Time User   : Tot= 44.6  [s]                                             #=  1
+cObjR_ALL            INFO Time User   : Tot= 6.57  [s] Ave/Min/Max=0.173(+-0.696)/    0/ 3.59  [s] #= 38
+cObj_ALL             INFO Time User   : Tot= 6.88  [s] Ave/Min/Max=0.287(+-0.878)/    0/ 3.71  [s] #= 24
+ChronoStatSvc        INFO Time User   : Tot= 41.5  [s]                                             #=  1
 *****Chrono*****     INFO ****************************************************************************************************
 ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
diff --git a/LArCalorimeter/LArCondUtils/CMakeLists.txt b/LArCalorimeter/LArCondUtils/CMakeLists.txt
index cdf1076b872678d347eb1348f05ba7cd2797f68d..c3e5d1bf344e572d3e1e997f4200fd4c5888e8ea 100644
--- a/LArCalorimeter/LArCondUtils/CMakeLists.txt
+++ b/LArCalorimeter/LArCondUtils/CMakeLists.txt
@@ -5,27 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArCondUtils )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/AthenaBaseComps
-                          Control/StoreGate
-                          Database/AthenaPOOL/AthenaPoolUtilities
-                          DetectorDescription/Identifier
-                          GaudiKernel
-                          LArCalorimeter/LArElecCalib
-                          Calorimeter/CaloDetDescr
-                          Calorimeter/CaloIdentifier
-                          Calorimeter/CaloGeoHelpers
-                          Control/AthenaKernel
-                          Database/RDBAccessSvc
-                          Database/RegistrationServices
-                          LArCalorimeter/LArCabling
-                          LArCalorimeter/LArGeoModel/LArHV
-                          LArCalorimeter/LArGeoModel/LArReadoutGeometry
-                          LArCalorimeter/LArIdentifier
-                          LArCalorimeter/LArRawConditions
-                          LArCalorimeter/LArRecConditions )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess )
diff --git a/LArCalorimeter/LArG4/LArG4Barrel/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4Barrel/CMakeLists.txt
index 08534e662dee402478eb3c553053b1d18686b2a0..03b1e2bf4aacc2803febfb8617d6189ec217a4ff 100644
--- a/LArCalorimeter/LArG4/LArG4Barrel/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4Barrel/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4Barrel )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Calorimeter/CaloG4Sim
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          GaudiKernel
-                          LArCalorimeter/LArG4/LArG4Code
-                          LArCalorimeter/LArGeoModel/LArHV
-                          Tools/PathResolver )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/LArCalorimeter/LArG4/LArG4Code/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4Code/CMakeLists.txt
index ba36aeaa17ce52be6a177eace608a7ce0deedcd5..2e00b5a3f8e75de094cf75ab8b0ede948342aba3 100644
--- a/LArCalorimeter/LArG4/LArG4Code/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4Code/CMakeLists.txt
@@ -5,23 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4Code )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Calorimeter/CaloG4Sim
-                          Calorimeter/CaloSimEvent
-                          DetectorDescription/AtlasDetDescr
-                          LArCalorimeter/LArGeoModel/LArGeoCode
-                          LArCalorimeter/LArSimEvent
-                          Simulation/G4Atlas/G4AtlasTools
-                          Control/StoreGate
-                          GaudiKernel
-                          PRIVATE
-                          Calorimeter/CaloIdentifier
-                          Control/AthenaKernel
-                          Control/CxxUtils
-                          AtlasTest/TestTools
-                          Simulation/G4Sim/MCTruth )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/LArCalorimeter/LArG4/LArG4EC/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4EC/CMakeLists.txt
index 8c2ae22e39291f3eb107dfa9f057f5521f5177d3..cded039785c200d3497975d0cb7da22ca878787e 100644
--- a/LArCalorimeter/LArG4/LArG4EC/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4EC/CMakeLists.txt
@@ -5,21 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4EC )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Calorimeter/CaloG4Sim
-                          DetectorDescription/GeoModel/GeoSpecialShapes
-                          LArCalorimeter/LArG4/LArG4Code
-                          LArCalorimeter/LArGeoModel/LArGeoCode
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          Database/RDBAccessSvc
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          DetectorDescription/GeoModel/GeoModelUtilities
-                          GaudiKernel
-                          LArCalorimeter/LArGeoModel/LArHV
-                          Tools/PathResolver )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( CLHEP )
diff --git a/LArCalorimeter/LArG4/LArG4FCAL/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4FCAL/CMakeLists.txt
index ec920e4536635895d9f351e5761d46814c9907c0..6c082c84e29614492a522380a59eb84d384275b3 100644
--- a/LArCalorimeter/LArG4/LArG4FCAL/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4FCAL/CMakeLists.txt
@@ -5,18 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4FCAL )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Calorimeter/CaloG4Sim
-                          LArCalorimeter/LArG4/LArG4Code
-                          LArCalorimeter/LArGeoModel/LArReadoutGeometry
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          Database/RDBAccessSvc
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          GaudiKernel
-                          Tools/PathResolver )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( CLHEP )
diff --git a/LArCalorimeter/LArG4/LArG4FastSimSvc/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4FastSimSvc/CMakeLists.txt
index 82616394dbf17011562414b67418e7adf92b113f..0b8cc9f1688762da0463e17b7a589884cd126ce7 100644
--- a/LArCalorimeter/LArG4/LArG4FastSimSvc/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4FastSimSvc/CMakeLists.txt
@@ -5,12 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4FastSimSvc )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          GaudiKernel 
-                          Generators/AtlasHepMC )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt
index 057d893d84393d40ceb4473186f1fad510373b53..9a4ca1d4c7296dbdd90e4a8ce083689f2e8ea86a 100644
--- a/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt
@@ -35,7 +35,7 @@ atlas_add_component( LArG4FastSimulation
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}  ${GEOMODELCORE_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEOMODELCORE_LIBRARIES} GaudiKernel StoreGateLib SGtests GeoSpecialShapes LArG4Code LArReadoutGeometry LArSimEvent G4AtlasToolsLib GeoPrimitives )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEOMODELCORE_LIBRARIES} GaudiKernel StoreGateLib SGtests GeoSpecialShapes LArG4Code LArReadoutGeometry LArSimEvent G4AtlasToolsLib GeoPrimitives LArG4ShowerLibSvcLib )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
diff --git a/LArCalorimeter/LArG4/LArG4GenShowerLib/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4GenShowerLib/CMakeLists.txt
index ac94939aa710b17a4d452ca8094afc81424d117b..5f85af58081be3f9d0505f1aa070d3192e58cd6f 100644
--- a/LArCalorimeter/LArG4/LArG4GenShowerLib/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4GenShowerLib/CMakeLists.txt
@@ -5,21 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4GenShowerLib )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/AthContainers
-                          Control/StoreGate
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          LArCalorimeter/LArG4/LArG4Code
-                          PRIVATE
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          Generators/GeneratorObjects
-                          LArCalorimeter/LArG4/LArG4ShowerLib )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt
index bce9b6c29ee1a3e0762608468caeee75008ea332..717abda6b56ad25ae69fa58abcaa2c3d9b5056e2 100644
--- a/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt
@@ -5,34 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4H6SD )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Calorimeter/CaloG4Sim
-                          Calorimeter/CaloSimEvent
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          Database/RDBAccessSvc
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          DetectorDescription/GeoModel/GeoModelUtilities
-                          DetectorDescription/Identifier
-                          Generators/GeneratorObjects
-                          LArCalorimeter/LArG4/LArG4Code
-                          LArCalorimeter/LArG4/LArG4RunControl
-                          LArCalorimeter/LArG4TB/LArG4TBSimEvent
-                          LArCalorimeter/LArGeoModel/LArReadoutGeometry
-                          LArCalorimeter/LArSimEvent
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/SimHelpers
-                          Simulation/HitManagement
-                          Simulation/G4Sim/MCTruth
-                          TestBeam/TBEvent
-                          Tools/PathResolver 
-                          Generators/AtlasHepMC )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( CLHEP )
diff --git a/LArCalorimeter/LArG4/LArG4H8SD/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4H8SD/CMakeLists.txt
index 06a905150974bc9d1ceeecce196f8fb9cc952098..146230e6f17907b6a1c4531c9b7ab2645c3fa80a 100644
--- a/LArCalorimeter/LArG4/LArG4H8SD/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4H8SD/CMakeLists.txt
@@ -5,15 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4H8SD )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Calorimeter/CaloG4Sim
-                          Calorimeter/CaloSimEvent
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          GaudiKernel
-                          LArCalorimeter/LArG4/LArG4Code )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/LArCalorimeter/LArG4/LArG4HEC/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4HEC/CMakeLists.txt
index 77d9a10c62c88aa3e028e332d4edc85eca150dd4..bc4dd23ede56999546977c94b833538487686799 100644
--- a/LArCalorimeter/LArG4/LArG4HEC/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4HEC/CMakeLists.txt
@@ -5,20 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4HEC )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          LArCalorimeter/LArGeoModel/LArReadoutGeometry
-                          Control/AthenaBaseComps
-                          PRIVATE
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          Database/RDBAccessSvc
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          GaudiKernel
-                          Calorimeter/CaloG4Sim
-                          LArCalorimeter/LArG4/LArG4Code
-                          LArCalorimeter/LArGeoModel/LArHV )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( CLHEP )
diff --git a/LArCalorimeter/LArG4/LArG4MiniFCAL/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4MiniFCAL/CMakeLists.txt
index 0d56009e2a53acb388ce329ae5a3cce74caca196..a1942408eaa5d40dfd812a98a2e240bb765e99c1 100644
--- a/LArCalorimeter/LArG4/LArG4MiniFCAL/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4MiniFCAL/CMakeLists.txt
@@ -5,18 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4MiniFCAL )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          PRIVATE
-                          Calorimeter/CaloG4Sim
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          Database/RDBAccessSvc
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          DetectorDescription/Identifier
-                          GaudiKernel
-                          LArCalorimeter/LArG4/LArG4Code )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( CLHEP )
diff --git a/LArCalorimeter/LArG4/LArG4RunControl/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4RunControl/CMakeLists.txt
index 6cc3b8ae4ce51e0ffcf540bfcac0e81603662b21..4fe682e65cafe5ac345b723e6ba702be7ea760d8 100644
--- a/LArCalorimeter/LArG4/LArG4RunControl/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4RunControl/CMakeLists.txt
@@ -5,13 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4RunControl )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          PRIVATE
-                          Control/StoreGate
-                          GaudiKernel )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
diff --git a/LArCalorimeter/LArG4/LArG4SD/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4SD/CMakeLists.txt
index d632162ff778bc5df98d57fb81ff53b027173ebf..524c9603e4592be5c30012b970e7ea96c0eb9381 100644
--- a/LArCalorimeter/LArG4/LArG4SD/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4SD/CMakeLists.txt
@@ -5,12 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4SD )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Calorimeter/CaloG4Sim
-                          GaudiKernel
-                          LArCalorimeter/LArG4/LArG4Code )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
@@ -24,7 +18,6 @@ atlas_add_component( LArG4SD
                      INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                      LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CaloG4SimLib GaudiKernel LArG4Code )
 
-
 atlas_add_test( LArG4SDToolConfig_test
                 SCRIPT test/LArG4SDToolConfig_test.py
                 PROPERTIES TIMEOUT 300 )
diff --git a/LArCalorimeter/LArG4/LArG4ShowerLib/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4ShowerLib/CMakeLists.txt
index 31f351cd604682f2ce1fc1774e34d238cb4d271b..3d6b0666fe5b7bab56ce6cbb338e8f7103217f4d 100644
--- a/LArCalorimeter/LArG4/LArG4ShowerLib/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4ShowerLib/CMakeLists.txt
@@ -5,12 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4ShowerLib )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthContainers
-                          LArCalorimeter/LArG4/LArG4Code 
-                          Generators/AtlasHepMC )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/LArCalorimeter/LArG4/LArG4Validation/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4Validation/CMakeLists.txt
index dd64ac528e3709625d88109c67db47442f92be8b..578b9b1897fb8c1ab48e92d9449aa54886684e4a 100644
--- a/LArCalorimeter/LArG4/LArG4Validation/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4Validation/CMakeLists.txt
@@ -5,20 +5,6 @@
 # Declare the package name:
 atlas_subdir( LArG4Validation )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          GaudiKernel
-                          Calorimeter/CaloDetDescr
-                          Calorimeter/CaloIdentifier
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          DetectorDescription/GeoModel/GeoAdaptors
-                          Generators/GeneratorObjects
-                          LArCalorimeter/LArSimEvent
-                          MagneticField/MagFieldInterfaces
-                          Reconstruction/egamma/egammaEvent )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( HepPDT )
diff --git a/LArCalorimeter/LArRawConditions/LArRawConditions/selection1.xml b/LArCalorimeter/LArRawConditions/LArRawConditions/selection1.xml
index f3c34216d8e825b86151bf6295bbc97510c88f31..97db14a07f943d45103f925056c5346ecb60de90 100644
--- a/LArCalorimeter/LArRawConditions/LArRawConditions/selection1.xml
+++ b/LArCalorimeter/LArRawConditions/LArRawConditions/selection1.xml
@@ -20,7 +20,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArAutoCorrP>"/>
+  <class name="std::pair<unsigned int,LArAutoCorrP>"/>
+  <class name="std::pair<unsigned int,std::vector<LArAutoCorrP> >"/>
   <class name="std::vector<LArAutoCorrP>"/>
   <class name="std::vector<std::pair<unsigned int, LArAutoCorrP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArAutoCorrP> > >"/>
@@ -35,7 +36,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArCaliPulseParamsP>"/>
+  <class name="std::pair<unsigned int, LArCaliPulseParamsP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArCaliPulseParamsP> >"/>
   <class name="std::vector<LArCaliPulseParamsP>"/>
   <class name="std::vector<std::pair<unsigned int, LArCaliPulseParamsP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArCaliPulseParamsP> > >"/>
@@ -50,7 +52,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArDAC2uAP>"/>
+  <class name="std::pair<unsigned int, LArDAC2uAP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArDAC2uAP> >"/>
   <class name="std::vector<LArDAC2uAP>"/>
   <class name="std::vector<std::pair<unsigned int,LArDAC2uAP> >"/>
   <class name="std::vector<std::pair<unsigned int,std::vector<LArDAC2uAP> > >"/>
@@ -65,7 +68,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArDetCellParamsP>"/>
+  <class name="std::pair<unsigned int, LArDetCellParamsP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArDetCellParamsP> >"/>
   <class name="std::vector<LArDetCellParamsP>"/>
   <class name="std::vector<std::pair<unsigned int, LArDetCellParamsP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArDetCellParamsP> > >"/>
@@ -80,7 +84,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArfSamplP>"/>
+  <class name="std::pair<unsigned int, LArfSamplP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArfSamplP> >"/>
   <class name="std::vector<LArfSamplP>"/>
   <class name="std::vector<std::pair<unsigned int, LArfSamplP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArfSamplP> > >"/>
@@ -94,7 +99,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArH6OscillationP>"/>
+  <class name="std::pair<unsigned int, LArH6OscillationP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArH6OscillationP> >"/>
   <class name="std::vector<LArH6OscillationP>"/>
   <class name="std::vector<std::pair<unsigned int, LArH6OscillationP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArH6OscillationP> > >"/>
@@ -107,7 +113,8 @@
   <!-- picked up by iterator pattern below. -->
   <!-- <class name="LArSingleFloatP" /> -->
   <class name="LArConditionsSubset<LArSingleFloatP>" />
-  <class pattern="*pair*<unsigned*LArSingleFloatP>"/>
+  <class name="std::pair<unsigned int, LArSingleFloatP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArSingleFloatP> >"/>
   <class name="std::vector<LArSingleFloatP>"/>
   <class name="std::vector<std::pair<unsigned int, LArSingleFloatP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArSingleFloatP> > >"/>
@@ -123,7 +130,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArMinBiasP>"/>
+  <class name="std::pair<unsigned int, LArMinBiasP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArMinBiasP> >"/>
   <class name="std::vector<LArMinBiasP>"/>
   <class name="std::vector<std::pair<unsigned int, LArMinBiasP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArMinBiasP> > >"/>
@@ -139,7 +147,8 @@
   </class>
 
 
-  <class pattern="*pair*<unsigned*LArMinBiasAverageP>"/>
+  <class name="std::pair<unsigned int, LArMinBiasAverageP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArMinBiasAverageP> >"/>
   <class name="std::vector<LArMinBiasAverageP>"/>
   <class name="std::vector<std::pair<unsigned int, LArMinBiasAverageP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArMinBiasAverageP> > >"/>
@@ -155,7 +164,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArMphysOverMcalP>"/>
+  <class name="std::pair<unsigned int, LArMphysOverMcalP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArMphysOverMcalP> >"/>
   <class name="std::vector<LArMphysOverMcalP>"/>
   <class name="std::vector<std::pair<unsigned int, LArMphysOverMcalP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArMphysOverMcalP> > >"/>
@@ -170,7 +180,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArNoiseP>"/>
+  <class name="std::pair<unsigned int, LArNoiseP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArNoiseP> >"/>
   <class name="std::vector<LArNoiseP>"/>
   <class name="std::vector<std::pair<unsigned int, LArNoiseP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArNoiseP> > >"/>
@@ -190,7 +201,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArOFCP>"/>
+  <class name="std::pair<unsigned int, LArOFCP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArOFCP> >"/>
   <class name="std::vector<LArOFCP>"/>
   <class name="std::vector<std::pair<unsigned int, LArOFCP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArOFCP> > >"/>
@@ -208,7 +220,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArPedestalP>"/>
+  <class name="std::pair<unsigned int, LArPedestalP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArPedestalP> >"/>
   <class name="std::vector<LArPedestalP>"/>
   <class name="std::vector<std::pair<unsigned int, LArPedestalP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArPedestalP> > >"/>
@@ -224,7 +237,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArPhysCaliTdiffP>"/>
+  <class name="std::pair<unsigned int, LArPhysCaliTdiffP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArPhysCaliTdiffP> >"/>
   <class name="std::vector<LArPhysCaliTdiffP>"/>
   <class name="std::vector<std::pair<unsigned int, LArPhysCaliTdiffP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArPhysCaliTdiffP> > >"/>
@@ -240,7 +254,8 @@
   <class name="LArConditionsSubset<LArRampP>"  id="4019776D-D528-4401-9CBD-7956C4B00607" >
     <field name="m_subsetMap" transient="true" />
   </class>
-  <class pattern="*pair*<unsigned*LArRampP>"/>
+  <class name="std::pair<unsigned int, LArRampP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArRampP> >"/>
   <class name="std::vector<LArRampP>"/>
   <class name="std::vector<std::pair<unsigned int, LArRampP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArRampP> > >"/>
@@ -256,7 +271,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LAruA2MeVP>"/>
+  <class name="std::pair<unsigned int, LAruA2MeVP>"/>
+  <class name="std::pair<unsigned int, std::vector<LAruA2MeVP> >"/>
   <class name="std::vector<LAruA2MeVP>"/>
   <class name="std::vector<std::pair<unsigned int, LAruA2MeVP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LAruA2MeVP> > >"/>
diff --git a/LArCalorimeter/LArRawConditions/LArRawConditions/selection2.xml b/LArCalorimeter/LArRawConditions/LArRawConditions/selection2.xml
index a7db3408daa7f97461d139019674336d22c77c94..8f238cb9e2bb6ecf7ee6fbc0526f99bcbc51d6d4 100644
--- a/LArCalorimeter/LArRawConditions/LArRawConditions/selection2.xml
+++ b/LArCalorimeter/LArRawConditions/LArRawConditions/selection2.xml
@@ -16,7 +16,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArShapeP>"/>
+  <class name="std::pair<unsigned int, LArShapeP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArShapeP> >"/>
   <class name="std::vector<LArShapeP>"/>
   <class name="std::vector<std::pair<unsigned int, LArShapeP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArShapeP> > >"/>
@@ -30,7 +31,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArTdriftP>"/>
+  <class name="std::pair<unsigned int, LArTdriftP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArTdriftP> >"/>
   <class name="std::vector<LArTdriftP>"/>
   <class name="std::vector<std::pair<unsigned int, LArTdriftP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArTdriftP> > >"/>
@@ -45,7 +47,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArRinjP>"/>
+  <class name="std::pair<unsigned int, LArRinjP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArRinjP> >"/>
   <class name="std::vector<LArRinjP>"/>
   <class name="std::vector<std::pair<unsigned int, LArRinjP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArRinjP> > >"/>
@@ -59,7 +62,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArCableLengthP>"/>
+  <class name="std::pair<unsigned int, LArCableLengthP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArCableLengthP> >"/>
   <class name="std::vector<LArCableLengthP>"/>
   <class name="std::vector<std::pair<unsigned int, LArCableLengthP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArCableLengthP> > >"/>
@@ -73,7 +77,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArCableAttenuationP>"/>
+  <class name="std::pair<unsigned int, LArCableAttenuationP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArCableAttenuationP> >"/>
   <class name="std::vector<LArCableAttenuationP>"/>
   <class name="std::vector<std::pair<unsigned int, LArCableAttenuationP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArCableAttenuationP> > >"/>
@@ -87,7 +92,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArTshaperP>"/>
+  <class name="std::pair<unsigned int, LArTshaperP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArTshaperP> >"/>
   <class name="std::vector<LArTshaperP>"/>
   <class name="std::vector<std::pair<unsigned int, LArTshaperP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArTshaperP> > >"/>
@@ -101,7 +107,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArOFCBinP>"/>
+  <class name="std::pair<unsigned int, LArOFCBinP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArOFCBinP> >"/>
   <class name="std::vector<LArOFCBinP>"/>
   <class name="std::vector<std::pair<unsigned int, LArOFCBinP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArOFCBinP> > >"/>
@@ -115,7 +122,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArEMEC_CphiP>"/>
+  <class name="std::pair<unsigned int, LArEMEC_CphiP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArEMEC_CphiP> >"/>
   <class name="std::vector<LArEMEC_CphiP>"/>
   <class name="std::vector<std::pair<unsigned int, LArEMEC_CphiP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArEMEC_CphiP> > >"/>
@@ -129,7 +137,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArEMEC_HValphaP>"/>
+  <class name="std::pair<unsigned int, LArEMEC_HValphaP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArEMEC_HValphaP> >"/>
   <class name="std::vector<LArEMEC_HValphaP>"/>
   <class name="std::vector<std::pair<unsigned int, LArEMEC_HValphaP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArEMEC_HValphaP> > >"/>
@@ -143,7 +152,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArEMEC_HVbetaP>"/>
+  <class name="std::pair<unsigned int, LArEMEC_HVbetaP>"/>
+  <class name="std::pair<unsigned int, std::vector<LArEMEC_HVbetaP> >"/>
   <class name="std::vector<LArEMEC_HVbetaP>"/>
   <class name="std::vector<std::pair<unsigned int, LArEMEC_HVbetaP> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArEMEC_HVbetaP> > >"/>
@@ -161,7 +171,8 @@
 
   <class name="std::vector<LArCaliWave>" />
   <!-- <class name="std::vector<std::vector<LArCaliWaveVec> >" /> -->
-  <class pattern="*pair*<unsigned*LArCaliWaveVec>"/>
+  <class name="std::pair<unsigned int, LArCaliWaveVec>"/>
+  <class name="std::pair<unsigned int, std::vector<LArCaliWaveVec> >"/>
   <class name="std::vector<LArCaliWaveVec>"/>
   <class name="std::vector<std::pair<unsigned int, LArCaliWaveVec> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArCaliWaveVec> > >"/>
@@ -176,7 +187,8 @@
     <field name="m_subsetMap" transient="true" />
   </class>
 
-  <class pattern="*pair*<unsigned*LArPhysWave>"/>
+  <class name="std::pair<unsigned int, LArPhysWave>"/>
+  <class name="std::pair<unsigned int, std::vector<LArPhysWave> >"/>
   <class name="std::vector<LArPhysWave>"/>
   <class name="std::vector<std::pair<unsigned int, LArPhysWave> >"/>
   <class name="std::vector<std::pair<unsigned int, std::vector<LArPhysWave> > >"/>
diff --git a/MagneticField/MagFieldElements/MagFieldElements/BFieldCache.h b/MagneticField/MagFieldElements/MagFieldElements/BFieldCache.h
index 98bf7f2ed75a75db780e7ebe030c004e8c6af313..0823eb46efb71b7e085ffc89caa3e51376716880 100644
--- a/MagneticField/MagFieldElements/MagFieldElements/BFieldCache.h
+++ b/MagneticField/MagFieldElements/MagFieldElements/BFieldCache.h
@@ -104,9 +104,9 @@ private:
   double m_zmin, m_zmax;          // bin range in z
   double m_rmin, m_rmax;          // bin range in r
   double m_phimin, m_phimax;      // bin range in phi
-  float m_invz, m_invr, m_invphi; // 1/(bin size) in z, r, phi
-  float m_field[3][8];            // (Bz,Br,Bphi) at 8 corners of the bin
-  float m_scale;                  // unit of m_field in kT
+  double m_invz, m_invr, m_invphi; // 1/(bin size) in z, r, phi
+  double m_field[3][8];            // (Bz,Br,Bphi) at 8 corners of the bin
+  double m_scale;                  // unit of m_field in kT
 };
 
 #include "BFieldCache.icc"
diff --git a/MagneticField/MagFieldElements/MagFieldElements/BFieldCache.icc b/MagneticField/MagFieldElements/MagFieldElements/BFieldCache.icc
index 0fadd5381bf1fb8b653d9a4a96bb0ddc7dcccbd3..7ce32c657efd9428980df16a9a9717e1416037fc 100644
--- a/MagneticField/MagFieldElements/MagFieldElements/BFieldCache.icc
+++ b/MagneticField/MagFieldElements/MagFieldElements/BFieldCache.icc
@@ -19,26 +19,25 @@ BFieldCache::getB(const double* ATH_RESTRICT xyz,
     phi += 2 * M_PI;
   }
   // fractional position inside this bin
-  const float fz = (z - m_zmin) * m_invz;
-  const float gz = 1.0 - fz;
-  const float fr = (r - m_rmin) * m_invr;
-  const float gr = 1.0 - fr;
-  const float fphi = (phi - m_phimin) * m_invphi;
-  const float gphi = 1.0 - fphi;
+  const double fz = (z - m_zmin) * m_invz;
+  const double gz = 1.0 - fz;
+  const double fr = (r - m_rmin) * m_invr;
+  const double gr = 1.0 - fr;
+  const double fphi = (phi - m_phimin) * m_invphi;
+  const double gphi = 1.0 - fphi;
   // interpolate field values in z, r, phi
-  const float scale = m_scale;
-  float Bzrphi[3];
+  double Bzrphi[3];
   for (int i = 0; i < 3; i++) { // z, r, phi components
-    const float* field = m_field[i];
-    Bzrphi[i] = scale * (gz * (gr * (gphi * field[0] + fphi * field[1]) +
-                               fr * (gphi * field[2] + fphi * field[3])) +
-                         fz * (gr * (gphi * field[4] + fphi * field[5]) +
-                               fr * (gphi * field[6] + fphi * field[7])));
+    const double* field = m_field[i];
+    Bzrphi[i] = m_scale * (gz * (gr * (gphi * field[0] + fphi * field[1]) +
+                                 fr * (gphi * field[2] + fphi * field[3])) +
+                           fz * (gr * (gphi * field[4] + fphi * field[5]) +
+                                 fr * (gphi * field[6] + fphi * field[7])));
   }
   // convert (Bz,Br,Bphi) to (Bx,By,Bz)
-  float invr;
-  float c;
-  float s;
+  double invr;
+  double c;
+  double s;
   if (r > 0.0) {
     invr = 1.0 / r;
     c = x * invr;
@@ -54,37 +53,43 @@ BFieldCache::getB(const double* ATH_RESTRICT xyz,
 
   // compute field derivatives if requested
   if (deriv) {
-    const float sz = m_scale * m_invz;
-    const float sr = m_scale * m_invr;
-    const float sphi = m_scale * m_invphi;
+    const double sz   = m_scale * m_invz;
+    const double sr   = m_scale * m_invr;
+    const double sphi = m_scale * m_invphi;
    
-    float dBdz[3];
-    float dBdr[3];
-    float dBdphi[3];
+    double dBdz[3];
+    double dBdr[3];
+    double dBdphi[3];
     
     for (int j = 0; j < 3; j++) { // Bz, Br, Bphi components
-      const float* field = m_field[j];
+      const double* field = m_field[j];
       dBdz[j] =
         sz *
-        (gr * (gphi * (field[4] - field[0]) + fphi * (field[5] - field[1])) +
-         fr * (gphi * (field[6] - field[2]) + fphi * (field[7] - field[3])));
+        (gr * (gphi * (field[4] - field[0]) +
+               fphi * (field[5] - field[1])) +
+         fr * (gphi * (field[6] - field[2]) +
+               fphi * (field[7] - field[3])));
       dBdr[j] =
         sr *
-        (gz * (gphi * (field[2] - field[0]) + fphi * (field[3] - field[1])) +
-         fz * (gphi * (field[6] - field[4]) + fphi * (field[7] - field[5])));
+        (gz * (gphi * (field[2] - field[0]) +
+               fphi * (field[3] - field[1])) +
+         fz * (gphi * (field[6] - field[4]) +
+               fphi * (field[7] - field[5])));
       dBdphi[j] =
-        sphi * (gz * (gr * (field[1] - field[0]) + fr * (field[3] - field[2])) +
-                fz * (gr * (field[5] - field[4]) + fr * (field[7] - field[6])));
+        sphi * (gz * (gr * (field[1] - field[0]) +
+                      fr * (field[3] - field[2])) +
+                fz * (gr * (field[5] - field[4]) +
+                      fr * (field[7] - field[6])));
     }
     // convert to cartesian coordinates
-    const float cc = c * c;
-    const float cs = c * s;
-    const float ss = s * s;
-    const float ccinvr = cc * invr;
-    const float csinvr = cs * invr;
-    const float ssinvr = ss * invr;
-    const float sinvr = s * invr;
-    const float cinvr = c * invr;
+    const double cc = c * c;
+    const double cs = c * s;
+    const double ss = s * s;
+    const double ccinvr = cc * invr;
+    const double csinvr = cs * invr;
+    const double ssinvr = ss * invr;
+    const double sinvr = s * invr;
+    const double cinvr = c * invr;
     deriv[0] = cc * dBdr[1] - cs * dBdr[2] - csinvr * dBdphi[1] +
                ssinvr * dBdphi[2] + sinvr * B[1];
     deriv[1] = cs * dBdr[1] - ss * dBdr[2] + ccinvr * dBdphi[1] -
diff --git a/MagneticField/MagFieldElements/MagFieldElements/BFieldCacheZR.h b/MagneticField/MagFieldElements/MagFieldElements/BFieldCacheZR.h
index 268bc789038b3484bc546fc3b5d20d5271a64aef..52f6a98fe90fe0dd710d14a720ac6f73d7842fea 100644
--- a/MagneticField/MagFieldElements/MagFieldElements/BFieldCacheZR.h
+++ b/MagneticField/MagFieldElements/MagFieldElements/BFieldCacheZR.h
@@ -66,8 +66,8 @@ public:
 private:
   double m_zmin, m_zmax; // bin range in z
   double m_rmin, m_rmax; // bin range in r
-  float m_invz, m_invr;  // 1/(bin size) in z, r
-  float m_field[2][4];   // (Bz,Br) at 4 corners of the bin
+  double m_invz, m_invr;  // 1/(bin size) in z, r
+  double m_field[2][4];   // (Bz,Br) at 4 corners of the bin
 };
 #include "BFieldCacheZR.icc"
 #endif
diff --git a/MagneticField/MagFieldElements/MagFieldElements/BFieldCacheZR.icc b/MagneticField/MagFieldElements/MagFieldElements/BFieldCacheZR.icc
index 941f997d9c68a8920f1ae946641d2afb23608acc..7643414d1105c98a07b90849c0e56354e74b800a 100644
--- a/MagneticField/MagFieldElements/MagFieldElements/BFieldCacheZR.icc
+++ b/MagneticField/MagFieldElements/MagFieldElements/BFieldCacheZR.icc
@@ -10,48 +10,50 @@ BFieldCacheZR::getB(const double* xyz, double r, double* B, double* deriv) const
   const double& y(xyz[1]);
   const double& z(xyz[2]);
   // fractional position inside this bin
-  float fz = (z - m_zmin) * m_invz;
-  float gz = 1.0 - fz;
-  float fr = (r - m_rmin) * m_invr;
-  float gr = 1.0 - fr;
+  double fz = (z - m_zmin) * m_invz;
+  double gz = 1.0 - fz;
+  double fr = (r - m_rmin) * m_invr;
+  double gr = 1.0 - fr;
   // interpolate field values in z, r
-  float Bzr[2];
+  double Bzr[2];
   for (int i = 0; i < 2; i++) { // z, r components
-    const float* field = m_field[i];
+    const double* field = m_field[i];
     Bzr[i] = gz * (gr * field[0] + fr * field[1]) +
              fz * (gr * field[2] + fr * field[3]);
   }
   // convert (Bz,Br) to (Bx,By,Bz)
-  float invr;
+  double invr;
   if (r > 0.0) {
     invr = 1.0 / r;
   } else {
     invr = 0.0;
   }
-  float c(x * invr);
-  float s(y * invr);
+  double c(x * invr);
+  double s(y * invr);
   B[0] = Bzr[1] * c;
   B[1] = Bzr[1] * s;
   B[2] = Bzr[0];
 
   // compute field derivatives if requested
   if (deriv) {
-    float dBdz[2];
+    double dBdz[2];
 
-    float dBdr[2];
+    double dBdr[2];
     for (int j = 0; j < 2; j++) { // Bz, Br components
-      const float* field = m_field[j];
+      const double* field = m_field[j];
       dBdz[j] =
-        m_invz * (gr * (field[2] - field[0]) + fr * (field[3] - field[1]));
+          m_invz * (gr * (field[2] - field[0]) +
+                    fr * (field[3] - field[1]));
       dBdr[j] =
-        m_invr * (gz * (field[1] - field[0]) + fz * (field[3] - field[2]));
+          m_invr * (gz * (field[1] - field[0]) +
+                    fz * (field[3] - field[2]));
     }
     // convert to cartesian coordinates
-    float cc = c * c;
-    float cs = c * s;
-    float ss = s * s;
-    float sinvr = s * invr;
-    float cinvr = c * invr;
+    double cc = c * c;
+    double cs = c * s;
+    double ss = s * s;
+    double sinvr = s * invr;
+    double cinvr = c * invr;
     deriv[0] = cc * dBdr[1] + sinvr * B[1];
     deriv[1] = cs * dBdr[1] - cinvr * B[1];
     deriv[2] = c * dBdz[1];
diff --git a/MagneticField/MagFieldElements/MagFieldElements/BFieldVectorZR.h b/MagneticField/MagFieldElements/MagFieldElements/BFieldVectorZR.h
index e5061dab58f1453e3395fd2073bbdb4c4fd7d7fd..291e1a93f1872de83687772f8c41bdee4140beb8 100644
--- a/MagneticField/MagFieldElements/MagFieldElements/BFieldVectorZR.h
+++ b/MagneticField/MagFieldElements/MagFieldElements/BFieldVectorZR.h
@@ -26,19 +26,19 @@ public:
   ~BFieldVectorZR() = default;
 
   //constructor
-  BFieldVectorZR(float Bz, float Br)
+  BFieldVectorZR(double Bz, double Br)
     : m_B{ Bz, Br }
   {}
   // setter
-  void set(float Bz, float Br) { m_B = { Bz, Br }; }
+  void set(double Bz, double Br) { m_B = { Bz, Br }; }
   // accessors
-  float z() const { return m_B[0]; }
-  float r() const { return m_B[1]; }
+  double z() const { return m_B[0]; }
+  double r() const { return m_B[1]; }
   // array-like accessor
-  float operator[](size_t i) const { return m_B[i]; }
+  double operator[](size_t i) const { return m_B[i]; }
 
 private:
-  std::array<float, 2> m_B;
+  std::array<double, 2> m_B;
 };
 
 #endif
diff --git a/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx b/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx
index 75c4583ee7cbf06f5ac76b4887d5e04870ecaf77..9881cb65d67835593e4e309342738be42303ae8e 100644
--- a/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx
@@ -22,11 +22,13 @@ MuonCacheCreator::MuonCacheCreator(const std::string &name,ISvcLocator *pSvcLoca
 }
 
 StatusCode MuonCacheCreator::initialize() {
+  ATH_CHECK( m_idHelperSvc.retrieve() );
   ATH_CHECK( m_MdtCsmCacheKey.initialize(!m_MdtCsmCacheKey.key().empty()) );
-  ATH_CHECK( m_CscCacheKey.initialize(!m_CscCacheKey.key().empty()) );
+  if (!m_CscCacheKey.key().empty() && !m_idHelperSvc->hasCSC()) {
+    ATH_MSG_WARNING("CscCacheKey is non-empty ("<<m_CscCacheKey.key()<<") but layout has no CSC chambers! Looks like something is wrongly configured.");
+  } else ATH_CHECK( m_CscCacheKey.initialize(!m_CscCacheKey.key().empty()) );
   ATH_CHECK( m_RpcCacheKey.initialize(!m_RpcCacheKey.key().empty()) );
   ATH_CHECK( m_TgcCacheKey.initialize(!m_TgcCacheKey.key().empty()) );
-  ATH_CHECK( m_idHelperSvc.retrieve() );
   return StatusCode::SUCCESS;
 }
 
@@ -53,7 +55,7 @@ StatusCode MuonCacheCreator::execute (const EventContext& ctx) const {
     ATH_MSG_DEBUG("Created cache container " << m_MdtCsmCacheKey);
   }
   // Create the CSC cache container
-  if (!m_CscCacheKey.key().empty()) {
+  if (m_idHelperSvc->hasCSC() && !m_CscCacheKey.key().empty()) {
      ATH_CHECK(createContainer(m_CscCacheKey,    m_idHelperSvc->cscIdHelper().module_hash_max(), ctx));
      ATH_MSG_DEBUG("Created cache container " << m_CscCacheKey);
    }
diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/share/CscDigitToCscRDO_topOptions.py b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/share/CscDigitToCscRDO_topOptions.py
index f0b8771765f23c6ba216f2f0039f9f6871af7daa..c65449f38462dfdb063532502d3e97980c379f9a 100644
--- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/share/CscDigitToCscRDO_topOptions.py
+++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/share/CscDigitToCscRDO_topOptions.py
@@ -40,7 +40,8 @@ CscDigitToCscRDO.OutputLevel = DEBUG
 include("MuonRdoToPrepData/CscRdoToCscPrepData_jobOptions.py")
 from MuonRdoToPrepData.MuonRdoToPrepDataConf import CscRdoToCscPrepData
 CscRdoToCscPrepData.OutputLevel = INFO #DEBUG
-
+from RegionSelector.RegSelToolConfig import makeRegSelTool_CSC
+CscRdoToCscPrepData.RegSel_CSC = makeRegSelTool_CSC()
 
 # get a handle on the ServiceManager which holds all the services
 from AthenaCommon.AppMgr import ServiceMgr
diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/share/ReadCscByteStream_topOptions.py b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/share/ReadCscByteStream_topOptions.py
index 0fcc132c536220a3772f91db4c6f60081011f046..123c6c2cf5a82da85839f43199dff4a531ac9233 100644
--- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/share/ReadCscByteStream_topOptions.py
+++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/share/ReadCscByteStream_topOptions.py
@@ -92,6 +92,8 @@ include("MuonRdoToPrepData/CscRdoToCscPrepData_jobOptions.py")
 
 from MuonRdoToPrepData.MuonRdoToPrepDataConf import CscRdoToCscPrepData
 CscRdoToCscPrepData.OutputLevel = DEBUG
+from RegionSelector.RegSelToolConfig import makeRegSelTool_CSC
+CscRdoToCscPrepData.RegSel_CSC = makeRegSelTool_CSC()
 
 # Byte stream conversion service
 theApp.ExtSvc += [ "ByteStreamCnvSvc" ]
diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/share/test.py b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/share/test.py
index 53f82a25142a4117b00d974ac1d5cea48b6e1a53..aa6a584f8750b725aff2385379492a720081b651 100644
--- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/share/test.py
+++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/share/test.py
@@ -84,5 +84,7 @@ from MuonRdoToPrepData.MuonRdoToPrepDataConf import CscRdoToCscPrepData
 CscRdoToCscPrepData = CscRdoToCscPrepData()
 #CscRdoToCscPrepData.DecodingTool = ToolSvc.CscPrepDataProviderTool
 CscRdoToCscPrepData.PrintPrepData = True
+from RegionSelector.RegSelToolConfig import makeRegSelTool_CSC
+CscRdoToCscPrepData.RegSel_CSC = makeRegSelTool_CSC()
 
 topSequence += CscRdoToCscPrepData
diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx
index 5ef7c5f25e392fbd1ca0c7a8aeb9cc1d11dc0a3f..d7ebd8e5deb38ac52f210933acc335e4cb3240d3 100644
--- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx
@@ -221,7 +221,10 @@ bool Muon::MdtRdoToPrepDataToolCore::handlePRDHash( IdentifierHash hash, const M
   if (m_BMEpresent) { // after BMEs were installed, the RDOs are indexed by the detectorElement hash of a multilayer
     Identifier elementId;
     IdContext tmp_context = m_idHelperSvc->mdtIdHelper().module_context();
-    m_idHelperSvc->mdtIdHelper().get_id(hash, elementId, &tmp_context);
+    if(m_idHelperSvc->mdtIdHelper().get_id(hash, elementId, &tmp_context)){
+      ATH_MSG_DEBUG("Found invalid elementId");
+      return false;
+    }
 
     Identifier multilayerId = m_idHelperSvc->mdtIdHelper().multilayerID(elementId, 1); //first multilayer
     IdentifierHash multilayerHash;
diff --git a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.cxx
index 8b98396e024cbc4948837369226557d180e99cf4..07ef4788a7e1c37d0a40c450e87ea08c26c34b44 100644
--- a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.cxx
@@ -40,12 +40,13 @@ Muon::MmRdoToPrepDataToolCore::MmRdoToPrepDataToolCore(const std::string& t,
   declareProperty("MergePrds", m_merge = true);
   declareProperty("ClusterBuilderTool",m_clusterBuilderTool);
   declareProperty("NSWCalibTool", m_calibTool);
+  declareProperty("singleStripChargeCut", m_singleStripChargeCut = 6241 * 0.4);   // 0.4 fC from BB5 cosmics
 }
 
 StatusCode Muon::MmRdoToPrepDataToolCore::initialize()
 {  
   ATH_MSG_DEBUG(" in initialize()");
-  
+ 
   ATH_CHECK(detStore()->retrieve(m_muonMgr));
   
   ATH_CHECK(m_idHelperSvc.retrieve());
@@ -182,6 +183,7 @@ StatusCode Muon::MmRdoToPrepDataToolCore::processCollection(const MM_RawDataColl
 
     } else {
        MMPrepData mpd = MMPrepData(prdId, hash, localPos, rdoList, cov, detEl, calibStrip.time, calibStrip.charge, calibStrip.distDrift);
+       if(mpd.charge() < m_singleStripChargeCut) continue;
        // set the hash of the MMPrepData such that it contains the correct value in case it gets used in SimpleMMClusterBuilderTool::getClusters
        mpd.setHashAndIndex(hash,0);
        mpd.setAuthor(Muon::MMPrepData::Author::RDOTOPRDConverter);
diff --git a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.h b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.h
index 5fbd33447e13f2e14605b9ef824f0ab61accaa15..467fee554b7bec244e6249045781d9b4eb63b445 100644
--- a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.h
+++ b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolCore.h
@@ -84,6 +84,7 @@ namespace Muon
     ToolHandle<IMMClusterBuilderTool> m_clusterBuilderTool;
     ToolHandle<INSWCalibTool> m_calibTool;
 
+    float m_singleStripChargeCut;
   }; 
 } // end of namespace
 
diff --git a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/MuonRdoToPrepData/CscRdoToCscPrepData.h b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/MuonRdoToPrepData/CscRdoToCscPrepData.h
index ebe5cf45633993aad1df8f6998e11a8cb2b302cf..872558f789ec9f80fe988a435b6d27ae90777868 100755
--- a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/MuonRdoToPrepData/CscRdoToCscPrepData.h
+++ b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/MuonRdoToPrepData/CscRdoToCscPrepData.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 CSCRDOTOCSCPREPDATA_H
@@ -10,7 +10,7 @@
 #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h"
 
 #include "TrigSteeringEvent/TrigRoiDescriptor.h"
-#include "IRegionSelector/IRegSelSvc.h"
+#include "IRegionSelector/IRegSelTool.h"
 #include "MuonPrepRawData/CscStripPrepDataContainer.h"
 /** Algorithm to decode RDO into CscStripPrepData
  - get the RDO container from Storegate
@@ -38,7 +38,7 @@ private:
   bool                                    m_print_prepData; //!<< If true, will dump information about the resulting PRDs.  
   bool m_seededDecoding;
   SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey;
-  ServiceHandle<IRegSelSvc> m_regionSelector; //<! pointer to RegionSelectionSvc
+  ToolHandle<IRegSelTool> m_regsel_csc; //<! pointer to RegionSelectionTool
   SG::WriteHandleKey<Muon::CscStripPrepDataContainer> m_cscCollection;
 };
 
diff --git a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/MuonRdoToPrepData/RpcRdoToRpcPrepData.h b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/MuonRdoToPrepData/RpcRdoToRpcPrepData.h
index 85d31660753ee104f7beacd317eb012668b7208d..3d29ae457b322d1dd34804b64cfc0b39ffd98490 100755
--- a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/MuonRdoToPrepData/RpcRdoToRpcPrepData.h
+++ b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/MuonRdoToPrepData/RpcRdoToRpcPrepData.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 RPCRDOTORPCPREPDATA_H
@@ -13,7 +13,7 @@
 
 #include "TrigSteeringEvent/TrigRoiDescriptor.h"
 
-#include "IRegionSelector/IRegSelSvc.h"
+#include "IRegionSelector/IRegSelTool.h"
 #include "MuonPrepRawData/MuonPrepDataContainer.h"
 /** Algorithm to decode RDO into RpcPrepData, using the Muon::RpcRdoToRpcPrepDataTool 
  @author Ketevi A. Assamagan
@@ -41,7 +41,7 @@ private:
     bool                                    m_print_prepData; //!<< If true, will dump information about the resulting PRDs.
     bool m_seededDecoding;
     SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey;
-    ServiceHandle<IRegSelSvc> m_regionSelector; //<! pointer to RegionSelectionSvc
+    ToolHandle<IRegSelTool> m_regsel_rpc; //<! pointer to RegionSelectionTool
     SG::WriteHandleKey<Muon::RpcPrepDataContainer> m_rpcCollection;
 
 };
diff --git a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/MuonRdoToPrepData/TgcRdoToTgcPrepData.h b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/MuonRdoToPrepData/TgcRdoToTgcPrepData.h
index 4d934d24c763da6273882c7b755a6b871c1ad614..2358f2839c73c48cfa700cb082f7ffb22bb9da10 100755
--- a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/MuonRdoToPrepData/TgcRdoToTgcPrepData.h
+++ b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/MuonRdoToPrepData/TgcRdoToTgcPrepData.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 TGCRDOTOTGCPREPDATA_H
@@ -13,7 +13,7 @@
 #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h"
 
 #include "TrigSteeringEvent/TrigRoiDescriptor.h"
-#include "IRegionSelector/IRegSelSvc.h"
+#include "IRegionSelector/IRegSelTool.h"
 #include "MuonPrepRawData/MuonPrepDataContainer.h"
 
 /** Algorithm to decode RDO into TgcPrepData, using the Muon::TgcRdoToTgcPrepDataTool 
@@ -44,7 +44,7 @@ class TgcRdoToTgcPrepData : public AthAlgorithm {
 
   bool m_seededDecoding;
   SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey;
-  ServiceHandle<IRegSelSvc> m_regionSelector; //<! pointer to RegionSelectionSvc
+  ToolHandle<IRegSelTool> m_regsel_tgc; //<! pointer to RegionSelectionTool
   SG::WriteHandleKey<Muon::TgcPrepDataContainer> m_tgcCollection;
 };
 
diff --git a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/CscRdoToCscPrepData.cxx b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/CscRdoToCscPrepData.cxx
index f78501aec1791ff152fe8090155051207eab11f9..175e9a3f282ae21f9bd3280fb3ce229b842e5c03 100755
--- a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/CscRdoToCscPrepData.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/CscRdoToCscPrepData.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
 */
 
 /// Author: Ketevi A. Assamagan
@@ -23,7 +23,7 @@ CscRdoToCscPrepData::CscRdoToCscPrepData(const std::string& name, ISvcLocator* p
     m_print_prepData(false),
     m_seededDecoding(false),
     m_roiCollectionKey("OutputRoIs"),
-    m_regionSelector("RegSelSvc",name),
+    m_regsel_csc("RegSelTool/RegSelTool_CSC",this),
     m_cscCollection("CSC_Measurements")
 {
     declareProperty("CscRdoToCscPrepDataTool",     m_muonRdoToPrepDataTool );
@@ -31,7 +31,7 @@ CscRdoToCscPrepData::CscRdoToCscPrepData(const std::string& name, ISvcLocator* p
     declareProperty("PrintPrepData",      m_print_prepData, "If true, will dump information about the resulting PRDs");
     declareProperty("DoSeededDecoding",   m_seededDecoding, "If true decode only in RoIs");
     declareProperty("RoIs",               m_roiCollectionKey, "RoIs to read in");
-    declareProperty("RegionSelectionSvc", m_regionSelector, "Region Selector");
+    declareProperty("RegSel_CSC", m_regsel_csc);
     declareProperty("OutputCollection", m_cscCollection);
 }
 
@@ -58,8 +58,8 @@ StatusCode CscRdoToCscPrepData::initialize(){
     if(m_seededDecoding){
       ATH_CHECK(m_roiCollectionKey.initialize());
       ATH_CHECK(m_cscCollection.initialize());
-      if (m_regionSelector.retrieve().isFailure()) {
-	ATH_MSG_FATAL("Unable to retrieve RegionSelector Svc");
+      if (m_regsel_csc.retrieve().isFailure()) {
+	ATH_MSG_FATAL("Unable to retrieve m_regsel_csc");
 	return StatusCode::FAILURE;
       }
     }
@@ -84,7 +84,7 @@ StatusCode CscRdoToCscPrepData::execute() {
       }
       else{
 	for(auto roi : *muonRoI){
-	  m_regionSelector->DetHashIDList(CSC,*roi,givenIDs);
+	  m_regsel_csc->HashIDList(*roi,givenIDs);
 	  if(givenIDs.size()!=0){
 	    status=m_muonRdoToPrepDataTool->decode(givenIDs, decodedIDs);
 	    givenIDs.clear();
diff --git a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/RpcRdoToRpcPrepData.cxx b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/RpcRdoToRpcPrepData.cxx
index 4dff8547c33523ada6ef79627ce4fdd31504b8ef..6a7e8f8beef4e0a0e9537ea745d7e36e936a1445 100755
--- a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/RpcRdoToRpcPrepData.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/RpcRdoToRpcPrepData.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
 */
 
 /// Author: Stefania Spagnolo 
@@ -22,7 +22,7 @@ RpcRdoToRpcPrepData::RpcRdoToRpcPrepData(const std::string& name, ISvcLocator* p
     m_print_prepData(false),
     m_seededDecoding(false),
     m_roiCollectionKey("OutputRoIs"),
-    m_regionSelector("RegSelSvc",name),
+    m_regsel_rpc("RegSelTool/RegSelTool_RPC",this),
     m_rpcCollection("RPC_Measurements")
 {
     declareProperty("DecodingTool",       m_tool,       "rpc rdo to prep data conversion tool" );
@@ -30,7 +30,7 @@ RpcRdoToRpcPrepData::RpcRdoToRpcPrepData(const std::string& name, ISvcLocator* p
     declareProperty("PrintPrepData",      m_print_prepData, "If true, will dump information about the resulting PRDs");
     declareProperty("DoSeededDecoding",   m_seededDecoding, "If true decode only in RoIs");
     declareProperty("RoIs",               m_roiCollectionKey, "RoIs to read in");
-    declareProperty("RegionSelectionSvc", m_regionSelector, "Region Selector");
+    declareProperty("RegSel_RPC", m_regsel_rpc);
     declareProperty("OutputCollection", m_rpcCollection);
 }  
 
@@ -59,8 +59,8 @@ StatusCode RpcRdoToRpcPrepData::initialize(){
   if(m_seededDecoding){
     ATH_CHECK(m_roiCollectionKey.initialize());
     ATH_CHECK(m_rpcCollection.initialize());
-    if (m_regionSelector.retrieve().isFailure()) {
-      ATH_MSG_FATAL("Unable to retrieve RegionSelector Svc");
+    if (m_regsel_rpc.retrieve().isFailure()) {
+      ATH_MSG_FATAL("Unable to retrieve m_regsel_rpc");
       return StatusCode::FAILURE;
     }
   }
@@ -99,7 +99,7 @@ StatusCode RpcRdoToRpcPrepData::execute() {
       else{
 	std::vector<uint32_t> rpcrobs;
 	for(auto roi : *muonRoI){
-	  m_regionSelector->DetROBIDListUint(RPC,*roi,rpcrobs);
+	  m_regsel_rpc->ROBIDList(*roi,rpcrobs);
 	  if(rpcrobs.size()!=0){
 	    decoded=true;
 	    status=m_tool->decode(rpcrobs);
diff --git a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/TgcRdoToTgcPrepData.cxx b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/TgcRdoToTgcPrepData.cxx
index c3486fdff7e76c167c721d7556066c81c871492e..15fd22ddacde970446fe22da9e44611afb512708 100755
--- a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/TgcRdoToTgcPrepData.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/TgcRdoToTgcPrepData.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
 */
 
 /// Author: Takashi Kubota
@@ -19,7 +19,7 @@ TgcRdoToTgcPrepData::TgcRdoToTgcPrepData(const std::string& name, ISvcLocator* p
   m_setting(0),
   m_seededDecoding(false),
   m_roiCollectionKey("OutputRoIs"),
-  m_regionSelector("RegSelSvc",name),
+  m_regsel_tgc("RegSelTool/RegSelTool_TGC",this),
   m_tgcCollection("TGC_Measurements")
 {
   declareProperty("DecodingTool",       m_tool,       "tgc rdo to prep data conversion tool" );
@@ -28,7 +28,7 @@ TgcRdoToTgcPrepData::TgcRdoToTgcPrepData(const std::string& name, ISvcLocator* p
   declareProperty("Setting",            m_setting,        "0 is default unseeded decoding"); 
   declareProperty("DoSeededDecoding",   m_seededDecoding, "If true decode only in RoIs");
   declareProperty("RoIs",               m_roiCollectionKey, "RoIs to read in");
-  declareProperty("RegionSelectorSvc",  m_regionSelector, "Region Selector");
+  declareProperty("RegSel_TGC", m_regsel_tgc);
   declareProperty("OutputCollection",   m_tgcCollection);
 
   // m_setting=314321 means 
@@ -89,8 +89,8 @@ StatusCode TgcRdoToTgcPrepData::initialize(){
   if(m_seededDecoding){
     ATH_CHECK(m_roiCollectionKey.initialize());
     ATH_CHECK(m_tgcCollection.initialize());
-    if (m_regionSelector.retrieve().isFailure()) {
-      ATH_MSG_FATAL("Unable to retrieve RegionSelector Svc");
+    if (m_regsel_tgc.retrieve().isFailure()) {
+      ATH_MSG_FATAL("Unable to retrieve m_regsel_tgc");
       return StatusCode::FAILURE;
     }
   }
@@ -116,7 +116,7 @@ StatusCode TgcRdoToTgcPrepData::execute() {
       std::vector<IdentifierHash> tgchashids;
       std::vector<IdentifierHash> hash_ids_withData;
       for(auto roi : *muonRoI){
-	m_regionSelector->DetHashIDList(TGC,*roi,tgchashids);
+	m_regsel_tgc->HashIDList(*roi,tgchashids);
 	if(tgchashids.size()!=0){
 	  ATH_CHECK(m_tool->decode(tgchashids, hash_ids_withData));
 	  tgchashids.clear();
diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/share/test.py b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/share/test.py
index 5f5da62547e4d563df7d4b25e2413e85f3964d6e..172f596bae24e8287b6ad9933f74239a8642962c 100644
--- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/share/test.py
+++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/share/test.py
@@ -57,4 +57,6 @@ print TgcRdoToPrepDataTool
 from MuonRdoToPrepData.MuonRdoToPrepDataConf import TgcRdoToTgcPrepData
 TgcRdoToTgcPrepData = TgcRdoToTgcPrepData()
 TgcRdoToTgcPrepData.PrintPrepData = True
+from RegionSelector.RegSelToolConfig import makeRegSelTool_TGC
+TgcRdoToTgcPrepData.RegSel_TGC = makeRegSelTool_TGC()
 topSequence += TgcRdoToTgcPrepData
diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MuonAlignmentCondAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MuonAlignmentCondAlg.cxx
index fc64a5c30715d1cd90a41def0a5d64d756fbcc70..2ebd3680a8d04b1b313bdbb8480c1859a2eef5c0 100644
--- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MuonAlignmentCondAlg.cxx
+++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MuonAlignmentCondAlg.cxx
@@ -237,18 +237,6 @@ StatusCode MuonAlignmentCondAlg::loadAlignABLines() {
   }		  
   ATH_MSG_INFO("recorded new " << writeALineHandle.key() << " with range " << rangeALineW << " into Conditions Store");
 
-  // >>>>>>>>>>>> START: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store >>>>>>>>>>>>
-  // =======================
-  // FIRST Update the MuonDetectorManager and THEN record the BLine.
-  // =======================
-
-  // FIXME: const_cast
-  if (const_cast<MuonGM::MuonDetectorManager*>(m_muonDetMgrDS)->updateDeformations(*writeBLineCdo).isFailure()) ATH_MSG_ERROR("Unable to updateDeformations" );
-  else ATH_MSG_DEBUG("updateDeformations DONE" );
-  // if (m_muonDetMgrDS->updateDeformations(writeBLineCdo.get()).isFailure()) ATH_MSG_ERROR("Unable to updateDeformations" );
-  // else ATH_MSG_DEBUG("updateDeformations DONE" );
-  // <<<<<<<<<<<<< END: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store <<<<<<<<<<<<<
-
   if (writeBLineHandle.record(rangeBLineW, std::move(writeBLineCdo)).isFailure()) {
     ATH_MSG_FATAL("Could not record BLineMapContainer " << writeBLineHandle.key() 
 		  << " with EventRange " << rangeBLineW
@@ -872,18 +860,6 @@ StatusCode MuonAlignmentCondAlg::loadAlignILines(std::string folderName)
    // dump I-lines to log file TBA
   if (m_dumpILines && (int)writeCdo->size()>0) dumpILines(folderName, writeCdo.get());
 
-  // >>>>>>>>>>>> START: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store >>>>>>>>>>>>
-  // =======================
-  // FIRST update MuonDetectorManager and THEN record the output cond object.
-  // =======================
-
-  // FIXME: const_cast
-  if (const_cast<MuonGM::MuonDetectorManager*>(m_muonDetMgrDS)->updateCSCInternalAlignmentMap(*writeCdo).isFailure()) ATH_MSG_ERROR("Unable to updateCSCInternalAlignmentMap" );
-  else ATH_MSG_DEBUG("updateCSCInternalAlignmentMap DONE" );
-  // if (m_muonDetMgrDS->updateCSCInternalAlignmentMap(writeCdo.get()).isFailure()) ATH_MSG_ERROR("Unable to updateCSCInternalAlignmentMap" );
-  // else ATH_MSG_DEBUG("updateCSCInternalAlignmentMap DONE" );
-  // <<<<<<<<<<<<< END: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store <<<<<<<<<<<<<
-
   if (writeHandle.record(rangeCscILinesW, std::move(writeCdo)).isFailure()) {
     ATH_MSG_FATAL("Could not record CscInternalAlignmentMapContainer " << writeHandle.key() 
 		  << " with EventRange " << rangeCscILinesW
@@ -1007,18 +983,6 @@ StatusCode MuonAlignmentCondAlg::loadAlignAsBuilt(std::string folderName)
   // !!!!!!!!!!!!!! In the MuonAlignmentDbTool this was in loadAlignABLines. I moved it here
   if ( m_asBuiltFile!="" ) setAsBuiltFromAscii(writeCdo.get());
 
-  // >>>>>>>>>>>> START: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store >>>>>>>>>>>>
-  // =======================
-  // FIRST update MuonDetectorManager and THEN record the output cond object.
-  // =======================
-
-  // FIXME: const_cast
-  if (const_cast<MuonGM::MuonDetectorManager*>(m_muonDetMgrDS)->updateAsBuiltParams(*writeCdo).isFailure()) ATH_MSG_ERROR("Unable to updateAsBuiltParams" );
-  else ATH_MSG_DEBUG("updateAsBuiltParams DONE" );
-  // if (m_muonDetMgrDS->updateAsBuiltParams(writeCdo.get()).isFailure()) ATH_MSG_ERROR("Unable to updateAsBuiltParams" );
-  // else ATH_MSG_DEBUG("updateAsBuiltParams DONE" );
-  // <<<<<<<<<<<<< END: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store <<<<<<<<<<<<<
-
   if (writeHandle.record(rangeMdtAsBuiltW, std::move(writeCdo)).isFailure()) {
     ATH_MSG_FATAL("Could not record MdtAsBuiltMapContainer " << writeHandle.key() 
 		  << " with EventRange " << rangeMdtAsBuiltW
diff --git a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py
index 1175a9040f0ef0b834b22ad86920a119d6000a4c..a482c0f9b7cf3c32b0e9502433df1fcf5b0297b0 100644
--- a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py
+++ b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py
@@ -73,6 +73,9 @@ def RpcRDODecodeCfg(flags, forTrigger=False):
     RpcRdoToRpcPrepData = RpcRdoToRpcPrepData(name          = "RpcRdoToRpcPrepData",
                                               DecodingTool  = RpcRdoToRpcPrepDataTool,
                                               PrintPrepData = False )
+    # add RegSelTool
+    from RegionSelector.RegSelToolConfig import regSelTool_RPC_Cfg
+    RpcRdoToRpcPrepData.RegSel_RPC = acc.popToolsAndMerge( regSelTool_RPC_Cfg( flags ) )
 
     if forTrigger:
         # Set the algorithm to RoI mode
@@ -103,6 +106,9 @@ def TgcRDODecodeCfg(flags, forTrigger=False):
     TgcRdoToTgcPrepData = TgcRdoToTgcPrepData(name          = "TgcRdoToTgcPrepData",
                                               DecodingTool  = TgcRdoToTgcPrepDataTool,
                                               PrintPrepData = False )
+    # add RegSelTool
+    from RegionSelector.RegSelToolConfig import regSelTool_TGC_Cfg
+    TgcRdoToTgcPrepData.RegSel_TGC = acc.popToolsAndMerge( regSelTool_TGC_Cfg( flags ) )
 
     if forTrigger:
         # Set the algorithm to RoI mode
@@ -173,6 +179,9 @@ def CscRDODecodeCfg(flags, forTrigger=False):
     CscRdoToCscPrepData = CscRdoToCscPrepData(name                    = "CscRdoToCscPrepData",
                                               CscRdoToCscPrepDataTool = CscRdoToCscPrepDataTool,
                                               PrintPrepData           = False )
+    # add RegSelTool
+    from RegionSelector.RegSelToolConfig import regSelTool_CSC_Cfg
+    CscRdoToCscPrepData.RegSel_CSC = acc.popToolsAndMerge( regSelTool_CSC_Cfg( flags ) )
 
     if forTrigger:
         # Set the algorithm to RoI mode
diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt
index a6ecb61e6508b94f22aef4370d9becf032fc4942..faa73eb878112be069714cf6e1d1faabc8684ddf 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt
+++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt
@@ -53,6 +53,7 @@ atlas_add_library( MuonReadoutGeometry
 if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
   set_source_files_properties(
      ${CMAKE_CURRENT_SOURCE_DIR}/src/MdtReadoutElement.cxx
+     ${CMAKE_CURRENT_SOURCE_DIR}/src/RpcReadoutElement.cxx
      ${CMAKE_CURRENT_SOURCE_DIR}/src/MuonStation.cxx
      PROPERTIES
      COMPILE_FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}"
diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx
index bde06552445c5e9ee9e34e720d75fb3b762d4b93..d87a01243480d027c251b93cb5c7d8ef58095d56 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx
@@ -889,6 +889,14 @@ namespace MuonGM {
 
   }
 
+#if defined(FLATTEN) && defined(__GNUC__)
+// We compile this package with optimization, even in debug builds; otherwise,
+// the heavy use of Eigen makes it too slow.  However, from here we may call
+// to out-of-line Eigen code that is linked from other DSOs; in that case,
+// it would not be optimized.  Avoid this by forcing all Eigen code
+// to be inlined here if possible.
+__attribute__ ((flatten))
+#endif
   void RpcReadoutElement::fillCache()
   {
 
diff --git a/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_DigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_DigitizationTool.cxx
index 06233836b5018ea42ce1a54734980a17250c3972..25c1f00978abd23dd135ccf39fb610ecdb8fbc67 100644
--- a/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_DigitizationTool.cxx
+++ b/MuonSpectrometer/MuonDigitization/MM_Digitization/src/MM_DigitizationTool.cxx
@@ -1242,6 +1242,10 @@ StatusCode MM_DigitizationTool::doDigitization(const EventContext& ctx) {
     // IdentifierHash detIdhash ;
     // set RE hash id
     const Identifier elemId = m_idHelperSvc->mmIdHelper().elementID( stripDigitOutputAllHits.digitID() );
+    if (!m_idHelperSvc->isMM(elemId)) {
+        ATH_MSG_WARNING("given Identifier "<<elemId.get_compact()<<" is not a MM Identifier, skipping");
+        continue;
+    }
     m_idHelperSvc->mmIdHelper().get_module_hash( elemId, moduleHash );
     
     MmDigitCollection* digitCollection = nullptr;
diff --git a/MuonSpectrometer/MuonG4/MuonG4SD/CMakeLists.txt b/MuonSpectrometer/MuonG4/MuonG4SD/CMakeLists.txt
index 4d89fe082969240448a350404b418b8dd889a038..b01fdcaebfc1dccc922bc2c65c6cdf707e4d3a2f 100644
--- a/MuonSpectrometer/MuonG4/MuonG4SD/CMakeLists.txt
+++ b/MuonSpectrometer/MuonG4/MuonG4SD/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( MuonG4SD )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/StoreGate
-                          DetectorDescription/GeoPrimitives
-                          GaudiKernel
-                          MuonSpectrometer/MuonSimEvent
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/MCTruth 
-                          AtlasTest/TestTools )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Eigen )
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx
index 9f17409e5b8579d3e965b928d9a4766aaa55d3d5..d622c58f0b7c35420c3131bb74f534da59512f95 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx
@@ -900,7 +900,7 @@ namespace Muon {
               }
             }
           }else if( etaHit.prd ){
-            if( !m_idHelperSvc->isRpc(etaHit.prd->identify()) ) continue;
+            if( !m_idHelperSvc->isRpc(etaHit.prd->identify()) && !m_idHelperSvc->issTgc(etaHit.prd->identify())) continue;
             Identifier gpId = m_idHelperSvc->gasGapId( etaHit.prd->identify() );
             auto mit = triggerLayersPhiMinMax.find(gpId);
             if( mit == triggerLayersPhiMinMax.end() )  ++nNoOverlaps;
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/CMakeLists.txt
deleted file mode 100644
index bf9f874997cbeecc274a8c40187dea8503a3c10c..0000000000000000000000000000000000000000
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-################################################################################
-# Package: MuonPatternFinderToolInterfaces
-################################################################################
-
-# Declare the package name:
-atlas_subdir( MuonPatternFinderToolInterfaces )
-
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern
-                          MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment
-                          Tracking/TrkEvent/TrkRoad )
-
-# Install files from the package:
-atlas_install_headers( MuonPatternFinderToolInterfaces )
-
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuonRoadChamberAssocTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuonRoadChamberAssocTool.h
deleted file mode 100644
index 79695b8bf08668b8a3899db054d1b20ee925123d..0000000000000000000000000000000000000000
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuonRoadChamberAssocTool.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUON_IMUONROADCHAMBERASSOCTOOL_H
-#define MUON_IMUONROADCHAMBERASSOCTOOL_H
- 
-#include "GaudiKernel/IAlgTool.h"
-#include "MuonPattern/MuonPatternCombinationCollection.h"
-#include "TrkRoad/TrackRoad.h"
-#include <vector>
-
-static const InterfaceID IID_IMuonRoadChamberAssocTool("Muon::IMuonRoadChamberAssocTool", 1, 0);
-
-namespace Trk {
-  class Track;
-}
-
-namespace Muon {
-
-  class IMuonRoadChamberAssocTool : virtual public IAlgTool 
-  {      
-    public:
-    /** access to tool interface */
-    static const InterfaceID& interfaceID();
-
-    virtual Muon::MuonPatternCombination* execute( Trk::TrackRoad road ) = 0;
-
-  };
-  
-  inline const InterfaceID& IMuonRoadChamberAssocTool::interfaceID()
-  {
-    return IID_IMuonRoadChamberAssocTool;
-  }
-
-} // end of name space
-
-#endif 
-
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoAllowCellTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoAllowCellTool.h
deleted file mode 100644
index a3623fb44ada45b58a549e50583eae9a58ca24e7..0000000000000000000000000000000000000000
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoAllowCellTool.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUON_IMUON_CDOALLOWCELLTOOL_H
-#define MUON_IMUON_CDOALLOWCELLTOOL_H
- 
-#include "GaudiKernel/IAlgTool.h"
-#include "MuonSegment/MuonSegmentCombinationCollection.h"
-#include "MuonPattern/MuonPatternCombinationCollection.h"
-
-#include <vector>
-
-static const InterfaceID IID_IMuon_CDoAllowCellTool("Muon::IMuon_CDoAllowCellTool", 1, 0);
-
-namespace Trk {
-  class Track;
-}
-
-namespace Muon {
-
-  /** @brief The IMuonSegmentMaker is a pure virtual interface for tools to find tracks starting from MuonSegmentCombinations  */  
-  class IMuon_CDoAllowCellTool : virtual public IAlgTool 
-  {      
-    public:
-    /** access to tool interface */
-    static const InterfaceID& interfaceID();
-
-    /** @brief Dummy execute() method
-	@param combi a reference to a MuonSegmentCombination
-	@return a pointer to a vector of tracks, the ownership of the tracks is passed to the client calling the tool.
-    */
-    virtual void execute( ) const = 0;
-
-  };
-  
-  inline const InterfaceID& IMuon_CDoAllowCellTool::interfaceID()
-  {
-    return IID_IMuon_CDoAllowCellTool;
-  }
-
-} // end of name space
-
-#endif 
-
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoCSCSegmentsTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoCSCSegmentsTool.h
deleted file mode 100644
index f0f4da2323d428dabc285d77acc34323df2117b6..0000000000000000000000000000000000000000
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoCSCSegmentsTool.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUON_IMUON_CDOCSCSEGMENTSTOOL_H
-#define MUON_IMUON_CDOCSCSEGMENTSTOOL_H
- 
-#include "GaudiKernel/IAlgTool.h"
-#include "MuonSegment/MuonSegmentCombinationCollection.h"
-#include "MuonPattern/MuonPatternCombinationCollection.h"
-
-#include <vector>
-
-static const InterfaceID IID_IMuon_CDoCSCSegmentsTool("Muon::IMuon_CDoCSCSegmentsTool", 1, 0);
-
-namespace Trk {
-  class Track;
-}
-
-namespace Muon {
-
-  /** @brief The IMuonSegmentMaker is a pure virtual interface for tools to find tracks starting from MuonSegmentCombinations  */  
-  class IMuon_CDoCSCSegmentsTool : virtual public IAlgTool 
-  {      
-    public:
-    /** access to tool interface */
-    static const InterfaceID& interfaceID();
-
-    /** @brief Dummy execute() method
-	@param combi a reference to a MuonSegmentCombination
-	@return a pointer to a vector of tracks, the ownership of the tracks is passed to the client calling the tool.
-    */
-    virtual void execute( ) const = 0;
-
-  };
-  
-  inline const InterfaceID& IMuon_CDoCSCSegmentsTool::interfaceID()
-  {
-    return IID_IMuon_CDoCSCSegmentsTool;
-  }
-
-} // end of name space
-
-#endif 
-
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoClustersTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoClustersTool.h
deleted file mode 100644
index a8d7b4436fa9e160cd2a227687254e835c7eb33f..0000000000000000000000000000000000000000
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoClustersTool.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUON_IMUON_CDOCLUSTERSTOOL_H
-#define MUON_IMUON_CDOCLUSTERSTOOL_H
- 
-#include "GaudiKernel/IAlgTool.h"
-#include "MuonSegment/MuonSegmentCombinationCollection.h"
-#include "MuonPattern/MuonPatternCombinationCollection.h"
-
-#include <vector>
-
-static const InterfaceID IID_IMuon_CDoClustersTool("Muon::IMuon_CDoClustersTool", 1, 0);
-
-namespace Trk {
-  class Track;
-}
-
-namespace Muon {
-
-  /** @brief The IMuonSegmentMaker is a pure virtual interface for tools to find tracks starting from MuonSegmentCombinations  */  
-  class IMuon_CDoClustersTool : virtual public IAlgTool 
-  {      
-    public:
-    /** access to tool interface */
-    static const InterfaceID& interfaceID();
-
-    /** @brief Dummy execute() method
-	@param combi a reference to a MuonSegmentCombination
-	@return a pointer to a vector of tracks, the ownership of the tracks is passed to the client calling the tool.
-    */
-    virtual void execute( ) const = 0;
-
-  };
-  
-  inline const InterfaceID& IMuon_CDoClustersTool::interfaceID()
-  {
-    return IID_IMuon_CDoClustersTool;
-  }
-
-} // end of name space
-
-#endif 
-
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoErrorSegmentTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoErrorSegmentTool.h
deleted file mode 100644
index 3ed8787fa30fc5ec7b2bd7c2d074d62e10e0b747..0000000000000000000000000000000000000000
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoErrorSegmentTool.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUON_IMUON_CDOERRORSEGMENTTOOL_H
-#define MUON_IMUON_CDOERRORSEGMENTTOOL_H
- 
-#include "GaudiKernel/IAlgTool.h"
-#include "MuonSegment/MuonSegmentCombinationCollection.h"
-#include "MuonPattern/MuonPatternCombinationCollection.h"
-
-#include <vector>
-
-static const InterfaceID IID_IMuon_CDoErrorSegmentTool("Muon::IMuon_CDoErrorSegmentTool", 1, 0);
-
-namespace Trk {
-  class Track;
-}
-
-namespace Muon {
-
-  /** @brief The IMuonSegmentMaker is a pure virtual interface for tools to find tracks starting from MuonSegmentCombinations  */  
-  class IMuon_CDoErrorSegmentTool : virtual public IAlgTool 
-  {      
-    public:
-    /** access to tool interface */
-    static const InterfaceID& interfaceID();
-
-    /** @brief Dummy execute() method
-	@param combi a reference to a MuonSegmentCombination
-	@return a pointer to a vector of tracks, the ownership of the tracks is passed to the client calling the tool.
-    */
-    virtual void execute( ) const = 0;
-
-  };
-  
-  inline const InterfaceID& IMuon_CDoErrorSegmentTool::interfaceID()
-  {
-    return IID_IMuon_CDoErrorSegmentTool;
-  }
-
-} // end of name space
-
-#endif 
-
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoLooseSegmentsTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoLooseSegmentsTool.h
deleted file mode 100644
index 367b81c2ba849a4518715403574c8f91747f42d2..0000000000000000000000000000000000000000
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoLooseSegmentsTool.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUON_IMUON_CDOLOOSESEGMENTSTOOL_H
-#define MUON_IMUON_CDOLOOSESEGMENTSTOOL_H
- 
-#include "GaudiKernel/IAlgTool.h"
-#include "MuonSegment/MuonSegmentCombinationCollection.h"
-#include "MuonPattern/MuonPatternCombinationCollection.h"
-
-#include <vector>
-
-static const InterfaceID IID_IMuon_CDoLooseSegmentsTool("Muon::IMuon_CDoLooseSegmentsTool", 1, 0);
-
-namespace Trk {
-  class Track;
-}
-
-namespace Muon {
-
-  /** @brief The IMuonSegmentMaker is a pure virtual interface for tools to find tracks starting from MuonSegmentCombinations  */  
-  class IMuon_CDoLooseSegmentsTool : virtual public IAlgTool 
-  {      
-    public:
-    /** access to tool interface */
-    static const InterfaceID& interfaceID();
-
-    /** @brief Dummy execute() method
-	@param combi a reference to a MuonSegmentCombination
-	@return a pointer to a vector of tracks, the ownership of the tracks is passed to the client calling the tool.
-    */
-    virtual void execute( ) const = 0;
-
-  };
-  
-  inline const InterfaceID& IMuon_CDoLooseSegmentsTool::interfaceID()
-  {
-    return IID_IMuon_CDoLooseSegmentsTool;
-  }
-
-} // end of name space
-
-#endif 
-
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoMDTROATool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoMDTROATool.h
deleted file mode 100644
index b82785acd836d65635f95f1339699f270a801cb2..0000000000000000000000000000000000000000
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoMDTROATool.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUON_IMUON_CDOMDTROATOOL_H
-#define MUON_IMUON_CDOMDTROATOOL_H
- 
-#include "GaudiKernel/IAlgTool.h"
-#include "MuonSegment/MuonSegmentCombinationCollection.h"
-#include "MuonPattern/MuonPatternCombinationCollection.h"
-
-#include <vector>
-
-static const InterfaceID IID_IMuon_CDoMDTROATool("Muon::IMuon_CDoMDTROATool", 1, 0);
-
-namespace Trk {
-  class Track;
-}
-
-namespace Muon {
-
-  /** @brief The IMuonSegmentMaker is a pure virtual interface for tools to find tracks starting from MuonSegmentCombinations  */  
-  class IMuon_CDoMDTROATool : virtual public IAlgTool 
-  {      
-    public:
-    /** access to tool interface */
-    static const InterfaceID& interfaceID();
-
-    /** @brief Dummy execute() method
-	@param combi a reference to a MuonSegmentCombination
-	@return a pointer to a vector of tracks, the ownership of the tracks is passed to the client calling the tool.
-    */
-    virtual void execute( ) const = 0;
-
-  };
-  
-  inline const InterfaceID& IMuon_CDoMDTROATool::interfaceID()
-  {
-    return IID_IMuon_CDoMDTROATool;
-  }
-
-} // end of name space
-
-#endif 
-
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoStrictSegmentsTool.h b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoStrictSegmentsTool.h
deleted file mode 100644
index 0c5894d00daee587f1b9cd22b6485d727f8d3865..0000000000000000000000000000000000000000
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonPatternFinderToolInterfaces/MuonPatternFinderToolInterfaces/IMuon_CDoStrictSegmentsTool.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUON_IMUON_CDDOSTRICTSEGMENTSTOOL_H
-#define MUON_IMUON_CDDOSTRICTSEGMENTSTOOL_H
- 
-#include "GaudiKernel/IAlgTool.h"
-#include "MuonSegment/MuonSegmentCombinationCollection.h"
-#include "MuonPattern/MuonPatternCombinationCollection.h"
-
-#include <vector>
-
-static const InterfaceID IID_IMuon_CDoStrictSegmentsTool("Muon::IMuon_CDoStrictSegmentsTool", 1, 0);
-
-namespace Trk {
-  class Track;
-}
-
-namespace Muon {
-
-  /** @brief The IMuonSegmentMaker is a pure virtual interface for tools to find tracks starting from MuonSegmentCombinations  */  
-  class IMuon_CDoStrictSegmentsTool : virtual public IAlgTool 
-  {      
-    public:
-    /** access to tool interface */
-    static const InterfaceID& interfaceID();
-
-    /** @brief Dummy execute() method
-	@param combi a reference to a MuonSegmentCombination
-	@return a pointer to a vector of tracks, the ownership of the tracks is passed to the client calling the tool.
-    */
-    virtual void execute( ) const = 0;
-
-  };
-  
-  inline const InterfaceID& IMuon_CDoStrictSegmentsTool::interfaceID()
-  {
-    return IID_IMuon_CDoStrictSegmentsTool;
-  }
-
-} // end of name space
-
-#endif 
-
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRDO_to_PRD_jobOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRDO_to_PRD_jobOptions.py
index f54c01917e3e5f30790f3fb6f5104cf949f41598..8085d278a475176d27b98cc4c31e2d9b43d75b8a 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRDO_to_PRD_jobOptions.py
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRDO_to_PRD_jobOptions.py
@@ -24,6 +24,8 @@ from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags
 if MuonGeometryFlags.hasCSC() and muonRecFlags.doCSCs() and DetFlags.makeRIO.CSC_on() and (DetFlags.haveRDO.CSC_on() or DetFlags.digitize.CSC_on()):
     topSequence += getAlgorithm("CscRdoToCscPrepData", tryDefaultConfigurable=True)
     topSequence.CscRdoToCscPrepData.CscRdoToCscPrepDataTool = CscPrepDataProviderTool()
+    from RegionSelector.RegSelToolConfig import makeRegSelTool_CSC
+    topSequence.CscRdoToCscPrepData.RegSel_CSC = makeRegSelTool_CSC()
 
 if muonRecFlags.doMDTs() and DetFlags.makeRIO.MDT_on() and (DetFlags.haveRDO.MDT_on() or DetFlags.digitize.MDT_on()):
     topSequence += getAlgorithm("MdtRdoToMdtPrepData", tryDefaultConfigurable=True)
@@ -34,10 +36,14 @@ if muonRecFlags.doMDTs() and DetFlags.makeRIO.MDT_on() and (DetFlags.haveRDO.MDT
 if muonRecFlags.doRPCs() and DetFlags.makeRIO.RPC_on() and (DetFlags.haveRDO.RPC_on() or DetFlags.digitize.RPC_on()):
     topSequence += getAlgorithm("RpcRdoToRpcPrepData", tryDefaultConfigurable=True )
     topSequence.RpcRdoToRpcPrepData.DecodingTool = RpcPrepDataProviderTool()
+    from RegionSelector.RegSelToolConfig import makeRegSelTool_RPC
+    topSequence.RpcRdoToRpcPrepData.RegSel_RPC = makeRegSelTool_RPC()
 
 if muonRecFlags.doTGCs() and DetFlags.makeRIO.TGC_on() and (DetFlags.haveRDO.TGC_on() or DetFlags.digitize.TGC_on()):
     topSequence += getAlgorithm("TgcRdoToTgcPrepData", tryDefaultConfigurable=True)
     topSequence.TgcRdoToTgcPrepData.DecodingTool = TgcPrepDataProviderTool()
+    from RegionSelector.RegSelToolConfig import makeRegSelTool_TGC
+    topSequence.TgcRdoToTgcPrepData.RegSel_TGC = makeRegSelTool_TGC()
 
 if not muonRecFlags.doFastDigitization():
     if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()):
diff --git a/MuonSpectrometer/MuonValidation/MuonSimHitToPrdTest/share/NtupleFragment.py b/MuonSpectrometer/MuonValidation/MuonSimHitToPrdTest/share/NtupleFragment.py
index b18925c39db643363a6f6e8be8589844dc815d6f..547642119f5a1c63dadfb064cf1a6b5d2e7ec9a3 100644
--- a/MuonSpectrometer/MuonValidation/MuonSimHitToPrdTest/share/NtupleFragment.py
+++ b/MuonSpectrometer/MuonValidation/MuonSimHitToPrdTest/share/NtupleFragment.py
@@ -24,6 +24,8 @@ ToolSvc += RpcRdoToPrepDataTool
 from MuonRdoToPrepData.MuonRdoToPrepDataConf import RpcRdoToRpcPrepData
 RpcRdoToRpcPrepData = RpcRdoToRpcPrepData()
 RpcRdoToRpcPrepData.PrintPrepData = False
+from RegionSelector.RegSelToolConfig import makeRegSelTool_RPC
+RpcRdoToRpcPrepData.RegSel_RPC = makeRegSelTool_RPC()
 
 topSequence += RpcRdoToRpcPrepData
 ######################## end of RPC rdo to prd 
diff --git a/MuonSpectrometer/MuonValidation/MuonSimHitToPrdTest/share/NtupleFragmentTestCabOnly.py b/MuonSpectrometer/MuonValidation/MuonSimHitToPrdTest/share/NtupleFragmentTestCabOnly.py
index 6e4797a8f1321418a57f1649795833ad9640763e..ec3caceda3053f3f25155fb3feb19aa7fad89f11 100644
--- a/MuonSpectrometer/MuonValidation/MuonSimHitToPrdTest/share/NtupleFragmentTestCabOnly.py
+++ b/MuonSpectrometer/MuonValidation/MuonSimHitToPrdTest/share/NtupleFragmentTestCabOnly.py
@@ -87,6 +87,8 @@ ToolSvc += RpcRdoToPrepDataTool
 from MuonRdoToPrepData.MuonRdoToPrepDataConf import RpcRdoToRpcPrepData
 RpcRdoToRpcPrepData = RpcRdoToRpcPrepData()
 RpcRdoToRpcPrepData.PrintPrepData = False
+from RegionSelector.RegSelToolConfig import makeRegSelTool_RPC
+RpcRdoToRpcPrepData.RegSel_RPC = makeRegSelTool_RPC()
 #
 topSequence += RpcRdoToRpcPrepData
 ######################## end of RPC rdo to prd 
diff --git a/MuonSpectrometer/MuonValidation/MuonSimHitToPrdTest/share/runRPCdecodingDumpOnNtuple.py b/MuonSpectrometer/MuonValidation/MuonSimHitToPrdTest/share/runRPCdecodingDumpOnNtuple.py
index b798c5ee27b6b9272dc6fee0b4fa90c4e66dbe1b..a2e2e082bcc150c0d23c2983a6f9b4f7f4a85b05 100644
--- a/MuonSpectrometer/MuonValidation/MuonSimHitToPrdTest/share/runRPCdecodingDumpOnNtuple.py
+++ b/MuonSpectrometer/MuonValidation/MuonSimHitToPrdTest/share/runRPCdecodingDumpOnNtuple.py
@@ -83,7 +83,8 @@ ToolSvc += RpcRdoToPrepDataTool
 from MuonRdoToPrepData.MuonRdoToPrepDataConf import RpcRdoToRpcPrepData
 RpcRdoToRpcPrepData = RpcRdoToRpcPrepData()
 RpcRdoToRpcPrepData.PrintPrepData = False
-#RpcRdoToRpcPrepData.PrintPrepData = True
+from RegionSelector.RegSelToolConfig import makeRegSelTool_RPC
+RpcRdoToRpcPrepData.RegSel_RPC = makeRegSelTool_RPC()
 #
 topSequence += RpcRdoToRpcPrepData
 ######################## end of RPC rdo to prd 
diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/CMakeLists.txt b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/CMakeLists.txt
index fce4b747c7714639128fabc463373253b38e06fc..b2c5d14bf3d333abd4b40a4bd7e0992d1c1692d2 100644
--- a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/CMakeLists.txt
+++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/CMakeLists.txt
@@ -36,15 +36,16 @@ atlas_install_joboptions( share/*_jobOptions.py )
 atlas_install_scripts( share/*_eljob.py )
 
 if( XAOD_STANDALONE )
-   atlas_add_test( testJobData
-      SCRIPT FTagAnalysisAlgorithmsTest_eljob.py --data-type data --unit-test
-      PROPERTIES TIMEOUT 600 )
-   atlas_add_test( testJobFullSim
-      SCRIPT FTagAnalysisAlgorithmsTest_eljob.py --data-type mc --unit-test
-      PROPERTIES TIMEOUT 600 )
-   atlas_add_test( testJobFastSim
-      SCRIPT FTagAnalysisAlgorithmsTest_eljob.py --data-type afii --unit-test
-      PROPERTIES TIMEOUT 600 )
+   # AnalysisBase migration: disabled until JetAnalysisAlgorithms is added
+   #atlas_add_test( testJobData
+   #   SCRIPT FTagAnalysisAlgorithmsTest_eljob.py --data-type data --unit-test
+   #   PROPERTIES TIMEOUT 600 )
+   #atlas_add_test( testJobFullSim
+   #   SCRIPT FTagAnalysisAlgorithmsTest_eljob.py --data-type mc --unit-test
+   #   PROPERTIES TIMEOUT 600 )
+   #atlas_add_test( testJobFastSim
+   #   SCRIPT FTagAnalysisAlgorithmsTest_eljob.py --data-type afii --unit-test
+   #   PROPERTIES TIMEOUT 600 )
 elseif( NOT "${CMAKE_PROJECT_NAME}" STREQUAL "AthDerivation" )
    atlas_add_test( testJobData
       SCRIPT athena.py
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/CMakeLists.txt
index ac6b468dc9761671aacd68a30696dc7b890b4b9c..2a1bd0d6ae142f82ce46bdbc1c3ce296131c2e79 100644
--- a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/CMakeLists.txt
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/CMakeLists.txt
@@ -67,8 +67,6 @@ macro( _add_exec name )
       LINK_LIBRARIES ${ROOT_LIBRARIES} PileupReweightingLib )
 endmacro( _add_exec )
 
-_add_exec( testPRW )
-_add_exec( testPRWTool )
 _add_exec( checkPRWConfigFile )
 
 # Test(s) in the package:
@@ -77,5 +75,23 @@ atlas_add_test( ut_PRWExample_test
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
    LINK_LIBRARIES ${ROOT_LIBRARIES} PileupReweightingLib )
 
+atlas_add_test( testPRW
+   SOURCES test/testPRW.cxx
+   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+   LINK_LIBRARIES ${ROOT_LIBRARIES} PileupReweightingLib )
+
+atlas_add_test( testPRWTool
+   SOURCES test/testPRWTool.cxx
+   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+   LINK_LIBRARIES ${ROOT_LIBRARIES} PileupReweightingLib )
+
+atlas_add_test( ut_PRWDataWeightExample_test
+   SOURCES test/ut_PRWDataWeightExample_test.cxx
+   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+   LINK_LIBRARIES ${ROOT_LIBRARIES} PileupReweightingLib )
+   
+# Install files from the package:
+atlas_install_python_modules( python/*.py )
 atlas_install_joboptions( share/*.py )
 atlas_install_data( share/*.root )
+atlas_install_scripts( scripts/PURW_create_actual_mu_profile.py )
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/PileupReweighting/PileupReweightingTool.h b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/PileupReweighting/PileupReweightingTool.h
index c87c6e31b63585aa9bcc054df203153198ad77bd..93fb1f2ded7204a9745e66d4d02937e22c440144 100644
--- a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/PileupReweighting/PileupReweightingTool.h
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/PileupReweighting/PileupReweightingTool.h
@@ -6,6 +6,9 @@
 #ifndef PILEUPREWEIGHTING_PILEUPREWEIGHTINGTOOL_H
 #define PILEUPREWEIGHTING_PILEUPREWEIGHTINGTOOL_H
 
+// System include(s):
+#include <memory>
+
 // Framework include(s):
 #include "AsgTools/AsgTool.h"
 
@@ -133,7 +136,10 @@ namespace CP {
    private:
       std::string m_configStream;
       bool m_inConfigMode;
-      CP::TPileupReweighting *m_upTool, *m_downTool; //systematic variation instances for the reweighting
+
+      // Systematic variation instances for the reweighting
+      std::unique_ptr< CP::TPileupReweighting > m_upTool;
+      std::unique_ptr< CP::TPileupReweighting > m_downTool;
 
       double m_upVariation; double m_downVariation;
       CP::SystematicVariation m_systUp, m_systDown;
@@ -149,6 +155,14 @@ namespace CP {
       std::map<int, bool> m_doneConfigs;
 
       bool m_noWeightsMode;
+      
+      bool m_varyRunNumber;
+      bool m_useRunDependentPrescaleWeight;
+      
+      std::vector<int> m_customPeriods;
+
+      ///< Default weight tool in standalone mode
+      std::unique_ptr< IWeightTool > m_defaultWeightTool;
 
       ToolHandle<IWeightTool> m_weightTool;
       ToolHandle<IGoodRunsListSelectionTool> m_grlTool;
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/PileupReweighting/TPileupReweighting.h b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/PileupReweighting/TPileupReweighting.h
index 7438cf7bf0a0759e13b6e6a414e51024b4951d56..a20c246e6d3fe62daa27d9322bfe2b351db7e340 100644
--- a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/PileupReweighting/TPileupReweighting.h
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/PileupReweighting/TPileupReweighting.h
@@ -34,13 +34,13 @@
 // STL includes
 #include <iostream>
 #include <stdexcept>
+#include <memory>
+#include <list>
 
-#include "TH1.h"
+#include <TH1.h>
+#include <TH2.h>
 
 
-class TH1;
-class TH1D;
-class TH2D;
 class TTree;
 class TFile;
 
@@ -53,10 +53,6 @@ namespace CP {
       /** Standard constructor */
       TPileupReweighting(const char* name="TPileupReweighting");
 
-      /** Standard destructor */
-      ~TPileupReweighting();
-
-
   public:
 
       /** use a hardcoded period configuration */
@@ -241,6 +237,12 @@ namespace CP {
       //*std::map<Int_t,std::map<Int_t, TH1*> > & GetInputHistograms() { return m_inputHistograms;}
 
 
+      std::vector<int> GetPeriodNumbers() const {
+        std::vector<int> out;
+        for(auto& p : m_periods) { out.push_back(p.first); }
+        return out;
+      }
+
       //-----------------------------------------------------
       //Methods to inspect the input and weighting histograms
       //-----------------------------------------------------
@@ -249,18 +251,18 @@ namespace CP {
             m_periods[periodNumber]->inputHists.find(channelNumber)==m_periods[periodNumber]->inputHists.end()) {
             return 0;
          }
-         return m_periods[periodNumber]->inputHists[channelNumber];
+         return m_periods[periodNumber]->inputHists[channelNumber].get();
       }
 
-      TH1D* GetPrimaryDistribution(Int_t channelNumber, Int_t periodNumber) {
+      TH1* GetPrimaryDistribution(Int_t channelNumber, Int_t periodNumber) {
          if(m_periods.find(periodNumber)==m_periods.end()||
             m_periods[periodNumber]->primaryHists.find(channelNumber)==m_periods[periodNumber]->primaryHists.end()) {
             return 0;
          }
-         return m_periods[periodNumber]->primaryHists[channelNumber];
+         return m_periods[periodNumber]->primaryHists[channelNumber].get();
       }
 
-      TH1D* GetPrimaryTriggerDistribution(const TString& trigger, Int_t periodNumber, long triggerBits)  {
+      TH1* GetPrimaryTriggerDistribution(const TString& trigger, Int_t periodNumber, long triggerBits)  {
          if(m_triggerObjs.find(trigger)==m_triggerObjs.end() || m_triggerObjs[trigger]->triggerHists.find(periodNumber) ==m_triggerObjs[trigger]->triggerHists.end() ||
             m_triggerObjs[trigger]->triggerHists[periodNumber].find(triggerBits) == m_triggerObjs[trigger]->triggerHists[periodNumber].end()) return 0;
       /*
@@ -268,15 +270,15 @@ namespace CP {
             m_triggerObjs.at(trigger).second->triggerHists.at(periodNumber).find(triggerBits) == m_triggerObjs.at(trigger).second.at(periodNumber).end()) return 0;
       */
          
-         return m_triggerObjs[trigger]->triggerHists[periodNumber][triggerBits];
+         return m_triggerObjs[trigger]->triggerHists[periodNumber][triggerBits].get();
       }
 
       /** Method for weighting data to account for prescales and mu bias. Use by giving the tool multiple lumicalc files, one for each trigger */
-      Double_t GetDataWeight(Int_t runNumber, const TString& trigger, Double_t x);
+      Double_t GetDataWeight(Int_t runNumber, const TString& trigger, Double_t x, bool run_dependent=false);
       Double_t GetDataWeight(Int_t runNumber, const TString& trigger);//version without mu dependence
 
     /** Method for prescaling MC to account for prescales in data */
-      Double_t GetPrescaleWeight(Int_t runNumber, const TString& trigger, Double_t x);
+      Double_t GetPrescaleWeight(Int_t runNumber, const TString& trigger, Double_t x, bool run_dependent=false);
       Double_t GetPrescaleWeight(Int_t runNumber, const TString& trigger);//version without mu dependence
 
 
@@ -298,6 +300,8 @@ namespace CP {
 
       double GetRunAverageMu(int run) { return m_runs[run].inputHists["None"]->GetMean(); }
 
+      
+
   protected:
       virtual bool runLbnOK(Int_t /*runNbr*/, Int_t /*lbn*/) { return true; } //override in the ASG tool
       virtual bool passTriggerBeforePrescale(const TString& trigger) const { 
@@ -313,13 +317,13 @@ namespace CP {
       Int_t IsBadBin(Int_t thisMCRunNumber, Int_t bin);
 
 
-      TH1* CloneEmptyHistogram(Int_t runNumber, Int_t channelNumber);
+      std::unique_ptr< TH1 > CloneEmptyHistogram(Int_t runNumber, Int_t channelNumber);
       /** Normalize histograms */
       void normalizeHistogram(TH1* histo);
       void AddDistributionTree(TTree *tree, TFile *file);
       //*Int_t FactorizeDistribution(TH1* hist, const TString weightName, Int_t channelNumber, Int_t periodNumber,bool includeInMCRun,bool includeInGlobal);
 
-      void CalculatePrescaledLuminosityHistograms(const TString& trigger);
+      void CalculatePrescaledLuminosityHistograms(const TString& trigger, int run_dependent=0);
 
       //********** Private members*************************
       TPileupReweighting* m_parentTool; //points to self if not a 'systematic varion' tool instance
@@ -348,7 +352,7 @@ namespace CP {
 
 
       /** the empty histogram used for this weight... effectively holds the configuration of the binning */
-      TH1* m_emptyHistogram; 
+      std::unique_ptr< TH1 > m_emptyHistogram; 
 
 
 
@@ -358,12 +362,11 @@ namespace CP {
 public:
       struct CompositeTrigger {
          int op;
-         CompositeTrigger* trig1;
-         CompositeTrigger* trig2;
+         std::unique_ptr< CompositeTrigger > trig1;
+         std::unique_ptr< CompositeTrigger > trig2;
          TString val;
          std::vector<TString> subTriggers; //only set for top-level object
-         CompositeTrigger() : op(0),trig1(0),trig2(0),val("") { }
-         ~CompositeTrigger() { if(trig1) delete trig1; if(trig2) delete trig2; }
+         CompositeTrigger() : op(0),trig1(),trig2(),val("") { }
          double eval(std::map<TString, std::map<Int_t, std::map<Int_t, Float_t> > >& m, int run, int lbn, const TPileupReweighting* tool) {
             switch(op) {
                case 0: if(m[val][run].find(lbn)==m[val][run].end() || !m[val][run][lbn] || !tool->passTriggerBeforePrescale(val)) return 0; /*trigger/failed disabled, so cannot contribute*/   
@@ -384,15 +387,18 @@ public:
           return out;
          }
          
-         std::map<int, std::map<long, TH1D*> > triggerHists; //unnormalized ... i.e. integral should be equal to the lumi! ... indexed by PeriodID,tbits
-         
+         // unnormalized ... i.e. integral should be equal to the lumi!
+         // ... indexed by PeriodID,tbits
+         // ... if doing run-dependent weights, PeriodID is replaced by -runNumber (negative number!)
+         std::map<int, std::map<long, std::unique_ptr< TH1 > > > triggerHists;
+
       };
 protected:
 
-      std::map<TString, CompositeTrigger*> m_triggerObjs; //map from trigger string to composite trigger object
+      std::map<TString, std::unique_ptr<CompositeTrigger> > m_triggerObjs; //map from trigger string to composite trigger object
 
-      CompositeTrigger* makeTrigger(const TString& s);
-      void calculateHistograms(CompositeTrigger* trigger);
+      std::unique_ptr<CompositeTrigger> makeTrigger(const TString& s);
+      void calculateHistograms(CompositeTrigger* trigger, int run_dependent);
 
 public:
       inline void PrintPeriods() { for(auto p : m_periods) {std::cout << p.first << " -> "; p.second->print("");} }
@@ -406,11 +412,11 @@ public:
          std::map<Int_t, Double_t> unrepData; //indexed by channel number
          std::vector<Period*> subPeriods; 
          std::vector<UInt_t> runNumbers; //populated with runNumbers that actually had some data available
-         std::map<Int_t, TH1*> inputHists;
+         std::map<Int_t, std::unique_ptr< TH1 > > inputHists;
          std::map<Int_t, Double_t> sumOfWeights; 
          std::map<Int_t, Int_t> numberOfEntries;
-         std::map<Int_t, TH1D*> primaryHists; //normalized histograms, indexed by channelNumber. -1 holds the data
-         std::map<Int_t, TH2D*> secondaryHists; //semi-normalized histograms, only used in 2D reweighting
+         std::map<Int_t, std::unique_ptr< TH1 > > primaryHists; //normalized histograms, indexed by channelNumber. -1 holds the data
+         std::map<Int_t, std::unique_ptr< TH2 > > secondaryHists; //semi-normalized histograms, only used in 2D reweighting
          //std::map<TString, TH1D*> triggerHists; //unnormalized ... i.e. integral should be equal to the lumi! ... should really only be filled in the channel=-1 case (i.e. data)
          bool contains(unsigned int runNumber) {
             if(runNumber >= start && runNumber <= end) return true;
@@ -423,18 +429,22 @@ public:
          };
          void print(const char* prefix) { 
             std::cout << prefix << id << "[" << start << "," << end << "] : ";
-            for(auto hist : inputHists) std::cout << hist.first << " , ";
+            for(auto& hist : inputHists) std::cout << hist.first << " , ";
             std::cout << std::endl;
             for(auto p : subPeriods) p->print(TString::Format(" %s",prefix).Data()); };
       };
       struct Run {
-         std::map<TString,TH1*> inputHists; //key is the 'trigger' 
+         std::map< TString, std::unique_ptr< TH1 > > inputHists; //key is the 'trigger' 
          std::map<Int_t,Double_t> badBins; 
          Double_t lumi; //total data in run
          std::map<UInt_t, std::pair<Double_t,Double_t> > lumiByLbn; //key=lbn, value = <lumi,mu>
-         TH1D* muDist; //mu distribution for this run
+         std::unique_ptr< TH1 > muDist; //mu distribution for this run
+         bool nominalFromHists = false; //flag if nominal 'None' hist came from histogram files (rather than lumicalc files)
       };
+      std::map<UInt_t, Run>& GetRunMap() { return m_runs; }
 protected:
+      /// List physically holding (owning) period objects
+      std::list< Period > m_periodList;
       std::map<Int_t, Period*> m_periods; //periods mapped by id. -1 = the "global" period (0->9999999). Uses a pointer so can easily implement remap as two entries pointing at same period
       std::map<UInt_t, Run> m_runs; //runs mapped by runNumber
 
@@ -446,7 +456,7 @@ protected:
       //RandomDataPeriod functionality stuff
       //numbers generated seperately for each mc period
       //-----------------------------------------------------
-      TRandom3 *m_random3;
+      std::unique_ptr< TRandom3 > m_random3;
 
       Bool_t m_ignoreBadChannels; //if true, will print a warning about any channels with too much unrepresented data, but will then just ignore them
       Bool_t m_useMultiPeriods = true; //if true, will allow for runDependentMC 
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/Root/PileupReweightingTool.cxx b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/Root/PileupReweightingTool.cxx
index 13fac3aee9953c850f0850a7446dcffee4d5626f..10a957c649da96bc61f08e8d779c24cf5f906caf 100644
--- a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/Root/PileupReweightingTool.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/Root/PileupReweightingTool.cxx
@@ -27,9 +27,12 @@ namespace CP {
 
 PileupReweightingTool::PileupReweightingTool( const std::string& name ) :CP::TPileupReweighting(name.c_str()), asg::AsgTool( name ), 
    m_inConfigMode(false), 
-   m_upTool(0), m_downTool(0), m_systUp("PRW_DATASF", 1 ), m_systDown("PRW_DATASF", -1), 
+   m_upTool(), m_downTool(), m_systUp("PRW_DATASF", 1 ), m_systDown("PRW_DATASF", -1), 
    m_activeTool(this), 
-   m_noWeightsMode(false), 
+   m_noWeightsMode(false),
+#ifdef XAOD_STANDALONE
+   m_defaultWeightTool( new McEventWeight( "DefaultWeightTool" ) ),
+#endif // XAOD_STANDALONE
    m_weightTool("McEventWeight/myWeightTool"),
    m_grlTool(""), m_tdt("") {
 
@@ -39,26 +42,32 @@ PileupReweightingTool::PileupReweightingTool( const std::string& name ) :CP::TPi
    declareProperty("ConfigOutputStream", m_configStream="", "When creating PRW config files, this is the THistSvc stream it goes into. If blank, it wont write this way");
 #endif
 
-   declareProperty("ConfigFiles", m_prwFiles={"dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root","dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root"}, "List of prw config files"); //array of files
+   declareProperty("ConfigFiles", m_prwFiles, "List of prw config files"); //array of files
    declareProperty("ConfigFilesPathPrefix", m_prwFilesPathPrefix="", "Path of additional folder structure in prw config files"); //string prefix
    declareProperty("LumiCalcFiles", m_lumicalcFiles, "List of lumicalc files, in the format '<filename>:<trigger>' .. if no trigger given, 'None' is assumed"); //array of files
    declareProperty("Prefix",m_prefix="","Prefix to attach to all decorations ... only used in the 'apply' method");
    declareProperty("UnrepresentedDataAction",m_unrepresentedDataAction=3,"1 = remove unrepresented data, 2 = leave it there, 3 = reassign it to nearest represented bin");
    declareProperty("UnrepresentedDataThreshold",m_unrepDataTolerance=0.05,"When unrepresented data is above this level, will require the PRW config file to be repaired");
-   declareProperty("UseMultiPeriods",m_useMultiPeriods=false,"If true, will try to treat each mc runNumber in a single mc dataset (channel) as a modelling a distinct period of data taking");
-   declareProperty("DataScaleFactor",m_dataScaleFactorX=1./1.09);
+   declareProperty("UseMultiPeriods",m_useMultiPeriods=true,"If true, will try to treat each mc runNumber in a single mc dataset (channel) as a modelling a distinct period of data taking");
+   declareProperty("UseRunDependentPrescaleWeight",m_useRunDependentPrescaleWeight=false,"If true, prescale weights in the getCombinedWeight method with Trigger string are determined with the specific random run number");
+   declareProperty("DataScaleFactor",m_dataScaleFactorX=1./1.03);
    declareProperty("UsePeriodConfig",m_usePeriodConfig="auto","Use this period configuration when in config generating mode. Set to 'auto' to auto-detect");
    declareProperty("IgnoreBadChannels",m_ignoreBadChannels=true,"If true, will ignore channels with too much unrepresented data, printing a warning for them");
-   declareProperty("DataScaleFactorUP",m_upVariation=1./1.,"Set to a value representing the 'up' fluctuation - will report a PRW_DATASF uncertainty to Systematic Registry");
-   declareProperty("DataScaleFactorDOWN",m_downVariation=1./1.18,"Set to a value representing the 'down' fluctuation - will report a PRW_DATASF uncertainty to Systematic Registry");
+   declareProperty("DataScaleFactorUP",m_upVariation=1./0.99,"Set to a value representing the 'up' fluctuation - will report a PRW_DATASF uncertainty to Systematic Registry");
+   declareProperty("DataScaleFactorDOWN",m_downVariation=1./1.07,"Set to a value representing the 'down' fluctuation - will report a PRW_DATASF uncertainty to Systematic Registry");
+   declareProperty("VaryRandomRunNumber",m_varyRunNumber=false,"If true, then when doing systematic variations, RandomRunNumber will fluctuate as well. Off by default as believed to lead to overestimated uncertainties");
+   
+   declareProperty("PeriodAssignments", m_customPeriods={284500,222222,324300,300000,324300,344495,310000,344496,999999}, "Specify period number assignments to run numbers ranges - this is usually an expert option");
    
    declareProperty("GRLTool", m_grlTool, "If you provide a GoodRunsListSelectionTool, any information from lumicalc files will be automatically filtered" );
    declareProperty("TrigDecisionTool",m_tdt, "When using the getDataWeight method, the TDT will be used to check decisions before prescale. Alternatively do expert()->SetTriggerBit('trigger',0) to flag which triggers are not fired before prescale (assumed triggers are fired if not specified)");
 
 #ifdef XAOD_STANDALONE
-   declareProperty( "WeightTool", m_weightTool = new McEventWeight("myWeightTool"),"The tool to compute the weight in the sumOfWeights");
+   declareProperty( "WeightTool", m_weightTool = m_defaultWeightTool.get(),
+                    "The tool to compute the weight in the sumOfWeights" );
 #else
-   declareProperty( "WeightTool", m_weightTool,"The tool to compute the weight in the sumOfWeights");
+   declareProperty( "WeightTool", m_weightTool,
+                    "The tool to compute the weight in the sumOfWeights" );
 #endif
 
 #ifndef XAOD_STANDALONE
@@ -78,7 +87,10 @@ PileupReweightingTool::PileupReweightingTool( const std::string& name ) :CP::TPi
 #ifndef XAOD_STANDALONE
 //rootcore can't do this yet!
 void PileupReweightingTool::updateHandler(Property& /*p*/) {
-   //call the original update handler 
+   // commenting this out as it doesn't compile anymore
+   // leaving it to domain expert to decide whether to keep or remove it
+   // //call the original update handler 
+   // this->msg_update_handler(p);
    EnableDebugging(this->msgLvl(MSG::DEBUG));
 }
 #endif
@@ -119,11 +131,11 @@ CP::SystematicCode PileupReweightingTool::applySystematicVariation( const CP::Sy
    }
    if(systConfig.find( m_systUp ) != systConfig.end()) {
       if(!m_upTool) { ATH_MSG_ERROR("Requested up variation of PRW_DATASF, but not configured to do this :-("); return SystematicCode::Unsupported; }
-       m_activeTool = m_upTool;
+      m_activeTool = m_upTool.get();
    }
    else if(systConfig.find( m_systDown ) != systConfig.end() ) {
       if(!m_downTool) { ATH_MSG_ERROR("Requested down variation of PRW_DATASF, but not configured to do this :-("); return SystematicCode::Unsupported; }
-      m_activeTool = m_downTool;
+      m_activeTool = m_downTool.get();
    }
    else m_activeTool = this;
    return SystematicCode::Ok;
@@ -156,22 +168,40 @@ StatusCode PileupReweightingTool::initialize() {
    //set debugging if debugging is on:
    EnableDebugging(this->msgLvl(MSG::DEBUG));
 
+   //convert custom periods vector to a vector of vectors (length 3) ...
+   std::vector<std::vector<int>> customPeriods;
+   for(auto& num : m_customPeriods) {
+    if(customPeriods.size()==0 || customPeriods.back().size()==3) customPeriods.resize(customPeriods.size()+1);
+    customPeriods.back().push_back(num);
+   }
+
+   for(auto& period : customPeriods) {
+    if(period.size()!=3) {
+      ATH_MSG_FATAL("Recevied period with " << period.size() << " numbers. Period configuration requires 3 numbers: periodNumber, startNumber, endNumber");
+      return StatusCode::FAILURE;
+    }
+    AddPeriod(period[0],period[1],period[2]);
+   }
+
    //see if we need variations 
    if(m_upVariation && (m_prwFiles.size()+m_lumicalcFiles.size())!=0) {
-      m_upTool = new TPileupReweighting((name()+"_upVariation").c_str());
+      m_upTool.reset( new TPileupReweighting((name()+"_upVariation").c_str()) );
       m_upTool->SetParentTool(this);
       m_upTool->CopyProperties(this);
       m_upTool->SetDataScaleFactors(m_upVariation);
+      for(auto& period : customPeriods) m_upTool->AddPeriod(period[0],period[1],period[2]); //already checked sizes above
    }
    if(m_downVariation && (m_prwFiles.size()+m_lumicalcFiles.size())!=0) {
-      m_downTool = new TPileupReweighting((name()+"_downVariation").c_str());
+      m_downTool.reset( new TPileupReweighting((name()+"_downVariation").c_str()) );
       m_downTool->SetParentTool(this);
       m_downTool->CopyProperties(this);
       m_downTool->SetDataScaleFactors(m_downVariation);
+      for(auto& period : customPeriods) m_downTool->AddPeriod(period[0],period[1],period[2]); //already checked sizes above
    }
 
    SetDefaultChannel(m_defaultChannel); //handled in GetDefaultChannel method now! if(m_upTool) m_upTool->SetDefaultChannel(m_defaultChannel); if(m_downTool) m_downTool->SetDefaultChannel(m_defaultChannel);
 
+
    //should we set the period config (file maker mode)
    if(m_prwFiles.size()+m_lumicalcFiles.size()==0) {
       m_inConfigMode=true;
@@ -186,6 +216,16 @@ StatusCode PileupReweightingTool::initialize() {
 #endif
    } else {
       //have we any prw to load
+      if(m_prwFiles.size() && m_usePeriodConfig=="auto") {
+        //will override the input config period assignments, will assume PRW is so standardized by r21 that we know best!
+        IgnoreConfigFilePeriods(true);
+        if(m_upTool) m_upTool->IgnoreConfigFilePeriods(true);
+        if(m_downTool) m_downTool->IgnoreConfigFilePeriods(true);
+        UsePeriodConfig("MC16"); //hardcoded period assignments
+        if(m_upTool) m_upTool->UsePeriodConfig("MC16");
+        if(m_downTool) m_downTool->UsePeriodConfig("MC16");
+      }
+      
       for(unsigned int j=0;j<m_prwFiles.size();j++) {
             ATH_MSG_VERBOSE("Locating File: " << m_prwFiles[j]);
             std::string file = PathResolverFindCalibFile(m_prwFiles[j]);
@@ -207,8 +247,11 @@ StatusCode PileupReweightingTool::initialize() {
             if(m_upTool) m_upTool->UsePeriodConfig(m_usePeriodConfig);
             if(m_downTool) m_downTool->UsePeriodConfig(m_usePeriodConfig);
          } else {
-            ATH_MSG_INFO("No config files provided, but " << m_lumicalcFiles.size() << " lumicalc file provided. Please specify a UsePeriodConfig if you want to use the tool without a config file (e.g. do 'MC15') ");
-            return StatusCode::FAILURE;
+            ATH_MSG_WARNING("No config files provided, but " << m_lumicalcFiles.size() << " lumicalc file provided. Assuming a period config of MC16 ");
+            UsePeriodConfig("MC16");
+            m_noWeightsMode=true; //will stop the prw weight being decorated in apply method
+            if(m_upTool) m_upTool->UsePeriodConfig("MC16");
+            if(m_downTool) m_downTool->UsePeriodConfig("MC16");
          }
       }
    
@@ -287,9 +330,9 @@ StatusCode PileupReweightingTool::finalize() {
                pStarts.push_back(subp->start); pEnds.push_back(subp->end);
             }
          }
-         for(auto inHist : period.second->inputHists) {
+         for(auto& inHist : period.second->inputHists) {
             channel = inHist.first;
-            TH1* hist = inHist.second;
+            TH1* hist = inHist.second.release();
             strncpy(histName,hist->GetName(),sizeof(histName)-1);
             CHECK( histSvc->regHist(TString::Format("/%s/PileupReweighting/%s",m_configStream.c_str(),hist->GetName()).Data(),hist) );
             if(!outTreeMC) {
@@ -310,7 +353,7 @@ StatusCode PileupReweightingTool::finalize() {
          runNumber = run.first;
          if(run.second.inputHists.find("None")==run.second.inputHists.end()) continue;
    
-         TH1* hist = run.second.inputHists["None"];
+         TH1* hist = run.second.inputHists["None"].release();
          strncpy(histName,hist->GetName(),sizeof(histName)-1);
          CHECK( histSvc->regHist(TString::Format("/%s/PileupReweighting/%s",m_configStream.c_str(),hist->GetName()).Data(),hist) );
          if(!outTreeData) {
@@ -335,7 +378,7 @@ StatusCode PileupReweightingTool::finalize() {
 #endif
    }
 
-   if(m_upTool) {delete m_upTool;m_upTool=0;} if(m_downTool)  {delete m_downTool;m_downTool=0;} 
+   m_upTool.reset(); m_downTool.reset(); 
 
    return StatusCode::SUCCESS;
 }
@@ -361,9 +404,10 @@ float PileupReweightingTool::getUnrepresentedDataWeight( const xAOD::EventInfo&
 
 /// Get a random run number for this MC event, mu_dependency is not recommended for this
 int PileupReweightingTool::getRandomRunNumber( const xAOD::EventInfo& eventInfo , bool mu_dependent) {
-   m_activeTool->SetRandomSeed(314159+eventInfo.mcChannelNumber()*2718+eventInfo.eventNumber()); //to make randomization repeatable
-   if(mu_dependent) return m_activeTool->GetRandomRunNumber(   eventInfo.runNumber(), eventInfo.averageInteractionsPerCrossing()  );
-   else return m_activeTool->GetRandomRunNumber( eventInfo.runNumber() );
+   CP::TPileupReweighting* tool = (m_varyRunNumber) ? m_activeTool : this;
+   tool->SetRandomSeed(314159+eventInfo.mcChannelNumber()*2718+eventInfo.eventNumber()); //to make randomization repeatable
+   if(mu_dependent) return tool->GetRandomRunNumber(   eventInfo.runNumber(), eventInfo.averageInteractionsPerCrossing()  );
+   else return tool->GetRandomRunNumber( eventInfo.runNumber() );
 }
 
 int PileupReweightingTool::fill( const xAOD::EventInfo& eventInfo ) {
@@ -396,6 +440,11 @@ int PileupReweightingTool::fill( const xAOD::EventInfo& eventInfo, Double_t x, D
 
 StatusCode PileupReweightingTool::apply(const xAOD::EventInfo& eventInfo, bool mu_dependent) {
 
+   if (eventInfo.isAvailable<unsigned int>(m_prefix+"RandomRunNumber")){
+     ATH_MSG_WARNING("Attempting to run pileup reweighting, but it has already been run with prefix \"" << m_prefix << "\" - returning");
+     return StatusCode::SUCCESS;
+   }
+
    if(m_inConfigMode)  {
       fill( eventInfo );
       return StatusCode::SUCCESS;
@@ -453,7 +502,7 @@ float PileupReweightingTool::getCombinedWeight( const xAOD::EventInfo& eventInfo
    //need to use the random run number ... only used to pick the subperiod, but in run2 so far we only have one subperiod
    unsigned int randomRunNum = (eventInfo.isAvailable<unsigned int>(m_prefix+"RandomRunNumber")) ? eventInfo.auxdataConst<unsigned int>(m_prefix+"RandomRunNumber") : getRandomRunNumber( eventInfo, mu_dependent );
    if(!mu_dependent) out *= m_activeTool->GetPrescaleWeight(randomRunNum, trigger);
-   out *= m_activeTool->GetPrescaleWeight( randomRunNum, trigger, getCorrectedAverageInteractionsPerCrossing(eventInfo,false) /*use the 'correct' mu instead of the one from the file!!*/ );
+   else out *= m_activeTool->GetPrescaleWeight( randomRunNum, trigger, getCorrectedAverageInteractionsPerCrossing(eventInfo,false) /*use the 'correct' mu instead of the one from the file!!*/, m_useRunDependentPrescaleWeight /*run-dependent*/ );
    return out;
 }
 
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/Root/TPileupReweighting.cxx b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/Root/TPileupReweighting.cxx
index abc0560a3f76840cbdbcd2c3d57c44d5d42c48ce..7d20cbd4edf058e105c32dcdb8637ff88c3b8e8c 100644
--- a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/Root/TPileupReweighting.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/Root/TPileupReweighting.cxx
@@ -21,6 +21,7 @@ Description: Tool to get the calculated MC pileup weight.
 
 // include math
 #include <math.h>
+#include <algorithm>
 
 // ROOT includes
 #include <TROOT.h>
@@ -48,31 +49,24 @@ CP::TPileupReweighting::TPileupReweighting(const char* name) :
    m_countingMode(true),m_unrepresentedDataAction(0),m_isInitialized(false),m_lumiVectorIsLoaded(false),
    m_dataScaleFactorX(1.),m_dataScaleFactorY(1.),
    m_mcScaleFactorX(1.),m_mcScaleFactorY(1.),
-   m_nextPeriodNumber(1),m_ignoreFilePeriods(false),m_metadatatree(0),m_unrepDataTolerance(0.05),m_doGlobalDataWeight(false),m_lumicalcRunNumberOffset(0), m_emptyHistogram(0), m_random3(0), m_ignoreBadChannels(false)
+   m_nextPeriodNumber(1),m_ignoreFilePeriods(false),m_metadatatree(0),m_unrepDataTolerance(0.05),m_doGlobalDataWeight(false),m_lumicalcRunNumberOffset(0), m_emptyHistogram(), m_random3(), m_ignoreBadChannels(false)
 {
-   m_random3 = new TRandom3(0);
+   m_random3.reset( new TRandom3(0) );
    m_random3->SetSeed(1);
 
    //create the global period 
-   m_periods[-1] = new Period(-1,0,9999999,0/* the global default channel*/);
+   m_periodList.emplace_back( -1,0,9999999,0/* the global default channel*/ );
+   m_periods[ -1 ] = &( m_periodList.back() );
 
    //MC12ab merger by default
    //RemapPeriod(195848,195847);
 }
 
-
-
-//=============================================================================
-// Destructor
-//=============================================================================
-CP::TPileupReweighting::~TPileupReweighting() {
-   delete m_random3; 
-}
-
 void CP::TPileupReweighting::RemapPeriod(Int_t periodNumber1, Int_t periodNumber2) {
    //check if periodNumber2 exists
    if(m_periods.find(periodNumber2)==m_periods.end()) {
-      m_periods[periodNumber2] = new Period(periodNumber2,0,0,GetDefaultChannel(-1)/*m_periods[-1]->defaultChannel*/);
+      m_periodList.emplace_back( periodNumber2, 0, 0, GetDefaultChannel(-1) );
+      m_periods[periodNumber2] = &( m_periodList.back() );
    }
    m_periods[periodNumber1] = m_periods[periodNumber2];
 }
@@ -80,7 +74,8 @@ void CP::TPileupReweighting::RemapPeriod(Int_t periodNumber1, Int_t periodNumber
 void CP::TPileupReweighting::SetDefaultChannel(Int_t channel, Int_t periodNumber) {
    //check if periodNumber2 exists
    if(m_periods.find(periodNumber)==m_periods.end()) {
-      m_periods[periodNumber] = new Period(periodNumber,0,0,channel);
+      m_periodList.emplace_back( periodNumber, 0, 0, channel );
+      m_periods[periodNumber] = &( m_periodList.back() );
    } else {
       m_periods[periodNumber]->SetDefaultChannel(channel); 
    }
@@ -88,9 +83,12 @@ void CP::TPileupReweighting::SetDefaultChannel(Int_t channel, Int_t periodNumber
 
 
 Int_t CP::TPileupReweighting::SetBinning(Int_t nbinsx, Double_t* xbins, Int_t nbinsy, Double_t* ybins) {
-   if(m_emptyHistogram) { delete m_emptyHistogram; }
-   if(nbinsy>0) m_emptyHistogram = new TH2D("default","default",nbinsx,xbins,nbinsy,ybins);
-   else m_emptyHistogram = new TH1D("default","default",nbinsx,xbins);
+   if( nbinsy > 0 ) {
+      m_emptyHistogram.reset( new TH2D( "default", "default", nbinsx, xbins,
+                                        nbinsy, ybins ) );
+   } else {
+      m_emptyHistogram.reset( new TH1D( "default", "default", nbinsx, xbins ) );
+   }
    m_emptyHistogram->SetDirectory(0);
    return 0;
 }
@@ -104,8 +102,7 @@ Int_t CP::TPileupReweighting::SetUniformBinning(Int_t nbinsx, Double_t xlow, Dou
 }
 Int_t CP::TPileupReweighting::SetBinning(TH1* hist) {
    if(!hist) return -1;
-   if(m_emptyHistogram) { delete m_emptyHistogram; }
-   m_emptyHistogram = dynamic_cast<TH1*>(hist->Clone("default"));
+   m_emptyHistogram.reset( dynamic_cast< TH1* >( hist->Clone( "default" ) ) );
    if (m_emptyHistogram)
      m_emptyHistogram->SetDirectory(0);
    return 0;
@@ -131,7 +128,7 @@ Double_t CP::TPileupReweighting::GetIntegratedLumi(const TString& trigger) {
       CalculatePrescaledLuminosityHistograms(trigger);
    }
    
-   auto h = m_triggerObjs[trigger]->triggerHists[-1][m_triggerObjs[trigger]->getBits(this)];
+   auto& h = m_triggerObjs[trigger]->triggerHists[-1][m_triggerObjs[trigger]->getBits(this)];
    
    return h->Integral(0,h->GetNbinsX()+1)/1E6;
 }
@@ -308,6 +305,13 @@ Int_t CP::TPileupReweighting::UsePeriodConfig(const TString& configName) {
       }
       SetUniformBinning(100,0,100); //Thanks Eric </sarcasm>
       Info("UsePeriodConfig","Using Run2 Period configuration, which assumes period assignment of 222222 to 999999");
+      return 0;
+   } else if(configName=="MC16") {
+     /* period configs are now assigned through the parent tool for MC16 */
+     
+     SetUniformBinning(100,0,100);
+     Info("UsePeriodConfig","Using MC16 Period configuration");
+     return 0;
    }
    Error("UsePeriodConfig","Unrecognized period config");
    return -1;
@@ -324,7 +328,9 @@ Int_t CP::TPileupReweighting::AddPeriod(Int_t periodNumber, UInt_t start, UInt_t
    }
 
    if(m_periods.find(periodNumber)==m_periods.end()) {
-      m_periods[periodNumber] = new Period(periodNumber,start,end,GetDefaultChannel(-1));
+      m_periodList.emplace_back( periodNumber, start, end,
+                                 GetDefaultChannel( -1 ) );
+      m_periods[periodNumber] = &( m_periodList.back() );
       return periodNumber;
    }
 
@@ -350,13 +356,17 @@ Int_t CP::TPileupReweighting::AddPeriod(Int_t periodNumber, UInt_t start, UInt_t
 
    if(p->subPeriods.size()==0) {
       while(m_periods.find(m_nextPeriodNumber) != m_periods.end()) m_nextPeriodNumber++;
-      m_periods[m_nextPeriodNumber] = new Period(m_nextPeriodNumber,p->start,p->end,p->defaultChannel);
+      m_periodList.emplace_back( m_nextPeriodNumber, p->start, p->end,
+                                 p->defaultChannel );
+      m_periods[m_nextPeriodNumber] = &( m_periodList.back() );
       p->subPeriods.push_back(m_periods[m_nextPeriodNumber]);
       p->start = 0; p->end=0;
    }
 
    while(m_periods.find(m_nextPeriodNumber) != m_periods.end()) m_nextPeriodNumber++;
-   m_periods[m_nextPeriodNumber] = new Period(m_nextPeriodNumber,start,end, p->defaultChannel);
+   m_periodList.emplace_back( m_nextPeriodNumber, start, end,
+                              p->defaultChannel );
+   m_periods[m_nextPeriodNumber] = &( m_periodList.back() );
    p->subPeriods.push_back(m_periods[m_nextPeriodNumber]);
 
    return m_nextPeriodNumber;
@@ -375,7 +385,8 @@ Int_t CP::TPileupReweighting::GetFirstFoundPeriodNumber(UInt_t runNumber) {
 }
 
 
-TH1* CP::TPileupReweighting::CloneEmptyHistogram(Int_t runNumber, Int_t channelNumber) {
+std::unique_ptr< TH1 >
+CP::TPileupReweighting::CloneEmptyHistogram(Int_t runNumber, Int_t channelNumber) {
 
    TString s("pileup");
    if(channelNumber>=0) {
@@ -390,7 +401,7 @@ TH1* CP::TPileupReweighting::CloneEmptyHistogram(Int_t runNumber, Int_t channelN
       throw std::runtime_error("Throwing 47: There is no binning info - use SetBinning/SetUniformBinning or load a prw config file (This usually means you need to call AddConfigFile BEFORE AddLumiCalcFile)");
    }
 
-   TH1* out = dynamic_cast<TH1*>(m_emptyHistogram->Clone(s));
+   std::unique_ptr< TH1 > out( dynamic_cast<TH1*>(m_emptyHistogram->Clone(s)) );
    if (out) {
      out->SetTitle(s);
      out->SetDirectory(0); //take ownership
@@ -462,7 +473,9 @@ Int_t CP::TPileupReweighting::AddMetaDataFile(const TString& fileName,const TStr
             Error("AddMetaDataFile","%s is not a valid metadata file. Should have a ChannelMetaData TTree",fileName.Data());
             throw std::runtime_error("Throwing 7");
          }
+	 rootFile->Close();
       }
+      delete rootFile;
    } else {
       //try to make the TTree by reading the file 
       tmp = new TTree("ChannelMetaData","ChannelMetaData");
@@ -593,7 +606,10 @@ void CP::TPileupReweighting::AddDistributionTree(TTree *tree, TFile *file) {
    bool isMC=true;
    //should have the standard structure 
    Int_t channel = 0; UInt_t runNbr = 0; 
-   std::vector<UInt_t>* pStarts = 0;std::vector<UInt_t>* pEnds = 0;
+   auto pStarts = std::make_unique< std::vector< UInt_t > >();
+   auto pStartsPtr = pStarts.get();
+   auto pEnds = std::make_unique< std::vector< UInt_t > >();
+   auto pEndsPtr = pEnds.get();
    Char_t histName[150];
    Char_t customName[150];
    Bool_t isDefaultForRunNumber(false); bool hasDefaultsBranch=false;
@@ -613,10 +629,10 @@ void CP::TPileupReweighting::AddDistributionTree(TTree *tree, TFile *file) {
       Error("AddDistributionTree","Could not find RunNumber branch in TTree");throw std::runtime_error("Throwing 18");
    }
    if(isMC) {
-      if(tree->SetBranchAddress("PeriodStarts",&pStarts)!=0) {
+      if(tree->SetBranchAddress("PeriodStarts",&pStartsPtr)!=0) {
          Error("AddDistributionTree","Could not find PeriodStarts branch in TTree");throw std::runtime_error("Throwing 18");
       }
-      if(tree->SetBranchAddress("PeriodEnds",&pEnds)!=0) {
+      if(tree->SetBranchAddress("PeriodEnds",&pEndsPtr)!=0) {
          Error("AddDistributionTree","Could not find PeriodEnds branch in TTree");throw std::runtime_error("Throwing 18");
       }
       if(tree->FindBranch("IsDefaultForRunNumber")!=0) {
@@ -636,7 +652,8 @@ void CP::TPileupReweighting::AddDistributionTree(TTree *tree, TFile *file) {
       TString weightName(customName);
       if(loadedHistos.find(sHistName)==loadedHistos.end()) {
          loadedHistos[sHistName]=true;
-         if(!m_ignoreFilePeriods && isMC) {
+         if(( (!m_ignoreFilePeriods) || m_periods.find(runNbr)==m_periods.end()) && isMC) {
+            //if ignoring file periods, will still add the period if it doesnt exist!
             for(unsigned int j=0;j<pStarts->size();j++) {
                unsigned int start = pStarts->at(j);unsigned int end = pEnds->at(j);
                AddPeriod(runNbr,start,end);
@@ -691,27 +708,27 @@ Int_t CP::TPileupReweighting::AddDistribution(TH1* hist,Int_t runNumber, Int_t c
    }
    
 
-   TH1*& inputHist = (channelNumber<0) ? m_runs[runNumber].inputHists["None"] : m_periods[runNumber]->inputHists[channelNumber];
+   auto& inputHist = (channelNumber<0) ? m_runs[runNumber].inputHists["None"] : m_periods[runNumber]->inputHists[channelNumber];
 
    if(!inputHist) {
       //if no emptyHistogram specified, we will use this histogram as the structure for the empty;
       if(!m_emptyHistogram) {
          //check if the input histogram is a TH1D or not. We like TH1D, not yucky TH1F
          if(strcmp(hist->IsA()->GetName(),"TH1D")==0 || strcmp(hist->IsA()->GetName(),"TH2D")==0) {
-            m_emptyHistogram = dynamic_cast<TH1*>(hist->Clone("default"));
+            m_emptyHistogram.reset( dynamic_cast<TH1*>(hist->Clone("default")) );
          } else {
             //check dimensionality
             if(hist->GetDimension()==1) {
                std::vector<Double_t> binsX;
                for(int i=0;i<=hist->GetNbinsX();i++) binsX.push_back(hist->GetXaxis()->GetBinLowEdge(i+1));
                TH1D tmpHist("tmpHist","tmpHist",binsX.size()-1,&binsX[0]);
-               m_emptyHistogram = dynamic_cast<TH1*>(tmpHist.Clone("default"));
+               m_emptyHistogram.reset( dynamic_cast<TH1*>(tmpHist.Clone("default")) );
             } else if(hist->GetDimension()==2) {
                std::vector<Double_t> binsX;std::vector<Double_t> binsY;
                for(int i=0;i<=hist->GetNbinsX();i++) binsX.push_back(hist->GetXaxis()->GetBinLowEdge(i+1));
                for(int i=0;i<=hist->GetNbinsY();i++) binsY.push_back(hist->GetYaxis()->GetBinLowEdge(i+1));
                TH2D tmpHist("tmpHist","tmpHist",binsX.size()-1,&binsX[0],binsY.size()-1,&binsY[0]);
-               m_emptyHistogram = dynamic_cast<TH1*>(tmpHist.Clone("default"));
+               m_emptyHistogram.reset( dynamic_cast<TH1*>(tmpHist.Clone("default")) );
             } else {
                Error("AddDistribution","Unknown input histogram dimensionality: %d",hist->GetDimension());
                throw std::runtime_error("Throwing 98");
@@ -729,6 +746,31 @@ Int_t CP::TPileupReweighting::AddDistribution(TH1* hist,Int_t runNumber, Int_t c
 
    //iterator over bins of histogram, filling the TH1 stored in the data map
    Double_t numEntries = inputHist->GetEntries();
+   
+   std::unique_ptr<TH1> tmpHist;
+   if(channelNumber<0) {
+    m_runs[runNumber].nominalFromHists = true;
+    //for data we will do an interpolation to build the shape and then scale it to the integral ...
+    tmpHist.reset( static_cast<TH1*>(inputHist->Clone("tmpHist")) );
+    tmpHist->Reset();
+    Int_t bin,binx,biny;
+    for(biny=1; biny<=tmpHist->GetNbinsY(); biny++) {
+      for(binx=1; binx<=tmpHist->GetNbinsX(); binx++) {
+         bin = tmpHist->GetBin(binx,biny);
+         Double_t x = tmpHist->GetXaxis()->GetBinCenter(binx)/m_dataScaleFactorX;
+         Double_t y = tmpHist->GetYaxis()->GetBinCenter(biny)/m_dataScaleFactorY;
+         if(tmpHist->GetDimension()==1){
+          tmpHist->SetBinContent(bin, hist->Interpolate(x));
+         } else {
+          tmpHist->SetBinContent(bin, hist->Interpolate(x,y));
+         }
+      }
+    }
+    tmpHist->Scale( hist->Integral() / tmpHist->Integral() );
+    tmpHist->SetEntries( hist->GetEntries() );
+    hist = tmpHist.get();
+   }
+   
    Int_t bin,binx,biny;
    for(biny=1; biny<=hist->GetNbinsY(); biny++) {
       for(binx=1; binx<=hist->GetNbinsX(); binx++) {
@@ -738,7 +780,7 @@ Int_t CP::TPileupReweighting::AddDistribution(TH1* hist,Int_t runNumber, Int_t c
          Double_t y = hist->GetYaxis()->GetBinCenter(biny);
          //shift x,y,z by the MCScaleFactors as appropriate 
          if(channelNumber>=0) {x *= m_mcScaleFactorX; y *= m_mcScaleFactorY;}
-         else { x *= m_dataScaleFactorX; y *= m_dataScaleFactorY; }
+         //data scale factor now dealt with in above interpolation
          Int_t inBin = inputHist->FindFixBin(x,y);
          Double_t inValue = inputHist->GetBinContent(inBin);
          inputHist->SetBinContent(inBin,inValue+value);
@@ -748,6 +790,8 @@ Int_t CP::TPileupReweighting::AddDistribution(TH1* hist,Int_t runNumber, Int_t c
    //also keep track of the number of entries 
    //SetBinContent screws with the entry count, so had to record it before the loops above
    inputHist->SetEntries(numEntries+hist->GetEntries());
+   
+   
    m_countingMode=false;
    return 0;
 
@@ -765,7 +809,7 @@ Int_t CP::TPileupReweighting::AddLumiCalcFile(const TString& fileName, const TSt
    TFile* rootFile = TFile::Open( fileName, "READ" );
    if ( rootFile->IsZombie() ) {
       Error("AddConfigFile","Could not open file: %s",fileName.Data());
-      std::string toThrow = "Throwing 6: Could not open file: "; toThrow += fileName;
+      std::string toThrow = "Throwing 6: Could not open file: "; toThrow += fileName.Data();
       throw std::runtime_error(toThrow);
    } else {
       //try to get the the known TTrees 
@@ -802,7 +846,14 @@ Int_t CP::TPileupReweighting::AddLumiCalcFile(const TString& fileName, const TSt
                if(!m_parentTool->runLbnOK(runNbr,lbn)) continue;
 
                Run& r = m_runs[runNbr];
-               if(trigger=="None") {r.lumiByLbn[lbn].first += intLumi; r.lumiByLbn[lbn].second = mu;}
+               if(trigger=="None") {
+                r.lumiByLbn[lbn].first += intLumi; 
+                r.lumiByLbn[lbn].second = mu;
+                if(r.nominalFromHists) continue; //don't fill runs that we already filled from hists ... only happens for the 'None' trigger
+               }
+               
+               
+               
                //rescale the mu value  ... do this *after* having stored the mu value in the lumiByLbn map
                mu *= m_dataScaleFactorX; 
                //fill into input data histograms 
@@ -819,6 +870,9 @@ Int_t CP::TPileupReweighting::AddLumiCalcFile(const TString& fileName, const TSt
             Info("AddLumiCalcFile","Adding LumiMetaData for DataWeight (trigger=%s) (scale factor=%f)...",trigger.Data(),m_dataScaleFactorX);
          }
          
+      } else {
+        Error("AddLumiCalcFile","No LumiMetaData found in file %s. not a LumiCalcFile?", fileName.Data());
+        throw std::runtime_error("No LumiMetaData found in file, not a LumiCalcFile?");
       }
    }
 
@@ -845,7 +899,7 @@ Int_t CP::TPileupReweighting::AddConfigFile(const TString& fileName) {
    TFile* rootFile = TFile::Open( fileName, "READ" );
    if ( rootFile->IsZombie() ) {
       Error("AddConfigFile","Could not open file: %s",fileName.Data());
-      std::string toThrow = "Throwing 6: Could not open file: "; toThrow += fileName;
+      std::string toThrow = "Throwing 6: Could not open file: "; toThrow += fileName.Data();
       throw std::runtime_error(toThrow);
    } else {
       //try to get the the known TTrees 
@@ -908,7 +962,6 @@ Bool_t CP::TPileupReweighting::RemoveChannel(int chanNum) {
          if(itr->first!=chanNum) ++itr;
          else {
             found=true;
-            if(itr->second) delete itr->second; //delete the hist 
             itr = period.second->inputHists.erase(itr);
          }
       }
@@ -952,11 +1005,13 @@ Int_t CP::TPileupReweighting::Initialize() {
 
    //find all channels that have too much unrepresented data (more than tolerance). We will remove these channels entirely 
 
+   std::map<int,std::map<int,bool>> trackWarnings; //map used to avoid reprinting warnings as loop over histogram bins
+
    double totalData(0);
    //count up the unrepresented data, indexed by channel 
    for(auto& run : m_runs) {
       if(run.second.inputHists.find("None") == run.second.inputHists.end()) continue;
-      TH1* hist = run.second.inputHists["None"];
+      TH1* hist = run.second.inputHists["None"].get();
       Int_t bin,binx,biny;
       for(biny=1; biny<=hist->GetNbinsY(); biny++) {
          for(binx=1; binx<=hist->GetNbinsX(); binx++) {
@@ -968,17 +1023,27 @@ Int_t CP::TPileupReweighting::Initialize() {
             std::map<Int_t, bool> doneChannels;
             for(auto& period : m_periods) {
                if(period.first != period.second->id) continue; //skip remappings
+	       if(period.first == -1) continue; //don't look at the global period when calculating unrepresented data
                if(!period.second->contains(run.first)) continue;
-               for(auto& inHist : period.second->inputHists) {
+               for(auto& inHist : m_periods[-1]->inputHists) { //use global period to iterate over channels
                   if(inHist.first<0) continue; //skips any data hists (shouldn't happen really)
-                  if((inHist.second)->GetBinContent(bin)==0) { 
-                     period.second->unrepData[inHist.first] += value;  //store unrep data by period too, because will use in GetUnrepresentedFraction 
-                     if(!isUnrep) {isUnrep=true; unrepDataByChannel[-1] += value;}    //store total unrep data... must be sure not to double count across the channels (if multiple channels have same unrep data
-                  }
-                  if(doneChannels[inHist.first]) continue; //dont doublecount the data if the channel was to blame across multiple periods
-                  if((inHist.second)->GetBinContent(bin)==0) {unrepDataByChannel[inHist.first] += value;doneChannels[inHist.first]=true;  }
+		  if(doneChannels[inHist.first]) continue; //dont doublecount the data if the channel was to blame across multiple period
+		  if(period.second->inputHists.find(inHist.first)==period.second->inputHists.end()) {
+		    //all the data is missing ..
+		    isUnrep=true;doneChannels[inHist.first]=true;
+		    unrepDataByChannel[inHist.first] += value; 
+		    if(!trackWarnings[inHist.first][period.first]) {
+		      trackWarnings[inHist.first][period.first]=true;
+		      Warning("Initialize","Channel %d has no configuration for period %d -- this is symptomatic of you trying to reweight an MC campaign to data not intended for that campaign (e.g. MC16a with 2017 data)",inHist.first,period.first);
+		    }
+		  } else if(period.second->inputHists[inHist.first]->GetBinContent(bin)==0) {
+		    //hist for this channel in this period exists, but this bin is empty 
+		    isUnrep=true;doneChannels[inHist.first]=true;
+		    unrepDataByChannel[inHist.first] += value; 
+		  }
                }
             }
+	    if(isUnrep) unrepDataByChannel[-1] += value; //store total unrep data
          }
       }
    }
@@ -1007,7 +1072,7 @@ Int_t CP::TPileupReweighting::Initialize() {
          unrepDataByChannel[-1] = 0;
          for(auto& run : m_runs) {
             if(run.second.inputHists.find("None") == run.second.inputHists.end()) continue;
-            TH1* hist = run.second.inputHists["None"];
+            TH1* hist = run.second.inputHists["None"].get();
             Int_t bin,binx,biny;
             for(biny=1; biny<=hist->GetNbinsY(); biny++) {
                for(binx=1; binx<=hist->GetNbinsX(); binx++) {
@@ -1034,18 +1099,18 @@ Int_t CP::TPileupReweighting::Initialize() {
 
 
    //need a CompositeTrigger to hold the unprescaled lumi hists ...
-   m_triggerObjs["None"] = new CompositeTrigger;
+   m_triggerObjs["None"] = std::make_unique< CompositeTrigger >();
 
    //go through all periods, use inputHists to populate the primary and secondary dists, and fill sumOfWeights and numberOfEntries
    for(auto period : m_periods) {
       if(period.first != period.second->id) continue; //skips remappings 
       for(auto& inputHist : period.second->inputHists) {
          int channel = inputHist.first;
-         TH1* hist = inputHist.second;
+         TH1* hist = inputHist.second.get();
          period.second->sumOfWeights[channel] += hist->GetSumOfWeights();
          period.second->numberOfEntries[channel] += hist->GetEntries();
          if(hist->GetDimension()==1) {
-            period.second->primaryHists[channel] = dynamic_cast<TH1D*>(CloneEmptyHistogram(period.first,channel));
+            period.second->primaryHists[channel] = CloneEmptyHistogram(period.first,channel);
             period.second->primaryHists[channel]->Add(hist);
          }
       }
@@ -1055,7 +1120,7 @@ Int_t CP::TPileupReweighting::Initialize() {
          if(run.second.inputHists.find("None") == run.second.inputHists.end()) continue;
          //add to list of runNumbers for this period 
          period.second->runNumbers.push_back(run.first);
-         TH1* hist = run.second.inputHists["None"];
+         TH1* hist = run.second.inputHists["None"].get();
 
          //sweep over bins, checking for unrepresented data and acting accordingly 
          Int_t bin,binx,biny;
@@ -1101,22 +1166,41 @@ Int_t CP::TPileupReweighting::Initialize() {
                 }
             }
          }
+         
+         //ensure hist is normalized correctly, if was read in from the 'actual mu' config files (where the normalization can be slightly wrong)
+         if(run.second.nominalFromHists) {
+          //get the total lumi for the run ...
+          double totLumi(0);
+          for(auto lb : run.second.lumiByLbn) {
+            totLumi += lb.second.first; 
+          }
+          hist->Scale( totLumi / hist->Integral() );
+          
+         }
+         
          //create the period's 'data' hist if necessary 
          if( hist->GetDimension()==1 ) {
               if(!period.second->primaryHists[-1] )  {
-                  period.second->primaryHists[-1] = dynamic_cast<TH1D*>(CloneEmptyHistogram(period.first,-1));
+                  period.second->primaryHists[-1] = CloneEmptyHistogram(period.first,-1);
                   //period.second->triggerHists["None"] = dynamic_cast<TH1D*>(CloneEmptyHistogram(period.first,-1)); //this will remain unnormalized, unlike the 'primaryHist'
-                  m_triggerObjs["None"]->triggerHists[period.second->id][0] = dynamic_cast<TH1D*>(CloneEmptyHistogram(period.first,-1)); //this will remain unnormalized, unlike the 'primaryHist'
+                  
+                  //this will remain unnormalized, unlike the 'primaryHist'
+                  m_triggerObjs["None"]->triggerHists[period.second->id][0] =
+                     CloneEmptyHistogram( period. first, -1 );
                }
          }
          else if( hist->GetDimension()==2 ) {
             if(!period.second->secondaryHists[-1] ) {
-               period.second->secondaryHists[-1] =  dynamic_cast<TH2D*>(CloneEmptyHistogram(period.first,-1));
-               period.second->primaryHists[-1] = period.second->secondaryHists[-1]->ProjectionX(); period.second->primaryHists[-1]->SetDirectory(0);
+               auto h = CloneEmptyHistogram(period.first,-1);
+               period.second->secondaryHists[-1].reset( dynamic_cast< TH2* >( h.release() ) );
+               period.second->primaryHists[-1].reset(
+                  period.second->secondaryHists[-1]->ProjectionX() );
+               period.second->primaryHists[-1]->SetDirectory(0);
                period.second->primaryHists[-1]->Reset();
                //period.second->triggerHists["None"] = static_cast<TH1D*>(period.second->primaryHists[-1]->Clone("triggerHist"));
                //period.second->triggerHists["None"]->SetDirectory(0);
-               m_triggerObjs["None"]->triggerHists[period.second->id][0] = static_cast<TH1D*>(period.second->primaryHists[-1]->Clone("triggerHist"));
+               m_triggerObjs["None"]->triggerHists[period.second->id][0].reset(
+                  static_cast<TH1*>(period.second->primaryHists[-1]->Clone("triggerHist")) );
                m_triggerObjs["None"]->triggerHists[period.second->id][0]->SetDirectory(0);
             }
             
@@ -1133,7 +1217,7 @@ Int_t CP::TPileupReweighting::Initialize() {
    double ignoredData(0);
    for(auto& run : m_runs) {
       bool covered(false);
-      TH1* hist = run.second.inputHists["None"];
+      TH1* hist = run.second.inputHists["None"].get();
       for(auto& period : m_periods) {
          if(!period.second->contains(run.first)) continue;
          if(period.first!=-1) covered=true; //don't count the global period
@@ -1197,14 +1281,11 @@ Int_t CP::TPileupReweighting::Initialize() {
    //now that all the distributions are built. Normalize them all 
    for(auto period : m_periods) {
       if(period.first != period.second->id) continue;
-      for(auto pHist : period.second->primaryHists) {
-         normalizeHistogram(pHist.second);
-      }
-      for(auto pHist : period.second->secondaryHists) {
-         normalizeHistogram(pHist.second);
+      for(auto& pHist : period.second->primaryHists) {
+         normalizeHistogram(pHist.second.get());
       }
-      for(auto pHist : period.second->inputHists) {
-         delete pHist.second;
+      for(auto& pHist : period.second->secondaryHists) {
+         normalizeHistogram(pHist.second.get());
       }
       period.second->inputHists.clear();
    }
@@ -1288,8 +1369,8 @@ UInt_t CP::TPileupReweighting::GetRandomRunNumber(Int_t periodNumber) {
    if(m_countingMode) { return 0; } //do nothing when in counting mode
 
    Period* p = m_periods[periodNumber];
-   if(!p) {
-      Error("GetRandomRunNumber","Unrecognised periodNumber: %d",periodNumber);
+   if(!p || !p->primaryHists[-1]) {
+      Error("GetRandomRunNumber","Unrecognised periodNumber or no data loaded for: %d",periodNumber);
       throw std::runtime_error("Throwing 1: Unrecognised periodNumber");
    }
 
@@ -1311,8 +1392,8 @@ UInt_t CP::TPileupReweighting::GetRandomRunNumber(Int_t periodNumber, Double_t x
    if(m_countingMode) { return 0; } //do nothing when in counting mode
 
    Period* p = m_periods[periodNumber];
-   if(!p) {
-      Error("GetRandomRunNumber","Unrecognised periodNumber: %d",periodNumber);
+   if(!p || !p->primaryHists[-1]) {
+      Error("GetRandomRunNumber","Unrecognised periodNumber or no data loaded for: %d",periodNumber);
       throw std::runtime_error("Throwing 1: Unrecognised periodNumber");
    }
 
@@ -1346,7 +1427,7 @@ UInt_t CP::TPileupReweighting::GetRandomLumiBlockNumber(UInt_t runNumber) {
       lumisum += lbn.second.first;
       if(lumisum >= lumi) return lbn.first;
    }
-   Error("GetRandomLumiBlockNumber","overran integrated luminosity for RunNumber=%d",runNumber);
+   Error("GetRandomLumiBlockNumber","overran integrated luminosity for RunNumber=%d (%f vs %f)",runNumber,lumi,lumisum);
    throw std::runtime_error("Throwing 46: overran integrated luminosity for runNumber");
    return 0;
 }
@@ -1389,7 +1470,7 @@ Bool_t CP::TPileupReweighting::IsUnrepresentedData(Int_t runNumber, Float_t x, F
 //this method builds a file get can be friended to a TTree with a prw-hash branch
 Bool_t CP::TPileupReweighting::MakeWeightTree(TString channelNumbers, TString outFile, TString hashBranch, TString weightBranch) {
    if(!m_isInitialized) { Info("MakeWeightTree","Initializing the subtool.."); Initialize(); }
-   TH1* hist = m_emptyHistogram;
+   TH1* hist = m_emptyHistogram.get();
    if(!hist) {
       Error("MakeWeightTree","Tool not configured properly ... please report this!");
       throw std::runtime_error("Throwing 47: Tool not configured properly ... please report this!");
@@ -1438,7 +1519,7 @@ Bool_t CP::TPileupReweighting::MakeWeightTree(TString channelNumbers, TString ou
 
 ULong64_t CP::TPileupReweighting::GetPRWHash(Int_t periodNumber, Int_t channelNumber, Float_t x, Float_t y) {
    if(!m_isInitialized) { Info("GetPRWHash","Initializing the subtool.."); Initialize(); }
-   TH1* hist = m_emptyHistogram;
+   TH1* hist = m_emptyHistogram.get();
    if(!hist) {
       Error("GetPRWHash","Tool not configured properly ... please report this!");
       throw std::runtime_error("Throwing 47: Tool not configured properly ... please report this!");
@@ -1460,7 +1541,7 @@ Float_t CP::TPileupReweighting::GetCombinedWeight(Int_t periodNumber, Int_t chan
       throw std::runtime_error("Throwing 2: You cannot get a weight when in config file generating mode. Please use FillWeight method");
    }
    //decide how many dimensions this weight has - use the emptyHistogram to tell... 
-   TH1* hist = m_emptyHistogram;
+   TH1* hist = m_emptyHistogram.get();
    if(!hist) {
       Error("GetCombinedWeight","Tool not configured properly ... please report this!");
       throw std::runtime_error("Throwing 47: Tool not configured properly ... please report this!");
@@ -1482,7 +1563,13 @@ Float_t CP::TPileupReweighting::GetPeriodWeight(Int_t periodNumber, Int_t channe
       Error("GetPeriodWeight","Unrecognised periodNumber: %d",periodNumber);
       throw std::runtime_error("Throwing 1: Unrecognised periodNumber");
    }
-   if(p->sumOfWeights.find(channelNumber) == p->sumOfWeights.end()) channelNumber = GetDefaultChannel(periodNumber);//p->defaultChannel;
+   if(p->sumOfWeights.find(channelNumber) == p->sumOfWeights.end()) {
+    channelNumber = GetDefaultChannel(periodNumber);//p->defaultChannel;
+    if(channelNumber!=0) {
+      Warning("GetPeriodWeight","You're using a default config file ... you're gonna have a bad time!!");
+      Warning("GetPeriodWeight","Please generate proper config files!");
+    }
+   }
 
    double n_a = p->sumOfWeights[channelNumber];
    double n = m_periods[-1]->sumOfWeights[channelNumber];
@@ -1507,7 +1594,7 @@ Float_t CP::TPileupReweighting::GetPrimaryWeight(Int_t periodNumber, Int_t chann
    if(p->sumOfWeights.find(channelNumber) == p->sumOfWeights.end()) channelNumber = GetDefaultChannel(periodNumber);//p->defaultChannel;
 
    if(!p->primaryHists[channelNumber]) {
-      Error("GetPrimaryWeight","Unrecognised channelNumber: %d",oChanNumber);
+      Error("GetPrimaryWeight","Unrecognised channelNumber %d for periodNumber %d",oChanNumber,periodNumber);
       throw std::runtime_error("Throwing 2: Unrecognised channelNumber");
    }
 
@@ -1515,6 +1602,14 @@ Float_t CP::TPileupReweighting::GetPrimaryWeight(Int_t periodNumber, Int_t chann
 
    double n = p->primaryHists[channelNumber]->GetBinContent(bin);
 
+   // There is a special case  that needs some additional protection
+   // If you have the sum of weights ==0 for a given mu then you will have 0 in the PRW 
+   // profile leading to an exception or FPE later
+   if (n==0){
+      Warning("GetPrimaryWeight","No events expected in channelNumber %d for periodNumber %d with x=%g.  Incorrect PRW profile or are you very unlucky???",channelNumber,periodNumber,x);
+      return 1.;
+   }
+
    if(!p->primaryHists[-1]) {
       Error("GetPrimaryWeight","No data loaded for period %d. Did you forget to load a lumicalc file or data config file?",periodNumber);
       throw std::runtime_error("Throwing 3: No data loaded. Did you forget to load a lumicalc file or data config file?");
@@ -1522,6 +1617,11 @@ Float_t CP::TPileupReweighting::GetPrimaryWeight(Int_t periodNumber, Int_t chann
 
    double l = p->primaryHists[-1]->GetBinContent(bin);
 
+   if (l==0 && n==0){
+      Error("GetPrimaryWeight","No events expected with this mu.  Incorrect PRW profile?  Throwing exception ...");
+      throw std::runtime_error(Form("Incorrect PRW profile detected. x=%g is not in the config file profile for channel %d, period %d", x, channelNumber, periodNumber ));
+   }
+
    return l/n;
 }
 
@@ -1551,7 +1651,7 @@ Double_t CP::TPileupReweighting::GetDataWeight(Int_t runNumber, const TString& t
    return out;
 }
 
-Double_t CP::TPileupReweighting::GetDataWeight(Int_t runNumber, const TString& trigger, Double_t x) {
+Double_t CP::TPileupReweighting::GetDataWeight(Int_t runNumber, const TString& trigger, Double_t x, bool runDependent) {
 
    if(!m_isInitialized) { Info("GetDataWeight","Initializing the subtool.."); Initialize(); }
    if(m_countingMode) return 0.;
@@ -1575,13 +1675,14 @@ Double_t CP::TPileupReweighting::GetDataWeight(Int_t runNumber, const TString& t
    if(tobj==m_triggerObjs.end()) {
       //try to do a subtrigger calculation we need to reopen all the lumicalc files and do the fiddily prescaled luminosity calculation
       //will throw errors if can't
-      CalculatePrescaledLuminosityHistograms(trigger);
+      CalculatePrescaledLuminosityHistograms(trigger,0);
       tobj = m_triggerObjs.find(trigger);
    }
    
    //check 
 
    
+   
    if(tobj->second->triggerHists.find(p->id) == tobj->second->triggerHists.end()) {
     Error("GetDataWeight","Could not find trigger %s in period %d",trigger.Data(),p->id);
     throw std::runtime_error("GetDataWeight: Could not find trigger 1");
@@ -1593,32 +1694,39 @@ Double_t CP::TPileupReweighting::GetDataWeight(Int_t runNumber, const TString& t
    
    if(tbits==0) return 1; //no trigger passed
    
-   auto dItr = tobj->second->triggerHists[p->id].find(tbits);
+   int idx = (runDependent) ? -runNumber : p->id;
+   
    
-   TH1D* denomHist = 0;
-   if(dItr == tobj->second->triggerHists[p->id].end()) {
+   auto dItr = tobj->second->triggerHists[idx].find(tbits);
+   
+   TH1* denomHist = 0;
+   if(dItr == tobj->second->triggerHists[idx].end()) {
       //possible that the tbits for this event have not been encountered before, so just redo the calculation ...
-      calculateHistograms(tobj->second);
+      calculateHistograms(tobj->second.get(),(runDependent) ? runNumber:0);
    
-      denomHist = tobj->second->triggerHists[p->id][tbits];
+      denomHist = tobj->second->triggerHists[idx][tbits].get();
       if(denomHist==0) {
-        Error("GetDataWeight","Could not find trigger %s in period %d with bits %ld",trigger.Data(),p->id, tbits);
+        Error("GetDataWeight","Could not find trigger %s in period %d with bits %ld",trigger.Data(),idx, tbits);
         throw std::runtime_error("GetDataWeight: Could not find trigger 2");
       }
    } else {
-    denomHist = dItr->second;
+      denomHist = dItr->second.get();
    }
 
    
-   TH1D* numerHist = m_triggerObjs["None"]->triggerHists[p->id][0];
+   TH1* numerHist = m_triggerObjs["None"]->triggerHists[idx][0].get();
    if(numerHist==0) {
-      Error("GetDataWeight","Could not find unprescaled trigger in period %d",p->id);
+      Error("GetDataWeight","Could not find unprescaled trigger in period %d",idx);
       throw std::runtime_error("GetDataWeight: Could not find unprescaled trigger. Please AddLumiCalc with a 'None' trigger");
    }
    
    if(m_doGlobalDataWeight) return numerHist->Integral(0,numerHist->GetNbinsX()+1)/denomHist->Integral(0,denomHist->GetNbinsX()+1);
 
-   Int_t bin=numerHist->FindFixBin(x*m_dataScaleFactorX); //MUST SCALE BY THE DATA SCALE FACTOR!
+   Int_t bin=(m_doPrescaleWeight) ? numerHist->FindFixBin(x) : //DO NOT SHIFT IF GETTING A PRESCALE WEIGHT - applied to MC, we only shift incoming mu if we are data
+     numerHist->FindFixBin(x*m_dataScaleFactorX); //if getting a data weight (i.e. running on data) MUST SCALE BY THE DATA SCALE FACTOR! (assume incoming is raw unscaled)
+   
+   //we also need to redirect the binning if necessary (unrepData=3)
+   if( (!m_doPrescaleWeight) && m_unrepresentedDataAction==3) bin = p->inputBinRedirect[bin];
    
    if(!denomHist->GetBinContent(bin)) {
      if(m_doPrescaleWeight) return -1; //happens if trigger was disabled/unavailable for that mu, even though that mu is in the dataset
@@ -1638,10 +1746,10 @@ Double_t CP::TPileupReweighting::GetPrescaleWeight(Int_t runNumber, const TStrin
    return out;
 }
 
-Double_t CP::TPileupReweighting::GetPrescaleWeight(Int_t runNumber, const TString& trigger, Double_t x) {
+Double_t CP::TPileupReweighting::GetPrescaleWeight(Int_t runNumber, const TString& trigger, Double_t x, bool runDependent) {
 
   m_doPrescaleWeight = true;
-  double out = GetDataWeight(runNumber,trigger,x);
+  double out = GetDataWeight(runNumber,trigger,x,runDependent);
   m_doPrescaleWeight = false;
   if(out<=0) return 0; //happens when triggers disabled/unavailable for a given mu ... therefore the prescale weight is 0
   return 1./out;
@@ -1677,11 +1785,11 @@ Int_t CP::TPileupReweighting::Fill(Int_t runNumber,Int_t channelNumber,Float_t w
          //need to create my period histogram 
          p->inputHists[channelNumber] = CloneEmptyHistogram(runNumber,channelNumber);
       }
-      hist = p->inputHists[channelNumber];
+      hist = p->inputHists[channelNumber].get();
    } else {
       Run& r = m_runs[runNumber];
-      if(r.inputHists["None"]==0) r.inputHists["None"]=CloneEmptyHistogram(runNumber,channelNumber);
-      hist = r.inputHists["None"];
+      if( ! r.inputHists["None"]) r.inputHists["None"]=CloneEmptyHistogram(runNumber,channelNumber);
+      hist = r.inputHists["None"].get();
    }
 
    if(!hist) {
@@ -1723,10 +1831,13 @@ Int_t CP::TPileupReweighting::WriteToFile(TFile* outFile) {
 
    outFile->cd();
 
-   TTree *outTreeMC=0;
-   TTree *outTreeData=0;
-   Int_t channel = 0;UInt_t runNumber = 0; 
-   std::vector<UInt_t>* pStarts = 0;std::vector<UInt_t>* pEnds = 0;
+   std::unique_ptr< TTree > outTreeMC;
+   std::unique_ptr< TTree > outTreeData;
+   Int_t channel = 0; UInt_t runNumber = 0; 
+   auto pStarts = std::make_unique< std::vector< UInt_t > >();
+   auto pStartsPtr = pStarts.get();
+   auto pEnds = std::make_unique< std::vector< UInt_t > >();
+   auto pEndsPtr = pEnds.get();
    Char_t histName[150];
 
 
@@ -1735,7 +1846,8 @@ Int_t CP::TPileupReweighting::WriteToFile(TFile* outFile) {
       if(period.first != period.second->id) continue; //skips redirects 
       if(period.first<0) continue; //avoid the global run number
       runNumber = period.first;
-      pStarts = new std::vector<UInt_t>;pEnds = new std::vector<UInt_t>;
+      pStarts->clear();
+      pEnds->clear();
       if(period.second->subPeriods.size()==0) { 
          pStarts->push_back(period.second->start); pEnds->push_back(period.second->end); 
       }
@@ -1744,23 +1856,22 @@ Int_t CP::TPileupReweighting::WriteToFile(TFile* outFile) {
             pStarts->push_back(subp->start); pEnds->push_back(subp->end);
          }
       }
-      for(auto inHist : period.second->inputHists) {
+      for(auto& inHist : period.second->inputHists) {
          channel = inHist.first;
-         TH1* hist = inHist.second;
+         TH1* hist = inHist.second.get();
          strncpy(histName,hist->GetName(),sizeof(histName)-1);
          hist->Write();
 
          if(!outTreeMC) {
-            outTreeMC = new TTree("MCPileupReweighting","MCPileupReweighting");
+            outTreeMC.reset( new TTree("MCPileupReweighting","MCPileupReweighting") );
             outTreeMC->Branch("Channel",&channel);
             outTreeMC->Branch("RunNumber",&runNumber);
-            outTreeMC->Branch("PeriodStarts",&pStarts);
-            outTreeMC->Branch("PeriodEnds",&pEnds);
+            outTreeMC->Branch("PeriodStarts",&pStartsPtr);
+            outTreeMC->Branch("PeriodEnds",&pEndsPtr);
             outTreeMC->Branch("HistName",&histName,"HistName/C");
          }
          outTreeMC->Fill();
       }
-      delete pStarts; delete pEnds;
    }
 
    //loop over data 
@@ -1768,11 +1879,11 @@ Int_t CP::TPileupReweighting::WriteToFile(TFile* outFile) {
       runNumber = run.first;
       if(run.second.inputHists.find("None")==run.second.inputHists.end()) continue;
 
-      TH1* hist = run.second.inputHists["None"];
+      TH1* hist = run.second.inputHists["None"].get();
       strncpy(histName,hist->GetName(),sizeof(histName)-1);
       hist->Write();
       if(!outTreeData) {
-         outTreeData = new TTree("DataPileupReweighting","DataPileupReweighting");
+         outTreeData.reset( new TTree("DataPileupReweighting","DataPileupReweighting") );
          outTreeData->Branch("RunNumber",&runNumber);
          outTreeData->Branch("HistName",&histName,"HistName/C");
       }
@@ -1781,9 +1892,12 @@ Int_t CP::TPileupReweighting::WriteToFile(TFile* outFile) {
 
 
    //write the non-zero ttrees 
-   if(outTreeMC) {outTreeMC->Write();delete outTreeMC;outTreeMC=0;}
-   if(outTreeData) {outTreeData->Write();delete outTreeData;outTreeData=0;}
-
+   if( outTreeMC ) {
+      outTreeMC->Write();
+   }
+   if( outTreeData ) {
+      outTreeData->Write();
+   }
 
    Info("WriteToFile", "Successfully generated config file: %s",outFile->GetName());
    Info("WriteToFile", "Happy Reweighting :-)");
@@ -1815,7 +1929,7 @@ void CP::TPileupReweighting::normalizeHistogram(TH1* hist){
                   bin = hist->GetBin(binx,biny,binz);
                   Double_t value = hist->GetBinContent(bin);
                   Double_t normalizer = proj->GetBinContent(binx);
-                  if(fabs(normalizer)>0.00001) {
+                  if(normalizer!=0.0) {
                      hist->SetBinContent(bin,value/normalizer);
                   } else {
                      skipNorm=true;
@@ -1827,7 +1941,7 @@ void CP::TPileupReweighting::normalizeHistogram(TH1* hist){
          if(skipNorm && m_debugging) Warning("normalizeHistogram","Skipped normalization in hist %s",hist->GetName());
       } else {
          //normalize to the sum of weights 
-         if(fabs(hist->GetSumOfWeights())>0.00001) {
+         if(hist->GetSumOfWeights()!=0.0) {
             hist->Scale(1.0/hist->GetSumOfWeights());
          } else {
             if (m_debugging) Warning("normalizeHistogram","Skipping Normalizing histogram %s to ~zero: %f",hist->GetName(),hist->GetSumOfWeights());
@@ -1861,21 +1975,23 @@ Int_t CP::TPileupReweighting::Merge(TCollection *coll) {
          if(period.first != period.second->id) continue;
          for(auto& iHist : period.second->inputHists) {
             if(GetInputHistogram(period.first,iHist.first)==0) {
-               m_periods[period.first]->inputHists[iHist.first] = dynamic_cast<TH1*>(iHist.second->Clone(iHist.second->GetName()));
+               m_periods[period.first]->inputHists[iHist.first].reset(
+                  dynamic_cast<TH1*>(iHist.second->Clone(iHist.second->GetName())) );
                m_periods[period.first]->inputHists[iHist.first]->SetDirectory(0);
             } else {
-               GetInputHistogram(period.first,iHist.first)->Add(iHist.second);
+               GetInputHistogram(period.first,iHist.first)->Add(iHist.second.get());
             }
          }
       }
       //also must remember to merge the runs too (where the data is held)
       for(auto& run : vobj->m_runs) {
          for(auto& iHist : run.second.inputHists) {
-            if(m_runs[run.first].inputHists[iHist.first]==0) {
-               m_runs[run.first].inputHists[iHist.first] = dynamic_cast<TH1*>(iHist.second->Clone(iHist.second->GetName()));
+            if( ! m_runs[run.first].inputHists[iHist.first] ) {
+               m_runs[run.first].inputHists[iHist.first].reset(
+                  dynamic_cast<TH1*>( iHist.second->Clone(iHist.second->GetName())) );
                m_runs[run.first].inputHists[iHist.first]->SetDirectory(0);
             } else {
-               m_runs[run.first].inputHists[iHist.first]->Add(iHist.second);
+               m_runs[run.first].inputHists[iHist.first]->Add(iHist.second.get());
             }
          }
       }
@@ -1885,12 +2001,12 @@ Int_t CP::TPileupReweighting::Merge(TCollection *coll) {
 }
 
 
-void CP::TPileupReweighting::CalculatePrescaledLuminosityHistograms(const TString& trigger) {
+void CP::TPileupReweighting::CalculatePrescaledLuminosityHistograms(const TString& trigger, int runDependentRun) {
    //check if this is a composite trigger (user has provided OR of triggers that are passed before prescale)
    
    TString triggerCopy = trigger; triggerCopy.ReplaceAll(" ",""); triggerCopy.ReplaceAll("&&","&");triggerCopy.ReplaceAll("||","|");
-   CompositeTrigger* t = makeTrigger(triggerCopy);
-   if(t==0) {
+   auto t = makeTrigger(triggerCopy);
+   if( ! t ) {
       Error("GetDataWeight","Error parsing composite trigger set: %s",trigger.Data());
       throw std::runtime_error("Could not parse composite trigger");
    }
@@ -1901,14 +2017,19 @@ void CP::TPileupReweighting::CalculatePrescaledLuminosityHistograms(const TStrin
 
    t->subTriggers = subTriggers; //cache the vector of triggers
    
-   calculateHistograms(t);
+   calculateHistograms(t.get(),runDependentRun);
    
    //save trigger object
-   m_triggerObjs[trigger] = t;
+   m_triggerObjs[trigger] = std::move( t );
 
 }
 
-void CP::TPileupReweighting::calculateHistograms(CompositeTrigger* t) {
+void CP::TPileupReweighting::calculateHistograms(CompositeTrigger* t, int runDependentRun) {
+  TH1* unprescaledLumi = 0;
+  if(runDependentRun) {
+     unprescaledLumi = m_triggerObjs["None"]->triggerHists[-runDependentRun][0].get();
+  }
+  bool fillUnprescaledLumi = (unprescaledLumi==0); //only fill the unprescaled histogram once ... so if it already exists, it must have already been filled
 
    //now we need the trigger bits for this trigger for this event
    long tbits = t->getBits(this);
@@ -1925,10 +2046,14 @@ void CP::TPileupReweighting::calculateHistograms(CompositeTrigger* t) {
    for(std::vector<TString>::iterator it = t->subTriggers.begin();it!=t->subTriggers.end();++it) {
       //Info("aa","subtrigger %s Int lumi is %f", it->Data(), m_triggerPrimaryDistributions[*it][1]->Integral());
       for(auto& fileName : m_lumicalcFiles[*it]) {
+        //if the file is also in the "None" list, then we will now the prescale must be 0 
+        //it seems that in these no-trigger files used for unprescaled lumi the prescales are all set to -1 
+        bool isUnprescaled = (std::find(m_lumicalcFiles["None"].begin(),m_lumicalcFiles["None"].end(),fileName)!=m_lumicalcFiles["None"].end());
+      
         TFile* rootFile = TFile::Open( fileName, "READ" );
         if ( rootFile->IsZombie() ) {
           Error("CalculatePrescaledLuminosityHistograms","Could not open file: %s",fileName.Data());
-          std::string toThrow = "Throwing 6: Could not open file: "; toThrow += fileName;
+          std::string toThrow = "Throwing 6: Could not open file: "; toThrow += fileName.Data();
           throw std::runtime_error(toThrow);
         } else {
           //try to get the the known TTrees 
@@ -1956,13 +2081,17 @@ void CP::TPileupReweighting::calculateHistograms(CompositeTrigger* t) {
               for(long i=0;i<nEntries;i++) {
                 b_runNbr->GetEntry(i);b_L1Presc->GetEntry(i);b_L2Presc->GetEntry(i);b_L3Presc->GetEntry(i);b_lbn->GetEntry(i);
                 runNbr += m_lumicalcRunNumberOffset;
+                if(runDependentRun && int(runNbr)!=runDependentRun) continue; //only use the given run with doing calculation run-dependently
                 //save the prescale by run and lbn 
                 //if(runNbr==215643) 
                 if(m_debugging) Info("...","prescale in [%d,%d] = %f %f %f", runNbr,lbn,ps1,ps2,ps3);
                 if(ps1>0&&ps2>0&&ps3>0) prescaleByRunAndLbn[*it][runNbr][lbn] = ps1*ps2*ps3;
+                else if(isUnprescaled) prescaleByRunAndLbn[*it][runNbr][lbn] = 1; //special case where the trigger is an unprescaled one and user is reusing the unprescaled lumicalc
               }
           }
+	  rootFile->Close();
         }
+	delete rootFile;
        } //end of loop over lumicalc files for this trigger
    }
 
@@ -1971,7 +2100,7 @@ void CP::TPileupReweighting::calculateHistograms(CompositeTrigger* t) {
     TFile* rootFile = TFile::Open( fileName, "READ" );
     if ( rootFile->IsZombie() ) {
         Error("CalculatePrescaledLuminosityHistograms","Could not open file: %s",fileName.Data());
-        std::string toThrow = "Throwing 6: Could not open file: "; toThrow += fileName;
+        std::string toThrow = "Throwing 6: Could not open file: "; toThrow += fileName.Data();
         throw std::runtime_error(toThrow);
     } else {
         //try to get the the known TTrees 
@@ -2000,6 +2129,7 @@ void CP::TPileupReweighting::calculateHistograms(CompositeTrigger* t) {
               b_lbn->GetEntry(i);
   
               runNbr += m_lumicalcRunNumberOffset;
+              if(runDependentRun && int(runNbr)!=runDependentRun) continue; //only use the given run with doing calculation run-dependently
               //for each subtrigger, lookup prescale, and calculate pFactor 
   /*
               double pFactor(1);
@@ -2010,7 +2140,7 @@ void CP::TPileupReweighting::calculateHistograms(CompositeTrigger* t) {
               }
               pFactor = 1. - pFactor;
   */
-
+              
               double pFactor = t->eval(prescaleByRunAndLbn,runNbr,lbn,this);
   
               //Info("...","prescale in [%d,%d] = %f", runNbr,lbn,1./pFactor);
@@ -2018,25 +2148,42 @@ void CP::TPileupReweighting::calculateHistograms(CompositeTrigger* t) {
               int bin = m_emptyHistogram->FindFixBin(mu*m_dataScaleFactorX);
   
               //add into all periods that contain this runNbr 
+              bool firstFill=false;
               for(auto p : m_periods) {
                 if(p.first != p.second->id) continue; //skips remappings 
                 if(!p.second->contains(runNbr)) continue;
+                if(runDependentRun && firstFill) continue; //only fill runDependentRun once, since they aren't kept in the period they go in their own run-indexed histogram
                 
+                int idx = (runDependentRun) ? -runDependentRun : p.second->id; //use negative runNumber to avoid clash with periodID
                 
                 
-                
-                std::map<long,TH1D*>& triggerHists = t->triggerHists[p.second->id];
+                auto& triggerHists = t->triggerHists[idx];
                 if(triggerHists.find(tbits) == triggerHists.end()) {
-                    triggerHists[tbits] = dynamic_cast<TH1D*>(CloneEmptyHistogram(p.first,-1));
-                    if(m_debugging) Info("CalculatePrescaledLuminosityHistograms","Created Data Weight Histogram for [%s,%d,%ld]",t->val.Data(),p.first, tbits);
+                    triggerHists[tbits] = CloneEmptyHistogram(p.first,-1);
+                    if(m_debugging) Info("CalculatePrescaledLuminosityHistograms","Created Data Weight Histogram for [%s,%d,%d,%ld]",t->val.Data(),p.first,idx,tbits);
                 }
                   //check if we were about to fill a bad bin ... if we are, we either skipp the fill (unrep action=1) or redirect (unrep action=3)
                 if( (m_unrepresentedDataAction==1) && p.second->inputBinRedirect[bin]!=bin) { } //do nothing
                 else if( m_unrepresentedDataAction==3 ) {triggerHists[tbits]->Fill(triggerHists[tbits]->GetBinCenter(p.second->inputBinRedirect[bin]), intLumi*pFactor);}
                 else triggerHists[tbits]->Fill(mu*m_dataScaleFactorX,intLumi*pFactor);
                 
+                
+                if(runDependentRun && fillUnprescaledLumi) {
+                  //need to fill unprescaled lumi histogram for this particular run ...
+                  if(unprescaledLumi==0) {
+                    m_triggerObjs["None"]->triggerHists[-runDependentRun][0] = CloneEmptyHistogram(p.first,-1);
+                    unprescaledLumi = m_triggerObjs["None"]->triggerHists[-runDependentRun][0].get();
+                  }
+                  if( (m_unrepresentedDataAction==1) && p.second->inputBinRedirect[bin]!=bin) { } //do nothing
+                  else if( m_unrepresentedDataAction==3 ) {unprescaledLumi->Fill(unprescaledLumi->GetBinCenter(p.second->inputBinRedirect[bin]), intLumi);}
+                  else unprescaledLumi->Fill(mu*m_dataScaleFactorX,intLumi);
+                } 
+                
+                firstFill=true;
+                
               }
           }
+	  rootFile->Close();
         }
     }
     delete rootFile;
@@ -2053,81 +2200,147 @@ void CP::TPileupReweighting::calculateHistograms(CompositeTrigger* t) {
 
 }
 
-CP::TPileupReweighting::CompositeTrigger* CP::TPileupReweighting::makeTrigger(const TString& s) {
-   if(m_debugging) Info("makeTrigger","Doing %s",s.Data());
-   //find the first operand
-   TString oper1; CompositeTrigger* cOper1 = 0;
-   if(s.BeginsWith("(")) {
-      //find closing bracket
+std::unique_ptr<CP::TPileupReweighting::CompositeTrigger>
+CP::TPileupReweighting::makeTrigger(const TString& s) {
+
+   if( m_debugging ) {
+      Info( "makeTrigger", "Doing %s", s.Data() );
+   }
+
+   // Find the first operand
+   TString oper1;
+   std::unique_ptr< CompositeTrigger > cOper1;
+   if( s.BeginsWith( "(" ) ) {
+      // Find closing bracket
       int bCounter=1; int i=1;
-      while(bCounter!=0 && i<=s.Length()) {
-         if(s(i)=='(') bCounter++;
-         else if(s(i)==')') bCounter--;
+      while( ( bCounter != 0 ) && ( i <= s.Length() ) ) {
+         if( s( i ) == '(' ) {
+            bCounter++;
+         } else if( s( i ) == ')' ) {
+            bCounter--;
+         }
          i++;
       }
-      if(bCounter!=0) { Error("makeTrigger","Missing closing bracket"); return 0; }
-      oper1 = s(1,i-2);
-      if(i==s.Length()+1) return makeTrigger(oper1); //meainingless brackets, just return evaluation
-      else {cOper1 = makeTrigger(oper1); if(cOper1==0) return 0; }
+      if( bCounter != 0 ) {
+         Error( "makeTrigger", "Missing closing bracket" );
+         return std::unique_ptr< CompositeTrigger >();
+      }
+      oper1 = s( 1, i - 2 );
+      if( i == s.Length() + 1 ) {
+         return makeTrigger( oper1 ); //meainingless brackets, just return evaluation
+      } else {
+         cOper1 = makeTrigger( oper1 );
+         if( ! cOper1 ) {
+            return 0;
+         }
+      }
    }
-   //find the second operand. Do this by finding the first operation at this level. if cannot find, then just set val
+
+   // Find the second operand. Do this by finding the first operation at
+   // this level. If cannot find, then just set val
    int i=0;int bCounter=0; int op=0;
-   while(i<=s.Length()) {
-      if(s(i)=='(') bCounter++;
-      else if(s(i)==')') bCounter--;
-      else if(s(i)=='&' && bCounter==0) { op=2; break;}
-      else if(s(i)=='|' && bCounter==0) { op=1; break;}
+   while( i <= s.Length() ) {
+      if( s( i ) == '(' ) {
+         bCounter++;
+      } else if( s( i ) == ')' ) {
+         bCounter--;
+      } else if( ( s( i ) == '&' ) && ( bCounter == 0 ) ) {
+         op = 2;
+         break;
+      } else if( ( s( i ) == '|' ) && ( bCounter == 0 ) ) {
+         op = 1;
+         break;
+      }
       i++;
    }
 
 
-   if(op==0) {
-      if(m_lumicalcFiles.find(s)==m_lumicalcFiles.end()) {
-         Error("GetDataWeight","Could not find subTrigger %s",s.Data());
-         return 0;
+   if( op == 0 ) {
+      if( m_lumicalcFiles.find( s ) == m_lumicalcFiles.end() ) {
+         Error( "GetDataWeight", "Could not find subTrigger %s", s.Data() );
+         return std::unique_ptr< CompositeTrigger >();
+      }
+      if( cOper1 ) {
+         return cOper1;
       }
-      if(cOper1) return cOper1; 
-      CompositeTrigger* out = new CompositeTrigger;
-      out->op=op;out->val = s; return out; //just a value trigger
+      auto out = std::make_unique< CompositeTrigger >();
+      out->op = op;
+      out->val = s;
+      return out; //just a value trigger
    }
 
-   CompositeTrigger* out = new CompositeTrigger;
-   out->op=op;
+   auto out = std::make_unique< CompositeTrigger >();
+   out->op = op;
 
-   if(op==1) { //an OR 
-      if(cOper1) out->trig1=cOper1;  
-      else {oper1=s(0,i); out->trig1=makeTrigger(oper1); if(out->trig1==0) { delete out; return 0; } }
-      TString oper2 = s(i+1,s.Length()); out->trig2 = makeTrigger(oper2); if(out->trig2==0) { delete out; return 0; } 
+   if( op == 1 ) { //an OR 
+      if( cOper1 ) {
+         out->trig1 = std::move( cOper1 );
+      } else {
+         oper1 = s( 0, i );
+         out->trig1 = makeTrigger( oper1 );
+         if( ! out->trig1 ) {
+            return std::unique_ptr< CompositeTrigger >();
+         }
+      }
+      TString oper2 = s( i + 1, s.Length() );
+      out->trig2 = makeTrigger( oper2 );
+      if( ! out->trig2 ) {
+         return std::unique_ptr< CompositeTrigger >();
+      }
       return out;
    }
 
-   //got here, must be an AND keep going until we hit an OR at this level, then make all that the first operand (delete cOper if necessary)
-   int j=i;bCounter=0;
-   while(j<=s.Length()) {
-      if(s(j)=='(') bCounter++;
-      else if(s(j)==')') bCounter--;
-      else if(s(j)=='|' && bCounter==0) { op=1; break;}
+   // Got here, must be an AND keep going until we hit an OR at this level,
+   // then make all that the first operand (delete cOper if necessary)
+   int j = i;
+   bCounter = 0;
+   while( j <= s.Length() ) {
+      if( s( j ) == '(' ) {
+         bCounter++;
+      } else if( s( j )== ')' ) {
+         bCounter--;
+      } else if( ( s( j ) == '|' ) && ( bCounter == 0 ) ) {
+         op=1;
+         break;
+      }
       j++;
    }
-   if(j==s.Length()+1 && op==2) { //no more OR found, set oper2 to remainder 
-      if(cOper1) out->trig1=cOper1;  
-      else {oper1=s(0,i); out->trig1=makeTrigger(oper1); }
-      TString oper2 = s(i+1,s.Length()); if(m_debugging) Info("makeTrigger","Found & %s %s",oper1.Data(),oper2.Data());
-      out->trig2 = makeTrigger(oper2); if(out->trig2==0) { delete out; return 0; } 
+   if( ( j == s.Length() + 1 ) && ( op == 2 ) ) { //no more OR found, set oper2 to remainder 
+      if( cOper1 ) {
+         out->trig1 = std::move( cOper1 );
+      } else {
+         oper1 = s( 0, i );
+         out->trig1 = makeTrigger( oper1 );
+      }
+      TString oper2 = s( i + 1, s.Length() );
+      if( m_debugging ) {
+         Info( "makeTrigger", "Found & %s %s", oper1.Data(), oper2.Data() );
+      }
+      out->trig2 = makeTrigger( oper2 );
+      if( ! out->trig2 ) {
+         return std::unique_ptr< CompositeTrigger >();
+      }
       return out;
-   } else if(op==1) {   //found an OR, set oper1 to everything up to this 
-      
-      oper1 = s(0,j); TString oper2 = s(j+1,s.Length()); if(m_debugging) Info("makeTrigger","Found & then | %s %s",oper1.Data(),oper2.Data());
-      if(cOper1) delete cOper1;
-      out->op=op; //updates to an OR
-      out->trig1=makeTrigger(oper1); if(out->trig1==0) { delete out; return 0; }
-      out->trig2=makeTrigger(oper2); if(out->trig2==0) { delete out; return 0; } 
+   } else if( op ==1 ) {   //found an OR, set oper1 to everything up to this 
+
+      oper1 = s( 0, j );
+      TString oper2 = s( j + 1, s.Length() );
+      if( m_debugging ) {
+         Info( "makeTrigger", "Found & then | %s %s", oper1.Data(),
+               oper2.Data() );
+      }
+      out->op = op; //updates to an OR
+      out->trig1 = makeTrigger( oper1 );
+      if( ! out->trig1 ) {
+         return std::unique_ptr< CompositeTrigger >();
+      }
+      out->trig2 = makeTrigger( oper2 );
+      if( ! out->trig2 ) {
+         return std::unique_ptr< CompositeTrigger >();
+      }
       return out;
    }
-   Error("makeTrigger","Should never have got here!, but did with %s", s.Data());
-   delete out;
-   return 0;
+   Error( "makeTrigger", "Should never have got here!, but did with %s",
+          s.Data() );
+   return std::unique_ptr< CompositeTrigger >();
 }
-
-
-
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/python/AutoconfigurePRW.py b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/python/AutoconfigurePRW.py
new file mode 100644
index 0000000000000000000000000000000000000000..33fb31110b469348455127a59c6f17ad6d9ccef3
--- /dev/null
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/python/AutoconfigurePRW.py
@@ -0,0 +1,78 @@
+# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+
+# Helper functions for the configuration of pileup reweighting
+reco_campaigns = { 
+ 'mc16a' : ['r9280','r9287','r9364'],
+ 'mc16d' : ['r10069','r10201','r10211','r10212'],
+ 'mc16e' : ['r10724','r10726']
+}
+
+# Function to get the campaign
+def getCampaign(ami_tag = None, project = None):
+    # Attempt auto-configuration
+    if ami_tag is None or project is None:
+        # either is not set, get unset from InputFilePeeker
+        from RecExConfig.InputFilePeeker import inputFileSummary
+        if inputFileSummary is not None:
+            ami_tag = inputFileSummary['tag_info']['AMITag'] if ami_tag is None else ami_tag
+            project = inputFileSummary['tag_info']['project_name'] if project is None else project
+
+    assert ami_tag is not None
+    assert project is not None
+
+    for c in reco_campaigns:
+        for r in reco_campaigns[c]:
+            if r in ami_tag:
+                return c
+
+    # MC-equivalent projects for data
+    if 'data18' in project: return 'mc16e'
+    elif 'data17' in project: return 'mc16d'
+    elif 'data16' in project or 'data15' in project: return 'mc16a'
+
+    return None
+
+# Function to get the data lumicalc files
+def getLumiCalcFiles(campaign = None):
+    # Attempt auto-configuration
+    campaign = campaign or getCampaign()
+    if campaign=='mc16a':
+        return ["GoodRunsLists/data15_13TeV/20170619/PHYS_StandardGRL_All_Good_25ns_276262-284484_OflLumi-13TeV-008.root",
+                "GoodRunsLists/data16_13TeV/20180129/PHYS_StandardGRL_All_Good_25ns_297730-311481_OflLumi-13TeV-009.root"]
+    elif campaign=='mc16d':
+        return ["GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.lumicalc.OflLumi-13TeV-010.root" ]
+    elif campaign=='mc16e':
+        return ["GoodRunsLists/data18_13TeV/20190708/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-010.root" ]
+    return []
+
+def getMCMuFiles(data_type = None, campaign = None, dsid = None):
+    # Attempt auto-configuration
+    defaultDirectory = 'dev/PileupReweighting/share'
+
+    if data_type is None or campaign is None or dsid is None:
+        # one is not set, get unset from InputFilePeeker
+        from RecExConfig.InputFilePeeker import inputFileSummary
+        if inputFileSummary is not None and 'IS_SIMULATION' in inputFileSummary['evt_type']:
+            # We are in an MC file - get the AMI tag
+            ami_tag = inputFileSummary['tag_info']['AMITag']
+            campaign = getCampaign(ami_tag=ami_tag)
+            dsid = str(inputFileSummary['mc_channel_number'][0]) if dsid is None else dsid
+            sim_flavor = inputFileSummary['metadata']['/Simulation/Parameters']['SimulationFlavour']
+            sim_type = 'FS' if sim_flavor in ['FullG4'] else 'AFII'
+            inputFile = defaultDirectory+'/DSID'+dsid[:3]+'xxx/pileup_'+campaign+'_dsid'+dsid+'_'+sim_type+'.root'
+            return [inputFile]
+    else:
+        # everything set explicitly
+        # data_type as in pileup analysis sequence: either 'data' or ('mc' or 'afii')
+        if data_type == "data":
+            return []
+        if data_type == "mc":
+            sim_type = "FS"
+        elif data_type == "afii":
+            sim_type = "AFII"
+        else:
+            raise ValueError("Invalid data_type %s" % data_type)
+
+        inputFile = defaultDirectory+'/DSID'+dsid[:3]+'xxx/pileup_'+campaign+'_dsid'+dsid+'_'+sim_type+'.root'
+        return [inputFile]
+    return []
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/scripts/PURW_create_actual_mu_profile.py b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/scripts/PURW_create_actual_mu_profile.py
new file mode 100755
index 0000000000000000000000000000000000000000..3e3c825fd3968ec8de9c8c7fb684bc6fc09555a6
--- /dev/null
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/scripts/PURW_create_actual_mu_profile.py
@@ -0,0 +1,98 @@
+#!/usr/bin/env python
+# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+
+import ROOT
+import argparse, sys, os, array, logging
+
+logger = logging.getLogger('PURW actual mu profile tool')
+logging.basicConfig()
+
+parser = argparse.ArgumentParser(description='Make a BCID-aware pileup reweighting file')
+parser.add_argument('--grl', type=str,
+                    help='GRL to use (mandatory)')
+parser.add_argument('--bcidfile', type=str,
+                    help='Input BCID lumi ROOT file (not from iLumiCalc!) (mandatory) For example, /afs/cern.ch/atlas/www/GROUPS/DATAPREPARATION/InteractionsperCrossing/data17_13TeV-OflLumi-13TeV-010.root')
+                    
+parser.add_argument('--outfile', type=str,
+                    help='Output file for PURW tool (default: purw.root)',
+                    default='purw.root')
+
+args = parser.parse_args()
+
+if not args.bcidfile:
+    logger.error('BCID File must be specified\n')
+    parser.print_help()
+    sys.exit(2)
+
+bcidfile = ROOT.TFile.Open(args.bcidfile)
+if not bcidfile:
+    logger.error('Cannot open the BCID lumi file %s', args.bcidfile)
+    logger.error('Exiting')
+    sys.exit(1)
+
+grl = None
+if not args.grl:
+    logger.error('Must specify GRL file\n')
+    parser.print_help()
+    sys.exit(2)
+
+if not os.path.isfile(args.grl):
+    logger.error('Cannot find GRL file %s', args.grl)
+    logger.error('Exiting')
+    sys.exit(1)
+
+outfile = ROOT.TFile.Open(args.outfile, 'RECREATE')
+metadata = ROOT.TTree('DataCustomReweighting', 'DataCustomReweighting')
+cname_arr = array.array('c', 'pileup\0')
+runno_arr = array.array('I', [0])
+histname_arr = array.array('c', 'pileup_data_run_XXXXXX\0')
+metadata.Branch('CustomName', cname_arr, 'CustomName/C')
+metadata.Branch('RunNumber', runno_arr, 'RunNumber/i')
+metadata.Branch('HistName', histname_arr, 'HistName/C')
+
+lgp = ROOT.Root.TGoodRunsListReader(args.grl)
+lgp.Interpret()
+grl = lgp.GetMergedGoodRunsList()
+for run in grl.GetGoodRuns():
+    outhist=None
+    runno = run.GetRunNumber()
+    runno_arr[0] = runno
+    histname_arr[-7:-1] = array.array('c', `runno`)
+    rdir = bcidfile.Get(`runno`)
+    if not rdir:
+        logger.warning('Unable to retrieve mu distributions for run %s, skipping ...', runno)
+        continue
+    #print rdir
+    runhist = None
+    for lbrange in run:
+        #print runno, lbrange.Begin(), lbrange.End()
+        for lb in xrange(lbrange.Begin(), lbrange.End()+1):
+            inhist = rdir.Get('%srec' % lb)
+            if not inhist:
+                logger.warning('Unable to retrieve mu distribution for run %s LB %s', (runno, lb))
+            else:
+                if not runhist:
+                    runhist = inhist.Clone('pileup_data_run_%s' % runno)
+                else:
+                    runhist.Add(inhist)
+    outfile.WriteTObject(runhist)
+    metadata.Fill()
+
+outfile.WriteTObject(metadata)
+
+#make some other metadata
+lumitag = bcidfile.Get('LuminosityTag')
+if not lumitag:
+    logger.warning("Unfortunately, LuminosityTag object not found in BCID info file")
+    logger.warning("This is not fatal, but reduces trackability of information.")
+else:
+    outfile.WriteTObject(lumitag)
+
+grlo = ROOT.TNamed("InputGRL", args.grl)
+outfile.WriteTObject(grlo)
+
+outfile.Close()
+
+        
+
+
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/scripts/checkPRW.py b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/scripts/checkPRW.py
new file mode 100755
index 0000000000000000000000000000000000000000..9cfb1bfd7596906f1d86171a30275bc5f7b7bd73
--- /dev/null
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/scripts/checkPRW.py
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+
+__author__ = "Will Buttinger"
+__doc__ = """
+This script helps you check your config files are complete. 
+You can also use it to output a single PRW config file containing just your datasets.
+
+Example: checkPRW.py --outPRWFile=my.prw.root --inDsTxt=my.datasets.txt  path/to/prwConfigs/*.root
+
+"""
+import os
+import argparse
+
+def main():
+    from argparse import RawTextHelpFormatter
+    
+    parser = argparse.ArgumentParser(description=__doc__,formatter_class=RawTextHelpFormatter)
+    parser.add_argument('--outPRWFile',action="store",help="OPTIONAL Name of the output prw file containing valid configs",required=False)
+    parser.add_argument('--outputSuspect',action="store_true",help="allow for suspect channels to be included in the output prw file",default=False)
+    parser.add_argument('--inDsTxt',action="store",help="text file containing datasets to make PRW for (one per line)",required=True)
+    parser.add_argument('prwFiles',nargs="+",help="PRW Config files to scan")
+    
+    args = parser.parse_args()
+
+    
+    try:
+      import pyAMI.atlas.api as atlasAPI
+      import pyAMI.client
+    except ImportError:
+      print "Could not import pyAMI ... please do: lsetup pyAMI"
+      print "Also ensure you have a valid certificate (voms-proxy-init -voms atlas)"
+      return 1
+
+    client = pyAMI.client.Client('atlas')
+    atlasAPI.init()
+
+    #read datasets into list
+    datasets=[]
+    for txtFile in args.inDsTxt.split(","):
+      with open(txtFile) as f: datasets += f.read().splitlines()
+
+    
+    print "Determining provenances of %d datasets ..." % len(datasets)
+    
+    aodDatasets=dict()
+    for dataset in datasets:
+      #strip the scope if it's there
+      if dataset.startswith("#"): continue
+      dataset = dataset.rsplit(":")[-1].strip()
+      if len(dataset)==0: continue
+      
+      print "Doing %s" % dataset
+      prov = atlasAPI.get_dataset_prov(client, dataset )
+      if 'node' not in prov:
+          print "ERROR: Could not determine provenance of %s, skipping!" % dataset
+          continue
+      theParent=""
+      for ds in prov['node']:
+        if ds[u'dataType']!=u'AOD': continue
+        theParent = str(ds[u'logicalDatasetName'])
+        theParentSize = int(ds[u'events'])
+        break
+      if theParent=="":
+          print "ERROR: Could not determine provenance of %s, skipping!" % dataset
+          continue
+      #extract the dsid ...
+      theParent = theParent.split(".")[1]
+      
+      if theParent in aodDatasets: aodDatasets[theParent] += theParentSize
+      else: aodDatasets[theParent] = theParentSize
+    
+    #aodDatasets is now a chanNum -> eventNumber pairing ...
+    
+    import ROOT
+    
+    out = ROOT.CP.TPileupReweighting("out")
+    for f in args.prwFiles:
+      out.AddConfigFile(f)
+    out.ResetCountingMode() #trick tool into going into counting mode 
+    
+    #list of known period numbers
+    periodNumbers = out.GetPeriodNumbers()
+    
+    for dsid,nevents in aodDatasets.iteritems():
+      #get the sum of weights from the tool
+      
+      total=0;
+      for p in periodNumbers:
+        if p==-1: continue
+        hist = out.GetInputHistogram(int(dsid),p)
+        if hist: total += hist.GetEntries()
+      
+      if total==nevents:
+        print "channel %s is ok" % dsid
+      elif total<nevents:
+        print "channel %s is incomplete (missing %d events from config files)" % (dsid,nevents-total)
+        out.RemoveChannel(int(dsid))
+      elif total>nevents:
+        print "channel %s is suspect! (config files have additional %d events)" % (dsid,total-nevents)
+        if not args.outputSuspect:
+          out.RemoveChannel(int(dsid))
+      
+      
+    
+    if args.outPRWFile:
+        out.Initialize();
+        out.WriteToFile(args.outPRWFile);
+    
+    
+    return 0
+
+
+if __name__ == "__main__":
+    os._exit(main())
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/scripts/generatePRW.py b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/scripts/generatePRW.py
new file mode 100755
index 0000000000000000000000000000000000000000..ca2ec03e3af65a418b760fd001749a02dbe51637
--- /dev/null
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/scripts/generatePRW.py
@@ -0,0 +1,172 @@
+#!/usr/bin/env python
+
+__author__ = "Will Buttinger"
+__doc__ = """
+Submit a task to the grid to generate PRW config files for a list of datasets.
+This command ensures that the PRW are generated from the unskimmed primary AOD datasets.
+
+Example: generatePRW.py --outDS=user.will.myPRW  --inDsTxt=datasets.txt
+
+"""
+
+import os
+import argparse
+import ROOT
+
+def main():
+    from argparse import RawTextHelpFormatter
+    
+    parser = argparse.ArgumentParser(description=__doc__,formatter_class=RawTextHelpFormatter)
+    
+    parser.add_argument('--inDsTxt',action="store",help="text file containing datasets to make PRW for (one per line) [REQUIRED]",required=True)
+    parser.add_argument('--outDS',action="store",default="",help="Name of the output dataset",required=False)
+    parser.add_argument('--forceStaged',action="store_true",help="If set, grid jobs will be submitted with forceStaged option")
+    parser.add_argument('--skipNTUP_PILEUP',action="store_true",help="If set, will not check for existing NTUP_PILEUP datasets")
+    parser.add_argument('prwFiles',nargs="*",help="Exosting PRW Config files to check")
+    
+    args = parser.parse_args()
+
+    try:
+      import pyAMI.atlas.api as atlasAPI
+      import pyAMI.client
+    except ImportError:
+      print "Could not import pyAMI ... please do: lsetup pyAMI"
+      print "Also ensure you have a valid certificate (voms-proxy-init -voms atlas)"
+      return 1
+
+    client = pyAMI.client.Client('atlas')
+    atlasAPI.init()
+
+    #read datasets into list
+    with open(args.inDsTxt) as f: datasets = f.read().splitlines()
+
+
+    
+    import ROOT
+    
+    out = ROOT.CP.TPileupReweighting("out")
+    for f in args.prwFiles:
+      out.AddConfigFile(f)
+    out.ResetCountingMode() #trick tool into going into counting mode 
+    #list of known period numbers
+    periodNumbers = out.GetPeriodNumbers()
+    
+    print "Determining provenances of %d datasets ..." % len(datasets)
+    
+    aodDatasets=[]
+    ntupDatasets=[]
+    for dataset in datasets:
+      dataset = dataset.strip("/")
+      #strip the scope if it's there
+      if dataset.startswith("#"): continue
+      dataset = dataset.rsplit(":")[-1].strip()
+      if len(dataset)==0: continue
+      
+      print "Doing %s" % dataset
+      prov = atlasAPI.get_dataset_prov(client, dataset )
+      if 'node' not in prov:
+          print "ERROR: Could not determine provenance of %s, skipping!" % dataset
+          continue
+      theParent=""
+      for ds in prov['node']:
+        if ds[u'dataType']!=u'AOD': continue
+        theParent = str(ds[u'logicalDatasetName'])
+        theParentSize = int(ds[u'events'])
+        
+        
+        break
+      if theParent=="":
+          print "ERROR: Could not determine provenance of %s, skipping!" % dataset
+          continue
+      
+      #check input prw files, if we specified
+      isIncomplete=False
+      if len(args.prwFiles):
+        total=0;
+        dsid = theParent.split(".")[1]
+        for p in periodNumbers:
+          if p==-1: continue
+          hist = out.GetInputHistogram(int(dsid),p)
+          if hist: total += hist.GetEntries()
+        
+        if total==theParentSize:
+            print "INFO: %s is complete in your existing PRW files. Good!" % dataset
+            continue
+        if total>theParentSize:
+            print "WARNING: %s is suspect in your existing PRW files, has %d events when expected %d ... please check you didn't overmerge" % (dataset,total,theParentSize)
+            continue
+        else:
+            if total!=0: 
+              print "WARNING: %s is incomplete (%d events when expected %d) ... will try to find centrally produced NTUP_PILEUP or prepare to generate" % (dataset,total,theParentSize)
+              isIncomplete=True
+        
+      #before adding the dataset, see if we can find an NTUP_PILEUP for it
+      if not args.skipNTUP_PILEUP:
+        ntupDatasetName = theParent.replace("AOD","NTUP_PILEUP")
+        ntupDatasetName = ntupDatasetName.replace("aod","%")
+        ntupDatasetName = ntupDatasetName.replace("merge","%")
+        #remove everything after first rtag of ami tag .. replace with wildcard
+        first_rtag_pos = ntupDatasetName.index("_r",ntupDatasetName.index("NTUP_PILEUP"))
+        try:
+            next_underscore_pos = ntupDatasetName.index("_",first_rtag_pos+1)
+        except ValueError:
+            next_underscore_pos = len(ntupDatasetName)
+        ntupDatasetName = ntupDatasetName[:next_underscore_pos]+"%"
+        res = atlasAPI.list_datasets(client, ntupDatasetName,fields='ldn,prodsys_status')
+        foundNTUP=False
+        for r in res:
+          if r[u'prodsys_status']!="ALL EVENTS AVAILABLE" and (isIncomplete or r[u'prodsys_status']!="EVENTS PARTIALLY AVAILABLE"): continue
+          print "Found existing NTUP_PILEUP ... please download: %s" % r[u"ldn"]
+          ntupDatasets += [r[u'ldn']]
+          foundNTUP=True
+          break
+        if foundNTUP==True: continue
+        
+      aodDatasets += [theParent]
+    
+    
+    if len(aodDatasets)>0:
+      if args.outDS=="":
+          print "NTUP_PILEUP need generating for the following datasets, please specify the --outDS option to give a name to the output dataset"
+          print ",".join(aodDatasets)
+          return 1
+      print "...submitting job to grid..."
+  
+      extraOpts=""
+      if args.forceStaged: extraOpts += "--forceStaged "
+  
+      mycommand = """pathena --inDS="%s" --outDS="%s" PileupReweighting/generatePRW_jobOptions.py %s--mergeOutput --nGBPerJob=MAX --addNthFieldOfInDSToLFN=2,6""" % (",".join(aodDatasets),args.outDS,extraOpts)
+      
+      print "Command: %s" % mycommand
+      
+      from subprocess import call
+      if call(mycommand,shell=True)!=0:
+         print "Problem executing command. Did you remember to do: lsetup panda"
+         return 1
+  
+  
+      print "... finished. Please monitor your job on the grid, and when it is finished, download the files!"
+    
+    if len(ntupDatasets):
+      frucio_fn = 'rucio_downloads_%s.sh' % args.inDsTxt
+      print "Please download existing config files from these datasets (see also output file %s):" % frucio_fn
+      with open(frucio_fn, 'w') as frucio:
+        for ds in ntupDatasets:
+          command = "rucio download %s" % ds
+          print command
+          frucio.write(command + '\n')
+      print ""
+    
+    if len(ntupDatasets) or len(aodDatasets):
+      print "After downloading, you are advised to check they are complete: checkPRW.py --inDsTxt=%s <downloaded files> " % args.inDsTxt
+      print "Thank you for generating config files, you get a gold star!"
+    else:
+      print "Looks like you are ready for pileup reweighting!"
+
+    return 0
+
+
+if __name__ == "__main__":
+
+    os._exit(main())
+
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/debugExample.C b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/debugExample.C
new file mode 100644
index 0000000000000000000000000000000000000000..2305fe1bfe56861bd9badc56a42bb0fd77a84ceb
--- /dev/null
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/debugExample.C
@@ -0,0 +1,35 @@
+//This is an example ROOT macro for running PRW
+//If you want me to help you debug a problem, please 
+//copy this macro and modify it so that it reproduces your issue
+//please locate all the input files on public (afs) space
+
+//execute with: root debugExample.C
+
+void debugExample() {
+  AAH(); //start macros with this line to ensure Gaudi features like ToolHandles can be used - AAH = AthAnalysisHelper
+  
+  POOL::TEvent evt(POOL::TEvent::kClassAccess);
+
+  evt.readFrom("$ASG_TEST_FILE_MC"); //replace with your input file
+
+  ToolHandle<CP::IPileupReweightingTool> prw("CP::PileupReweightingTool/tool");
+
+  //update the following two lines to point to your config and lumicalc files
+  //(if they are not in the calib area)
+  AAH::setProperty( prw, "ConfigFiles" , "['dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root']");
+  AAH::setProperty( prw, "LumiCalcFiles" , "['GoodRunsLists/data15_13TeV/20160720/physics_25ns_20.7.lumicalc.OflLumi-13TeV-005.root','GoodRunsLists/data16_13TeV/20170215/physics_25ns_20.7.lumicalc.OflLumi-13TeV-008.root']");
+
+  prw.retrieve(); //initializes the tool
+
+
+  evt.getEntry(0); //update to go to the problematic event;
+
+  const xAOD::EventInfo* ei = 0;
+  evt.retrieve( ei );
+
+  prw->getCombinedWeight( *ei ); //change this to reproduce your problem
+		   
+  
+
+
+}
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/generatePRW_jobOptions.py b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/generatePRW_jobOptions.py
index a2be966d96a1e9ef9d8f9cb83ede3c2bc4c38ae5..522b5a4389bb4a56b653648b7f351890be85a59d 100644
--- a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/generatePRW_jobOptions.py
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/generatePRW_jobOptions.py
@@ -1,6 +1,9 @@
 
 theApp.EvtMax=-1                                         #says how many events to run over. Set to -1 for all events
 
+#Include error handler for safety purposes
+theApp.CreateSvc += ["AthROOTErrorHandlerSvc"]
+
 #import AthenaPoolCnvSvc.ReadAthenaPool                   #sets up reading of POOL files (e.g. xAODs)
 import AthenaRootComps.ReadAthenaxAODHybrid
 svcMgr.EventSelector.AccessMode=1 #use class access mode ... I know it's wrong, but it should be ok just for the EventInfo information
@@ -14,7 +17,7 @@ if len(svcMgr.EventSelector.InputCollections)==0:
    
 
 #instantiate a tool without a config file, so that it's in config file making mode ...
-ToolSvc += CfgMgr.CP__PileupReweightingTool("auto",ConfigFiles=[],LumiCalcFiles=[],DataScaleFactor=1.0,DataScaleFactorUP=0.,DataScaleFactorDOWN=0.)
+ToolSvc += CfgMgr.CP__PileupReweightingTool("auto",ConfigFiles=[],LumiCalcFiles=[],DataScaleFactor=1.0,DataScaleFactorUP=0.,DataScaleFactorDOWN=0.,PeriodAssignments=[])
 
 #need to configure the weighttool to use TruthEvents, because of ATLASSIM-2989 bug in 20.7
 ToolSvc += CfgMgr.McEventWeight("MyWeights",UseTruthEvents=True)
@@ -22,12 +25,12 @@ ToolSvc.auto.WeightTool = ToolSvc.MyWeights
 
 
 algseq = CfgMgr.AthSequencer("AthAlgSeq")                #gets the main AthSequencer
-algseq += CfgMgr.CP__PileupReweightingProvider(ConfigOutputStream="METADATA",Tool=ToolSvc.auto)                           #adds an instance of your alg to it
+algseq += CfgMgr.CP__PileupReweightingProvider(ConfigOutputStream="NTUP_PILEUP",Tool=ToolSvc.auto)                           #adds an instance of your alg to it
 
 include("AthAnalysisBaseComps/SuppressLogging.py")       #Optional include to suppress as much athena output as possible
 
 svcMgr += CfgMgr.THistSvc()
-svcMgr.THistSvc.Output += ["METADATA DATAFILE='my.prw.root' OPT='RECREATE'"]
+svcMgr.THistSvc.Output += ["NTUP_PILEUP DATAFILE='" + outputFile + "' OPT='RECREATE'"]
 
 #use on the grid like this:
 #pathena PileupReweighting/generatePRW_jobOptions.py --inDS="etc/,etc/,etc/" --outDS="user.whatever.myprw/" --extOutFile="auto.prw.root"
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/mc11a_defaults.prw.root b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/mc11a_defaults.prw.root
deleted file mode 100644
index 8026da0d95407aabd1964834228dc1183c83c578..0000000000000000000000000000000000000000
Binary files a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/mc11a_defaults.prw.root and /dev/null differ
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/mc11b_defaults.prw.root b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/mc11b_defaults.prw.root
deleted file mode 100644
index 7bf93bc7f46ff049fa1b31bb676da4e42ab9d2f0..0000000000000000000000000000000000000000
Binary files a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/mc11b_defaults.prw.root and /dev/null differ
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/mc12a_defaults.prw.root b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/mc12a_defaults.prw.root
deleted file mode 100644
index 73c2b3842c72737860854d68ac2de913935da133..0000000000000000000000000000000000000000
Binary files a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/mc12a_defaults.prw.root and /dev/null differ
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/mc12ab_defaults.prw.root b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/mc12ab_defaults.prw.root
deleted file mode 100644
index 6fb4acab4e6d2df8aa38945c97efb1af8acace6a..0000000000000000000000000000000000000000
Binary files a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/mc12ab_defaults.prw.root and /dev/null differ
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/ut_PRWExample_test.ref b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/share/ut_PRWExample_test.ref
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/src/testPRW.C b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/testPRW.cxx
similarity index 97%
rename from PhysicsAnalysis/AnalysisCommon/PileupReweighting/src/testPRW.C
rename to PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/testPRW.cxx
index 2490efc3c22b25dc40ee7671de68b32d6ef0e7ce..5b7b6049de8f279aa0c55b4070964862cee22f49 100644
--- a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/src/testPRW.C
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/testPRW.cxx
@@ -98,7 +98,7 @@ int main() {
 
    std::cout << "prw1 Integrated lumi = " << prw1.GetIntegratedLumi() << " (expected=2.7e-5) " << std::endl;  testValue(prw1.GetIntegratedLumi(),2.7e-5);
    std::cout << "prw1 periodWeights : " << prw1.GetPeriodWeight(100,2002) << " (expected=1.6666) " << prw1.GetPeriodWeight(101,2002) << " (expected=0.5555)" << std::endl; testValue(prw1.GetPeriodWeight(100,2002),1.6666);
-   std::cout << "prw1 primaryWeights : " << prw1.GetPrimaryWeight(100,2002,0.5) << " (expected=0.5555) " << prw1.GetPrimaryWeight(100,2002,1.5) << " (expected=1.4444) " << prw1.GetPrimaryWeight(101,2002,0.5) << " (expected=inf .. no MC) " <<  prw1.GetPrimaryWeight(101,2002,1.5) << " (expected=2.3333) " << prw1.GetPrimaryWeight(101,2002,2.5) << " (expected=0.6666) " << prw1.GetPrimaryWeight(101,2002,3.5) << " (expected=0.) " << std::endl;
+   std::cout << "prw1 primaryWeights : " << prw1.GetPrimaryWeight(100,2002,0.5) << " (expected=0.5555) " << prw1.GetPrimaryWeight(100,2002,1.5) << " (expected=1.4444) " << /*prw1.GetPrimaryWeight(101,2002,0.5) << " (expected=inf .. no MC) " <<*/  prw1.GetPrimaryWeight(101,2002,1.5) << " (expected=2.3333) " << prw1.GetPrimaryWeight(101,2002,2.5) << " (expected=0.6666) " << prw1.GetPrimaryWeight(101,2002,3.5) << " (expected=0.) " << std::endl;
    testValue(prw1.GetPrimaryWeight(100,2002,0.5),0.5555);
    testValue(prw1.GetPrimaryWeight(100,2002,1.5),1.4444);
    testValue(prw1.GetPrimaryWeight(101,2002,1.5),2.3333);
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/testPRWTool.cxx b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/testPRWTool.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..e9b6e6c50593701b6ffd3eac6ac472068d5a6ea2
--- /dev/null
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/testPRWTool.cxx
@@ -0,0 +1,195 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+
+#include "AsgMessaging/MessageCheck.h"
+#include "PileupReweighting/PileupReweightingTool.h"
+#include "TTree.h"
+
+void testValue(double v1, double v2) {
+   if( (!v1 && v2) || (!v2 && v1) ) throw std::runtime_error("zero-non-zero mismatch");
+   if( fabs(v1-v2)/v1 > 0.001 ) throw std::runtime_error("mismatch > 0.1% in values");
+}
+
+
+int main() {
+
+   // needed for the ANA_CHECK() macro
+   using namespace asg::msgUserCode;
+   ANA_CHECK_SET_TYPE (int);
+
+   //create a 'dummy' lumicalc file, with only a few runs, with a few lumiblocks 
+   TFile l("tool.dummy.None.lumicalc.root","RECREATE");
+   TTree *t = new TTree("LumiMetaData","LumiMetaData");
+   UInt_t runNbr=0;Float_t ps1=1;Float_t ps2=1; Float_t ps3=1;UInt_t lbn=0;Float_t intLumi=0;Float_t mu=0;
+   t->Branch("RunNbr",&runNbr);t->Branch("L1Presc",&ps1);t->Branch("L2Presc",&ps2);t->Branch("L3Presc",&ps3);t->Branch("LBStart",&lbn);t->Branch("IntLumi",&intLumi);t->Branch("AvergeInteractionPerXing",&mu);
+
+   runNbr=1;lbn=1;intLumi=5;mu=0.5;t->Fill();
+   runNbr=1;lbn=2;intLumi=10;mu=1.5;t->Fill();
+   runNbr=2;lbn=1;intLumi=3;mu=1.5;t->Fill();
+   runNbr=3;lbn=1;intLumi=7;mu=1.5;t->Fill();
+   runNbr=3;lbn=2;intLumi=2;mu=2.5;t->Fill(); //will be unrepresented data in the setup in channel 2000
+ 
+   t->Write();delete t;
+   l.Close();
+
+   //make some trigger lumicalcs... only the prescale numbers are important!
+   TFile l2("tool.dummy.TriggerA.lumicalc.root","RECREATE");
+   t = new TTree("LumiMetaData","LumiMetaData");
+   t->Branch("RunNbr",&runNbr);t->Branch("L1Presc",&ps1);t->Branch("L2Presc",&ps2);t->Branch("L3Presc",&ps3);t->Branch("LBStart",&lbn);t->Branch("IntLumi",&intLumi);t->Branch("AvergeInteractionPerXing",&mu);
+
+   runNbr=1;lbn=1;ps1=2;mu=0.5;t->Fill();
+   runNbr=1;lbn=2;ps1=3;mu=1.5;t->Fill();
+   runNbr=2;lbn=1;ps1=3;mu=1.5;t->Fill();
+   runNbr=3;lbn=1;ps1=4;mu=1.5;t->Fill();
+   runNbr=3;lbn=2;ps1=2;mu=2.5;t->Fill(); 
+ 
+   t->Write();delete t;
+   l2.Close();
+
+   TFile l3("tool.dummy.TriggerB.lumicalc.root","RECREATE");
+   t = new TTree("LumiMetaData","LumiMetaData");
+   t->Branch("RunNbr",&runNbr);t->Branch("L1Presc",&ps1);t->Branch("L2Presc",&ps2);t->Branch("L3Presc",&ps3);t->Branch("LBStart",&lbn);t->Branch("IntLumi",&intLumi);t->Branch("AvergeInteractionPerXing",&mu);
+
+   runNbr=1;lbn=1;ps1=4;mu=0.5;t->Fill();
+   runNbr=1;lbn=2;ps1=6;mu=1.5;t->Fill();
+   runNbr=2;lbn=1;ps1=6;mu=1.5;t->Fill();
+   runNbr=3;lbn=1;ps1=8;mu=1.5;t->Fill();
+   runNbr=3;lbn=2;ps1=4;mu=2.5;t->Fill(); 
+ 
+   t->Write();delete t;
+   l3.Close();
+
+   //now create a config file ... this test config file generating 
+
+   CP::TPileupReweighting g;
+   g.AddPeriod(100,1,2);
+   g.AddPeriod(101,3,3);
+   g.SetUniformBinning(10,0,10);
+   g.Initialize();
+
+   g.Fill(100,2002,1,0.5);
+   g.Fill(100,2002,1,1.5);
+   g.Fill(101,2002,1,1.5);
+   g.Fill(101,2002,1,2.5);
+   g.Fill(101,2002,1,3.5);
+
+   g.WriteToFile("tool.dummy1.prw.root");
+
+   CP::TPileupReweighting* genConfig = new CP::TPileupReweighting("genConfig");
+   genConfig->AddPeriod(100,1,2);
+   genConfig->AddPeriod(101,3,3);
+   genConfig->SetUniformBinning(10,0,10);
+   genConfig->Initialize();
+
+   genConfig->Fill(100,2000/*channel number*/,1/*evt_weight*/,0.5);
+   genConfig->Fill(100,2000,1,1.5);
+   genConfig->Fill(101,2000,1,1.5);genConfig->Fill(101,2000,1,1.5);genConfig->Fill(101,2000,1,1.5); //three times stats in this bin 
+
+   genConfig->Fill(100,2001,0.5,1.5);
+   genConfig->Fill(101,2001,2,1.5);
+   genConfig->Fill(101,2001,1,2.5); 
+
+   genConfig->WriteToFile("tool.dummy2.prw.root");
+
+
+   std::vector<std::string> configFiles = {"tool.dummy2.prw.root"};
+   std::vector<std::string> lumicalcFiles = {"tool.dummy.None.lumicalc.root"};
+
+   //check multi period failure
+   CP::IPileupReweightingTool* prw_bad = new CP::PileupReweightingTool("prw_bad");
+   ANA_CHECK (asg::setProperty(prw_bad,"ConfigFiles",configFiles));
+   ANA_CHECK (asg::setProperty(prw_bad,"LumiCalcFiles",lumicalcFiles));
+   
+   try {
+     ANA_CHECK (prw_bad->initialize());
+   } catch(const std::runtime_error& e) {
+    std::cout << "correctly caught:" << e.what() << std::endl;
+   }
+   
+   
+
+   //repeat with action=3 ... 
+   CP::IPileupReweightingTool* prw = new CP::PileupReweightingTool("prw");
+   ANA_CHECK (asg::setProperty(prw,"ConfigFiles",configFiles));
+   ANA_CHECK (asg::setProperty(prw,"LumiCalcFiles",lumicalcFiles));
+   ANA_CHECK (asg::setProperty(prw,"UseMultiPeriods",true)); //channel 2000 has periods 100 and 101
+   ANA_CHECK (prw->initialize());
+
+
+
+   prw->expert()->SetUnrepresentedDataAction(3,1);
+
+   std::cout << "prw channel2000 combined weights: " << prw->expert()->GetCombinedWeight(100,2000,0.5) << " (expected 0.0) " << prw->expert()->GetCombinedWeight(100,2000,1.5) << " (expected 3.33333) " << prw->expert()->GetCombinedWeight(101,2000,1.5) << " (expected=0.555555) " << std::endl;
+   std::cout << "prw channel2000 'sum of weights': " << prw->expert()->GetCombinedWeight(100,2000,0.5)+prw->expert()->GetCombinedWeight(100,2000,1.5)+3*prw->expert()->GetCombinedWeight(101,2000,1.5) << " from 5 events (sum of evtweights=5)" << std::endl;
+
+   std::cout << "prw channel2001 combined weights: " << prw->expert()->GetCombinedWeight(100,2001,1.5) << " (expected 4.66666) " << prw->expert()->GetCombinedWeight(101,2001,1.5) << " (expected 0.58333) " << prw->expert()->GetCombinedWeight(101,2001,2.5) << " (expected=0.259259) " << std::endl;
+   std::cout << "prw channel2001 'sum of weights': " << 0.5*prw->expert()->GetCombinedWeight(100,2001,1.5)+2.*prw->expert()->GetCombinedWeight(101,2001,1.5)+1.*prw->expert()->GetCombinedWeight(101,2001,2.5) << " from 3 events (of various weights, sum of evtweights=3.5)" << std::endl;
+
+
+
+
+   CP::IPileupReweightingTool* prw1 = new CP::PileupReweightingTool("prw1");
+   std::vector<std::string> configFiles1 = {"tool.dummy1.prw.root"};
+   std::vector<std::string> lumicalcFiles1 = {"tool.dummy.None.lumicalc.root","tool.dummy.TriggerA.lumicalc.root:TriggerA","tool.dummy.TriggerB.lumicalc.root:TriggerB"};
+   ANA_CHECK (asg::setProperty(prw1, "ConfigFiles",configFiles1));
+   ANA_CHECK (asg::setProperty(prw1, "LumiCalcFiles",lumicalcFiles1));
+   ANA_CHECK (asg::setProperty(prw1,"UseMultiPeriods",true)); //channel 2000 has periods 100 and 101
+   ANA_CHECK (prw1->initialize());
+
+   std::cout << "prw1 Integrated lumi = " << prw1->GetIntegratedLumi() << " (expected=2.7e-5) " << std::endl;  testValue(prw1->GetIntegratedLumi(),2.7e-5);
+   std::cout << "prw1 periodWeights : " << prw1->expert()->GetPeriodWeight(100,2002) << " (expected=1.6666) " << prw1->expert()->GetPeriodWeight(101,2002) << " (expected=0.5555)" << std::endl; testValue(prw1->expert()->GetPeriodWeight(100,2002),1.6666);
+   std::cout << "prw1 primaryWeights : " << prw1->expert()->GetPrimaryWeight(100,2002,0.5) << " (expected=0.5555) " << prw1->expert()->GetPrimaryWeight(100,2002,1.5) << " (expected=1.4444) " << /*prw1->expert()->GetPrimaryWeight(101,2002,0.5) << " (expected=inf .. no MC) " <<*/  prw1->expert()->GetPrimaryWeight(101,2002,1.5) << " (expected=2.3333) " << prw1->expert()->GetPrimaryWeight(101,2002,2.5) << " (expected=0.6666) " << prw1->expert()->GetPrimaryWeight(101,2002,3.5) << " (expected=0.) " << std::endl;
+   testValue(prw1->expert()->GetPrimaryWeight(100,2002,0.5),0.5555);
+   testValue(prw1->expert()->GetPrimaryWeight(100,2002,1.5),1.4444);
+   testValue(prw1->expert()->GetPrimaryWeight(101,2002,1.5),2.3333);
+   testValue(prw1->expert()->GetPrimaryWeight(101,2002,2.5),0.6666);
+   testValue(prw1->expert()->GetPrimaryWeight(101,2002,3.5),0);
+
+   //test the random run number and lumiblock number generating 
+   int num1(0); int lnum1(0);
+   for(int i=0;i<1000000;i++) {
+      if(prw1->expert()->GetRandomRunNumber(100)==1) { //returns 1 or 2 in this test case .. should give 1 about 15/18ths of the time
+         num1++; 
+         if(prw1->expert()->GetRandomLumiBlockNumber(1)==1) lnum1++;
+      }
+   }
+   std::cout << "prw1 fraction of run1 = " << float(num1)/1000000 << " (expected=0.833333) " << " fraction of these with lbn1 = " << float(lnum1)/num1 << " (expected=0.333333) " << std::endl;
+   testValue(float(num1)/1000000,0.8333333);
+   testValue(float(lnum1)/num1,0.333333);
+
+   //test the DataWeights functionality .. first test the IntegratedLumi ...
+   std::cout << "prw1 TriggerA lumi = " << prw1->expert()->GetIntegratedLumi("TriggerA") << " (expected=9.58333e-6) " << std::endl; testValue(prw1->expert()->GetIntegratedLumi("TriggerA"),9.58333e-6);
+   std::cout << "prw1 TriggerB lumi = " << prw1->expert()->GetIntegratedLumi("TriggerB") << " (expected=4.79166e-6) " << std::endl; testValue(prw1->expert()->GetIntegratedLumi("TriggerB"),4.79166e-6);
+   std::cout << "prw1 TriggerA&&TriggerB lumi = " << prw1->expert()->GetIntegratedLumi("TriggerA&&TriggerB") << " (expected=1.81597e-6) " << std::endl;testValue(prw1->expert()->GetIntegratedLumi("TriggerA&&TriggerB"),1.81597e-6);
+
+   //now check the dataweight .. remember the runNumber is converted into a periodNumber (i.e. the weights aren't unique to a runNumber, they are unique to the periodNumber)
+   std::cout << "prw1 TriggerA DataWeights (mu independent): " << prw1->expert()->GetDataWeight(1,"TriggerA") << " (expected=2.63415) " << prw1->expert()->GetDataWeight(2,"TriggerA") << " (expected=2.63415) " << prw1->expert()->GetDataWeight(3,"TriggerA") << " (expected=3.2727)" << std::endl;
+   std::cout << "prw1 TriggerA DataWeights (mu dependent): " << prw1->expert()->GetDataWeight(1,"TriggerA",0.5) << " (expected=2) " << prw1->expert()->GetDataWeight(1,"TriggerA",1.5) << " (expected=3) " << prw1->expert()->GetDataWeight(2,"TriggerA",1.5) << " (expected=3.0000) " << prw1->expert()->GetDataWeight(3,"TriggerA",1.5) << " (expected=4) " << prw1->expert()->GetDataWeight(3,"TriggerA",2.5) << " (expected=2) " << std::endl;
+   
+   try {
+    prw1->expert()->GetDataWeight(3,"TriggerA",3.5);
+   } catch(...) {
+    std::cout << "correctly threw exception for out of range mu" << std::endl;
+   }
+   
+   testValue(prw1->expert()->GetDataWeight(1,"TriggerA"),2.63415);
+   testValue(prw1->expert()->GetDataWeight(2,"TriggerA"),2.63415);
+   testValue(prw1->expert()->GetDataWeight(3,"TriggerA"),3.2727);
+   testValue(prw1->expert()->GetDataWeight(1,"TriggerA",0.5),2.);
+   testValue(prw1->expert()->GetDataWeight(2,"TriggerA",1.5),3.);
+   testValue(prw1->expert()->GetDataWeight(3,"TriggerA",1.5),4);
+   testValue(prw1->expert()->GetDataWeight(3,"TriggerA",2.5),2);
+   //testValue(prw1->expert()->GetDataWeight(3,"TriggerA",3.5),nan);
+
+
+   //CP::TPileupReweighting t;
+
+   //t.AddLumiCalcFile("/usera/will/testareas/ZZ8TeV/ZZAnalysis/share/GRL_v61.None.lumicalc.root");
+
+
+
+
+   return 0;
+}
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/ut_PRWDataWeightExample_test.cxx b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/ut_PRWDataWeightExample_test.cxx
index 379c1384510dee8a38e8e78de12a21b92794be9f..73715427be37b81e0bbfde5e4033820863a95c53 100644
--- a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/ut_PRWDataWeightExample_test.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/ut_PRWDataWeightExample_test.cxx
@@ -17,7 +17,8 @@
 
 #include "TROOT.h"
 
-#include "POOLRootAccess/TEvent.h"
+#include "TTree.h"
+#include "TH1D.h"
 
 #include <assert.h>
 
@@ -26,8 +27,6 @@ using namespace asg::msgUserCode;
 int main() {
   ANA_CHECK_SET_TYPE (int); //makes ANA_CHECK return ints if exiting function
 
-  POOL::TEvent evt;
-  evt.readFrom("/r04/atlas/will/xAOD/data16_13TeV/DAOD_HIGG3D1.08297165._000001.pool.root.1");//"$ASG_TEST_FILE_DATA");
 
   asg::AnaToolHandle<CP::IPileupReweightingTool> prwTool("CP::PileupReweightingTool/prw");
   
@@ -35,8 +34,7 @@ int main() {
                                       "dev/PileupReweighting/ilumicalc_histograms_HLT_e12_lhvloose_nod0_L1EM10VH_297730-304494_OflLumi-13TeV-005.root:HLT_e12_lhvloose_nod0_L1EM10VH",
                                       "dev/PileupReweighting/ilumicalc_histograms_HLT_e24_lhvloose_nod0_L1EM20VH_297730-304494_OflLumi-13TeV-005.root:HLT_e24_lhvloose_nod0_L1EM20VH"}; //feed with lc files for each trigger
   
-  
-  
+  prwTool.setProperty( "DataScaleFactor", 1/1.09 );
   prwTool.setProperty( "LumiCalcFiles" , lcFiles );
   //prwTool.setProperty( "OutputLevel", 1 ); //VERBOSE OUTPUT LEVEL
 
@@ -62,6 +60,22 @@ int main() {
     throw std::runtime_error("data weight not expected value 960312");
   }
   
+  //compute expected prescale for mu of 24-25 in run 297730 for single trigger
+  TFile f1("/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data16_13TeV/20160803/physics_25ns_20.7.lumicalc.OflLumi-13TeV-005.root");
+  TTree* t1 = (TTree*)f1.Get("LumiMetaData");
+  TH1* h1 = new TH1D("h1","h1",1,-0.5,0.5);
+  t1->Draw("0>>h1","IntLumi*(RunNbr==297730&&AvergeInteractionPerXing>=(24*1.09)&&AvergeInteractionPerXing<(25*1.09))");
+  TFile f2("/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/PileupReweighting/ilumicalc_histograms_HLT_e12_lhvloose_nod0_L1EM10VH_297730-304494_OflLumi-13TeV-005.root");
+  TTree* t2 = (TTree*)f2.Get("LumiMetaData");
+  TH1* h2 = new TH1D("h2","h2",1,-0.5,0.5);
+  t2->Draw("0>>h2","IntLumi*(RunNbr==297730&&AvergeInteractionPerXing>=(24*1.09)&&AvergeInteractionPerXing<(25*1.09))");
+  
+  std::cout << "Expected run-dependent DataWeight  = " << h1->Integral()/h2->Integral() << std::endl;
+  std::cout << prwTool->expert()->GetDataWeight( 297730 , "HLT_e12_lhvloose_nod0_L1EM10VH", 24.5,true) << std::endl; 
+  if(! ( fabs(prwTool->expert()->GetDataWeight( 297730 , "HLT_e12_lhvloose_nod0_L1EM10VH", 24.5, true)  - (h1->Integral()/h2->Integral()) ) < 1e-3) ) {
+     throw std::runtime_error("data weight not expected value");
+  }
+//   
   //in this version 4.0 onwards, trigger bits default to assuming the trigger passed
   
   prwTool->expert()->SetTriggerBit("HLT_e12_lhvloose_nod0_L1EM10VH" , 1);
diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/ut_PRWExample_test.cxx b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/ut_PRWExample_test.cxx
index 011b328469acf5d8e60070dfdd9cc1bc8e46b077..71ae324a7cf009141684f07504c43cc2fb5d1980 100644
--- a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/ut_PRWExample_test.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/test/ut_PRWExample_test.cxx
@@ -7,7 +7,7 @@
 
 void generateTestFiles() {
    //create a 'dummy' lumicalc file, with only a few runs, with a few lumiblocks 
-   TFile l("dummy.None.lumicalc.root","RECREATE");
+   TFile l("example.dummy.None.lumicalc.root","RECREATE");
    TTree *t = new TTree("LumiMetaData","LumiMetaData");
    UInt_t runNbr=0;Float_t ps1=1;Float_t ps2=1; Float_t ps3=1;UInt_t lbn=0;Float_t intLumi=0;Float_t mu=0;
    t->Branch("RunNbr",&runNbr);t->Branch("L1Presc",&ps1);t->Branch("L2Presc",&ps2);t->Branch("L3Presc",&ps3);t->Branch("LBStart",&lbn);t->Branch("IntLumi",&intLumi);t->Branch("AvergeInteractionPerXing",&mu);
@@ -33,7 +33,7 @@ void generateTestFiles() {
    g.Fill(101,2002,1,2.5);
    g.Fill(101,2002,1,3.5);
 
-   g.WriteToFile("dummy1.prw.root");
+   g.WriteToFile("example.dummy1.prw.root");
 
 }
 
@@ -64,8 +64,8 @@ int main() {
 
    //for the example we have to generate a test file
    asg::AnaToolHandle<CP::IPileupReweightingTool> prwTool("CP::PileupReweightingTool/prw");
-   ANA_CHECK( prwTool.setProperty( "ConfigFiles", std::vector<std::string>({"dummy1.prw.root"}) ) );
-   ANA_CHECK( prwTool.setProperty( "LumiCalcFiles",  std::vector<std::string>({"dummy.None.lumicalc.root"}) ) );
+   ANA_CHECK( prwTool.setProperty( "ConfigFiles", std::vector<std::string>({"example.dummy1.prw.root"}) ) );
+   ANA_CHECK( prwTool.setProperty( "LumiCalcFiles",  std::vector<std::string>({"example.dummy.None.lumicalc.root"}) ) );
    ANA_CHECK( prwTool.setProperty( "UseMultiPeriods",true) ); //channel 2000 has periods 100 and 101
    ANA_CHECK( prwTool.initialize() );
 
diff --git a/PhysicsAnalysis/CommonTools/ExpressionEvaluation/ExpressionEvaluation/StackElement.icc b/PhysicsAnalysis/CommonTools/ExpressionEvaluation/ExpressionEvaluation/StackElement.icc
index e2ad46013e502e332a8d7f0b5be41b6678c21f19..309b6b000b72c8373cfb6300906fe45026cda77a 100644
--- a/PhysicsAnalysis/CommonTools/ExpressionEvaluation/ExpressionEvaluation/StackElement.icc
+++ b/PhysicsAnalysis/CommonTools/ExpressionEvaluation/ExpressionEvaluation/StackElement.icc
@@ -68,7 +68,7 @@ namespace ExpressionParsing {
          return m_vecDoubleVal.size();
          break;
 
-      case SE_INT:  [[fallthrough]]
+      case SE_INT:  [[fallthrough]] ;
       case SE_DOUBLE:
          return 1; // @TOOD 0?
          break;
diff --git a/PhysicsAnalysis/CommonTools/ExpressionEvaluation/Root/StackElement.cxx b/PhysicsAnalysis/CommonTools/ExpressionEvaluation/Root/StackElement.cxx
index 236f48671dc74c5f8c237497f71ecec181610711..da6f0a246a8e23076dc051e1348f29ca172dec7f 100644
--- a/PhysicsAnalysis/CommonTools/ExpressionEvaluation/Root/StackElement.cxx
+++ b/PhysicsAnalysis/CommonTools/ExpressionEvaluation/Root/StackElement.cxx
@@ -449,7 +449,7 @@ namespace ExpressionParsing {
       for (std::size_t idx=0; idx < a.size(); ++idx) {
          a[idx] = helper.compare(a[idx],b[idx]);
       }
-      return a;
+      return std::vector<int>(std::move(a));
    }
 
    template <class T_CompHelper>
@@ -459,7 +459,7 @@ namespace ExpressionParsing {
       for (std::size_t idx=0; idx < a.size(); ++idx) {
          b[idx] = helper.compare(a[idx],b[idx]);
       }
-      return b;
+      return std::vector<int>(std::move(b));
    }
 
    template <class T_CompHelper>
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/ExtendedJetCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/ExtendedJetCommon.py
index e205b87b638aadb378e9f0fec5ba9a8b2bec5627..c6ec6b1a99dce19e309cb2bf1ecefcd09795c212 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/ExtendedJetCommon.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/ExtendedJetCommon.py
@@ -663,6 +663,73 @@ def addRscanJets(jetalg,radius,inputtype,sequence,outputlist):
             addStandardJets(jetalg, radius, "LCTopo", mods="lctopo_ungroomed",
                             ghostArea=0.01, ptmin=2000, ptminFilter=7000, calibOpt="none", algseq=sequence, outputGroup=outputlist)
 
+##################################################################
+
+def addConstModJets(jetalg,radius,inputtype,constmods,sequence,outputlist,customVxColl="",
+                    addGetters=None, **kwargs):
+
+    if len(constmods)>0:
+        extjetlog.info("Building jet collection with modifier sequence {0}".format(constmods))
+    if customVxColl:
+        extjetlog.info("Building jet collection with custom vx collection {0}".format(customVxColl))
+
+    constmodstr = "".join(constmods)
+    if customVxColl and "CustomVtx" not in inputtype:
+        inputtype=inputtype+"CustomVtx"
+    jetname = "{0}{1}{2}{3}{4}Jets".format(jetalg,int(radius*10),constmodstr,inputtype,customVxColl)
+    algname = "jetalg"+jetname
+
+    # Avoid scheduling twice
+    if hasattr(sequence,algname):
+        extjetlog.warning("Sequence {0} already has an instance of const mod jet alg {1}".format(sequence,algname))
+        return
+
+    from JetRecConfig import ConstModHelpers
+    from JetRecConfig.JetDefinition import xAODType, JetConstit
+
+    if inputtype == "EMTopo":
+        constit = JetConstit( xAODType.CaloCluster, ["EM","Origin"])
+    elif inputtype == "LCTopo":
+        constit = JetConstit( xAODType.CaloCluster, ["LC","Origin"])
+    elif inputtype == "EMPFlow":
+        constit = JetConstit( xAODType.ParticleFlow )
+
+    constit.modifiers += constmods
+
+    constitalg = ConstModHelpers.getConstitModAlg(constit)
+    if not hasattr(sequence, constitalg.name()):
+        sequence += constitalg
+
+    # Get the PseudoJetGetter
+    from JetRecConfig import JetRecConfig
+    constitpjalg = JetRecConfig.getConstitPJGAlg( constit )
+    if not hasattr(sequence,constitpjalg.name()):
+        sequence += constitpjalg
+
+    getterbase = inputtype.lower()
+    if inputtype == "PFlowCustomVtx": getterbase = "empflow_reduced"
+
+    getters = [constitpjalg]+list(jtm.gettersMap[getterbase])[1:]
+
+    if addGetters:
+        getters += addGetters
+
+    suffix = customVxColl+constmodstr
+
+    # Pass the configuration to addStandardJets
+    # The modifiers will be taken from the
+    jetfindargs = {"jetalg":        jetalg,
+                   "rsize":         radius,
+                   "inputtype":     inputtype,
+                   "customGetters": getters,
+                   "namesuffix":    suffix,
+                   "algseq":        sequence,
+                   "outputGroup":   outputlist
+                   }
+    jetfindargs.update(kwargs)
+
+    addStandardJets(**jetfindargs)
+
 ##################################################################
 # Helper to add origin corrected clusters 
 ##################################################################
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JetCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JetCommon.py
index cc2dd97d61949111caf1928968077e239e908de3..1fffbcfe03d18fc54349e02dab6806e6cd5c1d92 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JetCommon.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JetCommon.py
@@ -27,7 +27,7 @@ DFJetAlgs = {}
 
 ##################################################################
 # Schedule the augmentation of a flag to label events with large
-# EMEC-IW Noise based on the presence of many bad quality clusters 
+# EMEC-IW Noise based on the presence of many bad quality clusters
 ##################################################################
 
 if hasattr(DerivationFrameworkJob,"BadBatmanAugmentation"):
@@ -41,7 +41,7 @@ else:
         DerivationFrameworkJob += batmanaug
         batmanaugtool = None
         from AthenaCommon.AppMgr import ToolSvc
-        # create and add the tool to the alg if needed                                                                                                                                                      
+        # create and add the tool to the alg if needed
         if hasattr(ToolSvc,"BadBatmanAugmentationTool"):
             batmanaugtool = getattr(ToolSvc,"BadBatmanAugmentationTool")
         else:
@@ -100,17 +100,20 @@ def addGhostAssociation(DerivationFrameworkJob):
 
 ##################################################################
 
-def reCreatePseudoJets(jetalg, rsize, inputtype, variableRMassScale=-1.0, variableRMinRadius=-1.0, algseq=None):
+def reCreatePseudoJets(jetalg, rsize, inputtype, variableRMassScale=-1.0, variableRMinRadius=-1.0, algseq=None, constmods=[]):
     """Return a list of tools (possibly empty) to be run in a jetalg. These tools will make sure PseudoJets will be associated
     to the container specified by the input arguments.    
     """
     
     from JetRec.JetRecStandard import jtm
     from JetRec.JetRecUtils import buildJetContName
-    jetContName = buildJetContName(jetalg, rsize, inputtype, variableRMassScale, variableRMinRadius)
+    constmodstr = "".join(constmods)
+    inputname = inputtype+constmodstr
+    label = inputtype + constmodstr
+    jetContName = buildJetContName(jetalg, rsize, inputname, variableRMassScale, variableRMinRadius)
 
     # Set default for the arguments to be passd to addJetFinder
-    finderArgs = dict( modifiersin= [], consumers = [], ghostArea= 0.01 , ptmin=40000, )
+    finderArgs = dict( modifiersin= [], consumers = [], ghostArea= 0.01 , ptmin=40000, constmods=constmods, )
     
     # We do things differently if the container already exists in the input
     from RecExConfig.AutoConfiguration import IsInInputFile
@@ -165,22 +168,54 @@ def reCreatePseudoJets(jetalg, rsize, inputtype, variableRMassScale=-1.0, variab
         #finderArgs['ghostArea'] =0  ## Cannot afford ghost area calculation for variable-R jets (for now)
     
     # map the input to the jtm code for PseudoJetGetter
-    getterMap = dict( LCTopo = 'lctopo', EMTopo = 'emtopo', EMPFlow = 'empflow', EMCPFlow = 'emcpflow', Truth='truth', TruthWZ='truthwz', PV0Track='pv0track')
+    getterMap = dict( LCTopo = 'lctopo', EMTopo = 'emtopo', EMPFlow = 'empflow', EMCPFlow = 'emcpflow', 
+                      Truth='truth', TruthWZ='truthwz', TruthDressedWZ='truthdressedwz', TruthCharged='truthcharged',
+                      PV0Track='pv0track')
     # create the finder for the temporary collection.
 
-    for getter in jtm.gettersMap[getterMap[inputtype]]:
-        if getter not in jtm.allGetters:
+    getters = getterMap[inputtype]
+
+    for getter in jtm.gettersMap[getters]:
+        if not hasattr(algseq, getter.name()):
             algseq += getter
-            jtm.allGetters += getter
 
-    tmpFinderTool= jtm.addJetFinder(tmpName, jetalg, rsize, getterMap[inputtype] ,
+    if len(constmods) > 0:
+        finderArgs['modifiersin'] = []
+
+        from JetRecConfig import ConstModHelpers
+        from JetRecConfig.JetDefinition import xAODType, JetConstit
+
+        if inputtype == "EMTopo":
+            constit = JetConstit( xAODType.CaloCluster, ["EM","Origin"])
+        elif inputtype == "LCTopo":
+            constit = JetConstit( xAODType.CaloCluster, ["LC","Origin"])
+        elif inputtype == "EMPFlow":
+            constit = JetConstit( xAODType.ParticleFlow )
+
+        constit.modifiers += constmods
+
+        constitalg = ConstModHelpers.getConstitModAlg(constit)
+        if not hasattr(algseq, constitalg.name()):
+            algseq += constitalg
+
+        from JetRecConfig import JetRecConfig
+        constitpjalg = JetRecConfig.getConstitPJGAlg( constit )
+        if not hasattr(algseq, constitpjalg.name()):
+            algseq += constitpjalg
+
+        getterbase = inputtype.lower()
+        getters = [constitpjalg]+list(jtm.gettersMap[getterbase])[1:]
+
+    tmpFinderTool= jtm.addJetFinder(tmpName, jetalg, rsize, getters,
                                     **finderArgs   # pass the prepared arguments
                                     )
     return [tmpFinderTool]
 
+##################################################################
+
 def buildGenericGroomAlg(jetalg, rsize, inputtype, groomedName, jetToolBuilder,
                          includePreTools=False, algseq=None, outputGroup="CustomJets",
-                         writeUngroomed=False, variableRMassScale=-1.0, variableRMinRadius=-1.0):
+                         writeUngroomed=False, variableRMassScale=-1.0, variableRMinRadius=-1.0, constmods=[]):
     algname = "jetalg"+groomedName[:-4]
 
     from RecExConfig.AutoConfiguration import IsInInputFile
@@ -192,7 +227,10 @@ def buildGenericGroomAlg(jetalg, rsize, inputtype, groomedName, jetToolBuilder,
         return
 
     from JetRec.JetRecUtils import buildJetContName
-    ungroomedName = buildJetContName(jetalg, rsize, inputtype, variableRMassScale, variableRMinRadius)
+    constmodstr = "".join(constmods)
+    inputname = inputtype+constmodstr
+    label = inputtype + constmodstr
+    ungroomedName = buildJetContName(jetalg, rsize, inputname, variableRMassScale, variableRMinRadius)
     ungroomedalgname = "jetalg"+ungroomedName[:-4] # Remove "Jets" from name
 
     # add these groomed jets to the output (use setdefault() to constuct the list if not existing yet)
@@ -207,14 +245,15 @@ def buildGenericGroomAlg(jetalg, rsize, inputtype, groomedName, jetToolBuilder,
         finderalg = getattr(algseq, ungroomedalgname)
         dfjetlog.warning( "Algsequence "+algseq.name()+" already has an instance of "+ungroomedalgname )
     elif ungroomedalgname in DFJetAlgs:
-        dfjetlog.info( "Added jet finder"+ ungroomedalgname+" to sequence"+ algseq.name() )
+        dfjetlog.info( "Added jet finder "+ ungroomedalgname+" to sequence"+ algseq.name() )
         finderalg = DFJetAlgs[ungroomedalgname]
         algseq += DFJetAlgs[ungroomedalgname]
     else:
         # 1. make sure we have pseudo-jet in our original container
         # this returns a list of the needed tools to do so.
-        jetalgTools = reCreatePseudoJets(jetalg, rsize, inputtype, variableRMassScale, variableRMinRadius, algseq)
-        if includePreTools:
+        jetalgTools = reCreatePseudoJets(jetalg, rsize, inputtype, variableRMassScale, variableRMinRadius, algseq, constmods=constmods)
+
+        if includePreTools and jetFlags.useTracks() and not "Truth" in inputtype:
             # enable track ghost association and JVF
             jetalgTools =  [jtm.tracksel, jtm.tvassoc] + jetalgTools 
 
@@ -238,10 +277,11 @@ def buildGenericGroomAlg(jetalg, rsize, inputtype, groomedName, jetToolBuilder,
 ##################################################################
 def addTrimmedJets(jetalg, rsize, inputtype, rclus=0.3, ptfrac=0.05, mods="groomed",
                    includePreTools=False, algseq=None, outputGroup="Trimmed",
-                   writeUngroomed=False, variableRMassScale=-1.0, variableRMinRadius=-1.0):
+                   writeUngroomed=False, variableRMassScale=-1.0, variableRMinRadius=-1.0, constmods=[]):
     from JetRec.JetRecUtils import buildJetContName
     from JetRec.JetRecUtils import buildJetAlgName
-    trimmedName = "{0}{1}TrimmedPtFrac{2}SmallR{3}Jets".format(buildJetAlgName(jetalg, rsize, variableRMassScale, variableRMinRadius),inputtype,int(ptfrac*100),int(rclus*100))
+    inputname = inputtype + "".join(constmods)
+    trimmedName = "{0}{1}TrimmedPtFrac{2}SmallR{3}Jets".format(buildJetAlgName(jetalg, rsize, variableRMassScale, variableRMinRadius),inputname,int(ptfrac*100),int(rclus*100))
 
     # a function dedicated to build Trimmed jet :
     def trimToolBuilder( name, inputJetCont):
@@ -254,14 +294,15 @@ def addTrimmedJets(jetalg, rsize, inputtype, rclus=0.3, ptfrac=0.05, mods="groom
     return buildGenericGroomAlg(jetalg, rsize, inputtype, trimmedName, trimToolBuilder,
                                 includePreTools, algseq, outputGroup,
                                 writeUngroomed=writeUngroomed,
-                                variableRMassScale=variableRMassScale, variableRMinRadius=variableRMinRadius)
+                                variableRMassScale=variableRMassScale, variableRMinRadius=variableRMinRadius, constmods=constmods)
 
 
 ##################################################################
 def addPrunedJets(jetalg, rsize, inputtype, rcut=0.50, zcut=0.15, mods="groomed",
                   includePreTools=False, algseq=None, outputGroup="Pruned",
-                  writeUngroomed=False):
-    prunedName = "{0}{1}{2}PrunedR{3}Z{4}Jets".format(jetalg,str(int(rsize*10)),inputtype,int(rcut*100),int(zcut*100))
+                  writeUngroomed=False, constmods=[]):
+    inputname = inputtype + "".join(constmods)
+    prunedName = "{0}{1}{2}PrunedR{3}Z{4}Jets".format(jetalg,str(int(rsize*10)),inputname,int(rcut*100),int(zcut*100))
 
     # a function dedicated to build Pruned jet :
     def pruneToolBuilder( name, inputJetCont):
@@ -273,14 +314,15 @@ def addPrunedJets(jetalg, rsize, inputtype, rcut=0.50, zcut=0.15, mods="groomed"
     # pass the trimmedName and our specific trimming tool builder to the generic function :
     return buildGenericGroomAlg(jetalg, rsize, inputtype, prunedName, pruneToolBuilder,
                                 includePreTools, algseq, outputGroup,
-                                writeUngroomed=writeUngroomed)
+                                writeUngroomed=writeUngroomed, constmods=constmods)
 
 
 ##################################################################
 def addFilteredJets(jetalg, rsize, inputtype, mumax=1.0, ymin=0.15, mods="groomed",
                     includePreTools=False, algseq=None, outputGroup="Filtered",
-                    writeUngroomed=False):
-    filteredName = "{0}{1}{2}BDRSFilteredMU{3}Y{4}Jets".format(jetalg,int(rsize*10),inputtype,int(mumax*100),int(ymin*100))
+                    writeUngroomed=False, constmods=[]):
+    inputname = inputtype + "".join(constmods)
+    filteredName = "{0}{1}{2}BDRSFilteredMU{3}Y{4}Jets".format(jetalg,int(rsize*10),inputname,int(mumax*100),int(ymin*100))
 
     # a function dedicated to build Filtered jet :
     def filterToolBuilder( name, inputJetCont):
@@ -292,15 +334,81 @@ def addFilteredJets(jetalg, rsize, inputtype, mumax=1.0, ymin=0.15, mods="groome
     # pass the trimmedName and our specific trimming tool builder to the generic function :
     return buildGenericGroomAlg(jetalg, rsize, inputtype, filteredName, filterToolBuilder,
                                 includePreTools, algseq, outputGroup,
-                                writeUngroomed=writeUngroomed)
+                                writeUngroomed=writeUngroomed, constmods=constmods)
 
 
 ##################################################################
 
+def addSoftDropJets(jetalg, rsize, inputtype, beta=0, zcut=0.1, mods="groomed",
+                    includePreTools=False, algseq=None, outputGroup="SoftDrop",
+                    writeUngroomed=False, constmods=[]):
+
+    inputname = inputtype + "".join(constmods)
+    softDropName = "{0}{1}{2}SoftDropBeta{3}Zcut{4}Jets".format(jetalg,int(rsize*10),inputname,int(beta*100),int(zcut*100))
+
+    # a function dedicated to build SoftDrop jet:
+    def softDropToolBuilder( name, inputJetCont):
+        from JetRec.JetRecStandard import jtm
+        if name in jtm.tools: return jtm.tools[name]
+        else: return jtm.addJetSoftDrop( name, beta=beta, zcut=zcut, r0=rsize, input=inputJetCont, modifiersin=mods )
+
+    dfjetlog.info( "Configuring soft drop jets :  "+softDropName )
+    #pass the softDropName and our specific soft drop tool to the generic function:
+    return buildGenericGroomAlg(jetalg, rsize, inputtype, softDropName, softDropToolBuilder,
+                                includePreTools, algseq, outputGroup,
+                                writeUngroomed=writeUngroomed, constmods=constmods)
+
+################################################################## 
+
+def addRecursiveSoftDropJets(jetalg, rsize, inputtype, beta=0, zcut=0.1, N=-1, mods="groomed",
+                             includePreTools=False, algseq=None, outputGroup="SoftDrop",
+                             writeUngroomed=False, constmods=[]):
+    inputname = inputtype + "".join(constmods)
+    if N >= 0:
+      softDropName = "{0}{1}{2}RecursiveSoftDropBeta{3}Zcut{4}N{5}Jets".format(jetalg,int(rsize*10),inputname,int(beta*100),int(zcut*100), int(N))
+    if N < 0:
+      softDropName = "{0}{1}{2}RecursiveSoftDropBeta{3}Zcut{4}NinfJets".format(jetalg,int(rsize*10),inputname,int(beta*100),int(zcut*100))
+
+
+    # a function dedicated to build SoftDrop jet:
+    def recursiveSoftDropToolBuilder( name, inputJetCont):
+        from JetRec.JetRecStandard import jtm
+        if name in jtm.tools: return jtm.tools[name]
+        else: return jtm.addJetRecursiveSoftDrop( name, beta=beta, zcut=zcut, N=N, r0=rsize, input=inputJetCont, modifiersin=mods )
+
+    dfjetlog.info( "Configuring soft drop jets :  "+softDropName )
+    #pass the softDropName and our specific soft drop tool to the generic function:
+    return buildGenericGroomAlg(jetalg, rsize, inputtype, softDropName, recursiveSoftDropToolBuilder,
+                                includePreTools, algseq, outputGroup,
+                                writeUngroomed=writeUngroomed, constmods=constmods)
+
+################################################################## 
+
+def addBottomUpSoftDropJets(jetalg, rsize, inputtype, beta=0, zcut=0.1, mods="groomed",
+                            includePreTools=False, algseq=None, outputGroup="SoftDrop",
+                            writeUngroomed=False, constmods=[]):
+    inputname = inputtype + "".join(constmods)
+    softDropName = "{0}{1}{2}BottomUpSoftDropBeta{3}Zcut{4}Jets".format(jetalg,int(rsize*10),inputname,int(beta*100),int(zcut*100))
+
+    # a function dedicated to build SoftDrop jet:
+    def bottomUpSoftDropToolBuilder( name, inputJetCont):
+        from JetRec.JetRecStandard import jtm
+        if name in jtm.tools: return jtm.tools[name]
+        else: return jtm.addJetBottomUpSoftDrop( name, beta=beta, zcut=zcut, r0=rsize, input=inputJetCont, modifiersin=mods )
+
+    dfjetlog.info( "Configuring soft drop jets :  "+softDropName )
+    #pass the softDropName and our specific soft drop tool to the generic function:
+    return buildGenericGroomAlg(jetalg, rsize, inputtype, softDropName, bottomUpSoftDropToolBuilder,
+                                includePreTools, algseq, outputGroup,
+                                writeUngroomed=writeUngroomed, constmods=constmods)
+
+################################################################## 
+
 def addStandardJets(jetalg, rsize, inputtype, ptmin=0., ptminFilter=0.,
                     mods="default", calibOpt="none", ghostArea=0.01,
                     algseq=None, namesuffix="",
-                    outputGroup="CustomJets"):
+                    outputGroup="CustomJets", customGetters=None, pretools = [], constmods = [],
+                    overwrite=False):
 
     jetnamebase = "{0}{1}{2}{3}".format(jetalg,int(rsize*10),inputtype,namesuffix)
     jetname = jetnamebase+"Jets"
@@ -312,7 +420,7 @@ def addStandardJets(jetalg, rsize, inputtype, ptmin=0., ptminFilter=0.,
     if algseq is None:
         dfjetlog.warning( "No algsequence passed! Will not schedule "+algname )
         return
-    elif IsInInputFile("xAOD::JetContainer",jetname):
+    elif IsInInputFile("xAOD::JetContainer",jetname) and not overwrite:
         dfjetlog.warning( "Collection  "+jetname+" is already in input AOD!" )
         return        
     elif algname in DFJetAlgs:
@@ -344,23 +452,33 @@ def addStandardJets(jetalg, rsize, inputtype, ptmin=0., ptminFilter=0.,
         finderArgs['modifiersin'] = mods
         finderArgs['calibOpt'] = calibOpt
         print ("mods in:", finderArgs['modifiersin'])
-        #finderArgs.pop('modifiersin') # leave the default modifiers.
+        if overwrite:
+            dfjetlog.info("Will overwrite AOD version of "+jetname)
+            finderArgs['overwrite']=True
     
         # map the input to the jtm code for PseudoJetGetter
-        getterMap = dict( LCTopo = 'lctopo', EMTopo = 'emtopo', EMPFlow = 'empflow', EMCPFlow = 'emcpflow', Truth='truth', TruthWZ='truthwz', PV0Track='pv0track')
+        getterMap = dict( LCTopo = 'lctopo', EMTopo = 'emtopo', EMPFlow = 'empflow', EMCPFlow = 'emcpflow', 
+                          Truth = 'truth',  TruthWZ = 'truthwz', TruthDressedWZ = 'truthdressedwz', TruthCharged = 'truthcharged',
+                          PV0Track='pv0track')
         # create the finder for the temporary collection.
 
-        for getter in jtm.gettersMap[getterMap[inputtype]]:
-            if getter not in jtm.allGetters:
-                algseq += getter
-                jtm.allGetters += getter
+        if customGetters is None:
+            inGetter = getterMap[inputtype]
+            for getter in jtm.gettersMap[inGetter]:
+                if not hasattr(algseq, getter.name()):
+                    algseq += getter
+        else:
+            inGetter = customGetters
+            for getter in customGetters:
+                if not hasattr(algseq, getter.name()):
+                    algseq += getter
 
-        finderTool= jtm.addJetFinder(jetname, jetalg, rsize, getterMap[inputtype] ,
+        finderTool= jtm.addJetFinder(jetname, jetalg, rsize, inGetter, constmods=constmods,
                                      **finderArgs   # pass the prepared arguments
                                      )
 
         from JetRec.JetRecConf import JetAlgorithm
-        alg = JetAlgorithm(algname, Tools = [finderTool])
+        alg = JetAlgorithm(algname, Tools = pretools+[finderTool])
         dfjetlog.info( "Added "+algname+" to sequence "+algseq.name() )
         algseq += alg
         DFJetAlgs[algname] = alg;
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/METTriggerDerivationContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/METTriggerDerivationContent.py
new file mode 100644
index 0000000000000000000000000000000000000000..368277ad4a23c477c38e1a0ae77ec73dbd82329b
--- /dev/null
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/METTriggerDerivationContent.py
@@ -0,0 +1,173 @@
+from DerivationFrameworkCore.DerivationFrameworkMaster import *
+from DerivationFrameworkJetEtMiss.JetCommon import *
+from DerivationFrameworkJetEtMiss.ExtendedJetCommon import *
+from DerivationFrameworkJetEtMiss.METCommon import *
+
+from DerivationFrameworkCore.ThinningHelper import ThinningHelper
+from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning, DerivationFramework__MuonTrackParticleThinning, DerivationFramework__EgammaTrackParticleThinning, DerivationFramework__TauTrackParticleThinning
+from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
+from AthenaCommon.SystemOfUnits import GeV
+from AthenaCommon.AppMgr import ToolSvc
+from DerivationFrameworkJetEtMiss.PFlowCommon import applyPFOAugmentation
+
+class METTriggerDerivationContentManager(object):
+    """ Helper class to assemble MET trigger derivation content """
+    def __init__(
+            self, stream_name, stream, common_prefix="DFMETTrig",
+            jet_algorithms = ["AntiKt4EMTopo", "AntiKt4EMPFlow"],
+            track_threshold = 10*GeV, track_sel=None, all_vars=None):
+        """ Create the manager
+
+        Parameters
+        ------------
+        stream_name: The name of the stream (e.g JETM10)
+        stream: The stream object returned by MSMgr.NewPoolRootStream
+        common_prefix: The prefix used by shared tools and decorations to prevent duplication
+        jet_algorithms: The different jet algorithms (+ associated MET containers) to write
+        track_threshold: Write out all tracks with pT above this threshold (in MeV)
+        track_sel: The track selection string
+        all_vars: Extra containers to add to 'AllVariables'
+        """
+        self.stream_name = stream_name
+        self._common_prefix = common_prefix
+        self.track_threshold = track_threshold
+        track_sel = track_sel
+        self.track_sel = track_sel
+        self.all_vars = [] if all_vars is None else all_vars
+        # Create the tools
+        if any(x in self.all_vars for x in ("JetETMissNeutralParticleFlowObjects", "JetETMissChargedParticleFlowObjects") ):
+            applyPFOAugmentation()
+        self._make_slimming_tools(stream, jet_algorithms)
+        self._make_augmentation_tools(stream)
+        self._make_thinning_tools(stream)
+
+    @classmethod
+    def make_loose_manager(cls, stream_name, stream):
+        return cls(
+                stream_name, stream, track_threshold=1*GeV, track_sel="Loose",
+                all_vars = [
+                    "HLT_xAOD__MuonContainer_MuonEFInfo",
+                    "CaloCalTopoClusters",
+                    "JetETMissChargedParticleFlowObjects",
+                    "JetETMissNeutralParticleFlowObjects",
+                    "Kt4EMPFlowEventShape"])
+
+    @classmethod
+    def make_tight_manager(cls, stream_name, stream):
+        return cls(stream_name, stream, track_threshold=10*GeV)
+
+    @property
+    def common_prefix(self):
+        return self._common_prefix
+
+    def make_kernel(self, *skimming_tools):
+        return CfgMgr.DerivationFramework__DerivationKernel(
+                self.stream_name + "Kernel",
+                AugmentationTools = self.augmentation_tools,
+                SkimmingTools = list(skimming_tools),
+                ThinningTools = self.thinning_tools)
+
+
+    def _mk_common_tool(self, cls, name, **kwargs):
+        """ Create a common tool, if it isn't already in the ToolSvc """
+        global ToolSvc
+        # Resolve the full name
+        if not name.startswith(self.common_prefix):
+            name = self.common_prefix + name
+        try:
+            return getattr(ToolSvc, name)
+        except AttributeError:
+            ToolSvc += cls(name, **kwargs)
+            return getattr(ToolSvc, name)
+
+    def _make_slimming_tools(self, stream, jet_algorithms):
+        self.slimming_helper = SlimmingHelper(self.stream_name + "SlimmingHelper")
+        smart_collections = ["Electrons", "Muons", "Photons", "TauJets", "PrimaryVertices", "InDetTrackParticles"]
+        smart_collections += ["{0}Jets".format(a) for a in jet_algorithms]
+        smart_collections += ["MET_Reference_{0}".format(a) for a in jet_algorithms]
+        if "AntiKt4EMTopo" in jet_algorithms:
+            smart_collections += [
+                    "AntiKt4EMTopoJets_BTagging201810", "BTagging_AntiKt4EMTopo_201810"]
+        if "AntiKt4EMPFlow" in jet_algorithms:
+            smart_collections += [
+                    "AntiKt4EMPFlowJets_BTagging201810", "BTagging_AntiKt4EMPFlow_201810",
+                    "AntiKt4EMPFlowJets_BTagging201903", "BTagging_AntiKt4EMPFlow_201903"]
+        self.slimming_helper.SmartCollections = smart_collections
+        self.slimming_helper.ExtraVariables = [
+                "{0}Jets.Timing".format(a) for a in jet_algorithms]
+        self.slimming_helper.AllVariables = [
+                "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET",
+                "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_mht",
+                "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_topocl_PS",
+                "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_topocl_PUC",
+                "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_topocl",
+                "LVL1EnergySumRoI",
+                "LVL1JetRoIs",
+                "LVL1JetEtRoI"] \
+                        + ["MET_Core_{0}".format(a) for a in jet_algorithms] \
+                        + ["METAssoc_{0}".format(a) for a in jet_algorithms] \
+                        + self.all_vars
+
+    def _make_augmentation_tools(self, stream):
+        """ Create any common augmentation tools """
+        self.augmentation_tools = []
+        if self.track_sel is not None:
+            tool = self._mk_common_tool(
+                    CfgMgr.DerivationFramework__InDetTrackSelectionToolWrapper,
+                    "{0.track_sel}TrackSelWrapper".format(self),
+                    ContainerName = "InDetTrackParticles",
+                    DecorationName = self.common_prefix + self.track_sel)
+            tool.TrackSelectionTool.CutLevel = self.track_sel
+            self.augmentation_tools.append(tool)
+            self.slimming_helper.ExtraVariables.append(
+                    "InDetTrackParticles." + tool.DecorationName)
+        tva_tool = self._mk_common_tool(
+                CfgMgr.DerivationFramework__TVAAugmentationTool,
+                "NominalTVAAugmentationTool",
+                LinkName = self.common_prefix+"NominalTVA",
+                TrackName = "InDetTrackParticles",
+                TVATool = self._mk_common_tool(
+                    CfgMgr.CP__TrackVertexAssociationTool,
+                    "NominalTVATool",
+                    WorkingPoint="Nominal") )
+        self.augmentation_tools.append(tva_tool)
+        self.slimming_helper.ExtraVariables.append(
+            "{0.TrackName}.{0.LinkName}".format(tva_tool) )
+
+    def _make_thinning_tools(self, stream):
+        stream_name = self.stream_name
+        self.thinning_helper = ThinningHelper(stream_name+"ThinningHelper")
+        self.thinning_helper.AppendToStream(stream)
+        self.thinning_tools = []
+        tool = DerivationFramework__TrackParticleThinning(
+                stream_name + "TPThinningTool",
+                StreamName = stream_name, 
+                SelectionString = "InDetTrackParticles.pt > {0}*GeV".format(
+                    self.track_threshold) )
+        if self.track_sel is not None:
+            tool.SelectionString += " || InDetTrackParticles.{0.common_prefix}{0.track_sel}".format(self)
+        self.thinning_tools.append(tool)
+        self.thinning_tools += [
+                DerivationFramework__MuonTrackParticleThinning(
+                    stream_name + "MuonTPThinningTool",
+                    StreamName             = stream_name,
+                    MuonKey                = "Muons",
+                    InDetTrackParticlesKey = "InDetTrackParticles"),
+                DerivationFramework__EgammaTrackParticleThinning(
+                    stream_name + "ElectronTPThinningTool",
+                    StreamName             = stream_name,
+                    SGKey                  = "Electrons",
+                    InDetTrackParticlesKey = "InDetTrackParticles"),
+                DerivationFramework__EgammaTrackParticleThinning(
+                    stream_name + "PhotonTPThinningTool",
+                    StreamName             = stream_name,
+                    SGKey                  = "Photons",
+                    InDetTrackParticlesKey = "InDetTrackParticles"),
+                DerivationFramework__TauTrackParticleThinning(
+                    stream_name + "TauTPThinningTool",
+                    StreamName             = stream_name,
+                    TauKey                 = "TauJets",
+                    InDetTrackParticlesKey = "InDetTrackParticles")
+                ]
+        global ToolSvc
+        ToolSvc += self.thinning_tools
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/TriggerLists.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/TriggerLists.py
index 83a470027c31a3f2c30a677cc5038bf4785b8cb8..21387bca2b605931dfb744def71a8167a5f78509 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/TriggerLists.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/TriggerLists.py
@@ -1,320 +1,43 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+from TriggerMenu.api.TriggerAPI import TriggerAPI
+from TriggerMenu.api.TriggerEnums import TriggerPeriod, TriggerType
+
+# jet triggers (single Jets, prescaled and unprescaled)
+def jetTrig():
+	period2015tofuture = TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 | TriggerPeriod.y2018 | TriggerPeriod.future
+	period2017tofuture = TriggerPeriod.y2017 | TriggerPeriod.y2018 | TriggerPeriod.future
+	API_jetTrig = TriggerAPI.getActive(period2015tofuture, TriggerType.j_single)
+	# Large-radius multijet triggers
+	API_jetTrig += TriggerAPI.getActive(period2017tofuture,TriggerType.j_multi,matchPattern=".*_a10t_.*")
+	# Eta-intercalibration triggers (one central, one forward jet)
+	API_jetTrig += TriggerAPI.getActive(period2015tofuture,TriggerType.j_multi,matchPattern="HLT_j.*_320eta490")
+	return API_jetTrig
+
+# electron triggers (unprescaled)
+def single_el_Trig():
+	API_singleElTriggers = TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2015, TriggerType.el_single) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2016, TriggerType.el_single) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2017, TriggerType.el_single) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2018, TriggerType.el_single) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.future, TriggerType.el_single)
+	return API_singleElTriggers
+
+def multi_el_Trig():
+	API_multiElTriggers = TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2015, TriggerType.el_multi) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2016, TriggerType.el_multi) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2017, TriggerType.el_multi) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2018, TriggerType.el_multi) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.future, TriggerType.el_multi)
+	return API_multiElTriggers
+
+# single muon triggers (unprescaled)
+def single_mu_Trig():
+	API_singleMuTriggers = TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2015, TriggerType.mu_single) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2016, TriggerType.mu_single) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2017, TriggerType.mu_single) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2018, TriggerType.mu_single) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.future, TriggerType.mu_single)
+	return API_singleMuTriggers
+
+def multi_mu_Trig():
+	API_multiMuTriggers = TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2015, TriggerType.mu_multi) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2016, TriggerType.mu_multi) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2017, TriggerType.mu_multi) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2018, TriggerType.mu_multi) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.future, TriggerType.mu_multi)
+	return API_multiMuTriggers
+
+# xe triggers (unprescaled)
+def MET_Trig():
+	API_MET_Triggers = TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2015, TriggerType.xe) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2016, TriggerType.xe) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2017, TriggerType.xe) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.y2018, TriggerType.xe) + TriggerAPI.getLowestUnprescaled(TriggerPeriod.future, TriggerType.xe)
+	return API_MET_Triggers
+
+# photon triggers (prescaled and unprescaled)
+def single_photon_Trig():
+	API_singlePhotonTriggers = TriggerAPI.getActive(TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 | TriggerPeriod.y2018 | TriggerPeriod.future, TriggerType.g_single)
+	return API_singlePhotonTriggers
 
-# jet triggers
-jetTriggers = [
-# unprescaled
-'HLT_j360_320eta490',
-'HLT_j360_320eta490_jes',
-'HLT_j360_320eta490_lcw',
-'HLT_j360_320eta490_lcw_jes',
-'HLT_j360_320eta490_lcw_nojcalib',
-'HLT_j360_320eta490_nojcalib',
-'HLT_j360_a10_lcw_L1J100',
-'HLT_j360_a10_lcw_sub_L1J100',
-'HLT_j360_a10r_L1J100',
-'HLT_j380',
-'HLT_j380_jes',
-'HLT_j380_lcw',
-'HLT_j380_lcw_jes',
-'HLT_j380_lcw_nojcalib',
-'HLT_j380_nojcalib',
-'HLT_j400_a10_lcw_L1J100',
-'HLT_j400_a10r_L1J100',
-'HLT_j400_a10_lcw_L1J100',
-'HLT_j400_a10r_L1J100',
-'HLT_j400_a10r_L1J100',
-'HLT_j400_a10_lcw_L1J100',
-'HLT_j400',
-'HLT_j400_jes',
-'HLT_j400_lcw',
-'HLT_j400_lcw_jes',
-'HLT_j400_nojcalib',
-'HLT_j400_sub',
-'HLT_j420',
-'HLT_j420_jes',
-'HLT_j420_lcw',
-'HLT_j420_lcw_jes',
-'HLT_j420_lcw_nojcalib',
-'HLT_j420_nojcalib',
-'HLT_j420_a10_lcw_L1J100',
-'HLT_j420_a10_lcw_sub_L1J100',
-'HLT_j420_a10r_L1J100',
-'HLT_j440',
-'HLT_j460',
-'HLT_j460_a10_lcw_nojcalib_L1J100',
-'HLT_j460_a10_lcw_sub_L1J100',
-'HLT_j460_a10_nojcalib_L1J100',
-'HLT_j460_a10_sub_L1J100',
-'HLT_j460_a10r_L1J100',
-# prescaled
-'HLT_j0_perf_L1RD0_FILLED',
-'HLT_j15',
-'HLT_j15_320eta490',
-'HLT_j15_j15_320eta490',
-'HLT_j25',
-'HLT_j25_320eta490',
-'HLT_j25_j25_320eta490',
-'HLT_j35',
-'HLT_j35_320eta490',
-'HLT_j35_j35_320eta490',
-'HLT_j35_jes',
-'HLT_j35_lcw',
-'HLT_j35_lcw_jes',
-'HLT_j35_lcw_nojcalib',
-'HLT_j35_nojcalib',
-'HLT_j45',
-'HLT_j45_320eta490',
-'HLT_j45_L1RD0_FILLED',
-'HLT_j45_j45_320eta490',
-'HLT_j55',
-'HLT_j55_320eta490',
-'HLT_j60',
-'HLT_j60_280eta320',
-'HLT_j60_320eta490',
-'HLT_j60_L1RD0_FILLED',
-'HLT_j60_j60_320eta490',
-'HLT_j85',
-'HLT_j85_280eta320',
-'HLT_j85_280eta320_jes',
-'HLT_j85_280eta320_lcw',
-'HLT_j85_280eta320_lcw_jes',
-'HLT_j85_280eta320_lcw_nojcalib',
-'HLT_j85_280eta320_nojcalib',
-'HLT_j85_320eta490',
-'HLT_j85_L1RD0_FILLED',
-'HLT_j85_j85_320eta490',
-'HLT_j85_jes',
-'HLT_j100',
-'HLT_j110',
-'HLT_j110_320eta490',
-'HLT_j150',
-'HLT_j175',
-'HLT_j175_320eta490',
-'HLT_j175_320eta490_jes',
-'HLT_j175_320eta490_lcw',
-'HLT_j175_320eta490_lcw_jes',
-'HLT_j175_320eta490_lcw_nojcalib',
-'HLT_j175_320eta490_nojcalib',
-'HLT_j200',
-'HLT_j260',
-'HLT_j260_320eta490_jes',
-'HLT_j260_320eta490_lcw',
-'HLT_j260_320eta490_lcw_jes',
-'HLT_j260_320eta490_lcw_nojcalib',
-'HLT_j260_320eta490_nojcalib',
-'HLT_j260_a10_lcw_L1J75',
-'HLT_j260_a10_lcw_nojcalib_L1J75',
-'HLT_j260_a10_lcw_sub_L1J75',
-'HLT_j260_a10_nojcalib_L1J75',
-'HLT_j260_a10_sub_L1J75',
-'HLT_j260_a10r_L1J75',
-'HLT_j300',
-'HLT_j300_a10_lcw_L1J75',
-'HLT_j300_a10_sub_L1J75',
-'HLT_j300_a10r_L1J75',
-'HLT_j320',
-'HLT_j340',
-'HLT_j360',
-'HLT_j380',
-]
-
-# single electron triggers
-
-singleElTriggers = [
-'HLT_e26_lhtight_smooth_iloose',
-'HLT_e26_lhtight_smooth_ivarloose',
-'HLT_e26_lhtight_iloose',
-'HLT_e26_lhtight_ivarloose',
-'HLT_e26_lhtight_nod0_iloose',
-'HLT_e26_lhtight_nod0_ivarloose',
-'HLT_e26_lhtight_cutd0dphideta_iloose',
-'HLT_e28_lhtight_smooth_iloose',
-'HLT_e28_lhtight_smooth_ivarloose',
-'HLT_e28_lhtight_iloose',
-'HLT_e28_lhtight_ivarloose',
-'HLT_e28_lhtight_nod0_iloose',
-'HLT_e28_lhtight_nod0_ivarloose',
-'HLT_e28_lhtight_nod0_ringer_iloose',
-'HLT_e28_lhtight_nod0_ringer_ivarloose',
-'HLT_e60_lhmedium',
-'HLT_e60_lhmedium_nod0',
-'HLT_e60_lhmedium_L1EM24VHI ',
-'HLT_e60_lhmedium_nod0_L1EM24VHI ',
-'HLT_e60_lhmedium_cutd0dphideta',
-'HLT_e140_lhloose',
-'HLT_e140_lhloose_nod0 ',
-'HLT_e140_lhloose_L1EM24VHI ',
-'HLT_e140_lhloose_nod0_L1EM24VHI ',
-'HLT_e300_etcut ',
-'HLT_e26_lhtight_idperf',
-'HLT_e24_lhtight_iloose',
-'HLT_e24_lhtight_nod0_iloose',
-'HLT_e24_lhtight_ivarloose',
-'HLT_e24_lhtight_nod0_ivarloose',
-'HLT_e24_lhtight_cutd0dphideta_iloose			',
-'HLT_e17_lhloose_nod0_2e9_lhloose_nod0',
-'HLT_e24_lhmedium_iloose',
-'HLT_e24_lhmedium_ivarloose',
-'HLT_e24_lhmedium_nod0_iloose',
-'HLT_e24_lhmedium_nod0_ivarloose ',
-'HLT_e24_lhmedium_iloose_L1EM20VH',
-'HLT_e24_lhmedium_nod0_iloose_L1EM20VH',
-'HLT_e24_lhmedium_ivarloose_L1EM20VH',
-'HLT_e24_lhmedium_nod0_ivarloose_L1EM20VH',
-'HLT_e24_lhmedium_L1EM20VH',
-'HLT_e24_lhmedium_nod0_L1EM20VH',
-'HLT_e24_medium_iloose_L1EM20VH ',
-'HLT_e120_lhloose',
-'HLT_e120_lhloose_nod0',
-'HLT_e24_lhmedium_iloose_L1EM18VH',
-'HLT_e24_lhmedium_nod0_iloose_L1EM18VH',
-'HLT_e24_lhmedium_ivarloose_L1EM18VH',
-'HLT_e24_lhmedium_nod0_ivarloose_L1EM18VH',
-'HLT_e24_lhmedium_nod0_ringer_iloose',
-'HLT_e24_lhmedium_nod0_ringer_ivarloose',
-'HLT_e60_medium',
-'HLT_e60_medium_L1EM24VHI',
-]
-
-# single muon triggers
-
-singleMuTriggers = [
-'HLT_mu26_imedium',
-'HLT_mu26_ivarmedium',
-'HLT_mu50HLT_mu60_0eta105_msonly',
-'HLT_mu24_mu8noL1',
-'HLT_mu24_2mu4noL1',
-'HLT_mu22_2mu4noL1',
-'HLT_mu20_2mu4noL1',
-'HLT_mu22_mu8noL1',
-'HLT_mu24_imedium',
-'HLT_mu24_ivarmedium',
-'HLT_mu20_mu8noL1',
-'HLT_mu40',
-'HLT_mu50',
-'HLT_mu24_ivarloose',
-'HLT_mu24_iloose',
-'HLT_mu24_iloose_L1MU15',
-'HLT_mu24_ivarloose_L1MU15',
-'HLT_mu20_iloose_L1MU15',
-'HLT_mu20_ivarloose_L1MU15',
-]
-
-# xe triggers
-
-metTriggers = [
-'HLT_xe80_tc_lcw_L1XE50',
-'HLT_xe90_mht_L1XE50',
-'HLT_xe90_mht_wEFMu_L1XE50',
-'HLT_xe90_tc_lcw_L1XE50 ',
-'HLT_xe90_tc_lcw_wEFMu_L1XE50 ',
-'HLT_xe100',
-'HLT_xe100_L1XE50 ',
-'HLT_xe100_L1XE60',
-'HLT_xe100_mht_L1XE50',
-'HLT_xe100_mht_L1XE60',
-'HLT_xe100_mht_wEFMu_L1XE50',
-'HLT_xe100_tc_em_L1XE50',
-'HLT_xe100_tc_em_wEFMu_L1XE50',
-'HLT_xe100_tc_lcw_L1XE50 ',
-'HLT_xe100_tc_lcw_L1XE60',
-'HLT_xe100_tc_lcw_wEFMu_L1XE50 ',
-'HLT_xe100_wEFMu_L1XE50 ',
-'HLT_xe110_L1XE50 ',
-'HLT_xe110_mht_L1XE50',
-'HLT_xe110_pueta_L1XE50 ',
-'HLT_xe110_pufit_L1XE50    ',
-'HLT_xe110_tc_em_L1XE50',
-'HLT_xe110_tc_em_wEFMu_L1XE50',
-'HLT_xe110_wEFMu_L1XE50 ',
-'HLT_xe120      ',
-'HLT_xe120_mht  ',
-'HLT_xe120_mht_wEFMu  ',
-'HLT_xe120_pueta',
-'HLT_xe120_pueta_L1XE50 ',
-'HLT_xe120_pueta_wEFMu',
-'HLT_xe120_pufit',
-'HLT_xe120_pufit_L1XE50',
-'HLT_xe120_pufit_wEFMu',
-'HLT_xe120_tc_em',
-'HLT_xe120_tc_em_wEFMu',
-'HLT_xe120_tc_lcw',
-'HLT_xe120_tc_lcw_wEFMu',
-'HLT_xe120_wEFMu      ',
-'HLT_xe130_mht_L1XE50',
-]
-
-#multi-muon triggers
-
-multiMuTriggers = [
-'HLT_2mu10',
-'HLT_3mu4',
-'HLT_2mu14',
-'HLT_2mu14_nomucomb',
-'HLT_3mu6',
-'HLT_3mu6_msonly',
-'HLT_mu18_mu8noL1',
-'HLT_mu18_2mu4noL1',
-]
-
-# multi-el triggers
-
-multiElTriggers = [
-'HLT_e17_lhloose_2e9_lhloose',
-'HLT_e17_lhmedium_2e9_lhmedium',
-'HLT_e17_lhmedium_nod0_2e9_lhmedium_nod0',
-'HLT_2e17_lhvloose',
-'HLT_2e17_lhvloose_nod0',
-'HLT_2e17_lhloose_cutd0dphideta',
-'HLT_2e17_lhloose',
-'HLT_2e15_lhvloose_L12EM13VH',
-'HLT_2e15_lhvloose_nod0_L12EM13VH',
-'HLT_2e12_lhvloose_L12EM10VH ',
-'HLT_2e12_lhvloose_nod0_L12EM10VH',
-]
-
-# photon triggers
-singlePhotonTriggers = [
-# prescaled
-'HLT_g10_loose',
-'HLT_g15_loose',
-'HLT_g15_loose_L1EM3',
-'HLT_g15_loose_L1EM7',
-'HLT_g20_loose',
-'HLT_g20_loose_L1EM12',
-'HLT_g20_loose_L1EM15',
-'HLT_g25_loose',
-'HLT_g25_loose_L1EM15',
-'HLT_g35_loose',
-'HLT_g35_loose_L1EM15',
-'HLT_g40_loose_L1EM15',
-'HLT_g45_loose_L1EM15',
-'HLT_g50_loose',
-'HLT_g50_loose_L1EM15',
-'HLT_g60_loose',
-'HLT_g60_loose_L1EM15VH',
-'HLT_g70_loose',
-'HLT_g80_loose',
-'HLT_g100_loose',
-'HLT_g120_loose',
-# unprescaled
-'HLT_g140_loose',
-'HLT_g200_etcut',
-'HLT_g250_etcut',
-'HLT_g300_etcut',
-]
-
-# multi-photon triggers
-
-multiPhotonTriggers = [
-'HLT_2g60_loose_L12EM15VH',
-'HLT_2g22_tight',
-'HLT_3g20_loose',
-'HLT_2g50_loose',
-'HLT_2g20_tight',
-'HLT_2g20_loose_g15_loose',
-'HLT_3g15_loose',
-'HLT_g35_medium_g25_medium',
-'HLT_g35_loose_g25_loose',
-'HLT_g35_loose_L1EM15_g25_loose_L1EM15',
-]
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM11.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM11.py
index fd2b32de69acb8bd2377b2c860b545c56c866f19..1dccd7f1c1a469c69f7639d950bb7e9cac69eede 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM11.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM11.py
@@ -24,7 +24,6 @@ JETM11Stream.AcceptAlgs(['JETM11Kernel'])
 #======================================================================================================================
 from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool
 from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__TriggerSkimmingTool
-# cutExpression = "(count(Electrons.DFCommonElectronsLHLoose && Electrons.DFCommonElectrons_pt > (20 * GeV) && abs(Electrons.DFCommonElectrons_eta) < 2.47) + count(Muons.DFCommonMuonsPreselection && Muons.pt > (20*GeV) && abs(Muon.eta) < 2.47) ) >= 1"
 singleElTriggers = TriggerLists.single_el_Trig()
 singleMuTriggers = TriggerLists.single_mu_Trig()
 cutExpression = "(count(Electrons.DFCommonElectronsLHLoose && Electrons.pt > (24 * GeV) && abs(Electrons.eta) < 2.47) + count(Muons.DFCommonMuonsPreselection && Muons.pt > (24*GeV) && abs(Muons.eta) < 2.47) ) >= 1"
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetAugmentationTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetAugmentationTool.cxx
index 7eadb5433a9da527a16cd4b3851fe500dd6ed8ae..dba95878b6dfac5f9acd1d202a1e04cc57b32c11 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetAugmentationTool.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetAugmentationTool.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -10,6 +10,7 @@
 
 #include "JetAugmentationTool.h"
 #include "xAODCore/ShallowCopy.h"
+#include "StoreGate/WriteDecorHandle.h"
 
 namespace DerivationFramework {
 
@@ -63,28 +64,38 @@ namespace DerivationFramework {
 
       m_docalib = true;
 
-      m_dec_calibpt  = std::make_unique< SG::AuxElement::Decorator<float> >(m_momentPrefix+m_calibMomentKey+"_pt");
-      m_dec_calibeta = std::make_unique< SG::AuxElement::Decorator<float> >(m_momentPrefix+m_calibMomentKey+"_eta");
-      m_dec_calibphi = std::make_unique< SG::AuxElement::Decorator<float> >(m_momentPrefix+m_calibMomentKey+"_phi");
-      m_dec_calibm   = std::make_unique< SG::AuxElement::Decorator<float> >(m_momentPrefix+m_calibMomentKey+"_m");
+      m_calibpt_key = m_containerName + "." + m_momentPrefix + m_calibMomentKey + "_pt";
+      m_calibeta_key = m_containerName + "." + m_momentPrefix + m_calibMomentKey + "_eta";
+      m_calibphi_key = m_containerName + "." + m_momentPrefix + m_calibMomentKey + "_phi";
+      m_calibm_key = m_containerName + "." + m_momentPrefix + m_calibMomentKey + "_m";
+
+      ATH_CHECK(m_calibpt_key.initialize());
+      ATH_CHECK(m_calibeta_key.initialize());
+      ATH_CHECK(m_calibphi_key.initialize());
+      ATH_CHECK(m_calibm_key.initialize());
 
       if(!m_jvtTool.empty()) {
 	CHECK(m_jvtTool.retrieve());
 	ATH_MSG_INFO("Augmenting jets with updated JVT \"" << m_momentPrefix+m_jvtMomentKey << "\"");
 	m_dojvt = true;
 
-	m_dec_jvt  = std::make_unique< SG::AuxElement::Decorator<float> >(m_momentPrefix+m_jvtMomentKey);
-        m_dec_passJvt  = std::make_unique< SG::AuxElement::Decorator<char> >(m_momentPrefix+"pass"+m_jvtMomentKey);
+	m_jvt_key = m_containerName + "." + m_momentPrefix + m_jvtMomentKey;
+	m_passJvt_key = m_containerName + "." + m_momentPrefix + "pass" + m_jvtMomentKey;
+
+	ATH_CHECK(m_jvt_key.initialize());
+	ATH_CHECK(m_passJvt_key.initialize());
 
 	if(!m_btagSelTools.empty()) {
 	  size_t ibtag(0);
 	  for(const auto& tool : m_btagSelTools) {
 	    CHECK(tool.retrieve());
 	    ATH_MSG_INFO("Augmenting jets with B-tag working point \"" << m_momentPrefix+m_btagWP[ibtag] << "\"");
-	    m_dec_btag.push_back(new SG::AuxElement::Decorator<float>(m_momentPrefix+m_btagWP[ibtag]));
+	    m_dec_btag_keys.emplace_back( m_containerName + "." + m_momentPrefix+m_btagWP[ibtag] );
 	    m_dobtag = true;
 	    ++ibtag;
 	  }
+
+	  ATH_CHECK(m_dec_btag_keys.initialize());
 	}
       }
     }
@@ -98,8 +109,14 @@ namespace DerivationFramework {
       CHECK(m_jetTrackSumMomentsTool.retrieve());
       ATH_MSG_INFO("Augmenting jets with track sum moments \"" << m_momentPrefix << "TrackSumMass,Pt\"");
       m_decoratetracksum = true;
-      m_dec_tracksummass = std::make_unique< SG::AuxElement::Decorator<float> >(m_momentPrefix+"TrackSumMass");
-      m_dec_tracksumpt   = std::make_unique< SG::AuxElement::Decorator<float> >(m_momentPrefix+"TrackSumPt");
+      m_acc_tracksummass = std::make_unique< SG::AuxElement::ConstAccessor<float> >(m_momentPrefix+"TrackSumMass");
+      m_acc_tracksumpt   = std::make_unique< SG::AuxElement::ConstAccessor<float> >(m_momentPrefix+"TrackSumPt");
+
+      m_tracksummass_key = m_containerName + "." + m_momentPrefix+"TrackSumMass";
+      m_tracksumpt_key = m_containerName + "." + m_momentPrefix+"TrackSumPt";
+
+      ATH_CHECK(m_tracksummass_key.initialize());
+      ATH_CHECK(m_tracksumpt_key.initialize());
     }
 
     // This tool creates the GhostTruthAssociation decorations recommended for truth matching //
@@ -107,8 +124,15 @@ namespace DerivationFramework {
       CHECK(m_jetPtAssociationTool.retrieve());
       ATH_MSG_INFO("Augmenting jets with GhostTruthAssociation moments Link and Fraction");
       m_decorateptassociation = true;
-      m_dec_GhostTruthAssociationFraction = std::make_unique< SG::AuxElement::Decorator<float> >("GhostTruthAssociationFraction");
-      m_dec_GhostTruthAssociationLink     = std::make_unique< SG::AuxElement::Decorator< ElementLink<xAOD::JetContainer> > >("GhostTruthAssociationLink");
+      m_acc_GhostTruthAssociationFraction = std::make_unique< SG::AuxElement::ConstAccessor<float> >("GhostTruthAssociationFraction");
+      m_acc_GhostTruthAssociationLink     = std::make_unique< SG::AuxElement::ConstAccessor< ElementLink<xAOD::JetContainer> > >("GhostTruthAssociationLink");
+      
+      m_GhostTruthAssociationFraction_key = m_containerName + ".GhostTruthAssociationFraction";
+      m_GhostTruthAssociationLink_key = m_containerName + ".GhostTruthAssociationLink";
+
+      ATH_CHECK(m_GhostTruthAssociationFraction_key.initialize());
+      ATH_CHECK(m_GhostTruthAssociationLink_key.initialize());
+
     }
 
     if(!m_trkSelectionTool.empty()) {
@@ -119,12 +143,28 @@ namespace DerivationFramework {
 	if(!m_qgTool.empty()){
 	  CHECK(m_qgTool.retrieve());
 	  m_decorateQGVariables = true;
-	  m_dec_AssociatedNTracks     = std::make_unique< SG::AuxElement::Decorator<int> >(m_momentPrefix + "QGTagger_NTracks");
-	  m_dec_AssociatedTracksWidth = std::make_unique< SG::AuxElement::Decorator<float> >(m_momentPrefix + "QGTagger_TracksWidth");
-	  m_dec_AssociatedTracksC1    = std::make_unique< SG::AuxElement::Decorator<float> >(m_momentPrefix + "QGTagger_TracksC1");
-	  m_dec_Associated_truthjet_nCharged = std::make_unique< SG::AuxElement::Decorator<int> >(m_momentPrefix + "QGTagger_truthjet_nCharged");
-	  m_dec_Associated_truthjet_pt       = std::make_unique< SG::AuxElement::Decorator<float> >(m_momentPrefix + "QGTagger_truthjet_pt");
-	  m_dec_Associated_truthjet_eta      = std::make_unique< SG::AuxElement::Decorator<float> >(m_momentPrefix + "QGTagger_truthjet_eta");
+
+	  m_acc_AssociatedNTracks     = std::make_unique< SG::AuxElement::ConstAccessor<int> >(m_momentPrefix + "QGTagger_NTracks");
+	  m_acc_AssociatedTracksWidth = std::make_unique< SG::AuxElement::ConstAccessor<float> >(m_momentPrefix + "QGTagger_TracksWidth");
+	  m_acc_AssociatedTracksC1    = std::make_unique< SG::AuxElement::ConstAccessor<float> >(m_momentPrefix + "QGTagger_TracksC1");
+	  m_acc_Associated_truthjet_nCharged = std::make_unique< SG::AuxElement::ConstAccessor<int> >(m_momentPrefix + "QGTagger_truthjet_nCharged");
+	  m_acc_Associated_truthjet_pt       = std::make_unique< SG::AuxElement::ConstAccessor<float> >(m_momentPrefix + "QGTagger_truthjet_pt");
+	  m_acc_Associated_truthjet_eta      = std::make_unique< SG::AuxElement::ConstAccessor<float> >(m_momentPrefix + "QGTagger_truthjet_eta");
+
+	  m_associatedNTracks_key = m_containerName + "." + m_momentPrefix + "QGTagger_NTracks";
+	  m_associatedTracksWidth_key = m_containerName + "." + m_momentPrefix + "QGTagger_TracksWidth";
+	  m_associatedTracksC1_key =m_containerName + "." + m_momentPrefix + "QGTagger_TracksC1";
+	  m_associated_truthjet_nCharged_key =m_containerName + "." + m_momentPrefix + "QGTagger_truthjet_nCharged";
+	  m_associated_truthjet_pt_key =m_containerName + "." + m_momentPrefix + "QGTagger_truthjet_pt";
+	  m_associated_truthjet_eta_key =m_containerName + "." + m_momentPrefix + "QGTagger_truthjet_eta";
+	  
+	  ATH_CHECK(m_associatedNTracks_key.initialize());
+	  ATH_CHECK(m_associatedTracksWidth_key.initialize());
+	  ATH_CHECK(m_associatedTracksC1_key.initialize());
+	  ATH_CHECK(m_associated_truthjet_nCharged_key.initialize());
+	  ATH_CHECK(m_associated_truthjet_pt_key.initialize());
+	  ATH_CHECK(m_associated_truthjet_eta_key.initialize());
+
 	}
       }
     }
@@ -134,13 +174,30 @@ namespace DerivationFramework {
       ATH_MSG_INFO("Augmenting jets with truthlabeling");
       m_decoratetruthlabel = true;
       m_truthLabelName = m_jetTruthLabelingTool->getLargeRJetTruthLabelName();
-      m_dec_Label = std::make_unique< SG::AuxElement::Decorator<int> >(m_truthLabelName);
-      m_dec_dRW = std::make_unique< SG::AuxElement::Decorator<float> >(m_truthLabelName+"_dR_W");
-      m_dec_dRZ = std::make_unique< SG::AuxElement::Decorator<float> >(m_truthLabelName+"_dR_Z");
-      m_dec_dRTop = std::make_unique< SG::AuxElement::Decorator<float> >(m_truthLabelName+"_dR_Top");
-      m_dec_dRH = std::make_unique< SG::AuxElement::Decorator<float> >(m_truthLabelName+"_dR_H");
-      m_dec_NB = std::make_unique< SG::AuxElement::Decorator<int> >(m_truthLabelName+"_NB");
-      m_dec_TruthJetMass = std::make_unique< SG::AuxElement::Decorator<float> >(m_truthLabelName+"_TruthJetMass");
+
+      m_acc_label = std::make_unique< SG::AuxElement::ConstAccessor<int> >(m_truthLabelName);
+      m_acc_dRW = std::make_unique< SG::AuxElement::ConstAccessor<float> >(m_truthLabelName+"_dR_W");
+      m_acc_dRZ = std::make_unique< SG::AuxElement::ConstAccessor<float> >(m_truthLabelName+"_dR_Z");
+      m_acc_dRTop = std::make_unique< SG::AuxElement::ConstAccessor<float> >(m_truthLabelName+"_dR_Top");
+      m_acc_dRH = std::make_unique< SG::AuxElement::ConstAccessor<float> >(m_truthLabelName+"_dR_H");
+      m_acc_NB = std::make_unique< SG::AuxElement::ConstAccessor<int> >(m_truthLabelName+"_NB");
+      m_acc_truthJetMass = std::make_unique< SG::AuxElement::ConstAccessor<float> >(m_truthLabelName+"_TruthJetMass");
+
+      m_truthLabel_key = m_containerName + "." + m_truthLabelName;
+      m_truthLabel_dRW_key = m_containerName + "." + m_truthLabelName+"_dR_W";
+      m_truthLabel_dRZ_key = m_containerName + "." + m_truthLabelName+"_dR_Z";
+      m_truthLabel_dRH_key = m_containerName + "." + m_truthLabelName+"_dR_H";
+      m_truthLabel_dRTop_key = m_containerName + "." + m_truthLabelName+"_dR_Top";
+      m_truthLabel_NB_key = m_containerName + "." + m_truthLabelName+"_NB";
+      m_truthLabel_truthJetMass_key = m_containerName + "." + m_truthLabelName+"_TruthJetMass";
+
+      ATH_CHECK(m_truthLabel_key.initialize());
+      ATH_CHECK(m_truthLabel_dRW_key.initialize());
+      ATH_CHECK(m_truthLabel_dRZ_key.initialize());
+      ATH_CHECK(m_truthLabel_dRH_key.initialize());
+      ATH_CHECK(m_truthLabel_dRTop_key.initialize());
+      ATH_CHECK(m_truthLabel_NB_key.initialize());
+      ATH_CHECK(m_truthLabel_truthJetMass_key.initialize());
     }
 
     return StatusCode::SUCCESS;
@@ -149,10 +206,6 @@ namespace DerivationFramework {
   StatusCode JetAugmentationTool::finalize()
   {
 
-    if(m_dobtag) {
-      for(const auto& pdec : m_dec_btag) delete pdec;
-    }
-
     return StatusCode::SUCCESS;
   }
 
@@ -188,7 +241,7 @@ namespace DerivationFramework {
 
     // Check if GhostTruthAssociation decorations already exist for first jet, and if so skip them
     bool isMissingPtAssociation = true;
-    if( !m_decorateptassociation || jets_copy->size() == 0 || m_dec_GhostTruthAssociationFraction->isAvailable(*jets_copy->at(0)) ) {
+    if( !m_decorateptassociation || jets_copy->size() == 0 || m_acc_GhostTruthAssociationFraction->isAvailable(*jets_copy->at(0)) ) {
       isMissingPtAssociation = false;
     }
 
@@ -223,28 +276,38 @@ namespace DerivationFramework {
 
       if(m_docalib) {
 
+	SG::WriteDecorHandle<xAOD::JetContainer, float> calibpt_handle(m_calibpt_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, float> calibeta_handle(m_calibeta_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, float> calibphi_handle(m_calibphi_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, float> calibm_handle(m_calibm_key);
+
 	// generate static decorators to avoid multiple lookups	
-	(*m_dec_calibpt)(jet_orig)  = jet->pt();
-	(*m_dec_calibeta)(jet_orig) = jet->eta();
-	(*m_dec_calibphi)(jet_orig) = jet->phi();
-	(*m_dec_calibm)(jet_orig)   = jet->m();
+	calibpt_handle(jet_orig)  = jet->pt();
+	calibeta_handle(jet_orig) = jet->eta();
+	calibphi_handle(jet_orig) = jet->phi();
+	calibm_handle(jet_orig)   = jet->m();
 
-	ATH_MSG_VERBOSE("Calibrated jet pt: " << (*m_dec_calibpt)(jet_orig) );
+	ATH_MSG_VERBOSE("Calibrated jet pt: " << jet->pt() );
 
 	if(m_dojvt) {
 
-	  (*m_dec_jvt)(jet_orig) = m_jvtTool->updateJvt(*jet);
-	  ATH_MSG_VERBOSE("Calibrated JVT: " << (*m_dec_jvt)(jet_orig) );
-	  
-	  bool passJVT_tool = m_jetJvtEfficiencyTool->passesJvtCut(jet_orig);
-	  (*m_dec_passJvt)(jet_orig) = passJVT_tool;
+	  SG::WriteDecorHandle<xAOD::JetContainer, float> jvt_handle(m_jvt_key);
+	  SG::WriteDecorHandle<xAOD::JetContainer, char> passJvt_handle(m_passJvt_key);
 
+	  float jvt_value = m_jvtTool->updateJvt(*jet);
+	  jvt_handle(jet_orig)= jvt_value;
+	  ATH_MSG_VERBOSE("Calibrated JVT: " << jvt_value);
+	  
+	  bool passJVT = m_jetJvtEfficiencyTool->passesJvtCut(jet_orig);
+	  passJvt_handle(jet_orig) = passJVT;
+	  
 	  if(m_dobtag) {
-	    bool passJVT = jet->pt()>50e3 || fabs(jet->eta())>2.4 || (*m_dec_jvt)(jet_orig)>0.64;
 	    size_t ibtag(0);
 	    for(const auto& tool : m_btagSelTools) {
-	      (*m_dec_btag[ibtag])(jet_orig) = jet->pt()>20e3 && fabs(jet->eta())<2.5 && passJVT && tool->accept(*jet);
-	      ATH_MSG_VERBOSE("Btag working point \"" << m_btagWP[ibtag] << "\" " << ((*m_dec_btag[ibtag])(jet_orig) ? "passed." : "failed."));
+	      SG::WriteDecorHandle<xAOD::JetContainer, char> dec_btag_handle(m_dec_btag_keys.at(ibtag));
+	      bool passWP = std::abs(jet->eta()) < 2.7 && passJVT && tool->accept(*jet);
+	      dec_btag_handle(jet_orig) = passWP;
+	      ATH_MSG_VERBOSE("Btag working point \"" << m_btagWP[ibtag] << "\" " << (passWP ? "passed." : "failed."));
 	      ++ibtag;
 	    }
 	  }
@@ -252,42 +315,68 @@ namespace DerivationFramework {
       }
 
       if(m_decoratetracksum) {  
-	(*m_dec_tracksummass)(jet_orig) = jet->getAttribute<float>("TrackSumMass");
-	(*m_dec_tracksumpt)(jet_orig)   = jet->getAttribute<float>("TrackSumPt");
-	ATH_MSG_VERBOSE("TrackSumMass: " << (*m_dec_tracksummass)(jet_orig) );
-	ATH_MSG_VERBOSE("TrackSumPt: "   << (*m_dec_tracksummass)(jet_orig) );
+	SG::WriteDecorHandle<xAOD::JetContainer, float> tracksummass_handle(m_tracksummass_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, float> tracksumpt_handle(m_tracksumpt_key);
+
+	tracksummass_handle(jet_orig) = (*m_acc_tracksummass)(*jet);
+	tracksumpt_handle(jet_orig)   = (*m_acc_tracksumpt)(*jet);
+
+	ATH_MSG_VERBOSE("TrackSumMass: " << (*m_acc_tracksummass)(jet_orig) );
+	ATH_MSG_VERBOSE("TrackSumPt: "   << (*m_acc_tracksummass)(jet_orig) );
       }
 
       if(m_decorateptassociation && isMissingPtAssociation){
-        if(m_dec_GhostTruthAssociationFraction->isAvailable(*jet)){
-	  (*m_dec_GhostTruthAssociationFraction)(jet_orig) = jet->getAttribute<float>("GhostTruthAssociationFraction");
-	  ATH_MSG_VERBOSE("GhostTruthAssociationFraction: " << (*m_dec_GhostTruthAssociationFraction)(jet_orig) );
+
+	SG::WriteDecorHandle<xAOD::JetContainer, float> ghostTruthAssocFrac_handle(m_GhostTruthAssociationFraction_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, ElementLink<xAOD::JetContainer> > ghostTruthAssocLink_handle(m_GhostTruthAssociationLink_key);
+
+        if(m_acc_GhostTruthAssociationFraction->isAvailable(*jet)){
+	  ghostTruthAssocFrac_handle(jet_orig) = (*m_acc_GhostTruthAssociationFraction)(*jet);
+	  ATH_MSG_INFO("GhostTruthAssociationFraction: " << (*m_acc_GhostTruthAssociationFraction)(jet_orig) );
 	}
-	if(m_dec_GhostTruthAssociationLink->isAvailable(*jet)){
-	  (*m_dec_GhostTruthAssociationLink)(jet_orig) = jet->getAttribute< ElementLink<xAOD::JetContainer> >("GhostTruthAssociationLink");
-	  ATH_MSG_VERBOSE("GhostTruthAssociationLink: " << (*m_dec_GhostTruthAssociationLink)(jet_orig) );
+	if(m_acc_GhostTruthAssociationLink->isAvailable(*jet)){
+	  ghostTruthAssocLink_handle(jet_orig) = (*m_acc_GhostTruthAssociationLink)(*jet);
+	  ATH_MSG_INFO("GhostTruthAssociationLink: " << (*m_acc_GhostTruthAssociationLink)(jet_orig) );
 	}
       }
       
       if(m_decoratetruthlabel){
-        if(m_dec_Label->isAvailable(*jet)) (*m_dec_Label)(jet_orig)  = (*m_dec_Label)(*jet);
-        if(m_dec_dRW->isAvailable(*jet)) (*m_dec_dRW)(jet_orig)  = (*m_dec_dRW)(*jet);
-        if(m_dec_dRZ->isAvailable(*jet)) (*m_dec_dRZ)(jet_orig)  = (*m_dec_dRZ)(*jet);
-        if(m_dec_dRTop->isAvailable(*jet)) (*m_dec_dRTop)(jet_orig)  = (*m_dec_dRTop)(*jet);
-        if(m_dec_dRH->isAvailable(*jet)) (*m_dec_dRH)(jet_orig)  = (*m_dec_dRH)(*jet);
-        if(m_dec_NB->isAvailable(*jet)) (*m_dec_NB)(jet_orig)  = (*m_dec_NB)(*jet);
-        if(m_dec_TruthJetMass->isAvailable(*jet)) (*m_dec_TruthJetMass)(jet_orig)  = (*m_dec_TruthJetMass)(*jet);
+
+	SG::WriteDecorHandle<xAOD::JetContainer, float> truthLabel_dRW_handle(m_truthLabel_dRW_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, int> truthLabel_handle(m_truthLabel_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, float> truthLabel_dRZ_handle(m_truthLabel_dRZ_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, float> truthLabel_dRH_handle(m_truthLabel_dRH_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, float> truthLabel_dRTop_handle(m_truthLabel_dRTop_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, int> truthLabel_NB_handle(m_truthLabel_NB_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, float> truthLabel_truthJetMass_handle(m_truthLabel_truthJetMass_key);
+	
+	if(m_acc_label->isAvailable(*jet)) truthLabel_handle(jet_orig) = (*m_acc_label)(*jet);
+	if(m_acc_dRW->isAvailable(*jet)) truthLabel_dRW_handle(jet_orig) = (*m_acc_dRW)(*jet);
+	if(m_acc_dRZ->isAvailable(*jet)) truthLabel_dRZ_handle(jet_orig) = (*m_acc_dRZ)(*jet);
+	if(m_acc_dRH->isAvailable(*jet)) truthLabel_dRH_handle(jet_orig) = (*m_acc_dRH)(*jet);
+	if(m_acc_dRTop->isAvailable(*jet)) truthLabel_dRTop_handle(jet_orig) = (*m_acc_dRTop)(*jet);
+	if(m_acc_NB->isAvailable(*jet)) truthLabel_NB_handle(jet_orig) = (*m_acc_NB)(*jet);
+	if(m_acc_truthJetMass->isAvailable(*jet)) truthLabel_truthJetMass_handle(jet_orig) = (*m_acc_truthJetMass)(*jet);
+	  
       }
 
       if(m_decorateQGVariables){
-	if(m_dec_AssociatedNTracks->isAvailable(*jet)) (*m_dec_AssociatedNTracks)(jet_orig) = (*m_dec_AssociatedNTracks)(*jet);
-	if(m_dec_AssociatedTracksWidth->isAvailable(*jet)) (*m_dec_AssociatedTracksWidth)(jet_orig) = (*m_dec_AssociatedTracksWidth)(*jet);
-	if(m_dec_AssociatedTracksC1->isAvailable(*jet)) (*m_dec_AssociatedTracksC1)(jet_orig) = (*m_dec_AssociatedTracksC1)(*jet);
-	if(m_dec_Associated_truthjet_nCharged->isAvailable(*jet)) (*m_dec_Associated_truthjet_nCharged)(jet_orig) = (*m_dec_Associated_truthjet_nCharged)(*jet);
-	if(m_dec_Associated_truthjet_pt->isAvailable(*jet)) (*m_dec_Associated_truthjet_pt)(jet_orig) = (*m_dec_Associated_truthjet_pt)(*jet);
-	if(m_dec_Associated_truthjet_eta->isAvailable(*jet)) (*m_dec_Associated_truthjet_eta)(jet_orig) = (*m_dec_Associated_truthjet_eta)(*jet);
-      }
 
+	SG::WriteDecorHandle<xAOD::JetContainer, int> associatedNTracks_handle(m_associatedNTracks_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, float> associatedTracksWidth_handle(m_associatedTracksWidth_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, float> associatedTracksC1_handle(m_associatedTracksC1_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, int> associated_truthjet_nCharged_handle(m_associated_truthjet_nCharged_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, float> associated_truthjet_pt_handle(m_associated_truthjet_pt_key);
+	SG::WriteDecorHandle<xAOD::JetContainer, float> associated_truthjet_eta_handle(m_associated_truthjet_eta_key);
+
+	if(m_acc_AssociatedNTracks->isAvailable(*jet)) associatedNTracks_handle(jet_orig) = (*m_acc_AssociatedNTracks)(*jet);
+	if(m_acc_AssociatedTracksWidth->isAvailable(*jet)) associatedTracksWidth_handle(jet_orig) = (*m_acc_AssociatedTracksWidth)(*jet);
+	if(m_acc_AssociatedTracksC1->isAvailable(*jet)) associatedTracksC1_handle(jet_orig) = (*m_acc_AssociatedTracksC1)(*jet);
+	if(m_acc_Associated_truthjet_nCharged->isAvailable(*jet)) associated_truthjet_nCharged_handle(jet_orig) = (*m_acc_Associated_truthjet_nCharged)(*jet);
+	if(m_acc_Associated_truthjet_pt->isAvailable(*jet)) associated_truthjet_pt_handle(jet_orig) = (*m_acc_Associated_truthjet_pt)(*jet);
+	if(m_acc_Associated_truthjet_eta->isAvailable(*jet)) associated_truthjet_eta_handle(jet_orig) = (*m_acc_Associated_truthjet_eta)(*jet);
+      }
+      
     }
 
     return StatusCode::SUCCESS;
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetAugmentationTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetAugmentationTool.h
index f4bc5557f3e873273aad89cea9d48e913e763100..9363efa601c402bd1d846b771ea68e48277aaa19 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetAugmentationTool.h
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetAugmentationTool.h
@@ -16,6 +16,7 @@
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "DerivationFrameworkInterfaces/IAugmentationTool.h"
 #include "GaudiKernel/ToolHandle.h"
+#include "StoreGate/WriteDecorHandleKeyArray.h"
 
 #include "JetInterface/IJetModifier.h"
 #include "JetInterface/IJetUpdateJvt.h"
@@ -45,70 +46,88 @@ namespace DerivationFramework {
     //
     // implement augmentations explicitly to avoid need to parse lists of moments to copy
     //
-    // calibration
 
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_calibpt;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_calibeta;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_calibphi;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_calibm;
+    // calibration
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_calibpt_key {this, "CalibPtKey", "", "Decoration for calibrated jet pt"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_calibeta_key {this, "CalibEtaKey", "", "Decoration for calibrated jet eta"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_calibphi_key {this, "CalibPhiKey", "", "Decoration for calibrated jet phi"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_calibm_key {this, "CalibMKey", "", "Decoration for calibrated jet mass"};
     ToolHandle<IJetModifier> m_jetCalibTool;
     std::string m_calibMomentKey;
     bool m_docalib;
 
     // JVT
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_jvt;
-    std::unique_ptr< SG::AuxElement::Decorator<char> > m_dec_passJvt;
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_jvt_key {this, "JVTKey", "", "Decoration for JVT"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_passJvt_key {this, "passJVTKey", "", "Decoration for boolean containing JVT decision"};
     ToolHandle<IJetUpdateJvt> m_jvtTool;
     ToolHandle<CP::IJetJvtEfficiency> m_jetJvtEfficiencyTool;
     std::string m_jvtMomentKey;
     bool m_dojvt;
 
     //PFlow fJVT
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_fjvt;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<float> > m_acc_fjvt;
     std::string m_fjvtMomentKey;
 
     // b-tagging       @author tripiana@cern.ch
-    std::vector<SG::AuxElement::Decorator<float>*> m_dec_btag;
     std::vector<std::string> m_btagWP;
     bool m_dobtag;
     /// Athena configured tools
     ToolHandleArray<IBTaggingSelectionTool> m_btagSelTools;
+    SG::WriteDecorHandleKeyArray<xAOD::JetContainer> m_dec_btag_keys{this, "BtagDecKeys", {}, "SG keys for b-tagging WP decisions"};
     
     //TrackSumMass and TrackSumPt for calo-jets built in Tier-0
     //@author: nurfikri.bin.norjoharuddeen@cern.ch
     ToolHandle<IJetModifier> m_jetTrackSumMomentsTool;
     bool m_decoratetracksum;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_tracksummass;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_tracksumpt;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<float> > m_acc_tracksummass;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<float> > m_acc_tracksumpt;
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_tracksummass_key {this,"TrackSumMassKey", "", "Decoration for mass calculated from associated tracks"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_tracksumpt_key {this,"TrackSumPtKey", "","Decoration for pt calculated from associated tracks"};
 
     // GhostTruthAssociation for derivations, @author jeff.dandoy@cern.ch
     ToolHandle<IJetModifier> m_jetPtAssociationTool;
     bool m_decorateptassociation;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_GhostTruthAssociationFraction;
-    std::unique_ptr< SG::AuxElement::Decorator< ElementLink<xAOD::JetContainer> > > m_dec_GhostTruthAssociationLink;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<float> > m_acc_GhostTruthAssociationFraction;
+    std::unique_ptr< SG::AuxElement::ConstAccessor< ElementLink<xAOD::JetContainer> > > m_acc_GhostTruthAssociationLink;
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_GhostTruthAssociationFraction_key {this,"GhostTruthAssocFracKey", "", "Decoration for fraction of ghost-associated truth pt to reco jet"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_GhostTruthAssociationLink_key {this, "GhostTruthAssocLinkKey", "", "Decoration for links of ghost-associated truth particles"};
 
     // Ntracks for QGTaggerTool --- 
     ToolHandle<InDet::IInDetTrackSelectionTool> m_trkSelectionTool;
     ToolHandle<CP::ITrackVertexAssociationTool> m_trkVtxAssociationTool;
     ToolHandle<IJetDecorator> m_qgTool;
     bool m_decorateQGVariables;
-    std::unique_ptr< SG::AuxElement::Decorator<int> > m_dec_AssociatedNTracks;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_AssociatedTracksWidth;
-    std::unique_ptr< SG::AuxElement::Decorator<float>  >m_dec_AssociatedTracksC1;
-    std::unique_ptr< SG::AuxElement::Decorator<int> > m_dec_Associated_truthjet_nCharged;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_Associated_truthjet_pt;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_Associated_truthjet_eta;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<int> > m_acc_AssociatedNTracks;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<float> > m_acc_AssociatedTracksWidth;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<float>  >m_acc_AssociatedTracksC1;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<int> > m_acc_Associated_truthjet_nCharged;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<float> > m_acc_Associated_truthjet_pt;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<float> > m_acc_Associated_truthjet_eta;
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_associatedNTracks_key {this, "associatedNTracksKey", "", "Decoration for number of ghost-associated tracks"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_associatedTracksWidth_key {this, "associatedTracksWidthKey", "", "Decoration for track width"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_associatedTracksC1_key {this, "associatedTracksC1Key", "", "Decoration for track C1"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_associated_truthjet_nCharged_key {this, "associatedTruthNChargedKey", "", "Decoration for charged truth particles"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_associated_truthjet_pt_key {this, "associatedTruthJetPtKey", "", "Decoration for associated truth jet pT"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_associated_truthjet_eta_key {this, "associatedTruthJetEtaKey", "", "Decoration for associated truth jet eta "};
 
     //// Large-R jet truth labeling @author jveatch@cern.ch and tnobe@cern.ch
     ToolHandle<JetTruthLabelingTool> m_jetTruthLabelingTool;
     bool m_decoratetruthlabel;
-    std::unique_ptr< SG::AuxElement::Decorator<int> > m_dec_Label;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_dRW;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_dRZ;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_dRH;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_dRTop;
-    std::unique_ptr< SG::AuxElement::Decorator<int> > m_dec_NB;
-    std::unique_ptr< SG::AuxElement::Decorator<float> > m_dec_TruthJetMass;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<int> > m_acc_label;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<float> > m_acc_dRW;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<float> > m_acc_dRZ;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<float> > m_acc_dRH;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<float> > m_acc_dRTop;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<int> > m_acc_NB;
+    std::unique_ptr< SG::AuxElement::ConstAccessor<float> > m_acc_truthJetMass;
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_truthLabel_key {this,"truthLabelKey", "", "Decoration for large-R truth label"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_truthLabel_dRW_key {this, "truthLabeldRWKey", "", "Decoration for dR between large-R jet and W boson"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_truthLabel_dRZ_key {this, "truthLabeldRZKey", "", "Decoration for dR between large-R jet and Z boson"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_truthLabel_dRH_key {this, "truthLabeldRHKey", "", "Decoration for dR between large-R jet and H boson"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_truthLabel_dRTop_key {this, "truthLabeldRTopKey", "", "Decoration for dR between large-R jet and top quark"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_truthLabel_NB_key {this, "truthLabeldRNBKey", "", "Decoration for number of ghost-associated b-hadrons"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_truthLabel_truthJetMass_key {this, "truthLabelJetMassKey", "", "Decoration for matched truth-jet mass"};
+
     std::string m_truthLabelName;
 
   }; 
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetExternalAssocTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetExternalAssocTool.cxx
index 171ebace5cbf14076f037dda5d660f41bd1bc516..bc8a09145789c9160e9b3716e4e0d36ea6668c66 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetExternalAssocTool.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetExternalAssocTool.cxx
@@ -1,10 +1,11 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // JetExternalAssocTool.cxx
 
 #include "JetExternalAssocTool.h"
+#include "StoreGate/WriteDecorHandle.h"
 
 namespace DerivationFramework{
 
@@ -48,19 +49,16 @@ StatusCode JetExternalAssocTool::initialize() {
 
   // setup vector of decorator
   for(auto NewLinkName : m_VectorOfNewLinkNames){
-    auto decorator = new SG::AuxElement::Decorator<type_ghostlink>(m_momentPrefix + NewLinkName);
-    m_VectorOfDecors.push_back(decorator);
+    m_dec_keys.emplace_back(  m_containerName + "." + m_momentPrefix + NewLinkName);
   }
 
+  ATH_CHECK(m_dec_keys.initialize());
+
   return StatusCode::SUCCESS;
 }
 
 StatusCode JetExternalAssocTool::finalize(){
 
-  for(auto decorator : m_VectorOfDecors){
-    delete decorator;
-  }
-
   return StatusCode::SUCCESS;
 }
 
@@ -181,7 +179,9 @@ bool JetExternalAssocTool::TransferLink(const xAOD::Jet& jet, const xAOD::Jet& j
       targetLinks.push_back(el_obj);
     }
 
-    (*(m_VectorOfDecors[index_link]))(jet) = targetLinks;
+    SG::WriteDecorHandle<xAOD::JetContainer, type_ghostlink*> dec_handle(m_dec_keys.at(index_link));
+    *dec_handle(jet) = targetLinks;
+
   }
 
   return true;
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetExternalAssocTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetExternalAssocTool.h
index 8dbe2a047a22442ffbc71504c37d9ac6270b893f..72bb7ceceb20af3b937ab65e306108713ef06caa 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetExternalAssocTool.h
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/JetExternalAssocTool.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
 */
 
 // JetExternalAssocTool.h
@@ -17,6 +17,7 @@
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "DerivationFrameworkInterfaces/IAugmentationTool.h"
 #include "GaudiKernel/ToolHandle.h"
+#include "StoreGate/WriteDecorHandleKeyArray.h"
 
 #include "xAODJet/JetContainer.h"
 
@@ -54,10 +55,9 @@ namespace DerivationFramework{
     typedef ElementLink<xAOD::IParticleContainer>            type_el;
     typedef std::vector<type_el>                             type_ghostlink;
 
-    std::vector<SG::AuxElement::Decorator<type_ghostlink>* > m_VectorOfDecors;
+    SG::WriteDecorHandleKeyArray<xAOD::JetContainer> m_dec_keys{this, "DecKeys", {}, "SG keys for external decorations"};
 
   };
 
 }
-
 #endif
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/TVAAugmentationTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/TVAAugmentationTool.cxx
index 8793166274dfad6f83daf2376634205c1f73467c..8703b7a56ec1a02076025e6fcc071befa73ff6d5 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/TVAAugmentationTool.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/TVAAugmentationTool.cxx
@@ -4,6 +4,7 @@
 
 #include "TVAAugmentationTool.h"
 #include "xAODTracking/TrackParticleContainer.h"
+#include "StoreGate/WriteDecorHandle.h"
 
 namespace DerivationFramework {
 
@@ -25,12 +26,17 @@ namespace DerivationFramework {
     ATH_MSG_INFO("Initialising TVAAugmentationTool " << name() );
     ATH_CHECK( m_tool.retrieve() );
 
-    m_vtxDec = std::make_unique<SG::AuxElement::Decorator<vtxLink_t>>(m_linkName);
+    m_vtxDec_key = m_trackName + "." + m_linkName;
+    ATH_CHECK(m_vtxDec_key.initialize());
+
     return StatusCode::SUCCESS;
   }
 
   StatusCode TVAAugmentationTool::addBranches() const
   {
+
+    SG::WriteDecorHandle<xAOD::TrackParticleContainer, vtxLink_t> vtxDec_handle(m_vtxDec_key);
+
     const xAOD::VertexContainer* vertices = nullptr;
     ATH_CHECK(evtStore()->retrieve(vertices, m_vertexName) );
     const xAOD::TrackParticleContainer* tracks = nullptr;
@@ -40,7 +46,7 @@ namespace DerivationFramework {
 
     for (const xAOD::Vertex* ivtx : *vertices)
       for (const xAOD::TrackParticle* itrk : matchMap[ivtx])
-        (*m_vtxDec)(*itrk).toContainedElement(*vertices, ivtx);
+        vtxDec_handle(*itrk).toContainedElement(*vertices, ivtx);
 
     return StatusCode::SUCCESS;
   }
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/TVAAugmentationTool.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/TVAAugmentationTool.h
index 2b2680b5ca9d6e186e6cdabacf6eba507988f390..068fa1e7b233d1efe046c923d97c074f78798a4f 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/TVAAugmentationTool.h
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/src/TVAAugmentationTool.h
@@ -29,7 +29,8 @@ namespace DerivationFramework {
       ToolHandle<CP::ITrackVertexAssociationTool> m_tool;
       // Internals
       using vtxLink_t = ElementLink<xAOD::VertexContainer>;
-      std::unique_ptr<SG::AuxElement::Decorator<vtxLink_t>> m_vtxDec;
+      SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> m_vtxDec_key {this, "vtxDecKey", "", "Decoration for associated vertex"};
+
   }; //> end class TVAAugmentationTool
 } //> end namespace DerivationFramework
 
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py
index 6aa324cd3280e6d376fa62a2584a0a1a5ab5bab3..dd6f9e1d0c9790d0004af5244006a2d0bd4b8823 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py
@@ -46,7 +46,7 @@ if (DerivationFrameworkIsMonteCarlo):
                                                                   ParticleSelectionString = "(abs(TruthParticles.pdgId) == 4)",
                                                                   Do_Compress             = True)
    ToolSvc += PHYSTruthCharmTool
-   from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation
+   #from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation
    SeqPHYS += CfgMgr.DerivationFramework__CommonAugmentation("PHYSTruthCharmKernel",AugmentationTools=[PHYSTruthCharmTool])
    # Add HF particles
    addHFAndDownstreamParticles(SeqPHYS)
@@ -189,22 +189,20 @@ addQGTaggerTool(jetalg="AntiKt4EMPFlow",sequence=SeqPHYS,algname="QGTaggerToolPF
 #====================================================================
 # Add our sequence to the top sequence
 #====================================================================
-# Ideally, this should come at the end of the job, but the tau additions
-# below make it such that we need it here
+# Ideally, this should come at the end of the job
 DerivationFrameworkJob += SeqPHYS
 
 #====================================================================
 # Tau   
 #====================================================================
-'''
-# Schedule low-pt di-tau reconstruction (needs AntiKt2PV0TrackJets)
+# Add low-pt di-tau reconstruction
 from DerivationFrameworkTau.TauCommon import addDiTauLowPt
-addDiTauLowPt()
-
+addDiTauLowPt(Seq=SeqPHYS)
+'''
 # Low-pt di-tau thinning
 from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__GenericObjectThinning
 PHYSDiTauLowPtThinningTool = DerivationFramework__GenericObjectThinning(name            = "PHYSDiTauLowPtThinningTool",
-                                                                        ThinningService = PHYSThinningHelper.ThinningSvc(),
+                                                                        StreamName      = PHYSStream.Name,
                                                                         ContainerName   = "DiTauJetsLowPt",
                                                                         SelectionString = "DiTauJetsLowPt.nSubjets > 1")
 ToolSvc += PHYSDiTauLowPtThinningTool
@@ -212,7 +210,7 @@ thinningTools.append(PHYSDiTauLowPtThinningTool)
 
 # ID tracks associated with low-pt ditau
 PHYSDiTauLowPtTPThinningTool = DerivationFramework__DiTauTrackParticleThinning(name                    = "PHYSDiTauLowPtTPThinningTool",
-                                                                               ThinningService         = PHYSThinningHelper.ThinningSvc(),
+                                                                               StreamName              = PHYSStream.Name,
                                                                                DiTauKey                = "DiTauJetsLowPt",
                                                                                InDetTrackParticlesKey  = "InDetTrackParticles",
                                                                                SelectionString         = "DiTauJetsLowPt.nSubjets > 1")
@@ -223,9 +221,9 @@ thinningTools.append(PHYSDiTauLowPtTPThinningTool)
 # CREATE THE DERIVATION KERNEL ALGORITHM   
 #====================================================================
 # Add the kernel for thinning (requires the objects be defined)
-from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel
-DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("PHYSKernel",
-                                                                       ThinningTools = thinningTools)
+#from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel
+SeqPHYS += CfgMgr.DerivationFramework__DerivationKernel("PHYSKernel",
+                                                        ThinningTools = thinningTools)
 
 
 #====================================================================
@@ -273,7 +271,7 @@ PHYSSlimmingHelper.SmartCollections = ["Electrons",
                                        #"MET_Baseline_AntiKt4EMPFlow",
                                        "TauJets",
                                        "DiTauJets",
-                                       #"DiTauJetsLowPt",
+                                       "DiTauJetsLowPt",
                                        "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets",
                                        #"AntiKtVR30Rmax4Rmin02TrackJets_BTagging201903",
                                        #"BTagging_AntiKtVR30Rmax4Rmin02Track_201903"
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauCommon.py
index d8e46c00e874b57e14b26c95f5ae2d1b53edc73d..2b09c165218bb0b8ff17ca9319d513ae6abc9e75 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauCommon.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauCommon.py
@@ -7,147 +7,165 @@
 #********************************************************************
 
 from __future__ import print_function
-
-from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob
-from AthenaCommon.AppMgr import ToolSvc
 from AthenaCommon import CfgMgr 
 
-#====================================================================
-# MAKE TAU ENUMS AVAILABLE
-#====================================================================
-#from ROOT import xAOD__TauJetParameters__IsTauFlag
+# will likely be replaced with generic tau decorator tool
+#from tauRec.TauRecAODBuilder import TauRecAODProcessor_FTau
+#TauRecAODProcessor_FTau()
 
 #====================================================================
 # AUGMENTATION TOOLS
 #====================================================================
-from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__AsgSelectionToolWrapper
-from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauSelectionTool
+def AddTauAugmentation(Seq=None, doVeryLoose=None, doLoose=None, doMedium=None, doTight=None):
 
-#from tauRec.TauRecAODBuilder import TauRecAODProcessor_FTau
-#TauRecAODProcessor_FTau()
-
-DFCommonTauWrapperTools = []
-
-# VeryLoose
-DFCommonTausSelectorVeryLoose = TauAnalysisTools__TauSelectionTool(name="DFCommonTausSelectorVeryLoose")
-DFCommonTausSelectorVeryLoose.JetIDWP = 19
-DFCommonTausSelectorVeryLoose.SelectionCuts = 1<<6
-DFCommonTausSelectorVeryLoose.ConfigPath = ''
-#TauAnalysisTools::CutJetIDWP should be used but issue with the dictionnary
-ToolSvc += DFCommonTausSelectorVeryLoose
-DFCommonTausVeryLooseWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonTausVeryLooseWrapper",
-                                                                             AsgSelectionTool = DFCommonTausSelectorVeryLoose,
-                                                                             StoreGateEntryName   = "DFCommonTausVeryLoose",
-                                                                             ContainerName        = "TauJets")
-ToolSvc += DFCommonTausVeryLooseWrapper
-print (DFCommonTausVeryLooseWrapper)
-DFCommonTauWrapperTools.append(DFCommonTausVeryLooseWrapper)
-
-# Loose
-DFCommonTausSelectorLoose = TauAnalysisTools__TauSelectionTool(name="DFCommonTausSelectorLoose")
-DFCommonTausSelectorLoose.JetIDWP = 20
-DFCommonTausSelectorLoose.SelectionCuts = 1<<6
-DFCommonTausSelectorLoose.ConfigPath = ''
-#TauAnalysisTools::CutJetIDWP should be used but issue with the dictionnary
-ToolSvc += DFCommonTausSelectorLoose
-DFCommonTausLooseWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonTausLooseWrapper",
-                                                                         AsgSelectionTool = DFCommonTausSelectorLoose,
-                                                                         StoreGateEntryName   = "DFCommonTausLoose",
-                                                                         ContainerName        = "TauJets")
-ToolSvc += DFCommonTausLooseWrapper
-print (DFCommonTausLooseWrapper)
-DFCommonTauWrapperTools.append(DFCommonTausLooseWrapper)
-
-# Medium
-DFCommonTausSelectorMedium = TauAnalysisTools__TauSelectionTool(name="DFCommonTausSelectorMedium")
-DFCommonTausSelectorMedium.JetIDWP = 21
-DFCommonTausSelectorMedium.SelectionCuts = 1<<6
-DFCommonTausSelectorMedium.ConfigPath = ''
-ToolSvc += DFCommonTausSelectorMedium
-DFCommonTausMediumWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonTausMediumWrapper",
-                                                                          AsgSelectionTool = DFCommonTausSelectorMedium,
-                                                                          StoreGateEntryName   = "DFCommonTausMedium",
-                                                                          ContainerName        = "TauJets")
-ToolSvc += DFCommonTausMediumWrapper
-print (DFCommonTausMediumWrapper)
-DFCommonTauWrapperTools.append(DFCommonTausMediumWrapper)
-
-# Tight
-DFCommonTausSelectorTight = TauAnalysisTools__TauSelectionTool(name="DFCommonTausSelectorTight")
-DFCommonTausSelectorTight.JetIDWP = 22
-DFCommonTausSelectorTight.SelectionCuts = 1<<6
-DFCommonTausSelectorTight.ConfigPath = ''
-ToolSvc += DFCommonTausSelectorTight
-DFCommonTausTightWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonTausTightWrapper",
-                                                                         AsgSelectionTool = DFCommonTausSelectorTight,
-                                                                         StoreGateEntryName   = "DFCommonTausTight",
-                                                                         ContainerName        = "TauJets" )
-ToolSvc += DFCommonTausTightWrapper
-print (DFCommonTausTightWrapper)
-DFCommonTauWrapperTools.append(DFCommonTausTightWrapper)
-
-
-#=======================================
-# CREATE THE DERIVATION KERNEL ALGORITHM
-#=======================================
+    if not Seq or hasattr(Seq,"TauAugmentationKernel"+Seq.name()):
+        print("Tau augmentation will not be scheduled")
+        return
 
-DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation( "TauCommonKernel",
-                                                                          AugmentationTools = DFCommonTauWrapperTools )
+    from AthenaCommon.AppMgr import ToolSvc
+    from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__AsgSelectionToolWrapper
+    from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauSelectionTool
+    import PyUtils.RootUtils as ru
+    ROOT = ru.import_root()
+    import cppyy
+    cppyy.loadDictionary('TauAnalysisTools')
+
+    TauAugmentationTools = []
+
+    if doVeryLoose:
+        if not hasattr(ToolSvc,"TauVeryLooseWrapper"):
+            TauSelectorVeryLoose = TauAnalysisTools__TauSelectionTool(name="TauSelectorVeryLoose")
+            TauSelectorVeryLoose.JetIDWP = ROOT.TauAnalysisTools.e_JETID.JETIDRNNVERYLOOSE
+            TauSelectorVeryLoose.SelectionCuts = ROOT.TauAnalysisTools.SelectionCuts.CutJetIDWP
+            TauSelectorVeryLoose.ConfigPath = ''
+            ToolSvc += TauSelectorVeryLoose
+
+            TauVeryLooseWrapper = DerivationFramework__AsgSelectionToolWrapper(name               = "TauVeryLooseWrapper",
+                                                                               AsgSelectionTool   = TauSelectorVeryLoose,
+                                                                               StoreGateEntryName = "DFTauVeryLoose",
+                                                                               ContainerName      = "TauJets")
+            ToolSvc += TauVeryLooseWrapper
+        else:
+            TauVeryLooseWrapper = getattr(ToolSvc,"TauVeryLooseWrapper")
+
+        print (TauVeryLooseWrapper)
+        TauAugmentationTools.append(TauVeryLooseWrapper)
+    
+    if doLoose:
+        if not hasattr(ToolSvc,"TauLooseWrapper"):
+            TauSelectorLoose = TauAnalysisTools__TauSelectionTool(name="TauSelectorLoose")
+            TauSelectorLoose.JetIDWP = ROOT.TauAnalysisTools.e_JETID.JETIDRNNLOOSE
+            TauSelectorLoose.SelectionCuts = ROOT.TauAnalysisTools.SelectionCuts.CutJetIDWP
+            TauSelectorLoose.ConfigPath = ''
+            ToolSvc += TauSelectorLoose
+
+            TauLooseWrapper = DerivationFramework__AsgSelectionToolWrapper(name               = "TauLooseWrapper",
+                                                                           AsgSelectionTool   = TauSelectorLoose,
+                                                                           StoreGateEntryName = "DFTauLoose",
+                                                                           ContainerName      = "TauJets")
+            ToolSvc += TauLooseWrapper
+        else:
+            TauLooseWrapper = getattr(ToolSvc,"TauLooseWrapper")
+
+        print (TauLooseWrapper)
+        TauAugmentationTools.append(TauLooseWrapper)
+    
+    if doMedium:
+        if not hasattr(ToolSvc,"TauMediumWrapper"):
+            TauSelectorMedium = TauAnalysisTools__TauSelectionTool(name="TauSelectorMedium")
+            TauSelectorMedium.JetIDWP = ROOT.TauAnalysisTools.e_JETID.JETIDRNNMEDIUM
+            TauSelectorMedium.SelectionCuts = ROOT.TauAnalysisTools.SelectionCuts.CutJetIDWP
+            TauSelectorMedium.ConfigPath = ''
+            ToolSvc += TauSelectorMedium
+
+            TauMediumWrapper = DerivationFramework__AsgSelectionToolWrapper(name               = "TauMediumWrapper",
+                                                                            AsgSelectionTool   = TauSelectorMedium,
+                                                                            StoreGateEntryName = "DFTauMedium",
+                                                                            ContainerName      = "TauJets")
+            ToolSvc += TauMediumWrapper
+        else:
+            TauMediumWrapper = getattr(ToolSvc,"TauMediumWrapper")
+
+        print (TauMediumWrapper)
+        TauAugmentationTools.append(TauMediumWrapper)
+    
+    if doTight:
+        if not hasattr(ToolSvc,"TauTightWrapper"):
+            TauSelectorTight = TauAnalysisTools__TauSelectionTool(name="TauSelectorTight")
+            TauSelectorTight.JetIDWP = ROOT.TauAnalysisTools.e_JETID.JETIDRNNTIGHT
+            TauSelectorTight.SelectionCuts = ROOT.TauAnalysisTools.SelectionCuts.CutJetIDWP
+            TauSelectorTight.ConfigPath = ''
+            ToolSvc += TauSelectorTight
+
+            TauTightWrapper = DerivationFramework__AsgSelectionToolWrapper(name               = "TauTightWrapper",
+                                                                           AsgSelectionTool   = TauSelectorTight,
+                                                                           StoreGateEntryName = "DFTauTight",
+                                                                           ContainerName      = "TauJets")
+            ToolSvc += TauTightWrapper
+        else:
+            TauTightWrapper = getattr(ToolSvc,"TauTightWrapper")
+
+        print (TauTightWrapper)
+        TauAugmentationTools.append(TauTightWrapper)
+            
+    if TauAugmentationTools:
+        Seq += CfgMgr.DerivationFramework__DerivationKernel("TauAugmentationKernel"+Seq.name(), AugmentationTools = TauAugmentationTools)
 
 #=================
 # TAU THINNING
 #=================
-def ThinTau(Name=None, ThinningService=None, Seq=None, SelectionString=None):
+def ThinTau(Seq=None, streamName=None, selectionString=None):
 
-    if not Name or not ThinningService or not Seq:
-        print ("Can't schedule tau thinning")
+    if not Seq or not streamName or hasattr(Seq,"TauThinningKernel"+Seq.name()):
+        print ("Tau thinning will not be scheduled")
         return
 
-    if not SelectionString:
-        SelectionString = "(TauJets.pt >= 15.*GeV) && (TauJets.nTracks<4 && TauJets.nTracks>0)"
+    if not selectionString:
+        selectionString = "(TauJets.pt >= 15.*GeV) && (TauJets.nTracks>0 && TauJets.nTracks<4)"
+
+    print ("Adding tau thinning:", selectionString)
 
     from AthenaCommon.AppMgr import ToolSvc
 
     # TauJets thinning
     from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__GenericObjectThinning
-    TauJetsThinningTool = DerivationFramework__GenericObjectThinning(name            = Name+"TauJetsThinningTool",
-                                                                     ThinningService = ThinningService,
+    TauJetsThinningTool = DerivationFramework__GenericObjectThinning(name            = "TauJetsThinningTool"+Seq.name(),
+                                                                     StreamName      = streamName,
                                                                      ContainerName   = "TauJets",
-                                                                     SelectionString = SelectionString)
+                                                                     SelectionString = selectionString)
     ToolSvc += TauJetsThinningTool
     print (TauJetsThinningTool)
 
     # Only keep tau tracks (and associated ID tracks) classified as charged tracks
     from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning
-    TauTPThinningTool = DerivationFramework__TauTrackParticleThinning(name                   = Name+"TauTPThinningTool",
-                                                                      ThinningService        = ThinningService,
+    TauTPThinningTool = DerivationFramework__TauTrackParticleThinning(name                   = "TauTPThinningTool"+Seq.name(),
+                                                                      StreamName             = streamName,
                                                                       TauKey                 = "TauJets",
                                                                       InDetTrackParticlesKey = "InDetTrackParticles",
-                                                                      SelectionString        = SelectionString,
-                                                                      ApplyAnd               = False,
+                                                                      SelectionString        = selectionString,
                                                                       DoTauTracksThinning    = True,
                                                                       TauTracksKey           = "TauTracks")
     ToolSvc += TauTPThinningTool
     print (TauTPThinningTool)
 
-    Seq += CfgMgr.DerivationFramework__DerivationKernel(Name+"TauThinningKernel", ThinningTools = [TauJetsThinningTool,TauTPThinningTool])
+    Seq += CfgMgr.DerivationFramework__DerivationKernel("TauThinningKernel"+Seq.name(), ThinningTools = [TauJetsThinningTool,TauTPThinningTool])
 
-'''
 #=======================================
 # Low-pt di-tau reconstruction
 #=======================================
-def addDiTauLowPt():
+def addDiTauLowPt(Seq=None):
 
-    from AthenaCommon.AppMgr import ToolSvc
-    if hasattr(ToolSvc,"DFCommonDiTauLowPtBuilder"):
+    if not Seq or hasattr(Seq,"DiTauLowPtBuilder"+Seq.name()):
+        print("Low-pt ditau reconstruction will not be scheduled")
         return
 
+    print ("Adding low-pt di-tau reconstruction")
+
     from DerivationFrameworkJetEtMiss.ExtendedJetCommon import addCHSPFlowObjects
     addCHSPFlowObjects()
 
     from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets
-    from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob
-    addStandardJets("AntiKt", 1.0, "EMPFlow", ptmin=40000, ptminFilter=50000, mods="pflow_ungroomed", calibOpt="none", algseq=DerivationFrameworkJob, outputGroup="TauCommon")
+    addStandardJets("AntiKt", 1.0, "EMPFlow", ptmin=40000, ptminFilter=50000, mods="pflow_ungroomed", calibOpt="none", algseq=Seq, outputGroup="TauCommon")
 
     import DiTauRec.DiTauAlgorithmsHolder as DiTauAlgs
     from DiTauRec.DiTauRecConf import DiTauBuilder
@@ -156,17 +174,18 @@ def addDiTauLowPt():
     ditauTools.append(DiTauAlgs.getSeedJetBuilder("AntiKt10EMPFlowJets"))
     ditauTools.append(DiTauAlgs.getElMuFinder())
     ditauTools.append(DiTauAlgs.getSubjetBuilder())
+    Seq += DiTauAlgs.getTVATool()
     ditauTools.append(DiTauAlgs.getVertexFinder())
     ditauTools.append(DiTauAlgs.getDiTauTrackFinder())
     ditauTools.append(DiTauAlgs.getIDVarCalculator(False))
 
+    from AthenaCommon.AppMgr import ToolSvc
     for tool in ditauTools:
         if not hasattr(ToolSvc,tool.name()):
             ToolSvc += tool            
     
-    DiTauLowPtBuilder = DiTauBuilder(name="DFCommonDiTauLowPtBuilder",
+    DiTauLowPtBuilder = DiTauBuilder(name="DiTauLowPtBuilder"+Seq.name(),
                                      DiTauContainer="DiTauJetsLowPt",
-                                     DiTauAuxContainer="DiTauJetsLowPtAux.",
                                      SeedJetName="AntiKt10EMPFlowJets",
                                      minPt=50000,
                                      maxEta=2.5,
@@ -174,8 +193,4 @@ def addDiTauLowPt():
                                      Rsubjet=0.2,
                                      Rcore=0.1,
                                      Tools=ditauTools)
-    ToolSvc += DiTauLowPtBuilder
-    DerivationFrameworkJob += DiTauLowPtBuilder
-
-    print ("Low-pt di-tau building has been scheduled")
-'''
+    Seq += DiTauLowPtBuilder
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauJetsCPContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauJetsCPContent.py
index 7fc38cbb54c33c83d8906590722ace6e689182d7..4892bc607d8b4762c234748a6fec0c1773edfb35 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauJetsCPContent.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauJetsCPContent.py
@@ -5,7 +5,7 @@ TauJetsCPContent = [
 "InDetTrackParticles",
 "InDetTrackParticlesAux.phi.vertexLink.theta.qOverP.truthParticleLink.truthMatchProbability",
 "TauJets",
-"TauJetsAux.pt.eta.phi.m.tauTrackLinks.jetLink.vertexLink.charge.isTauFlags.BDTJetScore.BDTEleScore.ptFinalCalib.etaFinalCalib.phiFinalCalib.mFinalCalib.electronLink.EleMatchLikelihoodScore.pt_combined.eta_combined.phi_combined.m_combined.BDTJetScoreSigTrans.BDTEleScoreSigTrans.PanTau_DecayMode.RNNJetScore.RNNJetScoreSigTrans.seedJetWidth.seedJetJvt.BDTEleScore_retuned.BDTEleScoreSigTrans_retuned.BDTEleLoose_retuned.BDTEleMedium_retuned.BDTEleTight_retuned.seedTrackWidthPt1000.seedTrackWidthPt500.truthParticleLink.truthJetLink",
+"TauJetsAux.pt.eta.phi.m.tauTrackLinks.jetLink.vertexLink.charge.isTauFlags.BDTJetScore.BDTEleScore.ptFinalCalib.etaFinalCalib.phiFinalCalib.mFinalCalib.electronLink.EleMatchLikelihoodScore.pt_combined.eta_combined.phi_combined.m_combined.BDTJetScoreSigTrans.BDTEleScoreSigTrans.PanTau_DecayMode.RNNJetScore.RNNJetScoreSigTrans.seedJetWidth.seedJetJvt.seedTrackWidthPt1000.seedTrackWidthPt500.truthParticleLink.truthJetLink",
 "TauTracks",
 "TauTracksAux.pt.eta.phi.flagSet.trackLinks",
 "TruthTaus",
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/share/TRIG6.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/share/TRIG6.py
index badb4e1280668d40abf9e61fee5ced201614c0bb..99f70ec40876028464982f1202a8079554cb11e3 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/share/TRIG6.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/share/TRIG6.py
@@ -14,7 +14,6 @@ trig6Seq = CfgMgr.AthSequencer("TRIG6Sequence")
 #====================================================================
 # SET UP STREAM   
 #====================================================================
-from AthenaServices.Configurables import ThinningSvc, createThinningSvc
 
 streamName = derivationFlags.WriteDAOD_TRIG6Stream.StreamName
 fileName   = buildFileName( derivationFlags.WriteDAOD_TRIG6Stream )
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/share/TRIG7.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/share/TRIG7.py
index 97e40b0b87256c7b2180e57500e78b5b9720cf52..4b13f83d0e601114aa3c2307a2de71bf317d7def 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/share/TRIG7.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTrigger/share/TRIG7.py
@@ -81,14 +81,6 @@ fileName   = buildFileName( derivationFlags.WriteDAOD_TRIG7Stream )
 TRIG7Stream = MSMgr.NewPoolRootStream( streamName, fileName )
 TRIG7Stream.AcceptAlgs(["TRIG7MainKernel"])
 
-#====================================================================
-# SET UP THINNING SERVICE   
-#====================================================================
-#from AthenaServices.Configurables import ThinningSvc, createThinningSvc
-#augStream = MSMgr.GetStream( streamName )
-#evtStream = augStream.GetEventStream()
-#svcMgr += createThinningSvc( svcName="TRIG7ThinningSvc", outStreams=[evtStream] )
-
 #====================================================================
 # THINNING HELPER
 #====================================================================
@@ -111,7 +103,7 @@ jetcuts = '(AntiKt10LCTopoJets.pt > '+jetptmin+'*GeV && abs(AntiKt10LCTopoJets.e
 
 ## save clusters matched to ungroomed jets with jetcuts selection
 TRIG7ClusterThinningTool = DerivationFramework__JetCaloClusterThinning(name                  = "TRIG7ClusterThinningTool",
-                                                                       ThinningService       = TRIG7ThinningHelper.ThinningSvc(),
+                                                                       StreamName            = streamName,
                                                                        SGKey                 = "AntiKt10LCTopoJets",
                                                                        TopoClCollectionSGKey = "CaloCalTopoClusters",
                                                                        SelectionString       = jetcuts,
@@ -124,7 +116,7 @@ trigjetcuts = '(HLT_xAOD__JetContainer_a10tclcwsubjesFS.pt > '+jetptmin+'*GeV &&
 
 ## save clusters matched to ungroomed trigger jets passing trigjetcuts
 TRIG7TrigClusterThinningTool = DerivationFramework__JetCaloClusterThinning(name                  = "TRIG7TrigClusterThinningTool",
-                                                                           ThinningService       = TRIG7ThinningHelper.ThinningSvc(),
+                                                                           StreamName            = streamName,
                                                                            SGKey                 = "HLT_xAOD__JetContainer_a10tclcwsubjesFS",
                                                                            TopoClCollectionSGKey = "CaloCalTopoClusters",
                                                                            SelectionString       = trigjetcuts
@@ -140,7 +132,7 @@ from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFram
 
 ## save tracks matched to ungroomed jets passing jetcuts
 TRIG7TrackThinningTool = DerivationFramework__JetTrackParticleThinning(name      = "TRIG7TrackThinningTool",
-                                                                       ThinningService       = TRIG7ThinningHelper.ThinningSvc(),
+                                                                       StreamName             = streamName,
                                                                        JetKey                 = "AntiKt10LCTopoJets",
                                                                        InDetTrackParticlesKey = "InDetTrackParticles",
                                                                        SelectionString        = jetcuts)
@@ -149,7 +141,7 @@ thinningTools.append(TRIG7TrackThinningTool)
 
 ## save trackss matched to ungroomed trigger jets passing trigjets cuts
 TRIG7TrigTrackThinningTool = DerivationFramework__JetTrackParticleThinning(name   = "TRIG7TrigTrackThinningTool",
-                                                                           ThinningService       = TRIG7ThinningHelper.ThinningSvc(),
+                                                                           StreamName             = streamName,
                                                                            JetKey                 = "HLT_xAOD__JetContainer_a10tclcwsubjesFS",
                                                                            InDetTrackParticlesKey = "InDetTrackParticles",
                                                                            SelectionString        = trigjetcuts)
@@ -165,7 +157,7 @@ from AthenaCommon.GlobalFlags import globalflags
 if doTruthThinning and DerivationFrameworkIsMonteCarlo:  
   from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning
   TRIG7TruthThinningTool = DerivationFramework__MenuTruthThinning(name               = "TRIG7TruthThinningTool",
-                                                                  ThinningService    = TRIG7ThinningHelper.ThinningSvc(),
+                                                                  StreamName         = streamName,
                                                                   WriteAllStable     = True)
   ToolSvc += TRIG7TruthThinningTool
   thinningTools.append(TRIG7TruthThinningTool)
diff --git a/PhysicsAnalysis/HeavyIonPhys/HIEventUtils/Root/HITowerWeightTool.cxx b/PhysicsAnalysis/HeavyIonPhys/HIEventUtils/Root/HITowerWeightTool.cxx
index 1159f05437de616cf56207a48263a842429b9773..d61455cbb1b77f3d281cfa18c45e22298a918a55 100644
--- a/PhysicsAnalysis/HeavyIonPhys/HIEventUtils/Root/HITowerWeightTool.cxx
+++ b/PhysicsAnalysis/HeavyIonPhys/HIEventUtils/Root/HITowerWeightTool.cxx
@@ -85,8 +85,17 @@ StatusCode HITowerWeightTool::configureEvent()
     auto itr=m_runMap.find(run_number);
     if(itr==m_runMap.end())
     {
-      m_runIndex=0;
-      ATH_MSG_WARNING("No calibration avaliable for " << run_number << ". Doing no eta-phi correction.");
+			//trying generic run number <=> no run dependence
+		        run_number = 226000;
+		        auto itrg=m_runMap.find(run_number);
+		        if(itrg==m_runMap.end()){
+		            m_runIndex=0;
+		            ATH_MSG_WARNING("No generic calibration or calibration for " << run_number << " is avaliable. Doing no eta-phi correction.");
+		        }
+		        else {
+		            m_runIndex=itrg->second;
+		            ATH_MSG_DEBUG("Using generic calibration for eta-phi correction.");
+		        }
     }
     else m_runIndex=itr->second;
     m_runNumber=run_number;
@@ -161,7 +170,9 @@ StatusCode HITowerWeightTool::initialize()
     ATH_MSG_FATAL("Cannot find TH3F h1_run_index in config file " << full_path );
     return StatusCode::FAILURE;
   }
-  for(int xbin=1; xbin<h1_run_index->GetNbinsX(); xbin++) m_runMap.emplace_hint(m_runMap.end(),std::make_pair(h1_run_index->GetBinContent(xbin),xbin));
+  for(int xbin=1; xbin<=h1_run_index->GetNbinsX(); xbin++) {
+		m_runMap.emplace_hint(m_runMap.end(),std::make_pair(h1_run_index->GetBinContent(xbin),xbin));
+	}
   f->Close();
   m_init=true;
   return StatusCode::SUCCESS;
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagHighLevelAugmenterAlg.h b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagHighLevelAugmenterAlg.h
index d8cf5562a438311deed3c0f0c66a98f91879ceda..ed7eacd49dd40d90ad74dbcb7bae29e346a0b7d7 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagHighLevelAugmenterAlg.h
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagHighLevelAugmenterAlg.h
@@ -7,7 +7,7 @@
 
 // ATLAS things
 #include "AthenaBaseComps/AthAlgorithm.h"
-#include "xAODJet/Jet.h"
+#include "xAODJet/JetContainer.h"
 #include "xAODBTagging/BTagging.h"
 #include "xAODEventInfo/EventInfo.h"
 #include "StoreGate/ReadDecorHandle.h"
@@ -29,6 +29,7 @@ namespace Analysis {
    
   private:
     // Input Containers
+    SG::ReadHandleKey<xAOD::JetContainer > m_JetCollectionName {this, "JetCollectionName", "", "Input jet container"};
     SG::ReadHandleKey<xAOD::BTaggingContainer > m_BTagCollectionName {this, "BTaggingCollectionName", "", "Input BTagging container"};
     SG::ReadDecorHandleKey<xAOD::BTaggingContainer> m_bTagJetDecorLinkName {this, "JetLinkName", "", "Element Link from BTagging to Jet container"};
     std::string m_flipTagConfig;
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggerAlg.h b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggerAlg.h
index 61ee38e22928796ebfb13d4a38d38424c0873660..ef1a6f2417212de8b62fbc3ce8c9909756485325 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggerAlg.h
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggerAlg.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef BTAGGING_JETBTAGGERALG_HH
@@ -45,8 +45,9 @@ class  JetBTaggerAlg:
   private:
   
     SG::ReadHandleKey<xAOD::JetContainer > m_JetCollectionName {this, "JetCollectionName", "", "Input jet container"};
-    Gaudi::Property<SG::WriteDecorHandleKey<xAOD::JetContainer> >m_jetBTaggingLinkName{this,"JetContainerName","","Element link form jet to BTagging container"};
+    SG::WriteDecorHandleKey<xAOD::JetContainer> m_jetBTaggingLinkName{this, "BTaggingLinkName","","Element link form jet to BTagging container"};
     SG::WriteHandleKey<xAOD::BTaggingContainer> m_BTaggingCollectionName {this, "BTaggingCollectionName", "", "Output BTagging container"};
+    SG::WriteDecorHandleKey<xAOD::BTaggingContainer> m_bTagJetDecorLinkName {this, "JetLinkName", "", "Element Link from BTagging to Jet container"};
 
     std::string m_JetName;
     std::string m_BTagLink;
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagHighLevelAugmenterAlgConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagHighLevelAugmenterAlgConfig.py
index 4dfca4ee3f4f7eedd8cbc6422a3fd8684bea2375..4a10f594b8ba36dd9bd831a0e561b1acf6b03028 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagHighLevelAugmenterAlgConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagHighLevelAugmenterAlgConfig.py
@@ -5,7 +5,7 @@ from AthenaConfiguration.ComponentFactory import CompFactory
 
 Analysis__BTagHighLevelAugmenterAlg=CompFactory.Analysis.BTagHighLevelAugmenterAlg
 
-def BTagHighLevelAugmenterAlgCfg(ConfigFlags, sequenceName, BTagCollection, Associator, doFlipTagger=False, **options):
+def BTagHighLevelAugmenterAlgCfg(ConfigFlags, sequenceName, JetCollection, BTagCollection, Associator, doFlipTagger=False, **options):
     """Adds a SecVtxTool instance and registers it.
 
     input: name:               The algorithm's name.
@@ -16,6 +16,7 @@ def BTagHighLevelAugmenterAlgCfg(ConfigFlags, sequenceName, BTagCollection, Asso
     acc = ComponentAccumulator(sequenceName)
 
     options = {}
+    options['JetCollectionName'] = JetCollection.replace('Track', 'PV0Track') + 'Jets'
     options['BTaggingCollectionName'] = BTagCollection
     options['JetLinkName'] = options['BTaggingCollectionName'] + '.jetLink'
     options['BTagTrackToJetAssociatorName'] = Associator
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagLightSecVertexingConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagLightSecVertexingConfig.py
index e87c04895a862dda1df484b580b3335de65358ac..c9b3f11742d936b36957563c71b84921d237985d 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagLightSecVertexingConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagLightSecVertexingConfig.py
@@ -2,7 +2,6 @@
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 from JetTagTools.JetFitterVariablesFactoryConfig import JetFitterVariablesFactoryCfg
 #from BTagging.MSVVariablesFactoryConfig import MSVVariablesFactoryCfg
 
@@ -46,8 +45,8 @@ def BTagLightSecVtxToolCfg(flags, Name, JetCollection, SVandAssoc = {""}, TimeSt
     options.setdefault('SecVtxFinderTrackNameList', secVtxFinderTrackNameList)
     options.setdefault('SecVtxFinderxAODBaseNameList', secVtxFinderxAODBaseNameList)
     options['BTagVxSecVertexInfoNames'] = VxSecVertexInfoNameList
-    options.setdefault('PrimaryVertexName', BTaggingFlags.PrimaryVertexCollectionName)
-    options.setdefault('vxPrimaryCollectionName', BTaggingFlags.PrimaryVertexCollectionName)
+    options.setdefault('PrimaryVertexName', flags.BTagging.PrimaryVertexCollectionName)
+    options.setdefault('vxPrimaryCollectionName', flags.BTagging.PrimaryVertexCollectionName)
     options.setdefault('JetFitterVariableFactory', jetFitterVF)
     options['JetSecVtxLinkName'] = jetcol + '.' + OutputFilesSVname
     options['JetJFVtxLinkName'] = jetcol + '.' + OutputFilesJFVxname
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagRun3Config.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagRun3Config.py
index 3d31adb660c47af3344a673e714768616e160c3b..fe5c1fcfe6f00919a8f10d8cf01dec3b52ac2da3 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagRun3Config.py
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagRun3Config.py
@@ -3,7 +3,6 @@
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
 from IOVDbSvc.IOVDbSvcConfig import addFolders
-from BTagging.BTaggingFlags import BTaggingFlags
 from BTagging.JetBTaggerAlgConfig import JetBTaggerAlgCfg
 from BTagging.JetParticleAssociationAlgConfig import JetParticleAssociationAlgCfg
 from BTagging.JetBTaggingAlgConfig import JetBTaggingAlgCfg
@@ -13,22 +12,49 @@ from BTagging.BTagTrackAugmenterAlgConfig import BTagTrackAugmenterAlgCfg
 from BTagging.BTagHighLevelAugmenterAlgConfig import BTagHighLevelAugmenterAlgCfg
 from BTagging.HighLevelBTagAlgConfig import HighLevelBTagAlgCfg
 
-def JetTagCalibCfg(ConfigFlags, scheme="", TaggerList = []):
+def JetTagCalibCfg(ConfigFlags, scheme="", TaggerList = [], useBTagFlagsDefaults = True, **kwargs):
     result=ComponentAccumulator()
 
-    #if ConfInstance.checkFlagsUsingBTaggingFlags():
-    if True:
+    CalibrationChannelAliases = [ "myOwnCollection->AntiKt4TopoEM,AntiKt4EMTopo",
+                              "AntiKt4Tower->AntiKt4Tower,AntiKt4H1Tower,AntiKt4TopoEM,AntiKt4EMTopo",
+                              "AntiKt4Topo->AntiKt4Topo,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4H1Topo",
+                              "AntiKt4LCTopo->AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4Topo,AntiKt4H1Topo",
+                              "AntiKt6Tower->AntiKt6Tower,AntiKt6H1Tower,AntiKt4TopoEM,AntiKt4EMTopo",
+                              "AntiKt6Topo->AntiKt6Topo,AntiKt6TopoEM,AntiKt6H1Topo,AntiKt6H1Tower,AntiKt4TopoEM,AntiKt4EMTopo",
+                              "AntiKt6LCTopo->AntiKt6LCTopo,AntiKt6TopoEM,AntiKt6Topo,AntiKt6H1Topo,AntiKt6H1Tower,AntiKt4TopoEM,AntiKt4EMTopo",
+                              "AntiKt4TopoEM->AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4H1Topo,AntiKt4LCTopo",
+                              "AntiKt6TopoEM->AntiKt6TopoEM,AntiKt6H1Topo,AntiKt6H1Tower,AntiKt4TopoEM,AntiKt4EMTopo",
+                              #WOUTER: I added some more aliases here that were previously set up at ./python/BTagging_jobOptions.py. But it cannot
+                              #stay there if we want support for JetRec to setup b-tagging from their end.
+                              "AntiKt4EMTopo->AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo",
+                              "AntiKt4LCTopo->AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo",
+                              "AntiKt4EMTopoOrigin->AntiKt4EMTopoOrigin,AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo",
+                              "AntiKt4LCTopoOrigin->AntiKt4LCTopoOrigin,AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo",
+                              "AntiKt10LCTopo->AntiKt10LCTopo,AntiKt6LCTopo,AntiKt6TopoEM,AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo",
+                              "AntiKt10Truth->AntiKt6TopoEM,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo",
+                              "AntiKt10TruthWZ->AntiKt10TruthWZ,AntiKt6TopoEM,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo",
+                              "AntiKt4Truth->AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo",
+                              "AntiKt4TruthWZ->AntiKt4TruthWZ,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo",
+                              "AntiKt4Track->AntiKt4Track,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo",
+                              "AntiKt3Track->AntiKt3Track,AntiKt4Track,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo",
+                              "AntiKt2Track->AntiKt2Track,AntiKt4Track,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo",
+                              "AntiKt4EMPFlow->AntiKt4EMPFlow,AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo",
+                              "AntiKt4HI->AntiKt4HI,AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo"]
+
+    newChannel = kwargs.get("NewChannel")
+    if newChannel:
+        CalibrationChannelAliases.append(newChannel)
+       
+    if useBTagFlagsDefaults:
       #IP2D
-      grades= [ "0HitIn0HitNInExp2","0HitIn0HitNInExpIn","0HitIn0HitNInExpNIn","0HitIn0HitNIn",
-                  "0HitInExp", "0HitIn",
-                  "0HitNInExp", "0HitNIn",
-                  "InANDNInShared", "PixShared", "SctShared",
-                  "InANDNInSplit", "PixSplit",
-                  "Good"]
+      grades= ConfigFlags.BTagging.Grades
 
       #IP3D
       #Same as IP2D. Revisit JetTagCalibCondAlg.cxx if not.
 
+      #RNNIP
+      RNNIPConfig = {'rnnip':''}
+
       JetTagCalibCondAlg=CompFactory.Analysis.JetTagCalibCondAlg
       jettagcalibcondalg = "JetTagCalibCondAlg"
       readkeycalibpath = "/GLOBAL/BTagCalib/RUN12"
@@ -38,7 +64,7 @@ def JetTagCalibCfg(ConfigFlags, scheme="", TaggerList = []):
           connSchema = "GLOBAL"
       histoskey = "JetTagCalibHistosKey"
       result.merge(addFolders(ConfigFlags,[readkeycalibpath], connSchema, className='CondAttrListCollection'))
-      JetTagCalib = JetTagCalibCondAlg(jettagcalibcondalg, ReadKeyCalibPath=readkeycalibpath, HistosKey = histoskey, taggers = TaggerList, channelAliases = BTaggingFlags.CalibrationChannelAliases, IP2D_TrackGradePartitions = grades, RNNIP_NetworkConfig = BTaggingFlags.RNNIPConfig)
+      JetTagCalib = JetTagCalibCondAlg(jettagcalibcondalg, ReadKeyCalibPath=readkeycalibpath, HistosKey = histoskey, taggers = TaggerList, channelAliases = CalibrationChannelAliases, IP2D_TrackGradePartitions = grades, RNNIP_NetworkConfig = RNNIPConfig)
   # Maybe needed for trigger use
   #from IOVDbSvc.CondDB import conddb
   #if conddb.dbdata == 'COMP200':
@@ -57,7 +83,7 @@ def registerJetCollectionEL(flags, JetCollection, TimeStamp):
     ItemList = []
     # btaggingLink
     suffix = ".".join(['btaggingLink'+ ts for ts in TimeStamp])
-    ItemList.append('xAOD::JetContainer#'+JetCollection+'Jets.' + suffix)
+    ItemList.append('xAOD::JetContainer#'+JetCollection+'Jets')
     ItemList.append('xAOD::JetAuxContainer#'+JetCollection+'JetsAux.'+ suffix)
 
     return ItemList
@@ -91,12 +117,8 @@ def registerOutputBTaggingContainers(flags, JetCollection, suffix = ''):
           author += '_' + suffix
 
       ItemList.append(OutputFilesBaseName + author)
-      # jetLink
-      jetLink = '.jetLink'
-      ItemList.append(OutputFilesBaseName+author+jetLink)
-      ItemList.append(OutputFilesBaseAuxName+author+jetLink)
-
-      ItemList.append(OutputFilesBaseAuxName + author + 'Aux.-BTagTrackToJetAssociatorBB')
+      ItemList.append(OutputFilesBaseAuxName + author + 'Aux.*')
+      #ItemList.append(OutputFilesBaseAuxName + author + 'Aux.-BTagTrackToJetAssociatorBB')
 
       return ItemList
 
@@ -107,6 +129,8 @@ def BTagRedoESDCfg(flags, jet, extraContainers=[]):
 
     #Register input ESD container in output
     ESDItemList = registerOutputBTaggingContainers(flags, jet)
+    ESDItemList += registerJetCollectionEL(flags, jet, [''])
+    print(ESDItemList)
     from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
     acc.merge(OutputStreamCfg(flags,"ESD", ItemList=ESDItemList+extraContainers))
 
@@ -145,18 +169,23 @@ def RenameInputContainerCfg(suffix):
 
     return acc
 
-def BTagCfg(inputFlags,**kwargs):
+def RenameHLTaggerCfg(JetCollection, Tagger, suffix):
+    acc=ComponentAccumulator()
+    AddressRemappingSvc, ProxyProviderSvc=CompFactory.getComps("AddressRemappingSvc","ProxyProviderSvc",)
+    AddressRemappingSvc = AddressRemappingSvc("AddressRemappingSvc")
+    AddressRemappingSvc.TypeKeyRenameMaps += ['xAOD::BTaggingAuxContainer#BTagging_' + JetCollection + '.' + Tagger + '_pu->BTagging_' + JetCollection + '.'+ Tagger + '_pu' + suffix]
+    AddressRemappingSvc.TypeKeyRenameMaps += ['xAOD::BTaggingAuxContainer#BTagging_' + JetCollection + '.' + Tagger + '_pc->BTagging_' + JetCollection + '.'+ Tagger + '_pc' + suffix]
+    AddressRemappingSvc.TypeKeyRenameMaps += ['xAOD::BTaggingAuxContainer#BTagging_' + JetCollection + '.' + Tagger + '_pb->BTagging_' + JetCollection + '.'+ Tagger + '_pb' + suffix]
+    AddressRemappingSvc.TypeKeyRenameMaps += ['xAOD::BTaggingAuxContainer#BTagging_' + JetCollection + '.' + Tagger + '_ptau->BTagging_' + JetCollection + '.'+ Tagger + '_ptau' + suffix]
+    acc.addService(AddressRemappingSvc)
+    acc.addService(ProxyProviderSvc(ProviderNames = [ "AddressRemappingSvc" ]))
 
-    #This is monolithic for now. 
-    #Once a first complete example runs, this will be split into small modular chunks.
-    #Some such items may be best placed elsewehere (e.g. put magnetic field setup in magnetic field git folder etc)
+    return acc
+def PrepareStandAloneBTagCfg(inputFlags):
     result=ComponentAccumulator()
-    timestamp = kwargs.get('TimeStamp', None)
-    if timestamp: del kwargs['TimeStamp']
-    splitAlg = kwargs.get('SplitAlg', None)
-    del kwargs['SplitAlg']
-    release = kwargs.get('Release', None)
-    if release: del kwargs['Release']
+
+    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
+    result.merge(PoolReadCfg(inputFlags))
 
     from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
     acc = TrackingGeometrySvcCfg(inputFlags)
@@ -184,11 +213,22 @@ def BTagCfg(inputFlags,**kwargs):
     #load folders needed for IBL
     result.merge(addFolders(inputFlags,['/Indet/IBLDist'],'INDET_OFL'))
 
-    #Should be parameters
-    JetCollection = ['AntiKt4EMTopo','AntiKt4EMPFlow']
+    return result
+
+def BTagCfg(inputFlags, JetCollection = [], **kwargs):
+
+    #This is monolithic for now. 
+    #Once a first complete example runs, this will be split into small modular chunks.
+    #Some such items may be best placed elsewehere (e.g. put magnetic field setup in magnetic field git folder etc)
+    result=ComponentAccumulator()
+    timestamp = kwargs.get('TimeStamp', None)
+    if timestamp: del kwargs['TimeStamp']
+    splitAlg = kwargs.get('SplitAlg', None)
+    del kwargs['SplitAlg']
+
 
     TrainedTaggers = inputFlags.BTagging.run2TaggersList + ['MultiSVbb1','MultiSVbb2']
-    result.merge(JetTagCalibCfg(inputFlags, TaggerList = TrainedTaggers))
+    result.merge(JetTagCalibCfg(inputFlags, TaggerList = TrainedTaggers, **kwargs))
 
     for jet in JetCollection:
         taggerList = inputFlags.BTagging.run2TaggersList
@@ -200,6 +240,10 @@ def BTagCfg(inputFlags,**kwargs):
             result.merge(RenameInputContainerCfg("old"))
         else:
             extraCont = []
+            extraCont.append("xAOD::VertexContainer#PrimaryVertices")
+            extraCont.append("xAOD::VertexAuxContainer#PrimaryVerticesAux.")
+            extraCont.append("xAOD::TrackParticleContainer#InDetTrackParticles")
+            extraCont.append("xAOD::TrackParticleAuxContainer#InDetTrackParticlesAux.")
             if splitAlg:
                 JFSecVtx = "xAOD::BTagVertexContainer#"
                 AuxJFSecVtx= "xAOD::BTagVertexAuxContainer#"
@@ -217,64 +261,74 @@ def BTagCfg(inputFlags,**kwargs):
             result.merge(BTagRedoESDCfg(inputFlags, jet, extraCont))
 
         if splitAlg:
-            timestamp = kwargs.get('TimeStamp', None)
-            if not timestamp:
-                timestamp = ['']
-            else:
-                del kwargs['TimeStamp']
-
-            postTagDL2JetToTrainingMap={
-                'AntiKt4EMPFlow': [
-                #'BTagging/201903/smt/antikt4empflow/network.json',
-                'BTagging/201903/rnnip/antikt4empflow/network.json',
-                'BTagging/201903/dl1r/antikt4empflow/network.json',
-                'BTagging/201903/dl1/antikt4empflow/network.json',
-                #'BTagging/201903/dl1rmu/antikt4empflow/network.json',
-                ]
-            }
-
-            if jet in postTagDL2JetToTrainingMap:
-                #Remove DL1 and RNNIP from taggers list, those taggers are run with HighLevelBTagAlg
-                taggerList.remove('RNNIP')
-                taggerList.remove('DL1')
-
-            #Track Association
-            TrackToJetAssociators = ['BTagTrackToJetAssociator', 'BTagTrackToJetAssociatorBB']
-
-            kwargs['Release'] = '22'
-            result.merge(JetParticleAssociationAlgCfg(inputFlags, jet, "InDetTrackParticles", 'BTagTrackToJetAssociator', **kwargs))
-            kwargs['Release'] = '21'
-            #result.merge(JetParticleAssociationAlgCfg(inputFlags, jet, "InDetTrackParticles", 'BTagTrackToJetAssociator', **kwargs))
-            result.merge(JetParticleAssociationAlgCfg(inputFlags, jet, "InDetTrackParticles", 'BTagTrackToJetAssociatorBB', **kwargs))
-            del kwargs['Release']
+            secVertexingAndAssociators = {'JetFitter':'BTagTrackToJetAssociator','SV1':'BTagTrackToJetAssociator', 'MSV':'BTagTrackToJetAssociatorBB'}
+            result.merge(JetBTaggerSplitAlgsCfg(inputFlags, JetCollection = jet, TaggerList = taggerList, SecVertexingAndAssociators = secVertexingAndAssociators, **kwargs))
+        else:
+            result.merge(JetBTaggerAlgCfg(inputFlags, JetCollection = jet, TaggerList = taggerList, **kwargs))
 
-            #Sec vertex finding
-            SecVertexingAndAssociators = {'JetFitter':'BTagTrackToJetAssociator','SV1':'BTagTrackToJetAssociator'}
-            for k, v in SecVertexingAndAssociators.items():
-                if v not in TrackToJetAssociators:
-                    raise RuntimeError( v + ' is not configured')
-                result.merge(JetSecVtxFindingAlgCfg(inputFlags, jet, "InDetTrackParticles", k, v))
+    return result
 
-                #Sec vertexing
-                result.merge(JetSecVertexingAlgCfg(inputFlags, jet, "InDetTrackParticles", k, v))
+def JetBTaggerSplitAlgsCfg(inputFlags, JetCollection="", TaggerList=[], SecVertexingAndAssociators = {}, SetupScheme="", **kwargs):
 
-            #result.merge(JetSecVertexingAlgCfg(inputFlags, jet, "InDetTrackParticles", 'MSV', 'BTagTrackToJetAssociatorBB'))
+    result=ComponentAccumulator()
+    jet = JetCollection
 
-            #BTagging
-            for ts in timestamp:
-                result.merge(JetBTaggingAlgCfg(inputFlags, JetCollection = jet, TaggerList = taggerList, SVandAssoc = SecVertexingAndAssociators, TimeStamp = ts, **kwargs))
+    timestamp = kwargs.get('TimeStamp', None)
+    if not timestamp:
+        timestamp = ['']
+    else:
+        del kwargs['TimeStamp']
+
+    postTagDL2JetToTrainingMap={
+        'AntiKt4EMPFlow': [
+        #'BTagging/201903/smt/antikt4empflow/network.json',
+        'BTagging/201903/rnnip/antikt4empflow/network.json',
+        'BTagging/201903/dl1r/antikt4empflow/network.json',
+        'BTagging/201903/dl1/antikt4empflow/network.json',
+        #'BTagging/201903/dl1rmu/antikt4empflow/network.json',
+        ]
+    }
+
+    if jet in postTagDL2JetToTrainingMap:
+        #Remove DL1 and RNNIP from taggers list, those taggers are run with HighLevelBTagAlg
+        TaggerList.remove('RNNIP')
+        TaggerList.remove('DL1')
+
+    #Track Association
+    TrackToJetAssociators = list(set(SecVertexingAndAssociators.values()))
+    if kwargs.get('Release', None) == '22':
+        #JetParticleAssociationAlg not implemented for BTagTrackToJetAssociatorBB in rel 22
+        TrackToJetAssociators.remove('BTagTrackToJetAssociatorBB')
+
+    for assoc in TrackToJetAssociators:
+        result.merge(JetParticleAssociationAlgCfg(inputFlags, jet, "InDetTrackParticles", assoc, **kwargs))
+        
+    del kwargs['Release']
+
+    #Sec vertex finding
+    for k, v in SecVertexingAndAssociators.items():
+        if v not in TrackToJetAssociators:
+            print( v + ' is not configured, Sec vertex finding skipped')
+            del SecVertexingAndAssociators[k]
+        else:
+            result.merge(JetSecVtxFindingAlgCfg(inputFlags, jet, "InDetTrackParticles", k, v))
+            #Sec vertexing
+            result.merge(JetSecVertexingAlgCfg(inputFlags, jet, "InDetTrackParticles", k, v))
 
-            if jet in postTagDL2JetToTrainingMap:
-                #Track Augmenter
-                result.merge(BTagTrackAugmenterAlgCfg(inputFlags))
+    #result.merge(JetSecVertexingAlgCfg(inputFlags, jet, "InDetTrackParticles", 'MSV', 'BTagTrackToJetAssociatorBB'))
 
-                for ts in timestamp:
-                    #HighLevel taggers can not be run with time stamped containers
-                    if ts == "":
-                        result.merge(RunHighLevelTaggersCfg(inputFlags, jet, 'BTagTrackToJetAssociator', postTagDL2JetToTrainingMap[jet], ts))
+    #BTagging
+    for ts in timestamp:
+        result.merge(JetBTaggingAlgCfg(inputFlags, JetCollection = jet, TaggerList = TaggerList, SVandAssoc = SecVertexingAndAssociators, TimeStamp = ts, **kwargs))
 
-        else:
-            result.merge(JetBTaggerAlgCfg(inputFlags, JetCollection = jet, TaggerList = taggerList, **kwargs))
+    if jet in postTagDL2JetToTrainingMap:
+        #Track Augmenter
+        result.merge(BTagTrackAugmenterAlgCfg(inputFlags))
+
+        for ts in timestamp:
+            #HighLevel taggers can not be run with time stamped containers
+            if ts == "":
+                result.merge(RunHighLevelTaggersCfg(inputFlags, jet, 'BTagTrackToJetAssociator', postTagDL2JetToTrainingMap[jet], ts))
 
     return result
 
@@ -292,12 +346,41 @@ def RunHighLevelTaggersCfg(inputFlags, JetCollection, Associator, TrainingMaps,
     HLBTagSeq = AthSequencer(sequenceName, Sequential = True)
     result.addSequence(HLBTagSeq)
 
-    result.merge(BTagHighLevelAugmenterAlgCfg(inputFlags, sequenceName, BTagCollection = BTagCollection, Associator = Associator, **kwargs) )
+    result.merge(BTagHighLevelAugmenterAlgCfg(inputFlags, sequenceName, JetCollection = JetCollection, BTagCollection = BTagCollection, Associator = Associator) )
     for dl2 in TrainingMaps:
         result.merge(HighLevelBTagAlgCfg(inputFlags, sequenceName, BTagCollection, dl2) )
 
     return result
 
+def BTagHLTaggersCfg(inputFlags, JetCollection = []):
+    acc = ComponentAccumulator()
+
+    # Nothing written out
+    from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
+    acc.merge(OutputStreamCfg(cfgFlags,"ESD", ItemList=[]))
+
+    DeprecatedHLTaggers = ['rnnip', 'DL1']
+    postTagDL2JetToTrainingMap={
+        'AntiKt4EMPFlow': [
+        #'BTagging/201903/smt/antikt4empflow/network.json',
+        'BTagging/201903/rnnip/antikt4empflow/network.json',
+        'BTagging/201903/dl1r/antikt4empflow/network.json',
+        'BTagging/201903/dl1/antikt4empflow/network.json',
+        #'BTagging/201903/dl1rmu/antikt4empflow/network.json',
+        ]
+    }
+    for jet in JetCollection:
+        if jet in postTagDL2JetToTrainingMap:
+            for tagger in DeprecatedHLTaggers:
+                acc.merge(RenameHLTaggerCfg(jet, tagger, '_old'))
+            #Track Augmenter
+            acc.merge(BTagTrackAugmenterAlgCfg(cfgFlags))
+
+            #HighLevel taggers can not be run with time stamped containers
+            acc.merge(RunHighLevelTaggersCfg(cfgFlags, jet, 'BTagTrackToJetAssociator', postTagDL2JetToTrainingMap[jet], ""))
+
+    return acc
+
 def str2bool(v):
     if v.lower() in ('yes', 'true', 't', 'y', '1'):
         return True
@@ -315,6 +398,7 @@ if __name__=="__main__":
     parser.add_argument("-f", "--filesIn", default = inputESD, type=str, help="Comma-separated list of input files")
     parser.add_argument("-t", "--nThreads", default=1, type=int, help="The number of concurrent threads to run. 0 uses serial Athena.")
     parser.add_argument("-r", "--release", default="22", type=str, help="Release number to test different scenarii.")
+    parser.add_argument("-l", "--highlevel", type=str2bool, default=False, help="Run only high level taggers.")
     parser.add_argument('-s', '--splitAlg', type=str2bool, default=False, help="Split JetBTaggerAlg.")
 
     args = parser.parse_args()
@@ -346,15 +430,21 @@ if __name__=="__main__":
     # Prevent the flags from being modified
     cfgFlags.lock()
 
-    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
-    acc.merge(PoolReadCfg(cfgFlags))
+    acc.merge(PrepareStandAloneBTagCfg(cfgFlags))
 
-    kwargs = {}
-    if args.release == "21.2":
-        kwargs["TimeStamp"] = ['201810','201903']
-    kwargs["SplitAlg"] = args.splitAlg
+    JetCollection = ['AntiKt4EMTopo', 'AntiKt4EMPFlow']
+
+    if args.highlevel:
+        acc.merge(BTagHLTaggersCfg(cfgFlags, JetCollection = JetCollection))
+    else:
+        kwargs = {}
+        kwargs['Release'] = args.release
+        if args.release == "21.2":
+            kwargs["TimeStamp"] = ['201810','201903']
+            kwargs['Release'] = '21'
+        kwargs["SplitAlg"] = args.splitAlg
 
-    acc.merge(BTagCfg(cfgFlags, **kwargs))
+        acc.merge(BTagCfg(cfgFlags, JetCollection = JetCollection, **kwargs))
 
     acc.setAppProperty("EvtMax",-1)
 
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagSecVertexingConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagSecVertexingConfig.py
index 55f5e6d4e707285347795d384061c91e17e18066..d5a24bec5980b51ee95dad940462d48666296814 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagSecVertexingConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagSecVertexingConfig.py
@@ -1,8 +1,7 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 from BTagging.NewJetFitterVxFinderConfig import NewJetFitterVxFinderCfg
 from BTagging.InDetVKalVxInJetToolConfig import InDetVKalVxInJetToolCfg
 from JetTagTools.JetFitterVariablesFactoryConfig import JetFitterVariablesFactoryCfg
@@ -56,8 +55,8 @@ def BTagSecVtxToolCfg(flags, Name, JetCollection, TimeStamp = "", **options):
     options.setdefault('SecVtxFinderList', secVtxFinderList)
     options.setdefault('SecVtxFinderTrackNameList', secVtxFinderTrackNameList)
     options.setdefault('SecVtxFinderxAODBaseNameList', secVtxFinderxAODBaseNameList)
-    options.setdefault('PrimaryVertexName', BTaggingFlags.PrimaryVertexCollectionName)
-    options.setdefault('vxPrimaryCollectionName', BTaggingFlags.PrimaryVertexCollectionName)
+    options.setdefault('PrimaryVertexName', flags.BTagging.PrimaryVertexCollectionName)
+    options.setdefault('vxPrimaryCollectionName', flags.BTagging.PrimaryVertexCollectionName)
     options['BTagJFVtxCollectionName'] = btagname + OutputFilesJFVxname
     options['BTagSVCollectionName'] = btagname + OutputFilesSVname
     options.setdefault('JetFitterVariableFactory', jetFitterVF)
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py
index dcdc51780c0b6cbcf2c89af6666cbd20457e1cc9..91c0011f6cac26dae266288e5a6c7ec2b8607589 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py
@@ -3,7 +3,6 @@
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
 Analysis__BTagTool=CompFactory.Analysis.BTagTool
-from BTagging.BTaggingFlags import BTaggingFlags
 
 def BTagToolCfg(ConfigFlags, TaggerList, useBTagFlagsDefaults = True):
       """Adds a new myBTagTool instance and registers it.
@@ -84,10 +83,9 @@ def BTagToolCfg(ConfigFlags, TaggerList, useBTagFlagsDefaults = True):
 
       options = {}
       if useBTagFlagsDefaults:
-        defaults = { 'Runmodus'                     : BTaggingFlags.Runmodus,
-                     'PrimaryVertexName'            : BTaggingFlags.PrimaryVertexCollectionName,
-                     'BaselineTagger'               : BTaggingFlags.BaselineTagger,
-                     'vxPrimaryCollectionName'      : BTaggingFlags.PrimaryVertexCollectionName,
+        defaults = { 'Runmodus'                     : ConfigFlags.BTagging.RunModus,
+                     'PrimaryVertexName'            : ConfigFlags.BTagging.PrimaryVertexCollectionName,
+                     'vxPrimaryCollectionName'      : ConfigFlags.BTagging.PrimaryVertexCollectionName,
                      'TagToolList'                  : tagToolList,
                    }
         for option in defaults:
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagTrackAssociationConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagTrackAssociationConfig.py
index 365be08f78b6f88b30abf93c7c3a86eeec85af1c..01be1345c61ee259028cc44dacaae702300ac76e 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagTrackAssociationConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagTrackAssociationConfig.py
@@ -1,10 +1,9 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
 from BTagging.BTagTrackToJetAssociatorConfig import BTagTrackToJetAssociatorCfg
 from BTagging.BTagMuonToJetAssociatorConfig import BTagMuonToJetAssociatorCfg
-from BTagging.BTaggingFlags import BTaggingFlags
 
 Analysis__BTagTrackAssociation=CompFactory.Analysis.BTagTrackAssociation
 
@@ -13,6 +12,7 @@ def BTagTrackAssociationCfg(flags, name, JetCollection, TaggerList, options={}):
     acc=ComponentAccumulator()
 
     # Setup associators
+    doStandardAssoc = True
     BTagTrackToJetAssociatorList = []
     BTagTrackToJetAssocNameList = []
     if 'IP2D' in TaggerList or 'IP3D' in TaggerList:
@@ -49,7 +49,7 @@ def BTagTrackAssociationCfg(flags, name, JetCollection, TaggerList, options={}):
     options.setdefault('MuonToJetAssociatorList', MuonToJetAssociatorList)
     options.setdefault('MuonToJetAssocNameList', MuonToJetAssocNameList)
     options.setdefault('MuonContainerNameList', MuonContainerNameList)
-    options.setdefault('BTagAssociation', BTaggingFlags.doStandardAssoc)
+    options.setdefault('BTagAssociation', doStandardAssoc)
     options['name'] = name
     tool = Analysis__BTagTrackAssociation(**options)
 
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfigFlags.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfigFlags.py
index d7ccc2101d3a2a4aa4685d6f9d60fb63fd50de8c..ffec4236d933177b27dff634b3b156979fc13e9a 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfigFlags.py
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfigFlags.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
 
 from AthenaConfiguration.AthConfigFlags import AthConfigFlags
 
@@ -8,7 +8,15 @@ def createBTaggingConfigFlags():
     btagcf.addFlag("BTagging.run2TaggersList", ['IP2D','IP3D','SV1','SoftMu','JetFitterNN','MV2c10','MV2c10mu','MV2c10rnn','MV2c100','MV2cl100','RNNIP','DL1','DL1mu','DL1rnn'])
     # Disable JetVertexCharge ATLASRECTS-4506
     btagcf.addFlag("BTagging.RunModus", "analysis") # reference mode used in FlavourTagPerformanceFramework (RetagFragment.py)
+    btagcf.addFlag("BTagging.ReferenceType", "ALL") # reference type for IP and SV taggers (B, UDSG, ALL)
     btagcf.addFlag("BTagging.JetPtMinRef", 15e3) # in MeV for uncalibrated pt
+    btagcf.addFlag("BTagging.PrimaryVertexCollectionName", "PrimaryVertices")
+    btagcf.addFlag("BTagging.Grades", [ "0HitIn0HitNInExp2","0HitIn0HitNInExpIn","0HitIn0HitNInExpNIn","0HitIn0HitNIn",
+                                        "0HitInExp", "0HitIn",
+                                        "0HitNInExp", "0HitNIn",
+                                        "InANDNInShared", "PixShared", "SctShared",
+                                        "InANDNInSplit", "PixSplit",
+                                        "Good"])
     #Do we really need this in AthConfigFlags?
     #Comments in BTaggingConfiguration.py
     btagcf.addFlag("BTagging.OutputFiles.Prefix", "BTagging_")
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetBTaggerAlgConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetBTaggerAlgConfig.py
index 7149c93345f8e321586f9c81a18794cfd8187cf6..11aa16f2a8d7ff0b771ef055ff107604cc4c4cd1 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetBTaggerAlgConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetBTaggerAlgConfig.py
@@ -14,6 +14,8 @@ def JetBTaggerAlgCfg(ConfigFlags, JetCollection="", TaggerList=[], SetupScheme="
     acc=ComponentAccumulator()
     jetcol = JetCollection
 
+    del options['Release']
+
     # setup the Analysis__BTagTrackAssociation tool
     options.setdefault('BTagTrackAssocTool', acc.popToolsAndMerge(BTagTrackAssociationCfg(ConfigFlags, 'TrackAssociation'+ ConfigFlags.BTagging.GeneralToolSuffix, jetcol, TaggerList )))
     
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVertexingAlgConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVertexingAlgConfig.py
index f53a0f5a2b1371ff626dd3568ff475c9980b152c..0b4f8e68aba47fd47038f4c2490321102e2c165f 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVertexingAlgConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVertexingAlgConfig.py
@@ -2,7 +2,6 @@
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 from BTagging.MSVVariablesFactoryConfig import MSVVariablesFactoryCfg
 
 Analysis__JetSecVertexingAlg=CompFactory.Analysis.JetSecVertexingAlg
@@ -24,14 +23,16 @@ def JetSecVertexingAlgCfg(ConfigFlags, JetCollection, ParticleCollection="", SVF
         JetSVLink = 'JFVtx'
     if SVFinder == 'SV1':
         JetSVLink = 'SecVtx'
+    if SVFinder == 'MSV':
+        JetSVLink = 'MSecVtx' # Maybe no used
 
     varFactory = acc.popToolsAndMerge(MSVVariablesFactoryCfg("MSVVarFactory"))
 
     btagname = ConfigFlags.BTagging.OutputFiles.Prefix + jetcol
     options = {}
     options.setdefault('SecVtxFinderxAODBaseName', SVFinder)
-    options.setdefault('PrimaryVertexName', BTaggingFlags.PrimaryVertexCollectionName)
-    options.setdefault('vxPrimaryCollectionName', BTaggingFlags.PrimaryVertexCollectionName)
+    options.setdefault('PrimaryVertexName', ConfigFlags.BTagging.PrimaryVertexCollectionName)
+    options.setdefault('vxPrimaryCollectionName', ConfigFlags.BTagging.PrimaryVertexCollectionName)
     options['JetCollectionName'] = jetcol.replace('Track', 'PV0Track') + 'Jets'
     options['BTagVxSecVertexInfoName'] = SVFinder + 'VxSecVertexInfo_' + JetCollection
     options['TrackToJetAssociatorName'] = options['JetCollectionName'] + '.' + Associator
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVtxFindingAlgConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVtxFindingAlgConfig.py
index e01ff70a90776484864f47a96226fc29162908f0..b6521171463ab3dc527d5be04a59f4d874696dc3 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVtxFindingAlgConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVtxFindingAlgConfig.py
@@ -2,7 +2,6 @@
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 from BTagging.NewJetFitterVxFinderConfig import NewJetFitterVxFinderCfg
 from BTagging.InDetVKalVxInJetToolConfig import InDetVKalVxInJetToolCfg
 
@@ -32,8 +31,8 @@ def JetSecVtxFindingAlgCfg(ConfigFlags, JetCollection, ParticleCollection="", SV
 
     options = {}
     options.setdefault('SecVtxFinder', secVtxFinder)
-    options.setdefault('PrimaryVertexName', BTaggingFlags.PrimaryVertexCollectionName)
-    options.setdefault('vxPrimaryCollectionName', BTaggingFlags.PrimaryVertexCollectionName)
+    options.setdefault('PrimaryVertexName', ConfigFlags.BTagging.PrimaryVertexCollectionName)
+    options.setdefault('vxPrimaryCollectionName', ConfigFlags.BTagging.PrimaryVertexCollectionName)
     options['JetCollectionName'] = jetcol.replace('Track', 'PV0Track') + 'Jets'
     options['TrackToJetAssociatorName'] = options['JetCollectionName'] + '.' + Associator
     options['BTagVxSecVertexInfoName'] = SVFinder + 'VxSecVertexInfo_' + JetCollection
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/NewJetFitterVxFinderConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/NewJetFitterVxFinderConfig.py
index 5f07c8bb4e7592d269bd9deac0c06e008831825e..b0c4b4d96d1f962a03de1bbd124922bbb023d2fe 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/NewJetFitterVxFinderConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/NewJetFitterVxFinderConfig.py
@@ -1,8 +1,7 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 from BTagging.InDetJetFitterUtilsConfig import InDetJetFitterUtilsCfg
 from BTagging.JetFitterSequentialVertexFitterConfig import JetFitterSequentialVertexFitterCfg
 from BTagging.VxInternalEdmFactoryConfig import VxInternalEdmFactoryCfg
@@ -41,7 +40,7 @@ def NewJetFitterVxFinderCfg(flags, name = 'JFVxFinder', suffix = "", useBTagFlag
         jetFitterExtrapolator = acc.popToolsAndMerge(AtlasExtrapolatorCfg(flags, 'JFExtrapolator'+suffix))
         improvedJetFitterInitializationHelper = acc.popToolsAndMerge(ImprovedJetFitterInitializationHelperCfg('ImprovedJFInitHelper'+suffix))
         vertexEdmFactory = acc.popToolsAndMerge(VxInternalEdmFactoryCfg('VxInternalEdmFactory'+suffix))
-        defaults = { 'VxPrimaryContainer'                  : BTaggingFlags.PrimaryVertexCollectionName,
+        defaults = { 'VxPrimaryContainer'                  : flags.BTagging.PrimaryVertexCollectionName,
                      'MaxNumDeleteIterations'              : 30,
                      'VertexProbCut'                       : 0.001,
                      'MaxClusteringIterations'             : 30,
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagHighLevelAugmenterAlg.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagHighLevelAugmenterAlg.cxx
index 10be070149b4bbd728b5e49897943beec0a889de..bfa4efa4afdb754551bbcddfa9cfd306d359a1b0 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagHighLevelAugmenterAlg.cxx
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagHighLevelAugmenterAlg.cxx
@@ -29,6 +29,7 @@ namespace Analysis {
     ATH_MSG_DEBUG( "Inizializing containers:"        );
     ATH_MSG_DEBUG( "    ** " << m_BTagCollectionName  );
 
+    ATH_CHECK( m_JetCollectionName.initialize() );
     ATH_CHECK( m_BTagCollectionName.initialize() );
     ATH_CHECK( m_bTagJetDecorLinkName.initialize() );
 
@@ -119,7 +120,16 @@ namespace Analysis {
   StatusCode BTagHighLevelAugmenterAlg::execute() {
     ATH_MSG_DEBUG( "Executing " << name() << "... " );
   
-    SG::ReadHandle< xAOD::BTaggingContainer > h_bTagContainer( m_BTagCollectionName);
+    EventContext ctx = Gaudi::Hive::currentContext();
+
+    //retrieve the Jet container
+    SG::ReadHandle<xAOD::JetContainer> h_JetCollectionName (m_JetCollectionName, ctx);
+    if (!h_JetCollectionName.isValid()) {
+      ATH_MSG_ERROR( " cannot retrieve jet container with key " << m_JetCollectionName.key()  );
+      return StatusCode::FAILURE;
+    }
+
+    SG::ReadHandle< xAOD::BTaggingContainer > h_bTagContainer( m_BTagCollectionName, ctx);
     CHECK( h_bTagContainer.isValid() );
     const xAOD::BTaggingContainer* btags = h_bTagContainer.get();
     ATH_MSG_DEBUG( "Retrieved " << btags->size() << " input btagging..." );
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggerAlg.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggerAlg.cxx
index dbb0b874d6f4d7e17c0fd5004286800c9df4e862..6ac9c34fa9f6f1dca0490eb5884006790c646954 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggerAlg.cxx
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggerAlg.cxx
@@ -51,6 +51,8 @@ namespace Analysis {
     ATH_CHECK( m_BTaggingCollectionName.initialize() );
     m_jetBTaggingLinkName = m_JetCollectionName.key() + m_BTagLink;
     ATH_CHECK( m_jetBTaggingLinkName.initialize() );
+    m_bTagJetDecorLinkName = m_BTaggingCollectionName.key() + ".jetLink";
+    ATH_CHECK( m_bTagJetDecorLinkName.initialize() );
    
     /// retrieve the main BTagTool
     if ( m_bTagTool.retrieve().isFailure() ) {
@@ -108,6 +110,8 @@ namespace Analysis {
 
     //Decor Jet with element link to the BTagging
     SG::WriteDecorHandle<xAOD::JetContainer,ElementLink< xAOD::BTaggingContainer > > h_jetBTaggingLinkName(m_jetBTaggingLinkName, ctx);
+    //Decor BTagging with element link to the Jet
+    SG::WriteDecorHandle<xAOD::BTaggingContainer, ElementLink< xAOD::JetContainer > > h_bTagJetLinkName(m_bTagJetDecorLinkName, ctx);
 
     //Create a xAOD::BTaggingContainer in any case (must be done)
     std::string bTaggingContName = m_BTaggingCollectionName.key();
@@ -171,13 +175,16 @@ namespace Analysis {
       ATH_MSG_WARNING("#BTAG# Failed in taggers call");
     }
 
-    //Create the element link from the jet to the btagging
+    //Create the element link from the jet to the btagging and reverse link
     for (size_t jetIndex=0; jetIndex < h_JetCollectionName->size() ; ++jetIndex) {
       const xAOD::Jet * jetToTag = h_JetCollectionName->at(jetIndex);
       xAOD::BTagging * itBTag = h_BTaggingCollectionName->at(jetIndex);
       ElementLink< xAOD::BTaggingContainer> linkBTagger;
       linkBTagger.toContainedElement(*h_BTaggingCollectionName.ptr(), itBTag);
       h_jetBTaggingLinkName(*jetToTag) = linkBTagger;
+      ElementLink< xAOD::JetContainer> linkJet;
+      linkJet.toContainedElement(*h_JetCollectionName.ptr(), jetToTag);
+      h_bTagJetLinkName(*itBTag) = linkJet;
     }
 
     return StatusCode::SUCCESS;
diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/DL1TagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/DL1TagConfig.py
index 0c6159329151e4a3ce4bbc783ce0f34f88d2d809..effd38ac65c64c295fbb0b3bfb9e972313aed717 100644
--- a/PhysicsAnalysis/JetTagging/JetTagTools/python/DL1TagConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/DL1TagConfig.py
@@ -1,8 +1,7 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 
 # import the DL1Tag configurable
 Analysis__DL1Tag=CompFactory.Analysis.DL1Tag
@@ -26,13 +25,16 @@ def DL1TagCfg(flags, name = 'DL1', scheme = '', useBTagFlagsDefaults = True, **o
     acc = ComponentAccumulator()
     options['name'] = name + 'Tag'
     basename = name
+    DL1LocalNNConfig = ''
+    ForceDL1CalibrationAlias = True
+    DL1CalibAlias = 'AntiKt4EMTopo'
     options['xAODBaseName'] = basename
-    options['LocalNNConfigurationFile'] = BTaggingFlags.DL1LocalNNConfig
+    options['LocalNNConfigurationFile'] = DL1LocalNNConfig
  
     if useBTagFlagsDefaults:
         defaults = { 'Runmodus'                         : flags.BTagging.RunModus,
-                     'forceDL1CalibrationAlias'         : BTaggingFlags.ForceDL1CalibrationAlias,
-                     'DL1CalibAlias'                    : BTaggingFlags.DL1CalibAlias,
+                     'forceDL1CalibrationAlias'         : ForceDL1CalibrationAlias,
+                     'DL1CalibAlias'                    : DL1CalibAlias,
                      'calibration_directory'            : basename,
                      }
         for option in defaults:
diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/IP2DTagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/IP2DTagConfig.py
index 5631d0595fdf4a00829aba48c5bc537e962b15f1..3aca626d04198369598cd64656dbede276facf04 100644
--- a/PhysicsAnalysis/JetTagging/JetTagTools/python/IP2DTagConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/IP2DTagConfig.py
@@ -2,7 +2,6 @@
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 from JetTagTools.BTagTrackToVertexIPEstimatorConfig import BTagTrackToVertexIPEstimatorCfg
 from JetTagTools.SVForIPToolConfig import SVForIPToolCfg
 from JetTagTools.IPDetailedTrackGradeFactoryConfig import IPDetailedTrackGradeFactoryCfg
@@ -18,7 +17,7 @@ def IP2DTagCfg( flags, name = 'IP2DTag', scheme = '', useBTagFlagsDefaults = Tru
     The following options have BTaggingFlags defaults:
 
     Runmodus                            default: BTagging.RunModus
-    referenceType                       default: BTaggingFlags.ReferenceType
+    referenceType                       default: BTagging.ReferenceType
     impactParameterView                 default: "2D"
     trackGradePartitions                default: [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ]
     RejectBadTracks                     default: False
@@ -37,12 +36,6 @@ def IP2DTagCfg( flags, name = 'IP2DTag', scheme = '', useBTagFlagsDefaults = Tru
     options['trackAssociationName'] = 'BTagTrackToJetAssociator'
     if (scheme == ""): 
         if useBTagFlagsDefaults:
-            grades= [ "0HitIn0HitNInExp2","0HitIn0HitNInExpIn","0HitIn0HitNInExpNIn","0HitIn0HitNIn",
-                  "0HitInExp", "0HitIn",
-                  "0HitNInExp", "0HitNIn",
-                  "InANDNInShared", "PixShared", "SctShared",
-                  "InANDNInSplit", "PixSplit",
-                  "Good"]
             trackToVertexIPEstimator = acc.popToolsAndMerge(BTagTrackToVertexIPEstimatorCfg(flags, 'TrkToVxIPEstimator'))
             svForIPTool = acc.popToolsAndMerge(SVForIPToolCfg('SVForIPTool'))
             trackGradeFactory = acc.popToolsAndMerge(IPDetailedTrackGradeFactoryCfg('IP2DDetailedTrackGradeFactory'))
@@ -50,10 +43,10 @@ def IP2DTagCfg( flags, name = 'IP2DTag', scheme = '', useBTagFlagsDefaults = Tru
             likelihood = acc.popToolsAndMerge(NewLikelihoodToolCfg(flags, 'IP2DNewLikelihoodTool', 'IP2D'))
 
             defaults = { 'Runmodus'                         : flags.BTagging.RunModus,
-                     'referenceType'                    : BTaggingFlags.ReferenceType,
+                     'referenceType'                    : flags.BTagging.ReferenceType,
                      'jetPtMinRef'                      : flags.BTagging.JetPtMinRef,
                      'impactParameterView'              : '2D',
-                     'trackGradePartitions'             : grades,
+                     'trackGradePartitions'             : flags.BTagging.Grades,
                      'RejectBadTracks'                  : True,
                      'jetCollectionList'                : [], #used only in reference mode
                      'unbiasIPEstimation'               : False,
diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/IP3DTagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/IP3DTagConfig.py
index fd7ffa95ef3c1235ead466c468ad58a54aa0e654..a803b72233eb3a04cafdb38c593ec659d15410e6 100644
--- a/PhysicsAnalysis/JetTagging/JetTagTools/python/IP3DTagConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/IP3DTagConfig.py
@@ -2,7 +2,6 @@
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 from JetTagTools.BTagTrackToVertexIPEstimatorConfig import BTagTrackToVertexIPEstimatorCfg
 from JetTagTools.SVForIPToolConfig import SVForIPToolCfg
 from JetTagTools.IPDetailedTrackGradeFactoryConfig import IPDetailedTrackGradeFactoryCfg
@@ -20,7 +19,7 @@ def IP3DTagCfg( flags, name = 'IP3DTag', scheme = '', useBTagFlagsDefaults = Tru
     The following options have BTaggingFlags defaults:
 
     Runmodus                            default: BTagging.RunModus
-    referenceType                       default: BTaggingFlags.ReferenceType
+    referenceType                       default: BTagging.ReferenceType
     impactParameterView                 default: "3D"
     trackGradePartitions                default: [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ]
     RejectBadTracks                     default: False
@@ -40,12 +39,6 @@ def IP3DTagCfg( flags, name = 'IP3DTag', scheme = '', useBTagFlagsDefaults = Tru
 
     if (scheme == ""): 
         if useBTagFlagsDefaults:
-            grades= [ "0HitIn0HitNInExp2","0HitIn0HitNInExpIn","0HitIn0HitNInExpNIn","0HitIn0HitNIn",
-                  "0HitInExp", "0HitIn",
-                  "0HitNInExp", "0HitNIn",
-                  "InANDNInShared", "PixShared", "SctShared",
-                  "InANDNInSplit", "PixSplit",
-                  "Good"]
             trackToVertexIPEstimator = acc.popToolsAndMerge(BTagTrackToVertexIPEstimatorCfg(flags, 'TrkToVxIPEstimator'))
             svForIPTool = acc.popToolsAndMerge(SVForIPToolCfg('SVForIPTool'))
             trackGradeFactory = acc.popToolsAndMerge(IPDetailedTrackGradeFactoryCfg('IP3DDetailedTrackGradeFactory'))
@@ -55,10 +48,10 @@ def IP3DTagCfg( flags, name = 'IP3DTag', scheme = '', useBTagFlagsDefaults = Tru
             trackVertexAssociationTool = acc.popToolsAndMerge(SpecialTrackAssociatorCfg('SpecialTrackAssociator'))
 
             defaults = { 'Runmodus'                         : flags.BTagging.RunModus,
-                     'referenceType'                    : BTaggingFlags.ReferenceType,
+                     'referenceType'                    : flags.BTagging.ReferenceType,
                      'jetPtMinRef'                      : flags.BTagging.JetPtMinRef,
                      'impactParameterView'              : '3D',
-                     'trackGradePartitions'             : grades,
+                     'trackGradePartitions'             : flags.BTagging.Grades,
                      'RejectBadTracks'                  : True,
                      'jetCollectionList'                : [], #used only in reference mode
                      'unbiasIPEstimation'               : False,
diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterNNToolConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterNNToolConfig.py
index 359d9f46fab626091bd17c3337838445cbc86d86..30c2068e7849a4427415a1191ca1b295bbcd8985 100644
--- a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterNNToolConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterNNToolConfig.py
@@ -1,8 +1,7 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 from JetTagTools.NeuralNetworkToHistoToolConfig import NeuralNetworkToHistoToolCfg
 
 # import the JetFitterNNTool configurable
@@ -24,7 +23,11 @@ def JetFitterNNToolCfg( name = 'JetFitterNNTool', CombinedIPNN = False, useBTagF
     output: The actual tool."""
     acc = ComponentAccumulator()
     options['name'] = name
-    if not BTaggingFlags.RunJetFitterNNTool:
+    # you can force the NN tool off with this flag (avoids loading
+    # old jetfitter nns which sometimes crash
+    RunJetFitterNNTool = True
+
+    if not RunJetFitterNNTool:
         raise ValueError("This case is not implemented because always True during Run2. Contact BTagging software team.")
     if useBTagFlagsDefaults:
         if not CombinedIPNN:
diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterTagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterTagConfig.py
index 07378024828c552db249190c589de27c2e21eeb6..0305c07890064659a68d7a0d2ba569c3420afdcc 100644
--- a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterTagConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterTagConfig.py
@@ -1,8 +1,7 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 from JetTagTools.JetFitterNtupleWriterNNConfig import JetFitterNtupleWriterNNCfg
 from JetTagTools.JetFitterNNToolConfig import JetFitterNNToolCfg
 
@@ -38,7 +37,7 @@ def JetFitterTagCfg(flags, name = 'JetFitterTagNN', scheme = '', CombinedIPNN =
                 jetFitterNtupleWriterNN = acc.popToolsAndMerge(JetFitterNtupleWriterNNCfg('JetFitterNtupleWriterNN'))
                 jetfitterClassifier = acc.popToolsAndMerge(JetFitterNNToolCfg('JetFitterNNTool'))
                 defaults = { 'Runmodus'                         : flags.BTagging.RunModus,
-                     'jetCollectionList'                : BTaggingFlags.Jets,
+                     'jetCollectionList'                : [], #used only in reference mode
                      'SecVxFinderName'                  : 'JetFitter',
                      'useForcedCalibration'             : False,
                      'ipinfoTaggerName'                 : "",
@@ -47,7 +46,7 @@ def JetFitterTagCfg(flags, name = 'JetFitterTagNN', scheme = '', CombinedIPNN =
                      }
             else:
                 defaults = { 'Runmodus'                         : flags.BTagging.RunModus,
-                     'jetCollectionList'                : BTaggingFlags.Jets,
+                     'jetCollectionList'                : [], #used only in reference mode
                      'SecVxFinderName'                  : 'JetFitter',
                      'useForcedCalibration'             : False,
                      'ipinfoTaggerName'                 : 'IP3D',
@@ -56,7 +55,7 @@ def JetFitterTagCfg(flags, name = 'JetFitterTagNN', scheme = '', CombinedIPNN =
             # JetFitterFlip should be a flip version of JetFitter created in setupSecVtxTool
         if useBTagFlagsDefaults:
             defaults = { 'Runmodus'                         : flags.BTagging.RunModus,
-                     'jetCollectionList'                : BTaggingFlags.Jets,
+                     'jetCollectionList'                : [], #used only in reference mode
                      'SecVxFinderName'                  : 'JetFitterFlip',
                      'useForcedCalibration'             : False,
                      'ipinfoTaggerName'                 : 'IP3D',
diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py
index 1c0adad002318697175a2c6b3bd7f222aae96055..2d6d4c408ae5bc2030ead061c7e89f3e347bd573 100644
--- a/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py
@@ -1,8 +1,7 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 from BTagging.MV2defaultValues import default_values
 from BTagging.MV2defaultValues import MVTM_varNames
 
@@ -27,14 +26,16 @@ def MV2TagCfg( flags, name = 'MV2c10', scheme = '', useBTagFlagsDefaults = True,
     acc = ComponentAccumulator()
     options['name'] = name + 'Tag'
     basename = name
+    ForceMV2CalibrationAlias = False
+    MV2CalibAlias = 'AntiKt4EMTopo'
     options['xAODBaseName'] = basename
 
     if useBTagFlagsDefaults:
         defaults = { 'Runmodus'                         : flags.BTagging.RunModus,
                      'taggerName'                       : basename,
                      'taggerNameBase'                   : basename,
-                     'forceMV2CalibrationAlias'         : BTaggingFlags.ForceMV2CalibrationAlias,
-                     'MV2CalibAlias'                    : BTaggingFlags.MV2CalibAlias,
+                     'forceMV2CalibrationAlias'         : ForceMV2CalibrationAlias,
+                     'MV2CalibAlias'                    : MV2CalibAlias,
                      'defaultvals'                      : default_values,
                      'MVTMvariableNames'                : MVTM_varNames,
                      }
diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/RNNIPTagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/RNNIPTagConfig.py
index 1c3ed2a381006fbf3931c5538f0e9dcaca76f9be..50d96b45e61783a80277bf7f0880a634d5d0e7f2 100644
--- a/PhysicsAnalysis/JetTagging/JetTagTools/python/RNNIPTagConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/RNNIPTagConfig.py
@@ -1,8 +1,7 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 from JetTagTools.BTagTrackToVertexIPEstimatorConfig import BTagTrackToVertexIPEstimatorCfg
 from JetTagTools.SVForIPToolConfig import SVForIPToolCfg
 from JetTagTools.IPDetailedTrackGradeFactoryConfig import IPDetailedTrackGradeFactoryCfg
@@ -28,6 +27,8 @@ def RNNIPTagCfg( flags, name = 'RNNIP', scheme = '', calibration=None, useBTagFl
     acc = ComponentAccumulator()   
     options['name'] = name
     basename = 'RNNIP'
+    RNNIPConfig = {'rnnip':''}
+    WriteRNNInputs = False
     options['xAODBaseName'] = basename
     options['trackAssociationName'] = 'BTagTrackToJetAssociator'
     cal_dir = calibration or basename
@@ -36,25 +37,19 @@ def RNNIPTagCfg( flags, name = 'RNNIP', scheme = '', calibration=None, useBTagFl
         is_flipped=True
 
     if useBTagFlagsDefaults:
-        grades= [ "0HitIn0HitNInExp2","0HitIn0HitNInExpIn","0HitIn0HitNInExpNIn","0HitIn0HitNIn",
-                  "0HitInExp", "0HitIn",
-                  "0HitNInExp", "0HitNIn",
-                  "InANDNInShared", "PixShared", "SctShared",
-                  "InANDNInSplit", "PixSplit",
-                  "Good"]
         trackToVertexIPEstimator = acc.popToolsAndMerge(BTagTrackToVertexIPEstimatorCfg(flags, 'TrkToVxIPEstimator'))
         svForIPTool = acc.popToolsAndMerge(SVForIPToolCfg('SVForIPTool'))
         trackGradeFactory = acc.popToolsAndMerge(IPDetailedTrackGradeFactoryCfg('RNNIPDetailedTrackGradeFactory'))
         trackSelectorTool = acc.popToolsAndMerge(IPTrackSelectorCfg(flags, 'RNNIPTrackSelector'))
 
         defaults = {
-                'trackGradePartitions'      : grades ,
+                'trackGradePartitions'      : flags.BTagging.Grades,
                 'RejectBadTracks'           : True,
-                'NetworkConfig'             : BTaggingFlags.RNNIPConfig,
+                'NetworkConfig'             : RNNIPConfig,
                 'unbiasIPEstimation'        : False,
                 'SecVxFinderName'           : 'SV1',
                 'calibration_directory'     : cal_dir,
-                'writeInputsToBtagObject'   : BTaggingFlags.WriteRNNInputs,
+                'writeInputsToBtagObject'   : WriteRNNInputs,
                 'trackSelectorTool'         : trackSelectorTool,
                 'SVForIPTool'               : svForIPTool,
                 'trackGradeFactory'         : trackGradeFactory,
diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/SV1TagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/SV1TagConfig.py
index 7502ad1ccf3866de9fe3c5c68623082438a42775..19c2bad813f5eb66e38c8d9ab5623dc756ecb822 100644
--- a/PhysicsAnalysis/JetTagging/JetTagTools/python/SV1TagConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/SV1TagConfig.py
@@ -1,8 +1,7 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 from JetTagTools.NewLikelihoodToolConfig import NewLikelihoodToolCfg
 
 # import the SVTag configurable
@@ -14,7 +13,7 @@ def SV1TagCfg( flags, name = 'SV1Tag', scheme = '', useBTagFlagsDefaults = True,
     The following options have BTaggingFlags defaults:
 
     Runmodus                            default: BTagging.RunModus
-    referenceType                       default: BTaggingFlags.ReferenceType
+    referenceType                       default: BTagging.ReferenceType
     SVAlgType                           default: "SV1"
     jetCollectionList                   default: BTaggingFlags.Jets
     LikelihoodTool                      default: None
@@ -31,10 +30,10 @@ def SV1TagCfg( flags, name = 'SV1Tag', scheme = '', useBTagFlagsDefaults = True,
     if useBTagFlagsDefaults:
         likelihood = acc.popToolsAndMerge(NewLikelihoodToolCfg(flags, 'SV1NewLikelihoodTool', 'SV1'))
         defaults = { 'Runmodus'                         : flags.BTagging.RunModus,
-                     'referenceType'                    : BTaggingFlags.ReferenceType,
+                     'referenceType'                    : flags.BTagging.ReferenceType,
                      'jetPtMinRef'                      : flags.BTagging.JetPtMinRef,
                      'SVAlgType'                        : 'SV1',
-                     'jetCollectionList'                : BTaggingFlags.Jets,
+                     'jetCollectionList'                : [], #used only in reference mode
                      'SecVxFinderName'                  : 'SV1',
                      'UseCHypo'                         : True,
                      'LikelihoodTool'                   : likelihood }
diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/SoftMuonTagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/SoftMuonTagConfig.py
index 6c6cd3b9e2371efaa07fa3421a45d82bc01a8c6f..db46da86737beb1f512442def77234011b04918c 100644
--- a/PhysicsAnalysis/JetTagging/JetTagTools/python/SoftMuonTagConfig.py
+++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/SoftMuonTagConfig.py
@@ -1,8 +1,7 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
-from BTagging.BTaggingFlags import BTaggingFlags
 from JetTagTools.BTagTrackToVertexIPEstimatorConfig import BTagTrackToVertexIPEstimatorCfg
 from JetTagTools.NewLikelihoodToolConfig import NewLikelihoodToolCfg
 from JetTagTools.MuonSelectorToolConfig import MuonSelectorToolCfg
@@ -17,7 +16,7 @@ def SoftMuonTagCfg( flags, name = 'SoftMu', useBTagFlagsDefaults = True, **optio
 
     Runmodus                            default: BTagging.RunModus
     jetCollectionList                   default: BTaggingFlags.Jets
-    originalMuCollectionName            default: BTaggingFlags.MuonCollectionName
+    originalMuCollectionName            default: BTaggingFlags.MuonCollectionName ('Muons')
     BTagJetEtamin                       default: 2.5 (only if BTagging.RunModus == 'reference')
     MuonQuality                         default: xAOD::Muon::Medium
 
@@ -25,6 +24,7 @@ def SoftMuonTagCfg( flags, name = 'SoftMu', useBTagFlagsDefaults = True, **optio
           useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified.
                   **options: Python dictionary with options for the tool.
     output: The actual tool."""
+    muonCollectionName = 'Muons'
     acc = ComponentAccumulator()
     if useBTagFlagsDefaults:
         trackToVertexIPEstimator = acc.popToolsAndMerge(BTagTrackToVertexIPEstimatorCfg(flags, 'TrkToVxIPEstimator'))
@@ -32,8 +32,8 @@ def SoftMuonTagCfg( flags, name = 'SoftMu', useBTagFlagsDefaults = True, **optio
         likelihood = acc.popToolsAndMerge(NewLikelihoodToolCfg(flags, 'SoftMuonTagNewLikelihoodTool', 'SMT'))
         defaults = {
                      'Runmodus'                         : flags.BTagging.RunModus,
-                     'jetCollectionList'                : BTaggingFlags.Jets,
-                     'originalMuCollectionName'         : BTaggingFlags.MuonCollectionName,
+                     'jetCollectionList'                : [], #used only in reference mode
+                     'originalMuCollectionName'         : muonCollectionName,
                      'MuonQuality'                      : 2,
                      'muonSelectorTool'                 : muonSelectorTool,
                      'LikelihoodTool'                   : likelihood,
diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/Root/MuonCalibrationAndSmearingTool.cxx b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/Root/MuonCalibrationAndSmearingTool.cxx
index 186c207e4823ba5254bdfbe3db4afe5df8bb925c..f6f0f959d8a31502379ddc4a8588c8b3cb7dd285 100644
--- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/Root/MuonCalibrationAndSmearingTool.cxx
+++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/Root/MuonCalibrationAndSmearingTool.cxx
@@ -2789,10 +2789,15 @@ namespace CP {
           if(reso_Misaligned > reso_AlignedOnly) {
             smear_mod = std::sqrt(std::pow(reso_Misaligned, 2) - std::pow(reso_AlignedOnly, 2));
           }
+          ATH_MSG_VERBOSE("[Direct CB Smearing] smear: " << smear);
+          ATH_MSG_VERBOSE("[Direct CB Smearing] smear_mod: " << smear_mod);
           // Taking 50% difference between perfectly aligned and misaligned samples
-          newSmear = std::sqrt(std::pow(smear, 2) + var*std::pow(0.5*smear_mod, 2)); 
-          if(newSmear<0.) newSmear = 0.;
+          double newSmearSquared = std::pow(smear, 2) + var*std::pow(0.5*smear_mod, 2);
+          if(newSmearSquared>0.) newSmear = std::sqrt(newSmearSquared);
+          else newSmear = 0.;
+          //if(newSmear<0.) newSmear = 0.;
         }
+        ATH_MSG_VERBOSE("[Direct CB Smearing] newSmear: " << newSmear);
         return newSmear; 
     }
     if( DetType == MCAST::DetectorType::MS ) {
diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/share/MCAST_jobOptions.py b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/share/MCAST_jobOptions.py
index 8274beef54c7a3f459b244c388542abca1132238..9516b4827e07012332bbeceb8a6ceb47489dd654 100644
--- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/share/MCAST_jobOptions.py
+++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/share/MCAST_jobOptions.py
@@ -1,4 +1,4 @@
-path = '/data/atlassmallfiles/users/artoni/mcp/mc16_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.deriv.DAOD_MUON6.e3601_s3126_r10201_p4029'
+path = '/data/atlas/atlasdata/artoni/mcp/tests/mc16_13TeV.301026.PowhegPythia8EvtGen_AZNLOCTEQ6L1_DYmumu_1000M1250.deriv.DAOD_EXOT0.e3649_s3126_r9364_p3654'
 files = [os.path.join(path, f) for f in os.listdir(path)]
 
 import AthenaPoolCnvSvc.ReadAthenaPool
@@ -15,7 +15,7 @@ alg = CP__TestMCASTTool()
 #alg.MuonCalibrationAndSmearingTool.Release = 'Recs2019_05_30'
 alg.MuonCalibrationAndSmearingTool.OutputLevel = INFO 
 alg.MuonCalibrationAndSmearingTool.AddExtraDecorations = True
-alg.MuonCalibrationAndSmearingTool.doExtraSmearing = False 
+alg.MuonCalibrationAndSmearingTool.doExtraSmearing = True 
 alg.MuonCalibrationAndSmearingTool.do2StationsHighPt = False 
 alg.OutputLevel = INFO 
 theJob += alg
diff --git a/PhysicsAnalysis/RingerSelectorTools/CMakeLists.txt b/PhysicsAnalysis/RingerSelectorTools/CMakeLists.txt
index 1f8a28b71bbd04c8cc19f09e959b074f73f44654..f7d8411db70d24f85f2dcfa0186afcc0026b9cc6 100644
--- a/PhysicsAnalysis/RingerSelectorTools/CMakeLists.txt
+++ b/PhysicsAnalysis/RingerSelectorTools/CMakeLists.txt
@@ -42,7 +42,7 @@ atlas_add_library( RingerSelectorToolsEnumsLib
                    Root/enums/*.cxx
                    PUBLIC_HEADERS RingerSelectorTools
                    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${ROOT_LIBRARIES} )
+                   LINK_LIBRARIES ${ROOT_LIBRARIES} PATCoreLib )
 
 atlas_add_library( RingerSelectorToolsLib
                    Root/*.cxx
@@ -50,8 +50,8 @@ atlas_add_library( RingerSelectorToolsLib
                    Root/tools/*.cxx
                    PUBLIC_HEADERS RingerSelectorTools
                    INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AsgTools CxxUtils xAODCaloRings xAODEgamma xAODTracking PATCoreLib EgammaAnalysisInterfacesLib RingerSelectorToolsEnumsLib
-                   PRIVATE_LINK_LIBRARIES xAODBase PathResolver )
+                   LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AsgTools CxxUtils xAODCaloRings xAODEgamma xAODTracking PATCoreLib EgammaAnalysisInterfacesLib RingerSelectorToolsEnumsLib 
+                   PRIVATE_LINK_LIBRARIES xAODBase PathResolver TrkTrackSummary )
 if( NOT XAOD_STANDALONE )
   atlas_add_component( RingerSelectorTools
                        src/components/*.cxx
diff --git a/Reconstruction/DiTauRec/python/DiTauAlgorithmsHolder.py b/Reconstruction/DiTauRec/python/DiTauAlgorithmsHolder.py
index d85146415b258e3b3130ab68c0aa1c4932a84149..914480beeed2d0f3eedcb73582ae34746d5ccb8b 100644
--- a/Reconstruction/DiTauRec/python/DiTauAlgorithmsHolder.py
+++ b/Reconstruction/DiTauRec/python/DiTauAlgorithmsHolder.py
@@ -88,11 +88,11 @@ def getElMuFinder():
     return ElMuFinder
 
 
-def setupTJVFTool():
-    from AthenaCommon.AppMgr import ToolSvc
+def getTVATool():
+    _name = sPrefix + 'TVATool'
 
-    from JetRec.JetRecConf import JetAlgorithm
-    jetTrackAlg = JetAlgorithm("JetTrackAlg_forDiTaus")
+    if _name in cached_instances:
+        return cached_instances[_name]
 
     from JetRecTools.JetRecToolsConf import TrackVertexAssociationTool
     TVATool = TrackVertexAssociationTool("TVATool_forDiTaus",
@@ -102,23 +102,24 @@ def setupTJVFTool():
                                          MaxTransverseDistance=2.5,  # in mm
                                          MaxLongitudinalDistance=2  # in mm
                                          )
-
+    from AthenaCommon.AppMgr import ToolSvc
     ToolSvc += TVATool
+
+    from JetRec.JetRecConf import JetAlgorithm
+    jetTrackAlg = JetAlgorithm(name=_name)
     jetTrackAlg.Tools = [TVATool]
 
-    from AthenaCommon.AlgSequence import AlgSequence
-    topSequence = AlgSequence()
-    topSequence += jetTrackAlg
+    cached_instances[_name] = jetTrackAlg
+    return jetTrackAlg
 
 
+# requires getTVATool
 def getVertexFinder():
     _name = sPrefix + 'VertexFinder'
 
     if _name in cached_instances:
         return cached_instances[_name]
 
-    setupTJVFTool()
-
     from DiTauRec.DiTauRecConf import VertexFinder
     VertexFinder = VertexFinder(name=_name,
                                 PrimVtxContainerName="PrimaryVertices",
diff --git a/Reconstruction/DiTauRec/python/DiTauBuilder.py b/Reconstruction/DiTauRec/python/DiTauBuilder.py
index cf1544248235d48d9291f3fb0083658dcbebd607..c41f0c7b49c4b3824a4c9c50d6627b3700aa07ec 100644
--- a/Reconstruction/DiTauRec/python/DiTauBuilder.py
+++ b/Reconstruction/DiTauRec/python/DiTauBuilder.py
@@ -52,12 +52,11 @@ class DiTauBuilder(Configured):
         from InDetRecExample.InDetJobProperties import InDetFlags
         from JetRec.JetRecFlags import jetFlags
         if (InDetFlags.doVertexFinding() and jetFlags.useTracks()) or diTauFlags.doVtxFinding:
+            topSequence += DiTauAlgs.getTVATool()
             tools.append(DiTauAlgs.getVertexFinder())
-            pass
         tools.append(DiTauAlgs.getDiTauTrackFinder())
         if diTauFlags.doCellFinding:
             tools.append(DiTauAlgs.getCellFinder(self.write_jet_cells, self.write_subjet_cells))
-            pass
 
         if not diTauFlags.doCellFinding:
             self.use_cells = False
diff --git a/Reconstruction/HeavyIonRec/HIGlobal/src/HIEventShapeFillerTool.cxx b/Reconstruction/HeavyIonRec/HIGlobal/src/HIEventShapeFillerTool.cxx
index 226f59b3aae88193b75b5c149aa812e6621f56d0..afb7b5a186e819f4bdca8166c5a56686ca686fcb 100644
--- a/Reconstruction/HeavyIonRec/HIGlobal/src/HIEventShapeFillerTool.cxx
+++ b/Reconstruction/HeavyIonRec/HIGlobal/src/HIEventShapeFillerTool.cxx
@@ -29,7 +29,6 @@ StatusCode HIEventShapeFillerTool::initializeCollection(xAOD::HIEventShapeContai
 {
    //change m_evtShape to m_evtShape
    m_evtShape=evtShape_;
-
    //tool is initialized only once
    if(!m_index)
    {
@@ -105,6 +104,10 @@ StatusCode HIEventShapeFillerTool::fillCollectionFromClusterContainer(const xAOD
   weight_vector->reserve(theClusters->size());
   SG::AuxElement::Decorator< float > decorator("HIEtaPhiWeight");
 
+	std::unique_ptr<std::vector<float> > cm_vector(new std::vector<float>());
+  cm_vector->reserve(theClusters->size());
+  SG::AuxElement::Decorator< float > cm_decorator("HIMag");
+
   constexpr float area_cluster=HI::TowerBins::getBinArea();
 
   if(m_towerWeightTool) CHECK(m_towerWeightTool->configureEvent());
@@ -125,6 +128,25 @@ StatusCode HIEventShapeFillerTool::fillCollectionFromClusterContainer(const xAOD
     weight_vector->push_back(weight);
     decorator(*cl)=weight;
 
+		//HIMag back in rel 22 (removed by mistake in 21)
+		float etot2=0;
+    float er2=0;
+
+    for(unsigned int sample=0; sample<24; sample++)
+    {
+      CaloSampling::CaloSample s=static_cast<CaloSampling::CaloSample>(sample);
+      if(!cl->hasSampling(s)) continue;
+      float esamp=std::abs(cl->eSample(s));
+      float w1=m_towerWeightTool->getWeight(eta,phi,s);
+      float wr=m_towerWeightTool->getWeightMag(eta,phi,s);
+      etot2+=esamp*w1;
+      er2+=esamp*wr;
+
+    }
+    float cm=er2/etot2;
+    cm_vector->push_back(cm);
+    cm_decorator(*cl)=cm;
+
     //update members
     slice->setEt(slice->et()+weight*ET);
     slice->setRho(slice->rho() + weight*ET/area_cluster);
@@ -158,7 +180,6 @@ StatusCode HIEventShapeFillerTool::fillCollectionFromClusterContainer(const xAOD
 
 StatusCode HIEventShapeFillerTool::fillCollectionFromCells(const SG::ReadHandleKey<CaloCellContainer> &cell_container_key)
 {
-   ATH_MSG_INFO("INSIDE FillCollectionFromCells");
    //retrieve the cell container from store
 	 SG::ReadHandle<CaloCellContainer>  read_handle_caloCell ( cell_container_key );
    const CaloCellContainer* CellContainer = read_handle_caloCell.get();
@@ -166,7 +187,6 @@ StatusCode HIEventShapeFillerTool::fillCollectionFromCells(const SG::ReadHandleK
 }
 StatusCode HIEventShapeFillerTool::fillCollectionFromCellContainer(const CaloCellContainer* CellContainer)
 {
-   ATH_MSG_INFO("INSIDE FillCollectionFromCellContainer");
    //loop on Cells
    for(const auto cellItr : *CellContainer) updateShape(m_evtShape,m_index,cellItr,1.,cellItr->eta(),cellItr->phi());
    return StatusCode::SUCCESS;
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetConstituentModifierTool.h b/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetConstituentModifierTool.h
new file mode 100644
index 0000000000000000000000000000000000000000..f9e5f03e740d0e0ae11d25aa046edfe0c91572b5
--- /dev/null
+++ b/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetConstituentModifierTool.h
@@ -0,0 +1,47 @@
+// This file is -*- C++ -*-
+/*
+   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+ */
+
+#ifndef HIJETREC_HIJETCONSTITUENTMODIFIERTOOL_H
+#define HIJETREC_HIJETCONSTITUENTMODIFIERTOOL_H
+ ///////////////////////////////////////////////////////
+ /// \class HIJetConstituentModifier
+ /// \author R.Longo - riccardo.longo@cern.ch
+ /// \date May 2020
+ ///
+ /// Tool to subtract final HIEventShape from constituents
+ /// on the fly (w/o modifying clusters)
+ ///////////////////////////////////////////////////////
+
+#include "JetRec/JetModifierBase.h"
+#include "xAODCaloEvent/CaloClusterContainer.h"
+#include "HIJetRec/IHISubtractorTool.h"
+
+#include "StoreGate/ReadHandleKey.h"
+#include "StoreGate/WriteHandleKey.h"
+
+class HIJetConstituentModifierTool : public JetModifierBase {
+
+   ASG_TOOL_CLASS(HIJetConstituentModifierTool, IJetModifier);
+
+ public:
+
+  // Constructor from tool name.
+  HIJetConstituentModifierTool(const std::string& myname);
+
+  virtual StatusCode initialize() override;
+  // Inherited method to modify a jet.
+  virtual int modifyJet(xAOD::Jet& jet) const;
+
+ private:
+   /// \brief Name of input cluster container
+  SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clusterKey { this, "ClusterKey", "ClusterKey", "Name of the input Cluster Container"};
+  /// \brief handle to IHISubtractorTool that determines the subtracted kinematics for each constituent
+  ToolHandle<IHISubtractorTool> m_subtractorTool { this, "Subtractor", "HIJetSubtractorToolBase", "" };
+  /// |brief boolean switch to drive the JetScale settings after constituents are added 
+  Gaudi::Property< bool > m_originCorrection { this, "ApplyOriginCorrection", false, "Apply Origin Correction boolean switch"};
+
+};
+
+#endif
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetConstituentSubtractionTool.h b/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetConstituentSubtractionTool.h
index 0e346b76c3e072c8dfef596e0832e7ac93db8f6b..30699de280eae07e8df4b351c698860e20c2ca5f 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetConstituentSubtractionTool.h
+++ b/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetConstituentSubtractionTool.h
@@ -62,8 +62,6 @@ private:
   /// \brief Name of HIEventShapeContainer
   SG::ReadHandleKey< xAOD::HIEventShapeContainer > m_eventShapeKey { this, "EventShapeKey", "", "The input HI Event Shape"};
 
-  SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer { this, "VertexContainer", "PrimaryVertices", "Vertex container for primary vertices"};
-
   //That looks useless. commented out for the moment
   //std::string m_modulation_key;
   /// \brief Subtracted jet kinematics are stored
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetRecDefs.h b/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetRecDefs.h
index 81a9cd5d92a82f10b7e22db4d1441fb740f7e38c..21d109e6484328eedcf64b719ad7ba72cc83c658 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetRecDefs.h
+++ b/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetRecDefs.h
@@ -9,17 +9,22 @@
 #include "xAODJet/JetTypes.h"
 #include "HIEventUtils/HIEventDefs.h"
 #include "FourMomUtils/xAODP4Helpers.h"
+#include "TLorentzVector.h"
 
 
 namespace HIJetRec{
 
   //define conventions for HIJets in terms of various signal states
-  constexpr const char* unsubtractedJetState() { return "JetUnsubtractedScaleMomentum";}
-  constexpr const char* subtractedJetState() { return "JetSubtractedScaleMomentum";}
-  constexpr xAOD::JetConstitScale subtractedConstitState() {return xAOD::UncalibratedJetConstituent;}
+  constexpr const char* unsubtractedJetState()                { return "JetUnsubtractedScaleMomentum";}
+  constexpr const char* subtractedJetState()                  { return "JetSubtractedScaleMomentum";}
+  constexpr const char* subtractedOriginCorrectedJetState()   { return "JetSubtractedOriginCorrectedScaleMomentum";}
+
+  constexpr xAOD::JetConstitScale subtractedConstitState()                { return xAOD::UncalibratedJetConstituent;}
+  constexpr xAOD::JetConstitScale subtractedOriginCorrectedConstitState() { return xAOD::CalibratedJetConstituent;}
 
   constexpr xAOD::CaloCluster::State unsubtractedClusterState() {return xAOD::CaloCluster::ALTCALIBRATED;}
   constexpr xAOD::CaloCluster::State subtractedClusterState() {return xAOD::CaloCluster::UNCALIBRATED;}
+  constexpr xAOD::CaloCluster::State subtractedOriginCorrectedClusterState() {return xAOD::CaloCluster::CALIBRATED;}
 
   inline bool inTowerBoundary(float eta0, float phi0, float eta, float phi)
   {
@@ -27,13 +32,13 @@ namespace HIJetRec{
     if( 2.*std::abs(xAOD::P4Helpers::deltaPhi(phi0,phi)) > HI::TowerBins::getBinSizePhi() ) return false;
     return true;
   }
-  
+
   inline void setClusterP4(const xAOD::CaloCluster::FourMom_t& p, xAOD::CaloCluster* cl, xAOD::CaloCluster::State s)
   {
     float energy=p.Energy();
     float eta=p.Eta();
     float phi=p.Phi();
-    if(energy < 0.) 
+    if(energy < 0.)
     {
       eta*=-1.;
       if(phi > 0.) phi-=M_PI;
@@ -62,5 +67,23 @@ namespace HIJetRec{
     }
   }
 
+/// \brief : getClusterP4 Added during Rel22 migration. We should never use CaloCluster_v1::p4() because this four vector can
+/// never have a negative energy. Therefore, if one tries to use setClusterP4 and then retrieve the cluster four momenta,
+/// must use this new method that keeps the cluster information as set in setClusterP4 (negative E and flipped eta phi)
+  inline TLorentzVector getClusterP4( const xAOD::CaloCluster* cl, xAOD::CaloCluster::State s ){
+    TLorentzVector correct_clusP4;
+    float energy=cl->e(s);
+    float eta=cl->eta(s);
+    float phi=cl->phi(s);
+    if(energy < 0.)
+    {
+      eta*=-1.;
+      if(phi > 0.) phi-=M_PI;
+      else phi+=M_PI;
+    }
+    float pt=energy/std::cosh(eta);
+    correct_clusP4.SetPtEtaPhiE(pt, eta,phi ,energy);
+    return correct_clusP4;
+  }
 }
 #endif
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.cxx
index 1dcb08a83f76920d6c3096c37d54dd19d9696442..555e6036eff2215d5ccea43cc13bfcfa447ef053 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.cxx
+++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.cxx
@@ -55,6 +55,8 @@ int HIEventShapeJetIteration::execute() const
 
   const HIEventShapeIndex* es_index = HIEventShapeMap::getIndex(m_inputEventShapeKey.key());
   //New implementation after moving away from mutable
+  ATH_MSG_INFO("HIEventShapeJetIteration: found index for  " << m_inputEventShapeKey.key());
+
   if(es_index==nullptr)
   {
     ATH_MSG_INFO("No HIEventShapeIndex w/ name " << m_inputEventShapeKey.key() << " adding it to the map");
@@ -64,7 +66,9 @@ int HIEventShapeJetIteration::execute() const
   }
 
   const HIEventShapeIndex* other_index = HIEventShapeMap::getIndex(m_outputEventShapeKey.key());
-  if(!other_index) HIEventShapeMap::insert( m_inputEventShapeKey.key(), *es_index );
+  if(!other_index) {
+   HIEventShapeMap::getMap()->insert( m_outputEventShapeKey.key(), *es_index );
+ }
   //End of new implementation
 
   const xAOD::JetContainer* theCaloJets=0;
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentModifierTool.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentModifierTool.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..7230177af05af31871d3a574b77ba357eab772ca
--- /dev/null
+++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentModifierTool.cxx
@@ -0,0 +1,112 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "HIJetRec/HIJetConstituentModifierTool.h"
+#include "HIJetRec/HIJetRecDefs.h"
+#include "xAODJet/JetConstituentVector.h"
+#include "xAODCaloEvent/CaloClusterContainer.h"
+#include "xAODBase/IParticle.h"
+#include "xAODBase/IParticleContainer.h"
+#include "JetRec/JetModifierBase.h"
+
+#include "StoreGate/ReadHandle.h"
+
+HIJetConstituentModifierTool::HIJetConstituentModifierTool(const std::string& myname): JetModifierBase(myname)
+{
+}
+
+StatusCode HIJetConstituentModifierTool::initialize(){
+
+  ATH_MSG_INFO("Initializing HIJetConstituentModifierTool w/ Cluster Key " << m_clusterKey.key() );
+  ATH_CHECK( m_clusterKey.initialize() );
+  return StatusCode::SUCCESS;
+
+}
+
+int HIJetConstituentModifierTool::modifyJet(xAOD::Jet& jet) const {
+
+    float E_min=m_subtractorTool->minEnergyForMoments();
+    const xAOD::JetConstituentVector constituents = jet.getConstituents();
+    std::vector<size_t> cluster_indices;
+    cluster_indices.reserve(constituents.size());
+
+    for (auto citer = constituents.begin(); citer != constituents.end(); ++citer)
+    {
+      cluster_indices.push_back(citer->rawConstituent()->index());
+    }
+
+    /// The accessor for the cluster element links
+   static SG::AuxElement::Accessor< std::vector< ElementLink< xAOD::IParticleContainer > > >
+     constituentAcc( "constituentLinks" );
+   static SG::AuxElement::Accessor< std::vector< float> >
+     constituentWeightAcc( "constituentWeights" );
+
+   if( constituentAcc.isAvailable(jet) ) constituentAcc( jet ).resize(0);
+   if( constituentWeightAcc.isAvailable(jet) ) constituentWeightAcc( jet ).resize(0);
+
+   //save unsubtracted kinematics as moment if they don’t exist already...
+   xAOD::IParticle::FourMom_t unsubtractedP4;
+   unsubtractedP4 = jet.p4();
+   jet.setJetP4(HIJetRec::unsubtractedJetState(),jet.jetP4());
+
+   xAOD::IParticle::FourMom_t subtractedP4;
+   xAOD::IParticle::FourMom_t subtractedOriginCorrP4;
+   xAOD::JetFourMom_t subtractedJet4vec;
+   xAOD::JetFourMom_t subtractedOriginCorrJet4vec;
+   //Cluster container access (from the e-gamma + cluster subtracted deep copy)
+   SG::ReadHandle<xAOD::CaloClusterContainer> readHandleSubtractedClusters ( m_clusterKey );
+
+   const xAOD::CaloClusterContainer* ccl=readHandleSubtractedClusters.get();
+
+   for(auto index : cluster_indices)
+   {
+     const xAOD::CaloCluster* cl=static_cast<const xAOD::CaloCluster*>(ccl->at(index));
+
+     jet.addConstituent(cl);
+     xAOD::IParticle::FourMom_t subtractedClusterP4;
+     subtractedClusterP4=HIJetRec::getClusterP4( cl, HIJetRec::subtractedClusterState());
+     subtractedP4+=subtractedClusterP4;
+     ATH_MSG_DEBUG("Subracted Cluster #: " << cl->index() << " :: E: " << subtractedClusterP4.E() << " :: Eta: " << subtractedClusterP4.Eta() << " :: Phi: " << subtractedClusterP4.Phi());
+
+     if( m_originCorrection ){
+       xAOD::IParticle::FourMom_t subtractedOriginCorrClusterP4;
+       subtractedOriginCorrClusterP4=HIJetRec::getClusterP4( cl, HIJetRec::subtractedOriginCorrectedClusterState());
+       subtractedOriginCorrP4+=subtractedOriginCorrClusterP4;
+       ATH_MSG_DEBUG("Subrtracted OC Cluster #: " << cl->index() << " :: E: " << subtractedOriginCorrClusterP4.E() << " :: Eta: " << subtractedOriginCorrClusterP4.Eta() << " :: Phi: " << subtractedOriginCorrClusterP4.Phi());
+     }
+
+   }
+
+   //Check for subtracted Kinematics
+   if(subtractedP4.E()/std::cosh(subtractedP4.Eta()) < E_min)
+   {
+     subtractedP4=unsubtractedP4;
+     subtractedP4*=1e-7;//ghost scale
+   }
+   //Check for subtracted + Origin Correction Kinematics
+   if(subtractedOriginCorrP4.E()/std::cosh(subtractedOriginCorrP4.Eta()) < E_min && m_originCorrection )
+   {
+     subtractedOriginCorrP4=unsubtractedP4;
+     subtractedOriginCorrP4*=1e-7;//ghost scale
+   }
+
+   subtractedJet4vec.SetCoordinates(subtractedP4.Pt(),subtractedP4.Eta(),
+                                    subtractedP4.Phi(),subtractedP4.M());
+   jet.setJetP4(HIJetRec::subtractedJetState(), subtractedJet4vec);
+
+   if( m_originCorrection ) {
+     subtractedOriginCorrJet4vec.SetCoordinates(subtractedOriginCorrP4.Pt(),subtractedOriginCorrP4.Eta(),
+                                                subtractedOriginCorrP4.Phi(),subtractedOriginCorrP4.M());
+     jet.setJetP4(HIJetRec::subtractedOriginCorrectedJetState(), subtractedOriginCorrJet4vec);
+     jet.setJetP4(subtractedOriginCorrJet4vec);
+     jet.setConstituentsSignalState(HIJetRec::subtractedOriginCorrectedConstitState());
+
+   }
+   else {
+     jet.setJetP4(subtractedJet4vec);
+     jet.setConstituentsSignalState(HIJetRec::subtractedConstitState());
+   }
+
+   return 0;
+}
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentSubtractionTool.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentSubtractionTool.cxx
index c4f4202b7606767c7b14e12d8d09e34bcf59928b..f8dc7966ce4030afcede4eb0934907909665d31e 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentSubtractionTool.cxx
+++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentSubtractionTool.cxx
@@ -25,7 +25,6 @@ StatusCode HIJetConstituentSubtractionTool::initialize()
 {
    ATH_MSG_VERBOSE("HIJetConstituentSubtractionTool initialize");
    ATH_CHECK( m_eventShapeKey.initialize( !m_eventShapeKey.key().empty()) );
-   ATH_CHECK( m_vertexContainer.initialize( !m_vertexContainer.key().empty()) );
    return StatusCode::SUCCESS;
 }
 
@@ -39,20 +38,18 @@ StatusCode HIJetConstituentSubtractionTool::modify(xAOD::JetContainer& jets) con
 
   //retrieve UE
   //Introduction of a read handle for the HIShapeContainer
-  SG::ReadHandle<xAOD::HIEventShapeContainer>  read_handle_evtShape ( m_eventShapeKey );
+  SG::ReadHandle<xAOD::HIEventShapeContainer>  readHandleEvtShape ( m_eventShapeKey );
 
   const xAOD::HIEventShapeContainer* shape=nullptr;
   const HIEventShapeIndex* es_index=nullptr;
   if(m_eventShapeKey.key().compare("") != 0)
   {
-    //if(evtStore()->retrieve(shape,EventShapeKey()).isFailure())
-    if (!read_handle_evtShape.isValid())
+    if (!readHandleEvtShape.isValid())
     {
       ATH_MSG_ERROR("Could not retrieve input HIEventShape " << m_eventShapeKey.key() );
       return StatusCode::FAILURE;
     }
-    shape = read_handle_evtShape.get(); /** TODO check if this is neeed  **/
-    //HIEventShapeMap is a c++ map that neeeds the string key to identify the paired object
+    shape = readHandleEvtShape.get();
     es_index=HIEventShapeMap::getIndex(m_eventShapeKey.key());
     if(es_index==nullptr)
     {
@@ -69,36 +66,6 @@ StatusCode HIJetConstituentSubtractionTool::modify(xAOD::JetContainer& jets) con
     return StatusCode::FAILURE;
   }
 
-  const xAOD::Vertex* primVertex=nullptr;
-  const xAOD::VertexContainer* vertices=nullptr;
-
-  //Introduction of a read handle for the HIShapeContainer
-  SG::ReadHandle<xAOD::VertexContainer>  read_handle_vertexContainer ( m_vertexContainer );
-
-  if(m_originCorrection)
-  {
-    if(!read_handle_vertexContainer.isValid())
-    {
-      ATH_MSG_ERROR("Could not retrieve VertexContainer " << m_vertexContainer.key());
-      return StatusCode::FAILURE;
-    }
-    //if(evtStore()->retrieve(vertices,m_vertexContainer).isFailure())
-    vertices = read_handle_vertexContainer.get();
-    for ( size_t iVertex = 0; iVertex < vertices->size(); ++iVertex )
-    {
-      if(vertices->at(iVertex)->vertexType() == xAOD::VxType::PriVtx)
-      {
-        	primVertex=vertices->at(iVertex);
-        	break;
-      }
-    }
-    if(!primVertex)
-    {
-      ATH_MSG_WARNING("No primary vertices found, using first in container");
-      primVertex=vertices->at(0);
-    }
-  }
-
   const xAOD::HIEventShape* eshape = nullptr;
   if(m_modulatorTool->getShape(eshape).isFailure())
   {
@@ -106,72 +73,22 @@ StatusCode HIJetConstituentSubtractionTool::modify(xAOD::JetContainer& jets) con
     return StatusCode::FAILURE;
   }
 
-  bool missingMoment=false;
-  bool needsUnsubMoment=false;
-  if(jets.size() > 0){
-     xAOD::JetFourMom_t tmp;
-     needsUnsubMoment = !((*jets.begin())->getAttribute<xAOD::JetFourMom_t>(HIJetRec::unsubtractedJetState(),tmp));
-  }
-
-  //check to see if unsubtracted moment has been stored
   for ( xAOD::JetContainer::iterator ijet=jets.begin(); ijet!=jets.end(); ++ijet)
   {
 
     xAOD::IParticle::FourMom_t p4_cl;
     xAOD::IParticle::FourMom_t p4_subtr;
     xAOD::IParticle::FourMom_t p4_unsubtr;
-    const xAOD::Vertex* origin=nullptr;
-    if(m_originCorrection)
-    {
-      if( !(*ijet)->getAssociatedObject<xAOD::Vertex>("OriginVertex", origin) )
-      {
-      	origin=primVertex;
-      	ATH_MSG_DEBUG("Jet has no associated vertex, using PV from container");
-      }
-    }
-
     const xAOD::JetConstituentVector constituents = (*ijet)->getConstituents();
     for (xAOD::JetConstituentVector::iterator itr = constituents.begin(); itr != constituents.end(); ++itr)
     {
       m_subtractorTool->subtract(p4_cl,itr->rawConstituent(),shape,es_index,m_modulatorTool, eshape); //modifies p4_cl to be constituent 4-vector AFTER subtraction
-      if(m_originCorrection)
-      {
-	const xAOD::CaloCluster* cl=static_cast<const xAOD::CaloCluster*>(itr->rawConstituent());
-	float mag = 0;
-	if(cl->isAvailable<float>("HIMag")) mag=cl->auxdataConst<float>("HIMag");
-	else
-	{
-	  double cm_mag=0;
-	  if(cl->retrieveMoment (xAOD::CaloCluster::CENTER_MAG, cm_mag)) mag=cm_mag;
-	}
-	if(mag!=0.)
-	{
-	  float eta0=cl->eta0();
-	  float phi0=cl->phi0();
-	  float radius=mag/std::cosh(eta0);
-	  xAOD::IParticle::FourMom_t p4_pos;
-	  p4_pos.SetX(radius*std::cos(phi0)-origin->x());
-	  p4_pos.SetY(radius*std::sin(phi0)-origin->y());
-	  p4_pos.SetZ(radius*std::sinh(eta0)-origin->z());
-
-	  double deta=p4_pos.Eta()-eta0;
-	  double dphi=p4_pos.Phi()-phi0;
-	  //adjust in case eta/phi are flipped in case of neg E clusters
-	  //this method is agnostic wrt convention
-	  if(p4_cl.Eta()*eta0 <0.) deta*=-1;
-
-	  double eta_prime=p4_cl.Eta()+deta;
-	  double phi_prime=p4_cl.Phi()+dphi;
-	  double e_subtr=p4_cl.E();
-	  p4_cl.SetPtEtaPhiE(e_subtr/std::cosh(eta_prime),eta_prime,phi_prime,e_subtr);
-	}
-	else missingMoment=true;
-      }
-
       p4_subtr+=p4_cl;
+
       if( msgLvl(MSG::DEBUG) )
       {
       	const xAOD::CaloCluster* cl=static_cast<const xAOD::CaloCluster*>(itr->rawConstituent());
+        //here we can still keep cl->p4 because it's taking the unsubtracted state - moreover is debug 
       	p4_unsubtr+=cl->p4(HIJetRec::unsubtractedClusterState());
       }
     }
@@ -190,9 +107,6 @@ StatusCode HIJetConstituentSubtractionTool::modify(xAOD::JetContainer& jets) con
 		  << std::setw(10) << std::setprecision(3) << p4_subtr.E()*1e-3
 		  << std::setw(10) << std::setprecision(3) << p4_subtr.M()*1e-3);
 
-
-
-
     xAOD::JetFourMom_t jet4vec;
     //if entire jet has negative E, do no subtraction but set to ghost scale
     //prevents cases with large cancellations with small E but pT non-trivial
@@ -203,14 +117,8 @@ StatusCode HIJetConstituentSubtractionTool::modify(xAOD::JetContainer& jets) con
     }
     jet4vec.SetCoordinates(p4_subtr.Pt(),p4_subtr.Eta(),p4_subtr.Phi(),p4_subtr.M());
 
-
     (*ijet)->setJetP4(momentName(),jet4vec);
 
-    xAOD::JetFourMom_t tmp;
-    //if(! (*ijet)->getAttribute<xAOD::JetFourMom_t>(HIJetRec::unsubtractedJetState(),tmp) ){
-    if(needsUnsubMoment)
-       (*ijet)->setJetP4(HIJetRec::unsubtractedJetState(), (*ijet)->jetP4());
-//    }
     if(!momentOnly())
     {
       //hack for now to allow use of pp calib tool skipping pileup subtraction
@@ -218,11 +126,9 @@ StatusCode HIJetConstituentSubtractionTool::modify(xAOD::JetContainer& jets) con
       (*ijet)->setJetP4("JetPileupScaleMomentum", jet4vec );
       (*ijet)->setJetP4(xAOD::JetEMScaleMomentum, jet4vec);
 
-      (*ijet)->setJetP4(jet4vec);
       (*ijet)->setConstituentsSignalState(HIJetRec::subtractedConstitState());
     }
   }
-  if(missingMoment) ATH_MSG_WARNING("No origin correction applied, CENTERMAG missing");
-  //Fix from conflict beetween d1493284 (master) and 5af8a733 (21.0)
+
     return StatusCode::SUCCESS;
 }
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecFlags.py b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecFlags.py
index d7a8b43435cc722fc23ed00df820781bb701b629..b3aeaa257c946d3c6460802566a4a211f9b2cce1 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecFlags.py
+++ b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecFlags.py
@@ -100,9 +100,9 @@ class AntiKtRValues(JobProperty):
 class DoCellBasedSubtraction(JobProperty):
     """ option to use cell based subtraction
     """
-    statusOn     = True
+    statusOn     = False
     allowedTypes = ['bool']
-    StoredValue  = True
+    StoredValue  = False
 
 class HarmonicsForSubtraction(JobProperty):
     """ List of flow harmonics applied to jet subtraction
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecTools.py b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecTools.py
index 89a8a323c15276b86a13648b56585dbb0eff606b..22597feaa019599645f09ab4c3afba0a91b2bb27 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecTools.py
+++ b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecTools.py
@@ -8,10 +8,10 @@ import AthenaCommon.SystemOfUnits as Units
 #configuring getter tools
 #selection for track jets
 from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
+from JetRec.JetRecConf import PseudoJetAlgorithm
 from JetRecTools.JetRecToolsConf import JetTrackSelectionTool
 from JetRecTools.JetRecToolsConf import SimpleJetTrackSelectionTool
 from JetRecTools.JetRecToolsConf import TrackVertexAssociationTool
-from JetRecTools.JetRecToolsConf import PseudoJetAlgorithm
 from JetMomentTools.JetMomentToolsConf import JetCaloQualityTool
 from JetMomentTools.JetMomentToolsConf import JetCaloCellQualityTool
 
@@ -45,9 +45,7 @@ if HIJetFlags.UseHITracks() :
                                 InputContainer = jtm.tracksel_HI.OutputContainer,
                                 Label = "Track",
                                 OutputContainer = "PseudoJetTracks_HI",
-                                TrackVertexAssociation = jtm.tvassoc_HI.TrackVertexAssociation,
-                                SkipNegativeEnergy = True,
-                                GhostScale = 0.0)
+                                SkipNegativeEnergy = True )
     #now for ghost tracks
     jtm += InDet__InDetTrackSelectionTool("trk_gtracksel_HI",
                                           minPt                = 400.*Units.MeV,
@@ -67,9 +65,7 @@ if HIJetFlags.UseHITracks() :
                                 InputContainer = jtm.gtracksel_HI.OutputContainer,
                                 Label = "GhostTrack",
                                 OutputContainer = "PseudoJetGhostTracks_HI_ghost",
-                                TrackVertexAssociation = jtm.tvassoc_HI.TrackVertexAssociation,
-                                SkipNegativeEnergy = True,
-                                GhostScale = 1e-20)
+                                SkipNegativeEnergy = True )
 
     jtm.jvf.unlock()
     jtm.jvf.TrackVertexAssociation=jtm.tvassoc_HI.TrackVertexAssociation
@@ -88,16 +84,14 @@ jtm += PseudoJetAlgorithm("get_HI",
                                 Label = "LCTopo", #Label = "Tower",
                                 OutputContainer = "PseudoJet" + ClusterKey,
                                 SkipNegativeEnergy = False,
-                                TreatNegativeEnergyAsGhost=True,
-                                GhostScale = 1.e-20
+                                TreatNegativeEnergyAsGhost=True
                                 )
 
 jtm += PseudoJetAlgorithm("gakt4trackget_HI",
                        InputContainer = HIJetFlags.TrackJetContainerName(),
                        Label = "Ghost" + HIJetFlags.TrackJetContainerName(),
                        SkipNegativeEnergy = True,
-                       OutputContainer = "PseudoJetGhost" +  HIJetFlags.TrackJetContainerName(),
-                       GhostScale = 1.e-20)
+                       OutputContainer = "PseudoJetGhost" +  HIJetFlags.TrackJetContainerName() )
 
 HIgetters_ghost_track = []
 HIgetters_common=[]
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecUtils.py b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecUtils.py
index 345e86b517136d9b219598d4b44d2e9bd3f7b4a1..34e27ed98defa999a68ab00bf26fc6f4e3b63ff1 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecUtils.py
+++ b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecUtils.py
@@ -145,6 +145,8 @@ def ApplySubtractionToClusters(**kwargs) :
     if 'cluster_key' in kwargs.keys() : cluster_key=kwargs['cluster_key']
     else : cluster_key=HIJetFlags.HIClusterKey()
 
+    if 'output_cluster_key' in kwargs.keys() : output_cluster_key=kwargs['output_cluster_key']
+    else : cluster_key=cluster_key+".deepCopy"
 
     if 'modulator' in kwargs.keys() : mod_tool=kwargs['modulator']
     else : mod_tool=GetNullModulator()
@@ -152,18 +154,26 @@ def ApplySubtractionToClusters(**kwargs) :
     if 'update_only' in kwargs.keys() : update_only = kwargs['update_only']
     else : update_only = False
 
+    if 'apply_origin_correction' in kwargs.keys() : apply_origin_correction=kwargs['apply_origin_correction']
+    else : apply_origin_correction=HIJetFlags.ApplyOriginCorrection()
+
+    do_cluster_moments=False
+    if 'CalculateMoments' in kwargs.keys() : do_cluster_moments=kwargs['CalculateMoments']
+
     HIClusterSubtraction=CompFactory.HIClusterSubtraction
     toolName='HIClusterSubtraction'
     if 'name' in kwargs.keys() : toolName = kwargs['name']
+
     theAlg=HIClusterSubtraction(toolName)
     theAlg.ClusterKey=cluster_key
+    theAlg.OutClusterKey=output_cluster_key
     theAlg.EventShapeKey=event_shape_key
     theAlg.Subtractor=GetSubtractorTool(**kwargs)
     theAlg.Modulator=mod_tool
     theAlg.UpdateOnly=update_only
+    theAlg.SetMoments=do_cluster_moments
+    theAlg.ApplyOriginCorrection=apply_origin_correction
 
-    do_cluster_moments=False
-    if 'CalculateMoments' in kwargs.keys() : do_cluster_moments=kwargs['CalculateMoments']
     if do_cluster_moments :
         CaloClusterMomentsMaker=CompFactory.CaloClusterMomentsMaker
         from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault
@@ -207,6 +217,25 @@ def ApplySubtractionToClusters(**kwargs) :
     jtm.jetrecs += [theAlg]
     jtm.HIJetRecs+=[theAlg]
 
+def GetConstituentsModifierTool(**kwargs) :
+    #For the cluster key, same exact logic as used for ApplySubtractionToClusters
+    if 'cluster_key' in kwargs.keys() : cluster_key=kwargs['cluster_key']
+    else : cluster_key=HIJetFlags.HIClusterKey()
+
+    if 'apply_origin_correction' in kwargs.keys() : apply_origin_correction=kwargs['apply_origin_correction']
+    else : apply_origin_correction=HIJetFlags.ApplyOriginCorrection()
+
+    HIJetConstituentModifierTool=CompFactory.HIJetConstituentModifierTool
+    toolName='HIJetConstituentModifierTool'
+    if 'name' in kwargs.keys() : toolName = kwargs['name']
+
+    cmod=HIJetConstituentModifierTool(toolName)
+    cmod.ClusterKey=cluster_key
+    cmod.Subtractor=GetSubtractorTool(**kwargs)
+    cmod.ApplyOriginCorrection=apply_origin_correction
+
+    jtm.add(cmod)
+    return cmod
 
 def AddIteration(seed_container,shape_name, **kwargs) :
 
@@ -273,14 +302,16 @@ def JetAlgFromTools(rtools, suffix="HI",persistify=True) :
         topsequence += JetAlgorithm("jetalgconstit"+suffix,
                                     Tools=[jtm.jetrunconstitHI])
 
-    #### test : add the PseudoJetAlgorithm
-    from JetRec.JetRecConf import PseudoJetAlgorithm
+    # Add the PseudoJetAlgorithm
+    # To avoid massive refactoring and to preserve familiarity,
+    # jet guys kept calling things "getters", but these are already
+    # PseudoJetAlgorithms as they eliminated the wrappers 
     for getter in jtm.allGetters:
-        print ('Adding PseudoJetAlgorithm for PseudoJetGetter %s' % getter.name)
+        print ('Adding PseudoJetAlgorithm %s' % getter.name)
         print ('Input Container %s' % getter.InputContainer)
         print ('Output Container %s' % getter.OutputContainer)
         print ('Label %s' % getter.Label)
-        topsequence += PseudoJetAlgorithm("pjalg_"+suffix+getter.Label,PJGetter=getter)
+        topsequence += getter
 
     runner=JetToolRunner("jetrun"+suffix,
                          Tools=rtools,
@@ -383,6 +414,7 @@ def GetHIModifierList(coll_name='AntiKt4HIJets',prepend_tools=[],append_tools=[]
     if coll_name not in jtm.HICalibMap.keys() :
         print ('Calibration for R=%d not available using default R=0.4 calibration')
         coll_name='AntiKt4HIJets'
+
     mod_list=prepend_tools
     mod_list+=[jtm.HICalibMap[coll_name]]
     mod_list+=jtm.modifiersMap['HI']
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/share/HIJetRec_jobOptions.py b/Reconstruction/HeavyIonRec/HIJetRec/share/HIJetRec_jobOptions.py
index 6ffa3c145f093350a0b81076446493aaf5645503..1121181189174f2b11c8333d506a3b8ff88844a4 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/share/HIJetRec_jobOptions.py
+++ b/Reconstruction/HeavyIonRec/HIJetRec/share/HIJetRec_jobOptions.py
@@ -39,8 +39,8 @@ if not jetFlags.useTruth():
 jetFlags.useTruth.set_Value_and_Lock(is_mc_or_overlay)
 
 
-#Tower level subtraction
-HIJetFlags.DoCellBasedSubtraction.set_Value_and_Lock(False)
+#Tower level subtraction - made it false by default to avoid confusion
+#HIJetFlags.DoCellBasedSubtraction.set_Value_and_Lock(False)
 
 jetFlags.useTracks.set_Value_and_Lock(True)
 #HIP mode
@@ -161,11 +161,6 @@ subtr1=MakeSubtractionTool(iter0.OutputEventShapeKey,moment_name="NoIteration",m
 #main subtractor
 subtr2=MakeSubtractionTool(HIJetFlags.IteratedEventShapeKey(),modulator=modulator1)
 
-#put subtraction tool at the FRONT of the jet modifiers list
-hi_tools=[subtr1,subtr2]
-hi_tools+=GetFlowMomentTools(iter1.OutputEventShapeKey,iter1.ModulationEventShapeKey)
-
-
 #==========#==========#==========#==========#==========#==========
 #special addition for egamma
 #Downstream egamma jo will call SubtractedCellGetter, it assumes that the container pointed to by
@@ -177,10 +172,18 @@ if not HIJetFlags.DoCellBasedSubtraction():
     cell_level_shape_key=iter_egamma.OutputEventShapeKey
     #HIJetFlags.IteratedEventShapeKey=iter_egamma.OutputEventShapeKey
 
-#Subtraction for egamma and to get layers
-ApplySubtractionToClusters(name="HIClusterSubtraction_egamma", event_shape_key=cell_level_shape_key, cluster_key=ClusterKey, modulator=modulator1, CalculateMoments=True, useClusters=False)
+cluster_key_eGamma_deep=ClusterKey+"_eGamma_deep"
+cluster_key_final_deep=cluster_key_eGamma_deep+"_Cluster_deep"
+#Subtraction for egamma and to get layers - here no origin correction yet (done in the next stage)
+ApplySubtractionToClusters(name="HIClusterSubtraction_egamma", event_shape_key=cell_level_shape_key, cluster_key=ClusterKey, output_cluster_key=cluster_key_eGamma_deep, modulator=modulator1, CalculateMoments=True, useClusters=False, apply_origin_correction=False)
 #Cluster subtraction for jets
-ApplySubtractionToClusters(event_shape_key=HIJetFlags.IteratedEventShapeKey(), update_only=True, cluster_key=ClusterKey, modulator=modulator1, CalculateMoments=False, useClusters=True)
+ApplySubtractionToClusters(event_shape_key=HIJetFlags.IteratedEventShapeKey(), cluster_key=cluster_key_eGamma_deep, output_cluster_key=cluster_key_final_deep, modulator=modulator1, CalculateMoments=False, useClusters=True, apply_origin_correction=HIJetFlags.ApplyOriginCorrection())
+
+#put subtraction tool at the FRONT of the jet modifiers list
+hi_tools=[subtr1,subtr2]
+hi_tools+=GetFlowMomentTools(iter1.OutputEventShapeKey,iter1.ModulationEventShapeKey)
+hi_tools+=[GetConstituentsModifierTool(name="HIJetConstituentModifierTool", cluster_key=cluster_key_final_deep, apply_origin_correction=HIJetFlags.ApplyOriginCorrection())]
+
 ###
 #subtracted algorithms
 #make main jets from unsubtr collections w/ same R, add modifiers for subtraction
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/src/HIClusterSubtraction.cxx b/Reconstruction/HeavyIonRec/HIJetRec/src/HIClusterSubtraction.cxx
index 651947798b5246ee6717ef70ede8f7564d2bba96..ec43691107e963510431a78c3761b3f410ccc212 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/src/HIClusterSubtraction.cxx
+++ b/Reconstruction/HeavyIonRec/HIJetRec/src/HIClusterSubtraction.cxx
@@ -6,7 +6,12 @@
 #include "xAODHIEvent/HIEventShapeContainer.h"
 #include "xAODCaloEvent/CaloClusterContainer.h"
 #include "HIEventUtils/HIEventShapeMap.h"
+#include "CaloUtils/CaloClusterStoreHelper.h"
 #include "HIJetRec/HIJetRecDefs.h"
+#include "xAODBase/IParticleHelpers.h"
+#include "xAODTracking/Vertex.h"
+#include "xAODTracking/VertexContainer.h"
+#include "xAODCaloEvent/CaloClusterAuxContainer.h"
 
 #include "StoreGate/ReadHandle.h"
 #include "StoreGate/WriteHandle.h"
@@ -23,7 +28,10 @@ StatusCode HIClusterSubtraction::initialize()
 {
 	//Keys initialization
 	ATH_CHECK( m_eventShapeKey.initialize() );
-	ATH_CHECK( m_clusterKey.initialize() );
+	ATH_CHECK( m_inClusterKey.initialize() );
+	ATH_CHECK( m_outClusterKey.initialize() );
+	//Vertex container needs to be initialized only if origin correction will take place
+	ATH_CHECK( m_vertexContainer.initialize( m_originCorrection ) );
 
   for (auto tool :  m_clusterCorrectionTools)
   {
@@ -34,74 +42,164 @@ StatusCode HIClusterSubtraction::initialize()
   return StatusCode::SUCCESS;
 }
 
+bool HIClusterSubtraction::doOriginCorrection( xAOD::CaloCluster* cl, const xAOD::Vertex* origin, xAOD::IParticle::FourMom_t& p4_cl ) const{
+	//made boolean to return what was "missingMoment" in HIJetConstituentSubtractionTool
+	bool missingMoment = false;
+	float mag = 0;
+	if(cl->isAvailable<float>("HIMag")) mag=cl->auxdataConst<float>("HIMag");
+	else
+	{
+		double cm_mag=0;
+		if(cl->retrieveMoment (xAOD::CaloCluster::CENTER_MAG, cm_mag)) mag=cm_mag;
+	}
+	if(mag!=0.)
+	{
+		float eta0=cl->eta0();
+		float phi0=cl->phi0();
+		float radius=mag/std::cosh(eta0);
+		xAOD::IParticle::FourMom_t p4_pos;
+		p4_pos.SetX(radius*std::cos(phi0)-origin->x());
+		p4_pos.SetY(radius*std::sin(phi0)-origin->y());
+		p4_pos.SetZ(radius*std::sinh(eta0)-origin->z());
+
+		double deta=p4_pos.Eta()-eta0;
+		double dphi=p4_pos.Phi()-phi0;
+		//adjust in case eta/phi are flipped in case of neg E clusters
+		//this method is agnostic wrt convention
+		if(p4_cl.Eta()*eta0 <0.) deta*=-1;
+
+		double eta_prime=p4_cl.Eta()+deta;
+		double phi_prime=p4_cl.Phi()+dphi;
+		double e_subtr=p4_cl.E();
+		p4_cl.SetPtEtaPhiE(e_subtr/std::cosh(eta_prime),eta_prime,phi_prime,e_subtr);
+	}
+	else missingMoment=true;
+
+	return missingMoment;
+}
+
 int HIClusterSubtraction::execute() const
 {
-
   //const jet::cellset_t & badcells = badCellMap.cells() ;
   //retrieve UE
-	//From here on temporarily commented out code bc decorators needs a dedicated treatment in MT
-	//const xAOD::HIEventShapeContainer* shape = 0;
+	const xAOD::HIEventShapeContainer* shape = 0;
 	SG::ReadHandle<xAOD::HIEventShapeContainer>  readHandleEvtShape ( m_eventShapeKey );
-  //shape = readHandleEvtShape.get();
-  ATH_MSG_WARNING("HIClusterSubtraction not yet migrated to MT. Currently disabled! ");
-  //const HIEventShapeIndex* es_index = HIEventShapeMap::getIndex( m_eventShapeKey.key() );
-
+  shape = readHandleEvtShape.cptr();
+  const HIEventShapeIndex* es_index = HIEventShapeMap::getIndex( m_eventShapeKey.key() );
   const xAOD::HIEventShape* eshape = nullptr;
-  //Hibryd merging between commit c2aeaed0 to master and 5af8a733 to 21.0ss
   CHECK(m_modulatorTool->getShape(eshape), 1);
-	//This part regards decoration!
-	//Needs a more deep implementation to work in MT - to be discussed w/ Bill Balunas
-	//Will be fronted in the next step of the migration
-  /*
-	SG::ReadHandle<xAOD::CaloClusterContainer>  read_handle_clusters ( m_clusterKey );
-	if (!read_handle_clusters.isValid())
-	{
-		ATH_MSG_ERROR("Could not retrieve input CaloClusterContainer " << m_clusterKey.key() );
-		return 1;
-	}
-	const xAOD::CaloClusterContainer* ccl=0;
-  if(m_updateMode)
+
+  //New implementation: make a deep copy of original HIClusters and apply subtraction to clusters in the new container
+	SG::ReadHandle<xAOD::CaloClusterContainer>  readHandleClusters ( m_inClusterKey );
+  // Now a handle to write the deep Copy
+  SG::WriteHandle<xAOD::CaloClusterContainer> writeHandleDeepCopyClusters ( m_outClusterKey );
+  // Preparing keys and container to perfrom the origin correction
+	const xAOD::Vertex* primVertex=nullptr;
+	const xAOD::VertexContainer* vertices=nullptr;
+  // Boolean to flag that at least a vertex is present in the vertex container
+	bool isOriginPossible = true;
+	// Finding the primary vertex in case origin correction has to be performed
+	if(m_originCorrection)
   {
-		ccl = read_handle_clusters.get();
-    //if(evtStore()->retrieve(ccl,m_clusterKey).isFailure())
-    std::unique_ptr<std::vector<float> > subtractedE(new std::vector<float>());
-    subtractedE->reserve(ccl->size());
-		//Decoration TODO: check for migration
-    SG::AuxElement::Decorator< float > decorator("HISubtractedE");
-
-    for(xAOD::CaloClusterContainer::const_iterator itr=ccl->begin(); itr!=ccl->end(); itr++)
+		// ReadHandle to retrieve the vertex container
+		SG::ReadHandle<xAOD::VertexContainer>  readHandleVertexContainer ( m_vertexContainer );
+    vertices = readHandleVertexContainer.get();
+    for ( size_t iVertex = 0; iVertex < vertices->size(); ++iVertex )
+    {
+      if(vertices->at(iVertex)->vertexType() == xAOD::VxType::PriVtx)
+      {
+        	primVertex=vertices->at(iVertex);
+        	break;
+      }
+    }
+    if(!primVertex && vertices->size() > 0)
     {
-      const xAOD::CaloCluster* cl=*itr;
-      xAOD::IParticle::FourMom_t p4;
-      m_subtractorTool->Subtract(p4,cl,shape,es_index,m_modulatorTool,eshape);
-      subtractedE->push_back(p4.E());
-      decorator(*cl)=p4.E();
+      ATH_MSG_WARNING("No primary vertices found, using first in container");
+      primVertex=vertices->at(0);
     }
+		if(!primVertex && vertices->size() == 0)
+    {
+      ATH_MSG_WARNING("No primary vertices found, and vertex container empty. Abortin Origin correction for this event.");
+      isOriginPossible = false;
+		}
   }
-  else
+	bool missingMoment=false;
+
+	auto originalCluster = readHandleClusters.cptr();
+	// Create the new container and its auxiliary store.
+	xAOD::CaloClusterContainer* copyClusters = new xAOD::CaloClusterContainer();
+  xAOD::AuxContainerBase* copyClustersAux = new xAOD::AuxContainerBase();
+  copyClusters->setStore(copyClustersAux);
+  copyClusters->reserve (originalCluster->size());
+
+	for (const xAOD::CaloCluster* oldCluster : *originalCluster) {
+	     xAOD::CaloCluster* newClu=new xAOD::CaloCluster();
+	     copyClusters->push_back (newClu);
+	     *newClu=*oldCluster;
+	}
+
+  for(xAOD::CaloClusterContainer::iterator itr=copyClusters->begin(); itr!=copyClusters->end(); itr++)
   {
-		xAOD::CaloClusterContainer* ccl=0;
-		ccl = read_handle_clusters.get();
-    for(xAOD::CaloClusterContainer::iterator itr=ccl->begin(); itr!=ccl->end(); itr++)
+    xAOD::CaloCluster* cl= *itr;
+		xAOD::IParticle::FourMom_t p4;
+		//Unsubtracted state record done by the subtractor tool functions.
+    if(m_setMoments)
+		{
+			//This flag is set to false for HIJetClustersSubtractorTool and true for HIJetCellSubtractorTool,
+			// but for the second we don't do origin correction. In principle the code is structured to do the same as the
+			//else for m_setMoments=true and HIJetClustersSubtractorTool, therefore we add the code for origin correction also here
+			m_subtractorTool->subtractWithMoments(cl, shape, es_index, m_modulatorTool, eshape);
+			if(isOriginPossible && m_originCorrection)
+			{
+				missingMoment = HIClusterSubtraction::doOriginCorrection( cl, primVertex, p4 );
+				HIJetRec::setClusterP4(p4,cl,HIJetRec::subtractedOriginCorrectedClusterState());
+			}
+		}
+    else
     {
-      xAOD::CaloCluster* cl=*itr;
-      xAOD::IParticle::FourMom_t p4;
-      if(m_setMoments) m_subtractorTool->SubtractWithMoments(cl, shape, es_index, m_modulatorTool, eshape);
-      else
-      {
-					m_subtractorTool->Subtract(p4,cl,shape,es_index,m_modulatorTool,eshape);
-					HIJetRec::setClusterP4(p4,cl,HIJetRec::subtractedClusterState());
-      }
-    }
+			m_subtractorTool->subtract(p4,cl,shape,es_index,m_modulatorTool,eshape);
+			HIJetRec::setClusterP4(p4,cl,HIJetRec::subtractedClusterState());
+
+			if(isOriginPossible)
+			{
+				ATH_MSG_DEBUG("Applying origin correction"
+							<< std::setw(12) << "Before:"
+							<< std::setw(10) << std::setprecision(3) << p4.Pt()*1e-3
+							<< std::setw(10) << std::setprecision(3) << p4.Eta()
+							<< std::setw(10) << std::setprecision(3) << p4.Phi()
+							<< std::setw(10) << std::setprecision(3) << p4.E()*1e-3
+							<< std::setw(10) << std::setprecision(3) << p4.M()*1e-3);
+
+				missingMoment = HIClusterSubtraction::doOriginCorrection( cl, primVertex, p4 );
+				HIJetRec::setClusterP4(p4,cl,HIJetRec::subtractedOriginCorrectedClusterState());
+
+				ATH_MSG_DEBUG("Applying origin correction"
+							<< std::setw(12) << "After:"
+							<< std::setw(10) << std::setprecision(3) << p4.Pt()*1e-3
+							<< std::setw(10) << std::setprecision(3) << p4.Eta()
+							<< std::setw(10) << std::setprecision(3) << p4.Phi()
+							<< std::setw(10) << std::setprecision(3) << p4.E()*1e-3
+							<< std::setw(10) << std::setprecision(3) << p4.M()*1e-3);
+			}
+		}
+  }//End of iterator over CaloClusterContainer
+
     for(ToolHandleArray<CaloClusterCollectionProcessor>::const_iterator toolIt=m_clusterCorrectionTools.begin();
 	      toolIt != m_clusterCorrectionTools.end(); toolIt++)
     {
       ATH_MSG_DEBUG(" Applying correction = " << (*toolIt)->name() );
-			CHECK((*toolIt)->execute(Gaudi::Hive::currentContext(), ccl), 1);
-			//Hibryd merging between commit c2aeaed0 to master and 5af8a733 to 21.0
-			//eventually needs to be changed to following for r21:
-			//CHECK((*toolIt)->execute(ccl), 1);
+			CHECK((*toolIt)->execute(Gaudi::Hive::currentContext(), copyClusters), 1);
     }//End loop over correction tools
-  }*/
+
+		if(missingMoment) ATH_MSG_WARNING("No origin correction applied, CENTERMAG missing");
+
+  // Make sure that memory is managed safely
+  std::unique_ptr<xAOD::CaloClusterContainer> outClusters(copyClusters);
+  std::unique_ptr<xAOD::AuxContainerBase> deepAux(copyClustersAux);
+
+	if(writeHandleDeepCopyClusters.record ( std::move(outClusters), std::move(deepAux)).isFailure() ){
+			ATH_MSG_ERROR("Unable to write DeepCopy Copy containers for subtracted clusters with key: " << m_outClusterKey.key());
+			return 1;
+	}
   return 0;
 }
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/src/HIClusterSubtraction.h b/Reconstruction/HeavyIonRec/HIJetRec/src/HIClusterSubtraction.h
index 44e53ca88ff339e13ff3b80094c5421a288dd44a..7a665337dde5d8b198fee677b3e86381175642fe 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/src/HIClusterSubtraction.h
+++ b/Reconstruction/HeavyIonRec/HIJetRec/src/HIClusterSubtraction.h
@@ -27,6 +27,7 @@
 #include <HIJetRec/IHISubtractorTool.h>
 #include <HIJetRec/IHIUEModulatorTool.h>
 #include "CaloRec/CaloClusterCollectionProcessor.h"
+#include "xAODTracking/VertexContainer.h"
 
 #include "StoreGate/ReadHandleKey.h"
 #include "StoreGate/WriteHandleKey.h"
@@ -45,12 +46,18 @@ public:
 
   virtual int execute() const;
 
+	bool doOriginCorrection( xAOD::CaloCluster* cl, const xAOD::Vertex* origin, xAOD::IParticle::FourMom_t& p4_cl ) const;
+
 
 private:
   /// \brief Name of input cluster container
-	SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clusterKey { this, "ClusterKey", "ClusterKey", "Name of the input Cluster Container"};
+	SG::ReadHandleKey< xAOD::CaloClusterContainer > m_inClusterKey { this, "ClusterKey", "ClusterKey", "Name of the input Cluster Container"};
+	/// |brief New writeHandleKey to store the shallow copy used for new CaloClusterTreatment
+	SG::WriteHandleKey< xAOD::CaloClusterContainer > m_outClusterKey { this, "OutClusterKey", "OutClusterKey", "Name of the output Cluster Container (deep Copy)"};
   /// \brief Name of HIEventShapeContainer defining background
 	SG::ReadHandleKey< xAOD::HIEventShapeContainer > m_eventShapeKey { this, "EventShapeKey", "EventShapeKey", "Name of HIEventShapeContainer defining background"};
+  /// |brief Name of Vertex Container for origin correction
+	SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer { this, "VertexContainer", "PrimaryVertices", "Vertex container for primary vertices"};
 
 	// Tool handles
   ToolHandle<IHISubtractorTool> m_subtractorTool { this, "Subtractor", "HIJetSubtractorToolBase", "Handle to IHISubtractorTool which does calculates subtracted kinematics" };
@@ -60,6 +67,8 @@ private:
 	// Booleans
 	Gaudi::Property< bool > m_setMoments { this, "SetMoments", true, "Set Moments boolean switch"};
 	Gaudi::Property< bool > m_updateMode  { this, "UpdateOnly", false, "Update Mode boolean switch"};
+  //Moving the origin correction directly here
+	Gaudi::Property< bool > m_originCorrection { this, "ApplyOriginCorrection", false, "Apply Origin Correction boolean switch"};
 
 };
 #endif
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/src/HIJetCellSubtractorTool.cxx b/Reconstruction/HeavyIonRec/HIJetRec/src/HIJetCellSubtractorTool.cxx
index 920fc265b04440aaf1fe148c297fd7c1c93cac03..5ca285b3b034790ae97445e6035b3d8445879708 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/src/HIJetCellSubtractorTool.cxx
+++ b/Reconstruction/HeavyIonRec/HIJetRec/src/HIJetCellSubtractorTool.cxx
@@ -30,9 +30,9 @@ void HIJetCellSubtractorTool::subtract(xAOD::IParticle::FourMom_t& subtr_mom, co
   const float phi0=cl->phi0();
 
   float mod=modulator->getModulation(phi0, eshape);
-
   //unsigned int eta_phi_index=HICaloCellHelper::FindEtaPhiBin(cl->eta0(),cl->phi0());
   xAOD::CaloCluster::const_cell_iterator cellIterEnd = cl->cell_end();
+
   for(xAOD::CaloCluster::const_cell_iterator cellIter=cl->cell_begin(); cellIter != cellIterEnd; cellIter++ )
   {
     CxxUtils::prefetchNext(cellIter, cellIterEnd);
@@ -55,6 +55,7 @@ void HIJetCellSubtractorTool::subtract(xAOD::IParticle::FourMom_t& subtr_mom, co
     phi_cl+=cell_E_w*phi;
 
   }
+
   if(E_cl!=0.)
   {
     eta_cl/=E_cl;
@@ -134,6 +135,12 @@ void HIJetCellSubtractorTool::subtractWithMoments(xAOD::CaloCluster* cl, const x
 
   std::vector<float> E_sample(CaloSampling::Unknown,0);
   uint32_t samplingPattern=0;
+
+  auto cellLink = cl->getCellLinks();
+  if( cellLink == NULL){
+     ATH_MSG_ERROR("HIJetCellSubtraction: cellLink null - returning");
+     return;
+  }
   //unsigned int eta_phi_index=HICaloCellHelper::FindEtaPhiBin(cl->eta0(),cl->phi0());
   xAOD::CaloCluster::cell_iterator cellIterEnd = cl->cell_end();
   for(xAOD::CaloCluster::cell_iterator cellIter=cl->cell_begin(); cellIter != cellIterEnd; cellIter++ )
@@ -166,8 +173,6 @@ void HIJetCellSubtractorTool::subtractWithMoments(xAOD::CaloCluster* cl, const x
     float cell_z=(*cellIter)->z();
     etot2+=abs_weight;
     er2+=std::sqrt(cell_x*cell_x+cell_y*cell_y+cell_z*cell_z)*abs_weight;
-
-
   }
   if(E_cl!=0.)
   {
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/src/HISubtractedCellMakerTool.cxx b/Reconstruction/HeavyIonRec/HIJetRec/src/HISubtractedCellMakerTool.cxx
index 04b80f0cd74240e888feea240d998353f7be8699..d80316b06030c42a113ebc4173bda48b475a8569 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/src/HISubtractedCellMakerTool.cxx
+++ b/Reconstruction/HeavyIonRec/HIJetRec/src/HISubtractedCellMakerTool.cxx
@@ -56,13 +56,7 @@ StatusCode HISubtractedCellMakerTool::process (CaloCellContainer* theCells,
     return StatusCode::SUCCESS;
   }
 
-  // FIXME: m_modulatorTool->retrieveShape() is non-const.
-  // It should be made const in order to be able to safely call it from here.
-  // However, this method already needs updating to work in MT (and is checked
-  // above), so just use a const_cast for now to allow this to compile
-  // when ToolHandle restrictions are enabled.
-
-  IHIUEModulatorTool* modtool_nc = const_cast<IHIUEModulatorTool*> (m_modulatorTool.get());
+  auto modtool_nc = m_modulatorTool.get();
   CHECK(modtool_nc->retrieveShape());
 
   for(auto pCell : *theCells)
@@ -76,8 +70,8 @@ StatusCode HISubtractedCellMakerTool::process (CaloCellContainer* theCells,
     {
       if( std::abs(eta) - HICaloRange::getRange().getRangeMax(sample) )
       {
-	double fp_round=(eta > 0.) ? -5e-3 : 5e-3;
-	bin=index->getIndex(eta+fp_round,sample);
+      	double fp_round=(eta > 0.) ? -5e-3 : 5e-3;
+      	bin=index->getIndex(eta+fp_round,sample);
       }
     }
 
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/src/components/HIJetRec_entries.cxx b/Reconstruction/HeavyIonRec/HIJetRec/src/components/HIJetRec_entries.cxx
index ac457b88e17794efd6b3fc80df057d6b3ac1e5a0..e34a0313363b73fcf0f14d017830f3b1ec06fc5b 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/src/components/HIJetRec_entries.cxx
+++ b/Reconstruction/HeavyIonRec/HIJetRec/src/components/HIJetRec_entries.cxx
@@ -8,6 +8,7 @@
 #include "HIJetRec/HIEventShapeJetIteration.h"
 #include "HIJetRec/HIJetClusterSubtractorTool.h"
 #include "HIJetRec/HIJetConstituentSubtractionTool.h"
+#include "HIJetRec/HIJetConstituentModifierTool.h"
 #include "HIJetRec/HIJetDRAssociationTool.h"
 #include "HIJetRec/HIJetMaxOverMeanTool.h"
 #include "HIJetRec/HIJetDiscriminatorTool.h"
@@ -21,7 +22,7 @@ DECLARE_COMPONENT( HIClusterSubtraction )
 DECLARE_COMPONENT( HISubtractedCellMakerTool )
 #endif
 
-
+DECLARE_COMPONENT( HIJetConstituentModifierTool )
 DECLARE_COMPONENT( HIEventShapeJetIteration )
 DECLARE_COMPONENT( HIJetConstituentSubtractionTool )
 DECLARE_COMPONENT( HIJetClusterSubtractorTool )
diff --git a/Reconstruction/Jet/JetRec/CMakeLists.txt b/Reconstruction/Jet/JetRec/CMakeLists.txt
index e85c9f87c0f54903651add011102aad70545ab0e..de9b347d3eaac7243f31f733d8207a9bdc8c56a7 100644
--- a/Reconstruction/Jet/JetRec/CMakeLists.txt
+++ b/Reconstruction/Jet/JetRec/CMakeLists.txt
@@ -51,12 +51,11 @@ find_package( GTest )
 atlas_add_library( JetRecLib
   JetRec/*.h Root/*.h Root/*.cxx
   PUBLIC_HEADERS JetRec
-  INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS}
-  PRIVATE_INCLUDE_DIRS ${FASTJETCONTRIB_INCLUDE_DIRS}
-  LINK_LIBRARIES ${ROOT_LIBRARIES} ${FASTJET_LIBRARIES} AthLinks AthContainers AsgTools
+  INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} ${FASTJETCONTRIB_INCLUDE_DIRS}
+  LINK_LIBRARIES ${ROOT_LIBRARIES} ${FASTJET_LIBRARIES} ${FASTJETCONTRIB_LIBRARIES} AthLinks AthContainers AsgTools
   xAODCaloEvent xAODJet xAODMuon EventShapeInterface JetEDM
   JetInterface
-  PRIVATE_LINK_LIBRARIES ${FASTJETCONTRIB_LIBRARIES} CxxUtils xAODBase xAODCore
+  PRIVATE_LINK_LIBRARIES CxxUtils xAODBase xAODCore
   xAODEventInfo xAODTracking ${mon_lib})
 
 if( NOT XAOD_STANDALONE )
@@ -68,7 +67,7 @@ endif()
 atlas_add_dictionary( JetRecDict
    JetRec/JetRecDict.h
    JetRec/selection.xml
-   LINK_LIBRARIES JetRecLib )
+   LINK_LIBRARIES JetRecLib ${mon_lib} )
 
 # Test(s) in the package:
 atlas_add_test( TestTests
diff --git a/Reconstruction/Jet/JetRec/JetRec/JetBottomUpSoftDrop.h b/Reconstruction/Jet/JetRec/JetRec/JetBottomUpSoftDrop.h
new file mode 100644
index 0000000000000000000000000000000000000000..7b6ea6297de6d7bd3f15b296fe3f0a668235f775
--- /dev/null
+++ b/Reconstruction/Jet/JetRec/JetRec/JetBottomUpSoftDrop.h
@@ -0,0 +1,65 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+// JetBottomUpSoftDrop.h
+
+#ifndef JetBottomUpSoftDrop_H
+#define JetBottomUpSoftDrop_H
+
+// Jennifer Roloff & Joe Taenzer
+// October 2016
+//
+// Tool to groom jets with bottom up softdrop.
+// SoftDrop is described in this paper: arXiv:1402.2657 
+// Bottom Up SoftDrop is described in this paper (under the name "Iterated SoftDrop": https://arxiv.org/pdf/1704.06266.pdf
+// See also: https://fastjet.hepforge.org/trac/browser/contrib/contribs/RecursiveTools/tags/2.0.0-beta1/BottomUpSoftDrop.hh
+
+#include "AsgTools/AsgTool.h"
+#include "JetInterface/IJetGroomer.h"
+#include "JetInterface/IJetFromPseudojet.h"
+#include "AsgTools/ToolHandle.h"
+
+#include "fastjet/ClusterSequence.hh"
+#include "fastjet/contrib/RecursiveSymmetryCutBase.hh"
+#include "fastjet/contrib/BottomUpSoftDrop.hh"
+
+class JetBottomUpSoftDrop
+: public asg::AsgTool,
+  virtual public IJetGroomer {
+ASG_TOOL_CLASS(JetBottomUpSoftDrop, IJetGroomer)
+
+public:
+
+  // Ctor.
+  JetBottomUpSoftDrop(std::string name);
+
+  // Dtor.
+  ~JetBottomUpSoftDrop();
+
+  // Initilization.
+  StatusCode initialize();
+
+  // Groom a jet and add result to a container.
+  int groom(const xAOD::Jet& jin,
+            const PseudoJetContainer&,
+            xAOD::JetContainer& jout) const;
+
+  // Dump to log.
+  void print() const;
+
+private:  // data
+
+  // Job options.
+  // SoftDrop algorithm:
+  // z > zcut * (dR12/R0)^beta
+  // z = min(pT1, pT2)/(pT1+pT2)
+  // R0 = characteristic jet radius
+  float m_zcut;                        // pT fraction for retaining subjets
+  float m_beta;                        // How much to consider angular dependence
+  float m_R0;	                         // Normalization of angular distance, usually the characteristic jet radius (default R0 = 1)
+  ToolHandle<IJetFromPseudojet> m_bld;  // Tool to build jets.
+
+};
+
+#endif
diff --git a/Reconstruction/Jet/JetRec/JetRec/JetRecDict.h b/Reconstruction/Jet/JetRec/JetRec/JetRecDict.h
index ca7763e79c998f70df282baf189ff8387f198552..bf8f46fb3fb7a0f702085c5dd3f96ff41e0a8d8d 100644
--- a/Reconstruction/Jet/JetRec/JetRec/JetRecDict.h
+++ b/Reconstruction/Jet/JetRec/JetRec/JetRecDict.h
@@ -1,11 +1,12 @@
 /*
-  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 JETREC_JETRECDICT_H
 #define JETREC_JETRECDICT_H
 
 #include "JetRec/FastJetInterfaceTool.h"
+#include "JetRec/JetBottomUpSoftDrop.h"
 #include "JetRec/JetByVertexFinder.h"
 #include "JetRec/JetConstitRemover.h"
 #include "JetRec/JetConstituentsRetriever.h"
@@ -19,6 +20,8 @@
 #include "JetRec/JetPseudojetRetriever.h"
 #include "JetRec/JetReclusterer.h"
 #include "JetRec/JetRecTool.h"
+#include "JetRec/JetRecursiveSoftDrop.h"
+#include "JetRec/JetSoftDrop.h"
 #include "JetRec/JetSorter.h"
 #include "JetRec/JetSplitter.h"
 #include "JetRec/JetToolRunner.h"
diff --git a/Reconstruction/Jet/JetRec/JetRec/JetRecursiveSoftDrop.h b/Reconstruction/Jet/JetRec/JetRec/JetRecursiveSoftDrop.h
new file mode 100644
index 0000000000000000000000000000000000000000..06b3db2dc545fb951de7ef89790c0b02e38a6e83
--- /dev/null
+++ b/Reconstruction/Jet/JetRec/JetRec/JetRecursiveSoftDrop.h
@@ -0,0 +1,68 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+// JetRecursiveSoftDrop.h
+
+#ifndef JetRecursiveSoftDrop_H
+#define JetRecursiveSoftDrop_H
+
+// Jennifer Roloff & Joe Taenzer
+// August 2017
+//
+// Tool to groom jets with recursive softdrop.
+// SoftDrop is described in this paper: arXiv:1402.2657
+// Recursive SoftDrop is described in this Boost2017 contribution: https://indico.cern.ch/event/579660/contributions/2582124/
+// See also: https://fastjet.hepforge.org/trac/browser/contrib/contribs/RecursiveTools/tags/2.0.0-beta1/RecursiveSoftDrop.hh
+
+#include "AsgTools/AsgTool.h"
+#include "JetInterface/IJetGroomer.h"
+#include "JetInterface/IJetFromPseudojet.h"
+#include "AsgTools/ToolHandle.h"
+
+#include "fastjet/ClusterSequence.hh"
+#include "fastjet/contrib/RecursiveSymmetryCutBase.hh"
+#include "fastjet/contrib/RecursiveSoftDrop.hh"
+
+class JetRecursiveSoftDrop
+: public asg::AsgTool,
+  virtual public IJetGroomer {
+ASG_TOOL_CLASS(JetRecursiveSoftDrop, IJetGroomer)
+
+public:
+
+  // Ctor.
+  JetRecursiveSoftDrop(std::string name);
+
+  // Dtor.
+  ~JetRecursiveSoftDrop();
+
+  // Initilization.
+  StatusCode initialize();
+
+  // Groom a jet and add result to a container.
+  int groom(const xAOD::Jet& jin,
+            const PseudoJetContainer&,
+            xAOD::JetContainer& jout) const;
+
+  // Dump to log.
+  void print() const;
+
+private:  // data
+
+  // Job options.
+  // Recursive SoftDrop algorithm:
+  // z > zcut * (dR12/R0)^beta
+  // z = min(pT1, pT2)/(pT1+pT2)
+  // R0 = characteristic jet radius
+  // N : algorithm terminates after passing SoftDrop condition N times 
+  // (Standard SoftDrop terminates after passing it once)
+  float m_zcut;                        // pT fraction for retaining subjets
+  float m_beta;                        // How much to consider angular dependence
+  int m_N;                        // Number of layers (-1 <> infinite)
+  float m_R0;	                         // Normalization of angular distance, usually the characteristic jet radius (default R0 = 1)
+  ToolHandle<IJetFromPseudojet> m_bld;  // Tool to build jets.
+
+};
+
+#endif
diff --git a/Reconstruction/Jet/JetRec/JetRec/JetSoftDrop.h b/Reconstruction/Jet/JetRec/JetRec/JetSoftDrop.h
index 728541d6bfcde3437e9263afcde72dc592a418af..2ed394f9ac1e364ce1438473c02a07d3e7844f30 100644
--- a/Reconstruction/Jet/JetRec/JetRec/JetSoftDrop.h
+++ b/Reconstruction/Jet/JetRec/JetRec/JetSoftDrop.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
 */
 
 // JetSoftDrop.h
@@ -55,7 +55,8 @@ private:  // data
   // z = min(pT1, pT2)/(pT1+pT2)
   // R0 = characteristic jet radius
   float m_zcut;                        // pT fraction for retaining subjets
-  float m_beta;                        // 
+  float m_beta;                        // How much to consider angular dependence
+  float m_R0;	                         // Normalization of angular distance, usually the characteristic jet radius (default R0 = 1)
   ToolHandle<IJetFromPseudojet> m_bld;  // Tool to build jets.
 
 };
diff --git a/Reconstruction/Jet/JetRec/JetRec/selection.xml b/Reconstruction/Jet/JetRec/JetRec/selection.xml
index 4e1ed8885fe59b107285bce99e9c2e6b3f334e05..995fe720c77076f03f0f04675ca921e0c53f3610 100644
--- a/Reconstruction/Jet/JetRec/JetRec/selection.xml
+++ b/Reconstruction/Jet/JetRec/JetRec/selection.xml
@@ -1,5 +1,6 @@
 <lcgdict>
 <class name="FastJetInterfaceTool"/>
+<class name="JetBottomUpSoftDrop"/>
 <class name="JetByVertexFinder"/>
 <class name="JetConstitRemover"/>
 <class name="JetConstituentsRetriever"/>
@@ -13,6 +14,8 @@
 <class name="JetPseudojetRetriever"/>
 <class name="JetReclusterer"/>
 <class name="JetRecTool"/>
+<class name="JetRecursiveSoftDrop"/>
+<class name="JetSoftDrop"/>
 <class name="JetSorter"/>
 <class name="JetSplitter"/>
 <class name="JetToolRunner"/>
diff --git a/Reconstruction/Jet/JetRec/Root/JetBottomUpSoftDrop.cxx b/Reconstruction/Jet/JetRec/Root/JetBottomUpSoftDrop.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..aebea20a9b1a5afdba5133637a3b86c0800171ae
--- /dev/null
+++ b/Reconstruction/Jet/JetRec/Root/JetBottomUpSoftDrop.cxx
@@ -0,0 +1,107 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+// JetBottomUpSoftDrop.cxx
+
+#include "JetRec/JetBottomUpSoftDrop.h"
+#include <iomanip>
+#include "fastjet/PseudoJet.hh"
+#include "fastjet/JetDefinition.hh"
+#include "fastjet/Selector.hh"
+#include "fastjet/tools/Filter.hh"
+#include "JetEDM/PseudoJetVector.h"
+
+
+using std::setw;
+using fastjet::PseudoJet;
+using xAOD::JetContainer;
+
+//**********************************************************************
+
+JetBottomUpSoftDrop::JetBottomUpSoftDrop(std::string name)
+  : AsgTool(name), m_bld("",this) {
+  declareProperty("ZCut", m_zcut =0.1);
+  declareProperty("Beta", m_beta =0.0);
+  declareProperty("R0",   m_R0   =1.0);
+  declareProperty("JetBuilder", m_bld);
+}
+
+//**********************************************************************
+
+JetBottomUpSoftDrop::~JetBottomUpSoftDrop() {
+}
+
+//**********************************************************************
+
+StatusCode JetBottomUpSoftDrop::initialize() {
+  if ( m_zcut < 0.0 || m_zcut > 10.0 ) {
+    ATH_MSG_ERROR("Invalid value for ZCut " << m_zcut);
+    return StatusCode::FAILURE;
+  }
+  if ( m_beta < 0.0 || m_beta > 10.0 ) {
+    ATH_MSG_ERROR("Invalid value for Beta " << m_beta);
+    return StatusCode::FAILURE;
+  }
+  if ( m_R0 < 0.0 || m_R0 > 10.0 ) {
+    ATH_MSG_ERROR("Invalid value for R0 " << m_R0);
+    return StatusCode::FAILURE;
+  }
+  if ( m_bld.empty() ) {
+    ATH_MSG_ERROR("Unable to retrieve jet builder.");
+    return StatusCode::FAILURE;
+  }
+  return StatusCode::SUCCESS;
+}
+
+//**********************************************************************
+
+int JetBottomUpSoftDrop::groom(const xAOD::Jet& jin,
+			       const PseudoJetContainer& pjContainer,
+			       xAOD::JetContainer& jets) const {
+  if ( pseudojetRetriever() == nullptr ) {
+    ATH_MSG_WARNING("Pseudojet retriever is null.");
+    return 1;
+  }
+  const PseudoJet* ppjin = pseudojetRetriever()->pseudojet(jin);
+  if ( ppjin == 0 ) {
+    ATH_MSG_WARNING("Jet does not have a pseudojet.");
+    return 1;
+  }
+
+  ////////////////////////
+  //configure bottom up soft drop tool
+  //https://fastjet.hepforge.org/trac/browser/contrib/contribs/RecursiveTools/tags/2.0.0-beta1
+  ////////////////////////
+  fastjet::contrib::BottomUpSoftDrop softdropper(m_beta, m_zcut, m_R0);
+  PseudoJet pjsoftdrop = softdropper(*ppjin);
+  int npsoftdrop = pjsoftdrop.pieces().size();
+  xAOD::Jet* pjet = m_bld->add(pjsoftdrop, pjContainer, jets, &jin);
+
+  pjet->setAttribute<float>("ZCut", m_zcut);
+  pjet->setAttribute<float>("SoftDropBeta", m_beta);
+  pjet->setAttribute<float>("SoftDropR0", m_R0);
+  pjet->setAttribute<int>("NSoftDropSubjets", npsoftdrop);
+
+  ATH_MSG_DEBUG("Properties after softdrop:");
+  ATH_MSG_DEBUG("   ncon: " << pjsoftdrop.constituents().size() << "/"
+                            << ppjin->constituents().size());
+  ATH_MSG_DEBUG("   nsub: " << npsoftdrop);
+  if ( pjet == 0 ) {
+    ATH_MSG_ERROR("Unable to add jet to container");
+  } else {
+    ATH_MSG_DEBUG("Added jet to container.");
+  }
+  return 0;
+}
+
+//**********************************************************************
+
+void JetBottomUpSoftDrop::print() const {
+  ATH_MSG_INFO("  Asymmetry measure min: " << m_zcut);
+  ATH_MSG_INFO("  Angular exponent: " << m_beta);
+  ATH_MSG_INFO("  Characteristic jet radius: " << m_R0);
+  ATH_MSG_INFO("  Jet builder: " << m_bld.name());
+}
+
+//**********************************************************************
diff --git a/Reconstruction/Jet/JetRec/Root/JetPruner.cxx b/Reconstruction/Jet/JetRec/Root/JetPruner.cxx
index 56d52dc99ccba4a9ecf94600bc2ed846fd507829..2a7f9cb13c43a2588f276dd612a3a8ff1139129d 100644
--- a/Reconstruction/Jet/JetRec/Root/JetPruner.cxx
+++ b/Reconstruction/Jet/JetRec/Root/JetPruner.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
 */
 
 // JetPruner.cxx
@@ -78,8 +78,8 @@ int JetPruner::groom(const xAOD::Jet& jin,
   ATH_MSG_VERBOSE(" Pruned cluster sequence: " << pjprun.associated_cluster_sequence());
   // Add jet to collection.
   xAOD::Jet* pjet = m_bld->add(pjprun, pjContainer, jets, &jin);
-  pjet->setAttribute("RCut", m_rcut);
-  pjet->setAttribute("ZCut", m_zcut);
+  pjet->setAttribute<float>("RCut", m_rcut);
+  pjet->setAttribute<float>("ZCut", m_zcut);
   pjet->setAttribute<int>("TransformType", xAOD::JetTransform::Prune);
   ATH_MSG_DEBUG("Properties after pruning:");
   ATH_MSG_DEBUG("   ncon: " << pjprun.constituents().size() << "/"
diff --git a/Reconstruction/Jet/JetRec/Root/JetRecursiveSoftDrop.cxx b/Reconstruction/Jet/JetRec/Root/JetRecursiveSoftDrop.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..8cdefda0e2807bb64c9325d2a17366c27d42b129
--- /dev/null
+++ b/Reconstruction/Jet/JetRec/Root/JetRecursiveSoftDrop.cxx
@@ -0,0 +1,112 @@
+/*
+  Copyright (C) 2002-2020c CERN for the benefit of the ATLAS collaboration
+*/
+
+// JetRecursiveSoftDrop.cxx
+
+#include "JetRec/JetRecursiveSoftDrop.h"
+#include <iomanip>
+#include "fastjet/PseudoJet.hh"
+#include "fastjet/JetDefinition.hh"
+#include "JetEDM/PseudoJetVector.h"
+
+
+using std::setw;
+using fastjet::PseudoJet;
+using xAOD::JetContainer;
+
+//**********************************************************************
+
+JetRecursiveSoftDrop::JetRecursiveSoftDrop(std::string name)
+  : AsgTool(name), m_bld("",this) {
+  declareProperty("ZCut", m_zcut =0.1);
+  declareProperty("Beta", m_beta =0.0);
+  declareProperty("N",    m_N    =-1); //default to infinite layers
+  declareProperty("R0",   m_R0   =1.0);
+  declareProperty("JetBuilder", m_bld);
+}
+
+//**********************************************************************
+
+JetRecursiveSoftDrop::~JetRecursiveSoftDrop() {
+}
+
+//**********************************************************************
+
+StatusCode JetRecursiveSoftDrop::initialize() {
+  if ( m_zcut < 0.0 || m_zcut > 10.0 ) {
+    ATH_MSG_ERROR("Invalid value for ZCut " << m_zcut);
+    return StatusCode::FAILURE;
+  }
+  if ( m_beta < 0.0 || m_beta > 10.0 ) {
+    ATH_MSG_ERROR("Invalid value for Beta " << m_beta);
+    return StatusCode::FAILURE;
+  }
+  if ( m_N < -1.0) {
+    ATH_MSG_ERROR("Invalid value for N " << m_N);
+    return StatusCode::FAILURE;
+  }
+  if ( m_R0 < 0.0 || m_R0 > 10.0 ) {
+    ATH_MSG_ERROR("Invalid value for R0 " << m_R0);
+    return StatusCode::FAILURE;
+  }
+  if ( m_bld.empty() ) {
+    ATH_MSG_ERROR("Unable to retrieve jet builder.");
+    return StatusCode::FAILURE;
+  }
+  return StatusCode::SUCCESS;
+}
+
+//**********************************************************************
+
+int JetRecursiveSoftDrop::groom(const xAOD::Jet& jin,
+				const PseudoJetContainer& pjContainer,
+				xAOD::JetContainer& jets) const {
+  if ( pseudojetRetriever() == nullptr ) {
+    ATH_MSG_WARNING("Pseudojet retriever is null.");
+    return 1;
+  }
+  const PseudoJet* ppjin = pseudojetRetriever()->pseudojet(jin);
+  if ( ppjin == 0 ) {
+    ATH_MSG_WARNING("Jet does not have a pseudojet.");
+    return 1;
+  }
+
+  ////////////////////////
+  //configure recursive soft drop tool
+  //https://fastjet.hepforge.org/trac/browser/contrib/contribs/RecursiveTools/tags/2.0.0-beta1
+  ////////////////////////
+  fastjet::contrib::RecursiveSoftDrop softdropper(m_beta, m_zcut, m_N, m_R0);
+  PseudoJet pjsoftdrop = softdropper(*ppjin);
+  int npsoftdrop = pjsoftdrop.pieces().size();
+  xAOD::Jet* pjet = m_bld->add(pjsoftdrop, pjContainer, jets, &jin);
+
+  pjet->setAttribute<float>("RSoftDropZCut", m_zcut);
+  pjet->setAttribute<float>("RSoftDropBeta", m_beta);
+  pjet->setAttribute<int>("RSoftDropN", m_N);
+  pjet->setAttribute<float>("SoftDropR0", m_R0);
+  pjet->setAttribute<int>("NSoftDropSubjets", npsoftdrop);
+
+  ATH_MSG_DEBUG("Properties after softdrop:");
+  ATH_MSG_DEBUG("   ncon: " << pjsoftdrop.constituents().size() << "/"
+                            << ppjin->constituents().size());
+  ATH_MSG_DEBUG("   nsub: " << npsoftdrop);
+  if ( pjet == 0 ) {
+    ATH_MSG_ERROR("Unable to add jet to container");
+  } else {
+    ATH_MSG_DEBUG("Added jet to container.");
+  }
+  return 0;
+}
+
+//**********************************************************************
+
+void JetRecursiveSoftDrop::print() const {
+  ATH_MSG_INFO("  Asymmetry measure min: " << m_zcut);
+  ATH_MSG_INFO("  Angular exponent: " << m_beta);
+  ATH_MSG_INFO("  Recursive layers: " << m_N);
+  ATH_MSG_INFO("  Characteristic jet radius: " << m_R0);
+  ATH_MSG_INFO("  Jet builder: " << m_bld.name());
+}
+
+//**********************************************************************
diff --git a/Reconstruction/Jet/JetRec/Root/JetSoftDrop.cxx b/Reconstruction/Jet/JetRec/Root/JetSoftDrop.cxx
index 190b16eeb5d0eca8f643cd1a0db1c47e54511a6b..872770f692af38b3fd54b8660ee6651903216eb0 100644
--- a/Reconstruction/Jet/JetRec/Root/JetSoftDrop.cxx
+++ b/Reconstruction/Jet/JetRec/Root/JetSoftDrop.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
 */
 
 // JetSoftDrop.cxx
@@ -25,6 +25,7 @@ JetSoftDrop::JetSoftDrop(std::string name)
   //https://indico.cern.ch/event/439039/contributions/2223279/attachments/1311773/1963161/BOOST16_toptagging_CMS.pdf
   declareProperty("ZCut", m_zcut =0.1);
   declareProperty("Beta", m_beta =0.0);
+  declareProperty("R0",   m_R0   =1.0);
   declareProperty("JetBuilder", m_bld);
 }
 
@@ -44,6 +45,10 @@ StatusCode JetSoftDrop::initialize() {
     ATH_MSG_ERROR("Invalid value for Beta " << m_beta);
     return StatusCode::FAILURE;
   }
+  if ( m_R0 < 0.0 || m_R0 > 10.0 ) {
+    ATH_MSG_ERROR("Invalid value for R0 " << m_R0);
+    return StatusCode::FAILURE;
+  }
   if ( m_bld.empty() ) {
     ATH_MSG_ERROR("Unable to retrieve jet builder.");
     return StatusCode::FAILURE;
@@ -54,8 +59,8 @@ StatusCode JetSoftDrop::initialize() {
 //**********************************************************************
 
 int JetSoftDrop::groom(const xAOD::Jet& jin,
-                       const PseudoJetContainer& pjContainer,
-                       xAOD::JetContainer& jets) const {
+		       const PseudoJetContainer& pjContainer,
+		       xAOD::JetContainer& jets) const {
   if ( pseudojetRetriever() == nullptr ) {
     ATH_MSG_WARNING("Pseudojet retriever is null.");
     return 1;
@@ -70,13 +75,14 @@ int JetSoftDrop::groom(const xAOD::Jet& jin,
   //configure soft drop tool
   //http://fastjet.hepforge.org/svn/contrib/contribs/RecursiveTools/tags/1.0.0/SoftDrop.hh
   ////////////////////////
-  fastjet::contrib::SoftDrop softdropper(m_beta, m_zcut);
+  fastjet::contrib::SoftDrop softdropper(m_beta, m_zcut, m_R0);
   PseudoJet pjsoftdrop = softdropper(*ppjin);
   int npsoftdrop = pjsoftdrop.pieces().size();
   xAOD::Jet* pjet = m_bld->add(pjsoftdrop, pjContainer, jets, &jin);
   //pjet->SetAttribute<int>("TransformType", xAOD::JetTransform::SoftDrop); //xAOD::JetTransform::SoftDrop probably doesn't exist yet
-  pjet->setAttribute("ZCut", m_zcut);
-  pjet->setAttribute("SoftDropBeta", m_beta);
+  pjet->setAttribute<float>("ZCut", m_zcut);
+  pjet->setAttribute<float>("SoftDropBeta", m_beta);
+  pjet->setAttribute<float>("SoftDropR0", m_R0);
   pjet->setAttribute<int>("NSoftDropSubjets", npsoftdrop);
 
   ATH_MSG_DEBUG("Properties after softdrop:");
@@ -96,6 +102,7 @@ int JetSoftDrop::groom(const xAOD::Jet& jin,
 void JetSoftDrop::print() const {
   ATH_MSG_INFO("  Asymmetry measure min: " << m_zcut);
   ATH_MSG_INFO("  Angular exponent: " << m_beta);
+  ATH_MSG_INFO("  Characteristic jet radius: " << m_R0);
   ATH_MSG_INFO("  Jet builder: " << m_bld.name());
 }
 
diff --git a/Reconstruction/Jet/JetRec/Root/JetSplitter.cxx b/Reconstruction/Jet/JetRec/Root/JetSplitter.cxx
index ef90b5d512cd6e64a34b4d5ab3531cfe6e95f75a..8a0286206a2678159610241245c4c87e4752ba86 100644
--- a/Reconstruction/Jet/JetRec/Root/JetSplitter.cxx
+++ b/Reconstruction/Jet/JetRec/Root/JetSplitter.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
 */
 
 // JetSplitter.cxx
@@ -144,16 +144,16 @@ int JetSplitter::groom(const xAOD::Jet& jin,
   } else {
     ATH_MSG_DEBUG("Added jet to container.");
     pjet->setAttribute<int>("TransformType", xAOD::JetTransform::MassDrop);
-    pjet->setAttribute("MuMax", m_mumax);
-    pjet->setAttribute("YMin", m_ymin);
-    pjet->setAttribute("RClus", m_rclus);
+    pjet->setAttribute<float>("MuMax", m_mumax);
+    pjet->setAttribute<float>("YMin", m_ymin);
+    pjet->setAttribute<float>("RClus", m_rclus);
     //this has to be a char, because by default bools are converted to chars in perstification. Thus if we run this tool on an exiting collection in a POOL file the type is char.                                                                                               
     pjet->setAttribute<char>("BDRS", m_bdrs);
-    pjet->setAttribute("NSubjetMax", m_nsubjetmax); 
-    pjet->setAttribute("DRFilt", drfilt);
-    pjet->setAttribute("MuFilt", mufilt);
-    pjet->setAttribute("YFilt",  yfilt);
-    pjet->setAttribute("NSubjet", npclus);
+    pjet->setAttribute<int>("NSubjetMax", m_nsubjetmax); 
+    pjet->setAttribute<float>("DRFilt", drfilt);
+    pjet->setAttribute<float>("MuFilt", mufilt);
+    pjet->setAttribute<float>("YFilt",  yfilt);
+    pjet->setAttribute<int>("NSubjet", npclus);
   }
   return 0;
 }
diff --git a/Reconstruction/Jet/JetRec/python/JetToolSupport.py b/Reconstruction/Jet/JetRec/python/JetToolSupport.py
index b9edbfc33c026f0b2b759a3bd1b3436f49c6a161..a3f8defa6bdd4bbbb1c73353b66a6929219dc35e 100644
--- a/Reconstruction/Jet/JetRec/python/JetToolSupport.py
+++ b/Reconstruction/Jet/JetRec/python/JetToolSupport.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
 
 # JetToolSupport.py
 #
@@ -168,12 +168,13 @@ class JetToolManager:
 
   # Build the list of modifiers, replacing the string "calib:XXX:CALIB" with
   # the appropriate calibration tool.
-  def buildModifiers(self, modifiersin, finder, getters, altname, output, calibOpt):
+  def buildModifiers(self, modifiersin, finder, getters, altname, output, calibOpt, constmods=[]):
     from GaudiKernel.Proxy.Configurable import ConfigurableAlgTool
     from JetRec.JetRecConf import JetFinder
     outmods = []
     inmods = self.getModifiers(modifiersin, altname)
     ncalib = 0
+    constmodstr = "".join(constmods)
     for mod in inmods:
       jetlog.info( self.prefix + "Adding modifier " + str(mod) )
       mod0 = ""
@@ -234,7 +235,7 @@ class JetToolManager:
         sinp = getters[0].Label.split("Origin")[0]
         salg = finder.JetAlgorithm
         srad = str(int(10*finder.JetRadius))
-        cname = output.replace(sinp, "Truth")
+        cname = output.replace(sinp, "Truth").replace(constmodstr, "")
         if cname == output:
             jetlog.info( sinp, cname, output )
             raise TypeError
@@ -252,7 +253,7 @@ class JetToolManager:
         sinp = getters[0].Label.split("Origin")[0]
         salg = finder.JetAlgorithm
         srad = str(int(10*finder.JetRadius))
-        cname = output.replace(sinp, "PV0Track")
+        cname = output.replace(sinp, "PV0Track").replace(constmodstr, "")
         if cname == output:
             jetlog.info( sinp, cname, output )
             raise TypeError
@@ -324,7 +325,7 @@ class JetToolManager:
   #         is the highest.
   def addJetFinderTool(self, toolname, alg, radius, ivtx =None,
                        ghostArea =0.0, ptmin =0.0, rndseed =1,
-                       variableRMinRadius =-1.0, variableRMassScale =-1.0):
+                       variableRMinRadius =-1.0, variableRMassScale =-1.0, constmods=[]):
     myname = "JetToolManager:addJetFinderTool: "
     if toolname in self.tools:
       m = "Tool " + myname + " is already registered"
@@ -396,7 +397,7 @@ class JetToolManager:
                    ghostArea =0.0, ptmin =0.0, ptminFilter =0.0, rndseed =1,
                    isTrigger =False, useTriggerStore =False,
                    variableRMinRadius =-1.0, variableRMassScale =-1.0,
-                   calibOpt ="", jetPseudojetCopier =""):
+                   calibOpt ="", jetPseudojetCopier ="", constmods=[]):
     self.msg(2, "Adding finder")
     from JetRec.JetRecConf import JetRecTool
     if type(gettersin) == str:
@@ -414,14 +415,14 @@ class JetToolManager:
       elif gettersin == "pv0track": ivtx = 0     # Find tracks only for 1st vertex
     # Retrieve/build the jet finder.
     lofinder,hifinder = self.addJetFinderTool(output+"Finder", alg, radius, ivtx, ghostArea, ptmin, rndseed, 
-                                            variableRMinRadius, variableRMassScale)
+                                              variableRMinRadius, variableRMassScale, constmods=constmods)
     jetrec = JetRecTool(output)
     jetrec.InputPseudoJets = [getter.OutputContainer for getter in getters]
     jetrec.JetFinder = hifinder
     jetrec.OutputContainer = output
     ptminSave = self.ptminFilter
     if ptminFilter > 0.0: self.ptminFilter = ptminFilter
-    jetrec.JetModifiers = self.buildModifiers(modifiersin, lofinder, getters, gettersin, output, calibOpt)
+    jetrec.JetModifiers = self.buildModifiers(modifiersin, lofinder, getters, gettersin, output, calibOpt, constmods=constmods)
     self.autoconfigureModifiers(jetrec.JetModifiers, output)
     if consumers != None:
       jetrec.JetConsumers = consumers
@@ -564,6 +565,117 @@ class JetToolManager:
     self.jetcons += [output]
     return jetrec
 
+  # Create a SoftDrop and rectool.
+  #   output = name for output container (and JetRecTool)
+  #   beta = Beta used in SoftDrop
+  #   zcut = ZCut used in SoftDrop
+  #   r0   = R0   used in RecursiveSoftDrop
+  #   input = name of the input jet container
+  #   modifiersin = list of modifier tools (or name of such in modifiersMap)
+  def addJetSoftDrop(self, output, beta, zcut, r0, input, modifiersin ="groomed",
+                     isTrigger =False, useTriggerStore =False, doArea =True):
+    from JetRec.JetRecConf import JetSoftDrop
+    from JetRec.JetRecConf import JetRecTool
+    groomer = JetSoftDrop(output + "Groomer")
+    groomer.ZCut = zcut
+    groomer.Beta = beta
+    groomer.R0   = r0
+    if doArea:
+      groomer.JetBuilder = self.jetBuilderWithArea
+    else:
+      groomer.JetBuilder = self.jetBuilderWithoutArea
+    self += groomer
+    jetrec = JetRecTool(output)
+    jetrec.JetGroomer = groomer
+    jetrec.InputContainer = input
+    jetrec.OutputContainer = output
+    jetrec.JetModifiers = self.getModifiers(modifiersin)
+    self.autoconfigureModifiers(jetrec.JetModifiers, output)
+    jetrec.Trigger = isTrigger or useTriggerStore
+    jetrec.Timer = jetFlags.timeJetRecTool()
+    self += jetrec
+    if isTrigger:
+      self.trigjetrecs += [jetrec]
+    else:
+      self.jetrecs += [jetrec]
+    self.jetcons += [output]
+    return jetrec
+
+  # Create a BottomUpSoftDrop and rectool.
+  #   output = name for output container (and JetRecTool)
+  #   beta = Beta used in BottomUpSoftDrop
+  #   zcut = ZCut used in BottomUpSoftDrop
+  #   r0   = R0   used in BottomUpSoftDrop
+  #   input = name of the input jet container
+  #   modifiersin = list of modifier tools (or name of such in modifiersMap)
+  def addJetBottomUpSoftDrop(self, output, beta, zcut, r0, input, modifiersin ="groomed",
+                     isTrigger =False, useTriggerStore =False, doArea =True):
+    from JetRec.JetRecConf import JetBottomUpSoftDrop
+    from JetRec.JetRecConf import JetRecTool
+
+    groomer = JetBottomUpSoftDrop(output + "Groomer")
+    groomer.ZCut = zcut
+    groomer.Beta = beta
+    groomer.R0   = r0
+    if doArea:
+      groomer.JetBuilder = self.jetBuilderWithArea
+    else:
+      groomer.JetBuilder = self.jetBuilderWithoutArea
+    self += groomer
+    jetrec = JetRecTool(output)
+    jetrec.JetGroomer = groomer
+    jetrec.InputContainer = input
+    jetrec.OutputContainer = output
+    jetrec.JetModifiers = self.getModifiers(modifiersin)
+    self.autoconfigureModifiers(jetrec.JetModifiers, output)
+    jetrec.Trigger = isTrigger or useTriggerStore
+    jetrec.Timer = jetFlags.timeJetRecTool()
+    self += jetrec
+    if isTrigger:
+      self.trigjetrecs += [jetrec]
+    else:
+      self.jetrecs += [jetrec]
+    self.jetcons += [output]
+    return jetrec
+
+  # Create a RecursiveSoftDrop and rectool.
+  #   output = name for output container (and JetRecTool)
+  #   beta = Beta used in RecursiveSoftDrop
+  #   zcut = ZCut used in RecursiveSoftDrop
+  #   r0   = R0   used in RecursiveSoftDrop
+  #   input = name of the input jet container
+  #   modifiersin = list of modifier tools (or name of such in modifiersMap)
+  def addJetRecursiveSoftDrop(self, output, beta, zcut, N, r0, input, modifiersin ="groomed",
+                     isTrigger =False, useTriggerStore =False, doArea =True):
+    from JetRec.JetRecConf import JetRecursiveSoftDrop
+    from JetRec.JetRecConf import JetRecTool
+
+    groomer = JetRecursiveSoftDrop(output + "Groomer")
+    groomer.ZCut = zcut
+    groomer.Beta = beta
+    groomer.N    = N
+    groomer.R0   = r0
+    if doArea:
+      groomer.JetBuilder = self.jetBuilderWithArea
+    else:
+      groomer.JetBuilder = self.jetBuilderWithoutArea
+    self += groomer
+    jetrec = JetRecTool(output)
+    jetrec.JetGroomer = groomer
+    jetrec.InputContainer = input
+    jetrec.OutputContainer = output
+    jetrec.JetModifiers = self.getModifiers(modifiersin)
+    self.autoconfigureModifiers(jetrec.JetModifiers, output)
+    jetrec.Trigger = isTrigger or useTriggerStore
+    jetrec.Timer = jetFlags.timeJetRecTool()
+    self += jetrec
+    if isTrigger:
+      self.trigjetrecs += [jetrec]
+    else:
+      self.jetrecs += [jetrec]
+    self.jetcons += [output]
+    return jetrec
+
   # Create a jet reclusterer and rectool.
   #   output = name for output container (and JetRecTool)
   #   alg = akgorithm name (Kt, CamKt, AntiKt)
@@ -593,13 +705,13 @@ class JetToolManager:
                         ghostArea =0.0, ptmin =0.0, ptminFilter =0.0, rndseed =1,
                         isTrigger =False, useTriggerStore =False,
                         variableRMinRadius =-1.0, variableRMassScale =-1.0,
-                        calibOpt ="", jetPseudojetCopier =""):
+                        calibOpt ="", jetPseudojetCopier ="", constmods=[]):
     self.msg(2, "Adding reclusterer")
     from JetRec.JetRecConf import JetRecTool
     from JetRec.JetRecConf import JetReclusterer
     # Retrieve/build the jet finder.
     lofinder,hifinder = self.addJetFinderTool(output+"Finder", alg, radius, ivtx, ghostArea, ptmin, rndseed, 
-                                              variableRMinRadius, variableRMassScale)
+                                              variableRMinRadius, variableRMassScale, constmods=constmods)
     reclname = output + "Reclusterer"
     groomer = JetReclusterer(
       reclname,
@@ -630,7 +742,7 @@ class JetToolManager:
   #   output = name for input container
   #   modifiersin = list of modifier tools (or name of such in modifiersMap)
   def addJetCopier(self, output, input, modifiersin, ptminFilter =0.0, radius =0.0, alg ="", inp ="",
-                   isTrigger=False, useTriggerStore=False, calibOpt ="", shallow =True):
+                   isTrigger=False, useTriggerStore=False, calibOpt ="", shallow =True, constmods=[]):
     from JetRec.JetRecConf import JetRecTool
     jetrec = JetRecTool(output)
     jetrec.InputContainer = input
@@ -643,7 +755,7 @@ class JetToolManager:
     class get:
       Label = inp
     getters = [get]
-    jetrec.JetModifiers = self.buildModifiers(modifiersin, finder, getters, None, output, calibOpt)
+    jetrec.JetModifiers = self.buildModifiers(modifiersin, finder, getters, None, output, calibOpt, constmods=constmods)
     self.autoconfigureModifiers(jetrec.JetModifiers, output)
     self.ptminFilter = ptminSave
     jetrec.Trigger = isTrigger or useTriggerStore
diff --git a/Reconstruction/Jet/JetRec/src/components/JetRec_entries.cxx b/Reconstruction/Jet/JetRec/src/components/JetRec_entries.cxx
index bc1988eef2711cb477c5cedbee0cf4f921bb7184..ace4fc6f397d107f577d71c9fad87e3b8ee104e6 100644
--- a/Reconstruction/Jet/JetRec/src/components/JetRec_entries.cxx
+++ b/Reconstruction/Jet/JetRec/src/components/JetRec_entries.cxx
@@ -16,6 +16,9 @@
 #include "JetRec/JetSplitter.h"
 #include "JetRec/JetTrimmer.h"
 #include "JetRec/JetPruner.h"
+#include "JetRec/JetSoftDrop.h"
+#include "JetRec/JetBottomUpSoftDrop.h"
+#include "JetRec/JetRecursiveSoftDrop.h"
 #include "JetRec/JetReclusterer.h"
 #include "JetRec/FastJetInterfaceTool.h"
 
@@ -39,6 +42,9 @@ DECLARE_COMPONENT( JetFilterTool )
 DECLARE_COMPONENT( JetSplitter )
 DECLARE_COMPONENT( JetTrimmer )
 DECLARE_COMPONENT( JetPruner )
+DECLARE_COMPONENT( JetSoftDrop )
+DECLARE_COMPONENT( JetBottomUpSoftDrop )
+DECLARE_COMPONENT( JetRecursiveSoftDrop )
 DECLARE_COMPONENT( JetReclusterer )
 DECLARE_COMPONENT( FastJetInterfaceTool )
 DECLARE_COMPONENT( JetPseudojetRetriever )
diff --git a/Reconstruction/MET/METRecoInterface/CMakeLists.txt b/Reconstruction/MET/METRecoInterface/CMakeLists.txt
index 27f8f9d90c22699311c4028b3cbaefe7af2cf9d3..5ab65fde10df45d829726e33a6609e3884da3cce 100644
--- a/Reconstruction/MET/METRecoInterface/CMakeLists.txt
+++ b/Reconstruction/MET/METRecoInterface/CMakeLists.txt
@@ -12,8 +12,12 @@ atlas_depends_on_subdirs( PUBLIC
                           Control/AthToolSupport/AsgTools
                           Event/xAOD/xAODMissingET )
 
-# Install files from the package:
-atlas_install_headers( METRecoInterface )
+atlas_add_library( METRecoInterface
+                   METRecoInterface/*.h
+                   INTERFACE
+                   PUBLIC_HEADERS METRecoInterface
+                   LINK_LIBRARIES AsgTools xAODMissingET )
+
 
 atlas_add_dictionary( METRecoInterfaceDict
        		      METRecoInterface/METRecoInterfaceDict.h
diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CMakeLists.txt b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CMakeLists.txt
index 3194b703cdcbeb73800645773c02c53a6e365dbb..6ed5abefd201a5b0487f457341dafa5ea1717981 100644
--- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CMakeLists.txt
+++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CMakeLists.txt
@@ -40,7 +40,7 @@ atlas_add_component( CaloTrkMuIdTools
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} CaloEvent AthenaBaseComps StoreGateLib SGtests xAODTracking GaudiKernel ICaloTrkMuIdTools RecoToolInterfaces TrkExInterfaces CaloDetDescrLib CaloGeoHelpers CaloIdentifier CaloUtilsLib xAODCaloEvent ParticleCaloExtension TileDetDescr PathResolver TrkSurfaces TrkCaloExtension TrkEventPrimitives )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} CaloEvent AthenaBaseComps StoreGateLib SGtests xAODTracking GaudiKernel ICaloTrkMuIdTools RecoToolInterfaces TrkExInterfaces CaloDetDescrLib CaloGeoHelpers CaloIdentifier CaloUtilsLib xAODCaloEvent ParticleCaloExtension TileDetDescr PathResolver TrkSurfaces TrkCaloExtension TrkEventPrimitives CaloTrackingGeometryLib )
 
 # Install files from the package:
 atlas_install_headers( CaloTrkMuIdTools )
diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonTag.cxx b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonTag.cxx
index 9aae53074e215d94dbf68d5a76dafa764e61e4ad..21e9bf86487d122ba2d26ca3bf7b50043dfa9378 100755
--- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonTag.cxx
+++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonTag.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 "CaloTrkMuIdTools/CaloMuonTag.h"
@@ -25,7 +25,10 @@ m_numRejected(0)
 ///////////////////////////////////////////////////////////////////////////////
 // Destructor
 ///////////////////////////////////////////////////////////////////////////////
-CaloMuonTag::~CaloMuonTag(){}
+CaloMuonTag::~CaloMuonTag()
+{
+  delete m_hist; m_hist = nullptr; // TFile::Get new's so this needs to be deleted
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 // initialize
@@ -41,6 +44,7 @@ StatusCode CaloMuonTag::initialize()
 	std::string rootFilePath = PathResolver::find_file("CaloTag.CutConfig.root","DATAPATH");
 	TFile* rootFile = TFile::Open(rootFilePath.c_str(), "READ");
 	ATH_CHECK(getHist(rootFile, m_tagMode.c_str(), m_hist));
+  rootFile->Close(); delete rootFile; rootFile = nullptr; // don't need the file anymore
 	// Read cut names from histogram
 	m_numCuts = m_hist->GetYaxis()->GetNbins();
 	if (m_numCuts == 0) {
diff --git a/Reconstruction/MuonIdentification/MuonCombinedValidation/MuonCombValidationInterfaces/CMakeLists.txt b/Reconstruction/MuonIdentification/MuonCombinedValidation/MuonCombValidationInterfaces/CMakeLists.txt
deleted file mode 100644
index fe834fe6f223fd16e9822790ad5579427585b685..0000000000000000000000000000000000000000
--- a/Reconstruction/MuonIdentification/MuonCombinedValidation/MuonCombValidationInterfaces/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-################################################################################
-# Package: MuonCombValidationInterfaces
-################################################################################
-
-# Declare the package name:
-atlas_subdir( MuonCombValidationInterfaces )
-
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces
-                          Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerToolInterfaces
-                          Tracking/TrkEvent/TrkParameters )
-
-# Install files from the package:
-atlas_install_headers( MuonCombValidationInterfaces )
-
diff --git a/Reconstruction/MuonIdentification/MuonCombinedValidation/MuonCombValidationInterfaces/MuonCombValidationInterfaces/IMuonSegmentTaggerValidationTool.h b/Reconstruction/MuonIdentification/MuonCombinedValidation/MuonCombValidationInterfaces/MuonCombValidationInterfaces/IMuonSegmentTaggerValidationTool.h
deleted file mode 100644
index bfc25a3074a4c0611f6377d22e1dcacd11060c31..0000000000000000000000000000000000000000
--- a/Reconstruction/MuonIdentification/MuonCombinedValidation/MuonCombValidationInterfaces/MuonCombValidationInterfaces/IMuonSegmentTaggerValidationTool.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef REC_IMUONSEGMENTTAGGERVALIDATIONTOOL_H
-#define REC_IMUONSEGMENTTAGGERVALIDATIONTOOL_H
-
-#include "GaudiKernel/IAlgTool.h"
-#include "TrkParameters/TrackParameters.h"
-#include "MuonSegmentMakerToolInterfaces/IMuonSegmentHitSummaryTool.h"
-#include "MuonSegmentTaggerToolInterfaces/IMuTagMatchingTool.h"
-
-
-static const InterfaceID IID_IMuonSegmentTaggerValidationTool("Muon::IMuonSegmentTaggerValidationTool",1,0);
-
-namespace Analysis {
-  class Muon;
-}
-
-namespace Rec {
-  class TrackParticle;
-}
-
-namespace Muon {
-  class MuonSegment;
-}
-
-namespace Trk {
-  class Track;
-}
-
-namespace Rec {
-
-  /** Interface for tools calculating hit count summaries for track */
-  class IMuonSegmentTaggerValidationTool : virtual public IAlgTool {      
-  public:
-
-    struct Summary {
-      /** constructor, takes ownership of track parameters pointer */
-      Summary() : trackAtSegement(0),segmentInfo(),t0(-1e9) {}
-      
-      /** destructor */
-      ~Summary() {
-	clear();
-      }
-      
-      /** copy constructor */
-      Summary( const Summary& sum ) {
-	copy(sum);
-      }
-      
-      /** assignment operator */
-      Summary& operator=(const Summary& sum){
-	if( this!=&sum ){
-	  clear();
-	  copy(sum);
-	}
-	return *this;
-      }
-
-      /** track extrapolated to the segment */
-      const Trk::TrackParameters* trackAtSegement;
-      
-      /** MuTagSegmentInfo */
-      IMuTagMatchingTool::MuTagSegmentInfo segmentInfo;
-
-      /** fitted t0 */
-      double t0;
-
-      private:
-      void clear() { if( trackAtSegement ) {
-	  delete trackAtSegement; 
-	  trackAtSegement = 0;
-	}
-      }
-      void copy( const Summary& sum ){
-	trackAtSegement = sum.trackAtSegement ? sum.trackAtSegement->clone() : 0;
-	segmentInfo = sum.segmentInfo;
-	t0 = sum.t0;
-      }
-    };
-
-  public:
-    /** IAlgTool interface */
-    static const InterfaceID& interfaceID();
-
-    /**  returns whether the Muon satisfies the new MuTagIMO cuts */
-    virtual bool goodMuTagIMOMuon( const Analysis::Muon& muon ) const = 0;
-
-    /** create summary for a Muon, default uses the ID track to calculate the summaries, if useIDTrack == false will use combined track if present */
-    virtual std::vector<IMuonSegmentTaggerValidationTool::Summary> create( const Analysis::Muon& muon, bool useIDTrack = true ) const = 0;
-
-    /** create summary for a list of segments and a track */
-    virtual std::vector<Summary> create( const Trk::Track& track, const std::vector<const Muon::MuonSegment*>& segments ) const = 0;
-
-    /** create summary for a give segment */
-    virtual Summary create( const Muon::MuonSegment& segment, const Trk::TrackParameters& pars ) const = 0;
-
-
-  };
-  
-  inline const InterfaceID& IMuonSegmentTaggerValidationTool::interfaceID()
-  {
-    return IID_IMuonSegmentTaggerValidationTool;
-  }
-
-
-} // end of name space
-
-#endif // IMuonSegmentTaggerValidationTool_H
-
diff --git a/Reconstruction/RecJobTransforms/python/MixStreamConfig.py b/Reconstruction/RecJobTransforms/python/MixStreamConfig.py
index b871caa6e48d4a9774e2f45bf2a25be6ea4e6390..ba6a0facc90e37b26bfac95cc03dee10725d40a0 100644
--- a/Reconstruction/RecJobTransforms/python/MixStreamConfig.py
+++ b/Reconstruction/RecJobTransforms/python/MixStreamConfig.py
@@ -5,7 +5,7 @@ from future.utils import iteritems
 
 from builtins import int
 
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #######################################################################################################
 # Defines
@@ -206,7 +206,7 @@ class MixingPartitioner(object):
 	def preStageInputFiles(self,CastorOrDCache = 'Castor'):
 		from PyJobTransformsCore.FilePreStager import theFileStagerRobot		
 		if CastorOrDCache == 'Castor':
-			from PyJobTransformsCore import CastorPreStager
+                        print("WARNING: Castor is not supported anymore")
 		else:
 			from StreamMix import DCachePreStager
 		fileList = self.ListOfFilesToStage()
diff --git a/Reconstruction/RecoTools/CaloRingerTools/CMakeLists.txt b/Reconstruction/RecoTools/CaloRingerTools/CMakeLists.txt
index c96fcd64df8ff668e9bfe6213d1b91e132b6f455..893fcf0eedc02a7dfbe8c77971d6ad28be6b848e 100644
--- a/Reconstruction/RecoTools/CaloRingerTools/CMakeLists.txt
+++ b/Reconstruction/RecoTools/CaloRingerTools/CMakeLists.txt
@@ -23,13 +23,18 @@ atlas_depends_on_subdirs( PUBLIC
                           PhysicsAnalysis/AnalysisCommon/PATCore
                           PhysicsAnalysis/RingerSelectorTools )
 
+atlas_add_library( CaloRingerToolsLib
+                   CaloRingerTools/*.h
+                   INTERFACE
+                   PUBLIC_HEADERS CaloRingerTools
+                   LINK_LIBRARIES GaudiKernel AthLinks StoreGateLib xAODBase xAODCaloRings xAODCaloEvent )
+
 # Component(s) in the package:
 atlas_add_component( CaloRingerTools
                      src/*.cxx
                      src/components/*.cxx
-                     LINK_LIBRARIES AthLinks xAODBase xAODCaloEvent xAODCaloRings GaudiKernel CaloEvent CaloGeoHelpers CaloUtilsLib AthenaBaseComps AthenaKernel CxxUtils xAODEgamma PATCoreLib RingerSelectorToolsLib )
+                     LINK_LIBRARIES CaloRingerToolsLib xAODCaloRings CaloEvent CaloGeoHelpers CaloUtilsLib AthenaBaseComps AthenaKernel CxxUtils xAODEgamma PATCoreLib RingerSelectorToolsLib )
 
 # Install files from the package:
-atlas_install_headers( CaloRingerTools )
 atlas_install_python_modules( python/*.py )
 
diff --git a/Reconstruction/eflowRec/eflowRec/EtaPhiLUT.h b/Reconstruction/eflowRec/eflowRec/EtaPhiLUT.h
new file mode 100644
index 0000000000000000000000000000000000000000..13d2ffd26832a88b317c8ef07db0addbece460fd
--- /dev/null
+++ b/Reconstruction/eflowRec/eflowRec/EtaPhiLUT.h
@@ -0,0 +1,45 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+// EtaPhi Look-up table for eflowRecClusters
+//     author: Teng Jian Khoo
+//     date:   Jun 2020
+//
+// Inspired by IParticlesLookUpTable from ParticlesInConeTools
+// By binning in phi and sorting in eta, extraction of objects in
+// a small eta/phi region can be accelerated.
+// Useful to reduce the number of distance computations needed
+// for e.g. track-cluster matching
+
+#ifndef EFLOWREC_ETAPHILOOKUPTABLE_H
+#define EFLOWREC_ETAPHILOOKUPTABLE_H
+
+#include <vector>
+
+#include "xAODCaloEvent/CaloCluster.h"
+#include "eflowRec/eflowRecCluster.h"
+
+namespace eflowRec {
+
+  /** 2D look up table for eflowRecClusters */
+  class EtaPhiLUT {
+  public:
+    /** constructor taking the desired binsize */
+  EtaPhiLUT( unsigned int nbins = 50 );
+
+  void fill(eflowRecClusterContainer& clustersin);
+
+  /** collect eflowRecClusters in a given cone */
+  std::vector<eflowRecCluster*> clustersInCone( float eta, float phi, float dr ) const;
+
+  private:
+
+    unsigned int m_nphiBins;    /// number of bins
+    float m_phiBinSize;  /// bin size
+    std::vector< std::vector<eflowRecCluster*> > m_phiBinnedLookUpTable; /// the look-up table
+  };
+
+}	// end of namespace
+
+#endif
diff --git a/Reconstruction/eflowRec/eflowRec/PFCellLevelSubtractionTool.h b/Reconstruction/eflowRec/eflowRec/PFCellLevelSubtractionTool.h
index 622bb23af016a153f02cb089ad34d393424c601c..dbbe152db7693fd25eabfab3d664b5389654aea1 100644
--- a/Reconstruction/eflowRec/eflowRec/PFCellLevelSubtractionTool.h
+++ b/Reconstruction/eflowRec/eflowRec/PFCellLevelSubtractionTool.h
@@ -9,11 +9,14 @@
 #include "eflowRec/IPFSubtractionTool.h"
 #include "GaudiKernel/ToolHandle.h"
 
+#include "xAODCaloEvent/CaloCluster.h"
+#include "xAODTracking/TrackParticle.h"
+
 #include "eflowRec/eflowCaloObject.h"
 #include "eflowRec/eflowCellList.h"
 #include "eflowRec/eflowEEtaBinnedParameters.h"
-#include "xAODCaloEvent/CaloCluster.h"
-#include "xAODTracking/TrackParticle.h"
+#include "eflowRec/PFMatchPositions.h"
+#include "eflowRec/EtaPhiLUT.h"
 
 #include <vector>
 
@@ -24,6 +27,14 @@ class IEFlowCellEOverPTool;
 class PFTrackClusterMatchingTool;
 class eflowRecTrack;
 
+namespace PFMatch {
+  class TrackEtaPhiInFixedLayersProvider;
+}
+
+namespace eflowRec {
+  class EtaPhiLUT;
+}
+
 class PFCellLevelSubtractionTool : public extends<AthAlgTool, IPFSubtractionTool> {
 public:
 
@@ -41,6 +52,7 @@ public:
     eflowCaloObjectContainer* caloObjects;
     eflowRecTrackContainer* tracks;
     eflowRecClusterContainer* clusters;
+    eflowRec::EtaPhiLUT clusterLUT;
   };
 
   void calculateRadialEnergyProfiles(eflowData& data) const;
@@ -53,6 +65,9 @@ public:
   std::string printCluster(const xAOD::CaloCluster* cluster) const;
   void printAllClusters(const eflowRecClusterContainer& recClusterContainer) const;
 
+  // Need a track position provider to preselect clusters
+  std::unique_ptr<PFMatch::TrackEtaPhiInFixedLayersProvider> m_trkpos;
+
   /** Default track-cluster matching tool */
   ToolHandle<PFTrackClusterMatchingTool> m_matchingTool{this,"PFTrackClusterMatchingTool","PFTrackClusterMatchingTool/CalObjBldMatchingTool","The track-cluster matching tool"};
   /* Track-cluster matching tools for calculating the pull */
diff --git a/Reconstruction/eflowRec/eflowRec/PFOChargedCreatorAlgorithm.h b/Reconstruction/eflowRec/eflowRec/PFOChargedCreatorAlgorithm.h
index a97a52392c333f41b65407dfd0c1b598da8c5286..a1b989446149ac9a04c0c55e90ebdba60aceeab1 100644
--- a/Reconstruction/eflowRec/eflowRec/PFOChargedCreatorAlgorithm.h
+++ b/Reconstruction/eflowRec/eflowRec/PFOChargedCreatorAlgorithm.h
@@ -1,18 +1,18 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 #ifndef PFOCHARGEDCREATORALGORITHM_H
 #define PFOCHARGEDCREATORALGORITHM_H
 
 #include "eflowRec/eflowCaloObject.h"
 
-#include "AthenaBaseComps/AthAlgorithm.h"
+#include "AthenaBaseComps/AthReentrantAlgorithm.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "StoreGate/DataHandle.h"
 
 #include "xAODPFlow/PFOContainer.h"
 
-class PFOChargedCreatorAlgorithm : public AthAlgorithm {
+class PFOChargedCreatorAlgorithm : public AthReentrantAlgorithm {
   
 public:
   
@@ -21,14 +21,12 @@ public:
   ~PFOChargedCreatorAlgorithm() {}
 
   StatusCode initialize();
-  StatusCode execute();
+  StatusCode execute(const EventContext&) const;
   StatusCode finalize();
 
 private:
   /** Create the charged PFO */ 
-  void createChargedPFO(const eflowCaloObject& energyFlowCaloObject, bool addClusters, SG::WriteHandle<xAOD::PFOContainer>& chargedPFOContainerWriteHandle);
-  /** Function to add links to the vertex to which a charged PFO is matched (using the tracking CP loose vertex association tool) */
-  void addVertexLinksToChargedPFO(const xAOD::VertexContainer* theVertexContainer, SG::WriteHandle<xAOD::PFOContainer>& chargedPFOContainerWriteHandle);
+  void createChargedPFO(const eflowCaloObject& energyFlowCaloObject, bool addClusters, SG::WriteHandle<xAOD::PFOContainer>& chargedPFOContainerWriteHandle) const;
 
   /** Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed */
   Gaudi::Property<bool> m_eOverPMode{this,"EOverPMode",false,"Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed"};
diff --git a/Reconstruction/eflowRec/eflowRec/PFONeutralCreatorAlgorithm.h b/Reconstruction/eflowRec/eflowRec/PFONeutralCreatorAlgorithm.h
index eb930ce28e471bcbfc6938236264dd3ad183b87f..40b7b7c2d558d51536dc21b0d1db187a8927de79 100644
--- a/Reconstruction/eflowRec/eflowRec/PFONeutralCreatorAlgorithm.h
+++ b/Reconstruction/eflowRec/eflowRec/PFONeutralCreatorAlgorithm.h
@@ -1,12 +1,12 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 #ifndef PFONEUTRALCREATORALGORITHM_H
 #define PFONEUTRALCREATORALGORITHM_H
 
 #include "eflowRec/eflowCaloObject.h"
 
-#include "AthenaBaseComps/AthAlgorithm.h"
+#include "AthenaBaseComps/AthReentrantAlgorithm.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "StoreGate/DataHandle.h"
 
@@ -14,7 +14,7 @@
 #include "xAODPFlow/PFO.h"
 #include "xAODPFlow/PFOContainer.h"
 
-class PFONeutralCreatorAlgorithm :  public AthAlgorithm {
+class PFONeutralCreatorAlgorithm :  public AthReentrantAlgorithm {
   
 public:
   
@@ -25,16 +25,16 @@ public:
   static const InterfaceID& interfaceID();
 
   StatusCode initialize();
-  StatusCode execute();
+  StatusCode execute(const EventContext& ctx) const;
   StatusCode finalize();
 
 private:
 
   /** Create the chargedneutral PFO */ 
-  void createNeutralPFO(const eflowCaloObject& energyFlowCaloObject,SG::WriteHandle<xAOD::PFOContainer>& neutralPFOContainerWriteHandle, SG::WriteHandle<xAOD::PFOContainer>* neutralPFOContainerWriteHandle_nonModified);
+  StatusCode createNeutralPFO(const eflowCaloObject& energyFlowCaloObject, xAOD::PFOContainer* neutralPFOContainer, xAOD::PFOContainer* neutralPFOContainer_nonModified) const;
 
   /** Function to add cluster moments onto PFO */
-  void addMoment(const xAOD::CaloCluster::MomentType& momentType, const xAOD::PFODetails::PFOAttributes& pfoAttribute, const xAOD::CaloCluster& theCluster, xAOD::PFO& thePFO);
+  void addMoment(const xAOD::CaloCluster::MomentType& momentType, const xAOD::PFODetails::PFOAttributes& pfoAttribute, const xAOD::CaloCluster& theCluster, xAOD::PFO& thePFO) const;
  
   /** Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed */
   Gaudi::Property<bool> m_eOverPMode{this,"EOverPMode",false,"Toggle EOverP algorithm mode, whereby no charged shower subtraction is performed"};
diff --git a/Reconstruction/eflowRec/eflowRec/PFRecoverSplitShowersTool.h b/Reconstruction/eflowRec/eflowRec/PFRecoverSplitShowersTool.h
index 86fdf16746b1bea1fc9fe691bf4b5e741b7af62a..b7e6cbabb59fa81ab32fa9fff2f9f64faf798f34 100644
--- a/Reconstruction/eflowRec/eflowRec/PFRecoverSplitShowersTool.h
+++ b/Reconstruction/eflowRec/eflowRec/PFRecoverSplitShowersTool.h
@@ -6,6 +6,9 @@
 #define PFRECOVERSPLITSHOWERSTOOL_H
 
 #include "AthenaBaseComps/AthAlgTool.h"
+
+#include <unordered_set>
+
 #include "GaudiKernel/ToolHandle.h"
 #include "xAODCaloEvent/CaloCluster.h"
 #include "eflowRec/IPFSubtractionTool.h"
@@ -40,7 +43,7 @@ class PFRecoverSplitShowersTool : public extends<AthAlgTool, IPFSubtractionTool>
 
   struct eflowData {
     eflowCaloObjectContainer* caloObjects;
-    std::vector<eflowRecCluster*> clustersToConsider;
+    std::unordered_set<eflowRecCluster*> clustersToConsider;
     std::vector<eflowRecTrack*> tracksToRecover;
   };
 
@@ -58,9 +61,6 @@ class PFRecoverSplitShowersTool : public extends<AthAlgTool, IPFSubtractionTool>
   /* Tool for getting e/p values and hadronic shower cell ordering principle parameters */
   ToolHandle<IEFlowCellEOverPTool> m_theEOverPTool{this,"eflowCellEOverPTool","eflowCellEOverPTool","Energy Flow E/P Values and Shower Parameters Tool"};
 
-  /** Track-Cluster matching tool */
-  ToolHandle<PFTrackClusterMatchingTool> m_matchingTool{this,"PFTrackClusterMatchingTool","PFTrackClusterMatchingTool/RcvrSpltMatchingTool","The track-cluster matching tool"};
-
   std::unique_ptr<eflowEEtaBinnedParameters> m_binnedParameters;
 
   /** Parameter that controls whether to use retain remaining calorimeter energy in track-cluster system, after charged shower subtraction */
diff --git a/Reconstruction/eflowRec/eflowRec/PFTrackClusterMatchingTool.h b/Reconstruction/eflowRec/eflowRec/PFTrackClusterMatchingTool.h
index ddf36db9d423ddf4ac9b19c4773758d4bb23e646..7867de6529b77f7641e2e3ae7df5819a16e71e06 100644
--- a/Reconstruction/eflowRec/eflowRec/PFTrackClusterMatchingTool.h
+++ b/Reconstruction/eflowRec/eflowRec/PFTrackClusterMatchingTool.h
@@ -14,6 +14,7 @@
 #ifndef PFMATCHINGTOOL_H_
 #define PFMATCHINGTOOL_H_
 
+#include <utility>
 #include "eflowRec/PFMatcher.h"
 
 class eflowRecCluster;
@@ -38,8 +39,8 @@ public:
   StatusCode finalize();
 
   /** Get n clusters that matches best to a given track */
-  std::vector<eflowRecCluster*> doMatches(const eflowRecTrack* track, eflowRecClusterContainer* clusters, int n) const;
-  std::vector<eflowRecCluster*> doMatches(const eflowRecTrack* track, const std::vector<eflowRecCluster*> clusters, int n) const;
+  std::vector<std::pair<eflowRecCluster*,float> > doMatches(const eflowRecTrack* track, eflowRecClusterContainer* clusters, int n) const;
+  std::vector<std::pair<eflowRecCluster*,float> > doMatches(const eflowRecTrack* track, const std::vector<eflowRecCluster*> clusters, int n) const;
 
 private:
 
diff --git a/Reconstruction/eflowRec/python/PFHLTSequence.py b/Reconstruction/eflowRec/python/PFHLTSequence.py
index 146426e762fe4062e5d2f25262cd2eee250222fc..a0a999012a0203cc07e5cf19fbdc4d83d3ac36d2 100644
--- a/Reconstruction/eflowRec/python/PFHLTSequence.py
+++ b/Reconstruction/eflowRec/python/PFHLTSequence.py
@@ -9,7 +9,7 @@ log = logging.getLogger('PFHLTSequence')
 # Use the appropriate containers based on what config is desired
 trackvtxcontainers = {
     "offline":  ("InDetTrackParticles","PrimaryVertices"),
-    "ftf":      ("HLT_IDTrack_FS_FTF","HLT_EFHistoPrmVtx"),
+    "ftf":      ("HLT_IDTrack_FS_FTF","HLT_IDVertex_FS"),
     }
 
 # PFTrackSelector
@@ -95,8 +95,7 @@ def getPFAlg(clustersin,tracktype):
     # cluster is needed to recover the full track expected energy
     # Reuse the default E/P subtraction tool
     PFRecoverSplitShowersTool = eflowRecConf.PFRecoverSplitShowersTool("PFRecoverSplitShowersTool",
-        eflowCellEOverPTool = CellEOverPTool,
-        PFTrackClusterMatchingTool = getPFMatchingTool("MatchingTool_RecoverSS",0.2)
+        eflowCellEOverPTool = CellEOverPTool
         )
 
     # Configure moment calculation using topocluster moment calculator
diff --git a/Reconstruction/eflowRec/share/PFlowMTConfig.py b/Reconstruction/eflowRec/share/PFlowMTConfig.py
index 721308e53aa507009103a1db32347db5c997293c..8bf16d1e55e85a97d41f4679de681d6047a2d74e 100644
--- a/Reconstruction/eflowRec/share/PFlowMTConfig.py
+++ b/Reconstruction/eflowRec/share/PFlowMTConfig.py
@@ -98,13 +98,6 @@ if jobproperties.eflowRecFlags.recoverIsolatedTracks == True:
 if jobproperties.eflowRecFlags.useUpdated2015ChargedShowerSubtraction == False:
    PFRecoverSplitShowersTool.useUpdated2015ChargedShowerSubtraction = False
 
-MatchingTool_Recover = PFTrackClusterMatchingTool()
-MatchingTool_Recover.TrackPositionType   = 'EM2EtaPhi' # str
-MatchingTool_Recover.ClusterPositionType = 'PlainEtaPhi' # str
-MatchingTool_Recover.DistanceType        = 'EtaPhiSquareDistance' # str
-MatchingTool_Recover.MatchCut = 0.2*0.2 # float
-PFRecoverSplitShowersTool.PFTrackClusterMatchingTool = MatchingTool_Recover
-
 if jobproperties.eflowRecFlags.eflowAlgType != "EOverP":
    PFAlgorithm.SubtractionToolList += [PFRecoverSplitShowersTool]
 
diff --git a/Reconstruction/eflowRec/src/EtaPhiLUT.cxx b/Reconstruction/eflowRec/src/EtaPhiLUT.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..778fb86f788c8f44ea18e1c5fd99f5f7c9fa98b5
--- /dev/null
+++ b/Reconstruction/eflowRec/src/EtaPhiLUT.cxx
@@ -0,0 +1,85 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include <cmath>
+#include <algorithm>
+
+#include "eflowRec/EtaPhiLUT.h"
+
+namespace eflowRec {
+
+  /// define 2*Pi
+  static constexpr float TWOPI = 2*M_PI;
+
+  /// hepler function to ensure phi is within +-Pi
+  float phiInRange(float phi) {
+    while (phi >= M_PI) phi -= TWOPI;
+    while (phi < -M_PI) phi += TWOPI;
+    return phi;
+  }
+
+  /// calculate phi index for a given phi
+  unsigned int phiIndex(float phi, float binsize) { return (phi + M_PI)/binsize; }
+
+  EtaPhiLUT::EtaPhiLUT( unsigned int nbins ) :
+    m_nphiBins(nbins),
+    m_phiBinSize(TWOPI/m_nphiBins),
+    m_phiBinnedLookUpTable(m_nphiBins)
+    {}
+
+  void EtaPhiLUT::fill(eflowRecClusterContainer& clustersin)
+  {
+    for(eflowRecCluster* cluster : clustersin) {
+      int index = phiIndex(cluster->getCluster()->phi(), m_phiBinSize);
+      m_phiBinnedLookUpTable[index].push_back(cluster);
+    }
+
+    for( auto& vec : m_phiBinnedLookUpTable ) {
+      std::stable_sort(vec.begin(),vec.end(),[](const eflowRecCluster* c1, const eflowRecCluster* c2) { return c1->getCluster()->eta() < c2->getCluster()->eta(); });
+    }
+  }
+
+  std::vector<eflowRecCluster*> EtaPhiLUT::clustersInCone( float eta, float phi, float dr ) const {
+    std::vector<eflowRecCluster*> result;
+
+    // Indices corresponding to phi range
+    unsigned int iPhiMin = phiIndex( phiInRange(phi-dr), m_phiBinSize );
+    unsigned int iPhiMax = phiIndex( phiInRange(phi+dr), m_phiBinSize );
+
+    // Extract index ranges to iterate over
+    std::vector< std::pair<int,int> > iPhiRanges;
+    if( iPhiMin < iPhiMax ) {
+      iPhiRanges.push_back( std::make_pair(iPhiMin,iPhiMax) );
+    } else { // special treatment for phi-wrapping
+      iPhiRanges.push_back( std::make_pair(0,iPhiMax) );
+      iPhiRanges.push_back( std::make_pair(iPhiMin,m_nphiBins-1) );
+    }
+
+    float dr2Cut = dr*dr;
+
+    // loop over ranges
+    for( auto& range : iPhiRanges ){
+      unsigned int indexMin = range.first;
+      unsigned int indexMax = range.second;
+      for( ; indexMin <= indexMax; ++indexMin ){
+        const std::vector<eflowRecCluster*>& phiClusters = m_phiBinnedLookUpTable[indexMin];
+
+        // Get iterators for clusters in relevant eta range
+        auto it_min = std::lower_bound (phiClusters.begin(), phiClusters.end(), eta-dr, [] (const eflowRecCluster* cl, float etaval) {return cl->getCluster()->eta()<etaval;} );
+        auto it_max = std::upper_bound (it_min, phiClusters.end(), eta+dr, [] (float etaval, const eflowRecCluster* cl) {return etaval<cl->getCluster()->eta();} );
+
+        // Apply deltaR cut
+        for( ;it_min!=it_max;++it_min ){
+          const xAOD::CaloCluster& xcluster = *(*it_min)->getCluster();
+          float deta = eta - xcluster.eta();
+          float dphi = phiInRange(phi - xcluster.phi());
+          float dr2 = deta*deta + dphi*dphi;
+          if( dr2 < dr2Cut ) result.push_back(*it_min);
+        }
+      }
+    }
+    return result;
+  }
+
+} // namespace
diff --git a/Reconstruction/eflowRec/src/PFCellLevelSubtractionTool.cxx b/Reconstruction/eflowRec/src/PFCellLevelSubtractionTool.cxx
index 07a5fe815ecddd70c63a92279c51ddc656db6ecd..6461f12d191356abc2edb0bbcdc9ad74e464c396 100644
--- a/Reconstruction/eflowRec/src/PFCellLevelSubtractionTool.cxx
+++ b/Reconstruction/eflowRec/src/PFCellLevelSubtractionTool.cxx
@@ -44,7 +44,7 @@ using namespace eflowSubtract;
 PFCellLevelSubtractionTool::PFCellLevelSubtractionTool(const std::string& type,const std::string& name,const IInterface* parent) :
   base_class( type, name, parent),
   m_binnedParameters(nullptr)
-{ 
+{
 }
 
 PFCellLevelSubtractionTool::~PFCellLevelSubtractionTool() {
@@ -57,10 +57,6 @@ StatusCode PFCellLevelSubtractionTool::initialize(){
     msg(MSG::WARNING) << "Cannot find PFTrackClusterMatchingTool" << endmsg;
   }
 
-  if (m_matchingToolForPull_015.retrieve().isFailure()) {
-    msg(MSG::WARNING) << "Cannot find PFTrackClusterMatchingTool_2" << endmsg;
-  }
-
   if (m_matchingToolForPull_02.retrieve().isFailure()) {
     msg(MSG::WARNING) << "Cannot find PFTrackClusterMatchingTool_2" << endmsg;
   }
@@ -76,6 +72,12 @@ StatusCode PFCellLevelSubtractionTool::initialize(){
     return StatusCode::SUCCESS;
   }
 
+  m_trkpos.reset( dynamic_cast<PFMatch::TrackEtaPhiInFixedLayersProvider*>(PFMatch::TrackPositionFactory::Get("EM2EtaPhi").release()) );
+  if(!m_trkpos.get()) {
+    ATH_MSG_ERROR("Failed to get TrackPositionProvider for cluster preselection!");
+    return StatusCode::FAILURE;
+  }
+
   return StatusCode::SUCCESS;
 
 }
@@ -88,6 +90,7 @@ void PFCellLevelSubtractionTool::execute(eflowCaloObjectContainer* theEflowCaloO
   data.caloObjects = theEflowCaloObjectContainer;
   data.tracks = recTrackContainer;
   data.clusters = recClusterContainer;
+  data.clusterLUT.fill(*recClusterContainer);
   
   /* Add each track to its best matching cluster's eflowCaloObject */
   matchAndCreateEflowCaloObj(m_nMatchesInCellLevelSubtraction, data);
@@ -114,30 +117,39 @@ unsigned int PFCellLevelSubtractionTool::matchAndCreateEflowCaloObj(unsigned int
   for (unsigned int iTrack=0; iTrack<nTrack; ++iTrack) {
     eflowRecTrack *thisEfRecTrack = static_cast<eflowRecTrack*>(data.tracks->at(iTrack));
 
-     /* Add cluster matches needed for pull calculation*/
-    std::vector<eflowRecCluster*> bestClusters_015 = m_matchingToolForPull_015->doMatches(thisEfRecTrack, data.clusters, -1);
-    std::vector<eflowRecCluster*> bestClusters_02 = m_matchingToolForPull_02->doMatches(thisEfRecTrack, data.clusters, -1);
+    // Preselect clusters in a local cone
+    eflowRecMatchTrack matchTrack(thisEfRecTrack);
+    PFMatch::EtaPhi etaphi = m_trkpos->getPosition(&matchTrack);
+    float tracketa = etaphi.getEta();
+    float trackphi = etaphi.getPhiD();
+    float dRpresel = 0.4; // Some safety margin, but still << full detector
+    std::vector<eflowRecCluster*> nearbyClusters = data.clusterLUT.clustersInCone(tracketa,trackphi,dRpresel);
 
-    for (unsigned int imatch=0; imatch < bestClusters_015.size(); ++imatch) {
-      eflowTrackClusterLink* trackClusterLink = eflowTrackClusterLink::getInstance(thisEfRecTrack, bestClusters_015.at(imatch));
-      thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink,"cone_015");    
-    }
-
-    for (unsigned int imatch=0; imatch < bestClusters_02.size(); ++imatch) {
-      eflowTrackClusterLink* trackClusterLink = eflowTrackClusterLink::getInstance(thisEfRecTrack, bestClusters_02.at(imatch));
+     /* Add cluster matches needed for pull calculation*/
+    std::vector<std::pair<eflowRecCluster*,float> > bestClusters_02 = m_matchingToolForPull_02->doMatches(thisEfRecTrack, data.clusters, -1);
+
+    for (auto& matchpair : bestClusters_02) {
+      eflowRecCluster* theCluster = matchpair.first;
+      float distancesq = matchpair.second;
+      eflowTrackClusterLink* trackClusterLink = eflowTrackClusterLink::getInstance(thisEfRecTrack, theCluster);
+      if(distancesq<0.15*0.15) {
+	// Narrower cone is a subset of the selected clusters
+	// Distance returned is deltaR^2
+	thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink,"cone_015");
+      }
       thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink,"cone_02");    
     }
 
-    std::vector<eflowRecCluster*> bestClusters = m_matchingTool->doMatches(thisEfRecTrack, data.clusters, n);
+    std::vector<std::pair<eflowRecCluster*,float> > bestClusters = m_matchingTool->doMatches(thisEfRecTrack, data.clusters, n);
     if (bestClusters.empty()) { continue; }
 
     /* Matched cluster: create TrackClusterLink and add it to both the track and the cluster (eflowCaloObject will be created later) */
     nMatches++;
-    for (unsigned int imatch=0; imatch < bestClusters.size(); ++imatch) {
-    eflowTrackClusterLink* trackClusterLink = eflowTrackClusterLink::getInstance(thisEfRecTrack, bestClusters.at(imatch));
-    thisEfRecTrack->addClusterMatch(trackClusterLink);
-    bestClusters.at(imatch)->addTrackMatch(trackClusterLink);
-    
+    for (auto& matchpair : bestClusters) {
+      eflowRecCluster* theCluster = matchpair.first;
+      eflowTrackClusterLink* trackClusterLink = eflowTrackClusterLink::getInstance(thisEfRecTrack, theCluster);
+      thisEfRecTrack->addClusterMatch(trackClusterLink);
+      theCluster->addTrackMatch(trackClusterLink);
     }
   
   }
diff --git a/Reconstruction/eflowRec/src/PFClusterCollectionTool.cxx b/Reconstruction/eflowRec/src/PFClusterCollectionTool.cxx
index 79f658a6c7fc7d3946c2f6880820bbfd7aea1896..6cf144b74eec1b478cf51a74f1fc8cd776bb8898 100644
--- a/Reconstruction/eflowRec/src/PFClusterCollectionTool.cxx
+++ b/Reconstruction/eflowRec/src/PFClusterCollectionTool.cxx
@@ -61,6 +61,7 @@ std::unique_ptr<xAOD::CaloClusterContainer> PFClusterCollectionTool::execute(con
       ATH_MSG_DEBUG("Adding cluster with E, eta and phi to moments maker " << thisCluster->e() << ", " << thisCluster->eta() << " and " << thisCluster->phi());
     }
   }
+  std::sort(result->begin(), result->end(), [](xAOD::CaloCluster* c1, xAOD::CaloCluster* c2) {return c1->e()>c2->e();});
   return result;
 }
 
diff --git a/Reconstruction/eflowRec/src/PFOChargedCreatorAlgorithm.cxx b/Reconstruction/eflowRec/src/PFOChargedCreatorAlgorithm.cxx
index fce83ce909c57b149005008fc8398fc653809a82..a9611817b9ed690aa234ab52cacce6119cfc282b 100644
--- a/Reconstruction/eflowRec/src/PFOChargedCreatorAlgorithm.cxx
+++ b/Reconstruction/eflowRec/src/PFOChargedCreatorAlgorithm.cxx
@@ -1,9 +1,11 @@
 /*                                                                                                                                                                                                                                        
-   Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration                                                                                                                                                                
+   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "eflowRec/PFOChargedCreatorAlgorithm.h"
 
+#include <algorithm>
+
 #include "eflowRec/eflowRecCluster.h"
 #include "eflowRec/eflowRecTrack.h"
 #include "eflowRec/eflowTrackClusterLink.h"
@@ -11,7 +13,7 @@
 #include "xAODPFlow/PFOAuxContainer.h"
 
 PFOChargedCreatorAlgorithm::PFOChargedCreatorAlgorithm(const std::string& name, ISvcLocator* pSvcLocator) :
-  AthAlgorithm(name,pSvcLocator)
+  AthReentrantAlgorithm(name,pSvcLocator)
 {
 }
 
@@ -24,23 +26,25 @@ StatusCode PFOChargedCreatorAlgorithm::initialize(){
   return StatusCode::SUCCESS;
 }
 
-StatusCode  PFOChargedCreatorAlgorithm::execute(){
+StatusCode  PFOChargedCreatorAlgorithm::execute(const EventContext& ctx) const {
 
   ATH_MSG_DEBUG("Processing eflowCaloObjectContainer");
 
-  SG::WriteHandle<xAOD::PFOContainer> chargedPFOContainerWriteHandle(m_chargedPFOContainerWriteHandleKey);
+  SG::WriteHandle<xAOD::PFOContainer> chargedPFOContainerWriteHandle(m_chargedPFOContainerWriteHandleKey,ctx);
   ATH_CHECK(chargedPFOContainerWriteHandle.record(std::make_unique<xAOD::PFOContainer>(),std::make_unique<xAOD::PFOAuxContainer>()));
   
   /* Create Charged PFOs from all eflowCaloObjects */
-  SG::ReadHandle<eflowCaloObjectContainer> eflowCaloObjectContainerReadHandle(m_eflowCaloObjectContainerReadHandleKey);
+  SG::ReadHandle<eflowCaloObjectContainer> eflowCaloObjectContainerReadHandle(m_eflowCaloObjectContainerReadHandleKey,ctx);
   for (auto thisEflowCaloObject : *eflowCaloObjectContainerReadHandle) createChargedPFO(*thisEflowCaloObject,true,chargedPFOContainerWriteHandle);
 
+  std::sort(chargedPFOContainerWriteHandle->begin(), chargedPFOContainerWriteHandle->end(), [] (const xAOD::PFO* pfo1, const xAOD::PFO* pfo2) {return pfo1->pt()>pfo2->pt();});
+
   return StatusCode::SUCCESS;  
 }
 
 StatusCode PFOChargedCreatorAlgorithm::finalize(){ return StatusCode::SUCCESS; }
 
-void PFOChargedCreatorAlgorithm::createChargedPFO(const eflowCaloObject& energyFlowCaloObject, bool addClusters, SG::WriteHandle<xAOD::PFOContainer>& chargedPFOContainerWriteHandle){
+void PFOChargedCreatorAlgorithm::createChargedPFO(const eflowCaloObject& energyFlowCaloObject, bool addClusters, SG::WriteHandle<xAOD::PFOContainer>& chargedPFOContainerWriteHandle) const {
 
   /* Loop over all tracks in the eflowCaloObject */
   int nTracks = energyFlowCaloObject.nTracks();
diff --git a/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx b/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx
index f42045c56da39bb1dc912580b550a9316298b149..00dd296913bb947fc4285cd56c7f52c63ee85313 100644
--- a/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx
+++ b/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx
@@ -1,9 +1,11 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "eflowRec/PFONeutralCreatorAlgorithm.h"
 
+#include <algorithm>
+
 #include "eflowRec/eflowCaloObject.h"
 #include "eflowRec/eflowRecCluster.h"
 #include "eflowRec/eflowTrackClusterLink.h"
@@ -11,7 +13,7 @@
 #include "xAODPFlow/PFOAuxContainer.h"
 
 PFONeutralCreatorAlgorithm::PFONeutralCreatorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator) :
-  AthAlgorithm(name, pSvcLocator)
+  AthReentrantAlgorithm(name, pSvcLocator)
 {
 }
 
@@ -26,29 +28,51 @@ StatusCode PFONeutralCreatorAlgorithm::initialize(){
   
 }
 
-StatusCode PFONeutralCreatorAlgorithm::execute(){
+StatusCode PFONeutralCreatorAlgorithm::execute(const EventContext& ctx) const {
 
   ATH_MSG_DEBUG("Executing");
 
-  SG::WriteHandle<xAOD::PFOContainer> neutralPFOContainerWriteHandle(m_neutralPFOContainerWriteHandleKey);
-  ATH_CHECK(neutralPFOContainerWriteHandle.record(std::make_unique<xAOD::PFOContainer>(),std::make_unique<xAOD::PFOAuxContainer>()));
-  std::unique_ptr<SG::WriteHandle<xAOD::PFOContainer> > p_neutralPFOContainerWriteHandle_nonModified(nullptr);
-  if (m_LCMode) {
-    p_neutralPFOContainerWriteHandle_nonModified = std::make_unique<SG::WriteHandle<xAOD::PFOContainer> >(m_neutralPFOContainerWriteHandleKey_nonModified);
-    ATH_CHECK(p_neutralPFOContainerWriteHandle_nonModified->record(std::make_unique<xAOD::PFOContainer>(),std::make_unique<xAOD::PFOAuxContainer>()));
-  }
-  
   /* Create Neutral PFOs from all eflowCaloObjects */
-  SG::ReadHandle<eflowCaloObjectContainer> eflowCaloObjectContainerReadHandle(m_eflowCaloObjectContainerReadHandleKey);
+  SG::ReadHandle<eflowCaloObjectContainer> eflowCaloObjectContainerReadHandle(m_eflowCaloObjectContainerReadHandleKey,ctx);
+
+  // Always create at least one PFO container & aux
+  auto neutralPFOContainer = std::make_unique<xAOD::PFOContainer>();
+  auto neutralPFOContainerAux = std::make_unique<xAOD::PFOAuxContainer>();
+  neutralPFOContainer->setStore(neutralPFOContainerAux.get());
+  // The non-modified container is only used for LC PFOs
+  std::unique_ptr<xAOD::PFOContainer> neutralPFOContainer_nonModified(nullptr);
+  std::unique_ptr<xAOD::PFOAuxContainer> neutralPFOContainerAux_nonModified(nullptr);
+  if(m_LCMode) {
+    neutralPFOContainer_nonModified = std::make_unique<xAOD::PFOContainer>();
+    neutralPFOContainerAux_nonModified = std::make_unique<xAOD::PFOAuxContainer>();
+    neutralPFOContainer->setStore(neutralPFOContainerAux_nonModified.get());
+  }
+
   ATH_MSG_DEBUG("Looping over eflowCaloObjects");
-  for (auto thisEflowCaloObject : *eflowCaloObjectContainerReadHandle) createNeutralPFO(*thisEflowCaloObject, neutralPFOContainerWriteHandle, p_neutralPFOContainerWriteHandle_nonModified.get());
+  // Create PFOs and fill the containers
+  for (auto thisEflowCaloObject : *eflowCaloObjectContainerReadHandle) {
+    if( createNeutralPFO(*thisEflowCaloObject, neutralPFOContainer.get(), neutralPFOContainer_nonModified.get()).isFailure() ) {
+      ATH_MSG_WARNING("Problem encountered while creating neutral PFOs");
+      return StatusCode::SUCCESS;
+    }
+  }
+
+  // Record the output containers
+  SG::WriteHandle<xAOD::PFOContainer> neutralPFOContainerWriteHandle(m_neutralPFOContainerWriteHandleKey,ctx);
+  std::sort(neutralPFOContainer->begin(), neutralPFOContainer->end(), [] (const xAOD::PFO* pfo1, const xAOD::PFO* pfo2) {return pfo1->pt()>pfo2->pt();});
+  ATH_CHECK( neutralPFOContainerWriteHandle.record(std::move(neutralPFOContainer),std::move(neutralPFOContainerAux)) );
+  if(m_LCMode) {
+    std::sort(neutralPFOContainer_nonModified->begin(), neutralPFOContainer_nonModified->end(), [] (const xAOD::PFO* pfo1, const xAOD::PFO* pfo2) {return pfo1->pt()>pfo2->pt();});
+    SG::WriteHandle<xAOD::PFOContainer> neutralPFOContainerWriteHandle_nonModified(m_neutralPFOContainerWriteHandleKey,ctx);
+    ATH_CHECK( neutralPFOContainerWriteHandle_nonModified.record(std::move(neutralPFOContainer_nonModified),std::move(neutralPFOContainerAux_nonModified)) );
+  }
 
   return StatusCode::SUCCESS;
 }
 
 StatusCode PFONeutralCreatorAlgorithm::finalize(){ return StatusCode::SUCCESS; }
 
-void PFONeutralCreatorAlgorithm::createNeutralPFO(const eflowCaloObject& energyFlowCaloObject,SG::WriteHandle<xAOD::PFOContainer>& neutralPFOContainerWriteHandle, SG::WriteHandle<xAOD::PFOContainer>* neutralPFOContainerWriteHandle_nonModified){
+StatusCode PFONeutralCreatorAlgorithm::createNeutralPFO(const eflowCaloObject& energyFlowCaloObject, xAOD::PFOContainer* neutralPFOContainer, xAOD::PFOContainer* neutralPFOContainer_nonModified) const {
 
   unsigned int nClusters = energyFlowCaloObject.nClusters();
 
@@ -72,12 +96,17 @@ void PFONeutralCreatorAlgorithm::createNeutralPFO(const eflowCaloObject& energyF
     xAOD::PFO* thisPFO = new xAOD::PFO();
     if (m_LCMode) {
       if (thisEfRecCluster->isTouchable()) {
-        neutralPFOContainerWriteHandle->push_back(thisPFO);
+        neutralPFOContainer->push_back(thisPFO);
       } else {
-	(*neutralPFOContainerWriteHandle_nonModified)->push_back(thisPFO);
+	if(neutralPFOContainer_nonModified) {
+	  neutralPFOContainer_nonModified->push_back(thisPFO);
+	} else {
+	  ATH_MSG_WARNING("Got a nullptr for non-modified nPFO container!");
+	  return StatusCode::FAILURE;
+	}
       }
     } else {
-      neutralPFOContainerWriteHandle->push_back(thisPFO);
+      neutralPFOContainer->push_back(thisPFO);
     }
 
     ATH_MSG_VERBOSE("  Get original cluster link");
@@ -278,9 +307,10 @@ void PFONeutralCreatorAlgorithm::createNeutralPFO(const eflowCaloObject& energyF
       thisPFO->setAttribute(myAttribute_TIMING, clusterTiming);
     }
   }
+  return StatusCode::SUCCESS;
 }
 
-void PFONeutralCreatorAlgorithm::addMoment(const xAOD::CaloCluster::MomentType& momentType, const xAOD::PFODetails::PFOAttributes& pfoAttribute, const xAOD::CaloCluster& theCluster, xAOD::PFO& thePFO){
+void PFONeutralCreatorAlgorithm::addMoment(const xAOD::CaloCluster::MomentType& momentType, const xAOD::PFODetails::PFOAttributes& pfoAttribute, const xAOD::CaloCluster& theCluster, xAOD::PFO& thePFO) const {
 
   double moment = 0.0;
   bool isRetrieved = theCluster.retrieveMoment(momentType, moment);
diff --git a/Reconstruction/eflowRec/src/PFRecoverSplitShowersTool.cxx b/Reconstruction/eflowRec/src/PFRecoverSplitShowersTool.cxx
index d0bb314287ac2b2986e7351762829cd7f249bcc8..06b16f46c9774355cd3a667d461bec66565034ec 100644
--- a/Reconstruction/eflowRec/src/PFRecoverSplitShowersTool.cxx
+++ b/Reconstruction/eflowRec/src/PFRecoverSplitShowersTool.cxx
@@ -36,11 +36,6 @@ PFRecoverSplitShowersTool::~PFRecoverSplitShowersTool() {}
 
 StatusCode PFRecoverSplitShowersTool::initialize(){
 
-  if (m_matchingTool.retrieve().isFailure()){
-    ATH_MSG_WARNING("Couldn't retrieve PFTrackClusterMatchingTool");
-    return StatusCode::SUCCESS;
-  }
-
   if (m_theEOverPTool.retrieve().isFailure()){
     ATH_MSG_WARNING("Cannot find eflowEOverPTool");
     return StatusCode::SUCCESS;
@@ -54,12 +49,14 @@ StatusCode PFRecoverSplitShowersTool::initialize(){
   return StatusCode::SUCCESS;
 }
 
-void PFRecoverSplitShowersTool::execute(eflowCaloObjectContainer* theEflowCaloObjectContainer, eflowRecTrackContainer*, eflowRecClusterContainer*) const {
+void PFRecoverSplitShowersTool::execute(eflowCaloObjectContainer* theEflowCaloObjectContainer, eflowRecTrackContainer* eflowRecTracks, eflowRecClusterContainer* eflowRecClusters) const {
 
   ATH_MSG_DEBUG("Executing");
 
   eflowData data;
   data.caloObjects = theEflowCaloObjectContainer;
+  data.tracksToRecover.reserve(eflowRecTracks->size());
+  data.clustersToConsider.reserve(eflowRecClusters->size());
 
   fillTracksToRecover(data);
   fillClustersToConsider(data);
@@ -91,12 +88,10 @@ void PFRecoverSplitShowersTool::fillClustersToConsider(eflowData& data) const {
         if (0 == (int)theCellLink->size()){ continue; }
 
         thisEflowCaloObject->efRecCluster(i)->clearTrackMatches();
-        data.clustersToConsider.push_back(thisEflowCaloObject->efRecCluster(i));
+        data.clustersToConsider.insert(thisEflowCaloObject->efRecCluster(i));
         thisEflowCaloObject->clearClusters();
     }
   }
-
-  std::sort(data.clustersToConsider.begin(),data.clustersToConsider.end(),eflowRecCluster::SortDescendingPt());
 }
 
 void PFRecoverSplitShowersTool::fillTracksToRecover(eflowData& data) const {
@@ -163,26 +158,35 @@ unsigned int PFRecoverSplitShowersTool::matchAndCreateEflowCaloObj(eflowData& da
       const xAOD::TrackParticle* track = thisEfRecTrack->getTrack();
       ATH_MSG_DEBUG("Recovering charged EFO with e,pt, eta and phi " << track->e() << ", " << track->pt() << ", " << track->eta() << " and " << track->phi());
     }
-    /* Get list of matched clusters */
-    std::vector<eflowRecCluster*> matchedClusters = m_matchingTool->doMatches(thisEfRecTrack, data.clustersToConsider, -1);
+    // Get list of matched clusters in the dR<0.2 cone -- already identified
+    const std::vector<eflowTrackClusterLink*>* matchedClusters_02 = thisEfRecTrack->getAlternativeClusterMatches("cone_02");
+    if (!matchedClusters_02) { continue; }
 
     if (msgLvl(MSG::DEBUG)){
-      for (auto thisEFRecCluster : matchedClusters) ATH_MSG_DEBUG("Have matched cluster with e, pt, eta, phi of " << thisEFRecCluster->getCluster()->e() << ", " <<  thisEFRecCluster->getCluster()->eta() << ", " << thisEFRecCluster->getCluster()->eta() << " and " << thisEFRecCluster->getCluster()->phi());
+      for (auto trkClusLink : *matchedClusters_02) {
+	const eflowRecCluster* thisEFRecCluster = trkClusLink->getCluster();
+	ATH_MSG_DEBUG("Have matched cluster with e, pt, eta, phi of " << thisEFRecCluster->getCluster()->e() << ", " <<  thisEFRecCluster->getCluster()->eta() << ", " << thisEFRecCluster->getCluster()->eta() << " and " << thisEFRecCluster->getCluster()->phi());
+      }
     }
 
-    if (matchedClusters.empty()) { continue; }
+    if (matchedClusters_02->empty()) { continue; }
 
     /* Matched cluster: create TrackClusterLink and add it to both the track and the cluster (eflowCaloObject will be created later) */
-    for (auto efRecCluster : matchedClusters){
-      eflowTrackClusterLink* trackClusterLink = eflowTrackClusterLink::getInstance(thisEfRecTrack,efRecCluster);
+    for (auto trkClusLink : *matchedClusters_02){
+      eflowRecCluster* thisEFRecCluster = trkClusLink->getCluster();
+      // Look up whether this cluster is intended for recovery
+      if( data.clustersToConsider.find(trkClusLink->getCluster()) == data.clustersToConsider.end() ) {continue;}
+      eflowTrackClusterLink* trackClusterLink = eflowTrackClusterLink::getInstance(thisEfRecTrack,thisEFRecCluster);
       thisEfRecTrack->addClusterMatch(trackClusterLink);
-      efRecCluster->addTrackMatch(trackClusterLink);
+      thisEFRecCluster->addTrackMatch(trackClusterLink);
     }
   }
 
   /* Create all eflowCaloObjects that contain eflowRecCluster */
   eflowCaloObjectMaker makeCaloObject;
-  unsigned int nCaloObjects = makeCaloObject.makeTrkCluCaloObjects(data.tracksToRecover, data.clustersToConsider,
+  std::vector<eflowRecCluster*> v_clustersToConsider(data.clustersToConsider.begin(),data.clustersToConsider.end());
+  std::sort(v_clustersToConsider.begin(),v_clustersToConsider.end(),eflowRecCluster::SortDescendingPt());
+  unsigned int nCaloObjects = makeCaloObject.makeTrkCluCaloObjects(data.tracksToRecover, v_clustersToConsider,
 								   data.caloObjects);
   ATH_MSG_DEBUG("PFRecoverSplitShowersTool created " << nCaloObjects << " CaloObjects");
 
@@ -214,9 +218,10 @@ void PFRecoverSplitShowersTool::performSubtraction(eflowCaloObject* thisEflowCal
     matchedClusters.clear();
     std::vector<eflowTrackClusterLink*> links = thisEfRecTrack->getClusterMatches();
     for ( auto thisEFlowTrackClusterLink : links) matchedClusters.push_back(thisEFlowTrackClusterLink->getCluster());
+    std::sort(matchedClusters.begin(),matchedClusters.end(),eflowRecCluster::SortDescendingPt());
 
     if (msgLvl(MSG::DEBUG)){
-      for (auto thisClus : matchedClusters) ATH_MSG_DEBUG("Cluster with e,pt, eta and phi of " << thisClus->getCluster()->e() << ", "<< thisClus->getCluster()->pt() << ", " << thisClus->getCluster()->eta() << " and " << thisClus->getCluster()->phi() << " will be subtracted");
+      for (auto thisClus : matchedClusters) ATH_MSG_DEBUG("Cluster " << thisClus->getCluster()->index() << " with e,pt, eta and phi of " << thisClus->getCluster()->e() << ", "<< thisClus->getCluster()->pt() << ", " << thisClus->getCluster()->eta() << " and " << thisClus->getCluster()->phi() << " will be subtracted");
     }
     /* Do subtraction */
     std::vector<std::pair<xAOD::CaloCluster*, bool> > clusterSubtractionList;
@@ -255,7 +260,7 @@ void PFRecoverSplitShowersTool::performSubtraction(eflowCaloObject* thisEflowCal
           else clusterSubtractedEnergyRatios.push_back(NAN);
         }
 
-	      pfSubtractionStatusSetter.markSubtractionStatus(clusterSubtractionList, clusterSubtractedEnergyRatios, *thisEflowCaloObject);
+	pfSubtractionStatusSetter.markSubtractionStatus(clusterSubtractionList, clusterSubtractedEnergyRatios, *thisEflowCaloObject);
 	
         } 
 
diff --git a/Reconstruction/eflowRec/src/PFTrackClusterMatchingTool.cxx b/Reconstruction/eflowRec/src/PFTrackClusterMatchingTool.cxx
index 04724057d4fbf1b9b1f7051305b086d525a28b24..e92a5e01c9250b8dd0b618458e659c5a23676d59 100644
--- a/Reconstruction/eflowRec/src/PFTrackClusterMatchingTool.cxx
+++ b/Reconstruction/eflowRec/src/PFTrackClusterMatchingTool.cxx
@@ -53,23 +53,17 @@ StatusCode PFTrackClusterMatchingTool::finalize() {
   return StatusCode::SUCCESS;
 }
 
-std::vector<eflowRecCluster*> PFTrackClusterMatchingTool::doMatches(const eflowRecTrack* track, eflowRecClusterContainer* clusters, int nMatches) const {
-  std::vector<eflowRecCluster*> vec_clusters;
-  for (unsigned int iCluster = 0; iCluster < clusters->size(); ++iCluster) {
-    eflowRecCluster* thisEFRecCluster = clusters->at(iCluster);
-    vec_clusters.push_back(thisEFRecCluster);
-  }
-  const std::vector<eflowRecCluster*> const_clusters = vec_clusters;
-  return doMatches(track, const_clusters, nMatches);
+std::vector<std::pair<eflowRecCluster*,float> > PFTrackClusterMatchingTool::doMatches(const eflowRecTrack* track, eflowRecClusterContainer* clusters, int nMatches) const {
+  const std::vector<eflowRecCluster*> vec_clusters(clusters->begin(), clusters->end());
+  return doMatches(track, vec_clusters, nMatches);
 }
 
-std::vector<eflowRecCluster*> PFTrackClusterMatchingTool::doMatches(const eflowRecTrack* track, const std::vector<eflowRecCluster*> clusters, int nMatches) const {
+std::vector<std::pair<eflowRecCluster*,float> > PFTrackClusterMatchingTool::doMatches(const eflowRecTrack* track, const std::vector<eflowRecCluster*> clusters, int nMatches) const {
 
   /* Transform the vector of eflowRecCluster into a vector of eflowMatchClusters */
-  unsigned int nClusters = clusters.size();
   std::vector<const eflowMatchCluster*> matchClusters;
-  for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster) {
-      matchClusters.push_back(clusters.at(iCluster)->getMatchCluster());
+  for (auto& cluster : clusters) {
+      matchClusters.push_back(cluster->getMatchCluster());
   }
 
   /* Use the TrackClusterMatcher to retrieve the matches */
@@ -77,12 +71,12 @@ std::vector<eflowRecCluster*> PFTrackClusterMatchingTool::doMatches(const eflowR
   std::vector<MatchDistance> allMatches = m_matcher->bestMatches(&matchTrack, matchClusters, nMatches, 0.1*track->getTrack()->e());
 
   /* Transform the vector of MatchDistance objects into a vector of eflowRecClusters and return it */
-  std::vector<eflowRecCluster*> results;
-  for (unsigned int imatch = 0; imatch < allMatches.size(); ++imatch) {
+  std::vector<std::pair<eflowRecCluster*,float> > results;
+  for (MatchDistance& match : allMatches) {
     // The matching cannot change the cluster type, this started as eflowMatchCluster
     // and remains of that type -- no need to test cast from ICluster*
-    const eflowMatchCluster* thisMatch = static_cast<const eflowMatchCluster*>(allMatches.at(imatch).first);
-    results.push_back(thisMatch->getEfRecCluster());
+    const eflowMatchCluster* thisMatch = static_cast<const eflowMatchCluster*>(match.first);
+    results.push_back(std::make_pair(thisMatch->getEfRecCluster(),match.second));
   }
   return results;
 }
diff --git a/Reconstruction/egamma/egammaAlgs/CMakeLists.txt b/Reconstruction/egamma/egammaAlgs/CMakeLists.txt
index 1121c7dd6b85bdaf309e03c9bbcaf31a2082d3ce..b71e28930fe9f2377d0c8a3f4a3fd7257e369f0a 100644
--- a/Reconstruction/egamma/egammaAlgs/CMakeLists.txt
+++ b/Reconstruction/egamma/egammaAlgs/CMakeLists.txt
@@ -46,7 +46,7 @@ atlas_add_component( egammaAlgs
 		     MCTruthClassifierLib CaloGeoHelpers CaloUtilsLib CaloDetDescrLib AthenaKernel  StoreGateLib 
 		     xAODTracking InDetReadoutGeometry EgammaAnalysisInterfacesLib egammaRecEvent egammaUtils
 		     TrkToolInterfaces InDetRecToolInterfaces FourMomUtils RecoToolInterfaces TrkTrack 
-		     TrkPseudoMeasurementOnTrack InDetConversionFinderToolsLib TrkCaloExtension)
+		     TrkPseudoMeasurementOnTrack InDetConversionFinderToolsLib TrkCaloExtension egammaInterfacesLib )
 	     
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Reconstruction/tauRecTools/CMakeLists.txt b/Reconstruction/tauRecTools/CMakeLists.txt
index 657c3091f773327a6ec13bfcac5c44149f7e047c..bb9e0d8e1a3f8d049e3088c75cc34f414422d77f 100644
--- a/Reconstruction/tauRecTools/CMakeLists.txt
+++ b/Reconstruction/tauRecTools/CMakeLists.txt
@@ -42,9 +42,9 @@ if( XAOD_STANDALONE OR XAOD_ANALYSIS )
       PRIVATE_INCLUDE_DIRS ${FASTJETCONTRIB_INCLUDE_DIRS} ${LWTNN_INCLUDE_DIRS}
       LINK_LIBRARIES ${ROOT_LIBRARIES} ${FASTJET_LIBRARIES} ${Boost_LIBRARIES}
       AthLinks AsgTools CxxUtils xAODCaloEvent xAODEventInfo xAODPFlow xAODEgamma xAODTau
-      xAODTracking xAODParticleEvent AsgDataHandlesLib
+      xAODTracking xAODParticleEvent AsgDataHandlesLib  MVAUtils
       PRIVATE_LINK_LIBRARIES ${FASTJETCONTRIB_LIBRARIES} ${LWTNN_LIBRARIES} FourMomUtils xAODJet
-      PathResolver MVAUtils )
+      PathResolver )
 else()
    atlas_add_library( tauRecToolsLib
       tauRecTools/*.h Root/*.cxx tauRecTools/lwtnn/*.h Root/lwtnn/*.cxx  ${tauRecToolsLibCintDict}
@@ -54,9 +54,9 @@ else()
       PRIVATE_INCLUDE_DIRS ${FASTJETCONTRIB_INCLUDE_DIRS} ${LWTNN_INCLUDE_DIRS}
       LINK_LIBRARIES ${ROOT_LIBRARIES} ${FASTJET_LIBRARIES} ${Boost_LIBRARIES}
       AthLinks AsgTools CxxUtils xAODCaloEvent xAODEventInfo xAODPFlow xAODEgamma xAODTau
-      xAODTracking xAODParticleEvent CaloUtilsLib Particle AsgDataHandlesLib
-      PRIVATE_LINK_LIBRARIES ${FASTJETCONTRIB_LIBRARIES} ${LWTNN_LIBRARIES} FourMomUtils xAODJet
-      PathResolver MVAUtils ElectronPhotonSelectorToolsLib )
+      xAODTracking xAODParticleEvent CaloUtilsLib Particle AsgDataHandlesLib MVAUtils
+      PRIVATE_LINK_LIBRARIES ${FASTJETCONTRIB_LIBRARIES} ${LWTNN_LIBRARIES} FourMomUtils xAODJet BeamSpotConditionsData 
+      PathResolver ElectronPhotonSelectorToolsLib )
 endif()
 
 if( NOT XAOD_STANDALONE )
diff --git a/Simulation/Barcode/BarcodeEvent/CMakeLists.txt b/Simulation/Barcode/BarcodeEvent/CMakeLists.txt
index ba8c20be4d009086dc17f73c19cc63fac8e2ea97..52b7785e829b64fb037c781bc6a0f036b32005ca 100644
--- a/Simulation/Barcode/BarcodeEvent/CMakeLists.txt
+++ b/Simulation/Barcode/BarcodeEvent/CMakeLists.txt
@@ -5,10 +5,6 @@
 # Declare the package name:
 atlas_subdir( BarcodeEvent )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel )
-
 atlas_add_library( BarcodeEventLib
                    BarcodeEvent/*.h
                    INTERFACE
diff --git a/Simulation/Barcode/BarcodeInterfaces/CMakeLists.txt b/Simulation/Barcode/BarcodeInterfaces/CMakeLists.txt
index d2da87fff935257cb6b16366a31cc992c6adc202..ce92988d7a92d78ada162077e214d50531f7bc82 100644
--- a/Simulation/Barcode/BarcodeInterfaces/CMakeLists.txt
+++ b/Simulation/Barcode/BarcodeInterfaces/CMakeLists.txt
@@ -5,11 +5,6 @@
 # Declare the package name:
 atlas_subdir( BarcodeInterfaces )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          Simulation/Barcode/BarcodeEvent )
-
 atlas_add_library( BarcodeInterfacesLib
                    BarcodeInterfaces/*.h
                    INTERFACE
diff --git a/Simulation/Barcode/BarcodeServices/CMakeLists.txt b/Simulation/Barcode/BarcodeServices/CMakeLists.txt
index c50234e4d8e3f706846936003d2a35eed4359a9c..9652a53f8217827df9e95341996599f298eb8af4 100644
--- a/Simulation/Barcode/BarcodeServices/CMakeLists.txt
+++ b/Simulation/Barcode/BarcodeServices/CMakeLists.txt
@@ -5,13 +5,6 @@
 # Declare the package name:
 atlas_subdir( BarcodeServices )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          GaudiKernel
-                          Simulation/Barcode/BarcodeEvent
-                          Simulation/Barcode/BarcodeInterfaces )
-
 # External dependencies:
 find_package( ROOT COMPONENTS Cint Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint )
 
diff --git a/Simulation/BeamEffects/CMakeLists.txt b/Simulation/BeamEffects/CMakeLists.txt
index af8e055daed7eb84a0dc2cf0ccd54385d860bb70..a7f21d8b251b6e2318d0809325613d0fcc932da5 100644
--- a/Simulation/BeamEffects/CMakeLists.txt
+++ b/Simulation/BeamEffects/CMakeLists.txt
@@ -5,20 +5,6 @@
 # Declare the package name:
 atlas_subdir( BeamEffects )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          InnerDetector/InDetConditions/BeamSpotConditionsData
-                          PRIVATE
-                          AtlasTest/TestTools
-                          Control/AthenaBaseComps
-                          Control/StoreGate
-                          Event/EventInfo
-                          Generators/AtlasHepMC
-                          Generators/GeneratorObjects
-                          InnerDetector/InDetConditions/InDetBeamSpotService
-                          Simulation/Interfaces/HepMC_Interfaces )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( GTest )
diff --git a/Simulation/BeamEffects/src/GenEventVertexPositioner.cxx b/Simulation/BeamEffects/src/GenEventVertexPositioner.cxx
index 8a80e311bd3bc3c24d30b78260b4c6ac046a0f46..137ce080e370231835fa16dabf682d1ce5027021 100644
--- a/Simulation/BeamEffects/src/GenEventVertexPositioner.cxx
+++ b/Simulation/BeamEffects/src/GenEventVertexPositioner.cxx
@@ -86,7 +86,7 @@ namespace Simulation
       auto vtxItEnd = ge.vertices_end();
       for( ; vtxIt != vtxItEnd; ++vtxIt) {
         // quick access:
-        HepMC::GenVertex *curVtx = (*vtxIt);
+        auto curVtx = (*vtxIt);
         const HepMC::FourVector &curPos = curVtx->position();
 
         // get a copy of the current vertex position
diff --git a/Simulation/BeamEffects/src/ZeroLifetimePositioner.cxx b/Simulation/BeamEffects/src/ZeroLifetimePositioner.cxx
index 0b58be6c4d7ecd9fc914ee3b4a06f33d854f6ac0..227f709ddea75450334d773b5e6028bcbd8681a4 100644
--- a/Simulation/BeamEffects/src/ZeroLifetimePositioner.cxx
+++ b/Simulation/BeamEffects/src/ZeroLifetimePositioner.cxx
@@ -71,7 +71,7 @@ StatusCode Simulation::ZeroLifetimePositioner::manipulate(HepMC::GenEvent& ge, b
   const auto pdgCodesEnd = m_pdgCodesToCheck.end();
   for (; vtxIt != vtxItEnd; ++vtxIt) {
     // quick access:
-    HepMC::GenVertex *curVtx = (*vtxIt);
+    auto curVtx = (*vtxIt);
     if (curVtx->particles_in_size()!=1 || curVtx->particles_out_size()!=1) { continue; }
     const int pdgIn=(*(curVtx->particles_in_const_begin()))->pdg_id();
     const int pdgOut=(*(curVtx->particles_out_const_begin()))->pdg_id();
diff --git a/Simulation/Digitization/python/DigitizationParametersConfig.py b/Simulation/Digitization/python/DigitizationParametersConfig.py
index 1750134ad465f0c3bc84740624640dc7085d12b5..87f1fc7848f82c7dd1a44dd9e4050abce941e975 100644
--- a/Simulation/Digitization/python/DigitizationParametersConfig.py
+++ b/Simulation/Digitization/python/DigitizationParametersConfig.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
 
 from AthenaCommon.Logging import logging
 logDigitizationWriteMetadata = logging.getLogger( 'DigitizationParametersConfig' )
@@ -39,7 +39,7 @@ def writeDigitizationMetadata(ConfigFlags):
                           'DetDescrVersion' : 'GeoModel.AtlasVersion'
                       }
     logDigitizationWriteMetadata.info('Filling Digitization MetaData')
-    for testKey, testFlag in digitMetaDataKeys.iteritems():
+    for testKey, testFlag in digitMetaDataKeys.items():
         if ConfigFlags.hasFlag(testFlag):
             testValue = ConfigFlags._get(testFlag)
             if not isinstance(testValue, str):
diff --git a/Simulation/FastShower/FastCaloSim/CMakeLists.txt b/Simulation/FastShower/FastCaloSim/CMakeLists.txt
index a1a7948c7310f1fb91d46e22cbf3b15a7a99b896..fb7bdfb529ca5ef7bf9a6b2a2403ab3f4dfd4166 100644
--- a/Simulation/FastShower/FastCaloSim/CMakeLists.txt
+++ b/Simulation/FastShower/FastCaloSim/CMakeLists.txt
@@ -1,4 +1,3 @@
-
 ################################################################################
 # Package: FastCaloSim
 ################################################################################
@@ -6,46 +5,12 @@
 # Declare the package name:
 atlas_subdir( FastCaloSim )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Calorimeter/CaloDetDescr
-                          Calorimeter/CaloEvent
-                          Calorimeter/CaloIdentifier
-                          Calorimeter/CaloInterface
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          DetectorDescription/Identifier
-                          GaudiKernel
-                          LArCalorimeter/LArRecEvent
-                          Simulation/FastSimulation/FastSimulationEvent
-                          Simulation/FastShower/FastCaloSimAthenaPool
-                          TileCalorimeter/TileEvent
-                          Tracking/TrkEvent/TrkEventPrimitives
-                          Tracking/TrkEvent/TrkParameters
-                          Tracking/TrkExtrapolation/TrkExInterfaces
-                          Generators/GeneratorObjects
-                          Simulation/FastShower/FastCaloSimAthenaPool
-                          PRIVATE
-                          Generators/AtlasHepMC
-                          Control/AthAllocators
-                          Database/AthenaPOOL/AthenaPoolUtilities
-                          DetectorDescription/AtlasDetDescr
-                          DetectorDescription/DetDescrCond/DetDescrCondTools
-                          DetectorDescription/GeoPrimitives
-                          Event/EventKernel
-                          Event/NavFourMom
-                          Generators/TruthUtils
-                          Tools/PathResolver
-                          Tracking/TrkDetDescr/TrkGeometry
-                          Tracking/TrkDetDescr/TrkSurfaces
-                          Tracking/TrkEvent/TrkMaterialOnTrack )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Eigen )
 find_package( HepPDT )
 find_package( ROOT COMPONENTS Gpad Cint Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Html Postscript Gui GX11TTF GX11 )
+find_package( Boost )
 
 # this line failed automatic conversion in cmt2cmake :
 # macro_append FastCaloSim_cppflags " -DFastCaloSim_project_release_v1=`echo $(FastCaloSim_project_release) | awk -F. '{printf("'"'%d'"'",$$1)}'` "
@@ -78,11 +43,11 @@ atlas_add_library( FastCaloSimLib
                    src/TCellReweight.cxx
                    ${FastCaloSimLibDictSource}
                    PUBLIC_HEADERS FastCaloSim
-                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS}
-                   PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}  ${EIGEN_INCLUDE_DIRS}
+                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} 
+                   PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}  ${EIGEN_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} CaloEvent CaloIdentifier CaloInterfaceLib AthenaBaseComps AthenaKernel FastCaloSimAthenaPool FastSimulationEventLib Identifier GaudiKernel LArRecEvent TileEvent TrkEventPrimitives TrkParameters TrkExInterfaces CaloDetDescrLib StoreGateLib SGtests
-                   PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthAllocators AthenaPoolUtilities AtlasDetDescr DetDescrCondToolsLib GeoPrimitives EventKernel NavFourMom GeneratorObjects TruthUtils PathResolver TrkGeometry TrkSurfaces TrkMaterialOnTrack )
+                   PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${Boost_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthAllocators AthenaPoolUtilities AtlasDetDescr DetDescrCondToolsLib GeoPrimitives EventKernel NavFourMom GeneratorObjects TruthUtils PathResolver TrkGeometry TrkSurfaces TrkMaterialOnTrack )
 
 atlas_add_component( FastCaloSim
                      src/components/*.cxx
@@ -93,13 +58,11 @@ atlas_add_component( FastCaloSim
 atlas_install_python_modules( python/*.py )
 atlas_install_joboptions( share/*.py )
 
-
 atlas_add_test( FastShowerCellBuilderTool_test
   SCRIPT test/FastShowerCellBuilderTool_test.sh
   PROPERTIES TIMEOUT 600
   LOG_SELECT_PATTERN "ERROR|error|WARNING [^U]|FATAL|processing|TestAlg|xxx" )
 
-
 atlas_add_test( AddNoiseCellBuilderToolConfigTest_test
                 SCRIPT python -m FastCaloSim.AddNoiseCellBuilderToolConfig
                 LOG_SELECT_PATTERN "ComponentAccumulator|^---|^IOVDbSvc" )
diff --git a/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx b/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx
index e3b5065e0dd107b3562e87fa5486a2eebcb42988..15d5479fc7652597130c065b2bea3c624a9a9570 100755
--- a/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx
+++ b/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx
@@ -75,6 +75,7 @@
 
 #include "FastCaloSimAthenaPool/FastShowerInfo.h"
 #include "FastCaloSimAthenaPool/FastShowerInfoContainer.h"
+#include "boost/algorithm/string.hpp"
 #include <string>
 #include <iostream>
 #include <sstream>
@@ -201,7 +202,6 @@ void FastShowerCellBuilderTool::LoadParametrizationsFromDir(std::string dir)
   TSystemDirectory d(dirname,dirname);
   TList* files=d.GetListOfFiles();
   for(int i=0;i<files->GetSize();++i) if(files->At(i)){
-      //    cout<<i<<" : "<<files->At(i)->GetName()<<" = "<<files->At(i)->GetTitle()<<endl;
       TString name=files->At(i)->GetName();
       if(name.Index(".root")==kNPOS) continue;
       name.ReplaceAll(".root","");
@@ -512,7 +512,7 @@ StatusCode FastShowerCellBuilderTool::OpenParamSource(std::string insource)
 {
   if(insource=="") return StatusCode::SUCCESS;
 
-  if(insource.find("DB=")==0) {
+  if(boost::starts_with (insource, "DB=")) {
     const unsigned int maxdbINFOoutput=2;
     if(m_DB_folder.size()>=maxdbINFOoutput && ( !msgLvl(MSG::DEBUG) ) ) {
       if(m_DB_folder.size()==maxdbINFOoutput) ATH_MSG_INFO("... skipping extra INFO output for further DB registration ...");
@@ -716,24 +716,24 @@ ParticleEnergyParametrization* FastShowerCellBuilderTool::findElower(int id,doub
   if(iter_id!=m_map_ParticleEnergyParametrizationMap.end()) {
     ATH_MSG_DEBUG("ID found="<<iter_id->first);
     t_map_PEP_Energy::const_iterator iter_E=iter_id->second.lower_bound(E);
-    if(iter_E==iter_id->second.end()) iter_E--;
+    if(iter_E==iter_id->second.end()) --iter_E;
     if(iter_E!=iter_id->second.end()) {
-      if(iter_E->first>=E && iter_E!=iter_id->second.begin()) iter_E--;
+      if(iter_E->first>=E && iter_E!=iter_id->second.begin()) --iter_E;
       ATH_MSG_DEBUG("E found="<<iter_E->first);
       // first para_eta > fabs_eta  !! might be wrong !!
       double aeta=fabs(eta);
       t_map_PEP_Eta::const_iterator iter_eta=iter_E->second.lower_bound(aeta);
 
-      if(iter_eta!=iter_E->second.begin())  iter_eta--;
+      if(iter_eta!=iter_E->second.begin())  --iter_eta;
       if(m_energy_eta_selection){
         ATH_MSG_DEBUG(" new eta selection for energy paramertization is used ");
-        if(iter_eta==iter_E->second.end()) iter_eta--;
+        if(iter_eta==iter_E->second.end()) --iter_eta;
         if(iter_eta!=iter_E->second.end()) {
 
           t_map_PEP_Eta::const_iterator best(iter_eta);
           double deta_best=fabs(best->first - aeta);
           while(iter_eta->first < aeta ) {
-            iter_eta++;
+            ++iter_eta;
             if(iter_eta!=iter_E->second.end()) {
               if(fabs(iter_eta->first-aeta) < deta_best) {
                 best=iter_eta;
@@ -791,20 +791,20 @@ ParticleEnergyParametrization* FastShowerCellBuilderTool::findEupper(int id,doub
   if(iter_id!=m_map_ParticleEnergyParametrizationMap.end()) {
     ATH_MSG_DEBUG("ID found="<<iter_id->first);
     t_map_PEP_Energy::const_iterator iter_E=iter_id->second.lower_bound(E);
-    if(iter_E==iter_id->second.end()) iter_E--;
+    if(iter_E==iter_id->second.end()) --iter_E;
     if(iter_E!=iter_id->second.end()) {
       ATH_MSG_DEBUG("E found="<<iter_E->first);
       double aeta=fabs(eta);
       t_map_PEP_Eta::const_iterator iter_eta=iter_E->second.lower_bound(aeta);
-      if(iter_eta!=iter_E->second.begin())  iter_eta--;
+      if(iter_eta!=iter_E->second.begin())  --iter_eta;
       if(m_energy_eta_selection){
-        if(iter_eta==iter_E->second.end()) iter_eta--;
+        if(iter_eta==iter_E->second.end()) --iter_eta;
         if(iter_eta!=iter_E->second.end()) {
 
           t_map_PEP_Eta::const_iterator best(iter_eta);
           double deta_best=fabs(best->first - aeta);
           while(iter_eta->first < aeta ) {
-            iter_eta++;
+            ++iter_eta;
             if(iter_eta!=iter_E->second.end()) {
               if(fabs(iter_eta->first-aeta) < deta_best) {
                 best=iter_eta;
@@ -868,11 +868,11 @@ const TShape_Result* FastShowerCellBuilderTool::findShape (int id,int calosample
       ATH_MSG_DEBUG("calosample found="<<iter_cs->first);
 
       t_map_PSP_Energy::const_iterator iter_E=iter_cs->second.lower_bound(E);
-      if(iter_E==iter_cs->second.end()) iter_E--;
+      if(iter_E==iter_cs->second.end()) --iter_E;
       double edist=fabs(iter_E->first - E);
       if(iter_E!=iter_cs->second.begin()) {
         t_map_PSP_Energy::const_iterator iter_Etest=iter_E;
-        iter_Etest--;
+        --iter_Etest;
         double edisttest=fabs(iter_Etest->first - E);
         if(edisttest<edist) iter_E=iter_Etest;
       }
@@ -967,7 +967,7 @@ FastShowerCellBuilderTool::get_calo_etaphi(std::vector<Trk::HitInfo>* hitVector,
   double best_target=0;
 
   std::vector<Trk::HitInfo>::iterator it = hitVector->begin();
-  while ( it!= hitVector->end() && it->detID != (3000+sample) ) { it++;}
+  while ( it!= hitVector->end() && it->detID != (3000+sample) ) { ++it;}
   //while ((*it).detID != (3000+sample) && it < hitVector->end() )  it++;
 
   if (it!=hitVector->end()) {
@@ -1026,8 +1026,8 @@ FastShowerCellBuilderTool::get_calo_etaphi(std::vector<Trk::HitInfo>* hitVector,
     while (it < hitVector->end()-1 ) {
       Amg::Vector3D hitPos1 = (*it).trackParms->position();
       int sid1=(*it).detID;
-      it++;
-      if ((hitPos1-it->trackParms->position()).mag()<0.001 ) it++; // ST exit and entry to the next layer may coincide
+      ++it;
+      if ((hitPos1-it->trackParms->position()).mag()<0.001 ) ++it; // ST exit and entry to the next layer may coincide
       if (it==hitVector->end()) break;
       Amg::Vector3D hitPos2 = (*it).trackParms->position();
       int sid2=(*it).detID;
@@ -1126,7 +1126,7 @@ FastShowerCellBuilderTool::get_calo_surface(std::vector<Trk::HitInfo>* hitVector
   for(int i=0;i<m_n_surfacelist;++i) {
     CaloCell_ID_FCS::CaloSample sample=m_surfacelist[i];
     std::vector<Trk::HitInfo>::iterator it = hitVector->begin();
-    while (it != hitVector->end() && it->detID != (3000+sample) )  { it++;}
+    while (it != hitVector->end() && it->detID != (3000+sample) )  { ++it;}
     if(it==hitVector->end()) continue;
     Amg::Vector3D hitPos = (*it).trackParms->position();
 
@@ -1164,7 +1164,7 @@ FastShowerCellBuilderTool::get_calo_surface(std::vector<Trk::HitInfo>* hitVector
   if(sample_calo_surf==CaloCell_ID_FCS::noSample) {
     // first intersection with sensitive calo layer
     std::vector<Trk::HitInfo>::iterator it = hitVector->begin();
-    while ( it < hitVector->end() && (*it).detID != 3 ) { it++;}   // to be updated
+    while ( it < hitVector->end() && (*it).detID != 3 ) { ++it;}   // to be updated
     if (it==hitVector->end())   {  // no calo intersection, abort
       return false;
     }
@@ -1321,7 +1321,7 @@ FastShowerCellBuilderTool::process_particle(CaloCellContainer* theCellContainer,
       int sample=(*it).detID;
       Amg::Vector3D hitPos = (*it).trackParms->position();
       ATH_MSG_DEBUG(" HIT: layer="<<sample-3000<<" eta="<<hitPos.eta()<<" phi="<<hitPos.phi()<<" d="<<hitPos.mag());
-      it++;
+      ++it;
     }
   }
 
@@ -1373,7 +1373,7 @@ FastShowerCellBuilderTool::process_particle(CaloCellContainer* theCellContainer,
     }
     // loop over intersection
     std::vector<Trk::HitInfo>::iterator it = hitVector->begin();
-    while (it < hitVector->end() && (*it).detID != -3 )  { it++;}   // to be updated
+    while (it < hitVector->end() && (*it).detID != -3 )  { ++it;}   // to be updated
     if(it!=hitVector->end()) {
       Amg::Vector3D hitPos = (*it).trackParms->position();
       CaloCell_ID_FCS::CaloSample sample = (CaloCell_ID_FCS::CaloSample)((*it).detID-3000);    // to be updated
@@ -1382,7 +1382,7 @@ FastShowerCellBuilderTool::process_particle(CaloCellContainer* theCellContainer,
       double dCurr = hitPos.mag();
       while ( it < hitVector->end()-1 )  {
         // step to the layer exit to evaluate the deposit
-        it++;
+        ++it;
         pCurr = (*it).trackParms->momentum().mag();
         double edeposit = pLast - pCurr; // to be updated! Includes dead material energy loss in calo deposit
         hitPos = (*it).trackParms->position();
@@ -1886,19 +1886,6 @@ FastShowerCellBuilderTool::process_particle(CaloCellContainer* theCellContainer,
           //          const CaloDetDescrElement* cell=theDDE[i][icell];
           double ecell=E_theDDE[icell]*p.E_layer[sample]/elayertot;
           if(ecell<=0) continue;
-          //          log<<MSG::DEBUG<<"layer "<<i<<" cell eta="<<cell->eta()<<" phi="<<cell->phi()<<" Eorg="<<ecell;
-
-          /*
-            if(ecell/p.E_layer[sample]>0.01) {
-            const CaloDetDescrElement* cell=theDDE[icell];
-            log << MSG::DEBUG <<" ceta="<<cell->eta()<<" cphi="<<cell->phi()<<" E="<<ecell;
-            if(ibestcell) {
-            const CaloDetDescrElement* bestcell=theDDE[ibestcell];
-            log <<" dhit :deta="<<cell->eta()-bestcell->eta()<<" dphi="<<TVector2::Phi_mpi_pi( cell->phi() - bestcell->phi() );
-            }
-            log <<endmsg;
-            }
-          */
 
           CLHEP::HepRandomEngine* engine = m_randomEngine->getEngine (ctx);
           double rndfactor=-1;
@@ -1921,15 +1908,12 @@ FastShowerCellBuilderTool::process_particle(CaloCellContainer* theCellContainer,
 
           CaloCell* theCaloCell=theCellContainer->findCell(cell->calo_hash());
           if(theCaloCell) {
-            //            log << MSG::VERBOSE << "found calo cell : eta=" <<theCaloCell->caloDDE()->eta()<<" phi="<<theCaloCell->caloDDE()->phi()<<" overlap="<<iter->second<<"old e=" <<theCaloCell->energy()<< " ; new e=" <<theCaloCell->energy()+energy*iter->second<< endmsg;
             theCaloCell->setEnergy(theCaloCell->energy()+ecell);
 
             if(m_storeFastShowerInfo) fastshowerinfo->AddCellEFinal(sample, ecell );
           } else {
             ATH_MSG_WARNING("det_elm found eta=" <<cell->eta()<<" phi="<<cell->phi()<<" hash="<<cell->calo_hash()
                             << " : e=" <<ecell<< " not filled!!! doing nothing!!!");
-            //            theCaloCell=new CaloCell(cell,ecell,0,1,CaloGain::UNKNOWNGAIN);
-            //            theCellContainer->push_back(theCaloCell);
 
             if(m_storeFastShowerInfo) fastshowerinfo->AddCellEFinal(sample);
           }
@@ -2042,7 +2026,7 @@ FastShowerCellBuilderTool::flag_simul_sate FastShowerCellBuilderTool::Is_below_v
     int nother=0;
     for(HepMC::GenVertex::particles_out_const_iterator pout=ver->particles_out_const_begin();pout!=ver->particles_out_const_end();++pout) {
       const HepMC::GenParticle* par=*pout;
-      int absid=abs(par->pdg_id());
+      int absid=std::abs(par->pdg_id());
       if(absid==22) {
         ++ngamma;
       } else {
@@ -2076,8 +2060,8 @@ void MC_init_particle_simul_state(MCdo_simul_state& do_simul_state,const MCparti
     const HepMC::GenParticle* par=*ip;
     if(par) {
       do_simul_state[par->barcode()]=1;
-      HepMC::GenVertex* outver=par->end_vertex();
-      HepMC::GenVertex* inver =par->production_vertex();
+      auto outver=par->end_vertex();
+      auto inver =par->production_vertex();
       if(outver) {
         do_simul_state[outver->barcode()]=1;
       }
@@ -2126,7 +2110,7 @@ void FastShowerCellBuilderTool::MC_remove_out_of_ID(MCdo_simul_state& do_simul_s
     if(par) {
       if(do_simul_state[par->barcode()]<=0) continue;
 
-      HepMC::GenVertex* inver =par->production_vertex();
+      auto inver =par->production_vertex();
       if(inver) {
         if(!Is_ID_Vertex(inver)) {
           int nin=0;
@@ -2177,7 +2161,7 @@ void FastShowerCellBuilderTool::MC_remove_below_v14_truth_cuts(MCdo_simul_state&
     if(par) {
       if(do_simul_state[par->barcode()]<=0) continue;
 
-      HepMC::GenVertex* outver =par->end_vertex();
+      auto outver =par->end_vertex();
       if(outver) {
         if(outver->barcode()>=-200000) continue;
 
@@ -2198,7 +2182,7 @@ void MC_remove_decay_to_simul(MCdo_simul_state& do_simul_state,const MCparticleC
     if(par) {
       if(do_simul_state[par->barcode()]<=0) continue;
 
-      HepMC::GenVertex* inver =par->production_vertex();
+      auto inver =par->production_vertex();
       if(inver) {
         MC_recursive_remove_in_particles(do_simul_state,inver,FastShowerCellBuilderTool::mother_particle);
       }
@@ -2258,8 +2242,6 @@ FastShowerCellBuilderTool::process (CaloCellContainer* theCellContainer,
     return StatusCode::FAILURE;
   }
 
-  //FastCaloSimIsGenSimulStable ifs;
-  //TruthHelper::IsGenNonInteracting invisible;
 
   MCparticleCollection particles;
   MCparticleCollection Simulparticles;
@@ -2278,7 +2260,6 @@ FastShowerCellBuilderTool::process (CaloCellContainer* theCellContainer,
         {
           particles.push_back(*istart);
         }
-      //std::cout <<std::endl;
     }
   particles = MC::filter_keep(particles, FastCaloSimIsGenSimulStable);
 
@@ -2365,8 +2346,8 @@ FastShowerCellBuilderTool::process (CaloCellContainer* theCellContainer,
       msg(MSG::DEBUG)<<reason;
 
       msg()<<indpar<<": id="<<par->pdg_id()<<" stat="<<par->status()<<" pt="<<par->momentum().perp()<<" eta="<<par->momentum().eta()<<" phi="<<par->momentum().phi();
-      HepMC::GenVertex*  inver =par->production_vertex();
-      HepMC::GenVertex* outver =par->end_vertex();
+      auto  inver =par->production_vertex();
+      auto outver =par->end_vertex();
       if(inver) {
         double inr=inver->position().perp();
         double inz=inver->position().z();
@@ -2459,27 +2440,6 @@ FastShowerCellBuilderTool::process (CaloCellContainer* theCellContainer,
 
     ++stat_npar;
   }
-  //std::cout <<"ZH Processed: "<<stat_npar<<"(ok: "<<stat_npar_nOK<<")"<<std::endl;
-  /*
-    MCparticleCollection all_particles;
-    log <<MSG::DEBUG<<"Start getting all particles"<<endmsg;
-    sc = m_gentesIO->getMC(all_particles, m_mcLocation );
-
-    if ( sc.isFailure() ) {
-    log << MSG::ERROR << "getMC from "<<m_mcLocation<<" failed "<< endmsg;
-    return StatusCode::FAILURE;
-    }
-
-    log <<MSG::INFO<<"Got all particles n="<<all_particles.size()<<endmsg;
-    for(ip=all_particles.begin(); ip<all_particles.end(); ++ip){
-    const HepMC::GenParticle* par=*ip;
-    if(abs(par->pdg_id())!=15) continue;
-    std::vector<double> sums(3);
-    sums[0]=sums[1]=sums[2]=0;
-    sum_par(par,log,sums,0);
-    print_par(par,log,0);
-    }
-  */
 
   ATH_MSG_DEBUG("Executing finished calo size=" <<theCellContainer->size()<<"; "<<stat_npar<<" particle(s), "<<stat_npar_OK<<" with sc=SUCCESS");
 
@@ -2531,36 +2491,6 @@ StatusCode FastShowerCellBuilderTool::releaseEvent (Stats& stats) const
 }
 
 
-/*
-  void FastShowerCellBuilderTool::deflectParticles(ITransportedParticleCollection &itpc)
-  {
-  MsgStream log( msgSvc(), name() );
-  log << MSG::DEBUG << "FastShowerCellBuilderTool deflectParticles()" << endmsg;
-
-  // read MC particles from TES
-  typedef std::vector<const HepMC::GenParticle*>  MCparticleCollection ;
-  typedef std::vector<const HepMC::GenParticle*>::const_iterator  MCparticleCollectionCIter ;
-
-  MCparticleCollection p;
-  TesIoStat stat = m_tesIO->getMC( p, m_mcSelector ) ;
-  std::string mess;
-  mess = stat? "Retrieved MC from TES ":"Failed MC retrieve from TES ";
-  log << MSG::DEBUG << mess << p.size()<<endmsg;
-
-  MCparticleCollectionCIter ip= p.begin();
-  for(; ip<p.end(); ++ip){
-  deflectParticle(itpc,*ip);
-  }
-  }
-
-  void FastShowerCellBuilderTool::deflectParticle(Atlfast::ITransportedParticleCollection &itpc,const HepMC::GenParticle* par)
-  {
-  ITransportedParticle *itp = new TransportedHelixParticle(par);
-  itp->deflect();
-  itpc.push_back(itp);
-  }
-
-*/
 
 std::vector<Trk::HitInfo>* FastShowerCellBuilderTool::caloHits(const HepMC::GenParticle& part) const
 {
diff --git a/Simulation/FastShower/FastCaloSim/src/obsolete/CBNTAA_DetailedCellInfo.cxx b/Simulation/FastShower/FastCaloSim/src/obsolete/CBNTAA_DetailedCellInfo.cxx
index 9230faa21c8962a459a188cbf983e646256a77b2..6beed615ced27501eb7f48134dd543007c5a0e24 100644
--- a/Simulation/FastShower/FastCaloSim/src/obsolete/CBNTAA_DetailedCellInfo.cxx
+++ b/Simulation/FastShower/FastCaloSim/src/obsolete/CBNTAA_DetailedCellInfo.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
 */
 
 // class CBNT_DetailedCellInfo 
@@ -306,7 +306,7 @@ StatusCode CBNTAA_DetailedCellInfo::CBNT_execute()
    std::vector<std::string>::iterator iter;
 
 
-   for (iter=m_CalibrationContainerNames.begin();iter!=m_CalibrationContainerNames.end();iter++) {
+   for (iter=m_CalibrationContainerNames.begin();iter!=m_CalibrationContainerNames.end();++iter) {
      sc = m_storeGate->retrieve(clbc,*iter);
      if (sc.isFailure()) {
        log << MSG::ERROR << "Cannot retrieve calibration container" << endmsg;
@@ -315,7 +315,7 @@ StatusCode CBNTAA_DetailedCellInfo::CBNT_execute()
      }
    }
 
-   for (iter=m_CalibrationContainerInactiveNames.begin();iter!=m_CalibrationContainerInactiveNames.end();iter++) {
+   for (iter=m_CalibrationContainerInactiveNames.begin();iter!=m_CalibrationContainerInactiveNames.end();++iter) {
      sc = m_storeGate->retrieve(clbc,*iter);
      if (sc.isFailure()) {
        log << MSG::ERROR << "Cannot retrieve calibration container (Inactive)" << endmsg;
@@ -367,11 +367,11 @@ StatusCode CBNTAA_DetailedCellInfo::CBNT_execute()
          
 
          std::vector<const CaloCalibrationHitContainer * >::const_iterator it;
-         for (it=v_clbc.begin();it!=v_clbc.end();it++) {
+         for (it=v_clbc.begin();it!=v_clbc.end();++it) {
            CaloCalibrationHitContainer::const_iterator first_calib_cell;
            CaloCalibrationHitContainer::const_iterator last_calib_cell  = (*it)->end();
            //loop over cells in calibration container
-           for(first_calib_cell = (*it)->begin();first_calib_cell!=last_calib_cell;first_calib_cell++) 
+           for(first_calib_cell = (*it)->begin();first_calib_cell!=last_calib_cell;++first_calib_cell) 
            {
              if ((*first_calib_cell)->cellID()==cell->ID())
              {
@@ -393,11 +393,11 @@ StatusCode CBNTAA_DetailedCellInfo::CBNT_execute()
          }  //end of loop over all calibration containers
 
          std::vector<const CaloCalibrationHitContainer * >::const_iterator itInactive;
-         for (itInactive=v_clbcInactive.begin();itInactive!=v_clbcInactive.end();itInactive++) {
+         for (itInactive=v_clbcInactive.begin();itInactive!=v_clbcInactive.end();++itInactive) {
            CaloCalibrationHitContainer::const_iterator first_calib_cell;
            CaloCalibrationHitContainer::const_iterator last_calib_cell  = (*itInactive)->end();
            //loop over cells in calibration container
-           for(first_calib_cell = (*itInactive)->begin();first_calib_cell!=last_calib_cell;first_calib_cell++) 
+           for(first_calib_cell = (*itInactive)->begin();first_calib_cell!=last_calib_cell;++first_calib_cell) 
            {
              if ((*first_calib_cell)->cellID()==cell->ID())
              {
diff --git a/Simulation/FastShower/FastCaloSimAthenaPool/CMakeLists.txt b/Simulation/FastShower/FastCaloSimAthenaPool/CMakeLists.txt
index e57d8d5defd6a25c5eba02b9c9b47f0ae2233461..0107bea909de5a78e7ad34720e754e8897a5c7e4 100644
--- a/Simulation/FastShower/FastCaloSimAthenaPool/CMakeLists.txt
+++ b/Simulation/FastShower/FastCaloSimAthenaPool/CMakeLists.txt
@@ -5,14 +5,6 @@
 # Declare the package name:
 atlas_subdir( FastCaloSimAthenaPool )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          Control/AthContainers
-                          Database/AthenaPOOL/AthenaPoolUtilities
-                          PRIVATE
-                          Database/AthenaPOOL/AthenaPoolCnvSvc )
-
 # External dependencies:
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 
diff --git a/Simulation/FastShower/FastCaloSimHit/CMakeLists.txt b/Simulation/FastShower/FastCaloSimHit/CMakeLists.txt
index 44163416e8927a8a1de4ebb7686e235f0672d43b..57b94c241260daf6f4131875f7fb2330bc46526e 100644
--- a/Simulation/FastShower/FastCaloSimHit/CMakeLists.txt
+++ b/Simulation/FastShower/FastCaloSimHit/CMakeLists.txt
@@ -5,23 +5,6 @@
 # Declare the package name:
 atlas_subdir( FastCaloSimHit )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Calorimeter/CaloInterface
-                          Control/AthenaBaseComps
-                          Control/StoreGate
-                          GaudiKernel
-                          LArCalorimeter/LArElecCalib
-                          LArCalorimeter/LArSimEvent
-                          TileCalorimeter/TileSimEvent
-                          PRIVATE
-                          Calorimeter/CaloEvent
-                          Calorimeter/CaloIdentifier
-                          Control/PileUpTools
-                          Event/EventInfo
-                          TileCalorimeter/TileConditions
-                          TileCalorimeter/TileEvent )
-
 # this line failed automatic conversion in cmt2cmake :
 # macro_append FastCaloSimHit_cppflags " -DFastCaloSimHit_project_release_v1=`echo $(FastCaloSimHit_project_release) | awk -F. '{printf("'"'%d'"'",$$1)}'` "
 
diff --git a/Simulation/FastSimulation/FastChainPileup/CMakeLists.txt b/Simulation/FastSimulation/FastChainPileup/CMakeLists.txt
index 27d35d423bd84e57f431a5fd749f976a63fa1220..36897620e3639a3bf25a00bbc8cbb14577b97904 100644
--- a/Simulation/FastSimulation/FastChainPileup/CMakeLists.txt
+++ b/Simulation/FastSimulation/FastChainPileup/CMakeLists.txt
@@ -5,12 +5,6 @@
 # Declare the package name:
 atlas_subdir( FastChainPileup )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          Generators/GeneratorModules
-                          Generators/Pythia8_i )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Lhapdf )
diff --git a/Simulation/FastSimulation/FastSimulationEvent/CMakeLists.txt b/Simulation/FastSimulation/FastSimulationEvent/CMakeLists.txt
index f67c472d0da9ba4a16925f71985ac3042cbf5c28..e33223b8c37d22586fbbc1b390476db8ae2f8a95 100644
--- a/Simulation/FastSimulation/FastSimulationEvent/CMakeLists.txt
+++ b/Simulation/FastSimulation/FastSimulationEvent/CMakeLists.txt
@@ -5,12 +5,6 @@
 # Declare the package name:
 atlas_subdir( FastSimulationEvent )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          DetectorDescription/GeoPrimitives
-                          Tracking/TrkEvent/TrkMaterialOnTrack )
-
 atlas_add_library( FastSimulationEventLib
                    src/*.cxx
                    PUBLIC_HEADERS FastSimulationEvent
diff --git a/Simulation/FastSimulation/FastSimulationJobTransforms/CMakeLists.txt b/Simulation/FastSimulation/FastSimulationJobTransforms/CMakeLists.txt
index dc28e770d75e8715579ca73ae4166ef4145674e6..7011cb9dae29890ce638a7948c04ae5a5efd2c2f 100644
--- a/Simulation/FastSimulation/FastSimulationJobTransforms/CMakeLists.txt
+++ b/Simulation/FastSimulation/FastSimulationJobTransforms/CMakeLists.txt
@@ -5,10 +5,6 @@
 # Declare the package name:
 atlas_subdir( FastSimulationJobTransforms )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Tools/PyJobTransformsCore )
-
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
 atlas_install_runtime( share/*.db share/*.root )
diff --git a/Simulation/G4Atlas/G4AtlasAlg/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasAlg/CMakeLists.txt
index 3a0b865f076d76e78956197bcf90ed3a99fd5f3a..e8f309127a313b33a22ce857dd77734bb5a08897 100644
--- a/Simulation/G4Atlas/G4AtlasAlg/CMakeLists.txt
+++ b/Simulation/G4Atlas/G4AtlasAlg/CMakeLists.txt
@@ -5,23 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4AtlasAlg )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/SGTools
-                          Control/StoreGate
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          Event/EventInfo
-                          Generators/AtlasHepMC
-                          Generators/GeneratorObjects
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Sim/MCTruthBase
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Simulation/Barcode/BarcodeInterfaces)
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Atlas/G4AtlasApps/share/jobOptions.G4Atlas.py b/Simulation/G4Atlas/G4AtlasApps/share/jobOptions.G4Atlas.py
index 39b292a2a46167304427d8b2e63de187366e4c7f..ad90fb5964ad389fda6a5aead98ed6041c095cf3 100644
--- a/Simulation/G4Atlas/G4AtlasApps/share/jobOptions.G4Atlas.py
+++ b/Simulation/G4Atlas/G4AtlasApps/share/jobOptions.G4Atlas.py
@@ -1,4 +1,7 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 ## Job options file for Geant4 ATLAS detector simulations
+from __future__ import print_function
 
 ## Algorithm sequence
 from AthenaCommon.AlgSequence import AlgSequence
@@ -74,7 +77,7 @@ pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(), randomStream="
 pg.sampler.pid = 999 #Geantino
 pg.sampler.mom = PG.EEtaMPhiSampler(energy=50000, eta=[-3,3])
 topSeq += pg
-print topSeq.ParticleGun
+print (topSeq.ParticleGun)
 
 # This should only be used when evgen is run in the simulation step
 include('G4AtlasApps/fragment.SimCopyWeights.py')
@@ -90,4 +93,4 @@ topSeq += getAlgorithm("BeamEffectsAlg", tryDefaultConfigurable=True)
 ## Add the G4 sim to the alg sequence after the generator
 from AthenaCommon.CfgGetter import getAlgorithm
 topSeq += getAlgorithm("G4AtlasAlg",tryDefaultConfigurable=True)
-print topSeq
+print (topSeq)
diff --git a/Simulation/G4Atlas/G4AtlasControl/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasControl/CMakeLists.txt
index 174a9b4e7158aca148b4e16d1d5d5d16b98a93a9..610639715ccbeaef2b7c1aefed5dca819a9ea377 100644
--- a/Simulation/G4Atlas/G4AtlasControl/CMakeLists.txt
+++ b/Simulation/G4Atlas/G4AtlasControl/CMakeLists.txt
@@ -5,10 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4AtlasControl )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Atlas/G4AtlasInterfaces/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasInterfaces/CMakeLists.txt
index 0e1ad60a3a9a565b71a6c4ca3afeb6c83091b1a8..a83257fe233b62a4407e15f32d118c3f43c808fb 100644
--- a/Simulation/G4Atlas/G4AtlasInterfaces/CMakeLists.txt
+++ b/Simulation/G4Atlas/G4AtlasInterfaces/CMakeLists.txt
@@ -5,10 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4AtlasInterfaces )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Atlas/G4AtlasServices/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasServices/CMakeLists.txt
index 7f2c059c510cbd57c9545082b52b78bb05c4103e..2d735a12d06a67ac253d5e95567b77b5be823ce9 100644
--- a/Simulation/G4Atlas/G4AtlasServices/CMakeLists.txt
+++ b/Simulation/G4Atlas/G4AtlasServices/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4AtlasServices )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          MagneticField/MagFieldInterfaces
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Utilities/G4PhysicsLists )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
@@ -38,7 +28,6 @@ atlas_add_test( G4AtlasServicesConfig_test
                 SCRIPT test/G4AtlasServicesConfig_test.py
                 PROPERTIES TIMEOUT 300 )
 
-
 # Install files from the package:
 atlas_install_python_modules( python/*.py
                               POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Simulation/G4Atlas/G4AtlasTests/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasTests/CMakeLists.txt
index 8a41c26951af14add8ce239df61e3a5b2c7b15aa..080911d598b8fbc4d3e193c4e69cfc07acb25700 100644
--- a/Simulation/G4Atlas/G4AtlasTests/CMakeLists.txt
+++ b/Simulation/G4Atlas/G4AtlasTests/CMakeLists.txt
@@ -5,40 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4AtlasTests )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          GaudiKernel
-                          PRIVATE
-                          Calorimeter/CaloDetDescr
-                          Calorimeter/CaloIdentifier
-                          Calorimeter/CaloSimEvent
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          DetectorDescription/GeoModel/GeoAdaptors
-                          DetectorDescription/GeoPrimitives
-                          DetectorDescription/Identifier
-                          Event/EventInfo
-                          ForwardDetectors/ALFA/ALFA_SimEv
-                          ForwardDetectors/LUCID/LUCID_SimUtils/LUCID_SimEvent
-                          ForwardDetectors/ZDC/ZDC_SimEvent
-                          Generators/AtlasHepMC
-                          Generators/GeneratorObjects
-                          InnerDetector/InDetSimEvent
-                          LArCalorimeter/LArSimEvent
-                          MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry
-                          MuonSpectrometer/MuonIdHelpers
-                          MuonSpectrometer/MuonSimEvent
-                          PhysicsAnalysis/TruthParticleID/McParticleEvent
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/MCTruth
-                          Simulation/G4Sim/TrackRecord
-                          Simulation/HitManagement
-                          TileCalorimeter/TileDetDescr
-                          TileCalorimeter/TileIdentifier
-                          TileCalorimeter/TileSimEvent )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Eigen )
diff --git a/Simulation/G4Atlas/G4AtlasTests/src/LArHitsTestTool.cxx b/Simulation/G4Atlas/G4AtlasTests/src/LArHitsTestTool.cxx
index 4ae39cccf85a9a23097a0f7afed97942ba1a395d..9ef784c2451cb3b87237e1beba01baa19386cceb 100644
--- a/Simulation/G4Atlas/G4AtlasTests/src/LArHitsTestTool.cxx
+++ b/Simulation/G4Atlas/G4AtlasTests/src/LArHitsTestTool.cxx
@@ -243,7 +243,7 @@ StatusCode LArHitsTestTool::processEvent() {
       }
     }
   }
-  const HepMC::GenParticle *primary = getPrimary();
+  auto primary = getPrimary();
   if (primary) {
     m_etot_eta->Fill(primary->momentum().eta(),etot);
     m_etot_phi->Fill(primary->momentum().phi(),etot);
diff --git a/Simulation/G4Atlas/G4AtlasTools/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasTools/CMakeLists.txt
index b2485364a4392c1a9a8b1f8df0653134c9b7e902..3b62b1c8dd7a3657f4b4f1176f2a99f1f39439ec 100644
--- a/Simulation/G4Atlas/G4AtlasTools/CMakeLists.txt
+++ b/Simulation/G4Atlas/G4AtlasTools/CMakeLists.txt
@@ -5,14 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4AtlasTools )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          AtlasGeometryCommon/SubDetectorEnvelopes
-                          Control/AthenaBaseComps
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          PRIVATE
-                          GaudiKernel )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( CLHEP )
@@ -36,7 +28,6 @@ atlas_add_component( G4AtlasTools
                      INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS}
                      LINK_LIBRARIES ${Boost_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} ${TBB_LIBRARIES} AthenaBaseComps G4AtlasInterfaces GaudiKernel G4AtlasToolsLib )
 
-
 #testing just the simulation parts, no forward detectors or region
 atlas_add_test( G4GeometryToolConfig_Simtest
                 SCRIPT test/G4GeometryToolConfig_Simtest.py
@@ -53,12 +44,10 @@ atlas_add_test( G4PhysicsRegionConfig_test
                 SCRIPT test/G4PhysicsRegionConfig_test.py
                 PROPERTIES TIMEOUT 300 )
 
-
 atlas_add_test( G4FieldConfig_test
                 SCRIPT test/G4FieldConfig_test.py
                 PROPERTIES TIMEOUT 300 )
 
-
 atlas_add_test( G4AtlasToolsConfigNew_test
                 SCRIPT test/G4AtlasToolsConfigNew_test.py
                 PROPERTIES TIMEOUT 300 )
diff --git a/Simulation/G4Extensions/Charginos/CMakeLists.txt b/Simulation/G4Extensions/Charginos/CMakeLists.txt
index c0a9601efec0bf57f9fd906b653d21c8f2c323f6..b866ccfacf0b8a63ebe66b7d5ef55ad4cdcf2c6a 100644
--- a/Simulation/G4Extensions/Charginos/CMakeLists.txt
+++ b/Simulation/G4Extensions/Charginos/CMakeLists.txt
@@ -5,13 +5,6 @@
 # Declare the package name:
 atlas_subdir( Charginos )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Simulation/G4Atlas/G4AtlasInterfaces )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Extensions/ExtraParticles/CMakeLists.txt b/Simulation/G4Extensions/ExtraParticles/CMakeLists.txt
index 1834c926128bfb65816ade5db09874c9c42d9a47..79f825bcaf4930a6cb18f01f764d7b22f0096768 100644
--- a/Simulation/G4Extensions/ExtraParticles/CMakeLists.txt
+++ b/Simulation/G4Extensions/ExtraParticles/CMakeLists.txt
@@ -5,13 +5,6 @@
 # Declare the package name:
 atlas_subdir( ExtraParticles )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Simulation/G4Atlas/G4AtlasInterfaces )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Extensions/G4CosmicFilter/CMakeLists.txt b/Simulation/G4Extensions/G4CosmicFilter/CMakeLists.txt
index 32c07d1a7ad519c6e67e1ac655cc05b9e506213b..27a024df161590ec488dcf43ce059842496d8190 100644
--- a/Simulation/G4Extensions/G4CosmicFilter/CMakeLists.txt
+++ b/Simulation/G4Extensions/G4CosmicFilter/CMakeLists.txt
@@ -5,17 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4CosmicFilter )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          Control/StoreGate
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools
-                          PRIVATE
-                          Simulation/G4Sim/MCTruth
-                          Simulation/G4Sim/TrackRecord )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Extensions/G4ExternalDecay/CMakeLists.txt b/Simulation/G4Extensions/G4ExternalDecay/CMakeLists.txt
index 28d20a9fb87ffd2add04db31de06e3fc0184faf6..c09ca87c9fcf42e2c78823ec8837c969bd507fc1 100644
--- a/Simulation/G4Extensions/G4ExternalDecay/CMakeLists.txt
+++ b/Simulation/G4Extensions/G4ExternalDecay/CMakeLists.txt
@@ -5,10 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4ExternalDecay )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Generators/Pythia8_i )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
@@ -33,7 +29,6 @@ if( HEPMC_FOUND )
    list( APPEND extra_libs AtlasHepMCLib )
 endif()
 
-
 # Component(s) in the package:
 atlas_add_library( G4ExternalDecay
                    src/*.cxx
diff --git a/Simulation/G4Extensions/G4HitFilter/CMakeLists.txt b/Simulation/G4Extensions/G4HitFilter/CMakeLists.txt
index c71bcfef3808e9ad9f0db9cc96903c831ad91b48..cbe21dd05489386e8d1ce445a9f538be5a102112 100644
--- a/Simulation/G4Extensions/G4HitFilter/CMakeLists.txt
+++ b/Simulation/G4Extensions/G4HitFilter/CMakeLists.txt
@@ -5,21 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4HitFilter )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Calorimeter/CaloSimEvent
-                          Control/AthenaBaseComps
-                          Control/StoreGate
-                          ForwardDetectors/LUCID/LUCID_SimUtils/LUCID_SimEvent
-                          InnerDetector/InDetSimEvent
-                          LArCalorimeter/LArSimEvent
-                          MuonSpectrometer/MuonSimEvent
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools
-                          TileCalorimeter/TileSimEvent )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Extensions/G4ScoringProcess/CMakeLists.txt b/Simulation/G4Extensions/G4ScoringProcess/CMakeLists.txt
index fd8bc8058199181945070d5f3c02f8eec8eb58bf..fa4d1e4c4a50e5d266a93b038d9d5a840409a6a6 100644
--- a/Simulation/G4Extensions/G4ScoringProcess/CMakeLists.txt
+++ b/Simulation/G4Extensions/G4ScoringProcess/CMakeLists.txt
@@ -5,13 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4ScoringProcess )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Simulation/G4Atlas/G4AtlasInterfaces )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Extensions/Gauginos/CMakeLists.txt b/Simulation/G4Extensions/Gauginos/CMakeLists.txt
index 024950c9a687ad6a18578984a088ab7de9814372..591d9dd2f225f4406d8d6e41bd92ef4e50cca2d8 100644
--- a/Simulation/G4Extensions/Gauginos/CMakeLists.txt
+++ b/Simulation/G4Extensions/Gauginos/CMakeLists.txt
@@ -5,12 +5,6 @@
 # Declare the package name:
 atlas_subdir( Gauginos )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/AthenaBaseComps
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasInterfaces )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Extensions/Monopole/CMakeLists.txt b/Simulation/G4Extensions/Monopole/CMakeLists.txt
index 4f38c51bb8428ffd003d4ac53e0f8b5a73feeb2a..7eacc7123cdefda91966a5865e3c5fd1eec4e241 100644
--- a/Simulation/G4Extensions/Monopole/CMakeLists.txt
+++ b/Simulation/G4Extensions/Monopole/CMakeLists.txt
@@ -5,13 +5,6 @@
 # Declare the package name:
 atlas_subdir( Monopole )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Simulation/G4Atlas/G4AtlasInterfaces )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Extensions/Quirks/CMakeLists.txt b/Simulation/G4Extensions/Quirks/CMakeLists.txt
index 9f6a32300947045f80c907bd63fb854eb4c3c5e9..99dd3e5c633d311a61b49a295e0d8eb90493a75a 100644
--- a/Simulation/G4Extensions/Quirks/CMakeLists.txt
+++ b/Simulation/G4Extensions/Quirks/CMakeLists.txt
@@ -5,14 +5,6 @@
 # Declare the package name:
 atlas_subdir( Quirks )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Extensions/RHadrons/CMakeLists.txt b/Simulation/G4Extensions/RHadrons/CMakeLists.txt
index 1b73c7d2fc0b943f237c37ffb010ca64462d6fa9..0daee5c839487bdebe7792e2541d425516b7e8ca 100644
--- a/Simulation/G4Extensions/RHadrons/CMakeLists.txt
+++ b/Simulation/G4Extensions/RHadrons/CMakeLists.txt
@@ -6,15 +6,6 @@
 atlas_subdir( RHadrons )
 
 if( NOT GENERATIONBASE )
-    # Declare the package's dependencies:
-    atlas_depends_on_subdirs( PUBLIC
-                              GaudiKernel
-                              PRIVATE
-                              Control/AthenaBaseComps
-                              Simulation/G4Atlas/G4AtlasInterfaces
-                              Simulation/G4Atlas/G4AtlasTools
-                              Simulation/G4Extensions/G4ExternalDecay
-                              Simulation/G4Sim/SimHelpers )
 
     # External dependencies:
     find_package( CLHEP )
diff --git a/Simulation/G4Extensions/Sleptons/CMakeLists.txt b/Simulation/G4Extensions/Sleptons/CMakeLists.txt
index 53940711964e037c23856e4f4fc8d1476523c3d4..2646be5219258e757ebe6ca7377f020b099f003d 100644
--- a/Simulation/G4Extensions/Sleptons/CMakeLists.txt
+++ b/Simulation/G4Extensions/Sleptons/CMakeLists.txt
@@ -5,13 +5,6 @@
 # Declare the package name:
 atlas_subdir( Sleptons )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Simulation/G4Atlas/G4AtlasInterfaces )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Sim/G4HiveEx/CMakeLists.txt b/Simulation/G4Sim/G4HiveEx/CMakeLists.txt
index 5433b70e524aab65f813c2cea6ba549903ab0a54..f73e76f7a93cd7944bd7ea6b5b40a64e6d855b7c 100644
--- a/Simulation/G4Sim/G4HiveEx/CMakeLists.txt
+++ b/Simulation/G4Sim/G4HiveEx/CMakeLists.txt
@@ -5,13 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4HiveEx )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          GaudiKernel
-                          Generators/GeneratorObjects )
-
 # External dependencies:
 find_package( Geant4 )
 find_package( CLHEP )
diff --git a/Simulation/G4Sim/MCTruth/CMakeLists.txt b/Simulation/G4Sim/MCTruth/CMakeLists.txt
index 4343bfbaf45729c1c339bdd5edb50f62a02bf491..5ad3559df9a4a6bce279091da6acb589ecbbd917 100644
--- a/Simulation/G4Sim/MCTruth/CMakeLists.txt
+++ b/Simulation/G4Sim/MCTruth/CMakeLists.txt
@@ -5,15 +5,6 @@
 # Declare the package name:
 atlas_subdir( MCTruth )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          Generators/AtlasHepMC
-                          Generators/GeneratorObjects
-                          PRIVATE
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/G4Sim/SimHelpers )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Sim/MCTruth/src/TrackInformation.cxx b/Simulation/G4Sim/MCTruth/src/TrackInformation.cxx
index 62470bdc8b9f1b98a78a1c6d2082918eadb97b32..ca8d9694a832612e3dffe005fea441d2da70a617 100644
--- a/Simulation/G4Sim/MCTruth/src/TrackInformation.cxx
+++ b/Simulation/G4Sim/MCTruth/src/TrackInformation.cxx
@@ -21,7 +21,6 @@ const HepMC::GenParticle* TrackInformation::GetHepMCParticle() const
 {
   return m_theParticle;
 }
-
 const ISF::ISFParticle* TrackInformation::GetBaseISFParticle() const
 {
   return m_theBaseISFParticle;
diff --git a/Simulation/G4Sim/MCTruthBase/CMakeLists.txt b/Simulation/G4Sim/MCTruthBase/CMakeLists.txt
index 1849bf34dff19f5a996ac0187aad262f32f41e82..af05f69fff4f1bad1f8891e4317abfcb088746d6 100644
--- a/Simulation/G4Sim/MCTruthBase/CMakeLists.txt
+++ b/Simulation/G4Sim/MCTruthBase/CMakeLists.txt
@@ -5,23 +5,6 @@
 # Declare the package name:
 atlas_subdir( MCTruthBase )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          GaudiKernel
-                          Simulation/G4Sim/SimHelpers
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          PRIVATE
-                          Generators/AtlasHepMC                          
-                          Control/AthenaBaseComps
-                          Control/StoreGate
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/MCTruth
-                          Simulation/G4Sim/TrackRecord
-                          DetectorDescription/AtlasDetDescr
-                          Simulation/ISF/ISF_Geant4/ISF_Geant4Event )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Sim/SimHelpers/CMakeLists.txt b/Simulation/G4Sim/SimHelpers/CMakeLists.txt
index 3019802149704fb469a12e366555643d9ea40c53..784646358a1d3080c467d3734c5c5de32f687fb4 100644
--- a/Simulation/G4Sim/SimHelpers/CMakeLists.txt
+++ b/Simulation/G4Sim/SimHelpers/CMakeLists.txt
@@ -5,11 +5,6 @@
 # Declare the package name:
 atlas_subdir( SimHelpers )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/StoreGate
-                          GaudiKernel )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Sim/TrackRecord/CMakeLists.txt b/Simulation/G4Sim/TrackRecord/CMakeLists.txt
index 62efd9cbf5b21b4e64c0f99e66711ec80e69b638..54a347c54e8f1576f9f331c216af5f38e8ea9dad 100644
--- a/Simulation/G4Sim/TrackRecord/CMakeLists.txt
+++ b/Simulation/G4Sim/TrackRecord/CMakeLists.txt
@@ -5,13 +5,6 @@
 # Declare the package name:
 atlas_subdir( TrackRecord )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          Simulation/HitManagement
-                          PRIVATE
-                          Database/AtlasSealCLHEP )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
diff --git a/Simulation/G4SimCnv/G4SimAthenaPOOL/CMakeLists.txt b/Simulation/G4SimCnv/G4SimAthenaPOOL/CMakeLists.txt
index b476d200cf949405ac05148378eb8f8bab9cf7d7..da7156e9b518a0ad70cc2cd43ea5fa08b7027c7c 100644
--- a/Simulation/G4SimCnv/G4SimAthenaPOOL/CMakeLists.txt
+++ b/Simulation/G4SimCnv/G4SimAthenaPOOL/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4SimAthenaPOOL )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Database/AthenaPOOL/AthenaPoolUtilities
-                          Database/AtlasSealCLHEP
-                          GaudiKernel
-                          PRIVATE
-                          Database/AthenaPOOL/AthenaPoolCnvSvc
-                          Simulation/G4Sim/TrackRecord
-                          Simulation/G4SimCnv/G4SimTPCnv )
-
 # Component(s) in the package:
 atlas_add_poolcnv_library( G4SimAthenaPOOLPoolCnv
                            src/*.cxx
diff --git a/Simulation/G4SimCnv/G4SimTPCnv/CMakeLists.txt b/Simulation/G4SimCnv/G4SimTPCnv/CMakeLists.txt
index abd1b40a832ac3cfaa89a63ec913a4be88f93f2d..1cb2188b1d58d62a3a0e2c60602ade2f0451cad0 100644
--- a/Simulation/G4SimCnv/G4SimTPCnv/CMakeLists.txt
+++ b/Simulation/G4SimCnv/G4SimTPCnv/CMakeLists.txt
@@ -5,15 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4SimTPCnv )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Database/AthenaPOOL/AthenaPoolCnvSvc
-                          Database/AthenaPOOL/AthenaPoolServices
-                          Simulation/G4Sim/TrackRecord
-                          PRIVATE
-                          AtlasTest/TestTools
-                          Control/AthenaKernel )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
diff --git a/Simulation/G4Utilities/G4Ancillary/G4AncillaryEventAthenaPool/CMakeLists.txt b/Simulation/G4Utilities/G4Ancillary/G4AncillaryEventAthenaPool/CMakeLists.txt
index 3808ec5fc3d23c972d7e283dff5246756f605939..5b514aca50ded3aac5d9c551a2f7db497b1e482e 100644
--- a/Simulation/G4Utilities/G4Ancillary/G4AncillaryEventAthenaPool/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4Ancillary/G4AncillaryEventAthenaPool/CMakeLists.txt
@@ -5,14 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4AncillaryEventAthenaPool )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Database/AthenaPOOL/AthenaPoolUtilities
-                          Database/AtlasSealCLHEP
-                          PRIVATE
-                          Database/AthenaPOOL/AthenaPoolCnvSvc
-                          Simulation/G4Utilities/G4Ancillary/G4AncillarySimEvent )
-
 # Component(s) in the package:
 atlas_add_poolcnv_library( G4AncillaryEventAthenaPoolPoolCnv
                            src/*.cxx
diff --git a/Simulation/G4Utilities/G4Ancillary/G4AncillarySimEvent/CMakeLists.txt b/Simulation/G4Utilities/G4Ancillary/G4AncillarySimEvent/CMakeLists.txt
index 10a879ac0a7e5c7a17f5fe76be8124e72c0abb99..48857e92875b1bf12924fe6accb53b8d09942587 100644
--- a/Simulation/G4Utilities/G4Ancillary/G4AncillarySimEvent/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4Ancillary/G4AncillarySimEvent/CMakeLists.txt
@@ -5,12 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4AncillarySimEvent )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          Generators/GeneratorObjects
-                          Simulation/HitManagement )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
diff --git a/Simulation/G4Utilities/G4DebuggingTools/CMakeLists.txt b/Simulation/G4Utilities/G4DebuggingTools/CMakeLists.txt
index d223876f83dd1770ce0e44775a670ec6ba8b5dbb..5dcaf3d9559cfaf0025e298ddf88277f0dcaaa62 100644
--- a/Simulation/G4Utilities/G4DebuggingTools/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4DebuggingTools/CMakeLists.txt
@@ -5,19 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4DebuggingTools )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Control/StoreGate
-                          Event/EventInfo
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/MCTruth
-                          Simulation/G4Sim/MCTruthBase
-                          Simulation/G4Sim/SimHelpers )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Utilities/G4DebuggingTools/python/G4DebuggingToolsConfig.py b/Simulation/G4Utilities/G4DebuggingTools/python/G4DebuggingToolsConfig.py
index e884a92cb8349fad76c7a5350c7f271584ecb9a5..ba14dbdcb07eaeec6208f99c73eeff1e49ee91fe 100644
--- a/Simulation/G4Utilities/G4DebuggingTools/python/G4DebuggingToolsConfig.py
+++ b/Simulation/G4Utilities/G4DebuggingTools/python/G4DebuggingToolsConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon import CfgMgr, Logging
 from G4AtlasServices import G4AtlasServicesConfig
@@ -7,7 +7,7 @@ def getVerboseSelectorTool(name="G4UA::VerboseSelectorTool", **kwargs):
     from G4AtlasApps.SimFlags import simFlags
     # example custom configuration
     if name in simFlags.UserActionConfig.get_Value().keys():
-        for prop,value in simFlags.UserActionConfig.get_Value()[name].iteritems():
+        for prop,value in simFlags.UserActionConfig.get_Value()[name].items():
             kwargs.setdefault(prop,value)
     return CfgMgr.G4UA__VerboseSelectorTool(name, **kwargs)
 
@@ -21,7 +21,7 @@ def getHyperspaceCatcherTool(name="G4UA::HyperspaceCatcherTool", **kwargs):
     from G4AtlasApps.SimFlags import simFlags
     # example custom configuration
     if name in simFlags.UserActionConfig.get_Value().keys():
-        for prop,value in simFlags.UserActionConfig.get_Value()[name].iteritems():
+        for prop,value in simFlags.UserActionConfig.get_Value()[name].items():
             kwargs.setdefault(prop,value)
     return CfgMgr.G4UA__HyperspaceCatcherTool(name, **kwargs)
 
@@ -41,7 +41,7 @@ def getVolumeDebuggerTool(name="G4UA::VolumeDebuggerTool", **kwargs):
     from G4AtlasApps.SimFlags import simFlags
     # example custom configuration
     if name in simFlags.UserActionConfig.get_Value().keys():
-        for prop,value in simFlags.UserActionConfig.get_Value()[name].iteritems():
+        for prop,value in simFlags.UserActionConfig.get_Value()[name].items():
             kwargs.setdefault(prop,value)
     return CfgMgr.G4UA__VolumeDebuggerTool(name, **kwargs)
 
@@ -56,7 +56,7 @@ def getGeant4SetupCheckerTool(name="G4UA::Geant4SetupCheckerTool", **kwargs):
     kwargs.setdefault('ReferenceFile',default_file)
     # Grab the properties that were already set
     if name in simFlags.UserActionConfig.get_Value().keys():
-        for prop,value in simFlags.UserActionConfig.get_Value()[name].iteritems():
+        for prop,value in simFlags.UserActionConfig.get_Value()[name].items():
             kwargs.setdefault(prop,value)
     # Set up the user action
     return CfgMgr.G4UA__Geant4SetupCheckerTool(name, **kwargs)
@@ -69,7 +69,7 @@ def getStepHistogramTool(name="G4UA::StepHistogramTool", **kwargs):
         return False
     from G4AtlasApps.SimFlags import simFlags
     if name in simFlags.UserActionConfig.get_Value().keys():
-        for prop,value in simFlags.UserActionConfig.get_Value()[name].iteritems():
+        for prop,value in simFlags.UserActionConfig.get_Value()[name].items():
             kwargs.setdefault(prop,value)
     return CfgMgr.G4UA__StepHistogramTool(name, **kwargs)
 
diff --git a/Simulation/G4Utilities/G4FastSimulation/CMakeLists.txt b/Simulation/G4Utilities/G4FastSimulation/CMakeLists.txt
index c41cbf3ded02d7704a03fe2eed7c839ee9af75b3..748425cdeb80859f2cc825812c5692a119cfee7e 100644
--- a/Simulation/G4Utilities/G4FastSimulation/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4FastSimulation/CMakeLists.txt
@@ -5,11 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4FastSimulation )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasTools )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Utilities/G4PhysicsLists/CMakeLists.txt b/Simulation/G4Utilities/G4PhysicsLists/CMakeLists.txt
index 2424cb241a29a197c377b126320ffcd4623e1e95..2898680a33478e0ab5039eaaee177fa4d4070fd9 100644
--- a/Simulation/G4Utilities/G4PhysicsLists/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4PhysicsLists/CMakeLists.txt
@@ -6,10 +6,6 @@
 # Declare the package name:
 atlas_subdir( G4PhysicsLists )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          GaudiKernel )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Utilities/G4ProfilingTools/CMakeLists.txt b/Simulation/G4Utilities/G4ProfilingTools/CMakeLists.txt
index 67127796fd9cf58646e03e08241c3b6cff826137..4be3d4ca17b41559f0fe92772e52915046e9aef4 100644
--- a/Simulation/G4Utilities/G4ProfilingTools/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4ProfilingTools/CMakeLists.txt
@@ -5,14 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4ProfilingTools )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaKernel
-                          Simulation/G4Atlas/G4AtlasTools
-			  Simulation/G4Atlas/G4AtlasInterfaces )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( CLHEP )
diff --git a/Simulation/G4Utilities/G4StepLimitation/CMakeLists.txt b/Simulation/G4Utilities/G4StepLimitation/CMakeLists.txt
index 2bd933e3daaa58769ce83637bc4dcdf78452c659..e3070ff96c5e739956900a023ad0b985bd1d3441 100644
--- a/Simulation/G4Utilities/G4StepLimitation/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4StepLimitation/CMakeLists.txt
@@ -5,13 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4StepLimitation )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Simulation/G4Atlas/G4AtlasInterfaces )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/G4Utilities/G4UserActions/CMakeLists.txt b/Simulation/G4Utilities/G4UserActions/CMakeLists.txt
index 3396bd068f5fd49df0d447b85f2ea1e21a612136..a33d0debf63a4b7ef10cb2ad063a1d95c51f336f 100644
--- a/Simulation/G4Utilities/G4UserActions/CMakeLists.txt
+++ b/Simulation/G4Utilities/G4UserActions/CMakeLists.txt
@@ -5,26 +5,6 @@
 # Declare the package name:
 atlas_subdir( G4UserActions )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/TrackRecord
-                          Event/EventInfo
-                          InnerDetector/InDetSimEvent
-                          MuonSpectrometer/MuonSimEvent
-                          Simulation/G4Sim/MCTruth
-                          Simulation/G4Sim/MCTruthBase
-                          Simulation/G4Sim/SimHelpers
-                          Simulation/G4Utilities/TrackWriteFastSim
-                          Simulation/G4Utilities/G4DebuggingTools
-                          Tools/PathResolver )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
@@ -39,7 +19,6 @@ atlas_add_component( G4UserActions
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS}
                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} ${TBB_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests GaudiKernel G4AtlasInterfaces G4AtlasToolsLib EventInfo InDetSimEvent MuonSimEvent MCTruth MCTruthBaseLib SimHelpers TrackWriteFastSimLib PathResolver G4DebuggingHelperLib)
 
-
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
 atlas_install_joboptions( share/*.py )
diff --git a/Simulation/G4Utilities/G4UserActions/share/jobOptions.RadiationMapsMaker.py b/Simulation/G4Utilities/G4UserActions/share/jobOptions.RadiationMapsMaker.py
index c72dd9e67029a7a8c630b6ee828a961dfaaee97f..d8dc202a3bf84f80783566110b4120fa363242f2 100644
--- a/Simulation/G4Utilities/G4UserActions/share/jobOptions.RadiationMapsMaker.py
+++ b/Simulation/G4Utilities/G4UserActions/share/jobOptions.RadiationMapsMaker.py
@@ -15,6 +15,8 @@ from G4UserActions.G4UserActionsConf import G4UA__RadiationMapsMakerTool
 # radmaptool.NBinsLogEn      =    90
 # radmaptool.NBinsLogEo      =    45
 # radmaptool.NBinsLogTimeCut =    20
+# radmaptool.NBinsDPhi       =    18
+# radmaptool.NBinsTheta      =     9
 # radmaptool.NBinsR3D        =    30
 # radmaptool.NBinsZ3D        =    60
 # radmaptool.NBinsPhi3D      =    32
@@ -34,6 +36,8 @@ from G4UserActions.G4UserActionsConf import G4UA__RadiationMapsMakerTool
 # radmaptool.LogEMaxo        =    7.0  # in log10(E/MeV)
 # radmaptool.LogTMin         =   -9.0  # in log10(t_cut/s)
 # radmaptool.LogTMax         =   11.0  # in log10(t_cut/s)
+# radmaptool.ThetaMin        =    0.0  # in degrees 
+# radmaptool.ThetaMin        =   90.0  # in degrees
 # radmaptool.ElemZMin        =    1    # Atomic number
 # radmaptool.ElemZMax        =   92    # Atomic number
 #
diff --git a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.cxx b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.cxx
index 8bf2474349bae33db59e357344f4cf019c426772..b309896e4148f4c0cc9f44e68b7f82e464dc8d7f 100644
--- a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.cxx
+++ b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.cxx
@@ -131,6 +131,10 @@ namespace G4UA{
       m_rz_neut_spec     [i] += maps.m_rz_neut_spec     [i];
       m_full_rz_neut_spec[i] += maps.m_full_rz_neut_spec[i];
     }
+    // x theta bins
+    for(unsigned int i=0;i<maps.m_theta_full_rz_neut_spec.size();i++) {
+      m_theta_full_rz_neut_spec[i] += maps.m_theta_full_rz_neut_spec[i];
+    }
     // all other particle's spectra have same size
     for(unsigned int i=0;i<maps.m_rz_gamm_spec.size();i++) {
       m_rz_gamm_spec     [i] += maps.m_rz_gamm_spec     [i];
@@ -146,6 +150,16 @@ namespace G4UA{
       m_rz_rest_spec     [i] += maps.m_rz_rest_spec     [i];
       m_full_rz_rest_spec[i] += maps.m_full_rz_rest_spec[i];
     }
+    // x theta bins
+    for(unsigned int i=0;i<maps.m_theta_full_rz_gamm_spec.size();i++) {
+      m_theta_full_rz_gamm_spec[i]  += maps.m_theta_full_rz_gamm_spec[i];
+      m_theta_full_rz_elec_spec[i]  += maps.m_theta_full_rz_elec_spec[i];
+      m_theta_full_rz_muon_spec[i]  += maps.m_theta_full_rz_muon_spec[i];
+      m_theta_full_rz_pion_spec[i]  += maps.m_theta_full_rz_pion_spec[i];
+      m_theta_full_rz_prot_spec[i]  += maps.m_theta_full_rz_prot_spec[i];
+      m_theta_full_rz_rchgd_spec[i] += maps.m_theta_full_rz_rchgd_spec[i];
+      m_theta_full_rz_rneut_spec[i] += maps.m_theta_full_rz_rneut_spec[i];
+    }
   }
 
   void RadiationMapsMaker::BeginOfRunAction(const G4Run*){
@@ -193,6 +207,15 @@ namespace G4UA{
     m_maps.m_full_rz_prot_spec.resize(0);
     m_maps.m_rz_rest_spec     .resize(0);
     m_maps.m_full_rz_rest_spec.resize(0);
+
+    m_maps.m_theta_full_rz_neut_spec .resize(0);
+    m_maps.m_theta_full_rz_gamm_spec .resize(0);
+    m_maps.m_theta_full_rz_elec_spec .resize(0);
+    m_maps.m_theta_full_rz_muon_spec .resize(0);
+    m_maps.m_theta_full_rz_pion_spec .resize(0);
+    m_maps.m_theta_full_rz_prot_spec .resize(0);
+    m_maps.m_theta_full_rz_rchgd_spec.resize(0);
+    m_maps.m_theta_full_rz_rneut_spec.resize(0);
     
     if (!m_config.material.empty()) {
       // need volume fraction only if particular material is selected
@@ -248,6 +271,15 @@ namespace G4UA{
     m_maps.m_rz_rest_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
     m_maps.m_full_rz_rest_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
 
+    m_maps.m_theta_full_rz_neut_spec .resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEn,0.0);
+    m_maps.m_theta_full_rz_gamm_spec .resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    m_maps.m_theta_full_rz_elec_spec .resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    m_maps.m_theta_full_rz_muon_spec .resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    m_maps.m_theta_full_rz_pion_spec .resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    m_maps.m_theta_full_rz_prot_spec .resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    m_maps.m_theta_full_rz_rchgd_spec.resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    m_maps.m_theta_full_rz_rneut_spec.resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+
     if (!m_config.material.empty()) {
       // need volume fraction only if particular material is selected
       // 2d zoom
@@ -407,7 +439,7 @@ namespace G4UA{
       double y1 = aStep->GetPostStepPoint()->GetPosition().y()*0.1;
       double z0 = aStep->GetPreStepPoint()->GetPosition().z()*0.1;
       double z1 = aStep->GetPostStepPoint()->GetPosition().z()*0.1;
-      
+
       double l = sqrt(pow(x1-x0,2)+pow(y1-y0,2)+pow(z1-z0,2));
       // make 1 mm steps but at least 1 step
       double dl0 = 0.1;
@@ -419,6 +451,14 @@ namespace G4UA{
       
       double weight = 0; // weight for NIEL
       double eKin = aStep->GetTrack()->GetKineticEnergy();
+      double theta = aStep->GetTrack()->GetMomentumDirection().theta()*180./M_PI;
+      // if theta range in configuration is 0 - 90 assume that 180-theta should
+      // be used for theta > 90; otherwise leave theta unchanged
+      theta = (theta > 90&&m_config.thetaMin==0&&m_config.thetaMax==90?180-theta:theta);
+      double dphi = (aStep->GetTrack()->GetMomentumDirection().phi()-p.phi())*180./M_PI;
+      while ( dphi > 360 ) dphi -= 360.;
+      while ( dphi <   0 ) dphi += 360.;
+      
       double logEKin = (eKin > 0?log10(eKin):(m_config.logEMinn<m_config.logEMino?m_config.logEMinn:m_config.logEMino)-1);
 
       if ( pdgid == 1 || pdgid == 9 ) {
@@ -472,6 +512,8 @@ namespace G4UA{
 	int vBinFullSpeco = -1;
 	int vBinZoomTime  = -1;
 	int vBinFullTime  = -1;
+	int vBinThetaFullSpecn = -1;
+	int vBinThetaFullSpeco = -1;
 	
 	// zoom 2d
 	if ( m_config.zMinZoom < abszorz && 
@@ -517,12 +559,26 @@ namespace G4UA{
 		 (pdgid == 6 || pdgid == 7)) {
 	      int ile = (logEKin-m_config.logEMinn)/(m_config.logEMaxn-m_config.logEMinn)*m_config.nBinslogEn;
 	      vBinFullSpecn = m_config.nBinsr*m_config.nBinslogEn*iz+ir*m_config.nBinslogEn+ile;
+	      if ( m_config.thetaMin < theta && 
+		   m_config.thetaMax > theta ) {
+		int ith = (theta-m_config.thetaMin)/(m_config.thetaMax-m_config.thetaMin)*m_config.nBinstheta;
+		int idph = dphi/360.*m_config.nBinsdphi;
+		ith = ith*m_config.nBinsdphi+idph;
+		vBinThetaFullSpecn = m_config.nBinsr*m_config.nBinslogEn*m_config.nBinsdphi*m_config.nBinstheta*iz+ir*m_config.nBinslogEn*m_config.nBinsdphi*m_config.nBinstheta+ile*m_config.nBinsdphi*m_config.nBinstheta+ith;
+	      }
 	    }
 	    if ( m_config.logEMino < logEKin && 
 		 m_config.logEMaxo > logEKin &&
 		 pdgid != 6 && pdgid != 7) {
 	      int ile = (logEKin-m_config.logEMino)/(m_config.logEMaxo-m_config.logEMino)*m_config.nBinslogEo;
 	      vBinFullSpeco = m_config.nBinsr*m_config.nBinslogEo*iz+ir*m_config.nBinslogEo+ile;
+	      if ( m_config.thetaMin < theta && 
+		   m_config.thetaMax > theta ) {
+		int ith = (theta-m_config.thetaMin)/(m_config.thetaMax-m_config.thetaMin)*m_config.nBinstheta;
+		int idph = dphi/360.*m_config.nBinsdphi;
+		ith = ith*m_config.nBinsdphi+idph;
+		vBinThetaFullSpeco = m_config.nBinsr*m_config.nBinslogEo*m_config.nBinsdphi*m_config.nBinstheta*iz+ir*m_config.nBinslogEo*m_config.nBinsdphi*m_config.nBinstheta+ile*m_config.nBinsdphi*m_config.nBinstheta+ith;
+	      }
 	    }
 	  }
 	}
@@ -685,6 +741,9 @@ namespace G4UA{
 	    if ( vBinFullSpecn >=0 ) {
 	      m_maps.m_full_rz_neut_spec [vBinFullSpecn] += dl;
 	    }
+	    if ( vBinThetaFullSpecn >=0 ) {
+	      m_maps.m_theta_full_rz_neut_spec [vBinThetaFullSpecn] += dl;
+	    }
 	  }
 	}
 	
@@ -730,6 +789,31 @@ namespace G4UA{
 	      m_maps.m_full_rz_rest_spec [vBinFullSpeco] += dl;
 	    }
 	  }
+	  if ( vBinThetaFullSpeco >=0 ) {
+	    if ( pdgid == 0 ) {
+	      m_maps.m_theta_full_rz_gamm_spec [vBinThetaFullSpeco] += dl;
+	    }
+	    else if ( pdgid == 1 ) {
+	      m_maps.m_theta_full_rz_prot_spec [vBinThetaFullSpeco] += dl;
+	    }
+	    else if ( pdgid == 2 ) {
+	      m_maps.m_theta_full_rz_pion_spec [vBinThetaFullSpeco] += dl;
+	    }
+	    else if ( pdgid == 3 ) {
+	      m_maps.m_theta_full_rz_muon_spec [vBinThetaFullSpeco] += dl;
+	    }
+	    else if ( pdgid == 4 || pdgid == 5 ) {
+	      m_maps.m_theta_full_rz_elec_spec [vBinThetaFullSpeco] += dl;
+	    }
+	    else {
+	      if ( absq > 0 ) {
+		m_maps.m_theta_full_rz_rchgd_spec [vBinThetaFullSpeco] += dl;
+	      }
+	      else {
+		m_maps.m_theta_full_rz_rneut_spec [vBinThetaFullSpeco] += dl;
+	      }
+	    }
+	  }
 	}
 	
 	if (!m_config.material.empty()) {
diff --git a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.h b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.h
index 682ba45e4961b70e71628a91910c80844d2a796b..b718b060a5a988dec4a3f11c7961b2da817c236f 100644
--- a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.h
+++ b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMaker.h
@@ -54,6 +54,14 @@ namespace G4UA
 	double phiMinZoom = -180.; // degrees
 	double phiMaxZoom =  180.; // degrees
 
+	// theta x dphi bins are used in the theta-spectra
+	
+	int nBinsdphi =  18; // 0 degrees <= dphi < 360 degrees
+	int nBinstheta =  9;
+
+	double thetaMin =  0.; // degrees
+	double thetaMax = 90.; // degrees
+
 	// neutron spectra
 	int nBinslogEn  =  90;   
 	double logEMinn = -11.; // min log10(E_kin/MeV) 
@@ -146,13 +154,17 @@ namespace G4UA
 	std::vector<double> m_rz_neut_spec;
         /// vector of neutron spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_neut_spec;
+        /// vector of neutron spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_neut_spec;
 
 	// gamma
 	
         /// vector of gamma spectra in log10(E/MeV) bins and the zoom 2d grid
 	std::vector<double> m_rz_gamm_spec;
-        /// vector of e^+/- spectra in log10(E/MeV) bins and the full 2d grid
+        /// vector of gamma spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_gamm_spec;
+        /// vector of gamma spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_gamm_spec;
 
 	// e^+/-
 	
@@ -160,6 +172,8 @@ namespace G4UA
 	std::vector<double> m_rz_elec_spec;
         /// vector of e^+/- spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_elec_spec;
+        /// vector of e^+/- spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_elec_spec;
 
 	// mu^+/-
 	
@@ -167,6 +181,8 @@ namespace G4UA
 	std::vector<double> m_rz_muon_spec;
         /// vector of mu^+/- spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_muon_spec;
+        /// vector of mu^+/- spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_muon_spec;
 
 	// pi^+/-
 	
@@ -174,6 +190,8 @@ namespace G4UA
 	std::vector<double> m_rz_pion_spec;
         /// vector of pi^+/- spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_pion_spec;
+        /// vector of pi^+/- spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_pion_spec;
 
 	// proton
 	
@@ -181,6 +199,8 @@ namespace G4UA
 	std::vector<double> m_rz_prot_spec;
         /// vector of proton spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_prot_spec;
+        /// vector of proton spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_prot_spec;
 
 	// rest
 	
@@ -188,6 +208,10 @@ namespace G4UA
 	std::vector<double> m_rz_rest_spec;
         /// vector of e^+/- spectra in log10(E/MeV) bins and the full 2d grid
 	std::vector<double> m_full_rz_rest_spec;
+        /// vector of rest charged spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_rchgd_spec;
+        /// vector of rest neutral spectra in log10(E/MeV) bins and the full 2d grid x theta bins
+	std::vector<double> m_theta_full_rz_rneut_spec;
 
 	// time dependent maps
 
diff --git a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMakerTool.cxx b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMakerTool.cxx
index 0940d3c2f84e4f31dfe6b21e9f7ed40e136b92c1..b1cd1fd0755feb7728340251d9fb3990a77c6b96 100644
--- a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMakerTool.cxx
+++ b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMakerTool.cxx
@@ -18,6 +18,7 @@ namespace G4UA{
     declareProperty("RadMapsFileName", m_radMapsFileName);
     /// Name of the material to make radiation maps for (take all if empty) 
     declareProperty("Material"       , m_config.material);
+    /// If true consider hits with y>0 only -- useful for shafts
     declareProperty("PositiveYOnly"  , m_config.posYOnly);
     /// map granularities 
     /// number of bins in r and z for all 2D maps
@@ -27,6 +28,10 @@ namespace G4UA{
     declareProperty("NBinsLogEn"     , m_config.nBinslogEn);
     /// number of bins in logE for energy spectra of other particles in 2D grids
     declareProperty("NBinsLogEo"     , m_config.nBinslogEo);
+    /// number of bins in dphi for dphi x theta dependent energy spectra
+    declareProperty("NBinsDPhi"      , m_config.nBinsdphi);
+    /// number of bins in theta for dphi x theta dependent energy spectra
+    declareProperty("NBinsTheta"     , m_config.nBinstheta);
     /// number of bins in r, z and phi for all 3D maps
     declareProperty("NBinsR3D"       , m_config.nBinsr3d);
     declareProperty("NBinsZ3D"       , m_config.nBinsz3d);
@@ -53,6 +58,9 @@ namespace G4UA{
     /// for logE of other particles in 2D spectra
     declareProperty("LogEMino"       , m_config.logEMino);
     declareProperty("LogEMaxo"       , m_config.logEMaxo);
+    /// for Theta in 2D spectra
+    declareProperty("ThetaMin"       , m_config.thetaMin);
+    declareProperty("ThetaMax"       , m_config.thetaMax);
     /// for logT in time-dependent TID 2D maps
     declareProperty("LogTMin"        , m_config.logTMin);
     declareProperty("LogTMax"        , m_config.logTMax);
@@ -80,6 +88,9 @@ namespace G4UA{
                                          m_config.logEMinn   << " < log10(E/MeV) < "                              << m_config.logEMaxn   << "\n" << 
                   "Other Spectra:   " << m_config.nBinslogEo << " log10E-bins"                                    << ", "                <<
                                          m_config.logEMino   << " < log10(E/MeV) < "                              << m_config.logEMaxo   << "\n" << 
+                  "DPhi-Bins:       " << m_config.nBinsdphi << " dphi-bins, 0 < dphi < 360 \n" << 
+		  "Theta-Bins:      " << m_config.nBinstheta << " theta-bins"                                     << ", "                  <<
+                                         m_config.thetaMin   << " < theta < "                                     << m_config.thetaMax   << "\n" << 
                   "3D Maps:         " << m_config.nBinsz3d   << (m_config.zMinFull<0?" z-bins, ":" |z|-bins, ")   << 
                                          m_config.nBinsr3d   << " r-bins, "                                       << 
                                          m_config.nBinsphi3d << " phi-bins"                                       << "\n"                << 
@@ -101,46 +112,72 @@ namespace G4UA{
   {
     ATH_MSG_DEBUG( "Finalizing " << name() );
 
-    // first make sure the vectors are empty
-
     RadiationMapsMaker::Report maps;
 
-    maps.m_rz_tid .resize(0);
-    maps.m_rz_eion.resize(0);
-    maps.m_rz_niel.resize(0);
-    maps.m_rz_h20 .resize(0);
-    maps.m_rz_neut.resize(0);
-    maps.m_rz_chad.resize(0);
-
-    maps.m_full_rz_tid .resize(0);
-    maps.m_full_rz_eion.resize(0);
-    maps.m_full_rz_niel.resize(0);
-    maps.m_full_rz_h20 .resize(0);
-    maps.m_full_rz_neut.resize(0);
-    maps.m_full_rz_chad.resize(0);
-
-    maps.m_3d_tid .resize(0);
-    maps.m_3d_eion.resize(0);
-    maps.m_3d_niel.resize(0);
-    maps.m_3d_h20 .resize(0);
-    maps.m_3d_neut.resize(0);
-    maps.m_3d_chad.resize(0);
-
-    maps.m_rz_neut_spec     .resize(0);
-    maps.m_full_rz_neut_spec.resize(0);
-    maps.m_rz_gamm_spec     .resize(0);
-    maps.m_full_rz_gamm_spec.resize(0);
-    maps.m_rz_elec_spec     .resize(0);
-    maps.m_full_rz_elec_spec.resize(0);
-    maps.m_rz_muon_spec     .resize(0);
-    maps.m_full_rz_muon_spec.resize(0);
-    maps.m_rz_pion_spec     .resize(0);
-    maps.m_full_rz_pion_spec.resize(0);
-    maps.m_rz_prot_spec     .resize(0);
-    maps.m_full_rz_prot_spec.resize(0);
-    maps.m_rz_rest_spec     .resize(0);
-    maps.m_full_rz_rest_spec.resize(0);
+    // vector of pointers to vectors of double to save space
+    std::vector<std::vector<double> *> pVal = {
+      &(maps.m_rz_tid),&(maps.m_rz_eion),&(maps.m_rz_niel),&(maps.m_rz_h20),&(maps.m_rz_neut),&(maps.m_rz_chad),
+      &(maps.m_full_rz_tid),&(maps.m_full_rz_eion),&(maps.m_full_rz_niel),&(maps.m_full_rz_h20),&(maps.m_full_rz_neut),&(maps.m_full_rz_chad)
+    };
+
+    std::vector<std::vector<double> *> pVal3d = {
+      &(maps.m_3d_tid),&(maps.m_3d_eion),&(maps.m_3d_niel),&(maps.m_3d_h20),&(maps.m_3d_neut),&(maps.m_3d_chad)
+    };
+
+    std::vector<std::vector<double> *> pValSpec = {
+      &(maps.m_rz_neut_spec),&(maps.m_rz_gamm_spec),&(maps.m_rz_elec_spec),&(maps.m_rz_muon_spec),&(maps.m_rz_pion_spec),&(maps.m_rz_prot_spec),&(maps.m_rz_rest_spec),     
+      &(maps.m_full_rz_neut_spec),&(maps.m_full_rz_gamm_spec),&(maps.m_full_rz_elec_spec),&(maps.m_full_rz_muon_spec),&(maps.m_full_rz_pion_spec),&(maps.m_full_rz_prot_spec),&(maps.m_full_rz_rest_spec)
+    };
+
+    std::vector<int> nBinslogE = {
+      m_config.nBinslogEn,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,
+      m_config.nBinslogEn,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo      
+    };
+
+    std::vector<std::vector<double> *> pValThetaSpec = {
+      &(maps.m_theta_full_rz_neut_spec),&(maps.m_theta_full_rz_gamm_spec),&(maps.m_theta_full_rz_elec_spec),&(maps.m_theta_full_rz_muon_spec),&(maps.m_theta_full_rz_pion_spec),&(maps.m_theta_full_rz_prot_spec),&(maps.m_theta_full_rz_rchgd_spec),&(maps.m_theta_full_rz_rneut_spec)
+    };
+
+    std::vector<int> nBinsThetalogE = {
+      m_config.nBinslogEn,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo,m_config.nBinslogEo
+    };
+
+    for(unsigned int hi=0;hi<pVal.size();hi++) {
+
+      // first make sure the vectors are empty
+
+      (pVal[hi])->resize(0);
+
+      // then resize to proper size and initialize with 0's 
+      // all maps are needed for the merge - so have to do resize
+      // for all before merging any ...
+
+      (pVal[hi])->resize(m_config.nBinsz*m_config.nBinsr,0.0);
+    }
+
+    // same for 3d 
+
+    for(unsigned int hi=0;hi<pVal3d.size();hi++) {
+      (pVal3d[hi])->resize(0);
+      (pVal3d[hi])->resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
+    }
+
+    // same for spectra
 
+    for(unsigned int hi=0;hi<pValSpec.size();hi++) {
+      (pValSpec[hi])->resize(0);
+      (pValSpec[hi])->resize(m_config.nBinsz*m_config.nBinsr*nBinslogE[hi],0.0);
+    }
+
+    // same for theta x dphi spectra
+
+    for(unsigned int hi=0;hi<pValThetaSpec.size();hi++) {
+      (pValThetaSpec[hi])->resize(0);
+      (pValThetaSpec[hi])->resize(m_config.nBinsdphi*m_config.nBinstheta*m_config.nBinsz*m_config.nBinsr*nBinsThetalogE[hi],0.0);
+    }
+
+    // same for misc individual maps
+    
     maps.m_rz_tid_time      .resize(0);
     maps.m_full_rz_tid_time .resize(0);
 
@@ -161,42 +198,8 @@ namespace G4UA{
     }
 
     // then resize to proper size and initialize with 0's 
-
-    maps.m_rz_tid .resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    maps.m_rz_eion.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    maps.m_rz_niel.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    maps.m_rz_h20 .resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    maps.m_rz_neut.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    maps.m_rz_chad.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-
-    maps.m_full_rz_tid .resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    maps.m_full_rz_eion.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    maps.m_full_rz_niel.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    maps.m_full_rz_h20 .resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    maps.m_full_rz_neut.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    maps.m_full_rz_chad.resize(m_config.nBinsz*m_config.nBinsr,0.0);
-    
-    maps.m_3d_tid .resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
-    maps.m_3d_eion.resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
-    maps.m_3d_niel.resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
-    maps.m_3d_h20 .resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
-    maps.m_3d_neut.resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
-    maps.m_3d_chad.resize(m_config.nBinsz3d*m_config.nBinsr3d*m_config.nBinsphi3d,0.0);
-
-    maps.m_rz_neut_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEn,0.0);
-    maps.m_full_rz_neut_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEn,0.0);
-    maps.m_rz_gamm_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    maps.m_full_rz_gamm_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    maps.m_rz_elec_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    maps.m_full_rz_elec_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    maps.m_rz_muon_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    maps.m_full_rz_muon_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    maps.m_rz_pion_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    maps.m_full_rz_pion_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    maps.m_rz_prot_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    maps.m_full_rz_prot_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    maps.m_rz_rest_spec     .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
-    maps.m_full_rz_rest_spec.resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogEo,0.0);
+    // all maps are needed for the merge - so have to do resize
+    // for all first ...
 
     maps.m_rz_tid_time      .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogT,0.0);
     maps.m_full_rz_tid_time .resize(m_config.nBinsz*m_config.nBinsr*m_config.nBinslogT,0.0);
@@ -224,321 +227,378 @@ namespace G4UA{
 
     TFile * f = new TFile(m_radMapsFileName.c_str(),"RECREATE");
 
-    TH2D * h_rz_tid  = new TH2D("rz_tid" ,"rz_tid" ,m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-    TH2D * h_rz_eion = new TH2D("rz_eion","rz_eion",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-    TH2D * h_rz_niel = new TH2D("rz_niel","rz_niel",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-    TH2D * h_rz_h20  = new TH2D("rz_h20" ,"rz_h20" ,m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-    TH2D * h_rz_neut = new TH2D("rz_neut","rz_neut",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-    TH2D * h_rz_chad = new TH2D("rz_chad","rz_chad",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
+    // histograms can be booked, filled, written and deleted in a loop
+    // in order to save memory. Need vectors to loop over them ...
+
+    std::vector<const char *> h2dNames = {
+      "rz_tid","rz_eion","rz_niel","rz_h20","rz_neut","rz_chad",
+      "full_rz_tid","full_rz_eion","full_rz_niel","full_rz_h20","full_rz_neut","full_rz_chad"
+    };
+
+    std::vector<const char *> h2dZTitles = {
+      "TID [Gy]","E_{ion}/V [MeV/cm^{3}]","NIEL [n_{eq}/cm^{2}]","SEE [h_{>20 MeV}/cm^{2}]","FLUX [n_{>100 keV}/cm^{2}]","FLUX [h_{charged}/cm^{2}]",
+      "TID [Gy]","E_{ion}/V [MeV/cm^{3}]","NIEL [n_{eq}/cm^{2}]","SEE [h_{>20 MeV}/cm^{2}]","FLUX [n_{>100 keV}/cm^{2}]","FLUX [h_{charged}/cm^{2}]"
+    };
+
+    std::vector<double> zMin = {
+      m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,
+      m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull
+    };
+ 
+    std::vector<double> zMax = {
+      m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,
+      m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull
+    };
+ 
+    std::vector<double> rMin = {
+      m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,
+      m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull
+    };
+ 
+    std::vector<double> rMax = {
+      m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,
+      m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull
+    };
 
     const char * xtitle =  (m_config.zMinFull<0?"z [cm]":"|z| [cm]");
 
-    h_rz_tid  ->SetXTitle(xtitle);
-    h_rz_eion ->SetXTitle(xtitle);
-    h_rz_niel ->SetXTitle(xtitle);
-    h_rz_h20  ->SetXTitle(xtitle);
-    h_rz_neut ->SetXTitle(xtitle);
-    h_rz_chad ->SetXTitle(xtitle);
-
-    h_rz_tid  ->SetYTitle("r [cm]");
-    h_rz_eion ->SetYTitle("r [cm]");
-    h_rz_niel ->SetYTitle("r [cm]");
-    h_rz_h20  ->SetYTitle("r [cm]");
-    h_rz_neut ->SetYTitle("r [cm]");
-    h_rz_chad ->SetYTitle("r [cm]");
-
-    h_rz_tid  ->SetZTitle("TID [Gy]");
-    h_rz_eion ->SetZTitle("E_{ion}/V [MeV/cm^{3}]");
-    h_rz_niel ->SetZTitle("NIEL [n_{eq}/cm^{2}]");
-    h_rz_h20  ->SetZTitle("SEE [h_{>20 MeV}/cm^{2}]");
-    h_rz_neut ->SetZTitle("FLUX [n_{>100 keV}/cm^{2}]");
-    h_rz_chad ->SetZTitle("FLUX [h_{charged}/cm^{2}]");
-
-    TH2D *h_full_rz_tid  = new TH2D("full_rz_tid" ,"full_rz_tid" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-    TH2D *h_full_rz_eion = new TH2D("full_rz_eion","full_rz_eion",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-    TH2D *h_full_rz_niel = new TH2D("full_rz_niel","full_rz_niel",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-    TH2D *h_full_rz_h20  = new TH2D("full_rz_h20" ,"full_rz_h20" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-    TH2D *h_full_rz_neut = new TH2D("full_rz_neut","full_rz_neut",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-    TH2D *h_full_rz_chad = new TH2D("full_rz_chad","full_rz_chad",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-
-    h_full_rz_tid  ->SetXTitle(xtitle);
-    h_full_rz_eion ->SetXTitle(xtitle);
-    h_full_rz_niel ->SetXTitle(xtitle);
-    h_full_rz_h20  ->SetXTitle(xtitle);
-    h_full_rz_neut ->SetXTitle(xtitle);
-    h_full_rz_chad ->SetXTitle(xtitle);
-
-    h_full_rz_tid  ->SetYTitle("r [cm]");
-    h_full_rz_eion ->SetYTitle("r [cm]");
-    h_full_rz_niel ->SetYTitle("r [cm]");
-    h_full_rz_h20  ->SetYTitle("r [cm]");
-    h_full_rz_neut ->SetYTitle("r [cm]");
-    h_full_rz_chad ->SetYTitle("r [cm]");
-
-    h_full_rz_tid  ->SetZTitle("TID [Gy]");
-    h_full_rz_eion ->SetZTitle("E_{ion}/V [MeV/cm^{3}]");
-    h_full_rz_niel ->SetZTitle("NIEL [n_{eq}/cm^{2}]");
-    h_full_rz_h20  ->SetZTitle("SEE [h_{>20 MeV}/cm^{2}]");
-    h_full_rz_neut ->SetZTitle("FLUX [n_{>100 keV}/cm^{2}]");
-    h_full_rz_chad ->SetZTitle("FLUX [h_{charged}/cm^{2}]");
-
-    TH3D * h_3d_tid  = new TH3D("h3d_tid" ,"h3d_tid" ,m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-    TH3D * h_3d_eion = new TH3D("h3d_eion","h3d_eion",m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-    TH3D * h_3d_niel = new TH3D("h3d_niel","h3d_niel",m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-    TH3D * h_3d_h20  = new TH3D("h3d_h20" ,"h3d_h20" ,m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-    TH3D * h_3d_neut = new TH3D("h3d_neut","h3d_neut",m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-    TH3D * h_3d_chad = new TH3D("h3d_chad","h3d_chad",m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-
-    h_3d_tid  ->SetXTitle(xtitle);
-    h_3d_eion ->SetXTitle(xtitle);
-    h_3d_niel ->SetXTitle(xtitle);
-    h_3d_h20  ->SetXTitle(xtitle);
-    h_3d_neut ->SetXTitle(xtitle);
-    h_3d_chad ->SetXTitle(xtitle);
-
-    h_3d_tid  ->SetYTitle("r [cm]");
-    h_3d_eion ->SetYTitle("r [cm]");
-    h_3d_niel ->SetYTitle("r [cm]");
-    h_3d_h20  ->SetYTitle("r [cm]");
-    h_3d_neut ->SetYTitle("r [cm]");
-    h_3d_chad ->SetYTitle("r [cm]");
-
-    h_3d_tid  ->SetZTitle("#phi [#circ]");
-    h_3d_eion ->SetZTitle("#phi [#circ]");
-    h_3d_niel ->SetZTitle("#phi [#circ]");
-    h_3d_h20  ->SetZTitle("#phi [#circ]");
-    h_3d_neut ->SetZTitle("#phi [#circ]");
-    h_3d_chad ->SetZTitle("#phi [#circ]");
-
-    h_3d_tid  ->SetTitle("TID [Gy]");
-    h_3d_eion ->SetTitle("E_{ion}/V [MeV/cm^{3}]");
-    h_3d_niel ->SetTitle("NIEL [n_{eq}/cm^{2}]");
-    h_3d_h20  ->SetTitle("SEE [h_{>20 MeV}/cm^{2}]");
-    h_3d_neut ->SetTitle("FLUX [n_{>100 keV}/cm^{2}]");
-    h_3d_chad ->SetTitle("FLUX [h_{charged}/cm^{2}]");
-
-    // neutron spectra
-    TH3D *h_full_rz_neut_spec = new TH3D("full_rz_neut_spec","full_rz_neut_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEn,m_config.logEMinn,m_config.logEMaxn);
-    TH3D *h_rz_neut_spec      = new TH3D("rz_neut_spec","rz_neut_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEn,m_config.logEMinn,m_config.logEMaxn);
-
-    h_rz_neut_spec      ->SetXTitle(xtitle);
-    h_rz_neut_spec      ->SetYTitle("r [cm]");
-    h_rz_neut_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_neut_spec      ->SetTitle("FLUX [n(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_neut_spec ->SetXTitle(xtitle);
-    h_full_rz_neut_spec ->SetYTitle("r [cm]");
-    h_full_rz_neut_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_neut_spec ->SetTitle("FLUX [n(log_{10}(E/MeV))/cm^{2}]");
-
-    // gamma spectra
-    TH3D *h_full_rz_gamm_spec = new TH3D("full_rz_gamm_spec","full_rz_gamm_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-    TH3D *h_rz_gamm_spec      = new TH3D("rz_gamm_spec","rz_gamm_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-
-    h_rz_gamm_spec      ->SetXTitle(xtitle);
-    h_rz_gamm_spec      ->SetYTitle("r [cm]");
-    h_rz_gamm_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_gamm_spec      ->SetTitle("FLUX [#gamma(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_gamm_spec ->SetXTitle(xtitle);
-    h_full_rz_gamm_spec ->SetYTitle("r [cm]");
-    h_full_rz_gamm_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_gamm_spec ->SetTitle("FLUX [#gamma(log_{10}(E/MeV))/cm^{2}]");
-
-    // e^+/- spectra
-    TH3D *h_full_rz_elec_spec = new TH3D("full_rz_elec_spec","full_rz_elec_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-    TH3D *h_rz_elec_spec      = new TH3D("rz_elec_spec","rz_elec_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-
-    h_rz_elec_spec      ->SetXTitle(xtitle);
-    h_rz_elec_spec      ->SetYTitle("r [cm]");
-    h_rz_elec_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_elec_spec      ->SetTitle("FLUX [e^{#pm}(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_elec_spec ->SetXTitle(xtitle);
-    h_full_rz_elec_spec ->SetYTitle("r [cm]");
-    h_full_rz_elec_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_elec_spec ->SetTitle("FLUX [e^{#pm}(log_{10}(E/MeV))/cm^{2}]");
-
-    // mu^+/- spectra
-    TH3D *h_full_rz_muon_spec = new TH3D("full_rz_muon_spec","full_rz_muon_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-    TH3D *h_rz_muon_spec      = new TH3D("rz_muon_spec","rz_muon_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-
-    h_rz_muon_spec      ->SetXTitle(xtitle);
-    h_rz_muon_spec      ->SetYTitle("r [cm]");
-    h_rz_muon_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_muon_spec      ->SetTitle("FLUX [#mu^{#pm}(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_muon_spec ->SetXTitle(xtitle);
-    h_full_rz_muon_spec ->SetYTitle("r [cm]");
-    h_full_rz_muon_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_muon_spec ->SetTitle("FLUX [#mu^{#pm}(log_{10}(E/MeV))/cm^{2}]");
-
-    // pi^+/- spectra
-    TH3D *h_full_rz_pion_spec = new TH3D("full_rz_pion_spec","full_rz_pion_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-    TH3D *h_rz_pion_spec      = new TH3D("rz_pion_spec","rz_pion_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-
-    h_rz_pion_spec      ->SetXTitle(xtitle);
-    h_rz_pion_spec      ->SetYTitle("r [cm]");
-    h_rz_pion_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_pion_spec      ->SetTitle("FLUX [#pi^{#pm}(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_pion_spec ->SetXTitle(xtitle);
-    h_full_rz_pion_spec ->SetYTitle("r [cm]");
-    h_full_rz_pion_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_pion_spec ->SetTitle("FLUX [#pi^{#pm}(log_{10}(E/MeV))/cm^{2}]");
-
-    // proton spectra
-    TH3D *h_full_rz_prot_spec = new TH3D("full_rz_prot_spec","full_rz_prot_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-    TH3D *h_rz_prot_spec      = new TH3D("rz_prot_spec","rz_prot_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-
-    h_rz_prot_spec      ->SetXTitle(xtitle);
-    h_rz_prot_spec      ->SetYTitle("r [cm]");
-    h_rz_prot_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_prot_spec      ->SetTitle("FLUX [p(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_prot_spec ->SetXTitle(xtitle);
-    h_full_rz_prot_spec ->SetYTitle("r [cm]");
-    h_full_rz_prot_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_prot_spec ->SetTitle("FLUX [p(log_{10}(E/MeV))/cm^{2}]");
-
-    // rest spectra
-    TH3D *h_full_rz_rest_spec = new TH3D("full_rz_rest_spec","full_rz_rest_spec",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-    TH3D *h_rz_rest_spec      = new TH3D("rz_rest_spec","rz_rest_spec",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogEo,m_config.logEMino,m_config.logEMaxo);
-
-    h_rz_rest_spec      ->SetXTitle(xtitle);
-    h_rz_rest_spec      ->SetYTitle("r [cm]");
-    h_rz_rest_spec      ->SetZTitle("log_{10}(E/MeV)");
-    h_rz_rest_spec      ->SetTitle("FLUX [rest(log_{10}(E/MeV))/cm^{2}]");
-
-    h_full_rz_rest_spec ->SetXTitle(xtitle);
-    h_full_rz_rest_spec ->SetYTitle("r [cm]");
-    h_full_rz_rest_spec ->SetZTitle("log_{10}(E/MeV)");
-    h_full_rz_rest_spec ->SetTitle("FLUX [rest(log_{10}(E/MeV))/cm^{2}]");
-
-    // time dependent TID maps
+    TH2D * h_rz_vol  = 0;
+    TH2D * h_rz_norm = 0;
+    TH2D * h_full_rz_vol  = 0;
+    TH2D * h_full_rz_norm = 0;
+
+    for(unsigned int hi=0;hi<h2dNames.size();hi++) {
+      TH2D *h2d = new TH2D(h2dNames[hi],h2dNames[hi],m_config.nBinsz,zMin[hi],zMax[hi],m_config.nBinsr,rMin[hi],rMax[hi]);
+      h2d->SetXTitle(xtitle);
+      h2d->SetYTitle("r [cm]");
+      h2d->SetZTitle(h2dZTitles[hi]);
+      if (hi==0 && !m_config.material.empty()) {
+	// need volume fraction only if particular material is selected
+	//
+	// the maps for TID, NIEL and SEE need to be divided by the ratio of (vol/norm) in order to get
+	// the proper estimate per volume bin for the selected material. 
+	// This is *not* done in the tool directly and left to the user after having summed the histograms
+	// from many individual jobs.
+	// 
+	h_rz_vol  = new TH2D("rz_vol" ,"rz_vol" ,m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
+	h_rz_norm = new TH2D("rz_norm","rz_norm",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
+	h_full_rz_vol  = new TH2D("full_rz_vol" ,"full_rz_vol" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
+	h_full_rz_norm = new TH2D("full_rz_norm","full_rz_norm",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
+	
+	h_rz_vol  ->SetXTitle(xtitle);
+	h_rz_norm ->SetXTitle(xtitle);
+	h_rz_vol  ->SetYTitle("r [cm]");
+	h_rz_norm ->SetYTitle("r [cm]");
+	std::string hname("Volume fraction of ");
+	hname += m_config.material;
+	h_rz_vol  ->SetZTitle(hname.data());
+	h_rz_norm ->SetZTitle("Volume norm");
+
+	h_full_rz_vol  ->SetXTitle(xtitle);
+	h_full_rz_norm ->SetXTitle(xtitle);
+	h_full_rz_vol  ->SetYTitle("r [cm]");
+	h_full_rz_norm ->SetYTitle("r [cm]");
+	h_full_rz_vol  ->SetZTitle(hname.data());
+	h_full_rz_norm ->SetZTitle("Volume norm");
+      }
+      
+      // normalize to volume element per bin
+      for(int i=0;i<h2d->GetNbinsX();i++) { 
+	for(int j=0;j<h2d->GetNbinsY();j++) { 
+	  int iBin = h2d->GetBin(i+1,j+1); 
+	  int vBin = m_config.nBinsr*i+j;
+	  double r0=h2d->GetYaxis()->GetBinLowEdge(j+1);
+	  double r1=h2d->GetYaxis()->GetBinUpEdge(j+1);
+	  double z0=h2d->GetXaxis()->GetBinLowEdge(i+1);
+	  double z1=h2d->GetXaxis()->GetBinUpEdge(i+1); 
+	  double vol=(z1-z0)*M_PI*(r1*r1-r0*r0);
+	  // if |z| instead of z double the volume
+	  if ( m_config.zMinFull >= 0 ) vol *= 2; 
+	  // if positive y hemisphere is used only -- half the volume
+	  if ( m_config.posYOnly ) vol *= 0.5; 
+	  double val = (*(pVal[hi]))[vBin];
+	  h2d->SetBinContent(iBin,val/vol);
+	  if (hi ==0 && !m_config.material.empty()) {
+	    // need volume fraction only if particular material is selected
+	    // VOL
+	    val =maps.m_rz_vol[vBin];
+	    h_rz_vol->SetBinContent(iBin,val/vol);
+	    // NORM
+	    val =maps.m_rz_norm[vBin];
+	    h_rz_norm->SetBinContent(iBin,val/vol);
+	  }
+	  if (hi ==h2dNames.size()/2 && !m_config.material.empty()) {
+	    // need volume fraction only if particular material is selected
+	    // VOL
+	    val =maps.m_full_rz_vol[vBin];
+	    h_full_rz_vol->SetBinContent(iBin,val/vol);
+	    // NORM
+	    val =maps.m_full_rz_norm[vBin];
+	    h_full_rz_norm->SetBinContent(iBin,val/vol);
+	  }
+	}
+      }
+      h2d->Write();
+      h2d->Delete();
+      if (hi ==h2dNames.size()/2 && !m_config.material.empty()) {
+	h_rz_vol->Write();
+	h_rz_vol->Delete();
+	h_rz_norm->Write();
+	h_rz_norm->Delete();
+	h_full_rz_vol->Write();
+	h_full_rz_vol->Delete();
+	h_full_rz_norm->Write();
+	h_full_rz_norm->Delete();
+      }
+    }
+
+    std::vector<const char *> h3dNames = {
+      "h3d_tid","h3d_eion","h3d_niel","h3d_h20","h3d_neut","h3d_chad"
+    };
+
+    std::vector<const char *> h3dTitles = {
+      "TID [Gy]","E_{ion}/V [MeV/cm^{3}]","NIEL [n_{eq}/cm^{2}]","SEE [h_{>20 MeV}/cm^{2}]","FLUX [n_{>100 keV}/cm^{2}]","FLUX [h_{charged}/cm^{2}]"
+    };
+
+    TH3D * h_3d_vol  = 0;
+    TH3D * h_3d_norm = 0;
+
+    for(unsigned int hi=0;hi<h3dNames.size();hi++) {
+      TH3D *h3d = new TH3D(h3dNames[hi],h3dNames[hi],m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
+      h3d->SetXTitle(xtitle);
+      h3d->SetYTitle("r [cm]");
+      h3d->SetZTitle("#phi [#circ]");
+      h3d->SetTitle(h3dTitles[hi]);
+      if (hi == 0 && !m_config.material.empty()) {
+	h_3d_vol  = new TH3D("h3d_vol" ,"h3d_vol" ,m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
+	h_3d_norm = new TH3D("h3d_norm","h3d_norm",m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
+	h_3d_vol  ->SetXTitle(xtitle);
+	h_3d_norm ->SetXTitle(xtitle);
+	h_3d_vol  ->SetYTitle("r [cm]");
+	h_3d_norm ->SetYTitle("r [cm]");
+	h_3d_vol  ->SetZTitle("#phi [#circ]");
+	h_3d_norm ->SetZTitle("#phi [#circ]");
+	std::string hname("Volume fraction of ");
+	hname += m_config.material;
+	h_3d_vol  ->SetTitle(hname.data());
+	h_3d_norm ->SetTitle("Volume norm");
+      }
+      // normalize to volume element per bin
+      for(int i=0;i<h3d->GetNbinsX();i++) { 
+	for(int j=0;j<h3d->GetNbinsY();j++) { 
+	  for(int k=0;k<h3d->GetNbinsZ();k++) { 
+	    int vBin = m_config.nBinsr3d*m_config.nBinsphi3d*i+m_config.nBinsphi3d*j+k;
+	    int iBin = h3d->GetBin(i+1,j+1,k+1); 
+	    double phi0=h3d->GetZaxis()->GetBinLowEdge(k+1);
+	    double phi1=h3d->GetZaxis()->GetBinUpEdge(k+1);
+	    double r0=h3d->GetYaxis()->GetBinLowEdge(j+1);
+	    double r1=h3d->GetYaxis()->GetBinUpEdge(j+1);
+	    double z0=h3d->GetXaxis()->GetBinLowEdge(i+1);
+	    double z1=h3d->GetXaxis()->GetBinUpEdge(i+1); 
+	    double vol=(z1-z0)*M_PI*(r1*r1-r0*r0)*(phi1-phi0)/360.; 
+	    // if |z| instead of z double the volume
+	    if ( m_config.zMinFull >= 0 ) vol *= 2; 
+	    // assume that phi-range corresponds to full 360 degrees in case 
+	    // lower phi boundary is 0 - i.e. all phi-segments mapped to first
+	    if ( m_config.phiMinZoom == 0 ) {
+	      vol *= 360./m_config.phiMaxZoom;
+	      // if positive y hemisphere is used only -- half the volume
+	      if ( m_config.posYOnly ) 
+		vol *= 0.5; 
+	    }
+	    double val = (*(pVal3d[hi]))[vBin];
+	    h3d->SetBinContent(iBin,val/vol);
+	    if (hi == 0 && !m_config.material.empty()) {
+	      // VOL
+	      val =maps.m_3d_vol[vBin];
+	      h_3d_vol->SetBinContent(iBin,val/vol);
+	      // NORM
+	      val =maps.m_3d_norm[vBin];
+	      h_3d_norm->SetBinContent(iBin,val/vol);
+	    }
+	  }
+	}
+      }
+      h3d->Write();
+      h3d->Delete();
+      if (hi == 0 && !m_config.material.empty()) {
+	h_3d_vol->Write();
+	h_3d_vol->Delete();
+	h_3d_norm->Write();
+	h_3d_norm->Delete();
+      }
+    }
+
+    // spectra
+    
+    std::vector<const char *> hSpecNames = {
+      "rz_neut_spec","rz_gamm_spec","rz_elec_spec","rz_muon_spec","rz_pion_spec","rz_prot_spec","rz_rest_spec",
+      "full_rz_neut_spec","full_rz_gamm_spec","full_rz_elec_spec","full_rz_muon_spec","full_rz_pion_spec","full_rz_prot_spec","full_rz_rest_spec"
+    };
+
+    std::vector<const char *> hSpecTitles = {
+      "FLUX [n(log_{10}(E/MeV))/cm^{2}]","FLUX [#gamma(log_{10}(E/MeV))/cm^{2}]","FLUX [e^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [#mu^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [#pi^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [p(log_{10}(E/MeV))/cm^{2}]","FLUX [rest(log_{10}(E/MeV))/cm^{2}]",
+      "FLUX [n(log_{10}(E/MeV))/cm^{2}]","FLUX [#gamma(log_{10}(E/MeV))/cm^{2}]","FLUX [e^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [#mu^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [#pi^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [p(log_{10}(E/MeV))/cm^{2}]","FLUX [rest(log_{10}(E/MeV))/cm^{2}]"
+    };
+
+    std::vector<double> zMinSpec = {
+      m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,m_config.zMinZoom,
+      m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull,m_config.zMinFull
+    };
+ 
+    std::vector<double> zMaxSpec = {
+      m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,m_config.zMaxZoom,
+      m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull,m_config.zMaxFull
+    };
+ 
+    std::vector<double> rMinSpec = {
+      m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,m_config.rMinZoom,
+      m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull,m_config.rMinFull
+    };
+ 
+    std::vector<double> rMaxSpec = {
+      m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,m_config.rMaxZoom,
+      m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull,m_config.rMaxFull
+    };
+
+    std::vector<double> logEMin = {
+      m_config.logEMinn,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,
+      m_config.logEMinn,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino
+    };
+ 
+    std::vector<double> logEMax = {
+      m_config.logEMaxn,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,
+      m_config.logEMaxn,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo
+    };
+ 
+    for(unsigned int hi=0;hi<hSpecNames.size();hi++) {
+      TH3D *hSpec = new TH3D(hSpecNames[hi],hSpecNames[hi],m_config.nBinsz,zMinSpec[hi],zMaxSpec[hi],m_config.nBinsr,rMinSpec[hi],rMaxSpec[hi],nBinslogE[hi],logEMin[hi],logEMax[hi]);
+      hSpec->SetXTitle(xtitle);
+      hSpec->SetYTitle("r [cm]");
+      hSpec->SetZTitle("log_{10}(E/MeV)");
+      hSpec->SetTitle(hSpecTitles[hi]);
+      // normalize to volume element per bin
+      for(int i=0;i<hSpec->GetNbinsX();i++) { 
+	for(int j=0;j<hSpec->GetNbinsY();j++) {
+	  double r0=hSpec->GetYaxis()->GetBinLowEdge(j+1);
+	  double r1=hSpec->GetYaxis()->GetBinUpEdge(j+1);
+	  double z0=hSpec->GetXaxis()->GetBinLowEdge(i+1);
+	  double z1=hSpec->GetXaxis()->GetBinUpEdge(i+1); 
+	  double vol=(z1-z0)*M_PI*(r1*r1-r0*r0);
+	  // if |z| instead of z double the volume
+	  if ( m_config.zMinFull >= 0 ) vol *= 2; 
+	  // if positive y hemisphere is used only -- half the volume
+	  if ( m_config.posYOnly ) vol *= 0.5; 
+	  double val;
+	  // Energy Spectra
+	  for(int k=0;k<hSpec->GetNbinsZ();k++) { 
+	    int kBin = hSpec->GetBin(i+1,j+1,k+1); 
+	    int vBinE = m_config.nBinsr*nBinslogE[hi]*i+j*nBinslogE[hi]+k;
+	    val = (*(pValSpec[hi]))[vBinE];
+	    hSpec->SetBinContent(kBin,val/vol);
+	  }
+	}
+      }
+      hSpec->Write();
+      hSpec->Delete();
+    }
+    
+    std::vector<const char *> hThetaSpecNames = {
+      "theta_dphi_full_rz_neut_spec","theta_dphi_full_rz_gamm_spec","theta_dphi_full_rz_elec_spec","theta_dphi_full_rz_muon_spec","theta_dphi_full_rz_pion_spec","theta_dphi_full_rz_prot_spec","theta_dphi_full_rz_rchgd_spec","theta_dphi_full_rz_rneut_spec"
+    };
+
+    std::vector<const char *> hThetaSpecTitles = {
+      "FLUX [n(log_{10}(E/MeV))/cm^{2}]","FLUX [#gamma(log_{10}(E/MeV))/cm^{2}]","FLUX [e^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [#mu^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [#pi^{#pm}(log_{10}(E/MeV))/cm^{2}]","FLUX [p(log_{10}(E/MeV))/cm^{2}]","FLUX [rest^{chgd}(log_{10}(E/MeV))/cm^{2}]","FLUX [rest^{neut}(log_{10}(E/MeV))/cm^{2}]"
+    };
+
+    std::vector<double> thetalogEMin = {
+      m_config.logEMinn,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino,m_config.logEMino
+    };
+ 
+    std::vector<double> thetalogEMax = {
+      m_config.logEMaxn,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo,m_config.logEMaxo
+    };
+ 
+    for(unsigned int hi=0;hi<hThetaSpecNames.size();hi++) {
+      for(int i=0;i<m_config.nBinstheta;i++) {
+	for(int j=0;j<m_config.nBinsdphi;j++) {
+	  TString hname(hThetaSpecNames[hi]);
+	  hname += "_";
+	  hname += (int)(m_config.thetaMin +   i  *(m_config.thetaMax-m_config.thetaMin)/m_config.nBinstheta);
+	  hname += "_";
+	  hname += (int)(m_config.thetaMin + (i+1)*(m_config.thetaMax-m_config.thetaMin)/m_config.nBinstheta);
+	  hname += "_";
+	  hname += (int)(j*360./m_config.nBinsdphi);
+	  hname += "_";
+	  hname += (int)((j+1)*360./m_config.nBinsdphi);
+	  TH3D * hThetaSpec = new TH3D(hname.Data(),hname.Data(),m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,nBinsThetalogE[hi],thetalogEMin[hi],thetalogEMax[hi]);
+	  
+	  hThetaSpec->SetXTitle(xtitle);
+	  hThetaSpec->SetYTitle("r [cm]");
+	  hThetaSpec->SetZTitle("log_{10}(E/MeV)");
+	  hname = TString(hThetaSpecTitles[hi]);
+	  hname += " Theta: ";
+	  hname += (int)(m_config.thetaMin +   i  *(m_config.thetaMax-m_config.thetaMin)/m_config.nBinstheta);
+	  hname += " - ";
+	  hname += (int)(m_config.thetaMin + (i+1)*(m_config.thetaMax-m_config.thetaMin)/m_config.nBinstheta);
+	  hname += " DPhi: ";
+	  hname += (int)(j*360./m_config.nBinsdphi);
+	  hname += " - ";
+	  hname += (int)((j+1)*360./m_config.nBinsdphi);
+	  hThetaSpec->SetTitle(hname.Data());
+	  // normalize to volume element per bin
+	  for(int k=0;k<hThetaSpec->GetNbinsX();k++) { 
+	    for(int l=0;l<hThetaSpec->GetNbinsY();l++) {
+	      double r0=hThetaSpec->GetYaxis()->GetBinLowEdge(l+1);
+	      double r1=hThetaSpec->GetYaxis()->GetBinUpEdge(l+1);
+	      double z0=hThetaSpec->GetXaxis()->GetBinLowEdge(k+1);
+	      double z1=hThetaSpec->GetXaxis()->GetBinUpEdge(k+1); 
+	      double vol=(z1-z0)*M_PI*(r1*r1-r0*r0);
+	      // if |z| instead of z double the volume
+	      if ( m_config.zMinFull >= 0 ) vol *= 2; 
+	      // if positive y hemisphere is used only -- half the volume
+	      if ( m_config.posYOnly ) vol *= 0.5; 
+	      double val;
+	      // Energy Spectra
+	      for(int m=0;m<hThetaSpec->GetNbinsZ();m++) { 
+		int mBin = hThetaSpec->GetBin(k+1,l+1,m+1); 
+		int vBinETh = m_config.nBinsr*nBinsThetalogE[hi]*m_config.nBinsdphi*m_config.nBinstheta*k+l*nBinsThetalogE[hi]*m_config.nBinsdphi*m_config.nBinstheta+m*m_config.nBinsdphi*m_config.nBinstheta+i*m_config.nBinsdphi+j;
+		val = (*(pValThetaSpec[hi]))[vBinETh];
+		hThetaSpec->SetBinContent(mBin,val/vol);
+	      }
+	    }
+	  }
+	  hThetaSpec->Write();
+	  hThetaSpec->Delete();
+	}
+      }
+    }
+    
+    // time dependent TID maps zoom
     TH3D * h_rz_tid_time       = new TH3D("rz_tid_time" ,"rz_tid_time"           ,m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinslogT,m_config.logTMin,m_config.logTMax);
-    TH3D * h_full_rz_tid_time  = new TH3D("full_rz_tid_time" ,"full_rz_tid_time" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogT,m_config.logTMin,m_config.logTMax);
     h_rz_tid_time     ->SetXTitle(xtitle);
-    h_full_rz_tid_time->SetXTitle(xtitle);
     h_rz_tid_time     ->SetYTitle("r [cm]");
-    h_full_rz_tid_time->SetYTitle("r [cm]");
     h_rz_tid_time     ->SetZTitle("log_{10}(t_{cut}/s)");
-    h_full_rz_tid_time->SetZTitle("log_{10}(t_{cut}/s)");
 
-    // element mass fraction maps
+    // element mass fraction maps zoom
     TH3D * h_rz_element       = new TH3D("rz_element" ,"rz_element"           ,m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom,m_config.elemZMax-m_config.elemZMin+1,m_config.elemZMin-0.5,m_config.elemZMax+0.5);
-    TH3D * h_full_rz_element  = new TH3D("full_rz_element" ,"full_rz_element" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.elemZMax-m_config.elemZMin+1,m_config.elemZMin-0.5,m_config.elemZMax+0.5);
     h_rz_element     ->SetXTitle(xtitle);
-    h_full_rz_element->SetXTitle(xtitle);
     h_rz_element     ->SetYTitle("r [cm]");
-    h_full_rz_element->SetYTitle("r [cm]");
     h_rz_element     ->SetZTitle("Z");
-    h_full_rz_element->SetZTitle("Z");
-
-    TH2D * h_rz_vol  = 0;
-    TH2D * h_rz_norm = 0;
-    TH2D * h_full_rz_vol  = 0;
-    TH2D * h_full_rz_norm = 0;
-    TH3D * h_3d_vol  = 0;
-    TH3D * h_3d_norm = 0;
-    if (!m_config.material.empty()) {
-      // need volume fraction only if particular material is selected
-      //
-      // the maps for TID, NIEL and SEE need to be divided by the ratio of (vol/norm) in order to get
-      // the proper estimate per volume bin for the selected material. 
-      // This is *not* done in the tool directly and left to the user after having summed the histograms
-      // from many individual jobs.
-      // 
-      h_rz_vol  = new TH2D("rz_vol" ,"rz_vol" ,m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-      h_rz_norm = new TH2D("rz_norm","rz_norm",m_config.nBinsz,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr,m_config.rMinZoom,m_config.rMaxZoom);
-      h_full_rz_vol  = new TH2D("full_rz_vol" ,"full_rz_vol" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-      h_full_rz_norm = new TH2D("full_rz_norm","full_rz_norm",m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull);
-      h_3d_vol  = new TH3D("h3d_vol" ,"h3d_vol" ,m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-      h_3d_norm = new TH3D("h3d_norm","h3d_norm",m_config.nBinsz3d,m_config.zMinZoom,m_config.zMaxZoom,m_config.nBinsr3d,m_config.rMinZoom,m_config.rMaxZoom,m_config.nBinsphi3d,m_config.phiMinZoom,m_config.phiMaxZoom);
-
-      h_rz_vol  ->SetXTitle(xtitle);
-      h_rz_norm ->SetXTitle(xtitle);
-      h_rz_vol  ->SetYTitle("r [cm]");
-      h_rz_norm ->SetYTitle("r [cm]");
-      std::string hname("Volume fraction of ");
-      hname += m_config.material;
-      h_rz_vol  ->SetZTitle(hname.data());
-      h_rz_norm ->SetZTitle("Volume norm");
-
-      h_full_rz_vol  ->SetXTitle(xtitle);
-      h_full_rz_norm ->SetXTitle(xtitle);
-      h_full_rz_vol  ->SetYTitle("r [cm]");
-      h_full_rz_norm ->SetYTitle("r [cm]");
-      h_full_rz_vol  ->SetZTitle(hname.data());
-      h_full_rz_norm ->SetZTitle("Volume norm");
-
-      h_3d_vol  ->SetXTitle(xtitle);
-      h_3d_norm ->SetXTitle(xtitle);
-      h_3d_vol  ->SetYTitle("r [cm]");
-      h_3d_norm ->SetYTitle("r [cm]");
-      h_3d_vol  ->SetZTitle("#phi [#circ]");
-      h_3d_norm ->SetZTitle("#phi [#circ]");
-      h_3d_vol  ->SetTitle(hname.data());
-      h_3d_norm ->SetTitle("Volume norm");
-    }
 
     // normalize to volume element per bin
-    for(int i=0;i<h_rz_tid->GetNbinsX();i++) { 
-      for(int j=0;j<h_rz_tid->GetNbinsY();j++) { 
-	int iBin = h_rz_tid->GetBin(i+1,j+1); 
-	int vBin = m_config.nBinsr*i+j;
-	double r0=h_rz_tid->GetYaxis()->GetBinLowEdge(j+1);
-	double r1=h_rz_tid->GetYaxis()->GetBinUpEdge(j+1);
-	double z0=h_rz_tid->GetXaxis()->GetBinLowEdge(i+1);
-	double z1=h_rz_tid->GetXaxis()->GetBinUpEdge(i+1); 
+    for(int i=0;i<h_rz_tid_time->GetNbinsX();i++) { 
+      for(int j=0;j<h_rz_tid_time->GetNbinsY();j++) { 
+	double r0=h_rz_tid_time->GetYaxis()->GetBinLowEdge(j+1);
+	double r1=h_rz_tid_time->GetYaxis()->GetBinUpEdge(j+1);
+	double z0=h_rz_tid_time->GetXaxis()->GetBinLowEdge(i+1);
+	double z1=h_rz_tid_time->GetXaxis()->GetBinUpEdge(i+1); 
 	double vol=(z1-z0)*M_PI*(r1*r1-r0*r0);
 	// if |z| instead of z double the volume
 	if ( m_config.zMinFull >= 0 ) vol *= 2; 
 	// if positive y hemisphere is used only -- half the volume
 	if ( m_config.posYOnly ) vol *= 0.5; 
 	double val;
-	// TID
-	val =maps.m_rz_tid[vBin];
-	h_rz_tid->SetBinContent(iBin,val/vol);
-	// EION
-	val =maps.m_rz_eion[vBin];
-	h_rz_eion->SetBinContent(iBin,val/vol);
-	// NIEL
-	val =maps.m_rz_niel[vBin];
-	h_rz_niel->SetBinContent(iBin,val/vol);
-	// SEE
-	val =maps.m_rz_h20[vBin];
-	h_rz_h20->SetBinContent(iBin,val/vol);
-	// NEUT
-	val =maps.m_rz_neut[vBin];
-	h_rz_neut->SetBinContent(iBin,val/vol);
-	// CHAD
-	val =maps.m_rz_chad[vBin];
-	h_rz_chad->SetBinContent(iBin,val/vol);
-	// Neutron Energy Spectra
-	for(int k=0;k<h_rz_neut_spec->GetNbinsZ();k++) { 
-	  int kBin = h_rz_neut_spec->GetBin(i+1,j+1,k+1); 
-	  int vBinE = m_config.nBinsr*m_config.nBinslogEn*i+j*m_config.nBinslogEn+k;
-	  val =maps.m_rz_neut_spec[vBinE];
-	  h_rz_neut_spec->SetBinContent(kBin,val/vol);
-	}
-	// All other particle's Energy Spectra
-	for(int k=0;k<h_rz_gamm_spec->GetNbinsZ();k++) { 
-	  int kBin = h_rz_gamm_spec->GetBin(i+1,j+1,k+1); 
-	  int vBinE = m_config.nBinsr*m_config.nBinslogEo*i+j*m_config.nBinslogEo+k;
-	  val =maps.m_rz_gamm_spec[vBinE];
-	  h_rz_gamm_spec->SetBinContent(kBin,val/vol);
-	  val =maps.m_rz_elec_spec[vBinE];
-	  h_rz_elec_spec->SetBinContent(kBin,val/vol);
-	  val =maps.m_rz_muon_spec[vBinE];
-	  h_rz_muon_spec->SetBinContent(kBin,val/vol);
-	  val =maps.m_rz_pion_spec[vBinE];
-	  h_rz_pion_spec->SetBinContent(kBin,val/vol);
-	  val =maps.m_rz_prot_spec[vBinE];
-	  h_rz_prot_spec->SetBinContent(kBin,val/vol);
-	  val =maps.m_rz_rest_spec[vBinE];
-	  h_rz_rest_spec->SetBinContent(kBin,val/vol);
-	}
 	// Time dependent TID maps
 	for(int k=0;k<h_rz_tid_time->GetNbinsZ();k++) { 
 	  int kBin = h_rz_tid_time->GetBin(i+1,j+1,k+1); 
@@ -553,90 +613,39 @@ namespace G4UA{
 	  val =maps.m_rz_element[vBinElem];
 	  h_rz_element->SetBinContent(kBin,val/vol);
 	}
-	if (!m_config.material.empty()) {
-	  // need volume fraction only if particular material is selected
-	  // VOL
-	  val =maps.m_rz_vol[vBin];
-	  h_rz_vol->SetBinContent(iBin,val/vol);
-	  // NORM
-	  val =maps.m_rz_norm[vBin];
-	  h_rz_norm->SetBinContent(iBin,val/vol);
-	}
       }
     }
-    h_rz_tid->Write();
-    h_rz_eion->Write();
-    h_rz_niel->Write();
-    h_rz_h20->Write();
-    h_rz_neut->Write();
-    h_rz_chad->Write();
-    h_rz_neut_spec->Write();
-    h_rz_gamm_spec->Write();
-    h_rz_elec_spec->Write();
-    h_rz_muon_spec->Write();
-    h_rz_pion_spec->Write();
-    h_rz_prot_spec->Write();
-    h_rz_rest_spec->Write();
+
     h_rz_tid_time->Write();
+    h_rz_tid_time->Delete();
     h_rz_element->Write();
+    h_rz_element->Delete();
     
+    // time dependent TID maps full
+    TH3D * h_full_rz_tid_time  = new TH3D("full_rz_tid_time" ,"full_rz_tid_time" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.nBinslogT,m_config.logTMin,m_config.logTMax);
+    h_full_rz_tid_time->SetXTitle(xtitle);
+    h_full_rz_tid_time->SetYTitle("r [cm]");
+    h_full_rz_tid_time->SetZTitle("log_{10}(t_{cut}/s)");
+
+    // element mass fraction maps full
+    TH3D * h_full_rz_element  = new TH3D("full_rz_element" ,"full_rz_element" ,m_config.nBinsz,m_config.zMinFull,m_config.zMaxFull,m_config.nBinsr,m_config.rMinFull,m_config.rMaxFull,m_config.elemZMax-m_config.elemZMin+1,m_config.elemZMin-0.5,m_config.elemZMax+0.5);
+    h_full_rz_element->SetXTitle(xtitle);
+    h_full_rz_element->SetYTitle("r [cm]");
+    h_full_rz_element->SetZTitle("Z");
+
     // normalize to volume element per bin
-    for(int i=0;i<h_full_rz_tid->GetNbinsX();i++) { 
-      for(int j=0;j<h_full_rz_tid->GetNbinsY();j++) { 
-	int iBin = h_full_rz_tid->GetBin(i+1,j+1); 
-	int vBin = m_config.nBinsr*i+j;
-	double r0=h_full_rz_tid->GetYaxis()->GetBinLowEdge(j+1);
-	double r1=h_full_rz_tid->GetYaxis()->GetBinUpEdge(j+1);
-	double z0=h_full_rz_tid->GetXaxis()->GetBinLowEdge(i+1);
-	double z1=h_full_rz_tid->GetXaxis()->GetBinUpEdge(i+1); 
+    for(int i=0;i<h_full_rz_tid_time->GetNbinsX();i++) { 
+      for(int j=0;j<h_full_rz_tid_time->GetNbinsY();j++) { 
+	double r0=h_full_rz_tid_time->GetYaxis()->GetBinLowEdge(j+1);
+	double r1=h_full_rz_tid_time->GetYaxis()->GetBinUpEdge(j+1);
+	double z0=h_full_rz_tid_time->GetXaxis()->GetBinLowEdge(i+1);
+	double z1=h_full_rz_tid_time->GetXaxis()->GetBinUpEdge(i+1); 
 	double vol=(z1-z0)*M_PI*(r1*r1-r0*r0); 
 	// if |z| instead of z double the volume
 	if ( m_config.zMinFull >= 0 ) vol *= 2; 
 	// if positive y hemisphere is used only -- half the volume
 	if ( m_config.posYOnly ) vol *= 0.5; 
 	double val;
-	// TID
-	val =maps.m_full_rz_tid[vBin];
-	h_full_rz_tid->SetBinContent(iBin,val/vol);
-	// EION
-	val =maps.m_full_rz_eion[vBin];
-	h_full_rz_eion->SetBinContent(iBin,val/vol);
-	// NIEL
-	val =maps.m_full_rz_niel[vBin];
-	h_full_rz_niel->SetBinContent(iBin,val/vol);
-	// SEE
-	val =maps.m_full_rz_h20[vBin];
-	h_full_rz_h20->SetBinContent(iBin,val/vol);
-	// NEUT
-	val =maps.m_full_rz_neut[vBin];
-	h_full_rz_neut->SetBinContent(iBin,val/vol);
-	// CHAD
-	val =maps.m_full_rz_chad[vBin];
-	h_full_rz_chad->SetBinContent(iBin,val/vol);
-	// Neutron Energy Spectra
-	for(int k=0;k<h_full_rz_neut_spec->GetNbinsZ();k++) { 
-	  int kBin = h_full_rz_neut_spec->GetBin(i+1,j+1,k+1); 
-	  int vBinE = m_config.nBinsr*m_config.nBinslogEn*i+j*m_config.nBinslogEn+k;
-	  val =maps.m_full_rz_neut_spec[vBinE];
-	  h_full_rz_neut_spec->SetBinContent(kBin,val/vol);
-	}
-	// All other particle's Energy Spectra
-	for(int k=0;k<h_full_rz_gamm_spec->GetNbinsZ();k++) { 
-	  int kBin = h_full_rz_gamm_spec->GetBin(i+1,j+1,k+1); 
-	  int vBinE = m_config.nBinsr*m_config.nBinslogEo*i+j*m_config.nBinslogEo+k;
-	  val =maps.m_full_rz_gamm_spec[vBinE];
-	  h_full_rz_gamm_spec->SetBinContent(kBin,val/vol);
-	  val =maps.m_full_rz_elec_spec[vBinE];
-	  h_full_rz_elec_spec->SetBinContent(kBin,val/vol);
-	  val =maps.m_full_rz_muon_spec[vBinE];
-	  h_full_rz_muon_spec->SetBinContent(kBin,val/vol);
-	  val =maps.m_full_rz_pion_spec[vBinE];
-	  h_full_rz_pion_spec->SetBinContent(kBin,val/vol);
-	  val =maps.m_full_rz_prot_spec[vBinE];
-	  h_full_rz_prot_spec->SetBinContent(kBin,val/vol);
-	  val =maps.m_full_rz_rest_spec[vBinE];
-	  h_full_rz_rest_spec->SetBinContent(kBin,val/vol);
-	}
 	// Time dependent TID maps
 	for(int k=0;k<h_full_rz_tid_time->GetNbinsZ();k++) { 
 	  int kBin = h_full_rz_tid_time->GetBin(i+1,j+1,k+1); 
@@ -651,103 +660,12 @@ namespace G4UA{
 	  val =maps.m_full_rz_element[vBinElem];
 	  h_full_rz_element->SetBinContent(kBin,val/vol);
 	}
-	if (!m_config.material.empty()) {
-	  // need volume fraction only if particular material is selected
-	  // VOL
-	  val =maps.m_full_rz_vol[vBin];
-	  h_full_rz_vol->SetBinContent(iBin,val/vol);
-	  // NORM
-	  val =maps.m_full_rz_norm[vBin];
-	  h_full_rz_norm->SetBinContent(iBin,val/vol);
-	}
       }
     }
-    h_full_rz_tid->Write();
-    h_full_rz_eion->Write();
-    h_full_rz_niel->Write();
-    h_full_rz_h20->Write();
-    h_full_rz_neut->Write();
-    h_full_rz_chad->Write();
-    h_full_rz_neut_spec->Write();
-    h_full_rz_gamm_spec->Write();
-    h_full_rz_elec_spec->Write();
-    h_full_rz_muon_spec->Write();
-    h_full_rz_pion_spec->Write();
-    h_full_rz_prot_spec->Write();
-    h_full_rz_rest_spec->Write();
     h_full_rz_tid_time->Write();
+    h_full_rz_tid_time->Delete();
     h_full_rz_element->Write();
-
-    // normalize to volume element per bin
-    for(int i=0;i<h_3d_tid->GetNbinsX();i++) { /* |z| */
-      for(int j=0;j<h_3d_tid->GetNbinsY();j++) { /* r */
-	for(int k=0;k<h_3d_tid->GetNbinsZ();k++) { /* phi */
-	  int vBin = m_config.nBinsr3d*m_config.nBinsphi3d*i+m_config.nBinsphi3d*j+k;
-	  int iBin = h_3d_tid->GetBin(i+1,j+1,k+1); 
-	  double phi0=h_3d_tid->GetZaxis()->GetBinLowEdge(k+1);
-	  double phi1=h_3d_tid->GetZaxis()->GetBinUpEdge(k+1);
-	  double r0=h_3d_tid->GetYaxis()->GetBinLowEdge(j+1);
-	  double r1=h_3d_tid->GetYaxis()->GetBinUpEdge(j+1);
-	  double z0=h_3d_tid->GetXaxis()->GetBinLowEdge(i+1);
-	  double z1=h_3d_tid->GetXaxis()->GetBinUpEdge(i+1); 
-	  double vol=(z1-z0)*M_PI*(r1*r1-r0*r0)*(phi1-phi0)/360.; 
-	  // if |z| instead of z double the volume
-	  if ( m_config.zMinFull >= 0 ) vol *= 2; 
-	  // assume that phi-range corresponds to full 360 degrees in case 
-	  // lower phi boundary is 0 - i.e. all phi-segments mapped to first
-	  if ( m_config.phiMinZoom == 0 ) {
-	    vol *= 360./m_config.phiMaxZoom;
-	    // if positive y hemisphere is used only -- half the volume
-	    if ( m_config.posYOnly ) 
-	      vol *= 0.5; 
-	  }
-	  double val;
-	  // TID
-	  val =maps.m_3d_tid[vBin];
-	  h_3d_tid->SetBinContent(iBin,val/vol);
-	  // EION
-	  val =maps.m_3d_eion[vBin];
-	  h_3d_eion->SetBinContent(iBin,val/vol);
-	  // NIEL
-	  val =maps.m_3d_niel[vBin];
-	  h_3d_niel->SetBinContent(iBin,val/vol);
-	  // SEE
-	  val =maps.m_3d_h20[vBin];
-	  h_3d_h20->SetBinContent(iBin,val/vol);
-	  // NEUT
-	  val =maps.m_3d_neut[vBin];
-	  h_3d_neut->SetBinContent(iBin,val/vol);
-	  // CHAD
-	  val =maps.m_3d_chad[vBin];
-	  h_3d_chad->SetBinContent(iBin,val/vol);
-	  if (!m_config.material.empty()) {
-	    // need volume fraction only if particular material is selected
-	    // VOL
-	    val =maps.m_3d_vol[vBin];
-	    h_3d_vol->SetBinContent(iBin,val/vol);
-	    // NORM
-	    val =maps.m_3d_norm[vBin];
-	    h_3d_norm->SetBinContent(iBin,val/vol);
-	  }
-	}
-      }
-    }
-    h_3d_tid->Write();
-    h_3d_eion->Write();
-    h_3d_niel->Write();
-    h_3d_h20->Write();
-    h_3d_neut->Write();
-    h_3d_chad->Write();
-
-    if (!m_config.material.empty()) {
-      // need volume fraction only if particular material is selected
-      h_rz_vol->Write();
-      h_rz_norm->Write();
-      h_full_rz_vol->Write();
-      h_full_rz_norm->Write();
-      h_3d_vol->Write();
-      h_3d_norm->Write();
-    }
+    h_full_rz_element->Delete();
 
     f->Close();
 
diff --git a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMakerTool.h b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMakerTool.h
index 6313fafd75a540a561ff372b0680595084f564cd..8d0cb87f4d244c2cd5ce66e0bacdaa1ad076ee7e 100644
--- a/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMakerTool.h
+++ b/Simulation/G4Utilities/G4UserActions/src/RadiationMapsMakerTool.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef G4USERACTIONS_G4UA__RADIATIONMAPSMAKERTOOL_H 
diff --git a/Simulation/G4Utilities/Geo2G4/CMakeLists.txt b/Simulation/G4Utilities/Geo2G4/CMakeLists.txt
index 65e07185004cac9b9dab1a7d69fd7769dcc436c3..0d0c795306414057ef6920e8a78da67db7158f0f 100644
--- a/Simulation/G4Utilities/Geo2G4/CMakeLists.txt
+++ b/Simulation/G4Utilities/Geo2G4/CMakeLists.txt
@@ -5,22 +5,6 @@
 # Declare the package name:
 atlas_subdir( Geo2G4 )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          DetectorDescription/GeoModel/GeoSpecialShapes
-                          DetectorDescription/GeoModel/GeoModelUtilities
-			  DetectorDescription/GeoPrimitives
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/SimHelpers
-                          Simulation/G4Utilities/GeoMaterial2G4 )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( CLHEP )
diff --git a/Simulation/G4Utilities/GeoMaterial2G4/CMakeLists.txt b/Simulation/G4Utilities/GeoMaterial2G4/CMakeLists.txt
index 5c6cf10fdb0e448dfe99b8ea04b79c5c3602e5c6..08250ecf2aad22a038d27c25e0e16d6bcfc012a3 100644
--- a/Simulation/G4Utilities/GeoMaterial2G4/CMakeLists.txt
+++ b/Simulation/G4Utilities/GeoMaterial2G4/CMakeLists.txt
@@ -5,14 +5,6 @@
 # Declare the package name:
 atlas_subdir( GeoMaterial2G4 )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          DetectorDescription/GeoModel/GeoModelUtilities )
-
 # External dependencies:
 find_package( Geant4 )
 find_package( CLHEP )
diff --git a/Simulation/G4Utilities/MCTruthAlgs/CMakeLists.txt b/Simulation/G4Utilities/MCTruthAlgs/CMakeLists.txt
index 991e913f851532177f46a9d60e9652ac558e19ee..22e41cb97d486a9349964d5b7d06c23faeb8ffef 100644
--- a/Simulation/G4Utilities/MCTruthAlgs/CMakeLists.txt
+++ b/Simulation/G4Utilities/MCTruthAlgs/CMakeLists.txt
@@ -5,13 +5,6 @@
 # Declare the package name:
 atlas_subdir( MCTruthAlgs )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          GaudiKernel
-                          PRIVATE
-                          Simulation/G4Sim/TrackRecord )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( HepPDT )
diff --git a/Simulation/G4Utilities/MCTruthSimAlgs/CMakeLists.txt b/Simulation/G4Utilities/MCTruthSimAlgs/CMakeLists.txt
index 88d84bad8cae560090ea99658ec29e63bdb5a18d..e9be74ed39bd9133c83095d28423b010d608a17d 100644
--- a/Simulation/G4Utilities/MCTruthSimAlgs/CMakeLists.txt
+++ b/Simulation/G4Utilities/MCTruthSimAlgs/CMakeLists.txt
@@ -5,22 +5,6 @@
 # Declare the package name:
 atlas_subdir( MCTruthSimAlgs )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Calorimeter/CaloSimEvent
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/PileUpTools
-                          Control/StoreGate
-                          Event/EventInfo
-                          Event/xAOD/xAODJet
-                          GaudiKernel
-                          Generators/GeneratorObjects
-                          Generators/TruthUtils
-                          MuonSpectrometer/MuonSimEvent
-                          Reconstruction/RecEvent
-                          Simulation/G4Sim/TrackRecord )
-
 # Component(s) in the package:
 atlas_add_component( MCTruthSimAlgs
                      src/*.cxx
diff --git a/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt b/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt
index 70e02fe3c05fbf2c2771d0758ce39dff29020700..4214bf122c2c5c52edc77caf6ea8c5763be1bd56 100644
--- a/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt
+++ b/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( TrackWriteFastSim )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/StoreGate
-                          Simulation/G4Sim/TrackRecord
-                          PRIVATE
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/MCTruth )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/HitManagement/CMakeLists.txt b/Simulation/HitManagement/CMakeLists.txt
index e7fe2fc3a05bef7b916386b68d5684c1d0dd69f5..c94bc29472d555f1428c3ce237f2e164fe2d390c 100644
--- a/Simulation/HitManagement/CMakeLists.txt
+++ b/Simulation/HitManagement/CMakeLists.txt
@@ -5,15 +5,6 @@
 # Declare the package name:
 atlas_subdir( HitManagement )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthContainers
-                          Control/AthenaKernel
-                          Event/EventInfo
-                          GaudiKernel
-                          PRIVATE
-                          AtlasTest/TestTools )
-
 # Component(s) in the package:
 atlas_add_library( HitManagement
                    src/*.cxx
diff --git a/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py b/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py
index c759bbb958f8e222eff5798130760525151c232a..0b28a9070f9b978296896205957d759ea211129d 100644
--- a/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py
+++ b/Simulation/ISF/ISF_Config/python/ISF_MainConfig.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
 
 """
 Tools configurations for ISF
@@ -367,10 +367,16 @@ def getKernel_MC12G4_IDCalo(name="ISF_Kernel_MC12G4_IDCalo", **kwargs):
 
 ############## Simulator: G4FastCalo ###############
 def getKernel_G4FastCalo(name="ISF_Kernel_G4FastCalo", **kwargs):
+    kwargs.setdefault("ParticleBroker"             , 'ISF_AFIIParticleBrokerSvc')
     kwargs.setdefault("BeamPipeSimulationSelectors", [ 'ISF_DefaultAFIIGeant4Selector' ]            )
     kwargs.setdefault("IDSimulationSelectors"      , [ 'ISF_DefaultAFIIGeant4Selector' ]            )
     kwargs.setdefault("CaloSimulationSelectors"    , [ 'ISF_MuonAFIIGeant4Selector',
                                                        'ISF_EtaGreater5ParticleKillerSimSelector',
+                                                       'ISF_PionG4FastCaloGeant4Selector',
+                                                       'ISF_ProtonG4FastCaloGeant4Selector',
+                                                       'ISF_NeutronG4FastCaloGeant4Selector',
+                                                       'ISF_ChargedKaonG4FastCaloGeant4Selector',
+                                                       'ISF_KLongG4FastCaloGeant4Selector',
                                                        'ISF_DefaultFastCaloSimV2Selector' ] )
     kwargs.setdefault("MSSimulationSelectors"      , [ 'ISF_DefaultAFIIGeant4Selector' ]            )
     kwargs.setdefault("CavernSimulationSelectors"  , [ 'ISF_DefaultParticleKillerSelector' ]        )
diff --git a/Simulation/ISF/ISF_Core/ISF_Algorithms/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Algorithms/CMakeLists.txt
index 75c22e7ffd34f32dd91343634da3a9a4e5de5ede..e9b973b08d093bc16514bfc2d3decfcd2d0416f2 100644
--- a/Simulation/ISF/ISF_Core/ISF_Algorithms/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Core/ISF_Algorithms/CMakeLists.txt
@@ -6,25 +6,6 @@
 # Declare the package name:
 atlas_subdir( ISF_Algorithms )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PRIVATE
-   GaudiKernel
-   Control/AthenaBaseComps
-   Control/StoreGate
-   DetectorDescription/AtlasDetDescr
-   InnerDetector/InDetSimEvent
-   LArCalorimeter/LArSimEvent
-   TileCalorimeter/TileSimEvent
-   MuonSpectrometer/MuonSimEvent
-   Generators/AtlasHepMC
-   Generators/GeneratorObjects
-   Simulation/Interfaces/HepMC_Interfaces
-   Simulation/ISF/ISF_Core/ISF_Event
-   Simulation/ISF/ISF_Core/ISF_Interfaces
-   Tools/PmbCxxUtils
-   AtlasTest/TestTools )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
diff --git a/Simulation/ISF/ISF_Core/ISF_AthenaPool/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_AthenaPool/CMakeLists.txt
index f1c6527b00fd82a42ecdce24fade0129ff06e487..5c430a28c36dc567f83c7245101647c640e904d5 100644
--- a/Simulation/ISF/ISF_Core/ISF_AthenaPool/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Core/ISF_AthenaPool/CMakeLists.txt
@@ -5,15 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_AthenaPool )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Database/AthenaPOOL/AthenaPoolUtilities
-                          Database/AtlasSealCLHEP
-                          PRIVATE
-                          Database/AthenaPOOL/AthenaPoolCnvSvc
-                          GaudiKernel
-                          Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent )
-
 # Component(s) in the package:
 atlas_add_poolcnv_library( ISF_AthenaPoolPoolCnv
                            src/*.cxx
diff --git a/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt
index 00e8e845b7431756ea82269060f7c7cb9d939a7f..9b64379cba7ff9a57d945eef28f72b87c5aa1e25 100644
--- a/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt
@@ -5,17 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_Event )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          AtlasTest/TestTools
-                          Control/AthenaBaseComps
-                          DetectorDescription/AtlasDetDescr
-                          DetectorDescription/GeoPrimitives
-                          Generators/AtlasHepMC
-                          Generators/GeneratorObjects
-                          GaudiKernel
-                          Simulation/Barcode/BarcodeEvent )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Eigen )
diff --git a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.h b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.h
index c1655f550908fbdbaa7f93bfe442b7cfbbd6c123..f020097eb5dff69f0e7af1e8162bfe2d1660e65d 100644
--- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.h
+++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -39,6 +39,7 @@ namespace ISF {
       float    m_cut_maxMomEta; //!< maximum pseudorapidity of particle momentum
       double   m_cut_minMom2;   //!< minimum squarde particle momentum magnitude
       double   m_cut_maxMom2;   //!< maximum squared particle momentum magnitude 
+      double   m_cut_maxEkin;   //!< maximum particle kinetic energy 
       float    m_cut_charge;    //!< particle charge
       int      m_cut_pdg;       //!< particle PDG code
   };
diff --git a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.icc b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.icc
index 6926d9260b10e13cc794495578b0465095122679..ea0a3934106bfb4cac0f04cf149a7ec5e0256a61 100644
--- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.icc
+++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.icc
@@ -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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -17,6 +17,7 @@ ISF::KinematicParticleCuts::KinematicParticleCuts() :
   m_cut_maxMomEta( 99.f),
   m_cut_minMom2(-1.),
   m_cut_maxMom2(-1.),
+  m_cut_maxEkin(-1.),
   m_cut_charge(ISF_UNDEF_CHARGE),
   m_cut_pdg(0)
 {
diff --git a/Simulation/ISF/ISF_Core/ISF_Interfaces/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Interfaces/CMakeLists.txt
index b0af11de8537b7e68bd0d1238ac87897a142c90c..63028887312e2b96930181027256e7e4e92494f0 100644
--- a/Simulation/ISF/ISF_Core/ISF_Interfaces/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Core/ISF_Interfaces/CMakeLists.txt
@@ -5,20 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_Interfaces )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          DetectorDescription/AtlasDetDescr
-                          DetectorDescription/GeoPrimitives
-                          Generators/GeneratorObjects
-                          GaudiKernel
-                          Generators/GeneratorObjects
-                          Simulation/Barcode/BarcodeEvent
-                          Simulation/G4Sim/TrackRecord
-                          Simulation/ISF/ISF_Core/ISF_Event )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Eigen )
diff --git a/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt
index 019b5e6e23c5f2b4c1846a7782187147700cce5f..27dfefdb3c56c795c22e9db681787764f543bf89 100644
--- a/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt
@@ -5,33 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_Services )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          AtlasGeometryCommon/SubDetectorEnvelopes
-                          Calorimeter/CaloIdentifier
-                          Calorimeter/CaloSimEvent
-                          Control/AthenaBaseComps
-                          Control/StoreGate
-                          DetectorDescription/AtlasDetDescr
-                          Generators/AtlasHepMC
-                          Generators/GeneratorObjects
-                          Generators/TruthUtils
-                          InnerDetector/InDetSimEvent
-                          MuonSpectrometer/MuonSimEvent
-                          Simulation/Barcode/BarcodeEvent
-                          Simulation/Barcode/BarcodeInterfaces
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Sim/MCTruth
-                          Simulation/G4Sim/SimHelpers
-                          Simulation/G4Sim/TrackRecord
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Simulation/ISF/ISF_HepMC/ISF_HepMC_Interfaces
-                          TileCalorimeter/TileSimEvent
-                          Tools/PmbCxxUtils )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Eigen )
@@ -116,13 +89,11 @@ atlas_add_test( TruthSvc_test
                   "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/test"
                 )
 
-
 #test ISF_ServicesConfigNew
 atlas_add_test( ISF_ServicesConfigNew_test
                 SCRIPT test/ISF_ServicesConfigNew_test.py
                 PROPERTIES TIMEOUT 300 )
 
-
 # Needed for the plugin service to see the test components
 # defined in the test binary.
 set_target_properties( ISF_Services_TruthSvc_test PROPERTIES ENABLE_EXPORTS True )
diff --git a/Simulation/ISF/ISF_Core/ISF_Tools/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Tools/CMakeLists.txt
index fc4ca04db1814e1f5e84bba0a974c6251a8e2731..5b8165fe255b83647da958ca5b88fb0b576c350a 100644
--- a/Simulation/ISF/ISF_Core/ISF_Tools/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Core/ISF_Tools/CMakeLists.txt
@@ -5,19 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_Tools )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          DetectorDescription/AtlasDetDescr
-                          Simulation/Barcode/BarcodeEvent
-                          Simulation/Barcode/BarcodeInterfaces
-                          Simulation/G4Sim/TrackRecord
-                          Generators/GeneratorObjects
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Core/ISF_Interfaces )
-
 # Component(s) in the package:
 atlas_add_component( ISF_Tools
                      src/*.cxx
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt
index 5edaa73a11bfaf2b178e81181cfdc120cb6444e5..97f8b0901d8964b7b1d44d4403fa9bfa61f8731d 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt
@@ -6,18 +6,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FastCaloSimEvent )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PUBLIC
-   Control/AthContainers
-   Control/AthenaKernel
-   Control/AthenaBaseComps
-   Calorimeter/CaloGeoHelpers
-   TileCalorimeter/TileSimEvent
-   PRIVATE
-   Calorimeter/CaloDetDescr
-   GaudiKernel )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( HepPDT )
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimInterfaces/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimInterfaces/CMakeLists.txt
index 44f850c88af490e8a631379386b53348680b390e..268ad136a41e3059b1000241757716e6af6d85ab 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimInterfaces/CMakeLists.txt
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimInterfaces/CMakeLists.txt
@@ -5,11 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FastCaloSimInterfaces )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          Simulation/ISF/ISF_Core/ISF_Event )
-
 # Component(s) in the package:
 atlas_add_library( ISF_FastCaloSimInterfaces
                    PUBLIC_HEADERS ISF_FastCaloSimInterfaces
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt
index 3d32cc5359aafde2f78e5027c7c4385ff8aa74fc..1d6c5e79795abb1f4c1ef484cf5778daf5fd541f 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt
@@ -5,45 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FastCaloSimParametrization )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Calorimeter/CaloDetDescr
-                          Calorimeter/CaloGeoHelpers
-                          Calorimeter/CaloInterface
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          DetectorDescription/Identifier
-                          GaudiKernel
-                          LArCalorimeter/LArElecCalib
-                          Simulation/Barcode/BarcodeEvent
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent
-                          Tracking/TrkEvent/TrkEventPrimitives
-                          Tracking/TrkEvent/TrkParameters
-                          Tracking/TrkExtrapolation/TrkExInterfaces
-                          PRIVATE
-                          Calorimeter/CaloEvent
-                          Calorimeter/CaloIdentifier
-                          Calorimeter/CaloTrackingGeometry
-                          Simulation/G4Sim/TrackRecord
-                          Database/AthenaPOOL/AthenaPoolUtilities
-                          DetectorDescription/GeoModel/GeoAdaptors
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          Event/EventInfo
-                          Event/NavFourMom
-                          Generators/AtlasHepMC
-                          Generators/GeneratorObjects
-                          LArCalorimeter/LArSimEvent
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimInterfaces
-                          TileCalorimeter/TileConditions
-                          TileCalorimeter/TileDetDescr
-                          TileCalorimeter/TileSimEvent
-                          Tracking/TrkDetDescr/TrkGeometry
-                          Tracking/TrkDetDescr/TrkSurfaces
-                          Tracking/TrkEvent/TrkMaterialOnTrack )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/CaloGeometry.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/CaloGeometry.h
index f7b161a9bfef8ca2f119003c5dcd7fc8b26c61e3..b47f1f73ca3950537f8f6099f41a00f12f19cbdc 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/CaloGeometry.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/CaloGeometry.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 ISF_FASTCALOSIMPARAMETRIZATION_CALOGEOMETRY_H
@@ -57,6 +57,7 @@ class CaloGeometry : virtual public ICaloGeometry {
     double rpos(int sample,double eta,int subpos = CaloSubPos::SUBPOS_MID) const;
     double zpos(int sample,double eta,int subpos = CaloSubPos::SUBPOS_MID) const;
     double rzpos(int sample,double eta,int subpos = CaloSubPos::SUBPOS_MID) const;
+    // cppcheck-suppress negativeContainerIndex; false positive
     bool   isCaloBarrel(int sample) const {return m_isCaloBarrel[sample];};
     static std::string SamplingName(int sample);
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.cxx
index 2ab79fe333c7d22a52225eb46f8a69fb3f4b1f5f..63051909e0ca2f1a2bb7c6c41fd9978e1879ed2f 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimCaloExtrapolation.cxx
@@ -267,7 +267,7 @@ std::vector<Trk::HitInfo>* FastCaloSimCaloExtrapolation::caloHits(const TFCSTrut
           int sample=(*it).detID;
           Amg::Vector3D hitPos = (*it).trackParms->position();
           ATH_MSG_DEBUG(" HIT: layer="<<sample<<" sample="<<sample-3000<<" eta="<<hitPos.eta()<<" phi="<<hitPos.phi()<<" d="<<hitPos.mag());
-          it++;
+          ++it;
         }
     }
 
@@ -277,7 +277,7 @@ std::vector<Trk::HitInfo>* FastCaloSimCaloExtrapolation::caloHits(const TFCSTrut
       int sample=(*it2).detID;
       Amg::Vector3D hitPos = (*it2).trackParms->position();
       ATH_MSG_DEBUG(" HIT: layer="<<sample<<" sample="<<sample-3000<<" eta="<<hitPos.eta()<<" phi="<<hitPos.phi()<<" r="<<hitPos.perp()<<" z="<<hitPos[Amg::z]);
-      it2++;
+      ++it2;
     }
 
   // Extrapolation may fail for very low pT charged particles. Enforce charge 0 to prevent this 
@@ -437,7 +437,7 @@ bool FastCaloSimCaloExtrapolation::get_calo_surface(TFCSExtrapolationState& resu
       std::vector<Trk::HitInfo>::iterator it = hitVector->begin();
 
       while (it != hitVector->end() && it->detID != (3000+sample) )
-        it++;
+        ++it;
 
       if(it==hitVector->end()) continue;
 
@@ -482,7 +482,7 @@ bool FastCaloSimCaloExtrapolation::get_calo_surface(TFCSExtrapolationState& resu
       std::vector<Trk::HitInfo>::iterator it = hitVector->begin();
 
       while( it < hitVector->end() && (*it).detID != 3 )
-        it++;   // to be updated
+        ++it;   // to be updated
 
       if (it==hitVector->end())
         return false;  // no calo intersection, abort
@@ -528,7 +528,7 @@ bool FastCaloSimCaloExtrapolation::get_calo_etaphi(TFCSExtrapolationState& resul
   std::vector<Trk::HitInfo>::iterator it = hitVector->begin();
 
   while( it!= hitVector->end() && it->detID != (3000+sample) )
-    it++;
+    ++it;
 
   //while ((*it).detID != (3000+sample) && it < hitVector->end() )  it++;
 
@@ -603,7 +603,7 @@ bool FastCaloSimCaloExtrapolation::get_calo_etaphi(TFCSExtrapolationState& resul
         {
           Amg::Vector3D hitPos1 = (*it).trackParms->position();
           int sid1=(*it).detID;
-          it++;
+          ++it;
           Amg::Vector3D hitPos2 = (*it).trackParms->position();
           int sid2=(*it).detID;
           double eta_avg=0.5*(hitPos1.eta()+hitPos2.eta());
@@ -712,7 +712,7 @@ bool FastCaloSimCaloExtrapolation::rz_cylinder_get_calo_etaphi(std::vector<Trk::
       Amg::Vector3D hitPos1 = (*it).trackParms->position();
       Amg::Vector3D hitMom1 = (*it).trackParms->momentum();
       int sid1=(*it).detID;
-      it++;
+      ++it;
       Amg::Vector3D hitPos2 = (*it).trackParms->position();
       Amg::Vector3D hitMom2 = (*it).trackParms->momentum();
       int sid2=(*it).detID;
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimParamAlg.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimParamAlg.cxx
index 51cc1d878e7676bf146fe8c20175f6c95299ca97..f5788d0a8f03ecb6200f012d4d7e6479dc772f75 100755
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimParamAlg.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/FastCaloSimParamAlg.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
 */
 
 
@@ -220,7 +220,7 @@ StatusCode FastCaloSimParamAlg::clusterize(ISF_FCS_Parametrization::FCS_StepInfo
   ISF_FCS_Parametrization::FCS_StepInfoCollection::iterator stepIter = stepinfo->begin();
   while(stepIter != stepinfo->end()) {
     if ((*stepIter)->valid()) {
-      stepIter++;
+      ++stepIter;
       continue;
     }
     ++nInvalid;
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/ISF_HitAnalysis.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/ISF_HitAnalysis.cxx
index d2f2584b8a6a7147ed252be56c8d3a77bd75ea9a..b16832585f618058812846ebab066768d4bb3170 100755
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/ISF_HitAnalysis.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/ISF_HitAnalysis.cxx
@@ -1200,7 +1200,7 @@ StatusCode ISF_HitAnalysis::execute()
   {
    LArHitContainer::const_iterator hi;
    int hitnumber = 0;
-   for (hi=(*iter).begin();hi!=(*iter).end();hi++)
+   for (hi=(*iter).begin();hi!=(*iter).end();++hi)
    {
           hitnumber++;
           GeoLArHit ghit(**hi);
@@ -1745,7 +1745,7 @@ std::vector<Trk::HitInfo>* ISF_HitAnalysis::caloHits(const HepMC::GenParticle& p
    int sample=(*it).detID;
    Amg::Vector3D hitPos = (*it).trackParms->position();
    ATH_MSG_DEBUG(" HIT: layer="<<sample<<" sample="<<sample-3000<<" eta="<<hitPos.eta()<<" phi="<<hitPos.phi()<<" d="<<hitPos.mag());
-   it++;
+   ++it;
   }
  }
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/CMakeLists.txt
index 29a7e7802fac28baa9eed1ff4893ad0a6a0c2821..1853b41a02f7ad644467b40741891f3a9ec188eb 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/CMakeLists.txt
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/CMakeLists.txt
@@ -5,22 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FastCaloSimSD )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/StoreGate
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools
-                          TileCalorimeter/TileG4/TileG4Interfaces
-                          PRIVATE
-                          Calorimeter/CaloDetDescr
-                          Calorimeter/CaloIdentifier
-                          Control/AthenaBaseComps
-                          Generators/GeneratorObjects
-                          LArCalorimeter/LArG4/LArG4Code
-                          Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent
-                          DetectorDescription/Identifier )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt
index f3972dc300f65b12aa40f8145917e2069fb6f3be..15887e9773b88561b664e5c0e03122eeadbbdac2 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt
@@ -5,33 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FastCaloSimServices )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaKernel
-                          DetectorDescription/IdDictParser
-                          Control/AthenaBaseComps
-                          Simulation/Barcode/BarcodeEvent
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Tracking/TrkEvent/TrkEventPrimitives
-                          Tracking/TrkExtrapolation/TrkExInterfaces
-                          Calorimeter/CaloInterface
-                          Calorimeter/CaloEvent
-                          Calorimeter/CaloDetDescr
-                          Control/StoreGate
-                          Event/NavFourMom
-                          Generators/AtlasHepMC
-                          Generators/GeneratorObjects
-                          Simulation/FastShower/FastCaloSim
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent
-                          Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimInterfaces
-                          Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization
-                          Tools/PathResolver )
-
-
-
 # External dependencies:
 find_package( CLHEP )
 find_package(lwtnn)
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/CMakeLists.txt
index a5d6ae7eb2f322e3c53c1f0b845ffe9967873638..61283b2cd776cf5eeba2877cd63272afd5c77e04 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/CMakeLists.txt
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/CMakeLists.txt
@@ -5,23 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_PunchThroughTools )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          DetectorDescription/GeoPrimitives
-                          Simulation/Barcode/BarcodeEvent
-                          Simulation/Barcode/BarcodeInterfaces
-                          Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimInterfaces
-                          AtlasGeometryCommon/SubDetectorEnvelopes
-                          Control/AthContainers
-                          GaudiKernel
-                          Generators/AtlasHepMC
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Tools/PathResolver )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Eigen )
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrInterfaces/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrInterfaces/CMakeLists.txt
index e03c63bf10a4c62fc04008ade90ed22a2a5c9458..b5a8e4a94c988fbd8cb2f1cf1b19e0858688b743 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrInterfaces/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrInterfaces/CMakeLists.txt
@@ -5,13 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FatrasDetDescrInterfaces )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          DetectorDescription/GeoPrimitives
-                          Event/EventPrimitives
-                          GaudiKernel
-                          InnerDetector/InDetDetDescr/InDetReadoutGeometry )
-
 # External dependencies:
 find_package( Eigen )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel/CMakeLists.txt
index 5dd3d35395b0ed4fd69b4e06c623d849db596c74..c6403f74dda61d5c1fb9afb531abdf0b1b7750de 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel/CMakeLists.txt
@@ -5,25 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FatrasDetDescrModel )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          DetectorDescription/GeoPrimitives
-                          DetectorDescription/Identifier
-                          Event/EventPrimitives
-                          InnerDetector/InDetDetDescr/InDetIdentifier
-                          InnerDetector/InDetDetDescr/InDetReadoutGeometry
-                          Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrInterfaces
-                          Tracking/TrkDetDescr/TrkDetDescrUtils
-                          Tracking/TrkDetDescr/TrkDetElementBase
-                          Tracking/TrkDetDescr/TrkGeometry
-                          Tracking/TrkDetDescr/TrkSurfaces
-                          Tracking/TrkEvent/TrkEventPrimitives
-                          Tracking/TrkEvent/TrkParameters
-                          PRIVATE
-                          Control/StoreGate
-                          GaudiKernel )
-
 # External dependencies:
 find_package( Eigen )
 find_package( CLHEP )
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/CMakeLists.txt
index 0181ab4307f7a8273f31283f53dc6429fc40f95c..c011d5fcbde25c49dc376965d25b785bbaee0305 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/CMakeLists.txt
@@ -5,23 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FatrasDetDescrTools )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          DetectorDescription/GeoPrimitives
-                          GaudiKernel
-                          Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrInterfaces
-                          Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel
-                          Tracking/TrkDetDescr/TrkDetDescrInterfaces
-                          Tracking/TrkDetDescr/TrkDetDescrUtils
-                          Tracking/TrkDetDescr/TrkSurfaces
-                          PRIVATE
-                          Control/StoreGate
-                          InnerDetector/InDetDetDescr/InDetIdentifier
-                          InnerDetector/InDetDetDescr/InDetReadoutGeometry
-                          Tracking/TrkDetDescr/TrkGeometry
-                          Tracking/TrkDetDescr/TrkVolumes )
-
 # External dependencies:
 find_package( Eigen )
 find_package( ROOT COMPONENTS RIO Core Tree MathCore Hist pthread )
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/CMakeLists.txt
index 9d74fa16b80896967ca3eea8c7b580669eeafb33..70f6d1bfbe8bc457df2edc822182621ff787d178 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/CMakeLists.txt
@@ -5,19 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FatrasEvent )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthLinks
-                          Control/AthenaKernel
-                          Control/CxxUtils
-                          DetectorDescription/Identifier
-                          InnerDetector/InDetRecEvent/InDetPrepRawData
-                          Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel
-                          Tracking/TrkEvent/TrkPrepRawData
-                          Tracking/TrkEvent/TrkRIO_OnTrack
-                          PRIVATE
-                          GaudiKernel )
-
 # External dependencies:
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasEventAthenaPool/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasEventAthenaPool/CMakeLists.txt
index dc81f08787e11037e6e967f95c2ec767a8fd828d..6cd3dad316e5f5681b6faf351ee71e9fcbaebbdb 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasEventAthenaPool/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasEventAthenaPool/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FatrasEventAthenaPool )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Database/AthenaPOOL/AthenaPoolUtilities
-                          PRIVATE
-                          Database/AthenaPOOL/AthenaPoolCnvSvc
-                          Database/AtlasSealCLHEP
-                          GaudiKernel
-                          Simulation/ISF/ISF_Fatras/ISF_FatrasEvent
-                          Simulation/ISF/ISF_Fatras/ISF_FatrasEventTPCnv )
-
 # Component(s) in the package:
 atlas_add_poolcnv_library( ISF_FatrasEventAthenaPoolPoolCnv
                            src/*.cxx
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasEventTPCnv/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasEventTPCnv/CMakeLists.txt
index 6eacd819ee2e1d1249cb51c72ff2381c9906bc63..1eb6069e5d3cde6b14e15462a8bb71cdd473f19f 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasEventTPCnv/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasEventTPCnv/CMakeLists.txt
@@ -6,28 +6,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FatrasEventTPCnv )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PUBLIC
-   Database/AthenaPOOL/AthenaPoolCnvSvc
-   Database/AthenaPOOL/AthenaPoolUtilities
-   DetectorDescription/Identifier
-   InnerDetector/InDetEventCnv/InDetEventTPCnv
-   Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel
-   Simulation/ISF/ISF_Fatras/ISF_FatrasEvent
-   Tracking/TrkEventCnv/TrkEventTPCnv
-   PRIVATE
-   AtlasTest/TestTools
-   Control/AthenaKernel
-   Control/AthAllocators
-   Control/StoreGate
-   DetectorDescription/GeoPrimitives
-   DetectorDescription/IdDictParser
-   Event/EventPrimitives
-   GaudiKernel
-   InnerDetector/InDetDetDescr/InDetIdentifier
-   Tracking/TrkDetDescr/TrkGeometry )
-
 # Component(s) in the package:
 atlas_add_tpcnv_library( ISF_FatrasEventTPCnv
    ISF_FatrasEventTPCnv/*.h ISF_FatrasEventTPCnv/ISF_FatrasEvent/*.h
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasServices/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasServices/CMakeLists.txt
index 19ece0bf0cf803a98f581bfe9d7d834c1a13292a..cbf9e11127292880badd463b50c117ce15feb209 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasServices/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasServices/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FatrasServices )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          DetectorDescription/AtlasDetDescr
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Tracking/TrkEvent/TrkTrack )
-
 # Component(s) in the package:
 atlas_add_component( ISF_FatrasServices
                      src/*.cxx
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/CMakeLists.txt
index b997dc29b97ca87f33c859b032016d7e5a8bc3c6..9ffb0c6249f9369854da1b9725ab6b2c341f2a9e 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/CMakeLists.txt
@@ -5,34 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FatrasTools )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          DetectorDescription/AtlasDetDescr
-                          DetectorDescription/GeoPrimitives
-                          Event/EventPrimitives
-                          Simulation/Barcode/BarcodeEvent
-                          Simulation/FastSimulation/FastSimulationEvent
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Simulation/ISF/ISF_Fatras/ISF_FatrasInterfaces
-                          Tracking/TrkDetDescr/TrkDetDescrInterfaces
-                          Tracking/TrkDetDescr/TrkDetDescrUtils
-                          Tracking/TrkDetDescr/TrkGeometry
-                          Tracking/TrkDetDescr/TrkSurfaces
-                          Tracking/TrkDetDescr/TrkVolumes
-                          Tracking/TrkEvent/TrkEventPrimitives
-                          Tracking/TrkEvent/TrkMaterialOnTrack
-                          Tracking/TrkEvent/TrkNeutralParameters
-                          Tracking/TrkEvent/TrkParameters
-                          Tracking/TrkEvent/TrkTrack
-                          Tracking/TrkExtrapolation/TrkExInterfaces
-                          Tracking/TrkExtrapolation/TrkExUtils )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Eigen )
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/CMakeLists.txt
index 0655fc16a86390bf028d22b6cf88b753a2be1269..5de1af4509949fc5f835c522d6f6a2ca4134a15f 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/CMakeLists.txt
@@ -5,23 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FatrasToolsG4 )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          GaudiKernel
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Fatras/ISF_FatrasInterfaces
-                          Tracking/TrkEvent/TrkEventPrimitives
-                          PRIVATE
-                          Generators/AtlasHepMC
-                          Control/StoreGate
-                          Simulation/Barcode/BarcodeEvent
-                          Simulation/G4Atlas/G4AtlasAlg
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Simulation/ISF/ISF_Geant4/ISF_Geant4Tools
-                          Tracking/TrkDetDescr/TrkGeometry )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( CLHEP )
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsID/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsID/CMakeLists.txt
index 231366c6b1a9f54c60a51f8d8efdbc850e29a834..a73f23f16bbaa2be662dbf1c2ad8166d400522fb 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsID/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsID/CMakeLists.txt
@@ -5,42 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_FatrasToolsID )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/AthContainers
-                          Control/StoreGate
-                          DetectorDescription/AtlasDetDescr
-                          DetectorDescription/IdDictDetDescr
-                          DetectorDescription/Identifier
-			  DetectorDescription/GeoPrimitives
-                          InnerDetector/InDetConditions/InDetConditionsSummaryService
-                          InnerDetector/InDetConditions/TRT_ConditionsServices
-                          InnerDetector/InDetDetDescr/InDetIdentifier
-                          InnerDetector/InDetDetDescr/InDetReadoutGeometry
-			  InnerDetector/InDetDetDescr/TRT_ReadoutGeometry
-                          InnerDetector/InDetRecEvent/InDetPrepRawData
-                          InnerDetector/InDetRecEvent/InDetRIO_OnTrack
-                          InnerDetector/InDetRecTools/SiClusterizationTool
-                          InnerDetector/InDetSimEvent
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel
-                          Simulation/ISF/ISF_Fatras/ISF_FatrasInterfaces
-                          Tracking/TrkDetDescr/TrkDetElementBase
-                          Tracking/TrkDetDescr/TrkSurfaces
-                          Tracking/TrkEvent/TrkEventPrimitives
-                          Tracking/TrkEvent/TrkMeasurementBase
-                          Tracking/TrkEvent/TrkParameters
-                          Tracking/TrkEvent/TrkRIO_OnTrack
-                          Tracking/TrkEvent/TrkTrack
-                          Tracking/TrkExtrapolation/TrkExInterfaces
-                          Tracking/TrkExtrapolation/TrkExUtils
-                          Tracking/TrkTools/TrkToolInterfaces )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonServices/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonServices/CMakeLists.txt
index 0d2a0e38e11c877e5093f40268f60772018c056f..e46508a4ee3b3808a3e4e8076da6951b0b7f3ee6 100644
--- a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonServices/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonServices/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_Geant4CommonServices )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          AtlasGeometryCommon/SubDetectorEnvelopes
-                          Control/AthenaBaseComps
-                          DetectorDescription/AtlasDetDescr
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Core/ISF_Interfaces )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/CMakeLists.txt
index 8d7b343610474751c473e7c1d974bd7066f09d50..22f99aacba14b34a00601e9f30166a4fea7bb404 100644
--- a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_Geant4CommonTools )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Simulation/G4Sim/TrackRecord
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Core/ISF_Interfaces )
-
 # Component(s) in the package:
 atlas_add_component( ISF_Geant4CommonTools
                      src/*.cxx
diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/CMakeLists.txt
index 8a05034d9ba60eb4737b97336eff2f7104a7dea8..4b02b05a8dcd69c71c055923de9954bbca74df98 100644
--- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/CMakeLists.txt
@@ -5,19 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_Geant4Event )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Simulation/G4Sim/SimHelpers
-                          Simulation/Barcode/BarcodeEvent
-                          Simulation/G4Sim/MCTruth
-                          PRIVATE
-                          Generators/AtlasHepMC
-                          DetectorDescription/GeoPrimitives )
-
-
-        
 # External dependencies:
 find_package( CLHEP )
 find_package( Eigen )
diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/CMakeLists.txt
index e0d85b059967d9691a4ef7f6afbd9df21a6594ab..19941217bb3786086f6433f51d3ce400e8ce6ecf 100644
--- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_Geant4Services )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Control/StoreGate
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Core/ISF_Interfaces )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt
index 071abf40acba993f0414438a5c515a472d8a985e..4b519f49a9dbadc13a4211f860fa457c11fd191d 100644
--- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt
@@ -5,25 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_Geant4Tools )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Control/StoreGate
-                          DetectorDescription/AtlasDetDescr
-                          Generators/AtlasHepMC
-                          Generators/GeneratorObjects
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Atlas/G4AtlasAlg
-                          Simulation/G4Sim/MCTruth
-                          Simulation/G4Sim/SimHelpers
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Simulation/ISF/ISF_Geant4/ISF_Geant4Event )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Eigen )
diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4UserActions/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4UserActions/CMakeLists.txt
index 05b2180d439d1c40737b012fa5ea9d63c4acd49f..bbf1055fda1a3b2e5b49a99e517a09bff6e6a328 100644
--- a/Simulation/ISF/ISF_Geant4/ISF_Geant4UserActions/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4UserActions/CMakeLists.txt
@@ -5,22 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_Geant4UserActions )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          PRIVATE
-                          Control/StoreGate
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasInterfaces
-                          Simulation/G4Atlas/G4AtlasTools
-                          TileCalorimeter/TileG4/TileG4Interfaces
-                          Calorimeter/CaloDetDescr
-                          Calorimeter/CaloIdentifier
-                          Control/AthenaBaseComps
-                          Generators/GeneratorObjects
-                          LArCalorimeter/LArG4/LArG4Code
-                          Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent
-                          DetectorDescription/Identifier )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/Simulation/ISF/ISF_HepMC/ISF_HepMC_Interfaces/CMakeLists.txt b/Simulation/ISF/ISF_HepMC/ISF_HepMC_Interfaces/CMakeLists.txt
index 0b9122bb837ef891039ab58094de3e46c04e4957..04edc588fe64f73ca7bc3fb7b542728ba26e9ea7 100644
--- a/Simulation/ISF/ISF_HepMC/ISF_HepMC_Interfaces/CMakeLists.txt
+++ b/Simulation/ISF/ISF_HepMC/ISF_HepMC_Interfaces/CMakeLists.txt
@@ -5,12 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_HepMC_Interfaces )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          Generators/AtlasHepMC
-                          Simulation/ISF/ISF_Core/ISF_Event )
-
 atlas_add_library( ISF_HepMC_Interfaces
                    ISF_HepMC_Interfaces/*.h
                    INTERFACE
diff --git a/Simulation/ISF/ISF_HepMC/ISF_HepMC_Tools/CMakeLists.txt b/Simulation/ISF/ISF_HepMC/ISF_HepMC_Tools/CMakeLists.txt
index 83274b189ef3c2287d0c208e2a78742d51f6566a..f8974a2b0b839ee879963e5ffb3c7f704f47dfd7 100644
--- a/Simulation/ISF/ISF_HepMC/ISF_HepMC_Tools/CMakeLists.txt
+++ b/Simulation/ISF/ISF_HepMC/ISF_HepMC_Tools/CMakeLists.txt
@@ -5,19 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_HepMC_Tools )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          DetectorDescription/AtlasDetDescr
-                          Generators/TruthUtils
-                          Generators/AtlasHepMC
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Simulation/ISF/ISF_HepMC/ISF_HepMC_Interfaces
-                          Tools/PathResolver )
-
 # External dependencies:
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 find_package( GTest )
diff --git a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimInterfaces/CMakeLists.txt b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimInterfaces/CMakeLists.txt
index b203d83575450d872f5669686f44c3987daa1b4b..9c22c51e3dcdefe7c71164379c9605163fad4edc 100644
--- a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimInterfaces/CMakeLists.txt
+++ b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimInterfaces/CMakeLists.txt
@@ -5,12 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_ParSimInterfaces )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Event/xAOD/xAODTracking
-                          GaudiKernel
-                          Tracking/TrkEvent/TrkParameters )
-
 atlas_add_library( ISF_ParSimInterfacesLib
                    ISF_ParSimInterfaces/*.h
                    INTERFACE
diff --git a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimServices/CMakeLists.txt b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimServices/CMakeLists.txt
index f7210c1a06a049963a891c63436f52b5ba2404c1..77c7037ffc20083619e8ea7d79572bf320e7a33f 100644
--- a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimServices/CMakeLists.txt
+++ b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimServices/CMakeLists.txt
@@ -5,15 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_ParSimServices )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          GaudiKernel
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Tracking/TrkDetDescr/TrkDetDescrInterfaces
-                          PRIVATE
-                          Simulation/ISF/ISF_Core/ISF_Event )
-
 # Component(s) in the package:
 atlas_add_component( ISF_ParSimServices
                      src/*.cxx
diff --git a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/CMakeLists.txt b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/CMakeLists.txt
index 31c2a8934b776e0d4b1db885318bdcdfe5b397d8..c5d9536ec6a92fdd17334efa4d029ae00188fd82 100644
--- a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/CMakeLists.txt
+++ b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/CMakeLists.txt
@@ -5,22 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_ParSimTools )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Event/xAOD/xAODTracking
-                          GaudiKernel
-                          InnerDetector/InDetConditions/InDetBeamSpotService
-                          InnerDetector/InDetConditions/BeamSpotConditionsData
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Simulation/ISF/ISF_ParametricSim/ISF_ParSimInterfaces
-                          Tracking/TrkExtrapolation/TrkExInterfaces
-                          PRIVATE
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Tools/PathResolver
-                          Tracking/TrkEvent/TrkParameters )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Matrix )
diff --git a/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt b/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt
index 6e0e8c57a54e8e659a81a212f9b52e12aac83c1f..c45118e877e807a7f3c8c74598fdf6d69aa81a02 100644
--- a/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt
+++ b/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt
@@ -5,25 +5,16 @@
 # Declare the package name:
 atlas_subdir( ISF_SimulationSelectors )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Generators/AtlasHepMC
-                          Simulation/Barcode/BarcodeServices
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Core/ISF_Interfaces
-                          Simulation/ISF/ISF_Tracking/ISF_TrackingInterfaces )
-
 # External dependencies:
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
+find_package( HepPDT )
 
 # Component(s) in the package:
 atlas_add_component( ISF_SimulationSelectors
                      src/*.cxx
                      src/components/*.cxx
-                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib GaudiKernel BarcodeServicesLib ISF_Event ISF_InterfacesLib ISF_TrackingInterfacesLib )
+                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS}
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} AtlasHepMCLib GaudiKernel BarcodeServicesLib ISF_Event ISF_InterfacesLib ISF_TrackingInterfacesLib )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
diff --git a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py
index 6c6900c4f7f6f8c2f36d86631b38675db31158b0..9e71c9a09f31734ee1f129ff3351867a3847e955 100644
--- a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py
+++ b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.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
 """
 ISF_SimulationSelectors configurations for ISF
 Elmar Ritsch, 04/02/2013
@@ -159,6 +159,36 @@ def getPionAFIIGeant4Selector(name="ISF_PionAFIIGeant4Selector", **kwargs):
     kwargs.setdefault('SimulationFlavor', SimulationFlavor.Geant4)
     return CfgMgr.ISF__KinematicSimSelector(name, **kwargs)
 
+def getPionG4FastCaloGeant4Selector(name="ISF_PionG4FastCaloGeant4Selector", **kwargs):
+    kwargs.setdefault('MaxEkin'         , 200)
+    kwargs.setdefault('ParticlePDG'     , 211)
+    kwargs.setdefault('Simulator'       , 'ISF_AFIIGeant4SimSvc')
+    return CfgMgr.ISF__KinematicSimSelector(name, **kwargs)
+
+def getProtonG4FastCaloGeant4Selector(name="ISF_ProtonG4FastCaloGeant4Selector", **kwargs):
+    kwargs.setdefault('MaxEkin'         , 400)
+    kwargs.setdefault('ParticlePDG'     , 2212)
+    kwargs.setdefault('Simulator'       , 'ISF_AFIIGeant4SimSvc')
+    return CfgMgr.ISF__KinematicSimSelector(name, **kwargs)
+
+def getNeutronG4FastCaloGeant4Selector(name="ISF_NeutronG4FastCaloGeant4Selector", **kwargs):
+    kwargs.setdefault('MaxEkin'         , 400)
+    kwargs.setdefault('ParticlePDG'     , 2112)
+    kwargs.setdefault('Simulator'       , 'ISF_AFIIGeant4SimSvc')
+    return CfgMgr.ISF__KinematicSimSelector(name, **kwargs)
+
+def getChargedKaonG4FastCaloGeant4Selector(name="ISF_ChargedKaonG4FastCaloGeant4Selector", **kwargs):
+    kwargs.setdefault('MaxEkin'         , 400)
+    kwargs.setdefault('ParticlePDG'     , 321)
+    kwargs.setdefault('Simulator'       , 'ISF_AFIIGeant4SimSvc')
+    return CfgMgr.ISF__KinematicSimSelector(name, **kwargs)
+
+def getKLongG4FastCaloGeant4Selector(name="ISF_KLongG4FastCaloGeant4Selector", **kwargs):
+    kwargs.setdefault('MaxEkin'         , 400)
+    kwargs.setdefault('ParticlePDG'     , 130)
+    kwargs.setdefault('Simulator'       , 'ISF_AFIIGeant4SimSvc')
+    return CfgMgr.ISF__KinematicSimSelector(name, **kwargs)
+
 def getPionAFII_QS_Geant4Selector(name="ISF_PionAFII_QS_Geant4Selector", **kwargs):
     kwargs.setdefault('Simulator'       , 'ISF_AFII_QS_Geant4SimSvc')
     return getPionAFIIGeant4Selector(name, **kwargs)
diff --git a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py
index 07f87b876cdb2e41df8ed34f19aba18834ec7f45..4fa66b226056da57755e18b477b45e053511b3b8 100644
--- a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py
+++ b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.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
 """
 Configuration database for ISF_SimulationSelectors
 Elmar Ritsch, 10/11/2014
@@ -12,6 +12,11 @@ addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getMuonGeant4Sele
 addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getProtonAFIIGeant4Selector"             , "ISF_ProtonAFIIGeant4Selector"            )
 addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getProtonAFII_QS_Geant4Selector"         , "ISF_ProtonAFII_QS_Geant4Selector"        )
 addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getPionAFIIGeant4Selector"               , "ISF_PionAFIIGeant4Selector"              )
+addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getPionG4FastCaloGeant4Selector"         , "ISF_PionG4FastCaloGeant4Selector"        )
+addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getProtonG4FastCaloGeant4Selector"       , "ISF_ProtonG4FastCaloGeant4Selector"      )
+addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getNeutronG4FastCaloGeant4Selector"      , "ISF_NeutronG4FastCaloGeant4Selector"     )
+addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonG4FastCaloGeant4Selector"  , "ISF_ChargedKaonG4FastCaloGeant4Selector" ) 
+addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getKLongG4FastCaloGeant4Selector"        , "ISF_KLongG4FastCaloGeant4Selector"       )  
 addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getPionAFII_QS_Geant4Selector"           , "ISF_PionAFII_QS_Geant4Selector"          )
 addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonAFIIGeant4Selector"        , "ISF_ChargedKaonAFIIGeant4Selector"       )
 addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonAFII_QS_Geant4Selector"    , "ISF_ChargedKaonAFII_QS_Geant4Selector"   )
diff --git a/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.cxx b/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.cxx
index 74be16e56c25f68b3504453b6e940b2b8241e11a..f3e081da00ba76f427b6317ef5e306803c6e3d9f 100644
--- a/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.cxx
+++ b/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -9,17 +9,23 @@
 // class include
 #include "KinematicSimSelector.h"
 
+#include "HepPDT/ParticleDataTable.hh"
+#include "HepPDT/ParticleData.hh"
+
+
 /** Constructor **/
 ISF::KinematicSimSelector::KinematicSimSelector(const std::string& t, const std::string& n, const IInterface* p)
   : BaseSimulationSelector(t,n,p)
   , KinematicParticleCuts()
+  , m_partPropSvc("PartPropSvc", name())
 {
   declareProperty("MinPosEta",            m_cut_minPosEta  , "Minimum Position Pseudorapidity" );
   declareProperty("MaxPosEta",            m_cut_maxPosEta  , "Maximum Position Pseudorapidity" );
   declareProperty("MinMomEta",            m_cut_minMomEta  , "Minimum Momentum Pseudorapidity" );
   declareProperty("MaxMomEta",            m_cut_maxMomEta  , "Maximum Momentum Pseudorapidity" );
   declareProperty("MinMom",               m_cut_minMom2    , "Minimum Particle Momentum"       );
-  declareProperty("MaxMom",               m_cut_maxMom2    , "Maximum Particle Moemntum"       );
+  declareProperty("MaxMom",               m_cut_maxMom2    , "Maximum Particle Momentum"       );
+  declareProperty("MaxEkin",              m_cut_maxEkin    , "Maximum Particle Kinetic Energy" );
   declareProperty("Charge",               m_cut_charge     , "Particle Charge"                 );
   declareProperty("ParticlePDG",          m_cut_pdg        , "Particle PDG Code"               );
 }
@@ -33,11 +39,30 @@ ISF::KinematicSimSelector::~KinematicSimSelector()
 StatusCode  ISF::KinematicSimSelector::initialize()
 {
   ATH_MSG_VERBOSE("Initializing ...");
+  ATH_CHECK(m_partPropSvc.retrieve()); 
+
+   HepPDT::ParticleDataTable* particleDataTable; 
+   particleDataTable = (HepPDT::ParticleDataTable*) m_partPropSvc->PDT();
+
+   if(particleDataTable == 0) 
+   {
+    ATH_MSG_ERROR("PDG table not found");
+    return StatusCode::FAILURE;
+    }
+
+  const HepPDT::ParticleData* data = particleDataTable->particle(HepPDT::ParticleID(abs(m_cut_pdg))); 
+
+  double mass = 0; 
+  if(data) mass = data->mass().value(); 
+
 
   // compute and store the square of the momentum cuts (faster comparisons)
   if ( !(m_cut_minMom2<0.)) m_cut_minMom2 *= m_cut_minMom2;
   if ( !(m_cut_maxMom2<0.)) m_cut_maxMom2 *= m_cut_maxMom2;
 
+  // if use kinetic energy 
+  if(!(m_cut_maxEkin < 0.)) m_cut_maxMom2 = m_cut_maxEkin * (m_cut_maxEkin + 2 * mass);
+
   return StatusCode::SUCCESS;
 }
 
diff --git a/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.h b/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.h
index 503a13b80af04f9d3bcd6cbe7aec279505e2c30c..e45215ce8ff29370cbf718d3bc3290dc9bed2a3b 100644
--- a/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.h
+++ b/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -9,6 +9,9 @@
 #ifndef ISF_TOOLS_KINEMATICSIMSELECTOR_H
 #define ISF_TOOLS_KINEMATICSIMSELECTOR_H 1
 
+#include "GaudiKernel/IPartPropSvc.h"
+
+
 // ISF includes
 #include "ISF_Event/KinematicParticleCuts.h"
 #include "BaseSimulationSelector.h"
@@ -25,6 +28,8 @@ namespace ISF
   class KinematicSimSelector final : public BaseSimulationSelector, public KinematicParticleCuts
   {
 
+  ServiceHandle<IPartPropSvc> m_partPropSvc; 
+  
   public:
     /** Constructor with parameters */
     KinematicSimSelector( const std::string& t, const std::string& n, const IInterface* p );
diff --git a/Simulation/ISF/ISF_Tracking/ISF_TrackingInterfaces/CMakeLists.txt b/Simulation/ISF/ISF_Tracking/ISF_TrackingInterfaces/CMakeLists.txt
index fff627d0896d83f6c35ff4b7ec55289fb5a0289a..42b11d461e1e9791fa7497e2f42b151a60c58abb 100644
--- a/Simulation/ISF/ISF_Tracking/ISF_TrackingInterfaces/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Tracking/ISF_TrackingInterfaces/CMakeLists.txt
@@ -5,10 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_TrackingInterfaces )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel )
-
 atlas_add_library( ISF_TrackingInterfacesLib
                    ISF_TrackingInterfaces/*.h
                    INTERFACE
diff --git a/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/CMakeLists.txt b/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/CMakeLists.txt
index 3d33a6332f094cfbeae33b53c49778816d69935d..257ab3a511270ca451c09b1f424dbc228ce37316 100644
--- a/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/CMakeLists.txt
@@ -5,19 +5,6 @@
 # Declare the package name:
 atlas_subdir( ISF_TrackingTools )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Simulation/ISF/ISF_Core/ISF_Event
-                          Simulation/ISF/ISF_Tracking/ISF_TrackingInterfaces
-                          Tracking/TrkDetDescr/TrkDetDescrInterfaces
-                          Tracking/TrkDetDescr/TrkGeometry
-                          Tracking/TrkEvent/TrkEventPrimitives
-                          Tracking/TrkEvent/TrkParameters
-                          Tracking/TrkExtrapolation/TrkExInterfaces )
-
 # Component(s) in the package:
 atlas_add_component( ISF_TrackingTools
                      src/*.cxx
diff --git a/Simulation/ISF/ISF_Validation/test/test_Sim_FullG4_ttbar.sh b/Simulation/ISF/ISF_Validation/test/test_Sim_FullG4_ttbar.sh
index 2f8f83a5f661dbf7a3de7a5dd5f1a00a346557c1..19582090e258d97be0e77ed381bd7b579742795a 100755
--- a/Simulation/ISF/ISF_Validation/test/test_Sim_FullG4_ttbar.sh
+++ b/Simulation/ISF/ISF_Validation/test/test_Sim_FullG4_ttbar.sh
@@ -21,7 +21,9 @@ Sim_tf.py \
 --inputEVNTFile '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/ISF_Validation/mc12_valid.110401.PowhegPythia_P2012_ttbar_nonallhad.evgen.EVNT.e3099.01517252._000001.pool.root.1' \
 --outputHITSFile 'test.HITS.pool.root' \
 --maxEvents '4' \
---imf False
+--imf False \
+--preExec 'from ISF_FastCaloSimServices.ISF_FastCaloSimJobProperties import ISF_FastCaloSimFlags;ISF_FastCaloSimFlags.ParamsInputFilename="/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/FastCaloSim/MC16/TFCSparam_dev_weightedhits_v12.root"'
+
 
 rc=$?
 rc2=-9999
diff --git a/Simulation/Interfaces/HepMC_Interfaces/CMakeLists.txt b/Simulation/Interfaces/HepMC_Interfaces/CMakeLists.txt
index e79ad0932bdb4bf737cf4c19abb120929aa2092c..ba7faf34c4d7cba66c3aafe239034f2d779b8cb8 100644
--- a/Simulation/Interfaces/HepMC_Interfaces/CMakeLists.txt
+++ b/Simulation/Interfaces/HepMC_Interfaces/CMakeLists.txt
@@ -5,11 +5,6 @@
 # Declare the package name:
 atlas_subdir( HepMC_Interfaces )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Generators/AtlasHepMC
-                          GaudiKernel )
-
 atlas_add_library( HepMC_InterfacesLib
                    HepMC_Interfaces/*.h
                    INTERFACE
diff --git a/Simulation/Overlay/IDC_OverlayBase/CMakeLists.txt b/Simulation/Overlay/IDC_OverlayBase/CMakeLists.txt
index 2827121b0b4a819d8852ec5a7efa2e408a041ac9..740c2e6e8679161413b29044125710b9df771ffc 100644
--- a/Simulation/Overlay/IDC_OverlayBase/CMakeLists.txt
+++ b/Simulation/Overlay/IDC_OverlayBase/CMakeLists.txt
@@ -5,11 +5,6 @@
 # Declare the package name:
 atlas_subdir( IDC_OverlayBase )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          DetectorDescription/Identifier )
-
 # Component(s) in the package:
 atlas_add_library( IDC_OverlayBase
                    PUBLIC_HEADERS IDC_OverlayBase
diff --git a/Simulation/RunDependentSim/RunDependentSimData/CMakeLists.txt b/Simulation/RunDependentSim/RunDependentSimData/CMakeLists.txt
index ce2a5a2835719ffe9fb1afb5bd93ccc6dc8318a9..03d5a0ffa3e9b9f775e24bb0648b4e89e1b1b07b 100644
--- a/Simulation/RunDependentSim/RunDependentSimData/CMakeLists.txt
+++ b/Simulation/RunDependentSim/RunDependentSimData/CMakeLists.txt
@@ -5,10 +5,6 @@
 # Declare the package name:
 atlas_subdir( RunDependentSimData )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/MinimalRunTime )
-
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
 atlas_install_scripts( share/rundmc_printdist )
diff --git a/Simulation/SimuJobTransforms/CMakeLists.txt b/Simulation/SimuJobTransforms/CMakeLists.txt
index c2f199469f0e97ba92aec7d3aec33dd559d6a8a5..e352da28f0073a62149e3da02298c928a0060232 100644
--- a/Simulation/SimuJobTransforms/CMakeLists.txt
+++ b/Simulation/SimuJobTransforms/CMakeLists.txt
@@ -5,10 +5,6 @@
 # Declare the package name:
 atlas_subdir( SimuJobTransforms )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Tools/PyJobTransforms )
-
 # Install files from the package:
 atlas_install_python_modules( python/*.py )
 atlas_install_joboptions( share/*.py )
diff --git a/Simulation/Tests/DigitizationTests/CMakeLists.txt b/Simulation/Tests/DigitizationTests/CMakeLists.txt
index 455235174d1861973b8ecefa7bb9c3a276a22099..b7d5633cad9ae927e5ffa69fc7ee158e20b28ded 100644
--- a/Simulation/Tests/DigitizationTests/CMakeLists.txt
+++ b/Simulation/Tests/DigitizationTests/CMakeLists.txt
@@ -5,18 +5,6 @@
 # Declare the package name:
 atlas_subdir( DigitizationTests )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaKernel
-                          Event/xAOD/xAODEventInfo
-                          Generators/GeneratorObjects
-                          InnerDetector/InDetDetDescr/InDetIdentifier
-                          InnerDetector/InDetRawEvent/InDetRawData
-                          InnerDetector/InDetRawEvent/InDetSimData )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
@@ -29,7 +17,6 @@ atlas_add_component( DigitizationTests
                      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel AthenaKernel GeneratorObjects InDetIdentifier InDetRawData InDetSimData xAODEventInfo )
 
 # Install files from the package:
-atlas_install_headers( DigitizationTests )
 atlas_install_python_modules( python/*.py )
 atlas_install_joboptions( share/*.py )
 atlas_install_runtime( test/DigitizationTests_TestConfiguration.xml )
diff --git a/Simulation/Tools/AtlasCLHEP_RandomGenerators/CMakeLists.txt b/Simulation/Tools/AtlasCLHEP_RandomGenerators/CMakeLists.txt
index b772ede2a255bd608baa9f0ce9c6fbdb51541829..7aba0ab4488237d299e7bdf9430c2b04ae0ba6b1 100644
--- a/Simulation/Tools/AtlasCLHEP_RandomGenerators/CMakeLists.txt
+++ b/Simulation/Tools/AtlasCLHEP_RandomGenerators/CMakeLists.txt
@@ -5,12 +5,6 @@
 # Declare the package name:
 atlas_subdir( AtlasCLHEP_RandomGenerators )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          GaudiKernel )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( CLHEP )
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt b/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt
index b697747a09d99be99c521ee9071d6ee2a440b7d3..a1d643bae657b0978a16f32c5edca5723d356645 100644
--- a/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/CMakeLists.txt
@@ -5,26 +5,6 @@
 # Declare the package name:
 atlas_subdir( CaloSamplingFractionAnalysis )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Calorimeter/CaloDetDescr
-                          Calorimeter/CaloEvent
-                          Calorimeter/CaloIdentifier
-                          Calorimeter/CaloSimEvent
-                          Control/AthenaBaseComps
-                          DetectorDescription/GeoModel/GeoAdaptors
-                          DetectorDescription/Identifier
-                          Event/EventInfo
-                          External/AtlasHepMC/AtlasHepMC
-                          LArCalorimeter/LArElecCalib
-                          LArCalorimeter/LArG4/LArG4RunControl
-                          LArCalorimeter/LArGeoModel/LArReadoutGeometry
-                          LArCalorimeter/LArSimEvent
-                          TileCalorimeter/TileDetDescr
-                          TileCalorimeter/TileSimEvent )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( HepMC )
diff --git a/Simulation/Tools/HitAnalysis/CMakeLists.txt b/Simulation/Tools/HitAnalysis/CMakeLists.txt
index 1ebce403dc6abf91e0e29b93db6eeb9330387e52..0bbbb9a78e6cc515decc691f77f1051b39e5958a 100644
--- a/Simulation/Tools/HitAnalysis/CMakeLists.txt
+++ b/Simulation/Tools/HitAnalysis/CMakeLists.txt
@@ -5,29 +5,6 @@
 # Declare the package name:
 atlas_subdir( HitAnalysis )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Calorimeter/CaloDetDescr
-                          Calorimeter/CaloIdentifier
-                          Calorimeter/CaloSimEvent
-                          Control/AthenaBaseComps
-                          DetectorDescription/GeoModel/GeoAdaptors
-                          Event/EventInfo
-                          ForwardDetectors/AFP/AFP_SimEv
-                          ForwardDetectors/ALFA/ALFA_SimEv
-                          ForwardDetectors/LUCID/LUCID_SimUtils/LUCID_SimEvent
-                          ForwardDetectors/ZDC/ZDC_SimEvent
-                          Generators/AtlasHepMC
-                          Generators/GeneratorObjects
-                          InnerDetector/InDetSimEvent
-                          LArCalorimeter/LArSimEvent
-                          MuonSpectrometer/MuonSimEvent
-                          Simulation/G4Sim/TrackRecord
-                          TileCalorimeter/TileDetDescr
-                          TileCalorimeter/TileSimEvent )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Table MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 )
diff --git a/Simulation/Tools/McEventCollectionFilter/CMakeLists.txt b/Simulation/Tools/McEventCollectionFilter/CMakeLists.txt
index 81c0bc06d556253f10fc67c37e8eda619177a7e9..03ae0ddc3ea17b55d3d4d51dfe53e7e3605886db 100644
--- a/Simulation/Tools/McEventCollectionFilter/CMakeLists.txt
+++ b/Simulation/Tools/McEventCollectionFilter/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( McEventCollectionFilter )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/AthenaBaseComps
-                          DetectorDescription/GeoPrimitives
-                          GaudiKernel
-                          Generators/AtlasHepMC
-                          Generators/GeneratorObjects
-                          InnerDetector/InDetSimEvent
-                          MuonSpectrometer/MuonSimEvent )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Eigen )
diff --git a/Simulation/Tools/RDOAnalysis/CMakeLists.txt b/Simulation/Tools/RDOAnalysis/CMakeLists.txt
index 84c221d054328b23fc869f6b4af93d53879ff2f2..a6d6ace05449c399644d7817509bf2ba898aaf9c 100644
--- a/Simulation/Tools/RDOAnalysis/CMakeLists.txt
+++ b/Simulation/Tools/RDOAnalysis/CMakeLists.txt
@@ -5,23 +5,6 @@
 # Declare the package name:
 atlas_subdir( RDOAnalysis )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          InnerDetector/InDetDetDescr/InDetIdentifier
-                          InnerDetector/InDetRawEvent/InDetRawData
-                          InnerDetector/InDetRawEvent/InDetSimData
-                          InnerDetector/InDetRawEvent/InDetBCM_RawData
-			  InnerDetector/InDetRecEvent/InDetPrepRawData
-                          LArCalorimeter/LArRawEvent
-                          MuonSpectrometer/MuonRDO
-                          MuonSpectrometer/MuonSimData
-                          TileCalorimeter/TileEvent
-			  Tracking/TrkDetDescr/TrkSurfaces
-			  Tracking/TrkEvent/TrkTruthData )
-
 # External dependencies:
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Table MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 )
 
diff --git a/Simulation/TruthJiveXML/CMakeLists.txt b/Simulation/TruthJiveXML/CMakeLists.txt
index 5c26e995a99b74ae7351dcf41a97760d518ebafa..e91513bbd3a72d827a357f6a9756c37112f26be7 100644
--- a/Simulation/TruthJiveXML/CMakeLists.txt
+++ b/Simulation/TruthJiveXML/CMakeLists.txt
@@ -5,18 +5,6 @@
 # Declare the package name:
 atlas_subdir( TruthJiveXML )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          GaudiKernel
-                          graphics/JiveXML
-                          PRIVATE
-                          Control/StoreGate
-                          Event/EventPrimitives
-                          Generators/AtlasHepMC
-                          Generators/GeneratorObjects
-                          Simulation/G4Sim/TrackRecord )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( HepPDT )
diff --git a/TestBeam/TBEvent/TBEvent/TBMWPC.h b/TestBeam/TBEvent/TBEvent/TBMWPC.h
index ab7d947072130c364f03bd0cb13831f7dc4dee36..8d211fcf8bf39e66831343386d889369bf34fe03 100755
--- a/TestBeam/TBEvent/TBEvent/TBMWPC.h
+++ b/TestBeam/TBEvent/TBEvent/TBMWPC.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 TBEVENT_TBMWPC_H
@@ -46,19 +46,19 @@ class TBMWPC : public TBBeamDetector
     
     
   // set signals  //////////////////////////////////////////////////////
-  void setCPos(std::vector<float> signals) {m_cPos=signals;}
-  void setCErr(std::vector<float> errors) {m_cErr=errors;}
+  void setCPos(const std::vector<float>& signals) {m_cPos=signals;}
+  void setCErr(const std::vector<float>& errors) {m_cErr=errors;}
     
     
   // set X or Y
   void setXchambers(bool isX){m_isX=isX;}
   
   /** Set cluster size for c-direction */
-  void setClusterSizeC(std::vector<float> clsize_c){ m_clusterSize_c=clsize_c;}
+  void setClusterSizeC(const std::vector<float>& clsize_c){ m_clusterSize_c=clsize_c;}
 
 
   // set/reset overflow
-  void setCPosOverflow(std::vector<bool> overflow) {m_cPosOverflow=overflow;}
+  void setCPosOverflow(const std::vector<bool>& overflow) {m_cPosOverflow=overflow;}
 
 
   // access signals ///////////////////////////////////////////////////////
diff --git a/TestBeam/TBEvent/TBEvent/TBMWPCRaw.h b/TestBeam/TBEvent/TBEvent/TBMWPCRaw.h
index 0a2951a1efb3cc6adc0602cf1e53bafb164a522b..a6ac1f0ae0dd2959dd0c27f39dd1c9095bd208ce 100755
--- a/TestBeam/TBEvent/TBEvent/TBMWPCRaw.h
+++ b/TestBeam/TBEvent/TBEvent/TBMWPCRaw.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 TBEVENT_TBMWPCRAW_H
@@ -53,7 +53,7 @@ class TBMWPCRaw : public TBBeamDetector
 
 
   /** Set the collection of the center wire number */
-  inline void setCwireno(std::vector<int> cwireno) {
+  inline void setCwireno(const std::vector<int>& cwireno) {
     m_cwireno = cwireno;
   }
   inline void addCwireno(int cwire){
@@ -61,7 +61,7 @@ class TBMWPCRaw : public TBBeamDetector
   }
 
   /** Set the collection of the number of wires in a cluster */
-  inline void setNwires(std::vector<int> nwires) {
+  inline void setNwires(const std::vector<int>& nwires) {
     m_nwires  = nwires;
   }    
   inline void addNwires(int nwire){
diff --git a/TestBeam/TBEvent/TBEvent/TBTailCatcher.h b/TestBeam/TBEvent/TBEvent/TBTailCatcher.h
index 9ef917bb5e1eb59cfba88b9973d37ef8ae7a2654..7b0d18de938fdf0b9ef7b077c02cb08e6730fa2f 100755
--- a/TestBeam/TBEvent/TBEvent/TBTailCatcher.h
+++ b/TestBeam/TBEvent/TBEvent/TBTailCatcher.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TBEVENT_TBTAILCATCHER_H
@@ -45,7 +45,7 @@ class TBTailCatcher : public TBBeamDetector,
   void addScintillator(TBScintillator* thisScint);
 
   const TBScintillator* 
-    getScintillator(std::string thisScintName) const;
+    getScintillator(const std::string& thisScintName) const;
 
   // global overflow
   //  virtual void setOverflow();
@@ -69,7 +69,7 @@ class TBTailCatcher : public TBBeamDetector,
 
   std::vector<double> m_signals;
 
-  unsigned int findIndex(std::string thisScintName) const;
+  unsigned int findIndex(const std::string& thisScintName) const;
 
 };
 CLASS_DEF( TBTailCatcher , 100992621 , 1 )
diff --git a/TestBeam/TBEvent/src/TBLArDigitContainer.cxx b/TestBeam/TBEvent/src/TBLArDigitContainer.cxx
index bca06a641dc44b7e1598219be4fe0389715e42f5..6b649c6e4b38e1edea4d99de441f1381b9c8517f 100755
--- a/TestBeam/TBEvent/src/TBLArDigitContainer.cxx
+++ b/TestBeam/TBEvent/src/TBLArDigitContainer.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 <stdio.h>
@@ -27,7 +27,7 @@ TBLArDigitContainer::operator std::string () const {
  int counter = 0 ;
  const LArDigit * digit ;    
  
-     for(it = this->begin() ; it != this->end() ; it++ ){ // Loop over Hits
+     for(it = this->begin() ; it != this->end() ; ++it ){ // Loop over Hits
      
        digit = *it ;
              
diff --git a/TestBeam/TBEvent/src/TBTailCatcher.cxx b/TestBeam/TBEvent/src/TBTailCatcher.cxx
index 9bd7af633f61ad40ed37303926981e4e0fa8ee64..07153faadc192f9ce84a07f458ca8ee877bbe51c 100755
--- a/TestBeam/TBEvent/src/TBTailCatcher.cxx
+++ b/TestBeam/TBEvent/src/TBTailCatcher.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
 */
 
 
@@ -43,12 +43,12 @@ TBTailCatcher::addScintillator(TBScintillator* thisScint)
 }
 
 const TBScintillator* 
-TBTailCatcher::getScintillator(std::string thisScintName) const
+TBTailCatcher::getScintillator(const std::string& thisScintName) const
 {
   DataVector< TBScintillator >::const_iterator first = this->begin();
   while ( first != this->end() && (*first)->getDetectorName() != thisScintName )
     {
-      first++;
+      ++first;
     }
   return ( first != this->end() )
     ? *first
@@ -77,14 +77,14 @@ TBTailCatcher::getSignal(const TBScintillator* thisScint) const
 }
 
 unsigned int
-TBTailCatcher::findIndex(std::string thisScintName) const
+TBTailCatcher::findIndex(const std::string& thisScintName) const
 {
   DataVector< TBScintillator >::const_iterator first = this->begin();
   unsigned int theIndex = 0;
   while( first != this->end() && thisScintName != (*first)->getDetectorName() )
     {
-      first++;
-      theIndex++;
+      ++first;
+      ++theIndex;
     }
   return theIndex;
 }
diff --git a/TestBeam/TBRec/CMakeLists.txt b/TestBeam/TBRec/CMakeLists.txt
index 2f68f38a8140d6a059eaf4be9fa1a93c29320f4a..985e8cf10ad77a41a63fdcf50e61ee66f415fe7d 100644
--- a/TestBeam/TBRec/CMakeLists.txt
+++ b/TestBeam/TBRec/CMakeLists.txt
@@ -68,7 +68,7 @@ atlas_add_library( TBRecLib
                    PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
                    DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} CaloEvent CaloGeoHelpers CaloIdentifier AthenaBaseComps AthenaKernel AthContainers GeoPrimitives Identifier EventInfo xAODTracking GaudiKernel LArIdentifier LArRawEvent TBEvent TrkDetDescrUtils TrkParameters TrkTrack CaloRecLib CaloUtilsLib StoreGateLib SGtests LArRawUtilsLib LArCablingLib CaloDetDescrLib TBCaloGeometryLib TBCondRunParLib
-                   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} CaloDmDetDescr CaloSimEvent CondDBObjects xAODCaloEvent LArG4TBSimEvent Particle PathResolver TrkSurfaces TrkEventPrimitives TrkExInterfaces )
+                   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} CaloDmDetDescr CaloSimEvent CondDBObjects xAODCaloEvent LArG4TBSimEvent Particle PathResolver TrkSurfaces TrkEventPrimitives TrkExInterfaces CaloTrackingGeometryLib TrackRecordLib )
 
 atlas_add_component( TBRec
                      src/components/*.cxx
diff --git a/TestBeam/TBTPCnv/src/TBADCRawContCnv_p1.cxx b/TestBeam/TBTPCnv/src/TBADCRawContCnv_p1.cxx
index 8f28dccf1d4f60465fa4948163fa7a8862c75aaa..bd9450a9c3dfd3ee7135d5451f9d51a3a4051f7b 100644
--- a/TestBeam/TBTPCnv/src/TBADCRawContCnv_p1.cxx
+++ b/TestBeam/TBTPCnv/src/TBADCRawContCnv_p1.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TBTPCnv/TBADCRawContCnv_p1.h"
@@ -52,7 +52,7 @@ TBADCRawContCnv_p1::transToPers(const TBADCRawCont* trans,
   TBADCRawCont::const_iterator ADCRawIt_e = trans->end();
 
   // copy all the scints from the trans to the pers
-  for (; ADCRawIt!=ADCRawIt_e; ADCRawIt++) {
+  for (; ADCRawIt!=ADCRawIt_e; ++ADCRawIt) {
     const TBADCRaw * ADCRaw = * ADCRawIt;
 
 		pers -> m_adc.push_back(            ADCRaw->getADC() );
diff --git a/TestBeam/TBTPCnv/src/TBBPCContCnv_p1.cxx b/TestBeam/TBTPCnv/src/TBBPCContCnv_p1.cxx
index e6357c4a0247e2fd85c6ed58c27bcd84c1e495d6..481fc7dc81e2c4f026edde4660202a0f29159985 100644
--- a/TestBeam/TBTPCnv/src/TBBPCContCnv_p1.cxx
+++ b/TestBeam/TBTPCnv/src/TBBPCContCnv_p1.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TBTPCnv/TBBPCContCnv_p1.h"
@@ -74,7 +74,7 @@ TBBPCContCnv_p1::transToPers(const TBBPCCont* trans,
   TBBPCCont::const_iterator BPCIt_e = trans->end();
 
   // copy all the scints from the trans to the pers
-  for (; BPCIt!=BPCIt_e; BPCIt++) {
+  for (; BPCIt!=BPCIt_e; ++BPCIt) {
     const TBBPC * BPC = * BPCIt;
 
     // fill in the scint properties
diff --git a/TestBeam/TBTPCnv/src/TBLArDigitContainerCnv_p1.cxx b/TestBeam/TBTPCnv/src/TBLArDigitContainerCnv_p1.cxx
index d73aba5f643337db8c02ecd7abb65b035e530a92..b302a6b863492e1ffd59eae7266d15ae6246798e 100644
--- a/TestBeam/TBTPCnv/src/TBLArDigitContainerCnv_p1.cxx
+++ b/TestBeam/TBTPCnv/src/TBLArDigitContainerCnv_p1.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TBTPCnv/TBLArDigitContainerCnv_p1.h"
@@ -58,7 +58,7 @@ TBLArDigitContainerCnv_p1::transToPers(const TBLArDigitContainer* trans,
   TBLArDigitContainer::const_iterator it=trans->begin();
   TBLArDigitContainer::const_iterator it_e=trans->end();
   //unsigned i=0;
-  for (;it!=it_e;it++) {
+  for (;it!=it_e;++it) {
     const LArDigit* transDigit=*it;
     pers->m_channelID.push_back(transDigit->hardwareID().get_identifier32().get_compact());
     pers->m_gain.push_back((unsigned char)transDigit->gain());
diff --git a/TestBeam/TBTPCnv/src/TBMWPCContCnv_p1.cxx b/TestBeam/TBTPCnv/src/TBMWPCContCnv_p1.cxx
index 6851cbc82a3acf9f6456d3dc3263041d03e603ba..7a577420e2764a0dc62453c0515fb56d45ede245 100644
--- a/TestBeam/TBTPCnv/src/TBMWPCContCnv_p1.cxx
+++ b/TestBeam/TBTPCnv/src/TBMWPCContCnv_p1.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TBTPCnv/TBMWPCContCnv_p1.h"
@@ -86,7 +86,7 @@ TBMWPCContCnv_p1::transToPers(const TBMWPCCont* trans,
   TBMWPCCont::const_iterator MWPCIt_e = trans->end();
 
   // copy all the MWPCs from the trans to the pers
-  for (; MWPCIt!=MWPCIt_e; MWPCIt++) {
+  for (; MWPCIt!=MWPCIt_e; ++MWPCIt) {
     const TBMWPC * MWPC = * MWPCIt;
 
     // fill in the MWPC properties
diff --git a/TestBeam/TBTPCnv/src/TBScintillatorContCnv_p1.cxx b/TestBeam/TBTPCnv/src/TBScintillatorContCnv_p1.cxx
index 23406a47ba193cba2fa8b03fce937104d82d8b45..d33bf550de3df9557cae0e5a7e400b54aafd6f79 100644
--- a/TestBeam/TBTPCnv/src/TBScintillatorContCnv_p1.cxx
+++ b/TestBeam/TBTPCnv/src/TBScintillatorContCnv_p1.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TBTPCnv/TBScintillatorContCnv_p1.h"
@@ -56,7 +56,7 @@ TBScintillatorContCnv_p1::transToPers(const TBScintillatorCont* trans,
   TBScintillatorCont::const_iterator scintIt_e = trans->end();
 
   // copy all the scints from the trans to the pers
-  for (; scintIt!=scintIt_e; scintIt++) {
+  for (; scintIt!=scintIt_e; ++scintIt) {
     const TBScintillator * scint = * scintIt;
 
     // fill in the scint properties
diff --git a/TestBeam/TBTPCnv/src/TBTDCRawContCnv_p1.cxx b/TestBeam/TBTPCnv/src/TBTDCRawContCnv_p1.cxx
index 5cea1d0a04ca97de369a7e426aa46e0c2765fe3e..0bbd72d42f3fd785dfe0bffd36802b941f86b5cc 100644
--- a/TestBeam/TBTPCnv/src/TBTDCRawContCnv_p1.cxx
+++ b/TestBeam/TBTPCnv/src/TBTDCRawContCnv_p1.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TBTPCnv/TBTDCRawContCnv_p1.h"
@@ -53,7 +53,7 @@ TBTDCRawContCnv_p1::transToPers(const TBTDCRawCont* trans,
   TBTDCRawCont::const_iterator TDCRawIt_e = trans->end();
 
   // copy all the scints from the trans to the pers
-  for (; TDCRawIt!=TDCRawIt_e; TDCRawIt++) {
+  for (; TDCRawIt!=TDCRawIt_e; ++TDCRawIt) {
     const TBTDCRaw * TDCRaw = * TDCRawIt;
 
 		pers -> m_tdc.push_back(            TDCRaw->getTDC() );
diff --git a/TestBeam/TBTPCnv/src/TBTailCatcherCnv_p1.cxx b/TestBeam/TBTPCnv/src/TBTailCatcherCnv_p1.cxx
index 512fc4a0832cb260e67dbb9b7f3264942072d3fd..ac761687f470e7266314dffd48c855245628d033 100644
--- a/TestBeam/TBTPCnv/src/TBTailCatcherCnv_p1.cxx
+++ b/TestBeam/TBTPCnv/src/TBTailCatcherCnv_p1.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TBTPCnv/TBTailCatcherCnv_p1.h"
@@ -66,7 +66,7 @@ TBTailCatcherCnv_p1::transToPers(const TBTailCatcher* trans,
   TBScintillatorCont::const_iterator scintIt_e = trans->end();
 
   // copy all the scints from the trans to the pers
-  for (; scintIt!=scintIt_e; scintIt++) {
+  for (; scintIt!=scintIt_e; ++scintIt) {
     const TBScintillator * scint = * scintIt;
 
     // fill in the scint properties
diff --git a/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/CMakeLists.txt
index dc893512ae88317f7a9d991c0ccd9c8110570ebb..db36be9d934190408a7de966ca409b0444b7ead6 100644
--- a/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( CombinedScintillator )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Calorimeter/CaloIdentifier
-                          Control/StoreGate
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Utilities/GeoMaterial2G4
-                          TileCalorimeter/TileSimEvent )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/CMakeLists.txt
index 9935230e5ee14decbf79318cd2f3daa5ef8a1a4a..e370a90e06bcdb38ed58e5e1ea0edaf61f9d09ae 100644
--- a/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/CMakeLists.txt
@@ -5,14 +5,6 @@
 # Declare the package name:
 atlas_subdir( DeadMaterial )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/StoreGate
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Utilities/GeoMaterial2G4 )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/TileCalorimeter/TileG4/TileAncillary/LarCrate/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/LarCrate/CMakeLists.txt
index 3ceff941462547fab912ebec76e66396ed6d324d..c495b7ef901f7310074155ac57a6b3047ce44237 100644
--- a/TileCalorimeter/TileG4/TileAncillary/LarCrate/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileAncillary/LarCrate/CMakeLists.txt
@@ -5,14 +5,6 @@
 # Declare the package name:
 atlas_subdir( LarCrate )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/StoreGate
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Utilities/GeoMaterial2G4 )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/CMakeLists.txt
index cdcfe3a2256301c5ef2cccf6363fdc9676a9f63a..a6056b7b692cf83272c156dc25fa47b395a2bb04 100644
--- a/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/CMakeLists.txt
@@ -5,17 +5,6 @@
 # Declare the package name:
 atlas_subdir( MinBiasScintillator )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          
-                          PRIVATE
-                          Calorimeter/CaloDetDescr
-                          Calorimeter/CaloIdentifier
-                          Control/StoreGate
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasTools
-                          TileCalorimeter/TileSimEvent )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/TileCalorimeter/TileG4/TileAncillary/MuonWall/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/MuonWall/CMakeLists.txt
index 176d0e772266e81d8e987a4b49a65168f39a67f6..4577d0bbf334760b81eb3ee0536d42b83364df57 100644
--- a/TileCalorimeter/TileG4/TileAncillary/MuonWall/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileAncillary/MuonWall/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( MuonWall )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Calorimeter/CaloIdentifier
-                          Control/StoreGate
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Utilities/GeoMaterial2G4
-                          TileCalorimeter/TileSimEvent )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/CMakeLists.txt
index c0ee2e92536910b6e2bc502239a52b00af4e3e2f..a04031e7e3c411263e3f673085cbf7cb351902b4 100644
--- a/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/CMakeLists.txt
@@ -5,16 +5,6 @@
 # Declare the package name:
 atlas_subdir( PhantomCalorimeter )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Calorimeter/CaloIdentifier
-                          Control/StoreGate
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Utilities/GeoMaterial2G4
-                          TileCalorimeter/TileSimEvent )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/TileCalorimeter/TileG4/TileG4Interfaces/CMakeLists.txt b/TileCalorimeter/TileG4/TileG4Interfaces/CMakeLists.txt
index c1f91e064cc83314ff835ec3d9e8950396a7c77f..0f926291e3608f89c66f0aeb79982329ba527e3f 100644
--- a/TileCalorimeter/TileG4/TileG4Interfaces/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileG4Interfaces/CMakeLists.txt
@@ -5,12 +5,6 @@
 # Declare the package name:
 atlas_subdir( TileG4Interfaces )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          DetectorDescription/Identifier
-                           )
-
 # External dependencies:
 find_package( Geant4 )
 
diff --git a/TileCalorimeter/TileG4/TileGeoG4Calib/CMakeLists.txt b/TileCalorimeter/TileG4/TileGeoG4Calib/CMakeLists.txt
index 1d25f541c04a1a5860553263c22a5b83346807f1..d91a48fa0ee4ea9109c9eb5328cd7f108e47878a 100644
--- a/TileCalorimeter/TileG4/TileGeoG4Calib/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileGeoG4Calib/CMakeLists.txt
@@ -5,28 +5,6 @@
 # Declare the package name:
 atlas_subdir( TileGeoG4Calib )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          
-                          PRIVATE
-                          Calorimeter/CaloG4Sim
-                          Calorimeter/CaloIdentifier
-                          Calorimeter/CaloSimEvent
-                          Control/CxxUtils
-                          Control/StoreGate
-                          Database/RDBAccessSvc
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          DetectorDescription/GeoModel/GeoModelUtilities
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasTools
-                          Simulation/G4Sim/MCTruth
-                          TileCalorimeter/TileDetDescr
-                          TileCalorimeter/TileG4/TileGeoG4SD
-                          TileCalorimeter/TileSimEvent
-                          TileCalorimeter/TileSimUtils
-                          TileCalorimeter/TileG4/TileG4Interfaces
-                          Tools/PathResolver )
-
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( CLHEP )
diff --git a/TileCalorimeter/TileG4/TileGeoG4SD/CMakeLists.txt b/TileCalorimeter/TileG4/TileGeoG4SD/CMakeLists.txt
index 773051757dd3cbe5c977210734e1f55f077125c0..7be73d35dfc5a5c289f42053db8a811f4199e3bb 100644
--- a/TileCalorimeter/TileG4/TileGeoG4SD/CMakeLists.txt
+++ b/TileCalorimeter/TileG4/TileGeoG4SD/CMakeLists.txt
@@ -5,24 +5,6 @@
 # Declare the package name:
 atlas_subdir( TileGeoG4SD )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          TileCalorimeter/TileDetDescr
-                          TileCalorimeter/TileSimEvent
-                          
-                          PRIVATE
-                          Calorimeter/CaloIdentifier
-                          Control/StoreGate
-                          TileCalorimeter/TileG4/TileG4Interfaces
-                          Calorimeter/CaloDetDescr
-                          Control/CxxUtils
-                          DetectorDescription/GeoModel/GeoModelInterfaces
-                          DetectorDescription/GeoModel/GeoModelUtilities
-                          GaudiKernel
-                          Simulation/G4Atlas/G4AtlasTools
-                          TileCalorimeter/TileGeoModel
-                          Tools/PathResolver )
-
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
diff --git a/TileCalorimeter/TileRecAlgs/src/TileBeamElemToCell.cxx b/TileCalorimeter/TileRecAlgs/src/TileBeamElemToCell.cxx
index 84b1123b80974f2d539378612e18160490776b9e..4370c32048303a7fb27289752f0e2d5476f25fdf 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileBeamElemToCell.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileBeamElemToCell.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
 */
 
 //*****************************************************************************
@@ -50,9 +50,7 @@ TileBeamElemToCell::TileBeamElemToCell(const std::string& name, ISvcLocator* pSv
   , m_tileInfo(0)
   , m_tileMgr(0)
 {
-  m_infoName = "TileInfo";
-
-  declareProperty("TileInfoName", m_infoName);                     // name of TileInfo store
+  declareProperty("TileInfoName", m_infoName = "TileInfo");                     // name of TileInfo store
 }
 
 TileBeamElemToCell::~TileBeamElemToCell()
diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellCorrection.cxx b/TileCalorimeter/TileRecAlgs/src/TileCellCorrection.cxx
index 2ede3dea85f3e2ffba87a4bfd8096a2ef1b6ffb6..8a2c95b42196f1b868c7138c40b07c6f22356680 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileCellCorrection.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileCellCorrection.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 
@@ -30,7 +30,7 @@ CaloCell_ID::SUBCALO TileCellCorrection::m_caloIndex = CaloCell_ID::TILE;
 /**
  * Constructor
  */
-TileCellCorrection::TileCellCorrection(const std::string name,
+TileCellCorrection::TileCellCorrection(const std::string& name,
     ISvcLocator* pSvcLocator)
   : AthService(name, pSvcLocator)
   , m_caloCellContainerID("AllCalo")
diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellCorrection.h b/TileCalorimeter/TileRecAlgs/src/TileCellCorrection.h
index 554258350b9bea24671eab686c25812239a3226c..b6ec1420c3a75056a6008fe849f2dd10e1673a9e 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileCellCorrection.h
+++ b/TileCalorimeter/TileRecAlgs/src/TileCellCorrection.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 TILERECALGS_TILECELLCORRECTION_H
@@ -62,7 +62,7 @@ class TileCellCorrection: public AthService, virtual public IIncidentListener {
     friend class SvcFactory<TileCellCorrection> ;
 
   public:
-    TileCellCorrection(const std::string name, ISvcLocator* pSvcLocator);
+    TileCellCorrection(const std::string& name, ISvcLocator* pSvcLocator);
 
     virtual ~TileCellCorrection(); //!< Destructor
 
diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellIDCToCell.cxx b/TileCalorimeter/TileRecAlgs/src/TileCellIDCToCell.cxx
index 934ff24a0821842a3650624d46a11944679142af..41d4b8e6c36b3813b778e4a6373f55e052056d41 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileCellIDCToCell.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileCellIDCToCell.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
 */
 
 //*****************************************************************************
@@ -44,13 +44,9 @@ TileCellIDCToCell::TileCellIDCToCell(const std::string& name, ISvcLocator* pSvcL
   , m_tileInfo(0)
   , m_tileMgr(0)
 {
-  m_cellIDC = "TileCellIDC";
-  m_cellContainer = "TileCellContainer";
-  m_infoName = "TileInfo";
-
-  declareProperty("TileCellIDC", m_cellIDC);                    // Name of input container
-  declareProperty("TileCellContainer", m_cellContainer);        // Name of output container
-  declareProperty("TileInfoName", m_infoName);                  // name of TileInfo store
+  declareProperty("TileCellIDC", m_cellIDC = "TileCellIDC");                    // Name of input container
+  declareProperty("TileCellContainer", m_cellContainer = "TileCellContainer");        // Name of output container
+  declareProperty("TileInfoName", m_infoName = "TileInfo");                  // name of TileInfo store
 }
 
 TileCellIDCToCell::~TileCellIDCToCell()
diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellToTTL1.cxx b/TileCalorimeter/TileRecAlgs/src/TileCellToTTL1.cxx
index 23fe6ac3217b5cc48b0a1f230f97f9fafbbb0031..c382e780cbcb02189407dd354b8e93f4ff9ca6a1 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileCellToTTL1.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileCellToTTL1.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
 */
 
 //*****************************************************************************
@@ -38,7 +38,7 @@
 //
 // Constructor
 //
-TileCellToTTL1::TileCellToTTL1(std::string name, ISvcLocator* pSvcLocator)
+TileCellToTTL1::TileCellToTTL1(const std::string& name, ISvcLocator* pSvcLocator)
   : AthAlgorithm(name, pSvcLocator)
   , m_tileID(0)
   , m_TT_ID(0)
diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellToTTL1.h b/TileCalorimeter/TileRecAlgs/src/TileCellToTTL1.h
index 61a99b41500d84798e888695a0e260988b09473d..281a270e31bf33a08554342985990d8dc9a3ed99 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileCellToTTL1.h
+++ b/TileCalorimeter/TileRecAlgs/src/TileCellToTTL1.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
 */
 
 
@@ -51,7 +51,7 @@ class TileCablingService;
 class TileCellToTTL1: public AthAlgorithm {
   public:
     // Constructor
-    TileCellToTTL1(std::string name, ISvcLocator* pSvcLocator);
+    TileCellToTTL1(const std::string& name, ISvcLocator* pSvcLocator);
 
     //Destructor 
     virtual ~TileCellToTTL1();
diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellVerify.cxx b/TileCalorimeter/TileRecAlgs/src/TileCellVerify.cxx
index 5c95f125bcf17d4cf6e4a3eb614332b18aefa41f..be878f5b35ef830f946623a655881be8ba1f7526 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileCellVerify.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileCellVerify.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
 */
 
 //*****************************************************************************
@@ -46,7 +46,7 @@ class CompCell {
 //==========================================================================
 
 // Constructor
-TileCellVerify::TileCellVerify(string name, ISvcLocator* pSvcLocator)
+TileCellVerify::TileCellVerify(const std::string& name, ISvcLocator* pSvcLocator)
   : AthAlgorithm(name, pSvcLocator)
   , m_tileID(0)
   , m_dumpCells(false)
diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellVerify.h b/TileCalorimeter/TileRecAlgs/src/TileCellVerify.h
index c1441fec2da93e0604cb7b00252103dcfacfe5bc..7150e851ce3e72bf351be564178bcf57921ccb63 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileCellVerify.h
+++ b/TileCalorimeter/TileRecAlgs/src/TileCellVerify.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
 */
 
 //****************************************************************************
@@ -46,7 +46,7 @@ class TileID;
 class TileCellVerify : public AthAlgorithm {
 public:
     // Constructor
-    TileCellVerify(std::string name, ISvcLocator* pSvcLocator);
+    TileCellVerify(const std::string& name, ISvcLocator* pSvcLocator);
 
     //Destructor 
     virtual ~TileCellVerify();                         
diff --git a/TileCalorimeter/TileRecAlgs/src/TileDigitsToTTL1.cxx b/TileCalorimeter/TileRecAlgs/src/TileDigitsToTTL1.cxx
index 60471500084b6962b912a50c8f45f7cfbb3bfbfb..6872ab2fb0337996a903245d916e8e19fcf5b36d 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileDigitsToTTL1.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileDigitsToTTL1.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
 */
 
 //*****************************************************************************
@@ -57,7 +57,7 @@
 //
 // Constructor
 //
-TileDigitsToTTL1::TileDigitsToTTL1(std::string name, ISvcLocator* pSvcLocator)
+TileDigitsToTTL1::TileDigitsToTTL1(const std::string& name, ISvcLocator* pSvcLocator)
   : AthAlgorithm(name, pSvcLocator)
   , m_tileID(0)
   , m_tileHWID(0)
diff --git a/TileCalorimeter/TileRecAlgs/src/TileDigitsToTTL1.h b/TileCalorimeter/TileRecAlgs/src/TileDigitsToTTL1.h
index 623662dbaabfef8a7305fd589d679d64fdc8a76c..cede2e1f7c79e49fd8e12f7b42cd0be0919712fa 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileDigitsToTTL1.h
+++ b/TileCalorimeter/TileRecAlgs/src/TileDigitsToTTL1.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
 */
 
 //****************************************************************************
@@ -52,7 +52,7 @@ class TileCondToolEmscale;
 class TileDigitsToTTL1: public AthAlgorithm {
   public:
     // Constructor
-    TileDigitsToTTL1(std::string name, ISvcLocator* pSvcLocator);
+    TileDigitsToTTL1(const std::string& name, ISvcLocator* pSvcLocator);
 
     //Destructor 
     virtual ~TileDigitsToTTL1();
diff --git a/TileCalorimeter/TileRecAlgs/src/TileMuonReceiverReadCnt.cxx b/TileCalorimeter/TileRecAlgs/src/TileMuonReceiverReadCnt.cxx
index e33480f1334738b312547027d34d248955ef982b..53fa806132a11bdd624909ca93b63013e94cdaab 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileMuonReceiverReadCnt.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileMuonReceiverReadCnt.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
 */
 
 //*****************************************************************************
@@ -47,7 +47,7 @@ using namespace std;
 //==========================================================================
 
 // Constructor
-TileMuonReceiverReadCnt::TileMuonReceiverReadCnt(string name, ISvcLocator* pSvcLocator)
+TileMuonReceiverReadCnt::TileMuonReceiverReadCnt(const std::string& name, ISvcLocator* pSvcLocator)
   : AthAlgorithm(name, pSvcLocator)
   , m_tileID(0)
   , m_tileHWID(0)
diff --git a/TileCalorimeter/TileRecAlgs/src/TileMuonReceiverReadCnt.h b/TileCalorimeter/TileRecAlgs/src/TileMuonReceiverReadCnt.h
index 4c5651e754042b9d905b66ac90314d24592fe4c3..7f01312937962075990ef77f4478593aca14ed52 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileMuonReceiverReadCnt.h
+++ b/TileCalorimeter/TileRecAlgs/src/TileMuonReceiverReadCnt.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
 */
 
 //****************************************************************************
@@ -41,7 +41,7 @@ class TileHWID;
 class TileMuonReceiverReadCnt : public AthAlgorithm {
 public:
     // Constructor
-    TileMuonReceiverReadCnt(std::string name, ISvcLocator* pSvcLocator);
+    TileMuonReceiverReadCnt(const std::string& name, ISvcLocator* pSvcLocator);
 
     // Destructor 
     virtual ~TileMuonReceiverReadCnt();                         
diff --git a/TileCalorimeter/TileRecAlgs/src/TileRawChannelToTTL1.cxx b/TileCalorimeter/TileRecAlgs/src/TileRawChannelToTTL1.cxx
index 7b547a696bf0747dfb68a7e298a7560b702795b6..ff4fb8b3846c53dbb542b7b46a9489e1f3b0cd7b 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileRawChannelToTTL1.cxx
+++ b/TileCalorimeter/TileRecAlgs/src/TileRawChannelToTTL1.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 //*****************************************************************************
@@ -61,7 +61,7 @@ using namespace CLHEP;
 //
 // Constructor
 //
-TileRawChannelToTTL1::TileRawChannelToTTL1(std::string name, ISvcLocator* pSvcLocator)
+TileRawChannelToTTL1::TileRawChannelToTTL1(const std::string& name, ISvcLocator* pSvcLocator)
   : AthAlgorithm(name, pSvcLocator)
   , m_tileID(0)
   , m_tileHWID(0)
diff --git a/TileCalorimeter/TileRecAlgs/src/TileRawChannelToTTL1.h b/TileCalorimeter/TileRecAlgs/src/TileRawChannelToTTL1.h
index eaf144a7161aef3223c55fdff9b6b5090b7a5661..2f532018df394d0f4ba7c9e497cf6464f3de390f 100644
--- a/TileCalorimeter/TileRecAlgs/src/TileRawChannelToTTL1.h
+++ b/TileCalorimeter/TileRecAlgs/src/TileRawChannelToTTL1.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
 */
 
 //****************************************************************************
@@ -54,7 +54,7 @@ class TileRawChannelContainer;
 class TileRawChannelToTTL1: public AthAlgorithm {
   public:
     // Constructor
-    TileRawChannelToTTL1(std::string name, ISvcLocator* pSvcLocator);
+    TileRawChannelToTTL1(const std::string& name, ISvcLocator* pSvcLocator);
 
     //Destructor 
     virtual ~TileRawChannelToTTL1();
diff --git a/Tools/PROCTools/data/master_q221_AOD_digest.ref b/Tools/PROCTools/data/master_q221_AOD_digest.ref
index 06f9614cc8c51a77295ba271fb5caee30e4ac88c..91978903c7e7af3da1b4f0711111117fc7a8ca5c 100644
--- a/Tools/PROCTools/data/master_q221_AOD_digest.ref
+++ b/Tools/PROCTools/data/master_q221_AOD_digest.ref
@@ -1,26 +1,26 @@
          run       event       nTopo   nIdTracks       nJets      nMuons       nElec   nTrueElec   nFakeElec       nPhot   nTruePhot   nFakePhot
       284500    87473001         118         128           4           1           9           2           7           7           4           3
-      284500    87473014          85          79           6           0           9           1           8           7           4           3
-      284500    87473022          38          30           4           0           5           1           4           2           1           1
+      284500    87473014          85          80           6           0           9           1           8           7           4           3
+      284500    87473022          38          29           4           0           5           1           4           4           3           1
       284500    87473032          27          33           4           1           9           4           5           2           1           1
-      284500    87473037          60          42           7           0          10           2           8           6           4           2
-      284500    87473040         101          96           9           0          17           1          16           7           5           2
-      284500    87473051         142         114          12           1          14           2          12          22          16           6
+      284500    87473037          60          42           7           0          11           2           9           5           3           2
+      284500    87473040         101          95           9           0          17           1          16           7           5           2
+      284500    87473051         142         111          12           1          13           1          12          23          16           7
       284500    87473063          62          76           5           2           6           2           4           6           4           2
       284500    87473068          26          35           1           1           0           0           0           0           0           0
-      284500    87473075          72          87           6           0           5           0           5           5           4           1
-      284500    87473084          83          86           7           3          15           1          14           9           4           5
+      284500    87473075          72          84           6           0           5           0           5           5           4           1
+      284500    87473084          83          86           7           3          14           1          13          10           5           5
       284500    87473091          43          49           3           0           2           1           1           5           2           3
       284500    87473096          72          75           3           2           2           0           2           3           2           1
-      284500    87473104          61          66           6           0           6           1           5           5           4           1
-      284500    87473114          93          83           7           2          13           1          12           8           5           3
-      284500    87473121          93         101           6           3          15           4          11           7           6           1
+      284500    87473104          61          63           6           0           6           1           5           5           4           1
+      284500    87473114          93          82           7           2          13           1          12           8           5           3
+      284500    87473121          93         100           6           3          16           4          12           6           5           1
       284500    87473132          81          59           9           1          10           0          10           5           5           0
       284500    87473137          81          71           8           3          15           0          15           6           6           0
       284500    87473144          83          70           7           1           6           0           6           8           5           3
-      284500    87473154          89          88           7           0          10           2           8           7           4           3
-      284500    87473162          52          52           3           0           8           1           7           3           2           1
+      284500    87473154          89          89           7           0           9           1           8           8           4           4
+      284500    87473162          52          52           3           0           7           0           7           3           2           1
       284500    87473167          74          54           6           3          12           2          10          13           8           5
-      284500    87473171          82          71           8           3           4           2           2           5           3           2
-      284500    87473184          74          88           5           2           8           2           6           8           5           3
-      284500    87473192          54          53           4           1           7           4           3           5           4           1
+      284500    87473171          82          70           8           3           4           2           2           5           3           2
+      284500    87473184          74          87           5           2           7           1           6           9           5           4
+      284500    87473192          54          52           4           1           7           4           3           5           4           1
diff --git a/Tools/PROCTools/data/master_q431_AOD_digest.ref b/Tools/PROCTools/data/master_q431_AOD_digest.ref
index 8f5fbb3ab9e6074b7716c733dd172b1ae8cc814a..6db7ca8af5ca03d22ee98135febdcdc6f46fa53f 100644
--- a/Tools/PROCTools/data/master_q431_AOD_digest.ref
+++ b/Tools/PROCTools/data/master_q431_AOD_digest.ref
@@ -1,26 +1,26 @@
          run       event       nTopo   nIdTracks       nJets      nMuons
       330470  1183722158           1           0           0           0
-      330470  1183722342         394         428          20           0
-      330470  1183727953         532         594          13           4
-      330470  1183732647         467         483          12           1
-      330470  1183733040         381         293           6           1
-      330470  1183734651         361         375          14           3
-      330470  1183735332         406         396           9           1
-      330470  1183736475         741         723          15           2
+      330470  1183722342         394         414          18           0
+      330470  1183727953         532         571          13           4
+      330470  1183732647         467         452          13           1
+      330470  1183733040         381         285           6           1
+      330470  1183734651         361         363          14           3
+      330470  1183735332         406         370           9           1
+      330470  1183736475         741         650          17           2
       330470  1183738728           1           0           0           0
-      330470  1183738949         368         443           9           1
-      330470  1183742489         152         126           2           1
-      330470  1183743040         285         313           5           0
-      330470  1183746343         492         504          14           0
+      330470  1183738949         368         418           9           1
+      330470  1183742489         152         125           2           1
+      330470  1183743040         285         305           5           0
+      330470  1183746343         492         465          14           0
       330470  1183746710           6           0           0           0
-      330470  1183751782         239         240           5           0
-      330470  1183752624         347         369           8           3
-      330470  1183753006         357         396          11           3
-      330470  1183754806         470         427          14           0
-      330470  1183769295         342         335           8           1
-      330470  1183769939         348         353          11           3
-      330470  1183773832         307         204           7           0
+      330470  1183751782         239         235           5           0
+      330470  1183752624         347         342           8           3
+      330470  1183753006         357         377          11           3
+      330470  1183754806         470         405          14           0
+      330470  1183769295         342         317           8           1
+      330470  1183769939         348         341          11           3
+      330470  1183773832         307         197           7           0
       330470  1183775209          57           0           0           0
-      330470  1183787124         431         381          11           2
-      330470  1183787946         321         325           5           1
-      330470  1183795329         458         345          19           0
+      330470  1183787124         431         361          11           2
+      330470  1183787946         321         310           5           1
+      330470  1183795329         458         333          18           0
diff --git a/Tools/PROCTools/python/RunTier0TestsTools.py b/Tools/PROCTools/python/RunTier0TestsTools.py
index 2a64d9fa180006f6f7c1d9cc668aac0937869992..d902cb1ca7bc57a9f17b306206fb676ec42ff402 100644
--- a/Tools/PROCTools/python/RunTier0TestsTools.py
+++ b/Tools/PROCTools/python/RunTier0TestsTools.py
@@ -25,7 +25,7 @@ ciRefFileMap = {
                 's3505-21.0'           : 'v1',
                 's3505-21.3'           : 'v1',
                 's3505-21.9'           : 'v1',
-                's3505-22.0'           : 'v4',
+                's3505-22.0'           : 'v5',
                 # OverlayTier0Test_required-test
                 'overlay-d1498-21.0'   : 'v2',
                 'overlay-d1498-22.0'   : 'v32',
diff --git a/Tools/PyJobTransformsCore/CMakeLists.txt b/Tools/PyJobTransformsCore/CMakeLists.txt
index be59de15822bebb774e74c82c26b8c1911960ee8..e20b18ac707acb926b04b839010b2507da049c60 100644
--- a/Tools/PyJobTransformsCore/CMakeLists.txt
+++ b/Tools/PyJobTransformsCore/CMakeLists.txt
@@ -6,8 +6,9 @@
 atlas_subdir( PyJobTransformsCore )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-atlas_install_scripts( share/slimmetadata share/checklog.py share/find_*.py share/trf_ls python/envutil.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
+atlas_install_scripts( share/checklog.py share/find_*.py share/trf_ls POST_BUILD_CMD ${ATLAS_FLAKE8} )
+atlas_install_scripts( share/slimmetadata )
 atlas_install_generic( share/*.db
                        DESTINATION share
                        EXECUTABLE )
diff --git a/Tools/PyJobTransformsCore/python/AtlasErrorCodes.py b/Tools/PyJobTransformsCore/python/AtlasErrorCodes.py
index 18621634a2a2832d81ab5eada5fc6072e95e068a..47aadf82ffb18f06e60d68a182b98aa2c0b1e25b 100755
--- a/Tools/PyJobTransformsCore/python/AtlasErrorCodes.py
+++ b/Tools/PyJobTransformsCore/python/AtlasErrorCodes.py
@@ -268,7 +268,7 @@ class ErrorInfo( object ):
         if not tb: return None
         short_tb = []
         for frame_info in tb:
-            if not 'AthenaCommon/Include.py' in frame_info[ 0 ]:
+            if 'AthenaCommon/Include.py' not in frame_info[ 0 ]:
                 short_tb.append( frame_info )
         return short_tb
 
@@ -285,7 +285,7 @@ class ErrorInfo( object ):
         if self.code == 0:
             self.backtrace = None
             self.severity = None
-        elif self.severity == None:
+        elif self.severity is None:
             self.severity = FATAL
 
     ## Errors occur when certain events are being processed.
@@ -331,19 +331,18 @@ class ErrorInfo( object ):
 #  @return List of ErrorPattern instances or @c None
 def getErrorPatterns( release ):
     global __errorPatterns
-    releaseType = type( release )
-    if releaseType.__name__ == 'str':
+    if isinstance(release, str):
         total_pats = [] # list of recognised error patterns
         for rel, pats in __errorPatterns.items():
             if rel.match( release ):
                 total_pats += pats
         return total_pats
-    elif releaseType == type( re.compile( 'test' ) ):
+    elif isinstance(release, re.Pattern):
         for rel, pats in __errorPatterns.items():
             if rel.pattern == release.pattern:
                 return pats
     else:
-        raise KeyError( 'getErrorPatterns() takes either a string or a compiled regular expression. Got an %s instead.' % releaseType.__name__ )
+        raise KeyError( 'getErrorPatterns() takes either a string or a compiled regular expression. Got an %s instead.' % type(release).__name__ )
     return None
 
 ## Retrieve error filter patterns for a given release.
@@ -352,19 +351,18 @@ def getErrorPatterns( release ):
 #  @return List of compiled regular expression isntances or @c None
 def getIgnorePatterns( release ):
     global __ignorePatterns
-    releaseType = type( release )
-    if releaseType == str:
+    if isinstance(release, str):
         total_pats = [] # list of possible patterns to ignore
         for rel, pats in __ignorePatterns.items():
             if rel.match( release ): 
                 total_pats += pats  
         return total_pats
-    elif releaseType == type( re.compile( 'test' ) ):
+    elif isinstance(release, re.Pattern):
         for rel, pats in __ignorePatterns.items():
             if rel.pattern == release.pattern:
                 return pats
     else:
-        raise KeyError( 'getIgnorePatterns() takes either a string or a compiled regular expression. Got an %s instead.' % releaseType.__name__ )
+        raise KeyError( 'getIgnorePatterns() takes either a string or a compiled regular expression. Got an %s instead.' % type(release).__name__ )
     return None
 
 ## Add an ErrorPattern instance to a specific release.
@@ -659,7 +657,7 @@ def matchErrorPattern(line,release):
     if release:
         try:
             release3 = '.'.join(release.split('.')[:3])
-        except:
+        except Exception:
             release3 = release
         rels.insert(0,release3)
     for rel in rels:
@@ -690,7 +688,7 @@ def matchIgnorePattern(line,release):
         try:
             # reduce 4-digit to 3-digit release
             release3 = '.'.join(release.split('.')[:3])
-        except:
+        except Exception:
             release3 = release
         rels.insert(0,release3)
     for rel in rels:
diff --git a/Tools/PyJobTransformsCore/python/CVSutil.py b/Tools/PyJobTransformsCore/python/CVSutil.py
deleted file mode 100755
index c9ad8eefc24227f7597438601b3dcba233f912f0..0000000000000000000000000000000000000000
--- a/Tools/PyJobTransformsCore/python/CVSutil.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-
-from __future__ import print_function
-
-def CVSkeywords( listOfKeyWords ):
-    """Take as input a list of strings containing CVS keywords of the form: \"$<name>:<value>$\"
-    It will return a dictionary with <name>,<value> as key,value pairs.
-    See cvs manual for possible keywords and their meaning."""
-    kwDict = {}
-    for kw in listOfKeyWords:
-        # CVS keywords are embedded between 2 '$' signs
-        dollar1 = kw.find('$')
-        dollar2 = kw.find('$',dollar1+1)
-        if dollar1 == -1 or dollar2 == -1:
-            print ("WARNING: %s is not a CVS keyword (it should have 2 '$' signs)" % kw)
-            continue
-        # get part in between the 2 '$' signs
-        cvskw = kw[dollar1+1:dollar2]
-        # split name and value
-        value = ''
-        colon = cvskw.find(':')
-        if colon == -1:
-            # no value. Full string is name
-            name = cvskw.strip()
-        else:
-            # name is part before colon
-            name = cvskw[:colon].strip()
-            # value is part after colon
-            if colon + 1 < len(cvskw):
-                value = cvskw[colon+1:].strip()
-        if not name:
-            print ("WARNING: \"%s\" is not a CVS keyword (it should have a name after the first $" % kw)
-            continue
-        kwDict[name] = value
-
-    return kwDict
-
-
-# Apply it to this module
-CVSkeywordsMap = CVSkeywords( ["$Id: CVSutil.py,v 1.2 2009-01-29 12:04:16 ctan Exp $" ,
-                               "$Name: not supported by cvs2svn $" ,
-                               "$Revision: 285339 $"] )
-
-__version__ = CVSkeywordsMap["Revision"]
-__author__ = "clat@hep.ph.bham.ac.uk"
-
-del CVSkeywordsMap
diff --git a/Tools/PyJobTransformsCore/python/CastorPreStager.py b/Tools/PyJobTransformsCore/python/CastorPreStager.py
deleted file mode 100755
index 9581aac2fc23fc86a1b57414f54da2dbf91dab2a..0000000000000000000000000000000000000000
--- a/Tools/PyJobTransformsCore/python/CastorPreStager.py
+++ /dev/null
@@ -1,114 +0,0 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-
-from __future__ import print_function
-
-__doc__ = """FilePreStager for the castor tape system"""
-
-__all__ = []
-
-from FilePreStager import *
-import os,re,time,commands
-import rfio
-from envutil import *
-
-# mapping of Castor stager_qry output to FilePreStager stati.
-_stager_qry_status_words = { 'STAGED'         : FilePreStager.STAGED ,
-                             'CANBEMIGR'      : FilePreStager.STAGED ,
-                             'STAGEIN'        : FilePreStager.STAGEIN ,
-                             'INVALID_STATUS' : FilePreStager.INVALID ,
-                             'not in stager'  : FilePreStager.ONTAPE }
-
-_stager_qry_statusRE = '|'.join( _stager_qry_status_words.keys() )
-
-_stager_qry_output_patterns = [ \
-    r'^%%s\s+\S+\s+(?P<status>%s)$' % (_stager_qry_statusRE) ,
-    r'^Error [0-9]+.*?\(File\s+%%s\s+(?P<status>%s)\s*\)$' % (_stager_qry_statusRE) ]
-
-class CastorPreStager(FilePreStager):
-    def __init__(self,name=None,filenamePattern=r'^/castor/|^rfio:/castor/|^castor:', maxWaitingTime=120*60, pollingInterval=5*60):
-        FilePreStager.__init__(self,filenamePattern,maxWaitingTime, pollingInterval, name)
-
-    def _writeOutFileList(self, listOfFiles, filename='castorFiles.list'):
-        '''Write list of files for castor to operate on to a file - prevents problems with excessive command line length'''
-        try:
-            f = open(filename, 'w')
-            for file in listOfFiles:
-                print (self.removePrefix(file), file=f)
-            f.close()
-        except IOError as errMsg:
-            raise FilePreStageError('Got IOError writing out list of files to stage as %s: %s' % (filename, errMsg))
-        return filename
-        
-
-    def getFilesStatus(self,listOfFiles):
-        """Return a dictionary containing the status of each file in <listOfFiles>.
-        The key is the filename and the value is the status."""
-        if not listOfFiles: return {}
-        if isinstance(listOfFiles, str):
-            listOfFiles = [ listOfFiles ]
-        fileList = self._writeOutFileList(listOfFiles)
-        # compatibility with single filename
-        # Write list of files to a file, so prevent 
-        castor_cmd = 'stager_qry'
-        if not find_executable(castor_cmd): 
-            raise FilePreStageError( "%s not found in PATH" % (castor_cmd) )
-        cmd = '%s -f %s' % (castor_cmd, fileList)
-        # execute command
-        self.printDebug(cmd)
-        stat,output = commands.getstatusoutput( cmd )
-        self.printVerbose(output)
-        if stat:
-            raise FilePreStageError( "Error executing %s (output=%s)" % (cmd,output) )
-        # analyse output
-        statusDict = {}
-        for f in listOfFiles:
-            for pat in _stager_qry_output_patterns:
-                patF = pat % self.removePrefix(f)
-                match = re.search( patF, output, re.MULTILINE )
-                if match:
-                    status = _stager_qry_status_words[match.group('status')]
-                    break
-            else:
-                status = FilePreStager.UNKNOWN
-            statusDict[f] = status
-
-        return statusDict
-        
-
-    def preStageFiles(self,listOfFiles):
-        if not listOfFiles: return
-        if isinstance(listOfFiles, str):
-            listOfFiles = [ listOfFiles ]
-        # compatibility with single filename
-        fileList = self._writeOutFileList(listOfFiles)
-        castor_cmd = 'stager_get'
-        if not find_executable(castor_cmd): 
-            raise FilePreStageError( "%s not found in PATH" % (castor_cmd) )
-        cmd = '%s -f %s' % (castor_cmd, fileList)
-        # execute command
-        self.printDebug(cmd)
-        stat,output = commands.getstatusoutput( cmd )
-        self.printVerbose(output)
-        if stat:
-            raise FilePreStageError( "Error executing %s (output=%s)" % (cmd,output) )
-
-#
-# setup for castor2 for atlas  using the env values for STAGE_HOST and STAGE_SVCCLASS
-#
-print ("Setting up castor 2 for ATLAS ...")
-castorEnv = {}
-castorEnv['RFIO_USE_CASTOR_V2']='YES'
-if os.getenv('STAGE_HOST')!= None:
-    castorEnv['STAGE_HOST']=os.getenv('STAGE_HOST')
-else:
-    castorEnv['STAGE_HOST']='castoratlas'
-if os.getenv('STAGE_SVCCLASS')!= None:
-    castorEnv['STAGE_SVCCLASS']=os.getenv('STAGE_SVCCLASS')
-else:
-    castorEnv['STAGE_SVCCLASS']='default'
-for n,v in castorEnv.items():
-    print ("%s=%s" % (n,v))
-
-os.environ.update(castorEnv)
-
-theCastorPreStager = CastorPreStager()
diff --git a/Tools/PyJobTransformsCore/python/FakeAthena.py b/Tools/PyJobTransformsCore/python/FakeAthena.py
index 5772ba21ca573a74adf9de86cb80edcada92c310..58ed730c4daba066fcf64764519eb639a30295df 100755
--- a/Tools/PyJobTransformsCore/python/FakeAthena.py
+++ b/Tools/PyJobTransformsCore/python/FakeAthena.py
@@ -1,9 +1,10 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-import os,sys, inspect
-from PyJobTransformsCore.trfutil import *
-from PyJobTransformsCore.trferr import *
-#from AthenaCommon.AppMgr import NO_EVSEL,MONTECARLO
+import os, inspect
+from past.builtins import execfile
+from PyJobTransformsCore.trfutil import find_joboptions
+from PyJobTransformsCore.trferr import JobOptionsNotFoundError
+from PyJobTransformsCore.TransformLogger import TransformLogger
 NO_EVSEL    = -99
 MONTECARLO  = 1
 
diff --git a/Tools/PyJobTransformsCore/python/FilePreStager.py b/Tools/PyJobTransformsCore/python/FilePreStager.py
index e408b75e12d1ed7deb09aaf76bf68d13d0189e7e..0df95929cd563cdcddacc794df10b61647c1c24a 100755
--- a/Tools/PyJobTransformsCore/python/FilePreStager.py
+++ b/Tools/PyJobTransformsCore/python/FilePreStager.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 
 __doc__ = """A base class for pre-staging files from tape to disk. Specific tape staging
@@ -219,9 +219,9 @@ class FileStagerRobot(TransformLogger):
         name = stager.name()
         oldStager = self.getStager(name)
         if oldStager is not None:
-            self.logger().warning("File pre-stager %s already in %s. Keeping old one." % (name,self.__name) )
+            self.logger().warning("File pre-stager %s already in %s. Keeping old one.", name,self.__name)
         else:
-            self.logger().debug("Adding file pre-stager %s to %s" % (name,self.__name) )
+            self.logger().debug("Adding file pre-stager %s to %s", name, self.__name)
             stager.setLoggerParentName(self.name())
             self.__stagerList.append( stager )
         
diff --git a/Tools/PyJobTransformsCore/python/JobReport.py b/Tools/PyJobTransformsCore/python/JobReport.py
index f2efa9afdf2839f194b9afce5aa01710f818b0b8..edcbf33879481e79db36da516666981856184bbd 100755
--- a/Tools/PyJobTransformsCore/python/JobReport.py
+++ b/Tools/PyJobTransformsCore/python/JobReport.py
@@ -3,12 +3,9 @@
 ## @package JobReport
 #
 #  @brief Main module containing the @em JobReport class and other ancillary classes @em JobInfo, @em FileInfo and @em TaskInfo.
-#  @author $LastChangedBy: graemes $
-#  @version $Rev: 501327 $
-#  @date $Date: 2012-05-18 16:24:55 +0200 (Fri, 18 May 2012) $
 
 from __future__ import with_statement, print_function
-import os,sys,re,shutil,traceback, subprocess, itertools
+import os, sys, shutil, subprocess, itertools
 import pickle
 from copy import copy
 from PyJobTransformsCore import AtlasErrorCodes, extraMetadata
@@ -265,7 +262,7 @@ class TaskInfo( XMLNode ):
             trfName = None
             taskFound = True
             yield self
-        elif trfName == False: # omit top level task
+        elif trfName is False: # omit top level task
             trfName = None
         for subtask in self.subTasks:
             for st in subtask.tasks( trfName, False ):
@@ -400,7 +397,7 @@ class JobReport( object ):
     #  stored e.g. in composite transforms.
     def __init__( self ):
         # Can't be at class scope due to py3 scoping rules for comprehensions.
-        JobReport.defaultFiles = [ defaultFilenameBase + ext for ext in fileExtensions ] + [ metadata_xml, jobinfo_xml ]
+        JobReport.defaultFiles = [ self.defaultFilenameBase + ext for ext in self.fileExtensions ] + [ self.metadata_xml, self.jobinfo_xml ]
 
         self.reset()
         self.setCommand()
@@ -915,7 +912,7 @@ class JobReport( object ):
         try:
             if athenaOK and self.info( 'athCode' ).contents() != '0':
                 athenaOK = False
-        except:
+        except Exception:
             athenaOK = False
         for eInfo in self.errors():
             if self.__ignoreUnknown and eInfo.code == 69999 and athenaOK:
@@ -956,7 +953,7 @@ class JobReport( object ):
         if self.__ignoreErrors:
             try:
                 athCode = self.info( 'athCode' ).contents()
-            except:
+            except Exception:
                 pass
             else:
                 # Return success if Athena returns success regardless of any errors detected
@@ -993,7 +990,7 @@ class JobReport( object ):
         temp2 = 'tempfile2_TOBEREMOVED_'
         try:
             # the actual execution
-            slimmetadataProcess = subprocess.check_call( [ "slimmetadata", filename, temp1, temp2 ] )
+            subprocess.check_call( [ "slimmetadata", filename, temp1, temp2 ] )
         except subprocess.CalledProcessError as cpe:
             print ("Error slimming %s [%s]: %s" % ( filename, cpe.returncode, cpe.message ))
         else:
@@ -1002,7 +999,7 @@ class JobReport( object ):
         for f in [ temp1, temp2 ]:
             try:
                 os.remove( f )
-            except:
+            except Exception:
                 pass
 
     ## A wrapper method to allow for metadata to be written in two different formats
@@ -1220,12 +1217,12 @@ class JobReport( object ):
         for info in info_try_block.keys():
             try:
                 info_try_block[info]=self.info( info ).getContents()[ info ]
-            except:
+            except Exception:
                 pass
         for info in info_try_block_odict.keys():
             try:
                 info_try_block_odict[info]=self.info( info ).getContents()
-            except:
+            except Exception:
                 pass
         nevents = 0
         for oFile in self.outputFiles():
@@ -1290,7 +1287,7 @@ class JobReport( object ):
                 ifiles.append( { 'lfn' : os.path.basename( i.filename() ), 
                                  'GUID' : i.guid(), 
                                  'dataset' : i.metaData( 'dataset' ) } )
-            except:
+            except Exception:
                 print ('JobReport collecting info input files:  problems with ', i)
         # collect info about outputfiles,
         # (metadata should be by file because of the combined trfs)  
@@ -1322,12 +1319,12 @@ class JobReport( object ):
         for info in info_try_block.keys():
             try:
                 info_try_block[info]=self.info( info ).getContents()[ info ]
-            except:
+            except Exception:
                 pass
         for info in info_try_block_odict.keys():
             try:
                 info_try_block_odict[info]=self.info( info ).getContents()
-            except:
+            except Exception:
                 pass
         nevents = 0
         for oFile in self.outputFiles():
diff --git a/Tools/PyJobTransformsCore/python/TransformConfig.py b/Tools/PyJobTransformsCore/python/TransformConfig.py
index 36aff25438c2c9e27cf52e1f65c67ab2246e44f3..842254e6abbc0c13e893b25fcb248facb0954533 100755
--- a/Tools/PyJobTransformsCore/python/TransformConfig.py
+++ b/Tools/PyJobTransformsCore/python/TransformConfig.py
@@ -100,7 +100,7 @@ class Descriptor(object):
         <variableName> is the name of the variable that is being set and is typically
         only used for error messages."""
         if self.__allowed and value not in self.__allowed:
-            raise TransformConfigError( '%s value %r is not in %s' % \
+            raise TransformConfigError( '%s value %r is not in %s' %
                                         (variableName, value, self.__allowed) )
 
         return value
@@ -156,7 +156,7 @@ class Float(Descriptor):
     def _checkValue(self,variableName,value):
         try:
             value = float(value)
-        except:
+        except Exception:
             raise TransformConfigError( '%s value %s is not a float' % (variableName, value) )
 
         # check the value against list of possible values
@@ -173,7 +173,7 @@ class Integer(Descriptor):
         inValue = value
         try:
             value = int(value)
-        except:
+        except Exception:
             raise TransformConfigError( '%s value %s is not an int' % (variableName, value) )
     
         if value != float(inValue):
@@ -206,8 +206,8 @@ class UniqueList(Descriptor):
         try:
             value.__iter__
             return list( value )
-        except:
-            raise TransformConfigError( '%s should be a list or tuple. Got %s instead.' % \
+        except Exception:
+            raise TransformConfigError( '%s should be a list or tuple. Got %s instead.' %
                                         ( variableName, type( value ).__name__ ) )
 
 
@@ -217,7 +217,7 @@ class UniqueList(Descriptor):
         if allowed:
             for v in value:
                 if v not in allowed:
-                    raise TransformConfigError( '%s value %r is not one of %s' % \
+                    raise TransformConfigError( '%s value %r is not one of %s' %
                                                 (variableName, value, allowed) )
         # make entries unique
         newValue = set() #[]
@@ -248,7 +248,7 @@ class ListOfStrings(UniqueList):
         # check that all entries are strings
         for v in value:
             if not isinstance( v, str ):
-                raise TransformConfigError("Entry %r in %s is not a string (but an %s)" % \
+                raise TransformConfigError("Entry %r in %s is not a string (but an %s)" %
                                            ( v, variableName, type( v ).__name__ ) )                                           
         return value
    
@@ -290,7 +290,7 @@ class JobConfigMetaClass(type):
 ##        print "JobConfigMetaClass( self=%r, name=%r, bases=%r, dict=%r )" % (self,name,bases,dict)
         if '__slots__' not in dict:
             raise TransformConfigError('Class %s does not have member __slots__. Please add __slots__ = ()'
-                                 ' to the class definition' % (name,) )
+                                       ' to the class definition' % (name,) )
         #
         # add list of properties
         #
diff --git a/Tools/PyJobTransformsCore/python/VTimer.py b/Tools/PyJobTransformsCore/python/VTimer.py
index 1956cbe21a093104a837d812aa485c41cde64067..4ddcb524ab904e006d7be45da0aca2209dcf67cb 100644
--- a/Tools/PyJobTransformsCore/python/VTimer.py
+++ b/Tools/PyJobTransformsCore/python/VTimer.py
@@ -84,7 +84,7 @@ class VTimer( object ):
         x = '%s %s' % ( tName, x )
         try:
             getattr( self.logger, severity )( x )
-        except:
+        except Exception:
             print (x)
 
     def toHMS( self, seconds = 0 ):
@@ -143,7 +143,7 @@ class VTimer( object ):
             self._print( 'not started [%s]' % name )
             # not re-inserting back onto _resultsStack as should not be on the stack in the first place.
             return
-        elif tContent.started == False:
+        elif tContent.started is False:
             self._print( 'already stopped [%s]' % name )
             # not re-inserting back onto _resultsStack as should not be on the stack in the first place.
             return
@@ -200,7 +200,7 @@ class VTimer( object ):
             return
         try:
             fileObj = open( fileName, 'w' )
-        except:
+        except Exception:
             self._print( ' : Could not open %s for writing.' % fileName )
             return
         pickle.dump( self._resultsDict, fileObj, pickle.HIGHEST_PROTOCOL )
diff --git a/Tools/PyJobTransformsCore/python/ValidateRootFile.py b/Tools/PyJobTransformsCore/python/ValidateRootFile.py
index 90d7c71bc55a7786531b53249b9b1e758c90048b..ee8590381d840718b00a78deb14227d664fcddde 100755
--- a/Tools/PyJobTransformsCore/python/ValidateRootFile.py
+++ b/Tools/PyJobTransformsCore/python/ValidateRootFile.py
@@ -1,6 +1,6 @@
 #!/bin/env python
 
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from __future__ import print_function
 
@@ -17,16 +17,16 @@ def checkPFCorruption(filename,verbose=False):
         print ("ERROR can't access file",filename)
         return -1
 
-    ROOT = RootUtils.import_root()
+    ROOT = RootUtils.import_root()  # noqa: F841
     from ROOT import TFile,TTree
     
     try:
         f=TFile.Open(filename)
-    except:
+    except Exception:
         print ("Can't open file",filename)
         return -1
 
-    nEvents=n=None
+    n=None
 
     keys=f.GetListOfKeys()
     for k in keys:
@@ -34,7 +34,7 @@ def checkPFCorruption(filename,verbose=False):
             tn=k.GetName()
             t=f.Get(tn)
             if not isinstance(t,TTree): return
-        except:
+        except Exception:
             print ("Can't get tree %s from file %s",tn,fn)
             f.Close()
             return -1
@@ -52,9 +52,6 @@ def checkPFCorruption(filename,verbose=False):
                     print ("Checking event",i)
         print ("Tree %s: %i event(s) ok" % (tn,n))
 
-        # Use CollectionTree determine the number of events
-        if tn=='CollectionTree': 
-            nEvents=n
         pass #end of loop over trees
 
     f.Close()
diff --git a/Tools/PyJobTransformsCore/python/athena_wrapper.py b/Tools/PyJobTransformsCore/python/athena_wrapper.py
index 2623a89bc535a61769433d0d5f49f9a71ae26627..659a1f3fa086d91e46f072029b466d25f67a4fa5 100755
--- a/Tools/PyJobTransformsCore/python/athena_wrapper.py
+++ b/Tools/PyJobTransformsCore/python/athena_wrapper.py
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## @package athena_wrapper
 #
@@ -11,9 +11,6 @@
 #  @li Handle any exceptions that arise from the execution of @c athena.py and create the
 #  appropriate AtlasErrorCodes.ErrorInfo object and a corresponding job report file.
 #
-#  @author $LastChangedBy: graemes $
-#  @version $Rev: 518863 $
-#  @date $Date: 2012-09-25 11:45:05 +0200 (Tue, 25 Sep 2012) $
 
 """date"      # executable for the shell, but a string block to python 
 # First part (shell part) copied from athena.py
@@ -146,12 +143,15 @@ fi
 import builtins
 printfunc = getattr(builtins,'print')
 
-import os, sys
+import sys
+from past.builtins import execfile
 from AthenaCommon.Include import IncludeError
 from PyJobTransformsCore import trferr, trfconsts
-from PyJobTransformsCore.JobReport import *
+from PyJobTransformsCore.JobReport import JobReport
 from PyJobTransformsCore import AtlasErrorCodes
 
+# flake8: noqa
+
 ## The err variable will be used to contain an ErrorInfo instance 
 #  after the trferr.errorHandler handles an exception.
 err = None
@@ -161,7 +161,7 @@ err = None
 try:
     ## Position of the '-c' option given at the command line.
     cPos = sys.argv.index( '-c' )
-except:
+except Exception:
     pass
 else:
     sys.argv[ cPos + 1 ] = ' '.join( sys.argv[ cPos + 1 : ] )
@@ -220,7 +220,7 @@ except str as e:
                                      severity = AtlasErrorCodes.FATAL,
                                      message = e )
 # Catch all other exceptions
-except:
+except Exception:
     err = AtlasErrorCodes.ErrorInfo( acronym = 'ATH_EXC_PYT',
                                       severity = AtlasErrorCodes.FATAL )
 
diff --git a/Tools/PyJobTransformsCore/python/basic_trfarg.py b/Tools/PyJobTransformsCore/python/basic_trfarg.py
index 42683c000aef8e332840c49d6cabd1ed985cf4a3..4ec3008082d06aac32d2ef6b32840043151fcf51 100755
--- a/Tools/PyJobTransformsCore/python/basic_trfarg.py
+++ b/Tools/PyJobTransformsCore/python/basic_trfarg.py
@@ -1,23 +1,19 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## @package basic_trfarg
 #
 #  @brief Package contains the basic argument types for JobTransforms.
 #  @details Classes defined in this package are not intended to be used directly.
 #  @see Argument classes designed to be used can be found in the full_trfarg package.
-#  @author $LastChangedBy: ivukotic $
-#  @version $Rev: 451072 $
-#  @date $Date: 2011-07-28 19:22:06 +0200 (Thu, 28 Jul 2011) $
 
 from __future__ import print_function
 
-import os, shutil, time, fnmatch, subprocess, copy
-import stat as statconsts
-from PyJobTransformsCore import fileutil, AtlasErrorCodes
-from PyJobTransformsCore.trfutil import *
-from PyJobTransformsCore.trferr import *
+import os, sys, time, fnmatch, subprocess, copy, re
+from PyJobTransformsCore import fileutil, envutil
+from PyJobTransformsCore.trfutil import AODFile, BSFile, CommentLine, DPDFile, ESDFile, EvgenFile, FileType, HitsFile, PoolDataFile, expandStringToList, strip_suffix
+from PyJobTransformsCore.trferr import TransformDefinitionError, TransformArgumentError, InputFileError, OutputFileError
 from PyJobTransformsCore.JobReport import FileInfo
-from PyJobTransformsCore.TransformLogger import TransformLogger,logging
+from PyJobTransformsCore.TransformLogger import TransformLogger
 
 
 ## @brief Base class of all transform argument classes.
@@ -442,7 +438,7 @@ class FloatArg( Argument ):
         """Turn a command line argument string into an float python object"""
         try: return float(val)
         except ValueError :
-            raise TransformArgumentError( '%s=%s is not of type %s' % \
+            raise TransformArgumentError( '%s=%s is not of type %s' %
                                           (self.name(), repr(val), self.basicType()) )
 
 
@@ -468,7 +464,7 @@ class StringArg( Argument ):
     def toPython(self,val):
         try: return str(val+'')
         except TypeError :
-            raise TransformArgumentError( '%s=%s is not of type %s' % \
+            raise TransformArgumentError( '%s=%s is not of type %s' %
                                           (self.name(), repr(val), self.basicType()) )
 
 
@@ -487,10 +483,10 @@ class StringChoicesArg( ArgChoices, StringArg ):
         if default is not None:
             try: default = self.toPython(default)
             except TransformDefinitionError :
-                raise TransformDefinitionError( 'Default value %s=%s is not of type %s' % \
+                raise TransformDefinitionError( 'Default value %s=%s is not of type %s' %
                                                 (self._name, repr(default), self.basicType()) )
             if not self.checkChoices(default):
-                raise TransformDefinitionError( 'Default value %s=%s is not one of %s' % \
+                raise TransformDefinitionError( 'Default value %s=%s is not one of %s' %
                                                 (self._name, repr(default), self.choices()) )
 
         Argument.setDefault(self,default)
@@ -503,7 +499,7 @@ class StringChoicesArg( ArgChoices, StringArg ):
             valUpper = val.upper()
             for c in self.choices():
                 if valUpper == c.upper() and val != c:
-                    self.logger().warning( 'Changing case of %s to %s' % (val,c) )
+                    self.logger().warning( 'Changing case of %s to %s', val, c )
                     val = c
                     break
         Argument.setValue(self,val)
@@ -517,7 +513,7 @@ class StringChoicesArg( ArgChoices, StringArg ):
         if not ArgChoices.checkChoices(self,val):
             raise TransformArgumentError( '%s=%r is not one of %s' %
                                           (name, val, ','.join(choices)) )
-        self.logger().debug( '%s is in list %s -> OK' % (repr(val), repr(choices)) )
+        self.logger().debug( '%s is in list %s -> OK', repr(val), repr(choices) )
 
             
 #
@@ -546,14 +542,14 @@ class BoolArg( ArgChoices, Argument ):
 
 
     def toPython(self,val):
-        if type(val) == type(True): return val != False
-        if type(val) == type(''):
+        if isinstance(val, bool): return val is not False
+        if isinstance(val, str):
             if val.lower() == 'true':  return True
             if val.lower() == 'false': return False
-            raise TransformArgumentError( '%s=%r is not one of %s' % \
+            raise TransformArgumentError( '%s=%r is not one of %s' %
                                           (self.name(), val, ','.join(self.choices())) )
         else:
-            raise TransformArgumentError( '%s=%r is not of type %s' % \
+            raise TransformArgumentError( '%s=%r is not of type %s' %
                                           (self.name(), val, self.basicType()) )
 
 
@@ -591,7 +587,7 @@ class FileArg( StringArg ):
                 #convert value to the correct case
                 valUpper = value.upper()
                 if valUpper == 'NONE' and value != 'NONE':
-                    self.logger().info( 'Changing case of %s to %s' % (value,valUpper) )
+                    self.logger().info( 'Changing case of %s to %s', value, valUpper )
                     value = valUpper
         if value != self.originalValue():
             self.__eventCount = None
@@ -613,7 +609,7 @@ class FileArg( StringArg ):
         """check that file exists (possibly with attempt number) and is non-empty"""
         val = self.value()
         if val.startswith( 'LFN:' ):
-            self.logger().info( '%s is an LFN. Omitting any local file checks.' % val )
+            self.logger().info( '%s is an LFN. Omitting any local file checks.', val )
             return
 #        if not fileutil.exists(val):
 #            found = fileutil.exists_suffix_number(val + '.')
@@ -700,7 +696,7 @@ class DataFileArg( FileArg ):
                 singleHash = False
         except IndexError: # problem with format of filename. filename ends with a single '#'!
             hashPos = -1
-            self.logger().warning( "Error trying to extract dataset from %s." % filename )
+            print( "Error trying to extract dataset from %s." % filename )
         dataset = filename[ 0 : hashPos ]
         if omitFromName:
             dsPrefix = ''
@@ -718,7 +714,7 @@ class DataFileArg( FileArg ):
             try:
                 fname = dsPrefix + dataset + filename[ hashPos + 2 : ]
             except IndexError: # problem with format of filename. filename ends with a double '#'!
-                self.logger().warning( "Error trying to extract filename from %s." % filename )
+                print( "Error trying to extract filename from %s." % filename )
             else:
                 if dirName:
                     fname = os.sep.join( [ dirName, fname ] )
@@ -737,7 +733,7 @@ class DataFileArg( FileArg ):
     #
     def eventCount(self):
         if self.__eventCount is None and self:
-            self.logger().info("Counting events of %s..." % self.originalValue())
+            self.logger().info("Counting events of %s...", self.originalValue())
             start = time.time()
             self.__eventCount = self._fileType.eventCount( self )
             if self.__eventCount is not None:
@@ -770,7 +766,7 @@ class InputFileArg( FileArg ):
         """Check that the file exists, and is readable"""
         if not self: return
         self.checkFile()
-        self.logger().debug( 'Inputfile %s is usable -> OK' % (self.originalValue()) )
+        self.logger().debug( 'Inputfile %s is usable -> OK', self.originalValue() )
         
 
     def eventCount(self):
@@ -913,7 +909,7 @@ class InputDataFileArg( DataFileArg ):
         if self:
             try:
                 val = self.value()[0]
-            except:
+            except Exception:
                 pass
             else:
                 return self._fileType.type( val )
@@ -925,7 +921,7 @@ class InputDataFileArg( DataFileArg ):
         if self:
             try:
                 val = self.value()[0]
-            except:
+            except Exception:
                 pass
             else:
                 return self._fileType.contents( val )
@@ -952,14 +948,14 @@ class InputDataFileArg( DataFileArg ):
         """First filename without the path and type"""
         try:
             return self._fileType.baseFilename( self.value()[0] )
-        except:
+        except Exception:
             return ""
 
     def bareFilename(self):
         """First filename without the path, the contents and the type."""
         try:
             return self._fileType.bareFilename( self.value()[0] )
-        except:
+        except Exception:
             return ""
 
 
@@ -992,7 +988,7 @@ class InputTarFileArg( InputFileArg ):
                 if not line: continue
                 self._filelist.append(line)
           # hack for slving bug on poll (Python 2.4?)      
-            ret=p.wait()
+            p.wait()
             while True:
                 line = p.stdout.readline().strip()
                 if not line: break
@@ -1107,11 +1103,12 @@ class InputTarFileAndSetupArg( InputTarFileArg ):
         pwd = os.getcwd()
         if setupdir and setupdir != os.curdir: os.chdir(setupdir)
         if fullsetup.endswith('.py'):
+            from past.builtins import execfile
             # avoid pollution of global namespace
             env = {}
             execfile( setupbase,env )
         else:
-            source_setup( setupbase )
+            envutil.source_setup( setupbase )
         # go back to original directory
         os.chdir(pwd)
         
@@ -1168,7 +1165,6 @@ class OutputFileArg( DataFileArg ):
         DataFileArg.preRunAction(self)
         val = self.value()
         self._fileInfo = None
-        mess = ''
         if not self:
             self.logger().debug( 'No output file expected. Nothing to be done.' )
         elif fileutil.exists(val):
@@ -1182,7 +1178,7 @@ class OutputFileArg( DataFileArg ):
     
     def validateFile( self ):
         if self._temporary or self._intermediate:
-            self.logger().info( '%s is a temporary/intermediate file. It will not be validated.' % self.name() )
+            self.logger().info( '%s is a temporary/intermediate file. It will not be validated.', self.name() )
             return
         try:
             self._fileType.validateFile( self, **self.__validationDict )
@@ -1214,12 +1210,12 @@ class OutputFileArg( DataFileArg ):
                 if FT is None: FT='unset'
                 necoll=self._fileType.writeSize(self)
                 if necoll is not None:
-					# returns filetype, number_of_events and tuple_of_sizes
+                    # returns filetype, number_of_events and tuple_of_sizes
                     alltheData.append(FT.upper())
                     alltheData.append(necoll[0])
                     alltheData.append(necoll[1])
                     return
-            except:
+            except Exception:
                 print ("basic_trfarg.py  exception caught:", sys.exc_type, ":", sys.exc_value)
         else:
             print ('basic_trfarg.py  Not checking object sizes for this file type')
diff --git a/Tools/PyJobTransformsCore/python/envutil.py b/Tools/PyJobTransformsCore/python/envutil.py
index 156c076e7937811dea5c0414c3cede16b93f83f2..387f799c88855f819ca60431498413a9a86954e2 100755
--- a/Tools/PyJobTransformsCore/python/envutil.py
+++ b/Tools/PyJobTransformsCore/python/envutil.py
@@ -355,8 +355,7 @@ def find_files_split( filename, dirlist, access, depth ):
         for f in filelist:
 ##            print ("Trying %s..." % f)
             if not os.path.isfile(f) or not fileutil.access(f, access): continue
-            if not f in filenameList:
-                fullfile = os.path.join( dir, f )
+            if f not in filenameList:
 ##                print ("==> Adding %s to list from %s" % (f,dir))
                 dirnameList.append(dir)
                 filenameList.append(f)
@@ -637,47 +636,3 @@ def source_setup(setupshell,options='',envRE=None):
     newenv = getenv_from_output( source_cmd + '; printenv', envRE )
     update_env(newenv)
     return newenv
-
-
-def setup_cmt(cmtroot):
-    """setup cmt itself, located at root directory cmtroot"""
-    setupsh = os.path.join(cmtroot,'mgr','setup.sh')
-    envRE = "CMTROOT|CMTBIN|CMTCONFIG|PATH|CLASSPATH"
-    return source_setup(setupsh, envRE=envRE)
-    
-
-def setup_cmt_from_package(packageRoot):
-    setupsh = os.path.join(packageRoot,'cmt','setup.sh')
-    cmtroot = getenv_from_output('cat ' + setupsh,'CMTROOT').get('CMTROOT')
-    if not cmtroot:
-        raise EnvironmentError( 'Failed to setup cmt from %s' % (setupsh) )
-    setup_cmt(cmtroot)
-
-
-def setup_cmt_package(packageRoot,envRE=None):
-    setupsh = os.path.join(packageRoot,'cmt','setup.sh')
-    cmtroot = os.environ.get('CMTROOT')
-    if not cmtroot: setup_cmt_from_package(packageRoot)
-    cmtsetup = os.path.join( cmtroot, 'mgr', 'setup.sh' )
-    cmtcmd = os.path.join( cmtroot, 'mgr', 'cmt' )
-    cmd = 'source %s 1>/dev/null 2>/dev/null && %s setup -sh -no_cleanup' % (cmtsetup, cmtcmd)
-    newenv = getenv_from_output(cmd,envRE)
-    update_env(newenv)
-    return newenv
-
-
-def cmt_package_version(packageRoot,withVersionDirectory=True):
-    """Return the version of the cmt package at given package Root directory"""
-    version = None
-    # first try the version.cmt file
-    versioncmtfilename = os.path.join(packageRoot,'cmt','version.cmt')
-    if os.path.exists(versioncmtfilename):
-        cmtversionfile = open(versioncmtfilename)
-        for line in cmtversionfile:
-            if line: version = line.strip()
-        cmtversionfile.close()
-    # if failed, assume with-version-directory and take last directory of packageRoot
-    if not version and withVersionDirectory:
-        version = os.path.basename( packageRoot )
-
-    return version
diff --git a/Tools/PyJobTransformsCore/python/extraMetadata.py b/Tools/PyJobTransformsCore/python/extraMetadata.py
index 982760cce3f2894b169869c1dcda495293ee6f70..ec41a5980677aee2fb1be9ea218131ad7ddb4735 100644
--- a/Tools/PyJobTransformsCore/python/extraMetadata.py
+++ b/Tools/PyJobTransformsCore/python/extraMetadata.py
@@ -1,6 +1,4 @@
-#
-#  extraMetadata.py
-#  
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 #
 #  Created by Alvin on 01/09/2009.
 #  
diff --git a/Tools/PyJobTransformsCore/python/fileutil.py b/Tools/PyJobTransformsCore/python/fileutil.py
index db3cbbd1e919d8f51f008cf64514c000c5812043..e249361a0b47623e854deb145da0828115aea5e4 100755
--- a/Tools/PyJobTransformsCore/python/fileutil.py
+++ b/Tools/PyJobTransformsCore/python/fileutil.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
 
 from __future__ import print_function
 
@@ -62,7 +62,7 @@ class AccessType:
 
 
     def matches(self,filename):
-        return re.search( self.matchPat, filename ) != None
+        return re.search( self.matchPat, filename ) is not None
 
 
     def cleanUp(self,filename):
@@ -104,7 +104,7 @@ class Tee:
 
     def flush(self):
         self.screen.flush()
-        file.flush(self)
+        self.f.flush()
 
     
 
@@ -155,8 +155,8 @@ def remove(filename):
     if at == IO_LOCAL:
         if exists(filename): retry_file_access( os.remove, filename )
     else:
-        print ("WARNING: file %s file %s can not be removed" % \
-              (at.name, filename))
+        print ("WARNING: file %s file %s can not be removed" %
+               (at.name, filename))
     
 
 def exists_suffix(filename,suffixRE):
diff --git a/Tools/PyJobTransformsCore/python/full_trfarg.py b/Tools/PyJobTransformsCore/python/full_trfarg.py
index f0247beb4315c462d4751b9b5cfc48cc2bd0c877..9bb9daf79fa8bb47ae34c54449a36a477847454a 100755
--- a/Tools/PyJobTransformsCore/python/full_trfarg.py
+++ b/Tools/PyJobTransformsCore/python/full_trfarg.py
@@ -1,20 +1,13 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-
-import CVSutil
-CVSkeywords = CVSutil.CVSkeywords( ["$Id: full_trfarg.py,v 1.61 2009-04-17 06:40:35 cote Exp $" ,
-                                    "$Name: not supported by cvs2svn $" ,
-                                    "$Revision: 525634 $"] )
-
-__version__ = CVSkeywords["Revision"]
-__author__ = "clat@hep.ph.bham.ac.uk"
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 __doc__ = """End-user Fully specialised arguments that can be used in JobTransform implemenations."""
 
+import os
 import copy
-from PyJobTransformsCore.basic_trfarg import *
-from PyJobTransformsCore.envutil import *
-from PyJobTransformsCore.trfutil import *
-from PyJobTransformsCore.trferr import *
+from PyJobTransformsCore.basic_trfarg import Argument, BoolArg, InputDataFileArg, InputTarFileAndSetupArg, InputTarFileArg, IntegerArg, OutputDataFileArg, OutputFileArg, StringArg
+from PyJobTransformsCore.envutil import find_joboptions
+from PyJobTransformsCore.trfutil import AODFile, BSFile, DPDFile, ESDFile, EvgenFile, FTKIPFile, HistogramFile, HitsFile, JiveXMLTGZFile, MonitorHistFile, NtupleFile, RDOFile, SANFile, TAGFile, expandStringToList, strip_suffix
+from PyJobTransformsCore.trferr import JobOptionsNotFoundError, TransformArgumentError, TransformDefinitionError
 from PyJobTransformsCore import fileutil
 
 
@@ -122,17 +115,17 @@ class OutputSkimmedBSFileArg(OutputDataFileArg):
         #print "FilenameTDAQ",filenameTDAQ
             
         if  fileutil.exists(filename):
-            self.logger().info("Found skimmed bystream file called %s" % filename)
+            self.logger().info("Found skimmed bystream file called %s", filename)
             OutputDataFileArg.prepareFileInfo( self )
             return
         elif  fileutil.exists(filenameTDAQ):
-            self.logger().info("Found skimmed bystream file called %s, renaming back to %s" % (filenameTDAQ, filename))
-            os.rename(filenameTDAQ,filename); #try - except?
+            self.logger().info("Found skimmed bystream file called %s, renaming back to %s", filenameTDAQ, filename)
+            os.rename(filenameTDAQ,filename) #try - except?
             #That's of course a hack that will work only in local file system. 
             OutputDataFileArg.prepareFileInfo( self )
             return
         else:
-            self.logger().info("No skimmed bystream file corresponding to %s found." % filename)
+            self.logger().info("No skimmed bystream file corresponding to %s found.", filename)
             return
         
 class InputESDFileArg(InputDataFileArg):
@@ -337,7 +330,7 @@ class BasicExec(Argument):
         try:
             valOut=StringToExec(valIn)
             return valOut
-        except:
+        except Exception:
             raise TransformArgumentError( '%s=%s: syntax error in BasicExec' % (self.name(),valIn) )
         return None
     
@@ -370,7 +363,7 @@ class ListOfStringsArg(StringArg):
             try:
                 valTmp=valIn.replace(',,',',')
                 valList=valTmp.split(',')
-            except:
+            except Exception:
                 raise TransformArgumentError( '%s=%s: syntax error in list of strings' % (self.name(),valIn) )
             return valList
 
@@ -392,10 +385,10 @@ class JobOptionsArg(StringArg):
         elif pacType == list:
             self._packages = package
         else:
-            raise TypeError("%s constructor argument \'package\' is not of type str or list (got type %s)" % \
-                            (self.__class__.__name__, pacType.__name__) )
+            raise TypeError("%s constructor argument \'package\' is not of type str or list (got type %s)",
+                            self.__class__.__name__, pacType.__name__)
         # prepend current directory if not already present
-        if not os.curdir in self._packages: self._packages.insert(0,os.curdir)
+        if os.curdir not in self._packages: self._packages.insert(0,os.curdir)
         self._fullFiles = []
         self._exeEnv = {} # copy of python environment after last execution of joboptions
         StringArg.__init__(self,help,name)
@@ -442,7 +435,7 @@ class JobOptionsArg(StringArg):
         val = Argument.value(self)
         newVal = []
         for v in val:
-            if self._packages and not os.sep in v:
+            if self._packages and os.sep not in v:
                 for p in self._packages:
                     full = os.path.join(p,v)
                     if find_joboptions( full ):
@@ -462,7 +455,7 @@ class JobOptionsArg(StringArg):
             #convert value to the correct case
             valUpper = value.upper()
             if valUpper == 'NONE' and value != 'NONE':
-                self.logger().info( 'Changing case of %s to %s' % (value,valUpper) )
+                self.logger().info( 'Changing case of %s to %s', value,valUpper )
                 value = valUpper
             # treat empty string as NONE
             if value == '': value = 'NONE'
@@ -485,7 +478,7 @@ class JobOptionsArg(StringArg):
         for i in range(len(shortList)):
             short = shortList[i]
             full  = fullList[i]
-            self.logger().info( 'Found %s in %s' % (short, strip_suffix(full,short)) )
+            self.logger().info( 'Found %s in %s', short, strip_suffix(full,short) )
 
     def exeJobOptions( self, env = {} ):
         """Execute the lines in the jobOptions file in environment <env>. The runtime
@@ -499,7 +492,7 @@ class JobOptionsArg(StringArg):
         for i in range( len( shortList ) ):
             short = shortList[ i ]
             full  = fullList[ i ]
-            self.logger().info( "Executing jobOptions file %s." % full )
+            self.logger().info( "Executing jobOptions file %s.", full )
             FakeAthena.theApp.exeJobOptions( short, env )
         self._exeEnv.update( copy.copy( env ) )
 
@@ -706,7 +699,7 @@ class DBReleaseArg( InputTarFileAndSetupArg ):
     """Tarball containing the DBRelease to use"""
     def __init__( self, name = 'DBRelease', destdir = os.curdir ):
         InputTarFileAndSetupArg.__init__( self, help = 'default', name = name,
-                                         setupfile = 'setup.py', envVars = None, destdir = destdir, temporary = True )
+                                          setupfile = 'setup.py', envVars = None, destdir = destdir, temporary = True )
 
     def isFullArgument(self):
         return True
diff --git a/Tools/PyJobTransformsCore/python/pool.py b/Tools/PyJobTransformsCore/python/pool.py
index 5e058ff8459785729dbb2dd020dd05aaba3da930..4330a6ef78177a566335cae07479e664b8be5e00 100755
--- a/Tools/PyJobTransformsCore/python/pool.py
+++ b/Tools/PyJobTransformsCore/python/pool.py
@@ -1,7 +1,7 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-import os,re
-from envutil import *
+import os
+from envutil import find_path_env, append_path_env_if
 
 POOL_HOME = 'POOL_HOME'
 
@@ -18,7 +18,6 @@ def setup_environment():
         pool_home = os.path.dirname(pool_path[0])
         os.environ[POOL_HOME] = pool_home
 
-    pool_lib = os.path.join( pool_home, 'lib' )
     pool_bin = os.path.join( pool_home, 'bin' )
 
     append_path_env_if('PYTHONPATH',pool_bin)
@@ -26,6 +25,4 @@ def setup_environment():
 
 setup_environment()
 
-from PyFCAction import *
-
-
+from PyFCAction import *  # noqa: F401 F403
diff --git a/Tools/PyJobTransformsCore/python/runargs.py b/Tools/PyJobTransformsCore/python/runargs.py
index 525564c0209c7a97e57d705b08972283c6a4d285..cf97bbb42f9e1099e9b450ccd345e798a5f46144 100755
--- a/Tools/PyJobTransformsCore/python/runargs.py
+++ b/Tools/PyJobTransformsCore/python/runargs.py
@@ -5,8 +5,7 @@ from __future__ import print_function
 __author__ = "clat@hep.ph.bham.ac.uk"
 
 import os
-from PyJobTransformsCore.TransformConfig import *
-from PyJobTransformsCore.TransformLogger import TransformLogger
+from PyJobTransformsCore.TransformConfig import Descriptor, JobConfig
 from PyJobTransformsCore.trfutil import VALIDATION_DICT
 from PyJobTransformsCore.trferr import TransformArgumentError
 
@@ -81,7 +80,7 @@ class CommandLineOption( Descriptor ):
         if not func: return
         if self.__takesArgument:
             func(value)
-        elif value == True:
+        elif value is True:
             func()
     
     
@@ -98,7 +97,7 @@ class CommandLineOption( Descriptor ):
                 # convert to boolean if possible.
                 try:
                     value = { 'TRUE' : True, 'FALSE' : False, '' : True }[ value.upper() ]
-                except:
+                except Exception:
                     raise TransformArgumentError( '%s value of %s not recognised.' % ( variableName, value ) )
             elif not isinstance( value, bool ):
                 raise TransformArgumentError( '%s should be boolean. Got %s (%s) instead.' % (variableName, value, valType) )
@@ -113,7 +112,7 @@ class CommandLineOption( Descriptor ):
             choices = self.allowedValues()
             try:
                 valueList = value.split( ',' )
-            except:
+            except Exception:
                 valueList = [ value ]
             # Convert value to the correct case, if there is a list of string choices
             if choices:
@@ -136,7 +135,7 @@ class CommandLineOption( Descriptor ):
                         raise TransformArgumentError( '%s value %r is not in %s' % ( variableName, v, choices ) )
                 try: # string list
                     return ','.join( newValueList )
-                except: # assume boolean
+                except Exception: # assume boolean
                     return newValueList[0]
         # check against list of possible values
         return Descriptor._checkValue(self,variableName,value)
@@ -185,7 +184,7 @@ class CommandLineOption( Descriptor ):
         # Check all allowed values
         if not self.__takesArgument:
             for val in allowedValues:
-                if val != True and val != False:
+                if val is not True and val is not False:
                     raise TransformArgumentError( '%s should be True or False. Got %s (%s) instead.' % (variableName, val, type(val).__name__) )
         else:
             for val in allowedValues:
@@ -369,7 +368,7 @@ class RunOptions(JobConfig):
                     # convert to boolean if possible.
                     try:
                         value = { 'TRUE' : True, 'FALSE' : False }[ value.upper() ]
-                    except:
+                    except Exception:
                         pass
                 else:
                     value=''
@@ -396,7 +395,7 @@ class RunOptions(JobConfig):
                     try:
                         # test if it is a negative number
                         float(name)  # covers both float and int
-                    except:
+                    except Exception:
                         raise TransformArgumentError('option %s not supported' % name)
                     else:
                         # it is a negative number: add it to the list, and go to next
@@ -416,7 +415,7 @@ class RunOptions(JobConfig):
                     # convert to boolean if possible.
                     try:
                         value = { 'TRUE' : True, 'FALSE' : False }[ value.upper() ]
-                    except:
+                    except Exception:
                         pass
                     setattr(self,longName,value)
                 else:
diff --git a/Tools/PyJobTransformsCore/python/trf.py b/Tools/PyJobTransformsCore/python/trf.py
index 459f076a96b2203619e83a3c9e779e4c1a2c42f7..eac660bbc9130554ef560204fd919ad4c1a350e9 100755
--- a/Tools/PyJobTransformsCore/python/trf.py
+++ b/Tools/PyJobTransformsCore/python/trf.py
@@ -1,33 +1,30 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## @package trf
 #
 #  @brief Main package containing the @em JobTransform class.
 #  @details Main module of @em PyJobTransformsCore package containing the base class @em JobTransform.
-#  @author $LastChangedBy: graemes $
-#  @version $Rev: 576050 $
-#  @date $Date: 2013-12-18 09:14:07 +0100 (Wed, 18 Dec 2013) $
 
 from __future__ import with_statement, print_function
-import os, sys, time, getopt, stat, re, math, subprocess, signal, threading
-import traceback
+from past.builtins import execfile
+import os, sys, time, stat, re, math, subprocess, signal, inspect
 import stat as statconsts
 from copy import copy
 try:
     import cPickle as pickle
-except:
+except Exception:
     import pickle
 import fileutil
 from PyJobTransformsCore import trfenv, trferr, trfconsts, AtlasErrorCodes
-from PyJobTransformsCore.trferr import *
-from PyJobTransformsCore.trfutil import *
-from PyJobTransformsCore.JobReport import *
-from PyJobTransformsCore.TransformLogger import *
+from PyJobTransformsCore.trferr import AthenaLogChecker, InputFileError, JobOptionsNotFoundError, TransformArgumentError, TransformDefinitionError, TransformEnvironmentError, TransformErrorDiagnoser, TransformValidationError
+from PyJobTransformsCore.trfutil import Author, CommentLine, PostJobOptionsFile, PreJobOptionsFile, SQLiteSupport, TRF_SETTING, VersionString, find_joboptions, get_atlas_release, get_files, setDefaultSignalHandlers, setTrfSignalHandler, strip_suffix
+from PyJobTransformsCore.JobReport import JobReport, JobInfo, _extraMetadataDict
+from PyJobTransformsCore.TransformLogger import TransformLogger
 from PyJobTransformsCore.TransformConfig import TransformConfig
-from PyJobTransformsCore.runargs import * 
+from PyJobTransformsCore.runargs import RunArguments, RunOptions, VALIDATION_DICT
 from PyJobTransformsCore.VTimer import vTimer
-from PyJobTransformsCore.basic_trfarg import Argument,OutputFileArg
-from PyJobTransformsCore.full_trfarg import *
+from PyJobTransformsCore.basic_trfarg import Argument
+from PyJobTransformsCore.full_trfarg import OptionArg, JobConfigArg
 from AthenaCommon import ExitCodes  
 
 ## @class JobTransform
@@ -132,7 +129,7 @@ class JobTransform(TransformLogger):
                         if _v:
                             version = _v
                             break
-            except:
+            except Exception:
                 pass
         ## Specify if this is the last trf in a chained series of trfs.
         #  This allows certain processes to be omitted/added depending on it's position in the trf chain. 
@@ -352,11 +349,11 @@ class JobTransform(TransformLogger):
                 self._logFile.write(line)
         try:
             self._logFile.close()
-        except:
+        except Exception:
             pass
         try:
             rc = self._runJobProcess.returncode
-        except:
+        except Exception:
             rc = None
         if rc < 0 or rc is None:
             os.system( 'dmesg > dmesg_trf.txt' )
@@ -562,13 +559,13 @@ class JobTransform(TransformLogger):
         try:
             if minEvents < 0 or maxEvents < 0 or maxEvents < minEvents:
                 raise Exception
-        except:
-            self.logger().info( "%s should be greater or equal to %s" % ( maxEvents, minEvents ) )
+        except Exception:
+            self.logger().info( "%s should be greater or equal to %s", maxEvents, minEvents )
             return
         self._minEvents = minEvents
-        self.logger().info("Setting minimum number of output events to %d" % minEvents)
+        self.logger().info("Setting minimum number of output events to %d", minEvents)
         self._maxEvents = maxEvents
-        self.logger().info("Setting maximum number of output events to %d" % maxEvents)
+        self.logger().info("Setting maximum number of output events to %d", maxEvents)
 
     ## @brief Ensure that the exit code is not affected by the presence of unknown errors.
     #  @details Aligns the transform exit code with that of @c athena.py (@em only if the latter was successful) 
@@ -634,7 +631,7 @@ class JobTransform(TransformLogger):
         try:
             execfile( fname )
         except IOError:
-            self.logger().warning( "Error reading file %s containing extra metadata." % fname )
+            self.logger().warning( "Error reading file %s containing extra metadata.", fname )
         else:
             _extraMetadataDict.update( locals()['extraMetadataDict'] )
 
@@ -704,7 +701,7 @@ class JobTransform(TransformLogger):
     def enableMaskAllErrors( self, val ):
         try:
             val = val.upper()
-        except:
+        except Exception:
             pass
         else:
             if val == 'ALL':
@@ -755,7 +752,7 @@ class JobTransform(TransformLogger):
         for n in self._sharedRunOpts:
             try:
                 setattr(self._runOpts,n,getattr(parentOpts,n))
-            except:
+            except Exception:
                 pass
 
     ## Add or replace options at the command line for @c athena.py
@@ -773,7 +770,7 @@ class JobTransform(TransformLogger):
             except ValueError:
                 pass
             else:
-                self.logger().warning( '%s cannot be used with the default --tcmalloc option. --tcmalloc option removed.' % option )
+                self.logger().warning( '%s cannot be used with the default --tcmalloc option. --tcmalloc option removed.', option )
         # remove old option if needed
         firstWord = option.split()[0]
         for opt in self._athenaOptions:
@@ -819,13 +816,12 @@ class JobTransform(TransformLogger):
         if isinstance(authorList,Author):
             authorsAdd = [ authorList ]
         else:
-            authType = type(authorList)
-            if authType == type(''):
+            if isinstance(authorList, str):
                 authorsAdd = [ Author(a) for a in authorList.split(',') ]
-            elif authType == type(list()):
+            elif isinstance(authorList, list):
                 pass
             else:
-                raise TransformDefinitionError('Author type %s not supported' % authType)
+                raise TransformDefinitionError('Author type %s not supported' % type(authorList))
         self._authors += authorsAdd
         # update authors template
         authStrings = [ str(a) for a in authorsAdd ]
@@ -1067,7 +1063,7 @@ class JobTransform(TransformLogger):
     #  @return None
     def ls(self):
         for arg in self._positionalArgs:
-            self.logger().info( '%s=%s # %s' % ( arg.name(), arg.value(), arg.getHelp() ) )
+            self.logger().info( '%s=%s # %s', arg.name(), arg.value(), arg.getHelp() )
 
     ## Getter function for the job transform name.
     #  @see _name attribute.
@@ -1139,7 +1135,7 @@ class JobTransform(TransformLogger):
     def getArgumentOfType(self,typename):
         for arg in self._positionalArgs:
             if arg.argumentType() == typename: return arg
-        self.logger().warning( "Argument of %s type not found. Returning None." % typename )
+        self.logger().warning( "Argument of %s type not found. Returning None.", typename )
         return None
 
     ## Getter function for the list of arguments in positional order.
@@ -1170,7 +1166,7 @@ class JobTransform(TransformLogger):
     #  @return None
     def writeRunArgs(self):
         filename = self.runArgsFilename()
-        self.logger().info( 'Writing runArgs to file \"%s\"' % filename )
+        self.logger().info( 'Writing runArgs to file \"%s\"', filename )
         with open( filename, 'w' ) as f:
             f.write( self.getRunArgsTemplate() % self.argumentValueDict() )
         filename = os.path.splitext(filename)[0] + '.gpickle'
@@ -1182,7 +1178,7 @@ class JobTransform(TransformLogger):
         raise TransformDefinitionError( "Auto-generation of skeleton jobOptions file not yet supported." +
                                         " It must be specified in the constructor of %s" % self.__class__.__name__  )
         filename = self.skeletonFilename()
-        self.logger().info( 'Writing skeleton to file \"%s\"' % filename )
+        self.logger().info( 'Writing skeleton to file \"%s\"', filename )
         with open( filename, 'w' ) as f:
             f.write( self.getSkeletonTemplate() % self.argumentValueDict() )
 
@@ -1318,7 +1314,6 @@ class JobTransform(TransformLogger):
         args = self._runOpts.extractOptions(argList)
         # process arguments
         posArgs = self._positionalArgs
-        reqArgs = self._requiredArgs
         nArgs = len(args)
         # fill the dictionary with all given arguments
         lastNamed=''
@@ -1329,15 +1324,15 @@ class JobTransform(TransformLogger):
             if equal == -1:
                 #positional argument. Not allowed after named argument
                 if lastNamed:
-                    raise TransformArgumentError(\
+                    raise TransformArgumentError(
                         'No positional arguments allowed after named arguments.' +
-                        ' Positional argument %d (%s) after named argument %s=%r' % \
+                        ' Positional argument %d (%s) after named argument %s=%r' %
                         (i+1,val,lastNamed,self.getArgument(lastNamed).value()) )
                 try:
                     name = posArgs[pos].name()
                 except IndexError:
-                    raise TransformArgumentError ('too many arguments: %d (max=%d)' % \
-                          (nArgs, len(posArgs)))
+                    raise TransformArgumentError ('too many arguments: %d (max=%d)' %
+                                                  (nArgs, len(posArgs)))
                 pos += 1
             else:
                 #named argument or option
@@ -1382,7 +1377,7 @@ class JobTransform(TransformLogger):
                 if oldEvents > 0:
                     newEvents = int( math.ceil(oldEvents/eff) )
                     maxEvts.setValue(newEvents)
-                    self.logger().info("Processing %d events instead of %d to account for filtering efficiency %f" % (newEvents, oldEvents, eff ) )
+                    self.logger().info("Processing %d events instead of %d to account for filtering efficiency %f", newEvents, oldEvents, eff )
 
     ## Dump to file the complete shell command to facilitate the re-execution of the transform.
     #  @remarks The arguments of the transform are written to a separate file as well.
@@ -1421,7 +1416,7 @@ class JobTransform(TransformLogger):
         # try environment variable DBRELEASE
         self._dbrelease = os.environ.get('DBRELEASE')
         if self._dbrelease:
-            self.logger().info( "Got Database Release number %s from environment variable DBRELEASE" % self._dbrelease )
+            self.logger().info( "Got Database Release number %s from environment variable DBRELEASE", self._dbrelease )
         else:
             self.logger().info( "Database Release no longer needed for r19 and beyond" )
             return
@@ -1452,8 +1447,8 @@ class JobTransform(TransformLogger):
         machineInfo = JobInfo('Machine')
         # Platform information
         import platform
-        joinList = lambda x : '-'.join(x)
-        asIs = lambda x: x
+        joinList = lambda x : '-'.join(x)  # noqa: E731
+        asIs = lambda x: x                 # noqa: E731
         platformEnv = { 'architecture'   : joinList ,
                         'dist'           : joinList ,
                         'machine'        : asIs ,
@@ -1471,8 +1466,8 @@ class JobTransform(TransformLogger):
         cpucache=''
         modelstring='UNKNOWN'
         fname='/proc/cpuinfo'
-        modelRE=re.compile('^model name\s+:\s+(\w.+)')
-        cacheRE=re.compile('^cache size\s+:\s+(\d+ KB)')
+        modelRE=re.compile(r'^model name\s+:\s+(\w.+)')
+        cacheRE=re.compile(r'^cache size\s+:\s+(\d+ KB)')
         try:
             with open( fname ) as f:
                 for line in f:
@@ -1507,7 +1502,7 @@ class JobTransform(TransformLogger):
                        'X?PRINT.*', 'INPUTRC', 'LESS.*', 'AFSHOME', 'USERPATH', 'IFS', 'LAMHELPFILE',
                        'CLUSTER_DIR', 'ENVIRONMENT', 'GS_LIB', 'ROOTPATH', 'XAUTHORITY'
                        '.*_DCOP', 'DCOP_.*', 'DOTFONTPATH', 'INITIALISED',
-                        'SAVEHIST', 'HISTSIZE', 
+                       'SAVEHIST', 'HISTSIZE',
                        'cmt', 'jcmt', 'CVS.*', 'CMTCVSOFFSET', os.sep )
         excludeEnvRE = re.compile( '^%s$' % '|'.join(excludeEnv) )
         for n,v in os.environ.items():
@@ -1579,7 +1574,7 @@ class JobTransform(TransformLogger):
         # gather metadata from logfile
         logfile = self._logFilename
         if os.path.exists(logfile):
-            self.logger().info( "Scanning logfile %s for metadata..." % logfile )
+            self.logger().info( "Scanning logfile %s for metadata...", logfile )
             # pattern in logfile:
             #    MetaData: <name> [unit]=<value>
             metaPat = re.compile( r"^MetaData:\s+(.*?)\s*=\s*(.*)$" )
@@ -1590,7 +1585,7 @@ class JobTransform(TransformLogger):
                     if match:
                         name=match.group(1).split()[0]  # take first word (second word is optional unit)
                         value=match.group(2)
-                        self.logger().info( "Found MetaData: %s=%s" % (name,value) )
+                        self.logger().info( "Found MetaData: %s=%s", name,value )
                         addMeta[name] = value
                         continue
                     # gather extra metadata from extraMetadata
@@ -1659,7 +1654,7 @@ class JobTransform(TransformLogger):
         # gather metadata from logfile
         logfile = self._logFilename
         if os.path.exists(logfile):
-            self.logger().info( "Scanning logfile %s for metadata..." % (logfile) )
+            self.logger().info( "Scanning logfile %s for metadata...", logfile )
             # pattern in logfile:
             #    MetaData: <name> [unit]=<value>
             metaPat = re.compile( r"^MetaData:\s+(.*?)\s*=\s*(.*)$" )
@@ -1670,7 +1665,7 @@ class JobTransform(TransformLogger):
                     if match:
                         name=match.group(1).split()[0]  # take first word (second word is optional unit)
                         value=match.group(2)
-                        self.logger().info( "Found MetaData: %s=%s" % (name,value) )
+                        self.logger().info( "Found MetaData: %s=%s", name, value )
                         addMeta[name] = value
                         continue
                     # gather extra metadata from extraMetadata
@@ -1709,7 +1704,6 @@ class JobTransform(TransformLogger):
     #  @return None
     def preStageInputFiles(self):
         from PyJobTransformsCore.FilePreStager import theFileStagerRobot
-        from PyJobTransformsCore import CastorPreStager
         self._addLogger( theFileStagerRobot )
         fileList = []
         for f in self._inputFiles:
@@ -1758,9 +1752,9 @@ class JobTransform(TransformLogger):
             if len(self._inputFiles) > 1:
                 self.logger.info('Checking maxEvents against {0} only ({1} are assumed to have the same event count)'.format(self._inputFiles[0].name(), [f.name() for f in self._inputFiles[1:]]))
             inputFile = self._inputFiles[0]
-            if VALIDATION_DICT[ 'ALL' ] == False or VALIDATION_DICT[ 'testCountEvents' ] == False:
+            if VALIDATION_DICT[ 'ALL' ] is False or VALIDATION_DICT[ 'testCountEvents' ] is False:
                 raise Exception
-        except:
+        except Exception:
             self.logger().info( "Skipping input file max event check." )
             return
         # Do nothing if all events are to be used (-1) rather than set it to the actual number.
@@ -1779,12 +1773,12 @@ class JobTransform(TransformLogger):
                 self.logger().warning("Found 0 events in %s, but total filesize %s. Ignoring event count.",
                                       inputFile.name(), totalSize )
             else:
-                raise InputFileError(inputFile.originalValue(),' empty file(s). Argument %s' % \
+                raise InputFileError(inputFile.originalValue(),' empty file(s). Argument %s' %
                                      (inputFile.name(),) ,
                                      error='TRF_INFILE_EMPTY')
         elif events < maxEvents:
             if self._maxEventsStrategy =='ABORT':
-                raise InputFileError(inputFile.originalValue(),': too few events (%d < %d) in input file' % \
+                raise InputFileError(inputFile.originalValue(),': too few events (%d < %d) in input file' %
                                      (events,maxEvents),
                                      error='TRF_INFILE_TOOFEW')
             elif self._maxEventsStrategy =='INPUTEVENTS':
@@ -1798,10 +1792,10 @@ class JobTransform(TransformLogger):
                 self.logger().warning("Unknown maxEventsStratety (%s). Ignoring that %s=%d is larger than number of events (%d) in input file(s) %s",
                                       self._maxEventsStrategy,maxEventsArg.name(),maxEvents,events,inputFile.originalValue())
             # Do check on minimum number of input events 
-            if VALIDATION_DICT[ 'ALL' ] == False or VALIDATION_DICT[ 'testEventMinMax' ] == False:
+            if VALIDATION_DICT[ 'ALL' ] is False or VALIDATION_DICT[ 'testEventMinMax' ] is False:
                 self.logger().info( "Input file event min/max test omitted." ) 
             elif self._minEvents and events < self._minEvents:
-                raise InputFileError(inputFile.originalValue(),': too few events (%d < %d) in input file' % \
+                raise InputFileError(inputFile.originalValue(),': too few events (%d < %d) in input file' %
                                      (events,self._minEvents),
                                      error='TRF_INFILE_TOOFEW')
         else:
@@ -1830,7 +1824,7 @@ class JobTransform(TransformLogger):
                 # SQLiteSupport is enabled.
                 if self._useSQLite is None:
                     self._useSQLite = self._mcInput
-                    self.logger().info( "%s use of SQLite." % { True : 'Enabling', False : 'Disabling', None : 'Disabling' }[ self._useSQLite ] )
+                    self.logger().info( "%s use of SQLite.", { True : 'Enabling', False : 'Disabling', None : 'Disabling' }[ self._useSQLite ] )
                 if not self._useSQLite:
                     continue
             cmd.preRunAction()
@@ -1849,12 +1843,12 @@ class JobTransform(TransformLogger):
             for l in lines:
                 # print (l.strip())
                 if l.startswith('/atlas/Role=production'): isProd=True
-        except OSError as e:
+        except OSError:
             print ("trf.py - Not a prodSys environment.")
                      
         
-        if isProd==False and os.getenv('TZAMIPW') is None: print ('Performance data will not get stored in the AMI db.'          )
-        elif self._exportToAmi==True and self.name()!='Digi_trf':  # digi is off as it has no AMItag and is fast
+        if isProd is False and os.getenv('TZAMIPW') is None: print ('Performance data will not get stored in the AMI db.'          )
+        elif self._exportToAmi is True and self.name()!='Digi_trf':  # digi is off as it has no AMItag and is fast
         
             #print ('-------', self.name(), '-------')
             
@@ -1862,8 +1856,7 @@ class JobTransform(TransformLogger):
             isStream=''
             isAMItag=''
             isRun=-1
-            isFormat=''
-            
+
             import PyUtils.AthFile as athFile 
             # this loop just tries to find runnumber, stream, amitag. should not look at NTUP files as these have not metadata embeded
             for arg in self._positionalArgs: 
@@ -1900,39 +1893,29 @@ class JobTransform(TransformLogger):
                             isRun    = inputFileSummary['run_number'][0]
                         print ('isRun    ', isRun)
                         
-                        # if 'stream_names' in inputFileSummary:
-                        #     isFormat = inputFileSummary['stream_names'][0].replace('Stream','')
-                        # print ('isFormat ',isFormat)
-                    
-                        # if arg.name().startswith('outputRDOFile'):
-                        #     print ('This is RDO. Changing format to proper one.')
-                        #     isFormat='RDO'
-                        
-                        if isMC==True:
+                        if isMC is True:
                             print ('this is MC. Changin stream->procstep and runnumber -> pandaid')
                             isStream=self.name()
-                            fromFN = inFile.split('.');
                             if inFile[1].isdigit():
                                 isRun = inFile[1]
                             else:
                                 isRun = 0
-                    except Exception as e:
+                    except Exception:
                         print ("Problem in decoding variables.")
                         print (sys.exc_info()[0])
                         print (sys.exc_info()[1])
-                    except:
+                    except Exception:
                         print ("Unexpected error:", sys.exc_info()[0])
                     print ('=====================')
                    
             if isAMItag!='':
-            			    
-                print ('trf.py STARTING UPLOAD the final values -> stream:',isStream,'\trunnumber:',isRun,'\tamitag:',isAMItag)#, '\tformat:',isFormat
+                print ('trf.py STARTING UPLOAD the final values -> stream:',isStream,'\trunnumber:',isRun,'\tamitag:',isAMItag)
                 
                 import PyJobTransforms.performanceDataUploader as pu
                 
                 uploader = pu.PerformanceUploader(isProd)
                 uploader.establishConnection()
-			    # this loop finds sizes and formats and uploads to AMI for all the files.
+                # this loop finds sizes and formats and uploads to AMI for all the files.
                 for cmd in self._postRunActions:
                     try:
                         # print ('trf.py _postRunAction ',cmd)
@@ -1946,13 +1929,13 @@ class JobTransform(TransformLogger):
                                     print ('trf.py object size data upload DONE')
                                 except Exception as exc:
                                     print (exc)
-                                except:
+                                except Exception:
                                     print ("Unexpected error:", sys.exc_info()[0])
                     except Exception as e:
                         print ('trf.py WARNING: Could not send size data to AMI ' , e)
                         print (sys.exc_info()[0])
                         print (sys.exc_info()[1])
-                    except:
+                    except Exception:
                         print ("Unexpected error:", sys.exc_info()[0])
                 
                 if self._name=='AtlasG4_trf' or self._name=='Evgen_trf' or self._name=='Digi_trf': 
@@ -1968,7 +1951,7 @@ class JobTransform(TransformLogger):
                             uploader.uploadPerfMonSD(isAMItag, self._name, isStream, int(isRun), perffile)
                         except Exception as exc: 
                             print (exc)
-                        except:
+                        except Exception:
                             print ("Unexpected error:", sys.exc_info()[0])
                         
                         print ('trf.py upload of job performance data done!')
@@ -1976,7 +1959,7 @@ class JobTransform(TransformLogger):
                         print ('trf.py WARNING: Could not send job info to AMI ' , e)
                         print (sys.exc_info()[0])
                         print (sys.exc_info()[1])
-                    except:
+                    except Exception:
                         print ("Unexpected error:", sys.exc_info()[0])
                 else:
                     print ('there is no perfmon file: ', perffile)
@@ -2001,11 +1984,11 @@ class JobTransform(TransformLogger):
             timelimited(120, self.doUpload)
         except Exception as exc: 
             print (exc)
-        except:
+        except Exception:
             print ("Unexpected error:", sys.exc_info()[0])
             
         
-        if not ( VALIDATION_DICT['ALL'] == False or VALIDATION_DICT[ 'testMatchEvents' ] == False ):
+        if not ( VALIDATION_DICT['ALL'] is False or VALIDATION_DICT[ 'testMatchEvents' ] is False ):
             self.matchEvents()
         else:
             self.logger().info( "Skipping event number matching." )
@@ -2031,13 +2014,13 @@ class JobTransform(TransformLogger):
         self.gatherEnvironmentInfo()
         # Do check on minimum and maximum number of requested output events (only if not running in test mode)
         maxEvents = None
-        if VALIDATION_DICT[ 'ALL' ] == False or VALIDATION_DICT[ 'testEventMinMax' ] == False: 
+        if VALIDATION_DICT[ 'ALL' ] is False or VALIDATION_DICT[ 'testEventMinMax' ] is False:
             self.logger().info( "Event min/max test omitted." )
         else:
             maxEventsArg = self.getArgumentOfType("MaxEvents")
             try:
                 maxEvents = maxEventsArg.value()
-            except:
+            except Exception:
                 pass
         if maxEvents and maxEvents != -1:
             # undo any efficiency correction
@@ -2074,7 +2057,7 @@ class JobTransform(TransformLogger):
             fullJo = find_joboptions( jo )
             if not fullJo:
                 raise JobOptionsNotFoundError(jo,'Top jobOptions file not found')
-            self.logger().info( 'Found top jobOptions %s in %s' % (jo, strip_suffix(fullJo,jo)) )
+            self.logger().info( 'Found top jobOptions %s in %s', jo, strip_suffix(fullJo,jo) )
             with open( fullJo ) as joFile:
                 for line in joFile:
                     self._logFile.write(line)
@@ -2097,7 +2080,7 @@ class JobTransform(TransformLogger):
             with open( athenaScript, 'w' ) as athenaFile:
                 # If we have an asetup to add, add it here....
                 if 'asetup' in self._namedArgs:
-                    self.logger().info('Found asetup arg: %s' % self._namedArgs['asetup'].value())
+                    self.logger().info('Found asetup arg: %s', self._namedArgs['asetup'].value())
                     athenaFile.write('#! /bin/sh' + os.linesep)
                     athenaFile.write('%s/scripts/asetup.sh %s' % (os.environ['AtlasSetup'], self._namedArgs['asetup'].value()) + os.linesep)
                     runViaScript = True
@@ -2107,14 +2090,13 @@ class JobTransform(TransformLogger):
                       statconsts.S_IRUSR | statconsts.S_IRGRP | statconsts.S_IROTH |
                       statconsts.S_IWUSR )
         except Exception as e:
-            self.logger().warning( 'Encountered an error while trying to create %s. %s' % ( athenaScript, e ) )
-        logStartAthena = self._logFile.tell()
+            self.logger().warning( 'Encountered an error while trying to create %s. %s', athenaScript, e )
         # the actual execution
         if runViaScript:
-            self.logger().info( 'Executing %s: %s' % ( self.name(), athenaScript ) )
+            self.logger().info( 'Executing %s: %s', self.name(), athenaScript )
             self._runJobProcess = subprocess.Popen( args = athenaScript, bufsize = 1, shell = False,stdout = subprocess.PIPE, stderr = subprocess.STDOUT )
         else:
-            self.logger().info( 'Executing %s: %s' % ( self.name(), ' '.join( athenaScriptArgs ) ) )
+            self.logger().info( 'Executing %s: %s', self.name(), ' '.join( athenaScriptArgs ) )
             self._runJobProcess = subprocess.Popen( args = athenaScriptArgs, bufsize = 1, shell = False,stdout = subprocess.PIPE, stderr = subprocess.STDOUT )
         # Poll stdout of the process and write to log file
         while self._runJobProcess.poll() is None:
@@ -2123,18 +2105,18 @@ class JobTransform(TransformLogger):
                 self._logFile.write(line)
         # adding the exit status from athena
         rc = self._runJobProcess.returncode
-        self.logger().info( '%s has completed running of Athena with exit code %s.' % ( self.name(), rc ) )
+        self.logger().info( '%s has completed running of Athena with exit code %s.', self.name(), rc )
         if rc < 0:
             # dump dmesg to file when the athena job receives a signal.
             os.system( 'dmesg > dmesg_athena.txt' )
             if rc == -signal.SIGKILL:
-                self.logger().error( 'Athena received signal %s = SIGKILL. Athena was killed, job will terminate. ' % rc )
+                self.logger().error( 'Athena received signal %s = SIGKILL. Athena was killed, job will terminate. ', rc )
             elif rc == -signal.SIGTERM:
-                self.logger().error( 'Athena received signal %s = SIGTERM. Athena was terminated, job will terminate. ' % rc )
+                self.logger().error( 'Athena received signal %s = SIGTERM. Athena was terminated, job will terminate. ', rc )
             else:
                 # After dicsussion with athena core people, we decided it's best to encode the 
                 # signal exit code in a 'shell like' way, adding 128 to it
-                self.logger().error( 'Athena received signal %s. Exit code reset to Athena exit code %d.' % (-rc, 128 + abs(rc) ) )  
+                self.logger().error( 'Athena received signal %s. Exit code reset to Athena exit code %d.', -rc, 128 + abs(rc) )
                 rc = 128 + abs(rc)
         # Add the athena exit codes and acroynm directly into the main job report before 
         # it is lost due to some exception occuring between now and the end of this function. 
@@ -2163,7 +2145,7 @@ class JobTransform(TransformLogger):
         if status == 0:
             self.doPostRunActions()
             # do check on number of events in output files
-            if VALIDATION_DICT[ 'ALL' ] == False or VALIDATION_DICT[ 'testEventMinMax' ] == False:
+            if VALIDATION_DICT[ 'ALL' ] is False or VALIDATION_DICT[ 'testEventMinMax' ] is False:
                 self.logger().info( "Output file event min/max test omitted." )
             else:
                 for f in self._outputFiles:
@@ -2182,7 +2164,7 @@ class JobTransform(TransformLogger):
     #  @warning Derived transforms must not override this function.
     #  @return JobReport.JobReport instance
     def execute(self):
-        self.logger().info( 'Using %s' % ( trfenv.trfPath) )
+        self.logger().info( 'Using %s', trfenv.trfPath )
         try:
             #clean up old stuff
             fileutil.remove(self._logFilename)
@@ -2199,7 +2181,7 @@ class JobTransform(TransformLogger):
             self._jobReport.addReport( self.runJob(), 'MERGE' )
         # Catch all exceptions
         except Exception as e:
-            self.logger().error( "During execution of %s, exception caught: %s" % ( self.name(), e ) )
+            self.logger().error( "During execution of %s, exception caught: %s", self.name(), e )
             self._jobReport.addError( self._handleException(e) )
         # run the error diagnoser on all errors
         errorDocter = TransformErrorDiagnoser()
@@ -2211,7 +2193,7 @@ class JobTransform(TransformLogger):
         self._jobReport.setIgnoreErrors( self._ignoreErrors )
         errorcode = self._jobReport.errorCode()
         exitcode  = self._jobReport.exitCode()
-        self.logger().info( "JobTransform completed for %s with error code %s (exit code %d)" % (self.name(),errorcode,exitcode) )
+        self.logger().info( "JobTransform completed for %s with error code %s (exit code %d)", self.name(),errorcode,exitcode )
         dirInfo = self._getRunDirInfo()
         # in case of ERROR, add workdir contents
         printListing = errorcode and 'KEY_INTERRUPT' not in self._jobReport.errorAcronym()
diff --git a/Tools/PyJobTransformsCore/python/trfValidateRootFile.py b/Tools/PyJobTransformsCore/python/trfValidateRootFile.py
index 8e7157276f5ea78872f55bf4ec4e8ee80d06c3b8..8340ae856c3bcfe6000849233f155311984e44be 100755
--- a/Tools/PyJobTransformsCore/python/trfValidateRootFile.py
+++ b/Tools/PyJobTransformsCore/python/trfValidateRootFile.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # @Package PyJobTransforms.trfValidateRootFile
 # @brief Functionality to test a Root file for corruption
@@ -15,31 +15,31 @@ import sys
 
 from PyUtils import RootUtils
 ROOT = RootUtils.import_root()
-from ROOT import TFile, TTree, TKey, TDirectory, TClass, TList, TObjArray, TStopwatch, TBasket, TDirectoryFile
+from ROOT import TFile, TTree, TDirectory, TStopwatch, TDirectoryFile
 
 
 
 def checkBranch(branch, msg):
 
-    msg.debug('Checking branch %s...' % branch.GetName())
+    msg.debug('Checking branch %s...', branch.GetName())
 
-    nBaskets=branch.GetWriteBasket();
+    nBaskets=branch.GetWriteBasket()
 
-    msg.debug('Checking %s baskets...' % nBaskets)
+    msg.debug('Checking %s baskets...', nBaskets)
 
     for iBasket in range(nBaskets):
-        basket=branch.GetBasket(iBasket);
+        basket=branch.GetBasket(iBasket)
         if not basket:
-            msg.warning('Basket %s of branch %s is corrupted.' % (iBasket, branch.GetName() ))
+            msg.warning('Basket %s of branch %s is corrupted.', iBasket, branch.GetName())
             return 1
 
-    listOfSubBranches=branch.GetListOfBranches();
-    msg.debug('Checking %s subbranches...' % listOfSubBranches.GetEntries())
+    listOfSubBranches=branch.GetListOfBranches()
+    msg.debug('Checking %s subbranches...', listOfSubBranches.GetEntries())
     for subBranch in listOfSubBranches:
         if checkBranch(subBranch,msg)==1:
-            return 1;
+            return 1
 
-    msg.debug('Branch %s looks ok.' % branch.GetName())
+    msg.debug('Branch %s looks ok.', branch.GetName())
     return 0    
 
 
@@ -47,11 +47,11 @@ def checkTreeBasketWise(tree, msg):
 
     listOfBranches=tree.GetListOfBranches()
 
-    msg.debug('Checking %s branches ...' % listOfBranches.GetEntries())
+    msg.debug('Checking %s branches ...', listOfBranches.GetEntries())
 
     for branch in listOfBranches:
         if checkBranch(branch,msg)==1:
-            msg.warning('Tree %s is corrupted (branch %s ).' % (tree.GetName(), branch.GetName()))
+            msg.warning('Tree %s is corrupted (branch %s ).', tree.GetName(), branch.GetName())
             return 1
 
     return 0
@@ -61,11 +61,11 @@ def checkTreeEventWise(tree, msg):
 
     nEntries=tree.GetEntries()
 
-    msg.debug('Checking %s entries...' % nEntries)
+    msg.debug('Checking %s entries...', nEntries)
 
     for i in range(nEntries):
         if tree.GetEntry(i)<0:
-            msg.warning('Event %s of tree %s is corrupted.' % (i, tree.GetName()))
+            msg.warning('Event %s of tree %s is corrupted.', i, tree.GetName())
             return 1
 
     return 0
@@ -73,33 +73,33 @@ def checkTreeEventWise(tree, msg):
 
 def checkDirectory(directory, type, requireTree, msg):
 
-    msg.debug('Checking directory %s...' % directory.GetName())
+    msg.debug('Checking directory %s...', directory.GetName())
 
     listOfKeys=directory.GetListOfKeys()
 
-    msg.debug('Checking %s keys... ' % listOfKeys.GetEntries())
+    msg.debug('Checking %s keys... ', listOfKeys.GetEntries())
 
     for key in listOfKeys:
 
-        msg.debug('Looking at key %s...' % key.GetName())
-        msg.debug('Key is of class %s.' % key.GetClassName())
+        msg.debug('Looking at key %s...', key.GetName())
+        msg.debug('Key is of class %s.', key.GetClassName())
 
         object=directory.Get(key.GetName())
         if not object:
-            msg.warning("Can't get object of key %s." % key.GetName())
+            msg.warning("Can't get object of key %s.", key.GetName())
             return 1
 
-        if ( the_object.GetName().find('Meta') > -1 ) and isinstance(the_object,TDirectoryFile):
-            msg.warning("Will ignore Meta TDirectoryFile %s!" % the_object.GetName() )
+        if ( object.GetName().find('Meta') > -1 ) and isinstance(object,TDirectoryFile):
+            msg.warning("Will ignore Meta TDirectoryFile %s!", object.GetName() )
             continue
 
         if requireTree and not isinstance(object, TTree):
-            msg.warning("Object %s is not of class TTree!" % object.GetName())
+            msg.warning("Object %s is not of class TTree!", object.GetName())
             return 1
 
         if isinstance(object,TTree):
 
-            msg.debug('Checking tree %s ...' % object.GetName())
+            msg.debug('Checking tree %s ...', object.GetName())
             
             if type=='event':
                 if checkTreeEventWise(object, msg)==1:
@@ -108,47 +108,47 @@ def checkDirectory(directory, type, requireTree, msg):
                 if checkTreeBasketWise(object, msg)==1:
                     return 1
 
-            msg.debug('Tree %s looks ok.' % object.GetName())    
+            msg.debug('Tree %s looks ok.', object.GetName())
             
         if isinstance(object, TDirectory):
             if checkDirectory(object, type, requireTree, msg)==1:
                 return 1
 
-    msg.debug('Directory %s looks ok.' % directory.GetName())
+    msg.debug('Directory %s looks ok.', directory.GetName())
     return 0
 
 
 def checkFile(fileName, type, requireTree, msg):
 
-    msg.info('Checking file %s.' % fileName)
+    msg.info('Checking file %s.', fileName)
 
     file=TFile.Open(fileName)
 
     if not file:
-        msg.warning("Can't access file %s." % fileName)
+        msg.warning("Can't access file %s.", fileName)
         return 1
 
     if not file.IsOpen():
-        msg.warning("Can't open file %s." % fileName)
+        msg.warning("Can't open file %s.", fileName)
         return 1
 
     if file.IsZombie():
-        msg.warning("File %s is a zombie." % fileName)
+        msg.warning("File %s is a zombie.", fileName)
         file.Close()
         return 1
 
     if file.TestBit(TFile.kRecovered):
-        msg.warning("File %s needed to be recovered." % fileName)
+        msg.warning("File %s needed to be recovered.", fileName)
         file.Close()
         return 1
 
     if checkDirectory(file, type, requireTree, msg)==1:
-        msg.warning("File %s is corrupted." % fileName)
+        msg.warning("File %s is corrupted.", fileName)
         file.Close()
         return 1
 
-    file.Close();
-    msg.info("File %s looks ok." % fileName)
+    file.Close()
+    msg.info("File %s looks ok.", fileName)
     return 0
 
 
@@ -203,10 +203,10 @@ def main(argv):
         return usage()
   
     rc=checkFile(fileName,type, requireTree, msg)
-    msg.debug('Returning %s' % rc)
+    msg.debug('Returning %s', rc)
     
-    clock.Stop();
-    clock.Print();
+    clock.Stop()
+    clock.Print()
 
     return rc
 
diff --git a/Tools/PyJobTransformsCore/python/trfenv.py b/Tools/PyJobTransformsCore/python/trfenv.py
index 77446f055264b144b38bc8f0732cc31e127e84ae..aaee0c4b66324fc1c42045449dc82dc8db65095a 100755
--- a/Tools/PyJobTransformsCore/python/trfenv.py
+++ b/Tools/PyJobTransformsCore/python/trfenv.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # prepare the runtime environment for the transformations
 import os,re,sys
@@ -9,7 +9,7 @@ if sys.hexversion < minPyVersion:
     minVersion = "%d.%d.%d" % ( (minPyVersion >> 24) & 0xFF, (minPyVersion >> 16) & 0xFF, (minPyVersion >> 8 ) & 0xFF )
     raise EnvironmentError( "Used python version (%s) too old. Requiring at least version %s" % (gotVersion,minVersion) )
 
-from PyJobTransformsCore.trferr import *
+from PyJobTransformsCore.trferr import TransformEnvironmentError
 from PyJobTransformsCore import trfconsts,envutil
 
 # no imports out of scope!
diff --git a/Tools/PyJobTransformsCore/python/trferr.py b/Tools/PyJobTransformsCore/python/trferr.py
index 56dff3387adffcc52537264308dfda7170d7085f..894e926910622b431e8835504625e397de866b4c 100755
--- a/Tools/PyJobTransformsCore/python/trferr.py
+++ b/Tools/PyJobTransformsCore/python/trferr.py
@@ -11,14 +11,12 @@ __all__ = [ 'TransformError', 'TransformDefinitionError', 'TransformArgumentErro
             'JobOptionsNotFoundError', 'TransformErrorHandler', 'AthenaLogChecker',
             'TransformThreadTimeout', 'TransformThreadError' ]
 
-import sys,re,os,copy
+import re
+import os
 from PyJobTransformsCore import fileutil, trfconsts, AtlasErrorCodes, VTimer
-from PyJobTransformsCore.xmlutil import XMLNode
-from PyJobTransformsCore.envutil import *
+from PyJobTransformsCore.envutil import find_library, examine_library, find_in_stack
 from PyJobTransformsCore.TransformLogger import TransformLogger
-#from AthenaCommon.Logging import logging
 from AthenaCommon.Include import IncludeError
-from PyJobTransformsCore.JobReport import *
 
 from future import standard_library
 standard_library.install_aliases()
@@ -248,8 +246,8 @@ class AthenaLogChecker:
             releaseName = 'ALL'
             if self.release:
                 releaseName += ',' + self.release 
-            logger.info("Scanning athena logfile %s assuming ATLAS release %s ..." % \
-                        (filename,releaseName) )
+            logger.info("Scanning athena logfile %s assuming ATLAS release %s ...",
+                        filename, releaseName)
             logger.info("Athena initialise()...")
         logFile = open(filename)
         nLines = 0
@@ -259,7 +257,7 @@ class AthenaLogChecker:
             report.addError( self.processLine( line, logger ) )
         logFile.close()
         if logger:
-            logger.info("Done scanning %d lines of file %s. Summary:" % (nLines,filename) )
+            logger.info("Done scanning %d lines of file %s. Summary:", nLines, filename)
             logger.info("   Ignored : %d", self.ignoreCount )
             logger.info("   Warnings: %d", self.warningCount )
             logger.info("   Errors  : %d", self.errorCount )
@@ -301,27 +299,27 @@ class AthenaLogChecker:
         # match ignore patterns
         ignore = AtlasErrorCodes.matchIgnorePattern(line,self.release)
         if ignore:
-            if ignore.re.pattern == '.*?\s+?INFO .+':
+            if ignore.re.pattern == r'.*?\s+?INFO .+':
                 return None
             self.ignoreCount += 1
             if logger:
-                logger.debug("ignoring error in line: \"%s\"" % line)
-                logger.debug("    because it matched: \"%s\"" % ignore.re.pattern)
+                logger.debug("ignoring error in line: \"%s\"", line)
+                logger.debug("    because it matched: \"%s\"", ignore.re.pattern)
             return None
         # then match known error patterns
         match, err = AtlasErrorCodes.matchErrorPattern(line,self.release)
         if err:
             self.processError(err)
             if logger:
-                logger.debug("matched error category %s in line: %s" % (err.category.acronym,line))
-                logger.debug("    because it matched: \"%s\"" % match.re.pattern)
+                logger.debug("matched error category %s in line: %s", err.category.acronym, line)
+                logger.debug("    because it matched: \"%s\"", match.re.pattern)
             return err
         # finally, perform generic error match
         err = self.extractError(line)
         if err:
             self.processError(err)
             if logger:
-                logger.verbose("non-matched error in line: %s" % line)
+                logger.verbose("non-matched error in line: %s", line)
             return err
         return None
 
@@ -339,7 +337,7 @@ class AthenaLogChecker:
         with who, severity and message field filled. For all other messages
         return None"""
         line=line.rstrip()
-        lineREC = re.compile("(^\S*\s*(?=WARNING|ERROR|FATAL))(WARNING|ERROR|FATAL)\:?\s+(.+$)")
+        lineREC = re.compile(r"(^\S*\s*(?=WARNING|ERROR|FATAL))(WARNING|ERROR|FATAL)\:?\s+(.+$)")
         match = lineREC.search(line)
         if match:
             who = match.group(1).strip()
@@ -485,7 +483,7 @@ class TransformErrorHandler(TransformLogger):
         # add filename to EnvironmentError for printout
         if isinstance(e,EnvironmentError):
             fn = e.filename
-            if fn != None and fn not in e.args: e.args += (fn,)
+            if fn is not None and fn not in e.args: e.args += (fn,)
         #
         # specific processing
         #
@@ -499,9 +497,8 @@ class TransformErrorHandler(TransformLogger):
         elif isinstance(e,Exception):
             if hasattr(e,'args') and type(e.args) == list and e.args:
                 args0 = e.args[0]
-                argType0 = type(args0)
                 # test for some known strings
-                if argType0 == type(''):
+                if isinstance(args0, str):
                     if args0.find('Failed to load DLL') != -1:
                         return self.handleDllLoadError(e)
         # error was not handled
@@ -529,7 +526,7 @@ class TransformErrorHandler(TransformLogger):
     def handleSystemExit(self,e):
         try:
             status = e.args[ 0 ]
-        except:
+        except Exception:
             status = 0
         if status == 0:
             return AtlasErrorCodes.ErrorInfo( acronym = 'OK' )
@@ -556,13 +553,16 @@ class TransformErrorHandler(TransformLogger):
     
     def handleDllLoadError(self,e):
         # try to find the guilty one
+        import subprocess
+        from PyJobTransformsCore.trfutil import TRACEBACK_TEXT
+
         mess = None
         diag = None
-        dllRE = "^theApp.Dlls\s*[+]?="
+        dllRE = r"^theApp.Dlls\s*[+]?="
         stack = find_in_stack( dllRE )
         if stack:
             text = stack[TRACEBACK_TEXT]
-            dllNameRE = "([\w\.\-]+)"
+            dllNameRE = r"([\w\.\-]+)"
             subRE = "%s%s%s%s" % (dllRE,r"\s*\[\s*\"", dllNameRE, r"\"\s*\]")
             dll = re.sub( subRE, r"\1", text )
             lib = 'lib%s.so' % (dll)
@@ -572,7 +572,7 @@ class TransformErrorHandler(TransformLogger):
             if not full_lib:
                 diag += '%s not found.' % (lib)
             else:
-                self.logger().debug( "Found %s. Checking dependencies..." % full_lib )
+                self.logger().debug( "Found %s. Checking dependencies...", full_lib )
                 lddOut = subprocess.getoutput( 'ldd %s' % (full_lib) )
                 missLibs = [ ]
                 subRE = "%s%s%s" % (r"^\s*",dllNameRE,r"\s+.*not found\s*.*$")
diff --git a/Tools/PyJobTransformsCore/python/trfutil.py b/Tools/PyJobTransformsCore/python/trfutil.py
index bc7a55248e091cdd70d388b71c1d7144376fc2e2..ec1ff87d6b4cc74b94c09ca8e2dbca1b520ae871 100755
--- a/Tools/PyJobTransformsCore/python/trfutil.py
+++ b/Tools/PyJobTransformsCore/python/trfutil.py
@@ -2,12 +2,12 @@
 
 from __future__ import print_function
 
-import os, sys, re, shutil, inspect, glob, time, signal, pickle
+import os, sys, re, shutil, glob, time, signal, pickle
 import bz2
 import functools
 import tarfile
-import traceback
 import uuid
+from builtins import range
 
 from subprocess import Popen, PIPE, STDOUT
 from threading import Thread
@@ -16,14 +16,12 @@ try:
 except AttributeError:  # __stop does not exist in Python 3.0
     TRF_Thread_stop = Thread._stop
 
-from .xmlutil import XMLNode
-from .envutil import *
+from .envutil import find_executable, find_file_env, find_files_env
 from PyJobTransformsCore import trfconsts, trfenv, fileutil
-from PyJobTransformsCore.trferr import *
-from PyJobTransformsCore import AtlasErrorCodes
+from PyJobTransformsCore.trferr import TransformValidationError, TransformThreadError, TransformThreadTimeout, JobOptionsNotFoundError, FileError
 from PyJobTransformsCore.TransformLogger import TransformLogger
 from PyJobTransformsCore.VTimer import vTimer
-from PyUtils import AthFile, RootUtils
+from PyUtils import RootUtils
 
 try:
     import PyDumper.SgDumpLib as sdl
@@ -37,7 +35,7 @@ TRF_SETTING = { 'testrun' : False, 'validationTimeout' : 600, 'validationRetry'
 
 LFN_VER_DICT = {}
 
-_PFNPat = re.compile( '^(?P<url>\S*?)(?P<lfn>[A-Za-z0-9\.\-\_]+?)(?P<ver>\.\d+)?$' )
+_PFNPat = re.compile( r'^(?P<url>\S*?)(?P<lfn>[A-Za-z0-9\.\-\_]+?)(?P<ver>\.\d+)?$' )
 
 _defaultSignalHandlerDict = {}
 
@@ -151,7 +149,7 @@ def getAncestry():
 #         so signaling left to right is correct 
 def listChildren(psTree = None, parent = os.getpid()):
     '''Take a psTree dictionary and list all children'''
-    if psTree == None:
+    if psTree is None:
         psTree = getAncestry()
     
     children = []
@@ -183,7 +181,6 @@ def infanticide(childPIDs, sleepTime = 3):
 
 ## @brief Decorator to dump a stack trace when hit by SIGUSR
 def sigUsrStackTrace(func):
-    import os
     import signal
     import traceback
     
@@ -241,7 +238,7 @@ def timelimited_exec1( tl_func, tl_timeout = TRF_SETTING[ 'TRFTimeout' ], tl_ret
             myChildren = listChildren()
             infanticide(myChildren)
             p.poll()
-            if p.returncode == None:
+            if p.returncode is None:
                 # Error - set some fallback value for rc
                 rc = -signal.SIGALRM
             else:
@@ -368,7 +365,7 @@ def getGUIDfromPFC(filename):
     if p.returncode != 0:
         print ("GUID retrieval failed: %s" % stderr)
         return (1, None)
-    if guid == None:
+    if guid is None:
         print ('Did not find GUID in catalog %s (usually harmless)' % catalog)
         return (0, None)
     print ("GUID retrieval: %s (%s) found in %s" % ( guid, filename, catalog ))
@@ -401,13 +398,13 @@ def StringToList(cmd):
     else:
         try:
             valList=cmd.split(',,')
-        except:
+        except Exception:
             raise ValueError("StringToList cannot interpret '%s' as a list."%str(cmd))
     return valList
 
 def ntup_entries(fname, tree_names):
     """Count events in ROOT-based files."""
-    if TRF_SETTING[ 'testrun' ] and ( VALIDATION_DICT[ 'ALL' ] == False or VALIDATION_DICT[ 'testCountEvents' ] == False ):
+    if TRF_SETTING[ 'testrun' ] and ( VALIDATION_DICT[ 'ALL' ] is False or VALIDATION_DICT[ 'testCountEvents' ] is False ):
         print ('Test run in progress. Event count (ROOT-based) disabled.')
         return None
     #work with string or list of strings
@@ -494,7 +491,7 @@ def strip_prefix( aString, aPrefix ):
 
 def remove_filename_extension( aString ):
     """Remove everything from <aString> starting from the last . (dot) after
-    the last path separator (/ or \) if any. If <aString> does not have a dot
+    the last path separator ('/' or '\') if any. If <aString> does not have a dot
     or if it ends with a path separator, then nothing is removed."""
     slash = aString.rfind(os.sep)
     dot = aString.rfind(os.extsep,slash+1)
@@ -737,7 +734,7 @@ def get_files( listOfFiles, fromWhere='data', doCopy='ifNotLocal', errorIfNotFou
             # Check existence of targetFile (side effect of an exception when running os.path.samefile).
             try:
                 isSameFile = os.path.samefile( srcFile, targetFile )
-            except OSError as x: # good. targetFile does not exist.
+            except OSError: # good. targetFile does not exist.
 #                print ("%s does not exist. %s" % ( targetFile, x ))
                 if os.path.islink( targetFile ): # broken symlink
                     try:
@@ -767,7 +764,7 @@ def get_files( listOfFiles, fromWhere='data', doCopy='ifNotLocal', errorIfNotFou
             try:
                 print ("**Attempting to remove %s" % targetFile)
                 os.remove( targetFile ) # remove files and symlinks
-            except: # dst file is a directory
+            except Exception: # dst file is a directory
                 for _root, _dirs, _files in os.walk( targetFile , topdown = False ):
                     for name in _files:
                         os.remove( os.path.join( _root, name ) )
@@ -916,10 +913,10 @@ def expandParallelVectorNotation( valIn ):
         return [ valIn ]
     if valIn.count( '[' ) != valIn.count( ']' ):
         raise Exception( 'Mismatched brackets.')
-    pieces = re.findall( '\[[\S]+\]', valIn ) # get the bracket sections
+    pieces = re.findall( r'\[[\S]+\]', valIn ) # get the bracket sections
     if not pieces:
         return [ valIn ]
-    if False in [ not re.findall('\[|\]', p[ 1:-1 ] ) for p in pieces ]:
+    if False in [ not re.findall( r'\[|\]', p[ 1:-1 ] ) for p in pieces ]:
         raise Exception( 'Nested brackets detected.' )
     ppieces = [ [ i.strip() for i in p[ 1:-1 ].split( ',' ) ] for p in pieces ]
     for i in map( None, *ppieces ):
@@ -1036,7 +1033,7 @@ def getCachedFileInfo( filename, infoKey ):
                 return resultList
             try:
                 return resultList[0]
-            except:
+            except Exception:
                 pass
     print (stdout)
     return None
@@ -1056,13 +1053,13 @@ def corruptionTestBS( filename, file_type,logger):
     while p.poll() is None:
       line = p.stdout.readline()
       if line:
-        logger.info("AtlListBSEvents Report: %s" % line.strip())
+        logger.info("AtlListBSEvents Report: %s", line.strip())
     rc = p.returncode
     if rc == 0:
       return rc
     #AltListBSEvents.exe failed, fall back to PyDumper
     else:
-      logger.info("AtlListBSEvents failed to validate %s, Using the (slower) PyDumper method " %filename)
+      logger.info("AtlListBSEvents failed to validate %s, Using the (slower) PyDumper method ", filename)
       cmdSnippet = os.linesep.join( [
           "from sys import exit",
           "import os",
@@ -1216,7 +1213,7 @@ class BSFile( FileType ):
         except Exception as e:
             print ("Event count failed for %s: %s" % ( arg, e ))
             return None
-        if TRF_SETTING[ 'testrun' ] and ( VALIDATION_DICT[ 'ALL' ] == False or VALIDATION_DICT[ 'testCountEvents' ] == False ):
+        if TRF_SETTING[ 'testrun' ] and ( VALIDATION_DICT[ 'ALL' ] is False or VALIDATION_DICT[ 'testCountEvents' ] is False ):
             logger.info( 'Test run in progress. Event count (AthFile-based) disabled.' )
             return None
         resultList = getCachedFileInfo( fileList, 'nentries' )
@@ -1240,7 +1237,7 @@ class BSFile( FileType ):
         except Exception as e:
             print ("Could not validate file associated with %s: %s" % ( arg, e ))
             return
-        if VALIDATION_DICT[ 'ALL' ] == False:
+        if VALIDATION_DICT[ 'ALL' ] is False:
             logger.info( "Skipping all validation routines." )
             return
         # Defined default validation values
@@ -1258,28 +1255,28 @@ class BSFile( FileType ):
             if vDict[ 'testIfExists' ]:
                 raise TransformValidationError( fName, 'failed validation. File not created. Argument %s' % argName, 'TRF_OUTFILE_NOTFOUND' )
             else:
-                logger.info( "Ignoring missing %s." % fName )
+                logger.info( "Ignoring missing %s.", fName )
                 return
         if fileutil.getsize( fName ) == 0:
             if vDict[ 'testIfEmpty' ]:
                 raise TransformValidationError( fName, 'failed validation. Empty file. Argument %s' % argName, 'TRF_OUTFILE_EMPTY' )
             else:
-                logger.info( "Ignoring empty %s." % fName )
+                logger.info( "Ignoring empty %s.", fName )
                 return
         # Check if sdl can cope with the file type
         if self.validationType() == 'any':
             vDict[ 'testIfCorrupt' ] = False
         if vDict[ 'testIfCorrupt' ] and sdl is not None:
-            logger.info( "Checking %s for corruption." % fName )
+            logger.info( "Checking %s for corruption.", fName )
             vTimer.start( '%s validation' % argName )
             sc = corruptionTestBS( fName, self.validationType(),logger )
             vTimer.stop( '%s validation' % argName )
             if sc < 0:
-                logger.warning( "Execution of corruption test failed [%s]." % sc )
+                logger.warning( "Execution of corruption test failed [%s].", sc )
             elif sc > 0:
                 raise TransformValidationError( fName, 'failed validation [%s]. File corrupt. Argument %s' % ( sc, argName ) )
         if vDict[ 'testCountEvents' ]:
-            logger.info( "Attempting to validate %s using event count routine." % fName )
+            logger.info( "Attempting to validate %s using event count routine.", fName )
             vTimer.start( '%s validation' % argName )
             eCount = arg.eventCount()
             vTimer.stop( '%s validation' % argName )
@@ -1288,15 +1285,15 @@ class BSFile( FileType ):
                   if not vDict[ 'continueOnZeroEventCount' ]:  
                     raise TransformValidationError( fName, 'failed validation. File contains no events. Argument %s' % argName, 'TRF_OUTFILE_TOOFEW' )
                   else:
-                    logger.info(" WARNING - 0 events in %s, proceeding with empty file. " % fName)
+                    logger.info(" WARNING - 0 events in %s, proceeding with empty file. ", fName)
                 else:
-                    logger.info( "Ignoring 0 events in %s." % fName )
+                    logger.info( "Ignoring 0 events in %s.", fName )
                     return
-            elif eCount == None:
+            elif eCount is None:
                 if vDict[ 'stopOnEventCountNone' ]:
                   raise TransformValidationError( fName, 'failed validation. Events could not be counted Argument %s' % argName, 'TRF_OUTFILE_NEVENTFAIL' )
                 else:
-                  logger.info( "No event count for file %s (corrupt or unreachable). Proceeding anyways." % fName )
+                  logger.info( "No event count for file %s (corrupt or unreachable). Proceeding anyways.", fName )
         if callable( vDict[ 'extraValidation' ] ):
             vTimer.start()
             extraValidationResult = None
@@ -1305,9 +1302,9 @@ class BSFile( FileType ):
             except TransformThreadTimeout:
                 logger.warning( 'Extra validation routine timed out.' )
             except TransformThreadError as e:
-                logger.warning( 'Thread running extra validation routine failed to stop.\n%s' % e )
+                logger.warning( 'Thread running extra validation routine failed to stop.\n%s', e )
             except Exception as e:
-                logger.warning( 'Extra validation routine error.\n%s' % e )
+                logger.warning( 'Extra validation routine error.\n%s', e )
             vTimer.stop()
             if not extraValidationResult:
                 raise TransformValidationError( fName, 'failed additional validation. Argument %s' % argName, 'TRF_OUTFILE' )
@@ -1322,7 +1319,7 @@ class BSFile( FileType ):
 #            sc, out = sdl.run_sg_dump( files = [ fName ], output = os.devnull, pyalg_cls = 'PyDumper.PyComps:DataProxyLoader', use_recex_links = False, file_type = self.validationType(), msg = logger )
 #            if sc != 0:
 #                raise TransformValidationError( fName, 'failed validation [%s]. File corrupt. Argument %s' % ( sc, argName ) )
-        logger.info( "%s successfully validated." % fName )
+        logger.info( "%s successfully validated.", fName )
         return
 
     def getGUID(self,filename):
@@ -1330,7 +1327,7 @@ class BSFile( FileType ):
             return None
         guid = getCachedFileInfo( filename, 'file_guid' )
         if guid is None:
-            raise FileError( filename, "File %s GUID not present in BS file." % filename )
+            raise FileError( filename, "File %s GUID not present in BS file.", filename )
         return guid
 
     def getMetaData(self,filename):
@@ -1361,7 +1358,7 @@ class RootTTreeFile( FileType ):
             return None
         # Use FClistGUID
         rc, guid = getGUIDfromPFC(filename)
-        if guid != None:
+        if guid is not None:
             return guid
         if rc != 0:
             print ('Warning: Problem with PFC')
@@ -1391,7 +1388,7 @@ class PoolDataFile( RootTTreeFile ):
     def getGUID(self, filename):
         # Use FClistGUID
         rc, guid = getGUIDfromPFC(filename)
-        if guid != None:
+        if guid is not None:
             return guid
         if rc != 0:
             print ('Warning: Problem with PFC')
@@ -1409,7 +1406,7 @@ class PoolDataFile( RootTTreeFile ):
                 if filename in words[1]:
                     guid = words[0]
                     break
-            except:
+            except Exception:
                 continue
         if p.returncode != 0:
             print ("GUID retrieval failed: %s" % stderr)
@@ -1430,7 +1427,7 @@ class PoolDataFile( RootTTreeFile ):
         except Exception as e:
             print ("Could not validate file associated with %s: %s" % ( arg, e ))
             return
-        if VALIDATION_DICT[ 'ALL' ] == False:
+        if VALIDATION_DICT[ 'ALL' ] is False:
             logger.info( "Skipping all validation routines." )
             return
         # Defined default validation values
@@ -1445,26 +1442,26 @@ class PoolDataFile( RootTTreeFile ):
             if vDict[ 'testIfExists' ]:
                 raise TransformValidationError( fName, 'failed validation. File not created. Argument %s' % argName, 'TRF_OUTFILE_NOTFOUND' )
             else:
-                logger.info( "Ignoring missing %s." % fName )
+                logger.info( "Ignoring missing %s.", fName )
                 return
         if fileutil.getsize( fName ) == 0:
             if vDict[ 'testIfEmpty' ]:
                 raise TransformValidationError( fName, 'failed validation. Empty file. Argument %s' % argName, 'TRF_OUTFILE_EMPTY' )
             else:
-                logger.info( "Ignoring empty %s." % fName )
+                logger.info( "Ignoring empty %s.", fName )
                 return
         # Check if sdl can cope with the file type
         if self.validationType() == 'any':
             vDict[ 'testIfCorrupt' ] = False
         if vDict[ 'testIfCorrupt' ]:
-            logger.info( "Checking %s for corruption." % fName )
+            logger.info( "Checking %s for corruption.", fName )
             vTimer.start( '%s validation' % argName )
             sc = corruptionTestROOT( fName, self.validationType() )
             vTimer.stop( '%s validation' % argName )
             if sc<0:
                 raise TransformValidationError( fName, 'failed validation [%s]. File corrupt. Argument %s' % ( sc, argName ) )
         if vDict[ 'testCountEvents' ]:
-            logger.info( "Attempting to validate %s using event count routine." % fName )
+            logger.info( "Attempting to validate %s using event count routine.", fName )
             vTimer.start( '%s validation' % argName )
             eCount = arg.eventCount()
             vTimer.stop( '%s validation' % argName )
@@ -1473,15 +1470,15 @@ class PoolDataFile( RootTTreeFile ):
                   if not vDict[ 'continueOnZeroEventCount' ]:  
                     raise TransformValidationError( fName, 'failed validation. File contains no events. Argument %s' % argName, 'TRF_OUTFILE_TOOFEW' )
                   else:
-                    logger.info(" WARNING - 0 events in %s, proceeding with empty file. " % fName)
+                    logger.info(" WARNING - 0 events in %s, proceeding with empty file. ", fName)
                 else:
-                    logger.info( "Ignoring 0 events in %s." % fName )
+                    logger.info( "Ignoring 0 events in %s.", fName )
                     return
-            elif eCount == None:
+            elif eCount is None:
                 if vDict[ 'stopOnEventCountNone' ]:
                   raise TransformValidationError( fName, 'failed validation. Events could not be counted Argument %s' % argName, 'TRF_OUTFILE_NEVENTFAIL' )
                 else:
-                  logger.info( "No event count for file %s (corrupt or unreachable). Proceeding anyways." % fName )
+                  logger.info( "No event count for file %s (corrupt or unreachable). Proceeding anyways.", fName )
         if callable( vDict[ 'extraValidation' ] ):
             vTimer.start()
             extraValidationResult = None
@@ -1490,9 +1487,9 @@ class PoolDataFile( RootTTreeFile ):
             except TransformThreadTimeout:
                 logger.warning( 'Extra validation routine timed out.' )
             except TransformThreadError as e:
-                logger.warning( 'Thread running extra validation routine failed to stop.\n%s' % e )
+                logger.warning( 'Thread running extra validation routine failed to stop.\n%s', e )
             except Exception as e:
-                logger.warning( 'Extra validation routine error.\n%s' % e )
+                logger.warning( 'Extra validation routine error.\n%s', e )
             vTimer.stop()
             if not extraValidationResult:
                 raise TransformValidationError( fName, 'failed additional validation. Argument %s' % argName, 'TRF_OUTFILE' )
@@ -1508,7 +1505,7 @@ class PoolDataFile( RootTTreeFile ):
 #            if sc != 0:
 #                raise TransformValidationError( fName, 'failed validation [%s]. File corrupt. Argument %s' % ( sc, argName ) )
 
-        logger.info( "%s successfully validated." % fName )
+        logger.info( "%s successfully validated.", fName )
         return
     
     def writeSize(self, arg):
@@ -1544,8 +1541,8 @@ class PoolDataFile( RootTTreeFile ):
             #     print (sys.exc_info()[0])
             #     print (sys.exc_info()[1])
             #     return
-			
-			#returns number_of_events and tuple of sizes
+
+            #returns number_of_events and tuple of sizes
             return [ne, collectionSize]	
         else:
             print ('not needed for file of this type')
@@ -1560,7 +1557,7 @@ class PoolDataFile( RootTTreeFile ):
         except Exception as e:
             print ("Event count failed for %s: %s" % ( arg, e ))
             return None
-        if TRF_SETTING[ 'testrun' ] and ( VALIDATION_DICT[ 'ALL' ] == False or VALIDATION_DICT[ 'testCountEvents' ] == False ):
+        if TRF_SETTING[ 'testrun' ] and ( VALIDATION_DICT[ 'ALL' ] is False or VALIDATION_DICT[ 'testCountEvents' ] is False ):
             logger.info( 'Test run in progress. Event count (AthFile-based) disabled.' )
             return None
         resultList = getCachedFileInfo( fileList, 'nentries' )
@@ -1581,7 +1578,7 @@ class PoolDataFile( RootTTreeFile ):
         if oldLevel != newLevel:
             os.environ['POOL_OUTMSG_LEVEL'] = newLevel
             if logger:
-                logger.info( "Setting POOL message level to %d." % level )
+                logger.info( "Setting POOL message level to %d.", level )
 
 
 class EvgenFile( PoolDataFile ):
@@ -1622,7 +1619,7 @@ class TAGFile( RootTTreeFile ):
     def getGUID(self, filename):
         # Use FClistGUID, then fallback to AthFile (N.B. tag files have funny names in the PFC!)
         rc, guid = getGUIDfromPFC("RootCollection||PFN:" + filename)
-        if guid != None:
+        if guid is not None:
             return guid
         if rc != 0:
             print ('Warning: Problem with PFC')
@@ -1638,7 +1635,6 @@ class TAGFile( RootTTreeFile ):
         """Return number of events in file of argument arg.
         Return None if event count is not applicable to file type."""
         try:
-            logger = arg.logger()
             fName = arg.value()
         except Exception as e:
             print ("Event count failed for %s: %s" % ( arg, e ))
@@ -1726,7 +1722,6 @@ class NtupleFile( RootTTreeFile ):
     
     def eventCount( self, arg ):
         try:
-            logger = arg.logger()
             fName = arg.value()
         except Exception as e:
             print ("Event count failed for %s: %s" % ( arg, e ))
@@ -1750,7 +1745,7 @@ class NtupleFile( RootTTreeFile ):
         except Exception as e:
             print ("Could not validate file associated with %s: %s" % ( arg, e ))
             return
-        if VALIDATION_DICT[ 'ALL' ] == False:
+        if VALIDATION_DICT[ 'ALL' ] is False:
             logger.info( "Skipping all validation routines." )
             return
         # Defined default validation values
@@ -1765,17 +1760,17 @@ class NtupleFile( RootTTreeFile ):
             if vDict[ 'testIfExists' ]:
                 raise TransformValidationError( fName, 'failed validation. File not created. Argument %s' % argName, 'TRF_OUTFILE_NOTFOUND' )
             else:
-                logger.info( "Ignoring missing %s." % fName )
+                logger.info( "Ignoring missing %s.", fName )
                 return
         if fileutil.getsize( fName ) == 0:
             if vDict[ 'testIfEmpty' ]:
                 raise TransformValidationError( fName, 'failed validation. Empty file. Argument %s' % argName, 'TRF_OUTFILE_EMPTY' )
             else:
-                logger.info( "Ignoring empty %s." % fName )
+                logger.info( "Ignoring empty %s.", fName )
                 return
 
         if vDict[ 'testIfCorrupt' ]:
-            logger.info( "Checking %s for corruption." % fName )
+            logger.info( "Checking %s for corruption.", fName )
             vTimer.start( '%s validation' % argName )
             from PyJobTransformsCore.trfValidateRootFile import checkFile as checkNTUPFile
             sc = checkNTUPFile(fileName=fName, type='basketWise', requireTree=False, msg=logger)
@@ -1785,7 +1780,7 @@ class NtupleFile( RootTTreeFile ):
     
             
         if vDict[ 'testCountEvents' ] and self.tree_names:
-            logger.info( "Attempting to validate %s using event count routine." % fName )
+            logger.info( "Attempting to validate %s using event count routine.", fName )
             vTimer.start( '%s validation' % argName )
             eCount = arg.eventCount()
             vTimer.stop( '%s validation' % argName )
@@ -1794,18 +1789,18 @@ class NtupleFile( RootTTreeFile ):
                   if not vDict[ 'continueOnZeroEventCount' ]:  
                     raise TransformValidationError( fName, 'failed validation. File contains no events. Argument %s' % argName, 'TRF_OUTFILE_TOOFEW' )
                   else:
-                    logger.info(" WARNING - 0 events in %s, proceeding with empty file. " % fName)
+                    logger.info(" WARNING - 0 events in %s, proceeding with empty file. ", fName)
                 else:
-                    logger.info( "Ignoring 0 events in %s." % fName )
+                    logger.info( "Ignoring 0 events in %s.", fName )
                     return
-            elif eCount == None:
+            elif eCount is None:
                 if vDict[ 'stopOnEventCountNone' ]:
                   raise TransformValidationError( fName, 'failed validation. Events could not be counted Argument %s' % argName, 'TRF_OUTFILE_NEVENTFAIL' )
                 else:
-                  logger.info( "No event count for file %s (corrupt or unreachable). Proceeding anyways." % fName )
+                  logger.info( "No event count for file %s (corrupt or unreachable). Proceeding anyways.", fName )
         else:
-            logger.info( "Event counting not tested for %s." % fName )
-        logger.info( "%s successfully validated." % fName )
+            logger.info( "Event counting not tested for %s.", fName )
+        logger.info( "%s successfully validated.", fName )
         return
 
 
@@ -1823,7 +1818,7 @@ class MonitorHistFile( RootTTreeFile ):
         except Exception as e:
             print ("Event count failed for %s: %s" % ( arg, e ))
             return None
-        if TRF_SETTING[ 'testrun' ] and ( VALIDATION_DICT[ 'ALL' ] == False or VALIDATION_DICT[ 'testCountEvents' ] == False ):
+        if TRF_SETTING[ 'testrun' ] and ( VALIDATION_DICT[ 'ALL' ] is False or VALIDATION_DICT[ 'testCountEvents' ] is False ):
             logger.info( 'Test run in progress. Event count (ROOT-based) disabled.' )
             return None
         ROOT = RootUtils.import_root(batch=True)
@@ -1833,9 +1828,9 @@ class MonitorHistFile( RootTTreeFile ):
         except TransformThreadTimeout:
             logger.warning( 'ROOT file opening timed out.' )
         except TransformThreadError as e:
-            logger.warning( 'Thread for ROOT file opening failed to stop.\n%s' % e )
+            logger.warning( 'Thread for ROOT file opening failed to stop.\n%s', e )
         except Exception as e:
-            logger.warning( 'ROOT file open error.\n%s' % e )
+            logger.warning( 'ROOT file open error.\n%s', e )
         if not f:
             logger.warning("Could not open file [%s].", fName)
             return None
@@ -1858,12 +1853,12 @@ class MonitorHistFile( RootTTreeFile ):
             return None
         try:
             nBinsX = h.GetNbinsX()
-        except:
+        except Exception:
             f.Close()
             logger.warning( 'Unable to retrieve number of events.' )
             return None            
         nev = 0
-        for i in xrange(1, nBinsX):
+        for i in range(1, nBinsX):
             if h[i] < 0:
                 # should not happen
                 logger.warning( 'Negative number of events for step %s.', h.GetXaxis().GetBinLabel(i) )
@@ -1892,7 +1887,7 @@ class MonitorHistFile( RootTTreeFile ):
         except Exception as e:
             print ("Could not validate file associated with %s: %s" % ( arg, e ))
             return
-        if VALIDATION_DICT[ 'ALL' ] == False:
+        if VALIDATION_DICT[ 'ALL' ] is False:
             logger.info( "Skipping all validation routines." )
             return
         # Defined default validation values
@@ -1907,23 +1902,23 @@ class MonitorHistFile( RootTTreeFile ):
             if vDict[ 'testIfExists' ]:
                 raise TransformValidationError( fName, 'failed validation. File not created. Argument %s' % argName, 'TRF_OUTFILE_NOTFOUND' )
             else:
-                logger.info( "Ignoring missing %s." % fName )
+                logger.info( "Ignoring missing %s.", fName )
                 return
         if fileutil.getsize( fName ) == 0:
             if vDict[ 'testIfEmpty' ]:
                 raise TransformValidationError( fName, 'failed validation. Empty file. Argument %s' % argName, 'TRF_OUTFILE_EMPTY' )
             else:
-                logger.info( "Ignoring empty %s." % fName )
+                logger.info( "Ignoring empty %s.", fName )
                 return
 #         if vDict[ 'testIfCorrupt' ]:
-#             logger.info( "Checking %s for corruption." % fName )
+#             logger.info( "Checking %s for corruption.", fName )
 #             vTimer.start( '%s validation' % argName )
 #             sc = corruptionTestROOT( fName, self.validationType() )
 #             vTimer.stop( '%s validation' % argName )
 #             if sc<0:
 #                 raise TransformValidationError( fName, 'failed validation [%s]. File corrupt. Argument %s' % ( sc, argName ) )
         if vDict[ 'testCountEvents' ] and 'HIST_' not in fName:
-            logger.info( "Attempting to validate %s using event count routine." % fName )
+            logger.info( "Attempting to validate %s using event count routine.", fName )
             vTimer.start( '%s validation' % argName )
             eCount = arg.eventCount()
             vTimer.stop( '%s validation' % argName )
@@ -1932,17 +1927,17 @@ class MonitorHistFile( RootTTreeFile ):
                   if not vDict[ 'continueOnZeroEventCount' ]:  
                     raise TransformValidationError( fName, 'failed validation. File contains no events. Argument %s' % argName, 'TRF_OUTFILE_TOOFEW' )
                   else:
-                    logger.info(" WARNING - 0 events in %s, proceeding with empty file. " % fName)
+                    logger.info(" WARNING - 0 events in %s, proceeding with empty file. ", fName)
                 else:
-                    logger.info( "Ignoring 0 events in %s." % fName )
+                    logger.info( "Ignoring 0 events in %s.", fName )
                     return
-            elif eCount == None:
+            elif eCount is None:
                 if vDict[ 'stopOnEventCountNone' ]:
                   raise TransformValidationError( fName, 'failed validation. Events could not be counted Argument %s' % argName, 'TRF_OUTFILE_NEVENTFAIL' )
                 else:
-                  logger.info( "No event count for file %s (corrupt or unreachable). Proceeding anyways." % fName )
+                  logger.info( "No event count for file %s (corrupt or unreachable). Proceeding anyways.", fName )
         elif 'HIST_' in fName:
-            logger.info('No event counting validation performed because file %s is of HIST_ subtype' % fName)
+            logger.info('No event counting validation performed because file %s is of HIST_ subtype', fName)
             
         if callable( vDict[ 'extraValidation' ] ):
             vTimer.start()
@@ -1952,13 +1947,13 @@ class MonitorHistFile( RootTTreeFile ):
             except TransformThreadTimeout:
                 logger.warning( 'Extra validation routine timed out.' )
             except TransformThreadError as e:
-                logger.warning( 'Thread running extra validation routine failed to stop.\n%s' % e )
+                logger.warning( 'Thread running extra validation routine failed to stop.\n%s', e )
             except Exception as e:
-                logger.warning( 'Extra validation routine error.\n%s' % e )
+                logger.warning( 'Extra validation routine error.\n%s', e )
             vTimer.stop()
             if not extraValidationResult:
                 raise TransformValidationError( fName, 'failed additional validation. Argument %s' % argName, 'TRF_OUTFILE' )
-        logger.info( "%s successfully validated." % fName )
+        logger.info( "%s successfully validated.", fName )
         return
 
 
@@ -1999,8 +1994,8 @@ class CommentLine:
     def bigComment(self,char='-',width=80):
         line = CommentLine.getLine(char,width)
         return line + os.linesep + \
-                self.smallComment() + os.linesep + \
-                line
+            self.smallComment() + os.linesep + \
+            line
 
 
 #
@@ -2120,7 +2115,7 @@ class StringNumberList:
         if self.__numberList is not None: return (self.__numberList,self.__digits)
         nums = self.getNumbers(openBracket,closeBracket)
         if nums is None: return (None,None)
-        if nums is "": return (list(),0)
+        if nums=="": return (list(),0)
         numList = [ ]
         bclose = len(nums)
         posB = 1
@@ -2293,7 +2288,7 @@ class ServiceOverride(PostJobOptionsFile,TransformLogger):
             val = members[mem]
             jo.append( "%s.%s = %r" % (self.__service, mem, val) )
             filename += '_%s_%s' % (mem,val)
-        self.logger().info('Creating jobOptions file %s' % filename)
+        self.logger().info('Creating jobOptions file %s', filename)
         joFile = open(filename,'w')
         joFile.write( os.linesep.join(jo) + os.linesep )
         joFile.close()
diff --git a/Tools/PyJobTransformsCore/python/xmlutil.py b/Tools/PyJobTransformsCore/python/xmlutil.py
index e90dc947d099d6e92ed775e8b1d7922fa1186140..a20761dabb37c877aca1ef0ecc67541682c7801c 100755
--- a/Tools/PyJobTransformsCore/python/xmlutil.py
+++ b/Tools/PyJobTransformsCore/python/xmlutil.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from __future__ import print_function
 
@@ -48,7 +48,7 @@ class XMLNode:
     def __init__(self,name,contents=None):
         self.__name = name
         self.__contents = None
-        if contents != None: self.setContents(contents)
+        if contents is not None: self.setContents(contents)
         self.__attributes = {}
 
 
diff --git a/Tools/PyJobTransformsCore/share/checklog.py b/Tools/PyJobTransformsCore/share/checklog.py
index 18243ace002f042752323c43bc534c48b1d57711..5719aaa9c8d99235ae2e88c934cab7b7213f7802 100755
--- a/Tools/PyJobTransformsCore/share/checklog.py
+++ b/Tools/PyJobTransformsCore/share/checklog.py
@@ -1,20 +1,23 @@
 #!/usr/bin/env python
-import os,sys,re
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+import os
+import sys
 from getopt import getopt
 from AthenaCommon.Logging import logging
 from AthenaCommon import ExitCodes
-from PyJobTransformsCore.trferr import *
-from PyJobTransformsCore.JobReport import *
-from PyJobTransformsCore.trfutil import *
+from PyJobTransformsCore.trferr import TransformErrorDiagnoser, AthenaLogChecker
+from PyJobTransformsCore.JobReport import JobReport, JobInfo
+from PyJobTransformsCore.trfutil import get_atlas_release
 
 def usage():
-    print "Parse an athena logfile for errors."
-    print "Usage: %s [options] <logfilename>" % os.path.basename(sys.argv[0])
-    print "Options:"
-    print "  -h : print short help"
-    print "  -d : print details on the error matching"
-    print "  -x : write jobInfo.xml file"
-    print "  -r <release> : assume atlas release <release>"
+    print("Parse an athena logfile for errors.")
+    print("Usage: %s [options] <logfilename>" % os.path.basename(sys.argv[0]))
+    print("Options:")
+    print("  -h : print short help")
+    print("  -d : print details on the error matching")
+    print("  -x : write jobInfo.xml file")
+    print("  -r <release> : assume atlas release <release>")
 
 if len(sys.argv) <= 1:
     usage()
@@ -75,7 +78,7 @@ errorDocter = TransformErrorDiagnoser()
 for error in report.errors():
     errorDocter.diagnoseError(error)
 
-print report
+print(report)
 if writeXML: report.writeJobInfoXML()
 
 # exit with appropriate code
diff --git a/Tools/PyJobTransformsCore/share/find_data.py b/Tools/PyJobTransformsCore/share/find_data.py
index fb8e106b7d89eec6fe7372d5b4d7b567238977b6..cb3a2f3ee60d9aaddcc599c6a75c7f2aad1d9f5a 100755
--- a/Tools/PyJobTransformsCore/share/find_data.py
+++ b/Tools/PyJobTransformsCore/share/find_data.py
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 from __future__ import print_function
 
 import sys,os
diff --git a/Tools/PyJobTransformsCore/share/find_library.py b/Tools/PyJobTransformsCore/share/find_library.py
index 383dda295e0945d2c7e285d9bb54c1bc029556c7..db739019eeaf9ee3ff6ce6a2c02af4e99696675f 100755
--- a/Tools/PyJobTransformsCore/share/find_library.py
+++ b/Tools/PyJobTransformsCore/share/find_library.py
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 import sys,os
 
 __doc__ = """Print the full path of the requested shared library, as found in LD_LIBRARY_PATH.
@@ -7,7 +8,7 @@ The 'lib' prefix and 'so' suffix can be omitted. If no match if found, nothing i
 
 def usage():
     use = "usage: %s <library> [library]" % os.path.basename(sys.argv[0])
-    print use + os.linesep*2 + __doc__
+    print(use + os.linesep*2 + __doc__)
 
 if len(sys.argv) <= 1:
     usage()
@@ -20,8 +21,4 @@ except ImportError:
 
 for lib in sys.argv[1:]:
     full = find_libraries(lib)
-    for f in full: print f
-
-
-
-
+    for f in full: print(f)
diff --git a/Tools/PyJobTransformsCore/share/find_python_module.py b/Tools/PyJobTransformsCore/share/find_python_module.py
index aa0ade202eca95a3211d47a2254a139236d6de41..a169e5bd5963da1449366530573cffc36089270b 100755
--- a/Tools/PyJobTransformsCore/share/find_python_module.py
+++ b/Tools/PyJobTransformsCore/share/find_python_module.py
@@ -1,14 +1,15 @@
 #!/usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 import sys,os
 
 def usage():
     use = "usage: %s <module> [module]" % os.path.basename(sys.argv[0])
-    print use + """
+    print(use + """
     
 Print the full path of the requested python module(s), as found in sys.path (PYTHONPATH + system paths)
 Wildcards are accepted, in which case all (first) matches are printed, one per line.
 The '.py' suffix can be omitted, in which case both .py and .pyc extensions are tried.
-If no match if found, nothing is printed."""
+If no match if found, nothing is printed.""")
 
 
 if len(sys.argv) <= 1:
@@ -22,4 +23,4 @@ except ImportError:
     
 for mod in sys.argv[1:]:
     full = find_python_modules(mod)
-    for f in full: print f
+    for f in full: print(f)
diff --git a/Tools/PyJobTransformsCore/share/trf_ls b/Tools/PyJobTransformsCore/share/trf_ls
index 463529e9c8045a124ec256f5c6aad9ae14ba9e4e..068bb9959c6d96b4d000c0f9c20466c9d9c4f9e5 100755
--- a/Tools/PyJobTransformsCore/share/trf_ls
+++ b/Tools/PyJobTransformsCore/share/trf_ls
@@ -1,8 +1,9 @@
 #!/usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 import sys,os,getopt
 def usage():
     use = "usage: %s [-h] [-p] [-f] [[trf_name] [trf_name]]" % os.path.basename(sys.argv[0])
-    print use + """
+    print(use + """
     
 Print a list of available jobtransforms, or find a specific one. Wildcards allowed.
 If <trf_name> does not end with _trf.py, this will be added before searching.
@@ -12,7 +13,7 @@ Options:
  -h : Print this help message
  -f : Print full path name.
  -p : Look in PYTHONPATH and include package name in front of trf name (for import in python)
-      If combined with option -f, print full path of python module."""
+      If combined with option -f, print full path of python module.""")
 
 
 showPython = False
@@ -61,11 +62,10 @@ for f in filelist:
     for full in found:
         trf = os.path.basename(full)
         if showPath:
-            print full
+            print(full)
         elif showPython:
             dir = os.path.dirname(full)
             package = os.path.basename(dir)
-            print '%s ' % os.path.join(package,trf)
+            print('%s ' % os.path.join(package,trf))
         else:
-            print trf
-            
+            print(trf)
diff --git a/Tools/PyJobTransformsCore/test/CastorPreStager_test.py b/Tools/PyJobTransformsCore/test/CastorPreStager_test.py
deleted file mode 100755
index 88d78a2b0b51a370c73136cb2566f50ba75e39ce..0000000000000000000000000000000000000000
--- a/Tools/PyJobTransformsCore/test/CastorPreStager_test.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
-from PyJobTransformsCore.FilePreStager import theFileStagerRobot
-theFileStagerRobot.setLoggerLevel(0) # all
-
-from PyJobTransformsCore import CastorPreStager
-from PyJobTransformsCore.trfutil import FileList
-
-# use FileArg for expansion of coded filelist
-fileList = FileList.expandStringToList( "rfio:/castor/cern.ch/atlas/csc/valiprod/sampleA/mc12/005001.pythia_minbias/simul/v12000003/mc12.005001.pythia_minbias.simul.HITS.v12000003._[00001-4].pool.root" )
-fileList += [ "/castor/cern.ch/atlas/csc/valiprod/sampleA/mc12/005001.pythia_minbias/simul/v12000003/mc12.005001.pythia_minbias.simul.HITS.v12000003._00006.pool.root",
-              "castor:/castor/cern.ch/atlas/csc/valiprod/sampleA/mc12/005001.pythia_minbias/simul/v12000003/mc12.005001.pythia_minbias.simul.HITS.v12000003._00007.pool.root" ]
-
-fileList += [ "any_file_not_in_castor" ]
-
-filesToStage = theFileStagerRobot.addFilesToStagerIfNeeded( fileList )
-print "Added %s files for pre-staging" % len(filesToStage)
-for f in filesToStage: print f
-theFileStagerRobot.waitUntilAllFilesStaged()
diff --git a/Tools/PyUtils/CMakeLists.txt b/Tools/PyUtils/CMakeLists.txt
index c5dfb66028520778b86a1abb22a2d73a66ddfa28..d2e741fce05e34c9fd67f706bf2e185b74287666 100644
--- a/Tools/PyUtils/CMakeLists.txt
+++ b/Tools/PyUtils/CMakeLists.txt
@@ -5,6 +5,7 @@ atlas_subdir( PyUtils )
 
 # External dependencies:
 find_package( decorator )
+find_package( graphviz )
 find_package( requests )
 find_package( six )
 find_package( ROOT COMPONENTS Core PyROOT Tree MathCore Hist RIO pthread )
diff --git a/Tracking/TrkConditions/TrackingGeometryCondAlg/src/TrackingGeometryCondAlg.cxx b/Tracking/TrkConditions/TrackingGeometryCondAlg/src/TrackingGeometryCondAlg.cxx
index 572bfdb7c6ba3eb6246cf18f6bf01a22fde4c285..1a2dad69db835621f76880f59a5dc47ee9484210 100644
--- a/Tracking/TrkConditions/TrackingGeometryCondAlg/src/TrackingGeometryCondAlg.cxx
+++ b/Tracking/TrkConditions/TrackingGeometryCondAlg/src/TrackingGeometryCondAlg.cxx
@@ -14,7 +14,6 @@ Trk::TrackingGeometryCondAlg::TrackingGeometryCondAlg(const std::string& name, I
   : AthReentrantAlgorithm(name, pSvcLocator),
     m_geometryProcessors(this) 
 {
-  declareProperty("GeometryBuilder", m_trackingGeometryBuilder);
   declareProperty("GeometryProcessors", m_geometryProcessors);
 }
 
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.h
index d5d7b6af3a4ef77f1c93407eea089fcc1667d644..7a1a97798f73311656b3058613ea7715bd1d099b 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.h
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.h
@@ -53,7 +53,11 @@ public:
   ConeSurface(Amg::Transform3D* htrans, double alpha, bool symmetric = false);
 
   /**Constructor form HepTransform, radius halfphi, and halflenght*/
-  ConeSurface(Amg::Transform3D* htrans, double alpha, double locZmin, double locZmax, double halfPhi = M_PI);
+  ConeSurface(Amg::Transform3D* htrans,
+              double alpha,
+              double locZmin,
+              double locZmax,
+              double halfPhi = M_PI);
 
   /**Constructor from HepTransform and CylinderBounds
     - ownership of the bounds is passed
@@ -82,75 +86,68 @@ public:
   /**Implicit Constructor*/
   virtual ConeSurface* clone() const override;
 
-  /** Use the Surface as a ParametersBase constructor, from local parameters - charged */
-  virtual ParametersT<5, Charged, ConeSurface>* createTrackParameters(double l1,
-                                                                      double l2,
-                                                                      double phi,
-                                                                      double theta,
-                                                                      double qop,
-                                                                      AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Charged, ConeSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - charged*/
-  virtual ParametersT<5, Charged, ConeSurface>* createTrackParameters(const Amg::Vector3D& position,
-                                                                      const Amg::Vector3D& momentum,
-                                                                      double charge,
-                                                                      AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Charged, ConeSurface>(position, momentum, charge, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from local parameters - neutral */
-  virtual  ParametersT<5, Neutral, ConeSurface>* createNeutralParameters(double l1,
-                                                                         double l2,
-                                                                         double phi,
-                                                                         double theta,
-                                                                         double qop,
-                                                                         AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Neutral, ConeSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - neutral */
-  virtual ParametersT<5, Neutral, ConeSurface>* createNeutralParameters(const Amg::Vector3D& position,
-                                                                        const Amg::Vector3D& momentum,
-                                                                        double charge,
-                                                                        AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Neutral, ConeSurface>(position, momentum, charge, *this, cov);
-  }
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * charged */
+  virtual ParametersT<5, Charged, ConeSurface>* createTrackParameters(
+    double l1,
+    double l2,
+    double phi,
+    double theta,
+    double qop,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters -
+   * charged*/
+  virtual ParametersT<5, Charged, ConeSurface>* createTrackParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * neutral */
+  virtual ParametersT<5, Neutral, ConeSurface>* createNeutralParameters(
+    double l1,
+    double l2,
+    double phi,
+    double theta,
+    double qop,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters -
+   * neutral */
+  virtual ParametersT<5, Neutral, ConeSurface>* createNeutralParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
 
   /** Use the Surface as a ParametersBase constructor, from local parameters */
   template<int DIM, class T>
-   ParametersT<DIM, T, ConeSurface>* createParameters(double l1,
-                                                      double l2,
-                                                      double phi,
-                                                      double theta,
-                                                      double qop,
-                                                      AmgSymMatrix(DIM) * cov = 0) const
-  {
-    return new ParametersT<DIM, T, ConeSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
+  ParametersT<DIM, T, ConeSurface>* createParameters(double l1,
+                                                     double l2,
+                                                     double phi,
+                                                     double theta,
+                                                     double qop,
+                                                     AmgSymMatrix(DIM) * cov = 0) const;
 
   /** Use the Surface as a ParametersBase constructor, from global parameters */
   template<int DIM, class T>
-  ParametersT<DIM, T, ConeSurface>* createParameters(const Amg::Vector3D& position,
-                                                     const Amg::Vector3D& momentum,
-                                                     double charge,
-                                                     AmgSymMatrix(DIM) * cov = 0) const
-  {
-    return new ParametersT<DIM, T, ConeSurface>(position, momentum, charge, *this, cov);
-  }
+  ParametersT<DIM, T, ConeSurface>* createParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(DIM) * cov = 0) const;
 
   /** Return the surface type */
-  virtual SurfaceType type() const override { return Surface::Cone; }
+  virtual SurfaceType type() const override final;
 
-  /** Return the measurement frame - this is needed for alignment, in particular for StraightLine and Perigee Surface
+  /** Return the measurement frame - this is needed for alignment, in particular
+    for StraightLine and Perigee Surface
     - the default implementation is the the RotationMatrix3D of the transform */
-  virtual Amg::RotationMatrix3D measurementFrame(const Amg::Vector3D& glopos,
-                                                       const Amg::Vector3D& glomom) const override;
+  virtual Amg::RotationMatrix3D measurementFrame(
+    const Amg::Vector3D& glopos,
+    const Amg::Vector3D& glomom) const override;
 
   /** Returns a global reference point:
      For the Cylinder this is @f$ (R*cos(\phi), R*sin(\phi),0)*transform() @f$
@@ -164,9 +161,11 @@ public:
 
   /**Return method for surface normal information
      at a given local point, overwrites the normal() from base class.*/
-  virtual const Amg::Vector3D* normal(const Amg::Vector2D& locpo) const override;
+  virtual const Amg::Vector3D* normal(
+    const Amg::Vector2D& locpo) const override;
 
-  /**Return method for the rotational symmetry axis - the z-Axis of the HepTransform */
+  /**Return method for the rotational symmetry axis - the z-Axis of the
+   * HepTransform */
   virtual const Amg::Vector3D& rotSymmetryAxis() const;
 
   /**This method returns the ConeBounds by reference
@@ -174,29 +173,39 @@ public:
   virtual const ConeBounds& bounds() const override;
 
   /**This method calls the inside method of ConeBounds*/
-  virtual bool insideBounds(const Amg::Vector2D& locpos, double tol1 = 0., double tol2 = 0.) const override;
-  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos, const BoundaryCheck& bchk) const override;
+  virtual bool insideBounds(const Amg::Vector2D& locpos,
+                            double tol1 = 0.,
+                            double tol2 = 0.) const override;
+  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos,
+                                 const BoundaryCheck& bchk) const override;
 
   /** Specialized for ConeSurface : LocalParameters to Vector2D */
-  virtual Amg::Vector2D localParametersToPosition(const LocalParameters& locpars) const override;
+  virtual Amg::Vector2D localParametersToPosition(
+    const LocalParameters& locpars) const override;
 
-  /** Specialized for ConeSurface : LocalToGlobal method without dynamic memory allocation */
-  virtual void localToGlobal(const Amg::Vector2D& locp, const Amg::Vector3D& mom, Amg::Vector3D& glob) const override;
+  /** Specialized for ConeSurface : LocalToGlobal method without dynamic memory
+   * allocation */
+  virtual void localToGlobal(const Amg::Vector2D& locp,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector3D& glob) const override;
 
-  /** Specialized for ConeSurface : GlobalToLocal method without dynamic memory allocation - boolean checks if on
-   * surface */
-  virtual bool globalToLocal(const Amg::Vector3D& glob, const Amg::Vector3D& mom, Amg::Vector2D& loc) const override;
+  /** Specialized for ConeSurface : GlobalToLocal method without dynamic memory
+   * allocation - boolean checks if on surface */
+  virtual bool globalToLocal(const Amg::Vector3D& glob,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector2D& loc) const override;
 
-  /** fast straight line intersection schema - provides closest intersection and (signed) path length
+  /** fast straight line intersection schema - provides closest intersection and
+  (signed) path length
 
   <b>mathematical motivation:</b>
 
     The calculation will be done in the 3-dim frame of the cone,
-    i.e. the symmetry axis of the cone is the z-axis, x- and y-axis are perpenticular
-    to the the z-axis. In this frame the cone is centered around the origin.
-    Therefore the two points describing the line have to be first recalculated into the new frame.
-    Suppose, this is done, the points of intersection can be
-    obtained as follows:<br>
+    i.e. the symmetry axis of the cone is the z-axis, x- and y-axis are
+  perpenticular to the the z-axis. In this frame the cone is centered around the
+  origin. Therefore the two points describing the line have to be first
+  recalculated into the new frame. Suppose, this is done, the points of
+  intersection can be obtained as follows:<br>
 
     The cone is described by the implicit equation
     @f$x^2 + y^2 = z^2 \tan \alpha@f$
@@ -218,91 +227,40 @@ public:
     is also the length of the path, since we normalized @f$x_d@f$
     to be unit length.
   */
-  virtual Intersection straightLineIntersection(const Amg::Vector3D& pos,
-                                                const Amg::Vector3D& dir,
-                                                bool forceDir = false,
-                                                BoundaryCheck bchk = false) const override;
+  virtual Intersection straightLineIntersection(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool forceDir = false,
+    BoundaryCheck bchk = false) const override;
 
   /** fast straight line distance to Surface */
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos,
-                                                        const Amg::Vector3D& dir) const override;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir) const override;
 
   /** fast straight line distance to Surface - with bounds options */
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos,
-                                                        const Amg::Vector3D& dir,
-                                                        bool bound) const override;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool bound) const override;
 
   /** the pathCorrection for derived classes with thickness */
-  virtual double pathCorrection(const Amg::Vector3D&, const Amg::Vector3D&) const override;
+  virtual double pathCorrection(const Amg::Vector3D&,
+                                const Amg::Vector3D&) const override;
 
   /** Return properly formatted class name for screen output */
-  virtual std::string name() const override { return "Trk::ConeSurface"; }
-
-protected:                                 //!< data members
-  SharedObject<const ConeBounds> m_bounds; //!< bounds (shared)
-  CxxUtils::CachedUniquePtrT<Amg::Vector3D>
-    m_referencePoint; //!< The global reference point (== a point on the surface)
-  CxxUtils::CachedUniquePtrT<Amg::Vector3D> m_rotSymmetryAxis; //!< The rotational symmetry axis
+  virtual std::string name() const override;
+
+protected:
+  //!< bounds (shared)
+  SharedObject<const ConeBounds> m_bounds;
+  //!< The global reference point (== a point on thesurface)
+  CxxUtils::CachedUniquePtrT<Amg::Vector3D> m_referencePoint;
+  //!< The rotational symmetry axis
+  CxxUtils::CachedUniquePtrT<Amg::Vector3D> m_rotSymmetryAxis;
 };
 
-inline ConeSurface*
-ConeSurface::clone() const
-{
-  return new ConeSurface(*this);
-}
-
-inline const Amg::Vector3D&
-ConeSurface::normal() const
-{
-  return Surface::normal();
-}
-
-inline const Amg::Vector3D*
-ConeSurface::normal(const Amg::Vector2D& lp) const
-{
-  // (cos phi cos alpha, sin phi cos alpha, sgn z sin alpha)
-  double phi = lp[Trk::locRPhi] / (bounds().r(lp[Trk::locZ]));
-  double sgn = lp[Trk::locZ] > 0 ? -1. : +1.;
-  Amg::Vector3D localNormal(cos(phi) * bounds().cosAlpha(), sin(phi) * bounds().cosAlpha(), sgn * bounds().sinAlpha());
-  return new Amg::Vector3D(transform().rotation() * localNormal);
-}
-
-inline const ConeBounds&
-ConeSurface::bounds() const
-{
-  return *(m_bounds.get());
-}
-
-inline bool
-ConeSurface::insideBounds(const Amg::Vector2D& locpos, double tol1, double tol2) const
-{
-  return bounds().inside(locpos, tol1, tol2);
-}
-
-inline bool
-ConeSurface::insideBoundsCheck(const Amg::Vector2D& locpos, const BoundaryCheck& bchk) const
-{
-  return bounds().inside(locpos, bchk.toleranceLoc1, bchk.toleranceLoc2);
-}
-
-inline Amg::Vector2D
-ConeSurface::localParametersToPosition(const LocalParameters& locpars) const
-{
-  if (locpars.contains(Trk::locRPhi) && locpars.contains(Trk::locZ))
-    return Amg::Vector2D(locpars[Trk::locRPhi], locpars[Trk::locZ]);
-  if (locpars.contains(Trk::locRPhi)) {
-    // not obvious what one should do here with the "r" bit, so by definintion
-    // take that r=1 if no z is given to fix down the r component
-    double phi = locpars[Trk::locRPhi];
-    return Amg::Vector2D(phi, locpars[Trk::locZ]);
-  } else if (locpars.contains(Trk::locZ)) {
-    double r = locpars[Trk::locZ] * bounds().tanAlpha();
-    // by definition set it to M_PI/2
-    return Amg::Vector2D(r * M_PI * 0.5, locpars[Trk::locZ]);
-  }
-  return Amg::Vector2D(0., 0.);
-}
-
 } // end of namespace
+#include "TrkSurfaces/ConeSurface.icc"
 
 #endif // TRKSURFACES_CONESURFACE_H
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.icc
new file mode 100644
index 0000000000000000000000000000000000000000..b4ef19066a714c2fb2f9fa8d7185e72d991e8a4c
--- /dev/null
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.icc
@@ -0,0 +1,162 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+namespace Trk {
+
+/** Return the surface type */
+inline Surface::SurfaceType
+ConeSurface::type() const
+{
+  return Surface::Cone;
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters -
+ * charged */
+inline ParametersT<5, Charged, ConeSurface>*
+ConeSurface::createTrackParameters(double l1,
+                                   double l2,
+                                   double phi,
+                                   double theta,
+                                   double qop,
+                                   AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Charged, ConeSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters -
+ * charged*/
+inline ParametersT<5, Charged, ConeSurface>*
+ConeSurface::createTrackParameters(const Amg::Vector3D& position,
+                                   const Amg::Vector3D& momentum,
+                                   double charge,
+                                   AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Charged, ConeSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters -
+ * neutral */
+inline ParametersT<5, Neutral, ConeSurface>*
+ConeSurface::createNeutralParameters(double l1,
+                                     double l2,
+                                     double phi,
+                                     double theta,
+                                     double qop,
+                                     AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Neutral, ConeSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters -
+ * neutral */
+inline ParametersT<5, Neutral, ConeSurface>*
+ConeSurface::createNeutralParameters(const Amg::Vector3D& position,
+                                     const Amg::Vector3D& momentum,
+                                     double charge,
+                                     AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Neutral, ConeSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters */
+template<int DIM, class T>
+ParametersT<DIM, T, ConeSurface>*
+ConeSurface::createParameters(double l1,
+                              double l2,
+                              double phi,
+                              double theta,
+                              double qop,
+                              AmgSymMatrix(DIM) * cov) const
+{
+  return new ParametersT<DIM, T, ConeSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters */
+template<int DIM, class T>
+ParametersT<DIM, T, ConeSurface>*
+ConeSurface::createParameters(const Amg::Vector3D& position,
+                              const Amg::Vector3D& momentum,
+                              double charge,
+                              AmgSymMatrix(DIM) * cov) const
+{
+  return new ParametersT<DIM, T, ConeSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+inline ConeSurface*
+ConeSurface::clone() const
+{
+  return new ConeSurface(*this);
+}
+
+inline const Amg::Vector3D&
+ConeSurface::normal() const
+{
+  return Surface::normal();
+}
+
+inline const Amg::Vector3D*
+ConeSurface::normal(const Amg::Vector2D& lp) const
+{
+  // (cos phi cos alpha, sin phi cos alpha, sgn z sin alpha)
+  double phi = lp[Trk::locRPhi] / (bounds().r(lp[Trk::locZ]));
+  double sgn = lp[Trk::locZ] > 0 ? -1. : +1.;
+  Amg::Vector3D localNormal(cos(phi) * bounds().cosAlpha(),
+                            sin(phi) * bounds().cosAlpha(),
+                            sgn * bounds().sinAlpha());
+  return new Amg::Vector3D(transform().rotation() * localNormal);
+}
+
+inline const ConeBounds&
+ConeSurface::bounds() const
+{
+  return *(m_bounds.get());
+}
+
+inline bool
+ConeSurface::insideBounds(const Amg::Vector2D& locpos,
+                          double tol1,
+                          double tol2) const
+{
+  return bounds().inside(locpos, tol1, tol2);
+}
+
+inline bool
+ConeSurface::insideBoundsCheck(const Amg::Vector2D& locpos,
+                               const BoundaryCheck& bchk) const
+{
+  return bounds().inside(locpos, bchk.toleranceLoc1, bchk.toleranceLoc2);
+}
+
+inline Amg::Vector2D
+ConeSurface::localParametersToPosition(const LocalParameters& locpars) const
+{
+  if (locpars.contains(Trk::locRPhi) && locpars.contains(Trk::locZ))
+    return Amg::Vector2D(locpars[Trk::locRPhi], locpars[Trk::locZ]);
+  if (locpars.contains(Trk::locRPhi)) {
+    // not obvious what one should do here with the "r" bit, so by definintion
+    // take that r=1 if no z is given to fix down the r component
+    double phi = locpars[Trk::locRPhi];
+    return Amg::Vector2D(phi, locpars[Trk::locZ]);
+  } else if (locpars.contains(Trk::locZ)) {
+    double r = locpars[Trk::locZ] * bounds().tanAlpha();
+    // by definition set it to M_PI/2
+    return Amg::Vector2D(r * M_PI * 0.5, locpars[Trk::locZ]);
+  }
+  return Amg::Vector2D(0., 0.);
+}
+
+/** Return properly formatted class name for screen output */
+inline std::string
+ConeSurface::name() const
+{
+  return "Trk::ConeSurface";
+}
+
+}
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.h
index 873312e141090347c1c98fd9df31a4dd736c3f44..746347b992586af05edc8d851faecd499ee6b28a 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.h
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -58,7 +58,10 @@ public:
   CylinderSurface(Amg::Transform3D* htrans, double radius, double hlength);
 
   /**Constructor from EigenTransform, radius halfphi, and halflenght*/
-  CylinderSurface(Amg::Transform3D* htrans, double radius, double hphi, double hlength);
+  CylinderSurface(Amg::Transform3D* htrans,
+                  double radius,
+                  double hphi,
+                  double hlength);
 
   /**Constructor from EigenTransform and CylinderBounds
     - ownership of the bounds is passed */
@@ -68,10 +71,12 @@ public:
      - bounds is not set */
   CylinderSurface(std::unique_ptr<Amg::Transform3D> htrans);
 
-  /** Constructor from radius and halflenght - speed optimized for concentric volumes */
+  /** Constructor from radius and halflenght - speed optimized for concentric
+   * volumes */
   CylinderSurface(double radius, double hlength);
 
-  /**Constructor from radius halfphi, and halflenght - speed optimized fron concentric volumes */
+  /**Constructor from radius halfphi, and halflenght - speed optimized fron
+   * concentric volumes */
   CylinderSurface(double radius, double hphi, double hlength);
 
   /**Constructor from EigenTransform and CylinderBounds
@@ -97,45 +102,41 @@ public:
   /**Implicit Constructor*/
   virtual CylinderSurface* clone() const override;
 
-  /** Use the Surface as a ParametersBase constructor, from local parameters - charged */
-  virtual  ParametersT<5, Charged, CylinderSurface>* createTrackParameters(double l1,
-                                                                           double l2,
-                                                                           double phi,
-                                                                           double theta,
-                                                                           double qop,
-                                                                           AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Charged, CylinderSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - charged*/
-  virtual ParametersT<5, Charged, CylinderSurface>* createTrackParameters(const Amg::Vector3D& position,
-                                                                          const Amg::Vector3D& momentum,
-                                                                          double charge,
-                                                                          AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Charged, CylinderSurface>(position, momentum, charge, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from local parameters - neutral */
-  virtual  ParametersT<5, Neutral, CylinderSurface>* createNeutralParameters(double l1,
-                                                                             double l2,
-                                                                             double phi,
-                                                                             double theta,
-                                                                             double qop,
-                                                                             AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Neutral, CylinderSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - neutral */
-  virtual ParametersT<5, Neutral, CylinderSurface>* createNeutralParameters(const Amg::Vector3D& position,
-                                                                            const Amg::Vector3D& momentum,
-                                                                            double charge,
-                                                                            AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Neutral, CylinderSurface>(position, momentum, charge, *this, cov);
-  }
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * charged */
+  virtual ParametersT<5, Charged, CylinderSurface>* createTrackParameters(
+    double l1,
+    double l2,
+    double phi,
+    double theta,
+    double qop,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters -
+   * charged*/
+  virtual ParametersT<5, Charged, CylinderSurface>* createTrackParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * neutral */
+  virtual ParametersT<5, Neutral, CylinderSurface>* createNeutralParameters(
+    double l1,
+    double l2,
+    double phi,
+    double theta,
+    double qop,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters -
+   * neutral */
+  virtual ParametersT<5, Neutral, CylinderSurface>* createNeutralParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
 
   /** Use the Surface as a ParametersBase constructor, from local parameters */
   template<int DIM, class T>
@@ -144,28 +145,27 @@ public:
                                                          double phi,
                                                          double theta,
                                                          double qop,
-                                                         AmgSymMatrix(DIM) * cov = 0) const
-  {
-    return new ParametersT<DIM, T, CylinderSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
+                                                         AmgSymMatrix(DIM) *
+                                                           cov = 0) const;
 
   /** Use the Surface as a ParametersBase constructor, from global parameters */
   template<int DIM, class T>
-  const ParametersT<DIM, T, CylinderSurface>* createParameters(const Amg::Vector3D& position,
-                                                               const Amg::Vector3D& momentum,
-                                                               double charge,
-                                                               AmgSymMatrix(DIM) * cov = 0) const
-  {
-    return new ParametersT<DIM, T, CylinderSurface>(position, momentum, charge, *this, cov);
-  }
-
-  /** Return the measurement frame - this is needed for alignment, in particular for StraightLine and Perigee Surface
-      - the default implementation is the the RotationMatrix3D of the transform */
-  virtual Amg::RotationMatrix3D measurementFrame(const Amg::Vector3D& glopos,
-                                                       const Amg::Vector3D& glomom) const override;
+  const ParametersT<DIM, T, CylinderSurface>* createParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(DIM) * cov = 0) const;
+
+  /** Return the measurement frame - this is needed for alignment, in particular
+     for StraightLine and Perigee Surface
+      - the default implementation is the the RotationMatrix3D of the transform
+   */
+  virtual Amg::RotationMatrix3D measurementFrame(
+    const Amg::Vector3D& glopos,
+    const Amg::Vector3D& glomom) const override;
 
   /** Return the surface type */
-  virtual SurfaceType type() const override { return Surface::Cylinder; }
+  virtual SurfaceType type() const override final;
 
   /** Returns a global reference point:
      For the Cylinder this is @f$ (R*cos(\phi), R*sin(\phi),0)*transform() @f$
@@ -179,9 +179,11 @@ public:
 
   /**Return method for surface normal information
      at a given local point, overwrites the normal() from base class.*/
-  virtual const Amg::Vector3D* normal(const Amg::Vector2D& locpo) const override;
+  virtual const Amg::Vector3D* normal(
+    const Amg::Vector2D& locpo) const override;
 
-  /**Return method for the rotational symmetry axis - the z-Axis of the HepTransform */
+  /**Return method for the rotational symmetry axis - the z-Axis of the
+   * HepTransform */
   virtual const Amg::Vector3D& rotSymmetryAxis() const;
 
   /**This method returns the CylinderBounds by reference
@@ -191,138 +193,92 @@ public:
   bool hasBounds() const;
 
   /**This method calls the inside method of CylinderBounds*/
-  virtual bool insideBounds(const Amg::Vector2D& locpos, double tol1 = 0., double tol2 = 0.) const override;
-  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos, const BoundaryCheck& bchk) const override;
+  virtual bool insideBounds(const Amg::Vector2D& locpos,
+                            double tol1 = 0.,
+                            double tol2 = 0.) const override;
 
-  /** Specialized for CylinderSurface : LocalParameters to Vector2D */
-  virtual Amg::Vector2D localParametersToPosition(const LocalParameters& locpars) const override;
-
-  /** Specialized for CylinderSurface : LocalToGlobal method without dynamic memory allocation */
-  virtual void localToGlobal(const Amg::Vector2D& locp, const Amg::Vector3D& mom, Amg::Vector3D& glob) const override;
-
-  /** Specialized for CylinderSurface : GlobalToLocal method without dynamic memory allocation - boolean checks if on
-   * surface */
-  virtual bool globalToLocal(const Amg::Vector3D& glob, const Amg::Vector3D& mom, Amg::Vector2D& loc) const override;
+  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos,
+                                 const BoundaryCheck& bchk) const override;
 
-  /** This method returns true if the GlobalPosition is on the Surface for both, within
-    or without check of whether the local position is inside boundaries or not */
+  /** Specialized for CylinderSurface : LocalParameters to Vector2D */
+  virtual Amg::Vector2D localParametersToPosition(
+    const LocalParameters& locpars) const override;
+
+  /** Specialized for CylinderSurface : LocalToGlobal method without dynamic
+   * memory allocation */
+  virtual void localToGlobal(const Amg::Vector2D& locp,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector3D& glob) const override;
+
+  /** Specialized for CylinderSurface : GlobalToLocal method without dynamic
+   * memory allocation - boolean checks if on surface */
+  virtual bool globalToLocal(const Amg::Vector3D& glob,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector2D& loc) const override;
+
+  /** This method returns true if the GlobalPosition is on the Surface for both,
+    within or without check of whether the local position is inside boundaries
+    or not */
   virtual bool isOnSurface(const Amg::Vector3D& glopo,
                            BoundaryCheck bchk = true,
                            double tol1 = 0.,
                            double tol2 = 0.) const override;
 
-  /** fast straight line intersection schema - provides closest intersection and (signed) path length
+  /** fast straight line intersection schema - provides closest intersection and
+     (signed) path length
 
       <b>mathematical motivation:</b>
 
       The calculation will be done in the 3-dim frame of the cylinder,
-      i.e. the symmetry axis of the cylinder is the z-axis, x- and y-axis are perpenticular
-      to the the z-axis. In this frame the cylinder is centered around the origin.
-      Therefore the two points describing the line have to be first recalculated into the new frame.
-      Suppose, this is done, the intersection is straight forward:<br>
-      may @f$p_{1}=(p_{1x}, p_{1y}, p_{1z}), p_{2}=(p_{2x}, p_{2y}, p_{2z}) @f$the two points describing the 3D-line,
-      then the line in the \f$x-y@f$plane can be written as
+      i.e. the symmetry axis of the cylinder is the z-axis, x- and y-axis are
+     perpenticular to the the z-axis. In this frame the cylinder is centered
+     around the origin. Therefore the two points describing the line have to be
+     first recalculated into the new frame. Suppose, this is done, the
+     intersection is straight forward:<br> may @f$p_{1}=(p_{1x}, p_{1y},
+     p_{1z}), p_{2}=(p_{2x}, p_{2y}, p_{2z}) @f$the two points describing the
+     3D-line, then the line in the \f$x-y@f$plane can be written as
       @f$y=kx+d\f$, where @f$k =\frac{p_{2y}-p_{1y}}{p_{2x}-p_{1x}}@f$such as
-     @f$d=\frac{p_{2x}p_{1y}-p_{1x}p_{2y}}{p_{2x}-p_{1x}},\f$<br> and intersects with the corresponding circle
-     @f$x^{2}+y^{2} = R^{2}. @f$<br> The solutions can then be found by a simple quadratic equation and reinsertion into
-     the line equation.
+     @f$d=\frac{p_{2x}p_{1y}-p_{1x}p_{2y}}{p_{2x}-p_{1x}},\f$<br> and intersects
+     with the corresponding circle
+     @f$x^{2}+y^{2} = R^{2}. @f$<br> The solutions can then be found by a simple
+     quadratic equation and reinsertion into the line equation.
   */
-  virtual Intersection straightLineIntersection(const Amg::Vector3D& pos,
-                                                const Amg::Vector3D& dir,
-                                                bool forceDir = false,
-                                                Trk::BoundaryCheck bchk = false) const override;
+  virtual Intersection straightLineIntersection(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool forceDir = false,
+    Trk::BoundaryCheck bchk = false) const override;
 
   /** fast distance to Surface */
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos,
-                                                        const Amg::Vector3D& dir) const override;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir) const override;
 
   /** fast distance to Surface - with bounds directive*/
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos,
-                                                        const Amg::Vector3D& dir,
-                                                        bool bound) const override;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool bound) const override;
 
   /** the pathCorrection for derived classes with thickness */
-  virtual double pathCorrection(const Amg::Vector3D& pos, const Amg::Vector3D& mom) const override;
+  virtual double pathCorrection(const Amg::Vector3D& pos,
+                                const Amg::Vector3D& mom) const override;
 
   /** Return properly formatted class name for screen output */
-  virtual std::string name() const override { return "Trk::CylinderSurface"; }
+  virtual std::string name() const override;
 
 protected: //!< data members
   template<class SURFACE, class BOUNDS_CNV>
   friend class ::BoundSurfaceCnv_p1;
 
   SharedObject<const CylinderBounds> m_bounds; //!< bounds (shared)
-  CxxUtils::CachedUniquePtrT<Amg::Vector3D>
-    m_referencePoint; //!< The global reference point (== a point on the surface)
-  CxxUtils::CachedUniquePtrT<Amg::Vector3D> m_rotSymmetryAxis; //!< The rotational symmetry axis
+  //!< The global reference point (== a point on the  surface)
+  CxxUtils::CachedUniquePtrT<Amg::Vector3D> m_referencePoint;
+  //!< The rotational symmetry axis
+  CxxUtils::CachedUniquePtrT<Amg::Vector3D> m_rotSymmetryAxis;
 };
 
-inline CylinderSurface*
-CylinderSurface::clone() const
-{
-  return new CylinderSurface(*this);
-}
-
-inline const Amg::Vector3D&
-CylinderSurface::normal() const
-{
-  return Surface::normal();
-}
-
-inline const Amg::Vector3D*
-CylinderSurface::normal(const Amg::Vector2D& lp) const
-{
-  double phi = lp[Trk::locRPhi] / (bounds().r());
-  Amg::Vector3D localNormal(cos(phi), sin(phi), 0.);
-  return new Amg::Vector3D(transform().rotation() * localNormal);
-}
-
-inline double
-CylinderSurface::pathCorrection(const Amg::Vector3D& pos, const Amg::Vector3D& mom) const
-{
-  // the global normal vector is pos-center.unit() - at the z of the position @TODO make safe for tilt
-  Amg::Vector3D pcT(pos.x() - center().x(), pos.y() - center().y(), 0.);
-  Amg::Vector3D normalT(pcT.unit()); // transverse normal
-  double cosAlpha = normalT.dot(mom.unit());
-  return (cosAlpha != 0 ? fabs(1. / cosAlpha) : 1.); // ST undefined for cosAlpha=0
-}
-
-inline const CylinderBounds&
-CylinderSurface::bounds() const
-{
-  return *(m_bounds.get());
-}
-
-inline bool
-CylinderSurface::hasBounds() const
-{
-  return m_bounds.get() != nullptr;
-}
-
-inline bool
-CylinderSurface::insideBounds(const Amg::Vector2D& locpos, double tol1, double tol2) const
-{
-  return bounds().inside(locpos, tol1, tol2);
-}
-
-inline bool
-CylinderSurface::insideBoundsCheck(const Amg::Vector2D& locpos, const BoundaryCheck& bchk) const
-{
-  return bounds().inside(locpos, bchk);
-}
-
-inline Amg::Vector2D
-CylinderSurface::localParametersToPosition(const LocalParameters& locpars) const
-{
-  if (locpars.contains(Trk::locRPhi) && locpars.contains(Trk::locZ))
-    return Amg::Vector2D(locpars[Trk::locRPhi], locpars[Trk::locZ]);
-  if (locpars.contains(Trk::locRPhi))
-    return Amg::Vector2D(locpars[Trk::locRPhi], 0.);
-  if (locpars.contains(Trk::locZ))
-    return Amg::Vector2D(bounds().r(), locpars[Trk::locZ]);
-  return Amg::Vector2D(bounds().r(), 0.);
-}
-
 } // end of namespace
+#include "TrkSurfaces/CylinderSurface.icc"
 
 #endif // TRKSURFACES_CYLINDERSURFACE_H
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.icc
new file mode 100644
index 0000000000000000000000000000000000000000..cb3c2c65db54c3268c2e69fab2f3bdf4cb8894ad
--- /dev/null
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.icc
@@ -0,0 +1,170 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+namespace Trk {
+
+/** Return the surface type */
+inline Surface::SurfaceType
+CylinderSurface::type() const
+{
+  return Surface::Cylinder;
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters -
+ * charged */
+inline ParametersT<5, Charged, CylinderSurface>*
+CylinderSurface::createTrackParameters(double l1,
+                                       double l2,
+                                       double phi,
+                                       double theta,
+                                       double qop,
+                                       AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Charged, CylinderSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters -
+ * charged*/
+inline ParametersT<5, Charged, CylinderSurface>*
+CylinderSurface::createTrackParameters(const Amg::Vector3D& position,
+                                       const Amg::Vector3D& momentum,
+                                       double charge,
+                                       AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Charged, CylinderSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters -
+ * neutral */
+inline ParametersT<5, Neutral, CylinderSurface>*
+CylinderSurface::createNeutralParameters(double l1,
+                                         double l2,
+                                         double phi,
+                                         double theta,
+                                         double qop,
+                                         AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Neutral, CylinderSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters -
+ * neutral */
+inline ParametersT<5, Neutral, CylinderSurface>*
+CylinderSurface::createNeutralParameters(const Amg::Vector3D& position,
+                                         const Amg::Vector3D& momentum,
+                                         double charge,
+                                         AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Neutral, CylinderSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters */
+template<int DIM, class T>
+ParametersT<DIM, T, CylinderSurface>*
+CylinderSurface::createParameters(double l1,
+                                  double l2,
+                                  double phi,
+                                  double theta,
+                                  double qop,
+                                  AmgSymMatrix(DIM) * cov) const
+{
+  return new ParametersT<DIM, T, CylinderSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters */
+template<int DIM, class T>
+const ParametersT<DIM, T, CylinderSurface>*
+CylinderSurface::createParameters(const Amg::Vector3D& position,
+                                  const Amg::Vector3D& momentum,
+                                  double charge,
+                                  AmgSymMatrix(DIM) * cov) const
+{
+  return new ParametersT<DIM, T, CylinderSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+inline CylinderSurface*
+CylinderSurface::clone() const
+{
+  return new CylinderSurface(*this);
+}
+
+inline const Amg::Vector3D&
+CylinderSurface::normal() const
+{
+  return Surface::normal();
+}
+
+inline const Amg::Vector3D*
+CylinderSurface::normal(const Amg::Vector2D& lp) const
+{
+  double phi = lp[Trk::locRPhi] / (bounds().r());
+  Amg::Vector3D localNormal(cos(phi), sin(phi), 0.);
+  return new Amg::Vector3D(transform().rotation() * localNormal);
+}
+
+inline double
+CylinderSurface::pathCorrection(const Amg::Vector3D& pos,
+                                const Amg::Vector3D& mom) const
+{
+  // the global normal vector is pos-center.unit() - at the z of the position
+  // @TODO make safe for tilt
+  Amg::Vector3D pcT(pos.x() - center().x(), pos.y() - center().y(), 0.);
+  Amg::Vector3D normalT(pcT.unit()); // transverse normal
+  double cosAlpha = normalT.dot(mom.unit());
+  return (cosAlpha != 0 ? fabs(1. / cosAlpha)
+                        : 1.); // ST undefined for cosAlpha=0
+}
+
+inline const CylinderBounds&
+CylinderSurface::bounds() const
+{
+  return *(m_bounds.get());
+}
+
+inline bool
+CylinderSurface::hasBounds() const
+{
+  return m_bounds.get() != nullptr;
+}
+
+inline bool
+CylinderSurface::insideBounds(const Amg::Vector2D& locpos,
+                              double tol1,
+                              double tol2) const
+{
+  return bounds().inside(locpos, tol1, tol2);
+}
+
+inline bool
+CylinderSurface::insideBoundsCheck(const Amg::Vector2D& locpos,
+                                   const BoundaryCheck& bchk) const
+{
+  return bounds().inside(locpos, bchk);
+}
+
+inline Amg::Vector2D
+CylinderSurface::localParametersToPosition(const LocalParameters& locpars) const
+{
+  if (locpars.contains(Trk::locRPhi) && locpars.contains(Trk::locZ))
+    return Amg::Vector2D(locpars[Trk::locRPhi], locpars[Trk::locZ]);
+  if (locpars.contains(Trk::locRPhi))
+    return Amg::Vector2D(locpars[Trk::locRPhi], 0.);
+  if (locpars.contains(Trk::locZ))
+    return Amg::Vector2D(bounds().r(), locpars[Trk::locZ]);
+  return Amg::Vector2D(bounds().r(), 0.);
+}
+
+inline std::string
+CylinderSurface::name() const
+{
+  return "Trk::CylinderSurface";
+}
+
+}
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.h
index c92859aae4f6e2c8fb6c1402a096eb836f1cf454..f6f19171ec3c46b075bdd645840a2bcf743bcc5b 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.h
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -51,14 +51,19 @@ public:
   /**Default Constructor*/
   DiscSurface();
 
-  /**Constructor for Discs from HepGeom::Transform3D, \f$ r_{min}, r_{max} \f$ */
+  /**Constructor for Discs from HepGeom::Transform3D, \f$ r_{min}, r_{max} \f$
+   */
   DiscSurface(Amg::Transform3D* htrans, double rmin, double rmax);
 
-  /**Constructor for Discs from HepGeom::Transform3D, \f$ r_{min}, r_{max}, \phi_{hsec} \f$ */
-  DiscSurface(Amg::Transform3D* htrans, double rmin, double rmax, double hphisec);
+  /**Constructor for Discs from HepGeom::Transform3D, \f$ r_{min}, r_{max},
+   * \phi_{hsec} \f$ */
+  DiscSurface(Amg::Transform3D* htrans,
+              double rmin,
+              double rmax,
+              double hphisec);
 
-  /**Constructor for Discs from HepGeom::Transform3D, \f$ r_{min}, r_{max}, hx_{min}, hx_{max} \f$
-     In this case you have DiscTrapezoidalBounds*/
+  /**Constructor for Discs from HepGeom::Transform3D, \f$ r_{min}, r_{max},
+     hx_{min}, hx_{max} \f$ In this case you have DiscTrapezoidalBounds*/
   DiscSurface(Amg::Transform3D* htrans,
               double minhalfx,
               double maxhalfx,
@@ -100,45 +105,41 @@ public:
   /** Virtual constructor*/
   virtual DiscSurface* clone() const override;
 
-  /** Use the Surface as a ParametersBase constructor, from local parameters - charged */
-  virtual ParametersT<5, Charged, DiscSurface>* createTrackParameters(double l1,
-                                                                      double l2,
-                                                                      double phi,
-                                                                      double theta,
-                                                                      double qop,
-                                                                      AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Charged, DiscSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - charged*/
-  virtual ParametersT<5, Charged, DiscSurface>* createTrackParameters(const Amg::Vector3D& position,
-                                                                      const Amg::Vector3D& momentum,
-                                                                      double charge,
-                                                                      AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Charged, DiscSurface>(position, momentum, charge, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from local parameters - neutral */
-  virtual ParametersT<5, Neutral, DiscSurface>* createNeutralParameters(double l1,
-                                                                        double l2,
-                                                                        double phi,
-                                                                        double theta,
-                                                                        double qop,
-                                                                        AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Neutral, DiscSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - neutral */
-  virtual ParametersT<5, Neutral, DiscSurface>* createNeutralParameters(const Amg::Vector3D& position,
-                                                                        const Amg::Vector3D& momentum,
-                                                                        double charge,
-                                                                        AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Neutral, DiscSurface>(position, momentum, charge, *this, cov);
-  }
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * charged */
+  virtual ParametersT<5, Charged, DiscSurface>* createTrackParameters(
+    double l1,
+    double l2,
+    double phi,
+    double theta,
+    double qop,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters -
+   * charged*/
+  virtual ParametersT<5, Charged, DiscSurface>* createTrackParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * neutral */
+  virtual ParametersT<5, Neutral, DiscSurface>* createNeutralParameters(
+    double l1,
+    double l2,
+    double phi,
+    double theta,
+    double qop,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters -
+   * neutral */
+  virtual ParametersT<5, Neutral, DiscSurface>* createNeutralParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
 
   /** Use the Surface as a ParametersBase constructor, from local parameters */
   template<int DIM, class T>
@@ -147,23 +148,19 @@ public:
                                                      double phi,
                                                      double theta,
                                                      double qop,
-                                                     AmgSymMatrix(DIM) * cov = 0) const
-  {
-    return new ParametersT<DIM, T, DiscSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
+                                                     AmgSymMatrix(DIM) *
+                                                       cov = 0) const;
 
   /** Use the Surface as a ParametersBase constructor, from global parameters */
   template<int DIM, class T>
-  ParametersT<DIM, T, DiscSurface>* createParameters(const Amg::Vector3D& position,
-                                                     const Amg::Vector3D& momentum,
-                                                     double charge,
-                                                     AmgSymMatrix(DIM) * cov = 0) const
-  {
-    return new ParametersT<DIM, T, DiscSurface>(position, momentum, charge, *this, cov);
-  }
+  ParametersT<DIM, T, DiscSurface>* createParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(DIM) * cov = 0) const;
 
   /** Return the surface type */
-  virtual SurfaceType type() const override { return Surface::Disc; }
+  virtual SurfaceType type() const override final;
 
   /** Returns a global reference point:
      For the Disc this is @f$ (R*cos(\phi), R*sin(\phi),0)*transform() @f$
@@ -175,54 +172,78 @@ public:
   const SurfaceBounds& bounds() const override;
 
   /**This method calls the inside method of the bounds*/
-  virtual bool insideBounds(const Amg::Vector2D& locpos, double tol1 = 0., double tol2 = 0.) const override;
-  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos, const BoundaryCheck& bchk) const override;
-
-  /** This method returns true if the GlobalPosition is on the Surface for both, within
-    or without check of whether the local position is inside boundaries or not */
+  virtual bool insideBounds(const Amg::Vector2D& locpos,
+                            double tol1 = 0.,
+                            double tol2 = 0.) const override;
+  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos,
+                                 const BoundaryCheck& bchk) const override;
+
+  /** This method returns true if the GlobalPosition is on the Surface for both,
+    within or without check of whether the local position is inside boundaries
+    or not */
   virtual bool isOnSurface(const Amg::Vector3D& glopo,
                            BoundaryCheck bchk = true,
                            double tol1 = 0.,
                            double tol2 = 0.) const override;
 
   /** Specialized for DiscSurface : LocalParameters to Vector2D */
-  virtual Amg::Vector2D localParametersToPosition(const LocalParameters& locpars) const override;
+  virtual Amg::Vector2D localParametersToPosition(
+    const LocalParameters& locpars) const override;
 
-  /** Specialized for DiscSurface: LocalToGlobal method without dynamic memory allocation */
-  virtual void localToGlobal(const Amg::Vector2D& locp, const Amg::Vector3D& mom, Amg::Vector3D& glob) const override;
+  /** Specialized for DiscSurface: LocalToGlobal method without dynamic memory
+   * allocation */
+  virtual void localToGlobal(const Amg::Vector2D& locp,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector3D& glob) const override;
 
-  /** Specialized for DiscSurface: GlobalToLocal method without dynamic memory allocation - boolean checks if on surface
+  /** Specialized for DiscSurface: GlobalToLocal method without dynamic memory
+   * allocation - boolean checks if on surface
    */
-  virtual bool globalToLocal(const Amg::Vector3D& glob, const Amg::Vector3D& mom, Amg::Vector2D& loc) const override;
+  virtual bool globalToLocal(const Amg::Vector3D& glob,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector2D& loc) const override;
 
-  /**  Special method for DiscSurface : local<->local transformations polar <-> cartesian */
+  /**  Special method for DiscSurface : local<->local transformations polar <->
+   * cartesian */
   const Amg::Vector2D* localPolarToCartesian(const Amg::Vector2D& locpol) const;
 
-  /**  Special method for Disc surface : local<->local transformations polar <-> cartesian */
-  const Amg::Vector2D* localCartesianToPolar(const Amg::Vector2D& loccart) const;
+  /**  Special method for Disc surface : local<->local transformations polar <->
+   * cartesian */
+  const Amg::Vector2D* localCartesianToPolar(
+    const Amg::Vector2D& loccart) const;
 
-  /**  Special method for Disc surface : local<->local transformations polar <-> cartesian by value*/
+  /**  Special method for Disc surface : local<->local transformations polar <->
+   * cartesian by value*/
   Amg::Vector2D localCartesianToPolarValue(const Amg::Vector2D& loccart) const;
 
-  /**  Special method for DiscSurface : local<->local transformations polar <-> cartesian */
-  const Amg::Vector2D* localPolarToLocalCartesian(const Amg::Vector2D& locpol) const;
+  /**  Special method for DiscSurface : local<->local transformations polar <->
+   * cartesian */
+  const Amg::Vector2D* localPolarToLocalCartesian(
+    const Amg::Vector2D& locpol) const;
 
-  /** Special method for DiscSurface :  local<->global transformation when provided cartesian coordinates */
-  const Amg::Vector3D* localCartesianToGlobal(const Amg::Vector2D& locpos) const;
+  /** Special method for DiscSurface :  local<->global transformation when
+   * provided cartesian coordinates */
+  const Amg::Vector3D* localCartesianToGlobal(
+    const Amg::Vector2D& locpos) const;
 
-  /** Special method for DiscSurface : global<->local from cartesian coordinates */
-  const Amg::Vector2D* globalToLocalCartesian(const Amg::Vector3D& glopos, double tol = 0.) const;
+  /** Special method for DiscSurface : global<->local from cartesian coordinates
+   */
+  const Amg::Vector2D* globalToLocalCartesian(const Amg::Vector3D& glopos,
+                                              double tol = 0.) const;
 
-  /** fast straight line intersection schema - standard: provides closest intersection and (signed) path length
-      forceDir is to provide the closest forward solution
+  /** fast straight line intersection schema - standard: provides closest
+     intersection and (signed) path length forceDir is to provide the closest
+     forward solution
 
       <b>mathematical motivation:</b>
 
       the equation of the plane is given by: <br>
       @f$ \vec n \cdot \vec x = \vec n \cdot \vec p,@f$ <br>
-      where @f$ \vec n = (n_{x}, n_{y}, n_{z})@f$ denotes the normal vector of the plane,
-      @f$ \vec p = (p_{x}, p_{y}, p_{z})@f$ one specific point on the plane and @f$ \vec x = (x,y,z) @f$ all possible
-     points on the plane.<br> Given a line with:<br>
+      where @f$ \vec n = (n_{x}, n_{y}, n_{z})@f$ denotes the normal vector of
+     the plane,
+      @f$ \vec p = (p_{x}, p_{y}, p_{z})@f$ one specific point on the plane and
+     @f$ \vec x = (x,y,z) @f$ all possible points on the plane.<br> Given a line
+     with:<br>
       @f$ \vec l(u) = \vec l_{1} + u \cdot \vec v @f$, <br>
       the solution for @f$ u @f$ can be written:
       @f$ u = \frac{\vec n (\vec p - \vec l_{1})}{\vec n \vec v}@f$ <br>
@@ -230,114 +251,38 @@ public:
       - either in the plane
       - perpenticular to the normal of the plane
    */
-  virtual Intersection straightLineIntersection(const Amg::Vector3D& pos,
-                                                const Amg::Vector3D& dir,
-                                                bool forceDir = false,
-                                                Trk::BoundaryCheck bchk = false) const override;
+  virtual Intersection straightLineIntersection(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool forceDir = false,
+    Trk::BoundaryCheck bchk = false) const override;
 
   /** fast straight line distance evaluation to Surface */
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos,
-                                                        const Amg::Vector3D& dir) const override;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir) const override;
 
   /** fast straight line distance evaluation to Surface - with bound option*/
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos,
-                                                        const Amg::Vector3D& dir,
-                                                        bool Bound) const override;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool Bound) const override;
 
   /** Return properly formatted class name for screen output */
-  virtual std::string name() const override { return "Trk::DiscSurface"; }
+  virtual std::string name() const override;
 
 protected: //!< data members
   template<class SURFACE, class BOUNDS_CNV>
   friend class ::BoundSurfaceCnv_p1;
-
-  SharedObject<const SurfaceBounds> m_bounds;                 //!< bounds (shared)
-  CxxUtils::CachedUniquePtrT<Amg::Vector3D> m_referencePoint; //!< reference Point on the Surface
-  static const NoBounds s_boundless;                          //!< static member for boundless approach
+  //!< bounds (shared)
+  SharedObject<const SurfaceBounds> m_bounds;
+  //!< reference Point on the Surface
+  CxxUtils::CachedUniquePtrT<Amg::Vector3D> m_referencePoint;
+  //!< static member for boundless approach
+  static const NoBounds s_boundless;
 };
 
-inline DiscSurface*
-DiscSurface::clone() const
-{
-  return new DiscSurface(*this);
-}
-
-inline const SurfaceBounds&
-DiscSurface::bounds() const
-{
-  if (m_bounds.get())
-    return (*(m_bounds.get()));
-  if (Surface::m_associatedDetElement && Surface::m_associatedDetElementId.is_valid()) {
-    return m_associatedDetElement->bounds(Surface::m_associatedDetElementId);
-  }
-  if (Surface::m_associatedDetElement)
-    return m_associatedDetElement->bounds();
-  return s_boundless;
-}
-
-inline bool
-DiscSurface::insideBounds(const Amg::Vector2D& locpos, double tol1, double tol2) const
-{
-  return bounds().inside(locpos, tol1, tol2);
-}
-
-inline bool
-DiscSurface::insideBoundsCheck(const Amg::Vector2D& locpos, const BoundaryCheck& bchk) const
-{
-  return (bounds().inside(locpos, bchk));
-}
-
-inline Amg::Vector2D
-DiscSurface::localParametersToPosition(const LocalParameters& locpars) const
-{
-  if (locpars.contains(Trk::locR) && locpars.contains(Trk::locPhi))
-    return Amg::Vector2D(locpars[Trk::locR], locpars[Trk::locPhi]);
-  if (locpars.contains(Trk::locR))
-    return Amg::Vector2D(locpars[Trk::locR], 0.);
-  if (locpars.contains(Trk::locPhi))
-    return Amg::Vector2D(0.5 * bounds().r(), locpars[Trk::locPhi]);
-  return Amg::Vector2D(0.5 * bounds().r(), 0.);
-}
-
-inline const Amg::Vector2D*
-DiscSurface::localPolarToCartesian(const Amg::Vector2D& locpol) const
-{
-  return (new Amg::Vector2D(locpol[locR] * std::cos(locpol[locPhi]), locpol[locR] * std::sin(locpol[locPhi])));
-}
-
-inline const Amg::Vector2D*
-DiscSurface::localCartesianToPolar(const Amg::Vector2D& loccart) const
-{
-  return (new Amg::Vector2D(std::sqrt(loccart[locX] * loccart[locX] + loccart[locY] * loccart[locY]),
-                            std::atan2(loccart[locY], loccart[locX])));
-}
-inline Amg::Vector2D
-DiscSurface::localCartesianToPolarValue(const Amg::Vector2D& loccart) const
-{
-  return (Amg::Vector2D(std::sqrt(loccart[locX] * loccart[locX] + loccart[locY] * loccart[locY]),
-                        std::atan2(loccart[locY], loccart[locX])));
-}
-
-inline Intersection
-DiscSurface::straightLineIntersection(const Amg::Vector3D& pos,
-                                      const Amg::Vector3D& dir,
-                                      bool forceDir,
-                                      Trk::BoundaryCheck bchk) const
-{
-  double denom = dir.dot(normal());
-  if (denom) {
-    double u = (normal().dot((center() - pos))) / (denom);
-    Amg::Vector3D intersectPoint(pos + u * dir);
-    // evaluate the intersection in terms of direction
-    bool isValid = forceDir ? (u > 0.) : true;
-    // evaluate (if necessary in terms of boundaries)
-    isValid = bchk ? (isValid && isOnSurface(intersectPoint)) : isValid;
-    // return the result
-    return Trk::Intersection(intersectPoint, u, isValid);
-  }
-  return Trk::Intersection(pos, 0., false);
-}
-
 } // end of namespace
+#include "TrkSurfaces/DiscSurface.icc"
 
 #endif // TRKSURFACES_DISCSURFACE_H
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.icc
new file mode 100644
index 0000000000000000000000000000000000000000..6a7102af8d534c02ccbcba8dad2f986e8055f881
--- /dev/null
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.icc
@@ -0,0 +1,187 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+namespace Trk {
+/** Return the surface type */
+inline Surface::SurfaceType
+DiscSurface::type() const
+{
+  return Surface::Disc;
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters -
+ * charged */
+inline ParametersT<5, Charged, DiscSurface>*
+DiscSurface::createTrackParameters(double l1,
+                                   double l2,
+                                   double phi,
+                                   double theta,
+                                   double qop,
+                                   AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Charged, DiscSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters -
+ * charged*/
+inline ParametersT<5, Charged, DiscSurface>*
+DiscSurface::createTrackParameters(const Amg::Vector3D& position,
+                                   const Amg::Vector3D& momentum,
+                                   double charge,
+                                   AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Charged, DiscSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters -
+ * neutral */
+inline ParametersT<5, Neutral, DiscSurface>*
+DiscSurface::createNeutralParameters(double l1,
+                                     double l2,
+                                     double phi,
+                                     double theta,
+                                     double qop,
+                                     AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Neutral, DiscSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters -
+ * neutral */
+inline ParametersT<5, Neutral, DiscSurface>*
+DiscSurface::createNeutralParameters(const Amg::Vector3D& position,
+                                     const Amg::Vector3D& momentum,
+                                     double charge,
+                                     AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Neutral, DiscSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters */
+template<int DIM, class T>
+ParametersT<DIM, T, DiscSurface>*
+DiscSurface::createParameters(double l1,
+                              double l2,
+                              double phi,
+                              double theta,
+                              double qop,
+                              AmgSymMatrix(DIM) * cov) const
+{
+  return new ParametersT<DIM, T, DiscSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters */
+template<int DIM, class T>
+ParametersT<DIM, T, DiscSurface>*
+DiscSurface::createParameters(const Amg::Vector3D& position,
+                              const Amg::Vector3D& momentum,
+                              double charge,
+                              AmgSymMatrix(DIM) * cov) const
+{
+  return new ParametersT<DIM, T, DiscSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+inline DiscSurface*
+DiscSurface::clone() const
+{
+  return new DiscSurface(*this);
+}
+
+inline const SurfaceBounds&
+DiscSurface::bounds() const
+{
+  if (m_bounds.get())
+    return (*(m_bounds.get()));
+  if (Surface::m_associatedDetElement &&
+      Surface::m_associatedDetElementId.is_valid()) {
+    return m_associatedDetElement->bounds(Surface::m_associatedDetElementId);
+  }
+  if (Surface::m_associatedDetElement)
+    return m_associatedDetElement->bounds();
+  return s_boundless;
+}
+
+inline bool
+DiscSurface::insideBounds(const Amg::Vector2D& locpos,
+                          double tol1,
+                          double tol2) const
+{
+  return bounds().inside(locpos, tol1, tol2);
+}
+
+inline bool
+DiscSurface::insideBoundsCheck(const Amg::Vector2D& locpos,
+                               const BoundaryCheck& bchk) const
+{
+  return (bounds().inside(locpos, bchk));
+}
+
+inline Amg::Vector2D
+DiscSurface::localParametersToPosition(const LocalParameters& locpars) const
+{
+  if (locpars.contains(Trk::locR) && locpars.contains(Trk::locPhi))
+    return Amg::Vector2D(locpars[Trk::locR], locpars[Trk::locPhi]);
+  if (locpars.contains(Trk::locR))
+    return Amg::Vector2D(locpars[Trk::locR], 0.);
+  if (locpars.contains(Trk::locPhi))
+    return Amg::Vector2D(0.5 * bounds().r(), locpars[Trk::locPhi]);
+  return Amg::Vector2D(0.5 * bounds().r(), 0.);
+}
+
+inline const Amg::Vector2D*
+DiscSurface::localPolarToCartesian(const Amg::Vector2D& locpol) const
+{
+  return (new Amg::Vector2D(locpol[locR] * std::cos(locpol[locPhi]),
+                            locpol[locR] * std::sin(locpol[locPhi])));
+}
+
+inline const Amg::Vector2D*
+DiscSurface::localCartesianToPolar(const Amg::Vector2D& loccart) const
+{
+  return (new Amg::Vector2D(
+    std::sqrt(loccart[locX] * loccart[locX] + loccart[locY] * loccart[locY]),
+    std::atan2(loccart[locY], loccart[locX])));
+}
+inline Amg::Vector2D
+DiscSurface::localCartesianToPolarValue(const Amg::Vector2D& loccart) const
+{
+  return (Amg::Vector2D(
+    std::sqrt(loccart[locX] * loccart[locX] + loccart[locY] * loccart[locY]),
+    std::atan2(loccart[locY], loccart[locX])));
+}
+
+inline Intersection
+DiscSurface::straightLineIntersection(const Amg::Vector3D& pos,
+                                      const Amg::Vector3D& dir,
+                                      bool forceDir,
+                                      Trk::BoundaryCheck bchk) const
+{
+  double denom = dir.dot(normal());
+  if (denom) {
+    double u = (normal().dot((center() - pos))) / (denom);
+    Amg::Vector3D intersectPoint(pos + u * dir);
+    // evaluate the intersection in terms of direction
+    bool isValid = forceDir ? (u > 0.) : true;
+    // evaluate (if necessary in terms of boundaries)
+    isValid = bchk ? (isValid && isOnSurface(intersectPoint)) : isValid;
+    // return the result
+    return Trk::Intersection(intersectPoint, u, isValid);
+  }
+  return Trk::Intersection(pos, 0., false);
+}
+
+/** Return properly formatted class name for screen output */
+inline std::string
+DiscSurface::name() const
+{
+  return "Trk::DiscSurface";
+}
+
+}
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.h
index f7752f9c2f57356681521135503be7f9c2a4ff10..af54ae7a6930d9e01577d49b2252e1dcf4612ba2 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.h
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.h
@@ -70,45 +70,41 @@ public:
   /**Equality operator*/
   virtual bool operator==(const Surface& sf) const override;
 
-  /** Use the Surface as a ParametersBase constructor, from local parameters - charged */
-  virtual ParametersT<5, Charged, PerigeeSurface>* createTrackParameters(double l1,
-                                                                         double l2,
-                                                                         double phi,
-                                                                         double theta,
-                                                                         double qop,
-                                                                         AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Charged, PerigeeSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - charged*/
-  virtual ParametersT<5, Charged, PerigeeSurface>* createTrackParameters(const Amg::Vector3D& position,
-                                                                         const Amg::Vector3D& momentum,
-                                                                         double charge,
-                                                                         AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Charged, PerigeeSurface>(position, momentum, charge, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from local parameters - neutral */
-  virtual ParametersT<5, Neutral, PerigeeSurface>* createNeutralParameters(double l1,
-                                                                           double l2,
-                                                                           double phi,
-                                                                           double theta,
-                                                                           double qop,
-                                                                           AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Neutral, PerigeeSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - neutral */
-  virtual ParametersT<5, Neutral, PerigeeSurface>* createNeutralParameters(const Amg::Vector3D& position,
-                                                                           const Amg::Vector3D& momentum,
-                                                                           double charge,
-                                                                           AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Neutral, PerigeeSurface>(position, momentum, charge, *this, cov);
-  }
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * charged */
+  virtual ParametersT<5, Charged, PerigeeSurface>* createTrackParameters(
+    double l1,
+    double l2,
+    double phi,
+    double theta,
+    double qop,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters -
+   * charged*/
+  virtual ParametersT<5, Charged, PerigeeSurface>* createTrackParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * neutral */
+  virtual ParametersT<5, Neutral, PerigeeSurface>* createNeutralParameters(
+    double l1,
+    double l2,
+    double phi,
+    double theta,
+    double qop,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters -
+   * neutral */
+  virtual ParametersT<5, Neutral, PerigeeSurface>* createNeutralParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
 
   /** Use the Surface as a ParametersBase constructor, from local parameters */
   template<int DIM, class T>
@@ -117,106 +113,124 @@ public:
                                                         double phi,
                                                         double theta,
                                                         double qop,
-                                                              AmgSymMatrix(DIM) * cov = 0) const
-  {
-    return new ParametersT<DIM, T, PerigeeSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
+                                                        AmgSymMatrix(DIM) *
+                                                          cov = 0) const;
 
-  /** Use the Surface as a ParametersBase constructor, from global parameters */
+  /** Use the Surface as a ParametersBase constructor, from global parameters
+   */
   template<int DIM, class T>
-  ParametersT<DIM, T, PerigeeSurface>* createParameters(const Amg::Vector3D& position,
-                                                        const Amg::Vector3D& momentum,
-                                                        double charge,
-                                                        AmgSymMatrix(DIM) * cov = 0) const
-  {
-    return new ParametersT<DIM, T, PerigeeSurface>(position, momentum, charge, *this, cov);
-  }
+  ParametersT<DIM, T, PerigeeSurface>* createParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(DIM) * cov = 0) const;
 
   /** Return the surface type */
-  virtual SurfaceType type() const override { return Surface::Perigee; }
+  virtual SurfaceType type() const override final;
 
-  /**Return method for transfromation, overwrites the transform() form base class*/
+  /**Return method for transfromation, overwrites the transform() form base
+   * class*/
   virtual const Amg::Transform3D& transform() const override;
 
-  /**Return method for surface center infromation, overwrites the center() form base class*/
+  /**Return method for surface center infromation, overwrites the center() form
+   * base class*/
   virtual const Amg::Vector3D& center() const override;
 
-  /**Return method for surface center infromation, overwrites the center() form base class*/
+  /**Return method for surface center infromation, overwrites the center() form
+   * base class*/
   virtual const Amg::Vector3D& normal() const override;
 
   /**Returns a normal vector at a specific localPosition*/
   virtual const Amg::Vector3D* normal(const Amg::Vector2D& lp) const override;
 
-  /** Return the measurement frame - this is needed for alignment, in particular for StraightLine and Perigee Surface
-      - the default implementation is the the RotationMatrix3D of the transform */
-  virtual Amg::RotationMatrix3D measurementFrame(const Amg::Vector3D& glopos,
-                                                       const Amg::Vector3D& glomom) const override;
+  /** Return the measurement frame - this is needed for alignment, in particular
+     for StraightLine and Perigee Surface
+      - the default implementation is the the RotationMatrix3D of the transform
+   */
+  virtual Amg::RotationMatrix3D measurementFrame(
+    const Amg::Vector3D& glopos,
+    const Amg::Vector3D& glomom) const override;
 
   /** Local to global method:
-      Take care that by just providing locR and locZ the global position cannot be calculated.
-      Therefor only the locZ-coordinate is taken and transformed into the global frame.
-      for calculating the global position, a momentum direction has to be provided as well, use the
-      appropriate function!
+      Take care that by just providing locR and locZ the global position cannot
+     be calculated. Therefor only the locZ-coordinate is taken and transformed
+     into the global frame. for calculating the global position, a momentum
+     direction has to be provided as well, use the appropriate function!
        */
-  virtual const Amg::Vector3D* localToGlobal(const LocalParameters& locpos) const;
+  virtual const Amg::Vector3D* localToGlobal(
+    const LocalParameters& locpos) const;
 
   /** This method is the true local->global transformation.<br>
       by providing a locR and locZ coordinate such as a GlobalMomentum
       the global position can be calculated.
-      The choice between the two possible canditates is done by the sign of the radius
+      The choice between the two possible canditates is done by the sign of the
+     radius
       */
-  virtual const Amg::Vector3D* localToGlobal(const LocalParameters& locpos, const Amg::Vector3D& glomom) const;
+  virtual const Amg::Vector3D* localToGlobal(const LocalParameters& locpos,
+                                             const Amg::Vector3D& glomom) const;
 
   /** LocalToGlobal method without dynamic memory allocation */
-  virtual void localToGlobal(const Amg::Vector2D& locp, const Amg::Vector3D& mom, Amg::Vector3D& glob) const override;
+  virtual void localToGlobal(const Amg::Vector2D& locp,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector3D& glob) const override;
 
-  /** GlobalToLocal method without dynamic memory allocation - boolean checks if on surface
-     \image html SignOfDriftCircleD0.gif
+  /** GlobalToLocal method without dynamic memory allocation - boolean checks if
+     on surface \image html SignOfDriftCircleD0.gif
   */
-  virtual bool globalToLocal(const Amg::Vector3D& glob, const Amg::Vector3D& mom, Amg::Vector2D& loc) const override;
+  virtual bool globalToLocal(const Amg::Vector3D& glob,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector2D& loc) const override;
 
-  /** fast straight line intersection schema - standard: provides closest intersection and (signed) path length
-      forceDir is to provide the closest forward solution
+  /** fast straight line intersection schema - standard: provides closest
+     intersection and (signed) path length forceDir is to provide the closest
+     forward solution
 
       b>mathematical motivation:</b>
       Given two lines in parameteric form:<br>
       - @f$ \vec l_{a}(\lambda) = \vec m_a + \lambda \cdot \vec e_{a} @f$ <br>
       - @f$ \vec l_{b}(\mu) = \vec m_b + \mu \cdot \vec e_{b} @f$ <br>
       the vector between any two points on the two lines is given by:
-      - @f$ \vec s(\lambda, \mu) = \vec l_{b} - l_{a} = \vec m_{ab} + \mu \cdot \vec e_{b} - \lambda \cdot \vec e_{a}
+      - @f$ \vec s(\lambda, \mu) = \vec l_{b} - l_{a} = \vec m_{ab} + \mu \cdot
+     \vec e_{b} - \lambda \cdot \vec e_{a}
      @f$, <br> when @f$ \vec m_{ab} = \vec m_{b} - \vec m_{a} @f$.<br>
-      @f$ \vec s(\lambda_0, \mu_0) @f$  denotes the vector between the two closest points <br>
-      @f$ \vec l_{a,0} = l_{a}(\lambda_0) @f$ and @f$ \vec l_{b,0} = l_{b}(\mu_0) @f$ <br>
-      and is perpenticular to both, @f$ \vec e_{a} @f$ and @f$ \vec e_{b} @f$.
+      @f$ \vec s(\lambda_0, \mu_0) @f$  denotes the vector between the two
+     closest points <br>
+      @f$ \vec l_{a,0} = l_{a}(\lambda_0) @f$ and @f$ \vec l_{b,0} =
+     l_{b}(\mu_0) @f$ <br> and is perpenticular to both, @f$ \vec e_{a} @f$ and
+     @f$ \vec e_{b} @f$.
 
       This results in a system of two linear equations:<br>
-      - (i) @f$ 0 = \vec s(\lambda_0, \mu_0) \cdot \vec e_a = \vec m_ab \cdot \vec e_a + \mu_0 \vec e_a \cdot \vec e_b -
-     \lambda_0 @f$ <br>
-      - (ii) @f$ 0 = \vec s(\lambda_0, \mu_0) \cdot \vec e_b = \vec m_ab \cdot \vec e_b + \mu_0  - \lambda_0 \vec e_b
-     \cdot \vec e_a @f$ <br>
+      - (i) @f$ 0 = \vec s(\lambda_0, \mu_0) \cdot \vec e_a = \vec m_ab \cdot
+     \vec e_a + \mu_0 \vec e_a \cdot \vec e_b - \lambda_0 @f$ <br>
+      - (ii) @f$ 0 = \vec s(\lambda_0, \mu_0) \cdot \vec e_b = \vec m_ab \cdot
+     \vec e_b + \mu_0  - \lambda_0 \vec e_b \cdot \vec e_a @f$ <br>
 
       Solving (i), (ii) for @f$ \lambda_0 @f$ and @f$ \mu_0 @f$ yields:
-      - @f$ \lambda_0 = \frac{(\vec m_ab \cdot \vec e_a)-(\vec m_ab \cdot \vec e_b)(\vec e_a \cdot \vec e_b)}{1-(\vec
-     e_a \cdot \vec e_b)^2} @f$ <br>
-      - @f$ \mu_0 = - \frac{(\vec m_ab \cdot \vec e_b)-(\vec m_ab \cdot \vec e_a)(\vec e_a \cdot \vec e_b)}{1-(\vec e_a
-     \cdot \vec e_b)^2} @f$ <br>
+      - @f$ \lambda_0 = \frac{(\vec m_ab \cdot \vec e_a)-(\vec m_ab \cdot \vec
+     e_b)(\vec e_a \cdot \vec e_b)}{1-(\vec e_a \cdot \vec e_b)^2} @f$ <br>
+      - @f$ \mu_0 = - \frac{(\vec m_ab \cdot \vec e_b)-(\vec m_ab \cdot \vec
+     e_a)(\vec e_a \cdot \vec e_b)}{1-(\vec e_a \cdot \vec e_b)^2} @f$ <br>
    */
-  virtual Intersection straightLineIntersection(const Amg::Vector3D& pos,
-                                                const Amg::Vector3D& dir,
-                                                bool forceDir = false,
-                                                Trk::BoundaryCheck bchk = false) const override;
+  virtual Intersection straightLineIntersection(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool forceDir = false,
+    Trk::BoundaryCheck bchk = false) const override;
 
   /** fast straight line distance evaluation to Surface */
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos,
-                                                        const Amg::Vector3D& dir) const override;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir) const override;
 
   /** fast straight line distance evaluation to Surface - with bound option*/
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos,
-                                                        const Amg::Vector3D& dir,
-                                                        bool Bound) const override;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool Bound) const override;
 
   /** the pathCorrection for derived classes with thickness */
-  virtual double pathCorrection(const Amg::Vector3D&, const Amg::Vector3D&) const override { return 1.; }
+  virtual double pathCorrection(const Amg::Vector3D&,
+                                const Amg::Vector3D&) const override;
 
   /**This method checks if a globalPosition in on the Surface or not*/
   virtual bool isOnSurface(const Amg::Vector3D& glopo,
@@ -225,126 +239,36 @@ public:
                            double tol2 = 0.) const override;
 
   /**This surface calls the iside method of the bounds*/
-  virtual bool insideBounds(const Amg::Vector2D& locpos, double tol1 = 0., double tol2 = 0.) const override;
-  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos, const BoundaryCheck& bchk) const override;
+  virtual bool insideBounds(const Amg::Vector2D& locpos,
+                            double tol1 = 0.,
+                            double tol2 = 0.) const override;
+
+  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos,
+                                 const BoundaryCheck& bchk) const override;
 
-  /** Special method for StraightLineSurface - provides the Line direction from cache: speedup */
+  /** Special method for StraightLineSurface - provides the Line direction from
+   * cache: speedup */
   const Amg::Vector3D& lineDirection() const;
 
   /** Return bounds() method */
   virtual const NoBounds& bounds() const override;
 
   /** Return properly formatted class name for screen output */
-  virtual std::string name() const override { return "Trk::PerigeeSurface"; }
+  virtual std::string name() const override;
 
   /** Output Method for MsgStream*/
   virtual MsgStream& dump(MsgStream& sl) const override;
   /** Output Method for std::ostream*/
   virtual std::ostream& dump(std::ostream& sl) const override;
 
-protected:                                                   //!< data members
-  CxxUtils::CachedUniquePtrT<Amg::Vector3D> m_lineDirection; //!< cache of the line direction (speeds up)
+protected:
+  //!< data members
+  //!< cache of the line direction (speeds up)
+  CxxUtils::CachedUniquePtrT<Amg::Vector3D> m_lineDirection;
   static const NoBounds s_perigeeBounds;
 };
 
-inline PerigeeSurface*
-PerigeeSurface::clone() const
-{
-  return new PerigeeSurface(*this);
-}
-
-inline const Amg::Transform3D&
-PerigeeSurface::transform() const
-{
-  if (!Surface::m_transform)
-    return (s_idTransform);
-  return (*Trk::Surface::m_transform);
-}
-
-inline const Amg::Vector3D&
-PerigeeSurface::center() const
-{
-  if (!Surface::m_center && !Surface::m_transform)
-    return (s_origin);
-  else if (!Surface::m_center)
-    m_center.set(std::make_unique<Amg::Vector3D>(m_transform->translation()));
-  return (*Surface::m_center);
-}
-
-inline const Amg::Vector3D&
-PerigeeSurface::normal() const
-{
-  return (s_xAxis);
-}
-
-inline const Amg::Vector3D*
-PerigeeSurface::normal(const Amg::Vector2D&) const
-{
-  return new Amg::Vector3D(this->normal());
-}
-
-inline bool
-PerigeeSurface::insideBounds(const Amg::Vector2D&, double, double) const
-{
-  return true;
-}
-
-inline bool
-PerigeeSurface::insideBoundsCheck(const Amg::Vector2D&, const BoundaryCheck&) const
-{
-  return true;
-}
-
-inline bool
-PerigeeSurface::isOnSurface(const Amg::Vector3D&, BoundaryCheck, double, double) const
-{
-  return true;
-}
-
-inline const NoBounds&
-PerigeeSurface::bounds() const
-{
-  return s_perigeeBounds;
-}
-
-inline Intersection
-PerigeeSurface::straightLineIntersection(const Amg::Vector3D& pos,
-                                         const Amg::Vector3D& dir,
-                                         bool forceDir,
-                                         Trk::BoundaryCheck) const
-{
-  // following nominclature found in header file and doxygen documentation
-  // line one is the straight track
-  const Amg::Vector3D& ma = pos;
-  const Amg::Vector3D& ea = dir;
-  // line two is the line surface
-  const Amg::Vector3D& mb = center();
-  const Amg::Vector3D& eb = lineDirection();
-  // now go ahead
-  Amg::Vector3D mab(mb - ma);
-  double eaTeb = ea.dot(eb);
-  double denom = 1 - eaTeb * eaTeb;
-  if (fabs(denom) > 10e-7) {
-    double lambda0 = (mab.dot(ea) - mab.dot(eb) * eaTeb) / denom;
-    // evaluate the direction, bounds are always true for Perigee
-    bool isValid = forceDir ? (lambda0 > 0.) : true;
-    return Trk::Intersection((ma + lambda0 * ea), lambda0, isValid);
-  }
-  return Trk::Intersection(pos, 0., false);
-}
-
-inline const Amg::Vector3D&
-PerigeeSurface::lineDirection() const
-{
-  if (m_lineDirection)
-    return (*m_lineDirection);
-  if (!m_lineDirection && Surface::m_transform) {
-    m_lineDirection.set(std::make_unique<Amg::Vector3D>(transform().rotation().col(2)));
-    return (*m_lineDirection);
-  }
-  return Trk::s_zAxis;
-}
-
 } // end of namespace
+#include "TrkSurfaces/PerigeeSurface.icc"
 
 #endif // TRKSURFACES_PERIGEESURFACE_H
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.icc
new file mode 100644
index 0000000000000000000000000000000000000000..b99a5a947410ae0e659695c344c05caa5de7a62a
--- /dev/null
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.icc
@@ -0,0 +1,207 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+namespace Trk {
+/** Use the Surface as a ParametersBase constructor, from local parameters -
+ * charged */
+inline ParametersT<5, Charged, PerigeeSurface>*
+PerigeeSurface::createTrackParameters(double l1,
+                                      double l2,
+                                      double phi,
+                                      double theta,
+                                      double qop,
+                                      AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Charged, PerigeeSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters -
+ * charged*/
+inline ParametersT<5, Charged, PerigeeSurface>*
+PerigeeSurface::createTrackParameters(const Amg::Vector3D& position,
+                                      const Amg::Vector3D& momentum,
+                                      double charge,
+                                      AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Charged, PerigeeSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters -
+ * neutral */
+inline ParametersT<5, Neutral, PerigeeSurface>*
+PerigeeSurface::createNeutralParameters(double l1,
+                                        double l2,
+                                        double phi,
+                                        double theta,
+                                        double qop,
+                                        AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Neutral, PerigeeSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters -
+ * neutral */
+inline ParametersT<5, Neutral, PerigeeSurface>*
+PerigeeSurface::createNeutralParameters(const Amg::Vector3D& position,
+                                        const Amg::Vector3D& momentum,
+                                        double charge,
+                                        AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Neutral, PerigeeSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters */
+template<int DIM, class T>
+ParametersT<DIM, T, PerigeeSurface>*
+PerigeeSurface::createParameters(double l1,
+                                 double l2,
+                                 double phi,
+                                 double theta,
+                                 double qop,
+                                 AmgSymMatrix(DIM) * cov) const
+{
+  return new ParametersT<DIM, T, PerigeeSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters */
+template<int DIM, class T>
+ParametersT<DIM, T, PerigeeSurface>*
+PerigeeSurface::createParameters(const Amg::Vector3D& position,
+                                 const Amg::Vector3D& momentum,
+                                 double charge,
+                                 AmgSymMatrix(DIM) * cov) const
+{
+  return new ParametersT<DIM, T, PerigeeSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Return the surface type */
+inline Surface::SurfaceType
+PerigeeSurface::type() const
+{
+  return Surface::Perigee;
+}
+
+inline PerigeeSurface*
+PerigeeSurface::clone() const
+{
+  return new PerigeeSurface(*this);
+}
+
+inline const Amg::Transform3D&
+PerigeeSurface::transform() const
+{
+  if (!Surface::m_transform)
+    return (s_idTransform);
+  return (*Trk::Surface::m_transform);
+}
+
+inline const Amg::Vector3D&
+PerigeeSurface::center() const
+{
+  if (!Surface::m_center && !Surface::m_transform)
+    return (s_origin);
+  else if (!Surface::m_center)
+    m_center.set(std::make_unique<Amg::Vector3D>(m_transform->translation()));
+  return (*Surface::m_center);
+}
+
+inline const Amg::Vector3D&
+PerigeeSurface::normal() const
+{
+  return (s_xAxis);
+}
+
+inline const Amg::Vector3D*
+PerigeeSurface::normal(const Amg::Vector2D&) const
+{
+  return new Amg::Vector3D(this->normal());
+}
+
+inline bool
+PerigeeSurface::insideBounds(const Amg::Vector2D&, double, double) const
+{
+  return true;
+}
+
+inline bool
+PerigeeSurface::insideBoundsCheck(const Amg::Vector2D&,
+                                  const BoundaryCheck&) const
+{
+  return true;
+}
+
+inline bool
+PerigeeSurface::isOnSurface(const Amg::Vector3D&,
+                            BoundaryCheck,
+                            double,
+                            double) const
+{
+  return true;
+}
+
+inline const NoBounds&
+PerigeeSurface::bounds() const
+{
+  return s_perigeeBounds;
+}
+
+inline Intersection
+PerigeeSurface::straightLineIntersection(const Amg::Vector3D& pos,
+                                         const Amg::Vector3D& dir,
+                                         bool forceDir,
+                                         Trk::BoundaryCheck) const
+{
+  // following nominclature found in header file and doxygen documentation
+  // line one is the straight track
+  const Amg::Vector3D& ma = pos;
+  const Amg::Vector3D& ea = dir;
+  // line two is the line surface
+  const Amg::Vector3D& mb = center();
+  const Amg::Vector3D& eb = lineDirection();
+  // now go ahead
+  Amg::Vector3D mab(mb - ma);
+  double eaTeb = ea.dot(eb);
+  double denom = 1 - eaTeb * eaTeb;
+  if (fabs(denom) > 10e-7) {
+    double lambda0 = (mab.dot(ea) - mab.dot(eb) * eaTeb) / denom;
+    // evaluate the direction, bounds are always true for Perigee
+    bool isValid = forceDir ? (lambda0 > 0.) : true;
+    return Trk::Intersection((ma + lambda0 * ea), lambda0, isValid);
+  }
+  return Trk::Intersection(pos, 0., false);
+}
+
+inline const Amg::Vector3D&
+PerigeeSurface::lineDirection() const
+{
+  if (m_lineDirection)
+    return (*m_lineDirection);
+  if (!m_lineDirection && Surface::m_transform) {
+    m_lineDirection.set(
+      std::make_unique<Amg::Vector3D>(transform().rotation().col(2)));
+    return (*m_lineDirection);
+  }
+  return Trk::s_zAxis;
+}
+/** the pathCorrection for derived classes with thickness */
+inline double
+PerigeeSurface::pathCorrection(const Amg::Vector3D&, const Amg::Vector3D&) const
+{
+  return 1.;
+}
+
+/** Return properly formatted class name for screen output */
+inline std::string
+PerigeeSurface::name() const
+{
+  return "Trk::PerigeeSurface";
+}
+
+}
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.h
index fb4bcb6908278517b67dfe2567a7fe1e13659560..654769b334bcf1b2901858035794604e1c886b0c 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.h
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -46,9 +46,10 @@ class ParametersT;
  It inherits from Surface.
 
  The Trk::PlaneSurface extends the Surface class with the possibility to convert
- in addition to local to global positions, also local to global direction (vice versa).
- The definition with of a local direciton with respect to a plane can be found in
- the dedicated Trk::LocalDirection class of the TrkEventPrimitives package.
+ in addition to local to global positions, also local to global direction (vice
+ versa). The definition with of a local direciton with respect to a plane can be
+ found in the dedicated Trk::LocalDirection class of the TrkEventPrimitives
+ package.
 
  @image html PlaneSurface.gif
 
@@ -71,10 +72,14 @@ public:
   PlaneSurface(const Amg::Vector3D& position, const CurvilinearUVT& curvUVT);
 
   /** Constructor from TrkDetElementBase*/
-  PlaneSurface(const TrkDetElementBase& detelement, Amg::Transform3D* transf = nullptr);
+  PlaneSurface(const TrkDetElementBase& detelement,
+               Amg::Transform3D* transf = nullptr);
 
-  /** Constructor from TrkDetElementBase and Identifier in case one element holds more surfaces*/
-  PlaneSurface(const TrkDetElementBase& detelement, const Identifier& id, Amg::Transform3D* transf = nullptr);
+  /** Constructor from TrkDetElementBase and Identifier in case one element
+   * holds more surfaces*/
+  PlaneSurface(const TrkDetElementBase& detelement,
+               const Identifier& id,
+               Amg::Transform3D* transf = nullptr);
 
   /** Constructor for planar Surface without Bounds */
   PlaneSurface(Amg::Transform3D* htrans);
@@ -86,31 +91,42 @@ public:
   PlaneSurface(Amg::Transform3D* htrans, double halephi, double haleta);
 
   /** Constructor for Trapezoidal Planes*/
-  PlaneSurface(Amg::Transform3D* htrans, double minhalephi, double maxhalephi, double haleta);
+  PlaneSurface(Amg::Transform3D* htrans,
+               double minhalephi,
+               double maxhalephi,
+               double haleta);
 
-  /** Constructor for Planes with provided RectangleBounds - ownership of bounds is passed*/
+  /** Constructor for Planes with provided RectangleBounds - ownership of bounds
+   * is passed*/
   PlaneSurface(Amg::Transform3D* htrans, RectangleBounds* rbounds);
 
-  /** Constructor for Planes with provided TriangleBounds - ownership of bounds is passed*/
+  /** Constructor for Planes with provided TriangleBounds - ownership of bounds
+   * is passed*/
   PlaneSurface(Amg::Transform3D* htrans, TriangleBounds* rbounds);
 
-  /** Constructor for Planes with provided AnnulusBounds - ownership of bounds is passed*/
+  /** Constructor for Planes with provided AnnulusBounds - ownership of bounds
+   * is passed*/
   PlaneSurface(Amg::Transform3D* htrans, AnnulusBounds* rbounds);
 
-  /** Constructor for Planes with provided TrapezoidBounds - ownership of bounds is passed*/
+  /** Constructor for Planes with provided TrapezoidBounds - ownership of bounds
+   * is passed*/
   PlaneSurface(Amg::Transform3D* htrans, TrapezoidBounds* rbounds);
 
-  /** Constructor for Planes with provided RotatedTrapezoidBounds - ownership of bounds is passed*/
+  /** Constructor for Planes with provided RotatedTrapezoidBounds - ownership of
+   * bounds is passed*/
   PlaneSurface(Amg::Transform3D* htrans, RotatedTrapezoidBounds* rbounds);
 
-  /** Constructor for Planes with provided DiamondBounds - ownership of bounds is passed*/
+  /** Constructor for Planes with provided DiamondBounds - ownership of bounds
+   * is passed*/
   PlaneSurface(Amg::Transform3D* htrans, DiamondBounds* rbounds);
 
-  /** Constructor for Planes with provided EllipseBounds - ownership of bounds is passed*/
+  /** Constructor for Planes with provided EllipseBounds - ownership of bounds
+   * is passed*/
   PlaneSurface(Amg::Transform3D* htrans, EllipseBounds* rbounds);
 
   /** Constructor for Planes with shared object*/
-  PlaneSurface(Amg::Transform3D* htrans, Trk::SharedObject<const Trk::SurfaceBounds>& sbounds);
+  PlaneSurface(Amg::Transform3D* htrans,
+               Trk::SharedObject<const Trk::SurfaceBounds>& sbounds);
 
   /**Destructor*/
   virtual ~PlaneSurface();
@@ -125,47 +141,43 @@ public:
   virtual PlaneSurface* clone() const override;
 
   /** Return the surface type */
-  virtual SurfaceType type() const override { return Surface::Plane; }
-
-  /** Use the Surface as a ParametersBase constructor, from local parameters - charged */
-  virtual ParametersT<5, Charged, PlaneSurface>* createTrackParameters(double l1,
-                                                                       double l2,
-                                                                       double phi,
-                                                                       double theta,
-                                                                       double qop,
-                                                                       AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Charged, PlaneSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - charged*/
-  virtual ParametersT<5, Charged, PlaneSurface>* createTrackParameters(const Amg::Vector3D& position,
-                                                                       const Amg::Vector3D& momentum,
-                                                                       double charge,
-                                                                       AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Charged, PlaneSurface>(position, momentum, charge, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from local parameters - neutral */
-  virtual ParametersT<5, Neutral, PlaneSurface>* createNeutralParameters(double l1,
-                                                                         double l2,
-                                                                         double phi,
-                                                                         double theta,
-                                                                         double oop,
-                                                                         AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Neutral, PlaneSurface>(l1, l2, phi, theta, oop, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - neutral */
-  virtual ParametersT<5, Neutral, PlaneSurface>* createNeutralParameters(const Amg::Vector3D& position,
-                                                                         const Amg::Vector3D& momentum,
-                                                                         double charge = 0.,
-                                                                         AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Neutral, PlaneSurface>(position, momentum, charge, *this, cov);
-  }
+  virtual SurfaceType type() const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * charged */
+  virtual ParametersT<5, Charged, PlaneSurface>* createTrackParameters(
+    double l1,
+    double l2,
+    double phi,
+    double theta,
+    double qop,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters -
+   * charged*/
+  virtual ParametersT<5, Charged, PlaneSurface>* createTrackParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * neutral */
+  virtual ParametersT<5, Neutral, PlaneSurface>* createNeutralParameters(
+    double l1,
+    double l2,
+    double phi,
+    double theta,
+    double oop,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters
+   * - neutral */
+  virtual ParametersT<5, Neutral, PlaneSurface>* createNeutralParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge = 0.,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
 
   /** Use the Surface as a ParametersBase constructor, from local parameters */
   template<int DIM, class T>
@@ -174,59 +186,73 @@ public:
                                                       double phi,
                                                       double theta,
                                                       double qop,
-                                                      AmgSymMatrix(DIM) * cov = 0) const
-  {
-    return new ParametersT<DIM, T, PlaneSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
+                                                      AmgSymMatrix(DIM) *
+                                                        cov = 0) const;
 
   /** Use the Surface as a ParametersBase constructor, from global parameters */
   template<int DIM, class T>
-  ParametersT<DIM, T, PlaneSurface>* createParameters(const Amg::Vector3D& position,
-                                                      const Amg::Vector3D& momentum,
-                                                      double charge,
-                                                      AmgSymMatrix(DIM) * cov = 0) const
-  {
-    return new ParametersT<DIM, T, PlaneSurface>(position, momentum, charge, *this, cov);
-  }
-
-  /**This method returns the bounds by reference, static NoBounds in case of no boundaries*/
+  ParametersT<DIM, T, PlaneSurface>* createParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(DIM) * cov = 0) const;
+
+  /**This method returns the bounds by reference, static NoBounds in case of no
+   * boundaries*/
   virtual const SurfaceBounds& bounds() const override;
 
   /**This method calls the inside() method of the Bounds*/
-  virtual bool insideBounds(const Amg::Vector2D& locpos, double tol1 = 0., double tol2 = 0.) const override;
+  virtual bool insideBounds(const Amg::Vector2D& locpos,
+                            double tol1 = 0.,
+                            double tol2 = 0.) const override;
 
-  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos, const BoundaryCheck& bchk) const override;
+  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos,
+                                 const BoundaryCheck& bchk) const override;
 
-  /** This method returns true if the GlobalPosition is on the Surface for both, within
-    or without check of whether the local position is inside boundaries or not */
+  /** This method returns true if the GlobalPosition is on the Surface for both,
+    within or without check of whether the local position is inside boundaries
+    or not */
   virtual bool isOnSurface(const Amg::Vector3D& glopo,
                            BoundaryCheck bchk = true,
                            double tol1 = 0.,
                            double tol2 = 0.) const override;
 
-  /** Specified for PlaneSurface: LocalToGlobal method without dynamic memory allocation */
-  virtual void localToGlobal(const Amg::Vector2D& locp, const Amg::Vector3D& mom, Amg::Vector3D& glob) const override;
+  /** Specified for PlaneSurface: LocalToGlobal method without dynamic memory
+   * allocation */
+  virtual void localToGlobal(const Amg::Vector2D& locp,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector3D& glob) const override;
 
-  /** Specified for PlaneSurface: GlobalToLocal method without dynamic memory allocation - boolean checks if on surface
+  /** Specified for PlaneSurface: GlobalToLocal method without dynamic memory
+   * allocation - boolean checks if on surface
    */
-  virtual bool globalToLocal(const Amg::Vector3D& glob, const Amg::Vector3D& mom, Amg::Vector2D& loc) const override;
+  virtual bool globalToLocal(const Amg::Vector3D& glob,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector2D& loc) const override;
 
-  /** This method transforms a local direction wrt the plane to a global direction */
-  void localToGlobalDirection(const Trk::LocalDirection& locdir, Amg::Vector3D& globdir) const;
+  /** This method transforms a local direction wrt the plane to a global
+   * direction */
+  void localToGlobalDirection(const Trk::LocalDirection& locdir,
+                              Amg::Vector3D& globdir) const;
 
-  /**This method transforms the global direction to a local direction wrt the plane */
-  void globalToLocalDirection(const Amg::Vector3D& glodir, Trk::LocalDirection& locdir) const;
+  /**This method transforms the global direction to a local direction wrt the
+   * plane */
+  void globalToLocalDirection(const Amg::Vector3D& glodir,
+                              Trk::LocalDirection& locdir) const;
 
-  /** fast straight line intersection schema - standard: provides closest intersection and (signed) path length
-      forceDir is to provide the closest forward solution
+  /** fast straight line intersection schema - standard: provides closest
+     intersection and (signed) path length forceDir is to provide the closest
+     forward solution
 
       <b>mathematical motivation:</b>
 
       the equation of the plane is given by: <br>
       @f$ \vec n \cdot \vec x = \vec n \cdot \vec p,@f$ <br>
-      where @f$ \vec n = (n_{x}, n_{y}, n_{z})@f$ denotes the normal vector of the plane,
-      @f$ \vec p = (p_{x}, p_{y}, p_{z})@f$ one specific point on the plane and @f$ \vec x = (x,y,z) @f$ all possible
-     points on the plane.<br> Given a line with:<br>
+      where @f$ \vec n = (n_{x}, n_{y}, n_{z})@f$ denotes the normal vector of
+     the plane,
+      @f$ \vec p = (p_{x}, p_{y}, p_{z})@f$ one specific point on the plane and
+     @f$ \vec x = (x,y,z) @f$ all possible points on the plane.<br> Given a line
+     with:<br>
       @f$ \vec l(u) = \vec l_{1} + u \cdot \vec v @f$, <br>
       the solution for @f$ u @f$ can be written:
       @f$ u = \frac{\vec n (\vec p - \vec l_{1})}{\vec n \vec v}@f$ <br>
@@ -235,82 +261,36 @@ public:
       - perpenticular to the normal of the plane
 
    */
-  virtual Intersection straightLineIntersection(const Amg::Vector3D& pos,
-                                                const Amg::Vector3D& dir,
-                                                bool forceDir,
-                                                Trk::BoundaryCheck bchk) const override;
+  virtual Intersection straightLineIntersection(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool forceDir,
+    Trk::BoundaryCheck bchk) const override;
 
   /** fast straight line distance evaluation to Surface */
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos,
-                                                        const Amg::Vector3D& dir) const override;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir) const override;
 
   /** fast straight line distance evaluation to Surface - with bound option*/
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos,
-                                                        const Amg::Vector3D& dir,
-                                                        bool Bound) const override;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool Bound) const override;
 
   /** Return properly formatted class name for screen output */
-  virtual std::string name() const override { return "Trk::PlaneSurface"; }
+  virtual std::string name() const override ;
 
 protected: //!< data members
   template<class SURFACE, class BOUNDS_CNV>
   friend class ::BoundSurfaceCnv_p1;
 
   SharedObject<const SurfaceBounds> m_bounds; //!< bounds (shared)
-  static const NoBounds s_boundless;          //!< NoBounds as return object when no bounds are declared
+  //!< NoBounds as return object when no bounds are declared
+  static const NoBounds s_boundless;
 };
 
-inline PlaneSurface*
-PlaneSurface::clone() const
-{
-  return new PlaneSurface(*this);
-}
-
-inline bool
-PlaneSurface::insideBounds(const Amg::Vector2D& locpos, double tol1, double tol2) const
-{
-  return (bounds().inside(locpos, tol1, tol2));
-}
-
-inline bool
-PlaneSurface::insideBoundsCheck(const Amg::Vector2D& locpos, const BoundaryCheck& bchk) const
-{
-  return (bounds().inside(locpos, bchk));
-}
-
-inline const SurfaceBounds&
-PlaneSurface::bounds() const
-{
-  if (m_bounds.get())
-    return *(m_bounds.get());
-  if (Surface::m_associatedDetElement && Surface::m_associatedDetElementId.is_valid()) {
-    return m_associatedDetElement->bounds(Surface::m_associatedDetElementId);
-  }
-  if (Surface::m_associatedDetElement)
-    return m_associatedDetElement->bounds();
-  return s_boundless;
-}
-
-inline Intersection
-PlaneSurface::straightLineIntersection(const Amg::Vector3D& pos,
-                                       const Amg::Vector3D& dir,
-                                       bool forceDir,
-                                       Trk::BoundaryCheck bchk) const
-{
-  double denom = dir.dot(normal());
-  if (denom) {
-    double u = (normal().dot((center() - pos))) / (denom);
-    Amg::Vector3D intersectPoint(pos + u * dir);
-    // evaluate the intersection in terms of direction
-    bool isValid = forceDir ? (u > 0.) : true;
-    // evaluate (if necessary in terms of boundaries)
-    isValid = bchk ? (isValid && isOnSurface(intersectPoint)) : isValid;
-    // return the result
-    return Trk::Intersection(intersectPoint, u, isValid);
-  }
-  return Trk::Intersection(pos, 0., false);
-}
-
 } // end of namespace
 
+#include "TrkSurfaces/PlaneSurface.icc"
 #endif // TRKSURFACES_PLANESURFACE_H
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.icc
new file mode 100644
index 0000000000000000000000000000000000000000..0a11027762d4a6b8abba6315ac70d1b7ac7de172
--- /dev/null
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.icc
@@ -0,0 +1,151 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+namespace Trk {
+
+inline Surface::SurfaceType
+PlaneSurface::type() const
+{
+  return Surface::Plane;
+}
+/** Use the Surface as a ParametersBase constructor, from local parameters -
+ * charged */
+inline ParametersT<5, Charged, PlaneSurface>*
+PlaneSurface::createTrackParameters(double l1,
+                                    double l2,
+                                    double phi,
+                                    double theta,
+                                    double qop,
+                                    AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Charged, PlaneSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters -
+ * charged*/
+inline ParametersT<5, Charged, PlaneSurface>*
+PlaneSurface::createTrackParameters(const Amg::Vector3D& position,
+                                    const Amg::Vector3D& momentum,
+                                    double charge,
+                                    AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Charged, PlaneSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters -
+ * neutral */
+inline ParametersT<5, Neutral, PlaneSurface>*
+PlaneSurface::createNeutralParameters(double l1,
+                                      double l2,
+                                      double phi,
+                                      double theta,
+                                      double oop,
+                                      AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Neutral, PlaneSurface>(
+    l1, l2, phi, theta, oop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters -
+ * neutral */
+inline ParametersT<5, Neutral, PlaneSurface>*
+PlaneSurface::createNeutralParameters(const Amg::Vector3D& position,
+                                      const Amg::Vector3D& momentum,
+                                      double charge,
+                                      AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Neutral, PlaneSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters */
+template<int DIM, class T>
+ParametersT<DIM, T, PlaneSurface>*
+PlaneSurface::createParameters(double l1,
+                               double l2,
+                               double phi,
+                               double theta,
+                               double qop,
+                               AmgSymMatrix(DIM) * cov) const
+{
+  return new ParametersT<DIM, T, PlaneSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters */
+template<int DIM, class T>
+ParametersT<DIM, T, PlaneSurface>*
+PlaneSurface::createParameters(const Amg::Vector3D& position,
+                               const Amg::Vector3D& momentum,
+                               double charge,
+                               AmgSymMatrix(DIM) * cov) const
+{
+  return new ParametersT<DIM, T, PlaneSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Return properly formatted class name for screen output */
+inline std::string
+PlaneSurface::name() const
+{
+  return "Trk::PlaneSurface";
+}
+
+inline PlaneSurface*
+PlaneSurface::clone() const
+{
+  return new PlaneSurface(*this);
+}
+
+inline bool
+PlaneSurface::insideBounds(const Amg::Vector2D& locpos,
+                           double tol1,
+                           double tol2) const
+{
+  return (bounds().inside(locpos, tol1, tol2));
+}
+
+inline bool
+PlaneSurface::insideBoundsCheck(const Amg::Vector2D& locpos,
+                                const BoundaryCheck& bchk) const
+{
+  return (bounds().inside(locpos, bchk));
+}
+
+inline const SurfaceBounds&
+PlaneSurface::bounds() const
+{
+  if (m_bounds.get())
+    return *(m_bounds.get());
+  if (Surface::m_associatedDetElement &&
+      Surface::m_associatedDetElementId.is_valid()) {
+    return m_associatedDetElement->bounds(Surface::m_associatedDetElementId);
+  }
+  if (Surface::m_associatedDetElement)
+    return m_associatedDetElement->bounds();
+  return s_boundless;
+}
+
+inline Intersection
+PlaneSurface::straightLineIntersection(const Amg::Vector3D& pos,
+                                       const Amg::Vector3D& dir,
+                                       bool forceDir,
+                                       Trk::BoundaryCheck bchk) const
+{
+  double denom = dir.dot(normal());
+  if (denom) {
+    double u = (normal().dot((center() - pos))) / (denom);
+    Amg::Vector3D intersectPoint(pos + u * dir);
+    // evaluate the intersection in terms of direction
+    bool isValid = forceDir ? (u > 0.) : true;
+    // evaluate (if necessary in terms of boundaries)
+    isValid = bchk ? (isValid && isOnSurface(intersectPoint)) : isValid;
+    // return the result
+    return Trk::Intersection(intersectPoint, u, isValid);
+  }
+  return Trk::Intersection(pos, 0., false);
+}
+}
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.h
index 03444b84efdd642d12ebe074a4735edc0f647665..186d74f18d8c0cf4fe10e4133f48da48c6387703 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.h
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /////////////////////////////////////////////////////////////////
@@ -58,13 +58,15 @@ public:
   StraightLineSurface(Amg::Transform3D* htrans, double radius, double halez);
 
   /**Constructor from TrkDetElementBase and Element identifier*/
-  StraightLineSurface(const TrkDetElementBase& detelement, const Identifier& id);
+  StraightLineSurface(const TrkDetElementBase& detelement,
+                      const Identifier& id);
 
   /**Copy constructor*/
   StraightLineSurface(const StraightLineSurface& slsf);
 
   /**Copy constructor with shift*/
-  StraightLineSurface(const StraightLineSurface& slsf, const Amg::Transform3D& transf);
+  StraightLineSurface(const StraightLineSurface& slsf,
+                      const Amg::Transform3D& transf);
 
   /**Destructor*/
   virtual ~StraightLineSurface();
@@ -78,45 +80,41 @@ public:
   /**Implicit constructor*/
   virtual StraightLineSurface* clone() const override;
 
-  /** Use the Surface as a ParametersBase constructor, from local parameters - charged */
-  virtual ParametersT<5, Charged, StraightLineSurface>* createTrackParameters(double l1,
-                                                                              double l2,
-                                                                              double phi,
-                                                                              double theta,
-                                                                              double qop,
-                                                                              AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Charged, StraightLineSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - charged*/
-  virtual ParametersT<5, Charged, StraightLineSurface>* createTrackParameters(const Amg::Vector3D& position,
-                                                                              const Amg::Vector3D& momentum,
-                                                                              double charge,
-                                                                              AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Charged, StraightLineSurface>(position, momentum, charge, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from local parameters - neutral */
-  virtual ParametersT<5, Neutral, StraightLineSurface>* createNeutralParameters(double l1,
-                                                                                double l2,
-                                                                                double phi,
-                                                                                double theta,
-                                                                                double qop,
-                                                                                AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Neutral, StraightLineSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - neutral */
-  virtual ParametersT<5, Neutral, StraightLineSurface>* createNeutralParameters(const Amg::Vector3D& position,
-                                                                                const Amg::Vector3D& momentum,
-                                                                                double charge,
-                                                                                AmgSymMatrix(5) * cov = nullptr) const override
-  {
-    return new ParametersT<5, Neutral, StraightLineSurface>(position, momentum, charge, *this, cov);
-  }
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * charged */
+  virtual ParametersT<5, Charged, StraightLineSurface>* createTrackParameters(
+    double l1,
+    double l2,
+    double phi,
+    double theta,
+    double qop,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters -
+   * charged*/
+  virtual ParametersT<5, Charged, StraightLineSurface>* createTrackParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * neutral */
+  virtual ParametersT<5, Neutral, StraightLineSurface>* createNeutralParameters(
+    double l1,
+    double l2,
+    double phi,
+    double theta,
+    double qop,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters -
+   * neutral */
+  virtual ParametersT<5, Neutral, StraightLineSurface>* createNeutralParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(5) * cov = nullptr) const override final;
 
   /** Use the Surface as a ParametersBase constructor, from local parameters */
   template<int DIM, class T>
@@ -125,105 +123,123 @@ public:
                                                              double phi,
                                                              double theta,
                                                              double qop,
-                                                             AmgSymMatrix(DIM) * cov = 0) const
-  {
-    return new ParametersT<DIM, T, StraightLineSurface>(l1, l2, phi, theta, qop, *this, cov);
-  }
+                                                             AmgSymMatrix(DIM) *
+                                                               cov = 0) const;
 
   /** Use the Surface as a ParametersBase constructor, from global parameters */
   template<int DIM, class T>
-  ParametersT<DIM, T, StraightLineSurface>* createParameters(const Amg::Vector3D& position,
-                                                             const Amg::Vector3D& momentum,
-                                                             double charge,
-                                                             AmgSymMatrix(DIM) * cov = 0) const
-  {
-    return new ParametersT<DIM, T, StraightLineSurface>(position, momentum, charge, *this, cov);
-  }
-
-  /** Return the measurement frame - this is needed for alignment, in particular for StraightLine and Perigee Surface
-      - the default implementation is the the RotationMatrix3D of the transform */
-  virtual Amg::RotationMatrix3D measurementFrame(const Amg::Vector3D& glopos,
-                                                       const Amg::Vector3D& glomom) const override;
+  ParametersT<DIM, T, StraightLineSurface>* createParameters(
+    const Amg::Vector3D& position,
+    const Amg::Vector3D& momentum,
+    double charge,
+    AmgSymMatrix(DIM) * cov = 0) const;
+
+  /** Return the measurement frame - this is needed for alignment, in particular
+     for StraightLine and Perigee Surface
+      - the default implementation is the the RotationMatrix3D of the transform
+   */
+  virtual Amg::RotationMatrix3D measurementFrame(
+    const Amg::Vector3D& glopos,
+    const Amg::Vector3D& glomom) const override;
 
   /** Return the surface type */
-  virtual SurfaceType type() const override { return Surface::Line; }
-
-  /** Specified for StraightLineSurface: LocalToGlobal method without dynamic memory allocation */
-  virtual void localToGlobal(const Amg::Vector2D& locp, const Amg::Vector3D& mom, Amg::Vector3D& glob) const override;
-
-  /** Specified for StraightLineSurface: GlobalToLocal method without dynamic memory allocation
-    This method is the true global->local transformation.<br>
-    makes use of globalToLocal and indicates the sign of the locR by the given momentum
-
-    The calculation of the sign of the radius (or \f$ d_0 \f$) can be done as follows:<br>
-    May \f$ \vec d = \vec m - \vec c \f$ denote the difference between the center of the line and
-    the global position of the measurement/predicted state, then \f$ \vec d \f$ lies within the so
-    called measurement plane.
-    The measurement plane is determined by the two orthogonal vectors \f$ \vec{measY}= \vec{locZ} \f$
-    and \f$ \vec{measX} = \vec{measY} \times \frac{\vec{p}}{|\vec{p}|} \f$.<br>
-
-    The sign of the radius (\f$ d_{0} \f$ ) is then defined by the projection of \f$ \vec{d} \f$
-    onto \f$ \vec{measX} \f$:<br>
-    \f$ sign = -sign(\vec{d} \cdot \vec{measX}) \f$
+  virtual SurfaceType type() const override final;
+
+  /** Specified for StraightLineSurface: LocalToGlobal method without dynamic
+   * memory allocation */
+  virtual void localToGlobal(const Amg::Vector2D& locp,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector3D& glob) const override;
+
+  /** Specified for StraightLineSurface: GlobalToLocal method without dynamic
+    memory allocation This method is the true global->local transformation.<br>
+    makes use of globalToLocal and indicates the sign of the locR by the given
+    momentum
+
+    The calculation of the sign of the radius (or \f$ d_0 \f$) can be done as
+    follows:<br> May \f$ \vec d = \vec m - \vec c \f$ denote the difference
+    between the center of the line and the global position of the
+    measurement/predicted state, then \f$ \vec d \f$ lies within the so called
+    measurement plane. The measurement plane is determined by the two orthogonal
+    vectors \f$ \vec{measY}= \vec{locZ} \f$ and \f$ \vec{measX} = \vec{measY}
+    \times \frac{\vec{p}}{|\vec{p}|} \f$.<br>
+
+    The sign of the radius (\f$ d_{0} \f$ ) is then defined by the projection of
+    \f$ \vec{d} \f$ onto \f$ \vec{measX} \f$:<br> \f$ sign = -sign(\vec{d} \cdot
+    \vec{measX}) \f$
 
     \image html SignOfDriftCircleD0.gif
   */
-  virtual bool globalToLocal(const Amg::Vector3D& glob, const Amg::Vector3D& mom, Amg::Vector2D& loc) const override;
+  virtual bool globalToLocal(const Amg::Vector3D& glob,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector2D& loc) const override;
 
-  /** Special method for StraightLineSurface - providing a different z estimate */
-  virtual const Amg::Vector3D* localToGlobal(const Trk::LocalParameters& locpars,
-                                             const Amg::Vector3D& glomom,
-                                             double locZ) const;
+  /** Special method for StraightLineSurface - providing a different z estimate
+   */
+  virtual const Amg::Vector3D* localToGlobal(
+    const Trk::LocalParameters& locpars,
+    const Amg::Vector3D& glomom,
+    double locZ) const;
 
-  /** Special method for StraightLineSurface - provides the Line direction from cache: speedup */
+  /** Special method for StraightLineSurface - provides the Line direction from
+   * cache: speedup */
   const Amg::Vector3D& lineDirection() const;
 
-  /** fast straight line intersection schema - standard: provides closest intersection and (signed) path length
-      forceDir is to provide the closest forward solution
+  /** fast straight line intersection schema - standard: provides closest
+     intersection and (signed) path length forceDir is to provide the closest
+     forward solution
 
       b>mathematical motivation:</b>
       Given two lines in parameteric form:<br>
       - @f$ \vec l_{a}(\lambda) = \vec m_a + \lambda \cdot \vec e_{a} @f$ <br>
       - @f$ \vec l_{b}(\mu) = \vec m_b + \mu \cdot \vec e_{b} @f$ <br>
       the vector between any two points on the two lines is given by:
-      - @f$ \vec s(\lambda, \mu) = \vec l_{b} - l_{a} = \vec m_{ab} + \mu \cdot \vec e_{b} - \lambda \cdot \vec e_{a}
+      - @f$ \vec s(\lambda, \mu) = \vec l_{b} - l_{a} = \vec m_{ab} + \mu \cdot
+     \vec e_{b} - \lambda \cdot \vec e_{a}
      @f$, <br> when @f$ \vec m_{ab} = \vec m_{b} - \vec m_{a} @f$.<br>
-      @f$ \vec s(\lambda_0, \mu_0) @f$  denotes the vector between the two closest points <br>
-      @f$ \vec l_{a,0} = l_{a}(\lambda_0) @f$ and @f$ \vec l_{b,0} = l_{b}(\mu_0) @f$ <br>
-      and is perpenticular to both, @f$ \vec e_{a} @f$ and @f$ \vec e_{b} @f$.
+      @f$ \vec s(\lambda_0, \mu_0) @f$  denotes the vector between the two
+     closest points <br>
+      @f$ \vec l_{a,0} = l_{a}(\lambda_0) @f$ and @f$ \vec l_{b,0} =
+     l_{b}(\mu_0) @f$ <br> and is perpenticular to both, @f$ \vec e_{a} @f$ and
+     @f$ \vec e_{b} @f$.
 
       This results in a system of two linear equations:<br>
-      - (i) @f$ 0 = \vec s(\lambda_0, \mu_0) \cdot \vec e_a = \vec m_ab \cdot \vec e_a + \mu_0 \vec e_a \cdot \vec e_b -
-     \lambda_0 @f$ <br>
-      - (ii) @f$ 0 = \vec s(\lambda_0, \mu_0) \cdot \vec e_b = \vec m_ab \cdot \vec e_b + \mu_0  - \lambda_0 \vec e_b
-     \cdot \vec e_a @f$ <br>
+      - (i) @f$ 0 = \vec s(\lambda_0, \mu_0) \cdot \vec e_a = \vec m_ab \cdot
+     \vec e_a + \mu_0 \vec e_a \cdot \vec e_b - \lambda_0 @f$ <br>
+      - (ii) @f$ 0 = \vec s(\lambda_0, \mu_0) \cdot \vec e_b = \vec m_ab \cdot
+     \vec e_b + \mu_0  - \lambda_0 \vec e_b \cdot \vec e_a @f$ <br>
 
       Solving (i), (ii) for @f$ \lambda_0 @f$ and @f$ \mu_0 @f$ yields:
-      - @f$ \lambda_0 = \frac{(\vec m_ab \cdot \vec e_a)-(\vec m_ab \cdot \vec e_b)(\vec e_a \cdot \vec e_b)}{1-(\vec
-     e_a \cdot \vec e_b)^2} @f$ <br>
-      - @f$ \mu_0 = - \frac{(\vec m_ab \cdot \vec e_b)-(\vec m_ab \cdot \vec e_a)(\vec e_a \cdot \vec e_b)}{1-(\vec e_a
-     \cdot \vec e_b)^2} @f$ <br>
+      - @f$ \lambda_0 = \frac{(\vec m_ab \cdot \vec e_a)-(\vec m_ab \cdot \vec
+     e_b)(\vec e_a \cdot \vec e_b)}{1-(\vec e_a \cdot \vec e_b)^2} @f$ <br>
+      - @f$ \mu_0 = - \frac{(\vec m_ab \cdot \vec e_b)-(\vec m_ab \cdot \vec
+     e_a)(\vec e_a \cdot \vec e_b)}{1-(\vec e_a \cdot \vec e_b)^2} @f$ <br>
    */
-  virtual Intersection straightLineIntersection(const Amg::Vector3D& pos,
-                                                const Amg::Vector3D& dir,
-                                                bool forceDir,
-                                                Trk::BoundaryCheck bchk) const override;
+  virtual Intersection straightLineIntersection(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool forceDir,
+    Trk::BoundaryCheck bchk) const override;
 
   /** fast straight line distance evaluation to Surface */
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos,
-                                                        const Amg::Vector3D& dir) const override;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir) const override;
 
   /** fast straight line distance evaluation to Surface - with bound option*/
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos,
-                                                        const Amg::Vector3D& dir,
-                                                        bool Bound) const override;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool Bound) const override;
 
   /** the pathCorrection for derived classes with thickness */
-  virtual double pathCorrection(const Amg::Vector3D&, const Amg::Vector3D&) const override { return 1.; }
+  virtual double pathCorrection(const Amg::Vector3D&,
+                                const Amg::Vector3D&) const override;
 
-  /** This method checks if the provided GlobalPosition is inside the assigned straw radius, but
-    no check is done whether the GlobalPosition is inside bounds or not.
-    It overwrites isOnSurface from Base Class as it saves the time of sign determination.  */
+  /** This method checks if the provided GlobalPosition is inside the assigned
+    straw radius, but no check is done whether the GlobalPosition is inside
+    bounds or not. It overwrites isOnSurface from Base Class as it saves the
+    time of sign determination.  */
   virtual bool isOnSurface(const Amg::Vector3D& glopo,
                            BoundaryCheck bchk = true,
                            double tol1 = 0.,
@@ -233,63 +249,26 @@ public:
   virtual const SurfaceBounds& bounds() const override;
 
   /**This surface calls the iside method of the bouns */
-  virtual bool insideBounds(const Amg::Vector2D& locpos, double tol1 = 0., double tol2 = 0.) const override;
-  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos, const BoundaryCheck& bchk) const override;
+  virtual bool insideBounds(const Amg::Vector2D& locpos,
+                            double tol1 = 0.,
+                            double tol2 = 0.) const override;
+  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos,
+                                 const BoundaryCheck& bchk) const override;
 
   /** Return properly formatted class name for screen output */
-  virtual std::string name() const override { return "Trk::StraightLineSurface"; };
+  virtual std::string name() const override;
 
 protected: //!< data members
   template<class SURFACE, class BOUNDS_CNV>
   friend class ::BoundSurfaceCnv_p1;
-
-  CxxUtils::CachedUniquePtrT<Amg::Vector3D> m_lineDirection; //!< cache of the line direction (speeds up)
-  SharedObject<const CylinderBounds> m_bounds;               //!< bounds (shared)
-  static const NoBounds s_boundless;                         //!< NoBounds as return object when no bounds are declared
+  //!< cache of the line direction (speeds up)
+  CxxUtils::CachedUniquePtrT<Amg::Vector3D> m_lineDirection;
+  //!< bounds (shared)
+  SharedObject<const CylinderBounds> m_bounds;
+  //!< NoBounds as return object when no bounds are declared
+  static const NoBounds s_boundless;
 };
-
-inline StraightLineSurface*
-StraightLineSurface::clone() const
-{
-  return new StraightLineSurface(*this);
-}
-
-inline const SurfaceBounds&
-StraightLineSurface::bounds() const
-{
-  if (m_bounds.get())
-    return *(m_bounds.get());
-  if (Surface::m_associatedDetElement && Surface::m_associatedDetElementId.is_valid()) {
-    return m_associatedDetElement->bounds(Surface::m_associatedDetElementId);
-  }
-  if (Surface::m_associatedDetElement)
-    return m_associatedDetElement->bounds();
-  return s_boundless;
-}
-
-inline bool
-StraightLineSurface::insideBounds(const Amg::Vector2D& locpos, double tol1, double tol2) const
-{
-  if (!(m_bounds.get()) && !Surface::m_associatedDetElement)
-    return true;
-  return (fabs(locpos[locR]) < bounds().r() + tol1 && bounds().insideLoc2(locpos, tol2));
-}
-
-inline bool
-StraightLineSurface::insideBoundsCheck(const Amg::Vector2D& locpos, const BoundaryCheck& bchk) const
-{
-  return StraightLineSurface::insideBounds(locpos, bchk.toleranceLoc1, bchk.toleranceLoc2);
-}
-
-inline const Amg::Vector3D&
-StraightLineSurface::lineDirection() const
-{
-  if (!m_lineDirection) {
-    m_lineDirection.set(std::make_unique<Amg::Vector3D>(transform().rotation().col(2)));
-  }
-  return (*m_lineDirection);
-}
-
 } // end of namespace
 
+#include "TrkSurfaces/StraightLineSurface.icc"
 #endif // TRKSURFACES_STRAIGHTLINESURFACE_H
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.icc
new file mode 100644
index 0000000000000000000000000000000000000000..d95d5980fecc8a2e4fac76d0e66645ea5f1e8bbe
--- /dev/null
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.icc
@@ -0,0 +1,155 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+namespace Trk {
+
+/** Return the surface type */
+inline Surface::SurfaceType
+StraightLineSurface::type() const
+{
+  return Surface::Line;
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters -
+ * charged */
+inline ParametersT<5, Charged, StraightLineSurface>*
+StraightLineSurface::createTrackParameters(double l1,
+                                           double l2,
+                                           double phi,
+                                           double theta,
+                                           double qop,
+                                           AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Charged, StraightLineSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters -
+ * charged*/
+inline ParametersT<5, Charged, StraightLineSurface>*
+StraightLineSurface::createTrackParameters(const Amg::Vector3D& position,
+                                           const Amg::Vector3D& momentum,
+                                           double charge,
+                                           AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Charged, StraightLineSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters -
+ * neutral */
+inline ParametersT<5, Neutral, StraightLineSurface>*
+StraightLineSurface::createNeutralParameters(double l1,
+                                             double l2,
+                                             double phi,
+                                             double theta,
+                                             double qop,
+                                             AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Neutral, StraightLineSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters -
+ * neutral */
+inline ParametersT<5, Neutral, StraightLineSurface>*
+StraightLineSurface::createNeutralParameters(const Amg::Vector3D& position,
+                                             const Amg::Vector3D& momentum,
+                                             double charge,
+                                             AmgSymMatrix(5) * cov) const
+{
+  return new ParametersT<5, Neutral, StraightLineSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from local parameters */
+template<int DIM, class T>
+ParametersT<DIM, T, StraightLineSurface>*
+StraightLineSurface::createParameters(double l1,
+                                      double l2,
+                                      double phi,
+                                      double theta,
+                                      double qop,
+                                      AmgSymMatrix(DIM) * cov) const
+{
+  return new ParametersT<DIM, T, StraightLineSurface>(
+    l1, l2, phi, theta, qop, *this, cov);
+}
+
+/** Use the Surface as a ParametersBase constructor, from global parameters */
+template<int DIM, class T>
+ParametersT<DIM, T, StraightLineSurface>*
+StraightLineSurface::createParameters(const Amg::Vector3D& position,
+                                      const Amg::Vector3D& momentum,
+                                      double charge,
+                                      AmgSymMatrix(DIM) * cov) const
+{
+  return new ParametersT<DIM, T, StraightLineSurface>(
+    position, momentum, charge, *this, cov);
+}
+
+inline StraightLineSurface*
+StraightLineSurface::clone() const
+{
+  return new StraightLineSurface(*this);
+}
+
+inline const SurfaceBounds&
+StraightLineSurface::bounds() const
+{
+  if (m_bounds.get())
+    return *(m_bounds.get());
+  if (Surface::m_associatedDetElement &&
+      Surface::m_associatedDetElementId.is_valid()) {
+    return m_associatedDetElement->bounds(Surface::m_associatedDetElementId);
+  }
+  if (Surface::m_associatedDetElement)
+    return m_associatedDetElement->bounds();
+  return s_boundless;
+}
+
+inline bool
+StraightLineSurface::insideBounds(const Amg::Vector2D& locpos,
+                                  double tol1,
+                                  double tol2) const
+{
+  if (!(m_bounds.get()) && !Surface::m_associatedDetElement)
+    return true;
+  return (fabs(locpos[locR]) < bounds().r() + tol1 &&
+          bounds().insideLoc2(locpos, tol2));
+}
+
+inline bool
+StraightLineSurface::insideBoundsCheck(const Amg::Vector2D& locpos,
+                                       const BoundaryCheck& bchk) const
+{
+  return StraightLineSurface::insideBounds(
+    locpos, bchk.toleranceLoc1, bchk.toleranceLoc2);
+}
+
+inline const Amg::Vector3D&
+StraightLineSurface::lineDirection() const
+{
+  if (!m_lineDirection) {
+    m_lineDirection.set(
+      std::make_unique<Amg::Vector3D>(transform().rotation().col(2)));
+  }
+  return (*m_lineDirection);
+}
+
+/** the pathCorrection for derived classes with thickness */
+inline double
+StraightLineSurface::pathCorrection(const Amg::Vector3D&,
+                                    const Amg::Vector3D&) const
+{
+  return 1.;
+}
+
+/** Return properly formatted class name for screen output */
+inline std::string
+StraightLineSurface::name() const
+{
+  return "Trk::StraightLineSurface";
+}
+
+}
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h
index 43568cb37315eecfdc4d87332096bf67828252d8..bfc9df0f867a8f50b821e39868c8c3542fb10e61 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h
@@ -53,12 +53,14 @@ enum SurfaceOwner
 
  Abstract Base Class for tracking surfaces
 
- The creation of a Surface by passing a HepGeom::Transform3D* through the constructor
- implies that the ownership of the HepGeom::Transform3D object is also passed to the Surface,
- therfor the memory is freed in the Surface destructor.
+ The creation of a Surface by passing a HepGeom::Transform3D* through the
+ constructor implies that the ownership of the HepGeom::Transform3D object is
+ also passed to the Surface, therfor the memory is freed in the Surface
+ destructor.
 
- For all isOnSurface, or positionOnSurface and insideBounds methods two tolerance parameters
- can be given which correspond to the two local natural coordinates of the surface loc1, loc2.
+ For all isOnSurface, or positionOnSurface and insideBounds methods two
+ tolerance parameters can be given which correspond to the two local natural
+ coordinates of the surface loc1, loc2.
 
  @author Andreas.Salzburger@cern.ch
  */
@@ -66,7 +68,8 @@ enum SurfaceOwner
 class Surface
 {
 
-  /** Declare the ILayerBuilder / ITrackingVolumeHelper to be a friend class such it is able to set the layer */
+  /** Declare the ILayerBuilder / ITrackingVolumeHelper to be a friend class
+   * such it is able to set the layer */
   friend class ILayerBuilder;
   friend class ITrackingVolumeHelper;
 
@@ -145,15 +148,16 @@ public:
   /** Returns the center position of the Surface */
   virtual const Amg::Vector3D& center() const;
 
-  /** Returns the normal vector of the Surface (i.e. in generall z-axis of rotation) */
+  /** Returns the normal vector of the Surface (i.e. in generall z-axis of
+   * rotation) */
   virtual const Amg::Vector3D& normal() const;
 
   /** Returns a normal vector at a specific local position */
   virtual const Amg::Vector3D* normal(const Amg::Vector2D& lp) const;
 
   /** Returns a global reference point on the surface,
-     for PlaneSurface, StraightLineSurface, PerigeeSurface this is equal to center(),
-     for CylinderSurface and DiscSurface this is a new member
+     for PlaneSurface, StraightLineSurface, PerigeeSurface this is equal to
+     center(), for CylinderSurface and DiscSurface this is a new member
      */
   virtual const Amg::Vector3D& globalReferencePoint() const;
 
@@ -172,132 +176,178 @@ public:
   /** return the base surface (simplified for persistification) */
   virtual const Trk::Surface* baseSurface() const;
 
-  /** Use the Surface as a ParametersBase constructor, from local parameters - charged */
-  virtual ParametersBase<5, Trk::Charged>* createTrackParameters(double,
-                                                                 double,
-                                                                 double,
-                                                                 double,
-                                                                 double,
-                                                                 AmgSymMatrix(5) * cov = nullptr) const = 0;
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - charged*/
-  virtual ParametersBase<5, Trk::Charged>* createTrackParameters(const Amg::Vector3D&,
-                                                                 const Amg::Vector3D&,
-                                                                 double,
-                                                                 AmgSymMatrix(5) * cov = nullptr) const = 0;
-
-  /** Use the Surface as a ParametersBase constructor, from local parameters - neutral */
-  virtual ParametersBase<5, Trk::Neutral>* createNeutralParameters(double,
-                                                                   double,
-                                                                   double,
-                                                                   double,
-                                                                   double,
-                                                                   AmgSymMatrix(5) * cov = nullptr) const = 0;
-
-  /** Use the Surface as a ParametersBase constructor, from global parameters - neutral */
-  virtual ParametersBase<5, Trk::Neutral>* createNeutralParameters(const Amg::Vector3D&,
-                                                                   const Amg::Vector3D&,
-                                                                   double charge = 0.,
-                                                                   AmgSymMatrix(5) * cov = nullptr) const = 0;
-
-  /** positionOnSurface() returns a pointer to a LocalPosition on the Surface,<br>
-    If BoundaryCheck==false it just returns the value of globalToLocal (including NULL pointer possibility),
-    if BoundaryCheck==true it checks whether the point is inside bounds or not (returns NULL pointer in this case). */
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * charged */
+  virtual ParametersBase<5, Trk::Charged>* createTrackParameters(
+    double,
+    double,
+    double,
+    double,
+    double,
+    AmgSymMatrix(5) * cov = nullptr) const = 0;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters -
+   * charged*/
+  virtual ParametersBase<5, Trk::Charged>* createTrackParameters(
+    const Amg::Vector3D&,
+    const Amg::Vector3D&,
+    double,
+    AmgSymMatrix(5) * cov = nullptr) const = 0;
+
+  /** Use the Surface as a ParametersBase constructor, from local parameters -
+   * neutral */
+  virtual ParametersBase<5, Trk::Neutral>* createNeutralParameters(
+    double,
+    double,
+    double,
+    double,
+    double,
+    AmgSymMatrix(5) * cov = nullptr) const = 0;
+
+  /** Use the Surface as a ParametersBase constructor, from global parameters -
+   * neutral */
+  virtual ParametersBase<5, Trk::Neutral>* createNeutralParameters(
+    const Amg::Vector3D&,
+    const Amg::Vector3D&,
+    double charge = 0.,
+    AmgSymMatrix(5) * cov = nullptr) const = 0;
+
+  /** positionOnSurface() returns a pointer to a LocalPosition on the
+    Surface,<br> If BoundaryCheck==false it just returns the value of
+    globalToLocal (including NULL pointer possibility), if BoundaryCheck==true
+    it checks whether the point is inside bounds or not (returns NULL pointer in
+    this case). */
   const Amg::Vector2D* positionOnSurface(const Amg::Vector3D& glopo,
                                          const BoundaryCheck& bchk = true,
                                          double tol1 = 0.,
                                          double tol2 = 0.) const;
 
-  /** The templated Parameters OnSurface method - checks on surface pointer first */
+  /** The templated Parameters OnSurface method - checks on surface pointer
+   * first */
   template<class T>
-  bool onSurface(const T& parameters, const BoundaryCheck& bchk = BoundaryCheck(true)) const;
+  bool onSurface(const T& parameters,
+                 const BoundaryCheck& bchk = BoundaryCheck(true)) const;
 
-  /** This method returns true if the GlobalPosition is on the Surface for both, within
-    or without check of whether the local position is inside boundaries or not */
+  /** This method returns true if the GlobalPosition is on the Surface for both,
+    within or without check of whether the local position is inside boundaries
+    or not */
   virtual bool isOnSurface(const Amg::Vector3D& glopo,
                            BoundaryCheck bchk = true,
                            double tol1 = 0.,
                            double tol2 = 0.) const;
 
   /**  virtual methods to be overwritten by the inherited surfaces */
-  virtual bool insideBounds(const Amg::Vector2D& locpos, double tol1 = 0., double tol2 = 0.) const = 0;
+  virtual bool insideBounds(const Amg::Vector2D& locpos,
+                            double tol1 = 0.,
+                            double tol2 = 0.) const = 0;
 
-  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos, const BoundaryCheck& bchk) const = 0;
+  virtual bool insideBoundsCheck(const Amg::Vector2D& locpos,
+                                 const BoundaryCheck& bchk) const = 0;
 
   /** This method returns the GlobalPosition from a LocalPosition
-    The LocalPosition can be outside Surface bounds - only for planar, cylinder surfaces fully defined */
+    The LocalPosition can be outside Surface bounds - only for planar, cylinder
+    surfaces fully defined */
   const Amg::Vector3D* localToGlobal(const Amg::Vector2D& locpos) const;
 
   /** This method returns the GlobalPosition from a LocalPosition
-    The LocalPosition can be outside Surface bounds - for generality with momentum*/
-  const Amg::Vector3D* localToGlobal(const Amg::Vector2D& locpos, const Amg::Vector3D& glomom) const;
+    The LocalPosition can be outside Surface bounds - for generality with
+    momentum*/
+  const Amg::Vector3D* localToGlobal(const Amg::Vector2D& locpos,
+                                     const Amg::Vector3D& glomom) const;
 
   /** This method returns the GlobalPosition from LocalParameters
-    The LocalParameters can be outside Surface bounds - only for planar, cylinder surfaces fully defined */
+    The LocalParameters can be outside Surface bounds - only for planar,
+    cylinder surfaces fully defined */
   const Amg::Vector3D* localToGlobal(const LocalParameters& locpars) const;
 
   /** This method returns the GlobalPosition from LocalParameters
-    The LocalParameters can be outside Surface bounds - for generality with momentum */
-  const Amg::Vector3D* localToGlobal(const LocalParameters& locpars, const Amg::Vector3D& glomom) const;
-
-  /** Specified by each surface type: LocalToGlobal method without dynamic memory allocation */
-  virtual void localToGlobal(const Amg::Vector2D& locp, const Amg::Vector3D& mom, Amg::Vector3D& glob) const = 0;
-
-  /** Specified by each surface type: GlobalToLocal method without dynamic memory allocation - boolean checks if on
-   * surface */
-  virtual bool globalToLocal(const Amg::Vector3D& glob, const Amg::Vector3D& mom, Amg::Vector2D& loc) const = 0;
+    The LocalParameters can be outside Surface bounds - for generality with
+    momentum */
+  const Amg::Vector3D* localToGlobal(const LocalParameters& locpars,
+                                     const Amg::Vector3D& glomom) const;
+
+  /** Specified by each surface type: LocalToGlobal method without dynamic
+   * memory allocation */
+  virtual void localToGlobal(const Amg::Vector2D& locp,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector3D& glob) const = 0;
+
+  /** Specified by each surface type: GlobalToLocal method without dynamic
+   * memory allocation - boolean checks if on surface */
+  virtual bool globalToLocal(const Amg::Vector3D& glob,
+                             const Amg::Vector3D& mom,
+                             Amg::Vector2D& loc) const = 0;
 
   /** This method returns the LocalPosition from a provided GlobalPosition.
     If the GlobalPosition is not on the Surface, it returns a NULL pointer.
-    This method does not check if the calculated LocalPosition is inside surface bounds.
-    If this check is needed, use positionOnSurface - only for planar, cylinder surface fully defined*/
-  const Amg::Vector2D* globalToLocal(const Amg::Vector3D& glopos, double tol = 0.) const;
+    This method does not check if the calculated LocalPosition is inside surface
+    bounds. If this check is needed, use positionOnSurface - only for planar,
+    cylinder surface fully defined*/
+  const Amg::Vector2D* globalToLocal(const Amg::Vector3D& glopos,
+                                     double tol = 0.) const;
 
   /** This method returns the LocalPosition from a provided GlobalPosition.
       If the GlobalPosition is not on the Surface, it returns a NULL pointer.
-      This method does not check if the calculated LocalPosition is inside surface bounds.
-      If this check is needed, use positionOnSurface - for generality with momentum */
-  const Amg::Vector2D* globalToLocal(const Amg::Vector3D& glopos, const Amg::Vector3D& glomom) const;
+      This method does not check if the calculated LocalPosition is inside
+     surface bounds. If this check is needed, use positionOnSurface - for
+     generality with momentum */
+  const Amg::Vector2D* globalToLocal(const Amg::Vector3D& glopos,
+                                     const Amg::Vector3D& glomom) const;
 
   /** Optionally specified by each surface type : LocalParameters to Vector2D */
-  virtual Amg::Vector2D localParametersToPosition(const LocalParameters& locpars) const;
+  virtual Amg::Vector2D localParametersToPosition(
+    const LocalParameters& locpars) const;
 
-  /** the pathCorrection for derived classes with thickness - it reflects if the direction projection is positive or
-   * negative */
-  virtual double pathCorrection(const Amg::Vector3D& pos, const Amg::Vector3D& mom) const;
+  /** the pathCorrection for derived classes with thickness - it reflects if the
+   * direction projection is positive or negative */
+  virtual double pathCorrection(const Amg::Vector3D& pos,
+                                const Amg::Vector3D& mom) const;
 
-  /** Return the measurement frame - this is needed for alignment, in particular for StraightLine and Perigee Surface
-       - the default implementation is the the RotationMatrix3D of the transform */
-  virtual Amg::RotationMatrix3D measurementFrame(const Amg::Vector3D& glopos, const Amg::Vector3D& glomom) const;
+  /** Return the measurement frame - this is needed for alignment, in particular
+     for StraightLine and Perigee Surface
+       - the default implementation is the the RotationMatrix3D of the transform
+   */
+  virtual Amg::RotationMatrix3D measurementFrame(
+    const Amg::Vector3D& glopos,
+    const Amg::Vector3D& glomom) const;
 
-  /** fst straight line intersection schema - templated for cvharged and neutral parameters */
+  /** fst straight line intersection schema - templated for cvharged and neutral
+   * parameters */
   template<class T>
-  Intersection straightLineIntersection(const T& pars, bool forceDir = false, Trk::BoundaryCheck bchk = false) const
+  Intersection straightLineIntersection(const T& pars,
+                                        bool forceDir = false,
+                                        Trk::BoundaryCheck bchk = false) const
   {
-    return straightLineIntersection(pars.position(), pars.momentum().unit(), forceDir, bchk);
+    return straightLineIntersection(
+      pars.position(), pars.momentum().unit(), forceDir, bchk);
   }
 
-  /** fast straight line intersection schema - standard: provides closest intersection and (signed) path length
-      forceFwd is to provide the closest forward solution
+  /** fast straight line intersection schema - standard: provides closest
+     intersection and (signed) path length forceFwd is to provide the closest
+     forward solution
    */
-  virtual Intersection straightLineIntersection(const Amg::Vector3D& pos,
-                                                const Amg::Vector3D& dir,
-                                                bool forceDir = false,
-                                                Trk::BoundaryCheck bchk = false) const = 0;
+  virtual Intersection straightLineIntersection(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool forceDir = false,
+    Trk::BoundaryCheck bchk = false) const = 0;
 
   /** fast straight line distance evaluation to Surface */
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos, const Amg::Vector3D& dir) const = 0;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir) const = 0;
 
   /** fast straight line distance evaluation to Surface - with bound option*/
-  virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D& pos,
-                                                        const Amg::Vector3D& dir,
-                                                        bool Bound) const = 0;
+  virtual DistanceSolution straightLineDistanceEstimate(
+    const Amg::Vector3D& pos,
+    const Amg::Vector3D& dir,
+    bool Bound) const = 0;
 
   /** Surface Bounds method */
   virtual const SurfaceBounds& bounds() const = 0;
 
-  /** Returns 'true' if this surface is 'free', i.e. it does not belong to a detector element (and returns false
-   * otherwise*/
+  /** Returns 'true' if this surface is 'free', i.e. it does not belong to a
+   * detector element (and returns false otherwise*/
   bool isFree() const;
 
   /** Return 'true' if this surface is own by the detector element */
@@ -332,7 +382,8 @@ public:
 
   /**return number of surfaces currently created - needed for EDM monitor */
   static unsigned int numberOfInstantiations();
-  /**return number of free surfaces currently created (i.e. those not belonging to a DE) - needed for EDM monitor */
+  /**return number of free surfaces currently created (i.e. those not belonging
+   * to a DE) - needed for EDM monitor */
   static unsigned int numberOfFreeInstantiations();
 
   /** method to associate the associated Trk::Layer which is alreay owned
@@ -340,19 +391,22 @@ public:
      - only done if no Layer is set already  */
   void associateLayer(const Layer& lay);
 
-    /** const method to associate the associated Trk::Layer which is alreay owned
-     - only allowed by LayerBuilder
-     - only done if no Layer is set already  */
-    void associateLayer ATLAS_NOT_CONST_THREAD_SAFE(const Layer& lay) const;
+  /** const method to associate the associated Trk::Layer which is alreay owned
+   - only allowed by LayerBuilder
+   - only done if no Layer is set already  */
+  void associateLayer ATLAS_NOT_CONST_THREAD_SAFE(const Layer& lay) const;
 
 protected:
   friend class ::SurfaceCnv_p1;
 
   /** Private members are in principle implemented as pointers to
    * objects for easy checks if they are already declared or not */
-  std::unique_ptr<Amg::Transform3D> m_transform;           //!< Transform3D to orient surface w.r.t to global frame
-  CxxUtils::CachedUniquePtr<Amg::Vector3D> m_center;       //!< center position of the surface
-  CxxUtils::CachedUniquePtr<Amg::Vector3D> m_normal;       //!< normal vector of the surface
+  std::unique_ptr<Amg::Transform3D>
+    m_transform; //!< Transform3D to orient surface w.r.t to global frame
+  CxxUtils::CachedUniquePtr<Amg::Vector3D>
+    m_center; //!< center position of the surface
+  CxxUtils::CachedUniquePtr<Amg::Vector3D>
+    m_normal; //!< normal vector of the surface
 
   /** Pointers to the a TrkDetElementBase */
   const TrkDetElementBase* m_associatedDetElement;
@@ -378,11 +432,13 @@ protected:
   /** number of objects of this type in memory - needed for EDM monitor*/
   static std::atomic<unsigned int> s_numberOfInstantiations;
 
-  /** number of objects of this type in memory which do not belong to a detector element - needed for EDM monitor*/
+  /** number of objects of this type in memory which do not belong to a detector
+   * element - needed for EDM monitor*/
   static std::atomic<unsigned int> s_numberOfFreeInstantiations;
 #endif
 };
-/**Overload of << operator for both, MsgStream and std::ostream for debug output*/
+/**Overload of << operator for both, MsgStream and std::ostream for debug
+ * output*/
 MsgStream&
 operator<<(MsgStream& sl, const Surface& sf);
 std::ostream&
@@ -390,6 +446,6 @@ operator<<(std::ostream& sl, const Surface& sf);
 
 typedef SurfaceUniquePtrT<Trk::Surface> SurfaceUniquePtr;
 typedef SurfaceUniquePtrT<const Trk::Surface> ConstSurfaceUniquePtr;
-}//
+} //
 #include "Surface.icc"
 #endif // TRKSURFACES_SURFACE_H
diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.icc
index ad40b18cd9ef6ad862e4aa4a6a9cc6b68e16ad42..4c34696f7e3b5ef8a6f9b6d697e2857eba062609 100644
--- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.icc
+++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.icc
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
 
-namespace Trk{
+namespace Trk {
 
 inline bool
 Surface::operator!=(const Surface& sf) const
@@ -32,7 +32,8 @@ inline const Amg::Vector3D&
 Surface::center() const
 {
   if (m_transform && !m_center) {
-    return *(m_center.set(std::make_unique<Amg::Vector3D>(m_transform->translation())));
+    return *(m_center.set(
+      std::make_unique<Amg::Vector3D>(m_transform->translation())));
   }
   if (m_center)
     return (*m_center);
@@ -47,7 +48,8 @@ inline const Amg::Vector3D&
 Surface::normal() const
 {
   if (m_transform && !m_normal) {
-    return *(m_normal.set(std::make_unique<Amg::Vector3D>(m_transform->rotation().col(2))));
+    return *(m_normal.set(
+      std::make_unique<Amg::Vector3D>(m_transform->rotation().col(2))));
   }
   if (m_normal)
     return (*m_normal);
@@ -58,7 +60,8 @@ Surface::normal() const
   return s_zAxis;
 }
 
-// standard is to set non-defined parameters to 0, but can be changed for surface type
+// standard is to set non-defined parameters to 0, but can be changed for
+// surface type
 inline Amg::Vector2D
 Surface::localParametersToPosition(const LocalParameters& locpars) const
 {
@@ -77,7 +80,8 @@ Surface::pathCorrection(const Amg::Vector3D&, const Amg::Vector3D& mom) const
 {
   Amg::Vector3D dir(mom.unit());
   double cosAlpha = dir.dot(normal());
-  return (cosAlpha != 0 ? fabs(1. / cosAlpha) : 1.); // ST undefined for cosAlpha=0
+  return (cosAlpha != 0 ? fabs(1. / cosAlpha)
+                        : 1.); // ST undefined for cosAlpha=0
 }
 
 //* the templated parameters on Surface method */
@@ -102,7 +106,8 @@ Surface::localToGlobal(const Amg::Vector2D& locpos) const
 }
 // common to all surfaces uses memory optimized method
 inline const Amg::Vector3D*
-Surface::localToGlobal(const Amg::Vector2D& locpos, const Amg::Vector3D& glomom) const
+Surface::localToGlobal(const Amg::Vector2D& locpos,
+                       const Amg::Vector3D& glomom) const
 {
   Amg::Vector3D* gPosition = new Amg::Vector3D;
   localToGlobal(locpos, glomom, *gPosition);
@@ -113,12 +118,14 @@ inline const Amg::Vector3D*
 Surface::localToGlobal(const LocalParameters& locpars) const
 {
   Amg::Vector3D* gPosition = new Amg::Vector3D;
-  localToGlobal(localParametersToPosition(locpars), Amg::Vector3D(1., 1., 1.), *gPosition);
+  localToGlobal(
+    localParametersToPosition(locpars), Amg::Vector3D(1., 1., 1.), *gPosition);
   return gPosition;
 }
 // common to all surfaces uses memory optimized method
 inline const Amg::Vector3D*
-Surface::localToGlobal(const LocalParameters& locpars, const Amg::Vector3D& glomom) const
+Surface::localToGlobal(const LocalParameters& locpars,
+                       const Amg::Vector3D& glomom) const
 {
   Amg::Vector3D* gPosition = new Amg::Vector3D(0., 0., 0.);
   localToGlobal(localParametersToPosition(locpars), glomom, *gPosition);
@@ -136,7 +143,8 @@ Surface::globalToLocal(const Amg::Vector3D& glopos, double) const
 }
 // common to all surfaces, uses memory optized method
 inline const Amg::Vector2D*
-Surface::globalToLocal(const Amg::Vector3D& glopos, const Amg::Vector3D& glomom) const
+Surface::globalToLocal(const Amg::Vector3D& glopos,
+                       const Amg::Vector3D& glomom) const
 {
   Amg::Vector2D* lPosition = new Amg::Vector2D(0., 0.);
   if (globalToLocal(glopos, glomom, *lPosition))
@@ -204,15 +212,16 @@ Surface::isFree() const
   return (m_owner == Trk::noOwn);
 }
 
-inline void
-Surface::setOwner ATLAS_NOT_CONST_THREAD_SAFE (SurfaceOwner x) const
+inline void Surface::setOwner
+ATLAS_NOT_CONST_THREAD_SAFE(SurfaceOwner x) const
 {
   const_cast<SurfaceOwner&>(m_owner) = x;
 }
 
-inline void 
-Surface::setOwner(SurfaceOwner x) { 
-  m_owner = x; 
+inline void
+Surface::setOwner(SurfaceOwner x)
+{
+  m_owner = x;
 }
 
 inline SurfaceOwner
@@ -233,14 +242,14 @@ Surface::setMaterialLayer(const Layer* mlay)
   m_materialLayer = mlay;
 }
 
-inline void
-Surface::setMaterialLayer ATLAS_NOT_CONST_THREAD_SAFE (const Layer& mlay) const
+inline void Surface::setMaterialLayer
+ATLAS_NOT_CONST_THREAD_SAFE(const Layer& mlay) const
 {
   const_cast<Surface*>(this)->m_materialLayer = (&mlay);
 }
 
-inline void
-Surface::setMaterialLayer ATLAS_NOT_CONST_THREAD_SAFE (const Layer* mlay) const
+inline void Surface::setMaterialLayer
+ATLAS_NOT_CONST_THREAD_SAFE(const Layer* mlay) const
 {
   const_cast<Surface*>(this)->m_materialLayer = mlay;
 }
@@ -251,12 +260,11 @@ Surface::associateLayer(const Layer& lay)
   m_associatedLayer = (&lay);
 }
 
-inline void
-Surface::associateLayer ATLAS_NOT_CONST_THREAD_SAFE (const Layer& lay) const
+inline void Surface::associateLayer
+ATLAS_NOT_CONST_THREAD_SAFE(const Layer& lay) const
 {
   const_cast<Surface*>(this)->m_associatedLayer = (&lay);
 }
 
 } // end of namespace Trk
 
-
diff --git a/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/ProjectionMatricesSet.h b/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/ProjectionMatricesSet.h
index 18238deb0b71e1b52522d0e9ac662a02e642f1f6..88d00c27291be3be9f1c7f52d0d0a3ebec008ae0 100755
--- a/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/ProjectionMatricesSet.h
+++ b/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/ProjectionMatricesSet.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -32,9 +32,6 @@ namespace Trk {
       /**Explicit constructor for 1-dimensional vector */
       ProjectionMatricesSet(int maxdim);
       
-      /** Virtual destructor */
-      virtual ~ProjectionMatricesSet();
-      
       /**Expansion matrix return*/
       const Amg::MatrixX& expansionMatrix(int mtx) const;
       
@@ -45,16 +42,16 @@ namespace Trk {
       int accessor(int mtx, ParamDefs par) const;
       
     private:
-     int                                          m_maxdim;
-     std::vector<const Amg::MatrixX*>             m_expansions;
-     std::vector<const Amg::MatrixX*>             m_reductions;
-     std::vector< std::vector<int> >              m_accessors;
+      int                             m_maxdim;
+      std::vector<Amg::MatrixX> m_expansions;
+      std::vector<Amg::MatrixX> m_reductions;
+      std::vector<std::vector<int>>   m_accessors;
      
   };    
 
-inline const Amg::MatrixX& ProjectionMatricesSet::expansionMatrix(int mtx) const { return (*m_expansions[mtx]); }
+inline const Amg::MatrixX& ProjectionMatricesSet::expansionMatrix(int mtx) const { return m_expansions[mtx]; }
 
-inline const Amg::MatrixX& ProjectionMatricesSet::reductionMatrix(int mtx) const { return (*m_reductions[mtx]); }
+inline const Amg::MatrixX& ProjectionMatricesSet::reductionMatrix(int mtx) const { return m_reductions[mtx]; }
     
 inline int ProjectionMatricesSet::accessor(int mtx, ParamDefs par) const { return (par-(m_accessors[mtx])[par]); }
 
diff --git a/Tracking/TrkEvent/TrkEventPrimitives/src/ProjectionMatricesSet.cxx b/Tracking/TrkEvent/TrkEventPrimitives/src/ProjectionMatricesSet.cxx
index d42ca6fa11085f16aea5a2b5e7ebf6f4bde18ed2..81ceacfe54abe8f59f7087e1136512528ab4c1b1 100755
--- a/Tracking/TrkEvent/TrkEventPrimitives/src/ProjectionMatricesSet.cxx
+++ b/Tracking/TrkEvent/TrkEventPrimitives/src/ProjectionMatricesSet.cxx
@@ -22,48 +22,42 @@ Trk::ProjectionMatricesSet::ProjectionMatricesSet(int maxdim) :
     std::vector<int>  accessorInt(m_maxdim);
     std::vector<bool> parameterTag(m_maxdim);
     unsigned int cols = 0;
-    for (int itag = 0, ipos=1; itag<m_maxdim; ++itag, ipos*=2) 
-       { bool bit = (imatx & ipos);
-         parameterTag[itag] = bit;   
-         if (bit) { ++cols;}
-       }
-     
-    Amg::MatrixX* reduction = nullptr;
-    Amg::MatrixX* expansion = nullptr;
-      
+    for (int itag = 0, ipos = 1; itag < m_maxdim; ++itag, ipos *= 2) {
+      bool bit = (imatx & ipos);
+      parameterTag[itag] = bit;
+      if (bit) {
+        ++cols;
+      }
+    }
+
+    //By default set zero 
+    Amg::MatrixX reduction;
+    reduction.setZero();
+    Amg::MatrixX expansion;
+    expansion.setZero();
     if (cols){      
       // rows and cols - initialized to zero
-      reduction = new Amg::MatrixX(m_maxdim, cols);
-      (*reduction).setZero();
+      reduction = Amg::MatrixX(m_maxdim, cols);
+      reduction.setZero();
       // go through the rows and fill them
       int reduc = 0;
       for (int irow = 0; irow<m_maxdim; irow++)
       {
-      
         int icol = irow - reduc;
         // avoids couting to col 4 for int(0b01111) = 15 matrix 
         icol = (icol < int(cols)) ? icol : cols-1;
-        (*reduction)(irow,icol) = parameterTag[irow] ? 1. : 0.;
+        reduction(irow,icol) = parameterTag[irow] ? 1. : 0.;
         if (!parameterTag[irow])
         { 
            accessorInt[irow] = -100;
            ++reduc;
-         }
-       else {
-         accessorInt[irow] = reduc;}
+        } else {
+          accessorInt[irow] = reduc;
+        }
       }
-    
       // the expansion matrix is the transposed reduction matrix
-      expansion = new Amg::MatrixX(reduction->transpose());
-      
-    } else {
-      // only one single case
-      reduction = new Amg::MatrixX(m_maxdim, m_maxdim);
-      (*reduction).setZero();    
-      expansion = new Amg::MatrixX(m_maxdim, m_maxdim);
-      (*expansion).setZero();          
-    }
-         
+      expansion = Amg::MatrixX(reduction.transpose());
+    } 
     // store them
     m_reductions.push_back(reduction);
     m_expansions.push_back(expansion);
@@ -71,16 +65,3 @@ Trk::ProjectionMatricesSet::ProjectionMatricesSet(int maxdim) :
   }
 
 }
-
-Trk::ProjectionMatricesSet::~ProjectionMatricesSet()
-{
-   std::vector<const Amg::MatrixX*>::const_iterator  matrixIter    = m_expansions.begin();
-   std::vector<const Amg::MatrixX*>::const_iterator  matrixIterEnd = m_expansions.end();   
-   for ( ; matrixIter != matrixIterEnd; delete (*matrixIter), ++matrixIter) { ;}
-
-   matrixIter    = m_reductions.begin();
-   matrixIterEnd = m_reductions.end();
-   for ( ; matrixIter != matrixIterEnd; delete (*matrixIter), ++matrixIter) { ;}
-
-}
-
diff --git a/Tracking/TrkEvent/VxMultiVertex/VxMultiVertex/MVFVxTrackAtVertex.h b/Tracking/TrkEvent/VxMultiVertex/VxMultiVertex/MVFVxTrackAtVertex.h
index 602111a830b3c3eb835a2b5d3712af85c0695e93..9650fb90b1df07ad267d28630fb5febf51ba6564 100755
--- a/Tracking/TrkEvent/VxMultiVertex/VxMultiVertex/MVFVxTrackAtVertex.h
+++ b/Tracking/TrkEvent/VxMultiVertex/VxMultiVertex/MVFVxTrackAtVertex.h
@@ -5,164 +5,165 @@
 #ifndef VXMULTIVERTEX_MVFVXTRACKATVERTEX_H
 #define VXMULTIVERTEX_MVFVXTRACKATVERTEX_H
 
-#include "VxVertex/VxTrackAtVertex.h"
-#include "TrkTrack/TrackCollection.h"
 #include "TrkParameters/TrackParameters.h"
-#include "TrkParticleBase/TrackParticleBaseCollection.h"
 #include "TrkParticleBase/TrackParticleBase.h"
-namespace Trk
+#include "TrkParticleBase/TrackParticleBaseCollection.h"
+#include "TrkTrack/TrackCollection.h"
+#include "VxVertex/VxTrackAtVertex.h"
+namespace Trk {
+
+/**
+ *   @class  Trk::MVFVxTrackAtVertex.h
+ *
+ * This class inherits from VxTrackAtVertex, adding for the "Multi Vertex
+ * Fitter" the following information: the Trk::TrackToVtxLink object, which
+ * stores the information about the association of a track to a set of vertices
+ *
+ * begin   : August 2006
+ * @authors : Giacinto Piacquadio (Freiburg University)
+ * giacinto.piacquadio@physik.uni-freiburg.de
+ */
+
+class TrackToVtxLink;
+class Track;
+
+class MVFVxTrackAtVertex : public VxTrackAtVertex
 {
-  
+public:
+  /**
+   * Default constructor
+   */
+  MVFVxTrackAtVertex();
+
+  /**
+   * Constructor requiring a chi2 per track and a track parameters at vertex as
+   * input
+   */
+  MVFVxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex);
+
+  /**
+   * Constructor requiring a chi2 per track, track parameters at vertex
+   * and initial perigee as input.
+   */
+  MVFVxTrackAtVertex(double chi2PerTrk,
+                     TrackParameters* perigeeAtVertex,
+                     TrackParameters* initialPerigee);
+
+  /**
+   * Constructor requiring a chi2 per track, track parameters at vertex
+   * and a linearized track state.
+   */
+  MVFVxTrackAtVertex(double chi2PerTrk,
+                     TrackParameters* perigeeAtVertex,
+                     double ndfPerTrk,
+                     Trk::LinearizedTrack* linState = nullptr);
+
+  /**
+   *Constructor requiring a chi2 per track,initial track parameters, track
+   *parameters at vertex and a linearized track state.
+   */
+  MVFVxTrackAtVertex(double chi2PerTrk,
+                     TrackParameters* perigeeAtVertex,
+                     TrackParameters* initialPerigee,
+                     double ndfPerTrk,
+                     Trk::LinearizedTrack* linState = nullptr);
+
+  /**
+   * Constructor with only trackOrParticleLink (no TrackToVtxLink);
+   */
+
+  MVFVxTrackAtVertex(Trk::ITrackLink* trackOrParticleLink);
+
+  /**
+   * Constructor using a link to vertices + trackParticle origin.
+   */
+  MVFVxTrackAtVertex(TrackToVtxLink* actuallink,
+                     const Track* track,
+                     const TrackCollection* trackTES);
+
+  MVFVxTrackAtVertex(TrackToVtxLink* actuallink,
+                     const Trk::TrackParticleBase* trackparticle,
+                     const Trk::TrackParticleBaseCollection* trkpartTES);
+
   /**
-   *   @class  Trk::MVFVxTrackAtVertex.h 
-   *
-   * This class inherits from VxTrackAtVertex, adding for the "Multi Vertex Fitter" the 
-   * following information:
-   * the Trk::TrackToVtxLink object, which stores the information about the association of a track 
-   * to a set of vertices
-   *            
-   * begin   : August 2006
-   * @authors : Giacinto Piacquadio (Freiburg University) giacinto.piacquadio@physik.uni-freiburg.de 
-   */
-  
-  class TrackToVtxLink;
-  class Track;
-
-  class MVFVxTrackAtVertex: public VxTrackAtVertex
-  {
-    public:
-    
-   /**
-    * Default constructor
-    */
-      MVFVxTrackAtVertex(); 
-    
-   /** 
-    * Constructor requiring a chi2 per track and a track parameters at vertex as input
-    */
-      MVFVxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex);
-   
-   /**
-    * Constructor requiring a chi2 per track, track parameters at vertex 
-    * and initial perigee as input.
-    */
-      MVFVxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex, TrackParameters* initialPerigee);
-   
-   /**
-    * Constructor requiring a chi2 per track, track parameters at vertex 
-    * and a linearized track state.
-    */
-      MVFVxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex,
-		      double ndfPerTrk,Trk::LinearizedTrack * linState=nullptr);
-   
-   /**
-    *Constructor requiring a chi2 per track,initial track parameters, track parameters at vertex 
-    * and a linearized track state.
-    */
-      MVFVxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex,  TrackParameters* initialPerigee,
-		      double ndfPerTrk,Trk::LinearizedTrack * linState=nullptr); 
-
-    /**
-     * Constructor with only trackOrParticleLink (no TrackToVtxLink);
-     */
-
-      MVFVxTrackAtVertex(Trk::ITrackLink* trackOrParticleLink);
-	
-   /**
-    * Constructor using a link to vertices + trackParticle origin.
-    */
-      MVFVxTrackAtVertex(TrackToVtxLink* actuallink,
-					     const Track* track,
-					     const TrackCollection* trackTES);
-
-      MVFVxTrackAtVertex(TrackToVtxLink* actuallink,
-					     const Trk::TrackParticleBase* trackparticle,
-					     const Trk::TrackParticleBaseCollection* trkpartTES);
-
-   /**
    *
    */
 
-      MVFVxTrackAtVertex(Trk::ITrackLink* trackOrParticleLink,
-			 TrackToVtxLink* actuallink);
-	
-
-   /**
-    * Destructor
-    */
-      virtual ~MVFVxTrackAtVertex();
-    
-   /**
-    * Copy constructor
-    */
-      MVFVxTrackAtVertex(const MVFVxTrackAtVertex& rhs);
-  
-   /**
-    * Assignement operator
-    */ 
-      MVFVxTrackAtVertex &operator= (const MVFVxTrackAtVertex &);
-   
-   /**
-    * A clone method for the proper workings of the copy constructor in VxCandidate
-    */
-      virtual MVFVxTrackAtVertex* clone() const;           
-      
-   /**
-    * Unconst access to  linkToVertices object
-    */      
-      Trk::TrackToVtxLink * linkToVertices(void);
-   
-   /**
-    * Const access to  linkToVertices object
-    */
-      const Trk::TrackToVtxLink * linkToVertices(void) const;
-   
-   /**
-    * Set method for linkToVertices object
-    */
-      void setLinkToVertices(TrackToVtxLink* trk);
-
-   /**
-    * Output Method for MsgStream, to be overloaded by child classes
-    */
-      virtual MsgStream& dump(MsgStream& sl) const;
-
-   /**
-    * Output Method for std::ostream, to be overloaded by child classes
-    */
-      virtual std::ostream& dump(std::ostream& sl) const;
-
-  protected:
-
-   /**
-    * Pointer to the TrackToVtxLink object, which contains the association of this track with all the other vertices (multi vertex fit)
-    */
-      TrackToVtxLink* m_linkToVertices;
-      
-  };
-
-
-
-  inline Trk::MVFVxTrackAtVertex* Trk::MVFVxTrackAtVertex::clone() const
-  {
-      return new MVFVxTrackAtVertex(*this);
-  }
-
-  inline Trk::TrackToVtxLink * Trk::MVFVxTrackAtVertex::linkToVertices(void) {
-    return m_linkToVertices;
-  }
-  
-  inline const Trk::TrackToVtxLink * Trk::MVFVxTrackAtVertex::linkToVertices(void) const {
-    return m_linkToVertices;
-  }
-  
+  MVFVxTrackAtVertex(Trk::ITrackLink* trackOrParticleLink,
+                     TrackToVtxLink* actuallink);
 
+  /**
+   * Destructor
+   */
+  virtual ~MVFVxTrackAtVertex();
 
+  /**
+   * Copy constructor
+   */
+  MVFVxTrackAtVertex(const MVFVxTrackAtVertex& rhs);
 
-}
-#endif
+  /**
+   * Assignement operator
+   */
+  MVFVxTrackAtVertex& operator=(const MVFVxTrackAtVertex&);
 
+  /**
+   * A clone method for the proper workings of the copy constructor in
+   * VxCandidate
+   */
+  virtual MVFVxTrackAtVertex* clone() const override;
 
+  /**
+   * Unconst access to  linkToVertices object
+   */
+  Trk::TrackToVtxLink* linkToVertices(void);
 
+  /**
+   * Const access to  linkToVertices object
+   */
+  const Trk::TrackToVtxLink* linkToVertices(void) const;
+
+  /**
+   * Set method for linkToVertices object
+   */
+  void setLinkToVertices(TrackToVtxLink* trk);
 
+  /**
+   * Output Method for MsgStream, to be overloaded by child classes
+   */
+  virtual MsgStream& dump(MsgStream& sl) const override;
+
+  /**
+   * Output Method for std::ostream, to be overloaded by child classes
+   */
+  virtual std::ostream& dump(std::ostream& sl) const override;
+
+protected:
+  /**
+   * Pointer to the TrackToVtxLink object, which contains the association of
+   * this track with all the other vertices (multi vertex fit)
+   */
+  TrackToVtxLink* m_linkToVertices;
+};
+
+inline Trk::MVFVxTrackAtVertex*
+Trk::MVFVxTrackAtVertex::clone() const
+{
+  return new MVFVxTrackAtVertex(*this);
+}
+
+inline Trk::TrackToVtxLink*
+Trk::MVFVxTrackAtVertex::linkToVertices(void)
+{
+  return m_linkToVertices;
+}
+
+inline const Trk::TrackToVtxLink*
+Trk::MVFVxTrackAtVertex::linkToVertices(void) const
+{
+  return m_linkToVertices;
+}
+
+}
+#endif
 
diff --git a/Tracking/TrkEvent/VxMultiVertex/src/MVFVxCandidate.cxx b/Tracking/TrkEvent/VxMultiVertex/src/MVFVxCandidate.cxx
index e02941e3077e2472de903454fc0dbf5c2812ac47..caf2b62f820955d2a4d1fa886aeb1f85895b0804 100755
--- a/Tracking/TrkEvent/VxMultiVertex/src/MVFVxCandidate.cxx
+++ b/Tracking/TrkEvent/VxMultiVertex/src/MVFVxCandidate.cxx
@@ -47,10 +47,8 @@ namespace Trk {
 
 
 
-  MVFVxCandidate::MVFVxCandidate(const MVFVxCandidate& rhs) :
-    VxCandidate(rhs),
-    m_fitInfo(rhs.m_fitInfo),
-    m_initialized(rhs.m_initialized) {}
+  MVFVxCandidate::MVFVxCandidate(const MVFVxCandidate& rhs) 
+    = default;
 
   MVFVxCandidate& MVFVxCandidate::operator= (const MVFVxCandidate& rhs)
   {
@@ -64,7 +62,7 @@ namespace Trk {
   }
   
   MVFVxCandidate::~MVFVxCandidate()
-  {}
+  = default;
   
   MsgStream& MVFVxCandidate::dump(MsgStream& sl) const {
     sl << "Printing Trk::MVFVxCandidate:" << endmsg;
diff --git a/Tracking/TrkEvent/VxMultiVertex/src/MVFVxTrackAtVertex.cxx b/Tracking/TrkEvent/VxMultiVertex/src/MVFVxTrackAtVertex.cxx
index 7df28883ca01aa59fcfce866b6394b53f2e8112e..2ef23d482b0925d7e23f21f757e5fe3f8594efaa 100755
--- a/Tracking/TrkEvent/VxMultiVertex/src/MVFVxTrackAtVertex.cxx
+++ b/Tracking/TrkEvent/VxMultiVertex/src/MVFVxTrackAtVertex.cxx
@@ -104,10 +104,9 @@ namespace Trk {
   }
 
 //copy constructor changed
-  MVFVxTrackAtVertex::MVFVxTrackAtVertex(const MVFVxTrackAtVertex& rhs) :
-    VxTrackAtVertex(rhs),
-    m_linkToVertices(rhs.m_linkToVertices)
-  {}
+  MVFVxTrackAtVertex::MVFVxTrackAtVertex(const MVFVxTrackAtVertex& rhs) 
+    
+  = default;
 
 
 //assignement operator changed
diff --git a/Tracking/TrkEvent/VxVertex/VxVertex/LinearizedTrack.h b/Tracking/TrkEvent/VxVertex/VxVertex/LinearizedTrack.h
index d9bde19a09628197a40b4d2b13f307bd41bead6c..fa1703dda89cf0d2083fd00408c5de4af0c51857 100755
--- a/Tracking/TrkEvent/VxVertex/VxVertex/LinearizedTrack.h
+++ b/Tracking/TrkEvent/VxVertex/VxVertex/LinearizedTrack.h
@@ -6,21 +6,21 @@
 //  LinearizedTrack (c) ATLAS Inner Detector Software  2006
 ////////////////////////////////////////////////////////////////////////////
 /**
- * @class Trk::LinearizedTrack.h 
+ * @class Trk::LinearizedTrack.h
  *
- * Caching class to store the parameters of expansion of the   
- * measurement equation in the vicinity of the vertex. 
+ * Caching class to store the parameters of expansion of the
+ * measurement equation in the vicinity of the vertex.
  *
  * See [1] Billoir and Qian et  al. NIM A311 (1992) 139-150 and
  * [2] R, Fruehwirth et al. Comp. Phys. Comm 96(1996) 189-208 for reference.
  *
  * The actiual way of expansion depends on the factory used. We assume
- * that by default a FullPerigeeLinearized track factory, implementing 
+ * that by default a FullPerigeeLinearized track factory, implementing
  * an exact solution is used.
  *
  * This is a replacement of a former PerigeeLinearizedTrack class
  *
- * @authors 
+ * @authors
  *                 Kirill Prokofiev <Kirill.Prokofiev@cern.ch>,
  *                 Andreas Wildauer <Andreas.Wildauer@cern.ch>,
  *                 Giacinto Piacquadio <nicola.giacinto.piacquadio@cern.ch>
@@ -32,168 +32,150 @@
 #ifndef VXVERTEX_LINEARIZEDTRACK_H
 #define VXVERTEX_LINEARIZEDTRACK_H
 
-#include "GeoPrimitives/GeoPrimitives.h"
 #include "EventPrimitives/EventPrimitives.h"
+#include "GeoPrimitives/GeoPrimitives.h"
 
 class MsgStream;
 
-namespace Trk
+namespace Trk {
+
+class LinearizedTrack
 {
 
- class  LinearizedTrack
- {
- 
-  public:
+public:
+
+  /**
+   * Constructor taking the perigee parameters  and covariance matrix
+   * of the track, propagated to the point of closest approach of
+   * linearization point, position and momentum Jacobians, constant
+   * term of expansion, chi2, and weight of the current track.
+   */
+  LinearizedTrack(const AmgVector(5) & expectedParametersAtPCA,
+                  const AmgSymMatrix(5) & expectedParErrorAtPCA,
+                  const Amg::Vector3D& linPoint,
+                  const AmgMatrix(5, 3) & positionJacobian,
+                  const AmgMatrix(5, 3) & momentumJacobian,
+                  const Amg::Vector3D& expectedPosition,
+                  const Amg::Vector3D& expectedMomentum,
+                  const AmgVector(5) & constantTerm);
+
   
+  ///default operations
+  LinearizedTrack() = default;
+  LinearizedTrack(const LinearizedTrack&) = default;
+  LinearizedTrack(LinearizedTrack&&) = default;
+  LinearizedTrack& operator=(const LinearizedTrack&) = default;
+  LinearizedTrack& operator=(LinearizedTrack&&) = default;
+  ~LinearizedTrack() = default;
   
+  LinearizedTrack* clone() const;
+
   /**
-    * Default constructor
-    */
-    LinearizedTrack();
-      
-   /**
-    * Copy constructor
-    */
-    LinearizedTrack(const LinearizedTrack & ); 
-
-   /**
-    * Constructor taking the perigee parameters  and covariance matrix 
-    * of the track, propagated to the point of closest approach of 
-    * linearization point, position and momentum Jacobians, constant 
-    * term of expansion, chi2, and weight of the current track.    
-    */    
-    LinearizedTrack(const AmgVector(5)&    expectedParametersAtPCA,
-                    const AmgSymMatrix(5)& expectedParErrorAtPCA,
-		    const Amg::Vector3D&   linPoint,      
-		    const AmgMatrix(5,3)&  positionJacobian,       
-	            const AmgMatrix(5,3)&  momentumJacobian,   	      
-	            const Amg::Vector3D&   expectedPosition,   	      
-	            const Amg::Vector3D&   expectedMomentum,   	      
-	            const AmgVector(5)&    constantTerm);
-   /**
-    * Assignement operator
-    */
-    LinearizedTrack & operator= (const LinearizedTrack &);  
-    
-   /**
-    * Clone method
-    */ 
-    LinearizedTrack * clone() const;
-    
-   /** 
-    *Output Method for MsgStream, to be overloaded by child classes 
-    */
-    virtual MsgStream& dump(MsgStream& sl) const;
-    
-   /** 
-    * Output Method for std::ostream, to be overloaded by child classes 
-    */
-    virtual std::ostream& dump(std::ostream& sl) const;
-
-   /**
-    * Default destructor
-    */
-    virtual ~LinearizedTrack();
-
-   /**
-    * Position Jacobian access
-    */
-    const AmgMatrix(5,3) & positionJacobian() const 
-    {
-     return m_PositionJacobian;
-    }
-   
-   /**
-    * Momentum Jacobian access
-    */
-    const AmgMatrix(5,3) & momentumJacobian() const 
-    {
-     return m_MomentumJacobian;
-    } 
-
-   /**
-    * Access to the expected position at point of 
-    * closet approach
-    */
-    const Amg::Vector3D & expectedPositionAtPCA() const 
-    {
-     return m_ExpectedPositionAtPOCA;
-    }
-  
-   /**
-    * Access to the expected momentum at point of 
-    * closet approach
-    */
-    const Amg::Vector3D &  expectedMomentumAtPCA() const 
-    {
-     return m_ExpectedMomentumAtPOCA;
-    }
+   *Output Method for MsgStream, to be overloaded by child classes
+   */
+  MsgStream& dump(MsgStream& sl) const;
+
+  /**
+   * Output Method for std::ostream, to be overloaded by child classes
+   */
+  std::ostream& dump(std::ostream& sl) const;
+
+
+  /**
+   * Position Jacobian access
+   */
+  const AmgMatrix(5, 3) & positionJacobian() const
+  {
+    return m_PositionJacobian;
+  }
+
+  /**
+   * Momentum Jacobian access
+   */
+  const AmgMatrix(5, 3) & momentumJacobian() const
+  {
+    return m_MomentumJacobian;
+  }
+
+  /**
+   * Access to the expected position at point of
+   * closet approach
+   */
+  const Amg::Vector3D& expectedPositionAtPCA() const
+  {
+    return m_ExpectedPositionAtPOCA;
+  }
+
+  /**
+   * Access to the expected momentum at point of
+   * closet approach
+   */
+  const Amg::Vector3D& expectedMomentumAtPCA() const
+  {
+    return m_ExpectedMomentumAtPOCA;
+  }
 
   /**
    * A constant term of Taylor expansion
    */
-    const AmgVector(5) & constantTerm() const 
-    {
-     return m_ConstantTerm;
-    }
-    
+  const AmgVector(5) & constantTerm() const { return m_ConstantTerm; }
+
   /**
-   * Access to the covariance and weight matrix of the 
-   * trajectory state. The parametrization obtained 
+   * Access to the covariance and weight matrix of the
+   * trajectory state. The parametrization obtained
    * through these methods depends on the actual TrackParameters
-   * current LinearizedTrack was created with. So far it can 
+   * current LinearizedTrack was created with. So far it can
    * be perigee for charged track or "quasy perigee" for
    * a neutral one. In the latter case, the 1/p is used instead of
    * the corresponding q/p data member.
-   */       
-   const AmgSymMatrix(5) & expectedCovarianceAtPCA() const;
-   
+   */
+  const AmgSymMatrix(5) & expectedCovarianceAtPCA() const;
+
   /**
    * Access to the expected weight matrix at point of closest approach.
-   * Note that m_ExpectedCovarianceAtPOCA stores a covariance matrix, this function
-   * will just invert it. No caching mechanism is implemented for now.
+   * Note that m_ExpectedCovarianceAtPOCA stores a covariance matrix, this
+   * function will just invert it. No caching mechanism is implemented for now.
    */
-   AmgSymMatrix(5) expectedWeightAtPCA() const;
-   
+  AmgSymMatrix(5) expectedWeightAtPCA() const;
+
   /**
    * Access to the parameters at point of closest approach
-   */  
-   const AmgVector(5) & expectedParametersAtPCA() const;
-  
+   */
+  const AmgVector(5) & expectedParametersAtPCA() const;
+
   /**
    * Class validity check
-   */   
-   bool isValid() const
-   {return m_vl;}
-  
+   */
+  bool isValid() const { return m_vl; }
+
   /**
    * An access to an actual linearization point.
-   */   
-   const Amg::Vector3D& linearizationPoint() const
-   {return m_linPoint;} 
-   
-  private:
- 
-   AmgVector(5) m_ExpectedParametersAtPOCA;
-   AmgSymMatrix(5) m_ExpectedCovarianceAtPOCA;
-   Amg::Vector3D m_linPoint;
-   AmgMatrix(5,3) m_PositionJacobian;
-   AmgMatrix(5,3) m_MomentumJacobian;
-   Amg::Vector3D m_ExpectedPositionAtPOCA;
-   Amg::Vector3D m_ExpectedMomentumAtPOCA;
-   AmgVector(5) m_ConstantTerm;
- 
-   bool m_vl; //validity flag: false if the class was created with default constructor,
-               //true otherwise    
- 
- };//end of class definitions
+   */
+  const Amg::Vector3D& linearizationPoint() const { return m_linPoint; }
+
+private:
+  AmgVector(5) m_ExpectedParametersAtPOCA;
+  AmgSymMatrix(5) m_ExpectedCovarianceAtPOCA;
+  Amg::Vector3D m_linPoint;
+  AmgMatrix(5, 3) m_PositionJacobian;
+  AmgMatrix(5, 3) m_MomentumJacobian;
+  Amg::Vector3D m_ExpectedPositionAtPOCA;
+  Amg::Vector3D m_ExpectedMomentumAtPOCA;
+  AmgVector(5) m_ConstantTerm;
+
+  bool m_vl = false; // validity flag: false if the class was created with
+                     // default constructor, true otherwise
+
+}; // end of class definitions
 
 /**
- * Overload of << operator for both, MsgStream and std::ostream 
+ * Overload of << operator for both, MsgStream and std::ostream
  * for debug output
- */ 
- MsgStream& operator << ( MsgStream& sl, const LinearizedTrack& sf);
- std::ostream& operator << ( std::ostream& sl, const LinearizedTrack& sf); 
+ */
+MsgStream&
+operator<<(MsgStream& sl, const LinearizedTrack& sf);
+std::ostream&
+operator<<(std::ostream& sl, const LinearizedTrack& sf);
 
-}//end of namespace definitions
+} // end of namespace definitions
 #endif
diff --git a/Tracking/TrkEvent/VxVertex/VxVertex/VxTrackAtVertex.h b/Tracking/TrkEvent/VxVertex/VxVertex/VxTrackAtVertex.h
index 9381e152ca4df39d1fabcc0547f0df37d87e6949..6b9c5731ac19932ed70fdd5e15d46a08b301c6be 100755
--- a/Tracking/TrkEvent/VxVertex/VxVertex/VxTrackAtVertex.h
+++ b/Tracking/TrkEvent/VxVertex/VxVertex/VxTrackAtVertex.h
@@ -7,531 +7,383 @@
                              -------------------
     begin   : 03-03-2004
     changes : 28-02-2006 by Kirill Prokofiev
-    email   : Kirill.Prokofiev@cern.ch    
+    email   : Kirill.Prokofiev@cern.ch
               Added pointer to the PerigeeLinearizedTrack required by
-	      iterative vertex fitters
+              iterative vertex fitters
     changes : 28-02-2006 by Giacinto Piacquadio
     changes : added support for non integer ndf < 2 (2 remains default)
               (adaptive vertexing methods)
     changes : 20-03-2006 by Kirill Prokofiev
-            : Equality operator added	      
-    changes : 27-03-2006 by Kirill Prokofiev	      
+            : Equality operator added
+    changes : 27-03-2006 by Kirill Prokofiev
               added support for storage of the refitted track state
-	      for vertex fitters with track smoothing.
+              for vertex fitters with track smoothing.
     changes:  06-04-2006 by Giacinto Piacquadio
               added support for ParametersBase At the ImpactPoint in 3d Plane
     changes:  08-06-2006 by Kirill Prokofiev
-              set methods added. Allow to use the smoothed chi2 of tracks.  
+              set methods added. Allow to use the smoothed chi2 of tracks.
     changes:  05-12-2006 by Kirill Prokofiev
               EDM cleanup: private ElementLink, modified FitQuality instead
-	      of separate ndf and chi2.             
+              of separate ndf and chi2.
  ***************************************************************************/
 
 #ifndef VXVERTEX_VXTRACKATVERTEX_H
 #define VXVERTEX_VXTRACKATVERTEX_H
 
-#include "TrkParameters/TrackParameters.h"
-#include "TrkNeutralParameters/NeutralParameters.h"
-#include "VxVertex/LinearizedTrack.h"
 #include "TrkEventPrimitives/FitQuality.h"
+#include "TrkNeutralParameters/NeutralParameters.h"
+#include "TrkParameters/TrackParameters.h"
 #include "TrkTrackLink/ITrackLink.h"
+#include "VxVertex/LinearizedTrack.h"
 #include <atomic>
 
 class MsgStream;
 
-namespace Trk
-{
+namespace Trk {
 
 /**
  * The VxTrackAtVertex is a common class for all present TrkVertexFitters
- * The VxTrackAtVertex is designed to store the information about the trajectory 
- * fitted to the VxCandidate.  
+ * The VxTrackAtVertex is designed to store the information about the trajectory
+ * fitted to the VxCandidate.
  * The values of VxTrackAtVertex's datamembers are set in different ways,
  * depending on which Vertex Fitter was used in the reconstruction.
  * The general functionality is the following:
  *
- * -- const initialPerigee(void) const: always returns the initial (before vertex fit)
- * perigee state  of the trajectory
+ * -- const initialPerigee(void) const: always returns the initial (before
+ * vertex fit) perigee state  of the trajectory
  *
  * -- const Trk::Track* origTrack(void) const: returns a pointer to the original
  * track if tracks were used for the vertex fit. In case the vertex was fitted
  * directly out of a vector of ParametersBase, this pointer will be zero.
  *
  * -- const Trk::ParametersBase* perigeeAtVertex(void) const: returns a
- * perigee parameters of the trajectory defined with respect to the fitted vertex.
- * In the case of Full Billoir Vertex Fit or any iterative vertex fit (Sequential, Kalman, etc)
- * with subsequent smoothing, the trajectory is defined _at_ the vertex position: d0 = 0.; z_0 = 0. 
+ * perigee parameters of the trajectory defined with respect to the fitted
+ * vertex. In the case of Full Billoir Vertex Fit or any iterative vertex fit
+ * (Sequential, Kalman, etc) with subsequent smoothing, the trajectory is
+ * defined _at_ the vertex position: d0 = 0.; z_0 = 0.
  *
- * In the case no refit of trajectory with  the knowledge of the vertex was performed
- * (Billoir Fast fit, iterative vertex fits without smoothing), the trajectory is just
- * extrapolated to the point of the closest approach in the transverse plane
- * to the fitted vertex and  perigee parameters with  respect to that vertex are calculated.
+ * In the case no refit of trajectory with  the knowledge of the vertex was
+ * performed (Billoir Fast fit, iterative vertex fits without smoothing), the
+ * trajectory is just extrapolated to the point of the closest approach in the
+ * transverse plane to the fitted vertex and  perigee parameters with  respect
+ * to that vertex are calculated.
  *
- * @author andreas.wildauer@cern.ch, Kirill.Prokofiev@cern.ch, Giacinto.Piacquadio@physik.uni-freiburg.de   
+ * @author andreas.wildauer@cern.ch, Kirill.Prokofiev@cern.ch,
+ * Giacinto.Piacquadio@physik.uni-freiburg.de
  */
 
-  //class ParametersBase;
-  
-  class VxTrackAtVertex
-  {
-  
-    public:
-    
-   /**
-    * Default constructor
-    */  
-      VxTrackAtVertex();
-
-    /**
-     * Move constructor operator
-     */
-      VxTrackAtVertex (VxTrackAtVertex &&) noexcept;
-
-   /**
-    * Constructor taking the perigee parameters and corresponding 
-    * Chi2 value. NOTE: using this constructor does not allow to store the
-    * initial (before refit) Perigee parameters of the track. 
-    */
-      VxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex, NeutralParameters* neutralPerigeeAtVertex=nullptr);
-      
-    /**
-     * Constructor taking the  perigee parameters of the track, chi2,
-     * and the initial TrackParameters of the track.
-     */ 
-      VxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex, NeutralParameters* neutralPerigeeAtVertex, const TrackParameters* initialPerigee, const NeutralParameters* initialNeutralPerigee);
-      VxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex, const TrackParameters* initialPerigee);
-
-    /**
-     * Constructor required for iterative vertex fitters only (with and without link to original track).
-     * In addition to the previous ones, it asks for a pointer to the LinearizedTrack
-     */
-      VxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex, NeutralParameters* neutralPerigeeAtVertex,
-		      double ndfPerTrk,LinearizedTrack * linState=nullptr);
-      VxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex,
-		      double ndfPerTrk,LinearizedTrack * linState=nullptr);
-		     
-    /**
-     * Constructor required for iterative vertex fitters only (with and without link to original track).
-     * In addition to the previous ones, it asks for a pointer to the LinearizedTrack, but also needs an
-     * initial track parameters.
-     */
-      VxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex, NeutralParameters* neutralPerigeeAtVertex,  const TrackParameters* initialPerigee, const NeutralParameters* initialNeutralPerigee,
-		      double ndfPerTrk,LinearizedTrack * linState=nullptr); 
-      VxTrackAtVertex(double chi2PerTrk, TrackParameters* perigeeAtVertex, const TrackParameters* initialPerigee,
-		      double ndfPerTrk,LinearizedTrack * linState=nullptr); 
-
-      VxTrackAtVertex(ITrackLink* trackOrParticleLink);
-
-      virtual ~VxTrackAtVertex();
-      
-    /**
-     * Copy constructor
-     */  
-      VxTrackAtVertex(const VxTrackAtVertex& rhs);
-    
-    /**
-     * Assignment operator
-     */
-      VxTrackAtVertex &operator= (const VxTrackAtVertex &);  
-     
-    /**
-     * Move assignment operator
-     */
-      VxTrackAtVertex &operator= (VxTrackAtVertex &&) noexcept;
-     
-    /**
-     * Clone method
-     */
-      virtual VxTrackAtVertex* clone() const;                
-         
-    /**
-     * Output Method for MsgStream, to be overloaded by child classes
-     */
-      virtual MsgStream& dump(MsgStream& sl) const;
-    
-    /**
-     * Output Method for std::ostream, to be overloaded by child classes
-     */
-      virtual std::ostream& dump(std::ostream& sl) const;
-    
-    /**
-     * Returns a pointer to the original track if any
-     */ 
-//       const Track* origTrack(void) const;
-      
-    /**
-     * Track Quality (Chi2 and ndf per track in a veretx fit)
-     */    
-      FitQuality trackQuality(void) const;       
-      
-    /**
-     * Perigee parameters with respect to fitted vertex
-     * d_0 and z_0 are equal to 0 in case the trajectory was refitted
-     * with the knowledge of the reconstructed vertex 
-     */  
-      const TrackParameters* perigeeAtVertex(void) const; 
-
-    /**
-     * Access to the initial perigee parameters of trajectory
-     */
-      virtual const TrackParameters* initialPerigee(void) const; 
- 
-
-    /**
-     * Perigee parameters with respect to fitted vertex
-     * d_0 and z_0 are equal to 0 in case the trajectory was refitted
-     * with the knowledge of the reconstructed vertex 
-     */  
-      const NeutralParameters* neutralPerigeeAtVertex(void) const; 
-
-    /**
-     * Access to the initial perigee parameters of trajectory
-     */
-      virtual const NeutralParameters* initialNeutralPerigee(void) const; 
- 
-     
-    /**
-     * Set methods for various components
-     */
-      void setTrackQuality(const FitQuality& trkQuality);
- 
-     
-    /**
-     * Setting up the initial track.
-     */ 
-      void setOrigTrack(ITrackLink * trk);
-
-
-    /**
-     * Setting up the initial track, without caching parameters.
-     */ 
-      void setOrigTrackNoCache(ITrackLink * trk);
-
-
-    /**
-     * Setting up the linearized track.
-     */  
-      void setLinTrack(LinearizedTrack * myLinTrack);
-      
-    /**
-     * Setting up parameters at vertex.
-     */   
-      void setPerigeeAtVertex(TrackParameters * perigee);
-      void setPerigeeAtVertex(NeutralParameters * perigee);
-     
-    /**
-     * This method changes a pointer to original perigee of the track.
-     * If the object has EL to Track, the pointer
-     * will not be changed. Use setOrigTrack() method for that.
-     */ 
-      void setInitialPerigee(const TrackParameters * perigee); 
-
-    /**
-     * This method changes a pointer to original perigee of the neutral.
-     * If the object has EL to Neutral, the pointer
-     * will not be changed. Use setOrigTrack() method for that.
-     */ 
-      void setInitialPerigee(const NeutralParameters * perigee); 
-      
-    /**
-     * Equality operator required when working with vectors
-     * Compares only the equality of the parameters of the 
-     *  Perigee with which this object was created.
-     */
-      bool operator==(const VxTrackAtVertex & data) const;
-      
-    /**
-     * Access method for the perigee linearized track
-     */
-      LinearizedTrack * linState(void); 
-      
-      const LinearizedTrack * linState(void) const;      
-
-    /**
-     * Information about fast compatibility estimation, to be given to the annealing
-     */      
-      double vtxCompatibility(void) const;
-      
-      void setVtxCompatibility(const double);
-     
-    /**
-     * Information about the weight of track in fit (given back by annealing): weight=ndf/2
-     */    
-      double weight(void) const;
-      
-    /**
-     * Set method for a weight
-     */      
-      void setWeight(const double);
-     
-    /**
-     * Set method for ImpactPoint3dAtaPlane.
-     */
-      void setImpactPoint3dAtaPlane(const AtaPlane* myIP3dAtaPlane);
-      
-    /**
-     * Returns ImpactPoint3dAtaPlane.(const access) 
-     */
-      const AtaPlane * ImpactPoint3dAtaPlane(void) const;
-
-    /**
-     * Set method for ImpactPoint3dNeutralAtaPlane.
-     */
-      void setImpactPoint3dNeutralAtaPlane(const NeutralAtaPlane* myIP3dNeutralAtaPlane);
-      
-    /**
-     * Returns ImpactPoint3dNeutralAtaPlane.(const access) 
-     */
-      const NeutralAtaPlane * ImpactPoint3dNeutralAtaPlane(void) const;
-
-      
-
-//hack: access methods  to the new link:  
-      const  ITrackLink * trackOrParticleLink(void) const;
-      
-      ITrackLink * trackOrParticleLink(void); 
-      
-      /**return number of objects currently created*/
-      static unsigned int numberOfInstantiations() ;
-
-  protected:
-    
-    /** 
-     * The chi2 and number of degrees of freedom of the track
-     */
-      FitQuality  m_fitQuality;
-      
-    /**
-     * Weight of the track with respect to vertex
-     */  
-      double m_trkWeight;
-     
-    /** 									     
-     * Value of the compatibility of the track to the actual vertex, based	     
-     * on the estimation on the distance between the track and the vertex through    
-     * the IP3dAtaPlane or IP3dNeutralAtaPlane.							     
-     */ 									     
-      double m_VertexCompatibility;         
-      
-    /** 
-     *  The perigee parameters of tracks used in the fit
-     *  wrt. the fitted vertex. In case the vertex fitter used
-     *  includes smoothing, this perigee state is set to 
-     *  refitted track state after the fit.
-     *  These values are written to the VxPrimary part of the CBNT. 
-     */
-      TrackParameters* m_perigeeAtVertex;
-
-    /** 
-     *  The perigee parameters of neutrals used in the fit
-     *  wrt. the fitted vertex. In case the vertex fitter used
-     *  includes smoothing, this perigee state is set to 
-     *  refitted neutral state after the fit.
-     *  These values are written to the VxPrimary part of the CBNT. 
-     */
-      NeutralParameters* m_neutralPerigeeAtVertex;
-       
-    /** 							     
-     * Linearized track, required for the iterative vertex fitting    
-     */ 							     
-      LinearizedTrack * m_linState;
-       
-    /** 							     
-     * Pointer to initial (before fit) perigee state of the track.   
-     * It is stored separately for the back-compatibility issues:    
-     * in some cases the vertex fit may be done directly on the      
-     * vector of TrackParameterss, instead of vector of tracks.      
-     */ 							     
-      const TrackParameters * m_initialPerigee;
-      const NeutralParameters * m_initialNeutralPerigee;
-       
-    /** 									       
-     * Pointer to the TrackParameters defined on the Plane with center the actual      
-     * vertex estimate and passing through the point of closest approach in 3d from    
-     * this vertex to the track, with direction of track perpendicular to the plane.   
-     * Needed by the IVertexTrackCompatibilityEstimator to estimate in a faster way    
-     * the compatibility of a vertex with the track.				       
-     */ 									       
-      const AtaPlane * m_ImpactPoint3dAtaPlane;
-      const NeutralAtaPlane * m_ImpactPoint3dNeutralAtaPlane;
-  
-//hacks related to the new link structure
-      ITrackLink * m_trackOrParticleLink;  
-    
-    private:
-      /** number of objects of this type in memory */
-      static std::atomic_uint s_numberOfInstantiations;
-  
-  };//end of class definitions
-  
-  inline const  ITrackLink * VxTrackAtVertex::trackOrParticleLink(void) const
-  {
-   return m_trackOrParticleLink; 
-  }
-  
-  inline ITrackLink * VxTrackAtVertex::trackOrParticleLink(void)
-  {
-   return m_trackOrParticleLink;
-  }
-  
-  inline const TrackParameters*  VxTrackAtVertex::initialPerigee(void) const
-  {
-    if (m_initialPerigee!=nullptr) return m_initialPerigee;//as default always return the proper object (be consistent!)  
-    if(m_trackOrParticleLink!=nullptr) return m_trackOrParticleLink->parameters();
-    return nullptr;													    
-  }
-
-  inline const NeutralParameters*  VxTrackAtVertex::initialNeutralPerigee(void) const
-  {
-    if (m_initialNeutralPerigee!=nullptr) return m_initialNeutralPerigee;//as default always return the proper object (be consistent!)  
-    if(m_trackOrParticleLink!=nullptr) return m_trackOrParticleLink->neutralParameters();
-    return nullptr;													    
-  }
-
-  inline VxTrackAtVertex* VxTrackAtVertex::clone() const
-  {
-    return new VxTrackAtVertex(*this);
-  }
-
-  inline void VxTrackAtVertex::setImpactPoint3dAtaPlane(const AtaPlane * myIP3dAtaPlane)
-  { 
-    if (m_ImpactPoint3dAtaPlane != nullptr) delete m_ImpactPoint3dAtaPlane;
-    m_ImpactPoint3dAtaPlane=myIP3dAtaPlane;
-  }  
-
-  inline const AtaPlane * VxTrackAtVertex::ImpactPoint3dAtaPlane(void) const
-  {
-    return m_ImpactPoint3dAtaPlane;
-  }
-
-  inline void VxTrackAtVertex::setImpactPoint3dNeutralAtaPlane(const NeutralAtaPlane * myIP3dNeutralAtaPlane)
-  { 
-    if (m_ImpactPoint3dNeutralAtaPlane != nullptr) delete m_ImpactPoint3dNeutralAtaPlane;
-    m_ImpactPoint3dNeutralAtaPlane=myIP3dNeutralAtaPlane;
-  }  
-
-  inline const NeutralAtaPlane * VxTrackAtVertex::ImpactPoint3dNeutralAtaPlane(void) const
-  {
-    return m_ImpactPoint3dNeutralAtaPlane;
-  }
-
-  inline void VxTrackAtVertex::setWeight(const double weight)
-  {
-    m_trkWeight = weight;
-  }
-
-  inline double VxTrackAtVertex::weight(void) const 
-  {
-    return m_trkWeight;
-  }
-
-  inline void VxTrackAtVertex::setVtxCompatibility(const double vtxCompatibility)
-  {
-    m_VertexCompatibility=vtxCompatibility;
-  }
-
-  inline double VxTrackAtVertex::vtxCompatibility(void) const 
-  {
-    return m_VertexCompatibility;
-  }
-
-  inline LinearizedTrack * VxTrackAtVertex::linState(void)
-  {
-   return m_linState;
-  }
-
-  inline const LinearizedTrack * VxTrackAtVertex::linState(void) const
-  {
-   return m_linState;
-  }
-
-  inline FitQuality VxTrackAtVertex::trackQuality(void) const
-  {
-    return m_fitQuality;
-  }
-  
-  inline const TrackParameters* VxTrackAtVertex::perigeeAtVertex(void) const
-  {
-    return m_perigeeAtVertex;
-  }
-
-  inline const NeutralParameters* VxTrackAtVertex::neutralPerigeeAtVertex(void) const
-  {
-    return m_neutralPerigeeAtVertex;
-  }
-
-  inline void VxTrackAtVertex::setTrackQuality(const FitQuality& trkQuality)
-  {   
-    m_fitQuality = trkQuality;
-  } 
-
-  inline void VxTrackAtVertex::setPerigeeAtVertex(TrackParameters * perigee)
-  {
-    if (m_perigeeAtVertex != nullptr) delete m_perigeeAtVertex;
-    m_perigeeAtVertex = perigee;
-  }
-
-  inline void VxTrackAtVertex::setPerigeeAtVertex(NeutralParameters * perigee)
-  {
-    if (m_neutralPerigeeAtVertex != nullptr) delete m_neutralPerigeeAtVertex;
-    m_neutralPerigeeAtVertex = perigee;
-  }
-  
-  inline void VxTrackAtVertex::setLinTrack(LinearizedTrack * myLinTrack)
-  {
-    if (m_linState != nullptr) delete m_linState;
-    m_linState=myLinTrack;
-  }
-
-  inline void VxTrackAtVertex::setOrigTrack(ITrackLink* trk)
-  {
-    delete m_trackOrParticleLink;
-//setting first the actual pointer:
-    m_trackOrParticleLink = trk;    
-
-//setting the initial perigee to be consistent with this 
-// new track    
-    if(trk != nullptr)
-    {
-     // delete initialPerigee before, otherwise memleak!!
-//      if (m_initialPerigee!=0) { delete m_initialPerigee; m_initialPerigee=0; }
-//      const TrackParameters * tmpInPer = trk->parameters();
-      m_initialPerigee = trk->parameters();
-      m_initialNeutralPerigee = trk->neutralParameters();
-    }else {
-      m_initialPerigee = nullptr;
-      m_initialNeutralPerigee = nullptr;
-    }
-  }//end of setOrigTrack method
-  
-  inline void VxTrackAtVertex::setOrigTrackNoCache(ITrackLink* trk)
-  {
-    delete m_trackOrParticleLink;
-    m_trackOrParticleLink = trk;    
-
-    m_initialPerigee = nullptr;
-    m_initialNeutralPerigee = nullptr;
-  }//end of setOrigTrackNocache method
-  
-  inline void VxTrackAtVertex::setInitialPerigee(const TrackParameters * perigee)
-  {
-   if(m_trackOrParticleLink == nullptr) m_initialPerigee = perigee;
-  }
-
-  inline void VxTrackAtVertex::setInitialPerigee(const NeutralParameters * perigee)
-  {
-   if(m_trackOrParticleLink == nullptr) m_initialNeutralPerigee = perigee;
-  }
-  
-/**Overload of << operator for both, MsgStream and std::ostream for debug 
-output; only needed in base class? */ 
-MsgStream& operator << ( MsgStream& sl, const VxTrackAtVertex& sf);
-std::ostream& operator << ( std::ostream& sl, const VxTrackAtVertex& sf); 
-  
-}//end of namespace definitions
-#endif
-
-
+// class ParametersBase;
 
+class VxTrackAtVertex
+{
 
+public:
+  /**
+   * Default constructor
+   */
+  VxTrackAtVertex();
+
+  /**
+   * Move constructor operator
+   */
+  VxTrackAtVertex(VxTrackAtVertex&&) noexcept;
+
+  /**
+   * Constructor taking the perigee parameters and corresponding
+   * Chi2 value. NOTE: using this constructor does not allow to store the
+   * initial (before refit) Perigee parameters of the track.
+   */
+  VxTrackAtVertex(double chi2PerTrk,
+                  TrackParameters* perigeeAtVertex,
+                  NeutralParameters* neutralPerigeeAtVertex = nullptr);
+
+  /**
+   * Constructor taking the  perigee parameters of the track, chi2,
+   * and the initial TrackParameters of the track.
+   */
+  VxTrackAtVertex(double chi2PerTrk,
+                  TrackParameters* perigeeAtVertex,
+                  NeutralParameters* neutralPerigeeAtVertex,
+                  const TrackParameters* initialPerigee,
+                  const NeutralParameters* initialNeutralPerigee);
+  VxTrackAtVertex(double chi2PerTrk,
+                  TrackParameters* perigeeAtVertex,
+                  const TrackParameters* initialPerigee);
+
+  /**
+   * Constructor required for iterative vertex fitters only (with and without
+   * link to original track). In addition to the previous ones, it asks for a
+   * pointer to the LinearizedTrack
+   */
+  VxTrackAtVertex(double chi2PerTrk,
+                  TrackParameters* perigeeAtVertex,
+                  NeutralParameters* neutralPerigeeAtVertex,
+                  double ndfPerTrk,
+                  LinearizedTrack* linState = nullptr);
+  VxTrackAtVertex(double chi2PerTrk,
+                  TrackParameters* perigeeAtVertex,
+                  double ndfPerTrk,
+                  LinearizedTrack* linState = nullptr);
+
+  /**
+   * Constructor required for iterative vertex fitters only (with and without
+   * link to original track). In addition to the previous ones, it asks for a
+   * pointer to the LinearizedTrack, but also needs an initial track parameters.
+   */
+  VxTrackAtVertex(double chi2PerTrk,
+                  TrackParameters* perigeeAtVertex,
+                  NeutralParameters* neutralPerigeeAtVertex,
+                  const TrackParameters* initialPerigee,
+                  const NeutralParameters* initialNeutralPerigee,
+                  double ndfPerTrk,
+                  LinearizedTrack* linState = nullptr);
+  VxTrackAtVertex(double chi2PerTrk,
+                  TrackParameters* perigeeAtVertex,
+                  const TrackParameters* initialPerigee,
+                  double ndfPerTrk,
+                  LinearizedTrack* linState = nullptr);
+
+  VxTrackAtVertex(ITrackLink* trackOrParticleLink);
+
+  virtual ~VxTrackAtVertex();
+
+  /**
+   * Copy constructor
+   */
+  VxTrackAtVertex(const VxTrackAtVertex& rhs);
+
+  /**
+   * Assignment operator
+   */
+  VxTrackAtVertex& operator=(const VxTrackAtVertex&);
+
+  /**
+   * Move assignment operator
+   */
+  VxTrackAtVertex& operator=(VxTrackAtVertex&&) noexcept;
+
+  /**
+   * Clone method
+   */
+  virtual VxTrackAtVertex* clone() const;
+
+  /**
+   * Output Method for MsgStream, to be overloaded by child classes
+   */
+  virtual MsgStream& dump(MsgStream& sl) const;
+
+  /**
+   * Output Method for std::ostream, to be overloaded by child classes
+   */
+  virtual std::ostream& dump(std::ostream& sl) const;
+
+  /**
+   * Returns a pointer to the original track if any
+   */
+  //       const Track* origTrack(void) const;
+
+  /**
+   * Track Quality (Chi2 and ndf per track in a veretx fit)
+   */
+  FitQuality trackQuality(void) const;
+
+  /**
+   * Perigee parameters with respect to fitted vertex
+   * d_0 and z_0 are equal to 0 in case the trajectory was refitted
+   * with the knowledge of the reconstructed vertex
+   */
+  const TrackParameters* perigeeAtVertex(void) const;
+
+  /**
+   * Access to the initial perigee parameters of trajectory
+   */
+  const TrackParameters* initialPerigee(void) const;
+
+  /**
+   * Perigee parameters with respect to fitted vertex
+   * d_0 and z_0 are equal to 0 in case the trajectory was refitted
+   * with the knowledge of the reconstructed vertex
+   */
+  const NeutralParameters* neutralPerigeeAtVertex(void) const;
+
+  /**
+   * Access to the initial perigee parameters of trajectory
+   */
+  const NeutralParameters* initialNeutralPerigee(void) const;
+
+  /**
+   * Set methods for various components
+   */
+  void setTrackQuality(const FitQuality& trkQuality);
+
+  /**
+   * Setting up the initial track.
+   */
+  void setOrigTrack(ITrackLink* trk);
+
+  /**
+   * Setting up the initial track, without caching parameters.
+   */
+  void setOrigTrackNoCache(ITrackLink* trk);
+
+  /**
+   * Setting up the linearized track.
+   */
+  void setLinTrack(LinearizedTrack* myLinTrack);
+
+  /**
+   * Setting up parameters at vertex.
+   */
+  void setPerigeeAtVertex(TrackParameters* perigee);
+  void setPerigeeAtVertex(NeutralParameters* perigee);
+
+  /**
+   * This method changes a pointer to original perigee of the track.
+   * If the object has EL to Track, the pointer
+   * will not be changed. Use setOrigTrack() method for that.
+   */
+  void setInitialPerigee(const TrackParameters* perigee);
+
+  /**
+   * This method changes a pointer to original perigee of the neutral.
+   * If the object has EL to Neutral, the pointer
+   * will not be changed. Use setOrigTrack() method for that.
+   */
+  void setInitialPerigee(const NeutralParameters* perigee);
+
+  /**
+   * Equality operator required when working with vectors
+   * Compares only the equality of the parameters of the
+   *  Perigee with which this object was created.
+   */
+  bool operator==(const VxTrackAtVertex& data) const;
+
+  /**
+   * Access method for the perigee linearized track
+   */
+  LinearizedTrack* linState(void);
+
+  const LinearizedTrack* linState(void) const;
+
+  /**
+   * Information about fast compatibility estimation, to be given to the
+   * annealing
+   */
+  double vtxCompatibility(void) const;
+
+  void setVtxCompatibility(const double);
+
+  /**
+   * Information about the weight of track in fit (given back by annealing):
+   * weight=ndf/2
+   */
+  double weight(void) const;
+
+  /**
+   * Set method for a weight
+   */
+  void setWeight(const double);
+
+  /**
+   * Set method for ImpactPoint3dAtaPlane.
+   */
+  void setImpactPoint3dAtaPlane(const AtaPlane* myIP3dAtaPlane);
+
+  /**
+   * Returns ImpactPoint3dAtaPlane.(const access)
+   */
+  const AtaPlane* ImpactPoint3dAtaPlane(void) const;
+
+  /**
+   * Set method for ImpactPoint3dNeutralAtaPlane.
+   */
+  void setImpactPoint3dNeutralAtaPlane(
+    const NeutralAtaPlane* myIP3dNeutralAtaPlane);
+
+  /**
+   * Returns ImpactPoint3dNeutralAtaPlane.(const access)
+   */
+  const NeutralAtaPlane* ImpactPoint3dNeutralAtaPlane(void) const;
+
+  // hack: access methods  to the new link:
+  const ITrackLink* trackOrParticleLink(void) const;
+
+  ITrackLink* trackOrParticleLink(void);
+
+  /**return number of objects currently created*/
+  static unsigned int numberOfInstantiations();
+
+protected:
+  /**
+   * The chi2 and number of degrees of freedom of the track
+   */
+  FitQuality m_fitQuality;
+
+  /**
+   * Weight of the track with respect to vertex
+   */
+  double m_trkWeight;
+
+  /**
+   * Value of the compatibility of the track to the actual vertex, based
+   * on the estimation on the distance between the track and the vertex through
+   * the IP3dAtaPlane or IP3dNeutralAtaPlane.
+   */
+  double m_VertexCompatibility;
+
+  /**
+   *  The perigee parameters of tracks used in the fit
+   *  wrt. the fitted vertex. In case the vertex fitter used
+   *  includes smoothing, this perigee state is set to
+   *  refitted track state after the fit.
+   *  These values are written to the VxPrimary part of the CBNT.
+   */
+  TrackParameters* m_perigeeAtVertex;
+
+  /**
+   *  The perigee parameters of neutrals used in the fit
+   *  wrt. the fitted vertex. In case the vertex fitter used
+   *  includes smoothing, this perigee state is set to
+   *  refitted neutral state after the fit.
+   *  These values are written to the VxPrimary part of the CBNT.
+   */
+  NeutralParameters* m_neutralPerigeeAtVertex;
+
+  /**
+   * Linearized track, required for the iterative vertex fitting
+   */
+  LinearizedTrack* m_linState;
+
+  /**
+   * Pointer to initial (before fit) perigee state of the track.
+   * It is stored separately for the back-compatibility issues:
+   * in some cases the vertex fit may be done directly on the
+   * vector of TrackParameterss, instead of vector of tracks.
+   */
+  const TrackParameters* m_initialPerigee;
+  const NeutralParameters* m_initialNeutralPerigee;
+
+  /**
+   * Pointer to the TrackParameters defined on the Plane with center the actual
+   * vertex estimate and passing through the point of closest approach in 3d
+   * from this vertex to the track, with direction of track perpendicular to the
+   * plane. Needed by the IVertexTrackCompatibilityEstimator to estimate in a
+   * faster way the compatibility of a vertex with the track.
+   */
+  const AtaPlane* m_ImpactPoint3dAtaPlane;
+  const NeutralAtaPlane* m_ImpactPoint3dNeutralAtaPlane;
+
+  // new link structure
+  ITrackLink* m_trackOrParticleLink;
+
+private:
+  /** number of objects of this type in memory */
+  static std::atomic_uint s_numberOfInstantiations;
+
+}; // end of class definitions
+
+} // end of namespace definitions
+
+#include "VxVertex/VxTrackAtVertex.icc"
+#endif
 
diff --git a/Tracking/TrkEvent/VxVertex/VxVertex/VxTrackAtVertex.icc b/Tracking/TrkEvent/VxVertex/VxVertex/VxTrackAtVertex.icc
new file mode 100644
index 0000000000000000000000000000000000000000..ac313d2e5cf72b036acf20547c2721f6786cb8b6
--- /dev/null
+++ b/Tracking/TrkEvent/VxVertex/VxVertex/VxTrackAtVertex.icc
@@ -0,0 +1,213 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+namespace Trk {
+inline const ITrackLink*
+VxTrackAtVertex::trackOrParticleLink(void) const
+{
+  return m_trackOrParticleLink;
+}
+
+inline ITrackLink*
+VxTrackAtVertex::trackOrParticleLink(void)
+{
+  return m_trackOrParticleLink;
+}
+
+inline const TrackParameters*
+VxTrackAtVertex::initialPerigee(void) const
+{
+  if (m_initialPerigee != nullptr)
+    return m_initialPerigee; // as default always return the proper object (be
+                             // consistent!)
+  if (m_trackOrParticleLink != nullptr)
+    return m_trackOrParticleLink->parameters();
+  return nullptr;
+}
+
+inline const NeutralParameters*
+VxTrackAtVertex::initialNeutralPerigee(void) const
+{
+  if (m_initialNeutralPerigee != nullptr)
+    return m_initialNeutralPerigee; // as default always return the proper
+                                    // object (be consistent!)
+  if (m_trackOrParticleLink != nullptr)
+    return m_trackOrParticleLink->neutralParameters();
+  return nullptr;
+}
+
+inline VxTrackAtVertex*
+VxTrackAtVertex::clone() const
+{
+  return new VxTrackAtVertex(*this);
+}
+
+inline void
+VxTrackAtVertex::setImpactPoint3dAtaPlane(const AtaPlane* myIP3dAtaPlane)
+{
+  if (m_ImpactPoint3dAtaPlane != nullptr)
+    delete m_ImpactPoint3dAtaPlane;
+  m_ImpactPoint3dAtaPlane = myIP3dAtaPlane;
+}
+
+inline const AtaPlane*
+VxTrackAtVertex::ImpactPoint3dAtaPlane(void) const
+{
+  return m_ImpactPoint3dAtaPlane;
+}
+
+inline void
+VxTrackAtVertex::setImpactPoint3dNeutralAtaPlane(
+  const NeutralAtaPlane* myIP3dNeutralAtaPlane)
+{
+  if (m_ImpactPoint3dNeutralAtaPlane != nullptr)
+    delete m_ImpactPoint3dNeutralAtaPlane;
+  m_ImpactPoint3dNeutralAtaPlane = myIP3dNeutralAtaPlane;
+}
+
+inline const NeutralAtaPlane*
+VxTrackAtVertex::ImpactPoint3dNeutralAtaPlane(void) const
+{
+  return m_ImpactPoint3dNeutralAtaPlane;
+}
+
+inline void
+VxTrackAtVertex::setWeight(const double weight)
+{
+  m_trkWeight = weight;
+}
+
+inline double
+VxTrackAtVertex::weight(void) const
+{
+  return m_trkWeight;
+}
+
+inline void
+VxTrackAtVertex::setVtxCompatibility(const double vtxCompatibility)
+{
+  m_VertexCompatibility = vtxCompatibility;
+}
+
+inline double
+VxTrackAtVertex::vtxCompatibility(void) const
+{
+  return m_VertexCompatibility;
+}
+
+inline LinearizedTrack*
+VxTrackAtVertex::linState(void)
+{
+  return m_linState;
+}
+
+inline const LinearizedTrack*
+VxTrackAtVertex::linState(void) const
+{
+  return m_linState;
+}
+
+inline FitQuality
+VxTrackAtVertex::trackQuality(void) const
+{
+  return m_fitQuality;
+}
+
+inline const TrackParameters*
+VxTrackAtVertex::perigeeAtVertex(void) const
+{
+  return m_perigeeAtVertex;
+}
+
+inline const NeutralParameters*
+VxTrackAtVertex::neutralPerigeeAtVertex(void) const
+{
+  return m_neutralPerigeeAtVertex;
+}
+
+inline void
+VxTrackAtVertex::setTrackQuality(const FitQuality& trkQuality)
+{
+  m_fitQuality = trkQuality;
+}
+
+inline void
+VxTrackAtVertex::setPerigeeAtVertex(TrackParameters* perigee)
+{
+  if (m_perigeeAtVertex != nullptr)
+    delete m_perigeeAtVertex;
+  m_perigeeAtVertex = perigee;
+}
+
+inline void
+VxTrackAtVertex::setPerigeeAtVertex(NeutralParameters* perigee)
+{
+  if (m_neutralPerigeeAtVertex != nullptr)
+    delete m_neutralPerigeeAtVertex;
+  m_neutralPerigeeAtVertex = perigee;
+}
+
+inline void
+VxTrackAtVertex::setLinTrack(LinearizedTrack* myLinTrack)
+{
+  if (m_linState != nullptr)
+    delete m_linState;
+  m_linState = myLinTrack;
+}
+
+inline void
+VxTrackAtVertex::setOrigTrack(ITrackLink* trk)
+{
+  delete m_trackOrParticleLink;
+  // setting first the actual pointer:
+  m_trackOrParticleLink = trk;
+
+  // setting the initial perigee to be consistent with this
+  // new track
+  if (trk != nullptr) {
+    // delete initialPerigee before, otherwise memleak!!
+    //      if (m_initialPerigee!=0) { delete m_initialPerigee;
+    //      m_initialPerigee=0; } const TrackParameters * tmpInPer =
+    //      trk->parameters();
+    m_initialPerigee = trk->parameters();
+    m_initialNeutralPerigee = trk->neutralParameters();
+  } else {
+    m_initialPerigee = nullptr;
+    m_initialNeutralPerigee = nullptr;
+  }
+} // end of setOrigTrack method
+
+inline void
+VxTrackAtVertex::setOrigTrackNoCache(ITrackLink* trk)
+{
+  delete m_trackOrParticleLink;
+  m_trackOrParticleLink = trk;
+
+  m_initialPerigee = nullptr;
+  m_initialNeutralPerigee = nullptr;
+} // end of setOrigTrackNocache method
+
+inline void
+VxTrackAtVertex::setInitialPerigee(const TrackParameters* perigee)
+{
+  if (m_trackOrParticleLink == nullptr)
+    m_initialPerigee = perigee;
+}
+
+inline void
+VxTrackAtVertex::setInitialPerigee(const NeutralParameters* perigee)
+{
+  if (m_trackOrParticleLink == nullptr)
+    m_initialNeutralPerigee = perigee;
+}
+
+/**Overload of << operator for both, MsgStream and std::ostream for debug
+output; only needed in base class? */
+MsgStream&
+operator<<(MsgStream& sl, const VxTrackAtVertex& sf);
+std::ostream&
+operator<<(std::ostream& sl, const VxTrackAtVertex& sf);
+
+}
+
diff --git a/Tracking/TrkEvent/VxVertex/src/LinearizedTrack.cxx b/Tracking/TrkEvent/VxVertex/src/LinearizedTrack.cxx
index 6e5d5b08dabb9e176237d0655e5f469440f20920..b456aa88ac59e4366698f49513ecc629e9c55fc2 100755
--- a/Tracking/TrkEvent/VxVertex/src/LinearizedTrack.cxx
+++ b/Tracking/TrkEvent/VxVertex/src/LinearizedTrack.cxx
@@ -6,9 +6,9 @@
                            LinearizedTrack.cxx  -  Description
                              -------------------
     begin   : 11/2006
-    comments: 
-    changes : 
-              
+    comments:
+    changes :
+
  ***************************************************************************/
 
 #include "VxVertex/LinearizedTrack.h"
@@ -16,140 +16,103 @@
 
 namespace Trk {
 
-    LinearizedTrack::LinearizedTrack() : 
-    // m_ExpectedParametersAtPOCA(5),
-    // m_ExpectedCovarianceAtPOCA(5,5),
-    // m_linPoint(0.,0.,0.),
-    // m_PositionJacobian(5,3,0),
-    // m_MomentumJacobian(5,3,0),
-    // m_ExpectedPositionAtPOCA(3),
-    // m_ExpectedMomentumAtPOCA(3),
-    // m_ConstantTerm(5),
-    m_vl(false)
-    {
-      m_ExpectedParametersAtPOCA.setZero();
-      m_ExpectedCovarianceAtPOCA.setZero();
-      m_linPoint.setZero();
-      m_PositionJacobian.setZero();
-      m_MomentumJacobian.setZero();
-      m_ExpectedPositionAtPOCA.setZero();
-      m_ExpectedMomentumAtPOCA.setZero();
-      m_ConstantTerm.setZero();
-    }
-    
-
-   LinearizedTrack::LinearizedTrack(const AmgVector(5)& expectedParametersAtPCA,
-                                    const AmgSymMatrix(5) &  expectedParErrorAtPCA,
-				    const Amg::Vector3D & linPoint,      
-				    const AmgMatrix(5,3) & positionJacobian,
-				    const AmgMatrix(5,3) & momentumJacobian,
-				    const Amg::Vector3D & expectedPositionAtPCA,
-                                    const Amg::Vector3D & expectedMomentumAtPCA,
-				    const AmgVector(5) & constantTerm):
-    m_ExpectedParametersAtPOCA(expectedParametersAtPCA),
-    m_ExpectedCovarianceAtPOCA(expectedParErrorAtPCA),
-    m_linPoint(linPoint),
-    m_PositionJacobian(positionJacobian),
-    m_MomentumJacobian(momentumJacobian),
-    m_ExpectedPositionAtPOCA(expectedPositionAtPCA),
-    m_ExpectedMomentumAtPOCA(expectedMomentumAtPCA),
-    m_ConstantTerm(constantTerm),
-    m_vl(true)
-    {}
-  
-  
-  
-    LinearizedTrack::LinearizedTrack(const LinearizedTrack & rhs) :
-    m_ExpectedParametersAtPOCA(rhs.m_ExpectedParametersAtPOCA),
-    m_ExpectedCovarianceAtPOCA(rhs.m_ExpectedCovarianceAtPOCA),
-    m_linPoint(rhs.m_linPoint),
-    m_PositionJacobian(rhs.m_PositionJacobian),
-    m_MomentumJacobian(rhs.m_MomentumJacobian),
-    m_ExpectedPositionAtPOCA(rhs.m_ExpectedPositionAtPOCA),
-    m_ExpectedMomentumAtPOCA(rhs.m_ExpectedMomentumAtPOCA),
-    m_ConstantTerm(rhs.m_ConstantTerm),
-    m_vl(rhs.m_vl){}
+LinearizedTrack::LinearizedTrack(const AmgVector(5) & expectedParametersAtPCA,
+                                 const AmgSymMatrix(5) & expectedParErrorAtPCA,
+                                 const Amg::Vector3D& linPoint,
+                                 const AmgMatrix(5, 3) & positionJacobian,
+                                 const AmgMatrix(5, 3) & momentumJacobian,
+                                 const Amg::Vector3D& expectedPositionAtPCA,
+                                 const Amg::Vector3D& expectedMomentumAtPCA,
+                                 const AmgVector(5) & constantTerm)
+  : m_ExpectedParametersAtPOCA(expectedParametersAtPCA)
+  , m_ExpectedCovarianceAtPOCA(expectedParErrorAtPCA)
+  , m_linPoint(linPoint)
+  , m_PositionJacobian(positionJacobian)
+  , m_MomentumJacobian(momentumJacobian)
+  , m_ExpectedPositionAtPOCA(expectedPositionAtPCA)
+  , m_ExpectedMomentumAtPOCA(expectedMomentumAtPCA)
+  , m_ConstantTerm(constantTerm)
+  , m_vl(true)
+{}
 
-  
-//assignement operator implementation  
-  LinearizedTrack & LinearizedTrack::operator= (const LinearizedTrack& rhs)
-  {
-    if (this!=&rhs)
-    {
-      m_ExpectedParametersAtPOCA=rhs.m_ExpectedParametersAtPOCA;
-      m_ExpectedCovarianceAtPOCA=rhs.m_ExpectedCovarianceAtPOCA,
-      m_linPoint= rhs.m_linPoint;
-      m_PositionJacobian=rhs.m_PositionJacobian;
-      m_MomentumJacobian=rhs.m_MomentumJacobian;
-      m_ExpectedPositionAtPOCA=rhs.m_ExpectedPositionAtPOCA;
-      m_ExpectedMomentumAtPOCA=rhs.m_ExpectedMomentumAtPOCA;
-      m_ConstantTerm=rhs.m_ConstantTerm;
-      m_vl = rhs.m_vl;
-    }
-    return *this;
-  }
-  
-//clone method implemetation
-  LinearizedTrack * LinearizedTrack::clone() const
-  {
-    if(m_vl) { 
-      return new LinearizedTrack(m_ExpectedParametersAtPOCA,
-                                 m_ExpectedCovarianceAtPOCA,
-			         m_linPoint,
-				 m_PositionJacobian,
-				 m_MomentumJacobian,
-				 m_ExpectedPositionAtPOCA,
-				 m_ExpectedMomentumAtPOCA,
-				 m_ConstantTerm); 
-    } return new LinearizedTrack();				       	   
-  }//end of clone method 
-  
-  const AmgSymMatrix(5) & LinearizedTrack::expectedCovarianceAtPCA() const 
-  {
-    return m_ExpectedCovarianceAtPOCA;
-  }
-  
-  AmgSymMatrix(5) LinearizedTrack::expectedWeightAtPCA() const
-  {
-    //the m_ExpectedCovarianceAtPOCA stores a covariance matrix, need to invert to get weight matrix
-    //note: no check if matrix is invertible
-    return m_ExpectedCovarianceAtPOCA.inverse();
-  }
-  
-  const AmgVector(5) & LinearizedTrack::expectedParametersAtPCA() const {
-    return m_ExpectedParametersAtPOCA;
+// clone method implemetation
+LinearizedTrack*
+LinearizedTrack::clone() const
+{
+  if (m_vl) {
+    return new LinearizedTrack(m_ExpectedParametersAtPOCA,
+                               m_ExpectedCovarianceAtPOCA,
+                               m_linPoint,
+                               m_PositionJacobian,
+                               m_MomentumJacobian,
+                               m_ExpectedPositionAtPOCA,
+                               m_ExpectedMomentumAtPOCA,
+                               m_ConstantTerm);
   }
+  return new LinearizedTrack();
+} // end of clone method
 
-  MsgStream& LinearizedTrack::dump(MsgStream& sl) const {
-    sl << "Printing Trk::LinearizedTrack" << endmsg;
-    sl << "  Expected Position at POCA: "   << m_ExpectedPositionAtPOCA << endmsg;
-    sl << "  Expected Momentum at POCA: "   << m_ExpectedMomentumAtPOCA << endmsg;
-    sl << "  Expected parameters at POCA: " << m_ExpectedParametersAtPOCA << endmsg;
-    sl << "  Expected covariance at POCA: " << m_ExpectedCovarianceAtPOCA << endmsg;
-    sl << "  Position jacobian: "           << m_PositionJacobian << endmsg;
-    sl << "  Momentum jacobian: "           << m_MomentumJacobian << endmsg;
-    sl << "  Constant term: " << m_ConstantTerm << endmsg;
-    return sl;
-  }
+const AmgSymMatrix(5) & LinearizedTrack::expectedCovarianceAtPCA() const
+{
+  return m_ExpectedCovarianceAtPOCA;
+}
 
-  std::ostream& LinearizedTrack::dump(std::ostream& sl) const {
-    sl << "Printing Trk::LinearizedTrack" << std::endl;
-    sl << "  Expected Position at POCA: "   << m_ExpectedPositionAtPOCA << std::endl;
-    sl << "  Expected Momentum at POCA: "   << m_ExpectedMomentumAtPOCA << std::endl;
-    sl << "  Expected parameters at POCA: " << m_ExpectedParametersAtPOCA << std::endl;
-    sl << "  Expected covariance at POCA: " << m_ExpectedCovarianceAtPOCA << std::endl;
-    sl << "  Position jacobian: "           << m_PositionJacobian << std::endl;
-    sl << "  Momentum jacobian: "           << m_MomentumJacobian << std::endl;
-    sl << "  Constant term: " << m_ConstantTerm << std::endl;
-    return sl;
-  }
-  
-  MsgStream& operator << ( MsgStream& sl, const LinearizedTrack& sf) 
-  { return sf.dump(sl); }
+AmgSymMatrix(5) LinearizedTrack::expectedWeightAtPCA() const
+{
+  // the m_ExpectedCovarianceAtPOCA stores a covariance matrix, need to invert
+  // to get weight matrix note: no check if matrix is invertible
+  return m_ExpectedCovarianceAtPOCA.inverse();
+}
+
+const AmgVector(5) & LinearizedTrack::expectedParametersAtPCA() const
+{
+  return m_ExpectedParametersAtPOCA;
+}
+
+MsgStream&
+LinearizedTrack::dump(MsgStream& sl) const
+{
+  sl << "Printing Trk::LinearizedTrack" << endmsg;
+  sl << "  Expected Position at POCA: " << m_ExpectedPositionAtPOCA << endmsg;
+  sl << "  Expected Momentum at POCA: " << m_ExpectedMomentumAtPOCA << endmsg;
+  sl << "  Expected parameters at POCA: " << m_ExpectedParametersAtPOCA
+     << endmsg;
+  sl << "  Expected covariance at POCA: " << m_ExpectedCovarianceAtPOCA
+     << endmsg;
+  sl << "  Position jacobian: " << m_PositionJacobian << endmsg;
+  sl << "  Momentum jacobian: " << m_MomentumJacobian << endmsg;
+  sl << "  Constant term: " << m_ConstantTerm << endmsg;
+  return sl;
+}
+
+std::ostream&
+LinearizedTrack::dump(std::ostream& sl) const
+{
+  sl << "Printing Trk::LinearizedTrack" << std::endl;
+  sl << "  Expected Position at POCA: " << m_ExpectedPositionAtPOCA
+     << std::endl;
+  sl << "  Expected Momentum at POCA: " << m_ExpectedMomentumAtPOCA
+     << std::endl;
+  sl << "  Expected parameters at POCA: " << m_ExpectedParametersAtPOCA
+     << std::endl;
+  sl << "  Expected covariance at POCA: " << m_ExpectedCovarianceAtPOCA
+     << std::endl;
+  sl << "  Position jacobian: " << m_PositionJacobian << std::endl;
+  sl << "  Momentum jacobian: " << m_MomentumJacobian << std::endl;
+  sl << "  Constant term: " << m_ConstantTerm << std::endl;
+  return sl;
+}
+
+MsgStream&
+operator<<(MsgStream& sl, const LinearizedTrack& sf)
+{
+  return sf.dump(sl);
+}
+
+std::ostream&
+operator<<(std::ostream& sl, const LinearizedTrack& sf)
+{
+  return sf.dump(sl);
+}
 
-  std::ostream& operator << ( std::ostream& sl, const LinearizedTrack& sf) 
-  { return sf.dump(sl); }
-  
-  LinearizedTrack::~LinearizedTrack() {}
-  
 } // end of namespace
diff --git a/Tracking/TrkEvent/VxVertex/src/RecVertex.cxx b/Tracking/TrkEvent/VxVertex/src/RecVertex.cxx
index c45fc5d3a5923e77134c33332acb7838d20491bc..99d42a5fe807120c0ba37b35b81fc4ee20310559 100755
--- a/Tracking/TrkEvent/VxVertex/src/RecVertex.cxx
+++ b/Tracking/TrkEvent/VxVertex/src/RecVertex.cxx
@@ -59,7 +59,7 @@ namespace Trk {
     return sl;
   }
 
-  RecVertex::~RecVertex() {}
+  RecVertex::~RecVertex() = default;
 
   const Trk::FitQuality& RecVertex::fitQuality() const
   {return m_fitQuality;}
diff --git a/Tracking/TrkEvent/VxVertex/src/VxTrackAtVertex.cxx b/Tracking/TrkEvent/VxVertex/src/VxTrackAtVertex.cxx
index 3b098b3ee5bdb3411462a96594734ed09d49d9d8..ab53551929807cb294348934ed2a2b5f511f21b4 100755
--- a/Tracking/TrkEvent/VxVertex/src/VxTrackAtVertex.cxx
+++ b/Tracking/TrkEvent/VxVertex/src/VxTrackAtVertex.cxx
@@ -18,368 +18,435 @@
 #include "GaudiKernel/MsgStream.h"
 
 namespace Trk {
-  std::atomic_uint VxTrackAtVertex::s_numberOfInstantiations=0;
-  
-  VxTrackAtVertex::VxTrackAtVertex() :
-                              m_fitQuality(Trk::FitQuality(0.,2.)),
-			      m_trkWeight(1.),
-			      m_VertexCompatibility(0.),
-                              m_perigeeAtVertex(nullptr),
-                              m_neutralPerigeeAtVertex(nullptr),
-                              m_linState(nullptr),
-                              m_initialPerigee(nullptr),
-                              m_initialNeutralPerigee(nullptr),
-			      m_ImpactPoint3dAtaPlane(nullptr), 
-			      m_ImpactPoint3dNeutralAtaPlane(nullptr),    
-                              m_trackOrParticleLink(nullptr)
-                              {
+std::atomic_uint VxTrackAtVertex::s_numberOfInstantiations = 0;
+
+VxTrackAtVertex::VxTrackAtVertex()
+  : m_fitQuality(Trk::FitQuality(0., 2.))
+  , m_trkWeight(1.)
+  , m_VertexCompatibility(0.)
+  , m_perigeeAtVertex(nullptr)
+  , m_neutralPerigeeAtVertex(nullptr)
+  , m_linState(nullptr)
+  , m_initialPerigee(nullptr)
+  , m_initialNeutralPerigee(nullptr)
+  , m_ImpactPoint3dAtaPlane(nullptr)
+  , m_ImpactPoint3dNeutralAtaPlane(nullptr)
+  , m_trackOrParticleLink(nullptr)
+{
 #ifndef NDEBUG
-                                s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
+  s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
 #endif
-                              }
-                             
-
-  VxTrackAtVertex::VxTrackAtVertex(double chi2PerTrk, Trk::TrackParameters* perigeeAtVertex, Trk::NeutralParameters* neutralPerigeeAtVertex) :
-                              m_fitQuality(Trk::FitQuality(chi2PerTrk,2.)),
-			      m_trkWeight(1.),
-			      m_VertexCompatibility(0.),
-                              m_perigeeAtVertex(perigeeAtVertex),
-                              m_neutralPerigeeAtVertex(neutralPerigeeAtVertex),
-                              m_linState(nullptr),
-                              m_initialPerigee(nullptr),
-                              m_initialNeutralPerigee(nullptr),
-			      m_ImpactPoint3dAtaPlane(nullptr),
-                              m_ImpactPoint3dNeutralAtaPlane(nullptr),
-			      m_trackOrParticleLink(nullptr)
-                              {
+}
+
+VxTrackAtVertex::VxTrackAtVertex(double chi2PerTrk,
+                                 Trk::TrackParameters* perigeeAtVertex,
+                                 Trk::NeutralParameters* neutralPerigeeAtVertex)
+  : m_fitQuality(Trk::FitQuality(chi2PerTrk, 2.))
+  , m_trkWeight(1.)
+  , m_VertexCompatibility(0.)
+  , m_perigeeAtVertex(perigeeAtVertex)
+  , m_neutralPerigeeAtVertex(neutralPerigeeAtVertex)
+  , m_linState(nullptr)
+  , m_initialPerigee(nullptr)
+  , m_initialNeutralPerigee(nullptr)
+  , m_ImpactPoint3dAtaPlane(nullptr)
+  , m_ImpactPoint3dNeutralAtaPlane(nullptr)
+  , m_trackOrParticleLink(nullptr)
+{
 #ifndef NDEBUG
-                                s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
+  s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
 #endif
-                              }
-
-  VxTrackAtVertex::VxTrackAtVertex(double chi2PerTrk, Trk::TrackParameters* perigeeAtVertex, Trk::NeutralParameters* neutralPerigeeAtVertex, 
-				   double ndfPerTrk, Trk::LinearizedTrack * linState):
-                              m_fitQuality(Trk::FitQuality(chi2PerTrk,ndfPerTrk)),
-			      m_trkWeight(1.),
-			      m_VertexCompatibility(0.),
-                              m_perigeeAtVertex(perigeeAtVertex),
-                              m_neutralPerigeeAtVertex(neutralPerigeeAtVertex),
-                              m_linState(linState),
-                              m_initialPerigee(nullptr),
-                              m_initialNeutralPerigee(nullptr),
-			      m_ImpactPoint3dAtaPlane(nullptr),
-                              m_ImpactPoint3dNeutralAtaPlane(nullptr),
-                              m_trackOrParticleLink(nullptr)
-                              {
+}
+
+VxTrackAtVertex::VxTrackAtVertex(double chi2PerTrk,
+                                 Trk::TrackParameters* perigeeAtVertex,
+                                 Trk::NeutralParameters* neutralPerigeeAtVertex,
+                                 double ndfPerTrk,
+                                 Trk::LinearizedTrack* linState)
+  : m_fitQuality(Trk::FitQuality(chi2PerTrk, ndfPerTrk))
+  , m_trkWeight(1.)
+  , m_VertexCompatibility(0.)
+  , m_perigeeAtVertex(perigeeAtVertex)
+  , m_neutralPerigeeAtVertex(neutralPerigeeAtVertex)
+  , m_linState(linState)
+  , m_initialPerigee(nullptr)
+  , m_initialNeutralPerigee(nullptr)
+  , m_ImpactPoint3dAtaPlane(nullptr)
+  , m_ImpactPoint3dNeutralAtaPlane(nullptr)
+  , m_trackOrParticleLink(nullptr)
+{
 #ifndef NDEBUG
-                                s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
+  s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
 #endif
-                              }
-  VxTrackAtVertex::VxTrackAtVertex(double chi2PerTrk, Trk::TrackParameters* perigeeAtVertex, 
-				   double ndfPerTrk, Trk::LinearizedTrack * linState):
-                              m_fitQuality(Trk::FitQuality(chi2PerTrk,ndfPerTrk)),
-			      m_trkWeight(1.),
-			      m_VertexCompatibility(0.),
-                              m_perigeeAtVertex(perigeeAtVertex),
-			      m_neutralPerigeeAtVertex(nullptr),
-                              m_linState(linState),
-                              m_initialPerigee(nullptr),
-			      m_initialNeutralPerigee(nullptr),
-			      m_ImpactPoint3dAtaPlane(nullptr),
-                              m_ImpactPoint3dNeutralAtaPlane(nullptr),
-                              m_trackOrParticleLink(nullptr)
-                              {
+}
+VxTrackAtVertex::VxTrackAtVertex(double chi2PerTrk,
+                                 Trk::TrackParameters* perigeeAtVertex,
+                                 double ndfPerTrk,
+                                 Trk::LinearizedTrack* linState)
+  : m_fitQuality(Trk::FitQuality(chi2PerTrk, ndfPerTrk))
+  , m_trkWeight(1.)
+  , m_VertexCompatibility(0.)
+  , m_perigeeAtVertex(perigeeAtVertex)
+  , m_neutralPerigeeAtVertex(nullptr)
+  , m_linState(linState)
+  , m_initialPerigee(nullptr)
+  , m_initialNeutralPerigee(nullptr)
+  , m_ImpactPoint3dAtaPlane(nullptr)
+  , m_ImpactPoint3dNeutralAtaPlane(nullptr)
+  , m_trackOrParticleLink(nullptr)
+{
 #ifndef NDEBUG
-                                s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
+  s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
 #endif
-                              }
-  
-//new constructors, including initial perigee state (refitting support)
-//Kirill Prokofiev 27-03-06  
-  VxTrackAtVertex::VxTrackAtVertex(double chi2PerTrk, 
-                                   Trk::TrackParameters* perigeeAtVertex, 
-                                   Trk::NeutralParameters* neutralPerigeeAtVertex, 
-				   const Trk::TrackParameters* initialPerigee,   
-				   const Trk::NeutralParameters* initialNeutralPerigee):   
-			           m_fitQuality(Trk::FitQuality(chi2PerTrk,2.)),
-				   m_trkWeight(1.),
-				   m_VertexCompatibility(0.),
-                                   m_perigeeAtVertex(perigeeAtVertex),
-                                   m_neutralPerigeeAtVertex(neutralPerigeeAtVertex),
-                                   m_linState(nullptr),
-                                   m_initialPerigee(initialPerigee),
-                                   m_initialNeutralPerigee(initialNeutralPerigee),
-	  		           m_ImpactPoint3dAtaPlane(nullptr),
-				   m_ImpactPoint3dNeutralAtaPlane(nullptr),
-                                   m_trackOrParticleLink(nullptr)
-                              {
+}
+
+// new constructors, including initial perigee state (refitting support)
+// Kirill Prokofiev 27-03-06
+VxTrackAtVertex::VxTrackAtVertex(
+  double chi2PerTrk,
+  Trk::TrackParameters* perigeeAtVertex,
+  Trk::NeutralParameters* neutralPerigeeAtVertex,
+  const Trk::TrackParameters* initialPerigee,
+  const Trk::NeutralParameters* initialNeutralPerigee)
+  : m_fitQuality(Trk::FitQuality(chi2PerTrk, 2.))
+  , m_trkWeight(1.)
+  , m_VertexCompatibility(0.)
+  , m_perigeeAtVertex(perigeeAtVertex)
+  , m_neutralPerigeeAtVertex(neutralPerigeeAtVertex)
+  , m_linState(nullptr)
+  , m_initialPerigee(initialPerigee)
+  , m_initialNeutralPerigee(initialNeutralPerigee)
+  , m_ImpactPoint3dAtaPlane(nullptr)
+  , m_ImpactPoint3dNeutralAtaPlane(nullptr)
+  , m_trackOrParticleLink(nullptr)
+{
 #ifndef NDEBUG
-                                s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
+  s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
 #endif
-                              }
-
-  VxTrackAtVertex::VxTrackAtVertex(double chi2PerTrk, 
-                                   Trk::TrackParameters* perigeeAtVertex, 
-				   const Trk::TrackParameters* initialPerigee):   
-			           m_fitQuality(Trk::FitQuality(chi2PerTrk,2.)),
-				   m_trkWeight(1.),
-				   m_VertexCompatibility(0.),
-                                   m_perigeeAtVertex(perigeeAtVertex),
-				   m_neutralPerigeeAtVertex(nullptr),
-                                   m_linState(nullptr),
-                                   m_initialPerigee(initialPerigee),
-                                   m_initialNeutralPerigee(nullptr),
-	  		           m_ImpactPoint3dAtaPlane(nullptr),
-				   m_ImpactPoint3dNeutralAtaPlane(nullptr),
-                                   m_trackOrParticleLink(nullptr)
-                              {
+}
+
+VxTrackAtVertex::VxTrackAtVertex(double chi2PerTrk,
+                                 Trk::TrackParameters* perigeeAtVertex,
+                                 const Trk::TrackParameters* initialPerigee)
+  : m_fitQuality(Trk::FitQuality(chi2PerTrk, 2.))
+  , m_trkWeight(1.)
+  , m_VertexCompatibility(0.)
+  , m_perigeeAtVertex(perigeeAtVertex)
+  , m_neutralPerigeeAtVertex(nullptr)
+  , m_linState(nullptr)
+  , m_initialPerigee(initialPerigee)
+  , m_initialNeutralPerigee(nullptr)
+  , m_ImpactPoint3dAtaPlane(nullptr)
+  , m_ImpactPoint3dNeutralAtaPlane(nullptr)
+  , m_trackOrParticleLink(nullptr)
+{
 #ifndef NDEBUG
-                                s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
+  s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
 #endif
-                              }
-  
-  VxTrackAtVertex::VxTrackAtVertex(double chi2PerTrk, 
-                                   Trk::TrackParameters* perigeeAtVertex,  
-                                   Trk::NeutralParameters* neutralPerigeeAtVertex,  
-				   const Trk::TrackParameters* initialPerigee,
-				   const Trk::NeutralParameters* initialNeutralPerigee,
-		                   double ndfPerTrk,
-				   Trk::LinearizedTrack * linState):
-			      m_fitQuality(Trk::FitQuality(chi2PerTrk,ndfPerTrk)),
-			      m_trkWeight(1.),
-                              m_VertexCompatibility(0.),
-                              m_perigeeAtVertex(perigeeAtVertex),
-                              m_neutralPerigeeAtVertex(neutralPerigeeAtVertex),
-                              m_linState(linState),
-                              m_initialPerigee(initialPerigee),
-                              m_initialNeutralPerigee(initialNeutralPerigee),
-			      m_ImpactPoint3dAtaPlane(nullptr),
-			      m_ImpactPoint3dNeutralAtaPlane(nullptr),
-                              m_trackOrParticleLink(nullptr)
-			      {
+}
+
+VxTrackAtVertex::VxTrackAtVertex(
+  double chi2PerTrk,
+  Trk::TrackParameters* perigeeAtVertex,
+  Trk::NeutralParameters* neutralPerigeeAtVertex,
+  const Trk::TrackParameters* initialPerigee,
+  const Trk::NeutralParameters* initialNeutralPerigee,
+  double ndfPerTrk,
+  Trk::LinearizedTrack* linState)
+  : m_fitQuality(Trk::FitQuality(chi2PerTrk, ndfPerTrk))
+  , m_trkWeight(1.)
+  , m_VertexCompatibility(0.)
+  , m_perigeeAtVertex(perigeeAtVertex)
+  , m_neutralPerigeeAtVertex(neutralPerigeeAtVertex)
+  , m_linState(linState)
+  , m_initialPerigee(initialPerigee)
+  , m_initialNeutralPerigee(initialNeutralPerigee)
+  , m_ImpactPoint3dAtaPlane(nullptr)
+  , m_ImpactPoint3dNeutralAtaPlane(nullptr)
+  , m_trackOrParticleLink(nullptr)
+{
 #ifndef NDEBUG
-                                s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
+  s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
 #endif
-                              }
-  VxTrackAtVertex::VxTrackAtVertex(double chi2PerTrk, 
-                                   Trk::TrackParameters* perigeeAtVertex,  
-				   const Trk::TrackParameters* initialPerigee,
-		                   double ndfPerTrk,
-				   Trk::LinearizedTrack * linState):
-			      m_fitQuality(Trk::FitQuality(chi2PerTrk,ndfPerTrk)),
-			      m_trkWeight(1.),
-                              m_VertexCompatibility(0.),
-                              m_perigeeAtVertex(perigeeAtVertex),
-                              m_neutralPerigeeAtVertex(nullptr),
-                              m_linState(linState),
-                              m_initialPerigee(initialPerigee),
-                              m_initialNeutralPerigee(nullptr),
-			      m_ImpactPoint3dAtaPlane(nullptr),
-			      m_ImpactPoint3dNeutralAtaPlane(nullptr),
-                              m_trackOrParticleLink(nullptr)
-			      {
+}
+VxTrackAtVertex::VxTrackAtVertex(double chi2PerTrk,
+                                 Trk::TrackParameters* perigeeAtVertex,
+                                 const Trk::TrackParameters* initialPerigee,
+                                 double ndfPerTrk,
+                                 Trk::LinearizedTrack* linState)
+  : m_fitQuality(Trk::FitQuality(chi2PerTrk, ndfPerTrk))
+  , m_trkWeight(1.)
+  , m_VertexCompatibility(0.)
+  , m_perigeeAtVertex(perigeeAtVertex)
+  , m_neutralPerigeeAtVertex(nullptr)
+  , m_linState(linState)
+  , m_initialPerigee(initialPerigee)
+  , m_initialNeutralPerigee(nullptr)
+  , m_ImpactPoint3dAtaPlane(nullptr)
+  , m_ImpactPoint3dNeutralAtaPlane(nullptr)
+  , m_trackOrParticleLink(nullptr)
+{
 #ifndef NDEBUG
-                                s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
+  s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
 #endif
-                              }
-  
-  VxTrackAtVertex::VxTrackAtVertex(Trk::ITrackLink* trackOrParticleLink):
-                                  m_fitQuality(Trk::FitQuality(0.,2.)),
-				  m_trkWeight(1.),
-				  m_VertexCompatibility(0.),
-				  m_perigeeAtVertex(nullptr),
-				  m_neutralPerigeeAtVertex(nullptr),
-				  m_linState(nullptr),
-				  m_initialPerigee(nullptr),
-				  m_initialNeutralPerigee(nullptr),
-				  m_ImpactPoint3dAtaPlane(nullptr),
-			          m_ImpactPoint3dNeutralAtaPlane(nullptr),
-                                  m_trackOrParticleLink (nullptr)
-  {  
-    this->setOrigTrack(trackOrParticleLink);
+}
+
+VxTrackAtVertex::VxTrackAtVertex(Trk::ITrackLink* trackOrParticleLink)
+  : m_fitQuality(Trk::FitQuality(0., 2.))
+  , m_trkWeight(1.)
+  , m_VertexCompatibility(0.)
+  , m_perigeeAtVertex(nullptr)
+  , m_neutralPerigeeAtVertex(nullptr)
+  , m_linState(nullptr)
+  , m_initialPerigee(nullptr)
+  , m_initialNeutralPerigee(nullptr)
+  , m_ImpactPoint3dAtaPlane(nullptr)
+  , m_ImpactPoint3dNeutralAtaPlane(nullptr)
+  , m_trackOrParticleLink(nullptr)
+{
+  this->setOrigTrack(trackOrParticleLink);
 #ifndef NDEBUG
-    s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
+  s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
 #endif
-  }
+}
 
-  
-//destructor changed
-  VxTrackAtVertex::~VxTrackAtVertex() 
-  { 
-   if (m_perigeeAtVertex !=nullptr) { delete m_perigeeAtVertex; m_perigeeAtVertex=nullptr; }
-   if (m_neutralPerigeeAtVertex !=nullptr) { delete m_neutralPerigeeAtVertex; m_neutralPerigeeAtVertex=nullptr; }
-   if (m_linState !=nullptr)        { delete m_linState;        m_linState=nullptr; } 
-//    if (m_initialPerigee !=0)  { delete m_initialPerigee;  m_initialPerigee=0; }
-   if (m_ImpactPoint3dAtaPlane!=nullptr) { delete m_ImpactPoint3dAtaPlane; m_ImpactPoint3dAtaPlane=nullptr; }
-   if (m_ImpactPoint3dNeutralAtaPlane!=nullptr) { delete m_ImpactPoint3dNeutralAtaPlane; m_ImpactPoint3dNeutralAtaPlane=nullptr; }
-   if (m_trackOrParticleLink!=nullptr) { delete m_trackOrParticleLink; m_trackOrParticleLink=nullptr; }
+// destructor changed
+VxTrackAtVertex::~VxTrackAtVertex()
+{
+  if (m_perigeeAtVertex != nullptr) {
+    delete m_perigeeAtVertex;
+    m_perigeeAtVertex = nullptr;
+  }
+  if (m_neutralPerigeeAtVertex != nullptr) {
+    delete m_neutralPerigeeAtVertex;
+    m_neutralPerigeeAtVertex = nullptr;
+  }
+  if (m_linState != nullptr) {
+    delete m_linState;
+    m_linState = nullptr;
+  }
+  //    if (m_initialPerigee !=0)  { delete m_initialPerigee;
+  //    m_initialPerigee=0; }
+  if (m_ImpactPoint3dAtaPlane != nullptr) {
+    delete m_ImpactPoint3dAtaPlane;
+    m_ImpactPoint3dAtaPlane = nullptr;
+  }
+  if (m_ImpactPoint3dNeutralAtaPlane != nullptr) {
+    delete m_ImpactPoint3dNeutralAtaPlane;
+    m_ImpactPoint3dNeutralAtaPlane = nullptr;
+  }
+  if (m_trackOrParticleLink != nullptr) {
+    delete m_trackOrParticleLink;
+    m_trackOrParticleLink = nullptr;
+  }
 #ifndef NDEBUG
-    s_numberOfInstantiations.fetch_sub(1, std::memory_order_relaxed);
+  s_numberOfInstantiations.fetch_sub(1, std::memory_order_relaxed);
 #endif
-  }
+}
 
-//copy constructor changed
-  VxTrackAtVertex::VxTrackAtVertex(const VxTrackAtVertex& rhs) :
-        m_fitQuality(rhs.m_fitQuality),
-	m_trkWeight(rhs.m_trkWeight),
-        m_VertexCompatibility(rhs.m_VertexCompatibility),
-        m_perigeeAtVertex(rhs.m_perigeeAtVertex ? rhs.m_perigeeAtVertex->clone() : nullptr),
-        m_neutralPerigeeAtVertex(rhs.m_neutralPerigeeAtVertex ? rhs.m_neutralPerigeeAtVertex->clone() : nullptr),
-	m_linState(rhs.m_linState ? rhs.m_linState->clone() : nullptr),
-// 	m_initialPerigee(rhs.m_initialPerigee ? rhs.m_initialPerigee->clone() : 0),
-	m_initialPerigee(rhs.m_initialPerigee),
-	m_initialNeutralPerigee(rhs.m_initialNeutralPerigee),
-	m_ImpactPoint3dAtaPlane(rhs.m_ImpactPoint3dAtaPlane ? new AtaPlane(*rhs.m_ImpactPoint3dAtaPlane) : nullptr),
-	m_ImpactPoint3dNeutralAtaPlane(rhs.m_ImpactPoint3dNeutralAtaPlane ? new NeutralAtaPlane(*rhs.m_ImpactPoint3dNeutralAtaPlane) : nullptr),
-        m_trackOrParticleLink(rhs.m_trackOrParticleLink ? rhs.m_trackOrParticleLink->clone() : nullptr)
-  {
+// copy constructor changed
+VxTrackAtVertex::VxTrackAtVertex(const VxTrackAtVertex& rhs)
+  : m_fitQuality(rhs.m_fitQuality)
+  , m_trkWeight(rhs.m_trkWeight)
+  , m_VertexCompatibility(rhs.m_VertexCompatibility)
+  , m_perigeeAtVertex(rhs.m_perigeeAtVertex ? rhs.m_perigeeAtVertex->clone()
+                                            : nullptr)
+  , m_neutralPerigeeAtVertex(rhs.m_neutralPerigeeAtVertex
+                               ? rhs.m_neutralPerigeeAtVertex->clone()
+                               : nullptr)
+  , m_linState(rhs.m_linState ? rhs.m_linState->clone() : nullptr)
+  ,
+  // 	m_initialPerigee(rhs.m_initialPerigee ? rhs.m_initialPerigee->clone() :
+  // 0),
+  m_initialPerigee(rhs.m_initialPerigee)
+  , m_initialNeutralPerigee(rhs.m_initialNeutralPerigee)
+  , m_ImpactPoint3dAtaPlane(rhs.m_ImpactPoint3dAtaPlane
+                              ? new AtaPlane(*rhs.m_ImpactPoint3dAtaPlane)
+                              : nullptr)
+  , m_ImpactPoint3dNeutralAtaPlane(
+      rhs.m_ImpactPoint3dNeutralAtaPlane
+        ? new NeutralAtaPlane(*rhs.m_ImpactPoint3dNeutralAtaPlane)
+        : nullptr)
+  , m_trackOrParticleLink(
+      rhs.m_trackOrParticleLink ? rhs.m_trackOrParticleLink->clone() : nullptr)
+{
 #ifndef NDEBUG
-    s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
+  s_numberOfInstantiations.fetch_add(1, std::memory_order_relaxed);
 #endif
-  }
-
+}
 
-//assignment operator changed
-  VxTrackAtVertex & VxTrackAtVertex::operator= (const VxTrackAtVertex& rhs)
-  {
-    if (this!=&rhs)
-    {
-      m_fitQuality = rhs.m_fitQuality;
-      m_trkWeight = rhs.m_trkWeight;
-      delete m_perigeeAtVertex;
-      m_perigeeAtVertex = rhs.m_perigeeAtVertex ? rhs.m_perigeeAtVertex->clone() : nullptr;
-      delete m_neutralPerigeeAtVertex;
-      m_neutralPerigeeAtVertex = rhs.m_neutralPerigeeAtVertex ? rhs.m_neutralPerigeeAtVertex->clone() : nullptr;
-      delete m_linState;
-      m_linState = rhs.m_linState ? rhs.m_linState->clone() : nullptr;
-//       m_initialPerigee = rhs.m_initialPerigee ? rhs.m_initialPerigee->clone() : 0;
-      m_initialPerigee = rhs.m_initialPerigee;
-      m_initialNeutralPerigee = rhs.m_initialNeutralPerigee;
-      delete m_ImpactPoint3dAtaPlane;
-      m_ImpactPoint3dAtaPlane=rhs.m_ImpactPoint3dAtaPlane ? new AtaPlane(*rhs.m_ImpactPoint3dAtaPlane) : nullptr;
-      delete m_ImpactPoint3dNeutralAtaPlane;
-      m_ImpactPoint3dNeutralAtaPlane=rhs.m_ImpactPoint3dNeutralAtaPlane ? new NeutralAtaPlane(*rhs.m_ImpactPoint3dNeutralAtaPlane) : nullptr;
-      m_VertexCompatibility=rhs.m_VertexCompatibility;
-      delete m_trackOrParticleLink;
-      m_trackOrParticleLink = (rhs.m_trackOrParticleLink ? rhs.m_trackOrParticleLink->clone() : nullptr);
-    }
-    return *this;
+// assignment operator changed
+VxTrackAtVertex&
+VxTrackAtVertex::operator=(const VxTrackAtVertex& rhs)
+{
+  if (this != &rhs) {
+    m_fitQuality = rhs.m_fitQuality;
+    m_trkWeight = rhs.m_trkWeight;
+    delete m_perigeeAtVertex;
+    m_perigeeAtVertex =
+      rhs.m_perigeeAtVertex ? rhs.m_perigeeAtVertex->clone() : nullptr;
+    delete m_neutralPerigeeAtVertex;
+    m_neutralPerigeeAtVertex = rhs.m_neutralPerigeeAtVertex
+                                 ? rhs.m_neutralPerigeeAtVertex->clone()
+                                 : nullptr;
+    delete m_linState;
+    m_linState = rhs.m_linState ? rhs.m_linState->clone() : nullptr;
+    //       m_initialPerigee = rhs.m_initialPerigee ?
+    //       rhs.m_initialPerigee->clone() : 0;
+    m_initialPerigee = rhs.m_initialPerigee;
+    m_initialNeutralPerigee = rhs.m_initialNeutralPerigee;
+    delete m_ImpactPoint3dAtaPlane;
+    m_ImpactPoint3dAtaPlane = rhs.m_ImpactPoint3dAtaPlane
+                                ? new AtaPlane(*rhs.m_ImpactPoint3dAtaPlane)
+                                : nullptr;
+    delete m_ImpactPoint3dNeutralAtaPlane;
+    m_ImpactPoint3dNeutralAtaPlane =
+      rhs.m_ImpactPoint3dNeutralAtaPlane
+        ? new NeutralAtaPlane(*rhs.m_ImpactPoint3dNeutralAtaPlane)
+        : nullptr;
+    m_VertexCompatibility = rhs.m_VertexCompatibility;
+    delete m_trackOrParticleLink;
+    m_trackOrParticleLink =
+      (rhs.m_trackOrParticleLink ? rhs.m_trackOrParticleLink->clone()
+                                 : nullptr);
   }
+  return *this;
+}
 
+VxTrackAtVertex::VxTrackAtVertex(VxTrackAtVertex&& rhs) noexcept
+{
 
-  VxTrackAtVertex::VxTrackAtVertex (VxTrackAtVertex&& rhs) noexcept
-  {
+  m_fitQuality = rhs.m_fitQuality;
+  m_trkWeight = rhs.m_trkWeight;
 
-      m_fitQuality = rhs.m_fitQuality;
-      m_trkWeight = rhs.m_trkWeight;
+  m_perigeeAtVertex = rhs.m_perigeeAtVertex;
+  rhs.m_perigeeAtVertex = nullptr;
 
-      m_perigeeAtVertex = rhs.m_perigeeAtVertex;
-      rhs.m_perigeeAtVertex = nullptr;
+  m_neutralPerigeeAtVertex = rhs.m_neutralPerigeeAtVertex;
+  rhs.m_neutralPerigeeAtVertex = nullptr;
 
-      m_neutralPerigeeAtVertex = rhs.m_neutralPerigeeAtVertex;
-      rhs.m_neutralPerigeeAtVertex = nullptr;
+  m_linState = rhs.m_linState;
+  rhs.m_linState = nullptr;
 
-      m_linState = rhs.m_linState;
-      rhs.m_linState = nullptr;
+  m_initialPerigee = rhs.m_initialPerigee;
+  m_initialNeutralPerigee = rhs.m_initialNeutralPerigee;
+  m_VertexCompatibility = rhs.m_VertexCompatibility;
 
-      m_initialPerigee = rhs.m_initialPerigee;
-      m_initialNeutralPerigee = rhs.m_initialNeutralPerigee;
-      m_VertexCompatibility=rhs.m_VertexCompatibility;
+  m_ImpactPoint3dAtaPlane = rhs.m_ImpactPoint3dAtaPlane;
+  rhs.m_ImpactPoint3dAtaPlane = nullptr;
 
-      m_ImpactPoint3dAtaPlane = rhs.m_ImpactPoint3dAtaPlane;
-      rhs.m_ImpactPoint3dAtaPlane = nullptr;
+  m_ImpactPoint3dNeutralAtaPlane = rhs.m_ImpactPoint3dNeutralAtaPlane;
+  rhs.m_ImpactPoint3dNeutralAtaPlane = nullptr;
 
-      m_ImpactPoint3dNeutralAtaPlane = rhs.m_ImpactPoint3dNeutralAtaPlane;
-      rhs.m_ImpactPoint3dNeutralAtaPlane = nullptr;
+  m_trackOrParticleLink = rhs.m_trackOrParticleLink;
+  rhs.m_trackOrParticleLink = nullptr;
+}
 
-      m_trackOrParticleLink = rhs.m_trackOrParticleLink;
-      rhs.m_trackOrParticleLink = nullptr;
+VxTrackAtVertex&
+VxTrackAtVertex::operator=(VxTrackAtVertex&& rhs) noexcept
+{
+  if (this != &rhs) {
+    m_fitQuality = rhs.m_fitQuality;
+    m_trkWeight = rhs.m_trkWeight;
 
-  }
+    delete m_perigeeAtVertex;
+    m_perigeeAtVertex = rhs.m_perigeeAtVertex;
+    rhs.m_perigeeAtVertex = nullptr;
 
+    delete m_neutralPerigeeAtVertex;
+    m_neutralPerigeeAtVertex = rhs.m_neutralPerigeeAtVertex;
+    rhs.m_neutralPerigeeAtVertex = nullptr;
 
-  VxTrackAtVertex & VxTrackAtVertex::operator= (VxTrackAtVertex&& rhs) noexcept
-  {
-    if (this!=&rhs)
-    {
-      m_fitQuality = rhs.m_fitQuality;
-      m_trkWeight = rhs.m_trkWeight;
+    delete m_linState;
+    m_linState = rhs.m_linState;
+    rhs.m_linState = nullptr;
 
-      delete m_perigeeAtVertex;
-      m_perigeeAtVertex = rhs.m_perigeeAtVertex;
-      rhs.m_perigeeAtVertex = nullptr;
+    m_initialPerigee = rhs.m_initialPerigee;
+    m_initialNeutralPerigee = rhs.m_initialNeutralPerigee;
+    m_VertexCompatibility = rhs.m_VertexCompatibility;
 
-      delete m_neutralPerigeeAtVertex;
-      m_neutralPerigeeAtVertex = rhs.m_neutralPerigeeAtVertex;
-      rhs.m_neutralPerigeeAtVertex = nullptr;
+    delete m_ImpactPoint3dAtaPlane;
+    m_ImpactPoint3dAtaPlane = rhs.m_ImpactPoint3dAtaPlane;
+    rhs.m_ImpactPoint3dAtaPlane = nullptr;
 
-      delete m_linState;
-      m_linState = rhs.m_linState;
-      rhs.m_linState = nullptr;
+    delete m_ImpactPoint3dNeutralAtaPlane;
+    m_ImpactPoint3dNeutralAtaPlane = rhs.m_ImpactPoint3dNeutralAtaPlane;
+    rhs.m_ImpactPoint3dNeutralAtaPlane = nullptr;
 
-      m_initialPerigee = rhs.m_initialPerigee;
-      m_initialNeutralPerigee = rhs.m_initialNeutralPerigee;
-      m_VertexCompatibility=rhs.m_VertexCompatibility;
+    delete m_trackOrParticleLink;
+    m_trackOrParticleLink = rhs.m_trackOrParticleLink;
+    rhs.m_trackOrParticleLink = nullptr;
+  }
+  return *this;
+}
 
-      delete m_ImpactPoint3dAtaPlane;
-      m_ImpactPoint3dAtaPlane = rhs.m_ImpactPoint3dAtaPlane;
-      rhs.m_ImpactPoint3dAtaPlane = nullptr;
+bool
+VxTrackAtVertex::operator==(const VxTrackAtVertex& data) const
+{
 
-      delete m_ImpactPoint3dNeutralAtaPlane;
-      m_ImpactPoint3dNeutralAtaPlane = rhs.m_ImpactPoint3dNeutralAtaPlane;
-      rhs.m_ImpactPoint3dNeutralAtaPlane = nullptr;
+  return (this->initialPerigee() == data.initialPerigee());
+  //    return ( (this->initialPerigee()->position() -
+  //    data.initialPerigee()->position()).mag()<1e-8 &&
+  //             (this->initialPerigee()->momentum() -
+  //             data.initialPerigee()->momentum()).mag()<1e-8    ) ;
+}
 
-      delete m_trackOrParticleLink;
-      m_trackOrParticleLink = rhs.m_trackOrParticleLink;
-      rhs.m_trackOrParticleLink = nullptr;
-    }
-    return *this;
+MsgStream&
+VxTrackAtVertex::dump(MsgStream& sl) const
+{
+  sl << "Printing VxTrackAtVertex:" << endmsg;
+  const Trk::TrackParameters* inPerigee = this->initialPerigee();
+  if (inPerigee) {
+    sl << "Original Perigee: " << *(inPerigee) << endmsg;
+  } else {
+    sl << "This VxTrackAtVertex was not created using initial perigee"
+       << endmsg;
   }
-
-  bool VxTrackAtVertex::operator==(const VxTrackAtVertex & data) const  
-  {  
-
-    return ( this->initialPerigee() == data.initialPerigee() );
-//    return ( (this->initialPerigee()->position() - data.initialPerigee()->position()).mag()<1e-8 &&
-//             (this->initialPerigee()->momentum() - data.initialPerigee()->momentum()).mag()<1e-8    ) ;
+  if (this->perigeeAtVertex() != nullptr) {
+    sl << "Refitted Perigee: " << *(this->perigeeAtVertex()) << endmsg;
+  } else {
+    sl << "Refitted Perigee was not stored in pool file." << endmsg;
   }
-     
-  MsgStream& VxTrackAtVertex::dump(MsgStream& sl) const {
-    sl << "Printing VxTrackAtVertex:" << endmsg;
-    const Trk::TrackParameters * inPerigee = this->initialPerigee();
-    if(inPerigee) { sl << "Original Perigee: " << *(inPerigee) << endmsg;
-    } else { sl<<"This VxTrackAtVertex was not created using initial perigee"<<endmsg;
-}
-    if (this->perigeeAtVertex() != nullptr) { sl << "Refitted Perigee: " << *(this->perigeeAtVertex()) << endmsg;
-    } else { sl << "Refitted Perigee was not stored in pool file." << endmsg;
+  sl << m_fitQuality << "\tWeight: " << m_trkWeight << endmsg;
+  return sl;
 }
-    sl << m_fitQuality << "\tWeight: " << m_trkWeight << endmsg;
-    return sl;
-  }
 
-  std::ostream& VxTrackAtVertex::dump(std::ostream& sl) const {
-    sl << "Printing VxTrackAtVertex:" << std::endl;
-    const Trk::TrackParameters * inPerigee = this->initialPerigee();
-    if(inPerigee) { sl << "Original Perigee: " << *(inPerigee) << std::endl;
-    } else { sl<<"This VxTrackAtVertex was not created using initial perigee"<<std::endl;
+std::ostream&
+VxTrackAtVertex::dump(std::ostream& sl) const
+{
+  sl << "Printing VxTrackAtVertex:" << std::endl;
+  const Trk::TrackParameters* inPerigee = this->initialPerigee();
+  if (inPerigee) {
+    sl << "Original Perigee: " << *(inPerigee) << std::endl;
+  } else {
+    sl << "This VxTrackAtVertex was not created using initial perigee"
+       << std::endl;
+  }
+  if (this->perigeeAtVertex() != nullptr) {
+    sl << "Refitted Perigee: " << *(this->perigeeAtVertex()) << std::endl;
+  } else {
+    sl << "Refitted Perigee was not stored in pool file." << std::endl;
+  }
+  sl << m_fitQuality << "\tWeight: " << m_trkWeight << std::endl;
+  return sl;
 }
-    if (this->perigeeAtVertex() != nullptr) { sl << "Refitted Perigee: " << *(this->perigeeAtVertex()) << std::endl;
-    } else { sl << "Refitted Perigee was not stored in pool file." << std::endl;
+
+MsgStream&
+operator<<(MsgStream& sl, const VxTrackAtVertex& sf)
+{
+  return sf.dump(sl);
 }
-    sl << m_fitQuality << "\tWeight: " << m_trkWeight << std::endl;
-    return sl;
-  }
 
-  MsgStream& operator << ( MsgStream& sl, const VxTrackAtVertex& sf) 
-  { return sf.dump(sl); }
+std::ostream&
+operator<<(std::ostream& sl, const VxTrackAtVertex& sf)
+{
+  return sf.dump(sl);
+}
 
-  std::ostream& operator << ( std::ostream& sl, const VxTrackAtVertex& sf) 
-  { return sf.dump(sl); }
-  
-  unsigned int VxTrackAtVertex::numberOfInstantiations()
-  {
-    return s_numberOfInstantiations.load();
-  }
+unsigned int
+VxTrackAtVertex::numberOfInstantiations()
+{
+  return s_numberOfInstantiations.load();
+}
 
-     
 } // end of namespace
diff --git a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/EnergyLossUpdator.h b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/EnergyLossUpdator.h
index 3a6725b91f025971a62d2acd6dfd37992853192d..7c0bfec4c263f1ccd0b7db528fbb3991c21f9722 100755
--- a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/EnergyLossUpdator.h
+++ b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/EnergyLossUpdator.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -165,8 +165,8 @@ namespace Trk {
       double dEdXBetheBloch(const MaterialProperties& mat,
                             double& transKaz,
                             double& transTmax,
-                            double gamma,
                             double beta,
+                            double gamma,
                             ParticleHypothesis particle=pion) const;
       
       Trk::EnergyLoss* ionizationEnergyLoss(const MaterialProperties& mat,
diff --git a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h
index ff85058fac416db1fd997df987ba9e740284877f..ba1bd19e06b602d9f8df6e874bacb5c9c41118e1 100755
--- a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h
+++ b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h
@@ -90,11 +90,11 @@ struct ParametersNextVolume
   BoundarySurfaceFace exitFace;
 
   ParametersNextVolume(TrackParmContainer& track_parm_container)
-    : nextParameters(track_parm_container)
+    : nextVolume(nullptr)
+    , nextParameters(track_parm_container)
     , navParameters(track_parm_container)
+    , exitFace(undefinedFace)
   {
-    nextVolume = nullptr;
-    exitFace = undefinedFace;
   }
 
   //!< update the boundaryInformation
diff --git a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/TimedExtrapolator.h b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/TimedExtrapolator.h
index fe347d3c393774fc672afbf6ce9a270fa156488d..2cd30aab4a123c1463c2a002c1bc1ef4ec8b5809 100755
--- a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/TimedExtrapolator.h
+++ b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/TimedExtrapolator.h
@@ -104,11 +104,12 @@ namespace Trk {
     const TrackParameters*   navParameters;
     BoundarySurfaceFace      exitFace;
     
-    ParamsNextVolume(){
-      nextVolume              = nullptr;
-      nextParameters          = nullptr;
-      navParameters           = nullptr;
-        exitFace                = undefinedFace;
+    ParamsNextVolume()
+      : nextVolume(nullptr),
+        nextParameters(nullptr),
+        navParameters(nullptr),
+        exitFace(undefinedFace)
+    {
     }
     
     
diff --git a/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx b/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx
index 63f731ce2f1a86138a998b90c10555a462a6e226..680f1c07b6fbbe43b546bb194fdd95afa15796d1 100755
--- a/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx
+++ b/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx
@@ -215,6 +215,7 @@ StatusCode
 Trk::Extrapolator::initialize()
 {
 
+  // cppcheck-suppress publicAllocationError; false positive
   m_referenceSurface = new Trk::PlaneSurface(new Amg::Transform3D(Trk::s_idTransform), 0., 0.);
   m_referenceSurface->setOwner(Trk::TGOwn);
 
@@ -774,7 +775,7 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(const EventContext& ctx,
       staticVol->confinedDetachedVolumes();
     if (detVols) {
       std::vector<const Trk::DetachedTrackingVolume*>::const_iterator iTer = detVols->begin();
-      for (; iTer != detVols->end(); iTer++) {
+      for (; iTer != detVols->end(); ++iTer) {
         // active station ?
         const Trk::Layer* layR = (*iTer)->layerRepresentation();
         bool active = layR && layR->layerType();
@@ -829,7 +830,7 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(const EventContext& ctx,
             }
           } else if (confLays) {
             std::vector<const Trk::Layer*>::const_iterator lIt = confLays->begin();
-            for (; lIt != confLays->end(); lIt++) {
+            for (; lIt != confLays->end(); ++lIt++) {
               cache.m_layers.emplace_back(&((*lIt)->surfaceRepresentation()), true);
               cache.m_navigLays.emplace_back((*iTer)->trackingVolume(), *lIt);
             }
@@ -998,7 +999,7 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(const EventContext& ctx,
   std::vector<const Trk::DetachedTrackingVolume*>* detVols =
     m_navigator->trackingGeometry()->lowestDetachedTrackingVolumes(gp);
   std::vector<const Trk::DetachedTrackingVolume*>::iterator dIter = detVols->begin();
-  for (; dIter != detVols->end(); dIter++) {
+  for (; dIter != detVols->end(); ++dIter) {
     const Trk::Layer* layR = (*dIter)->layerRepresentation();
     bool active = layR && layR->layerType();
     if (active && !resolveActive) {
@@ -1036,7 +1037,7 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(const EventContext& ctx,
       // collect dense volume boundary
       if (confinedDense) {
         std::vector<const Trk::TrackingVolume*>::const_iterator vIter = confinedDense->begin();
-        for (; vIter != confinedDense->end(); vIter++) {
+        for (; vIter != confinedDense->end(); ++vIter) {
           const std::vector<SharedObject<const BoundarySurface<TrackingVolume>>>& bounds =
             (*vIter)->boundarySurfaces();
           cache.m_denseVols.emplace_back(*vIter, bounds.size());
@@ -1584,7 +1585,7 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(const EventContext& ctx,
             cache.m_denseVols.begin();
           while (index >= (*dIter).second && dIter != cache.m_denseVols.end()) {
             index -= (*dIter).second;
-            dIter++;
+            ++dIter;
           }
           if (dIter != cache.m_denseVols.end()) {
             currVol = (*dIter).first;
@@ -1626,7 +1627,7 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(const EventContext& ctx,
             cache.m_navigVolsInt.begin();
           while (index >= (*nIter).second && nIter != cache.m_navigVolsInt.end()) {
             index -= (*nIter).second;
-            nIter++;
+            ++nIter;
           }
           if (nIter != cache.m_navigVolsInt.end()) {
             currVol = (*nIter).first;
@@ -1674,7 +1675,7 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(const EventContext& ctx,
             cache.m_detachedVols.begin();
           while (index >= (*dIter).second && dIter != cache.m_detachedVols.end()) {
             index -= (*dIter).second;
-            dIter++;
+            ++dIter;
           }
           if (dIter != cache.m_detachedVols.end()) {
             currVol = (*dIter).first->trackingVolume();
@@ -2059,7 +2060,7 @@ Trk::Extrapolator::extrapolateToVolumeImpl(const EventContext& ctx,
           if (dist < (*sIter).second) {
             break;
           }
-          sIter++;
+          ++sIter;
         }
         sIter = surfaces.insert(sIter, (std::pair<const Trk::Surface*, double>(nextSurface, dist)));
       } else {
@@ -2091,7 +2092,7 @@ Trk::Extrapolator::extrapolateToVolumeImpl(const EventContext& ctx,
     for (std::vector<std::pair<const Trk::Surface*, double>>::reverse_iterator rsIter =
            surfaces.rbegin();
          rsIter != surfaces.rend();
-         rsIter++) {
+         ++rsIter) {
       if ((*rsIter).second < 0) {
         Cache cache{};
         // Material effect updator cache
@@ -4988,7 +4989,7 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit(const EventContext& ctx,
       cache.m_currentStatic->confinedDetachedVolumes();
     if (detVols) {
       std::vector<const Trk::DetachedTrackingVolume*>::const_iterator iTer = detVols->begin();
-      for (; iTer != detVols->end(); iTer++) {
+      for (; iTer != detVols->end(); ++iTer) {
         // active station ?
         const Trk::Layer* layR = (*iTer)->layerRepresentation();
         bool active = layR && layR->layerType();
@@ -5026,7 +5027,7 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit(const EventContext& ctx,
             }
           } else if (confLays) {
             std::vector<const Trk::Layer*>::const_iterator lIt = confLays->begin();
-            for (; lIt != confLays->end(); lIt++) {
+            for (; lIt != confLays->end(); ++lIt) {
               cache.m_layers.emplace_back(&((*lIt)->surfaceRepresentation()), true);
               cache.m_navigLays.emplace_back((*iTer)->trackingVolume(), *lIt);
             }
@@ -5074,7 +5075,7 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit(const EventContext& ctx,
   std::vector<const Trk::DetachedTrackingVolume*>* detVols =
     m_navigator->trackingGeometry()->lowestDetachedTrackingVolumes(gp);
   std::vector<const Trk::DetachedTrackingVolume*>::iterator dIter = detVols->begin();
-  for (; dIter != detVols->end(); dIter++) {
+  for (; dIter != detVols->end(); ++dIter) {
     const Trk::Layer* layR = (*dIter)->layerRepresentation();
     bool active = layR && layR->layerType();
     if (active && !resolveActive) {
@@ -5112,7 +5113,7 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit(const EventContext& ctx,
       // collect dense volume boundary
       if (confinedDense) {
         std::vector<const Trk::TrackingVolume*>::const_iterator vIter = confinedDense->begin();
-        for (; vIter != confinedDense->end(); vIter++) {
+        for (; vIter != confinedDense->end(); ++vIter) {
           const std::vector<SharedObject<const BoundarySurface<TrackingVolume>>>& bounds =
             (*vIter)->boundarySurfaces();
           cache.m_denseVols.emplace_back(*vIter, bounds.size());
@@ -5645,7 +5646,7 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit(const EventContext& ctx,
           cache.m_denseVols.begin();
         while (index >= (*dIter).second && dIter != cache.m_denseVols.end()) {
           index -= (*dIter).second;
-          dIter++;
+          ++dIter;
         }
         if (dIter != cache.m_denseVols.end()) {
           currVol = (*dIter).first;
@@ -5685,9 +5686,9 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit(const EventContext& ctx,
                              cache.m_layers.size() - cache.m_denseBoundaries.size();
         std::vector<std::pair<const Trk::TrackingVolume*, unsigned int>>::iterator nIter =
           navigVols.begin();
-        while (index >= (*nIter).second && nIter != navigVols.end()) {
+        while (nIter != navigVols.end() && index >= (*nIter).second) {
           index -= (*nIter).second;
-          nIter++;
+          ++nIter;
         }
         if (nIter != navigVols.end()) {
           currVol = (*nIter).first;
@@ -5728,7 +5729,7 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit(const EventContext& ctx,
           cache.m_detachedVols.begin();
         while (index >= (*dIter).second && dIter != cache.m_detachedVols.end()) {
           index -= (*dIter).second;
-          dIter++;
+          ++dIter;
         }
         if (dIter != cache.m_detachedVols.end()) {
           currVol = (*dIter).first->trackingVolume();
diff --git a/Tracking/TrkExtrapolation/TrkExTools/src/TimedExtrapolator.cxx b/Tracking/TrkExtrapolation/TrkExTools/src/TimedExtrapolator.cxx
index 8162d7e8081c754f4af536fdbe1ee0fdb936b6cb..d43e5c95ceb1106813bddfe62af95c84a197f757 100644
--- a/Tracking/TrkExtrapolation/TrkExTools/src/TimedExtrapolator.cxx
+++ b/Tracking/TrkExtrapolation/TrkExTools/src/TimedExtrapolator.cxx
@@ -485,7 +485,7 @@ Trk::TimedExtrapolator::extrapolateToVolumeWithPathLimit(
     const std::vector<const Trk::DetachedTrackingVolume *> *detVols = cache.m_currentStatic->confinedDetachedVolumes();
     if (detVols) {
       std::vector<const Trk::DetachedTrackingVolume *>::const_iterator iTer = detVols->begin();
-      for (; iTer != detVols->end(); iTer++) {
+      for (; iTer != detVols->end(); ++iTer) {
         // active station ?
         const Trk::Layer *layR = (*iTer)->layerRepresentation();
         bool active = layR && layR->layerType();
@@ -526,7 +526,7 @@ Trk::TimedExtrapolator::extrapolateToVolumeWithPathLimit(
             }
           } else if (confLays) {
             std::vector<const Trk::Layer *>::const_iterator lIt = confLays->begin();
-            for (; lIt != confLays->end(); lIt++) {
+            for (; lIt != confLays->end(); ++lIt) {
               cache.m_layers.emplace_back(&((*lIt)->surfaceRepresentation()),
                                                                                      true);
               cache.m_navigLays.emplace_back((*iTer)->trackingVolume(), *lIt);
@@ -607,7 +607,7 @@ Trk::TimedExtrapolator::extrapolateToVolumeWithPathLimit(
       // collect dense volume boundary
       if (confinedDense) {
         std::vector<const Trk::TrackingVolume *>::const_iterator vIter = confinedDense->begin();
-        for (; vIter != confinedDense->end(); vIter++) {
+        for (; vIter != confinedDense->end(); ++vIter) {
           const std::vector< SharedObject<const BoundarySurface<TrackingVolume> > > &bounds =
             (*vIter)->boundarySurfaces();
           cache.m_denseVols.emplace_back(*vIter, bounds.size());
@@ -1029,7 +1029,7 @@ Trk::TimedExtrapolator::extrapolateToVolumeWithPathLimit(
         std::vector< std::pair<const Trk::TrackingVolume *, unsigned int> >::iterator dIter = cache.m_denseVols.begin();
         while (index >= (*dIter).second && dIter != cache.m_denseVols.end()) {
           index -= (*dIter).second;
-          dIter++;
+          ++dIter;
         }
         if (dIter != cache.m_denseVols.end()) {
           currVol = (*dIter).first;
@@ -1061,9 +1061,9 @@ Trk::TimedExtrapolator::extrapolateToVolumeWithPathLimit(
         unsigned int index = solutions[iSol] - iDest - cache.m_staticBoundaries.size() - cache.m_layers.size() -
                              cache.m_denseBoundaries.size();
         std::vector< std::pair<const Trk::TrackingVolume *, unsigned int> >::iterator nIter = navigVols.begin();
-        while (index >= (*nIter).second && nIter != navigVols.end()) {
+        while (nIter != navigVols.end() && index >= (*nIter).second) {
           index -= (*nIter).second;
-          nIter++;
+          ++nIter;
         }
         if (nIter != navigVols.end()) {
           currVol = (*nIter).first;
@@ -1090,7 +1090,7 @@ Trk::TimedExtrapolator::extrapolateToVolumeWithPathLimit(
                                unsigned int> >::iterator dIter = cache.m_detachedVols.begin();
         while (index >= (*dIter).second && dIter != cache.m_detachedVols.end()) {
           index -= (*dIter).second;
-          dIter++;
+          ++dIter;
         }
         if (dIter != cache.m_detachedVols.end()) {
           currVol = (*dIter).first->trackingVolume();
@@ -1610,7 +1610,7 @@ Trk::TimedExtrapolator::transportToVolumeWithPathLimit(Trk::TimedExtrapolator::C
   const std::vector<const Trk::DetachedTrackingVolume *> *detVols = cache.m_currentStatic->confinedDetachedVolumes();
   if (detVols) {
     std::vector<const Trk::DetachedTrackingVolume *>::const_iterator iTer = detVols->begin();
-    for (; iTer != detVols->end(); iTer++) {
+    for (; iTer != detVols->end(); ++iTer) {
       // active station ?
       const Trk::Layer *layR = (*iTer)->layerRepresentation();
       bool active = layR && layR->layerType();
@@ -1685,7 +1685,7 @@ Trk::TimedExtrapolator::transportToVolumeWithPathLimit(Trk::TimedExtrapolator::C
           (*iTer)->trackingVolume()->confinedDenseVolumes();
         if (confinedDense && !confinedDense->empty()) {
           std::vector<const Trk::TrackingVolume *>::const_iterator vIter = confinedDense->begin();
-          for (; vIter != confinedDense->end(); vIter++) {
+          for (; vIter != confinedDense->end(); ++vIter) {
             const std::vector< SharedObject<const BoundarySurface<TrackingVolume> > >  &bounds =
               (*vIter)->boundarySurfaces();
             int newB = 0;
@@ -1717,7 +1717,7 @@ Trk::TimedExtrapolator::transportToVolumeWithPathLimit(Trk::TimedExtrapolator::C
         const std::vector<const Trk::Layer *> *confLays = (*iTer)->trackingVolume()->confinedArbitraryLayers();
         if (confLays) {
           std::vector<const Trk::Layer *>::const_iterator lIt = confLays->begin();
-          for (; lIt != confLays->end(); lIt++) {
+          for (; lIt != confLays->end(); ++lIt) {
             const Trk::Surface &surf = (*lIt)->surfaceRepresentation();
             Trk::DistanceSolution distSol = surf.straightLineDistanceEstimate(currPar->position(),
                                                                               dir * currPar->momentum().normalized());
@@ -1740,7 +1740,7 @@ Trk::TimedExtrapolator::transportToVolumeWithPathLimit(Trk::TimedExtrapolator::C
   std::vector< Trk::DestBound >::iterator bIter = cache.m_trStaticBounds.begin();
   while (bIter != cache.m_trStaticBounds.end()) {
     cache.m_trSurfs.emplace_back((*bIter).surface, (*bIter).distance);
-    bIter++;
+    ++bIter;
   }
 
   // std::cout <<"navigation in current static:"<< cache.m_trSurfs.size()<<","<<cache.m_trStaticBounds.size()<< std::endl;
@@ -2068,7 +2068,7 @@ Trk::TimedExtrapolator::transportToVolumeWithPathLimit(Trk::TimedExtrapolator::C
       std::vector< std::pair<const Trk::TrackingVolume *, unsigned int> >::iterator dIter = cache.m_denseVols.begin();
       while (index >= (*dIter).second && dIter != cache.m_denseVols.end()) {
         index -= (*dIter).second;
-        dIter++;
+        ++dIter;
       }
       if (dIter != cache.m_denseVols.end()) {
         currVol = (*dIter).first;
diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx
index 813a059c2115780d4168fb1d2739bfe3a51fe3b8..c7eb7f9333b7aee7791f11cb2c3bae3bc70ad6b8 100755
--- a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx
+++ b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx
@@ -565,6 +565,7 @@ namespace Trk
     ExtrapolationType type = FittedTrajectory;
     std::unique_ptr<const TrackSurfaceIntersection> intersection {parameters.intersection()};
 
+    const TrackSurfaceIntersection* startIntersection = intersection.get();
     int hit = measurements.size();
     for (MeasurementSet::const_iterator m = measurementSet.begin();
          m != measurementSet.end();
@@ -572,7 +573,7 @@ namespace Trk
       std::unique_ptr<const TrackSurfaceIntersection> newIntersection{
         m_stepPropagator->intersectSurface(ctx,
                                            (**m).associatedSurface(),
-                                           intersection.get(),
+                                           startIntersection,
                                            qOverP,
                                            m_stepField,
                                            Trk::muon)
@@ -609,9 +610,11 @@ namespace Trk
         intersection = std::make_unique<TrackSurfaceIntersection>(*intersection);
       }
       auto measurement = std::make_unique<FitMeasurement>(hit, nullptr, *m);
-      measurement->intersection(type, intersection.get());
+      measurement->intersection(type, intersection.release());
       measurement->qOverP(qOverP);
       measurements.push_back(measurement.release());
+      //remember the last intersection for the next loop iteration
+      startIntersection=&(measurements.back()->intersection(type));
     }
 
     // reorder if necessary
diff --git a/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/FitMeasurement.h b/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/FitMeasurement.h
index 03f20a64398e4443d1f6697165c4915e6f6b19a8..887b6e84e55007dc81a01997c44128dfde068c1d 100755
--- a/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/FitMeasurement.h
+++ b/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/FitMeasurement.h
@@ -21,6 +21,8 @@
 #include "TrkiPatFitterUtils/ExtrapolationType.h"
 #include "TrkiPatFitterUtils/MeasurementType.h"
 
+#include <memory>
+
 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
 
 class HitOnTrack;
@@ -122,7 +124,8 @@ public:
     bool				hasIntersection (ExtrapolationType type) const;
     const TrackSurfaceIntersection&	intersection (ExtrapolationType type) const;
     void				intersection (ExtrapolationType type,
-						      const TrackSurfaceIntersection*);
+						      const TrackSurfaceIntersection* value);
+                                                      //std::unique_ptr<TrackSurfaceIntersection>);
     bool				isAlignment (void) const;
     bool				isCluster (void) const;
     bool				isDrift (void) const;
@@ -214,7 +217,7 @@ private:
     bool				m_flippedDriftDistance;
     int					m_hitIndex;
     HitOnTrack*				m_hitOnTrack;
-    const TrackSurfaceIntersection*	m_intersection[ExtrapolationTypes];
+    std::array<std::unique_ptr<const TrackSurfaceIntersection>,ExtrapolationTypes >  m_intersection;
     unsigned				m_lastParameter;
     const MaterialEffectsBase*		m_materialEffects;
     bool				m_materialEffectsOwner;
@@ -364,7 +367,7 @@ FitMeasurement::hitOnTrack (void) const
 
 inline bool
 FitMeasurement::hasIntersection (ExtrapolationType type) const
-{ return (m_intersection[type] != 0); }
+{ return (bool)m_intersection[type]; }
 
 inline const TrackSurfaceIntersection&
 FitMeasurement::intersection (ExtrapolationType type) const
diff --git a/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMeasurement.cxx b/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMeasurement.cxx
index f165e58087962c52660c9bb88ac310070fde5ca0..e6af50c991a19d86da838650dc24d8337f3da492 100755
--- a/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMeasurement.cxx
+++ b/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMeasurement.cxx
@@ -88,12 +88,6 @@ FitMeasurement::FitMeasurement (int		       	hitIndex,
       m_weight			(1.),
       m_weight2			(1.)
 {
-    // initialize intersection array
-    for (int typ = 0; typ != ExtrapolationTypes; ++typ)
-    {
-	m_intersection[typ] = 0;
-    }
-
     double sigma	= 0.;
     if (m_numberDoF > 0) sigma	= Amg::error(measurementBase->localCovariance(),locX);
     double sigma2	= 0.;
@@ -258,11 +252,6 @@ FitMeasurement::FitMeasurement (const MaterialEffectsBase*	materialEffects,
 
     if(calo) m_type = calorimeterScatterer;
 
-    for (int typ = 0; typ != ExtrapolationTypes; ++typ)
-    {
-	m_intersection[typ] = 0;
-    }
-
     // set any energy loss
     const EnergyLoss* energyLoss	= 0;
     const ScatteringAngles* scattering	= 0;
@@ -392,12 +381,7 @@ FitMeasurement::FitMeasurement (double				radiationThickness,
     if (! surface) delete m_surface;
     m_surface = &m_materialEffects->associatedSurface();
 
-    // initialize intersections
-    for (int typ = 0; typ != ExtrapolationTypes; ++typ)
-    {
-	m_intersection[typ] = 0;
-    }
-    m_intersection[FittedTrajectory] = new TrackSurfaceIntersection(position,direction,0.);
+    m_intersection[FittedTrajectory] = std::make_unique<TrackSurfaceIntersection>(position,direction,0.);
 }
 
 // constructor for adding (mis-)alignment effects
@@ -456,14 +440,9 @@ FitMeasurement::FitMeasurement (const AlignmentEffectsOnTrack*	alignmentEffects,
     if (m_sigmaMinus) m_weight	= 1./m_sigmaMinus;
     if (m_sigmaPlus)  m_weight2	= 1./m_sigmaPlus;
 				      
-    // initialize intersections
-    for (int typ = 0; typ != ExtrapolationTypes; ++typ)
-    {
-    	m_intersection[typ] = 0;
-    }
-    m_intersection[FittedTrajectory] = new TrackSurfaceIntersection(position,
-    								    direction,
-    								    0.);
+    m_intersection[FittedTrajectory] = std::make_unique<TrackSurfaceIntersection>(position,
+										  direction,
+										  0.);
 }
     
 // constructor creating placeholder Surface for delimiting material aggregation
@@ -523,14 +502,9 @@ FitMeasurement::FitMeasurement (const TrackSurfaceIntersection&	intersection,
     CurvilinearUVT uvt(intersection.direction());
     m_surface = new PlaneSurface(m_position,uvt); 
 
-    // initialize intersections
-    for (int typ = 0; typ != ExtrapolationTypes; ++typ)
-    {
-	m_intersection[typ] = 0;
-    }
-    m_intersection[FittedTrajectory] = new TrackSurfaceIntersection(m_position,
-								    intersection.direction(),
-								    0.);
+    m_intersection[FittedTrajectory] = std::make_unique<TrackSurfaceIntersection>(m_position,
+										  intersection.direction(),
+										  0.);
 }
     
 // other TrackStateOnSurface types
@@ -593,11 +567,6 @@ FitMeasurement::FitMeasurement (const TrackStateOnSurface&	TSOS)
 // 	m_type = MSperigee;
 //     }
     
-    // initialize intersection array
-    for (int typ = 0; typ != ExtrapolationTypes; ++typ)
-    {
-	m_intersection[typ] = 0;
-    }
 }
     
 // SiliconTracker constructor (from iPatRec)
@@ -655,11 +624,6 @@ FitMeasurement::FitMeasurement (int			hitIndex,
       m_weight			(1.),
       m_weight2			(1.)
 {
-    // initialize intersection array
-    for (int typ = 0; typ != ExtrapolationTypes; ++typ)
-    {
-	m_intersection[typ] = 0;
-    }
 
     // pixel has 2-D measurement
     if (type == pixelCluster)
@@ -776,12 +740,6 @@ FitMeasurement::FitMeasurement (int	       		hitIndex,
       m_weight			(1.),
       m_weight2			(1.)
 {
-    // initialize intersection array
-    for (int typ = 0; typ != ExtrapolationTypes; ++typ)
-    {
-	m_intersection[typ] = 0;
-    }
-
     m_sensorDirection		= new Amg::Vector3D(m_surface->transform().rotation().col(2));
 
     // add protection against junk input
@@ -935,10 +893,6 @@ FitMeasurement::FitMeasurement (const TrackParameters&	perigee)
 	// std::cout << " weight :" << std::endl;
     }
 
-    for (int typ = 0; typ != ExtrapolationTypes; ++typ)
-    {
-	m_intersection[typ] = 0;
-    }
 }
 
 // transverseVertex constructor
@@ -993,16 +947,11 @@ FitMeasurement::FitMeasurement (double			d0,
       m_weight			(1./sigma),
       m_weight2			(1.)
 {
-    for (int typ = 0; typ != ExtrapolationTypes; ++typ)
-    {
-	m_intersection[typ] = 0;
-    }
 }
 
 // destructor
 FitMeasurement::~FitMeasurement (void)
 {
-    for (int typ = 0; typ != ExtrapolationTypes; ++typ) delete m_intersection[typ];
     delete m_minimizationDirection;
     delete m_normal;
     delete m_perigee;
@@ -1017,10 +966,10 @@ void
 FitMeasurement::intersection (ExtrapolationType type,
 			      const TrackSurfaceIntersection* value)
 {
-    if (type!=FittedTrajectory) delete m_intersection[type];
-    m_intersection[type] = value;
+  m_intersection[type].reset(value);
 }
 
+
 void
 FitMeasurement::printHeading (MsgStream& log) const
 {
diff --git a/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx b/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx
index 2b3c42fdfc885b9acff7e18d5b9456354b3fa221..104596fc7ba29648c9e38e8d2fc4f59ca4079f98 100644
--- a/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx
+++ b/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx
@@ -1135,7 +1135,7 @@ void Trk::TrkMaterialProviderTool::updateVector(DataVector<const Trk::TrackState
     while(i<ntoupdate) {
       it = inputTSOS->erase(it);
       ++i;
-      firstMS--;
+      --firstMS;
     }    
     inputTSOS->insert(firstMS, caloTSOS->begin(), caloTSOS->end());
   }
@@ -1169,7 +1169,7 @@ void Trk::TrkMaterialProviderTool::updateVectorMS(DataVector<const Trk::TrackSta
 
 // In the MuonSpectrometer the TSOS for the MaterialEffectsOnTrack do NOT have trackParameters
 
-  for(;it!= inputTSOS->end();it++) {
+  for(;it!= inputTSOS->end();++it) {
     msStates++;
     if((*it)->materialEffectsOnTrack()) {
       msMatStates++;
@@ -1220,7 +1220,7 @@ void Trk::TrkMaterialProviderTool::updateVectorMS(DataVector<const Trk::TrackSta
    std::cout << " msStates " <<   msStates << " msMatStates " << msMatStates << " msMatParStates " << msMatParStates << std::endl;
 
 // dump (new) energy loss
-   for(it = firstMS;it!= inputTSOS->end();it++) {
+   for(it = firstMS;it!= inputTSOS->end();++it) {
     if((*it)->materialEffectsOnTrack()) {
       const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>((*it)->materialEffectsOnTrack());
       if(meot) {
diff --git a/Tracking/TrkTools/TrkParticleCreator/CMakeLists.txt b/Tracking/TrkTools/TrkParticleCreator/CMakeLists.txt
index 70ff9751062a259d219a7feeeaca22064584c9f6..8355ea9b10c6168a0a1bbab0119f62280fc07800 100644
--- a/Tracking/TrkTools/TrkParticleCreator/CMakeLists.txt
+++ b/Tracking/TrkTools/TrkParticleCreator/CMakeLists.txt
@@ -58,4 +58,4 @@ atlas_add_component( TrkParticleCreator
    AthContainers AtlasDetDescr GeoPrimitives IdDictDetDescr InDetPrepRawData
    InDetRIO_OnTrack MagFieldInterfaces Particle ITrackToVertex TrkSurfaces
    TrkPseudoMeasurementOnTrack VxVertex TrkExInterfaces PixelGeoModelLib
-   TrkParticleCreatorLib MagFieldElements MagFieldConditions)
+   TrkParticleCreatorLib MagFieldElements MagFieldConditions BeamSpotConditionsData )
diff --git a/Tracking/TrkTools/TrkTrackSummaryTool/CMakeLists.txt b/Tracking/TrkTools/TrkTrackSummaryTool/CMakeLists.txt
index 995a9caed8b938615f91dbc024303ec95d4e1263..2ab5a9a09228eb78449e2a15964ce953026179be 100644
--- a/Tracking/TrkTools/TrkTrackSummaryTool/CMakeLists.txt
+++ b/Tracking/TrkTools/TrkTrackSummaryTool/CMakeLists.txt
@@ -31,7 +31,8 @@ atlas_add_component( TrkTrackSummaryTool
                      src/*.cxx
                      src/components/*.cxx
                      LINK_LIBRARIES AthenaBaseComps AthContainers GaudiKernel TrkParameters TrkTrackSummary TrkToolInterfaces AtlasDetDescr 
-		     Identifier TrkDetElementBase TrkGeometry TrkCompetingRIOsOnTrack TrkEventPrimitives TrkMeasurementBase TrkRIO_OnTrack TrkTrack CxxUtils)
+		     Identifier TrkDetElementBase TrkGeometry TrkCompetingRIOsOnTrack TrkEventPrimitives TrkMeasurementBase TrkRIO_OnTrack TrkTrack CxxUtils
+                     TRT_ElectronPidToolsLib )
 
 # Install files from the package:
 atlas_install_headers( TrkTrackSummaryTool )
diff --git a/Tracking/TrkVertexFitter/TrkV0Fitter/TrkV0Fitter/TrkV0VertexFitter.h b/Tracking/TrkVertexFitter/TrkV0Fitter/TrkV0Fitter/TrkV0VertexFitter.h
index 27046f04a09cc2cd568eb3b15e5630f79ccb702d..d32fec23c6c955d72ce2dee61c07b9a8d242ff2a 100755
--- a/Tracking/TrkVertexFitter/TrkV0Fitter/TrkV0Fitter/TrkV0VertexFitter.h
+++ b/Tracking/TrkVertexFitter/TrkV0Fitter/TrkV0Fitter/TrkV0VertexFitter.h
@@ -158,13 +158,13 @@ namespace Trk
     */
       
     virtual xAOD::Vertex * fit(const std::vector<const xAOD::TrackParticle*> & vectorTrk,
-                               const std::vector<double> masses,
+                               const std::vector<double>& masses,
                                const double& constraintMass,
                                const xAOD::Vertex* pointingVertex,
                                const Amg::Vector3D& startingPoint) const;
 
     virtual xAOD::Vertex * fit(const std::vector<const Trk::TrackParameters*> & perigeeList,
-                               const std::vector<double> masses,
+                               const std::vector<double>& masses,
                                const double& constraintMass,
                                const xAOD::Vertex* pointingVertex,
                                const Amg::Vector3D& startingPoint) const;
diff --git a/Tracking/TrkVertexFitter/TrkV0Fitter/src/TrkV0VertexFitter.cxx b/Tracking/TrkVertexFitter/TrkV0Fitter/src/TrkV0VertexFitter.cxx
index ca1fdb73ee50881f0d1d069c7aeac85be0fa459d..0704ab2ffda553a83c24e62ead2bc0bdd0ba62f0 100755
--- a/Tracking/TrkVertexFitter/TrkV0Fitter/src/TrkV0VertexFitter.cxx
+++ b/Tracking/TrkVertexFitter/TrkV0Fitter/src/TrkV0VertexFitter.cxx
@@ -116,7 +116,7 @@ namespace Trk
 
   /** Interface for xAOD::TrackParticle with mass and pointing constraints */
   xAOD::Vertex * TrkV0VertexFitter::fit(const std::vector<const xAOD::TrackParticle*> & vectorTrk,
-                                        const std::vector<double> masses,
+                                        const std::vector<double>& masses,
                                         const double& constraintMass,
                                         const xAOD::Vertex* pointingVertex,
                                         const Amg::Vector3D& firstStartingPoint) const
@@ -210,7 +210,7 @@ namespace Trk
 
   /** Interface for Trk::TrackParameters with mass and pointing constraints */
   xAOD::Vertex * TrkV0VertexFitter::fit(const std::vector<const Trk::TrackParameters*>& originalPerigees,
-                                        const std::vector<double> masses,
+                                        const std::vector<double>& masses,
                                         const double& constraintMass,
                                         const xAOD::Vertex* pointingVertex,
                                         const Amg::Vector3D& firstStartingPoint) const
diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtParametersBase.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtParametersBase.cxx
index aa0b2adb53e4f02669eb14f83a519947b5e00452..609cd85e631bd1b19153eb0d59f855e28fdd10f6 100755
--- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtParametersBase.cxx
+++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtParametersBase.cxx
@@ -31,7 +31,7 @@ namespace Trk {
 
     //MsgStream log(msgSvc(), name());
     std::vector<const TrackParameters*>::const_iterator   i_pbase;
-    AmgVector(5) VectPerig; VectPerig<<0.,0.,0.,0.,0.;
+    AmgVector(5) VectPerig; VectPerig.setZero();
     Amg::Vector3D perGlobalPos,perGlobalVrt;
     const Trk::Perigee* mPer=nullptr;
     double CovVertTrk[15]; std::fill(CovVertTrk,CovVertTrk+15,0.);
diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrackParticle.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrackParticle.cxx
index c7798e81a89d1ba3aebed6342210d9c5a7534510..1f7363cc9f7bfef26eadad5418c57e4535860646 100755
--- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrackParticle.cxx
+++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrackParticle.cxx
@@ -33,7 +33,7 @@ namespace Trk {
  {
 
     std::vector<const xAOD::TrackParticle*>::const_iterator   i_ntrk;
-    AmgVector(5) VectPerig; VectPerig<<0.,0.,0.,0.,0.;
+    AmgVector(5) VectPerig; VectPerig.setZero();
     const Trk::Perigee*        mPer=nullptr;
     double CovVertTrk[15]; std::fill(CovVertTrk,CovVertTrk+15,0.);
     double tmp_refFrameX=0, tmp_refFrameY=0, tmp_refFrameZ=0;
@@ -139,7 +139,7 @@ namespace Trk {
                                       State& state) const
  {
     std::vector<const xAOD::NeutralParticle*>::const_iterator   i_ntrk;
-    AmgVector(5) VectPerig; VectPerig<<0.,0.,0.,0.,0.;
+    AmgVector(5) VectPerig; VectPerig.setZero();
     const  NeutralPerigee*        mPer=nullptr;
     double CovVertTrk[15]; std::fill(CovVertTrk,CovVertTrk+15,0.);
     double tmp_refFrameX=0, tmp_refFrameY=0, tmp_refFrameZ=0;
@@ -247,7 +247,7 @@ namespace Trk {
  {
 
     std::vector<const TrackParticleBase*>::const_iterator   i_ntrk;
-    AmgVector(5) VectPerig; VectPerig<<0.,0.,0.,0.,0.;
+    AmgVector(5) VectPerig; VectPerig.setZero();
     const Trk::Perigee*        mPer=nullptr;
     double CovVertTrk[15]; std::fill(CovVertTrk,CovVertTrk+15,0.);
     double tmp_refFrameX=0, tmp_refFrameY=0, tmp_refFrameZ=0;
diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrkTrack.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrkTrack.cxx
index 6d78c797e17bbbc05697086da51777257c09a8a4..4a25f6b0b2987ca65b995e125fcfca11bb21fd16 100755
--- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrkTrack.cxx
+++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrkTrack.cxx
@@ -35,7 +35,7 @@ namespace Trk{
                                State& state) const
  {
     std::vector<const Track*>::const_iterator   i_ntrk;
-    AmgVector(5) VectPerig; VectPerig<<0.,0.,0.,0.,0;
+    AmgVector(5) VectPerig; VectPerig.setZero();
     const  Perigee* mPer;
     double CovVertTrk[15]; std::fill(CovVertTrk,CovVertTrk+15,0.);
     double tmp_refFrameX=0, tmp_refFrameY=0, tmp_refFrameZ=0;
diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalExtPropagator.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalExtPropagator.cxx
index 0c9961c64fbaa71163812183b4a9431785f9543c..a3f64a5c0a77922bd3716e09ef62ed29914d4c2f 100755
--- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalExtPropagator.cxx
+++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalExtPropagator.cxx
@@ -131,7 +131,7 @@ namespace Trk {
       }
       const Perigee*          mPer = dynamic_cast<const Perigee*>(endPer);
       const AtaStraightLine*  Line = dynamic_cast<const AtaStraightLine*>(endPer);
-      AmgVector(5) VectPerig; VectPerig<<0.,0.,0.,0.,0.;
+      AmgVector(5) VectPerig; VectPerig.setZero();
       const AmgSymMatrix(5) *CovMtx=nullptr;
       if( mPer ){
         VectPerig = mPer->parameters(); 
diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalVrtFitFastSvc.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalVrtFitFastSvc.cxx
index bcfc2784adf7f85d2e4e08d7df20ace59af8e154..98502edd8582931cbc6096f8fb4bdcd61fb54d38 100755
--- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalVrtFitFastSvc.cxx
+++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalVrtFitFastSvc.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // Header include
@@ -73,15 +73,15 @@ namespace Trk{
 
 	std::vector<double>::iterator it1,it2;
 	it1=it2=xx.begin();
-	for(i=0; i<((n+1)/2); i++,it1++){}; for(i=0; i<(n/2+1);i++,it2++){};
+	for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){};
 	out[0]=0.5*( (*it1) + (*it2) );
 		
 	it1=it2=yy.begin();
-	for(i=0; i<((n+1)/2); i++,it1++){}; for(i=0; i<(n/2+1);i++,it2++){};
+	for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){};
 	out[1]=0.5*( (*it1) + (*it2) );
 
 	it1=it2=zz.begin();
-	for(i=0; i<((n+1)/2); i++,it1++){}; for(i=0; i<(n/2+1);i++,it2++){};
+	for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){};
 	out[2]=0.5*( (*it1) + (*it2) );
 
     }
@@ -138,15 +138,15 @@ namespace Trk{
 
 	std::vector<double>::iterator it1,it2;
 	it1=it2=xx.begin();
-	for(i=0; i<((n+1)/2); i++,it1++){}; for(i=0; i<(n/2+1);i++,it2++){};
+	for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){};
 	out[0]=0.5*( (*it1) + (*it2) );
 		
 	it1=it2=yy.begin();
-	for(i=0; i<((n+1)/2); i++,it1++){}; for(i=0; i<(n/2+1);i++,it2++){};
+	for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){};
 	out[1]=0.5*( (*it1) + (*it2) );
 
 	it1=it2=zz.begin();
-	for(i=0; i<((n+1)/2); i++,it1++){}; for(i=0; i<(n/2+1);i++,it2++){};
+	for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){};
 	out[2]=0.5*( (*it1) + (*it2) );
 
     }
@@ -203,15 +203,15 @@ namespace Trk{
 
 	std::vector<double>::iterator it1,it2;
 	it1=it2=xx.begin();
-	for(i=0; i<((n+1)/2); i++,it1++){}; for(i=0; i<(n/2+1);i++,it2++){};
+	for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){};
 	out[0]=0.5*( (*it1) + (*it2) );
 		
 	it1=it2=yy.begin();
-	for(i=0; i<((n+1)/2); i++,it1++){}; for(i=0; i<(n/2+1);i++,it2++){};
+	for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){};
 	out[1]=0.5*( (*it1) + (*it2) );
 
 	it1=it2=zz.begin();
-	for(i=0; i<((n+1)/2); i++,it1++){}; for(i=0; i<(n/2+1);i++,it2++){};
+	for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){};
 	out[2]=0.5*( (*it1) + (*it2) );
 
     }
@@ -268,15 +268,15 @@ namespace Trk{
 
 	std::vector<double>::iterator it1,it2;
 	it1=it2=xx.begin();
-	for(i=0; i<((n+1)/2); i++,it1++){}; for(i=0; i<(n/2+1);i++,it2++){};
+	for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){};
 	out[0]=0.5*( (*it1) + (*it2) );
 		
 	it1=it2=yy.begin();
-	for(i=0; i<((n+1)/2); i++,it1++){}; for(i=0; i<(n/2+1);i++,it2++){};
+	for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){};
 	out[1]=0.5*( (*it1) + (*it2) );
 
 	it1=it2=zz.begin();
-	for(i=0; i<((n+1)/2); i++,it1++){}; for(i=0; i<(n/2+1);i++,it2++){};
+	for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){};
 	out[2]=0.5*( (*it1) + (*it2) );
 
     }
diff --git a/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveVertexFitter.cxx b/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveVertexFitter.cxx
index a0f122505c974414747202454d9b4ecd96f66045..84f4953b2d7c9079e737fd12e0859a0a669d208a 100755
--- a/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveVertexFitter.cxx
+++ b/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveVertexFitter.cxx
@@ -294,7 +294,7 @@ namespace Trk
 
     std::vector<const Trk::TrackParameters*> perigeeList;
     for (std::vector<const Trk::Track*>::const_iterator iter=VectorTrk.begin();
-         iter!=VectorTrk.end();iter++) {
+         iter!=VectorTrk.end();++iter) {
       if (std::isnan((*iter)->perigeeParameters()->parameters()[Trk::d0])) {
         continue;
       }
@@ -352,7 +352,7 @@ namespace Trk
 
     std::vector<const Trk::TrackParameters*> perigeeList;
     for (std::vector<const Trk::TrackParticleBase*>::const_iterator iter=VectorTrk.begin();
-         iter!=VectorTrk.end();iter++) {
+         iter!=VectorTrk.end();++iter) {
       if (std::isnan((*iter)->perigee()->parameters()[Trk::d0])) {
         continue;
       }
@@ -474,7 +474,7 @@ namespace Trk
 
         //collect all measured perigees
         
-        for (iter=lintracksBegin;iter!=lintracksEnd;iter++) {
+        for (iter=lintracksBegin;iter!=lintracksEnd;++iter) {
           //m_LinearizedTrackFactory->linearize(*iter,ActualPosition);
           bool success=m_ImpactPoint3dEstimator->addIP3dAtaPlane(*iter,NewVertex);
           if (!success)
@@ -491,7 +491,7 @@ namespace Trk
       lintracksEnd=ActualVertex->vxTrackAtVertex().end();
 
       //now reweight tracks (find chi2 compatibility with actual vertex position)
-      for (iter=lintracksBegin;iter!=lintracksEnd;iter++) {
+      for (iter=lintracksBegin;iter!=lintracksEnd;++iter) {
 
         //estimate the compatibility of the track to the vertex and store it in iter->linState()->m_vtxCompatibility
         m_TrackCompatibilityEstimator->estimate(*iter,NewVertex);
@@ -509,7 +509,7 @@ namespace Trk
       }
 
       //now update with all the tracks info
-      for (iter=lintracksBegin;iter!=lintracksEnd;iter++) {
+      for (iter=lintracksBegin;iter!=lintracksEnd;++iter) {
         if(msgLvl(MSG::VERBOSE))
         {
           msg(MSG::VERBOSE) << "Updating vertex with a new track" << endmsg;
@@ -582,7 +582,7 @@ namespace Trk
     if(m_doSmoothing) {
       m_VertexSmoother->smooth(*ActualVertex);
     } else {
-      for (iter=lintracksBegin;iter!=lintracksEnd;iter++) {
+      for (iter=lintracksBegin;iter!=lintracksEnd;++iter) {
         //      const MeasuredPerigee* castToMP=dynamic_cast<const MeasuredPerigee*>(iter->initialPerigee());
         //      if (castToMP==0) {
         //        msg(MSG::WARNING) << "Couldn't cast a track to MeasuredPerigee to smooth it. Neutrals not supported. " <<
diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/CMakeLists.txt b/Tracking/TrkVertexFitter/TrkVertexTools/CMakeLists.txt
index 539498ae86c0f4ff47c05c46efbcafb590012512..7a951cf6937fa857205c6dcea4461381eb9b7644 100644
--- a/Tracking/TrkVertexFitter/TrkVertexTools/CMakeLists.txt
+++ b/Tracking/TrkVertexFitter/TrkVertexTools/CMakeLists.txt
@@ -28,7 +28,7 @@ atlas_add_component( TrkVertexTools
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} 
-                     LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel xAODTracking GaudiKernel TrkVertexFitterInterfaces EventPrimitives GeneratorObjects TrkEventPrimitives VxVertex )
+                     LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel xAODTracking GaudiKernel TrkVertexFitterInterfaces EventPrimitives GeneratorObjects TrkEventPrimitives VxVertex BeamSpotConditionsData )
 
 # Install files from the package:
 atlas_install_headers( TrkVertexTools )
diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/doc/METMenuSequences.md b/Trigger/TrigAlgorithms/TrigEFMissingET/doc/METMenuSequences.md
index 8e4d09e5c775982801699ce7cc9c498e56a2504c..202fc01d938834c401f503feb786c7c1c8d59432 100644
--- a/Trigger/TrigAlgorithms/TrigEFMissingET/doc/METMenuSequences.md
+++ b/Trigger/TrigAlgorithms/TrigEFMissingET/doc/METMenuSequences.md
@@ -20,8 +20,9 @@ topSequence = AlgSequence()
 
 from L1Decoder.L1DecoderConfig import mapThresholdToL1DecisionCollection
 
-from DecisionHandling.DecisionHandlingConf import InputMakerForRoI
+from DecisionHandling.DecisionHandlingConf import InputMakerForRoI, ViewCreatorInitialROITool
 InputMakerAlg = InputMakerForRoI("MetCellInputMaker", RoIsLink="initialRoI")
+InputMakerAlg.RoITool = ViewCreatorInitialROITool()
 InputMakerAlg.RoIs='METCellRoI'
 InputMakerAlg.InputMakerInputDecisions=[mapThresholdToL1DecisionCollection("XE")]
 InputMakerAlg.InputMakerOutputDecisions="InputMaker_from_L1MET"
@@ -39,7 +40,7 @@ metHypoTool.metThreshold=50
 metHypoAlg = MissingETHypoAlgMT("METHypoAlg")
 metHypoAlg.HypoTools = [metHypoTool]
 metHypoAlg.METContainerKey="HLT_MET"
-metHypoAlg.HypoInputDecisions = InputMakerAlg.InputMakerOutputDecisions[0]
+metHypoAlg.HypoInputDecisions = InputMakerAlg.InputMakerOutputDecisions
 metHypoAlg.HypoOutputDecisions = "EFMETDecisions"
 
 topSequence += metHypoAlg
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h
index 573cb0d858f5df72215c8888e2fe5bba7e0614bf..880a43b7b764fe6530fa3cc042ff91376558c4ec 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h
@@ -14,10 +14,10 @@
 #include "TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h"
 #include "MuonRDO/RpcPadContainer.h"
 
-#include "TrigL2MuonSA/RpcData.h"
-#include "TrigL2MuonSA/RpcFitResult.h"
-#include "TrigL2MuonSA/RpcPatFinder.h"
-#include "TrigL2MuonSA/RecMuonRoIUtils.h"
+#include "../src/RpcData.h"
+#include "../src/RpcFitResult.h"
+#include "../src/RpcPatFinder.h"
+#include "../src/RecMuonRoIUtils.h"
 #include "RegionSelector/IRegSelSvc.h"
 #include "TrigSteeringEvent/TrigRoiDescriptor.h"
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlignmentBarrelLUT.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlignmentBarrelLUT.cxx
index c12771e1b30800d84e9d0635c91ab73a4ba1047e..aa116cc88ccb447c4d3f159a5ba5eb3c7874361a 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlignmentBarrelLUT.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlignmentBarrelLUT.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/AlignmentBarrelLUT.h"
+#include "AlignmentBarrelLUT.h"
 #include<fstream>
 
 #include "AthenaBaseComps/AthMsgStreamMacros.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/AlignmentBarrelLUT.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlignmentBarrelLUT.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/AlignmentBarrelLUT.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlignmentBarrelLUT.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlignmentBarrelLUTSvc.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlignmentBarrelLUTSvc.cxx
index 23c6dd7ff5801590894006f07fb04bc49ceb5b3b..8c9555141c8a7634074d2c0c0ea265f317725fe1 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlignmentBarrelLUTSvc.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlignmentBarrelLUTSvc.cxx
@@ -4,7 +4,7 @@
 
 #include "GaudiKernel/ISvcLocator.h"
 
-#include "TrigL2MuonSA/AlignmentBarrelLUTSvc.h"
+#include "AlignmentBarrelLUTSvc.h"
 #include "PathResolver/PathResolver.h"
 
 #include "AthenaBaseComps/AthMsgStreamMacros.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/AlignmentBarrelLUTSvc.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlignmentBarrelLUTSvc.h
similarity index 96%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/AlignmentBarrelLUTSvc.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlignmentBarrelLUTSvc.h
index e97b9c2aea3b3989a8584ea33605139eb02af249..77c2bba7ca246c70333ea09de80d23043f10413a 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/AlignmentBarrelLUTSvc.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlignmentBarrelLUTSvc.h
@@ -11,7 +11,7 @@
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
 
-#include "TrigL2MuonSA/AlignmentBarrelLUT.h"
+#include "AlignmentBarrelLUT.h"
 
 namespace TrigL2MuonSA {
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlphaBetaEstimate.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlphaBetaEstimate.cxx
index 71db753e207072f16986b3b0ead2b4a9790e18fa..f111c28f6ce0296a05d4d2b5c7e76711713b5a44 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlphaBetaEstimate.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlphaBetaEstimate.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/AlphaBetaEstimate.h"
+#include "AlphaBetaEstimate.h"
 
 #include <cmath>
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/AlphaBetaEstimate.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlphaBetaEstimate.h
similarity index 90%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/AlphaBetaEstimate.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlphaBetaEstimate.h
index 55952a87248613e341d5061dcb3d8c798d9beab5..35ddd6ddff8c8adf7e728cd748d7e5817e5281e4 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/AlphaBetaEstimate.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/AlphaBetaEstimate.h
@@ -11,11 +11,11 @@
 
 #include "TrigT1Interfaces/RecMuonRoI.h"
 
-#include "TrigL2MuonSA/TgcFitResult.h"
-#include "TrigL2MuonSA/MuonRoad.h"
-#include "TrigL2MuonSA/TrackData.h"
+#include "TgcFitResult.h"
+#include "MuonRoad.h"
+#include "TrackData.h"
 
-#include "TrigL2MuonSA/PtEndcapLUTSvc.h"
+#include "PtEndcapLUTSvc.h"
 
 namespace TrigL2MuonSA {
   
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/BarrelRoadData.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/BarrelRoadData.cxx
index ad77fe6dbc82d1d50b8c69227b9df1cac7c78065..bda1a52e4581359b0b457ae4e9e860ed9a7045ac 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/BarrelRoadData.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/BarrelRoadData.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/BarrelRoadData.h"
+#include "BarrelRoadData.h"
 #include <iostream>
 
 const float MuonRoads[2][12][8] = {{ // LOW PT threshold
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/BarrelRoadData.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/BarrelRoadData.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/BarrelRoadData.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/BarrelRoadData.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscData.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscData.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscData.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscData.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.cxx
index 23586ce55052d82366c96f81af683ae4c021203d..1323f74e17fdd03c5a253348673f7efeb8b89ea2 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/CscDataPreparator.h"
+#include "CscDataPreparator.h"
 
 #include "StoreGate/ActiveStoreSvc.h"
 #include "xAODTrigMuon/TrigMuonDefs.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.h
similarity index 95%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscDataPreparator.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.h
index 90cc948bd37418d112fb9a546d77ca6285f0d307..cde865c7b2bda93193d59072b6c19b5d6584dc20 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscDataPreparator.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscDataPreparator.h
@@ -13,10 +13,10 @@
 #include "ByteStreamCnvSvcBase/ROBDataProviderSvc.h"
 #include "TrigT1Interfaces/RecMuonRoI.h"
 #include "RegionSelector/IRegSelSvc.h"
-#include "TrigL2MuonSA/TgcData.h"
-#include "TrigL2MuonSA/CscData.h"
-#include "TrigL2MuonSA/RecMuonRoIUtils.h"
-#include "TrigL2MuonSA/MuonRoad.h"
+#include "TgcData.h"
+#include "CscData.h"
+#include "RecMuonRoIUtils.h"
+#include "MuonRoad.h"
 #include "TrigSteeringEvent/TrigRoiDescriptor.h"
 #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h"
 #include "MuonPrepRawData/MuonPrepDataContainer.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscRegUtils.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscRegUtils.cxx
index 3aa88f323f9798ca8576b6e73978c21293415a15..aea9e4a5b874234da3488a9e24bfd661e760545f 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscRegUtils.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscRegUtils.cxx
@@ -3,7 +3,7 @@
 */
 
 
-#include "TrigL2MuonSA/CscRegUtils.h"
+#include "CscRegUtils.h"
 
 #include "AthenaBaseComps/AthMsgStreamMacros.h"
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscRegUtils.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscRegUtils.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscRegUtils.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscRegUtils.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscSegmentMaker.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscSegmentMaker.cxx
index a66f0c5ba71140318ac60916e7a19990980d12ef..adf9767950ad9f63224e106de24f5f4a9b0138dd 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscSegmentMaker.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscSegmentMaker.cxx
@@ -6,7 +6,7 @@
 #include "MuonReadoutGeometry/CscReadoutElement.h"
 #include "MuonReadoutGeometry/MuonDetectorManager.h"
 
-#include "TrigL2MuonSA/CscSegmentMaker.h"
+#include "CscSegmentMaker.h"
 #include "AthenaBaseComps/AthMsgStreamMacros.h"
 
 #include "GeoPrimitives/GeoPrimitives.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscSegmentMaker.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscSegmentMaker.h
similarity index 96%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscSegmentMaker.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscSegmentMaker.h
index a9b438830ae300fa72a89f954b4986358197932f..932f2cb1d6cc89d93aaee1601a3336a2a36f0ff8 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/CscSegmentMaker.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/CscSegmentMaker.h
@@ -12,11 +12,11 @@
 
 #include "GeoPrimitives/GeoPrimitives.h"
 
-#include "TrigL2MuonSA/TrackData.h"
-#include "TrigL2MuonSA/TgcFitResult.h"
-#include "TrigL2MuonSA/MuonRoad.h"
-#include "TrigL2MuonSA/CscData.h"
-#include "TrigL2MuonSA/CscRegUtils.h"
+#include "TrackData.h"
+#include "TgcFitResult.h"
+#include "MuonRoad.h"
+#include "CscData.h"
+#include "CscRegUtils.h"
 
 #include <vector>
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtData.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtData.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtData.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtData.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx
index b84d02b8537676c3bd381a6bad6fa86f7b89e948..14b5ccceda87ac058838cb1754aec77692bbeb35 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/MdtDataPreparator.h"
+#include "MdtDataPreparator.h"
 
 #include "CxxUtils/phihelper.h"
 
@@ -17,7 +17,7 @@
 #include "MuonReadoutGeometry/MuonDetectorManager.h"
 #include "MuonReadoutGeometry/MdtReadoutElement.h"
 
-#include "TrigL2MuonSA/MdtRegionDefiner.h"
+#include "MdtRegionDefiner.h"
 
 #include "xAODTrigMuon/TrigMuonDefs.h"
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.h
similarity index 96%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.h
index 08986d6bed03dd0c6bbd788f227805f7a0f4c2b4..8e97d675adefed269bd99f6357dba61809b2c801 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.h
@@ -19,13 +19,13 @@
 #include "TrigSteeringEvent/TrigRoiDescriptor.h"
 #include "MuonIdHelpers/IMuonIdHelperSvc.h"
 
-#include "TrigL2MuonSA/TgcData.h"
-#include "TrigL2MuonSA/MdtData.h"
-#include "TrigL2MuonSA/RecMuonRoIUtils.h"
-#include "TrigL2MuonSA/MdtRegionDefiner.h"
+#include "TgcData.h"
+#include "MdtData.h"
+#include "RecMuonRoIUtils.h"
+#include "MdtRegionDefiner.h"
 
-#include "TrigL2MuonSA/RpcFitResult.h"
-#include "TrigL2MuonSA/TgcFitResult.h"
+#include "RpcFitResult.h"
+#include "TgcFitResult.h"
 
 #include "MuonCablingData/MuonMDT_CablingMap.h"
 #include "StoreGate/ReadCondHandleKey.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparatorOptions.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparatorOptions.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparatorOptions.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparatorOptions.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtRegion.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegion.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtRegion.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegion.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx
index e7de388953c0dceaebb9a33e2ff81e892fd32df4..fa2ab5677d25de7f508f34721ee39bef25998639 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx
@@ -2,9 +2,9 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/MdtRegionDefiner.h"
+#include "MdtRegionDefiner.h"
 
-#include "TrigL2MuonSA/MdtRegion.h"
+#include "MdtRegion.h"
 #include "MuonReadoutGeometry/MuonDetectorManager.h"
 #include "MuonReadoutGeometry/MdtReadoutElement.h"
 #include "MuonReadoutGeometry/MuonStation.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtRegionDefiner.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.h
similarity index 93%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtRegionDefiner.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.h
index 555de87e2c439684f5dc76c6bf0c4c83717ed18f..505731a7471e1853f9ced3212df77400a36dc421 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtRegionDefiner.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.h
@@ -11,13 +11,13 @@
 #include "MuonIdHelpers/IMuonIdHelperSvc.h"
 #include "TrigT1Interfaces/RecMuonRoI.h"
 
-#include "TrigL2MuonSA/TgcFit.h"
-#include "TrigL2MuonSA/TgcData.h"
-#include "TrigL2MuonSA/RpcData.h"
-#include "TrigL2MuonSA/TgcFitResult.h"
-#include "TrigL2MuonSA/RpcFitResult.h"
-#include "TrigL2MuonSA/MuonRoad.h"
-#include "TrigL2MuonSA/MdtRegion.h"
+#include "TgcFit.h"
+#include "TgcData.h"
+#include "RpcData.h"
+#include "TgcFitResult.h"
+#include "RpcFitResult.h"
+#include "MuonRoad.h"
+#include "MdtRegion.h"
 
 #include <string>
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx
index ef157b8f6e342b308862c57d42e5debf6c482981..ff66b97f51d72a100fbea8b4d1896fd53d8c79fb 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/MuCalStreamerTool.h"
+#include "MuCalStreamerTool.h"
 
 #include <cmath>
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuCalStreamerTool.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h
similarity index 95%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuCalStreamerTool.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h
index 1ad3b9a71f34ec6e399e53550520c46817767b4b..4ff27c7a8fd4126e398576fb799fd830d10a32e0 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuCalStreamerTool.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h
@@ -8,11 +8,11 @@
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "GaudiKernel/ServiceHandle.h"
 
-#include "TrigL2MuonSA/MdtData.h"
-#include "TrigL2MuonSA/RpcData.h"
-#include "TrigL2MuonSA/TgcData.h"
-#include "TrigL2MuonSA/CscData.h"
-#include "TrigL2MuonSA/TrackData.h"
+#include "MdtData.h"
+#include "RpcData.h"
+#include "TgcData.h"
+#include "CscData.h"
+#include "TrackData.h"
 
 #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h"
 #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.cxx
index d620a5939fe4bcd3395c3213cdfab0163f18e412..d5a74b8e6054128f4c5ec4c5179d567d16fbc1d1 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/MuFastDataPreparator.h"
+#include "MuFastDataPreparator.h"
 
 #include "MuonReadoutGeometry/MuonDetectorManager.h"
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.h
similarity index 90%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastDataPreparator.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.h
index 40b1865f6aeb12047db5929cd6e1e0b4781064d8..e9e4186e64103df6855bc65404e9f5ac217a767d 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastDataPreparator.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.h
@@ -19,19 +19,19 @@
 #include "TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h"
 #include "TrigSteeringEvent/TrigRoiDescriptor.h"
 
-#include "TrigL2MuonSA/MuFastDataPreparatorOptions.h"
+#include "MuFastDataPreparatorOptions.h"
 #include "TrigL2MuonSA/RpcDataPreparator.h"
-#include "TrigL2MuonSA/RpcRoadDefiner.h"
-#include "TrigL2MuonSA/RpcPatFinder.h"
-#include "TrigL2MuonSA/TgcDataPreparator.h"
-#include "TrigL2MuonSA/TgcRoadDefiner.h"
-#include "TrigL2MuonSA/MdtDataPreparator.h"
-#include "TrigL2MuonSA/MdtRegion.h"
-#include "TrigL2MuonSA/CscDataPreparator.h"
-#include "TrigL2MuonSA/CscData.h"
+#include "RpcRoadDefiner.h"
+#include "RpcPatFinder.h"
+#include "TgcDataPreparator.h"
+#include "TgcRoadDefiner.h"
+#include "MdtDataPreparator.h"
+#include "MdtRegion.h"
+#include "CscDataPreparator.h"
+#include "CscData.h"
 
 #include "TrigMuonBackExtrapolator/ITrigMuonBackExtrapolator.h"
-#include "TrigL2MuonSA/PtEndcapLUTSvc.h"
+#include "PtEndcapLUTSvc.h"
 
 #include "RPC_CondCabling/RpcCablingCondData.h"
 #include "StoreGate/ReadCondHandleKey.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastDataPreparatorOptions.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparatorOptions.h
similarity index 90%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastDataPreparatorOptions.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparatorOptions.h
index 7b02ce829521b7975dfb6958086471033426d2ff..d8748bc4297a3700caeae37cb84e74bb1550cd89 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastDataPreparatorOptions.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparatorOptions.h
@@ -5,8 +5,8 @@
 #ifndef  TRIGL2MUONSA_MUFASTDATAPREPARATOROPTIONS_H
 #define  TRIGL2MUONSA_MUFASTDATAPREPARATOROPTIONS_H
 
-#include "TrigL2MuonSA/TgcDataPreparatorOptions.h"
-#include "TrigL2MuonSA/MdtDataPreparatorOptions.h"
+#include "TgcDataPreparatorOptions.h"
+#include "MdtDataPreparatorOptions.h"
 
 namespace TrigL2MuonSA {
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastPatternFinder.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastPatternFinder.cxx
index 4eb7d5677356745034677f2a2a05bf49bbb16e71..b40dfbc5ca15ce0e50b8a12d4ba4e5dabbf866a9 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastPatternFinder.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastPatternFinder.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/MuFastPatternFinder.h"
+#include "MuFastPatternFinder.h"
 
 #include "MuonCalibEvent/MdtCalibHit.h"
 #include "MuonReadoutGeometry/MuonDetectorManager.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastPatternFinder.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastPatternFinder.h
similarity index 95%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastPatternFinder.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastPatternFinder.h
index 04637312760c33240c8f9e59fd435649e5fccdf5..6728279b23528e78d6dedc3dfeb573a0b93513e9 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastPatternFinder.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastPatternFinder.h
@@ -11,9 +11,9 @@
 
 #include "GeoPrimitives/GeoPrimitives.h"
 #include "MdtCalibSvc/MdtCalibrationTool.h"
-#include "TrigL2MuonSA/MuonRoad.h"
-#include "TrigL2MuonSA/MdtData.h"
-#include "TrigL2MuonSA/TrackData.h"
+#include "MuonRoad.h"
+#include "MdtData.h"
+#include "TrackData.h"
 #include "MuonIdHelpers/IMuonIdHelperSvc.h"
 
 // --------------------------------------------------------------------------------
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.cxx
index dd3c6dc07968814ca9b1fd11da9fb23ce31f86f3..c9cedd5faae3ea756ef85543e41477fd64d50074 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/MuFastStationFitter.h"
+#include "MuFastStationFitter.h"
 #include "xAODTrigMuon/L2StandAloneMuonAuxContainer.h"
 
 #include "CLHEP/Units/PhysicalConstants.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastStationFitter.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.h
similarity index 93%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastStationFitter.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.h
index 041fd626185cd7b37a7220b2b093e2cd1611480b..4ace53a5c1b6aa14b9203d2c330da4e6f91d6a76 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastStationFitter.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastStationFitter.h
@@ -10,16 +10,16 @@
 #include "GaudiKernel/ToolHandle.h"
 #include "TrigT1Interfaces/RecMuonRoI.h"
 
-#include "TrigL2MuonSA/MdtData.h"
-#include "TrigL2MuonSA/TgcFitResult.h"
-#include "TrigL2MuonSA/RpcFitResult.h"
-#include "TrigL2MuonSA/SuperPointData.h"
-#include "TrigL2MuonSA/TrackData.h"
-#include "TrigL2MuonSA/MuonRoad.h"
-#include "TrigL2MuonSA/PtEndcapLUT.h"
+#include "MdtData.h"
+#include "TgcFitResult.h"
+#include "RpcFitResult.h"
+#include "SuperPointData.h"
+#include "TrackData.h"
+#include "MuonRoad.h"
+#include "PtEndcapLUT.h"
 #include "TrigMuonBackExtrapolator/ITrigMuonBackExtrapolator.h"
-#include "TrigL2MuonSA/AlphaBetaEstimate.h"
-#include "TrigL2MuonSA/PtFromAlphaBeta.h"
+#include "AlphaBetaEstimate.h"
+#include "PtFromAlphaBeta.h"
 
 namespace TrigL2MuonSA {
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx
index 5fc174ef82bab7cd6f105f8ee5fc23a5b38c95de..9b17f0b7a69256b461f0da3bdd4ceb32807d9a35 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx
@@ -5,7 +5,7 @@
 #include <numeric>
 #include <string>
 
-#include "TrigL2MuonSA/MuFastSteering.h"
+#include "MuFastSteering.h"
 #include "xAODTrigMuon/L2StandAloneMuonAuxContainer.h"
 #include "xAODTrigMuon/TrigMuonDefs.h"
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastSteering.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h
similarity index 96%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastSteering.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h
index 2167cd060b0ed2f44cc3e8141a633489efbdfb14..491587f889c689b24e8415725990377bec5a87fb 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastSteering.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h
@@ -14,16 +14,16 @@
 
 #include "TrigSteeringEvent/TrigRoiDescriptor.h"
 
-#include "TrigL2MuonSA/MuFastDataPreparator.h"
-#include "TrigL2MuonSA/MuFastPatternFinder.h"
-#include "TrigL2MuonSA/MuFastStationFitter.h"
-#include "TrigL2MuonSA/MuFastTrackFitter.h"
-#include "TrigL2MuonSA/MuFastTrackExtrapolator.h"
-#include "TrigL2MuonSA/RecMuonRoIUtils.h"
-#include "TrigL2MuonSA/MuCalStreamerTool.h"
+#include "MuFastDataPreparator.h"
+#include "MuFastPatternFinder.h"
+#include "MuFastStationFitter.h"
+#include "MuFastTrackFitter.h"
+#include "MuFastTrackExtrapolator.h"
+#include "RecMuonRoIUtils.h"
+#include "MuCalStreamerTool.h"
 #include "GaudiKernel/IIncidentListener.h"
-#include "TrigL2MuonSA/CscSegmentMaker.h"
-#include "TrigL2MuonSA/CscRegUtils.h"
+#include "CscSegmentMaker.h"
+#include "CscRegUtils.h"
 
 //adding a part of DataHandle for AthenaMT
 #include "AthenaBaseComps/AthReentrantAlgorithm.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackExtrapolator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackExtrapolator.cxx
index 27d35bf5160f5ff2d93801a603239919f36177a3..c1af2468ba6b12cb0c5c19d70d6cb1f59bb74199 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackExtrapolator.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackExtrapolator.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/MuFastTrackExtrapolator.h"
+#include "MuFastTrackExtrapolator.h"
 #include "xAODTrigMuon/L2StandAloneMuonAuxContainer.h"
 #include "xAODTrigMuon/TrigMuonDefs.h"
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastTrackExtrapolator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackExtrapolator.h
similarity index 97%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastTrackExtrapolator.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackExtrapolator.h
index dc88ad6d869f99bc56e3c90b1d0e7b6a7b7a9f5d..ff43f25571c13003703b5adb543b26c8cb7f2505 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastTrackExtrapolator.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackExtrapolator.h
@@ -9,7 +9,7 @@
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
 
-#include "TrigL2MuonSA/TrackData.h"
+#include "TrackData.h"
 
 #include "TrigMuonBackExtrapolator/ITrigMuonBackExtrapolator.h"
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackFitter.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackFitter.cxx
index 61af56c0b39a73e71c14475acab7399500e66e7b..ae2002805f87f7ce0a6561a4e22830c8f06be6aa 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackFitter.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackFitter.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/MuFastTrackFitter.h"
+#include "MuFastTrackFitter.h"
 
 #include "AthenaBaseComps/AthMsgStreamMacros.h"
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastTrackFitter.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackFitter.h
similarity index 81%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastTrackFitter.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackFitter.h
index 61fbc155324b258bd8a4eb5c7114a654771ce65d..a29932d6e3a551c2527e79001f87b260f9af3322 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastTrackFitter.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastTrackFitter.h
@@ -10,18 +10,18 @@
 
 #include "TrigT1Interfaces/RecMuonRoI.h"
 
-#include "TrigL2MuonSA/RpcFitResult.h"
-#include "TrigL2MuonSA/TgcFitResult.h"
-#include "TrigL2MuonSA/TrackData.h"
+#include "RpcFitResult.h"
+#include "TgcFitResult.h"
+#include "TrackData.h"
 
-#include "TrigL2MuonSA/PtEndcapLUTSvc.h"
-#include "TrigL2MuonSA/PtBarrelLUTSvc.h"
-#include "TrigL2MuonSA/AlignmentBarrelLUTSvc.h"
+#include "PtEndcapLUTSvc.h"
+#include "PtBarrelLUTSvc.h"
+#include "AlignmentBarrelLUTSvc.h"
 
-#include "TrigL2MuonSA/SagittaRadiusEstimate.h"
-#include "TrigL2MuonSA/AlphaBetaEstimate.h"
-#include "TrigL2MuonSA/PtFromRadius.h"
-#include "TrigL2MuonSA/PtFromAlphaBeta.h"
+#include "SagittaRadiusEstimate.h"
+#include "AlphaBetaEstimate.h"
+#include "PtFromRadius.h"
+#include "PtFromAlphaBeta.h"
 
 namespace TrigL2MuonSA {
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuonRoad.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuonRoad.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuonRoad.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuonRoad.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtBarrelLUT.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtBarrelLUT.cxx
index 089e5708d7b48f0c8c5638627c71f956d7d8d3f0..d21c94af5e0d37bf353e003b1378e6ed4382c8e9 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtBarrelLUT.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtBarrelLUT.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/PtBarrelLUT.h"
+#include "PtBarrelLUT.h"
 
 #include<fstream>
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtBarrelLUT.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtBarrelLUT.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtBarrelLUT.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtBarrelLUT.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtBarrelLUTSvc.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtBarrelLUTSvc.cxx
index 8333ad14fabf5b1fcf0496d80cf2ab1d89ef643b..c78c2dfe5a007affb565b54e0ceac3738c5fcaf0 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtBarrelLUTSvc.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtBarrelLUTSvc.cxx
@@ -4,7 +4,7 @@
 
 #include "GaudiKernel/ISvcLocator.h"
 
-#include "TrigL2MuonSA/PtBarrelLUTSvc.h"
+#include "PtBarrelLUTSvc.h"
 #include "PathResolver/PathResolver.h"
 
 #include "AthenaBaseComps/AthMsgStreamMacros.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtBarrelLUTSvc.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtBarrelLUTSvc.h
similarity index 95%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtBarrelLUTSvc.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtBarrelLUTSvc.h
index 1d83d996b4730ab792b596a83e9331c4e1c2929b..3ee66acc9dfd497c1d739dc2299b966bb365e666 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtBarrelLUTSvc.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtBarrelLUTSvc.h
@@ -12,7 +12,7 @@
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
 
-#include "TrigL2MuonSA/PtBarrelLUT.h"
+#include "PtBarrelLUT.h"
 
 namespace TrigL2MuonSA {
 
@@ -27,7 +27,7 @@ namespace TrigL2MuonSA {
   public:
     PtBarrelLUTSvc(const std::string& name,ISvcLocator* sl);
     
-    virtual StatusCode queryInterface(const InterfaceID& riid,void** ppvIF);
+    virtual StatusCode queryInterface(const InterfaceID& riid,void** ppvIF) override;
     
     virtual StatusCode initialize(void) override;
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtEndcapLUT.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtEndcapLUT.cxx
index 06ad499b6a58c11d38e5814eaddc12246a03c3c2..c5aaffb92a717ac9fc50dc0355deafe1b1a7a13d 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtEndcapLUT.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtEndcapLUT.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/PtEndcapLUT.h"
+#include "PtEndcapLUT.h"
 #include "CLHEP/Vector/TwoVector.h"
 #include <fstream>
 #include <sstream>
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtEndcapLUT.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtEndcapLUT.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtEndcapLUT.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtEndcapLUT.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtEndcapLUTSvc.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtEndcapLUTSvc.cxx
index 85633851c2e4c0a0e0f3e837d5d6b9f6af9f1efd..7c7977b957e73805e94ebe5b112f73207e7c241b 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtEndcapLUTSvc.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtEndcapLUTSvc.cxx
@@ -4,7 +4,7 @@
 
 #include "GaudiKernel/ISvcLocator.h"
 
-#include "TrigL2MuonSA/PtEndcapLUTSvc.h"
+#include "PtEndcapLUTSvc.h"
 #include "PathResolver/PathResolver.h"
 
 #include "AthenaBaseComps/AthMsgStreamMacros.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtEndcapLUTSvc.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtEndcapLUTSvc.h
similarity index 97%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtEndcapLUTSvc.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtEndcapLUTSvc.h
index 89d28c26e1d573b258a836dd71f4e98e59f5a4a1..52868be10e77e6910ffa05f00d60db0b840d4334 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtEndcapLUTSvc.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtEndcapLUTSvc.h
@@ -11,7 +11,7 @@
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
 
-#include "TrigL2MuonSA/PtEndcapLUT.h"
+#include "PtEndcapLUT.h"
 
 #include <map>
 #include <cstring>
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromAlphaBeta.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromAlphaBeta.cxx
index eaafa5c07189a2c4576b37970b85ea5ebf6e5d25..70bd86d3672f77dd929cd91a6c02eb63283d7c6f 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromAlphaBeta.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromAlphaBeta.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/PtFromAlphaBeta.h"
+#include "PtFromAlphaBeta.h"
 
 #include "CLHEP/Units/PhysicalConstants.h"
 #include "xAODTrigMuon/TrigMuonDefs.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtFromAlphaBeta.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromAlphaBeta.h
similarity index 90%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtFromAlphaBeta.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromAlphaBeta.h
index cef2d61e21b07ad0239bb104f637a1b291278704..2d3afb4aec86d91dd960983d90f6f3923ce95b46 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtFromAlphaBeta.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromAlphaBeta.h
@@ -9,10 +9,10 @@
 
 #include "GaudiKernel/ServiceHandle.h"
 
-#include "TrigL2MuonSA/TrackData.h"
-#include "TrigL2MuonSA/PtEndcapLUTSvc.h"
-#include "TrigL2MuonSA/PtEndcapLUT.h"
-#include "TrigL2MuonSA/TgcFitResult.h"
+#include "TrackData.h"
+#include "PtEndcapLUTSvc.h"
+#include "PtEndcapLUT.h"
+#include "TgcFitResult.h"
 
 namespace TrigL2MuonSA {
   
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromRadius.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromRadius.cxx
index 267c73445a9d4727a1878af8ab2da0d10a8c4750..b8a22b7c24dc38941ad670e693c7bf243661e47f 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromRadius.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromRadius.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/PtFromRadius.h"
+#include "PtFromRadius.h"
 
 #include "CLHEP/Units/PhysicalConstants.h"
 #include "TMath.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtFromRadius.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromRadius.h
similarity index 87%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtFromRadius.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromRadius.h
index 9e1020c3efe212f8dc5762f0eb00f0aba6afdb3c..0d51efd779795a43bf4bbb329abebdc54608f2b2 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/PtFromRadius.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/PtFromRadius.h
@@ -9,9 +9,9 @@
 
 #include "GaudiKernel/ServiceHandle.h"
 
-#include "TrigL2MuonSA/TrackData.h"
-#include "TrigL2MuonSA/PtBarrelLUTSvc.h"
-#include "TrigL2MuonSA/PtBarrelLUT.h"
+#include "TrackData.h"
+#include "PtBarrelLUTSvc.h"
+#include "PtBarrelLUT.h"
 
 namespace TrigL2MuonSA {
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RecMuonRoIUtils.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RecMuonRoIUtils.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RecMuonRoIUtils.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/RecMuonRoIUtils.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcData.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcData.h
similarity index 95%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcData.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcData.h
index c7a660a940561cac9c4c034578f795d9e63527b6..c2bd6aa90298c6636cbc3ff8bc8c4a8216e49234 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcData.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcData.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef  TRIGL2MUONSA_RPCDATA_H
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx
index e13a314a9d9a79061015b4c8d3113e490396685a..794b9cab42afb38ac59acc64923ceeb42b566b1e 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx
@@ -6,8 +6,8 @@
 #include <cmath>
 
 #include "TrigL2MuonSA/RpcDataPreparator.h"
-#include "TrigL2MuonSA/RpcData.h"
-#include "TrigL2MuonSA/RecMuonRoIUtils.h"
+#include "RpcData.h"
+#include "RecMuonRoIUtils.h"
 
 #include "MuonReadoutGeometry/MuonDetectorManager.h"
 #include "MuonReadoutGeometry/RpcReadoutElement.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcFitResult.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcFitResult.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcFitResult.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcFitResult.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcPatFinder.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcPatFinder.cxx
index 1c432aad75f2ac9ec15d4bcad8289b1cd50bed7e..0912ffd9edb2433eb7fb7d70d39090252e0d5196 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcPatFinder.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcPatFinder.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/RpcPatFinder.h"
+#include "RpcPatFinder.h"
 
 #include <math.h>
 #include <bitset>
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcPatFinder.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcPatFinder.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcPatFinder.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcPatFinder.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.cxx
index 7f753f214dc4c2dbd53990616fc82e2cc49d7715..3228d2083fa20ddff2c05f65f8071ffd893e5abe 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.cxx
@@ -4,7 +4,7 @@
 
 #include <cmath>
 
-#include "TrigL2MuonSA/RpcRoadDefiner.h"
+#include "RpcRoadDefiner.h"
 #include "TrigSteeringEvent/TrigRoiDescriptor.h"
 #include "AthenaBaseComps/AthMsgStreamMacros.h"
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcRoadDefiner.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.h
similarity index 92%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcRoadDefiner.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.h
index b2f5ef5aea48b2754efd44c28056ef27fc1818b8..6aafa67f10d64128b24f61b09db4ca98fd9a2c75 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcRoadDefiner.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.h
@@ -10,12 +10,12 @@
 #include "GaudiKernel/ToolHandle.h"
 
 #include "TrigMuonBackExtrapolator/ITrigMuonBackExtrapolator.h"
-#include "TrigL2MuonSA/RpcData.h"
-#include "TrigL2MuonSA/RpcPatFinder.h"
-#include "TrigL2MuonSA/MuonRoad.h"
-#include "TrigL2MuonSA/MdtRegion.h"
-#include "TrigL2MuonSA/RpcFitResult.h"
-#include "TrigL2MuonSA/BarrelRoadData.h"
+#include "RpcData.h"
+#include "RpcPatFinder.h"
+#include "MuonRoad.h"
+#include "MdtRegion.h"
+#include "RpcFitResult.h"
+#include "BarrelRoadData.h"
 #include "TrigT1Interfaces/RecMuonRoI.h"
 #include "RegionSelector/IRegSelSvc.h"
 #include "MuonIdHelpers/IMuonIdHelperSvc.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/SagittaRadiusEstimate.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/SagittaRadiusEstimate.cxx
index 30dc9b737ad231b8116866c5bcf27d0bcd731858..6b5088969bba6e70aa9c12254899a7e9d79959b7 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/SagittaRadiusEstimate.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/SagittaRadiusEstimate.cxx
@@ -4,7 +4,7 @@
 
 #include <cmath>
 
-#include "TrigL2MuonSA/SagittaRadiusEstimate.h"
+#include "SagittaRadiusEstimate.h"
 
 #include "xAODTrigMuon/TrigMuonDefs.h"
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/SagittaRadiusEstimate.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/SagittaRadiusEstimate.h
similarity index 90%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/SagittaRadiusEstimate.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/SagittaRadiusEstimate.h
index 51f36afad5ca7d4d1b8a56f24f09928395a10212..f0d837cafe548de37046d7922d87fefef4739690 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/SagittaRadiusEstimate.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/SagittaRadiusEstimate.h
@@ -11,11 +11,11 @@
 
 #include "TrigT1Interfaces/RecMuonRoI.h"
 
-#include "TrigL2MuonSA/RpcFitResult.h"
-#include "TrigL2MuonSA/TrackData.h"
+#include "RpcFitResult.h"
+#include "TrackData.h"
 
-#include "TrigL2MuonSA/AlignmentBarrelLUTSvc.h"
-#include "TrigL2MuonSA/AlignmentBarrelLUT.h"
+#include "AlignmentBarrelLUTSvc.h"
+#include "AlignmentBarrelLUT.h"
 
 namespace TrigL2MuonSA {
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/SuperPointData.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/SuperPointData.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/SuperPointData.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/SuperPointData.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcData.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcData.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcData.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcData.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx
index b4a5f877bebd2fd900405674059871ca155f4add..772075cdbaf082b78e9f12464f0c3747f4fe9aad 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx
@@ -4,9 +4,9 @@
 
 #include <cmath>
 
-#include "TrigL2MuonSA/TgcDataPreparator.h"
-#include "TrigL2MuonSA/TgcData.h"
-#include "TrigL2MuonSA/RecMuonRoIUtils.h"
+#include "TgcDataPreparator.h"
+#include "TgcData.h"
+#include "RecMuonRoIUtils.h"
 #include "MuonReadoutGeometry/MuonDetectorManager.h"
 #include "MuonPrepRawData/MuonPrepDataContainer.h"
 #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.h
similarity index 96%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.h
index 46aea41df3602afb8e9ac5ce50a565a7f099046e..d21f66ce7d78cf264914807a1b835e5651baa183 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.h
@@ -12,9 +12,9 @@
 #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h"
 #include "TrigT1Interfaces/RecMuonRoI.h"
 #include "MuonRDO/TgcRdoContainer.h"
-#include "TrigL2MuonSA/TgcDataPreparatorOptions.h"
-#include "TrigL2MuonSA/TgcData.h"
-#include "TrigL2MuonSA/RecMuonRoIUtils.h"
+#include "TgcDataPreparatorOptions.h"
+#include "TgcData.h"
+#include "RecMuonRoIUtils.h"
 #include "RegionSelector/IRegSelSvc.h"
 #include "MuonTGC_Cabling/MuonTGC_CablingSvc.h"
 #include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparatorOptions.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparatorOptions.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparatorOptions.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparatorOptions.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcFit.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcFit.cxx
index 2fdf1347c336fe0e26d47a47278ee9d7df9462e7..f71644cdb8c2f81a1b8c14bc72d26d941e08dc69 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcFit.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcFit.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/TgcFit.h"
+#include "TgcFit.h"
 #include "gsl/gsl_statistics.h"
 #include "gsl/gsl_fit.h"
 #include <float.h>
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcFit.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcFit.h
similarity index 99%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcFit.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcFit.h
index d4feeae668eca874e77b104711290307e44269cb..c418c0524773765ac829ff24ea59bc0f6982cd67 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcFit.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcFit.h
@@ -11,7 +11,7 @@
 #include "GeoPrimitives/GeoPrimitives.h"
 #include "GeoPrimitives/GeoPrimitivesHelpers.h"
 
-#include "TrigL2MuonSA/TgcFitResult.h"
+#include "TgcFitResult.h"
 
 namespace TrigL2MuonSA {
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcFitResult.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcFitResult.h
similarity index 100%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcFitResult.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcFitResult.h
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx
index 1a769effe4b0ecafbf6e2bccd34175fb3d756aa4..5a5214a76ef95172d7f892b78b779b16834cb414 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx
@@ -2,8 +2,8 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "TrigL2MuonSA/TgcRoadDefiner.h"
-#include "TrigL2MuonSA/MdtRegion.h"
+#include "TgcRoadDefiner.h"
+#include "MdtRegion.h"
 #include "xAODTrigMuon/L2StandAloneMuonAuxContainer.h"
 #include "xAODTrigMuon/TrigMuonDefs.h"
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.h
similarity index 92%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.h
index ebeba873716980305027555c04ff13fccc6e6ce8..3e7bd92542a5cf88c53b2a5d9063e09af01e144a 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.h
@@ -10,12 +10,12 @@
 #include "GaudiKernel/ToolHandle.h"
 
 #include "TrigMuonBackExtrapolator/ITrigMuonBackExtrapolator.h"
-#include "TrigL2MuonSA/PtEndcapLUTSvc.h"
-#include "TrigL2MuonSA/PtEndcapLUT.h"
-#include "TrigL2MuonSA/TgcFit.h"
-#include "TrigL2MuonSA/TgcData.h"
-#include "TrigL2MuonSA/MuonRoad.h"
-#include "TrigL2MuonSA/MdtRegion.h"
+#include "PtEndcapLUTSvc.h"
+#include "PtEndcapLUT.h"
+#include "TgcFit.h"
+#include "TgcData.h"
+#include "MuonRoad.h"
+#include "MdtRegion.h"
 #include "TrigT1Interfaces/RecMuonRoI.h"
 #include "RegionSelector/IRegSelSvc.h"
 #include "MuonIdHelpers/IMuonIdHelperSvc.h"
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TrackData.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TrackData.h
similarity index 93%
rename from Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TrackData.h
rename to Trigger/TrigAlgorithms/TrigL2MuonSA/src/TrackData.h
index 120dce3ec8ffce439795ddceb5b1b7218b97406d..65cb3cf2b05e82bc6b2559fedad153ed0fe8ae29 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TrackData.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TrackData.h
@@ -1,12 +1,12 @@
 /*
-  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  TRIGL2MUONSA_TRACKDATA_H
 #define  TRIGL2MUONSA_TRACKDATA_H
 
-#include "TrigL2MuonSA/MdtData.h"
-#include "TrigL2MuonSA/SuperPointData.h"
+#include "MdtData.h"
+#include "SuperPointData.h"
 
 #define NCHAMBER 11
 
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/components/TrigL2MuonSA_entries.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/components/TrigL2MuonSA_entries.cxx
index 6130bb07c6cb788ea86cf8ace1da3afd8c61b402..633baab0f9cefe611fc8dc94929f708ffb45af8e 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/components/TrigL2MuonSA_entries.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/components/TrigL2MuonSA_entries.cxx
@@ -1,32 +1,32 @@
 
-#include "TrigL2MuonSA/MuFastSteering.h"
-#include "TrigL2MuonSA/MuFastDataPreparator.h"
-#include "TrigL2MuonSA/TgcDataPreparator.h"
+#include "../MuFastSteering.h"
+#include "../MuFastDataPreparator.h"
+#include "../TgcDataPreparator.h"
 #include "TrigL2MuonSA/RpcDataPreparator.h"
-#include "TrigL2MuonSA/MdtDataPreparator.h"
-#include "TrigL2MuonSA/CscDataPreparator.h"
-#include "TrigL2MuonSA/TgcRoadDefiner.h"
-#include "TrigL2MuonSA/TgcFit.h"
-#include "TrigL2MuonSA/RpcRoadDefiner.h"
-#include "TrigL2MuonSA/RpcPatFinder.h"
-#include "TrigL2MuonSA/MdtRegionDefiner.h"
-#include "TrigL2MuonSA/MuFastPatternFinder.h"
-#include "TrigL2MuonSA/MuFastTrackFitter.h"
-#include "TrigL2MuonSA/MuFastStationFitter.h"
-#include "TrigL2MuonSA/MuFastTrackExtrapolator.h"
-#include "TrigL2MuonSA/AlphaBetaEstimate.h"
-#include "TrigL2MuonSA/SagittaRadiusEstimate.h"
-#include "TrigL2MuonSA/PtFromAlphaBeta.h"
-#include "TrigL2MuonSA/PtFromRadius.h"
-#include "TrigL2MuonSA/PtBarrelLUT.h"
-#include "TrigL2MuonSA/PtEndcapLUT.h"
-#include "TrigL2MuonSA/AlignmentBarrelLUT.h"
-#include "TrigL2MuonSA/PtBarrelLUTSvc.h"
-#include "TrigL2MuonSA/PtEndcapLUTSvc.h"
-#include "TrigL2MuonSA/AlignmentBarrelLUTSvc.h"
-#include "TrigL2MuonSA/MuCalStreamerTool.h"
-#include "TrigL2MuonSA/CscSegmentMaker.h"
-#include "TrigL2MuonSA/CscRegUtils.h"
+#include "../MdtDataPreparator.h"
+#include "../CscDataPreparator.h"
+#include "../TgcRoadDefiner.h"
+#include "../TgcFit.h"
+#include "../RpcRoadDefiner.h"
+#include "../RpcPatFinder.h"
+#include "../MdtRegionDefiner.h"
+#include "../MuFastPatternFinder.h"
+#include "../MuFastTrackFitter.h"
+#include "../MuFastStationFitter.h"
+#include "../MuFastTrackExtrapolator.h"
+#include "../AlphaBetaEstimate.h"
+#include "../SagittaRadiusEstimate.h"
+#include "../PtFromAlphaBeta.h"
+#include "../PtFromRadius.h"
+#include "../PtBarrelLUT.h"
+#include "../PtEndcapLUT.h"
+#include "../AlignmentBarrelLUT.h"
+#include "../PtBarrelLUTSvc.h"
+#include "../PtEndcapLUTSvc.h"
+#include "../AlignmentBarrelLUTSvc.h"
+#include "../MuCalStreamerTool.h"
+#include "../CscSegmentMaker.h"
+#include "../CscRegUtils.h"
 
 using namespace TrigL2MuonSA;
 
diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/CaloDef.py b/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/CaloDef.py
index b7354c7de4b14025813422b225fb290ae15b88bd..6b7231da24fe7f1f042f1ceac4864fe3aca8dd0f 100644
--- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/CaloDef.py
+++ b/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/CaloDef.py
@@ -119,6 +119,7 @@ def clusterFSInputMaker( ):
   RoIs = 'FSJETRoI'
   from AthenaConfiguration.ComponentFactory import CompFactory
   InputMakerAlg = CompFactory.InputMakerForRoI("IMclusterFS", RoIsLink="initialRoI")
+  InputMakerAlg.RoITool = CompFactory.ViewCreatorInitialROITool()
   InputMakerAlg.RoIs=RoIs
   return InputMakerAlg
 
diff --git a/Trigger/TrigAlgorithms/TrigT2CaloEgamma/python/TrigT2CaloEgammaMTConfig.py b/Trigger/TrigAlgorithms/TrigT2CaloEgamma/python/TrigT2CaloEgammaMTConfig.py
index e91b851e3b5cb906774dc9909836f7f873db77b2..b7d902ebeabceb13cc0d0c3b5c5a68621123d4aa 100644
--- a/Trigger/TrigAlgorithms/TrigT2CaloEgamma/python/TrigT2CaloEgammaMTConfig.py
+++ b/Trigger/TrigAlgorithms/TrigT2CaloEgamma/python/TrigT2CaloEgammaMTConfig.py
@@ -30,7 +30,7 @@ def fastL2EgammaClusteringAlg( flags, roisKey="EMCaloRoIs", doRinger=False):
     acc.addPublicTool( samp1 )
 
     sampe = EgammaReEmEnFex('FaAlgoEmEnFexConfig')
-    sampe.ExtraInputs+=[( 'LArOnOffIdMapping' , 'ConditionStore+LArOnOffIdMap' )]
+    sampe.ExtraInputs=[( 'LArOnOffIdMapping' , 'ConditionStore+LArOnOffIdMap' )]
     acc.addPublicTool( sampe )
 
     samph = EgammaReHadEnFex('FaAlgoHadEnFexConfig')
diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/CMakeLists.txt b/Trigger/TrigAnalysis/TrigDecisionMaker/CMakeLists.txt
index 79e7588fe1f5f40e23245b5019414d4508a8c568..c58c4001456266700bfcd1a92e745d120d496c39 100644
--- a/Trigger/TrigAnalysis/TrigDecisionMaker/CMakeLists.txt
+++ b/Trigger/TrigAnalysis/TrigDecisionMaker/CMakeLists.txt
@@ -1,35 +1,17 @@
-################################################################################
-# Package: TrigDecisionMaker
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigDecisionMaker )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/AthenaBaseComps
-                          Control/StoreGate
-                          Event/EventInfo
-                          Event/xAOD/xAODEventInfo
-                          Event/xAOD/xAODTrigger
-                          GaudiKernel
-                          Trigger/TrigConfiguration/TrigConfInterfaces
-                          Trigger/TrigConfiguration/TrigConfL1Data
-                          Trigger/TrigConfiguration/TrigConfHLTData
-                          Trigger/TrigEvent/TrigDecisionEvent
-                          Trigger/TrigEvent/TrigSteeringEvent
-                          Trigger/TrigSteer/TrigSteering
-                          Trigger/TrigSteer/DecisionHandling
-                          Trigger/TrigSteer/TrigOutputHandling
-                          Trigger/TrigT1/TrigT1Result )
+# External dependencies:
+find_package( Boost )
 
 # Component(s) in the package:
 atlas_add_component( TrigDecisionMaker
                      src/*.cxx
                      src/components/*.cxx
-                     LINK_LIBRARIES AthenaBaseComps DecisionHandlingLib StoreGateLib SGtests EventInfo xAODEventInfo GaudiKernel TrigConfL1Data TrigConfHLTData TrigDecisionEvent TrigSteeringEvent TrigSteeringLib TrigT1Result xAODTrigger TrigOutputHandlingLib )
+                     INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
+                     LINK_LIBRARIES AthenaBaseComps EventInfo GaudiKernel StoreGateLib TrigConfHLTData TrigConfInterfaces TrigConfL1Data TrigDecisionEvent TrigOutputHandlingLib TrigSteeringEvent TrigSteeringLib TrigT1Result xAODEventInfo xAODTrigger )
 
 # Install files from the package:
-atlas_install_python_modules( python/__init__.py python/TrigDecisionMakerConfig.py )
-atlas_install_joboptions( share/jobOfragment*.py )
-
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/python/TrigDecisionMakerConfig.py b/Trigger/TrigAnalysis/TrigDecisionMaker/python/TrigDecisionMakerConfig.py
index c9d17ab5b71de9d5218cf4f0fc22475d8b3e5ae5..01d9306ddfc87e31242a7164a40cfd1dca0daad9 100644
--- a/Trigger/TrigAnalysis/TrigDecisionMaker/python/TrigDecisionMakerConfig.py
+++ b/Trigger/TrigAnalysis/TrigDecisionMaker/python/TrigDecisionMakerConfig.py
@@ -1,8 +1,7 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from TrigDecisionMaker.TrigDecisionMakerConf import TrigDec__TrigDecisionMaker
 from TrigDecisionMaker.TrigDecisionMakerConf import TrigDec__TrigDecisionMakerMT
-#from TrigDecisionMaker.TrigDecisionMakerConf import TrigDec__TrigDecisionTest
 
 from AthenaCommon.AppMgr import ToolSvc
 
@@ -11,25 +10,12 @@ class TrigDecisionMaker( TrigDec__TrigDecisionMaker ):
     def __init__(self, name = "TrigDecMaker"):
         super( TrigDecisionMaker, self ).__init__( name )
 
-        from AthenaCommon.Logging import logging  # loads logger
-        log = logging.getLogger( name )
 
-    def setDefaults(self, handle):
-        pass
-        #from AthenaCommon.Constants import DEBUG
-        #handle.OutputLevel = DEBUG
-        #return
-        
 class TrigDecisionMakerMT( TrigDec__TrigDecisionMakerMT ):
     __slots__ = []
     def __init__(self, name = "TrigDecMakerMT"):
         super( TrigDecisionMakerMT, self ).__init__( name )
 
-        from AthenaCommon.Logging import logging  # loads logger
-        log = logging.getLogger( name )
-
-    def setDefaults(self, handle):
-        pass
 
 # Following not yet ported to the AthenaMT / Run 3 alg
 
@@ -37,7 +23,7 @@ class TrigDecisionStream ( object) :
     def __init__ ( self, streamName = "Stream1", fileName = "HLT.root",
                    catalog = "xmlcatalog_file:Catalog1.xml",
                    store = None) :
-        import AthenaPoolCnvSvc.WriteAthenaPool
+        import AthenaPoolCnvSvc.WriteAthenaPool  # noqa: F401
         from AthenaCommon.AppMgr import ServiceMgr as svcMgr
         svcMgr.PoolSvc.WriteCatalog = catalog
 
@@ -49,7 +35,7 @@ class TrigDecisionStream ( object) :
 
         self.stream.OutputFile = fileName
 
-        if store != None :
+        if store is not None :
             self.stream.Store = store
         else :
             from StoreGate.StoreGateConf import StoreGateSvc
@@ -69,7 +55,7 @@ class TrigConditionStream ( object) :
                    catalog = "xmlcatalog_file:Catalog1.xml",
                    store = None ) :
 
-        import AthenaPoolCnvSvc.WriteAthenaPool
+        import AthenaPoolCnvSvc.WriteAthenaPool  # noqa: F401
         from AthenaCommon.AppMgr import ServiceMgr as svcMgr
         from PoolSvc.PoolSvcConf import PoolSvc
         svcMgr += PoolSvc()
@@ -83,7 +69,7 @@ class TrigConditionStream ( object) :
 
         self.stream.OutputFile = fileName
 
-        if store != None :
+        if store is not None :
             self.stream.Store = store
         else :
             from StoreGate.StoreGateConf import StoreGateSvc
@@ -112,7 +98,6 @@ class WriteTrigDecisionToFile ( object ) :
 
         from StoreGate.StoreGateConf import StoreGateSvc
         sgStore = StoreGateSvc("StoreGateSvc")
-        dtStore = StoreGateSvc("DetectorStore")
 
         self.TrigDecStream  = TrigDecisionStream ("Stream1", fileName, catalog, sgStore)
 
@@ -174,15 +159,15 @@ class WriteTrigDecision ( object ) :
 
         TopAlg += self.TrigDecMaker
 
-        if AODItemList != None : self.addItemsToList(AODItemList)
-        if ESDItemList != None : self.addItemsToList(ESDItemList)
+        if AODItemList is not None : self.addItemsToList(AODItemList)
+        if ESDItemList is not None : self.addItemsToList(ESDItemList)
 
         from AthenaCommon.Logging import logging  # loads logger
         log = logging.getLogger( 'WriteTrigDecisionToAOD' )
 
         log.info('TrigDecision writing enabled')
         
-        makexAOD = WritexAODTrigDecision()
+        WritexAODTrigDecision()
 
 
     def addItemsToList(self, itemList) :
@@ -197,9 +182,7 @@ class ReadTrigDecisionFromFile ( object ) :
                    catalog = "xmlcatalog_file:Catalog1.xml" ) :
 
         from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-        from AthenaCommon.Constants import TRUE
-
-        import AthenaPoolCnvSvc.ReadAthenaPool
+        import AthenaPoolCnvSvc.ReadAthenaPool  # noqa: F401
 
         svcMgr.EventSelector.InputCollections = [ fileName ]
         svcMgr.PoolSvc.ReadCatalog = [ catalog ]
diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/share/Lvl1Results.txt b/Trigger/TrigAnalysis/TrigDecisionMaker/share/Lvl1Results.txt
deleted file mode 100644
index 26bb56945938257ba801bbfcf76c8c9cdf4bcf81..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigDecisionMaker/share/Lvl1Results.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-EM15i,EM25i;  EM15i,EM25i;  MU6,MU20; MU6; MU6; J50
-MU01
-EM15i,EM25i;  EM15i,EM25i;  MU6,MU20; MU6,MU20; J50,J65,J90,J200
-MU01
-EM15i,EM25i;  EM15i,EM25i;  EM15i,EM25i;  EM15i,EM25i;
-MU6; MU6;  MU6; MU6;
-MU01
-TAU25; XE30, XE60; J50,J65,J90,J200
-J50,J65,J90; J50,J65,J90,J200; J50,J65,J90
-MU6
-MU01
diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/share/jobOfragment_CBNTAA_TriggerDecision.py b/Trigger/TrigAnalysis/TrigDecisionMaker/share/jobOfragment_CBNTAA_TriggerDecision.py
deleted file mode 100644
index 4b45c968c3e7fa72c2b4aec6772ff82d0176df23..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigDecisionMaker/share/jobOfragment_CBNTAA_TriggerDecision.py
+++ /dev/null
@@ -1,23 +0,0 @@
-theApp.Dlls += [ "TrigDecisionMaker" ]
-if CBNTAthenaAware:
-    CBNT_AthenaAware = Algorithm( "CBNT_AthenaAware" )
-    CBNT_AthenaAware.Members+=[ "CBNTAA_TriggerDecision/CBNT_TriggerDecision" ]
-    CBNT_TriggerDecision = Algorithm( "CBNT_TriggerDecision" )
-
-    # flags to include for L1/L2/EF signatures in TriggerDecision or not
-    CBNT_TriggerDecision.doL1 = True
-    CBNT_TriggerDecision.doL2 = True
-    CBNT_TriggerDecision.doEF = True
-    
-    # SG keys for config data
-    CBNT_TriggerDecision.TrigConfigL2Key = "storeL2Location"
-    CBNT_TriggerDecision.TrigConfigEFKey = "storeEFLocation"
-    
-    # base SG key for trigger decision object
-    CBNT_TriggerDecision.TrigDecisionKey = "MyTriggerDecision"
-    
-#else:
-#    CBNT_Athena = Algorithm( "CBNT_Athena" )
-#    CBNT_Athena.Members += [ "CBNT_TrigT2Tau" ]
-
-
diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/share/jobOfragment_TrigDecisionMaker.py b/Trigger/TrigAnalysis/TrigDecisionMaker/share/jobOfragment_TrigDecisionMaker.py
deleted file mode 100644
index a0c23982f98241295b94bf8ea04a5534b59c9fb9..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigDecisionMaker/share/jobOfragment_TrigDecisionMaker.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#--------------------------------------------------------------
-# TrigDecisionMaker Algorithm
-#--------------------------------------------------------------
-
-# the package's DLL 
-theApp.Dlls += [ "TrigDecisionMaker" ]
-
-# the Algorithm
-theApp.TopAlg += ["TrigDec::TrigDecisionMaker"]
-theApp.TopAlg += ["TrigDec::TrigAODConfigMaker"]
-
-TrigDecisionMaker = Algorithm( "TrigDec::TrigDecisionMaker" )
-
-# flags to include for L1/L2/EF signatures in TriggerDecision or not
-TrigDecisionMaker.doL1 = True
-TrigDecisionMaker.doL2 = True
-TrigDecisionMaker.doEF = True
-TrigDecisionMaker.doHLT = True
-
-# SG keys for config data
-TrigDecisionMaker.l2ResultKey = "HLTResult_L2"
-TrigDecisionMaker.efResultKey = "HLTResult_EF"
-TrigDecisionMaker.efResultKey = "HLTResult_HLT"
-
-# SG keys for output trigger decision object and signatures to ignore
-TrigDecisionMaker.TrigDecisionKey = "TrigDecision"
-
-# debug level
-TrigDecisionMaker.OutputLevel = VERBOSE
-
-TrigAODConfigMaker = Algorithm( "TrigDec::TrigAODConfigMaker" )
-
-# SG keys for config data
-TrigAODConfigMaker.HLTConfigDataKey = "AODConfig"
-TrigAODConfigMaker.Lvl1ConfigDataKey = "AODConfig"
-TrigAODConfigMaker.Lvl1PrescaleConfigDataKey = "AODConfig"
-
-# debug level
-TrigAODConfigMaker.OutputLevel = VERBOSE
diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/share/jobOfragment_TriggerDecisionMaker.py b/Trigger/TrigAnalysis/TrigDecisionMaker/share/jobOfragment_TriggerDecisionMaker.py
deleted file mode 100644
index 848546da701433a79a97cf8933cf59454b3973dd..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigDecisionMaker/share/jobOfragment_TriggerDecisionMaker.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#--------------------------------------------------------------
-# TrigDecisionMaker Algorithm
-#--------------------------------------------------------------
-
-# the package's DLL 
-theApp.Dlls += [ "TrigDecisionMaker" ]
-
-# the Algorithm
-theApp.TopAlg += ["TriggerDecisionMaker"]
-TriggerDecisionMaker = Algorithm( "TriggerDecisionMaker" )
-
-# flags to include for L1/L2/EF signatures in TriggerDecision or not
-TriggerDecisionMaker.doL1 = True
-TriggerDecisionMaker.doL2 = True
-TriggerDecisionMaker.doEF = True
-
-# SG keys for config data
-TriggerDecisionMaker.TrigConfigL2Key = "storeL2Location"
-TriggerDecisionMaker.TrigConfigEFKey = "storeEFLocation"
-
-# SG keys for output trigger decision object and signatures to ignore
-TriggerDecisionMaker.TrigDecisionKey = "MyTriggerDecision"
-TriggerDecisionMaker.IgnoreItemNames = [ "EM01",
-                                         "L2_e10","EF_e10","L2_e10L2_e10",
-                                         "L2_e10TRTxK","EF_e10TRTxK",
-                                         "L2_g10","EF_g10",
-                                         "L2_tauNoCut","EF_tauNoCut",
-                                         "L2_jet20", "EF_jet20",
-                                         "L2_jet20a", "L2_jet20b", "L2_jet20c",
-                                         "L2_jet20d", "L2_jet20kt",
-                                         "EF_jet20aEt", "EF_jet20bEt",
-                                         "EF_jet20cEt", "EF_jet20dEt" ]
-
-
-# debug level
-TriggerDecisionMaker.OutputLevel = 3
diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/share/pureNewSteering_menu.py b/Trigger/TrigAnalysis/TrigDecisionMaker/share/pureNewSteering_menu.py
deleted file mode 100644
index 439d9dc8dcfd175c9c28535c19308ddb3fc2ae3d..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigDecisionMaker/share/pureNewSteering_menu.py
+++ /dev/null
@@ -1,402 +0,0 @@
-from TriggerMenuPython.TriggerPythonConfig import *
-
-menu = TriggerPythonConfig('pureNewSteering_menu.xml', 'l1.xml' )
-
-
-
-# L1 necessary
-menu.addItem('EM15i', prescale='1', ctpid='2')
-menu.addEMThreshold('EM15i', value='15', emiso='10', hadiso='11' )
-
-item = LVL1MenuItem('2EM15i', prescale='1', ctpid='2')
-item.addAndedCondition(name='EM15i', multi='2')
-menu.addLVL1Item(item)
-
-menu.addItem('EM25i',  prescale='50', ctpid='3', priority='HIGH')
-menu.addEMThreshold('EM25i', value='20', emiso='10', etamin='-20', etamax='20' )
-
-menu.addItem('MU06', prescale='0', ctpid='122')
-menu.addMuonThreshold('MU06', value='6')
-
-item = LVL1MenuItem('2MU06', prescale='1', ctpid='2')
-item.addAndedCondition(name='MU06', multi='2')
-menu.addLVL1Item(item)
-
-
-menu.addItem('MU20', prescale='0', ctpid='123')
-menu.addMuonThreshold('MU20', value='21')
-
-menu.addItem('J200', prescale='0', ctpid='56')
-menu.addJetThreshold('J200', value='200')
-
-menu.addItem('J90', prescale='20', ctpid='56')
-menu.addJetThreshold('J90', value='90')
-
-item = LVL1MenuItem('3J90', prescale='1', ctpid='2')
-item.addAndedCondition(name='MU06', multi='3')
-menu.addLVL1Item(item)
-
-
-menu.addItem('J65', prescale='30', ctpid='56')
-menu.addJetThreshold('J65', value='60')
-
-menu.addItem('J50', prescale='0', ctpid='56')
-menu.addJetThreshold('J50', value='40')
-
-menu.addItem('TAU25', prescale='0', ctpid='23')
-menu.addTauThreshold('TAU25', value='20')
-
-item = LVL1MenuItem('TAU25+XE30', prescale='1', ctpid='2')
-item.addAndedCondition(name='TAU25', multi='1')
-item.addAndedCondition(name='XE30', multi='1')
-menu.addLVL1Item(item)
-
-item = LVL1MenuItem('J50+XE60', prescale='1', ctpid='2')
-item.addAndedCondition(name='J50', multi='1')
-item.addAndedCondition(name='XE60', multi='1')
-menu.addLVL1Item(item)
-
-menu.addItem('XE30', prescale='0', ctpid='23')
-menu.addEtMissThreshold('XE30', value='20')
-
-menu.addItem('XE60', prescale='0', ctpid='23')
-menu.addEtMissThreshold('XE60', value='50')
-
-
-from TrigSteeringTest.TrigSteeringTestConf import PESA__dummyAlgo, PESA__newDummyAlgo2To1, PESA__newDummyAlgoAllTEs
-
-# L2
-# examples below show all the posibilities of configuring Sequences
-Egamma = PESA__dummyAlgo('Egamma_L2')                                     # create configurable instance
-Egamma2 = PESA__dummyAlgo('Egamma2_L2')                                   # create configurable another instance
-
-menu.addSequence("EM15i" , [ Egamma, Egamma2, "PESA::dummyAlgo/EgammaAdv3" ] , "em15i" )  # use bot here, mixing with old fassioned way
-menu.addSequence("em15i" , PESA__dummyAlgo("EgammaAdv_L2"), "em15i'" )    # create configurable on the fly
-
-defalgo = PESA__dummyAlgo('Em25')                                               # no arg given ...default name
-menu.addSequence("EM25i" , defalgo, "em25i" )
-menu.addSequence("em25i" ,"PESA::dummyAlgo/EgammaAdv/g10" ,"em25i'" )     # ols stryle again; with parameter
-
-Muon = PESA__dummyAlgo('Muon')
-Muon2 = PESA__dummyAlgo('Muon2')
-menu.addSequence("MU20" , [Muon, Muon2 ] ,"mu20" )
-menu.addSequence("mu20" ,"PESA::dummyAlgo/MuonAdv" ,"mu20'" )       # both are equivalent
-
-menu.addSequence("MU06" ,Muon ,"mu6" )
-menu.addSequence("mu6" , PESA__dummyAlgo('MuonAdv'),"mu6'" )        # see above, both are equivalent
-
-menu.addSequence("J200" ,"PESA::dummyAlgo/Jet_L2" ,"j200" )
-menu.addSequence("j200" ,"PESA::dummyAlgo/JetAdv_L2" ,"j200'" )
-
-menu.addSequence("J90" ,"PESA::dummyAlgo/Jet_L2" ,"j90" )
-menu.addSequence("j90" ,"PESA::dummyAlgo/JetAdv_L2" ,"j90'" )
-
-menu.addSequence("J65" ,"PESA::dummyAlgo/Jet_L2" ,"j65" )
-menu.addSequence("j65" ,"PESA::dummyAlgo/JetAdv_L2" ,"j65'" )
-
-menu.addSequence("J50" ,"PESA::dummyAlgo/Jet_L2" ,"j50" )
-menu.addSequence("j50" ,"PESA::dummyAlgo/JetAdv_L2" ,"j50'" )
-
-menu.addSequence("TAU25" ,"PESA::dummyAlgo/Tau_L2" ,"tau25" )
-menu.addSequence("tau25" ,"PESA::dummyAlgo/TauAdv_L2" ,"tau25'" )
-
-menu.addSequence("XE30" ,"PESA::dummyAlgo/MissingEt_L2" ,"xE30" )
-menu.addSequence("xE30" ,"PESA::dummyAlgo/MissingEt_L2" ,"xE30'" )
-
-menu.addSequence("XE60" ,"PESA::dummyAlgo/MissingEt_L2" ,"xE60" )
-menu.addSequence("xE60" ,"PESA::dummyAlgo/MissingEt_L2" ,"xE60'" )
-
-ZFinder_L2 = PESA__newDummyAlgo2To1('ZFinder_L2')           # the same for other algo types
-menu.addSequence(["em25i", "em25i"] ,ZFinder_L2 ,"Z" )
-
-HiggsFinder_L2 = PESA__newDummyAlgo2To1('HtoZZ')
-menu.addSequence(["Z", "Z"] ,HiggsFinder_L2 ,"Higgs" )
-
-MissETRefiner_L2 = PESA__newDummyAlgoAllTEs("MissETRefiner_L2")
-menu.addSequence(["MU20", "EM25i"] ,MissETRefiner_L2 ,"MET_L2" )
-
-
-# EF
-menu.addSequence("em15i'" ,"PESA::dummyAlgo/gamma_EF" ,"g15" )
-menu.addSequence("g15" ,"PESA::dummyAlgo/gammaAdv_EF" ,"g15'" )
-
-menu.addSequence("em15i'" ,"PESA::dummyAlgo/electron_EF" ,"e15i" )
-menu.addSequence("e15i" ,"PESA::dummyAlgo/electronAdv_EF" ,"e15i'" )
-
-menu.addSequence("em25i'" ,"PESA::dummyAlgo/gamma_EF" ,"g25" )
-menu.addSequence("g25" ,"PESA::dummyAlgo/gammaAdv_EF" ,"g25'" )
-
-menu.addSequence("em25i'" ,"PESA::dummyAlgo/electron_EF" ,"e25i" )
-menu.addSequence("e25i" ,"PESA::dummyAlgo/electronAdv_EF" ,"e25i'" )
-
-menu.addSequence("mu20'" ,"PESA::dummyAlgo/MuonMoore_EF" ,"muon20" )
-menu.addSequence("muon20" , PESA__dummyAlgo("xuxMuon_EF"), "muon20'" )
-
-menu.addSequence("mu6'" ,"PESA::dummyAlgo/MuonMoore_EF" ,"muon6" )
-menu.addSequence("muon6" , PESA__dummyAlgo('MuonAdvEF1'),"muon6'" )
-
-menu.addSequence("j200'" ,"PESA::dummyAlgo/JetKt" ,"jet200" )
-menu.addSequence("jet200" ,"PESA::dummyAlgo/JetAdvKt" ,"jet200'" )
-
-menu.addSequence("j90'" ,"PESA::dummyAlgo/JetKt" ,"jet90" )
-menu.addSequence("jet90" ,"PESA::dummyAlgo/JetAdvKt" ,"jet90'" )
-
-menu.addSequence("j65'" ,"PESA::dummyAlgo/JetKt" ,"jet65" )
-menu.addSequence("jet65" ,"PESA::dummyAlgo/JetAdvKt" ,"jet65'" )
-
-menu.addSequence("j50'" ,"PESA::dummyAlgo/JetKt" ,"jet50" )
-menu.addSequence("jet50" ,"PESA::dummyAlgo/JetAdvKt" ,"jet50'" )
-
-menu.addSequence("tau25'" ,"PESA::dummyAlgo/TauClu" ,"Tau25" )
-menu.addSequence("Tau25" ,"PESA::dummyAlgo/TauAdvEF" ,"Tau25'" )
-
-menu.addSequence("xE30'" ,"PESA::dummyAlgo/MissingEt" ,"missingE30" )
-menu.addSequence("missingE30" ,"PESA::dummyAlgo/MissingEt" ,"missingE30'" )
-
-menu.addSequence("xE60'" ,"PESA::dummyAlgo/MissingEt" ,"missingE60" )
-menu.addSequence("missingE60" ,"PESA::dummyAlgo/MissingEt" ,"missingE60'" )
-
-
-
-menu.addSequence(["e25i", "e25i"] ,"PESA::newDummyAlgo2To1/ZFinder_EF" ,"Z'" )
-
-menu.addSequence(["Z'", "Z'"] ,"PESA::newDummyAlgo2To1/HtoZZ_EF" ,"Higgs'" )
-
-
-
-# chains
-
-# L2
-chain = HLTChain( chain_name="em25i_L2", chain_counter="1", lower_chain_name="EM25i", level="L2", prescale="1", pass_through="0")
-chain.addHLTSignature( "em25i" ).addHLTSignature( "em25i'" )
-chain.addTriggerTypeBit('4')
-chain.addStreamTag('electrons', prescale='1')
-menu.addHLTChain(chain)
-
-
-chain = HLTChain( chain_name="mu20_L2", chain_counter="2", lower_chain_name="MU20", level="L2", prescale="1", pass_through="0")
-chain.addHLTSignature( "mu20" )
-chain.addHLTSignature( "mu20'" )
-chain.addTriggerTypeBit('10')
-chain.addStreamTag('muons', prescale='1')
-menu.addHLTChain(chain)
-
-
-chain = HLTChain( chain_name="2em15i_L2", chain_counter="3", lower_chain_name="2EM15i", level="L2", prescale="1", pass_through="0")
-chain.addHLTSignature( [ "em15i", "em15i" ] )
-chain.addHLTSignature( [ "em15i'", "em15i'"] )
-chain.addTriggerTypeBit('3')
-chain.addStreamTag('electrons', prescale='1')
-menu.addHLTChain(chain)
-
-
-chain = HLTChain( chain_name="2mu6_L2", chain_counter="4", lower_chain_name="2MU06", level="L2", prescale="1", pass_through="0")
-chain.addHLTSignature( "mu6" )
-chain.addHLTSignature( "mu6'" )
-chain.addTriggerTypeBit('9')
-chain.addStreamTag('muons', prescale='1')
-menu.addHLTChain(chain)
-
-
-
-
-
-chain = HLTChain( chain_name="j200_L2", chain_counter="5", lower_chain_name="J200", level="L2", prescale="1", pass_through="0")
-chain.addHLTSignature( "j200" )
-chain.addHLTSignature( "j200'" )
-chain.addTriggerTypeBit('24')
-chain.addStreamTag('jet', prescale='1')
-menu.addHLTChain(chain)
-
-
-chain = HLTChain( chain_name="3j90_L2", chain_counter="6", lower_chain_name="3J90", level="L2", prescale="1", pass_through="0")
-chain.addHLTSignature( ["j90", "j90", "j90"] )
-chain.addHLTSignature( [ "j90'", "j90'", "j90'" ] )
-chain.addTriggerTypeBit('28')
-chain.addStreamTag('jet', prescale='1')
-menu.addHLTChain(chain)
-
-
-
-
-
-chain = HLTChain( chain_name="tau25_xE30_L2", chain_counter="7", lower_chain_name="TAU25+XE30", level="L2", prescale="1", pass_through="0")
-chain.addHLTSignature( [ "tau25", "xE30" ] )
-chain.addHLTSignature( [ "tau25'", "xE30'" ] )
-chain.addTriggerTypeBit('48')
-chain.addStreamTag('tau', prescale='1')
-menu.addHLTChain(chain)
-
-
-
-
-
-chain = HLTChain( chain_name="j50_xE60_L2", chain_counter="8", lower_chain_name="J50+XE60", level="L2", prescale="1", pass_through="0")
-chain.addHLTSignature( [ "j50", "xE60" ] )
-chain.addHLTSignature( [ "j50'", "xE60'" ] )
-chain.addTriggerTypeBit('31')
-chain.addStreamTag('missingET', prescale='1')
-menu.addHLTChain(chain)
-
-
-
-
-
-chain = HLTChain( chain_name="Z_L2", chain_counter="9", lower_chain_name="EM25i", level="L2", prescale="1", pass_through="0")
-chain.addHLTSignature( ["em25i", "em25i" ])
-chain.addHLTSignature( ["em25i'", "em25i'" ])
-chain.addHLTSignature( "Z" )
-chain.addStreamTag('electrons', prescale='1')
-chain.addStreamTag('zee', type='calibration', prescale='1')
-chain.addTriggerTypeBit('4')
-menu.addHLTChain(chain)
-
-
-
-
-chain = HLTChain( chain_name="H_L2", chain_counter="10", lower_chain_name="EM25i", level="L2", prescale="1", pass_through="0")
-chain.addHLTSignature( [ "em25i", "em25i", "em25i", "em25i"] )
-chain.addHLTSignature( [ "em25i'", "em25i'", "em25i'", "em25i'" ] )
-chain.addHLTSignature( [ "Z", "Z" ] )
-chain.addHLTSignature( "Higgs" )
-chain.addStreamTag('higgs', prescale='1')
-chain.addStreamTag('higgs', type='express', prescale='100')
-chain.addTriggerTypeBit('4')
-chain.addTriggerTypeBit('67')
-menu.addHLTChain(chain)
-
-
-
-
-
-chain = HLTChain( chain_name="empty_L2", chain_counter="11", lower_chain_name="", level="L2", prescale="1", pass_through="0")
-
-
-
-
-chain = HLTChain( chain_name="MissingET_L2", chain_counter="12", lower_chain_name="", level="L2", prescale="1", pass_through="0")
-chain.addHLTSignature( "MET_L2", sigcounter=2 )
-chain.addTriggerTypeBit('36')
-chain.addStreamTag('missingET', prescale='1')
-#menu.addHLTChain(chain)
-
-
-
-
-# EF
-chain = HLTChain( chain_name="e25i_EF", chain_counter="1", lower_chain_name="em25i_L2", level="EF", prescale="1", pass_through="0")
-chain.addHLTSignature( "e25i" )
-chain.addHLTSignature( "e25i'" )
-chain.addTriggerTypeBit('4')
-chain.addStreamTag('electrons', prescale='1')
-menu.addHLTChain(chain)
-
-
-
-
-chain = HLTChain( chain_name="mu20_EF", chain_counter="2", lower_chain_name="mu20_L2", level="EF", prescale="1", pass_through="0")
-chain.addHLTSignature( "muon20" )
-chain.addHLTSignature( "muon20'" )
-chain.addTriggerTypeBit('12')
-chain.addStreamTag('muons', prescale='1')
-menu.addHLTChain(chain)
-
-
-
-
-
-chain = HLTChain( chain_name="2e15i_EF", chain_counter="3", lower_chain_name="2em15i_L2", level="EF", prescale="1", pass_through="0")
-chain.addHLTSignature( [ "e15i", "e15i" ] )
-chain.addHLTSignature( [ "e15i'","e15i'" ] )
-chain.addTriggerTypeBit('5')
-chain.addStreamTag('electrons', prescale='1')
-menu.addHLTChain(chain)
-
-
-
-chain = HLTChain( chain_name="2mu6_EF", chain_counter="4", lower_chain_name="2mu6_L2", level="EF", prescale="1", pass_through="0")
-chain.addHLTSignature( [ "muon6", "muon6" ] )
-chain.addHLTSignature( [ "muon6'", "muon6'" ] )
-chain.addTriggerTypeBit('11')
-chain.addStreamTag('emuons', prescale='1')
-menu.addHLTChain(chain)
-
-
-
-
-
-chain = HLTChain( chain_name="g25_EF", chain_counter="5", lower_chain_name="em25i_L2", level="EF", prescale="1", pass_through="0")
-chain.addHLTSignature( "g25" ).addHLTSignature( "g25'" )
-chain.addTriggerTypeBit('5')
-chain.addStreamTag('electrons', prescale='1')
-menu.addHLTChain(chain)
-
-
-chain = HLTChain(chain_name="j200_EF", chain_counter="6", lower_chain_name="j200_L2", level="EF", prescale="1", pass_through="0")
-chain.addHLTSignature( "jet200" )
-chain.addHLTSignature( "jet200'" )
-chain.addTriggerTypeBit('45')
-chain.addStreamTag('jetss', prescale='1')
-menu.addHLTChain(chain)
-
-
-
-
-chain = HLTChain( chain_name="3j90_EF", chain_counter="7", lower_chain_name="3j90_L2", level="EF", prescale="1", pass_through="0")
-chain.addHLTSignature( [ "jet90", "jet90", "jet90" ] )
-chain.addHLTSignature( [ "jet90'", "jet90'", "jet90'" ] )
-chain.addTriggerTypeBit('46')
-chain.addStreamTag('jetss', prescale='1')
-menu.addHLTChain(chain)
-
-
-
-
-
-chain = HLTChain( chain_name="tau25_xE30_EF", chain_counter="8", lower_chain_name="tau25_xE30_L2", level="EF", prescale="1", pass_through="0")
-chain.addHLTSignature( [ "Tau25", "missingE30" ] )
-chain.addHLTSignature( [ "Tau25'", "missingE30'" ] )
-chain.addTriggerTypeBit('36')
-chain.addStreamTag('Bphys', prescale='1')
-menu.addHLTChain(chain)
-
-
-
-chain = HLTChain( chain_name="j50_xE60_EF", chain_counter="9", lower_chain_name="j50_xE60_L2", level="EF", prescale="1", pass_through="0")
-chain.addHLTSignature( [ "jet50", "missingE60" ] )
-chain.addHLTSignature( [ "jet50'", "missingE60'" ] )
-chain.addTriggerTypeBit('37')
-chain.addStreamTag('Bphys', prescale='1')
-#menu.addHLTChain(chain)
-
-
-
-
-
-
-chain = HLTChain( chain_name="Z_EF", chain_counter="10", lower_chain_name="Z_L2", level="EF", prescale="1", pass_through="0")
-chain.addHLTSignature( [ "e25i","e25i" ] )
-chain.addHLTSignature( [ "e25i'", "e25i'" ] )
-chain.addHLTSignature( "Z'" )
-chain.addStreamTag('higgs', prescale='1')
-chain.addStreamTag('zee', type='calibration', prescale='1')
-chain.addStreamTag('higgs', type='express', prescale='200')
-chain.addTriggerTypeBit('4')
-chain.addTriggerTypeBit('67')
-menu.addHLTChain(chain)
-
-
-
-chain = HLTChain( chain_name="H_EF", chain_counter="11", lower_chain_name="H_L2", level="EF", prescale="1", pass_through="0")
-chain.addHLTSignature(  [ "e25i", "e25i", "e25i", "e25i" ] )
-chain.addHLTSignature( [ "e25i'", "e25i'", "e25i'", "e25i'" ] )
-chain.addHLTSignature( [ "Z'", "Z'" ] )
-chain.addHLTSignature( "Higgs'" )
-chain.addStreamTag('higgs', prescale='1')
-chain.addStreamTag('higgs', type='express', prescale='1')
-chain.addTriggerTypeBit('4')
-chain.addTriggerTypeBit('67')
-menu.addHLTChain(chain)
-
-menu.writeConfigFiles();
-menu.dot(algs=True)
diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/share/trigDec_ReadPOOL_AODConfigSvc.py b/Trigger/TrigAnalysis/TrigDecisionMaker/share/trigDec_ReadPOOL_AODConfigSvc.py
deleted file mode 100644
index 1995803e1f7574808606938b334e1f1ae3c62944..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigDecisionMaker/share/trigDec_ReadPOOL_AODConfigSvc.py
+++ /dev/null
@@ -1,57 +0,0 @@
-MessageSvc.Format = "% F%52W%S%7W%R%T %0W%M"
-
-from AthenaCommon.AlgSequence import AlgSequence
-TopAlg = AlgSequence()
-
-########################
-# TrigDecTest
-########################
-
-
-from TrigConfigSvc.TrigConfigSvcConfig import TrigConfigSvc
-log.info("setting up TrigConfigSvc:")
-svc = TrigConfigSvc()
-
-try:
-    svc.SetState( 'aod' )
-except:
-    log.warning( 'failed to set state of TrigConfigSvc ...')
-try:
-    svc.InitialiseSvc()
-except:
-    log.warning( 'failed to activate TrigConfigSvc ...')
-
-
-from TrigDecisionMaker.TrigDecisionMakerConfig import TrigDecisionTest
-
-TrigDecTest = TrigDecisionTest()
-TrigDecTest.OutputLevel = DEBUG
-TrigDecTest.TrigDecisionTool.OutputLevel = VERBOSE
-# NOTE: the following line is to test what happens when not getting the SG obj
-# TrigDecTest.TrigDecisionTool.TrigDecisionKey = "NotWorking"
-
-TopAlg += TrigDecTest
-
-########################
-# Load POOL support
-########################
-
-from TrigDecisionMaker.TrigDecisionMakerConfig import ReadTrigDecisionFromFile
-ReadTrigDecisionFromFile("TrigDec.root", "xmlcatalog_file:Catalog1.xml")
-
-############################
-# Set output level threshold
-############################
-
-svcMgr.MessageSvc.OutputLevel = INFO
-svcMgr.MessageSvc.defaultLimit = 100000
-
-EventSelector.OutputLevel = DEBUG
-
-
-### print the job ###
-#####################
-log.info("print job:")
-print TopAlg
-
-print ServiceMgr
diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/share/trigDec_ReadPOOL_XMLConfigSvc.py b/Trigger/TrigAnalysis/TrigDecisionMaker/share/trigDec_ReadPOOL_XMLConfigSvc.py
deleted file mode 100644
index 87ba78b219dec7ae432cebcee9251a6026e6275f..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigDecisionMaker/share/trigDec_ReadPOOL_XMLConfigSvc.py
+++ /dev/null
@@ -1,60 +0,0 @@
-MessageSvc.Format = "% F%52W%S%7W%R%T %0W%M"
-
-from AthenaCommon.AlgSequence import AlgSequence
-TopAlg = AlgSequence()
-
-########################
-# TrigDecTest
-########################
-
-# set xml file names:
-from TrigConfigSvc.TrigConfigSvcConfig import TrigConfigSvc
-log.info("setting up TrigConfigSvc:")
-svc = TrigConfigSvc()
-svc.hltXmlFile = 'pureSteering_menu.xml'
-svc.l1XmlFile  = 'l1.xml'
-
-try:
-    svc.SetState( 'xml' )
-except:
-    log.warning( 'failed to set state of TrigConfigSvc ...')
-try:
-    svc.InitialiseSvc()
-except:
-    log.warning( 'failed to activate TrigConfigSvc ...')
-
-
-
-from TrigDecisionMaker.TrigDecisionMakerConfig import TrigDecisionTest
-TrigDecTest = TrigDecisionTest()
-TrigDecTest.OutputLevel = DEBUG
-TrigDecTest.TrigDecisionTool.OutputLevel = VERBOSE
-# NOTE: the following line is to test what happens when not getting the SG obj
-# TrigDecTest.TrigDecisionTool.TrigDecisionKey = "NotWorking"
-
-TopAlg += TrigDecTest
-
-########################
-# Load POOL support
-########################
-
-from TrigDecisionMaker.TrigDecisionMakerConfig import ReadTrigDecisionFromFile
-ReadTrigDecisionFromFile("TrigDec.root", "xmlcatalog_file:Catalog1.xml")
-#ReadTrigDecisionFromFile("/data/data3/atlas/datafiles/verkerke/AOD.015005._00011.pool.root", "xmlcatalog_file:Catalog1.xml")
-
-############################
-# Set output level threshold
-############################
-
-svcMgr.MessageSvc.OutputLevel = INFO
-svcMgr.MessageSvc.defaultLimit = 100000
-
-EventSelector.OutputLevel = DEBUG
-
-
-### print the job ###
-#####################
-log.info("print job:")
-print TopAlg
-
-print ServiceMgr
diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/share/trigDec_pureSteeringL2_WritePOOL.py b/Trigger/TrigAnalysis/TrigDecisionMaker/share/trigDec_pureSteeringL2_WritePOOL.py
deleted file mode 100644
index 664c23efbd9f993a4f2741cc9a2497c14380153c..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigDecisionMaker/share/trigDec_pureSteeringL2_WritePOOL.py
+++ /dev/null
@@ -1,80 +0,0 @@
-########################
-# Framework
-########################
-
-import AthenaCommon.AtlasUnixGeneratorJob
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-
-from AthenaCommon.AppMgr import theApp
-theApp.EvtMax = 10
-
-########################
-# Generate config XML files
-########################
-
-include("pureNewSteering_menu.py")
-
-########################
-# L2 Steering:
-########################
-
-from TrigSteering.TestingTrigSteeringConfig import TestingTrigSteer_L2
-log.info("setting up TestingTrigSteer_L2 configurable:")
-hltSteer_L2 = TestingTrigSteer_L2('hltSteer_L2', hltFile='pureNewSteering_menu.xml', lvl1File='')
-
-topSequence += hltSteer_L2
-hltSteer_L2.Navigation.ClassesToPayload += [ 'TrigRoiDescriptor' ]
-
-########################
-# EF Steering:
-########################
-
-from TrigSteering.TestingTrigSteeringConfig import TestingTrigSteer_EF
-log.info("setting up TestingTrigSteer_EF configurable:")
-hltSteer_EF = TestingTrigSteer_EF('hltSteer_EF')
-
-topSequence += hltSteer_EF
-hltSteer_EF.Navigation.ClassesToPayload += [ 'TrigRoiDescriptor' ]
-
-########################
-# TrigDecision Makers
-########################
-
-theApp.Dlls += [ "TrigDecisionMaker" ]
-theApp.TopAlg += [ "TrigDec::TrigDecisionMaker/TrigDecMaker" ]
-theApp.TopAlg += [ "TrigDec::TrigAODConfigDataMaker/TrigAODCfgMaker" ]
-
-########################
-# POOL
-########################
-
-import AthenaPoolCnvSvc.WriteAthenaPool
-
-## get a handle on the ServiceManager
-from AthenaCommon.AppMgr import ServiceMgr as svcMgr
-
-#Explicitly specify the output file catalog
-from PoolSvc.PoolSvcConf import PoolSvc
-svcMgr += PoolSvc()
-svcMgr.PoolSvc.WriteCatalog = "xmlcatalog_file:Catalog1.xml"
-
-from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
-
-Stream1 = AthenaPoolOutputStream( "Stream1" )
-Stream1.OutputFile = "HLT.root"; # ** mandatory parameter ** // The output file name
-Stream1.ItemList += [ "TrigDec::TrigDecision#TrigDecision" ]
-Stream1.ItemList += [ "TrigConf::HLTAODConfigData#AODConfig" ]
-Stream1.ItemList += [ "TrigConf::Lvl1AODConfigData#AODConfig" ]
-Stream1.ItemList += [ "TrigConf::Lvl1AODPrescaleConfigData#AODConfig" ]
-
-theApp.Dlls += [ "TrigEventAthenaPoolPoolCnv" ]
-
-#--------------------------------------------------------------
-# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL)
-#--------------------------------------------------------------
-svcMgr.MessageSvc.OutputLevel = 3
-svcMgr.PoolSvc.OutputLevel = 2 
-svcMgr.AthenaPoolCnvSvc.OutputLevel = 2
-Stream1.OutputLevel = 2
diff --git a/Trigger/TrigAnalysis/TrigDecisionMaker/share/trigDec_pureSteering_WritePOOL.py b/Trigger/TrigAnalysis/TrigDecisionMaker/share/trigDec_pureSteering_WritePOOL.py
deleted file mode 100644
index c2e09eff8e7c5e5970d46619f7bf7fac0b594485..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigDecisionMaker/share/trigDec_pureSteering_WritePOOL.py
+++ /dev/null
@@ -1,112 +0,0 @@
-MessageSvc.Format = "% F%52W%S%7W%R%T %0W%M"
-
-########################
-# Framework
-########################
-
-import AthenaCommon.AtlasUnixGeneratorJob
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-
-from AthenaCommon.AppMgr import theApp
-theApp.EvtMax = 10
-
-########################
-# Generate config XML files
-########################
-
-include("TrigSteering/pureSteering_menu.py")
-
-
-###    Setup  TrigConfigSvc      ###
-####################################
-from TrigConfigSvc.TrigConfigSvcConfig import SetupTrigConfigSvc
-log.info("setting up TrigConfigSvc:")
-svc = SetupTrigConfigSvc()
-svc.hltXmlFile = 'pureSteering_menu.xml'
-svc.l1XmlFile  = 'l1.xml'
-
-try:
-    svc.SetStates( 'xml' )
-except:
-    log.warning( 'failed to set state of TrigConfigSvc ...')
-try:
-    svc.InitialiseSvc()
-except:
-    log.warning( 'failed to activate TrigConfigSvc ...')
-
-ServiceMgr.TrigConfigSvc.OutputLevel=VERBOSE
-ServiceMgr.HLTConfigSvc.OutputLevel=VERBOSE
-ServiceMgr.LVL1ConfigSvc.OutputLevel=VERBOSE
-
-
-
-########################
-# L2 Steering:
-########################
-
-from TrigSteering.TestingTrigSteeringConfig import TestingTrigSteer_L2
-log.info("setting up TestingTrigSteer_L2 configurable:")
-hltSteer_L2 = TestingTrigSteer_L2('hltSteer_L2')
-
-
-## Switch off all monitoring !!!
-hltSteer_L2.pruneSteeringMonTools([])
-
-topSequence += hltSteer_L2
-hltSteer_L2.Navigation.ClassesToPayload += [ 'TrigRoiDescriptor' ]
-
-########################
-# EF Steering:
-########################
-
-from TrigSteering.TestingTrigSteeringConfig import TestingTrigSteer_EF
-log.info("setting up TestingTrigSteer_EF configurable:")
-hltSteer_EF = TestingTrigSteer_EF('hltSteer_EF')
-
-## Switch off all monitoring !!!
-hltSteer_EF.pruneSteeringMonTools([])
-
-topSequence += hltSteer_EF
-hltSteer_EF.Navigation.ClassesToPayload += [ 'TrigRoiDescriptor' ]
-
-########################
-# POOL
-########################
-
-from TrigDecisionMaker.TrigDecisionMakerConfig import WriteTrigDecisionToFile
-#WriteTrigDecisionToFile("TrigDec.root", "Conditions.root")
-trigDecStream = WriteTrigDecisionToFile("TrigDec.root")
-trigDecStream.TrigDecMaker.OutputLevel = VERBOSE
-
-
-
-########################
-# Serialization
-########################
-# Set up service
-include( "FourMom/FourMomDict_joboptions.py" )
-include( "Navigation/NavigationDict_joboptions.py" )
-include( "EventKernel/EventKernelDict_joboptions.py" )
-include( "TrigCaloEvent/TrigCaloEventDict_joboptions.py" )
-include( "TrigParticle/TrigParticleDict_joboptions.py" )
-include ("TrigSteeringEvent/TrigSteeringEventDict_joboptions.py")
-
-
-############################
-# Set output level threshold
-############################
-
-svcMgr.MessageSvc.OutputLevel = INFO
-svcMgr.PoolSvc.OutputLevel = DEBUG
-svcMgr.AthenaPoolCnvSvc.OutputLevel = DEBUG
-
-
-### print the job ###
-#####################
-log.info("print job:")
-print topSequence
-
-
-topSequence.hltSteer_L2.OutputLevel=VERBOSE
diff --git a/Trigger/TrigConfiguration/TrigConfBase/share/trigconf_msg_athena_test.ref b/Trigger/TrigConfiguration/TrigConfBase/share/trigconf_msg_athena_test.ref
index 3fee3247a19a14271a024c917032e73516fe95a9..d16c15847b1be726bcc9a3e268e8a5c848eebb77 100644
--- a/Trigger/TrigConfiguration/TrigConfBase/share/trigconf_msg_athena_test.ref
+++ b/Trigger/TrigConfiguration/TrigConfBase/share/trigconf_msg_athena_test.ref
@@ -1,10 +1,29 @@
+Sat Jun 27 05:03:36 CEST 2020
+Preloading tcmalloc_minimal.so
+Py:Athena            INFO including file "AthenaCommon/Preparation.py"
+Py:Athena            INFO using release [WorkDir-22.0.16] [x86_64-centos7-gcc8-opt] [atlas-work3/0446faaa9579] -- built on [2020-06-26T2302]
+Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
+Py:Athena            INFO including file "AthenaCommon/Execution.py"
+Py:Athena            INFO including file "TrigConfBase/test_TrigConfMsgAlg.py"
+Py:Athena            INFO including file "AthenaCommon/runbatch.py"
+Py:ConfigurableDb    INFO Read module info for 5552 configurables from 78 genConfDb files
+Py:ConfigurableDb    INFO No duplicates have been found: that's good !
+ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
+ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
+ApplicationMgr    SUCCESS 
+====================================================================================================================================
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v33r1)
+                                          running on lxplus755.cern.ch on Sat Jun 27 05:03:49 2020
+====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
+ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
+ClassIDSvc           INFO  getRegistryEntries: read 7027 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
-HistogramPersis...WARNING Histograms saving not required.
+AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr       INFO Application Manager Started successfully
 AthenaEventLoopMgr   INFO   ===>>>  start of run 1    <<<===
@@ -17,13 +36,10 @@ TrigConfMsgAlg       INFO Next message is printed via TrigConfMessaging:
 TrigConfMsgAlg       INFO An INFO message
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 2 events processed so far  <<<===
 ApplicationMgr       INFO Application Manager Stopped successfully
+IncidentProcAlg1     INFO Finalize
+IncidentProcAlg2     INFO Finalize
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
-*****Chrono*****     INFO ****************************************************************************************************
-*****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
-*****Chrono*****     INFO ****************************************************************************************************
-*****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
 ApplicationMgr       INFO Application Manager Terminated successfully
 Py:Athena            INFO leaving with code 0: "successful run"
diff --git a/Trigger/TrigConfiguration/TrigConfData/CMakeLists.txt b/Trigger/TrigConfiguration/TrigConfData/CMakeLists.txt
index c4c691f0611cbcb91d0596175c6e122a26d686d4..03bfa94ae99dcd291fffc95c338c08a47c03289b 100644
--- a/Trigger/TrigConfiguration/TrigConfData/CMakeLists.txt
+++ b/Trigger/TrigConfiguration/TrigConfData/CMakeLists.txt
@@ -21,7 +21,7 @@ atlas_add_library ( TrigConfDataSA
                     TrigConfData/*.h src/*.cxx
                     PUBLIC_HEADERS TrigConfData
                     INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                    LINK_LIBRARIES ${Boost_LIBRARIES} CxxUtils
+                    LINK_LIBRARIES ${Boost_LIBRARIES}
                     DEFINITIONS -DTRIGCONF_STANDALONE
                     )
 
diff --git a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/Logic.h b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/Logic.h
index 1fb2ed6b5427b56e41920973c51987928e46a646..1085fae1f6670fad3886e20de9c4aa4705acf4cb 100644
--- a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/Logic.h
+++ b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/Logic.h
@@ -5,8 +5,6 @@
 #ifndef TRIGCONFDATA_LOGIC_H
 #define TRIGCONFDATA_LOGIC_H
 
-#include "CxxUtils/checker_macros.h"
-
 #include <string>
 #include <vector>
 #include <map>
diff --git a/Trigger/TrigCost/RatesAnalysis/python/RatesTrigger.py b/Trigger/TrigCost/RatesAnalysis/python/RatesTrigger.py
index ddca3a1a28a5bbce5de90fe9dfbfd0207a09b01c..398c95d003ae083bfd5437c432ed219a5c675fbf 100644
--- a/Trigger/TrigCost/RatesAnalysis/python/RatesTrigger.py
+++ b/Trigger/TrigCost/RatesAnalysis/python/RatesTrigger.py
@@ -56,7 +56,7 @@ class RatesTrigger:
     self.rateErr = self.passWeightedErr / self.rateDenominator
 
     # Trigger's efficiency is the fraction of active events which are passed. Error propagated.
-    self.efficiency    = self.passWeighted / self.activeWeighted
+    self.efficiency    = self.passWeighted / self.activeWeighted if self.activeWeighted > 0.0 else 0.0
     self.efficiencyErr = 0
     if self.passWeighted != 0 and self.activeWeighted != 0:
       fracErr = math.sqrt( math.pow(self.passWeightedErr/self.passWeighted,2) + math.pow(self.activeWeightedErr/self.activeWeighted,2) )
diff --git a/Trigger/TrigCost/RatesAnalysis/share/RatesAnalysisFullMenu.py b/Trigger/TrigCost/RatesAnalysis/share/RatesAnalysisFullMenu.py
index 0789b7313a1aed41cd893ec6ea61ab62b201111e..5cf3e0808795f055707e4cd79983fa055ba21aac 100755
--- a/Trigger/TrigCost/RatesAnalysis/share/RatesAnalysisFullMenu.py
+++ b/Trigger/TrigCost/RatesAnalysis/share/RatesAnalysisFullMenu.py
@@ -43,6 +43,7 @@ if __name__=='__main__':
 
   # Set the Athena configuration flags
   ConfigFlags.Input.Files = ["root://eosatlas.cern.ch//eos/atlas/atlasdatadisk/rucio/data16_13TeV/8d/de/AOD.10654269._000566.pool.root.1"]
+
   ConfigFlags.fillFromArgs(args.flags)
   from PyUtils import AthFile
   af = AthFile.fopen(ConfigFlags.Input.Files[0]) 
@@ -62,8 +63,7 @@ if __name__=='__main__':
   cfg = MainServicesCfg(ConfigFlags)
   cfg.merge(PoolReadCfg(ConfigFlags))
 
-  from GaudiSvc.GaudiSvcConf import THistSvc
-  histSvc = THistSvc()
+  histSvc = CompFactory.THistSvc()
   histSvc.Output += ["RATESTREAM DATAFILE='" + args.outputHist + "' OPT='RECREATE'"]
   cfg.addService(histSvc)
 
@@ -78,7 +78,6 @@ if __name__=='__main__':
   tdt = CompFactory.Trig.TrigDecisionTool('TrigDecisionTool')
   tdt.TrigConfigSvc = cfgsvc
   tdt.NavigationFormat = "TrigComposite"
-  tdt.Navigation.Dlls = [e for e in  EDMLibraries if 'TPCnv' not in e]
   cfg.addPublicTool(tdt)
 
   # If the dataset name is in the input files path, then it will be fetched from there
@@ -95,8 +94,7 @@ if __name__=='__main__':
     xsec = amiTool.getCrossSection()
     fEff = amiTool.getFilterEfficiency()
 
-  from EnhancedBiasWeighter.EnhancedBiasWeighterConf import EnhancedBiasWeighter
-  ebw = EnhancedBiasWeighter('EnhancedBiasRatesTool')
+  ebw = CompFactory.EnhancedBiasWeighter('EnhancedBiasRatesTool')
   ebw.RunNumber = runNumber
   ebw.UseBunchCrossingTool = useBunchCrossingTool
   ebw.IsMC = isMC
@@ -107,8 +105,7 @@ if __name__=='__main__':
   ebw.MCIgnoreGeneratorWeights = args.MCIgnoreGeneratorWeights
   cfg.addPublicTool(ebw)
 
-  from RatesAnalysis.RatesAnalysisConf import FullMenu
-  rates = FullMenu()
+  rates = CompFactory.FullMenu()
   rates.PrescaleXML = args.inputPrescalesXML
   rates.DoTriggerGroups = args.disableTriggerGroups
   rates.DoGlobalGroups = args.disableGlobalGroups
@@ -126,14 +123,12 @@ if __name__=='__main__':
 
   # Setup for accessing bunchgroup data from the DB
   if useBunchCrossingTool:
-    from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool
     if isMC:
-      cfg.addPublicTool(BunchCrossingTool("MC"))
+      cfg.addPublicTool(CompFactory.BunchCrossingTool("MC"))
     else:
-      cfg.addPublicTool(BunchCrossingTool("LHC"))
+      cfg.addPublicTool(CompFactory.BunchCrossingTool("LHC"))
 
-  from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr
-  eventLoop = AthenaEventLoopMgr()
+  eventLoop = CompFactory.AthenaEventLoopMgr()
   eventLoop.EventPrintoutInterval = 1000
   cfg.addService(eventLoop)
 
diff --git a/Trigger/TrigEvent/TrigBSExtraction/CMakeLists.txt b/Trigger/TrigEvent/TrigBSExtraction/CMakeLists.txt
index 10c01220bf6ae397ebdb3e6b7ea12e57980f9fcb..9ff61e1eeb169030a2dde3e8b018bb6ed51a3c06 100644
--- a/Trigger/TrigEvent/TrigBSExtraction/CMakeLists.txt
+++ b/Trigger/TrigEvent/TrigBSExtraction/CMakeLists.txt
@@ -1,64 +1,13 @@
-cmake_minimum_required( VERSION 3.2 )
-################################################################################
-# Package: TrigBSExtraction
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigBSExtraction )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          Control/StoreGate
-                          Event/xAOD/xAODJetCnv
-                          Event/xAOD/xAODTrackingCnv
-                          Event/xAOD/xAODTrigBphysCnv
-                          Event/xAOD/xAODTrigCaloCnv
-			  Event/xAOD/xAODBTaggingCnv
-                          Event/xAOD/xAODTrigMinBiasCnv
-                          Event/xAOD/xAODTrigMissingETCnv
-                          Event/xAOD/xAODTrigMuonCnv
-			  Event/xAOD/xAODTauCnv
-			  Event/xAOD/xAODEgammaCnv
-			  Event/xAOD/xAODTriggerCnv
-			  Event/xAOD/xAODCaloEventCnv
-                          GaudiKernel
-                          Trigger/TrigDataAccess/TrigSerializeCnvSvc
-                          Trigger/TrigEvent/TrigNavigation
-                          Trigger/TrigEvent/TrigSteeringEvent
-                          PRIVATE
-                          Event/xAOD/xAODJet
-                          Event/xAOD/xAODMuon
-                          Event/xAOD/xAODTracking
-                          Event/xAOD/xAODTrigBphys
-                          Event/xAOD/xAODTrigCalo
-                          Event/xAOD/xAODTrigMinBias
-                          Event/xAOD/xAODTrigMissingET
-                          Event/xAOD/xAODTrigMuon
-			  Event/xAOD/xAODTau
-			  Event/xAOD/xAODEgamma
-			  Event/xAOD/xAODCaloEvent
-			  Event/xAOD/xAODTrigger
-			  Event/xAOD/xAODBTagging
-                          Reconstruction/Jet/JetEvent
-                          Reconstruction/Particle
-			  Reconstruction/tauEvent
-			  Reconstruction/egamma/egammaEvent
-                          Tracking/TrkEvent/TrkTrack
-                          Trigger/TrigEvent/TrigCaloEvent
-                          Trigger/TrigEvent/TrigInDetEvent
-                          Trigger/TrigEvent/TrigMissingEtEvent
-                          Trigger/TrigEvent/TrigMuonEvent
-                          Trigger/TrigEvent/TrigParticle
-                          Trigger/TrigEvent/TrigStorageDefinitions )
-
 # Component(s) in the package:
 atlas_add_component( TrigBSExtraction
                      src/*.cxx
                      src/components/*.cxx
-                     LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests GaudiKernel TrigSerializeCnvSvcLib TrigNavigationLib TrigSteeringEvent xAODJet xAODMuon xAODTracking xAODTrigBphys xAODTrigCalo xAODTrigMinBias xAODTrigMissingET xAODTrigMuon xAODTau xAODEgamma xAODCaloEvent xAODTrigger xAODBTagging JetEvent Particle tauEvent egammaEvent CaloEvent TrkTrack TrigCaloEvent TrigInDetEvent TrigMissingEtEvent TrigMuonEvent TrigParticle TrigStorageDefinitions xAODTauCnvLib xAODTrigMuonCnvLib xAODJetCnvLib xAODTrigCaloCnvLib xAODBTaggingCnvLib xAODTrigBphysCnvLib xAODTrigMissingETCnvLib xAODTrigMinBiasCnvLib xAODEgammaCnvLib xAODCaloEventCnvLib xAODTriggerCnvLib )
+                     LINK_LIBRARIES AthenaBaseComps CaloEvent GaudiKernel JetEvent Particle StoreGateLib TrigCaloEvent TrigInDetEvent TrigMissingEtEvent TrigMuonEvent TrigNavigationLib TrigParticle TrigSerializeCnvSvcLib TrigSteeringEvent TrigStorageDefinitions TrkTrack egammaEvent tauEvent xAODBTagging xAODBTaggingCnvLib xAODCaloEvent xAODCaloEventCnvLib xAODEgamma xAODEgammaCnvLib xAODJet xAODJetCnvLib xAODMuon xAODTau xAODTauCnvLib xAODTracking xAODTrackingCnvLib xAODTrigBphys xAODTrigBphysCnvLib xAODTrigCalo xAODTrigCaloCnvLib xAODTrigMinBias xAODTrigMinBiasCnvLib xAODTrigMissingET xAODTrigMissingETCnvLib xAODTrigMuon xAODTrigMuonCnvLib xAODTrigger xAODTriggerCnvLib )
 
 # Install files from the package:
-atlas_install_headers( TrigBSExtraction )
 atlas_install_joboptions( share/*.py )
-
diff --git a/Trigger/TrigEvent/TrigDecisionEvent/CMakeLists.txt b/Trigger/TrigEvent/TrigDecisionEvent/CMakeLists.txt
index 298134a1ca5cf75f1cba8818e74d481f82d5c405..e45de145910bc354d02f460622cf6bfc7147816f 100644
--- a/Trigger/TrigEvent/TrigDecisionEvent/CMakeLists.txt
+++ b/Trigger/TrigEvent/TrigDecisionEvent/CMakeLists.txt
@@ -1,33 +1,17 @@
-################################################################################
-# Package: TrigDecisionEvent
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigDecisionEvent )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          Control/AthLinks
-                          Trigger/TrigEvent/TrigSteeringEvent
-                          PRIVATE
-                          AtlasTest/TestTools )
-
-# External dependencies:
-find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
-
 # Component(s) in the package:
 atlas_add_library( TrigDecisionEvent
                    src/*.cxx
                    PUBLIC_HEADERS TrigDecisionEvent
-                   PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES AthLinks AthenaKernel TrigSteeringEvent
-                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} TestTools )
+                   LINK_LIBRARIES AthLinks AthenaKernel TrigSteeringEvent )
 
 atlas_add_dictionary( TrigDecisionEventDict
                       TrigDecisionEvent/TrigDecisionEventDict.h
                       TrigDecisionEvent/selection.xml
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks AthenaKernel TrigSteeringEvent TestTools TrigDecisionEvent
+                      LINK_LIBRARIES TrigDecisionEvent
                       DATA_LINKS HLT::HLTResult )
 
diff --git a/Trigger/TrigEvent/TrigDecisionEventTPCnv/CMakeLists.txt b/Trigger/TrigEvent/TrigDecisionEventTPCnv/CMakeLists.txt
index 65a72e8e111aed23b1eff26cdf7eedf3b501aa51..0a9874d4f9f44ff6bfae057b1f1c90e8cce29c3c 100644
--- a/Trigger/TrigEvent/TrigDecisionEventTPCnv/CMakeLists.txt
+++ b/Trigger/TrigEvent/TrigDecisionEventTPCnv/CMakeLists.txt
@@ -1,72 +1,46 @@
-################################################################################
-# Package: TrigDecisionEventTPCnv
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigDecisionEventTPCnv )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/DataModelAthenaPool
-                          Database/AthenaPOOL/AthenaPoolCnvSvc
-                          Trigger/TrigEvent/TrigSteeringEventTPCnv
-                          PRIVATE
-                          AtlasTest/TestTools
-                          Control/AthenaKernel
-                          Control/SGTools
-                          GaudiKernel
-                          Trigger/TrigEvent/TrigDecisionEvent
-                          Trigger/TrigEvent/TrigSteeringEvent )
-
-# External dependencies:
-find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
-
 # Component(s) in the package:
 atlas_add_tpcnv_library( TrigDecisionEventTPCnv
                          src/*.cxx
                          PUBLIC_HEADERS TrigDecisionEventTPCnv
-                         PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                         LINK_LIBRARIES ${ROOT_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib TrigSteeringEventTPCnv TestTools AthenaKernel SGTools GaudiKernel TrigDecisionEvent TrigSteeringEvent )
+                         LINK_LIBRARIES AthenaPoolCnvSvcLib DataModelAthenaPoolLib TrigDecisionEvent TrigSteeringEventTPCnv
+                         PRIVATE_LINK_LIBRARIES AthenaKernel )
 
 atlas_add_dictionary( TrigDecisionEventTPCnvDict
                       TrigDecisionEventTPCnv/TrigDecisionEventTPCnvDict.h
                       TrigDecisionEventTPCnv/selection.xml
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib TrigSteeringEventTPCnv TestTools AthenaKernel SGTools GaudiKernel TrigDecisionEvent TrigSteeringEvent TrigDecisionEventTPCnv )
+                      LINK_LIBRARIES TrigDecisionEventTPCnv )
 
 atlas_add_dictionary( OLD_TrigDecisionEventTPCnvDict
                       TrigDecisionEventTPCnv/TrigDecisionEventTPCnvDict.h
                       TrigDecisionEventTPCnv/OLD_selection.xml
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib TrigSteeringEventTPCnv TestTools AthenaKernel SGTools GaudiKernel TrigDecisionEvent TrigSteeringEvent TrigDecisionEventTPCnv )
+                      LINK_LIBRARIES TrigDecisionEventTPCnv )
 
 atlas_add_test( TrigDecisionCnv_p1_test
                 SOURCES
                 test/TrigDecisionCnv_p1_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib TrigSteeringEventTPCnv TestTools AthenaKernel SGTools GaudiKernel TrigDecisionEvent TrigSteeringEvent TrigDecisionEventTPCnv )
+                LINK_LIBRARIES TrigDecisionEventTPCnv )
 
 atlas_add_test( TrigDecisionCnv_p2_test
                 SOURCES
                 test/TrigDecisionCnv_p2_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib TrigSteeringEventTPCnv TestTools AthenaKernel SGTools GaudiKernel TrigDecisionEvent TrigSteeringEvent TrigDecisionEventTPCnv )
+                LINK_LIBRARIES TrigDecisionEventTPCnv )
 
 atlas_add_test( TrigDecisionCnv_p3_test
                 SOURCES
                 test/TrigDecisionCnv_p3_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib TrigSteeringEventTPCnv TestTools AthenaKernel SGTools GaudiKernel TrigDecisionEvent TrigSteeringEvent TrigDecisionEventTPCnv )
+                LINK_LIBRARIES TrigDecisionEventTPCnv )
 
 atlas_add_test( TrigDecisionCnv_p4_test
                 SOURCES
                 test/TrigDecisionCnv_p4_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib TrigSteeringEventTPCnv TestTools AthenaKernel SGTools GaudiKernel TrigDecisionEvent TrigSteeringEvent TrigDecisionEventTPCnv )
+                LINK_LIBRARIES TrigDecisionEventTPCnv )
 
 atlas_add_test( TrigDecisionCnv_p5_test
                 SOURCES
                 test/TrigDecisionCnv_p5_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib TrigSteeringEventTPCnv TestTools AthenaKernel SGTools GaudiKernel TrigDecisionEvent TrigSteeringEvent TrigDecisionEventTPCnv )
-
+                LINK_LIBRARIES TrigDecisionEventTPCnv )
diff --git a/Trigger/TrigEvent/TrigNavStructure/CMakeLists.txt b/Trigger/TrigEvent/TrigNavStructure/CMakeLists.txt
index 2219f6bee9c37dd24d22f7218ba9f6d81439f897..3ae61fe8dd4bba0cf54a0ebb689a02ba388497aa 100644
--- a/Trigger/TrigEvent/TrigNavStructure/CMakeLists.txt
+++ b/Trigger/TrigEvent/TrigNavStructure/CMakeLists.txt
@@ -1,26 +1,23 @@
-################################################################################
-# Package: TrigNavStructure
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigNavStructure )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PUBLIC
-   Control/AthContainers
-   Control/AthToolSupport/AsgTools
-   Control/CxxUtils )
-
 # External dependencies:
 find_package( Boost COMPONENTS regex )
 
+# Extra dependencies, based on the build environment:
+set( extra_libs )
+if( NOT XAOD_STANDALONE )
+   set( extra_libs StoreGateLib )
+endif()
+
 # The library of the package:
 atlas_add_library( TrigNavStructure
    TrigNavStructure/*.h Root/*.cxx
    PUBLIC_HEADERS TrigNavStructure
    INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-   LINK_LIBRARIES ${Boost_LIBRARIES} AthContainers AsgTools )
+   LINK_LIBRARIES ${Boost_LIBRARIES} AsgTools AthContainers CxxUtils xAODCore ${extra_libs} )
 
 # Test(s) in the package:
 foreach( test_name ut_iterators_test ut_build_trignav_test ut_features_test
diff --git a/Trigger/TrigEvent/TrigNavTools/CMakeLists.txt b/Trigger/TrigEvent/TrigNavTools/CMakeLists.txt
index bd2856ddb4c483a245915cad3d49b07f84d7362e..b5caeda5c6571d0f64c1d1c9a330358209462111 100644
--- a/Trigger/TrigEvent/TrigNavTools/CMakeLists.txt
+++ b/Trigger/TrigEvent/TrigNavTools/CMakeLists.txt
@@ -1,39 +1,18 @@
-################################################################################
-# Package: TrigNavTools
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigNavTools )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Trigger/TrigAnalysis/TrigDecisionTool
-                          Trigger/TrigEvent/TrigNavigation
-                          PRIVATE
-                          Control/StoreGate
-                          Event/xAOD/xAODTrigger
-                          GaudiKernel
-                          PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces
-                          Trigger/TrigConfiguration/TrigConfHLTData
-                          Trigger/TrigEvent/TrigSteeringEvent )
-
-# External dependencies:
-find_package( Boost COMPONENTS filesystem thread system )
-
 # Component(s) in the package:
 atlas_add_library( TrigNavToolsLib
                    src/*.cxx
                    PUBLIC_HEADERS TrigNavTools
-                   PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                   LINK_LIBRARIES AthenaBaseComps AthenaKernel TrigDecisionToolLib TrigNavigationLib StoreGateLib SGtests
-                   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} xAODTrigger GaudiKernel TrigConfHLTData TrigSteeringEvent DerivationFrameworkInterfaces )
+                   PRIVATE_LINK_LIBRARIES AthenaBaseComps AthenaKernel TrigConfHLTData TrigSteeringEvent xAODTrigger
+                   LINK_LIBRARIES GaudiKernel TrigDecisionToolLib TrigNavigationLib )
 
 atlas_add_component( TrigNavTools
                      src/components/*.cxx
-                     INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps AthenaKernel TrigDecisionToolLib TrigNavigationLib StoreGateLib SGtests xAODTrigger GaudiKernel TrigConfHLTData TrigSteeringEvent TrigNavToolsLib DerivationFrameworkInterfaces )
+                     LINK_LIBRARIES TrigNavToolsLib )
 
 # Install files from the package:
 atlas_install_python_modules( python/__init__.py python/TrigNavToolsConfig.py )
diff --git a/Trigger/TrigEvent/TrigNavTools/doc/packagedoc.h b/Trigger/TrigEvent/TrigNavTools/doc/packagedoc.h
deleted file mode 100644
index 037ffc7ab18810ee8b1b23eb1251476c68ad3144..0000000000000000000000000000000000000000
--- a/Trigger/TrigEvent/TrigNavTools/doc/packagedoc.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-/**
-
-@page TrigNavTools_page TrigNavTools package
-
-@section TrigNavTools_TrigNavToolsIntro Introduction
-
-*/
diff --git a/Trigger/TrigEvent/TrigNavigation/CMakeLists.txt b/Trigger/TrigEvent/TrigNavigation/CMakeLists.txt
index 92f7d6538e375a4f1ec703ae9c2182f55cf64a84..f5a1e179ffdbde7eb0f33817fd6cf96a6801aa4b 100644
--- a/Trigger/TrigEvent/TrigNavigation/CMakeLists.txt
+++ b/Trigger/TrigEvent/TrigNavigation/CMakeLists.txt
@@ -1,36 +1,8 @@
-# $Id: CMakeLists.txt 783840 2016-11-12 17:28:04Z ssnyder $
-################################################################################
-# Package: TrigNavigation
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigNavigation )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PUBLIC
-   Control/CxxUtils
-   Control/AthContainers
-   Control/AthLinks
-   Control/AthToolSupport/AsgTools
-   Control/AthenaBaseComps
-   Control/AthenaKernel
-   Control/SGTools
-   Control/StoreGate
-   GaudiKernel
-   Trigger/TrigEvent/TrigNavStructure
-   Trigger/TrigEvent/TrigStorageDefinitions
-   PRIVATE
-   AtlasTest/TestTools
-   Control/AthContainersInterfaces
-   Control/AthContainersRoot
-   Control/RootUtils
-   Control/CxxUtils
-   Event/xAOD/xAODCore
-   Trigger/TrigConfiguration/TrigConfHLTData
-   Trigger/TrigDataAccess/TrigSerializeCnvSvc
-   Trigger/TrigDataAccess/TrigSerializeResult )
-
 # External dependencies:
 find_package( Boost COMPONENTS regex )
 
diff --git a/Trigger/TrigEvent/TrigParticle/CMakeLists.txt b/Trigger/TrigEvent/TrigParticle/CMakeLists.txt
index df272cdaa97507304082058e1041f470e3f134f2..24cef4adaf93385c3f754462bbc85609986d448d 100644
--- a/Trigger/TrigEvent/TrigParticle/CMakeLists.txt
+++ b/Trigger/TrigEvent/TrigParticle/CMakeLists.txt
@@ -1,64 +1,30 @@
-################################################################################
-# Package: TrigParticle
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigParticle )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthenaKernel
-                          Control/AthContainers
-                          Control/AthLinks
-                          Control/Navigation
-                          Event/EventKernel
-                          Event/FourMom
-                          Reconstruction/Particle
-                          Tracking/TrkEvent/VxVertex
-                          Trigger/TrigEvent/TrigCaloEvent
-                          Trigger/TrigEvent/TrigInDetEvent
-                          PRIVATE
-                          Calorimeter/CaloGeoHelpers
-                          Event/xAOD/xAODBTagging
-                          Event/xAOD/xAODEgamma
-                          Event/xAOD/xAODJet
-                          Event/xAOD/xAODTau
-                          Event/xAOD/xAODTrigEgamma
-                          Reconstruction/Jet/JetEvent
-                          Reconstruction/egamma/egammaEvent
-                          Reconstruction/tauEvent
-                          Trigger/TrigDataAccess/TrigSerializeCnvSvc
-                          Trigger/TrigEvent/TrigNavigation )
-
-# External dependencies:
-find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
-
 # Component(s) in the package:
 atlas_add_library( TrigParticle
                    src/*.cxx
                    PUBLIC_HEADERS TrigParticle
-                   PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES AthContainers AthLinks Navigation AthenaKernel EventKernel FourMom Particle VxVertex TrigCaloEvent TrigInDetEvent TrigSerializeCnvSvcLib TrigNavigationLib
-                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} CaloGeoHelpers xAODBTagging xAODEgamma xAODJet xAODTau xAODTrigEgamma JetEvent egammaEvent tauEvent )
+                   LINK_LIBRARIES AthContainers AthLinks AthenaKernel EventKernel FourMom Navigation Particle TrigCaloEvent TrigInDetEvent TrigNavigationLib TrigSerializeCnvSvcLib VxVertex egammaEvent tauEvent
+                   PRIVATE_LINK_LIBRARIES CaloGeoHelpers JetEvent TrigNavigationLib xAODBTagging xAODEgamma xAODJet xAODTau xAODTrigEgamma )
 
 atlas_add_sercnv_library( TrigParticleSerCnv
                           FILES TrigParticle/TrigElectron.h TrigParticle/TrigElectronContainer.h TrigParticle/TrigPhoton.h TrigParticle/TrigPhotonContainer.h TrigParticle/TrigTau.h TrigParticle/TrigTauContainer.h TrigParticle/TrigL2Bjet.h TrigParticle/TrigL2BjetContainer.h TrigParticle/TrigEFBjet.h TrigParticle/TrigEFBjetContainer.h TrigParticle/TrigL2Bphys.h TrigParticle/TrigL2BphysContainer.h TrigParticle/TrigEFBphys.h TrigParticle/TrigEFBphysContainer.h egammaEvent/egammaContainer.h egammaEvent/egDetailContainer.h tauEvent/TauJetContainer.h tauEvent/TauDetailsContainer.h JetEvent/JetCollection.h JetEvent/JetMomentMap.h JetEvent/JetMomentMapCollection.h JetEvent/JetKeyDescriptor.h JetEvent/JetKeyDescriptorCollection.h
                           TYPES_WITH_NAMESPACE Analysis::TauJetContainer Analysis::TauDetailsContainer
-                          INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                          LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks Navigation AthenaKernel EventKernel FourMom Particle VxVertex TrigCaloEvent TrigInDetEvent CaloGeoHelpers xAODBTagging xAODEgamma xAODJet xAODTau xAODTrigEgamma JetEvent egammaEvent tauEvent TrigSerializeCnvSvcLib TrigNavigationLib TrigParticle )
+                          LINK_LIBRARIES TrigParticle )
 
 atlas_add_sercnv_library( TrigParticlexAODSerCnv
                           FILES xAODTau/TauJetContainer.h xAODTau/TauJetAuxContainer.h xAODTau/TauTrackContainer.h xAODTau/TauTrackAuxContainer.h xAODJet/JetContainer.h xAODJet/JetTrigAuxContainer.h xAODTrigEgamma/TrigPhotonContainer.h xAODTrigEgamma/TrigPhotonAuxContainer.h xAODTrigEgamma/TrigElectronContainer.h xAODTrigEgamma/TrigElectronAuxContainer.h xAODTrigEgamma/ElectronTrigAuxContainer.h xAODTrigEgamma/PhotonTrigAuxContainer.h xAODEgamma/ElectronContainer.h xAODEgamma/ElectronAuxContainer.h xAODEgamma/PhotonContainer.h xAODEgamma/PhotonAuxContainer.h xAODBTagging/BTaggingContainer.h xAODBTagging/BTaggingTrigAuxContainer.h xAODBTagging/BTagVertexContainer.h xAODBTagging/BTagVertexAuxContainer.h
                           TYPES_WITH_NAMESPACE xAOD::TauJetContainer xAOD::TauJetAuxContainer xAOD::TauTrackContainer xAOD::TauTrackAuxContainer xAOD::JetContainer xAOD::JetTrigAuxContainer xAOD::TrigPhotonContainer xAOD::TrigPhotonAuxContainer xAOD::TrigElectronContainer xAOD::TrigElectronAuxContainer xAOD::ElectronContainer xAOD::ElectronAuxContainer xAOD::PhotonContainer xAOD::PhotonAuxContainer xAOD::ElectronTrigAuxContainer xAOD::PhotonTrigAuxContainer xAOD::BTaggingContainer xAOD::BTaggingTrigAuxContainer xAOD::BTagVertexContainer xAOD::BTagVertexAuxContainer
                           CNV_PFX xAOD
-                          INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                          LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks Navigation AthenaKernel EventKernel FourMom Particle VxVertex TrigCaloEvent TrigInDetEvent CaloGeoHelpers xAODBTagging xAODEgamma xAODJet xAODTau xAODTrigEgamma JetEvent egammaEvent tauEvent TrigSerializeCnvSvcLib TrigNavigationLib TrigParticle )
+                          LINK_LIBRARIES TrigParticle )
 
 atlas_add_dictionary( TrigParticleDict
                       TrigParticle/TrigParticleDict.h
                       TrigParticle/selection.xml
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks Navigation AthenaKernel EventKernel FourMom Particle VxVertex TrigCaloEvent TrigInDetEvent CaloGeoHelpers xAODBTagging xAODEgamma xAODJet xAODTau xAODTrigEgamma JetEvent egammaEvent tauEvent TrigSerializeCnvSvcLib TrigNavigationLib TrigParticle
+                      LINK_LIBRARIES TrigParticle
                       DATA_LINKS TrigTau TrigPhotonContainer TrigEFBjetContainer TrigL2BjetContainer
                       ELEMENT_LINKS TrigL2BphysContainer TrigEFBphysContainer TrigElectronContainer )
 
diff --git a/Trigger/TrigEvent/TrigParticleTPCnv/CMakeLists.txt b/Trigger/TrigEvent/TrigParticleTPCnv/CMakeLists.txt
index 03a99debde048518308eb3277f1bac39fdf94ce5..45b175d330a3a5aeece3a21eabf25571036c5098 100644
--- a/Trigger/TrigEvent/TrigParticleTPCnv/CMakeLists.txt
+++ b/Trigger/TrigEvent/TrigParticleTPCnv/CMakeLists.txt
@@ -1,159 +1,47 @@
-################################################################################
-# Package: TrigParticleTPCnv
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigParticleTPCnv )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/DataModelAthenaPool
-                          Database/AthenaPOOL/AthenaPoolCnvSvc
-                          Database/AthenaPOOL/AthenaPoolUtilities
-                          Event/EventCommonTPCnv
-                          Event/FourMom
-                          Reconstruction/Particle
-                          Reconstruction/TrackParticleTPCnv
-                          Trigger/TrigEvent/TrigCaloEvent
-                          Trigger/TrigEvent/TrigCaloEventTPCnv
-                          Trigger/TrigEvent/TrigInDetEvent
-                          Trigger/TrigEvent/TrigInDetEventTPCnv
-                          Trigger/TrigEvent/TrigParticle
-                          PRIVATE
-                          AtlasTest/TestTools
-                          Control/AthenaKernel
-                          Control/SGTools
-                          GaudiKernel )
-
-# External dependencies:
-find_package( CLHEP )
-find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
-
 # Component(s) in the package:
 atlas_add_tpcnv_library( TrigParticleTPCnv
                          src/*.cxx
                          PUBLIC_HEADERS TrigParticleTPCnv
-                         PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                         PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
-                         LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel )
+                         LINK_LIBRARIES AthenaKernel AthenaPoolCnvSvcLib AthenaPoolUtilities DataModelAthenaPoolLib EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle )
 
 atlas_add_dictionary( TrigParticleTPCnvDict
                       TrigParticleTPCnv/TrigParticleTPCnvDict.h
                       TrigParticleTPCnv/selection.xml
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
+                      LINK_LIBRARIES TrigParticleTPCnv )
 
 atlas_add_dictionary( OLD_TrigParticleTPCnvDict
                       TrigParticleTPCnv/TrigParticleTPCnvDict.h
                       TrigParticleTPCnv/OLD_selection.xml
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigEFBjetCnv_p1_test
-                SOURCES
-                test/TrigEFBjetCnv_p1_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigEFBjetCnv_p2_test
-                SOURCES
-                test/TrigEFBjetCnv_p2_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigEFBphysCnv_p1_test
-                SOURCES
-                test/TrigEFBphysCnv_p1_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigEFBphysCnv_p2_test
-                SOURCES
-                test/TrigEFBphysCnv_p2_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigEFBphysCnv_p3_test
-                SOURCES
-                test/TrigEFBphysCnv_p3_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigElectronCnv_p2_test
-                SOURCES
-                test/TrigElectronCnv_p2_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigElectronCnv_p3_test
-                SOURCES
-                test/TrigElectronCnv_p3_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigL2BjetCnv_p1_test
-                SOURCES
-                test/TrigL2BjetCnv_p1_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigL2BjetCnv_p2_test
-                SOURCES
-                test/TrigL2BjetCnv_p2_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigL2BjetCnv_p3_test
-                SOURCES
-                test/TrigL2BjetCnv_p3_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigL2BphysCnv_p1_test
-                SOURCES
-                test/TrigL2BphysCnv_p1_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigL2BphysCnv_p2_test
-                SOURCES
-                test/TrigL2BphysCnv_p2_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigL2BphysCnv_p3_test
-                SOURCES
-                test/TrigL2BphysCnv_p3_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigPhotonCnv_p2_test
-                SOURCES
-                test/TrigPhotonCnv_p2_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigPhotonCnv_p3_test
-                SOURCES
-                test/TrigPhotonCnv_p3_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigTauCnv_p1_test
-                SOURCES
-                test/TrigTauCnv_p1_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigTauCnv_p2_test
-                SOURCES
-                test/TrigTauCnv_p2_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
-atlas_add_test( TrigTauCnv_p3_test
-                SOURCES
-                test/TrigTauCnv_p3_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModelAthenaPoolLib AthenaPoolCnvSvcLib AthenaPoolUtilities EventCommonTPCnv FourMom Particle TrackParticleTPCnv TrigCaloEvent TrigCaloEventTPCnv TrigInDetEvent TrigInDetEventTPCnv TrigParticle TestTools AthenaKernel SGTools GaudiKernel TrigParticleTPCnv )
-
+                      LINK_LIBRARIES TrigParticleTPCnv )
+
+# Tests:
+function( _add_test test )
+   atlas_add_test( ${test}
+                   SOURCES
+                   test/${test}.cxx
+                   LINK_LIBRARIES TrigParticleTPCnv )
+endfunction()
+
+_add_test( TrigEFBjetCnv_p1_test )
+_add_test( TrigEFBjetCnv_p2_test )
+_add_test( TrigEFBphysCnv_p1_test )
+_add_test( TrigEFBphysCnv_p2_test )
+_add_test( TrigEFBphysCnv_p3_test )
+_add_test( TrigElectronCnv_p2_test )
+_add_test( TrigElectronCnv_p3_test )
+_add_test( TrigL2BjetCnv_p1_test )
+_add_test( TrigL2BjetCnv_p2_test )
+_add_test( TrigL2BjetCnv_p3_test )
+_add_test( TrigL2BphysCnv_p1_test )
+_add_test( TrigL2BphysCnv_p2_test )
+_add_test( TrigL2BphysCnv_p3_test )
+_add_test( TrigPhotonCnv_p2_test )
+_add_test( TrigPhotonCnv_p3_test )
+_add_test( TrigTauCnv_p1_test )
+_add_test( TrigTauCnv_p2_test )
+_add_test( TrigTauCnv_p3_test )
diff --git a/Trigger/TrigEvent/TrigParticleTPCnv/test/TrigEFBjetCnv_p1_test.cxx b/Trigger/TrigEvent/TrigParticleTPCnv/test/TrigEFBjetCnv_p1_test.cxx
index 8ff55cbeefdb119dcd2bd433a8c6c6cb731ce99c..2eea51e075010fde0267248691196737d7ad922a 100644
--- a/Trigger/TrigEvent/TrigParticleTPCnv/test/TrigEFBjetCnv_p1_test.cxx
+++ b/Trigger/TrigEvent/TrigParticleTPCnv/test/TrigEFBjetCnv_p1_test.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
 */
 
 // $Id$
@@ -17,7 +17,6 @@
 #include "TestTools/FLOATassert.h"
 #include "TestTools/leakcheck.h"
 #include "GaudiKernel/MsgStream.h"
-#include "CLHEP/Vector/ThreeVector.h"
 #include <cassert>
 #include <iostream>
 
diff --git a/Trigger/TrigEvent/TrigParticleTPCnv/test/TrigEFBjetCnv_p2_test.cxx b/Trigger/TrigEvent/TrigParticleTPCnv/test/TrigEFBjetCnv_p2_test.cxx
index bd322214ca22f59ffb2aef909218776204a0c109..00e71c687cf38e6c1bac6407b277a98a012d0e39 100644
--- a/Trigger/TrigEvent/TrigParticleTPCnv/test/TrigEFBjetCnv_p2_test.cxx
+++ b/Trigger/TrigEvent/TrigParticleTPCnv/test/TrigEFBjetCnv_p2_test.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
 */
 
 // $Id$
@@ -17,7 +17,6 @@
 #include "TestTools/FLOATassert.h"
 #include "TestTools/leakcheck.h"
 #include "GaudiKernel/MsgStream.h"
-#include "CLHEP/Vector/ThreeVector.h"
 #include <cassert>
 #include <iostream>
 
diff --git a/Trigger/TrigEvent/TrigRoiConversion/CMakeLists.txt b/Trigger/TrigEvent/TrigRoiConversion/CMakeLists.txt
index 651bc637e716b426604c8a1dd38324a46bb8511d..bad330263138a3c226120997c1a530ca4fb0e757 100644
--- a/Trigger/TrigEvent/TrigRoiConversion/CMakeLists.txt
+++ b/Trigger/TrigEvent/TrigRoiConversion/CMakeLists.txt
@@ -1,26 +1,8 @@
-# $Id: CMakeLists.txt 789262 2016-12-12 13:15:37Z krasznaa $
-################################################################################
-# Package: TrigRoiConversion
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigRoiConversion )
 
-# Extra dependencies, based on the build environment:
-set( extra_deps )
-if( NOT XAOD_STANDALONE )
-   set( extra_deps Control/AthenaBaseComps GaudiKernel )
-endif()
-
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PUBLIC
-   Control/AthToolSupport/AsgTools
-   Trigger/TrigEvent/TrigSteeringEvent
-   PRIVATE
-   Event/xAOD/xAODTrigger
-   ${extra_deps} )
-
 # Component(s) in the package:
 atlas_add_library( TrigRoiConversionLib
    TrigRoiConversion/*.h Root/*.cxx
@@ -31,6 +13,5 @@ atlas_add_library( TrigRoiConversionLib
 if( NOT XAOD_STANDALONE )
    atlas_add_component( TrigRoiConversion
       src/*.h src/*.cxx src/components/*.cxx
-      LINK_LIBRARIES AthenaBaseComps GaudiKernel xAODTrigger
-      TrigRoiConversionLib )
+      LINK_LIBRARIES AthenaBaseComps TrigRoiConversionLib xAODTrigger )
 endif()
diff --git a/Trigger/TrigEvent/TrigStorageDefinitions/CMakeLists.txt b/Trigger/TrigEvent/TrigStorageDefinitions/CMakeLists.txt
index 2e711949857ca34142f6fc29caa3101cc2e54cac..80309d4e48dcd459a3ca92e4ea4cca8ea98774a2 100644
--- a/Trigger/TrigEvent/TrigStorageDefinitions/CMakeLists.txt
+++ b/Trigger/TrigEvent/TrigStorageDefinitions/CMakeLists.txt
@@ -1,65 +1,33 @@
-################################################################################
-# Package: TrigStorageDefinitions
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigStorageDefinitions )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthLinks
-                          Control/AthContainers
-                          Control/Navigation
-                          Event/xAOD/xAODBTagging
-                          Event/xAOD/xAODCaloEvent
-                          Event/xAOD/xAODEgamma
-                          Event/xAOD/xAODHIEvent
-                          Event/xAOD/xAODJet
-                          Event/xAOD/xAODMuon
-                          Event/xAOD/xAODTau
-                          Event/xAOD/xAODTracking
-                          Event/xAOD/xAODTrigBphys
-                          Event/xAOD/xAODTrigCalo
-                          Event/xAOD/xAODTrigEgamma
-                          Event/xAOD/xAODTrigL1Calo
-                          Event/xAOD/xAODTrigMinBias
-                          Event/xAOD/xAODTrigMissingET
-                          Event/xAOD/xAODTrigMuon
-                          Event/xAOD/xAODTrigRinger
-                          Event/xAOD/xAODTrigger
-                          PRIVATE
-                          AtlasTest/TestTools )
-
 # External dependencies:
-find_package( Boost COMPONENTS filesystem thread system )
+find_package( Boost )
 
 # Component(s) in the package:
 atlas_add_library( TrigStorageDefinitions
                    PUBLIC_HEADERS TrigStorageDefinitions
                    INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${Boost_LIBRARIES} AthLinks AthContainers Navigation xAODBTagging xAODCaloEvent xAODEgamma xAODHIEvent xAODJet xAODMuon xAODTau xAODTracking xAODTrigBphys xAODTrigCalo xAODTrigEgamma xAODTrigL1Calo xAODTrigMinBias xAODTrigMissingET xAODTrigMuon xAODTrigRinger xAODTrigger )
+                   LINK_LIBRARIES AthLinks AthContainers Navigation xAODBTagging xAODCaloEvent xAODEgamma xAODHIEvent xAODJet xAODMuon xAODTau xAODTracking xAODTrigBphys xAODTrigCalo xAODTrigEgamma xAODTrigL1Calo xAODTrigMinBias xAODTrigMissingET xAODTrigMuon xAODTrigRinger xAODTrigger )
 
 atlas_add_test( TypeInformation_test
                 SOURCES
                 test/TypeInformation_test.cxx
-                INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                LINK_LIBRARIES ${Boost_LIBRARIES} AthLinks AthContainers Navigation xAODBTagging xAODCaloEvent xAODEgamma xAODHIEvent xAODJet xAODMuon xAODTau xAODTracking xAODTrigBphys xAODTrigCalo xAODTrigEgamma xAODTrigL1Calo xAODTrigMinBias xAODTrigMissingET xAODTrigMuon xAODTrigRinger xAODTrigger TestTools TrigStorageDefinitions )
+                LINK_LIBRARIES TrigStorageDefinitions )
 
 atlas_add_test( ListMap_test
                 SOURCES
                 test/ListMap_test.cxx
-                INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                LINK_LIBRARIES ${Boost_LIBRARIES} AthLinks AthContainers Navigation xAODBTagging xAODCaloEvent xAODEgamma xAODHIEvent xAODJet xAODMuon xAODTau xAODTracking xAODTrigBphys xAODTrigCalo xAODTrigEgamma xAODTrigL1Calo xAODTrigMinBias xAODTrigMissingET xAODTrigMuon xAODTrigRinger xAODTrigger TestTools TrigStorageDefinitions )
+                LINK_LIBRARIES TrigStorageDefinitions )
 
 atlas_add_test( NewEDMMap_test
                 SOURCES
                 test/NewEDMMap_test.cxx
-                INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                LINK_LIBRARIES ${Boost_LIBRARIES} AthLinks AthContainers Navigation xAODBTagging xAODCaloEvent xAODEgamma xAODHIEvent xAODJet xAODMuon xAODTau xAODTracking xAODTrigBphys xAODTrigCalo xAODTrigEgamma xAODTrigL1Calo xAODTrigMinBias xAODTrigMissingET xAODTrigMuon xAODTrigRinger xAODTrigger TestTools TrigStorageDefinitions )
+                LINK_LIBRARIES TrigStorageDefinitions )
 
 atlas_add_test( Basic_test
                 SOURCES
                 test/Basic_test.cxx
-                INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                LINK_LIBRARIES ${Boost_LIBRARIES} AthLinks AthContainers Navigation xAODBTagging xAODCaloEvent xAODEgamma xAODHIEvent xAODJet xAODMuon xAODTau xAODTracking xAODTrigBphys xAODTrigCalo xAODTrigEgamma xAODTrigL1Calo xAODTrigMinBias xAODTrigMissingET xAODTrigMuon xAODTrigRinger xAODTrigger TestTools TrigStorageDefinitions )
-
+                LINK_LIBRARIES TrigStorageDefinitions )
diff --git a/Trigger/TrigEvent/TrigTopoEvent/CMakeLists.txt b/Trigger/TrigEvent/TrigTopoEvent/CMakeLists.txt
index 5070e5de010768fb5b24a6a3e94957de3d26f454..3bd770f85f9fdf3b3ea62e6994d0b215c1611693 100644
--- a/Trigger/TrigEvent/TrigTopoEvent/CMakeLists.txt
+++ b/Trigger/TrigEvent/TrigTopoEvent/CMakeLists.txt
@@ -1,47 +1,22 @@
-################################################################################
-# Package: TrigTopoEvent
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigTopoEvent )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Control/AthContainers
-                          Control/AthenaKernel
-                          GaudiKernel
-                          Reconstruction/egamma/egammaEvent
-                          Reconstruction/tauEvent
-                          Trigger/TrigEvent/TrigCaloEvent
-                          Trigger/TrigEvent/TrigInDetEvent
-                          Trigger/TrigEvent/TrigMuonEvent
-                          Trigger/TrigEvent/TrigParticle
-                          PRIVATE
-                          Event/EventPrimitives
-                          Trigger/TrigDataAccess/TrigSerializeCnvSvc
-                          Trigger/TrigEvent/TrigNavigation )
-
-# External dependencies:
-find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
-
 # Component(s) in the package:
 atlas_add_library( TrigTopoEvent
                    src/*.cxx
                    PUBLIC_HEADERS TrigTopoEvent
-                   PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES AthContainers AthenaKernel GaudiKernel egammaEvent tauEvent TrigCaloEvent TrigInDetEvent TrigMuonEvent TrigParticle TrigSerializeCnvSvcLib TrigNavigationLib
-                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} EventPrimitives )
+                   LINK_LIBRARIES AthContainers AthenaKernel GaudiKernel TrigMuonEvent TrigParticle egammaEvent tauEvent
+                   PRIVATE_LINK_LIBRARIES CxxUtils EventPrimitives TrigNavigationLib )
 
 atlas_add_sercnv_library( TrigTopoEventSerCnv
                           FILES TrigTopoEvent/ElectronMuonTopoInfo.h TrigTopoEvent/ElectronMuonTopoInfoContainer.h
-                          INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                          LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthenaKernel GaudiKernel egammaEvent tauEvent TrigCaloEvent TrigInDetEvent TrigMuonEvent TrigParticle EventPrimitives TrigSerializeCnvSvcLib TrigNavigationLib TrigTopoEvent )
+                          LINK_LIBRARIES TrigTopoEvent )
 
 atlas_add_dictionary( TrigTopoEventDict
                       TrigTopoEvent/TrigTopoEventDict.h
                       TrigTopoEvent/selection.xml
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthenaKernel GaudiKernel egammaEvent tauEvent TrigCaloEvent TrigInDetEvent TrigMuonEvent TrigParticle EventPrimitives TrigSerializeCnvSvcLib TrigNavigationLib TrigTopoEvent
+                      LINK_LIBRARIES TrigTopoEvent
                       DATA_LINKS ElectronMuonTopoInfo
                       ELEMENT_LINKS ElectronMuonTopoInfoContainer )
-
diff --git a/Trigger/TrigEvent/TrigTopoEventTPCnv/CMakeLists.txt b/Trigger/TrigEvent/TrigTopoEventTPCnv/CMakeLists.txt
index cee2945086cff936e38750e9d5b06647692b12cc..cd6b0fc948bf6d1d4e02fbd5c8f5d6f25beb4fcb 100644
--- a/Trigger/TrigEvent/TrigTopoEventTPCnv/CMakeLists.txt
+++ b/Trigger/TrigEvent/TrigTopoEventTPCnv/CMakeLists.txt
@@ -1,40 +1,21 @@
-################################################################################
-# Package: TrigTopoEventTPCnv
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TrigTopoEventTPCnv )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Database/AthenaPOOL/AthenaPoolCnvSvc
-                          Trigger/TrigEvent/TrigTopoEvent
-                          PRIVATE
-                          AtlasTest/TestTools
-                          Control/AthenaKernel
-                          GaudiKernel )
-
-# External dependencies:
-find_package( CLHEP )
-find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
-
 # Component(s) in the package:
 atlas_add_tpcnv_library( TrigTopoEventTPCnv
                          src/*.cxx
                          PUBLIC_HEADERS TrigTopoEventTPCnv
-                         PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                         PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
-                         LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolCnvSvcLib TrigTopoEvent TestTools AthenaKernel GaudiKernel )
+                         PRIVATE_LINK_LIBRARIES AthenaKernel
+                         LINK_LIBRARIES AthenaPoolCnvSvcLib TrigTopoEvent )
 
 atlas_add_dictionary( TrigTopoEventTPCnvDict
                       TrigTopoEventTPCnv/TrigTopoEventTPCnvDict.h
                       TrigTopoEventTPCnv/selection.xml
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolCnvSvcLib TrigTopoEvent TestTools AthenaKernel GaudiKernel TrigTopoEventTPCnv )
+                      LINK_LIBRARIES TrigTopoEventTPCnv )
 
 atlas_add_test( ElectronMuonTopoInfoCnv_p1_test
                 SOURCES
                 test/ElectronMuonTopoInfoCnv_p1_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolCnvSvcLib TrigTopoEvent TestTools AthenaKernel GaudiKernel TrigTopoEventTPCnv )
-
+                LINK_LIBRARIES TrigTopoEventTPCnv )
diff --git a/Trigger/TrigEvent/TrigTopoEventTPCnv/test/ElectronMuonTopoInfoCnv_p1_test.cxx b/Trigger/TrigEvent/TrigTopoEventTPCnv/test/ElectronMuonTopoInfoCnv_p1_test.cxx
index a34d9790a3a489b51abb300a10c1f73aa7f74f38..feea234943253edb0f7372a234973474ae477ab5 100644
--- a/Trigger/TrigEvent/TrigTopoEventTPCnv/test/ElectronMuonTopoInfoCnv_p1_test.cxx
+++ b/Trigger/TrigEvent/TrigTopoEventTPCnv/test/ElectronMuonTopoInfoCnv_p1_test.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
 */
 
 // $Id$
@@ -15,7 +15,6 @@
 #include "TrigTopoEventTPCnv/ElectronMuonTopoInfoCnv_p1.h"
 #include "TestTools/leakcheck.h"
 #include "GaudiKernel/MsgStream.h"
-#include "CLHEP/Vector/ThreeVector.h"
 #include <cassert>
 #include <iostream>
 
diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/TrigBjetMonitoring/HLTBjetMonTool.h b/Trigger/TrigMonitoring/TrigBjetMonitoring/TrigBjetMonitoring/HLTBjetMonTool.h
index 95e23681c80e5f5cc2b574ee325f60482ea4a6a2..323c2031ea7ab5e470a7019e762844180874b85c 100755
--- a/Trigger/TrigMonitoring/TrigBjetMonitoring/TrigBjetMonitoring/HLTBjetMonTool.h
+++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/TrigBjetMonitoring/HLTBjetMonTool.h
@@ -70,7 +70,7 @@ class HLTBjetMonTool : public IHLTMonTool {
       "The SG key of the online BJet container from the TriggerEDMRun3"};
 
   SG::ReadHandleKey<xAOD::VertexContainer> m_offlineVertexContainerKey {this,"OfflineVertexContainerName","PrimaryVertices","Key of offline primary vertexes"};
-  SG::ReadHandleKey<xAOD::VertexContainer> m_onlineVertexContainerKey {this,"OnlineVertexContainerName","HLT_EFHistoPrmVtx","Key of online bjet primary vertexes"};
+  SG::ReadHandleKey<xAOD::VertexContainer> m_onlineVertexContainerKey {this,"OnlineVertexContainerName","HLT_IDVertex_FS","Key of online bjet primary vertexes"};
   SG::ReadHandleKey<xAOD::TrackParticleContainer> m_onlineTrackContainerKey {this,"OnlineTrackContainerName","HLT_IDTrack_Bjet_IDTrig","Key of online tracks of bjets"};
 
   ToolHandle<Trig::TrigDecisionTool> m_trigDec; //!
diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx
index 69349b9b66d6cf0efe8c7fcc94a8f50cec7b3f88..05c6df13cca7ad238032cb9fa73bcab8586899d9 100755
--- a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx
+++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx
@@ -1083,7 +1083,9 @@ StatusCode HLTBjetMonTool::book(){
 	  if(HistJet) hist2("jetEtaPhi"+HistExt,"HLT/BjetMon/"+HistDir)->Fill(jet->eta(),jet->phi());
 	  // zPV associated to the jets in the same event: they are the same for every jet in the same event so only the first zPV should be plotted
 	  if (ijet == 0) {
-	    auto vertexLinkInfo = TrigCompositeUtils::findLink<xAOD::VertexContainer>(jetLinkInfo.source, "EFHistoPrmVtx"); // CV 200120
+	    std::string vtxname = m_onlineVertexContainerKey.key();
+	    if ( vtxname.find("HLT_")==0 ) vtxname.erase(0,4);
+	    auto vertexLinkInfo = TrigCompositeUtils::findLink<xAOD::VertexContainer>(jetLinkInfo.source, vtxname ); // CV 200120
 	    ATH_CHECK( vertexLinkInfo.isValid() ) ; // TM 200120
 	    const xAOD::Vertex* vtx = *(vertexLinkInfo.link);
 	    ATH_MSG_DEBUG("        PVz_jet from jet link info: " << vtx->z());
diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx
index df2cc7e08ed45b02f99e7e9aaa5f002b33a21095..503e71ac1b32747c319d37732f41e02aa974ae25 100644
--- a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx
+++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx
@@ -229,7 +229,7 @@ StatusCode TrigBjetMonitorAlgorithm::fillHistograms( const EventContext& ctx ) c
 	    }// onlinebjets
 
 	  }//bjetChain
-
+	  
 	  //bjet or mujet chains
 	  if (bjetChain || mujetChain) {
 
@@ -369,7 +369,11 @@ StatusCode TrigBjetMonitorAlgorithm::fillHistograms( const EventContext& ctx ) c
 	    fill("TrigBjetMonitor",jetEta,jetPhi);
 	    // zPV associated to the jets in the same event: they are the same for every jet in the same event so only the first zPV should be plotted
 	    if (ijet == 0) {
-	      auto vertexLinkInfo = TrigCompositeUtils::findLink<xAOD::VertexContainer>(jetLinkInfo.source, "EFHistoPrmVtx"); // CV 200120
+
+	      std::string vtxname = m_onlineVertexContainerKey.key();
+	      if ( vtxname.find("HLT_")==0 ) vtxname.erase(0,4);
+
+	      auto vertexLinkInfo = TrigCompositeUtils::findLink<xAOD::VertexContainer>(jetLinkInfo.source, vtxname ); // CV 200120
 	      ATH_CHECK( vertexLinkInfo.isValid() ) ; // TM 200120
 	      const xAOD::Vertex* vtx = *(vertexLinkInfo.link);
 	      NameH = "PVz_jet_"+trigName;
diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.h b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.h
index 07dfd01f729b88c38f5434c1c70defca9b867a49..565bae13e0d6fa10e7588a92948fe96754dbd669 100644
--- a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.h
+++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.h
@@ -31,7 +31,7 @@ class TrigBjetMonitorAlgorithm : public AthMonitorAlgorithm {
   std::vector<std::string> m_allChains;
   SG::ReadHandleKey<xAOD::MuonContainer> m_muonContainerKey;
   SG::ReadHandleKey<xAOD::VertexContainer> m_offlineVertexContainerKey {this,"OfflineVertexContainerName","PrimaryVertices","Key of offline primary vertexes"};
-  SG::ReadHandleKey<xAOD::VertexContainer> m_onlineVertexContainerKey {this,"OnlineVertexContainerName","HLT_EFHistoPrmVtx","Key of online bjet primary vertexes"};
+  SG::ReadHandleKey<xAOD::VertexContainer> m_onlineVertexContainerKey {this,"OnlineVertexContainerName","HLT_IDVertex_FS","Key of online bjet primary vertexes"};
   SG::ReadHandleKey<xAOD::TrackParticleContainer> m_onlineTrackContainerKey {this,"OnlineTrackContainerName","HLT_IDTrack_Bjet_IDTrig","Key of online tracks of bjets"};
 
   ToolHandle<Trig::TrigDecisionTool> m_trigDec; //!
diff --git a/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitCategory.py b/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitCategory.py
index ea1b4c6ee177ceef484d19c55ce504155b9161c9..315c724b7874594dafba3ac5d792bcc4cf6963d9 100644
--- a/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitCategory.py
+++ b/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitCategory.py
@@ -29,8 +29,6 @@ monitoring_jet = [ 'j25',
                    '6j60',
                    '5j60',
                    '10j40_L14J20',
-                   'j0_perf_ds1_L1J75',
-                   'j0_perf_ds1_L1J100',
                    'ht850_L1J100',
                    'j60_TT',
                    'j85_cleanLLP',
@@ -93,8 +91,6 @@ primary_jet                = ['j25',
                               '6j60',
                               '5j60',
                               '10j40_L14J20',
-                              'j0_perf_ds1_L1J75',
-                              'j0_perf_ds1_L1J100',
                               'ht850_L1J100',
                               'j60_TT',
                               'j85_cleanLLP',
@@ -157,8 +153,6 @@ monitoring_jet_pp = ['j25',
                      '6j60',
                      '5j60',
                      '10j40_L14J20',
-                     'j0_perf_ds1_L1J75',
-                     'j0_perf_ds1_L1J100',
                      'ht850_L1J100',
                      'j60_TT',
                      'j85_cleanLLP',
@@ -218,8 +212,6 @@ primary_jet_pp                = ['j25',
                                  '6j60',
                                  '5j60',
                                  '10j40_L14J20',
-                                 'j0_perf_ds1_L1J75',
-                                 'j0_perf_ds1_L1J100',
                                  'ht850_L1J100',
                                  'j60_TT',
                                  'j85_cleanLLP',
@@ -281,8 +273,6 @@ monitoring_jet_validation = ['j25',
                              '6j60',
                              '5j60',
                              '10j40_L14J20',
-                             'j0_perf_ds1_L1J75',
-                             'j0_perf_ds1_L1J100',
                              'ht850_L1J100',
                              'j60_TT',
                              'j85_cleanLLP',
@@ -346,8 +336,6 @@ primary_jet_validation        = ['j25',
                                  '6j60',
                                  '5j60',
                                  '10j40_L14J20',
-                                 'j0_perf_ds1_L1J75',
-                                 'j0_perf_ds1_L1J100',
                                  'ht850_L1J100',
                                  'j60_TT',
                                  'j85_cleanLLP',
@@ -427,8 +415,6 @@ monitoring_jet_hi = ['j25',
                      '4j45',
                      '6j60',
                      '5j60',
-                     'j0_perf_ds1_L1J75',
-                     'j0_perf_ds1_L1J100',
                      'ht850_L1J100',
                      'j30_ion_L1TE20', #start HI chains
                      'j30_L1TE20',
@@ -470,8 +456,6 @@ primary_jet_hi = ['j25',
                   '4j45',
                   '6j60',
                   '5j60',
-                  'j0_perf_ds1_L1J75',
-                  'j0_perf_ds1_L1J100',
                   'ht850_L1J100',
                   'j30_ion_L1TE20', #start HI chains
                   'j30_L1TE20',
diff --git a/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitoringConfig.py b/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitoringConfig.py
index 975dac18c986297645b1b52cde144e33dcc8ceb0..8aac676048d4f6fa68eb28389a6a37f36aeb3cde 100644
--- a/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitoringConfig.py
+++ b/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitoringConfig.py
@@ -180,11 +180,7 @@ if (pp) or (mc):
   
 # HLT items
   hlt_hltEtThresholds            = { 'j0_perf_L1RD0_FILLED': 0.,
-                                     'j0_perf_ftk_L1RD0_FILLED': 0.,
-                                     'j0_perf_ftkrefit_L1RD0_FILLED': 0.,
                                      'j0_gsc0_boffperf_split_L1RD0_FILLED': 0.,
-                                     'j0_gsc0_boffperf_split_ftk_L1RD0_FILLED': 0.,
-                                     'j0_gsc0_boffperf_split_ftkrefit_L1RD0_FILLED': 0.,
                                      'j35':20.,
                                      'j35_jes':20.,
                                      'j35_lcw':20.,
@@ -230,11 +226,7 @@ if (pp) or (mc):
 
   
   hlt_hltEtaHighThresholds       = { 'j0_perf_L1RD0_FILLED': 2.5,
-                                     'j0_perf_ftk_L1RD0_FILLED': 2.5,
-                                     'j0_perf_ftkrefit_L1RD0_FILLED': 2.5,
                                      'j0_gsc0_boffperf_split_L1RD0_FILLED': 2.5,
-                                     'j0_gsc0_boffperf_split_ftk_L1RD0_FILLED': 2.5,
-                                     'j0_gsc0_boffperf_split_ftkrefit_L1RD0_FILLED': 2.5,
                                      'j35':3.2,
                                      'j35_jes':3.2,
                                      'j35_lcw':3.2,
@@ -280,11 +272,7 @@ if (pp) or (mc):
 
   
   hlt_hltEtaLowThresholds        = { 'j0_perf_L1RD0_FILLED': 0.,
-                                     'j0_perf_ftk_L1RD0_FILLED': 0.,
-                                     'j0_perf_ftkrefit_L1RD0_FILLED': 0.,
                                      'j0_gsc0_boffperf_split_L1RD0_FILLED': 0.,
-                                     'j0_gsc0_boffperf_split_ftk_L1RD0_FILLED': 0.,
-                                     'j0_gsc0_boffperf_split_ftkrefit_L1RD0_FILLED': 0.,
                                      'j35':0.0,
                                      'j35_jes':0.0,
                                      'j35_lcw':0.0,
@@ -332,11 +320,7 @@ if (pp) or (mc):
   
   
   hlt_hltJetn                    = { 'j0_perf_L1RD0_FILLED': 1,
-                                     'j0_perf_ftk_L1RD0_FILLED': 1,
-                                     'j0_perf_ftkrefit_L1RD0_FILLED': 1,
                                      'j0_gsc0_boffperf_split_L1RD0_FILLED': 1,
-                                     'j0_gsc0_boffperf_split_ftk_L1RD0_FILLED': 1,
-                                     'j0_gsc0_boffperf_split_ftkrefit_L1RD0_FILLED': 1,
                                      'j35':1,
                                      'j35_jes':1,
                                      'j35_lcw':1,
@@ -382,11 +366,7 @@ if (pp) or (mc):
   
   
   hlt_hltContainers              = { 'j0_perf_L1RD0_FILLED':'a4tcemsubjesISFS',
-                                     'j0_perf_ftk_L1RD0_FILLED':'a4tcemsubjesISFSftk',
-                                     'j0_perf_ftkrefit_L1RD0_FILLED':'a4tcemsubjesISFSftkrefit',
                                      'j0_gsc0_boffperf_split_L1RD0_FILLED':'a4tcemsubjesISFS',
-                                     'j0_gsc0_boffperf_split_ftk_L1RD0_FILLED':'a4tcemsubjesISFSftk',
-                                     'j0_gsc0_boffperf_split_ftkrefit_L1RD0_FILLED':'a4tcemsubjesISFSftkrefit',
                                      'j35':'a4tcemsubjesISFS',
                                      'j35_sub':'a4tcemsubFS',
                                      'j35_jes':'a4tcemjesFS',
@@ -435,11 +415,7 @@ if (pp) or (mc):
                 
 # Offline 
   hlt_offlineEtThresholds        = {     'j0_perf_L1RD0_FILLED': 0.,
-                                         'j0_perf_ftk_L1RD0_FILLED': 0.,
-                                         'j0_perf_ftkrefit_L1RD0_FILLED': 0.,
                                          'j0_gsc0_boffperf_split_L1RD0_FILLED': 0.,
-                                         'j0_gsc0_boffperf_split_ftk_L1RD0_FILLED': 0.,
-                                         'j0_gsc0_boffperf_split_ftkrefit_L1RD0_FILLED': 0.,
                                          'L1_J15':0., 
                                          'j35_jes':20.,
                                          'j35_lcw':20.,
diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitorAlgorithm.py
index 176a8932dd1f74d3ebb42d5964b12ad0709d9e48..65841dfa0fdabebbfa7e69a4fb60525de39f9d64 100644
--- a/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitorAlgorithm.py
+++ b/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitorAlgorithm.py
@@ -98,15 +98,27 @@ def TrigMETMonConfig(inputFlags):
     et_bins=205 #Et
     et_min=-13.5
     et_max=401.5
+    et_bins_log=20 #Et_log
+    et_min_log=-1.875
+    et_max_log=4.125
     ec_bins=199 #Ex, Ey, Ez
     ec_min=-298.5
     ec_max=298.5
+    ec_bins_log=27 #Ex_log, Ey_log, Ez_log
+    ec_min_log=-4.125
+    ec_max_log=4.125
     sumet_bins=305 #sumEt
     sumet_min=-27.0
     sumet_max=4203.0
+    sumet_bins_log=20 #sumEt_log
+    sumet_min_log=-1.875
+    sumet_max_log=4.125
     sume_bins=153 #sumE
     sume_min=-27.0
     sume_max=24003.0
+    sume_bins_log=40 #sumE_log
+    sume_min_log=-1.875
+    sume_max_log=6.125
     phi_bins=100 # phi
     phi_bins_2d=24 # phi
     phi_min=-3.1416
@@ -119,6 +131,7 @@ def TrigMETMonConfig(inputFlags):
     eff_min=-13.5
     eff_max=401.5
     # Histograms
+    ## offline MET
     metGroup.defineHistogram('offline_Ex',title='Offline Missing E_{x};E_{x} [GeV];Events',
                              path='Expert/Offline',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
     metGroup.defineHistogram('offline_Ey',title='Offline Missing E_{y};E_{y} [GeV];Events',
@@ -127,36 +140,89 @@ def TrigMETMonConfig(inputFlags):
                              path='Expert/Offline',xbins=et_bins,xmin=et_min,xmax=et_max)
     metGroup.defineHistogram('offline_sumEt',title='Offline sumE_{T};sumE_{T} [GeV];Events',
                              path='Expert/Offline',xbins=sumet_bins,xmin=sumet_min,xmax=sumet_max)
+    ## L1
     metGroup.defineHistogram('L1_Ex',title='L1 Missing E_{x};E_{x} [GeV];Events',
                              path='Shifter/L1',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
     metGroup.defineHistogram('L1_Ey',title='L1 Missing E_{y};E_{y} [GeV];Events',
                              path='Shifter/L1',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
     metGroup.defineHistogram('L1_Et',title='L1 Missing E_{T};E_{T} [GeV];Events',
                              path='Shifter/L1',xbins=et_bins,xmin=et_min,xmax=et_max)
+    ## HLT cell
     metGroup.defineHistogram('cell_Ex',title='cell Missing E_{x};E_{x} [GeV];Events',
                              path='Shifter/cell',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
+    metGroup.defineHistogram('cell_Ex_log',title='cell Missing E_{x} log;sgn(E_{x}) log_{10}(E_{x}/GeV);Events',
+                             path='Shifter/cell',xbins=ec_bins_log,xmin=ec_min_log,xmax=ec_max_log)
     metGroup.defineHistogram('cell_Ey',title='cell Missing E_{y};E_{y} [GeV];Events',
                              path='Shifter/cell',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
+    metGroup.defineHistogram('cell_Ey_log',title='cell Missing E_{y} log;sgn(E_{y}) log_{10}(E_{y}/GeV);Events',
+                             path='Shifter/cell',xbins=ec_bins_log,xmin=ec_min_log,xmax=ec_max_log)
     metGroup.defineHistogram('cell_Et',title='cell Missing E_{T};E_{T} [GeV];Events',
                              path='Shifter/cell',xbins=et_bins,xmin=et_min,xmax=et_max)
+    metGroup.defineHistogram('cell_Et_log',title='cell Missing E_{T} log;log_{10}(E_{T}/GeV);Events',
+                             path='Shifter/cell',xbins=et_bins_log,xmin=et_min_log,xmax=et_max_log)
+    metGroup.defineHistogram('cell_sumEt',title='cell sumEt;sumEt [GeV];Events',
+                             path='Shifter/cell',xbins=sumet_bins,xmin=sumet_min,xmax=sumet_max)
+    metGroup.defineHistogram('cell_sumEt_log',title='cell sumEt log;log_{10}(sumEt/GeV);Events',
+                             path='Shifter/cell',xbins=sumet_bins_log,xmin=sumet_min_log,xmax=sumet_max_log)
+    metGroup.defineHistogram('cell_phi',title='cell #phi;#phi;Events',
+                             path='Shifter/cell',xbins=phi_bins,xmin=phi_min,xmax=phi_max)
+    metGroup.defineHistogram('cell_phi;cell_phi_etweight', title='cell #phi (etweighted);#phi;E_{T} weighted events',
+                             weight='cell_Et',
+                             path='Shifter/cell',xbins=phi_bins,xmin=phi_min,xmax=phi_max)
+    metGroup.defineHistogram('cell_eta,cell_phi;cell_eta_phi', type='TH2F', title='cell #eta - #phi;#eta;#phi',
+                             path='Shifter/cell',
+                             xbins=eta_bins_2d,xmin=eta_min,xmax=eta_max,ybins=phi_bins_2d,ymin=phi_min,ymax=phi_max)
+    metGroup.defineHistogram('cell_eta,cell_phi;cell_eta_phi_etweight', type='TH2F', title='cell #eta - #phi (etweighted);#eta;#phi',
+                             weight='cell_Et',
+                             path='Shifter/cell',
+                             xbins=eta_bins_2d,xmin=eta_min,xmax=eta_max,ybins=phi_bins_2d,ymin=phi_min,ymax=phi_max)
+    ## HLT trkmht
     metGroup.defineHistogram('trkmht_Ex',title='trkmht Missing E_{x};E_{x} [GeV];Events',
                              path='Shifter/trkmht',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
+    metGroup.defineHistogram('trkmht_Ex_log',title='trkmht Missing E_{x} log;sgn(E_{x}) log_{10}(E_{x}/GeV);Events',
+                             path='Shifter/trkmht',xbins=ec_bins_log,xmin=ec_min_log,xmax=ec_max_log)
     metGroup.defineHistogram('trkmht_Ey',title='trkmht Missing E_{y};E_{y} [GeV];Events',
                              path='Shifter/trkmht',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
+    metGroup.defineHistogram('trkmht_Ey_log',title='trkmht Missing E_{y} log;sgn(E_{y}) log_{10}(E_{y}/GeV);Events',
+                             path='Shifter/trkmht',xbins=ec_bins_log,xmin=ec_min_log,xmax=ec_max_log)
     metGroup.defineHistogram('trkmht_Et',title='trkmht Missing E_{T};E_{T} [GeV];Events',
                              path='Shifter/trkmht',xbins=et_bins,xmin=et_min,xmax=et_max)
+    metGroup.defineHistogram('trkmht_Et_log',title='trkmht Missing E_{T} log;log_{10}(E_{T}/GeV);Events',
+                             path='Shifter/trkmht',xbins=et_bins_log,xmin=et_min_log,xmax=et_max_log)
+    metGroup.defineHistogram('trkmht_sumEt',title='trkmht sumEt;sumEt [GeV];Events',
+                             path='Shifter/trkmht',xbins=sumet_bins,xmin=sumet_min,xmax=sumet_max)
+    metGroup.defineHistogram('trkmht_sumEt_log',title='trkmht sumEt log;log_{10}(sumEt/GeV);Events',
+                             path='Shifter/trkmht',xbins=sumet_bins_log,xmin=sumet_min_log,xmax=sumet_max_log)
+    metGroup.defineHistogram('trkmht_phi',title='trkmht #phi;#phi;Events',
+                             path='Shifter/trkmht',xbins=phi_bins,xmin=phi_min,xmax=phi_max)
+    metGroup.defineHistogram('trkmht_phi;trkmht_phi_etweight', title='trkmht #phi (etweighted);#phi;E_{T} weighted events',
+                             weight='trkmht_Et',
+                             path='Shifter/trkmht',xbins=phi_bins,xmin=phi_min,xmax=phi_max)
+    ## HLT tcpufit
     metGroup.defineHistogram('tcpufit_Ex',title='tcpufit Missing E_{x};E_{x} [GeV];Events',
                              path='Shifter/tcpufit',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
+    metGroup.defineHistogram('tcpufit_Ex_log',title='tcpufit Missing E_{x} log;sgn(E_{x}) log_{10}(E_{x}/GeV);Events',
+                             path='Shifter/tcpufit',xbins=ec_bins_log,xmin=ec_min_log,xmax=ec_max_log)
     metGroup.defineHistogram('tcpufit_Ey',title='tcpufit Missing E_{y};E_{y} [GeV];Events',
                              path='Shifter/tcpufit',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
+    metGroup.defineHistogram('tcpufit_Ey_log',title='tcpufit Missing E_{y} log;sgn(E_{y}) log_{10}(E_{y}/GeV);Events',
+                             path='Shifter/tcpufit',xbins=ec_bins_log,xmin=ec_min_log,xmax=ec_max_log)
     metGroup.defineHistogram('tcpufit_Ez',title='tcpufit Missing E_{z};E_{z} [GeV];Events',
                              path='Shifter/tcpufit',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
+    metGroup.defineHistogram('tcpufit_Ez_log',title='tcpufit Missing E_{z} log;sgn(E_{z}) log_{10}(E_{x}/GeV);Events',
+                             path='Shifter/tcpufit',xbins=ec_bins_log,xmin=ec_min_log,xmax=ec_max_log)
     metGroup.defineHistogram('tcpufit_Et',title='tcpufit Missing E_{T};E_{T} [GeV];Events',
                              path='Shifter/tcpufit',xbins=et_bins,xmin=et_min,xmax=et_max)
+    metGroup.defineHistogram('tcpufit_Et_log',title='tcpufit Missing E_{T} log;log_{10}(E_{T}/GeV);Events',
+                             path='Shifter/tcpufit',xbins=et_bins_log,xmin=et_min_log,xmax=et_max_log)
     metGroup.defineHistogram('tcpufit_sumEt',title='tcpufit sumEt;sumEt [GeV];Events',
                              path='Shifter/tcpufit',xbins=sumet_bins,xmin=sumet_min,xmax=sumet_max)
+    metGroup.defineHistogram('tcpufit_sumEt_log',title='tcpufit sumEt log;log_{10}(sumEt/GeV);Events',
+                             path='Shifter/tcpufit',xbins=sumet_bins_log,xmin=sumet_min_log,xmax=sumet_max_log)
     metGroup.defineHistogram('tcpufit_sumE',title='tcpufit sumE;sumE [GeV];Events',
                              path='Shifter/tcpufit',xbins=sume_bins,xmin=sume_min,xmax=sume_max)
+    metGroup.defineHistogram('tcpufit_sumE_log',title='tcpufit sumE log;log_{10}(sumE/GeV);Events',
+                             path='Shifter/tcpufit',xbins=sume_bins_log,xmin=sume_min_log,xmax=sume_max_log)
     metGroup.defineHistogram('tcpufit_eta',title='tcpufit #eta;#eta;Events',
                              path='Shifter/tcpufit',xbins=eta_bins,xmin=eta_min,xmax=eta_max)
     metGroup.defineHistogram('tcpufit_phi',title='tcpufit #phi;#phi;Events',
@@ -171,36 +237,93 @@ def TrigMETMonConfig(inputFlags):
                              weight='tcpufit_Et',
                              path='Shifter/tcpufit',
                              xbins=eta_bins_2d,xmin=eta_min,xmax=eta_max,ybins=phi_bins_2d,ymin=phi_min,ymax=phi_max)
+    ## Efficiency
     metGroup.defineHistogram('offline_Et,pass_L11;L11_eff', type='TProfile',title='L1 efficiency;offline E_{T} [GeV];Efficiency',
                              path='Shifter/eff',xbins=eff_bins,xmin=eff_min,xmax=eff_max)
     metGroup.defineHistogram('offline_Et,pass_HLT1;HLT1_eff', type='TProfile',title='HLT1 efficiency;offline E_{T} [GeV];Efficiency',
                              path='Shifter/eff',xbins=eff_bins,xmin=eff_min,xmax=eff_max)
     metGroup.defineHistogram('offline_Et,pass_HLT2;HLT2_eff', type='TProfile',title='HLT2 efficiency;offline E_{T} [GeV];Efficiency',
                              path='Shifter/eff',xbins=eff_bins,xmin=eff_min,xmax=eff_max)
+    ## HLT mht
     metGroup.defineHistogram('mht_Ex',title='mht Missing E_{x};E_{x} [GeV];Events',
                              path='Shifter/mht',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
+    metGroup.defineHistogram('mht_Ex_log',title='mht Missing E_{x} log;sgn(E_{x}) log_{10}(E_{x}/GeV);Events',
+                             path='Shifter/mht',xbins=ec_bins_log,xmin=ec_min_log,xmax=ec_max_log)
     metGroup.defineHistogram('mht_Ey',title='mht Missing E_{y};E_{y} [GeV];Events',
                              path='Shifter/mht',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
+    metGroup.defineHistogram('mht_Ey_log',title='mht Missing E_{y} log;sgn(E_{y}) log_{10}(E_{y}/GeV);Events',
+                             path='Shifter/mht',xbins=ec_bins_log,xmin=ec_min_log,xmax=ec_max_log)
     metGroup.defineHistogram('mht_Et', title='mht E_{T};E_{T} [GeV];Events',
                              path='Shifter/mht',xbins=et_bins,xmin=et_min,xmax=et_max)
+    metGroup.defineHistogram('mht_Et_log',title='mht Missing E_{T} log;log_{10}(E_{T}/GeV);Events',
+                             path='Shifter/mht',xbins=et_bins_log,xmin=et_min_log,xmax=et_max_log)
+    metGroup.defineHistogram('mht_sumEt',title='mht sumEt;sumEt [GeV];Events',
+                             path='Shifter/mht',xbins=sumet_bins,xmin=sumet_min,xmax=sumet_max)
+    metGroup.defineHistogram('mht_sumEt_log',title='mht sumEt log;log_{10}(sumEt/GeV);Events',
+                             path='Shifter/mht',xbins=sumet_bins_log,xmin=sumet_min_log,xmax=sumet_max_log)
+    metGroup.defineHistogram('mht_phi',title='mht #phi;#phi;Events',
+                             path='Shifter/mht',xbins=phi_bins,xmin=phi_min,xmax=phi_max)
+    metGroup.defineHistogram('mht_phi;mht_phi_etweight', title='mht #phi (etweighted);#phi;E_{T} weighted events',
+                             weight='mht_Et',
+                             path='Shifter/mht',xbins=phi_bins,xmin=phi_min,xmax=phi_max)
+    metGroup.defineHistogram('mht_eta,cell_phi;mht_eta_phi', type='TH2F', title='mht #eta - #phi;#eta;#phi',
+                             path='Shifter/mht',
+                             xbins=eta_bins_2d,xmin=eta_min,xmax=eta_max,ybins=phi_bins_2d,ymin=phi_min,ymax=phi_max)
+    metGroup.defineHistogram('mht_eta,mht_phi;mht_eta_phi_etweight', type='TH2F', title='mht #eta - #phi (etweighted);#eta;#phi',
+                             weight='mht_Et',
+                             path='Shifter/mht',
+                             xbins=eta_bins_2d,xmin=eta_min,xmax=eta_max,ybins=phi_bins_2d,ymin=phi_min,ymax=phi_max)
+    ## HLT pfsum
     metGroup.defineHistogram('pfsum_Ex',title='pfsum Missing E_{x};E_{x} [GeV];Events',
                              path='Shifter/pfsum',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
+    metGroup.defineHistogram('pfsum_Ex_log',title='pfsum Missing E_{x} log;sgn(E_{x}) log_{10}(E_{x}/GeV);Events',
+                             path='Shifter/pfsum',xbins=ec_bins_log,xmin=ec_min_log,xmax=ec_max_log)
     metGroup.defineHistogram('pfsum_Ey',title='pfsum Missing E_{y};E_{y} [GeV];Events',
                              path='Shifter/pfsum',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
+    metGroup.defineHistogram('pfsum_Ey_log',title='pfsum Missing E_{y} log;sgn(E_{y}) log_{10}(E_{y}/GeV);Events',
+                             path='Shifter/pfsum',xbins=ec_bins_log,xmin=ec_min_log,xmax=ec_max_log)
     metGroup.defineHistogram('pfsum_Et', title='pfsum E_{T};E_{T} [GeV];Events',
                              path='Shifter/pfsum',xbins=et_bins,xmin=et_min,xmax=et_max)
+    metGroup.defineHistogram('pfsum_Et_log',title='pfsum Missing E_{T} log;log_{10}(E_{T}/GeV);Events',
+                             path='Shifter/pfsum',xbins=et_bins_log,xmin=et_min_log,xmax=et_max_log)
+    metGroup.defineHistogram('pfsum_sumEt',title='pfsum sumEt;sumEt [GeV];Events',
+                             path='Shifter/pfsum',xbins=sumet_bins,xmin=sumet_min,xmax=sumet_max)
+    metGroup.defineHistogram('pfsum_sumEt_log',title='pfsum sumEt log;log_{10}(sumEt/GeV);Events',
+                             path='Shifter/pfsum',xbins=sumet_bins_log,xmin=sumet_min_log,xmax=sumet_max_log)
+    metGroup.defineHistogram('pfsum_phi',title='pfsum #phi;#phi;Events',
+                             path='Shifter/pfsum',xbins=phi_bins,xmin=phi_min,xmax=phi_max)
+    metGroup.defineHistogram('pfsum_phi;pfsum_phi_etweight', title='pfsum #phi (etweighted);#phi;E_{T} weighted events',
+                             weight='pfsum_Et',
+                             path='Shifter/pfsum',xbins=phi_bins,xmin=phi_min,xmax=phi_max)
+    ## HLT tc
     metGroup.defineHistogram('tc_Ex',title='tc Missing E_{x};E_{x} [GeV];Events',
                              path='Expert/tc',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
     metGroup.defineHistogram('tc_Ey',title='tc Missing E_{y};E_{y} [GeV];Events',
                              path='Expert/tc',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
     metGroup.defineHistogram('tc_Et', title='tc E_{T};E_{T} [GeV];Events',
                              path='Expert/tc',xbins=et_bins,xmin=et_min,xmax=et_max)
+    ## Chain specific
     metChain1Group.defineHistogram('cell_Ex',title='cell Missing E_{x};E_{x} [GeV];Events',
                                   path='cell',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
+    metChain1Group.defineHistogram('cell_Ex_log',title='cell Missing E_{x} log;sgn(E_{x}) log_{10}(E_{x}/GeV);Events',
+                             path='cell',xbins=ec_bins_log,xmin=ec_min_log,xmax=ec_max_log)
     metChain1Group.defineHistogram('cell_Ey',title='cell Missing E_{y};E_{y} [GeV];Events',
                                   path='cell',xbins=ec_bins,xmin=ec_min,xmax=ec_max)
+    metChain1Group.defineHistogram('cell_Ey_log',title='cell Missing E_{y} log;sgn(E_{y}) log_{10}(E_{y}/GeV);Events',
+                             path='cell',xbins=ec_bins_log,xmin=ec_min_log,xmax=ec_max_log)
     metChain1Group.defineHistogram('cell_Et',title='cell Missing E_{T};E_{T} [GeV];Events',
                                   path='cell',xbins=et_bins,xmin=et_min,xmax=et_max)
+    metChain1Group.defineHistogram('cell_Et_log',title='cell Missing E_{T} log;log_{10}(E_{T}/GeV);Events',
+                             path='cell',xbins=et_bins_log,xmin=et_min_log,xmax=et_max_log)
+    metChain1Group.defineHistogram('cell_sumEt',title='cell sumEt;sumEt [GeV];Events',
+                             path='cell',xbins=sumet_bins,xmin=sumet_min,xmax=sumet_max)
+    metChain1Group.defineHistogram('cell_sumEt_log',title='cell sumEt log;log_{10}(sumEt/GeV);Events',
+                             path='cell',xbins=sumet_bins_log,xmin=sumet_min_log,xmax=sumet_max_log)
+    metChain1Group.defineHistogram('cell_phi',title='cell #phi;#phi;Events',
+                             path='cell',xbins=phi_bins,xmin=phi_min,xmax=phi_max)
+    metChain1Group.defineHistogram('cell_phi;cell_phi_etweight', title='cell #phi (etweighted);#phi;E_{T} weighted events',
+                             weight='cell_Et',
+                             path='cell',xbins=phi_bins,xmin=phi_min,xmax=phi_max)
     
     ### STEP 6 ###
     # Finalize. The return value should be a tuple of the ComponentAccumulator
diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx
index ec01b8425dcb66475e7c077551a4a955be4c3a3a..89093a5a105be76aea2ddbb4af3ff7588d6036e9 100644
--- a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx
+++ b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx
@@ -113,37 +113,73 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co
     auto cell_Ex = Monitored::Scalar<float>("cell_Ex",0.0);
     auto cell_Ey = Monitored::Scalar<float>("cell_Ey",0.0);
     auto cell_Et = Monitored::Scalar<float>("cell_Et",0.0);
+    auto cell_sumEt = Monitored::Scalar<float>("cell_sumEt",0.0);
+    auto cell_Ex_log = Monitored::Scalar<float>("cell_Ex_log",0.0);
+    auto cell_Ey_log = Monitored::Scalar<float>("cell_Ey_log",0.0);
+    auto cell_Et_log = Monitored::Scalar<float>("cell_Et_log",0.0);
+    auto cell_sumEt_log = Monitored::Scalar<float>("cell_sumEt_log",0.0);
+    auto cell_eta = Monitored::Scalar<float>("cell_eta",0.0);
+    auto cell_phi = Monitored::Scalar<float>("cell_phi",0.0);
     auto mht_Ex = Monitored::Scalar<float>("mht_Ex",0.0);
     auto mht_Ey = Monitored::Scalar<float>("mht_Ey",0.0);
     auto mht_Et = Monitored::Scalar<float>("mht_Et",0.0);
+    auto mht_sumEt = Monitored::Scalar<float>("mht_sumEt",0.0);
+    auto mht_Ex_log = Monitored::Scalar<float>("mht_Ex_log",0.0);
+    auto mht_Ey_log = Monitored::Scalar<float>("mht_Ey_log",0.0);
+    auto mht_Et_log = Monitored::Scalar<float>("mht_Et_log",0.0);
+    auto mht_sumEt_log = Monitored::Scalar<float>("mht_sumEt_log",0.0);
+    auto mht_eta = Monitored::Scalar<float>("mht_eta",0.0);
+    auto mht_phi = Monitored::Scalar<float>("mht_phi",0.0);
     auto tc_Ex = Monitored::Scalar<float>("tc_Ex",0.0);
     auto tc_Ey = Monitored::Scalar<float>("tc_Ey",0.0);
     auto tc_Et = Monitored::Scalar<float>("tc_Et",0.0);
     auto trkmht_Ex = Monitored::Scalar<float>("trkmht_Ex",0.0);
     auto trkmht_Ey = Monitored::Scalar<float>("trkmht_Ey",0.0);
     auto trkmht_Et = Monitored::Scalar<float>("trkmht_Et",0.0);
+    auto trkmht_sumEt = Monitored::Scalar<float>("trkmht_sumEt",0.0);
+    auto trkmht_Ex_log = Monitored::Scalar<float>("trkmht_Ex_log",0.0);
+    auto trkmht_Ey_log = Monitored::Scalar<float>("trkmht_Ey_log",0.0);
+    auto trkmht_Et_log = Monitored::Scalar<float>("trkmht_Et_log",0.0);
+    auto trkmht_sumEt_log = Monitored::Scalar<float>("trkmht_sumEt_log",0.0);
+    auto trkmht_phi = Monitored::Scalar<float>("trkmht_phi",0.0);
     auto tcpufit_Ex = Monitored::Scalar<float>("tcpufit_Ex",0.0);
     auto tcpufit_Ey = Monitored::Scalar<float>("tcpufit_Ey",0.0);
     auto tcpufit_Ez = Monitored::Scalar<float>("tcpufit_Ez",0.0);
     auto tcpufit_Et = Monitored::Scalar<float>("tcpufit_Et",0.0);
     auto tcpufit_sumEt = Monitored::Scalar<float>("tcpufit_sumEt",0.0);
     auto tcpufit_sumE = Monitored::Scalar<float>("tcpufit_sumE",0.0);
+    auto tcpufit_Ex_log = Monitored::Scalar<float>("tcpufit_Ex_log",0.0);
+    auto tcpufit_Ey_log = Monitored::Scalar<float>("tcpufit_Ey_log",0.0);
+    auto tcpufit_Ez_log = Monitored::Scalar<float>("tcpufit_Ez_log",0.0);
+    auto tcpufit_Et_log = Monitored::Scalar<float>("tcpufit_Et_log",0.0);
+    auto tcpufit_sumEt_log = Monitored::Scalar<float>("tcpufit_sumEt_log",0.0);
+    auto tcpufit_sumE_log = Monitored::Scalar<float>("tcpufit_sumE_log",0.0);
     auto tcpufit_eta = Monitored::Scalar<float>("tcpufit_eta",0.0);
     auto tcpufit_phi = Monitored::Scalar<float>("tcpufit_phi",0.0);
     auto pfsum_Ex = Monitored::Scalar<float>("pfsum_Ex",0.0);
     auto pfsum_Ey = Monitored::Scalar<float>("pfsum_Ey",0.0);
     auto pfsum_Et = Monitored::Scalar<float>("pfsum_Et",0.0);
+    auto pfsum_sumEt = Monitored::Scalar<float>("pfsum_sumEt",0.0);
+    auto pfsum_Ex_log = Monitored::Scalar<float>("pfsum_Ex_log",0.0);
+    auto pfsum_Ey_log = Monitored::Scalar<float>("pfsum_Ey_log",0.0);
+    auto pfsum_Et_log = Monitored::Scalar<float>("pfsum_Et_log",0.0);
+    auto pfsum_sumEt_log = Monitored::Scalar<float>("pfsum_sumEt_log",0.0);
+    auto pfsum_phi = Monitored::Scalar<float>("pfsum_phi",0.0);
     auto pass_L11 = Monitored::Scalar<float>("pass_L11",0.0);
     auto pass_HLT1 = Monitored::Scalar<float>("pass_HLT1",0.0);
     auto pass_HLT2 = Monitored::Scalar<float>("pass_HLT2",0.0);
 
+
+    // constant floor for log plots
+    double epsilon = 1.189;
+
     // access offline MET values
     if ( offline_met_cont.isValid() && offline_met_cont->size() > 0 ) {
       offline_met = offline_met_cont->at(0);
       offline_Ex = - (offline_met->mpx())/1000.;
       offline_Ey = - (offline_met->mpy())/1000.;
       offline_sumEt = (offline_met->sumet())/1000.;
-      offline_Et = sqrt(offline_Ex*offline_Ex + offline_Ey*offline_Ey);
+      offline_Et = std::sqrt(offline_Ex*offline_Ex + offline_Ey*offline_Ey);
     }
 
     // access L1 MET values
@@ -160,15 +196,35 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co
       hlt_met = hlt_cell_met_cont->at(0);
       cell_Ex = (hlt_met->ex())/1000.;
       cell_Ey = (hlt_met->ey())/1000.;
-      cell_Et = sqrt(cell_Ex*cell_Ex + cell_Ey*cell_Ey);
-    }
+      float cell_Ez = (hlt_met->ez())/1000.;
+      cell_Et = std::sqrt(cell_Ex*cell_Ex + cell_Ey*cell_Ey);
+      cell_sumEt = (hlt_met->sumEt())/1000.;
+      cell_Ex_log = signed_log(cell_Ex, epsilon);
+      cell_Ey_log = signed_log(cell_Ey, epsilon);
+      cell_Et_log = signed_log(cell_Et, epsilon);
+      cell_sumEt_log = signed_log(cell_sumEt, epsilon);
+
+      TVector3 v(cell_Ex, cell_Ey, cell_Ez);
+      cell_eta = v.Eta();
+      cell_phi = v.Phi();
+   }
 
     // access HLT mht MET values
     if ( hlt_mht_met_cont.isValid() && hlt_mht_met_cont->size() > 0 ) {
       hlt_met = hlt_mht_met_cont->at(0);
       mht_Ex = (hlt_met->ex())/1000.;
       mht_Ey = (hlt_met->ey())/1000.;
-      mht_Et = sqrt(mht_Ex*mht_Ex + mht_Ey*mht_Ey);
+      float mht_Ez = (hlt_met->ez())/1000.;
+      mht_Et = std::sqrt(mht_Ex*mht_Ex + mht_Ey*mht_Ey);
+      mht_sumEt = (hlt_met->sumEt())/1000.;
+      mht_Ex_log = signed_log(mht_Ex, epsilon);
+      mht_Ey_log = signed_log(mht_Ey, epsilon);
+      mht_Et_log = signed_log(mht_Et, epsilon);
+      mht_sumEt_log = signed_log(mht_sumEt, epsilon);
+
+      TVector3 v(mht_Ex, mht_Ey, mht_Ez);
+      mht_eta = v.Eta();
+      mht_phi = v.Phi();
     }
 
     // access HLT tclcw MET values
@@ -176,7 +232,7 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co
       hlt_met = hlt_tc_met_cont->at(0);
       tc_Ex = (hlt_met->ex())/1000.;
       tc_Ey = (hlt_met->ey())/1000.;
-      tc_Et = sqrt(tc_Ex*tc_Ex + tc_Ey*tc_Ey);
+      tc_Et = std::sqrt(tc_Ex*tc_Ex + tc_Ey*tc_Ey);
     }
 
     // access HLT trkmht MET values
@@ -184,7 +240,16 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co
       hlt_met = hlt_trkmht_met_cont->at(0);
       trkmht_Ex = (hlt_met->ex())/1000.;
       trkmht_Ey = (hlt_met->ey())/1000.;
-      trkmht_Et = sqrt(trkmht_Ex*trkmht_Ex + trkmht_Ey*trkmht_Ey);
+      float trkmht_Ez = (hlt_met->ez())/1000.;
+      trkmht_Et = std::sqrt(trkmht_Ex*trkmht_Ex + trkmht_Ey*trkmht_Ey);
+      trkmht_sumEt = (hlt_met->sumEt())/1000.;
+      trkmht_Ex_log = signed_log(trkmht_Ex, epsilon);
+      trkmht_Ey_log = signed_log(trkmht_Ey, epsilon);
+      trkmht_Et_log = signed_log(trkmht_Et, epsilon);
+      trkmht_sumEt_log = signed_log(trkmht_sumEt, epsilon);
+    
+      TVector3 v(trkmht_Ex, trkmht_Ey, trkmht_Ez);
+      trkmht_phi = v.Phi();
     }
 
     // access HLT tcpufit MET values
@@ -193,9 +258,15 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co
       tcpufit_Ex = (hlt_met->ex())/1000.;
       tcpufit_Ey = (hlt_met->ey())/1000.;
       tcpufit_Ez = (hlt_met->ez())/1000.;
-      tcpufit_Et = sqrt(tcpufit_Ex*tcpufit_Ex + tcpufit_Ey*tcpufit_Ey);
+      tcpufit_Et = std::sqrt(tcpufit_Ex*tcpufit_Ex + tcpufit_Ey*tcpufit_Ey);
       tcpufit_sumEt = (hlt_met->sumEt())/1000.;
       tcpufit_sumE = (hlt_met->sumE())/1000.;
+      tcpufit_Ex_log = signed_log(tcpufit_Ex, epsilon);
+      tcpufit_Ey_log = signed_log(tcpufit_Ey, epsilon);
+      tcpufit_Ez_log = signed_log(tcpufit_Ez, epsilon);
+      tcpufit_Et_log = signed_log(tcpufit_Et, epsilon);
+      tcpufit_sumEt_log = signed_log(tcpufit_sumEt, epsilon);
+      tcpufit_sumE_log = signed_log(tcpufit_sumE, epsilon);
 
       TVector3 v(tcpufit_Ex, tcpufit_Ey, tcpufit_Ez);
       tcpufit_eta = v.Eta();
@@ -207,7 +278,16 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co
       hlt_met = hlt_pfsum_met_cont->at(0);
       pfsum_Ex = (hlt_met->ex())/1000.;
       pfsum_Ey = (hlt_met->ey())/1000.;
-      pfsum_Et = sqrt(pfsum_Ex*pfsum_Ex + pfsum_Ey*pfsum_Ey);
+      float pfsum_Ez = (hlt_met->ez())/1000.;
+      pfsum_Et = std::sqrt(pfsum_Ex*pfsum_Ex + pfsum_Ey*pfsum_Ey);
+      pfsum_sumEt = (hlt_met->sumEt())/1000.;
+      pfsum_Ex_log = signed_log(pfsum_Ex, epsilon);
+      pfsum_Ey_log = signed_log(pfsum_Ey, epsilon);
+      pfsum_Et_log = signed_log(pfsum_Et, epsilon);
+      pfsum_sumEt_log = signed_log(pfsum_sumEt, epsilon);
+    
+      TVector3 v(pfsum_Ex, pfsum_Ey, pfsum_Ez);
+      pfsum_phi = v.Phi();
     }
 
     // efficiency plots
@@ -240,14 +320,37 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co
          L1_Ex,L1_Ey,L1_Et,
          pass_L11,pass_HLT1,pass_HLT2);
     if (hlt_cell_met_cont->size() > 0) {
-      fill(tool,cell_Ex,cell_Ey,cell_Et,
-         mht_Ex,mht_Ey,mht_Et,
+      fill(tool,cell_Ex,cell_Ey,cell_Et,cell_sumEt,
+         cell_Ex_log,cell_Ey_log,cell_Et_log,cell_sumEt_log,
+         cell_eta,cell_phi,
+         mht_Ex,mht_Ey,mht_Et,mht_sumEt,
+         mht_Ex_log,mht_Ey_log,mht_Et_log,mht_sumEt_log,
+         mht_eta,mht_phi,
          tc_Ex,tc_Ey,tc_Et,
-         trkmht_Ex,trkmht_Ey,trkmht_Et,
-         pfsum_Ex,pfsum_Ey,pfsum_Et,
-         tcpufit_Ex,tcpufit_Ey,tcpufit_Ez,tcpufit_Et,
-         tcpufit_sumEt,tcpufit_sumE,tcpufit_eta,tcpufit_phi);
+         trkmht_Ex,trkmht_Ey,trkmht_Et,trkmht_sumEt,
+         trkmht_Ex_log,trkmht_Ey_log,trkmht_Et_log,trkmht_sumEt_log,
+         trkmht_phi,
+         pfsum_Ex,pfsum_Ey,pfsum_Et,pfsum_sumEt,
+         pfsum_Ex_log,pfsum_Ey_log,pfsum_Et_log,pfsum_sumEt_log,
+         pfsum_phi,
+         tcpufit_Ex,tcpufit_Ey,tcpufit_Ez,tcpufit_Et,tcpufit_sumEt,tcpufit_sumE,
+         tcpufit_Ex_log,tcpufit_Ey_log,tcpufit_Ez_log,tcpufit_Et_log,tcpufit_sumEt_log,tcpufit_sumE_log,
+         tcpufit_eta,tcpufit_phi);
     }
 
     return StatusCode::SUCCESS;
 }
+
+
+double TrigMETMonitorAlgorithm::signed_log(double e, double epsilon) const {
+
+
+  double e_log = -9e9;
+  if (std::abs(e) > epsilon)
+    e_log = std::copysign(std::log10(std::abs(e)), e);
+  else
+    e_log = 0.01;
+
+  return e_log;
+}
+
diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.h b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.h
index 4a2366abc278ae022ae3471dad74d80e6a3fcff6..88e919cdcf89de600bae42d4c08352db48c54adb 100644
--- a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.h
+++ b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.h
@@ -24,6 +24,8 @@ class TrigMETMonitorAlgorithm : public AthMonitorAlgorithm {
   virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
 
  private:
+  double signed_log(double e, double epsilon) const;
+
   SG::ReadHandleKey<xAOD::MissingETContainer> m_offline_met_key;
 
   SG::ReadHandleKey<xAOD::EnergySumRoI> m_lvl1_roi_key;
diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/python/L2MuonSAMonConfig.py b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/python/L2MuonSAMonConfig.py
index 5cf22eb6f97c5eae7fae72e662119a31bf0475fa..5b60726c934a847a2fb5990c028cf6cc4250d9a0 100644
--- a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/python/L2MuonSAMonConfig.py
+++ b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/python/L2MuonSAMonConfig.py
@@ -1,18 +1,459 @@
-#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 
 def L2MuonSAMonConfig(helper):
     
     from AthenaConfiguration.ComponentFactory import CompFactory
-    monAlg = helper.addAlgorithm(CompFactory.L2MuonSAMonMT,'L2MuonSAMonMT')
+    # HLT_mu6_L1MU6 is test chain for small statistics, so it will be removed.
+    Chains = ['HLT_mu6_L1MU6', 'HLT_mu26_ivarmedium_L1MU20']
 
+    for chain in Chains:
 
-    histGroup = helper.addGroup(monAlg, 'L2MuonSAMonMT', 'HLT/MuonMon/L2MuonSA')
+        GroupName = 'L2MuonSA_'+chain
 
+        monAlg = helper.addAlgorithm(CompFactory.L2MuonSAMonMT,'L2MuonSAMonMT_'+chain)
+        monAlg.MonitoredChains = [chain]
+        monAlg.Group = GroupName
 
-    import ROOT
-    histGroup.defineHistogram('saPt',title='L2MuonSA Pt;p_{T} [GeV];Events', type='TH1F', path='',xbins=25,xmin=-60.0,xmax=60.0)
-    histGroup.defineHistogram('saEta',title='L2MuonSA Eta;#eta;Events', type='TH1F', path='',xbins=25,xmin=-3.0,xmax=3.0)
-    histGroup.defineHistogram('saPhi',title='L2MuonSA Phi;#phi;Events', type='TH1F', path='',xbins=25,xmin=-ROOT.TMath.Pi(),xmax=ROOT.TMath.Pi())
+        histGroup = helper.addGroup(monAlg, GroupName, 'HLT/MuonMon/L2MuonSA/'+chain)
+    
+    
+        import ROOT
+        # basic EDM variables
+        histGroup.defineHistogram(GroupName+'_Pt;L2MuonSA_Pt',
+                                  title='L2MuonSA Pt '+chain+';p_{T} [GeV];Events', 
+                                  type='TH1F', path='',xbins=210,xmin=-105.,xmax=105.)
+
+        histGroup.defineHistogram(GroupName+'_Pt;L2MuonSA_Pt_Barrel',
+                                  title='L2MuonSA Pt Barrel '+chain+';p_{T} [GeV];Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1F', path='',xbins=210,xmin=-105.,xmax=105.)
+
+        histGroup.defineHistogram(GroupName+'_Pt;L2MuonSA_Pt_Endcap',
+                                  title='L2MuonSA Pt Endcap '+chain+';p_{T} [GeV];Events',
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1F', path='',xbins=210,xmin=-105.,xmax=105.)
+
+        histGroup.defineHistogram(GroupName+'_Eta;L2MuonSA_Eta',
+                                  title='L2MuonSA Eta '+chain+';#eta;Events', 
+                                  type='TH1F', path='',xbins=108,xmin=-2.7,xmax=2.7)
+
+        histGroup.defineHistogram(GroupName+'_Phi;L2MuonSA_Phi',
+                                  title='L2MuonSA Phi '+chain+';#phi;Events', 
+                                  type='TH1F', path='',xbins=96,xmin=-ROOT.TMath.Pi(),xmax=ROOT.TMath.Pi())
+
+        histGroup.defineHistogram(GroupName+'_Phi;L2MuonSA_Phi_Barrel',
+                                  title='L2MuonSA Phi Barrel '+chain+';#phi;Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1F', path='',xbins=96,xmin=-ROOT.TMath.Pi(),xmax=ROOT.TMath.Pi())
+
+        histGroup.defineHistogram(GroupName+'_Phi;L2MuonSA_Phi_Endcap',
+                                  title='L2MuonSA Phi Endcap '+chain+';#phi;Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1F', path='',xbins=96,xmin=-ROOT.TMath.Pi(),xmax=ROOT.TMath.Pi())
+
+        histGroup.defineHistogram(GroupName+'_Eta,'+GroupName+'_Phi;L2MuonSA_Eta_vs_Phi',
+                                  title='L2MuonSA Eta vs Phi '+chain+';#eta;#phi', 
+                                  type='TH2F', path='',xbins=108,xmin=-2.7,xmax=2.7, ybins=96,ymin=-ROOT.TMath.Pi(),ymax=ROOT.TMath.Pi())
+
+
+
+        # position and superpoint
+        histGroup.defineHistogram(GroupName+'_saddr;L2MuonSA_saddr',
+                                  title='L2MuonSA station address '+chain+';address;Events',
+                                  type='TH1I', path='',xbins=6,xmin=-1,xmax=5)
+
+        histGroup.defineHistogram(GroupName+'_MDTpoints_z,'+GroupName+'_MDTpoints_r;L2MuonSA_MDTpoints_z_vs_r',
+                                  title='L2MuonSA MDT superpoint Z vs R (mm) '+chain+';Z[mm];R[mm]', 
+                                  type='TH2F', path='',xbins=200,xmin=-24000,xmax=24000, ybins=200,ymin=-14000,ymax=14000)
+
+
+
+        # L1 RoI eta vs. phi in case mF failed
+        histGroup.defineHistogram(GroupName+'_roiEta,'+GroupName+'_roiPhi;L2MuonSA_failed_L1_eta_vs_phi',
+                                  title='L1 RoI Eta vs. Phi in case of L2MuonSA failure '+chain+';#eta;#phi', 
+                                  cutmask=GroupName+'mf_failure',
+                                  type='TH2F', path='',xbins=108,xmin=-2.7,xmax=2.7, ybins=96,ymin=-ROOT.TMath.Pi(),ymax=ROOT.TMath.Pi())
+
+
+
+        # MuonFeatureDetails
+        # process floe
+        histGroup.defineHistogram(GroupName+'_proc_flow;L2MuonSA_proc_flow',
+                                  title='L2MuonSA process flow '+chain+';;Events', 
+                                  type='TH1I', path='',xbins=6,xmin=1,xmax=7,
+                                  xlabels=["input","n L1 hits > 0","L1 emu ok at trigger layer","n MDT hits > 0 at middle layer","MDT fit ok at middle layer","MDT fit ok at >= 2 layers"])
+
+
+        # RPC
+        histGroup.defineHistogram(GroupName+'_RPC_Pad_N;L2MuonSA_RPC_Pad_N',
+                                  title='L2MuonSA RPC number of hits '+chain+';RPC number of hits;Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1I', path='',xbins=20,xmin=0,xmax=20)
+
+
+        # TGC
+        histGroup.defineHistogram(GroupName+'_TGC_Mid_rho_chi2;L2MuonSA_TGC_Mid_rho_chi2',
+                                  title='L2MuonSA TGC big wheel rho fit chi2 '+chain+';chi2;Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1F', path='',xbins=100,xmin=0,xmax=10)
+
+        histGroup.defineHistogram(GroupName+'_TGC_Mid_phi_chi2;L2MuonSA_TGC_Mid_phi_chi2',
+                                  title='L2MuonSA TGC big wheel phi fit chi2 '+chain+';chi2;Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1F', path='',xbins=100,xmin=0,xmax=10)
+
+        histGroup.defineHistogram(GroupName+'_TGC_Mid_rho_N;L2MuonSA_TGC_Mid_rho_N',
+                                  title='L2MuonSA TGC big wheel number of hits in rho '+chain+';TGC BW rho nhits;Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1I', path='',xbins=20,xmin=0,xmax=20)
+
+        histGroup.defineHistogram(GroupName+'_TGC_Mid_phi_N;L2MuonSA_TGC_Mid_phi_N',
+                                  title='L2MuonSA TGC big wheel number of hits in phi '+chain+';TGC BW phi nhits;Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1I', path='',xbins=20,xmin=0,xmax=20)
+
+
+        # MDT
+        histGroup.defineHistogram(GroupName+'_MDT_Inn_fit_chi2;L2MuonSA_MDT_Inn_fit_chi2_barrel',
+                                  title='L2MuonSA barrel MDT Inner station fit chi2 '+chain+';chi2;Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1F', path='',xbins=100,xmin=0,xmax=10)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Mid_fit_chi2;L2MuonSA_MDT_Mid_fit_chi2_barrel',
+                                  title='L2MuonSA barrel MDT Middle station fit chi2 '+chain+';chi2;Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1F', path='',xbins=100,xmin=0,xmax=10)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Out_fit_chi2;L2MuonSA_MDT_Out_fit_chi2_barrel',
+                                  title='L2MuonSA barrel MDT Outer station fit chi2 '+chain+';chi2;Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1F', path='',xbins=100,xmin=0,xmax=10)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Inn_fit_chi2;L2MuonSA_MDT_Inn_fit_chi2_endcap',
+                                  title='L2MuonSA endcap MDT Inner station fit chi2 '+chain+';chi2;Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1F', path='',xbins=100,xmin=0,xmax=10)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Mid_fit_chi2;L2MuonSA_MDT_Mid_fit_chi2_endcap',
+                                  title='L2MuonSA endcap MDT Middle station fit chi2 '+chain+';chi2;Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1F', path='',xbins=100,xmin=0,xmax=10)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Out_fit_chi2;L2MuonSA_MDT_Out_fit_chi2_endcap',
+                                  title='L2MuonSA endcap MDT Outer station fit chi2 '+chain+';chi2;Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1F', path='',xbins=100,xmin=0,xmax=10)
+
+        histGroup.defineHistogram(GroupName+'_MDT_N;L2MuonSA_MDT_N_barrel',
+                                  title='L2MuonSA barrel MDT number of hits '+chain+';MDT nhits;Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1I', path='',xbins=40,xmin=0,xmax=40)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Inn_N;L2MuonSA_MDT_Inn_N_barrel',
+                                  title='L2MuonSA barrel MDT Inner number of hits '+chain+';MDT nhits Inner;Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1I', path='',xbins=40,xmin=0,xmax=40)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Mid_N;L2MuonSA_MDT_Mid_N_barrel',
+                                  title='L2MuonSA barrel MDT Middle number of hits '+chain+';MDT nhits Middle;Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1I', path='',xbins=40,xmin=0,xmax=40)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Out_N;L2MuonSA_MDT_Out_N_barrel',
+                                  title='L2MuonSA barrel MDT Outer number of hits '+chain+';MDT nhits Outer;Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1I', path='',xbins=40,xmin=0,xmax=40)
+
+        histGroup.defineHistogram(GroupName+'_MDT_N;L2MuonSA_MDT_N_endcap',
+                                  title='L2MuonSA endcap MDT number of hits '+chain+';MDT nhits;Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1I', path='',xbins=40,xmin=0,xmax=40)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Inn_N;L2MuonSA_MDT_Inn_N_endcap',
+                                  title='L2MuonSA endcap MDT Inner number of hits '+chain+';MDT nhits Inner;Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1I', path='',xbins=40,xmin=0,xmax=40)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Mid_N;L2MuonSA_MDT_Mid_N_endcap',
+                                  title='L2MuonSA endcap MDT Middle number of hits '+chain+';MDT nhits Middle;Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1I', path='',xbins=40,xmin=0,xmax=40)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Out_N;L2MuonSA_MDT_Out_N_endcap',
+                                  title='L2MuonSA endcap MDT Outer number of hits '+chain+';MDT nhits Outer;Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1I', path='',xbins=40,xmin=0,xmax=40)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Inn_residual;L2MuonSA_MDT_Inn_residual_barrel',
+                                  title='L2MuonSA barrel MDT Inner station residual '+chain+';MDT Inner barrel residual [cm];Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1F', path='',xbins=100,xmin=-20,xmax=20)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Mid_residual;L2MuonSA_MDT_Mid_residual_barrel',
+                                  title='L2MuonSA barrel MDT Middle station residual '+chain+';MDT Middle barrel residual [cm];Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1F', path='',xbins=100,xmin=-20,xmax=20)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Out_residual;L2MuonSA_MDT_Out_residual_barrel',
+                                  title='L2MuonSA barrel MDT Outer station residual '+chain+';MDT Outer barrel residual [cm];Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1F', path='',xbins=100,xmin=-20,xmax=20)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Inn_residual_OffMatch;L2MuonSA_MDT_Inn_residual_barrel_OffMatch',
+                                  title='L2MuonSA barrel MDT Inner station residual matched with Offline '+chain+';MDT Inner barrel residual [cm];Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1F', path='',xbins=100,xmin=-20,xmax=20)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Mid_residual_OffMatch;L2MuonSA_MDT_Mid_residual_barrel_OffMatch',
+                                  title='L2MuonSA barrel MDT Middle station residual matched with Offline '+chain+';MDT Middle barrel residual [cm];Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1F', path='',xbins=100,xmin=-20,xmax=20)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Out_residual_OffMatch;L2MuonSA_MDT_Out_residual_barrel_OffMatch',
+                                  title='L2MuonSA barrel MDT Outer station residual matched with Offline '+chain+';MDT Outer barrel residual [cm];Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1F', path='',xbins=100,xmin=-20,xmax=20)
+
+        histGroup.defineHistogram(GroupName+'_LB,'+GroupName+'_MDT_Inn_residual;L2MuonSA_MDT_Inn_residual_barrel_vs_LB',
+                                  title='L2MuonSA barrel MDT Inner station residual vs LB '+chain+';LB;MDT Inner barrel residual [cm]', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH2F', path='',xbins=750,xmin=1.,xmax=1501.,ybins=80,ymin=-20,ymax=20)
+
+        histGroup.defineHistogram(GroupName+'_LB,'+GroupName+'_MDT_Mid_residual;L2MuonSA_MDT_Mid_residual_barrel_vs_LB',
+                                  title='L2MuonSA barrel MDT Middle station residual vs LB '+chain+';LB;MDT Middle barrel residual [cm]', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH2F', path='',xbins=750,xmin=1.,xmax=1501.,ybins=80,ymin=-20,ymax=20)
+
+        histGroup.defineHistogram(GroupName+'_LB,'+GroupName+'_MDT_Out_residual;L2MuonSA_MDT_Out_residual_barrel_vs_LB',
+                                  title='L2MuonSA barrel MDT Outer station residual vs LB '+chain+';LB;MDT Outer barrel residual [cm]', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH2F', path='',xbins=750,xmin=1.,xmax=1501.,ybins=80,ymin=-20,ymax=20)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Inn_residual;L2MuonSA_MDT_Inn_residual_endcap',
+                                  title='L2MuonSA endcap MDT Inner station residual '+chain+';MDT Inner endcap residual [cm];Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1F', path='',xbins=100,xmin=-20,xmax=20)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Mid_residual;L2MuonSA_MDT_Mid_residual_endcap',
+                                  title='L2MuonSA endcap MDT Middle station residual '+chain+';MDT Middle endcap residual [cm];Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1F', path='',xbins=100,xmin=-20,xmax=20)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Out_residual;L2MuonSA_MDT_Out_residual_endcap',
+                                  title='L2MuonSA endcap MDT Outer station residual '+chain+';MDT Outer endcap residual [cm];Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1F', path='',xbins=100,xmin=-20,xmax=20)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Inn_residual_OffMatch;L2MuonSA_MDT_Inn_residual_endcap_OffMatch',
+                                  title='L2MuonSA endcap MDT Inner station residual matched with Offline '+chain+';MDT Inner endcap residual [cm];Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1F', path='',xbins=100,xmin=-20,xmax=20)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Mid_residual_OffMatch;L2MuonSA_MDT_Mid_residual_endcap_OffMatch',
+                                  title='L2MuonSA endcap MDT Middle station residual matched with Offline '+chain+';MDT Middle endcap residual [cm];Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1F', path='',xbins=100,xmin=-20,xmax=20)
+
+        histGroup.defineHistogram(GroupName+'_MDT_Out_residual_OffMatch;L2MuonSA_MDT_Out_residual_endcap_OffMatch',
+                                  title='L2MuonSA endcap MDT Outer station residual matched with Offline '+chain+';MDT Outer endcap residual [cm];Events', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH1F', path='',xbins=100,xmin=-20,xmax=20)
+
+        histGroup.defineHistogram(GroupName+'_LB,'+GroupName+'_MDT_Inn_residual;L2MuonSA_MDT_Inn_residual_endcap_vs_LB',
+                                  title='L2MuonSA endcap MDT Inner station residual vs LB '+chain+';LB;MDT Inner endcap residual [cm]', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH2F', path='',xbins=750,xmin=1.,xmax=1501.,ybins=80,ymin=-20,ymax=20)
+
+        histGroup.defineHistogram(GroupName+'_LB,'+GroupName+'_MDT_Mid_residual;L2MuonSA_MDT_Mid_residual_endcap_vs_LB',
+                                  title='L2MuonSA endcap MDT Middle station residual vs LB '+chain+';LB;MDT Middle endcap residual [cm]', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH2F', path='',xbins=750,xmin=1.,xmax=1501.,ybins=80,ymin=-20,ymax=20)
+
+        histGroup.defineHistogram(GroupName+'_LB,'+GroupName+'_MDT_Out_residual;L2MuonSA_MDT_Out_residual_endcap_vs_LB',
+                                  title='L2MuonSA endcap MDT Outer station residual vs LB '+chain+';LB;MDT Outer endcap residual [cm]', 
+                                  cutmask=GroupName+'_isEndcap',
+                                  type='TH2F', path='',xbins=750,xmin=1.,xmax=1501.,ybins=80,ymin=-20,ymax=20)
+
+
+
+        # Comparison to Offline
+        # dR wrt Offline
+        histGroup.defineHistogram(GroupName+'_dRmin;L2MuonSA_dR_toRecMuonCB',
+                                  title='dR between L2MuonSA and Offline '+chain+';#DeltaR;Events', 
+                                  type='TH1F', path='',xbins=100,xmin=0,xmax=2)
+
+
+        # L1 RoI wrt offline
+        histGroup.defineHistogram(GroupName+'_initialRoI_dR;L2MuonSA_initialRoI_dR_toRecMuonCB',
+                                  title='L2MuonSA initialRoI dR wrt offline CB '+chain+';dR(initialRoI vs offl CB);Events', 
+                                  type='TH1F', path='',xbins=100,xmin=0.,xmax=0.5)
+
+        histGroup.defineHistogram(GroupName+'_offEta,'+GroupName+'_initialRoI_dEta;L2MuonSA_initialRoI_dEta_vs_Eta_toRecMuonCB',
+                                  title='L2MuonSA initialRoI wrt Offline CB muon, d#eta '+chain+';offl CB #eta;d#eta(initialRoI vs offl CB)', 
+                                  type='TH2F', path='',xbins=54,xmin=-2.7,xmax=2.7, ybins=60,ymin=-0.3,ymax=0.3)
+
+        histGroup.defineHistogram(GroupName+'_offEta,'+GroupName+'_initialRoI_dPhi;L2MuonSA_initialRoI_dPhi_vs_Eta_toRecMuonCB',
+                                  title='L2MuonSA initialRoI wrt Offline CB muon, d#phi '+chain+';offl CB #eta;d#phi(initialRoI vs offl CB)', 
+                                  type='TH2F', path='',xbins=54,xmin=-2.7,xmax=2.7, ybins=44,ymin=-0.2,ymax=0.2)
+
+
+        # pt resolution (barrel, endcap1, endcap2, or endcap3) (A-side or C-side)
+        histGroup.defineHistogram(GroupName+'_ptresol;L2MuonSA_ptresol_toRecMuonCB',
+                                  title='L2MuonSA pT resolution wrt Offline '+chain+';p_{T} resol;Events', 
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_ptresol;L2MuonSA_ptresol_toRecMuonCB_BR',
+                                  title='L2MuonSA pT resolution wrt Offline Barrel '+chain+';p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isBarrel',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_ptresol;L2MuonSA_ptresol_toRecMuonCB_EC1',
+                                  title='L2MuonSA pT resolution wrt Offline Endcap1 '+chain+';p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap1',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_ptresol;L2MuonSA_ptresol_toRecMuonCB_EC2',
+                                  title='L2MuonSA pT resolution wrt Offline Endcap2 '+chain+';p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap2',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_ptresol;L2MuonSA_ptresol_toRecMuonCB_EC3',
+                                  title='L2MuonSA pT resolution wrt Offline Endcap3 '+chain+';p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap3',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+
+        histGroup.defineHistogram(GroupName+'_offPt_signed,'+GroupName+'_ptresol;L2MuonSA_ptresol_toRecMuonCB_pt_barrel_A',
+                                  title='L2MuonSA barrel A pT resolution wrt Offline in pt '+chain+';p_{T} [GeV/c];p_{T} resol', 
+                                  cutmask=GroupName+'_isBarrelA',
+                                  type='TH2F', path='',xbins=104,xmin=-52.,xmax=52.,ybins=100,ymin=-2.,ymax=2.)
+
+        histGroup.defineHistogram(GroupName+'_offPt_signed,'+GroupName+'_ptresol;L2MuonSA_ptresol_toRecMuonCB_pt_barrel_C',
+                                  title='L2MuonSA barrel C pT resolution wrt Offline in pt '+chain+';p_{T} [GeV/c];p_{T} resol', 
+                                  cutmask=GroupName+'_isBarrelC',
+                                  type='TH2F', path='',xbins=104,xmin=-52.,xmax=52.,ybins=100,ymin=-2.,ymax=2.)
+
+        histGroup.defineHistogram(GroupName+'_offPt_signed,'+GroupName+'_ptresol;L2MuonSA_ptresol_toRecMuonCB_pt_endcap_A',
+                                  title='L2MuonSA endcap A pT resolution wrt Offline in pt '+chain+';p_{T} [GeV/c];p_{T} resol', 
+                                  cutmask=GroupName+'_isEndcapA',
+                                  type='TH2F', path='',xbins=104,xmin=-52.,xmax=52.,ybins=100,ymin=-2.,ymax=2.)
+
+        histGroup.defineHistogram(GroupName+'_offPt_signed,'+GroupName+'_ptresol;L2MuonSA_ptresol_toRecMuonCB_pt_endcap_C',
+                                  title='L2MuonSA endcap C pT resolution wrt Offline in pt '+chain+';p_{T} [GeV/c];p_{T} resol', 
+                                  cutmask=GroupName+'_isEndcapC',
+                                  type='TH2F', path='',xbins=104,xmin=-52.,xmax=52.,ybins=100,ymin=-2.,ymax=2.)
+
+
+        histGroup.defineHistogram(GroupName+'_offEta,'+GroupName+'_ptresol;L2MuonSA_ptresol_toRecMuonCB_eta',
+                                  title='L2MuonSA pT resolution wrt Offline in eta '+chain+';#eta;p_{T} resol', 
+                                  type='TH2F', path='',xbins=27,xmin=-2.7,xmax=2.7,ybins=100,ymin=-2.,ymax=2.)
+
+        histGroup.defineHistogram(GroupName+'_offEta,'+GroupName+'_ptresol;L2MuonSA_ptresol_toRecMuonCB_eta_pT4_6',
+                                  title='L2MuonSA pT resolution wrt Offline in eta (pT4GeV-6GeV) '+chain+';#eta;p_{T} resol', 
+                                  cutmask=GroupName+'_pt4to6',
+                                  type='TH2F', path='',xbins=27,xmin=-2.7,xmax=2.7,ybins=100,ymin=-2.,ymax=2.)
+
+        histGroup.defineHistogram(GroupName+'_offEta,'+GroupName+'_ptresol;L2MuonSA_ptresol_toRecMuonCB_eta_pT6_8',
+                                  title='L2MuonSA pT resolution wrt Offline in eta (pT6GeV-8GeV) '+chain+';#eta;p_{T} resol', 
+                                  cutmask=GroupName+'_pt6to8',
+                                  type='TH2F', path='',xbins=27,xmin=-2.7,xmax=2.7,ybins=100,ymin=-2.,ymax=2.)
+
+        histGroup.defineHistogram(GroupName+'_offEta,'+GroupName+'_ptresol;L2MuonSA_ptresol_toRecMuonCB_eta_pT8_x',
+                                  title='L2MuonSA pT resolution wrt Offline in eta (pT over 8GeV) '+chain+';#eta;p_{T} resol', 
+                                  cutmask=GroupName+'_ptover8',
+                                  type='TH2F', path='',xbins=27,xmin=-2.7,xmax=2.7,ybins=100,ymin=-2.,ymax=2.)
+
+
+        # inverse pt resolution (positive or negative muon) (A-side or C-side) (barrel, endcap1, endcap2, or endcap3)
+        histGroup.defineHistogram(GroupName+'_invptresol_pos;L2MuonSA_invptresol_toRecMuonCB_pos',
+                                  title='L2MuonSA pT resolution wrt Offline positive muons '+chain+';1/p_{T} resol;Events', 
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_neg;L2MuonSA_invptresol_toRecMuonCB_neg',
+                                  title='L2MuonSA pT resolution wrt Offline negative muons '+chain+';1/p_{T} resol;Events', 
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+
+        histGroup.defineHistogram(GroupName+'_invptresol_pos;L2MuonSA_invptresol_toRecMuonCB_pos_BR_A',
+                                  title='L2MuonSA pT resolution wrt Offline pos muons Barrel A-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isBarrelA',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_neg;L2MuonSA_invptresol_toRecMuonCB_neg_BR_A',
+                                  title='L2MuonSA pT resolution wrt Offline neg muons Barrel A-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isBarrelA',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_pos;L2MuonSA_invptresol_toRecMuonCB_pos_EC1_A',
+                                  title='L2MuonSA pT resolution wrt Offline pos muons EndCap1 A-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap1A',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_neg;L2MuonSA_invptresol_toRecMuonCB_neg_EC1_A',
+                                  title='L2MuonSA pT resolution wrt Offline neg muons EndCap1 A-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap1A',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_pos;L2MuonSA_invptresol_toRecMuonCB_pos_EC2_A',
+                                  title='L2MuonSA pT resolution wrt Offline pos muons EndCap2 A-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap2A',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_neg;L2MuonSA_invptresol_toRecMuonCB_neg_EC2_A',
+                                  title='L2MuonSA pT resolution wrt Offline neg muons EndCap2 A-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap2A',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_pos;L2MuonSA_invptresol_toRecMuonCB_pos_EC3_A',
+                                  title='L2MuonSA pT resolution wrt Offline pos muons EndCap3 A-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap3A',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_neg;L2MuonSA_invptresol_toRecMuonCB_neg_EC3_A',
+                                  title='L2MuonSA pT resolution wrt Offline neg muons EndCap3 A-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap3A',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+
+        histGroup.defineHistogram(GroupName+'_invptresol_pos;L2MuonSA_invptresol_toRecMuonCB_pos_BR_C',
+                                  title='L2MuonSA pT resolution wrt Offline pos muons Barrel C-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isBarrelC',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_neg;L2MuonSA_invptresol_toRecMuonCB_neg_BR_C',
+                                  title='L2MuonSA pT resolution wrt Offline neg muons Barrel C-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isBarrelC',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_pos;L2MuonSA_invptresol_toRecMuonCB_pos_EC1_C',
+                                  title='L2MuonSA pT resolution wrt Offline pos muons EndCap1 C-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap1C',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_neg;L2MuonSA_invptresol_toRecMuonCB_neg_EC1_C',
+                                  title='L2MuonSA pT resolution wrt Offline neg muons EndCap1 C-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap1C',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_pos;L2MuonSA_invptresol_toRecMuonCB_pos_EC2_C',
+                                  title='L2MuonSA pT resolution wrt Offline pos muons EndCap2 C-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap2C',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_neg;L2MuonSA_invptresol_toRecMuonCB_neg_EC2_C',
+                                  title='L2MuonSA pT resolution wrt Offline neg muons EndCap2 C-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap2C',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_pos;L2MuonSA_invptresol_toRecMuonCB_pos_EC3_C',
+                                  title='L2MuonSA pT resolution wrt Offline pos muons EndCap3 C-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap3C',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
+
+        histGroup.defineHistogram(GroupName+'_invptresol_neg;L2MuonSA_invptresol_toRecMuonCB_neg_EC3_C',
+                                  title='L2MuonSA pT resolution wrt Offline neg muons EndCap3 C-side '+chain+';1/p_{T} resol;Events', 
+                                  cutmask=GroupName+'_isEndcap3C',
+                                  type='TH1F', path='',xbins=100,xmin=-2.,xmax=2.)
 
     return
diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/python/TrigMuonEfficiencyMonConfig.py b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/python/TrigMuonEfficiencyMonConfig.py
index 8b46219d9d73f9620ad687169e9b579a4e08dfe5..8259e12f8fef6657e32197b17171ee26f3e19791 100644
--- a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/python/TrigMuonEfficiencyMonConfig.py
+++ b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/python/TrigMuonEfficiencyMonConfig.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
 
 import re
 import math
@@ -8,7 +8,9 @@ def TrigMuonEfficiencyMonConfig(helper):
     
     from AthenaConfiguration.ComponentFactory import CompFactory
 
-    Chains = ['HLT_mu26_ivarmedium_L1MU20', 'HLT_mu50_L1MU20', 'HLT_mu6_L1MU6']
+    # HLT_mu6_L1MU6 is test chain for small statistics, so it will be removed.
+    # To do: add multi-muon chain and msonly chain
+    Chains = ['HLT_mu6_L1MU6', 'HLT_mu26_ivarmedium_L1MU20', 'HLT_mu50_L1MU20']
 
     cached_regex = {}
     def regex(pat):
@@ -42,17 +44,48 @@ def TrigMuonEfficiencyMonConfig(helper):
                                       type='TEfficiency', path='',xbins=xbins,xmin=xmin,xmax=xmax)
 
             histGroup.defineHistogram(GroupName+'_L2SApass,'+GroupName+'_'+variable+';EffL2SA_'+variable+'_wrt_Upstream',
-                                      title='L2MuonSA Efficiency '+chain+';'+xlabel+';Efficiency',
+                                      title='L2MuonSA Efficiency '+chain+' wrt Upstream;'+xlabel+';Efficiency',
                                       cutmask=GroupName+'_L1pass',
                                       type='TEfficiency', path='',xbins=xbins,xmin=xmin,xmax=xmax)
 
+            histGroup.defineHistogram(GroupName+'_L2SApass,'+GroupName+'_'+variable+';EffL2SA_'+variable+'_wrt_offlineCB',
+                                      title='L2MuonSA Efficiency '+chain+' wrt offlineCB;'+xlabel+';Efficiency',
+                                      type='TEfficiency', path='',xbins=xbins,xmin=xmin,xmax=xmax)
+
             histGroup.defineHistogram(GroupName+'_L2CBpass,'+GroupName+'_'+variable+';EffL2CB_'+variable+'_wrt_Upstream',
-                                      title='L2muComb Efficiency '+chain+';'+xlabel+';Efficiency',
+                                      title='L2muComb Efficiency '+chain+' wrt Upstream;'+xlabel+';Efficiency',
+                                      cutmask=GroupName+'_L2SApass',
+                                      type='TEfficiency', path='',xbins=xbins,xmin=xmin,xmax=xmax)
+
+            histGroup.defineHistogram(GroupName+'_L2CBpass,'+GroupName+'_'+variable+';EffL2CB_'+variable+'_wrt_offlineCB',
+                                      title='L2muComb Efficiency '+chain+' wrt offlineCB;'+xlabel+';Efficiency',
+                                      type='TEfficiency', path='',xbins=xbins,xmin=xmin,xmax=xmax)
+
+            histGroup.defineHistogram(GroupName+'_EFSApass,'+GroupName+'_'+variable+';EffEFSA_'+variable+'_wrt_Upstream',
+                                      title='EFSA Muon Efficiency '+chain+' wrt Upstream;'+xlabel+';Efficiency',
+                                      cutmask=GroupName+'_L2CBpass',
+                                      type='TEfficiency', path='',xbins=xbins,xmin=xmin,xmax=xmax)
+
+            histGroup.defineHistogram(GroupName+'_EFSApass,'+GroupName+'_'+variable+';EffEFSA_'+variable+'_wrt_offlineCB',
+                                      title='EFSA Muon Efficiency '+chain+' wrt offlineCB;'+xlabel+';Efficiency',
+                                      type='TEfficiency', path='',xbins=xbins,xmin=xmin,xmax=xmax)
+
+            histGroup.defineHistogram(GroupName+'_EFSApass,'+GroupName+'_'+variable+';EffEFSA_'+variable+'_wrt_offlineCB_passedL2SA',
+                                      title='EFSA Muon Efficiency passed L2SA '+chain+' wrt offlineCB;'+xlabel+';Efficiency',
                                       cutmask=GroupName+'_L2SApass',
                                       type='TEfficiency', path='',xbins=xbins,xmin=xmin,xmax=xmax)
 
-            histGroup.defineHistogram(GroupName+'_EFpass,'+GroupName+'_'+variable+';EffEF_'+variable+'_wrt_Upstream',
-                                      title='EF Muon Efficiency '+chain+';'+xlabel+';Efficiency',
+            histGroup.defineHistogram(GroupName+'_EFCBpass,'+GroupName+'_'+variable+';EffEFCB_'+variable+'_wrt_Upstream',
+                                      title='EFCB Muon Efficiency '+chain+' wrt Upstream;'+xlabel+';Efficiency',
+                                      cutmask=GroupName+'_EFSApass',
+                                      type='TEfficiency', path='',xbins=xbins,xmin=xmin,xmax=xmax)
+
+            histGroup.defineHistogram(GroupName+'_EFCBpass,'+GroupName+'_'+variable+';EffEFCB_'+variable+'_wrt_offlineCB',
+                                      title='EFCB Muon Efficiency '+chain+' wrt offlineCB;'+xlabel+';Efficiency',
+                                      type='TEfficiency', path='',xbins=xbins,xmin=xmin,xmax=xmax)
+
+            histGroup.defineHistogram(GroupName+'_EFCBpass,'+GroupName+'_'+variable+';EffEFCB_'+variable+'_wrt_offlineCB_passedL2CB',
+                                      title='EFCB Muon Efficiency passed L2CB '+chain+' wrt offlineCB;'+xlabel+';Efficiency',
                                       cutmask=GroupName+'_L2CBpass',
                                       type='TEfficiency', path='',xbins=xbins,xmin=xmin,xmax=xmax)
 
diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/L2MuonSAMonMT.cxx b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/L2MuonSAMonMT.cxx
index f06a8de21ddc0b90d201cfafc3cdefd486a302d6..04da9b03c3689e92404e711f0311e7cdcc9f09ec 100644
--- a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/L2MuonSAMonMT.cxx
+++ b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/L2MuonSAMonMT.cxx
@@ -1,9 +1,11 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "L2MuonSAMonMT.h"
 
+#include "xAODTrigMuon/TrigMuonDefs.h"
+#include "MuonMatchingTool.h"
 
 L2MuonSAMonMT :: L2MuonSAMonMT(const std::string& name, ISvcLocator* pSvcLocator )
   : TrigMuonMonitorAlgorithm(name, pSvcLocator)
@@ -12,34 +14,365 @@ L2MuonSAMonMT :: L2MuonSAMonMT(const std::string& name, ISvcLocator* pSvcLocator
 
 StatusCode L2MuonSAMonMT :: initialize(){
   StatusCode sc = TrigMuonMonitorAlgorithm::initialize();
-  ATH_CHECK( m_L2MuonSAContainerKey.initialize() );
+  ATH_CHECK( m_matchTool.retrieve() );
   return sc;
 }
 
 
-StatusCode L2MuonSAMonMT :: fillVariables(const EventContext &ctx) const {
+StatusCode L2MuonSAMonMT :: fillVariablesPerChain(const EventContext &ctx, const std::string &chain) const {
 
   ATH_MSG_DEBUG ("Filling histograms for " << name() << "...");
 
-  SG::ReadHandle<xAOD::L2StandAloneMuonContainer> muonSAs(m_L2MuonSAContainerKey, ctx);
-  if (! muonSAs.isValid() ) {
-    ATH_MSG_ERROR("evtStore() does not contain xAOD::L2StandAloneMuon collection with name "<< m_L2MuonSAContainerKey);
-    return StatusCode::FAILURE;
+  auto lb = Monitored::Scalar<int>(m_group+"_LB",-1.0);
+  lb = GetEventInfo(ctx)->lumiBlock();
+
+  const float ZERO_LIMIT = 0.00001;
+
+  std::vector< TrigCompositeUtils::LinkInfo<xAOD::L2StandAloneMuonContainer> > featureCont = getTrigDecisionTool()->features<xAOD::L2StandAloneMuonContainer>( chain, TrigDefs::includeFailedDecisions );
+  for(const TrigCompositeUtils::LinkInfo<xAOD::L2StandAloneMuonContainer>& muLinkInfo : featureCont){
+    ATH_CHECK( muLinkInfo.isValid() );
+    const ElementLink<xAOD::L2StandAloneMuonContainer> muEL = muLinkInfo.link;
+
+
+    // basic EDM variables
+    auto saPt = Monitored::Scalar<float>(m_group+"_Pt",-1.0);
+    auto saEta = Monitored::Scalar<float>(m_group+"_Eta",-1.0);
+    auto saPhi = Monitored::Scalar<float>(m_group+"_Phi",-1.0);
+    auto saddr = Monitored::Scalar<int>(m_group+"_saddr",-1.0);
+    auto roiEta = Monitored::Scalar<float>(m_group+"_roiEta",-1.0);
+    auto roiPhi = Monitored::Scalar<float>(m_group+"_roiPhi",-1.0);
+    auto mf_failure = Monitored::Scalar<bool>(m_group+"_mf_failure",false);
+
+    saPt = (*muEL)->pt();
+    saEta = (*muEL)->eta();
+    saPhi = (*muEL)->phi();
+    saddr = (*muEL)->sAddress();
+    roiEta = (*muEL)->roiEta();
+    roiPhi = (*muEL)->roiPhi();
+
+    ATH_MSG_DEBUG("saPt = " << saPt << ", saEta =" << saEta << ", saPhi = " << saPhi << ", saddr = " << saddr);
+    if(fabs(saPt) < ZERO_LIMIT) mf_failure = true;
+
+    fill(m_group, roiEta, roiPhi, mf_failure);
+    if( mf_failure ) continue;
+
+    // define barrel or endcap
+    auto isBarrel = Monitored::Scalar<bool>(m_group+"_isBarrel",false);
+    auto isEndcap = Monitored::Scalar<bool>(m_group+"_isEndcap",false);
+
+    if(saddr == -1)  isEndcap = true;
+    else isBarrel = true;;
+
+    fill(m_group, saPt, saEta, saPhi, saddr, isBarrel, isEndcap);
+
+
+    // define process flow
+    std::vector<int> proc_flow;
+    auto mon_proc_flow = Monitored::Collection(m_group+"_proc_flow", proc_flow);
+
+    bool isL1hitThere               = false;
+    bool isL1emuOkForTriggerPlane   = false;
+    bool isMDThitThereForTriggerPlane = false;
+    bool isMDTFitOkForTriggerPlane    = false;
+    bool isMDTFitOkFor2Plane          = false;
+
+
+    // detector variables
+    // RPC and TGC
+    auto nRPC = Monitored::Scalar<int>(m_group+"_RPC_Pad_N",0);
+    auto TGCMidRhoChi2 = Monitored::Scalar<float>(m_group+"_TGC_Mid_rho_chi2",-1.0);
+    auto TGCMidPhiChi2 = Monitored::Scalar<float>(m_group+"_TGC_Mid_phi_chi2",-1.0);
+    auto nTGCMidRho = Monitored::Scalar<int>(m_group+"_TGC_Mid_rho_N",0);
+    auto nTGCMidPhi = Monitored::Scalar<int>(m_group+"_TGC_Mid_phi_N",0);
+
+    nRPC = (*muEL)->rpcHitLayer().size();
+    TGCMidRhoChi2 = (*muEL)->tgcMidRhoChi2();
+    TGCMidPhiChi2 = (*muEL)->tgcMidPhiChi2();
+    nTGCMidRho = (*muEL)->tgcMidRhoN();
+    nTGCMidPhi = (*muEL)->tgcMidPhiN();
+
+    fill(m_group, nRPC, TGCMidRhoChi2, TGCMidPhiChi2, nTGCMidRho, nTGCMidPhi, isBarrel, isEndcap);
+
+
+    // use process flow
+    if(isBarrel){
+      if( nRPC > 0 ) isL1hitThere = true;
+      float rpcFitMidSlope = (*muEL)->rpcFitMidSlope();
+      if( fabs(rpcFitMidSlope) > ZERO_LIMIT ) isL1emuOkForTriggerPlane = true;
+    }
+    else {
+      if( nTGCMidRho > 0 && nTGCMidPhi > 0 ) isL1hitThere = true;
+      float TGCMid1Z  = (*muEL)->tgcMid1Z();
+      if( fabs(TGCMid1Z) > ZERO_LIMIT ) isL1emuOkForTriggerPlane = true;
+    }
+
+
+    // define inner, middle, and outer
+    int inner  = 0;
+    int middle = 1;
+    int outer  = 2;
+
+    if (isEndcap) {
+      inner  = xAOD::L2MuonParameters::Chamber::EndcapInner;
+      middle = xAOD::L2MuonParameters::Chamber::EndcapMiddle;
+      outer  = xAOD::L2MuonParameters::Chamber::EndcapOuter;
+    } else {
+      inner  = xAOD::L2MuonParameters::Chamber::BarrelInner;
+      middle = xAOD::L2MuonParameters::Chamber::BarrelMiddle;
+      outer  = xAOD::L2MuonParameters::Chamber::BarrelOuter;
+    }
+
+    float sign = 1;
+    if( saPhi < 0 ) sign = -1;
+
+
+    // super point
+    std::vector<float> sp_r, sp_z;
+    sp_r.clear();
+    sp_z.clear();
+
+    auto mon_sp_r= Monitored::Collection(m_group+"_MDTpoints_r", sp_r);
+    auto mon_sp_z= Monitored::Collection(m_group+"_MDTpoints_z", sp_z);
+
+    if( fabs((*muEL)->superPointR(inner)) > ZERO_LIMIT ) {
+      sp_r.push_back( sign * (*muEL)->superPointR(inner) );
+      sp_z.push_back( (*muEL)->superPointZ(inner) );
+    }
+    if( fabs((*muEL)->superPointR(middle)) > ZERO_LIMIT ) {
+      sp_r.push_back( sign * (*muEL)->superPointR(middle) );
+      sp_z.push_back( (*muEL)->superPointZ(middle) );
+    }
+    if( fabs((*muEL)->superPointR(outer)) > ZERO_LIMIT ) {
+      sp_r.push_back( sign * (*muEL)->superPointR(outer) );
+      sp_z.push_back( (*muEL)->superPointZ(outer) );
+    }
+
+    fill(m_group, mon_sp_r, mon_sp_z);
+
+
+    // MDT
+    auto MDTInnChi2 = Monitored::Scalar<float>(m_group+"_MDT_Inn_fit_chi2",-1.0);
+    auto MDTMidChi2 = Monitored::Scalar<float>(m_group+"_MDT_Mid_fit_chi2",-1.0);
+    auto MDTOutChi2 = Monitored::Scalar<float>(m_group+"_MDT_Out_fit_chi2",-1.0);
+    auto n_mdt_hits = Monitored::Scalar<int>(m_group+"_MDT_N",0);
+    auto n_mdt_hits_inner = Monitored::Scalar<int>(m_group+"_MDT_Inn_N",0);
+    auto n_mdt_hits_middle = Monitored::Scalar<int>(m_group+"_MDT_Mid_N",0);
+    auto n_mdt_hits_outer = Monitored::Scalar<int>(m_group+"_MDT_Out_N",0);
+
+    MDTInnChi2 = (*muEL)->superPointChi2(inner);
+    MDTMidChi2 = (*muEL)->superPointChi2(middle);
+    MDTOutChi2 = (*muEL)->superPointChi2(outer);
+
+
+    std::vector<float> res_inn, res_mid, res_out;
+    res_inn.clear();
+    res_mid.clear();
+    res_out.clear();
+
+    auto mon_res_inn = Monitored::Collection(m_group+"_MDT_Inn_residual",res_inn);
+    auto mon_res_mid = Monitored::Collection(m_group+"_MDT_Mid_residual",res_mid);
+    auto mon_res_out = Monitored::Collection(m_group+"_MDT_Out_residual",res_out);
+
+
+    n_mdt_hits = (*muEL)->nMdtHits();
+
+    for (int i_tube=0; i_tube<n_mdt_hits; i_tube++) {
+      float res = (*muEL)->mdtHitResidual(i_tube) / 10 ; // to cm
+      int imr = (*muEL)->mdtHitChamber(i_tube);
+
+      if (imr == inner) {
+        n_mdt_hits_inner++;
+        res_inn.push_back(res);
+      }
+      else if (imr == middle) {
+        n_mdt_hits_middle++;
+        res_mid.push_back(res);
+      }
+      else if (imr == outer) {
+        n_mdt_hits_outer++;
+        res_out.push_back(res);
+      }
+    }
+
+    fill(m_group, MDTInnChi2, MDTMidChi2, MDTOutChi2, n_mdt_hits, n_mdt_hits_inner, n_mdt_hits_middle, n_mdt_hits_outer, mon_res_inn, mon_res_mid, mon_res_out, lb, isBarrel, isEndcap);
+
+
+    // use process flow
+    float MDTInnR = (*muEL)->superPointR(inner);
+    float MDTMidR = (*muEL)->superPointR(middle);
+    float MDTOutR = (*muEL)->superPointR(outer);
+
+    if( n_mdt_hits_middle > 0 ) isMDThitThereForTriggerPlane = true;
+    if( MDTMidR > ZERO_LIMIT ) isMDTFitOkForTriggerPlane = true;
+    if( isMDTFitOkForTriggerPlane && (MDTInnR > ZERO_LIMIT || MDTOutR > ZERO_LIMIT) ) isMDTFitOkFor2Plane  = true;
+
+    proc_flow.push_back(1);
+    if( isL1hitThere )                 proc_flow.push_back(2);
+    if( isL1emuOkForTriggerPlane )     proc_flow.push_back(3);
+    if( isMDThitThereForTriggerPlane ) proc_flow.push_back(4);
+    if( isMDTFitOkForTriggerPlane )    proc_flow.push_back(5);
+    if( isMDTFitOkFor2Plane )          proc_flow.push_back(6);
+
+    fill(m_group, mon_proc_flow);
+
+
+    // matching to offline
+    const float DR_cut = 0.4;
+    const xAOD::Muon* RecMuonCB = m_matchTool->matchOff(ctx, saEta, saPhi, DR_cut);
+    if(RecMuonCB == nullptr) continue;
+
+    std::vector<float> res_inn_OffMatch = res_inn;
+    std::vector<float> res_mid_OffMatch = res_mid;
+    std::vector<float> res_out_OffMatch = res_out;
+
+    auto mon_res_inn_OffMatch = Monitored::Collection(m_group+"_MDT_Inn_residual_OffMatch",res_inn_OffMatch);
+    auto mon_res_mid_OffMatch = Monitored::Collection(m_group+"_MDT_Mid_residual_OffMatch",res_mid_OffMatch);
+    auto mon_res_out_OffMatch = Monitored::Collection(m_group+"_MDT_Out_residual_OffMatch",res_out_OffMatch);
+
+    fill(m_group, mon_res_inn_OffMatch, mon_res_mid_OffMatch, mon_res_out_OffMatch, isBarrel, isEndcap);
+
   }
 
-  // variables
-  auto saPt = Monitored::Scalar<double>("saPt",-1.0);
-  auto saEta = Monitored::Scalar<double>("saEta",-1.0);
-  auto saPhi = Monitored::Scalar<double>("saPhi",-1.0);
+  return StatusCode::SUCCESS;
+}
+
+
+
+StatusCode L2MuonSAMonMT :: fillVariablesPerOfflineMuonPerChain(const EventContext&, const xAOD::Muon* mu, const std::string &chain) const {
+
+  ATH_MSG_DEBUG ("Filling histograms for " << name() << "...");
 
-  for (const auto& l2sa : *muonSAs) {
-    saPt = l2sa->pt();
-    saEta = l2sa->eta();
-    saPhi = l2sa->phi();
-    fill("L2MuonSAMonMT", saPt, saEta, saPhi);
+  const float ZERO_LIMIT = 0.00001;
+  const float DR_MATCHED = 0.25;
+
+
+  // offline muon variables
+  auto offEta = Monitored::Scalar<float>(m_group+"_offEta",0.);
+  auto offPt_signed = Monitored::Scalar<float>(m_group+"_offPt_signed",0.);
+  offEta = mu->eta();
+
+  float offPt = mu->pt()/1e3;
+  float offPhi = mu->phi();
+  float offCharge = mu->charge();
+  offPt_signed = offPt * offCharge;
+
+  // dR wrt offline
+  float match_dR = 1000.;
+  const xAOD::L2StandAloneMuon *samu = m_matchTool->matchSA(mu, chain, match_dR);
+  auto dRmin = Monitored::Scalar<float>(m_group+"_dRmin",1000.);
+  if(samu != nullptr) dRmin = xAOD::P4Helpers::deltaR(mu, samu, false); 
+
+  fill(m_group, dRmin);
+  if( dRmin > DR_MATCHED ) return StatusCode::SUCCESS; // not matched to L2MuonSA
+
+  
+  // L1 RoI wrt offline 
+  float saPt  = samu->pt();
+  float roiEta = samu->roiEta();
+  float roiPhi = samu->roiPhi();
+
+  auto roidEta = Monitored::Scalar<float>(m_group+"_initialRoI_dEta",0.);
+  auto roidPhi = Monitored::Scalar<float>(m_group+"_initialRoI_dPhi",0.);
+  auto roidR = Monitored::Scalar<float>(m_group+"_initialRoI_dR",0.);
+
+  roidEta = roiEta - offEta;
+  roidPhi = xAOD::P4Helpers::deltaPhi(offPhi, roiPhi);
+  roidR = sqrt(roidEta*roidEta + roidPhi*roidPhi);
+  
+  fill(m_group, roidEta, roidPhi, roidR, offEta);
+
+
+  // pt resolution, inverse pt resolution
+  auto ptresol = Monitored::Scalar<float>(m_group+"_ptresol",0.);
+  auto invptresol = Monitored::Scalar<float>(m_group+"_invptresol",0.);
+  if ( fabs(offPt) > ZERO_LIMIT && fabs(saPt) > ZERO_LIMIT ) {
+    ptresol = fabs(saPt)/fabs(offPt) - 1.;
+    invptresol = (1./(offPt * offCharge) - 1./saPt) / (1./(offPt * offCharge));
   }
 
 
+  // inverse pt resolution depends on charge of offline muon
+  std::vector<float> invptresol_pos, invptresol_neg;
+  invptresol_pos.clear();
+  invptresol_neg.clear();
+
+  auto mon_invptresol_pos = Monitored::Collection(m_group+"_invptresol_pos",invptresol_pos);
+  auto mon_invptresol_neg = Monitored::Collection(m_group+"_invptresol_neg",invptresol_neg);
+
+  if( offCharge > 0. ) invptresol_pos.push_back(invptresol);
+  else invptresol_neg.push_back(invptresol);
+
+
+  // region variables
+  const float ETA_OF_BARREL   = 1.05;
+  const float ETA_OF_ENDCAP1   = 1.5;
+  const float ETA_OF_ENDCAP2   = 2.0;
+  const float ETA_OF_ENDCAP3   = 2.5;
+
+  auto isBarrel = Monitored::Scalar<bool>(m_group+"_isBarrel",false);
+  auto isBarrelA = Monitored::Scalar<bool>(m_group+"_isBarrelA",false);
+  auto isBarrelC = Monitored::Scalar<bool>(m_group+"_isBarrelC",false);
+  auto isEndcapA = Monitored::Scalar<bool>(m_group+"_isEndcapA",false);
+  auto isEndcapC = Monitored::Scalar<bool>(m_group+"_isEndcapC",false);
+  auto isEndcap1 = Monitored::Scalar<bool>(m_group+"_isEndcap1",false);
+  auto isEndcap2 = Monitored::Scalar<bool>(m_group+"_isEndcap2",false);
+  auto isEndcap3 = Monitored::Scalar<bool>(m_group+"_isEndcap3",false);
+  auto isEndcap1A = Monitored::Scalar<bool>(m_group+"_isEndcap1A",false);
+  auto isEndcap2A = Monitored::Scalar<bool>(m_group+"_isEndcap2A",false);
+  auto isEndcap3A = Monitored::Scalar<bool>(m_group+"_isEndcap3A",false);
+  auto isEndcap1C = Monitored::Scalar<bool>(m_group+"_isEndcap1C",false);
+  auto isEndcap2C = Monitored::Scalar<bool>(m_group+"_isEndcap2C",false);
+  auto isEndcap3C = Monitored::Scalar<bool>(m_group+"_isEndcap3C",false);
+
+  // offline pt variables
+  auto pt4to6 = Monitored::Scalar<bool>(m_group+"_pt4to6",false);
+  auto pt6to8 = Monitored::Scalar<bool>(m_group+"_pt6to8",false);
+  auto ptover8 = Monitored::Scalar<bool>(m_group+"_ptover8",false);
+
+
+  // define region
+  if( fabs(offEta) < ETA_OF_BARREL ) {
+    if( offEta > 0. ) isBarrelA = true;
+    else isBarrelC = true;
+  }
+  else{
+    if( offEta > 0. ) isEndcapA = true;
+    else isEndcapC = true;
+  }
+
+
+  if( fabs(offEta) < ETA_OF_BARREL ){
+    isBarrel = true;
+    if( offEta > 0. ) isBarrelA = true;
+    else isBarrelC = true;
+  }
+  else if ( fabs(offEta) < ETA_OF_ENDCAP1 ){
+    isEndcap1 = true;
+    if( offEta > 0. ) isEndcap1A = true;
+    else isEndcap1C = true;
+  }
+  else if ( fabs(offEta) < ETA_OF_ENDCAP2 ){
+    isEndcap2 = true;
+    if( offEta > 0. ) isEndcap2A = true;
+    else isEndcap2C = true;
+  }
+  else if ( fabs(offEta) < ETA_OF_ENDCAP3 ){
+    isEndcap3 = true;
+    if( offEta > 0. ) isEndcap3A = true;
+    else isEndcap3C = true;
+  }
+
+
+  if( fabs(offPt) > 4 ){
+    if( fabs(offPt) < 6 ) pt4to6 = true;
+    else if( fabs(offPt) < 8 ) pt6to8 = true;
+    else ptover8 = true;
+  }
+
+
+  fill(m_group, ptresol, offPt_signed, offEta, isBarrel, isEndcap1, isEndcap2, isEndcap3, isBarrelA, isBarrelC, isEndcapA, isEndcapC, pt4to6, pt6to8, ptover8);  
+  fill(m_group, mon_invptresol_pos, mon_invptresol_neg, isBarrelA, isBarrelC, isEndcap1A, isEndcap2A, isEndcap3A, isEndcap1C, isEndcap2C, isEndcap3C);
+
+  
   return StatusCode::SUCCESS;
 }
-
diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/L2MuonSAMonMT.h b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/L2MuonSAMonMT.h
index 97ca033244dc4bfcf1710685392de51b77685c3d..bde836feef5fd2173d5c9e5a042a13e09d583ebb 100644
--- a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/L2MuonSAMonMT.h
+++ b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/L2MuonSAMonMT.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRIGMUONMONITORINGMT_L2MUONSAMONMT_H
@@ -8,6 +8,8 @@
 #include "TrigMuonMonitorAlgorithm.h"
 #include "xAODTrigMuon/L2StandAloneMuonContainer.h"
 
+class MuonMatchingTool;
+
 /*
 This is a class for monitoring L2MuonSA.
  */
@@ -19,12 +21,12 @@ class L2MuonSAMonMT : public TrigMuonMonitorAlgorithm{
   virtual StatusCode initialize() override;
 
  protected:
-  virtual StatusCode fillVariables(const EventContext &ctx) const override;
+  virtual StatusCode fillVariablesPerChain(const EventContext &ctx, const std::string &chain) const override;
+  virtual StatusCode fillVariablesPerOfflineMuonPerChain(const EventContext& ctx, const xAOD::Muon* mu, const std::string &chain) const override;
 
+  Gaudi::Property<std::string> m_group {this, "Group", "", "Histogram group"};
 
- private:
-  SG::ReadHandleKey<xAOD::L2StandAloneMuonContainer> m_L2MuonSAContainerKey {this, "L2StandAloneMuonContainerName", "HLT_MuonL2SAInfo", "L2MuonSA container"};
-  
+  ToolHandle<MuonMatchingTool> m_matchTool {this, "MuonMatchingTool", "MuonMatchingTool", "Tool for matching offline and online objects"};
 
 };
 
diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.cxx b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.cxx
index 062109d0afe66ee6f126880a03176a231d740cd8..0c8d8e5742fba344e823a8277bee91ca518cfccc 100644
--- a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.cxx
+++ b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.cxx
@@ -1,14 +1,11 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "MuonMatchingTool.h"
 #include "xAODTrigger/MuonRoIContainer.h"
 
-static const InterfaceID IID_MuonMatchingTool("IID_MuonMatchingTool", 1, 0);
-
-const InterfaceID& MuonMatchingTool::interfaceID() { return IID_MuonMatchingTool; }
-
+const static double ZERO_LIMIT = 1.e-5;
 
 MuonMatchingTool :: MuonMatchingTool(const std::string& type, const std::string& name, const IInterface*  parent)
   : AthAlgTool(type, name, parent)
@@ -21,74 +18,100 @@ StatusCode MuonMatchingTool :: initialize(){
   if(m_use_extrapolator){
     ATH_CHECK( m_extrapolator.retrieve() );
   }
+  ATH_CHECK( m_MuonContainerKey.initialize() );
+  ATH_CHECK( m_MuonRoIContainerKey.initialize() );
 
   return StatusCode::SUCCESS;
 }
 
 
-template<>
-std::tuple<double,double> MuonMatchingTool :: trigPosForMatch<xAOD::L2StandAloneMuon>(const xAOD::L2StandAloneMuon *trig) const {
-  return std::forward_as_tuple(trig->roiEta(), trig->roiPhi()); 
+const Amg::Vector3D MuonMatchingTool :: offlineMuonAtPivot(const xAOD::Muon* mu) const{
+  const xAOD::TrackParticle* track = mu->primaryTrackParticle();
+  std::unique_ptr<const Trk::TrackParameters> extPars(extTrackToPivot(track));
+  return extPars ? extPars->position() : Amg::Vector3D(0.,0.,0.);
 }
 
+
 template<>
-std::tuple<double,double> MuonMatchingTool :: offlinePosForMatch<xAOD::L2StandAloneMuonContainer>(const xAOD::Muon *mu) const {
-  double eta = mu->eta();
-  double phi = mu->phi();
-  if(m_use_extrapolator){
-    const xAOD::TrackParticle* track = mu->primaryTrackParticle();
-    const Trk::TrackParameters* extPar = extTrackToPivot(track);
-    if(extPar){
-      ATH_MSG_DEBUG("exrapolation successful");
-      eta = extPar->position().eta();
-      phi = extPar->position().phi();
-      delete extPar; extPar = nullptr;
-    }
-  }
-  return std::forward_as_tuple(eta, phi);
+std::tuple<bool, double,double> MuonMatchingTool :: trigPosForMatch<xAOD::L2StandAloneMuon>(const xAOD::L2StandAloneMuon *trig){
+  return std::forward_as_tuple(true, trig->roiEta(), trig->roiPhi());
 }
 
 
-StatusCode MuonMatchingTool :: matchEF(  const xAOD::Muon *mu, std::string trig, bool &pass) const {
+std::tuple<bool, double,double> MuonMatchingTool :: trigPosForMatchEFSA(const xAOD::Muon *trig){
+  const xAOD::TrackParticle* mooreMuon = trig->trackParticle(xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle);
+  return mooreMuon ? std::forward_as_tuple(true, mooreMuon->eta(), mooreMuon->phi()) : std::forward_as_tuple(false, 0., 0.);
+}
+
+
+const xAOD::Muon* MuonMatchingTool :: matchEFSA(  const xAOD::Muon *mu, std::string trig, bool &pass) const {
+  ATH_MSG_DEBUG("MuonMonitoring::matchEFSA()");
+  float reqdR = 0.03;
+  return match<xAOD::Muon>( mu, trig, reqdR, pass, &MuonMatchingTool::trigPosForMatchEFSA);
+}
+
+
+const xAOD::Muon* MuonMatchingTool :: matchEF(  const xAOD::Muon *mu, std::string trig, bool &pass) const {
   ATH_MSG_DEBUG("MuonMonitoring::matchEF()");
-  return match<xAOD::MuonContainer>( mu, trig, 0.03, pass);
+  float reqdR = 0.03;
+  return match<xAOD::Muon>( mu, trig, reqdR, pass);
 }
 
 
+const xAOD::L2StandAloneMuon* MuonMatchingTool :: matchSA(  const xAOD::Muon *mu, std::string trig, bool &pass) const {
+  ATH_MSG_DEBUG("MuonMonitoring::matchSA()");
+  float reqdR = 0.25;
+  if(m_use_extrapolator){
+    reqdR = reqdRL1byPt(mu->pt());
+    const Amg::Vector3D extPos = offlineMuonAtPivot(mu);
+    if(extPos.norm()>ZERO_LIMIT){
+      return match<xAOD::L2StandAloneMuon>( &extPos, trig, reqdR, pass);
+    }
+  }
+  return match<xAOD::L2StandAloneMuon>( mu, trig, reqdR, pass);
+}
 
-StatusCode MuonMatchingTool :: matchSA(  const xAOD::Muon *mu, std::string trig, bool &pass) const {
+const xAOD::L2StandAloneMuon* MuonMatchingTool :: matchSA(  const xAOD::Muon *mu, std::string trig, float &dR) const {
   ATH_MSG_DEBUG("MuonMonitoring::matchSA()");
-  double reqdR = 0.25;
-  if(m_use_extrapolator) reqdR = reqdRL1byPt(mu->pt());
-  return match<xAOD::L2StandAloneMuonContainer>( mu, trig, reqdR, pass);
+  bool pass = false;
+  return match<xAOD::L2StandAloneMuon>( mu, trig, dR, pass);
 }
 
 
-StatusCode MuonMatchingTool :: matchCB(  const xAOD::Muon *mu, std::string trig, bool &pass) const {
+const xAOD::L2CombinedMuon* MuonMatchingTool :: matchCB(  const xAOD::Muon *mu, std::string trig, bool &pass) const {
   ATH_MSG_DEBUG("MuonMonitoring::matchCB()");
-  return match<xAOD::L2CombinedMuonContainer>( mu, trig, 0.03, pass);
+  float reqdR = 0.03;
+  return match<xAOD::L2CombinedMuon>( mu, trig, reqdR, pass);
 }
 
 
-StatusCode MuonMatchingTool :: matchL1(  const xAOD::Muon *mu, SG::ReadHandle<xAOD::MuonRoIContainer> &murois, std::string trig, bool &pass) const {
+const xAOD::MuonRoI* MuonMatchingTool :: matchL1(  const xAOD::Muon *mu, const EventContext& ctx, std::string trig, bool &pass) const {
 
   double refEta = mu->eta();
   double refPhi = mu->phi();
   double reqdR = 0.25;
   if(m_use_extrapolator){
-    const xAOD::TrackParticle* track = mu->primaryTrackParticle();
-    const Trk::TrackParameters* extPar = extTrackToPivot(track);
-    if(extPar){
-      ATH_MSG_DEBUG("exrapolation successful");
-      refEta = extPar->position().eta();
-      refPhi = extPar->position().phi();
-      reqdR = reqdRL1byPt(mu->pt());
-      delete extPar; extPar = nullptr;
+    reqdR = reqdRL1byPt(mu->pt());
+    const Amg::Vector3D extPos = offlineMuonAtPivot(mu);
+    if(extPos.norm()>ZERO_LIMIT){
+      refEta = extPos.eta();
+      refPhi = extPos.phi();
     }
   }
 
   pass = false;
-  for(const auto &roi : *murois){
+  const xAOD::MuonRoI *closest = nullptr;
+  SG::ReadHandle<xAOD::MuonRoIContainer> rois(m_MuonRoIContainerKey, ctx);
+  if (! rois.isValid() ) {
+    ATH_MSG_ERROR("evtStore() does not contain xAOD::MuonRoI collection with name "<< m_MuonRoIContainerKey);
+    return closest;
+  }
+  if(rois->getConstStore()==nullptr){
+    xAOD::MuonRoIContainer *ncptr = const_cast<xAOD::MuonRoIContainer*>(rois.get());
+    ncptr->setStore(DataLink<SG::IConstAuxStore>(m_MuonRoIContainerKey.key()+"Aux.", ctx));
+  }
+
+  for(const auto &roi : *rois){
     double roiEta = roi->eta();
     double roiPhi = roi->phi();
     int roiThr = roi->getThrNumber();
@@ -100,14 +123,43 @@ StatusCode MuonMatchingTool :: matchL1(  const xAOD::Muon *mu, SG::ReadHandle<xA
     if( dR<reqdR && roiThr>=L1ItemSTI(trig)){
       reqdR = dR;
       pass = true;
+      closest = roi;
       ATH_MSG_DEBUG("* L1 muon eta=" << roiEta << " phi=" << roiPhi  << " dR=" << dR <<  " isPassed=true" ); 
     }
   }
 
-  return StatusCode::SUCCESS;
+  return closest;
 }
 
 
+const xAOD::Muon* MuonMatchingTool :: matchOff( const EventContext& ctx, float trigEta, float trigPhi, float DR_cut) const {
+
+  const xAOD::Muon *muon = nullptr;
+
+  SG::ReadHandle<xAOD::MuonContainer> muons(m_MuonContainerKey, ctx);
+  if (! muons.isValid() ) {
+    ATH_MSG_ERROR("evtStore() does not contain muon Collection with name "<< m_MuonContainerKey);
+    return muon;
+  }
+
+  for(const auto &mu : *muons){
+    float offEta = mu->eta();
+    float offPhi = mu->phi();
+
+    float deta = offEta - trigEta;
+    float dphi = xAOD::P4Helpers::deltaPhi(offPhi, trigPhi);
+    double dR = sqrt(deta*deta + dphi*dphi);
+
+    if(dR < DR_cut){
+      DR_cut = dR;
+      muon = mu;
+      ATH_MSG_DEBUG("* Trigger muon eta=" << trigEta << " phi=" << trigPhi  << " offEta=" << offEta << " offPhi=" << offPhi << " dR=" << dR);
+    }
+  }  
+
+  return muon;
+}
+
 
 double MuonMatchingTool :: FermiFunction(double x, double x0, double w) const {
   return 1/(1+TMath::Exp(-10*(x-x0)/w));
diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.h b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.h
index 92e2a5ccebaf2dd2727501fdaff94db240d2d2b4..8471246d71280964288357de4aecb259278be4fd 100644
--- a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.h
+++ b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRIGMUONMONITORINGMT_MUONMATCHINGTOOL_H
@@ -24,7 +24,6 @@
 class MuonMatchingTool : public AthAlgTool {
 
  public:
-  static const InterfaceID& interfaceID();
   MuonMatchingTool(const std::string& type, const std::string &name, const IInterface* parent);
 
   virtual StatusCode initialize() override;
@@ -44,10 +43,14 @@ class MuonMatchingTool : public AthAlgTool {
 
 
 
-  StatusCode matchL1(const xAOD::Muon *mu, SG::ReadHandle<xAOD::MuonRoIContainer> &murois, std::string trigger, bool &pass) const;
-  StatusCode matchSA(const xAOD::Muon *mu, std::string trigger, bool &pass) const;
-  StatusCode matchCB(const xAOD::Muon *mu, std::string trigger, bool &pass) const;
-  StatusCode matchEF(const xAOD::Muon *mu, std::string trigger, bool &pass) const;
+  const xAOD::MuonRoI* matchL1(const xAOD::Muon *mu, const EventContext& ctx, std::string trigger, bool &pass) const;
+  const xAOD::L2StandAloneMuon* matchSA(const xAOD::Muon *mu, std::string trigger, bool &pass) const;
+  const xAOD::L2StandAloneMuon* matchSA(const xAOD::Muon *mu, std::string trigger, float &dR) const;
+  const xAOD::L2CombinedMuon* matchCB(const xAOD::Muon *mu, std::string trigger, bool &pass) const;
+  const xAOD::Muon* matchEFSA(const xAOD::Muon *mu, std::string trigger, bool &pass) const;
+  const xAOD::Muon* matchEF(const xAOD::Muon *mu, std::string trigger, bool &pass) const;
+
+  const xAOD::Muon* matchOff( const EventContext& ctx, float trigEta, float trigPhi, float DR_cut) const;
 
   const Trk::TrackParameters* extTrackToPivot(const xAOD::TrackParticle *track) const;
   const Trk::TrackParameters* extTrackToTGC(const xAOD::TrackParticle *track) const;
@@ -58,13 +61,19 @@ class MuonMatchingTool : public AthAlgTool {
 
  private:
   // private methods
-  // Template methods that perform different matching schemes for T=xAOD::L2StandAloneMuon, xAOD::L2CombinedMuon and xAOD::Muon (EF).
   // See MuonMatchingTool.cxx for specialization and MuonMatchingTool.icc for implementation
-  template<class T> inline std::tuple<double,double> trigPosForMatch(const T *trig) const;
-  template<class T> inline std::tuple<double,double> offlinePosForMatch(const xAOD::Muon *mu) const;
-  template<class T> StatusCode match(const xAOD::Muon *mu, std::string trigger, double reqdR, bool &pass) const;
+  template<class T, class OFFL> const T* match(const OFFL *offl, std::string trigger, float &reqdR, bool &pass,
+				   std::tuple<bool,double,double> (*trigPosForMatchFunc)(const T*) = &MuonMatchingTool::trigPosForMatch<T>) const;
+  const Amg::Vector3D offlineMuonAtPivot(const xAOD::Muon *mu) const;
   double FermiFunction(double x, double x0, double w) const;
 
+  // static methods
+  // Template methods that perform different matching schemes for T=xAOD::L2StandAloneMuon, xAOD::L2CombinedMuon and xAOD::Muon (EF).
+  template<class T> static inline std::tuple<bool,double,double> trigPosForMatch(const T *trig);
+  static inline std::tuple<bool,double,double> trigPosForMatchEFSA(const xAOD::Muon *trig);
+  
+  SG::ReadHandleKey<xAOD::MuonRoIContainer> m_MuonRoIContainerKey {this, "MuonRoIContainerName", "LVL1MuonRoIs", "Level 1 muon container"};
+  SG::ReadHandleKey<xAOD::MuonContainer> m_MuonContainerKey {this, "MuonContainerName", "Muons", "Offline muon container"};
 
   // properties
   Gaudi::Property<bool> m_use_extrapolator {this, "UseExtrapolator", false, "Flag to enable the extrapolator for matching offline and trigger muons"};
diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.icc b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.icc
index 83bf382f8548a69361f107c5f23b9bd445428f57..d2d2c35f28be4be11f6a69493775bc6bec39d666 100644
--- a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.icc
+++ b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.icc
@@ -1,30 +1,32 @@
 /* -*- mode:c++ -*-
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 
-template<class T> std::tuple<double,double> MuonMatchingTool :: trigPosForMatch(const T *trig) const { 
-  return std::forward_as_tuple(trig->eta(), trig->phi()); 
-}
-
-template<class T> std::tuple<double,double> MuonMatchingTool :: offlinePosForMatch(const xAOD::Muon *mu) const { 
-  return std::forward_as_tuple(mu->eta(), mu->phi());
+template<class T> std::tuple<bool,double,double> MuonMatchingTool :: trigPosForMatch(const T *trig) {
+  return std::forward_as_tuple(true, trig->eta(), trig->phi());
 }
 
 
-template<class T>
-StatusCode MuonMatchingTool :: match(const xAOD::Muon* mu, std::string trig, double reqdR, bool &pass) const {
+template<class T, class OFFL>
+const T* MuonMatchingTool :: match(const OFFL* offl, std::string trig, float &reqdR, bool &pass,
+                                   std::tuple<bool,double,double> (*trigPosForMatchFunc)(const T*)) const {
 
   ATH_MSG_DEBUG("MuonMonitoring::match<T>");
+
+  using CONTAINER = DataVector<T>;
   
-  const auto [offlEta, offlPhi] = offlinePosForMatch<T>(mu);
+  double offlEta = offl->eta();
+  double offlPhi = offl->phi();
 
-  std::vector< TrigCompositeUtils::LinkInfo<T> > featureCont = m_trigDec->features<T>( trig, TrigDefs::includeFailedDecisions );
-  for(const TrigCompositeUtils::LinkInfo<T>& featureLinkInfo : featureCont){
-    ATH_CHECK( featureLinkInfo.isValid() );
-    const ElementLink<T> link = featureLinkInfo.link;
+  std::vector< TrigCompositeUtils::LinkInfo<CONTAINER> > featureCont = m_trigDec->features<CONTAINER>( trig, TrigDefs::includeFailedDecisions );
+  const T* ptr = nullptr;
+  for(const TrigCompositeUtils::LinkInfo<CONTAINER>& featureLinkInfo : featureCont){
+    if ( !featureLinkInfo.isValid() ) continue;
+    const ElementLink<CONTAINER> link = featureLinkInfo.link;
 
-    const auto [trigEta, trigPhi] = trigPosForMatch(*link);
+    const auto [status, trigEta, trigPhi] = trigPosForMatchFunc(*link);
+    if(!status) continue;
     double deta = offlEta - trigEta;
     double dphi = xAOD::P4Helpers::deltaPhi(offlPhi, trigPhi);
     double dR = sqrt(deta*deta + dphi*dphi);
@@ -33,12 +35,13 @@ StatusCode MuonMatchingTool :: match(const xAOD::Muon* mu, std::string trig, dou
     if( dR<reqdR ){
       reqdR = dR;
       pass = ( featureLinkInfo.state == TrigCompositeUtils::ActiveState::ACTIVE );
-      ATH_MSG_DEBUG("* Trigger muon eta=" << trigEta << " phi=" << trigPhi  << " pt=" << (*link)->pt() << " dR=" << dR <<  " isPassed=" << pass);
+      ptr = *link.cptr();
+      ATH_MSG_DEBUG("* Trigger muon eta=" << trigEta << " phi=" << trigPhi  << " pt=" << ptr->pt() << " dR=" << dR <<  " isPassed=" << pass);
     }
   }
 
 
-  return StatusCode::SUCCESS;
+  return ptr;
 
 }
 
diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/TrigMuonEfficiencyMonMT.cxx b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/TrigMuonEfficiencyMonMT.cxx
index 6ebc8c59fd537337213b42ec56fc2379517d8056..d0af1bf86fd1e7d4d55a0a7e19da3ec583696f5a 100644
--- a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/TrigMuonEfficiencyMonMT.cxx
+++ b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/TrigMuonEfficiencyMonMT.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TrigMuonEfficiencyMonMT.h"
@@ -15,7 +15,6 @@ TrigMuonEfficiencyMonMT :: TrigMuonEfficiencyMonMT(const std::string& name, ISvc
 StatusCode TrigMuonEfficiencyMonMT :: initialize(){
   StatusCode sc = TrigMuonMonitorAlgorithm::initialize();
   ATH_CHECK( m_matchTool.retrieve() );
-  ATH_CHECK( m_MuonRoIContainerKey.initialize() );
 
   // Pairing HLT and L1
   unsigned int nchains = m_monitored_chains.size();
@@ -61,17 +60,6 @@ StatusCode TrigMuonEfficiencyMonMT :: fillVariablesPerOfflineMuonPerChain(const
   auto muEta = Monitored::Scalar<float>(m_group+"_muEta");
   auto muPhi = Monitored::Scalar<float>(m_group+"_muPhi");
 
-
-  SG::ReadHandle<xAOD::MuonRoIContainer> rois(m_MuonRoIContainerKey, ctx);
-  if (! rois.isValid() ) {
-    ATH_MSG_ERROR("evtStore() does not contain xAOD::MuonRoI collection with name "<< m_MuonRoIContainerKey);
-    return StatusCode::FAILURE;
-  }
-  if(rois->getConstStore()==nullptr){
-    xAOD::MuonRoIContainer *ncptr = const_cast<xAOD::MuonRoIContainer*>(rois.get());
-    ncptr->setStore(DataLink<SG::IConstAuxStore>(m_MuonRoIContainerKey.key()+"Aux.", ctx));
-  }
-
   muPt = mu->pt()/1e3;
   muEta = mu->eta();
   muPhi = mu->phi();
@@ -79,12 +67,13 @@ StatusCode TrigMuonEfficiencyMonMT :: fillVariablesPerOfflineMuonPerChain(const
   auto L1pass = Monitored::Scalar<bool>(m_group+"_L1pass",false);
   auto L2SApass = Monitored::Scalar<bool>(m_group+"_L2SApass",false);
   auto L2CBpass = Monitored::Scalar<bool>(m_group+"_L2CBpass",false);
-  auto EFpass = Monitored::Scalar<bool>(m_group+"_EFpass",false);
+  auto EFSApass = Monitored::Scalar<bool>(m_group+"_EFSApass",false);
+  auto EFCBpass = Monitored::Scalar<bool>(m_group+"_EFCBpass",false);
 
 
   if(m_doL1){
     bool activestate = false;
-    ATH_CHECK( m_matchTool->matchL1(mu, rois, m_l1seeds.at(chain), activestate) );
+    m_matchTool->matchL1(mu, ctx, m_l1seeds.at(chain), activestate);
     L1pass = activestate;
   } else {
     L1pass = true;
@@ -94,7 +83,7 @@ StatusCode TrigMuonEfficiencyMonMT :: fillVariablesPerOfflineMuonPerChain(const
   if(L1pass){
     if(m_doL2SA){
       bool activestate = false;
-      ATH_CHECK( m_matchTool->matchSA(mu, chain, activestate) );
+      m_matchTool->matchSA(mu, chain, activestate);
       L2SApass = activestate;
     } else {
       L2SApass = true;
@@ -105,7 +94,7 @@ StatusCode TrigMuonEfficiencyMonMT :: fillVariablesPerOfflineMuonPerChain(const
   if(L2SApass){
     if(m_doL2CB){
       bool activestate = false;
-      ATH_CHECK( m_matchTool->matchCB(mu, chain, activestate) );
+      m_matchTool->matchCB(mu, chain, activestate);
       L2CBpass = activestate;
     } else {
       L2CBpass = true;
@@ -116,22 +105,34 @@ StatusCode TrigMuonEfficiencyMonMT :: fillVariablesPerOfflineMuonPerChain(const
   if(L2CBpass){
     if(m_doEF){
       bool activestate = false;
-      ATH_CHECK( m_matchTool->matchEF(mu, chain, activestate) );
-      EFpass = activestate;
+      m_matchTool->matchEFSA(mu, chain, activestate);
+      EFSApass = activestate;
     } else {
-      EFpass = true;
+      EFSApass = true;
     }
   }
-  ATH_MSG_DEBUG("L1pass:" << L1pass << " L2SAPass:" << L2SApass << " L2CBpass:" << L2CBpass << " EFpass:" << EFpass);
+
+
+  if(EFSApass){
+    if(m_doEF){
+      bool activestate = false;
+      m_matchTool->matchEF(mu, chain, activestate);
+      EFCBpass = activestate;
+    } else {
+      EFCBpass = true;
+    }
+  }
+
+  ATH_MSG_DEBUG("L1pass:" << L1pass << " L2SAPass:" << L2SApass << " L2CBpass:" << L2CBpass << " EFSApass:" << EFSApass <<  " EFCBpass:" << EFCBpass);
 
 
   //// Cuts based on the offline muon's features ////
   // Inclusive
-  fill(m_group, muPt, L1pass, L2SApass, L2CBpass, EFpass);
+  fill(m_group, muPt, L1pass, L2SApass, L2CBpass, EFSApass, EFCBpass);
 
   // Plateau
   if(muPt>m_thresholds.at(chain)){
-    fill(m_group, muEta, muPhi,  L1pass, L2SApass, L2CBpass, EFpass);
+    fill(m_group, muEta, muPhi, L1pass, L2SApass, L2CBpass, EFSApass, EFCBpass);
   }
 
 
@@ -189,8 +190,8 @@ StatusCode TrigMuonEfficiencyMonMT :: selectMuonsTagAndProbe(SG::ReadHandle<xAOD
     bool pass1 = false;
     bool pass2 = false;
 
-    ATH_CHECK(m_matchTool->matchEF(dimu.first, m_tag_trig, pass1));
-    ATH_CHECK(m_matchTool->matchEF(dimu.second, m_tag_trig, pass2));
+    m_matchTool->matchEF(dimu.first, m_tag_trig, pass1);
+    m_matchTool->matchEF(dimu.second, m_tag_trig, pass2);
     
     if(pass1){
       if(std::find(probes.begin(), probes.end(), dimu.second)==probes.end()){
diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/TrigMuonEfficiencyMonMT.h b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/TrigMuonEfficiencyMonMT.h
index 1a33fd0b962adb3950172ee3fa1c1ad2e6da536f..d654241d3494514700a4f88a2f3acdd0219a5092 100644
--- a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/TrigMuonEfficiencyMonMT.h
+++ b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/TrigMuonEfficiencyMonMT.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRIGMUONMONITORINGMT_TRIGMUONEFFICIENCYMONMT_H
@@ -33,9 +33,6 @@ class TrigMuonEfficiencyMonMT : public TrigMuonMonitorAlgorithm{
   // tools
   ToolHandle<MuonMatchingTool> m_matchTool {this, "MuonMatchingTool", "MuonMatchingTool", "Tool for matching offline and online objects"};
 
-  // ReadHandles
-  SG::ReadHandleKey<xAOD::MuonRoIContainer> m_MuonRoIContainerKey {this, "MuonRoIContainerName", "LVL1MuonRoIs", "Level 1 muon container"};
-
   // properties
   Gaudi::Property<std::string> m_eff_method {this, "Method", "", "Method to measure efficiency e.g. \"TagAndProbe\", \"Bootstrap\""};
   Gaudi::Property<std::string> m_event_trigger {this, "EventTrigger", "", "Trigger used to select events"};
diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/TrigMuonMonitorAlgorithm.h b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/TrigMuonMonitorAlgorithm.h
index b89fca720f25d558f0a063672d47bd6e93107c7b..1297ec895ddf4298d56146c521f208ef70592082 100644
--- a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/TrigMuonMonitorAlgorithm.h
+++ b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/TrigMuonMonitorAlgorithm.h
@@ -42,7 +42,7 @@ class TrigMuonMonitorAlgorithm : public AthMonitorAlgorithm {
   // Properties
   Gaudi::Property<std::vector<std::string> > m_monitored_chains {this, "MonitoredChains", {}, "Trigger chains that are monitored"};
   Gaudi::Property<int> m_muontype {this, "MuonType", xAOD::Muon::MuonType::Combined, "MuonType used for monitoring"};
-  
+
 
 };
 
diff --git a/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt b/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt
index d746ccc55ce4bbbe92cc756065064fcae0c67904..f8965dddb8030200d62a8e397ff3972f5ef14040 100644
--- a/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt
+++ b/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt
@@ -4,7 +4,12 @@
 atlas_subdir( DecisionHandling )
 
 atlas_add_library( DecisionHandlingLib
-                   src/*.cxx
+                   src/ComboHypo.cxx
+                   src/ComboHypoToolBase.cxx
+                   src/DumpDecisions.cxx
+                   src/HLTIdentifier.cxx
+                   src/HypoBase.cxx
+                   src/InputMakerBase.cxx
                    PUBLIC_HEADERS DecisionHandling
                    LINK_LIBRARIES AthenaBaseComps AthenaMonitoringKernelLib GaudiKernel StoreGateLib TrigCompositeUtilsLib TrigCostMonitorMTLib TrigSteeringEvent TrigTimeAlgsLib
                    PRIVATE_LINK_LIBRARIES AthContainers AthViews xAODTrigger )
@@ -12,6 +17,11 @@ atlas_add_library( DecisionHandlingLib
 # Component(s) in the package:
 atlas_add_component( DecisionHandling
                      src/components/*.cxx
-                     LINK_LIBRARIES DecisionHandlingLib )
+                     src/DeltaRRoIComboHypoTool.cxx
+                     src/InputMakerForRoI.cxx
+                     src/TriggerSummaryAlg.cxx
+                     src/RoRSeqFilter.cxx
+                     src/ViewCreator*.cxx
+                     LINK_LIBRARIES DecisionHandlingLib xAODTrigCalo AthViews xAODTracking xAODJet )
 
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Trigger/TrigSteer/ViewAlgs/ViewAlgs/IViewCreatorROITool.h b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/IViewCreatorROITool.h
similarity index 100%
rename from Trigger/TrigSteer/ViewAlgs/ViewAlgs/IViewCreatorROITool.h
rename to Trigger/TrigSteer/DecisionHandling/DecisionHandling/IViewCreatorROITool.h
diff --git a/Trigger/TrigSteer/DecisionHandling/src/InputMakerBase.cxx b/Trigger/TrigSteer/DecisionHandling/src/InputMakerBase.cxx
index 960c08b4ec4cb97018a5832156719bee9dbfa4e1..6974ee95c010ce9a3e814c6abde766eb81e9523b 100644
--- a/Trigger/TrigSteer/DecisionHandling/src/InputMakerBase.cxx
+++ b/Trigger/TrigSteer/DecisionHandling/src/InputMakerBase.cxx
@@ -82,6 +82,11 @@ StatusCode InputMakerBase::decisionInputToOutput(const EventContext& context, SG
 
   } // end of: for ( auto inputKey: decisionInputs() )
 
+  // Print some debug messages summarising the content of the outputHandles.
+  if (msgLvl(MSG::DEBUG)) {
+    debugPrintOut(context, outputHandle);
+  }
+
   return StatusCode::SUCCESS;
 }
 
diff --git a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx
index 340a2d6adc5fcd5393ded3140c6d2ca0d9da4748..35851da4d7762e1a97c8add88ed6d40ee08bbf49 100644
--- a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx
+++ b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx
@@ -10,10 +10,8 @@
 
 using TrigCompositeUtils::DecisionContainer;
 using TrigCompositeUtils::Decision;
-using TrigCompositeUtils::linkToPrevious;
-using TrigCompositeUtils::getLinkToPrevious;
-using TrigCompositeUtils::findLink;
 using TrigCompositeUtils::createAndStore;
+using TrigCompositeUtils::roiString;
 
 InputMakerForRoI:: InputMakerForRoI( const std::string& name, 
  ISvcLocator* pSvcLocator )    
@@ -22,7 +20,8 @@ InputMakerForRoI:: InputMakerForRoI( const std::string& name,
 
 StatusCode  InputMakerForRoI::initialize() {
   ATH_MSG_DEBUG("Will produce output RoI collections: " << m_RoIs);
-  CHECK( m_RoIs.initialize( SG::AllowEmpty ) );
+  ATH_CHECK( m_RoIs.initialize( SG::AllowEmpty ) );
+  ATH_CHECK( m_roiTool.retrieve() );
   return StatusCode::SUCCESS;
 }
 
@@ -31,58 +30,69 @@ StatusCode  InputMakerForRoI::execute( const EventContext& context ) const {
   
   // create the output decisions from the input collections
   SG::WriteHandle<DecisionContainer> outputHandle = createAndStore( decisionOutputs(), context );
-  ATH_CHECK(decisionInputToOutput(context, outputHandle));
   ATH_CHECK(outputHandle.isValid());
-  
-  // Prepare Outputs
-  std::unique_ptr<TrigRoiDescriptorCollection> oneRoIColl = std::make_unique<TrigRoiDescriptorCollection>();
-
-  // use also this:    ElementLinkVector<xAOD::MuonRoIContainer> getMuonRoILinks = obj->objectCollectionLinks<xAOD::MuonRoIContainer>("ManyMuonRoIs");
-  std::vector <ElementLink<TrigRoiDescriptorCollection> > RoIsFromDecision;  // used to check for duplicate features linked to different inputHandles
+  ATH_CHECK(decisionInputToOutput(context, outputHandle));
+  ATH_MSG_DEBUG("Merging complete");
 
   if( outputHandle->size() == 0) {
     ATH_MSG_WARNING( "Have no decisions in output handle "<< outputHandle.key() << ". Handle is valid but container is empty. "
-      << "Check why this EventViewCreatorAlgorithm was unlocked by a Filter, if the Filter then gave it no inputs.");
+      << "Check why this InputMakerForRoI was unlocked by a Filter, if the Filter then gave it no inputs.");
+  } else {
+    ATH_MSG_DEBUG( "Have output " << outputHandle.key() << " with " << outputHandle->size() << " elements" );
+  }
+
+  // Find and link to the output Decision objects the ROIs to run over
+  ATH_CHECK( m_roiTool->attachROILinks(*outputHandle, context) );
+
+  if (m_RoIs.empty()) {
+    ATH_MSG_DEBUG("No concrete output ROI collection required from this InputMaker.");
     return StatusCode::SUCCESS;
   }
 
-  ATH_MSG_DEBUG( "Got output "<< outputHandle.key()<<" with " << outputHandle->size() << " elements" );
-  // loop over output decisions in container of outputHandle, follow link to inputDecision
-  for ( auto outputDecision : *outputHandle){ 
-    ElementLinkVector<DecisionContainer> inputLinks = getLinkToPrevious(outputDecision);
-    for (auto input: inputLinks){
-      const Decision* inputDecision = *input;
-      auto roiELInfo = findLink<TrigRoiDescriptorCollection>( inputDecision, m_roisLink.value() );
-      auto roiEL = roiELInfo.link;
-      ATH_CHECK( roiEL.isValid() );
-
-      // avoid adding the same feature multiple times: check if not in container, if not add it
-      if ( find(RoIsFromDecision.begin(), RoIsFromDecision.end(), roiEL) == RoIsFromDecision.end() ) {
-        RoIsFromDecision.push_back(roiEL); // just to keep track of which we have used 
-        const TrigRoiDescriptor* roi = *roiEL;
-        ATH_MSG_DEBUG("Found RoI:" <<*roi<<" FS="<<roi->isFullscan());
-        //make a new one:
-        TrigRoiDescriptor* newroi= new TrigRoiDescriptor(*roi); //use copy constructor
-        oneRoIColl->push_back(newroi);
+  // Prepare Outputs
+  std::unique_ptr<TrigRoiDescriptorCollection> outputRoIColl = std::make_unique<TrigRoiDescriptorCollection>();
+
+  std::vector <ElementLink<TrigRoiDescriptorCollection> > RoIsFromDecision;  // used to check for duplicate RoIs 
+
+  if (m_mergeIntoSuperRoI) {
+    TrigRoiDescriptor* superRoI = new TrigRoiDescriptor();
+    superRoI->setComposite(true);
+    superRoI->manageConstituents(false);
+    outputRoIColl->push_back(superRoI);
+  }
+
+  // loop over output decisions in container of outputHandle, collect RoIs to process
+  for (const Decision* outputDecision : *outputHandle) { 
+
+    if (!outputDecision->hasObjectLink(roiString(), ClassID_traits<TrigRoiDescriptorCollection>::ID())) {
+      ATH_MSG_ERROR("No '" << roiString() << "'link was attached by the ROITool. Decision object dump:" << *outputDecision);
+      return StatusCode::FAILURE;
+    }
+    const ElementLink<TrigRoiDescriptorCollection> roiEL = outputDecision->objectLink<TrigRoiDescriptorCollection>(roiString());
+    ATH_CHECK(roiEL.isValid());
+
+    // Avoid adding the same ROI multiple times: check if not in container, if not add it
+    if ( find(RoIsFromDecision.begin(), RoIsFromDecision.end(), roiEL) == RoIsFromDecision.end() ) {
+      RoIsFromDecision.push_back(roiEL); // just to keep track of which we have used 
+      const TrigRoiDescriptor* roi = *roiEL;
+      ATH_MSG_DEBUG("Found RoI:" <<*roi<<" FS="<<roi->isFullscan());
+
+      if (m_mergeIntoSuperRoI) { // Append to the single superRoI
+        outputRoIColl->back()->push_back( roi );
+      } else { // Add individually
+        TrigRoiDescriptor* newroi = new TrigRoiDescriptor(*roi); //use copy constructor
+        outputRoIColl->push_back(newroi);
         ATH_MSG_DEBUG("Added RoI:" <<*newroi<<" FS="<<newroi->isFullscan());
       }
-    } // loop over previous input links           
+    } 
+
   } // loop over decisions      
   
-  
   // Finally, record output
-  if (m_RoIs.empty()) {
-    ATH_MSG_DEBUG("No concrete output ROI collection required from this InputMaker.");
-  } else {
-    ATH_MSG_DEBUG("Produced "<<oneRoIColl->size() <<" output RoIs");
-    auto roi_outputHandle = SG::makeHandle(m_RoIs, context);
-    ATH_CHECK( roi_outputHandle.record(std::move(oneRoIColl)) );
-  }
+  ATH_MSG_DEBUG("Produced "<<outputRoIColl->size() <<" output RoIs");
+  auto roi_outputHandle = SG::makeHandle(m_RoIs, context);
+  ATH_CHECK( roi_outputHandle.record(std::move(outputRoIColl)) );
 
-  // call base class helper method to print some debug messages summarising the content of the outputHandles.
-  if (msgLvl(MSG::DEBUG)) {
-    debugPrintOut(context, outputHandle);
-  }
 
   return StatusCode::SUCCESS;
 }
diff --git a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.h b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.h
index 9f5119fd46c7a6a628a24efa4bd3ea233c0fd1ae..aa615baf368f85459fa2649b5687ca5969fadb5d 100644
--- a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.h
+++ b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.h
@@ -1,8 +1,8 @@
 /*
   Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
-#ifndef TRIGUPGRADETEST_INPUTMAKERFORROI_H
-#define TRIGUPGRADETEST_INPUTMAKERFORROI_H 
+#ifndef DESICIONHANDLING_INPUTMAKERFORROI_H
+#define DESICIONHANDLING_INPUTMAKERFORROI_H 
 
 
 #include <string>
@@ -11,6 +11,8 @@
 #include "AthContainers/ConstDataVector.h"
 #include "StoreGate/ReadHandleKeyArray.h"
 #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
+#include "DecisionHandling/IViewCreatorROITool.h"
+
 
   /**
    * @class  InputMakerForRoI
@@ -26,10 +28,16 @@
     virtual StatusCode  execute(const EventContext&) const override;
 
   private: 
-    SG::WriteHandleKey<TrigRoiDescriptorCollection> m_RoIs {this,"RoIs", "",
+    SG::WriteHandleKey<TrigRoiDescriptorCollection> m_RoIs {this, "RoIs", "",
       "Name of the collection of ROI extrated from the input Decision Objects. Used as cocnrete starting handle for step's reconstruction."};
 
+    ToolHandle<IViewCreatorROITool> m_roiTool{this, "RoITool", "",
+      "Tool used to supply per-Decision Object the RoI which should be processed."};
+
+    Gaudi::Property<bool> m_mergeIntoSuperRoI{this, "MergeIntoSuperRoI", false,
+      "If true, the output RoIs collection will contain only one ROI, this will be a SuperRoI encompassing all individual ROIs - one from each of the input Decision Objects."};
+
   }; 
 
 
-#endif //> !TRIGUPGRADETEST_INPUTMAKERFORROI_H
+#endif //> !DESICIONHANDLING_INPUTMAKERFORROI_H
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnClusterROITool.cxx b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnClusterROITool.cxx
similarity index 100%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnClusterROITool.cxx
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnClusterROITool.cxx
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnClusterROITool.h b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnClusterROITool.h
similarity index 88%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnClusterROITool.h
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnClusterROITool.h
index a80cb49c5c1a9e546f3d87f716bacf0a402fae7c..ff39dda85c5171cf09da47427744e489d7ae221b 100644
--- a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnClusterROITool.h
+++ b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnClusterROITool.h
@@ -2,12 +2,12 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#ifndef VIEWALGS_VIEWCREATORCENTREDONCLUSTERROITOOL_H
-#define VIEWALGS_VIEWCREATORCENTREDONCLUSTERROITOOL_H
+#ifndef DESICIONHANDLING_VIEWCREATORCENTREDONCLUSTERROITOOL_H
+#define DESICIONHANDLING_VIEWCREATORCENTREDONCLUSTERROITOOL_H
 
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "StoreGate/WriteHandleKey.h"
-#include "ViewAlgs/IViewCreatorROITool.h"
+#include "DecisionHandling/IViewCreatorROITool.h"
 #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
 #include "xAODTrigCalo/TrigEMClusterContainer.h"
 
@@ -49,4 +49,4 @@ public:
 
 };
 
-#endif //> !VIEWALGS_VIEWCREATORCENTREDONCLUSTERROITOOL_H
+#endif //> !DESICIONHANDLING_VIEWCREATORCENTREDONCLUSTERROITOOL_H
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnIParticleROITool.cxx b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnIParticleROITool.cxx
similarity index 100%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnIParticleROITool.cxx
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnIParticleROITool.cxx
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnIParticleROITool.h b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnIParticleROITool.h
similarity index 87%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnIParticleROITool.h
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnIParticleROITool.h
index d766bb72d6db773b76bc6680064702d2111c5a73..62eddd373318587464eee926d95852e841aeb297 100644
--- a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnIParticleROITool.h
+++ b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnIParticleROITool.h
@@ -2,12 +2,12 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#ifndef VIEWALGS_VIEWCREATORCENTREDONIPARTICLEROITOOL_H
-#define VIEWALGS_VIEWCREATORCENTREDONIPARTICLEROITOOL_H
+#ifndef DESICIONHANDLING_VIEWCREATORCENTREDONIPARTICLEROITOOL_H
+#define DESICIONHANDLING_VIEWCREATORCENTREDONIPARTICLEROITOOL_H
 
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "StoreGate/WriteHandleKey.h"
-#include "ViewAlgs/IViewCreatorROITool.h"
+#include "DecisionHandling/IViewCreatorROITool.h"
 #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
 
 /**
@@ -48,4 +48,4 @@ public:
 
 };
 
-#endif //> !VIEWALGS_VIEWCREATORCENTREDONIPARTICLEROITOOL_H
+#endif //> !DESICIONHANDLING_VIEWCREATORCENTREDONIPARTICLEROITOOL_H
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnJetWithPVConstraintROITool.cxx b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnJetWithPVConstraintROITool.cxx
similarity index 100%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnJetWithPVConstraintROITool.cxx
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnJetWithPVConstraintROITool.cxx
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnJetWithPVConstraintROITool.h b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnJetWithPVConstraintROITool.h
similarity index 88%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnJetWithPVConstraintROITool.h
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnJetWithPVConstraintROITool.h
index cc65588dab5ae44b1c70f421fe6e77973338b700..da690591ae869a15eb5aaf05bd37a7a23983dfba 100644
--- a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorCentredOnJetWithPVConstraintROITool.h
+++ b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorCentredOnJetWithPVConstraintROITool.h
@@ -2,12 +2,12 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#ifndef VIEWALGS_VIEWCREATORCENTREDONJETWITHPVCONSTRAINTROITOOL_H
-#define VIEWALGS_VIEWCREATORCENTREDONJETWITHPVCONSTRAINTROITOOL_H
+#ifndef DESICIONHANDLING_VIEWCREATORCENTREDONJETWITHPVCONSTRAINTROITOOL_H
+#define DESICIONHANDLING_VIEWCREATORCENTREDONJETWITHPVCONSTRAINTROITOOL_H
 
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "StoreGate/WriteHandleKey.h"
-#include "ViewAlgs/IViewCreatorROITool.h"
+#include "DecisionHandling/IViewCreatorROITool.h"
 #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
 
 #include "xAODTracking/VertexContainer.h"
@@ -62,4 +62,4 @@ public:
 
 };
 
-#endif //> !VIEWALGS_VIEWCREATORCENTREDONJETWITHPVCONSTRAINTROITOOL_H
+#endif //> !DESICIONHANDLING_VIEWCREATORCENTREDONJETWITHPVCONSTRAINTROITOOL_H
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorFSROITool.cxx b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorFSROITool.cxx
similarity index 100%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorFSROITool.cxx
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorFSROITool.cxx
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorFSROITool.h b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorFSROITool.h
similarity index 85%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorFSROITool.h
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorFSROITool.h
index c76fb89808468a0e1417c57ba869b7fd12023f8e..73396ecbd12e8daf27a9b4b74622c915ae09e6b0 100644
--- a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorFSROITool.h
+++ b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorFSROITool.h
@@ -2,12 +2,12 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#ifndef VIEWALGS_VIEWCREATORFSROITOOL_H
-#define VIEWALGS_VIEWCREATORFSROITOOL_H
+#ifndef DESICIONHANDLING_VIEWCREATORFSROITOOL_H
+#define DESICIONHANDLING_VIEWCREATORFSROITOOL_H
 
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "StoreGate/WriteHandleKey.h"
-#include "ViewAlgs/IViewCreatorROITool.h"
+#include "DecisionHandling/IViewCreatorROITool.h"
 #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
 
 /**
@@ -39,4 +39,4 @@ public:
 
 };
 
-#endif //> !VIEWALGS_VIEWCREATORFSROITOOL_H
+#endif //> !DESICIONHANDLING_VIEWCREATORFSROITOOL_H
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorFetchFromViewROITool.cxx b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorFetchFromViewROITool.cxx
similarity index 100%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorFetchFromViewROITool.cxx
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorFetchFromViewROITool.cxx
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorFetchFromViewROITool.h b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorFetchFromViewROITool.h
similarity index 89%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorFetchFromViewROITool.h
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorFetchFromViewROITool.h
index cf62f0d8aeca80ad5fdfa665a812c9755bb039e0..705a7a814a02384ac0cce34300a797c1664ce8a0 100644
--- a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorFetchFromViewROITool.h
+++ b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorFetchFromViewROITool.h
@@ -2,12 +2,12 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#ifndef VIEWALGS_VIEWCREATORFETCHFROMVIEWROITOOL_H
-#define VIEWALGS_VIEWCREATORFETCHFROMVIEWROITOOL_H
+#ifndef DESICIONHANDLING_VIEWCREATORFETCHFROMVIEWROITOOL_H
+#define DESICIONHANDLING_VIEWCREATORFETCHFROMVIEWROITOOL_H
 
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "StoreGate/WriteHandleKey.h"
-#include "ViewAlgs/IViewCreatorROITool.h"
+#include "DecisionHandling/IViewCreatorROITool.h"
 #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
 
 /**
@@ -47,4 +47,4 @@ public:
 
 };
 
-#endif //> !VIEWALGS_VIEWCREATORFETCHFROMVIEWROITOOL_H
+#endif //> !DESICIONHANDLING_VIEWCREATORFETCHFROMVIEWROITOOL_H
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorInitialROITool.cxx b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorInitialROITool.cxx
similarity index 100%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorInitialROITool.cxx
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorInitialROITool.cxx
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorInitialROITool.h b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorInitialROITool.h
similarity index 83%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorInitialROITool.h
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorInitialROITool.h
index bb297e595e36da44e491f726502b3db2a4845bdf..81f2e35843b09a25ddb3305d80d055286c7cb354 100644
--- a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorInitialROITool.h
+++ b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorInitialROITool.h
@@ -2,11 +2,11 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#ifndef VIEWALGS_VIEWCREATORINITIALROITOOL_H
-#define VIEWALGS_VIEWCREATORINITIALROITOOL_H
+#ifndef DESICIONHANDLING_VIEWCREATORINITIALROITOOL_H
+#define DESICIONHANDLING_VIEWCREATORINITIALROITOOL_H
 
 #include "AthenaBaseComps/AthAlgTool.h"
-#include "ViewAlgs/IViewCreatorROITool.h"
+#include "DecisionHandling/IViewCreatorROITool.h"
 
 /**
  * @class ViewCreatorInitialROITool
@@ -32,4 +32,4 @@ public:
 
 };
 
-#endif //> !VIEWALGS_VIEWCREATORINITIALROITOOL_H
+#endif //> !DESICIONHANDLING_VIEWCREATORINITIALROITOOL_H
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorNamedROITool.cxx b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorNamedROITool.cxx
similarity index 100%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorNamedROITool.cxx
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorNamedROITool.cxx
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorNamedROITool.h b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorNamedROITool.h
similarity index 82%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorNamedROITool.h
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorNamedROITool.h
index 34d9849cef1edb9145419887108de88408f59783..1bc3c37da151255f3da9cb3ba730fef5b5732ddf 100644
--- a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorNamedROITool.h
+++ b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorNamedROITool.h
@@ -2,11 +2,11 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-#ifndef VIEWALGS_VIEWCREATORNAMEDROITOOL_H
-#define VIEWALGS_VIEWCREATORNAMEDROITOOL_H
+#ifndef DESICIONHANDLING_VIEWCREATORNAMEDROITOOL_H
+#define DESICIONHANDLING_VIEWCREATORNAMEDROITOOL_H
 
 #include "AthenaBaseComps/AthAlgTool.h"
-#include "ViewAlgs/IViewCreatorROITool.h"
+#include "DecisionHandling/IViewCreatorROITool.h"
 
 /**
  * @class ViewCreatorNamedROITool
@@ -32,4 +32,4 @@ public:
 
 };
 
-#endif //> !VIEWALGS_VIEWCREATORNAMEDROITOOL_H
+#endif //> !DESICIONHANDLING_VIEWCREATORNAMEDROITOOL_H
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorPreviousROITool.cxx b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorPreviousROITool.cxx
similarity index 100%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorPreviousROITool.cxx
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorPreviousROITool.cxx
diff --git a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorPreviousROITool.h b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorPreviousROITool.h
similarity index 95%
rename from Trigger/TrigSteer/ViewAlgs/src/ViewCreatorPreviousROITool.h
rename to Trigger/TrigSteer/DecisionHandling/src/ViewCreatorPreviousROITool.h
index 3f8d022df75db0ed2254eb408a9b61a4ac952563..95cdb00d6305d0f564ccfb1d8b51482877e4bcce 100644
--- a/Trigger/TrigSteer/ViewAlgs/src/ViewCreatorPreviousROITool.h
+++ b/Trigger/TrigSteer/DecisionHandling/src/ViewCreatorPreviousROITool.h
@@ -6,7 +6,7 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 #define VIEWALGS_VIEWCREATORPREVIOUSROITOOL_H
 
 #include "AthenaBaseComps/AthAlgTool.h"
-#include "ViewAlgs/IViewCreatorROITool.h"
+#include "DecisionHandling/IViewCreatorROITool.h"
 
 /**
  * @class ViewCreatorPreviousROITool
diff --git a/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx b/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx
index e891afb5dad91b7a401bcb32542fd35d9eced1ec..7a1f0d36154b2180b9fdf99c6db8b3f1c610786f 100644
--- a/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx
+++ b/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx
@@ -6,6 +6,15 @@
 #include "../DeltaRRoIComboHypoTool.h"
 #include "DecisionHandling/ComboHypoToolBase.h"
 
+#include "../ViewCreatorInitialROITool.h"
+#include "../ViewCreatorPreviousROITool.h"
+#include "../ViewCreatorNamedROITool.h"
+#include "../ViewCreatorFSROITool.h"
+#include "../ViewCreatorFetchFromViewROITool.h"
+#include "../ViewCreatorCentredOnIParticleROITool.h"
+#include "../ViewCreatorCentredOnClusterROITool.h"
+#include "../ViewCreatorCentredOnJetWithPVConstraintROITool.h"
+
 DECLARE_COMPONENT( DumpDecisions )
 DECLARE_COMPONENT( RoRSeqFilter )
 DECLARE_COMPONENT( TriggerSummaryAlg )
@@ -14,4 +23,14 @@ DECLARE_COMPONENT( InputMakerForRoI )
 DECLARE_COMPONENT( ComboHypoToolBase )
 DECLARE_COMPONENT( DeltaRRoIComboHypoTool )
 
+DECLARE_COMPONENT( ViewCreatorInitialROITool )
+DECLARE_COMPONENT( ViewCreatorPreviousROITool )
+DECLARE_COMPONENT( ViewCreatorNamedROITool )
+DECLARE_COMPONENT( ViewCreatorFSROITool )
+DECLARE_COMPONENT( ViewCreatorFetchFromViewROITool )
+DECLARE_COMPONENT( ViewCreatorCentredOnIParticleROITool )
+DECLARE_COMPONENT( ViewCreatorCentredOnClusterROITool )
+DECLARE_COMPONENT( ViewCreatorCentredOnJetWithPVConstraintROITool )
+
+
 
diff --git a/Trigger/TrigSteer/ViewAlgs/CMakeLists.txt b/Trigger/TrigSteer/ViewAlgs/CMakeLists.txt
index 811d9b89b0be46c42079ae5c078c6a06cace026c..e2c5914873f06c873857f4a19622594caad103ac 100644
--- a/Trigger/TrigSteer/ViewAlgs/CMakeLists.txt
+++ b/Trigger/TrigSteer/ViewAlgs/CMakeLists.txt
@@ -11,4 +11,4 @@ atlas_add_library( ViewAlgsLib
 
 atlas_add_component( ViewAlgs
                      src/*.cxx src/components/*.cxx
-                     LINK_LIBRARIES AthViews AthenaBaseComps CxxUtils DecisionHandlingLib MuonCombinedEvent StoreGateLib TrigSteeringEvent ViewAlgsLib xAODJet xAODMuon xAODTracking xAODTrigCalo )
+                     LINK_LIBRARIES AthViews AthenaBaseComps CxxUtils DecisionHandlingLib MuonCombinedEvent StoreGateLib TrigSteeringEvent ViewAlgsLib xAODJet xAODMuon  )
diff --git a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx
index 84292ade21be048a66fba0de3995efae33a6f9d1..11c165c4d7f63b4e6f1e4351e0130838efeb5b65 100644
--- a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx
+++ b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx
@@ -55,11 +55,13 @@ StatusCode EventViewCreatorAlgorithm::execute( const EventContext& context ) con
   const DecisionContainer* cachedViews = nullptr;
   if (!m_cachedViewsKey.empty()) {
     SG::ReadHandle<DecisionContainer> cachedRH = SG::makeHandle(m_cachedViewsKey, context);
-    ATH_CHECK(cachedRH.isValid());
-    cachedViews = cachedRH.ptr();
+    // Even if the handle is configured, this precursor EventViewCreatorAlg may not have executed in a given event
+    if (cachedRH.isValid()) {
+      cachedViews = cachedRH.ptr();
+    }
   }
 
-  // Keep track of the ROIs we spwan a View for, do not spawn duplicates.
+  // Keep track of the ROIs we spawn a View for, do not spawn duplicates.
   // For many cases, this will be covered by the Merging operation preceding this.
   ElementLinkVector<TrigRoiDescriptorCollection> RoIsFromDecision;
 
@@ -83,7 +85,7 @@ StatusCode EventViewCreatorAlgorithm::execute( const EventContext& context ) con
     ATH_CHECK(roiEL.isValid());
 
     // We do one of three things here, either... 
-    // a) We realise that an identically configured past EVCA has already run a View on an equivilant ROI. If so we can re-use this.
+    // a) We realise that an identically configured past EVCA has already run a View on an equivalent ROI. If so we can re-use this.
     // b) We encounter a new ROI and hence need to spawn a new view.
     // c) We encounter a ROI that we have already seen in looping over this outputHandle, we can re-use a view.
       
@@ -96,7 +98,7 @@ StatusCode EventViewCreatorAlgorithm::execute( const EventContext& context ) con
 
     if (useCached) {
 
-      // Re-use an aready processed view from a previously executed EVCA instance
+      // Re-use an already processed view from a previously executed EVCA instance
       const Decision* cached = cachedViews->at(cachedIndex);
       ElementLink<ViewContainer> cachedViewEL = cached->objectLink<ViewContainer>(viewString());
       ElementLink<TrigRoiDescriptorCollection> cachedROIEL = cached->objectLink<TrigRoiDescriptorCollection>(roiString());
@@ -159,9 +161,6 @@ StatusCode EventViewCreatorAlgorithm::execute( const EventContext& context ) con
     getScheduler(),                                 // Scheduler to launch with
     m_reverseViews ) );                             // Debug option
   
-  if (msgLvl(MSG::DEBUG)) {
-    debugPrintOut(context, outputHandle);
-  }
   return StatusCode::SUCCESS;
 }
 
diff --git a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.h b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.h
index 4e54f68397460153c4cd021ce9ec814aa1517b27..b393b3b8efca212607cd4cfe35b9162fbc065843 100644
--- a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.h
+++ b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.h
@@ -21,7 +21,7 @@
 #include "GaudiKernel/IScheduler.h"
 #include "AthViews/View.h"
 
-#include "ViewAlgs/IViewCreatorROITool.h"
+#include "DecisionHandling/IViewCreatorROITool.h"
 
 // Muon specifics
 #include "xAODMuon/MuonContainer.h"
diff --git a/Trigger/TrigSteer/ViewAlgs/src/components/ViewAlgs_entries.cxx b/Trigger/TrigSteer/ViewAlgs/src/components/ViewAlgs_entries.cxx
index ba3ed577af455e179ff54d630f9b915e5805b74e..8f1bca845a4815e59632a074da250a3a4b5bbbc1 100644
--- a/Trigger/TrigSteer/ViewAlgs/src/components/ViewAlgs_entries.cxx
+++ b/Trigger/TrigSteer/ViewAlgs/src/components/ViewAlgs_entries.cxx
@@ -2,23 +2,8 @@
 
 #include "../EventViewCreatorAlgorithm.h"
 #include "../MergeViews.h"
-#include "../ViewCreatorInitialROITool.h"
-#include "../ViewCreatorPreviousROITool.h"
-#include "../ViewCreatorNamedROITool.h"
-#include "../ViewCreatorFSROITool.h"
-#include "../ViewCreatorFetchFromViewROITool.h"
-#include "../ViewCreatorCentredOnIParticleROITool.h"
-#include "../ViewCreatorCentredOnClusterROITool.h"
-#include "../ViewCreatorCentredOnJetWithPVConstraintROITool.h"
+
 
 DECLARE_COMPONENT( EventViewCreatorAlgorithm )
 DECLARE_COMPONENT( MergeViews )
-DECLARE_COMPONENT( ViewCreatorInitialROITool )
-DECLARE_COMPONENT( ViewCreatorPreviousROITool )
-DECLARE_COMPONENT( ViewCreatorNamedROITool )
-DECLARE_COMPONENT( ViewCreatorFSROITool )
-DECLARE_COMPONENT( ViewCreatorFetchFromViewROITool )
-DECLARE_COMPONENT( ViewCreatorCentredOnIParticleROITool )
-DECLARE_COMPONENT( ViewCreatorCentredOnClusterROITool )
-DECLARE_COMPONENT( ViewCreatorCentredOnJetWithPVConstraintROITool )
 
diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/CMakeLists.txt
index 31831f4e01995f0a51ab502fba4092c7db59f5bf..d87bb00ccbc4d7de77a45806bf4d0b3065ca9d12 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/CMakeLists.txt
@@ -1,20 +1,9 @@
-################################################################################
-# Package: L1TopoAlgorithms
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( L1TopoAlgorithms )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PUBLIC
-   Trigger/TrigT1/L1Topo/L1TopoEvent
-   Trigger/TrigT1/L1Topo/L1TopoInterfaces
-   PRIVATE
-   Trigger/TrigT1/L1Topo/L1TopoSimulationUtils )
-
 # External dependencies:
-find_package( Boost )
 find_package( ROOT COMPONENTS Core Hist )
 
 # Make sure that the executable of the package gets linked against all of its
@@ -26,10 +15,8 @@ string( REPLACE "-Wl,--as-needed" "" CMAKE_EXE_LINKER_FLAGS
 atlas_add_library( L1TopoAlgorithms
    L1TopoAlgorithms/*.h Root/*.cxx
    PUBLIC_HEADERS L1TopoAlgorithms
-   PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
    LINK_LIBRARIES L1TopoEvent L1TopoInterfaces
-   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES}
-   L1TopoSimulationUtils )
+   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} L1TopoCommon L1TopoSimulationUtils )
 
 atlas_add_executable( TrigConfL1TopoGenPyAlg
    src/test/L1TopoGenPyAlg.cxx
diff --git a/Trigger/TrigT1/L1Topo/L1TopoByteStream/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoByteStream/CMakeLists.txt
index afc1765d3fd8d1a13d83f48a0973e9a3d28f9729..0039ab4b152a6b95e476e13359f31b2377e69423 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoByteStream/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoByteStream/CMakeLists.txt
@@ -1,22 +1,8 @@
-################################################################################
-# Package: L1TopoByteStream
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( L1TopoByteStream )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          GaudiKernel
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Control/StoreGate
-                          Event/ByteStreamCnvSvcBase
-                          Event/ByteStreamData
-                          Event/xAOD/xAODTrigL1Calo
-                          Trigger/TrigT1/L1Topo/L1TopoRDO )
-
 # External dependencies:
 find_package( tdaq-common COMPONENTS eformat_write )
 
@@ -25,7 +11,7 @@ atlas_add_component( L1TopoByteStream
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} GaudiKernel AthenaBaseComps AthenaKernel StoreGateLib SGtests ByteStreamCnvSvcBaseLib ByteStreamData ByteStreamData_test xAODTrigL1Calo L1TopoRDO )
+                     LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps AthenaKernel ByteStreamCnvSvcBaseLib ByteStreamData GaudiKernel L1TopoRDO StoreGateLib xAODTrigL1Calo )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCommon/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoCommon/CMakeLists.txt
index 2bacc118c5b9e09533e8fb0d8099423640e6ee79..ac15fd6199b1468fe90df413e76da918ed3094c9 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCommon/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoCommon/CMakeLists.txt
@@ -1,17 +1,9 @@
-################################################################################
-# Package: L1TopoCommon
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( L1TopoCommon )
 
-# External dependencies:
-find_package( Boost COMPONENTS filesystem thread system )
-
 # Component(s) in the package:
 atlas_add_library( L1TopoCommon
                    Root/*.cxx
-                   PUBLIC_HEADERS L1TopoCommon
-                   INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${Boost_LIBRARIES} )
-
+                   PUBLIC_HEADERS L1TopoCommon )
diff --git a/Trigger/TrigT1/L1Topo/L1TopoConfig/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoConfig/CMakeLists.txt
index 7aec365fe46931ec25c745a77fd400ca5a9f816d..e98f97b76bd3aaf5d1e930a87b7826de232289c9 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoConfig/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoConfig/CMakeLists.txt
@@ -1,30 +1,21 @@
-################################################################################
-# Package: L1TopoConfig
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( L1TopoConfig )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Trigger/TrigConfiguration/TrigConfBase
-                          Trigger/TrigT1/L1Topo/L1TopoCommon )
-
 # External dependencies:
-find_package( Boost COMPONENTS filesystem thread system )
-find_package( cx_Oracle )
+find_package( Boost )
 
 # Component(s) in the package:
 atlas_add_library( L1TopoConfig
                    Root/*.cxx
                    PUBLIC_HEADERS L1TopoConfig
                    INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${Boost_LIBRARIES} TrigConfBase L1TopoCommon )
+                   LINK_LIBRARIES TrigConfBase L1TopoCommon )
 
 atlas_add_executable( TrigConfTopoReader
                       src/test/TopoReader.cxx
-                      INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${Boost_LIBRARIES} TrigConfBase L1TopoCommon L1TopoConfig )
+                      LINK_LIBRARIES L1TopoConfig )
 
 # Install files from the package:
 atlas_install_xmls( data/*.xml )
diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/CMakeLists.txt
index 87c2a1940909ac18ec15952e9d8eb458860c5267..dd086bcc87c1216ef3d4fbaac804cc0a25a04963 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/CMakeLists.txt
@@ -1,42 +1,25 @@
-################################################################################
-# Package: L1TopoCoreSim
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( L1TopoCoreSim )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Trigger/TrigT1/L1Topo/L1TopoCommon
-                          Trigger/TrigT1/L1Topo/L1TopoConfig
-                          Trigger/TrigT1/L1Topo/L1TopoEvent
-                          Trigger/TrigT1/L1Topo/L1TopoInterfaces
-                          PRIVATE
-                          Trigger/TrigConfiguration/TrigConfBase
-                          Trigger/TrigT1/L1Topo/L1TopoAlgorithms
-                          Trigger/TrigT1/L1Topo/L1TopoHardware )
-
 # External dependencies:
-find_package( Boost COMPONENTS filesystem thread system )
-find_package( ROOT COMPONENTS Core Tree pthread RIO Hist MathCore )
+find_package( Boost )
+find_package( ROOT COMPONENTS Core RIO Hist )
 
 # Component(s) in the package:
 atlas_disable_as_needed()
 atlas_add_library( L1TopoCoreSim
                    Root/*.cxx
                    PUBLIC_HEADERS L1TopoCoreSim
-                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                   PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                   LINK_LIBRARIES L1TopoCommon L1TopoConfig L1TopoEvent L1TopoInterfaces ${ROOT_LIBRARIES}
-                   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} TrigConfBase L1TopoAlgorithms L1TopoHardware )
+                   PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${ROOT_LIBRARIES} L1TopoCommon L1TopoConfig L1TopoEvent L1TopoInterfaces TrigConfBase
+                   PRIVATE_LINK_LIBRARIES L1TopoHardware L1TopoAlgorithms )
 
 atlas_add_executable( TrigConfTopoStandAlone
                       src/test/TopoStandAlone.cxx
-                      INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} L1TopoCommon L1TopoConfig L1TopoEvent L1TopoInterfaces TrigConfBase L1TopoAlgorithms L1TopoHardware L1TopoCoreSim )
+                      LINK_LIBRARIES L1TopoCoreSim TrigConfBase )
 
 atlas_add_executable( TrigConfTopoTestSteeringConfig
                       src/test/TopoTestSteeringConfig.cxx
-                      INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} L1TopoCommon L1TopoConfig L1TopoEvent L1TopoInterfaces TrigConfBase L1TopoAlgorithms L1TopoHardware L1TopoCoreSim )
-
+                      LINK_LIBRARIES L1TopoCoreSim )
diff --git a/Trigger/TrigT1/L1Topo/L1TopoEvent/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoEvent/CMakeLists.txt
index a9d19b9067c0b8a22375de6d21c339019b466443..02e5cec5e52b168391e26650102caa63b8c29012 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoEvent/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoEvent/CMakeLists.txt
@@ -1,22 +1,10 @@
-################################################################################
-# Package: L1TopoEvent
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( L1TopoEvent )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Trigger/TrigConfiguration/TrigConfBase
-                          Trigger/TrigT1/L1Topo/L1TopoCommon )
-
-# External dependencies:
-find_package( Boost COMPONENTS filesystem thread system )
-
 # Component(s) in the package:
 atlas_add_library( L1TopoEvent
                    Root/*.cxx
                    PUBLIC_HEADERS L1TopoEvent
-                   INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${Boost_LIBRARIES} TrigConfBase L1TopoCommon )
-
+                   LINK_LIBRARIES TrigConfBase L1TopoCommon )
diff --git a/Trigger/TrigT1/L1Topo/L1TopoHardware/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoHardware/CMakeLists.txt
index 89a87ed29df44f64a1698153e58464d42db88b51..db5fcc3d2335b749f104e85b0aa164cf42be8d51 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoHardware/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoHardware/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: L1TopoHardware
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( L1TopoHardware )
@@ -12,7 +10,8 @@ find_package( Boost )
 atlas_add_library( L1TopoHardware
    L1TopoHardware/*.h Root/*.cxx
    INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-   PUBLIC_HEADERS L1TopoHardware )
+   PUBLIC_HEADERS L1TopoHardware
+   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} )
 
 atlas_add_executable( TrigConfL1TopoGenPyHardware
    src/test/L1TopoGenPyHardware.cxx
diff --git a/Trigger/TrigT1/L1Topo/L1TopoInterfaces/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoInterfaces/CMakeLists.txt
index 57d429010ff42bcddc39f64a4f4527a000923bf1..436e3f7b02da4185e691f4bcb63ee6aeaad2db61 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoInterfaces/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoInterfaces/CMakeLists.txt
@@ -1,24 +1,15 @@
-################################################################################
-# Package: L1TopoInterfaces
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( L1TopoInterfaces )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Trigger/TrigConfiguration/TrigConfBase
-                          Trigger/TrigT1/L1Topo/L1TopoCommon
-                          Trigger/TrigT1/L1Topo/L1TopoEvent )
-
 # External dependencies:
-find_package( Boost COMPONENTS filesystem thread system )
-find_package( ROOT COMPONENTS Core Tree pthread RIO MathCore Hist )
+find_package( ROOT COMPONENTS Core RIO Hist )
 
 # Component(s) in the package:
 atlas_add_library( L1TopoInterfaces
                    Root/*.cxx
                    PUBLIC_HEADERS L1TopoInterfaces
-                   INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${Boost_LIBRARIES} TrigConfBase L1TopoCommon L1TopoEvent ${ROOT_LIBRARIES} )
-
+                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES}
+                   LINK_LIBRARIES L1TopoCommon L1TopoEvent TrigConfBase )
diff --git a/Trigger/TrigT1/L1Topo/L1TopoMonitoring/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoMonitoring/CMakeLists.txt
index 618e94953621ec82f0e9bc6b65b256c889c631a4..cd25b8cefdbec102ae50de2d0424cd3fe669ebd3 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoMonitoring/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoMonitoring/CMakeLists.txt
@@ -1,24 +1,13 @@
-################################################################################
-# Package: L1TopoMonitoring
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( L1TopoMonitoring )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PRIVATE
-                          Control/AthenaBaseComps
-                          GaudiKernel
-                          Trigger/TrigConfiguration/TrigConfInterfaces
-                          Trigger/TrigT1/L1Topo/L1TopoConfig
-                          Trigger/TrigT1/L1Topo/L1TopoRDO
-                          Trigger/TrigT1/TrigT1Result )
-
 # Component(s) in the package:
 atlas_add_component( L1TopoMonitoring
                      src/*.cxx
                      src/components/*.cxx
-                     LINK_LIBRARIES AthenaBaseComps GaudiKernel L1TopoConfig L1TopoRDO TrigT1Result )
+                     LINK_LIBRARIES AthenaBaseComps L1TopoConfig L1TopoRDO TrigConfInterfaces TrigT1Result )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
diff --git a/Trigger/TrigT1/L1Topo/L1TopoRDO/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoRDO/CMakeLists.txt
index 0f37746ce4f36193bb7a507dde971b39f3a42626..6e398cd8df88524d7fa8f457be5815342e7718c6 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoRDO/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoRDO/CMakeLists.txt
@@ -1,30 +1,19 @@
-################################################################################
-# Package: L1TopoRDO
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( L1TopoRDO )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          AtlasTest/TestTools
-                          Control/AthenaKernel
-                          Control/AthContainers)
-
 # External dependencies:
-find_package( Boost COMPONENTS filesystem thread system )
+find_package( Boost )
 
 # Component(s) in the package:
 atlas_add_library( L1TopoRDO
                    src/*.cxx
                    PUBLIC_HEADERS L1TopoRDO
                    PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                   LINK_LIBRARIES TestTools AthContainers AthenaKernel
-                   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} )
+                   LINK_LIBRARIES AthContainers AthenaKernel )
 
 atlas_add_test( L1TopoRDO_test
                 SOURCES
                 test/L1TopoRDO_test.cxx
-                INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                LINK_LIBRARIES ${Boost_LIBRARIES} TestTools AthContainers AthenaKernel L1TopoRDO )
-
+                LINK_LIBRARIES L1TopoRDO )
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoSimulation/CMakeLists.txt
index d59494a9456fba0a3be7143cd576cafee83cea52..44e9340ac2e1ead1fb1f4680610360e8830e1663 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/CMakeLists.txt
@@ -1,30 +1,8 @@
-# $Id: CMakeLists.txt 780947 2016-10-28 10:01:38Z salderwe $
-################################################################################
-# Package: L1TopoSimulation
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( L1TopoSimulation )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PRIVATE
-   Control/AthenaBaseComps
-   Control/AthenaMonitoring
-   GaudiKernel
-   Trigger/TrigConfiguration/TrigConfBase
-   Trigger/TrigConfiguration/TrigConfInterfaces
-   Trigger/TrigConfiguration/TrigConfL1Data
-   Trigger/TrigSteer/TrigInterfaces
-   Trigger/TrigT1/L1Topo/L1TopoConfig
-   Trigger/TrigT1/L1Topo/L1TopoCoreSim
-   Trigger/TrigT1/L1Topo/L1TopoEvent
-   Trigger/TrigT1/L1Topo/L1TopoInterfaces
-   Trigger/TrigT1/TrigT1CaloEvent
-   Trigger/TrigT1/TrigT1CaloUtils
-   Trigger/TrigT1/TrigT1Interfaces
-   Trigger/TrigT1/TrigT1Result )
-
 # External dependencies:
 find_package( ROOT COMPONENTS Core Hist )
 
@@ -41,17 +19,13 @@ atlas_add_library( L1TopoSimulationLib
 atlas_add_component( L1TopoSimulation
    src/*.h src/*.cxx src/components/*.cxx
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-   LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaMonitoringLib
-   TrigInterfacesLib TrigT1CaloEventLib TrigT1CaloUtilsLib
-   AthenaBaseComps GaudiKernel TrigConfBase TrigConfL1Data L1TopoConfig L1TopoSimulationLib
-   L1TopoCoreSim L1TopoEvent L1TopoInterfaces L1TopoAlgorithms TrigT1Interfaces
-   TrigT1Result TrigConfInterfaces )
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaMonitoringLib L1TopoConfig L1TopoCoreSim L1TopoEvent L1TopoInterfaces L1TopoRDO L1TopoSimulationLib StoreGateLib TrigConfBase TrigConfInterfaces TrigConfL1Data TrigInterfacesLib TrigT1CaloEventLib TrigT1CaloUtilsLib TrigT1Interfaces TrigT1Result xAODTrigCalo xAODTrigger )
 
 atlas_add_component( L1TopoSimulationTest
    src/test/*.h src/test/*.cxx src/test/components/*.cxx src/AthenaL1TopoHistSvc.h src/AthenaL1TopoHistSvc.cxx
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-   LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel L1TopoCoreSim L1TopoEvent L1TopoInterfaces L1TopoAlgorithms L1TopoSimulationLib)
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaMonitoringLib GaudiKernel L1TopoConfig L1TopoCoreSim L1TopoEvent L1TopoInterfaces StoreGateLib TrigConfBase TrigConfInterfaces )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/*.py )
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.cxx
index 73c924817a5986ef45a4df48031e6cd8839f6c5f..8b3019d0c546c3a12d66b6f698e02ad87b7b4b1d 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.cxx
@@ -13,7 +13,6 @@
 #include "L1TopoEvent/ClusterTOB.h"
 #include "L1TopoEvent/TopoInputEvent.h"
 #include "TrigT1Interfaces/RecMuonRoI.h"
-#include "TrigT1Interfaces/TrigT1StoreGateKeys.h"
 #include "TrigT1Interfaces/RecMuonRoiSvc.h"
 #include "TrigT1Interfaces/MuCTPIL1Topo.h"
 #include "TrigT1Interfaces/MuCTPIL1TopoCandidate.h"
@@ -34,29 +33,17 @@ using namespace LVL1;
 MuonInputProvider::MuonInputProvider( const std::string& type, const std::string& name, 
                                       const IInterface* parent) :
    base_class(type, name, parent),
-   m_roibLocation(ROIB::DEFAULT_RoIBRDOLocation),
    m_histSvc("THistSvc", name),
    m_configSvc( "TrigConf::TrigConfigSvc/TrigConfigSvc", name ),
    m_recRPCRoiSvc( LVL1::ID_RecRpcRoiSvc, name ),
    m_recTGCRoiSvc( LVL1::ID_RecTgcRoiSvc, name ),
-   m_MuctpiSimTool("LVL1MUCTPI::L1MuctpiTool/LVL1MUCTPI__L1MuctpiTool"),
-   m_muonROILocation( LVL1MUCTPI::DEFAULT_MuonRoIBLocation ),
-   m_MuonEncoding(0),
-   m_MuCTPItoL1TopoLocation (LVL1MUCTPI::DEFAULT_MuonL1TopoLocation),
-   m_MuCTPItoL1TopoLocationPlusOne("")
+   m_MuctpiSimTool("LVL1MUCTPI::L1MuctpiTool/LVL1MUCTPI__L1MuctpiTool")
 {
    declareInterface<LVL1::IInputTOBConverter>( this );
-   declareProperty( "ROIBResultLocation", m_roibLocation, "Storegate key for the reading the ROIBResult" );
    declareProperty( "LVL1ConfigSvc", m_configSvc, "LVL1 Config Service");
    declareProperty( "RecRpcRoiSvc", m_recRPCRoiSvc, "RPC Rec Roi Service");
    declareProperty( "RecTgcRoiSvc", m_recTGCRoiSvc, "TGC Rec Roi Service");
-   declareProperty( "MuonROILocation", m_muonROILocation, "Storegate key for the Muon ROIs" );
-
-   declareProperty( "MuonEncoding", m_MuonEncoding, "0=full granularity Mu ROIs, 1=MuCTPiToTopo granularity");
-   declareProperty( "locationMuCTPItoL1Topo", m_MuCTPItoL1TopoLocation, "Storegate key for MuCTPItoL1Topo ");
    declareProperty( "MuctpiSimTool", m_MuctpiSimTool,"Tool for MUCTPIsimulation");
-
-   declareProperty("BCPlusOneLocation", m_MuCTPItoL1TopoLocationPlusOne);
 }
 
 MuonInputProvider::~MuonInputProvider()
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.h
index 150bed834e1060b3ed0d14b624922e9233ab4c55..899ca5f4b0077bdcb7285802e281627d19de291c 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.h
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.h
@@ -13,6 +13,7 @@
 #include <vector>
 #include "TrigT1Result/RoIBResult.h"
 #include "TrigT1Interfaces/MuCTPIToRoIBSLink.h"
+#include "TrigT1Interfaces/TrigT1StoreGateKeys.h"
 
 class TH1I;
 class TH2I;
@@ -68,7 +69,6 @@ namespace LVL1 {
       */
       unsigned int topoMuonPtThreshold(const MuCTPIL1TopoCandidate &mctpiCand) const;
 
-      SG::ReadHandleKey<ROIB::RoIBResult> m_roibLocation;
 
       ServiceHandle<ITHistSvc> m_histSvc;
 
@@ -81,14 +81,14 @@ namespace LVL1 {
 
       std::vector< TrigConf::TriggerThreshold* > m_MuonThresholds;
 
-      SG::ReadHandleKey<L1MUINT::MuCTPIToRoIBSLink> m_muonROILocation;    //!<  Muon ROIs SG key
+      SG::ReadHandleKey<L1MUINT::MuCTPIToRoIBSLink> m_muonROILocation { this, "MuonROILocation", LVL1MUCTPI::DEFAULT_MuonRoIBLocation, "Storegate key for the Muon ROIs" };
+      SG::ReadHandleKey<ROIB::RoIBResult> m_roibLocation{ this, "ROIBResultLocation", ROIB::DEFAULT_RoIBRDOLocation, "Storegate key for the reading the ROIBResult" };
+      SG::ReadHandleKey<LVL1::MuCTPIL1Topo> m_MuCTPItoL1TopoLocation { this, "locationMuCTPItoL1Topo", LVL1MUCTPI::DEFAULT_MuonL1TopoLocation, "Storegate key for MuCTPItoL1Topo "};
+      SG::ReadHandleKey<LVL1::MuCTPIL1Topo> m_MuCTPItoL1TopoLocationPlusOne { this, "BCPlusOneLocation", "", "Storegate key for MuCTPItoL1TopoPlusOne"};
+      Gaudi::Property<uint16_t> m_MuonEncoding {this, "MuonEncoding", 0, "0=full granularity Mu ROIs, 1=MuCTPiToTopo granularity"};
 
       TH1I * m_hPt {nullptr};
       TH2I * m_hEtaPhi {nullptr};
-
-      int m_MuonEncoding; //!< Use 0 for full granularity; 1 for MuCTPiToTopo muon granularity
-      SG::ReadHandleKey<LVL1::MuCTPIL1Topo> m_MuCTPItoL1TopoLocation;
-      SG::ReadHandleKey<LVL1::MuCTPIL1Topo> m_MuCTPItoL1TopoLocationPlusOne;
    };
 }
 
diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/CMakeLists.txt
index c2b90db9e5025c06e56395c7e38a83ae75072f21..b6898cfd1ec0ebbff39038c99f1ca06e564e1930 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/CMakeLists.txt
@@ -1,15 +1,8 @@
-################################################################################
-# Package: L1TopoSimulationUtils
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( L1TopoSimulationUtils )
 
-# Trigger dependencies
-atlas_depends_on_subdirs(
-   PUBLIC
-   Trigger/TrigT1/L1Topo/L1TopoEvent )
-
 find_package( Boost )
 
 # Component(s) in the package:
diff --git a/Trigger/TrigT1/L1Topo/L1TopoValidation/L1TopoValDataCnv/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoValidation/L1TopoValDataCnv/CMakeLists.txt
index 1517c8052b5c1f4da8fa09b7f2fb0b25dcfdd8f3..39aec5d76e9ddbbf9fcf0b98d6e502b34d9bf1fa 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoValidation/L1TopoValDataCnv/CMakeLists.txt
+++ b/Trigger/TrigT1/L1Topo/L1TopoValidation/L1TopoValDataCnv/CMakeLists.txt
@@ -1,22 +1,10 @@
-################################################################################
-# Package: L1TopoValDataCnv
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( L1TopoValDataCnv )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs( PUBLIC
-                          Trigger/TrigEvent/TrigSteeringEvent
-                          PRIVATE
-                          Control/AthenaBaseComps
-                          Control/AthenaKernel
-                          Event/xAOD/xAODTrigger
-                          GaudiKernel
-                          Trigger/TrigT1/TrigT1Result )
-
 # Component(s) in the package:
 atlas_add_component( L1TopoValDataCnv
                      src/*.cxx
                      src/components/*.cxx
-                     LINK_LIBRARIES TrigSteeringEvent AthenaBaseComps AthenaKernel xAODTrigger GaudiKernel TrigT1Result )
+                     LINK_LIBRARIES AthenaBaseComps AthenaKernel TrigSteeringEvent TrigT1Result xAODTrigger )
diff --git a/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py b/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py
index 1cd714872fbc573edcb28aed4acd559bd384ca56..6b60e639d94d67a92bd1e1634a73fde4366ae25f 100644
--- a/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py
+++ b/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py
@@ -133,6 +133,9 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E
     InDetSCTRawDataProvider.RDOCacheKey = InDetCacheNames.SCTRDOCacheKey
     InDetSCTRawDataProvider.BSErrCacheKey = InDetCacheNames.SCTBSErrCacheKey
 
+    from RegionSelector.RegSelToolConfig import makeRegSelTool_SCT
+    InDetSCTRawDataProvider.RegSelTool = makeRegSelTool_SCT()
+
     viewAlgs.append(InDetSCTRawDataProvider)
 
     # load the SCTEventFlagWriter
@@ -251,6 +254,8 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E
   InDetSCT_Clusterization.RoIs = rois
   InDetSCT_Clusterization.ClusterContainerCacheKey = InDetCacheNames.SCT_ClusterKey
 
+  from RegionSelector.RegSelToolConfig import makeRegSelTool_SCT
+  InDetSCT_Clusterization.RegSelTool = makeRegSelTool_SCT()
 
   viewAlgs.append(InDetSCT_Clusterization)
 
diff --git a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py
index a5fceef394520721819ea69a3afc09cb18d09a82..f8f2b730e845c2d4d787019bf36a20492314e57e 100644
--- a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py
+++ b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py
@@ -172,6 +172,7 @@ def TrigInDetCondConfig( flags ):
   BeamSpotCondAlg=CompFactory.BeamSpotCondAlg
   acc.addCondAlgo(BeamSpotCondAlg( "BeamSpotCondAlg" ))
 
+
   from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg
   mfsc = MagneticFieldSvcCfg(flags)
   acc.merge( mfsc )
@@ -186,6 +187,10 @@ def TrigInDetConfig( flags, roisKey="EMRoIs", signatureName='' ):
 
   from InDetRecExample.InDetKeys import InDetKeys
 
+  # Region selector tool for SCT
+  from RegionSelector.RegSelToolConfig import regSelTool_SCT_Cfg
+  RegSelTool_SCT = acc.popToolsAndMerge(regSelTool_SCT_Cfg(flags))
+
   #Only add raw data decoders if we're running over raw data
   isMC = flags.Input.isMC
   if not isMC:
@@ -238,6 +243,8 @@ def TrigInDetConfig( flags, roisKey="EMRoIs", signatureName='' ):
     InDetSCTRawDataProvider.RoIs = roisKey
     InDetSCTRawDataProvider.RDOCacheKey = InDetCacheNames.SCTRDOCacheKey
 
+    InDetSCTRawDataProvider.RegSelTool = RegSelTool_SCT
+
     acc.addEventAlgo(InDetSCTRawDataProvider)
 
     # load the SCTEventFlagWriter
@@ -334,6 +341,8 @@ def TrigInDetConfig( flags, roisKey="EMRoIs", signatureName='' ):
   InDetSCT_Clusterization.RoIs = roisKey
   InDetSCT_Clusterization.ClusterContainerCacheKey = InDetCacheNames.SCT_ClusterKey
 
+  InDetSCT_Clusterization.RegSelTool = RegSelTool_SCT
+
   acc.addEventAlgo(InDetSCT_Clusterization)
 
 
diff --git a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetPriVtxConfig.py b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetPriVtxConfig.py
index 2b2aa57502ebc24f5b6c33407c959855666b5766..85b8bec6df85deca48f5387b073d5bce3ea0430c 100644
--- a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetPriVtxConfig.py
+++ b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetPriVtxConfig.py
@@ -1,143 +1,313 @@
-#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+__author__ =   "Mark Sutton"
+__doc__    =   "vertexFinder_builder"
+__all__    = [ "vertexFinder_builder", "makeVertices" ]
+
+
+#  These routines create the vertex finder for 
+#  use in the trigger
+#  
+#  This is done in the 
+# 
+#     vertexFinder_builder() 
 #
-#           Vertexing 
+#  function at the end - the rest are just helper 
+#  functions to create the relevant tools that are 
+#  needed along the way 
 
 
-from AthenaCommon.Logging import logging
-log = logging.getLogger("InDetVtx")
+# linearised track factory, whatever that does, for the vertex finder
 
+def  linearTrackFactory_builder( signature, extrapolator ) :
 
-def makeVertices( whichSignature, inputTrackCollection, outputVtxCollection ):
-   from AthenaCommon.AppMgr import ToolSvc
-   from TrigEDMConfig.TriggerEDMRun3 import recordable
-   #vtxCollectionName = "HLT_xPrimVx"
+    from AthenaCommon.AppMgr import ToolSvc
 
-   #If signature specified add suffix to the algorithms
-   signature =  "_" + whichSignature if whichSignature else ''
-   
-   
-   from TrkExTools.TrkExToolsConf import Trk__Extrapolator
-   InDetTrigExtrapolator = Trk__Extrapolator(name                    = 'InDetTrigExtrapolator' + signature,
-   #                                        Propagators             = [ InDetPropagator ], # [ InDetPropagator, InDetStepPropagator ],
-   #                                        MaterialEffectsUpdators = [ InDetMaterialUpdator ],
-   #                                        Navigator               = InDetNavigator,
-   #                                        SubPropagators          = InDetSubPropagators,
-   #                                        SubMEUpdators           = InDetSubUpdators)
-                                           )
-   ToolSvc += InDetTrigExtrapolator
-   
-   from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__FullLinearizedTrackFactory
-   InDetTrigLinFactory = Trk__FullLinearizedTrackFactory(name              = "InDetTrigFullLinearizedTrackFactory" + signature,
-                                                     Extrapolator      = InDetTrigExtrapolator )
-   ToolSvc += InDetTrigLinFactory
-   
-   from TrkVertexBilloirTools.TrkVertexBilloirToolsConf import Trk__FastVertexFitter
-   InDetTrigVxFitterTool = Trk__FastVertexFitter(name                   = "InDetTrigFastVertexFitterTool" + signature,
-                                             LinearizedTrackFactory = InDetTrigLinFactory,
-                                             Extrapolator           = InDetTrigExtrapolator) # commented out due to the InDetPriVxFinderToolNoBeamConstraint testing 
-   ToolSvc += InDetTrigVxFitterTool
-   
-   
-   from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
-   InDetTrigTrackSelectorTool = InDet__InDetTrackSelectionTool(name = "InDetTrigDetailedTrackSelectionTool" + signature,
-   #                                                          CutLevel = InDetPrimaryVertexingCuts.TrackCutLevel(),
-   #                                                          minPt = InDetPrimaryVertexingCuts.minPT(),
-   #                                                          maxD0 = InDetPrimaryVertexingCuts.IPd0Max(),
-   #                                                          maxZ0 = InDetPrimaryVertexingCuts.z0Max(),
-   #                                                          maxZ0SinTheta = InDetPrimaryVertexingCuts.IPz0Max(),
-   #                                                          maxSigmaD0 = InDetPrimaryVertexingCuts.sigIPd0Max(),
-   #                                                          maxSigmaZ0SinTheta = InDetPrimaryVertexingCuts.sigIPz0Max(),
-                                                             # maxChiSqperNdf = InDetPrimaryVertexingCuts.fitChi2OnNdfMax(), # Seems not to be implemented?
-   #                                                          maxAbsEta = InDetPrimaryVertexingCuts.etaMax(),
-   #                                                          minNInnermostLayerHits = InDetPrimaryVertexingCuts.nHitInnermostLayer(),
-   #                                                          minNPixelHits = InDetPrimaryVertexingCuts.nHitPix(),
-   #                                                          maxNPixelHoles = InDetPrimaryVertexingCuts.nHolesPix(),
-   #                                                          minNSctHits = InDetPrimaryVertexingCuts.nHitSct(),
-   #                                                          minNTrtHits = InDetPrimaryVertexingCuts.nHitTrt(),
-   #                                                          minNSiHits = InDetPrimaryVertexingCuts.nHitSi(),
-   #                                                          TrackSummaryTool = InDetTrackSummaryTool,
-                                                             Extrapolator = InDetTrigExtrapolator)
-   ToolSvc += InDetTrigTrackSelectorTool
-   
-   from TrkVertexSeedFinderUtils.TrkVertexSeedFinderUtilsConf import Trk__GaussianTrackDensity
-   TrigGaussDensityEstimator = Trk__GaussianTrackDensity( name = "TrigGaussianDensity" + signature )
-   
-   ToolSvc += TrigGaussDensityEstimator
-   
-   from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__TrackDensitySeedFinder
-   InDetTrigVtxSeedFinder = Trk__TrackDensitySeedFinder( name = "TrigGaussianDensitySeedFinder" + signature,
-                                                     DensityEstimator = TrigGaussDensityEstimator )
-   
-   ToolSvc += InDetTrigVtxSeedFinder
-   
-   from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__ImpactPoint3dEstimator
-   InDetTrigImpactPoint3dEstimator = Trk__ImpactPoint3dEstimator(name              = "InDetTrigImpactPoint3dEstimator" + signature,
-                                                             Extrapolator      = InDetTrigExtrapolator)
-   
-   ToolSvc += InDetTrigImpactPoint3dEstimator
-   
-   from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetIterativePriVxFinderTool
-   InDetTrigPriVxFinderToolNoBeamConstraint = InDet__InDetIterativePriVxFinderTool(name                 = "InDetTrigPriVxFinderToolNoBeamConstraint" + signature,
-                                                                               VertexFitterTool         = InDetTrigVxFitterTool,
-                                                                               TrackSelector            = InDetTrigTrackSelectorTool,
-                                                                               SeedFinder               = InDetTrigVtxSeedFinder,
-                                                                               ImpactPoint3dEstimator   = InDetTrigImpactPoint3dEstimator,
-                                                                               LinearizedTrackFactory   = InDetTrigLinFactory,
-                                                                               useBeamConstraint        = False,
-                                                                               significanceCutSeeding   = 12,
-                                                                               maximumChi2cutForSeeding = 49,
-                                                                               maxVertices              = 200,
-                                                                               createSplitVertices      = False,
-                                                                               #doMaxTracksCut           = InDetPrimaryVertexingCuts.doMaxTracksCut(),
-                                                                               #MaxTracks                = InDetPrimaryVertexingCuts.MaxTracks()  )
-                                                                              ) 
-   ToolSvc += InDetTrigPriVxFinderToolNoBeamConstraint
-   
-   #  if InDetFlags.primaryVertexSortingSetup() == 'SumPt2Sorting':
-   
-   from TrkVertexWeightCalculators.TrkVertexWeightCalculatorsConf import Trk__SumPtVertexWeightCalculator
-   TrigVertexWeightCalculator = Trk__SumPtVertexWeightCalculator(name              = "InDetSumPtVertexWeightCalculator" + signature,
-                                                             DoSumPt2Selection = True)
-   
-   #    elif InDetFlags.primaryVertexSortingSetup() == 'VxProbSorting':
-   
-   #  from TrkVertexWeightCalculators.TrkVertexWeightCalculatorsConf import Trk__VxProbVertexWeightCalculator
-   #  VertexWeightCalculator = Trk__VxProbVertexWeightCalculator(name          = "InDetVxProbVertexWeightCalculator",
-   #                                                             HistogramPath = "/VxProbHisto/h_sTrkPdfminBias")
-   
-   #    elif InDetFlags.primaryVertexSortingSetup() == 'NNSorting':
-         
-   #  from TrkVertexWeightCalculators.TrkVertexWeightCalculatorsConf import Trk__NNVertexWeightCalculator
-   #  VertexWeightCalculator = Trk__NNVertexWeightCalculator(name = "InDetNNVertexWeightCalculator",
-   #                                                             HistoFilePath ="/NNHisto/")
-       
-   ToolSvc += TrigVertexWeightCalculator
+    from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__FullLinearizedTrackFactory
+
+    linearTrackFactory = Trk__FullLinearizedTrackFactory( name         = "FullLinearizedTrackFactory" + signature,
+                                                          Extrapolator = extrapolator )
+    ToolSvc += linearTrackFactory
+
+    return linearTrackFactory
+
+
+
+# vertex fitter for the vertex finder 
+
+def  vertexFitterTool_builder( signature, linearTrackFactory, extrapolator ) :
+
+    from AthenaCommon.AppMgr import ToolSvc
+    
+    from TrkVertexBilloirTools.TrkVertexBilloirToolsConf import Trk__FastVertexFitter
+    vertexFitterTool = Trk__FastVertexFitter( name                   = "InDetTrigFastVertexFitterTool" + signature,
+                                              LinearizedTrackFactory = linearTrackFactory,
+                                              Extrapolator           = extrapolator ) 
+    ToolSvc += vertexFitterTool
+    
+    return vertexFitterTool
+
+
+
+
+# impact parameter estimator
+
+def  impactEstimator_builder( signature, extrapolator ) :
+
+    from AthenaCommon.AppMgr import ToolSvc
+    
+    from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__ImpactPoint3dEstimator
+    impactPoint3dEstimator = Trk__ImpactPoint3dEstimator( name         = "InDetTrigImpactPoint3dEstimator" + signature,
+                                                          Extrapolator = extrapolator )
    
+    ToolSvc += impactPoint3dEstimator
+
+    return impactPoint3dEstimator
+
+
+
+
+
+def  trackSelectorTool_builder( signature, trackSummaryTool, extrapolator ) :
+
+    from AthenaCommon.AppMgr import ToolSvc
+    
+    # now create the track selection tool itself ...
+    
+    from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
    
-   from TrkVertexTools.TrkVertexToolsConf import Trk__VertexCollectionSortingTool
-   TrigVertexCollectionSortingTool = Trk__VertexCollectionSortingTool(name                   = "InDetVertexCollectionSortingTool" + signature,
-                                                                  VertexWeightCalculator = TrigVertexWeightCalculator)
-   ToolSvc += TrigVertexCollectionSortingTool
+    trackSelectorTool = InDet__InDetTrackSelectionTool( name     = "InDetTrigDetailedTrackSelectionTool" + signature,
+                                                       Extrapolator     = extrapolator ) 
+
+# these changes need to go in next ...
+#                                                        TrackSummaryTool = trackSummaryTool,
+#                                                        CutLevel = configuredTrigVtxCuts.TrackCutLevel(),
+#                                                        # maybe have all these cuts passed in just by passing in the configuredVtsCuts object 
+#                                                        minPt    = configuredTrigVtxCuts.minPT(),
+#                                                        maxD0    = configuredTrigVtxCuts.IPd0Max(),
+#                                                        maxZ0    = configuredTrigVtxCuts.z0Max(),
+#                                                        maxZ0SinTheta = configuredTrigVtxCuts.IPz0Max(),
+#                                                        maxSigmaD0    = configuredTrigVtxCuts.sigIPd0Max(),
+#                                                        maxSigmaZ0SinTheta = configuredTrigVtxCuts.sigIPz0Max(),
+#                                                        maxChiSqperNdf     = configuredTrigVtxCuts.fitChi2OnNdfMax(), # Seems not to be implemented?
+#                                                        maxAbsEta          = configuredTrigVtxCuts.etaMax(),
+#                                                        minNInnermostLayerHits = configuredTrigVtxCuts.nHitInnermostLayer(),
+#                                                        minNPixelHits    = configuredTrigVtxCuts.nHitPix(),
+#                                                        maxNPixelHoles   = configuredTrigVtxCuts.nHolesPix(),
+#                                                        minNSctHits      = configuredTrigVtxCuts.nHitSct(),
+#                                                        minNTrtHits      = configuredTrigVtxCuts.nHitTrt(),
+#                                                        minNSiHits       = configuredTrigVtxCuts.nHitSi() )
+
+    ToolSvc += trackSelectorTool
    
-   from InDetPriVxFinder.InDetPriVxFinderMonitoring import InDetPriVxFinderMonitoringTool
+    return trackSelectorTool
+
+
+
+
+# the trackdensity seed finder builder ...
+
+def  trackDensitySeedFinder_builder( signature ) :
+    
+    from AthenaCommon.AppMgr import ToolSvc
+
+    # Gaussian Density finder needed by the seed finder ...
+    
+    from TrkVertexSeedFinderUtils.TrkVertexSeedFinderUtilsConf import Trk__GaussianTrackDensity
+    gaussianTrackDensity = Trk__GaussianTrackDensity( name = "TrigGaussianDensity" + signature )
    
+    ToolSvc += gaussianTrackDensity
    
-   from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder
-   InDetTrigPriVxFinder = InDet__InDetPriVxFinder(name                        = "InDetTrigPriVxFinder" + signature,
-                          VertexFinderTool            = InDetTrigPriVxFinderToolNoBeamConstraint,
-                          TracksName                  = recordable(inputTrackCollection), #recordable("HLT_IDTrack"),          #InDetKeys.xAODTrackParticleContainer(),
-                          VxCandidatesOutputName      = outputVtxCollection, #"HLT_xPrimVx",  #InDetKeys.PrimaryVerticesWithoutBeamConstraint(),
-                          VertexCollectionSortingTool = TrigVertexCollectionSortingTool,
-                          doVertexSorting             = True,
-                          #OutputLevel = 2,
-                          PriVxMonTool = InDetPriVxFinderMonitoringTool(),
-                          )
+    # TrackDensitySeed Finder for the iterative vtx finder tool ...
+    
+    from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__TrackDensitySeedFinder
+    trackDensitySeedFinder = Trk__TrackDensitySeedFinder( name             = "TrigGaussianDensitySeedFinder" + signature,
+                                                          DensityEstimator = gaussianTrackDensity )
    
-   #Its not a tool but algorithm!
-   #ToolSvc += InDetTrigPriVxFinder
-   log.debug(InDetTrigPriVxFinder)
+    ToolSvc += trackDensitySeedFinder
 
+    return trackDensitySeedFinder
    
+
+
+
+
+# create the actual vertex finder tool ...
+
+def vertexFinderTool_builder( signature ) : 
+
+    from AthenaCommon.AppMgr import ToolSvc
+
+    # use the getters from TrackingCommon ... 
+    import InDetRecExample.TrackingCommon as TrackingCommon
    
-   return  [ InDetTrigPriVxFinder  ]
+    # the track summary tool, and extrapolator will be needed by multiple 
+    # tools so create them once and pass them into the builders ...  
+
+    trackSummaryTool = TrackingCommon.getInDetTrackSummaryTool()
+    extrapolator     = TrackingCommon.getInDetExtrapolator()
+
+    # NB: not yet ready to go in, but we have the code here in readiness ...
+    # get the selection cuts use to select the actual tracks in the tool ...
+    #   from InDetTrigRecExample.TrigInDetConfiguredVtxCuts import ConfiguredTrigVertexingCuts 
+    #   configuredTrigVtxCuts = ConfiguredTrigVertexingCuts() 
+    #   configuredTrigVtxCuts.printInfo()
+
+
+    
+    # now create the five sub tools needed ...
+
+    linearTrackFactory     =     linearTrackFactory_builder( signature, extrapolator )
+    vertexFitterTool       =       vertexFitterTool_builder( signature, linearTrackFactory, extrapolator )
+    impactEstimator        =        impactEstimator_builder( signature, extrapolator )
+    trackSelectorTool      =      trackSelectorTool_builder( signature, trackSummaryTool, extrapolator )
+    trackDensitySeedFinder = trackDensitySeedFinder_builder( signature )
+    
+    # now create the actual vertex finder tool ...
+    # this is the main part of the actual working part of the code - 
+    # the vertoces are found by this class, in this instance it includes
+    # a beam line constraint - it we want this to allow this constrain 
+    # to be disabled we can add a flag and some additional logic 
+
+    from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetIterativePriVxFinderTool
+    
+    vertexFinderTool = InDet__InDetIterativePriVxFinderTool( name                     = "InDetTrigPriVxFinderTool" + signature,
+                                                             VertexFitterTool         = vertexFitterTool,
+                                                             TrackSelector            = trackSelectorTool,
+                                                             SeedFinder               = trackDensitySeedFinder,
+                                                             ImpactPoint3dEstimator   = impactEstimator,
+                                                             LinearizedTrackFactory   = linearTrackFactory,
+                                                             useBeamConstraint        = False,
+                                                             significanceCutSeeding   = 12,
+                                                             maximumChi2cutForSeeding = 49,
+                                                             maxVertices              = 200,
+                                                             createSplitVertices      = False )
+# these too should go in next ...
+#                                                            doMaxTracksCut           = configuredTrigVtxCuts.doMaxTracksCut(),
+#                                                            MaxTracks                = configuredTrigVtxCuts.MaxTracks() )
+                                                           
+    
+ # InDetAdaptiveMultiPriVxFinderTool job options for later 
+ #  verxtexFinderTool = InDet__InDetAdaptiveMultiPriVxFinderTool( name = "InDetTrigPriVxFinderTool" + signature,
+ #                                                             VertexFitterTool         = vertexFitterTool,
+ #  ...
+
+ # VertexFitterTool  = vertexFitterTool,
+ # TrackSelector     = trackSelectorTool,
+ # SeedFinder        = trackDensitySeedFinder,
+ 
+ # IPEstimator       = Trk::ITrackToVertexIPEstimator  : impactEstimator is different type than for IterativeFinder 
+ # BeamSpotKey       = InDet::BeamSpotData  : what is this ??
+
+ # TracksMaxZinterval = 
+ # maxVertexChi2 = 
+ # finalCutMaxVertexChi2 = 
+ # cutVertexDependence = 
+ # MinWeight = 
+ # realMultiVertex = 
+ # useFastCompatibility = 
+ # useBeamConstraint = 
+ # addSingleTrackVertices = 
+ # tracksMaxSignificance = 
+ # m_useSeedConstraint = 
+ # selectiontype = 
+ # //==0 for sum p_t^2
+ # //==1 for NN
+ # //==2 for min bias compatibility estimation (in the future)
+ # maxIterations = 
+ # do3dSplitting = 
+ # zBfieldApprox = 
+ # maximumVertexContamination = 
+
+    ToolSvc += vertexFinderTool
    
+    return vertexFinderTool
+
+
+
+
+
+# create the vertex sorting tool - this is to sort the vertex candidates into 
+# some order so clients can pick the best one off the front and so on ...
+
+def vertexSortingTool_builder( signature ) :
+
+    from AthenaCommon.AppMgr import ToolSvc
+    
+    # create the vertex weight calculator, to be passed into the sorting tool ... 
+
+    from TrkVertexWeightCalculators.TrkVertexWeightCalculatorsConf import Trk__SumPtVertexWeightCalculator
+    vertexWeightCalculator = Trk__SumPtVertexWeightCalculator( name  = "InDetSumPtVertexWeightCalculator" + signature,
+                                                               DoSumPt2Selection = True)
+    ToolSvc += vertexWeightCalculator
+    
+    # and now create the sorting tool ...
+
+    from TrkVertexTools.TrkVertexToolsConf import Trk__VertexCollectionSortingTool
+    vertexSortingTool = Trk__VertexCollectionSortingTool( name = "InDetVertexCollectionSortingTool" + signature,
+                                                            VertexWeightCalculator = vertexWeightCalculator)
+    ToolSvc += vertexSortingTool
+    
+    return vertexSortingTool
+    
+
+
+
+# create online vertex monitoring histograms
+
+def vertexMonitoringTool_builder( signature ) : 
+    from InDetPriVxFinder.InDetPriVxFinderMonitoring import InDetPriVxFinderMonitoringTool
+    return  InDetPriVxFinderMonitoringTool()
+
+
+
+
+
+# actual function to create the vertex finder instance
+# needs the tool to actually create the vertices, plus the 
+# tool to sort them into the desired order, and some monitoring
+
+def vertexFinder_builder( signature, inputTracks, outputVertices ) :
+
+    from AthenaCommon.Logging import logging
+    log = logging.getLogger("InDetVtx")
+
+    from TrigEDMConfig.TriggerEDMRun3 import recordable
+
+    # create the three subtools for use by the vertexFinder itself ...
+    
+    # the actual tool which finde the vertices ... 
+    vertexFinderTool = vertexFinderTool_builder( signature ) 
+
+    # which are then sorted ...
+    vertexSortingTool = vertexSortingTool_builder( signature )
+
+    # and finally some monitoring ...
+    vertexMonitoringTool = vertexMonitoringTool_builder( signature )
+
+    # no create the vertex finder ...
+
+    from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder
+
+    vertexFinder = InDet__InDetPriVxFinder( name                        = "InDetTrigPriVxFinder" + signature,
+                                            VertexFinderTool            = vertexFinderTool,
+                                            TracksName                  = recordable(inputTracks), 
+                                            VxCandidatesOutputName      = recordable(outputVertices), 
+                                            VertexCollectionSortingTool = vertexSortingTool,
+                                            doVertexSorting             = True,
+                                            PriVxMonTool                = vertexMonitoringTool )
+    
+    log.debug(vertexFinder)
+    
+    return  [ vertexFinder ]
+
+
+
+# old function for backwards compatability
+
+def makeVertices( whichSignature, inputTrackCollection, outputVtxCollection ) :
+    return vertexFinder_builder( signature      = whichSignature, 
+                                 inputTracks    = inputTrackCollection,
+                                 outputVertices = outputVtxCollection )
+    
+
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/CMakeLists.txt b/Trigger/TrigTools/TrigT2CaloCalibration/CMakeLists.txt
index a6b9d6f218a1e703d110dd9fa80ad1edf4bc22bf..35e749ec9c54840b6e26b6d427b7be62d2c13557 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/CMakeLists.txt
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/CMakeLists.txt
@@ -11,6 +11,7 @@ atlas_depends_on_subdirs( PUBLIC
                           Calorimeter/CaloConditions
                           Calorimeter/CaloGeoHelpers
                           Calorimeter/CaloRec
+                          Calorimeter/CaloUtils
                           Control/AthenaBaseComps
                           Control/AthenaKernel
                           Control/StoreGate
@@ -32,7 +33,7 @@ atlas_add_library( TrigT2CaloCalibrationLib
                    src/*.cxx
                    PUBLIC_HEADERS TrigT2CaloCalibration
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES CaloConditions CaloGeoHelpers AthenaBaseComps AthenaKernel AthenaPoolUtilities xAODTrigCalo GaudiKernel TrigCaloEvent CaloClusterCorrectionLib CaloRecLib StoreGateLib SGtests CaloDetDescrLib AthenaPoolCnvSvcLib RegistrationServicesLib
+                   LINK_LIBRARIES CaloConditions CaloGeoHelpers AthenaBaseComps AthenaKernel AthenaPoolUtilities xAODTrigCalo GaudiKernel TrigCaloEvent CaloClusterCorrectionLib CaloRecLib CaloUtilsLib StoreGateLib SGtests CaloDetDescrLib AthenaPoolCnvSvcLib RegistrationServicesLib
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} EventInfo )
 
 atlas_add_component( TrigT2CaloCalibration
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaGapCalibration.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaGapCalibration.h
index 618b08c9ec58c333a3f0c3a5f565ef21df8f2271..ca2515a174a3ed113db42d1f13775f9602a6abe0 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaGapCalibration.h
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaGapCalibration.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
 */
 
 
@@ -11,7 +11,7 @@
 #include "GaudiKernel/MsgStream.h"
 
 // Specific for this calibration
-#include "CaloRec/ToolWithConstantsMixin.h"
+#include "CaloUtils/ToolWithConstants.h"
 #include "CaloConditions/Array.h"
 #include "CaloClusterCorrection/interpolate.h"
 #include "CaloGeoHelpers/CaloSampling.h"
@@ -21,57 +21,37 @@
 //class TrigEMCluster;
 
 /** General Interface for calibrations at the LVL2 Egamma Calo Fex algo */
-class EgammaGapCalibration : virtual public IEgammaCalibration,
-			     virtual public AthAlgTool, 
-			     public CaloRec::ToolWithConstantsMixin 
+class EgammaGapCalibration :
+  public extends<CaloUtils::ToolWithConstants<AthAlgTool>,
+                 IEgammaCalibration>          
 {
  public:
-  
-  /** Constructor */
-  EgammaGapCalibration(const std::string & type, 
-		       const std::string & name,
-		       const IInterface* parent) 
-    : AthAlgTool(type,name,parent), CaloRec::ToolWithConstantsMixin() {
-    declareInterface<IEgammaCalibration>(this);
-    declareConstant("correction",      m_correction);
-    declareConstant("eta_start_crack", m_eta_start_crack);
-    declareConstant("eta_end_crack",   m_eta_end_crack);
-    declareConstant("degree",          m_degree);
-    declareConstant("use_raw_eta",     m_use_raw_eta);
-    declareProperty("UseInterpolation",m_interpolate = true);
-    finish_ctor();
-  }
-  
-  /** Destructor */
-  virtual ~EgammaGapCalibration() { }
+
+  /// Inherit constructor.
+  using base_class::base_class;
   
   /** Initialization of the tool */
-  StatusCode initialize();
+  virtual StatusCode initialize() override;
   
   /** Finalization of the tool */
-  StatusCode finalize();
-  
-  /** Set Property necessary */
-  using AthAlgTool::setProperty;
-  StatusCode setProperty(const std::string&, const std::string&);
-  StatusCode setProperty(const Property&);
+  virtual StatusCode finalize() override;
   
   /** method to perform the correction. The correction
       type is defined by the tool which also uses
       this interface. In some cases, the tool needs
       more than the cluster to perform the calibration.
       This can be passed via the void pointer */
-  virtual void makeCorrection(xAOD::TrigEMCluster*, const void* v=NULL);
+  virtual void makeCorrection(xAOD::TrigEMCluster*, const void* v=nullptr) override;
   
  private:
   MsgStream* m_log;
   // Correction Variables
-  CaloRec::Array<2>     m_correction;
-  float m_eta_start_crack;
-  float m_eta_end_crack;
-  int m_degree;
-  bool m_use_raw_eta;
-  bool m_interpolate;  
+  Constant<CxxUtils::Array<2> >  m_correction      { this, "correction" };
+  Constant<float>                m_eta_start_crack { this, "eta_start_crack" };
+  Constant<float>                m_eta_end_crack   { this, "eta_end_crack" };
+  Constant<int>                  m_degree          { this, "degree" };
+  Constant<bool>                 m_use_raw_eta     { this, "use_raw_eta" };
+  BooleanProperty                m_interpolate     { this, "UseInterpolation", true };
 };
 
 #endif
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaHitsCalibration.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaHitsCalibration.h
index 65215595ba98c8aa42b8424d6bf9e0e068d40461..11c27e5ba267c237f6b3239272c32ce1bbe799ae 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaHitsCalibration.h
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaHitsCalibration.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 TRIGT2CALOCALIBRATION_EGAMMAHITSCALIBRATION
@@ -11,7 +11,7 @@
 #include "GaudiKernel/MsgStream.h"
 
 // Specific for this calibration
-#include "CaloRec/ToolWithConstantsMixin.h"
+#include "CaloUtils/ToolWithConstants.h"
 #include "CaloConditions/Array.h"
 #include "CaloGeoHelpers/CaloSampling.h"
 #include "xAODTrigCalo/TrigEMCluster.h"
@@ -21,61 +21,40 @@
 
 
 /** General Interface for calibrations at the LVL2 Egamma Calo Fex algo */
-class EgammaHitsCalibration  : virtual public IEgammaCalibration,
-	virtual public AthAlgTool, public CaloRec::ToolWithConstantsMixin {
+class EgammaHitsCalibration  :
+  public extends<CaloUtils::ToolWithConstants<AthAlgTool>,
+                 IEgammaCalibration>
+{
 	public:
-	/** Constructor */
-	EgammaHitsCalibration (const std::string & type, const std::string & name,
-		const IInterface* parent) : AthAlgTool(type,name,parent),
-	CaloRec::ToolWithConstantsMixin(),
-  m_showerDepth(0){
-    declareInterface<IEgammaCalibration>(this);
-    declareConstant("correction",      m_correction);
-    declareConstant("sampling_depth",  m_sampling_depth);
-    declareConstant("eta_start_crack", m_eta_start_crack);
-    declareConstant("eta_end_crack",   m_eta_end_crack);
-    declareConstant("etamax",          m_etamax);
-    declareConstant("use_raw_eta",     m_use_raw_eta);
-    declareConstant("preserve_offset", m_preserve_offset);
-    declareConstant("fix_v6_pathologies", m_fix_v6_pathologies, true);
-    finish_ctor();
-	}
-	virtual ~EgammaHitsCalibration () { }
-
+        /// Inherit constructor.
+        using base_class::base_class;
+  
 	/** Initialization of the tool */
-	StatusCode initialize();
+	virtual StatusCode initialize() override;
 
 	/** Finalization of the tool */
-	StatusCode finalize();
-
-	/** Set Property necessary */
-        using AthAlgTool::setProperty;
-	StatusCode setProperty(const std::string&,
-		const std::string&);
-	StatusCode setProperty(const Property&);
+	virtual StatusCode finalize() override;
 
 	/** method to perform the correction. The correction
 		type is defined by the tool which also uses
 		this interface. In some cases, the tool needs
 		more than the cluster to perform the calibration.
 		This can be passed via the void pointer */
-	virtual void makeCorrection(xAOD::TrigEMCluster*, const void* v=NULL);
+	virtual void makeCorrection(xAOD::TrigEMCluster*, const void* v=nullptr) override;
 
 	private:
 	MsgStream* m_log;
 	// Correction Variables
-	CaloRec::Array<3>  m_correction;// on CalibHits m_correction' size is 3
-  CaloRec::Array<2>  m_sampling_depth; 
-	CaloRec::WritableArrayData<1>* m_interp_barriers;
-	float m_eta_start_crack;
-	float m_eta_end_crack;
-	float m_etamax;
-	bool m_use_raw_eta;
-	bool m_preserve_offset;
-	bool m_fix_v6_pathologies;
-
-  EgammaHitsShowerDepth *m_showerDepth;
-
+        Constant<CxxUtils::Array<3> >  m_correction { this, "correction" };
+        Constant<CxxUtils::Array<2> >  m_sampling_depth { this, "sampling_depth" };
+        Constant<float> m_eta_start_crack   { this, "eta_start_crack" };
+        Constant<float> m_eta_end_crack     { this, "eta_end_crack" };
+        Constant<float> m_etamax            { this, "etamax" };
+        Constant<bool> m_use_raw_eta        { this, "use_raw_eta" };
+        Constant<bool> m_preserve_offset    { this, "preserve_offset" };
+        Constant<bool> m_fix_v6_pathologies { this, "fix_v6_pathologies" };
+
+        EgammaHitsShowerDepth m_showerDepth;
 };
 
 #endif
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaHitsShowerDepth.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaHitsShowerDepth.h
index a3b8df0763c588e42d7a711a797e1800844b7560..dcd4fe075ae9187abad4f6826174f909ad9f18a8 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaHitsShowerDepth.h
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaHitsShowerDepth.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TRIGT2CALOCALIBRATION_EGAMMAHITSSHOWERDEPTH
@@ -14,25 +14,21 @@
 class EgammaHitsShowerDepth
 {
 public:
-  EgammaHitsShowerDepth (const CaloRec::Array<2>& sampling_depth,
-                              const float& start_crack,
-                              const float& end_crack,
-                              const float& etamax,
-                              MsgStream* log);
-
-
   float depth (const float &aeta,
-                const xAOD::TrigEMCluster* cluster) const;
+               const float start_crack,
+               const float end_crack,
+               const CxxUtils::Array<2>& sampling_depth,
+               const float etamax,
+               const xAOD::TrigEMCluster* cluster) const;
 
   static const CaloSampling::CaloSample m_samps[2][4];
 
 private:
   void barrelCoefs (const float &aeta, float R[4]) const;
-  bool endcapCoefs (const float &aeta, float R[4]) const;
-  const CaloRec::Array<2>& m_sampling_depth;
-  const float& m_start_crack;
-  const float& m_end_crack;
-  const float& m_etamax;
+  bool endcapCoefs (const float &aeta,
+                    const CxxUtils::Array<2>& sampling_depth,
+                    const float etamax,
+                    float R[4]) const;
 };
 
 
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaLWCalibration.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaLWCalibration.h
index f5c27b2fc234b898bc3fc12917a61218939dfd47..6fd2e7c0c9be935373158ab465650b8e29df4f2e 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaLWCalibration.h
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaLWCalibration.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
 */
 
 
@@ -11,7 +11,7 @@
 #include "GaudiKernel/MsgStream.h"
 
 // Specific for this calibration
-#include "CaloRec/ToolWithConstantsMixin.h"
+#include "CaloUtils/ToolWithConstants.h"
 #include "CaloConditions/Array.h"
 #include "CaloClusterCorrection/interpolate.h"
 #include "CaloGeoHelpers/CaloSampling.h"
@@ -21,59 +21,42 @@
 //class TrigEMCluster;
 
 /** General Interface for calibrations at the LVL2 Egamma Calo Fex algo */
-class EgammaLWCalibration : virtual public IEgammaCalibration,
-	virtual public AthAlgTool, public CaloRec::ToolWithConstantsMixin {
+class EgammaLWCalibration : 
+  public extends<CaloUtils::ToolWithConstants<AthAlgTool>,
+                 IEgammaCalibration>          
+{
 	public:
-	/** Constructor */
-	EgammaLWCalibration(const std::string & type, const std::string & name,
-		const IInterface* parent) : AthAlgTool(type,name,parent),
-	CaloRec::ToolWithConstantsMixin() {
-	declareInterface<IEgammaCalibration>(this);
-	declareConstant("correction",      m_correction);
-	declareConstant("eta_start_crack", m_eta_start_crack);
-	declareConstant("eta_end_crack",   m_eta_end_crack);
-	declareConstant("etamax",          m_etamax);
-	declareConstant("degree",          m_degree);
-	declareConstant("use_raw_eta",     m_use_raw_eta);
-	declareConstant("preserve_offset", m_preserve_offset);
-	declareProperty("UseInterpolation",m_interpolate = true);
-	finish_ctor();
-	}
-	virtual ~EgammaLWCalibration() { }
+        /// Inherit constructor.
+        using base_class::base_class;
 
 	/** Initialization of the tool */
-	StatusCode initialize();
+	virtual StatusCode initialize() override;
 
 	/** Finalization of the tool */
-	StatusCode finalize();
-
-	/** Set Property necessary */
-        using AthAlgTool::setProperty;
-	StatusCode setProperty(const std::string&,
-		const std::string&);
-	StatusCode setProperty(const Property&);
+	virtual StatusCode finalize() override;
 
 	/** method to perform the correction. The correction
 		type is defined by the tool which also uses
 		this interface. In some cases, the tool needs
 		more than the cluster to perform the calibration.
 		This can be passed via the void pointer */
-	virtual void makeCorrection(xAOD::TrigEMCluster*, const void* v=NULL);
+	virtual void makeCorrection(xAOD::TrigEMCluster*, const void* v=nullptr) override;
 
 	private:
 	MsgStream* m_log;
 	// Correction Variables
-	CaloRec::Array<2>     m_correction;
-	CaloRec::WritableArrayData<1>* m_interp_barriers;
-	float m_eta_start_crack;
-	float m_eta_end_crack;
-	float m_etamax;
-	int m_degree;
-	bool m_use_raw_eta;
-	bool m_preserve_offset;
-	CaloSampling::CaloSample m_samps[2][4];
-	bool m_interpolate;
-
+        Constant<CxxUtils::Array<2> > m_correction { this, "correction" };
+        Constant<float> m_eta_start_crack { this, "eta_start_crack" };
+        Constant<float> m_eta_end_crack   { this, "eta_end_crack" };
+        Constant<float> m_etamax          { this, "etamax" };
+        Constant<int> m_degree            { this, "degree" };
+        Constant<bool> m_use_raw_eta      { this, "use_raw_eta" };
+        Constant<bool> m_preserve_offset  { this, "preserve_offset" };
+        Constant<bool> m_interpolate      { this, "UseInterpolation" };
+
+        CaloSampling::CaloSample m_samps[2][4];
+        const unsigned m_shape[1] = {2};
+        CxxUtils::WritableArrayData<1> m_interp_barriers { m_shape };
 };
 
 #endif
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaSshapeCalibration.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaSshapeCalibration.h
index 901af25a183b19385dcf95e933107189ddb3cb93..eea7ca7eeacf64cc7c6cb668a914c4b4b33230f5 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaSshapeCalibration.h
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaSshapeCalibration.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 TRIGT2CALOCALIBRATION_EGAMMASSHAPECALIBRATION
@@ -8,7 +8,7 @@
 #include "TrigT2CaloCalibration/IEgammaCalibration.h"
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "GaudiKernel/MsgStream.h"
-#include "CaloRec/ToolWithConstantsMixin.h"
+#include "CaloUtils/ToolWithConstants.h"
 #include "CaloConditions/Array.h"
 //#include "TrigT2CaloCommon/Calo_Def.h"
 #include "CaloClusterCorrection/CaloClusterCorrectionCommon.h"
@@ -20,38 +20,29 @@
 //--------------------------------------------
 // class EgammaSshapeCalibration
 //--------------------------------------------
-class EgammaSshapeCalibration : virtual public IEgammaCalibration, 
-				virtual public AthAlgTool, 
-				public CaloRec::ToolWithConstantsMixin
+class EgammaSshapeCalibration :
+  public extends<CaloUtils::ToolWithConstants<AthAlgTool>,
+                 IEgammaCalibration>          
 {  
  public:
-  
-  /** Constructor */
-  EgammaSshapeCalibration(const std::string &type,
-			  const std::string &name, 
-			  const IInterface* parent);
-  /** Destructor */
-  virtual ~EgammaSshapeCalibration() {}
+
+  /// Inherit constructor.
+  using base_class::base_class;
   
   /** Initialization of the tool */
-  StatusCode initialize();
+  virtual StatusCode initialize() override;
   
   /** Finalization of the tool */
-  StatusCode finalize();
+  virtual StatusCode finalize() override;
   
   /** Virtual function from IEgammaCalibration */
-  virtual void makeCorrection(xAOD::TrigEMCluster*, const void*);
+  virtual void makeCorrection(xAOD::TrigEMCluster*, const void*) override;
 
-  /** Set Property necessary */
-  using AthAlgTool::setProperty;
-  StatusCode setProperty(const std::string&,const std::string&);  
-  StatusCode setProperty(const Property&);
-  
  private:
   void docalc(int,
 	      const CaloClusterCorrectionCommon::TableBuilder&,
-	      const CaloRec::Array<1>&, 
-	      CaloRec::WritableArray<2>&,
+	      const CxxUtils::Array<1>&, 
+	      CxxUtils::WritableArray<2>&,
 	      int&);
   
  private:
@@ -98,7 +89,7 @@ class EgammaSshapeCalibration : virtual public IEgammaCalibration,
   /// is exactly 0, for any e and r, then this energy/region is skipped.
   /// (This is usually because insufficient statistics were available
   /// to get a good fit.)
-  CaloRec::Array<4> m_correction;
+  Constant<CxxUtils::Array<4> > m_correction { this, "correction" };
   
   /// Calibration constant: table of regions.  For each region, we have:
   ///  - Lower @f$|\eta|@f$ for the region.
@@ -110,7 +101,7 @@ class EgammaSshapeCalibration : virtual public IEgammaCalibration,
   ///
   /// If the forms variable is provided, then the functional form is
   /// taken from there instead of from here.
-  CaloRec::Array<2> m_regions;
+  Constant<CxxUtils::Array<2> > m_regions { this, "regions" };
   enum {
     REG_LO = 0,
     REG_HI = 1,
@@ -120,17 +111,17 @@ class EgammaSshapeCalibration : virtual public IEgammaCalibration,
   };
   
   /** Table of energies at which the correction was tabulated. */
-  CaloRec::Array<1>  m_energies;  				     
+  Constant<CxxUtils::Array<1> >  m_energies { this, "energies" };
   
   /** Degree of the polynomial interpolation in energy. */
-  int  m_energy_degree; 
+  Constant<int>  m_energy_degree { this, "energy_degree", 3 };
   
-  bool m_isRange_barrel;
+  Constant<bool> m_isRange_barrel { this, "rangeBarrel" };
 
   /// Calibration constant: Functional form to use per region per energy.
   /// If this is empty, the form is taken instead from the region table
   /// (and is thus same for  all energies).
-  CaloRec::Array<2> m_forms;
+  Constant<CxxUtils::Array<2> > m_forms { this, "forms" };
 };
 
 #endif
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaTransitionRegions.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaTransitionRegions.h
index 07209274643050f4e4c2a46d6b74380cfcf6efeb..f42e7fd8f34dfd91fb66791252fc3de62083e96f 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaTransitionRegions.h
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaTransitionRegions.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 TRIGT2CALOCALIBRATION_EGAMMATRANSITIONREGIONS
@@ -10,7 +10,7 @@
 #include "GaudiKernel/MsgStream.h"
 
 // Specific for this calibration
-#include "CaloRec/ToolWithConstantsMixin.h"
+#include "CaloUtils/ToolWithConstants.h"
 #include "CaloConditions/Array.h"
 #include "CaloGeoHelpers/CaloSampling.h"
 #include "xAODTrigCalo/TrigEMCluster.h"
@@ -20,53 +20,37 @@
 
 
 /** General Interface for calibrations at the LVL2 Egamma Calo Fex algo */
-class EgammaTransitionRegions  : virtual public IEgammaCalibration,
-	virtual public AthAlgTool, public CaloRec::ToolWithConstantsMixin {
+class EgammaTransitionRegions  :
+  public extends<CaloUtils::ToolWithConstants<AthAlgTool>,
+                 IEgammaCalibration>          
+{
 	public:
-	/** Constructor */
-	EgammaTransitionRegions (const std::string & type, const std::string & name,
-		const IInterface* parent) : AthAlgTool(type,name,parent),
-	CaloRec::ToolWithConstantsMixin() {
-    declareInterface<IEgammaCalibration>(this);
-    declareConstant("correction",      m_correction);
-    declareConstant("etamin_TR00",     m_etamin_TR00);
-    declareConstant("etamax_TR00",     m_etamax_TR00);
-    declareConstant("etamin_TR08",     m_etamin_TR08);
-    declareConstant("etamax_TR08",     m_etamax_TR08);
-    declareConstant("use_raw_eta",     m_use_raw_eta);
-    finish_ctor();
-	}
-	virtual ~EgammaTransitionRegions() { }
+        /// Inherit constructor.
+        using base_class::base_class;
 
 	/** Initialization of the tool */
-	StatusCode initialize();
+        virtual StatusCode initialize() override;
 
 	/** Finalization of the tool */
-	StatusCode finalize();
+	virtual StatusCode finalize() override;
 
-	/** Set Property necessary */
-        using AthAlgTool::setProperty;
-	StatusCode setProperty(const std::string&,
-		const std::string&);
-	StatusCode setProperty(const Property&);
 
 	/** method to perform the correction. The correction
 		type is defined by the tool which also uses
 		this interface. In some cases, the tool needs
 		more than the cluster to perform the calibration.
 		This can be passed via the void pointer */
-	virtual void makeCorrection(xAOD::TrigEMCluster*, const void* v=NULL);
+	virtual void makeCorrection(xAOD::TrigEMCluster*, const void* v=nullptr) override;
 
 	private:
 	MsgStream* m_log;
 	// Correction Variables
-	CaloRec::Array<2>  m_correction;// on CalibHits m_correction' size is 3
-	float m_etamin_TR00;
-	float m_etamax_TR00;
-	float m_etamin_TR08;
-	float m_etamax_TR08;
-	bool m_use_raw_eta;
-
+        Constant<CxxUtils::Array<2> >  m_correction  { this, "correction" };
+        Constant<float>                m_etamin_TR00 { this, "etamin_TR00" };
+        Constant<float>                m_etamax_TR00 { this, "etamax_TR00" };
+        Constant<float>                m_etamin_TR08 { this, "etamin_TR08" };
+        Constant<float>                m_etamax_TR08 { this, "etamax_TR08" };
+        Constant<bool>                 m_use_raw_eta { this, "use_raw_eta" };
 };
 
 #endif
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/IEgammaCalibration.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/IEgammaCalibration.h
index 61047b11a8a071b2917ea859313a307d66e4fa0a..641790635a14bde5a314e3082902a83885581682 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/IEgammaCalibration.h
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/IEgammaCalibration.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
 */
 
 
@@ -12,12 +12,10 @@
 // Just for the pointer definition
 //class TrigEMCluster;
 
-static const InterfaceID IID_IEgammaCalibration("IEgammaCalibration",1,0);
-
 /** General Interface for calibrations at the LVL2 Egamma Calo Fex algo */
 class IEgammaCalibration : virtual public IAlgTool{
 	public:
-		static const InterfaceID& interfaceID();
+                DeclareInterfaceID( IEgammaCalibration, 1, 0 );
 
 	/** method to perform the correction. The correction
 		type is defined by the tool which also uses
@@ -28,9 +26,4 @@ class IEgammaCalibration : virtual public IAlgTool{
 		
 };
 
-inline const InterfaceID& IEgammaCalibration::interfaceID()
-{
-	return IID_IEgammaCalibration;
-}
-
 #endif
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/IT2HadCalibTool.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/IT2HadCalibTool.h
index dd5a9f1033984d6fd9c1d583d11bbeb5603f1978..e980769ec0a53751b0c250d1075f64e076f75bc1 100755
--- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/IT2HadCalibTool.h
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/IT2HadCalibTool.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
 */
 
 // ********************************************************************
@@ -22,7 +22,7 @@
 class IT2HadCalibTool : virtual public IAlgTool {
     public:
         /**interface ID*/
-        static const InterfaceID& interfaceID();
+        DeclareInterfaceID( IT2HadCalibTool, 1, 0 );
         
         /**virtual method to be defined in the inherited class for*/
         virtual double c_energy(double EMenergy,double HADenergy,double eta) = 0;
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2GSCalibTool.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2GSCalibTool.h
index 71c0748dc0d30c68363ca800af3d12d88ab7fe41..3f8cd50b14c0ec965889c47791a85a11ff7dd58b 100755
--- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2GSCalibTool.h
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2GSCalibTool.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
 */
 
 // ********************************************************************
@@ -23,46 +23,40 @@
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "GaudiKernel/Property.h"
 
-#include "CaloRec/ToolWithConstantsMixin.h"
+#include "CaloUtils/ToolWithConstants.h"
 
 #include "TrigT2CaloCalibration/IT2HadCalibTool.h"
 
 #include <vector>
 #include <math.h>
 
-class T2GSCalibTool : virtual public IT2HadCalibTool, 
-                               public AthAlgTool,
-                               public CaloRec::ToolWithConstantsMixin 
+class T2GSCalibTool : 
+  public extends<CaloUtils::ToolWithConstants<AthAlgTool>,
+                 IT2HadCalibTool>
 {
  public:
    /** Constructor */
    T2GSCalibTool(const std::string&,const std::string&,const IInterface*); 
    /** Destructor */
-   ~T2GSCalibTool();
+   virtual ~T2GSCalibTool();
    /** athena initialize method */
-   StatusCode initialize();
+   virtual StatusCode initialize() override;
    /** athena finalize method */
-   StatusCode finalize(); 
+   virtual StatusCode finalize() override;
    
-   // These ones must be redefined for ToolWithConstantsMixin
-   using AthAlgTool::setProperty;
-   virtual StatusCode setProperty (const std::string& propname,
-                                   const std::string& value);  
-   virtual StatusCode setProperty (const Property& p); 
-
    /** @brief Returns the response for each calo layer 
    * @param[in] Fraction of jet energy deposited in the layer
    * @param[in] Jet energy after JES calibration
    * @param[in] Eta position of the jet
    */
-   double c_energy(double fLayer,double jetEnergy,double eta);
-   double c_febenergy(double fLayer,double jetEnergy,double eta);
+   virtual double c_energy(double fLayer,double jetEnergy,double eta) override;
+   virtual double c_febenergy(double fLayer,double jetEnergy,double eta) override;
 
  private:
    
    MsgStream m_log;
 
-   CaloRec::Array<3>                 m_calibConstants;
+   Constant<CxxUtils::Array<3> >    m_calibConstants { this, "CalibConstants"};
    std::vector<double>               m_etaBins;
    std::vector<std::vector<double> > m_ptBins;
    std::vector<std::vector<double> > m_propertyBins;
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2JESCalibTool.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2JESCalibTool.h
index 2fda15217da438015d1b30ee37642c0afcd15059..19f65c8b6306b136efcc125f27f7267e36ce2559 100755
--- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2JESCalibTool.h
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2JESCalibTool.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
 */
 
 // ********************************************************************
@@ -23,48 +23,42 @@
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "GaudiKernel/Property.h"
 
-#include "CaloRec/ToolWithConstantsMixin.h"
+#include "CaloUtils/ToolWithConstants.h"
 
 #include "TrigT2CaloCalibration/IT2HadCalibTool.h"
 
 #include <vector>
 #include <math.h>
 
-class T2JESCalibTool : virtual public IT2HadCalibTool, 
-                               public AthAlgTool,
-                               public CaloRec::ToolWithConstantsMixin 
+class T2JESCalibTool :
+  public extends<CaloUtils::ToolWithConstants<AthAlgTool>,
+                 IT2HadCalibTool>
 {
  public:
    /** Constructor */
    T2JESCalibTool(const std::string&,const std::string&,const IInterface*); 
    /** Destructor */
-   ~T2JESCalibTool();
+   virtual ~T2JESCalibTool();
    /** athena initialize method */
-   StatusCode initialize();
+   virtual StatusCode initialize() override;
    /** athena finalize method */
-   StatusCode finalize(); 
+   virtual StatusCode finalize() override; 
    
-   // These ones must be redefined for ToolWithConstantsMixin
-   using AthAlgTool::setProperty;
-   virtual StatusCode setProperty (const std::string& propname,
-                                   const std::string& value);  
-   virtual StatusCode setProperty (const Property& p); 
-
    // both energy arguments must be transverse energy in MeV   
    /** @brief Returns a calibrated energy using JES correction 
    * @param[in] Sum of energy for all EM samplings (except sampling 3)
    * @param[in] Sum of energy for all HAD samplings (+ EM sampling 3)
    * @param[in] Eta position of the cluster
    */
-   double c_energy(double EMenergy,double HADenergy,double eta);
-   double c_febenergy(double EMenergy,double HADenergy,double eta);
+   virtual double c_energy(double EMenergy,double HADenergy,double eta) override;
+   virtual double c_febenergy(double EMenergy,double HADenergy,double eta) override;
    
  private:
    
    MsgStream m_log;
 
-   CaloRec::Array<2> m_EnergyCorrConstants;
-   double m_etcut;
+   Constant<CxxUtils::Array<2> > m_EnergyCorrConstants { this, "JES_Factors" };
+   FloatProperty m_etcut { this, "MinEtCut", 10 }; // Non-standard... in GeV!
 
    int GetEtaBin(double jet_eta);
    double PolLogE(const CaloRec::Array<2> &constants, unsigned bin, double E);
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/python/EgammaCalibrationConfig.py b/Trigger/TrigTools/TrigT2CaloCalibration/python/EgammaCalibrationConfig.py
index c94ee3bd353aa2bb04c68c53bd9cf10b46c6c334..e15153d03a7aa4c865fca470f323f3a59ca9eb9f 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/python/EgammaCalibrationConfig.py
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/python/EgammaCalibrationConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # flake8: noqa
 # ... because this file is hopeless ...
@@ -99,6 +99,7 @@ class EgammaSshapeCalibrationBarrelConfig(CompFactory.EgammaSshapeCalibration):
         self.correction=str(ele_layer2_etaoffv4_1_37_b)
         self.regions=str(layer2_etaoffv4_1_regions_b)
         self.energies=str(ele_etaoffv4_1_energies)
+        self.forms="[[]]"
         self.energy_degree=3
         self.rangeBarrel=True
     
@@ -109,6 +110,7 @@ class EgammaSshapeCalibrationEndcapConfig(CompFactory.EgammaSshapeCalibration):
         self.correction=str(ele_layer2_etaoffv4_1_55_e)
         self.regions=str(layer2_etaoffv4_1_regions_e)
         self.energies=str(ele_etaoffv4_1_energies)
+        self.forms="[[]]"
         self.energy_degree=3
         self.rangeBarrel=False
 
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaGapCalibration.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaGapCalibration.cxx
index fbfec7a217b6da5d92a2e79de482fbd434e1df79..2b12ec00df431d5250eb751d874033931dd95936 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaGapCalibration.cxx
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaGapCalibration.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
 */
 
 
@@ -25,8 +25,7 @@ using CaloClusterCorr::interpolate;
 
 StatusCode EgammaGapCalibration::initialize(){
 
-	CHECK (AthAlgTool::initialize());
-	CHECK (CaloRec::ToolWithConstantsMixin::initialize() );
+	CHECK (base_class::initialize());
 	m_log = new MsgStream(AthAlgTool::msgSvc(), name() );
 
 	(*m_log) << MSG::DEBUG << "Initialize Tool : " << name() << endmsg;
@@ -57,11 +56,13 @@ void EgammaGapCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
 	float the_aeta=(clus->eta());
 	if (the_aeta<0) the_aeta=-the_aeta;
 	// If far from the crack, nothing to do
-	if (the_aeta < m_eta_start_crack || the_aeta > m_eta_end_crack) return;
- 
-	float a      = interpolate(m_correction, the_aeta, m_degree,1);
-	float alpha  = interpolate(m_correction, the_aeta, m_degree,2);
-	float offset = interpolate(m_correction, the_aeta, m_degree,3);
+	if (the_aeta < m_eta_start_crack() || the_aeta > m_eta_end_crack()) return;
+
+        CxxUtils::Array<2> correction = m_correction();
+        int degree = m_degree();
+	float a      = interpolate(correction, the_aeta, degree,1);
+	float alpha  = interpolate(correction, the_aeta, degree,2);
+	float offset = interpolate(correction, the_aeta, degree,3);
 	float eh_scint = clus->energy(CaloSampling::TileGap3);
 	float ec = clus->energy();
 	clus->setEnergy(a*(ec+alpha*eh_scint + offset));
@@ -73,19 +74,3 @@ void EgammaGapCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
 
 }
 
-StatusCode
-EgammaGapCalibration::setProperty (const std::string& propname,
-                                    const std::string& value)
-{
-  CHECK( AthAlgTool::setProperty(propname,value) );
-  CHECK( CaloRec::ToolWithConstantsMixin::setProperty (propname, value) );
-  return StatusCode::SUCCESS;
-}
-
-StatusCode
-EgammaGapCalibration::setProperty (const Property& p)
-{
-  CHECK( AthAlgTool::setProperty(p) );
-  CHECK( CaloRec::ToolWithConstantsMixin::setProperty (p) );
-  return StatusCode::SUCCESS;
-}
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsCalibration.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsCalibration.cxx
index e2bdf7738adc85cbd934184834c7bf86344745fc..05646e5ea3104cd735ae4000d2bf8a1d27a57518 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsCalibration.cxx
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsCalibration.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
 */
 
 // ********************************************************************
@@ -26,46 +26,35 @@
 
 StatusCode EgammaHitsCalibration::initialize(){
 
-    CHECK (AthAlgTool::initialize());
-    CHECK (CaloRec::ToolWithConstantsMixin::initialize() );
+    CHECK (base_class::initialize());
     m_log = new MsgStream(AthAlgTool::msgSvc(), name() );
 
     (*m_log) << MSG::DEBUG << "Initialize Tool : " << name() << endmsg;
 
 
 
-    unsigned int shape[] = {2};
-
-    m_interp_barriers = new CaloRec::WritableArrayData<1> (shape);
-
-    (*m_interp_barriers)[0] = m_eta_start_crack;
-    (*m_interp_barriers)[1] = m_eta_end_crack;
-
-    m_showerDepth = new EgammaHitsShowerDepth(m_sampling_depth,
-        m_eta_start_crack,
-        m_eta_end_crack,
-        m_etamax,
-        m_log);
-
     return StatusCode::SUCCESS;
 }
 
 StatusCode EgammaHitsCalibration::finalize(){
     (*m_log) << MSG::DEBUG << "Finalize Tool : " << name() << endmsg;
-    delete m_showerDepth;
     delete m_log;
-    delete m_interp_barriers;
     return StatusCode::SUCCESS;
 }
 
 void EgammaHitsCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
     const void * /*param*/){
 
+    const float etamax = m_etamax();
+    const float eta_start_crack = m_eta_start_crack();
+    const float eta_end_crack = m_eta_end_crack();
+    const CxxUtils::Array<3> correction = m_correction();
+
     float the_aeta = (clus->eta());
 
     the_aeta = (the_aeta>0)?(the_aeta):(- the_aeta);
 
-    if (the_aeta >= m_etamax) return; 
+    if (the_aeta >= etamax) return; 
 
 #ifndef NDEBUG
     (*m_log) << MSG::DEBUG <<  "************************************************************************************************" << endmsg;
@@ -73,9 +62,9 @@ void EgammaHitsCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
     (*m_log) << MSG::DEBUG <<  "************************************************************************************************" << endmsg;       
 #endif
     int si;
-    if (the_aeta < m_eta_start_crack)
+    if (the_aeta < eta_start_crack)
         si = 0; //barrel
-    else if (the_aeta > m_eta_end_crack)
+    else if (the_aeta > eta_end_crack)
         si = 1; //endcap
     else {
         // No corrections are applied for the crack region.
@@ -83,11 +72,11 @@ void EgammaHitsCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
     }
 
      
-    int ibin = (static_cast<int> (the_aeta / m_etamax * 100));
+    int ibin = (static_cast<int> (the_aeta / etamax * 100));
     int ibin_frontCorr = ibin; 
-    if (m_fix_v6_pathologies) {
+    if (m_fix_v6_pathologies()) {
       if ( the_aeta>2.35) 
-        ibin_frontCorr = (static_cast<int> (235. / m_etamax )); 
+        ibin_frontCorr = (static_cast<int> (235. / etamax )); 
    }
 
 #ifndef NDEBUG
@@ -95,15 +84,20 @@ void EgammaHitsCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
         (*m_log) << MSG::DEBUG << "Eta --> " << the_aeta << "  Bin --> " << ibin <<" Cluster eta = " << clus->eta() << endmsg;
 
         (*m_log) << MSG::DEBUG << "Check calibration coefficients -----------------------------------------------"<< endmsg;
-        (*m_log) << MSG::DEBUG << "Accordion   :  " << m_correction[0][ibin][0] <<"  " << m_correction[0][ibin][1] << " "  << m_correction[0][ibin][2] << " "  << m_correction[0][ibin][3] << endmsg;
-        (*m_log) << MSG::DEBUG << "OutOfCOne   :  " << m_correction[1][ibin][0] <<"  " << m_correction[1][ibin][1] << " "  << m_correction[1][ibin][2] << " "  << m_correction[1][ibin][3] << endmsg;
-        (*m_log) << MSG::DEBUG << "Leakage     :  " << m_correction[2][ibin][0] <<"  " << m_correction[2][ibin][1] << " " << m_correction[2][ibin][2] << " "  << m_correction[2][ibin][3] << endmsg;
-        (*m_log) << MSG::DEBUG << "Front offset:  " << m_correction[3][ibin_frontCorr][0] <<"  " <<m_correction[3][ibin_frontCorr][1]  << " " << m_correction[3][ibin_frontCorr][2] << " "  << m_correction[3][ibin_frontCorr][3] <<endmsg;
-        (*m_log) << MSG::DEBUG << "Front Slope  :  " << m_correction[4][ibin_frontCorr][0] <<"  " << m_correction[4][ibin_frontCorr][1] << " " << m_correction[4][ibin_frontCorr][2] << " "  << m_correction[4][ibin_frontCorr][3] <<  endmsg;
-        (*m_log) << MSG::DEBUG << "Second order:  " << m_correction[5][ibin_frontCorr][0] << "  " << m_correction[5][ibin_frontCorr][1] << "  "  << m_correction[5][ibin_frontCorr][2] << " " << m_correction[5][ibin_frontCorr][3] << endmsg;
+        (*m_log) << MSG::DEBUG << "Accordion   :  " << correction[0][ibin][0] <<"  " << correction[0][ibin][1] << " "  << correction[0][ibin][2] << " "  << correction[0][ibin][3] << endmsg;
+        (*m_log) << MSG::DEBUG << "OutOfCOne   :  " << correction[1][ibin][0] <<"  " << correction[1][ibin][1] << " "  << correction[1][ibin][2] << " "  << correction[1][ibin][3] << endmsg;
+        (*m_log) << MSG::DEBUG << "Leakage     :  " << correction[2][ibin][0] <<"  " << correction[2][ibin][1] << " " << correction[2][ibin][2] << " "  << correction[2][ibin][3] << endmsg;
+        (*m_log) << MSG::DEBUG << "Front offset:  " << correction[3][ibin_frontCorr][0] <<"  " <<correction[3][ibin_frontCorr][1]  << " " << correction[3][ibin_frontCorr][2] << " "  << correction[3][ibin_frontCorr][3] <<endmsg;
+        (*m_log) << MSG::DEBUG << "Front Slope  :  " << correction[4][ibin_frontCorr][0] <<"  " << correction[4][ibin_frontCorr][1] << " " << correction[4][ibin_frontCorr][2] << " "  << correction[4][ibin_frontCorr][3] <<  endmsg;
+        (*m_log) << MSG::DEBUG << "Second order:  " << correction[5][ibin_frontCorr][0] << "  " << correction[5][ibin_frontCorr][1] << "  "  << correction[5][ibin_frontCorr][2] << " " << correction[5][ibin_frontCorr][3] << endmsg;
 #endif
 
-    float shower_lbary = (*m_showerDepth).depth(the_aeta,clus);
+    float shower_lbary = m_showerDepth.depth(the_aeta,
+                                             eta_start_crack,
+                                             eta_end_crack,
+                                             m_sampling_depth(),
+                                             etamax,
+                                             clus);
     if (!shower_lbary)
       return;
 
@@ -154,14 +148,14 @@ void EgammaHitsCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
     // Now calibrate the Accordion
     // -------------------------------------------------------------
 
-    float acc_corr = m_correction[0][ibin][1] + m_correction[0][ibin][2] * shower_lbary + m_correction[0][ibin][3] * shower_lbary * shower_lbary ;
+    float acc_corr = correction[0][ibin][1] + correction[0][ibin][2] * shower_lbary + correction[0][ibin][3] * shower_lbary * shower_lbary ;
 
     float e_out_perc = 0;
-    if (the_aeta < m_eta_start_crack) {
-        e_out_perc = m_correction[1][ibin][1] + m_correction[1][ibin][2] * shower_lbary + m_correction[1][ibin][3] * shower_lbary * shower_lbary ;
+    if (the_aeta < eta_start_crack) {
+        e_out_perc = correction[1][ibin][1] + correction[1][ibin][2] * shower_lbary + correction[1][ibin][3] * shower_lbary * shower_lbary ;
     }
     else {
-        e_out_perc = m_correction[1][ibin][1] + m_correction[1][ibin][2] * shower_lbary + m_correction[1][ibin][3] / shower_lbary ;
+        e_out_perc = correction[1][ibin][1] + correction[1][ibin][2] * shower_lbary + correction[1][ibin][3] / shower_lbary ;
     }   
 
     float e_acc_reco=acc_corr*(eacc_base )*(1+(e_out_perc)/100);
@@ -171,7 +165,7 @@ void EgammaHitsCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
     // -------------------------------------------------------------
 
     float e_leak_perc = 0;
-    e_leak_perc = m_correction[2][ibin][3] + m_correction[2][ibin][1] * shower_lbary + m_correction[2][ibin][2] * exp(shower_lbary);
+    e_leak_perc = correction[2][ibin][3] + correction[2][ibin][1] * shower_lbary + correction[2][ibin][2] * exp(shower_lbary);
 
     if (e_leak_perc < 0 ) e_leak_perc = 0.;
     if (e_leak_perc > 100.) e_leak_perc = 100.;
@@ -190,15 +184,15 @@ void EgammaHitsCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
     }
     else if (the_aeta < 1.8) {
 
-        if (the_aeta < m_eta_start_crack) {
-            float WpsOff      = m_correction[3][ibin_frontCorr][1] + m_correction[3][ibin_frontCorr][2] * raw_energy + m_correction[3][ibin_frontCorr][3] * raw_energy * raw_energy;
-            float WpsSlo      = m_correction[4][ibin_frontCorr][1]  * pow(log(raw_energy),m_correction[4][ibin_frontCorr][2]) + m_correction[4][ibin_frontCorr][3] *sqrt( raw_energy );
+        if (the_aeta < eta_start_crack) {
+            float WpsOff      = correction[3][ibin_frontCorr][1] + correction[3][ibin_frontCorr][2] * raw_energy + correction[3][ibin_frontCorr][3] * raw_energy * raw_energy;
+            float WpsSlo      = correction[4][ibin_frontCorr][1]  * pow(log(raw_energy),correction[4][ibin_frontCorr][2]) + correction[4][ibin_frontCorr][3] *sqrt( raw_energy );
             e_front_reco=WpsOff + WpsSlo*(eps_base);
 
 #ifndef NDEBUG
             (*m_log) << MSG::DEBUG  << " raw event  " << raw_energy << endmsg;
-            (*m_log) << MSG::DEBUG  << " froffset coeff " << m_correction[3][ibin_frontCorr][1] << " " << m_correction[3][ibin_frontCorr][2] << " " << m_correction[3][ibin_frontCorr][3]  << endmsg; 
-            (*m_log) << MSG::DEBUG  << " frslope coeff  " << m_correction[4][ibin_frontCorr][1] << " " << m_correction[4][ibin_frontCorr][2] << " " << m_correction[4][ibin_frontCorr][3] << endmsg; 
+            (*m_log) << MSG::DEBUG  << " froffset coeff " << correction[3][ibin_frontCorr][1] << " " << correction[3][ibin_frontCorr][2] << " " << correction[3][ibin_frontCorr][3]  << endmsg; 
+            (*m_log) << MSG::DEBUG  << " frslope coeff  " << correction[4][ibin_frontCorr][1] << " " << correction[4][ibin_frontCorr][2] << " " << correction[4][ibin_frontCorr][3] << endmsg; 
             (*m_log) << MSG::DEBUG  << " WpsOff,WpsSlo " << WpsOff << " " << WpsSlo << endmsg; 
             (*m_log) << MSG::DEBUG  << " eps_base, efront_reco " << eps_base << " " << e_front_reco << endmsg; 
 #endif
@@ -208,16 +202,16 @@ void EgammaHitsCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
 
             if (raw_energy<20.) raw_energy=20.;
 
-            float WpsOff      = m_correction[3][ibin_frontCorr][1] + m_correction[3][ibin_frontCorr][2] * raw_energy + m_correction[3][ibin_frontCorr][3] * sqrt(raw_energy);
-            float WpsSlo      = m_correction[4][ibin_frontCorr][1]  + m_correction[4][ibin_frontCorr][2] * log(raw_energy) + m_correction[4][ibin_frontCorr][3] * sqrt(raw_energy);
-            float WpsSlo2     = m_correction[5][ibin_frontCorr][1]  + m_correction[5][ibin_frontCorr][2] * raw_energy - m_correction[5][ibin_frontCorr][3] / (raw_energy * raw_energy) ;
+            float WpsOff      = correction[3][ibin_frontCorr][1] + correction[3][ibin_frontCorr][2] * raw_energy + correction[3][ibin_frontCorr][3] * sqrt(raw_energy);
+            float WpsSlo      = correction[4][ibin_frontCorr][1]  + correction[4][ibin_frontCorr][2] * log(raw_energy) + correction[4][ibin_frontCorr][3] * sqrt(raw_energy);
+            float WpsSlo2     = correction[5][ibin_frontCorr][1]  + correction[5][ibin_frontCorr][2] * raw_energy - correction[5][ibin_frontCorr][3] / (raw_energy * raw_energy) ;
             e_front_reco=WpsOff + WpsSlo*(eps_base) + WpsSlo2*(eps_base)*(eps_base);
             if (e_front_reco<0.) e_front_reco= eps_base;
 #ifndef NDEBUG
             (*m_log) << MSG::DEBUG << " raw energy " << raw_energy << endmsg; 
-            (*m_log) << MSG::DEBUG << "p1 " << m_correction[3][ibin_frontCorr][1] << " " << m_correction[3][ibin_frontCorr][2] << " " << m_correction[3][ibin_frontCorr][3] <<  " " << WpsOff << endmsg;
-            (*m_log) << MSG::DEBUG << "p2 " << m_correction[4][ibin_frontCorr][1] << " " << m_correction[4][ibin_frontCorr][2] << " " << m_correction[4][ibin_frontCorr][3] << " " << WpsSlo << endmsg;
-            (*m_log) << MSG::DEBUG << "p3 " << m_correction[5][ibin_frontCorr][1] << " " << m_correction[5][ibin_frontCorr][2] << " " << m_correction[5][ibin_frontCorr][3] << " " << WpsSlo2 << endmsg;
+            (*m_log) << MSG::DEBUG << "p1 " << correction[3][ibin_frontCorr][1] << " " << correction[3][ibin_frontCorr][2] << " " << correction[3][ibin_frontCorr][3] <<  " " << WpsOff << endmsg;
+            (*m_log) << MSG::DEBUG << "p2 " << correction[4][ibin_frontCorr][1] << " " << correction[4][ibin_frontCorr][2] << " " << correction[4][ibin_frontCorr][3] << " " << WpsSlo << endmsg;
+            (*m_log) << MSG::DEBUG << "p3 " << correction[5][ibin_frontCorr][1] << " " << correction[5][ibin_frontCorr][2] << " " << correction[5][ibin_frontCorr][3] << " " << WpsSlo2 << endmsg;
             (*m_log) << MSG::DEBUG << " WpsOff, WpsSlo, WpsSlo2 " << WpsOff << " " << WpsSlo << " " << WpsSlo2 << endmsg; 
             (*m_log) << MSG::DEBUG << " eps_base, efront_reco " << eps_base << " " <<  e_front_reco << endmsg; 
 #endif
@@ -226,14 +220,14 @@ void EgammaHitsCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
 
     }
     else {
-        float p1 =  m_correction[3][ibin_frontCorr][1] + m_correction[3][ibin_frontCorr][2] * raw_energy  + m_correction[3][ibin_frontCorr][3] * raw_energy  * raw_energy ;
-        float p2 =  m_correction[4][ibin_frontCorr][1] + m_correction[4][ibin_frontCorr][2] * raw_energy  + m_correction[4][ibin_frontCorr][3] * raw_energy  * raw_energy ;
-        float p3 =  m_correction[5][ibin_frontCorr][1] + m_correction[5][ibin_frontCorr][2] * raw_energy  + m_correction[5][ibin_frontCorr][3] * raw_energy  * raw_energy ;
+        float p1 =  correction[3][ibin_frontCorr][1] + correction[3][ibin_frontCorr][2] * raw_energy  + correction[3][ibin_frontCorr][3] * raw_energy  * raw_energy ;
+        float p2 =  correction[4][ibin_frontCorr][1] + correction[4][ibin_frontCorr][2] * raw_energy  + correction[4][ibin_frontCorr][3] * raw_energy  * raw_energy ;
+        float p3 =  correction[5][ibin_frontCorr][1] + correction[5][ibin_frontCorr][2] * raw_energy  + correction[5][ibin_frontCorr][3] * raw_energy  * raw_energy ;
 
 #ifndef NDEBUG
-        (*m_log) << MSG::DEBUG << "p1 " << m_correction[3][ibin_frontCorr][1] << " " << m_correction[3][ibin_frontCorr][2] << " " << m_correction[3][ibin_frontCorr][3] << endmsg;
-        (*m_log) << MSG::DEBUG << "p2 " << m_correction[4][ibin_frontCorr][1] << " " << m_correction[4][ibin_frontCorr][2] << " " << m_correction[4][ibin_frontCorr][3] << endmsg;
-        (*m_log) << MSG::DEBUG << "p3 " << m_correction[5][ibin_frontCorr][1] << " " << m_correction[5][ibin_frontCorr][2] << " " << m_correction[5][ibin_frontCorr][3] << endmsg;
+        (*m_log) << MSG::DEBUG << "p1 " << correction[3][ibin_frontCorr][1] << " " << correction[3][ibin_frontCorr][2] << " " << correction[3][ibin_frontCorr][3] << endmsg;
+        (*m_log) << MSG::DEBUG << "p2 " << correction[4][ibin_frontCorr][1] << " " << correction[4][ibin_frontCorr][2] << " " << correction[4][ibin_frontCorr][3] << endmsg;
+        (*m_log) << MSG::DEBUG << "p3 " << correction[5][ibin_frontCorr][1] << " " << correction[5][ibin_frontCorr][2] << " " << correction[5][ibin_frontCorr][3] << endmsg;
 #endif
 
         e_front_reco= (p1 + p2 * shower_lbary + p3 * shower_lbary * shower_lbary);
@@ -295,20 +289,3 @@ void EgammaHitsCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
 
 }
 
-StatusCode
-EgammaHitsCalibration::setProperty (const std::string& propname,
-        const std::string& value)
-{
-    CHECK( AthAlgTool::setProperty(propname,value) );
-    CHECK( CaloRec::ToolWithConstantsMixin::setProperty (propname, value) );
-    return StatusCode::SUCCESS;
-}
-
-StatusCode
-EgammaHitsCalibration::setProperty (const Property& p)
-{
-    CHECK( AthAlgTool::setProperty(p) );
-    CHECK( CaloRec::ToolWithConstantsMixin::setProperty (p) );
-    return StatusCode::SUCCESS;
-}
-
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsShowerDepth.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsShowerDepth.cxx
index 7a0217ca6821a55a5e6589cd7510e2496809ab03..8dcd0829554a249a3be7ad3a6503dc8a49418521 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsShowerDepth.cxx
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsShowerDepth.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // ********************************************************************
@@ -35,19 +35,6 @@ const CaloSampling::CaloSample EgammaHitsShowerDepth::m_samps[2][4] =
 };
 
 
-EgammaHitsShowerDepth::EgammaHitsShowerDepth  (const CaloRec::Array<2>& sampling_depth,        
-                            const float& start_crack,                  
-                            const float& end_crack,                    
-                            const float& etamax,                       
-                            MsgStream* /*log*/)
-    : m_sampling_depth (sampling_depth),
-      m_start_crack (start_crack),
-      m_end_crack (end_crack),
-      m_etamax (etamax)
-{
-}
-
-
 /**
  * @brief Calculate the depth of the cluster.
  * @param aeta abs(eta) of the cluster.
@@ -55,18 +42,22 @@ EgammaHitsShowerDepth::EgammaHitsShowerDepth  (const CaloRec::Array<2>& sampling
  * @param log Stream for debug messages.
  */
 float EgammaHitsShowerDepth::depth (const float &aeta,
-                                          const xAOD::TrigEMCluster* cluster) const
+                                    const float start_crack,
+                                    const float end_crack,
+                                    const CxxUtils::Array<2>& sampling_depth,
+                                    const float etamax,
+                                    const xAOD::TrigEMCluster* cluster) const
 {
 
   float R[4];
   int si;
 
-  if (aeta < m_start_crack) {
+  if (aeta < start_crack) {
     barrelCoefs (aeta, R);
     si = 0;
   }
-  else if (aeta > m_end_crack) {
-    if (!endcapCoefs (aeta, R))
+  else if (aeta > end_crack) {
+    if (!endcapCoefs (aeta, sampling_depth, etamax, R))
       return 0;
     si = 1;
   }
@@ -165,16 +156,21 @@ void EgammaHitsShowerDepth::barrelCoefs (const float &aeta, float R[4]) const
 /**
  * @brief Calculate the sampling depth coefficients for the endcap.
  * @param aeta abs(eta) of the cluster.
+ * @param sampling_depth Array of sampling depths per bin/sampling in the EC.
+ * @param etamax Maximum eta value in @a sampling_depth.
  * @param R[out] The set of coefficients per layer.
  */
-bool EgammaHitsShowerDepth::endcapCoefs (const float &aeta, float R[4]) const
+bool EgammaHitsShowerDepth::endcapCoefs (const float &aeta,
+                                         const CxxUtils::Array<2>& sampling_depth,
+                                         const float etamax,
+                                         float R[4]) const
 {
-  unsigned int ibin = (static_cast<unsigned int> (aeta / m_etamax * 100)) ;
-  if (ibin >= m_sampling_depth.size())
+  unsigned int ibin = (static_cast<unsigned int> (aeta / etamax * 100)) ;
+  if (ibin >= sampling_depth.size())
     return false;
 
   for (int i=0; i < 4; i++)
-    R[i] = m_sampling_depth[ibin][i+1];
+    R[i] = sampling_depth[ibin][i+1];
   return true;
 }
 
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaLWCalibration.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaLWCalibration.cxx
index 85b0cbd661433ec87646d47ff67a6897f36203cf..43f0a1106c1bddf80914ccee827c918e2c5133c2 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaLWCalibration.cxx
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaLWCalibration.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
 */
 
 
@@ -25,8 +25,7 @@ using CaloClusterCorr::interpolate;
 
 StatusCode EgammaLWCalibration::initialize(){
 
-	CHECK (AthAlgTool::initialize());
-	CHECK (CaloRec::ToolWithConstantsMixin::initialize() );
+	CHECK (base_class::initialize());
 	m_log = new MsgStream(AthAlgTool::msgSvc(), name() );
 
 	(*m_log) << MSG::DEBUG << "Initialize Tool : " << name() << endmsg;
@@ -41,10 +40,8 @@ StatusCode EgammaLWCalibration::initialize(){
 	m_samps[1][2]=CaloSampling::EME2;
 	m_samps[1][3]=CaloSampling::EME3;
 
-	unsigned int shape[] = {2};
-	m_interp_barriers = new CaloRec::WritableArrayData<1> (shape);
-	(*m_interp_barriers)[0] = m_eta_start_crack;
-	(*m_interp_barriers)[1] = m_eta_end_crack;
+	m_interp_barriers[0] = m_eta_start_crack();
+	m_interp_barriers[1] = m_eta_end_crack();
 
 	return StatusCode::SUCCESS;
 }
@@ -52,7 +49,6 @@ StatusCode EgammaLWCalibration::initialize(){
 StatusCode EgammaLWCalibration::finalize(){
 	(*m_log) << MSG::DEBUG << "Finalize Tool : " << name() << endmsg;
 	delete m_log;
-	delete m_interp_barriers;
 	return StatusCode::SUCCESS;
 }
 
@@ -65,29 +61,32 @@ void EgammaLWCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
 	(*m_log) << MSG::DEBUG << "Cluster E input : " <<
 		clus->energy() << endmsg;
 #endif
+        const float etamax = m_etamax();
 	float the_aeta=(clus->eta());
 	if (the_aeta<0) the_aeta=-the_aeta;
-	if (the_aeta >= m_etamax) return;
+	if (the_aeta >= etamax) return;
 	int si;
-	if (the_aeta < m_eta_start_crack) si=0;
-	else if ( the_aeta > m_eta_end_crack) si=1;
+	if (the_aeta < m_eta_start_crack()) si=0;
+	else if ( the_aeta > m_eta_end_crack()) si=1;
 	else return; // No Correction at the Gap.
 	float pars[4];
-	int ibin=static_cast<int> (the_aeta/m_etamax * m_correction.size());
-	pars[0] = m_correction[ibin][1];
-	pars[1] = m_correction[ibin][2];
-	if (m_interpolate){
+        const CxxUtils::Array<2> correction = m_correction();
+	int ibin=static_cast<int> (the_aeta/etamax * correction.size());
+	pars[0] = correction[ibin][1];
+	pars[1] = correction[ibin][2];
+        const int degree = m_degree();
+	if (m_interpolate()){
 	for(int i=2;i<4;i++)
-		pars[i] = interpolate(m_correction,
-			the_aeta,m_degree,i+1,(*m_interp_barriers));
+		pars[i] = interpolate(correction,
+			the_aeta,degree,i+1,m_interp_barriers);
 	}
 	else{
-		pars[2]=m_correction[ibin][3];
-		pars[3]=m_correction[ibin][4];
+		pars[2]=correction[ibin][3];
+		pars[3]=correction[ibin][4];
 	}
 
 	float e_offset = 0;
-	if (m_preserve_offset) {
+	if (m_preserve_offset()) {
 	  double total0 = 0;
 	  for (int sampling=0; sampling<4; ++sampling)
 	     total0 += clus->energy(m_samps[si][sampling]);
@@ -109,19 +108,3 @@ void EgammaLWCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
 
 }
 
-StatusCode
-EgammaLWCalibration::setProperty (const std::string& propname,
-                                    const std::string& value)
-{
-  CHECK( AthAlgTool::setProperty(propname,value) );
-  CHECK( CaloRec::ToolWithConstantsMixin::setProperty (propname, value) );
-  return StatusCode::SUCCESS;
-}
-
-StatusCode
-EgammaLWCalibration::setProperty (const Property& p)
-{
-  CHECK( AthAlgTool::setProperty(p) );
-  CHECK( CaloRec::ToolWithConstantsMixin::setProperty (p) );
-  return StatusCode::SUCCESS;
-}
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaSshapeCalibration.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaSshapeCalibration.cxx
index 4739092c9456248c5966921c5cb42dcc498fed38..cb7337262af5fb39d0eb276cd4139c9c42a5a108 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaSshapeCalibration.cxx
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaSshapeCalibration.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 "TrigT2CaloCalibration/EgammaSshapeCalibration.h"
@@ -11,33 +11,12 @@
 #include <math.h>
 #include <iomanip>
 
-//====================================================================
-//
-// EgammaSshapeCalibration constructor
-//
-//====================================================================
-EgammaSshapeCalibration::EgammaSshapeCalibration(const std::string &type,
-						 const std::string &name, 
-						 const IInterface* parent) 
-  : AthAlgTool(type,name,parent), CaloRec::ToolWithConstantsMixin()
-{
-  declareInterface<IEgammaCalibration>(this);
-  declareConstant("correction",    m_correction);
-  declareConstant("regions",       m_regions);
-  declareConstant("energies",      m_energies);
-  declareConstant("energy_degree", m_energy_degree=3);  
-  declareConstant("rangeBarrel",   m_isRange_barrel=true);  
-  declareConstant ("forms",        m_forms, true);
-  finish_ctor();
-}
-
 //====================================================================
 // initialize
 //====================================================================
 StatusCode EgammaSshapeCalibration::initialize(){
   m_log = new MsgStream(AthAlgTool::msgSvc(), name() ); 
-  CHECK(AthAlgTool::initialize());
-  CHECK(CaloRec::ToolWithConstantsMixin::initialize());
+  CHECK(base_class::initialize());
   (*m_log) << MSG::DEBUG << "Initialize Tool : " << name() << endmsg;
   return StatusCode::SUCCESS;
 }
@@ -59,13 +38,15 @@ void EgammaSshapeCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
   if(arg!=0){
     const CaloDetDescrElement *caloDDE = (const CaloDetDescrElement*) arg;
 
+    bool isRange_barrel = m_isRange_barrel();
+
 #ifndef NDEBUG    
     (*m_log) << MSG::DEBUG << "caloDDE->descriptor()->is_lar_em_barrel() = " 
 	     << caloDDE->descriptor()->is_lar_em_barrel() << endmsg;
     (*m_log) << MSG::DEBUG << "caloDDE->descriptor()->is_lar_em_endcap() = " 
 	     << caloDDE->descriptor()->is_lar_em_endcap() << endmsg;
 
-    (*m_log) << MSG::DEBUG << "m_isRange_barrel=" << m_isRange_barrel << endmsg;
+    (*m_log) << MSG::DEBUG << "m_isRange_barrel=" << isRange_barrel << endmsg;
 
     (*m_log) << MSG::DEBUG << "clus->energy(CaloSampling::PreSamplerB) = " 
 	     << clus->energy(CaloSampling::PreSamplerB) << endmsg;
@@ -84,19 +65,19 @@ void EgammaSshapeCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
     (*m_log) << MSG::DEBUG << "clus->energy(CaloSampling::EME3)        = " 
 	     << clus->energy(CaloSampling::EME3) << endmsg;
 
-    if((caloDDE->descriptor()->is_lar_em_barrel() &&  m_isRange_barrel) ||
-       (caloDDE->descriptor()->is_lar_em_endcap() && !m_isRange_barrel))
+    if((caloDDE->descriptor()->is_lar_em_barrel() &&  isRange_barrel) ||
+       (caloDDE->descriptor()->is_lar_em_endcap() && !isRange_barrel))
       (*m_log) << MSG::DEBUG 
 	       << "[GOOD]: seedCell location and selected eta range agree" << endmsg;
-    else if((caloDDE->descriptor()->is_lar_em_barrel() && !m_isRange_barrel) ||
-	    (caloDDE->descriptor()->is_lar_em_endcap() &&  m_isRange_barrel))
+    else if((caloDDE->descriptor()->is_lar_em_barrel() && !isRange_barrel) ||
+	    (caloDDE->descriptor()->is_lar_em_endcap() &&  isRange_barrel))
       (*m_log) << MSG::DEBUG 
 	       << "[BAD]: seedCell location and selected eta range disagree !!" << endmsg;
 #endif
   
     // check if seedCell is in barrel or end-cap for correct range selection
-    if((caloDDE->descriptor()->is_lar_em_barrel() && !m_isRange_barrel) ||
-       (caloDDE->descriptor()->is_lar_em_endcap() &&  m_isRange_barrel))
+    if((caloDDE->descriptor()->is_lar_em_barrel() && !isRange_barrel) ||
+       (caloDDE->descriptor()->is_lar_em_endcap() &&  isRange_barrel))
       return;
     
     double eta      = clus->eta();     // cluster position in eta     
@@ -132,11 +113,12 @@ void EgammaSshapeCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
     
     // Find the appropriate region 
     int region_ndx=-1;
-    unsigned int nreg = m_regions.size();
+    const CxxUtils::Array<2> regions = m_regions();
+    unsigned int nreg = regions.size();
 
     // find correct region
     for (unsigned int i=0; i<nreg; i++) {
-      if(aeta>=m_regions[i][REG_LO] && aeta<m_regions[i][REG_HI]){
+      if(aeta>=regions[i][REG_LO] && aeta<regions[i][REG_HI]){
 	region_ndx=i;
 	break;
       }
@@ -149,8 +131,8 @@ void EgammaSshapeCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
 
     // In a few regions, the fit was done using a cell size different
     // from what we actually have.  Need to recalculate u in this case.
-    if(std::abs(m_regions[region_ndx][REG_CELLSIZE]-elt_deta) > 1e-3) {
-      float cellsize = m_regions[region_ndx][REG_CELLSIZE];
+    if(std::abs(regions[region_ndx][REG_CELLSIZE]-elt_deta) > 1e-3) {
+      float cellsize = regions[region_ndx][REG_CELLSIZE];
       u = fmod(aeta,cellsize)/cellsize*2 - 1;
     }
 
@@ -159,7 +141,8 @@ void EgammaSshapeCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
     Builder *builder = new Builder(*this, aeta, u, region_ndx);
     
     // Calculate the correction for each energy.
-    unsigned int n_energies = m_energies.size();
+    const CxxUtils::Array<1> energies = m_energies();
+    unsigned int n_energies = energies.size();
     unsigned int shape[] = {n_energies, 2};
     CaloRec::WritableArrayData<2> corrtab (shape);
     
@@ -168,24 +151,24 @@ void EgammaSshapeCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
     // that one point in that case.
     unsigned int beg = 0;
     unsigned int end = n_energies;
-    if(energy <= m_energies[0]) // ok. m_energies also in MeV
+    if(energy <= energies[0]) // ok. energies also in MeV
       end = 1;
-    else if(energy >= m_energies[n_energies-1])// ok. m_energies also in MeV
+    else if(energy >= energies[n_energies-1])// ok. energies also in MeV
       beg = n_energies-1;
     
     // Build the table.
     int n_good = 0;
     for (unsigned int i=beg; i<end; i++)
-      docalc(i, *builder, m_energies, corrtab, n_good); 
+      docalc(i, *builder, energies, corrtab, n_good); 
     
     // If we only evaluated one point, but it wasn't good, keep
     // searching until we find a good one.
     while (n_good==0 && beg>0) {
       --beg;
-      docalc (beg, *builder, m_energies, corrtab, n_good);
+      docalc (beg, *builder, energies, corrtab, n_good);
     }
     while (n_good == 0 && end<n_energies) {
-      docalc(end, *builder, m_energies, corrtab, n_good);
+      docalc(end, *builder, energies, corrtab, n_good);
       ++end;
     }
     
@@ -210,7 +193,7 @@ void EgammaSshapeCalibration::makeCorrection(xAOD::TrigEMCluster* clus,
     else{ // Do the interpolation.
       offs = CaloClusterCorr::interpolate(corrtab, 
 					  energy, 
-					  m_energy_degree,
+					  m_energy_degree(),
 					  1, 
 					  CaloRec::Array<1>(), 
 					  n_good);
@@ -247,26 +230,6 @@ inline void EgammaSshapeCalibration::docalc (int i,
 }
 
 
-//====================================================================
-// EgammaSshapeCalibration::setProperty
-//====================================================================
-StatusCode EgammaSshapeCalibration::setProperty (const std::string& propname,
-						 const std::string& value){
-  CHECK( AthAlgTool::setProperty(propname,value) );
-  CHECK( CaloRec::ToolWithConstantsMixin::setProperty (propname, value) );
-  return StatusCode::SUCCESS;
-}
-
-
-//====================================================================
-// EgammaSshapeCalibration::setProperty
-//====================================================================
-StatusCode EgammaSshapeCalibration::setProperty (const Property& p){
-  CHECK( AthAlgTool::setProperty(p) );
-  CHECK( CaloRec::ToolWithConstantsMixin::setProperty (p) );
-  return StatusCode::SUCCESS;
-}
-
 //====================================================================
 //
 // Builder constructor
@@ -280,7 +243,7 @@ EgammaSshapeCalibration::Builder::Builder (const EgammaSshapeCalibration& corr,
     m_aeta(aeta),
     m_u(u),
     m_region_ndx(region_ndx),
-    m_form (m_corr.m_regions[region_ndx][REG_FORM])
+    m_form (m_corr.m_regions()[region_ndx][REG_FORM])
 { }
 
 //====================================================================
@@ -290,7 +253,7 @@ float EgammaSshapeCalibration::Builder::calculate(int energy_ndx,
 						  bool& good) const {
 
   // Find the proper array of coefficients.
-  CaloRec::Array<2> coef = m_corr.m_correction[energy_ndx][m_region_ndx];
+  CaloRec::Array<2> coef = m_corr.m_correction()[energy_ndx][m_region_ndx];
   
   // If we don't have coefficients for this energy/region, skip it.
   if(coef[0].end()[-1]==0) {
@@ -300,8 +263,9 @@ float EgammaSshapeCalibration::Builder::calculate(int energy_ndx,
 
   // Which functional form to use?
   int form;
-  if (m_corr.m_forms.size() != 0)
-    form = m_corr.m_forms[m_region_ndx][energy_ndx];
+  CxxUtils::Array<2> forms = m_corr.m_forms();
+  if (forms.size(0) != 0 && forms.size(1) != 0)
+    form = forms[m_region_ndx][energy_ndx];
   else
     form = m_form;
 
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaTransitionRegions.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaTransitionRegions.cxx
index 1c3a98944d5d77edb881ae4398c71b9d1772da4b..714220607c6c4136dc2f59325032f1f93e836fff 100644
--- a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaTransitionRegions.cxx
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaTransitionRegions.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
 */
 
 // ********************************************************************
@@ -42,8 +42,7 @@ const CaloSampling::CaloSample samps[2][4] =
 
 StatusCode EgammaTransitionRegions::initialize(){
 
-    CHECK (AthAlgTool::initialize());
-    CHECK (CaloRec::ToolWithConstantsMixin::initialize() );
+    CHECK (base_class::initialize());
     m_log = new MsgStream(AthAlgTool::msgSvc(), name() );
 
     (*m_log) << MSG::DEBUG << "Initialize Tool : " << name() << endmsg;
@@ -76,8 +75,9 @@ void EgammaTransitionRegions::makeCorrection(xAOD::TrigEMCluster* clus,
     (*m_log) << MSG::DEBUG <<  "************************************************************************************************" << endmsg;       
 #endif
 
-    CaloRec::Array<1> tr00	= m_correction[0];
-    CaloRec::Array<1> tr08	= m_correction[1];
+    CxxUtils::Array<2> correction = m_correction();
+    CaloRec::Array<1> tr00	= correction[0];
+    CaloRec::Array<1> tr08	= correction[1];
 
 #ifndef NDEBUG
     (*m_log) << MSG::DEBUG <<  "************************************************************************************************" << endmsg;
@@ -89,14 +89,14 @@ void EgammaTransitionRegions::makeCorrection(xAOD::TrigEMCluster* clus,
     // Compute correction for eta = 0 
     // -------------------------------------------------------------
 
-    if (the_aeta < m_etamax_TR00 && the_aeta > m_etamin_TR00 ) {
+    if (the_aeta < m_etamax_TR00() && the_aeta > m_etamin_TR00() ) {
 #ifndef NDEBUG
 	(*m_log) << MSG::DEBUG << "Applying correction for eta = 0 (loose) " << endmsg;
 	(*m_log) << MSG::DEBUG << tr00[0] << " " <<  tr00[1] << " " <<  tr00[2] << endmsg;
 #endif
 	corr = ( tr00[0] - tr00[1] / (exp( tr00[2] - the_aeta ) + exp( tr00[3]*( the_aeta - tr00[4]))+tr00[5]));
     }
-    else if ( the_aeta < m_etamin_TR00 ) {
+    else if ( the_aeta < m_etamin_TR00() ) {
 	corr = tr00[6];
 #ifndef NDEBUG
 	(*m_log) << MSG::DEBUG << "Applying correction for eta = 0 (tight) " << endmsg;
@@ -107,7 +107,7 @@ void EgammaTransitionRegions::makeCorrection(xAOD::TrigEMCluster* clus,
     // Compute correction for eta = 0.8
     // -------------------------------------------------------------
 
-    if (the_aeta < m_etamax_TR08 && the_aeta > m_etamin_TR08 ) {
+    if (the_aeta < m_etamax_TR08() && the_aeta > m_etamin_TR08() ) {
 #ifndef NDEBUG
 	(*m_log) << MSG::DEBUG << "Applying correction for eta = 0.8 (loose) " << endmsg;
 	(*m_log) << MSG::DEBUG << tr08[0] << " " <<  tr08[1] << " " <<  tr08[2] << endmsg;
@@ -141,20 +141,3 @@ void EgammaTransitionRegions::makeCorrection(xAOD::TrigEMCluster* clus,
 
 }
 
-StatusCode
-EgammaTransitionRegions::setProperty (const std::string& propname,
-        const std::string& value)
-{
-    CHECK( AthAlgTool::setProperty(propname,value) );
-    CHECK( CaloRec::ToolWithConstantsMixin::setProperty (propname, value) );
-    return StatusCode::SUCCESS;
-}
-
-StatusCode
-EgammaTransitionRegions::setProperty (const Property& p)
-{
-    CHECK( AthAlgTool::setProperty(p) );
-    CHECK( CaloRec::ToolWithConstantsMixin::setProperty (p) );
-    return StatusCode::SUCCESS;
-}
-
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/IT2HadCalibTool.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/IT2HadCalibTool.cxx
deleted file mode 100755
index ca3aa31edce23d4e82a8058f188c0bdaba848227..0000000000000000000000000000000000000000
--- a/Trigger/TrigTools/TrigT2CaloCalibration/src/IT2HadCalibTool.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "TrigT2CaloCalibration/IT2HadCalibTool.h"
-
-static const InterfaceID IID_IT2HadCalibTool("IT2HadCalibTool", 1, 0);
-
-const InterfaceID& IT2HadCalibTool::interfaceID()
-{
-        return IID_IT2HadCalibTool;
-}
-
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/T2GSCalibTool.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/T2GSCalibTool.cxx
index c6f35938066b538ba5d1568e1753a4f4fd5d2e30..88b79852f61f87659c7b95126746d68896b9a461 100755
--- a/Trigger/TrigTools/TrigT2CaloCalibration/src/T2GSCalibTool.cxx
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/T2GSCalibTool.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
 */
 
 // ********************************************************************
@@ -20,12 +20,10 @@
 
 
 T2GSCalibTool::T2GSCalibTool(const std::string& t, const std::string& n,
-			       const IInterface*  p ) : AthAlgTool(t,n,p),	m_log(msgSvc(), n)	
+			       const IInterface*  p )
+  : base_class(t,n,p),
+    m_log(msgSvc(), n)	
 {
- 
-  declareInterface<IT2HadCalibTool>(this);
-
-  declareConstant("CalibConstants",     m_calibConstants);
   declareProperty("EtaBins",            m_etaBins);
   declareProperty("EtaMin",             m_etaMin);
   declareProperty("EtaMax",             m_etaMax);
@@ -43,32 +41,11 @@ T2GSCalibTool::~T2GSCalibTool() {
 }
 
 
-StatusCode T2GSCalibTool::setProperty (const std::string& propname,
-                                             const std::string& value){
-  StatusCode sc = AthAlgTool::setProperty (propname, value);
-  if (sc.isFailure())
-    return sc;
-  sc=CaloRec::ToolWithConstantsMixin::setProperty (propname, value);
-  if (sc.isFailure())
-    return sc;
-  return StatusCode::SUCCESS;  
-}
-
-StatusCode T2GSCalibTool::setProperty (const Property& p){
-  StatusCode sc=AthAlgTool::setProperty (p);
-  if (sc.isFailure())
-    return sc;
-  sc=CaloRec::ToolWithConstantsMixin::setProperty (p);
-  if (sc.isFailure())
-    return sc;
-  return StatusCode::SUCCESS;
-}   
-
-
 StatusCode T2GSCalibTool::initialize()
 {
   // Initialize MsgStream
   m_log.setLevel(msgLevel());
+  ATH_CHECK( base_class::initialize() );
   return StatusCode::SUCCESS;  
 }
 
@@ -140,13 +117,13 @@ double T2GSCalibTool::CalculateCorrection(double jetProperty,
     ? interpolate(pT, jetProperty, 
 		  m_ptBins[eta_index], 
 		  m_propertyBins[eta_index], 
-		  m_calibConstants[eta_index]) 
+		  m_calibConstants()[eta_index]) 
     : 0;
   if(corr == 0){
     corr = extrapolate(pT, jetProperty, 
 		       m_ptBins[eta_index], 
 		       m_propertyBins[eta_index], 
-		       m_calibConstants[eta_index]);
+		       m_calibConstants()[eta_index]);
 
 
   }
diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/T2JESCalibTool.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/T2JESCalibTool.cxx
index 4e28f4f2f7caec3f7e7ae028ddb0c2f13122eba8..d95b4ee3778ce5dbdac000b93d23527be00e9e14 100755
--- a/Trigger/TrigTools/TrigT2CaloCalibration/src/T2JESCalibTool.cxx
+++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/T2JESCalibTool.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
 */
 
 // ********************************************************************
@@ -23,13 +23,10 @@
 
 
 T2JESCalibTool::T2JESCalibTool(const std::string& t, const std::string& n,
-			       const IInterface*  p ) : AthAlgTool(t,n,p),	m_log(msgSvc(), n)	
+			       const IInterface*  p )
+  : base_class(t,n,p),
+    m_log(msgSvc(), n)	
 {
- 
- declareInterface<IT2HadCalibTool>(this);
- m_etcut = 10; //GeV
- declareProperty("MinEtCut",m_etcut);
- declareConstant("JES_Factors", m_EnergyCorrConstants);
 }
 
  
@@ -37,32 +34,11 @@ T2JESCalibTool::~T2JESCalibTool() {
 }
 
 
-StatusCode T2JESCalibTool::setProperty (const std::string& propname,
-                                             const std::string& value){
-  StatusCode sc = AthAlgTool::setProperty (propname, value);
-  if (sc.isFailure())
-    return sc;
-  sc=CaloRec::ToolWithConstantsMixin::setProperty (propname, value);
-  if (sc.isFailure())
-    return sc;
-  return StatusCode::SUCCESS;  
-}
-
-StatusCode T2JESCalibTool::setProperty (const Property& p){
-  StatusCode sc=AthAlgTool::setProperty (p);
-  if (sc.isFailure())
-    return sc;
-  sc=CaloRec::ToolWithConstantsMixin::setProperty (p);
-  if (sc.isFailure())
-    return sc;
-  return StatusCode::SUCCESS;
-}   
-
-
 StatusCode T2JESCalibTool::initialize()
 {
   // Initialize MsgStream
   m_log.setLevel(msgLevel());
+  ATH_CHECK( base_class::initialize() );
   return StatusCode::SUCCESS;  
 }
 
@@ -113,7 +89,7 @@ double T2JESCalibTool::GetJES(double jet_e, double jet_eta)
   unsigned ieta = GetEtaBin(jet_eta);
 
   // Calculate the jet response and then the JES as 1/R
-  double R=PolLogE(m_EnergyCorrConstants,ieta,E);
+  double R=PolLogE(m_EnergyCorrConstants(),ieta,E);
   return 1.0/R;
 }
 
diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref
index a13e0bc643ba74e701371a2c1c5d16b4e06b2d97..dcc3d0bbb2bdb08087fb52c131c5a49cf3777b50 100644
--- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref
+++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref
@@ -553,6 +553,12 @@ TrigSignatureMoniMT                                INFO -- #1198298874 Features
 TrigSignatureMoniMT                                INFO HLT_noalg_idmon_L1RD0_UNPAIRED_ISO #2536676873
 TrigSignatureMoniMT                                INFO -- #2536676873 Events         0          0          -          -          -          -          -          -          0
 TrigSignatureMoniMT                                INFO -- #2536676873 Features                             -          -          -          -          -          -
+TrigSignatureMoniMT                                INFO HLT_noalg_mb_L1RD2_EMPTY #3788962163
+TrigSignatureMoniMT                                INFO -- #3788962163 Events         0          0          -          -          -          -          -          -          0
+TrigSignatureMoniMT                                INFO -- #3788962163 Features                             -          -          -          -          -          -
+TrigSignatureMoniMT                                INFO HLT_noalg_zb_L1ZB #1289992951
+TrigSignatureMoniMT                                INFO -- #1289992951 Events         0          0          -          -          -          -          -          -          0
+TrigSignatureMoniMT                                INFO -- #1289992951 Features                             -          -          -          -          -          -
 TrigSignatureMoniMT                                INFO HLT_sct_noise_SCTPEB_L1RD0_EMPTY #3024203296
 TrigSignatureMoniMT                                INFO -- #3024203296 Events         0          0          0          -          -          -          -          -          0
 TrigSignatureMoniMT                                INFO -- #3024203296 Features                             0          -          -          -          -          -
diff --git a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py
index 1678736f034e1e1f7e0a6a68edf435943671993a..b2e85e98eb3f4e072c4cf508b55a036c075e42e6 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py
@@ -47,7 +47,7 @@ class TrigInDetCompStep(Step):
     def __init__(self, name='TrigInDetComp'):
         super(TrigInDetCompStep, self).__init__(name)
         self.input_file = 'data-hists.root'
-        self.ref_file = 'data-ref.root'
+        self.ref_file = 'data-hists.root'   #### need to add reference file here 
         self.output_dir = 'HLT-plots'
         self.chains = ' '
         self.args = ''
diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_tida22.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_tida22.py
index 798ab55c0e58978e6d6569d0f9145a063f4266d4..9b1c11a996053bbc0e7317c8f9f60643425fea4f 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_tida22.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_tida22.py
@@ -154,6 +154,8 @@ if ( True ) :
 
     "HLT_b.*perf.*:HLT_IDTrack_Bjet_FTF",
     "HLT_b.*perf.*:HLT_IDTrack_Bjet_IDTrig",
+    "HLT_j.*perf.*:HLT_IDTrack_Bjet_FTF",
+    "HLT_j.*perf.*:HLT_IDTrack_Bjet_IDTrig",
 
     "HLT_e.*_etcut.*:HLT_IDTrack_Electron_FTF",
     "HLT_e.*_etcut.*:HLT_IDTrack_Electron_IDTrig",
@@ -161,7 +163,7 @@ if ( True ) :
     "HLT_tau.*_idperf.*:HLT_IDTrack_TauCore_FTF",
     "HLT_tau.*_idperf.*:HLT_IDTrack_TauIso_FTF",
     "HLT_tau.*_idperf.*:HLT_IDTrack_Tau_IDTrig"
-
+    "HLT_tau.*_idperf.*:HLT_IDTrack_Tau_FTF"
 
     ]
   
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_grid.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_grid.py
new file mode 100755
index 0000000000000000000000000000000000000000..dfc931c5a2795fe384628eb09fcfae235fb9f4c9
--- /dev/null
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_grid.py
@@ -0,0 +1,133 @@
+#!/usr/bin/env python
+
+# art-description: art job for all_ttbar_pu80_grid
+# art-type: grid
+# art-include: master/Athena
+# art-input: mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195
+# art-input-nfiles: 3
+# art-athena-mt: 4
+# art-output: *.txt
+# art-output: *.log
+# art-output: log.*
+# art-output: *.out
+# art-output: *.err
+# art-output: *.log.tar.gz
+# art-output: *.new
+# art-output: *.json
+# art-output: *.root
+# art-output: *.check*
+# art-output: HLTEF-plots
+# art-output: HLTL2-plots
+# art-output: times
+# art-output: times-FTF
+# art-output: cost-perCall
+# art-output: cost-perEvent
+# art-output: cost-perCall-chain
+# art-output: cost-perEvent-chain
+# art-output: *.dat 
+
+
+from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps
+from TrigInDetValidation.TrigInDetArtSteps import TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep
+
+
+import sys,getopt
+
+try:
+    opts, args = getopt.getopt(sys.argv[1:],"l",["local"])
+except getopt.GetoptError:
+    print("Usage: -l(--local)")
+
+
+local=False
+for opt,arg in opts:
+    if opt in ("-l", "--local"):
+        local=True
+
+
+
+chains = [
+    'HLT_mu6_idperf_L1MU6',
+    'HLT_mu24_idperf_L1MU20',
+    'HLT_e5_etcut_L1EM3',  ## need an idperf chain once one is in the menu
+    'HLT_tau25_idperf_tracktwo_L1TAU12IM',
+    'HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20'
+]
+
+preexec_trig = ';'.join([
+    'doEmptyMenu=True',
+    'doMuonSlice=True',
+    'doEgammaSlice=True',
+    'doTauSlice=True',
+    'doBjetSlice=True',
+    'selectChains='+str(chains)
+])
+
+
+preexec_reco = ';'.join([
+    'from RecExConfig.RecFlags import rec',
+    'rec.doForwardDet=False',
+    'rec.doEgamma=False',
+    'rec.doMuonCombined=False',
+    'rec.doJetMissingETTag=False',
+    'rec.doTau=False'
+])
+
+preexec_aod = ';'.join([
+     preexec_reco,
+     'from ParticleBuilderOptions.AODFlags import AODFlags',
+     'AODFlags.ThinGeantTruth.set_Value_and_Lock(False)',
+     'AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False)',
+     'AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False)',
+     'AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False)'
+])
+
+
+
+preexec_all = ';'.join([
+    'from TriggerJobOpts.TriggerFlags import TriggerFlags',
+    'TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\")',
+])
+
+rdo2aod = ExecStep.ExecStep()
+rdo2aod.type = 'Reco_tf'
+rdo2aod.max_events = 1000 # TODO: 2000 events
+rdo2aod.threads = 1 # TODO: change to 4
+rdo2aod.concurrent_events = 1 # TODO: change to 4
+rdo2aod.perfmon = False
+rdo2aod.args = '--outputAODFile=AOD.pool.root --steering="doRDO_TRIG" '
+if local:
+    rdo2aod.input = 'ttbar_pu80'   ## This isn't the same sample as the grid test but for not lets use it.
+else:
+    rdo2aod.input = ''
+    rdo2aod.args += '--inputRDOFile=$ArtInFile '
+
+rdo2aod.args += ' --preExec "RDOtoRDOTrigger:{:s};" "all:{:s};" "RAWtoESD:{:s};" "ESDtoAOD:{:s};"'.format(
+    preexec_trig, preexec_all, preexec_reco, preexec_aod)
+
+test = Test.Test()
+test.art_type = 'grid'
+test.exec_steps = [rdo2aod]
+test.check_steps = CheckSteps.default_check_steps(test)
+
+# Run analysis to produce TrkNtuple
+test.exec_steps.append(TrigInDetAna())
+ 
+# Run Tidardict
+test.check_steps.append(TrigInDetdictStep())
+ 
+# Now the comparitor steps
+comp=TrigInDetCompStep('CompareStep1')
+comp.chains = 'HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF'
+comp.output_dir = 'HLT-plots-FTF'
+test.check_steps.append(comp)
+ 
+ 
+comp2=TrigInDetCompStep('CompareStep2')
+comp2.chains='HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_IDTrig'
+comp2.output_dir = 'HLT-plots-IDTrig'
+test.check_steps.append(comp2)
+
+
+import sys
+sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_build.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_build.py
index a7e54d29c8315d72fab3f096dd6b9ff484ad5394..c52b13e6b01abc94b95c611634135e05b8c958ba 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_build.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_build.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# art-description: art job for mu_Zmumu_IBL_pu40
+# art-description: art job for mu_Zmumu_pu40_build
 # art-type: build
 # art-include: master/Athena
 
@@ -20,13 +20,21 @@ preexec_trig = ';'.join([
 ])
 
 preexec_reco = ';'.join([
-    'pass' # TODO: figure out a working set of options to disable parts of reco
-    # 'from RecExConfig.RecFlags import rec',
-    # 'rec.doForwardDet=False',
-    # 'rec.doEgamma=False',
-    # 'rec.doMuonCombined=False',
-    # 'rec.doJetMissingETTag=False',
-    # 'rec.doTau=False'
+    'from RecExConfig.RecFlags import rec',
+    'rec.doForwardDet=False',
+    'rec.doEgamma=False',
+    'rec.doMuonCombined=False',
+    'rec.doJetMissingETTag=False',
+    'rec.doTau=False'
+])
+
+preexec_aod = ';'.join([
+     preexec_reco,
+     'from ParticleBuilderOptions.AODFlags import AODFlags',
+     'AODFlags.ThinGeantTruth.set_Value_and_Lock(False)',
+     'AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False)',
+     'AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False)',
+     'AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False)'
 ])
 
 preexec_all = ';'.join([
@@ -43,7 +51,7 @@ rdo2aod.concurrent_events = 1 # TODO: change to 4
 rdo2aod.perfmon = False
 rdo2aod.args = '--outputAODFile=AOD.pool.root --steering="doRDO_TRIG"'
 rdo2aod.args += ' --preExec "RDOtoRDOTrigger:{:s};" "all:{:s};" "RAWtoESD:{:s};" "ESDtoAOD:{:s};"'.format(
-    preexec_trig, preexec_all, preexec_reco, preexec_reco)
+    preexec_trig, preexec_all, preexec_reco, preexec_aod)
 
 test = Test.Test()
 test.art_type = 'build'
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_grid.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_grid.py
index 2bd7d45f5cefed63264aebcff77fa86e24cb0389..3cd757d5f2b7520268ddeb0e2feb7a71a18e2449 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_grid.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_grid.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# art-description: art job for mu_Zmumu_IBL_pu40
+# art-description: art job for mu_Zmumu_pu40_grid
 # art-type: grid
 # art-include: master/Athena
 # art-input: mc15_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.RDO.e3601_s2576_s2132_r7143
@@ -30,6 +30,22 @@
 from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps
 from TrigInDetValidation.TrigInDetArtSteps import TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep
 
+
+import sys,getopt
+
+try:
+    opts, args = getopt.getopt(sys.argv[1:],"l",["local"])
+except getopt.GetoptError:
+    print("Usage: -l(--local)")
+
+
+local=False
+for opt,arg in opts:
+    if opt in ("-l", "--local"):
+        local=True
+
+
+
 chains = [
     'HLT_mu6_idperf_L1MU6',
     'HLT_mu24_idperf_L1MU20'
@@ -41,16 +57,27 @@ preexec_trig = ';'.join([
     'selectChains='+str(chains)
 ])
 
+
 preexec_reco = ';'.join([
-    'pass' # TODO: figure out a working set of options to disable parts of reco
-    # 'from RecExConfig.RecFlags import rec',
-    # 'rec.doForwardDet=False',
-    # 'rec.doEgamma=False',
-    # 'rec.doMuonCombined=False',
-    # 'rec.doJetMissingETTag=False',
-    # 'rec.doTau=False'
+    'from RecExConfig.RecFlags import rec',
+    'rec.doForwardDet=False',
+    'rec.doEgamma=False',
+    'rec.doMuonCombined=False',
+    'rec.doJetMissingETTag=False',
+    'rec.doTau=False'
+])
+
+preexec_aod = ';'.join([
+     preexec_reco,
+     'from ParticleBuilderOptions.AODFlags import AODFlags',
+     'AODFlags.ThinGeantTruth.set_Value_and_Lock(False)',
+     'AODFlags.ThinNegativeEnergyCaloClusters.set_Value_and_Lock(False)',
+     'AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False)',
+     'AODFlags.ThinInDetForwardTrackParticles.set_Value_and_Lock(False)'
 ])
 
+
+
 preexec_all = ';'.join([
     'from TriggerJobOpts.TriggerFlags import TriggerFlags',
     'TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\")',
@@ -58,14 +85,19 @@ preexec_all = ';'.join([
 
 rdo2aod = ExecStep.ExecStep()
 rdo2aod.type = 'Reco_tf'
-rdo2aod.input = ''  # specified in inputRDOFile below
-rdo2aod.max_events = 100 # TODO: 2000 events
+rdo2aod.max_events = 2000 # TODO: 2000 events
 rdo2aod.threads = 1 # TODO: change to 4
 rdo2aod.concurrent_events = 1 # TODO: change to 4
 rdo2aod.perfmon = False
-rdo2aod.args = '--inputRDOFile=$ArtInFile --outputAODFile=AOD.pool.root --steering="doRDO_TRIG"'
+rdo2aod.args = '--outputAODFile=AOD.pool.root --steering="doRDO_TRIG" '
+if local:
+    rdo2aod.input = 'Zmumu_pu40'
+else:
+    rdo2aod.input = ''
+    rdo2aod.args += '--inputRDOFile=$ArtInFile '
+
 rdo2aod.args += ' --preExec "RDOtoRDOTrigger:{:s};" "all:{:s};" "RAWtoESD:{:s};" "ESDtoAOD:{:s};"'.format(
-    preexec_trig, preexec_all, preexec_reco, preexec_reco)
+    preexec_trig, preexec_all, preexec_reco, preexec_aod)
 
 test = Test.Test()
 test.art_type = 'grid'
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/Cosmic.py b/Trigger/TrigValidation/TrigUpgradeTest/share/Cosmic.py
index 73760490124c33aa72af7c8202a58a141ff3d1f0..c1a6d765a0236b9d79c32bb11f9a783be0109fa5 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/Cosmic.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/Cosmic.py
@@ -23,7 +23,8 @@ from AthenaCommon.AlgSequence import AthSequencer
 signatureName = 'Cosmic'
 
 #TODO switch once done
-from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm, ViewCreatorInitialROITool
+from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
+from DecisionHandling.DecisionHandlingConf import ViewCreatorInitialROITool
 from L1Decoder.L1DecoderConfig import mapThresholdToL1RoICollection, mapThresholdToL1DecisionCollection
 
 inputMakerAlg = EventViewCreatorAlgorithm("IM_%s"%signatureName)
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/photon.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/photon.withViews.py
index e6728c83928e1bef73133dd3a35f48750dd728e5..110add925c6c14f8216c5a8e33b8fa76df71eb2e 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/photon.withViews.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/photon.withViews.py
@@ -18,8 +18,8 @@ trigL2CaloRingerFexMT = init_ringer()
 
 from AthenaCommon.CFElements import parOR, seqOR, seqAND, stepSeq, findAlgorithm
 from DecisionHandling.DecisionHandlingConf import RoRSeqFilter, DumpDecisions
-from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm, ViewCreatorInitialROITool
-
+from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
+from DecisionHandling.DecisionHandlingConf import ViewCreatorInitialROITool
 
 def createFastCaloSequence(rerun=False):
    __prefix = "Rerurn_" if rerun else ""
diff --git a/Trigger/TrigValidation/TrigValTools/bin/trigvalsteering-unit-tester.py b/Trigger/TrigValidation/TrigValTools/bin/trigvalsteering-unit-tester.py
index 06ce1e242c7fa0e96fa95b373809a45a3f17b284..6e49a502e02594cdaa3799db56ce91a53c2c3a53 100755
--- a/Trigger/TrigValidation/TrigValTools/bin/trigvalsteering-unit-tester.py
+++ b/Trigger/TrigValidation/TrigValTools/bin/trigvalsteering-unit-tester.py
@@ -1,15 +1,35 @@
 #!/usr/bin/env python
 #
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 #
 
 import sys
 import os
+import re
 import argparse
 import subprocess
 from TrigValTools.TrigValSteering import Common
 
 
+def grep_errors(filename):
+    '''Grep for error messages but ignore missing reference errors and echo commands'''
+    error_pattern = '^.*ERROR.*$'
+    ignore_patterns = [
+        'Missing reference',
+        'echo "ERROR'
+    ]
+    def filter_fn(msg):
+        for p in ignore_patterns:
+            if p in msg:
+                return False
+        return True
+
+    lines = []
+    with open(filename) as f:
+        lines = re.findall(error_pattern, f.read(), re.MULTILINE)
+    return list(filter(filter_fn, lines))
+
+
 def main():
     log = Common.get_logger()
 
@@ -35,17 +55,15 @@ def main():
             status_str = 'OK'
             if ret_code != 0:
                 status_str = 'FAILED WITH CODE {:d}'.format(ret_code)
-            # Grep for error messages but ignore missing reference errors and echo commands
-            grep_cmd = 'grep ERROR {:s}'.format(log_file)
-            grep_cmd += ' | grep -v "Missing reference"'
-            grep_cmd += ' | grep -v "echo \\\"ERROR"'
-            grep_cmd += ' >/dev/null 2>&1'
-            grep_code = subprocess.call(grep_cmd, shell=True)
-            if grep_code == 0:
-                status_str = 'ERROR IN LOG {:s}'.format(log_file)
+            errors = grep_errors(log_file)
+            if len(errors) > 0:
+                status_str = 'ERROR IN LOG {:s}:'.format(log_file)
+
             if status_str != 'OK':
                 n_failed += 1
             log.info('---- %s ---- %s', test, status_str)
+            for msg in errors:
+                print(msg)
     return n_failed
 
 
diff --git a/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py b/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py
index 6c7462f75379c684157ec08a2106750a37c63747..22fd8d6643fa84fe834fd8da33747692bce1a594 100644
--- a/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py
+++ b/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/CheckSteps.py
@@ -14,7 +14,7 @@ import json
 import six
 import glob
 
-from TrigValTools.TrigValSteering.Step import Step
+from TrigValTools.TrigValSteering.Step import Step, get_step_from_list
 from TrigValTools.TrigValSteering.Common import art_input_eos, art_input_cvmfs
 
 class RefComparisonStep(Step):
@@ -624,7 +624,7 @@ class MessageCountStep(Step):
     def __init__(self, name='MessageCount'):
         super(MessageCountStep, self).__init__(name)
         self.executable = 'messageCounter.py'
-        self.log_regex = r'(athena\..*log$|athenaHLT:.*\.out$|^log\..*to.*)'
+        self.log_regex = r'(athena\.(?!.*tail).*log$|athenaHLT:.*\.out$|^log\..*to.*)'
         self.skip_logs = []
         self.start_pattern = r'(HltEventLoopMgr|AthenaHiveEventLoopMgr).*INFO Starting loop on events'
         self.end_pattern = r'(HltEventLoopMgr.*INFO All events processed|AthenaHiveEventLoopMgr.*INFO.*Loop Finished)'
@@ -679,10 +679,10 @@ class MessageCountStep(Step):
                     if summary[level] > threshold:
                         self.result += 1
                         self.log.info(
-                            '%s Number of %s messages %s is higher than threshold %s',
-                            self.name, level, summary[level], threshold)
+                            '%s Number of %s messages %s in %s is higher than threshold %s',
+                            self.name, level, summary[level], log_file, threshold)
                         if self.print_on_fail:
-                            self.log.info('%s Printing all %s messages', self.name, level)
+                            self.log.info('%s Printing all %s messages from %s', self.name, level, log_file)
                             with open(all_json_file) as af:
                                 all_msg = json.load(af)
                                 for msg in all_msg[level]:
@@ -741,13 +741,16 @@ def default_check_steps(test):
         log_to_zip = check_steps[-1].merged_name
 
     # Reco_tf log merging
-    step_types = [step.type for step in test.exec_steps]
-    if 'Reco_tf' in step_types:
+    reco_tf_steps = [step for step in test.exec_steps if step.type=='Reco_tf']
+    if len(reco_tf_steps) > 0:
         reco_tf_logmerge = LogMergeStep('LogMerge_Reco_tf')
         reco_tf_logmerge.warn_if_missing = False
         tf_names = ['HITtoRDO', 'RDOtoRDOTrigger', 'RAWtoESD', 'ESDtoAOD',
                     'PhysicsValidation', 'RAWtoALL']
         reco_tf_logmerge.log_files = ['log.'+tf_name for tf_name in tf_names]
+        if not get_step_from_list('LogMerge', check_steps):
+            for step in reco_tf_steps:
+                reco_tf_logmerge.log_files.append(step.get_log_file_name())
         reco_tf_logmerge.extra_log_regex = r'athfile-.*\.log\.txt'
         reco_tf_logmerge.merged_name = 'athena.merged.log'
         log_to_zip = reco_tf_logmerge.merged_name
diff --git a/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/ExecStep.py b/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/ExecStep.py
index dcff8fa0c38b5aff1211f6d60a7c8cf3b5730fd2..d935df5bd430ff699130211c297762c9639773d6 100644
--- a/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/ExecStep.py
+++ b/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/ExecStep.py
@@ -91,6 +91,12 @@ class ExecStep(Step):
             self.report_result(1, 'TestConfig')
             sys.exit(1)
 
+        # Ensure no log duplication for transforms
+        if self.executable.endswith('_tf.py'):
+            os.environ['TRF_NOECHO'] = '1'
+            if 'TRF_ECHO' in os.environ:
+                del os.environ['TRF_ECHO']
+
     def configure_input(self):
         self.log.debug('Configuring input for step %s', self.name)
         if self.input is None:
diff --git a/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/Step.py b/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/Step.py
index accc830224e5d11510b7a2705cb4ba126bbbb7cc..296519c370cc60ca15ccb7cb05271a5827a7befc 100644
--- a/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/Step.py
+++ b/Trigger/TrigValidation/TrigValTools/python/TrigValSteering/Step.py
@@ -11,6 +11,7 @@ import sys
 import signal
 import subprocess
 import time
+import re
 from enum import Enum
 from threading import Timer
 from TrigValTools.TrigValSteering.Common import get_logger, art_result
@@ -185,6 +186,19 @@ class Step(object):
             with open(self.get_log_file_name()) as log_file:
                 log=log_file.read()
                 print(log)  # noqa: ATL901
+                # Print also sub-step logs for transforms
+                if self.executable.endswith('_tf.py'):
+                    step_matches = re.findall('Logs for (.*) are in (.*)', log)
+                    if not step_matches:
+                        self.log.warning('Failed to determine sub-step log names, cannot print the full sub-step logs')
+                    else:
+                        step_log_names = [m[1] for m in step_matches]
+                        for step_log_name in step_log_names:
+                            if os.path.isfile(step_log_name):
+                                with open(step_log_name) as step_log_file:
+                                    step_log = step_log_file.read()
+                                    self.log.info('Printing sub-step log file %s', step_log_name)
+                                    print(step_log)  # noqa: ATL901
 
         return self.result, cmd
 
diff --git a/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json b/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json
index 973b26b5fcc9b0b384d85690af5afe43eb56c9c5..370d8ba36c54eb5b66fb136a1fe4de75b3faa872 100644
--- a/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json
+++ b/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json
@@ -117,7 +117,7 @@
         "source": "mc",
         "format": "RDO",
         "paths": [
-            "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TriggerTest/mc16_13TeV.310772.CosmicRays_CollisionSetup.recon.RDO.s3513_s3519_r11737_tid20237005_00/RDO.20237005._004484.pool.root.1"
+            "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TriggerTest/mc16_13TeV.310772.CosmicRays_CollisionSetup.recon.RDO.s3513_s3519_r11737_tid20237005_00/RDO.20237005.merge250"
         ]
     },
     "Zmumu_pu40": {
diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
index 2fc9bdda41f304e6c67d19ca83550eda4da0663e..d585523117b459303c9bc4b2cf2949be7fdcbe39 100644
--- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
@@ -553,6 +553,12 @@ TrigSignatureMoniMT                                 INFO -- #1198298874 Features
 TrigSignatureMoniMT                                 INFO HLT_noalg_idmon_L1RD0_UNPAIRED_ISO #2536676873
 TrigSignatureMoniMT                                 INFO -- #2536676873 Events         20         20         -          -          -          -          -          -          20         
 TrigSignatureMoniMT                                 INFO -- #2536676873 Features                             -          -          -          -          -          -          
+TrigSignatureMoniMT                                 INFO HLT_noalg_mb_L1RD2_EMPTY #3788962163
+TrigSignatureMoniMT                                 INFO -- #3788962163 Events         20         20         -          -          -          -          -          -          20         
+TrigSignatureMoniMT                                 INFO -- #3788962163 Features                             -          -          -          -          -          -          
+TrigSignatureMoniMT                                 INFO HLT_noalg_zb_L1ZB #1289992951
+TrigSignatureMoniMT                                 INFO -- #1289992951 Events         20         20         -          -          -          -          -          -          20         
+TrigSignatureMoniMT                                 INFO -- #1289992951 Features                             -          -          -          -          -          -          
 TrigSignatureMoniMT                                 INFO HLT_sct_noise_SCTPEB_L1RD0_EMPTY #3024203296
 TrigSignatureMoniMT                                 INFO -- #3024203296 Events         20         20         20         -          -          -          -          -          20         
 TrigSignatureMoniMT                                 INFO -- #3024203296 Features                             20         -          -          -          -          -          
diff --git a/Trigger/TrigValidation/TriggerTest/test/test_slice_id_build.sh b/Trigger/TrigValidation/TriggerTest/test/test_slice_id_build.sh
deleted file mode 100755
index f088d6dc0989adc9452bfc8c429552677cd265fd..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TriggerTest/test/test_slice_id_build.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-# art-description: ID TriggerTest over e28_lhtight_idperf on MC
-# art-type: build
-# art-include: 21.1/AthenaP1
-# art-include: 21.0/Athena
-# art-include: 21.3/Athena
-# art-include: master/Athena
-# Skipping art-output which has no effect for build tests.
-# If you create a grid version, check art-output in existing grid tests.
-
-export NAME="slice_id_build"
-export EVENTS="10"
-export JOBOPTION="TriggerTest/testIDAthenaTrigRDO.py"
-export COST_MONITORING="False"
-
-source exec_athena_art_trigger_validation.sh
-source exec_art_triggertest_post.sh
diff --git a/Trigger/TrigValidation/TriggerTest/test/test_slice_l1_build.sh b/Trigger/TrigValidation/TriggerTest/test/test_slice_l1_build.sh
deleted file mode 100755
index 22a456fe16739e88ee747fe2fb54f1541bc43ec0..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TriggerTest/test/test_slice_l1_build.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-# art-description: No menu (L1) TriggerTest on MC
-# art-type: build
-# art-include: 21.1/AthenaP1
-# art-include: 21.0/Athena
-# art-include: 21.3/Athena
-# art-include: master/Athena
-# Skipping art-output which has no effect for build tests.
-# If you create a grid version, check art-output in existing grid tests.
-
-export NAME="slice_l1_build"
-export EVENTS="10"
-export JOBOPTION="TriggerTest/testLVL1CTPAthenaTrigRDO.py"
-export COST_MONITORING="False"
-
-source exec_athena_art_trigger_validation.sh
-source exec_art_triggertest_post.sh
diff --git a/Trigger/TrigValidation/TriggerTest/test/test_slice_l1_grid.sh b/Trigger/TrigValidation/TriggerTest/test/test_slice_l1_grid.sh
deleted file mode 100755
index 0209bcd5abc9a80b72e75d7292492e2567681f93..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TriggerTest/test/test_slice_l1_grid.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-
-# art-description: No menu (L1) TriggerTest on MC
-# art-type: grid
-# art-include: 21.1/AthenaP1
-# art-include: 21.0/Athena
-# art-include: 21.3/Athena
-# art-include: master/Athena
-# art-output: *.txt
-# art-output: *.log
-# art-output: log.*
-# art-output: *.out
-# art-output: *.err
-# art-output: *.log.tar.gz
-# art-output: *.new
-# art-output: *.json
-# art-output: *.root
-# art-output: *.pmon.gz
-# art-output: *perfmon*
-# art-output: costMonitoring_*
-# art-output: HLTconfig*.xml
-# art-output: L1Topoconfig*.xml
-# art-output: LVL1config*.xml
-
-export NAME="slice_l1_grid"
-export JOBOPTION="TriggerTest/testLVL1CTPAthenaTrigRDO.py"
-
-source exec_athena_art_trigger_validation.sh
-source exec_art_triggertest_post.sh
diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_writeBS_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_writeBS_build.py
index ca22e03efd40ba19df7b43464f9c231f0db1d37d..c121c72fa44ed768d9b28bc1da68ca47d887e170 100755
--- a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_writeBS_build.py
+++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_writeBS_build.py
@@ -6,7 +6,7 @@
 # Skipping art-output which has no effect for build tests.
 # If you create a grid version, check art-output in existing grid tests.
 
-from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps
+from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps, Step
 
 ex = ExecStep.ExecStep()
 ex.type = 'athena'
@@ -16,10 +16,17 @@ ex.threads = 1
 # LS2_v1 soon to be renamed to Dev_pp_run3_v1
 ex.args = '-c "setMenu=\'LS2_v1\';doWriteBS=True;doWriteRDOTrigger=False;"'
 
+checkBS = Step.Step("CheckBS")
+checkBS.executable = 'trigbs_dumpHLTContentInBS_run3.py'
+checkBS.args = ' --l1 --hlt --hltres --stag --sizeSummary'
+checkBS.args += ' `find . -name \'*Single_Stream.daq.RAW.*Athena.*.data\' | tail -n 1`'
+checkBS.required = True
+checkBS.auto_report_result = True
+
 test = Test.Test()
 test.art_type = 'build'
 test.exec_steps = [ex]
-test.check_steps = CheckSteps.default_check_steps(test)
+test.check_steps = [checkBS] + CheckSteps.default_check_steps(test)
 
 import sys
 sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_writeBS_grid.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_writeBS_grid.py
index d23565d8cd47a0e75adc446bc7f00ef385088999..a680494e22dc66d6dab5ac3beebb82ab379e6a02 100755
--- a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_writeBS_grid.py
+++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Dev_writeBS_grid.py
@@ -17,7 +17,7 @@
 # art-output: prmon*
 # art-output: *.check*
 
-from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps
+from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps, Step
 
 ex = ExecStep.ExecStep()
 ex.type = 'athena'
@@ -27,10 +27,17 @@ ex.threads = 1
 # LS2_v1 soon to be renamed to Dev_pp_run3_v1
 ex.args = '-c "setMenu=\'LS2_v1\';doWriteBS=True;doWriteRDOTrigger=False;"'
 
+checkBS = Step.Step("CheckBS")
+checkBS.executable = 'trigbs_dumpHLTContentInBS_run3.py'
+checkBS.args = ' --l1 --hlt --hltres --stag --sizeSummary'
+checkBS.args += ' `find . -name \'*Single_Stream.daq.RAW.*Athena.*.data\' | tail -n 1`'
+checkBS.required = True
+checkBS.auto_report_result = True
+
 test = Test.Test()
 test.art_type = 'grid'
 test.exec_steps = [ex]
-test.check_steps = CheckSteps.default_check_steps(test)
+test.check_steps = [checkBS] + CheckSteps.default_check_steps(test)
 
 import sys
 sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_build.py
index 597ae164854a64e23b500f36c902d7532fe2f808..ddadc08033a13bcf0e4d550fbd14f38a91e6be86 100755
--- a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_build.py
+++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_build.py
@@ -6,7 +6,7 @@
 # Skipping art-output which has no effect for build tests.
 # If you create a grid version, check art-output in existing grid tests.
 
-from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps
+from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps, Step
 
 ex = ExecStep.ExecStep()
 ex.type = 'athena'
@@ -16,10 +16,17 @@ ex.threads = 1
 # LS2_v1 soon to be renamed to Dev_pp_run3_v1
 ex.args = '-c "setMenu=\'LS2_v1\';doWriteBS=True;doWriteRDOTrigger=False;"'
 
+checkBS = Step.Step("CheckBS")
+checkBS.executable = 'trigbs_dumpHLTContentInBS_run3.py'
+checkBS.args = ' --l1 --hlt --hltres --stag --sizeSummary'
+checkBS.args += ' `find . -name \'*Single_Stream.daq.RAW.*Athena.*.data\' | tail -n 1`'
+checkBS.required = True
+checkBS.auto_report_result = True
+
 test = Test.Test()
 test.art_type = 'build'
 test.exec_steps = [ex]
-test.check_steps = CheckSteps.default_check_steps(test)
+test.check_steps = [checkBS] + CheckSteps.default_check_steps(test)
 
 import sys
 sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_grid.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_grid.py
index 82633fbd8173e61c5a22ccaf324ed6e0015c31bd..a80afdf45ecb7ec569bea8f4e1ffb065f12c3952 100755
--- a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_grid.py
+++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_grid.py
@@ -17,7 +17,7 @@
 # art-output: prmon*
 # art-output: *.check*
 
-from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps
+from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps, Step
 
 ex = ExecStep.ExecStep()
 ex.type = 'athena'
@@ -27,10 +27,17 @@ ex.threads = 1
 # LS2_v1 soon to be renamed to Dev_pp_run3_v1
 ex.args = '-c "setMenu=\'LS2_v1\';doWriteBS=True;doWriteRDOTrigger=False;"'
 
+checkBS = Step.Step("CheckBS")
+checkBS.executable = 'trigbs_dumpHLTContentInBS_run3.py'
+checkBS.args = ' --l1 --hlt --hltres --stag --sizeSummary'
+checkBS.args += ' `find . -name \'*Single_Stream.daq.RAW.*Athena.*.data\' | tail -n 1`'
+checkBS.required = True
+checkBS.auto_report_result = True
+
 test = Test.Test()
 test.art_type = 'grid'
 test.exec_steps = [ex]
-test.check_steps = CheckSteps.default_check_steps(test)
+test.check_steps = [checkBS] + CheckSteps.default_check_steps(test)
 
 import sys
 sys.exit(test.run())
diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py
index 4c6d6d8264b15120f44708ce97cdb6b23bdba059..235f6af57abc37b174a10eafba5028cb98047fa0 100644
--- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py
+++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py
@@ -287,10 +287,16 @@ TriggerHLTListRun3 = [
     ('xAOD::JetContainer#HLT_AntiKt4EMPFlowCSSKJets_nojcalib_ftf',                'BS ESD AODFULL', 'Jet'),
     ('xAOD::JetAuxContainer#HLT_AntiKt4EMPFlowCSSKJets_nojcalib_ftfAux.'+JetVars, 'BS ESD AODFULL', 'Jet'),
 
+    # FS tracks
     ('xAOD::TrackParticleContainer#HLT_IDTrack_FS_FTF',                 'BS ESD AODFULL', 'Jet'),
     ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_FS_FTFAux.',          'BS ESD AODFULL', 'Jet'),
 
-    # custom BeamSpot tracks - we don't want to write these out in general so this
+    # FS vertices
+    ('xAOD::VertexContainer#HLT_IDVertex_FS',                  'BS ESD AODFULL', 'Jet'),
+    ('xAOD::VertexAuxContainer#HLT_IDVertex_FSAux.',          'BS ESD AODFULL', 'Jet'),
+
+
+    # custom BeamSpot tracks - we don't want to write these out in general so this 
     # is commented, if we want to write them out at some point, then these lines
     # should be uncommented and they should get written out
     #    ('xAOD::TrackParticleContainer#HLT_IDTrack_BeamSpot_FTF',         'BS ESD AODFULL', 'ID', 'inViews:beamspotViewRoIs' ),
@@ -367,9 +373,6 @@ TriggerHLTListRun3 = [
     ('xAOD::JetContainer#HLT_GSCJet',                             'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet', 'inViews:BTagViews'),
     ('xAOD::JetAuxContainer#HLT_GSCJetAux.',                         'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet'),
 
-    # vertex for b-jets
-    ('xAOD::VertexContainer#HLT_EFHistoPrmVtx',                          'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet'),
-    ('xAOD::VertexAuxContainer#HLT_EFHistoPrmVtxAux.',                   'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet'),
 
     # bjet b-tagging
     ('xAOD::BTaggingContainer#HLT_BTagging',                          'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet', 'inViews:BTagViews'),
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py
index b3105fd101d2c04a4db5df8e35342f9c8aa02e7e..8919edd3be2473221f38698d32c1df9a6e444f57 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py
@@ -110,9 +110,6 @@ def Lvl1SimulationSequence( flags = None ):
     ToolSvc += L1MuctpiTool("L1MuctpiTool")
     ToolSvc.L1MuctpiTool.LVL1ConfigSvc = svcMgr.LVL1ConfigSvc
     
-    ToolSvc += L1MuctpiTool("LVL1MUCTPI__L1MuctpiTool") # one for topo, no idea why we need two
-    ToolSvc.LVL1MUCTPI__L1MuctpiTool.LVL1ConfigSvc = svcMgr.LVL1ConfigSvc        
-
     muctpi             = L1Muctpi()
     muctpi.LVL1ConfigSvc = svcMgr.LVL1ConfigSvc
     
@@ -147,15 +144,31 @@ def Lvl1SimulationSequence( flags = None ):
     from MuonCondSvc.MuonCondSvcConf import TGCTriggerDbAlg
     condSeq += TGCTriggerDbAlg()
 
+    from L1TopoSimulation.L1TopoSimulationConfig import L1TopoSimulation
+    l1TopoSim = L1TopoSimulation()
+
+    l1TopoSim.MuonInputProvider.ROIBResultLocation = "" #disable input from RoIBResult
+    l1TopoSim.MuonInputProvider.MuctpiSimTool = ToolSvc.L1MuctpiTool
+
+    # enable the reduced (coarse) granularity topo simulation
+    # currently only for MC
+    from AthenaCommon.GlobalFlags  import globalflags
+    if globalflags.DataSource()!='data':
+        l1TopoSim.MuonInputProvider.MuonEncoding = 1
+    else:
+        l1TopoSim.MuonInputProvider.MuonEncoding = 0
+
+
+
     ctp             = CTPSimulationInReco("CTPSimulation")
     ctp.DoLUCID     = False
     ctp.DoBCM       = False
-    ctp.DoL1Topo    = False
+    ctp.DoL1Topo    = True
     ctp.UseCondL1Menu = False
     ctp.TrigConfigSvc = svcMgr.LVL1ConfigSvc
     ctpSim      = seqAND("ctpSim", [ctp, RoIBuilder("RoIBuilder")])
 
     #l1Sim = seqAND("l1Sim", [caloTowerMaker] )
-    l1Sim = seqAND("l1Sim", [l1CaloSim, l1MuonSim, ctpSim] )
+    l1Sim = seqAND("l1Sim", [l1CaloSim, l1MuonSim, l1TopoSim, ctpSim] )
     return l1Sim
-    
+
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py
index 75d886bf62c96925b3c623421204c3c0f5918220..25d772009bc674abd0af8937702d401601232e25 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py
@@ -308,11 +308,11 @@ def triggerBSOutputCfg(flags, decObj, decObjHypoOut, summaryAlg, offline=False):
     """
     Returns CA with algorithms and/or tools required to do the serialisation
 
-    decObj - list of all naviagtaion objects
+    decObj - list of all navigation objects
     decObjHypoOut - list of decisions produced by hypos
     summaryAlg - the instance of algorithm producing final decision
-    offline - if true CA contains algorithms that needs to be merged to output stream sequence,
-              if false the CA contains a tool that needs to be added to HLT EventLoopMgr
+    offline - if true CA contains algorithms that need to be merged to output stream sequence,
+              if false the CA contains a tool that needs to be added to HltEventLoopMgr
     """
     from TrigEDMConfig import DataScoutingInfo
     from TrigEDMConfig.TriggerEDM import getRun3BSList
@@ -365,11 +365,8 @@ def triggerBSOutputCfg(flags, decObj, decObjHypoOut, summaryAlg, offline=False):
         hltResultMakerAlg = HLTResultMTMakerAlg()
         hltResultMakerAlg.ResultMaker = hltResultMakerTool
         acc.addEventAlgo( hltResultMakerAlg )
-        # TODO: Decide if stream tags are needed and, if yes, find a way to save updated ones in offline BS saving
 
         # Transfer trigger bits to xTrigDecision which is read by offline BS writing ByteStreamCnvSvc
-        #from TrigDecisionMaker.TrigDecisionMakerConfig import TrigDecisionMakerMT
-        #decmaker = TrigDecisionMakerMT('TrigDecMakerMT')
         decmaker = CompFactory.getComp( "TrigDec::TrigDecisionMakerMT" )("TrigDecMakerMT")
         acc.addEventAlgo( decmaker )
 
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/dbmod_CostMonForCAF.py b/Trigger/TriggerCommon/TriggerJobOpts/share/dbmod_CostMonForCAF.py
deleted file mode 100644
index e5cd2dcf514a9c6918695bf0b43cffb532bbc852..0000000000000000000000000000000000000000
--- a/Trigger/TriggerCommon/TriggerJobOpts/share/dbmod_CostMonForCAF.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# TrigDB modifier
-# Usage: athenaMT/PT -C 'include("TriggerJobOpts/dbmod_CostMonForCAF.py")' ...
-#
-# Enable writing of cost monitoring ntuples at CAF
-#
-from GaudiPython.Bindings import iProperty
-
-isL2 = len(iProperty('TrigSteer_L2').properties())>0
-isEF = len(iProperty('TrigSteer_EF').properties())>0
-isHLT = len(iProperty('TrigSteer_HLT').properties())>0
-
-if isL2:
-    iProperty('TrigSteer_L2').doOperationalInfo = 1
-    iProperty('TrigSteer_L2.TrigCostExecL2').writeAlways = True
-
-if isEF:
-    iProperty('TrigSteer_EF').doOperationalInfo = 1
-    iProperty('TrigSteer_EF.TrigCostExecEF').writeAlways = True
-    
-if isHLT:
-    iProperty('TrigSteer_HLT').doOperationalInfo = 1
-    iProperty('TrigSteer_HLT.TrigCostExecHLT').writeAlways = True
-
-
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/dbmod_ignorePrescales.py b/Trigger/TriggerCommon/TriggerJobOpts/share/dbmod_ignorePrescales.py
deleted file mode 100644
index 301d896adc8d461e7e70d1cfcf26227579c9aadc..0000000000000000000000000000000000000000
--- a/Trigger/TriggerCommon/TriggerJobOpts/share/dbmod_ignorePrescales.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# TrigDB modifier
-# Usage: athenaMT/PT -C 'include("TriggerJobOpts/dbmod_ignorePrescales.py")' ...
-#
-# Ignore prescales
-#
-from GaudiPython.Bindings import iProperty
-
-# This will work for L2
-if len(iProperty('TrigSteer_L2.Lvl1Converter').properties())>0:
-   iProperty('TrigSteer_L2.Lvl1Converter').ignorePrescales = True
-   
-# and this for EF
-if len(iProperty('TrigSteer_EF.Lvl1Converter').properties())>0:
-   iProperty('TrigSteer_EF.Lvl1Converter').ignorePrescales = True   
-   
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/dbmod_setTimeout.py b/Trigger/TriggerCommon/TriggerJobOpts/share/dbmod_setTimeout.py
deleted file mode 100644
index 553fc9df1dbcca294cdbe77d572ec3dedd0b5f6e..0000000000000000000000000000000000000000
--- a/Trigger/TriggerCommon/TriggerJobOpts/share/dbmod_setTimeout.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# TrigDB modifier
-# Usage: athenaMT/PT -C 'include("TriggerJobOpts/dbmod_setTimeout.py")' ...
-#
-# Set timeouts
-#
-from GaudiPython.Bindings import iProperty
-
-l2timeout = 10*1e9   # ns
-eftimeout = 180*1e9  # ns
-
-# This will work for L2
-if len(iProperty('TrigSteer_L2').properties())>0:
-   iProperty('TrigSteer_L2').softEventTimeout = 0.9*l2timeout
-   iProperty('TrigSteer_L2').hardEventTimeout = l2timeout
-   
-# and this for EF
-if len(iProperty('TrigSteer_EF').properties())>0:
-   iProperty('TrigSteer_EF').softEventTimeout = 0.9*eftimeout
-   iProperty('TrigSteer_Ef').hardEventTimeout = eftimeout   
-   
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py
index 56188de40fa2cb65e71647363678e011c361ccca..bd983492a07456dd75086f98819fcb1e4754fa43 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py
@@ -614,7 +614,7 @@ if opt.reverseViews or opt.filterViews:
     viewMakers = collectViewMakers( topSequence )
     theFilter = []
     if opt.filterViews:
-        theFilter = [ "Cache", "EventInfo", "HLT_EFHistoPrmVtx" ]
+        theFilter = [ "Cache", "EventInfo", "HLT_IDVertex_FS" ]
     for alg in viewMakers:
         alg.ReverseViewsDebug = opt.reverseViews
         alg.FallThroughFilter = theFilter
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py
index d6086cab24c41ce505f805446e62f24d4ad4964c..53a1a5e9058f3f8a7c479724779852282f7fe45c 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py
@@ -25,11 +25,11 @@ def getBJetSequence():
 # ====================================================================================================  
 
 def bJetStep2Sequence():
-    prmVtxKey = "HLT_EFHistoPrmVtx"
+    prmVtxKey = "HLT_IDVertex_FS"
     outputRoIName = "HLT_Roi_Bjet"
 
     from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
-    from ViewAlgs.ViewAlgsConf import ViewCreatorCentredOnJetWithPVConstraintROITool
+    from DecisionHandling.DecisionHandlingConf import ViewCreatorCentredOnJetWithPVConstraintROITool
     InputMakerAlg = EventViewCreatorAlgorithm( "IMBJet_step2" )
     #
     newRoITool = ViewCreatorCentredOnJetWithPVConstraintROITool()
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py
index 162ee73577d081640074bc40b3cef8f9958f19f4..416d23ad7d36d25f14ee9a3a8e482a22ec431a58 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py
@@ -9,8 +9,8 @@ from TrigStreamerHypo.TrigStreamerHypoConfigMT import StreamerHypoToolMTgenerato
 from TrigStreamerHypo.TrigStreamerHypoConf import TrigStreamerHypoAlgMT
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence
 from AthenaCommon.CFElements import seqAND
-from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm, ViewCreatorInitialROITool
-
+from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
+from DecisionHandling.DecisionHandlingConf import ViewCreatorInitialROITool
 
 #----------------------------------------------------------------
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/MonitorChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/MonitorChainConfiguration.py
index 615dd21fd63edd8cec8ca6c143ed1504342c23b4..1f183f1ad18c871c7f362b855c374b3a736ad5d7 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/MonitorChainConfiguration.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/MonitorChainConfiguration.py
@@ -6,7 +6,7 @@ log = logging.getLogger("TriggerMenuMT.HLTMenuConfig.CalibCosmicMon.MonitorChain
 
 from TriggerMenuMT.HLTMenuConfig.Menu.ChainConfigurationBase import ChainConfigurationBase
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import ChainStep, MenuSequence
-from DecisionHandling.DecisionHandlingConf import InputMakerForRoI
+from DecisionHandling.DecisionHandlingConf import InputMakerForRoI, ViewCreatorInitialROITool
 from AthenaCommon.CFElements import seqAND
 from TrigGenericAlgs.TrigGenericAlgsConfig import TimeBurnerCfg, TimeBurnerHypoToolGen
 from AthenaConfiguration.ComponentAccumulator import conf2toConfigurable
@@ -46,6 +46,7 @@ class MonitorChainConfiguration(ChainConfigurationBase):
     def getTimeBurnerStep(self):
         # Input maker - required by the framework, but inputs don't matter for TimeBurner
         inputMaker = InputMakerForRoI("IM_TimeBurner")
+        inputMaker.RoITool = ViewCreatorInitialROITool()
         inputMaker.RoIs="TimeBurnerInputRoIs"
         inputMakerSeq = seqAND("TimeBurnerSequence", [inputMaker])
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/StreamingChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/StreamingChainConfiguration.py
index c8ffd0373c1329e36461a4d4bd58a9f0832ee2a8..e7f587269dfdfb070a4c97223a704ec9434f2527 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/StreamingChainConfiguration.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/StreamingChainConfiguration.py
@@ -8,7 +8,7 @@ from TriggerMenuMT.HLTMenuConfig.Menu.ChainConfigurationBase import ChainConfigu
 from TrigStreamerHypo.TrigStreamerHypoConfigMT import StreamerHypoToolMTgenerator
 from TrigStreamerHypo.TrigStreamerHypoConf import TrigStreamerHypoAlgMT
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence
-from DecisionHandling.DecisionHandlingConf import InputMakerForRoI
+from DecisionHandling.DecisionHandlingConf import InputMakerForRoI, ViewCreatorInitialROITool
 from AthenaCommon.CFElements import seqAND
 
 
@@ -23,6 +23,7 @@ def StreamingSequenceCfg( flags ):
 def StreamingMenuSequence():
 
     inputMakerAlg = InputMakerForRoI("IM_streamerInputMaker")
+    inputMakerAlg.RoITool = ViewCreatorInitialROITool()
     inputMakerAlg.RoIs="streamerInputRoIs"
     streamingSequence = seqAND("streamerSequence", [inputMakerAlg])
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/EventBuildingSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/EventBuildingSequenceSetup.py
index cf8f4b3dec84733af8425ad48ae12a921519c83b..153952c628ebb64b549531652e36e9437146abad 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/EventBuildingSequenceSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/EventBuildingSequenceSetup.py
@@ -7,7 +7,7 @@ from TriggerMenuMT.HLTMenuConfig.Menu import EventBuildingInfo
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import ChainStep, MenuSequence
 from TrigPartialEventBuilding.TrigPartialEventBuildingConf import PEBInfoWriterAlg
 from TrigPartialEventBuilding.TrigPartialEventBuildingConfig import StaticPEBInfoWriterToolCfg, RoIPEBInfoWriterToolCfg
-from DecisionHandling.DecisionHandlingConf import InputMakerForRoI
+from DecisionHandling.DecisionHandlingConf import InputMakerForRoI, ViewCreatorInitialROITool
 from libpyeformat_helper import SubDetector
 from AthenaCommon.CFElements import seqAND, findAlgorithm
 from AthenaCommon.Logging import logging
@@ -104,6 +104,7 @@ def pebInfoWriterTool(name, eventBuildType):
 
 def pebInputMaker(eventBuildType):
     maker = InputMakerForRoI("IMpeb_"+eventBuildType)
+    maker.RoITool = ViewCreatorInitialROITool()
     maker.RoIs = "pebInputRoI_" + eventBuildType
     return maker
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py
index 2a673f5d85e01b9585c38c427009d6a8d368bf4d..be1401115c5aa6965b2165b8d87f3a1227f3abc3 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py
@@ -10,7 +10,8 @@ from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, RecoFr
 # Until such time as FS and RoI collections do not interfere, a hacky fix
 #from AthenaCommon.CFElements import parOR, seqAND
 from AthenaCommon.CFElements import seqAND
-from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm, ViewCreatorInitialROITool
+from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
+from DecisionHandling.DecisionHandlingConf import ViewCreatorInitialROITool
 from TrigEDMConfig.TriggerEDMRun3 import recordable
 
 def fastElectronSequence(ConfigFlags):
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonSequenceSetup.py
index 34c0e0c125b29205d769c794f8370fee6a704ebe..0f379090ce77e2b8320eae5f06dc4af0934a5cd1 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonSequenceSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonSequenceSetup.py
@@ -3,7 +3,8 @@
 # menu components   
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, RecoFragmentsPool
 from AthenaCommon.CFElements import parOR, seqAND
-from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm, ViewCreatorInitialROITool
+from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
+from DecisionHandling.DecisionHandlingConf import ViewCreatorInitialROITool
 import AthenaCommon.CfgMgr as CfgMgr
 from TrigEDMConfig.TriggerEDMRun3 import recordable
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionCaloSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionCaloSequenceSetup.py
index 16ffb099d64c0fd051eb5baec9d06c64d0efd9a2..3b6617ed781b0b7ea26a758cc870b3d442d189e0 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionCaloSequenceSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionCaloSequenceSetup.py
@@ -5,7 +5,8 @@
 # menu components   
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, RecoFragmentsPool
 from AthenaCommon.CFElements import seqAND
-from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm, ViewCreatorInitialROITool
+from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
+from DecisionHandling.DecisionHandlingConf import ViewCreatorInitialROITool
 from AthenaConfiguration.AllConfigFlags import ConfigFlags
 from TrigEDMConfig.TriggerEDMRun3 import recordable
       
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup.py
index 466ce6ee4dd24a382ed6ba270025ae1a8b59438d..becfe6f5ac66a26ee1fcdb497fb23c3dc3952aaf 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup.py
@@ -7,7 +7,8 @@ from AthenaConfiguration.AllConfigFlags import ConfigFlags
 # menu components   
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, RecoFragmentsPool
 from AthenaCommon.CFElements import parOR, seqAND
-from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm, ViewCreatorInitialROITool
+from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
+from DecisionHandling.DecisionHandlingConf import ViewCreatorInitialROITool
 
 
 def precisionElectronSequence(ConfigFlags):
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py
index 3e4c2bab38d82c3e8f674974fd0f399a283bc137..2ef3bef8109971e8f0322e1ee3173338e6b07cbd 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py
@@ -42,7 +42,7 @@ def generateChains( flags,  chainDict ):
 
     accCalo.printConfig()
 
-    fastCaloStep = ChainStep(firstStepName, [fastCaloSequence])
+    fastCaloStep = ChainStep(name=firstStepName, Sequences=[fastCaloSequence], chainDicts=[chainDict])
 
 
     secondStepName = getChainStepName('Electron', 2)
@@ -75,7 +75,7 @@ def generateChains( flags,  chainDict ):
 
     fastInDetSequence.createHypoTools(chainDict)
 
-    fastInDetStep = ChainStep( secondStepName, [fastInDetSequence] )
+    fastInDetStep = ChainStep( name=secondStepName, Sequences=[fastInDetSequence], chainDicts=[chainDict])
 
     l1Thresholds=[]
     for part in chainDict['chainParts']:
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py
index b0b6a72fe7b34571ea33426aef46b906f5a51068..b6e791509e2bb946216608219bb7ede9303ca980 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py
@@ -144,7 +144,7 @@ def defineCalibFilterMods(jetRecoDict,dataSource,rhoKey="auto"):
             gscDepth = "EM3"
             if "gsc" in jetRecoDict["jetCalib"]:
                 gscDepth = "trackWIDTH"
-                pvname = "HLT_EFHistoPrmVtx"
+                pvname = "HLT_IDVertex_FS"
 
         elif jetRecoDict["dataType"]=="pf":
             gscDepth = "auto"
@@ -152,7 +152,7 @@ def defineCalibFilterMods(jetRecoDict,dataSource,rhoKey="auto"):
             calibSeq = "JetArea_Residual_EtaJES_GSC"
             if jetRecoDict["jetCalib"].endswith("IS"):
                 calibSeq += "_Insitu"
-            pvname = "HLT_EFHistoPrmVtx"
+            pvname = "HLT_IDVertex_FS"
 
         calibSpec = ":".join( [calibContext, dataSource, calibSeq, rhoKey, pvname, gscDepth] )
         from .TriggerJetMods import ConstitFourMom_copy
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py
index 23a12bd0493f1d732f987b990acade362969a4e4..97789cf114ee819440148b76cdcfb02ce60e326c 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py
@@ -20,10 +20,10 @@ def JetTrackingSequence(dummyFlags,trkopt,RoIs):
         viewAlgs = makeInDetAlgsNoView( "JetFS", "FS", rois=RoIs )
         jetTrkSeq += viewAlgs
         tracksname = recordable("HLT_IDTrack_FS_FTF")
-        verticesname = recordable("HLT_EFHistoPrmVtx")
+        verticesname = recordable("HLT_IDVertex_FS")
 
     from TrigInDetConfig.TrigInDetPriVtxConfig import makeVertices
-    vtxAlgs = makeVertices( "jet", "HLT_IDTrack_FS_FTF", verticesname )
+    vtxAlgs = makeVertices( "jet", tracksname, verticesname )
     prmVtx = vtxAlgs[-1]
     jetTrkSeq += prmVtx
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py
index aed3c8e8234227faaf5c0f7900e4703730c47866..8b4318d8a45d55ebd10ef76b653a60188786ea45 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py
@@ -121,7 +121,7 @@ class TrkMHTConfig(AlgConfig):
         # These are the names set by the upstream algorithms. Unfortunately
         # these aren't passed to us - we just have to 'know' them
         tracks = "HLT_IDTrack_FS_FTF"
-        vertices = "HLT_EFHistoPrmVtx"
+        vertices = "HLT_IDVertex_FS"
         tva = "JetTrackVtxAssoc_{trkopt}".format(**jetRecoDict)
         track_links = "GhostTrack_{trkopt}".format(**jetRecoDict)
 
@@ -164,7 +164,7 @@ class PFSumConfig(AlgConfig):
         constit_mod_seq = getConstitModAlg(
                 constit, "HLT",
                 tvaKey="JetTrackVtxAssoc_{trkopt}".format(**jetRecoDict),
-                vtxKey="HLT_EFHistoPrmVtx")
+                vtxKey="HLT_IDVertex_FS")
         self.inputs = [tcSeq, pfseq, constit_mod_seq]
         self.fexAlg = self._make_fex_alg(
                 HLT__MET__PFSumFex,
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py
index 6f999fc7f8f707da4824fd93b044a2d2dfb542ff..2cf1db244a2acaa1c642002f8103fed2ef3f5512 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py
@@ -5,6 +5,8 @@ from AthenaCommon.CFElements import seqAND
 from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import generateDecisionTreeOld
 from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig_newJO import generateDecisionTree
 from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT
+from TriggerMenuMT.HLTMenuConfig.Menu.ChainMerging import mergeChainDefs
+from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitInterSignatureChainDict
 from six import iteritems
 
 from AthenaCommon.Logging import logging
@@ -52,32 +54,50 @@ def generateMenu( flags ):
         if len(value) == 0:
             continue
 
+        signatureName = name.split('.')[-1]
+        signatures = []
 
         # fill the map[signature, generating function]
+        if signatureName== 'combined':
+            for chain in cfgFlag.get():
+                signatures += dictFromChainName(chain)['signatures']
+        else:
+            signatures = [signatureName]
 
-        signature = name.split('.')[-1]
-        fillGeneratorsMap( signatureToGenerator, signature )
-
-        if signature not in signatureToGenerator:
-            log.warning('Generator for {} is missing. Chain dict will not be built'.format(signature))
-            continue
+        for sig in signatures:
+            fillGeneratorsMap( signatureToGenerator, sig.lower() )
 
+        # call generating function and pass to CF builder
         for chain in cfgFlag.get():
-            
-            chainDict = dictFromChainName( chain )
+            # TODO topo threshold
+            mainChainDict = dictFromChainName( chain )
             
             counter += 1
-            chainDict['chainCounter'] = counter
+            mainChainDict['chainCounter'] = counter
 
-            allChainDicts.append(chainDict)
-            # TODO topo threshold
+            allChainDicts.append(mainChainDict)
+
+            chainDicts = splitInterSignatureChainDict(mainChainDict)
+            listOfChainConfigs = []
+
+            for chainDict in chainDicts:
+                signature = chainDict['signature'].lower()
+
+                if signature not in signatureToGenerator:
+                    log.warning('Generator for {} is missing. Chain dict will not be built'.format(signature))
+                    continue
+
+                chainConfig = signatureToGenerator[signature](flags, chainDict)
+                listOfChainConfigs.append(chainConfig)
 
-            # call generating function and pass to CF builder
+            if len(listOfChainConfigs) > 1:
+                theChainConfig = mergeChainDefs(listOfChainConfigs, mainChainDict)
 
-            chainConfig = signatureToGenerator[signature](flags, chainDict)
-            TriggerConfigHLT.registerChain( chainDict, chainConfig )
-            menuChains.append( chainConfig )
+            else:
+                theChainConfig = listOfChainConfigs[0]
 
+            TriggerConfigHLT.registerChain( mainChainDict, theChainConfig )
+            menuChains.append( theChainConfig )
 
     log.info('Obtained Menu Chain objects')
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py
index 50f8ee50da41eafd30125f529ba97ebb31c25e8f..6970ca18cbf3574924e2267ac8fda10ac8165fe0 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py
@@ -69,7 +69,7 @@ def generateDecisionTree(chains):
     @memoize
     def getFilterAlg( stepNumber, stepName ):
         """
-        Returns, if need be create, filter for a given step
+        Returns, if need be created, filter for a given step
         """
 
         filtersStep = getFiltersStepSeq( stepNumber )
@@ -84,6 +84,19 @@ def generateDecisionTree(chains):
         log.debug('Creted filter {}'.format(filterName))
         return filterAlg
 
+    @memoize
+    def getComboHypo( stepNumber, step ):
+        """
+        Returns, if need be created, combo hypo for a given step
+        """
+
+        # todo: change name to be retrieved via CFNaming
+        #   so based on input hypos
+        comboHypoName = step.combo.name
+        comboHypo = CompFactory.ComboHypo(comboHypoName)
+
+        return comboHypo
+            
     @memoize
     def findInputMaker( stepCounter, stepName ):
         seq = getSingleMenuSeq( stepCounter, stepName )
@@ -143,6 +156,11 @@ def generateDecisionTree(chains):
             hypoAlg.HypoInputDecisions  = ""
             hypoAlg.HypoOutputDecisions = ""
 
+            if step.isCombo:
+                comboHypo = getComboHypo( stepCounter, step )
+                comboHypo.HypoInputDecisions  = []
+                comboHypo.HypoOutputDecisions = []
+
     # connect all outputs (decision DF)
     for chain in chains:
         for stepCounter, step in enumerate( chain.steps, 1 ):
@@ -163,6 +181,7 @@ def generateDecisionTree(chains):
                     filterOutputName = CFNaming.filterOutName( filterAlg.name, i )
                     filterAlg.Output = addAndAssureUniqness( filterAlg.Output, filterOutputName, "{} output".format( filterAlg.name ) )
                     im.InputMakerInputDecisions = addAndAssureUniqness( im.InputMakerInputDecisions,  filterOutputName, "{} input".format( im.name ) )
+
                 imOutputName = CFNaming.inputMakerOutName( im.name )
                 im.InputMakerOutputDecisions = assureUnsetOrTheSame( im.InputMakerOutputDecisions, imOutputName, "{} IM output".format( im.name ) )
                 # Hypo linking
@@ -175,6 +194,7 @@ def generateDecisionTree(chains):
 
                 hypoAlg.HypoTools.append( sequence._hypoToolConf.confAndCreate( TriggerConfigHLT.getChainDictFromChainName( chain.name ) ) )
 
+
     for chain in chains:
         for stepCounter, step in enumerate( chain.steps, 1 ):
             filterAlg = getFilterAlg( stepCounter, step.name )
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
index 132c2b6f68e49f41a6c2d2101c8fab03691dfbc9..b2f41ec09ffae0f286b2db8b0194e0e301243283 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
@@ -14,7 +14,7 @@ from TriggerMenuMT.HLTMenuConfig.Menu.MenuPrescaleConfig import addSliceChainsTo
 import TriggerMenuMT.HLTMenuConfig.Menu.MC_pp_run3_v1 as mc_menu
 import TriggerMenuMT.HLTMenuConfig.Menu.PhysicsP1_pp_run3_v1 as p1_menu
 
-from TriggerMenuMT.HLTMenuConfig.Menu.Physics_pp_run3_v1 import PhysicsStream,SingleMuonGroup,MultiMuonGroup,SingleElectronGroup,MultiElectronGroup,SinglePhotonGroup,MultiPhotonGroup,SingleMETGroup,MultiMETGroup,SingleJetGroup,MultiJetGroup,SingleBjetGroup,SingleTauGroup,BphysicsGroup
+from TriggerMenuMT.HLTMenuConfig.Menu.Physics_pp_run3_v1 import PhysicsStream,SingleMuonGroup,MultiMuonGroup,SingleElectronGroup,MultiElectronGroup,SinglePhotonGroup,MultiPhotonGroup,SingleMETGroup,MultiMETGroup,SingleJetGroup,MultiJetGroup,SingleBjetGroup,SingleTauGroup,BphysicsGroup,MinBiasGroup,ZeroBiasGroup
 
 def setupMenu():
 
@@ -240,6 +240,7 @@ def setupMenu():
         ChainProp(name='HLT_beamspot_allTE_trkfast_BeamSpotPEB_L1J15',  l1SeedThresholds=['FSNOSEED'], stream=['BeamSpot'], groups=['RATE:BeamSpot',  'BW:BeamSpot']),
     ]
     TriggerFlags.MinBiasSlice.signatures   = TriggerFlags.MinBiasSlice.signatures() + [
+        ChainProp(name='HLT_noalg_mb_L1RD2_EMPTY', l1SeedThresholds=['FSNOSEED'], stream=['MinBias'], groups=MinBiasGroup),
         # ChainProp(name='HLT_mb_sp400_trk40_hmt_L1RD0_FILLED',        l1SeedThresholds=['FSNOSEED'], stream=[PhysicsStream], groups=MinBiasGroup),
         # ChainProp(name='HLT_mb_sp600_trk45_hmt_L1RD0_FILLED',        l1SeedThresholds=['FSNOSEED'], stream=[PhysicsStream], groups=MinBiasGroup),
     ]
@@ -248,6 +249,7 @@ def setupMenu():
     ]
 
     TriggerFlags.StreamingSlice.signatures = TriggerFlags.StreamingSlice.signatures() + [
+        ChainProp(name='HLT_noalg_zb_L1ZB', l1SeedThresholds=['FSNOSEED'], stream=['ZeroBias'], groups=ZeroBiasGroup),
     ]
     TriggerFlags.MonitorSlice.signatures   = TriggerFlags.MonitorSlice.signatures() + [
     ]
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1_newJO.py
index 2eee6d649370783551dd1abfddf41ab8081b17eb..27d0fdda4fbc0f3c3f86b732113bc13b4df6cef9 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1_newJO.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1_newJO.py
@@ -57,12 +57,13 @@ def setupMenu(flags):
     flags.Trigger.menu.jet = [
        ChainProp(name='HLT_j45_L1J20',  groups=SingleJetGroup),
        ChainProp(name='HLT_j85_L1J20',  groups=SingleJetGroup),
-       ChainProp(name='HLT_2j35_L1J20', groups=SingleJetGroup),
+       ChainProp(name='HLT_2j35_L1J20', groups=SingleJetGroup)
     ]
 
-    # flags.Trigger.menu.combined = [
-    #     get_flag_item('HLT_e8_mu8_L1EM6_MU6', [], ['RATE:SingleMuon', 'BW:Muon'])
-    # ]
+    flags.Trigger.menu.combined = [
+        ChainProp(name='HLT_e7_mu10_L1EM7_MU10', groups=SingleElectronGroup),
+        ChainProp(name='HLT_e5_mu5_L1EM7_MU10', groups=SingleElectronGroup),
+    ]
 
 if __name__ == "__main__":
     from AthenaCommon.Configurable import Configurable
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index 74c80a054fb0e8b149158bb495c4df2d98338f10..6d322b94600acea926cedb7a39a3581040062f25 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -320,6 +320,7 @@ class EmptyMenuSequence(object):
     def __init__(self, name):
         self._name = name
         Maker = CompFactory.InputMakerForRoI("IM"+name)
+        Maker.RoITool = CompFactory.ViewCreatorInitialROITool()
         self._maker       = InputMakerNode( Alg = Maker )
         self._seed=''
         self._sequence    = Node( Alg = seqAND(name, [Maker]))
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Physics_pp_run3_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Physics_pp_run3_v1.py
index 3b4f66c1717066b9b4df5bcfd2d0b41be2835daf..22b06fb939072ceadc278e6d91c25ed850790d55 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Physics_pp_run3_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Physics_pp_run3_v1.py
@@ -27,6 +27,7 @@ SingleTauGroup = ['RATE:SingleTau', 'BW:Tau']
 #MultiTauGroup = ['RATE:MultiTau', 'BW:Tau']
 BphysicsGroup = ['RATE:Bphysics', 'BW:Bphysics']
 MinBiasGroup = ['RATE:MinBias', 'BW:MinBias']
+ZeroBiasGroup = ['RATE:ZeroBias', 'BW:ZeroBias']
 EgammaStreamersGroup = ['RATE:SeededStreamers', 'BW:Egamma']
 TauStreamersGroup = ['RATE:SeededStreamers', 'BW:Tau']
 JetStreamersGroup = ['RATE:SeededStreamers', 'BW:Jet']
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py
index 361a3aa0148fd2a81f84f7e8682d86071641cf37..399d7df8bf223146e123570f311350876848466e 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py
@@ -47,7 +47,8 @@ _all_streams = [
     StreamInfo('HardProbes', 'physics', True, True),
     StreamInfo('MinBias', 'physics', True, True),
     # Special stream to be used only for special chains rejecting all events like timeburner
-    StreamInfo('DISCARD', 'unknown', False, False)
+    StreamInfo('DISCARD', 'unknown', False, False),
+    StreamInfo('ZeroBias', 'physics', True, True)
 ]
 
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py
index 781d7bd6ab3aa7e8eb5e3d31771c1c9929968add..820eba59d6f2f570d3de3d0e645e3e521f286d6b 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py
@@ -12,7 +12,8 @@ from AthenaCommon.CFElements import seqAND
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import ChainStep
 from TrigInDetConfig.InDetSetup import makeInDetAlgs
 from TrigEDMConfig.TriggerEDMRun3 import recordable
-from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm, ViewCreatorInitialROITool
+from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
+from DecisionHandling.DecisionHandlingConf import ViewCreatorInitialROITool
 from AthenaCommon.GlobalFlags import globalflags
 #----------------------------------------------------------------
 # fragments generating configuration will be functions in New JO,
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py
index ad6ac0b40093ee77f2a5bbdc2a4f80fb6acbb1fc..4709f37998da220d7e7bd081cf8b13e1b5a39583 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py
@@ -24,8 +24,9 @@ muonCombinedRecFlags.doStatisticalCombination = False
 muonCombinedRecFlags.doCombinedFit = True
 muonRecFlags.enableErrorTuning = False
 
-from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm, \
-  ViewCreatorInitialROITool, ViewCreatorPreviousROITool, ViewCreatorNamedROITool, \
+from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
+from DecisionHandling.DecisionHandlingConf import ViewCreatorInitialROITool, \
+  ViewCreatorPreviousROITool, ViewCreatorNamedROITool, \
   ViewCreatorFSROITool, ViewCreatorCentredOnIParticleROITool, ViewCreatorFetchFromViewROITool
 
 #muon container names (for RoI based sequences)
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py
index c7fd8c0bb7c781e537d3ba8f729e0b748ae1c33b..04be1be621942a5082fbd2e79909341eee4f26bb 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py
@@ -70,17 +70,18 @@ def makeMuonPrepDataAlgs(RoIs="MURoIs", forFullScan=False):
   # Load data into the view
   import AthenaCommon.CfgMgr as CfgMgr
   muDataPrepVDV = CfgMgr.AthViews__ViewDataVerifier( "muDataPrepVDV" + postFix )
-  muDataPrepVDV.DataObjects = [( 'CscStripPrepDataCollection_Cache' , MuonPrdCacheNames.CscStripCache ),
-                               ( 'MdtPrepDataCollection_Cache' , MuonPrdCacheNames.MdtCache )]
-
-  # Only load these objects if they aren't available in conddb
-  from IOVDbSvc.CondDB import conddb
-  if not conddb.folderRequested( "/CSC/DCS/LAYERSTATE" ):
-    muDataPrepVDV.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/CSC/DCS/LAYERSTATE' )]
-  if not conddb.folderRequested( "/CSC/T0PHASE" ):
-    muDataPrepVDV.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0PHASE' )]
-  if not conddb.folderRequested( "/CSC/T0BASE" ):
-    muDataPrepVDV.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0BASE' )]
+  muDataPrepVDV.DataObjects = [( 'MdtPrepDataCollection_Cache' , MuonPrdCacheNames.MdtCache )]
+  if MuonGeometryFlags.hasCSC():
+    muDataPrepVDV.DataObjects += [( 'CscStripPrepDataCollection_Cache' , MuonPrdCacheNames.CscStripCache )]
+
+    # Only load these objects if they aren't available in conddb
+    from IOVDbSvc.CondDB import conddb
+    if not conddb.folderRequested( "/CSC/DCS/LAYERSTATE" ):
+      muDataPrepVDV.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/CSC/DCS/LAYERSTATE' )]
+    if not conddb.folderRequested( "/CSC/T0PHASE" ):
+      muDataPrepVDV.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0PHASE' )]
+    if not conddb.folderRequested( "/CSC/T0BASE" ):
+      muDataPrepVDV.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0BASE' )]
 
   viewAlgs_MuonPRD.append( muDataPrepVDV )
 
@@ -121,61 +122,64 @@ def makeMuonPrepDataAlgs(RoIs="MURoIs", forFullScan=False):
 
     viewAlgs_MuonPRD.append(  MM_RdoToMM_PrepData )
 
-
-  ### CSC RDO data ###
-  from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CscROD_Decoder
-  CSCRodDecoder = Muon__CscROD_Decoder(name		= "CscROD_Decoder",
-                                       IsCosmics	= False,
-                                       IsOldCosmics 	= False )
-  ToolSvc += CSCRodDecoder
-
-  from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CSC_RawDataProviderToolMT
-  MuonCscRawDataProviderTool = Muon__CSC_RawDataProviderToolMT(name        = "CSC_RawDataProviderToolMT",
-                                                               CscContainerCacheKey = MuonCacheNames.CscCache,
-                                                               Decoder     = CSCRodDecoder )
-  ToolSvc += MuonCscRawDataProviderTool
-
-  from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CscRdoToCscPrepDataToolMT
-  CscRdoToCscPrepDataTool = Muon__CscRdoToCscPrepDataToolMT(name           = "CscRdoToCscPrepDataTool",
-                                                            CscStripPrdContainerCacheKey = MuonPrdCacheNames.CscStripCache)
-  
-  ToolSvc += CscRdoToCscPrepDataTool
-
-  from MuonRdoToPrepData.MuonRdoToPrepDataConf import CscRdoToCscPrepData
-  CscRdoToCscPrepData = CscRdoToCscPrepData(name                    = "CscRdoToCscPrepData" + postFix,
-                                            CscRdoToCscPrepDataTool = CscRdoToCscPrepDataTool,
-                                            PrintPrepData           = False,
-                                            DoSeededDecoding        = not forFullScan,
-                                            RoIs                    = RoIs )
-
-
-  from MuonByteStream.MuonByteStreamConf import Muon__CscRawDataProvider
-  CscRawDataProvider = Muon__CscRawDataProvider(name         = "CscRawDataProvider" + postFix,
-                                                ProviderTool = MuonCscRawDataProviderTool,
-                                                DoSeededDecoding        = not forFullScan,
-                                                RoIs                    = RoIs)
-
-  from CscClusterization.CscClusterizationConf import CscThresholdClusterBuilderTool
-  CscClusterBuilderTool = CscThresholdClusterBuilderTool(name        = "CscThresholdClusterBuilderTool" )
-  ToolSvc += CscClusterBuilderTool
-
-  #CSC cluster building
-  from CscClusterization.CscClusterizationConf import CscThresholdClusterBuilder
-  CscClusterBuilder = CscThresholdClusterBuilder(name            = "CscThresholdClusterBuilder",
-                                                 cluster_builder = CscClusterBuilderTool)
+  if MuonGeometryFlags.hasCSC():
+    ### CSC RDO data ###
+    from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CscROD_Decoder
+    CSCRodDecoder = Muon__CscROD_Decoder(name		= "CscROD_Decoder",
+                                         IsCosmics	= False,
+                                         IsOldCosmics 	= False )
+    ToolSvc += CSCRodDecoder
+
+    from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CSC_RawDataProviderToolMT
+    MuonCscRawDataProviderTool = Muon__CSC_RawDataProviderToolMT(name        = "CSC_RawDataProviderToolMT",
+                                                                 CscContainerCacheKey = MuonCacheNames.CscCache,
+                                                                 Decoder     = CSCRodDecoder )
+    ToolSvc += MuonCscRawDataProviderTool
+
+    from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CscRdoToCscPrepDataToolMT
+    CscRdoToCscPrepDataTool = Muon__CscRdoToCscPrepDataToolMT(name           = "CscRdoToCscPrepDataTool",
+                                                              CscStripPrdContainerCacheKey = MuonPrdCacheNames.CscStripCache)
+    
+    ToolSvc += CscRdoToCscPrepDataTool
+
+    from MuonRdoToPrepData.MuonRdoToPrepDataConf import CscRdoToCscPrepData
+    CscRdoToCscPrepData = CscRdoToCscPrepData(name                    = "CscRdoToCscPrepData" + postFix,
+                                              CscRdoToCscPrepDataTool = CscRdoToCscPrepDataTool,
+                                              PrintPrepData           = False,
+                                              DoSeededDecoding        = not forFullScan,
+                                              RoIs                    = RoIs )
+
+    from RegionSelector.RegSelToolConfig import makeRegSelTool_CSC
+    CscRdoToCscPrepData.RegSel_CSC = makeRegSelTool_CSC()
+
+    from MuonByteStream.MuonByteStreamConf import Muon__CscRawDataProvider
+    CscRawDataProvider = Muon__CscRawDataProvider(name         = "CscRawDataProvider" + postFix,
+                                                  ProviderTool = MuonCscRawDataProviderTool,
+                                                  DoSeededDecoding        = not forFullScan,
+                                                  RoIs                    = RoIs)
+
+    from CscClusterization.CscClusterizationConf import CscThresholdClusterBuilderTool
+    CscClusterBuilderTool = CscThresholdClusterBuilderTool(name        = "CscThresholdClusterBuilderTool" )
+    ToolSvc += CscClusterBuilderTool
+
+    #CSC cluster building
+    from CscClusterization.CscClusterizationConf import CscThresholdClusterBuilder
+    CscClusterBuilder = CscThresholdClusterBuilder(name            = "CscThresholdClusterBuilder",
+                                                   cluster_builder = CscClusterBuilderTool)
 
   # Make sure required objects are still available at whole-event level
   from AthenaCommon.AlgSequence import AlgSequence
   topSequence = AlgSequence()
 
-  if globalflags.InputFormat.is_bytestream():
-    viewAlgs_MuonPRD.append( CscRawDataProvider )
-    muDataPrepVDV.DataObjects += [( 'CscRawDataCollection_Cache' , MuonCacheNames.CscCache )]
-  else:
-    muDataPrepVDV.DataObjects += [( 'CscRawDataContainer' , 'StoreGateSvc+CSCRDO' )]
-    topSequence.SGInputLoader.Load += [( 'CscRawDataContainer' , 'StoreGateSvc+CSCRDO' )]
-  viewAlgs_MuonPRD.append( CscRdoToCscPrepData )
-  viewAlgs_MuonPRD.append( CscClusterBuilder )
+  if MuonGeometryFlags.hasCSC():
+    if globalflags.InputFormat.is_bytestream():
+      viewAlgs_MuonPRD.append( CscRawDataProvider )
+      muDataPrepVDV.DataObjects += [( 'CscRawDataCollection_Cache' , MuonCacheNames.CscCache )]
+    else:
+      muDataPrepVDV.DataObjects += [( 'CscRawDataContainer' , 'StoreGateSvc+CSCRDO' )]
+      topSequence.SGInputLoader.Load += [( 'CscRawDataContainer' , 'StoreGateSvc+CSCRDO' )]
+    viewAlgs_MuonPRD.append( CscRdoToCscPrepData )
+    viewAlgs_MuonPRD.append( CscClusterBuilder )
 
 
   ### MDT RDO data ###
@@ -252,6 +256,9 @@ def makeMuonPrepDataAlgs(RoIs="MURoIs", forFullScan=False):
                                             DoSeededDecoding = not forFullScan,
                                             RoIs             = RoIs)
 
+  from RegionSelector.RegSelToolConfig import makeRegSelTool_RPC
+  RpcRdoToRpcPrepData.RegSel_RPC = makeRegSelTool_RPC()
+
   from MuonByteStream.MuonByteStreamConf import Muon__RpcRawDataProvider
   RpcRawDataProvider = Muon__RpcRawDataProvider(name         = "RpcRawDataProvider" + postFix,
                                                 ProviderTool = MuonRpcRawDataProviderTool,
@@ -288,6 +295,8 @@ def makeMuonPrepDataAlgs(RoIs="MURoIs", forFullScan=False):
                                             PrintPrepData    = False,
                                             DoSeededDecoding = not forFullScan,
                                             RoIs             = RoIs)
+  from RegionSelector.RegSelToolConfig import makeRegSelTool_TGC
+  TgcRdoToTgcPrepData.RegSel_TGC = makeRegSelTool_TGC()
 
   from MuonByteStream.MuonByteStreamConf import Muon__TgcRawDataProvider
   TgcRawDataProvider = Muon__TgcRawDataProvider(name         = "TgcRawDataProvider" + postFix,                                                
@@ -335,27 +344,28 @@ def muFastRecoSequence( RoIs, doFullScanID = False ):
                                ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ),
                                ( 'DataVector< LVL1::RecMuonRoI >' , 'StoreGateSvc+HLT_RecMURoIs' )]
 
-  # Only load these objects if they aren't available in conddb
-  from IOVDbSvc.CondDB import conddb
-  if not conddb.folderRequested( "/CSC/DCS/LAYERSTATE" ):
-    muFastRecoVDV.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/CSC/DCS/LAYERSTATE' )]
-  if not conddb.folderRequested( "/CSC/T0PHASE" ):
-    muFastRecoVDV.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0PHASE' )]
-  if not conddb.folderRequested( "/CSC/T0BASE" ):
-    muFastRecoVDV.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0BASE' )]
+  if MuonGeometryFlags.hasCSC():
+    # Only load these objects if they aren't available in conddb
+    from IOVDbSvc.CondDB import conddb
+    if not conddb.folderRequested( "/CSC/DCS/LAYERSTATE" ):
+      muFastRecoVDV.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/CSC/DCS/LAYERSTATE' )]
+    if not conddb.folderRequested( "/CSC/T0PHASE" ):
+      muFastRecoVDV.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0PHASE' )]
+    if not conddb.folderRequested( "/CSC/T0BASE" ):
+      muFastRecoVDV.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/CSC/T0BASE' )]
 
   muFastRecoSequence += muFastRecoVDV
 
-
-  # Configure the L2 CSC data preparator - we can turn off the data decoding here
-  from TrigL2MuonSA.TrigL2MuonSAConf import TrigL2MuonSA__CscDataPreparator
-  L2CscDataPreparator = TrigL2MuonSA__CscDataPreparator(name = "L2MuonSACscDataPreparator",
-                                                        DecodeBS = False,
-                                                        DoDecoding = False,
-                                                        CscRawDataProvider   = "",
-                                                        CscPrepDataProvider  = "",
-                                                        CscClusterProvider   = "")
-  ToolSvc += L2CscDataPreparator
+  if MuonGeometryFlags.hasCSC():
+    # Configure the L2 CSC data preparator - we can turn off the data decoding here
+    from TrigL2MuonSA.TrigL2MuonSAConf import TrigL2MuonSA__CscDataPreparator
+    L2CscDataPreparator = TrigL2MuonSA__CscDataPreparator(name = "L2MuonSACscDataPreparator",
+                                                          DecodeBS = False,
+                                                          DoDecoding = False,
+                                                          CscRawDataProvider   = "",
+                                                          CscPrepDataProvider  = "",
+                                                          CscClusterProvider   = "")
+    ToolSvc += L2CscDataPreparator
  
   # Configure the L2 MDT data preparator - we can turn off the data decoding here
   from TrigL2MuonSA.TrigL2MuonSAConf import TrigL2MuonSA__MdtDataPreparator
@@ -391,7 +401,8 @@ def muFastRecoSequence( RoIs, doFullScanID = False ):
 
   from TrigL2MuonSA.TrigL2MuonSAConf import TrigL2MuonSA__MuFastDataPreparator
   MuFastDataPreparator = TrigL2MuonSA__MuFastDataPreparator()
-  MuFastDataPreparator.CSCDataPreparator = L2CscDataPreparator
+  if MuonGeometryFlags.hasCSC():
+    MuFastDataPreparator.CSCDataPreparator = L2CscDataPreparator
   MuFastDataPreparator.MDTDataPreparator = L2MdtDataPreparator
   MuFastDataPreparator.RPCDataPreparator = L2RpcDataPreparator
   MuFastDataPreparator.TGCDataPreparator = L2TgcDataPreparator
@@ -524,9 +535,10 @@ def muEFSARecoSequence( RoIs, name ):
     # we now try to share the data preparation algorithms with L2, so we tell the view that it should expect the MDT, TGC, CSC and RPC PRDs to be available
     EFMuonViewDataVerifier.DataObjects += [( 'Muon::MdtPrepDataContainer' , 'StoreGateSvc+MDT_DriftCircles' ),
                                            ( 'Muon::TgcPrepDataContainer' , 'StoreGateSvc+TGC_Measurements' ),
-                                           ( 'Muon::RpcPrepDataContainer' , 'StoreGateSvc+RPC_Measurements' ),
-                                           ( 'Muon::CscStripPrepDataContainer' , 'StoreGateSvc+CSC_Measurements' ),
-                                           ( 'Muon::CscPrepDataContainer' , 'StoreGateSvc+CSC_Clusters' )]
+                                           ( 'Muon::RpcPrepDataContainer' , 'StoreGateSvc+RPC_Measurements' )]
+    if MuonGeometryFlags.hasCSC():
+      EFMuonViewDataVerifier.DataObjects += [( 'Muon::CscStripPrepDataContainer' , 'StoreGateSvc+CSC_Measurements' ),
+                                             ( 'Muon::CscPrepDataContainer' , 'StoreGateSvc+CSC_Clusters' )]
     if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()): 
       EFMuonViewDataVerifier.DataObjects += [( 'Muon::MMPrepDataContainer'       , 'StoreGateSvc+MM_Measurements'),
                                              ( 'Muon::sTgcPrepDataContainer'     , 'StoreGateSvc+STGC_Measurements')]
@@ -620,8 +632,7 @@ def muEFCBRecoSequence( RoIs, name ):
   muEFCBRecoSequence = parOR("efcbViewNode_"+name)
   #Need ID tracking related objects and MS tracks from previous steps
   ViewVerifyMS = CfgMgr.AthViews__ViewDataVerifier("muonCBViewDataVerifier")
-  ViewVerifyMS.DataObjects = [( 'Muon::CscStripPrepDataContainer' , 'StoreGateSvc+CSC_Measurements' ),  
-                              ( 'Muon::MdtPrepDataContainer' , 'StoreGateSvc+MDT_DriftCircles' ),  
+  ViewVerifyMS.DataObjects = [( 'Muon::MdtPrepDataContainer' , 'StoreGateSvc+MDT_DriftCircles' ),  
                               ( 'Muon::TgcPrepDataContainer'      , 'StoreGateSvc+TGC_Measurements' ),
                               ( 'Muon::RpcPrepDataContainer'      , 'StoreGateSvc+RPC_Measurements' ),
                               ( 'MuonCandidateCollection' , 'StoreGateSvc+MuonCandidates'),
@@ -629,7 +640,8 @@ def muEFCBRecoSequence( RoIs, name ):
                               ( 'SCT_FlaggedCondData' , 'StoreGateSvc+SCT_FlaggedCondData' ),
                               ( 'MuonCandidateCollection' , 'StoreGateSvc+MuonCandidates_FS' ),
                               ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )]
-
+  if MuonGeometryFlags.hasCSC():
+    ViewVerifyMS.DataObjects += [( 'Muon::CscStripPrepDataContainer' , 'StoreGateSvc+CSC_Measurements' )]
   if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()): 
     ViewVerifyMS.DataObjects += [( 'Muon::MMPrepDataContainer'       , 'StoreGateSvc+MM_Measurements'),
                                 ( 'Muon::sTgcPrepDataContainer'     , 'StoreGateSvc+STGC_Measurements') ]
@@ -803,10 +815,11 @@ def muEFInsideOutRecoSequence(RoIs, name):
     # for non-latemu chains, the decoding/hough transform is run in an earlier step
     #Need PRD containers for inside-out reco
     ViewVerifyInsideOut = CfgMgr.AthViews__ViewDataVerifier("muonInsideOutViewDataVerifier")
-    ViewVerifyInsideOut.DataObjects = [( 'Muon::CscPrepDataContainer' , 'StoreGateSvc+CSC_Clusters' ),
-                                       ( 'Muon::RpcPrepDataContainer' , 'StoreGateSvc+RPC_Measurements' ),
+    ViewVerifyInsideOut.DataObjects = [( 'Muon::RpcPrepDataContainer' , 'StoreGateSvc+RPC_Measurements' ),
                                        ( 'Muon::TgcPrepDataContainer' , 'StoreGateSvc+TGC_Measurements' ),
                                        ( 'Muon::HoughDataPerSectorVec' , 'StoreGateSvc+HoughDataPerSectorVec')]
+    if MuonGeometryFlags.hasCSC():
+      ViewVerifyInsideOut.DataObjects += [( 'Muon::CscPrepDataContainer' , 'StoreGateSvc+CSC_Clusters' )]
     if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()): 
       ViewVerifyInsideOut.DataObjects += [( 'Muon::MMPrepDataContainer'       , 'StoreGateSvc+MM_Measurements'),
                                           ( 'Muon::sTgcPrepDataContainer'     , 'StoreGateSvc+STGC_Measurements') ]
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py
index 2c571ee87957ad1b2bb6b035469d0377da5c50cf..a2411a112fd2131e7c3698c14db59cef2a03ba49 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py
@@ -113,7 +113,7 @@ def generateChains( flags, chainDict ):
 
     l2muFastSequence.createHypoTools(chainDict)
 
-    l2muFastStep = ChainStep( stepName, [l2muFastSequence] )
+    l2muFastStep = ChainStep( name=stepName, Sequences=[l2muFastSequence], chainDicts=[chainDict] )
 
     ### Set muon step2 ###
     # Please set up L2muComb step here
@@ -176,7 +176,7 @@ def generateChains( flags, chainDict ):
 
     efmuMSSequence.createHypoTools(chainDict)
 
-    efmuMSStep = ChainStep( stepEFMSName, [efmuMSSequence] )
+    efmuMSStep = ChainStep( name=stepEFMSName, Sequences=[efmuMSSequence], chainDicts=[chainDict] )
 
     l1Thresholds=[]
     for part in chainDict['chainParts']:
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py
index d9a5aea24b5810f8eb1385151c769f17909fc7d2..1a02cec684050ae627b4481b636b8121f24bb470 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py
@@ -4,7 +4,8 @@
 
 from AthenaCommon.CFElements import parOR, seqAND
 from AthenaCommon.GlobalFlags import globalflags
-from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm, ViewCreatorInitialROITool, ViewCreatorPreviousROITool
+from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
+from DecisionHandling.DecisionHandlingConf import ViewCreatorInitialROITool, ViewCreatorPreviousROITool
 from TrigT2CaloCommon.CaloDef import HLTLCTopoRecoSequence
 from TrigEDMConfig.TriggerEDMRun3 import recordable
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import RecoFragmentsPool