diff --git a/Calorimeter/CaloG4Sim/CaloG4Sim/ATLAS_CHECK_THREAD_SAFETY b/Calorimeter/CaloG4Sim/CaloG4Sim/ATLAS_CHECK_THREAD_SAFETY
new file mode 100644
index 0000000000000000000000000000000000000000..bd029a61c8f975e53c6ba99cdaea0e49646e0942
--- /dev/null
+++ b/Calorimeter/CaloG4Sim/CaloG4Sim/ATLAS_CHECK_THREAD_SAFETY
@@ -0,0 +1 @@
+Calorimeter/CaloG4Sim
diff --git a/Calorimeter/CaloG4Sim/CaloG4Sim/EscapedEnergyRegistry.h b/Calorimeter/CaloG4Sim/CaloG4Sim/EscapedEnergyRegistry.h
index d25bb6f0d59f34e87daa3eab40c94f672a1ab47f..8d82088b898c997dfa990b86d5a6e68de86e326f 100644
--- a/Calorimeter/CaloG4Sim/CaloG4Sim/EscapedEnergyRegistry.h
+++ b/Calorimeter/CaloG4Sim/CaloG4Sim/EscapedEnergyRegistry.h
@@ -1,11 +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 CaloG4_EscapedEnergyRegistry_H
 #define CaloG4_EscapedEnergyRegistry_H
 
 #include "CaloG4Sim/VEscapedEnergyProcessing.h"
+#include "CxxUtils/checker_macros.h"
 #include "globals.hh"
 
 #include <map>
@@ -75,7 +76,7 @@ namespace CaloG4
      // Thread-to-EscapeEnergyRegistry concurrent map type
     using EERThreadMap_t = tbb::concurrent_unordered_map< std::thread::id, EscapedEnergyRegistry*, std::hash<std::thread::id> >;
     // Concurrent map of EERs, one for each thread
-    static EERThreadMap_t m_EERThreadMap;
+    static EERThreadMap_t m_EERThreadMap ATLAS_THREAD_SAFE;
     // @brief Search inside m_EERThreadMap the element with the current threadID 
     // and return it or return a null pointer if the element is not found
     static EscapedEnergyRegistry* getEER();
diff --git a/Calorimeter/CaloG4Sim/src/CalibrationDefaultProcessing.cc b/Calorimeter/CaloG4Sim/src/CalibrationDefaultProcessing.cc
index c0fd10089dfb6e5fc0b5c96c74626f4fe97caa34..a03b0a2db37c0a9c0a95ace44adfb4704bc79881 100644
--- a/Calorimeter/CaloG4Sim/src/CalibrationDefaultProcessing.cc
+++ b/Calorimeter/CaloG4Sim/src/CalibrationDefaultProcessing.cc
@@ -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
 */
 
 // CalibrationDefaultProcessing
@@ -20,6 +20,7 @@
 
 #include "CaloG4Sim/CalibrationDefaultProcessing.h"
 #include "CaloG4Sim/SimulationEnergies.h"
+#include "CxxUtils/checker_macros.h"
 
 // For the event-level flag
 #include "MCTruth/AtlasG4EventUserInfo.h"
@@ -32,6 +33,7 @@
 
 #include "GaudiKernel/Bootstrap.h"
 #include "GaudiKernel/ISvcLocator.h"
+#include <atomic>
 
 namespace G4UA
 {
@@ -79,7 +81,9 @@ namespace G4UA
           // this step.  Note that we have to "cast away" const-ness for
           // the G4Step*, due to how G4VSensitiveDetector::Hit() is
           // defined.
-          m_defaultSD->Hit( const_cast<G4Step*>(a_step) );
+          // Should be ok, since Geant doesn't do intra-event parallelism.
+          G4Step* step_nc ATLAS_THREAD_SAFE = const_cast<G4Step*> (a_step);
+          m_defaultSD->Hit( step_nc );
 
           // Update the step info
           atlasG4EvtUserInfo->SetLastProcessedBarcode( track->GetTrackID() );
@@ -88,10 +92,8 @@ namespace G4UA
       }
 
       else {
-        // FIXME - thread unsafe static!!!
-        static G4bool warningPrinted = false;
-        if ( ! warningPrinted ) {
-          warningPrinted = true;
+        static std::atomic_flag warningPrinted ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT;
+        if ( ! warningPrinted.test_and_set() ) {
           G4cout << "CaloG4::CalibrationDefaultProcessing::SteppingAction - "
                  << G4endl
                  << "   A default calibration sensitive detector was not defined."
diff --git a/Control/AthContainers/AthContainers/AuxTypeRegistry.h b/Control/AthContainers/AthContainers/AuxTypeRegistry.h
index 79661353a42e241cc6004f917479bb6f7030e2e8..62a8b883078c14df07eb8a1077d700bb408ca617 100644
--- a/Control/AthContainers/AthContainers/AuxTypeRegistry.h
+++ b/Control/AthContainers/AthContainers/AuxTypeRegistry.h
@@ -1,10 +1,8 @@
 // This file's extension implies that it's C, but it's really -*- C++ -*-.
 
 /*
-  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: AuxTypeRegistry.h 784452 2016-11-15 21:40:41Z ssnyder $
 /**
  * @file AthContainers/AuxTypeRegistry.h
  * @author scott snyder <snyder@bnl.gov>
@@ -23,6 +21,8 @@
 #include "AthContainers/tools/AuxTypeVector.h"
 #include "AthContainers/tools/AuxTypeVectorFactory.h"
 #include "AthContainers/tools/threading.h"
+#include "CxxUtils/ConcurrentStrMap.h"
+#include "CxxUtils/SimpleUpdater.h"
 #include "CxxUtils/bitmask.h"
 #ifndef XAOD_STANDALONE
 #include "AthenaKernel/IInputRename.h"
@@ -289,7 +289,7 @@ public:
    * @brief Return the vector factory for a given vector element type.
    * @param ti The type of the vector element.
    *
-   * Returns 0 if the type is not known.
+   * Returns nullptr if the type is not known.
    * (Use @c addFactory to add new mappings.)
    */
   const IAuxTypeVectorFactory* getFactory (const std::type_info& ti) const;
@@ -393,25 +393,12 @@ private:
    * @brief Return the vector factory for a given auxid.
    * @param auxid The desired aux data item.
    *
-   * Returns 0 if the type is not known.
+   * Returns nullptr if the type is not known.
    * (Use @c addFactory to add new mappings.)
    */
   const IAuxTypeVectorFactory* getFactory (SG::auxid_t auxid) const;
 
 
-  /**
-   * @brief Return the vector factory for a given vector element type.
-   *        (external locking)
-   * @param lock The registry lock.
-   * @param ti The type of the vector element.
-   *
-   * Returns 0 if the type is not known.
-   * (Use @c addFactory to add new mappings.)
-   */
-  const IAuxTypeVectorFactory* getFactory (lock_t& lock,
-                                           const std::type_info& ti) const;
-
-
   /**
    * @brief Add a new type -> factory mapping.  (external locking)
    * @param lock The registry lock.
@@ -447,6 +434,15 @@ private:
   IAuxTypeVectorFactory* makeFactoryNull() const;
 
 
+  /**
+   * @brief Return the key used to look up an entry in m_auxids.
+   * @param name The name of the aux data item.
+   * @param clsname The name of its associated class.  May be blank.
+   */
+  static std::string makeKey (const std::string& name,
+                              const std::string& clsname);
+
+
   /// Hold information about one aux data item.
   struct typeinfo_t
   {
@@ -472,30 +468,12 @@ private:
   AthContainers_detail::concurrent_vector<typeinfo_t> m_types;
 
 
-  /// Key used for name -> auxid lookup.
-  /// First element is name, second is class name.
-  typedef std::pair<std::string, std::string> key_t;
-
-
-  /// Helper to hash the key type.
-  struct stringpair_hash
-  {
-    size_t operator() (const key_t& key) const
-    {
-      return shash (key.first) + shash (key.second);
-    }
-    std::hash<std::string> shash;
-  };
-
-
   /// Map from name -> auxid.
-  typedef std::unordered_map<key_t, SG::auxid_t, stringpair_hash>
-    id_map_t;
+  using id_map_t = CxxUtils::ConcurrentStrMap<SG::auxid_t, CxxUtils::SimpleUpdater>;
   id_map_t m_auxids;
 
   /// Map from type_info name -> IAuxTypeVectorFactory.
-  typedef std::unordered_map<std::string,
-                             const IAuxTypeVectorFactory*> ti_map_t;
+  using ti_map_t = CxxUtils::ConcurrentStrMap<const IAuxTypeVectorFactory*, CxxUtils::SimpleUpdater>;
   ti_map_t m_factories;
 
   /// Hold additional factory instances we need to delete.
diff --git a/Control/AthContainers/AthContainers/AuxTypeRegistry.icc b/Control/AthContainers/AthContainers/AuxTypeRegistry.icc
index f888377cebbacdf379784c5a802b5a7d5ad357c1..386ca1b5dd2f3ff8d1eec37bca14a479dea6581d 100644
--- a/Control/AthContainers/AthContainers/AuxTypeRegistry.icc
+++ b/Control/AthContainers/AthContainers/AuxTypeRegistry.icc
@@ -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: AuxTypeRegistry.icc 602003 2014-06-16 17:07:01Z ssnyder $
 /**
  * @file AthContainers/AuxTypeRegistry.icc
  * @author scott snyder <snyder@bnl.gov>
@@ -38,7 +36,7 @@ AuxTypeRegistry::getAuxID (const std::string& name,
  * @brief Return the vector factory for a given auxid.
  * @param auxid The desired aux data item.
  *
- * Returns 0 if the type is not known.
+ * Returns nullptr if the type is not known.
  * (Use @c addFactory to add new mappings.)
  */
 inline
diff --git a/Control/AthContainers/Root/AuxTypeRegistry.cxx b/Control/AthContainers/Root/AuxTypeRegistry.cxx
index 46da2502ef06d6064aee43b16df8b4ce1377f38c..0bf50e9e99bbac1d0f3eb24d7f060f3db11a328a 100644
--- a/Control/AthContainers/Root/AuxTypeRegistry.cxx
+++ b/Control/AthContainers/Root/AuxTypeRegistry.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
 */
-
-// $Id$
 /**
  * @file AthContainers/AuxTypeRegistry.cxx
  * @author scott snyder <snyder@bnl.gov>
@@ -68,9 +66,12 @@ SG::auxid_t
 AuxTypeRegistry::findAuxID( const std::string& name,
                             const std::string& clsname ) const
 {
-  lock_t lock (m_mutex);
-  key_t key (name, clsname);
-  id_map_t::const_iterator i = m_auxids.find (key);
+  // No locking needed here.
+  // The extra test here is to avoid having to copy a string
+  // in the common case where clsname is blank.
+  id_map_t::const_iterator i = m_auxids.find (clsname.empty() ?
+                                              name :
+                                              makeKey (name, clsname));
   if (i != m_auxids.end()) {
     return i->second;
   }
@@ -121,6 +122,21 @@ AuxTypeRegistry::makeVectorFromData (SG::auxid_t auxid,
 }
 
 
+/**
+ * @brief Return the key used to look up an entry in m_auxids.
+ * @param name The name of the aux data item.
+ * @param clsname The name of its associated class.  May be blank.
+ */
+std::string AuxTypeRegistry::makeKey (const std::string& name,
+                                      const std::string& clsname)
+{
+  if (clsname.empty()) {
+    return name;
+  }
+  return clsname + "::" + name;
+}
+
+
 
 /**
  * @brief Return the name of an aux data item.
@@ -294,34 +310,16 @@ void AuxTypeRegistry::clear (SG::auxid_t auxid, void* dst, size_t dst_index)
  * @brief Return the vector factory for a given vector element type.
  * @param ti The type of the vector element.
  *
- * Returns 0 if the type is not known.
+ * Returns nullptr if the type is not known.
  * (Use @c addFactory to add new mappings.)
  */
 const IAuxTypeVectorFactory*
 AuxTypeRegistry::getFactory (const std::type_info& ti) const
-{
-  lock_t lock (m_mutex);
-  return getFactory (lock, ti);
-}
-
-
-/**
- * @brief Return the vector factory for a given vector element type.
- *        (external locking)
- * @param lock The registry lock.
- * @param ti The type of the vector element.
- *
- * Returns 0 if the type is not known.
- * (Use @c addFactory to add new mappings.)
- */
-const IAuxTypeVectorFactory*
-AuxTypeRegistry::getFactory (lock_t& /*lock*/,
-                             const std::type_info& ti) const
 {
   ti_map_t::const_iterator it = m_factories.find (ti.name());
   if (it != m_factories.end())
     return it->second;
-  return 0;
+  return nullptr;
 }
 
 
@@ -358,7 +356,7 @@ void AuxTypeRegistry::addFactory (lock_t& /*lock*/,
                                   const std::type_info& ti,
                                   IAuxTypeVectorFactory* factory)
 {
-  ti_map_t::iterator it = m_factories.find (ti.name());
+  ti_map_t::const_iterator it = m_factories.find (ti.name());
   if (it != m_factories.end()) {
     if (it->second->isDynamic() && !factory->isDynamic()) {
       // Replacing a dynamic factory with a non-dynamic one.
@@ -366,13 +364,13 @@ void AuxTypeRegistry::addFactory (lock_t& /*lock*/,
       // Instead, push it on a vector to remember it so we can delete
       // it later.
       m_oldFactories.push_back (it->second);
-      it->second = factory;
+      m_factories.insert_or_assign (ti.name(), factory);
     }
     else
       delete factory;
   }
   else
-    m_factories[ti.name()] = factory;
+    m_factories.insert_or_assign (ti.name(), factory);
 }
 
 
@@ -382,6 +380,8 @@ void AuxTypeRegistry::addFactory (lock_t& /*lock*/,
  * Populates the type -> factory mappings for standard C++ types.
  */
 AuxTypeRegistry::AuxTypeRegistry()
+  : m_auxids (id_map_t::Updater_t()),
+    m_factories (ti_map_t::Updater_t())
 {
   m_types.reserve (auxid_set_size_hint);
 
@@ -419,7 +419,7 @@ AuxTypeRegistry::AuxTypeRegistry()
  */
 AuxTypeRegistry::~AuxTypeRegistry()
 {
-  for (ti_map_t::value_type& p : m_factories)
+  for (auto& p : m_factories)
     delete p.second;
   for (const IAuxTypeVectorFactory* p : m_oldFactories)
     delete p;
@@ -453,9 +453,9 @@ AuxTypeRegistry::findAuxID (const std::string& name,
                             const std::type_info& ti,
                             IAuxTypeVectorFactory* (AuxTypeRegistry::*makeFactory) () const)
 {
-  lock_t lock (m_mutex);
-  key_t key (name, clsname);
-  id_map_t::iterator i = m_auxids.find (key);
+  lock_t lock (m_mutex);  // May be able to relax this lock.
+  std::string key = makeKey (name, clsname);
+  id_map_t::const_iterator i = m_auxids.find (key);
   if (i != m_auxids.end()) {
     typeinfo_t& m = m_types[i->second];
 
@@ -479,7 +479,7 @@ AuxTypeRegistry::findAuxID (const std::string& name,
         IAuxTypeVectorFactory* fac2 = (*this.*makeFactory)();
         if (fac2) {
           addFactory (lock, ti, fac2);
-          m.m_factory = getFactory (lock, ti);
+          m.m_factory = getFactory (ti);
         }
       }
       return i->second;
@@ -490,12 +490,12 @@ AuxTypeRegistry::findAuxID (const std::string& name,
     // fall through, get a new auxid and real type info
     // new auxid needed so a new data vector is created in the AuxStore
   }
-  const IAuxTypeVectorFactory* fac = getFactory (lock, ti);
+  const IAuxTypeVectorFactory* fac = getFactory (ti);
   if (!fac || fac->isDynamic()) {
     IAuxTypeVectorFactory* fac2 = (*this.*makeFactory)();
     if (fac2) {
       addFactory (lock, ti, fac2);
-      fac = getFactory (lock, ti);
+      fac = getFactory (ti);
     }
   }
   if (!fac) return null_auxid;
@@ -508,7 +508,7 @@ AuxTypeRegistry::findAuxID (const std::string& name,
   t.m_factory = fac;
   t.m_flags = flags;
   AthContainers_detail::fence_seq_cst();
-  m_auxids[key] = auxid;
+  m_auxids.insert_or_assign (key, auxid);
 
   return auxid;
 }
diff --git a/Control/AthenaCommon/CMakeLists.txt b/Control/AthenaCommon/CMakeLists.txt
index f087ae817778d50c6f49f0e2eae68e700b69f364..e0ffc081ed6bdbdd6e9df506095a7e29a084bad6 100644
--- a/Control/AthenaCommon/CMakeLists.txt
+++ b/Control/AthenaCommon/CMakeLists.txt
@@ -3,6 +3,9 @@
 # Declare the package name:
 atlas_subdir( AthenaCommon )
 
+# External dependencies.
+find_package( future )
+
 # Set up specific Athena runtime environment:
 set( AthenaCommonEnvironment_DIR ${CMAKE_CURRENT_SOURCE_DIR}
    CACHE PATH "Location of AthenaCommonEnvironmentConfig.cmake" )
@@ -11,7 +14,7 @@ find_package( AthenaCommonEnvironment )
 # Install files from the package:
 atlas_install_python_modules( python/*.py python/Utils
                               POST_BUILD_CMD ${ATLAS_FLAKE8} )
-atlas_install_joboptions( share/Preparation.py share/Execution.py share/Atlas.UnixStandardJob.py test/*.py 
+atlas_install_joboptions( share/Preparation.py share/Execution.py share/Atlas.UnixStandardJob.py test/*.py
                           share/zeroJO.py share/Atlas_Gen.UnixStandardJob.py share/MemTraceInclude.py share/runbatch.py)
 atlas_install_scripts( share/athena.py share/athena_preload.sh share/chappy.py share/test_cfg_pickling.py share/ThinCAWrapper.sh)
 atlas_install_runtime(share/*.pkl)
@@ -26,14 +29,14 @@ atlas_add_test( AthAppMgrUnitTests SCRIPT test/test_AthAppMgrUnitTests.sh
 atlas_add_test( ConfigurableUnitTests SCRIPT test/test_ConfigurableUnitTests.sh
                 PROPERTIES TIMEOUT 300
                 LOG_IGNORE_PATTERN "Warning in <TFile::Init>: no StreamerInfo found|^Ran .* tests in" )
-atlas_add_test( JobOptionsUnitTests SCRIPT test/test_JobOptionsUnitTests.sh 
+atlas_add_test( JobOptionsUnitTests SCRIPT test/test_JobOptionsUnitTests.sh
                 LOG_IGNORE_PATTERN "Warning in <TFile::Init>: no StreamerInfo found|^Ran .* tests in" )
 atlas_add_test( JobPropertiesUnitTests SCRIPT test/test_JobPropertiesUnitTests.sh
                 LOG_IGNORE_PATTERN "Warning in <TFile::Init>: no StreamerInfo found|^Ran .* tests in" )
 atlas_add_test( KeyStoreUnitTests SCRIPT test/test_KeyStoreUnitTests.sh
                 LOG_IGNORE_PATTERN "Warning in <TFile::Init>: no StreamerInfo found|^Ran .* tests in|^outFileName: " )
 atlas_add_test( CFElementsTest SCRIPT python -m unittest -v AthenaCommon.CFElements
-		POST_EXEC_SCRIPT nopost.sh ) 
+		POST_EXEC_SCRIPT nopost.sh )
 
 atlas_add_test( GenerateBootstrapTest
    SCRIPT test/test_gen_bootstrap.sh
diff --git a/Control/AthenaCommon/share/athena.py b/Control/AthenaCommon/share/athena.py
index f114cbed608eb79a7bd63ea274e7d4cffc60339c..2140470dc9019f10a9995a392aee570bab31447b 100755
--- a/Control/AthenaCommon/share/athena.py
+++ b/Control/AthenaCommon/share/athena.py
@@ -27,7 +27,7 @@ do
 	--stdcmath)      USEIMF=0;;
 	--imf)           USEIMF=1;;
 	--preloadlib*)     export ATHENA_ADD_PRELOAD=${a#*=};;
-	--drop-and-reload) export ATHENA_DROP_RELOAD=1;;
+	--drop-and-reload) ATHENA_DROP_RELOAD=1;;
 	--CA)              USECA=1;;
 	*)               otherargs="$otherargs $a";;
     esac
diff --git a/Control/AthenaConfiguration/CMakeLists.txt b/Control/AthenaConfiguration/CMakeLists.txt
index dc6084e7b04f7003639bdbe2f13d8919d5a1c34e..a4f11c6aec0798315acdc6ef1dcf9844b8b701ae 100644
--- a/Control/AthenaConfiguration/CMakeLists.txt
+++ b/Control/AthenaConfiguration/CMakeLists.txt
@@ -3,6 +3,9 @@
 # Declare the package name:
 atlas_subdir( AthenaConfiguration )
 
+# External dependencies.
+find_package( future )
+
 # Install files from the package:
 atlas_install_python_modules( python/*.py python/iconfTool
                               POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Control/AthenaConfiguration/python/AllConfigFlags.py b/Control/AthenaConfiguration/python/AllConfigFlags.py
index 137186d0313e87ab866d1817b0f29bec2e6752e3..5025f59995a8f4a5ec76299fe23cbe39d9ec8d06 100644
--- a/Control/AthenaConfiguration/python/AllConfigFlags.py
+++ b/Control/AthenaConfiguration/python/AllConfigFlags.py
@@ -4,7 +4,7 @@ from __future__ import print_function
 
 from AthenaConfiguration.AthConfigFlags import AthConfigFlags
 from AthenaCommon.SystemOfUnits import TeV
-from AthenaConfiguration.AutoConfigFlags import GetFileMD
+from AthenaConfiguration.AutoConfigFlags import GetFileMD, getInitialTimeStampsFromRunNumbers, getRunToTimestampDict
 from PyUtils.moduleExists import moduleExists
 
 
@@ -29,8 +29,14 @@ def _createCfgFlags():
     acf.addFlag('Input.Files', ["_ATHENA_GENERIC_INPUTFILE_NAME_",] ) # former global.InputFiles
     acf.addFlag('Input.SecondaryFiles', []) # secondary input files for DoubleEventSelector
     acf.addFlag('Input.isMC', lambda prevFlags : "IS_SIMULATION" in GetFileMD(prevFlags.Input.Files).get("eventTypes",[]) ) # former global.isMC
+    acf.addFlag('Input.OverrideRunNumber', False )
     acf.addFlag('Input.RunNumber', lambda prevFlags : list(GetFileMD(prevFlags.Input.Files).get("runNumbers",[]))) # former global.RunNumber
     acf.addFlag('Input.LumiBlockNumber', lambda prevFlags : list(GetFileMD(prevFlags.Input.Files).get("lumiBlockNumbers",[]))) # former global.RunNumber
+    acf.addFlag('Input.TimeStamp', lambda prevFlags : [] if not prevFlags.Input.OverrideRunNumber else getInitialTimeStampsFromRunNumbers(prevFlags.Input.RunNumber))
+    # Configure EvtIdModifierSvc with a list of dictionaries of the form:
+    # {'run': 152166, 'lb': 202, 'starttstamp': 1269948352889940910, 'dt': 104.496, 'evts': 1, 'mu': 0.005, 'force_new': False}
+    acf.addFlag("Input.RunAndLumiOverrideList", [])
+
     acf.addFlag('Input.ProjectName', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("project_name","data17_13TeV") ) # former global.ProjectName
     acf.addFlag('Input.Format', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("file_type","") ) # former global.InputFormat
 
@@ -42,8 +48,16 @@ def _createCfgFlags():
         collections = [col for col in rawCollections if not col.endswith('Aux.') ]
         return collections
 
+    def _typedInputCollections(inputFile):
+        if not inputFile:
+            return []
+
+        collections = ['%s#%s' % type_key for type_key in GetFileMD(inputFile).get("itemList",[])]
+        return collections
+
     acf.addFlag('Input.Collections', lambda prevFlags : _inputCollections(prevFlags.Input.Files) )
     acf.addFlag('Input.SecondaryCollections', lambda prevFlags : _inputCollections(prevFlags.Input.SecondaryFiles) )
+    acf.addFlag('Input.TypedCollections', lambda prevFlags : _typedInputCollections(prevFlags.Input.Files) )
 
     acf.addFlag('Concurrency.NumProcs', 0)
     acf.addFlag('Concurrency.NumThreads', 0)
@@ -137,6 +151,10 @@ def _createCfgFlags():
     acf.addFlag("IOVDb.GlobalTag",lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("IOVDbGlobalTag",None) or "CONDBR2-BLKPA-2017-05")
     from IOVDbSvc.IOVDbAutoCfgFlags import getDatabaseInstanceDefault
     acf.addFlag("IOVDb.DatabaseInstance",getDatabaseInstanceDefault)
+    # Run dependent simulation
+    # map from runNumber to timestamp; migrated from RunDMCFlags.py
+    acf.addFlag("IOVDb.RunToTimestampDict", lambda prevFlags: getRunToTimestampDict())
+
 
     def __bfield():
         from MagFieldConfig.BFieldConfigFlags import createBFieldConfigFlags
diff --git a/Control/AthenaConfiguration/python/AutoConfigFlags.py b/Control/AthenaConfiguration/python/AutoConfigFlags.py
index 5ac59444e9470ff9c1e041c07d5694ce64304c22..12958a31c184367eab2b4f79e02e8de938bf2329 100644
--- a/Control/AthenaConfiguration/python/AutoConfigFlags.py
+++ b/Control/AthenaConfiguration/python/AutoConfigFlags.py
@@ -55,3 +55,20 @@ def DetDescrInfo(geoTag):
     detDescrInfo = _initializeGeometryParameters(geoTag)
     detDescrInfo["geomTag"] = geoTag
     return detDescrInfo
+
+
+# Based on RunDMCFlags.py
+def getRunToTimestampDict():
+    # this wrapper is intended to avoid an initial import
+    from .RunToTimestampData import RunToTimestampDict
+    return RunToTimestampDict
+
+
+def getInitialTimeStampsFromRunNumbers(runNumbers):
+    """This is used to hold a dictionary of the form
+    {152166:1269948352889940910, ...} to allow the
+    timestamp to be determined from the run.
+    """
+    run2timestampDict =  getRunToTimestampDict()
+    timeStamps = [run2timestampDict.get(runNumber,1) for runNumber in runNumbers] # Add protection here?
+    return timeStamps
diff --git a/Simulation/G4Atlas/G4AtlasApps/python/RunToTimestampData.py b/Control/AthenaConfiguration/python/RunToTimestampData.py
similarity index 100%
rename from Simulation/G4Atlas/G4AtlasApps/python/RunToTimestampData.py
rename to Control/AthenaConfiguration/python/RunToTimestampData.py
diff --git a/Control/AthenaIPCTools/src/AthenaSharedMemoryTool.cxx b/Control/AthenaIPCTools/src/AthenaSharedMemoryTool.cxx
index 5c46484f21e9407f51ba01b1eaaa1fbe604191de..224f48fc98c60d64449ee76773da90efb7d9004e 100644
--- a/Control/AthenaIPCTools/src/AthenaSharedMemoryTool.cxx
+++ b/Control/AthenaIPCTools/src/AthenaSharedMemoryTool.cxx
@@ -356,7 +356,7 @@ StatusCode AthenaSharedMemoryTool::getObject(void** target, size_t& nbytes, int
 }
 
 //___________________________________________________________________________
-StatusCode AthenaSharedMemoryTool::clearObject(char** tokenString, int& num) const {
+StatusCode AthenaSharedMemoryTool::clearObject(const char** tokenString, int& num) const {
    if (m_isClient) {
       ShareEventHeader* evtH = static_cast<ShareEventHeader*>(m_status->get_address());
       if (evtH->evtProcessStatus != ShareEventHeader::CLEARED) {
diff --git a/Control/AthenaIPCTools/src/AthenaSharedMemoryTool.h b/Control/AthenaIPCTools/src/AthenaSharedMemoryTool.h
index 182cda61b452b7affcef16bf1f6f541006038354..d629361ff115c0cfd26edabcd2d59ef8918d8222 100644
--- a/Control/AthenaIPCTools/src/AthenaSharedMemoryTool.h
+++ b/Control/AthenaIPCTools/src/AthenaSharedMemoryTool.h
@@ -53,7 +53,7 @@ public:
 
    StatusCode putObject(const void* source, size_t nbytes, int num = 0) const;
    StatusCode getObject(void** target, size_t& nbytes, int num = 0) const;
-   StatusCode clearObject(char** tokenString, int& num) const;
+   StatusCode clearObject(const char** tokenString, int& num) const;
    StatusCode lockObject(const char* tokenString, int num = 0) const;
 
 private:
diff --git a/Control/AthenaIPCTools/src/AthenaYamplTool.cxx b/Control/AthenaIPCTools/src/AthenaYamplTool.cxx
index fea75d358e3007c68fe3c72c7cb70e967efd0f76..7ed8fc9a153bb372d0bd416eb8ed3bb4b31927a4 100644
--- a/Control/AthenaIPCTools/src/AthenaYamplTool.cxx
+++ b/Control/AthenaIPCTools/src/AthenaYamplTool.cxx
@@ -235,7 +235,7 @@ StatusCode AthenaYamplTool::getObject(void**, size_t&, int) const {
 }
 
 //___________________________________________________________________________
-StatusCode AthenaYamplTool::clearObject(char**, int&) const {
+StatusCode AthenaYamplTool::clearObject(const char**, int&) const {
   return(StatusCode::FAILURE);
 }
 
diff --git a/Control/AthenaIPCTools/src/AthenaYamplTool.h b/Control/AthenaIPCTools/src/AthenaYamplTool.h
index 51e91ed2c88ce2295a8eb58b74da59db03f3fd3d..440b47f6a8c2f0095d9a37125fdd896fe1936413 100644
--- a/Control/AthenaIPCTools/src/AthenaYamplTool.h
+++ b/Control/AthenaIPCTools/src/AthenaYamplTool.h
@@ -43,7 +43,7 @@ public:
 
    StatusCode putObject(const void* source, size_t nbytes, int num = 0) const;
    StatusCode getObject(void** target, size_t& nbytes, int num = 0) const;
-   StatusCode clearObject(char** tokenString, int& num) const;
+   StatusCode clearObject(const char** tokenString, int& num) const;
    StatusCode lockObject(const char* tokenString, int num = 0) const;
 
 private:
diff --git a/Control/AthenaKernel/AthenaKernel/IAthenaIPCTool.h b/Control/AthenaKernel/AthenaKernel/IAthenaIPCTool.h
index b734fa1bc6251ebdc2b2aa9c601a0ec435070b1c..12e3353e39837e61fb4d4b8036f665329c713eb2 100644
--- a/Control/AthenaKernel/AthenaKernel/IAthenaIPCTool.h
+++ b/Control/AthenaKernel/AthenaKernel/IAthenaIPCTool.h
@@ -24,7 +24,7 @@ public:
 
    virtual StatusCode putObject(const void* source, size_t nbytes, int num = 0) const = 0;
    virtual StatusCode getObject(void** target, size_t& nbytes, int num = 0) const = 0;
-   virtual StatusCode clearObject(char** tokenString, int& num) const = 0;
+   virtual StatusCode clearObject(const char** tokenString, int& num) const = 0;
    virtual StatusCode lockObject(const char* tokenString, int num = 0) const = 0;
 };
 
diff --git a/Control/AthenaKernel/python/EventIdOverrideConfig.py b/Control/AthenaKernel/python/EventIdOverrideConfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..d49a61ab6280d465f921320587762b3e13960e21
--- /dev/null
+++ b/Control/AthenaKernel/python/EventIdOverrideConfig.py
@@ -0,0 +1,131 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
+from AthenaConfiguration.ComponentFactory import CompFactory
+
+# based on https://acode-browser1.usatlas.bnl.gov/lxr/source/athena/Control/AthenaServices/python/Configurables.py#0247
+def add_modifier(run_nbr=None, evt_nbr=None, time_stamp=None, lbk_nbr=None, nevts=1):
+
+    if run_nbr is None:
+        modify_run_nbr = 0
+        run_nbr = 0
+    else:
+        modify_run_nbr = 1
+
+    if evt_nbr is None:
+        modify_evt_nbr = 0
+        evt_nbr = 0
+    else:
+        modify_evt_nbr = 1
+
+    if time_stamp is None:
+        modify_time_stamp = 0
+        time_stamp = 0
+    else:
+        modify_time_stamp = 1
+
+    if lbk_nbr is None:
+        modify_lbk_nbr = 0
+        lbk_nbr = 0
+    else:
+        modify_lbk_nbr = 1
+
+    mod_bit = int(0b0000
+                  | (modify_run_nbr << 0)
+                  | (modify_evt_nbr << 1)
+                  | (modify_time_stamp << 2)
+                  | (modify_lbk_nbr << 3))
+
+    return [run_nbr, evt_nbr, time_stamp, lbk_nbr, nevts, mod_bit]
+
+
+def buildListOfModifiers(ConfigFlags):
+    # migrated from RunDMCFlags.py
+    Modifiers = []
+    pDicts = ConfigFlags.Input.RunAndLumiOverrideList
+    DataRunNumber = ConfigFlags.Digitization.DataRunNumber
+
+    if pDicts:
+        for el in pDicts:
+            evt_nbr = el.get("evt_nbr", None)
+            Modifiers += add_modifier(run_nbr=el["run"], evt_nbr=evt_nbr, time_stamp=el["starttstamp"], lbk_nbr=el["lb"], nevts=el["evts"])
+    elif DataRunNumber>0:
+        assert DataRunNumber >= 0, (
+            "ConfigFlags.Digitization.DataRunNumber %d is negative. "
+            "Use a real run number from data." % DataRunNumber)
+
+        # Using event numbers to avoid "some very large number" setting
+        totalNumber = 1000000
+        if ConfigFlags.Exec.MaxEvents > 0:
+            totalNumber = ConfigFlags.Exec.MaxEvents + 1
+        if ConfigFlags.Exec.SkipEvents > 0:
+            totalNumber += ConfigFlags.Exec.SkipEvents
+
+        InitialTimeStamp = ConfigFlags.IOVDb.RunToTimestampDict.get(DataRunNumber, 1) # TODO fix repeated configuration
+
+        FirstLB = 1
+        Modifiers += add_modifier(run_nbr=DataRunNumber, lbk_nbr=FirstLB, time_stamp=InitialTimeStamp, nevts=totalNumber)
+    elif ConfigFlags.Input.RunNumber:
+        # Behaviour for Simulation jobs. For standard Simulation we
+        # override the run number once per job. TODO Still need to deal with the specific case of DataOverlay
+        myRunNumber = ConfigFlags.Input.RunNumber[0]
+        assert myRunNumber >= 0, (
+            "ConfigFlags.Input.RunNumber[0] %d is negative. "
+            "Use a real run number from data." % myRunNumber)
+        myFirstLB = ConfigFlags.Input.LumiBlockNumber[0]
+        myInitialTimeStamp = ConfigFlags.Input.TimeStamp[0]
+
+        # Using event numbers to avoid "some very large number" setting
+        totalNumber = 1000000
+        if ConfigFlags.Exec.MaxEvents > 0:
+            totalNumber = ConfigFlags.Exec.MaxEvents + 1
+        if ConfigFlags.Exec.SkipEvents > 0:
+            totalNumber += ConfigFlags.Exec.SkipEvents
+        Modifiers += add_modifier(run_nbr=myRunNumber, lbk_nbr=myFirstLB, time_stamp=myInitialTimeStamp, nevts=totalNumber)
+    return Modifiers
+
+
+def getMinMaxRunNumbers(ConfigFlags):
+    """Get a pair (firstrun,lastrun + 1) for setting ranges in IOVMetaData """
+    mini = 1
+    maxi = 2147483647
+    pDicts = ConfigFlags.Input.RunAndLumiOverrideList
+    if pDicts:
+        # Behaviour for Digitization jobs using RunAndLumiOverrideList
+        allruns = [element['run'] for element in pDicts]
+        mini = min(allruns) + 0
+        maxi = max(allruns) + 1
+    elif ConfigFlags.Digitization.DataRunNumber>0:
+        # Behaviour for Digitization jobs using DataRunNumber
+        DataRunNumber = ConfigFlags.Digitization.DataRunNumber
+        assert DataRunNumber >= 0, (
+            "ConfigFlags.Digitization.DataRunNumber %d is negative. "
+            "Use a real run number from data." % DataRunNumber)
+        mini = DataRunNumber
+        maxi = DataRunNumber+1
+    elif ConfigFlags.Input.RunNumber:
+        # Behaviour for Simulation jobs
+        myRunNumber = ConfigFlags.Input.RunNumber[0]
+        assert myRunNumber >= 0, (
+            "ConfigFlags.Input.RunNumber[0] %d is negative. "
+            "Use a real run number from data." % myRunNumber)
+        mini = myRunNumber
+        maxi = 2147483647
+    return (mini,maxi)
+
+
+def EvtIdModifierSvcCfg(ConfigFlags, name="EvtIdModifierSvc", **kwargs):
+    acc = ComponentAccumulator()
+    if ConfigFlags.Digitization.Pileup or ConfigFlags.Sim.DoFullChain:
+        kwargs.setdefault("EvtStoreName", "OriginalEvent_SG")
+    else:
+        kwargs.setdefault("EvtStoreName", "StoreGateSvc")
+
+    Modifiers = buildListOfModifiers(ConfigFlags)
+    if len(Modifiers) > 0:
+        kwargs.setdefault("Modifiers", Modifiers)
+    acc.addService(CompFactory.EvtIdModifierSvc(name, **kwargs), create=True)
+    iovDbMetaDataTool = CompFactory.IOVDbMetaDataTool()
+    iovDbMetaDataTool.MinMaxRunNumbers = getMinMaxRunNumbers(ConfigFlags)
+    acc.addPublicTool(iovDbMetaDataTool)
+    return acc
diff --git a/Control/AthenaMPTools/src/EvtRangeProcessor.cxx b/Control/AthenaMPTools/src/EvtRangeProcessor.cxx
index d9d8f01cabd84c8626dafea7d8a4e607701a9c51..c931f4f75b3defd948bba1ebd9a9728c810f2eb2 100644
--- a/Control/AthenaMPTools/src/EvtRangeProcessor.cxx
+++ b/Control/AthenaMPTools/src/EvtRangeProcessor.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 "EvtRangeProcessor.h"
@@ -47,6 +47,7 @@ EvtRangeProcessor::EvtRangeProcessor(const std::string& type
   , m_isPileup(false)
   , m_rankId(-1)
   , m_nEventsBeforeFork(0)
+  , m_activeWorkers(0)
   , m_inpFile("")
   , m_chronoStatSvc("ChronoStatSvc", name)
   , m_incidentSvc("IncidentSvc", name)
@@ -120,6 +121,7 @@ int EvtRangeProcessor::makePool(int, int nprocs, const std::string& topdir)
   }
 
   m_nprocs = (nprocs==-1?sysconf(_SC_NPROCESSORS_ONLN):nprocs);
+  m_activeWorkers = m_nprocs;
   m_subprocTopDir = topdir;
 
   // Create rank queue and fill it
@@ -236,6 +238,15 @@ StatusCode EvtRangeProcessor::wait_once(pid_t& pid)
 	return StatusCode::FAILURE;
       }
     }
+    else {
+      // The worker finished successfully and it was the last worker. Release the Event Range Scatterer
+      if(--m_activeWorkers==0
+	 && !m_sharedFailedPidQueue->send_basic<pid_t>(-1)) {
+	// To Do: how to report this error to the pilot?
+	ATH_MSG_ERROR("Failed to release the Event Range Scatterer");
+	return StatusCode::FAILURE;
+      }
+    }
 
     // Erase the pid from m_procStates map
     m_procStates.erase(itProcState);
diff --git a/Control/AthenaMPTools/src/EvtRangeProcessor.h b/Control/AthenaMPTools/src/EvtRangeProcessor.h
index 82b8268489d2fa780bf2968fdd25662379bbff50..ea997db121234623251205a380860d7d6ef76266 100644
--- a/Control/AthenaMPTools/src/EvtRangeProcessor.h
+++ b/Control/AthenaMPTools/src/EvtRangeProcessor.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 ATHENAMPTOOLS_EVTRANGEPROCESSOR_H
@@ -66,6 +66,7 @@ class EvtRangeProcessor final : public AthenaMPToolBase
   bool m_isPileup;        // Are we doing pile-up digitization?
   int  m_rankId;          // Each worker has its own unique RankID from the range (0,...,m_nprocs-1) 
   int  m_nEventsBeforeFork;
+  int  m_activeWorkers;   // Keep track of the number of workers
   std::string m_inpFile;  // Cached name of the input file. To avoid reopening
 
   ServiceHandle<IChronoStatSvc>     m_chronoStatSvc;
diff --git a/Control/AthenaMPTools/src/EvtRangeScatterer.cxx b/Control/AthenaMPTools/src/EvtRangeScatterer.cxx
index 0c3da82ad342ddadc5605c62fe4293011c84b817..e40a15b132da6e9ebd54ea19741b681e11280d68 100644
--- a/Control/AthenaMPTools/src/EvtRangeScatterer.cxx
+++ b/Control/AthenaMPTools/src/EvtRangeScatterer.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 "EvtRangeScatterer.h"
@@ -23,8 +23,8 @@
 #include <cstdlib>
 
 EvtRangeScatterer::EvtRangeScatterer(const std::string& type
-			       , const std::string& name
-			       , const IInterface* parent)
+				     , const std::string& name
+				     , const IInterface* parent)
   : AthenaMPToolBase(type,name,parent)
   , m_processorChannel("")
   , m_eventRangeChannel("")
@@ -212,6 +212,7 @@ std::unique_ptr<AthenaInterprocess::ScheduledWork> EvtRangeScatterer::exec_func(
   std::string strReady("Ready for events");
   std::string strStopProcessing("No more events");
   std::string processorWaitRequest("");
+  int workerPid{-1};
 
   ATH_MSG_INFO("Starting main loop");
 
@@ -225,6 +226,12 @@ std::unique_ptr<AthenaInterprocess::ScheduledWork> EvtRangeScatterer::exec_func(
 	usleep(1000);
       }
       ATH_MSG_INFO("One of the processors is ready for the next range");
+      // Get PID from the request and Update m_pid2RangeID
+      workerPid = std::atoi(processorWaitRequest.c_str());
+      auto it = m_pid2RangeID.find(workerPid);
+      if(it!=m_pid2RangeID.end()) {
+	m_pid2RangeID.erase(it);
+      }
     }    
 
     // Signal the Pilot that AthenaMP is ready for event processing
@@ -239,7 +246,7 @@ std::unique_ptr<AthenaInterprocess::ScheduledWork> EvtRangeScatterer::exec_func(
       eventRange = eventRange.substr(0,carRet);
 
     // Break the loop if no more ranges are expected
-    if(eventRange.compare(strStopProcessing)==0) {
+    if(eventRange.find(strStopProcessing)!=std::string::npos) {
       ATH_MSG_INFO("Stopped the loop. Last message from the Event Range Channel: " << eventRange);
       break;
     }
@@ -335,6 +342,12 @@ std::unique_ptr<AthenaInterprocess::ScheduledWork> EvtRangeScatterer::exec_func(
 	usleep(1000);
       }
       ATH_MSG_INFO("One of the processors is ready for the next range");
+      // Get PID from the request and Update m_pid2RangeID
+      workerPid = std::atoi(processorWaitRequest.c_str());
+      auto it = m_pid2RangeID.find(workerPid);
+      if(it!=m_pid2RangeID.end()) {
+	m_pid2RangeID.erase(it);
+      }
     }
     
     // Send to the Processor: RangeID,evtToken[,evtToken] 
@@ -344,8 +357,7 @@ std::unique_ptr<AthenaInterprocess::ScheduledWork> EvtRangeScatterer::exec_func(
     procReportPending++;
 
     // Get PID from the request and Update m_pid2RangeID
-    int pid = std::atoi(processorWaitRequest.c_str());
-    m_pid2RangeID[pid] = rangeID;
+    m_pid2RangeID[workerPid] = rangeID;
     processorWaitRequest.clear();
 
     ATH_MSG_INFO("Sent response to the processor : " << message2ProcessorStr);
@@ -360,29 +372,32 @@ std::unique_ptr<AthenaInterprocess::ScheduledWork> EvtRangeScatterer::exec_func(
       // We already have one processor waiting for the answer
       emptyMess4Processor = malloc(1);
       socket2Processor->send(emptyMess4Processor,1);
-      ATH_MSG_INFO("Set one processor free");
+      ATH_MSG_INFO("Set worker PID=" << workerPid << " free");
+      processorWaitRequest.clear();
     }
-    for(int i(0); i<(processorWaitRequest.empty()?m_nprocs:m_nprocs-1); ++i) {
+    bool endLoop{false};
+    while(true) {
       ATH_MSG_DEBUG("Going to set another processor free");
-      while(getNewRangeRequest(socket2Processor,socket2Pilot,procReportPending).empty()) {
-	pollFailedPidQueue(sharedFailedPidQueue,socket2Pilot,procReportPending);
+      while(processorWaitRequest.empty()) {
+	processorWaitRequest = getNewRangeRequest(socket2Processor,socket2Pilot,procReportPending);
+	if(pollFailedPidQueue(sharedFailedPidQueue,socket2Pilot,procReportPending)==-1) {
+	  endLoop = true;
+	  break;
+	}
 	usleep(1000);
       }
+      if(endLoop) break;
+      // Remove worker from m_pid2RangeID
+      workerPid = std::atoi(processorWaitRequest.c_str());
+      auto it = m_pid2RangeID.find(workerPid);
+      if(it!=m_pid2RangeID.end()) {
+	m_pid2RangeID.erase(it);
+      }
       emptyMess4Processor = malloc(1);
       socket2Processor->send(emptyMess4Processor,1);
-      ATH_MSG_INFO("Set one processor free");
-    }
-
-    ATH_MSG_INFO("Still " << procReportPending << " pending reports");
-    
-    // Final round of colecting output file names from processors
-    while(procReportPending>0) {
-      std::string strProcessorRequest = getNewRangeRequest(socket2Processor,socket2Pilot,procReportPending);
-      if(!strProcessorRequest.empty()) {
-	ATH_MSG_WARNING("Unexpected message received from a processor at this stage : " << strProcessorRequest);
-      }
-      pollFailedPidQueue(sharedFailedPidQueue,socket2Pilot,procReportPending);
-      usleep(1000);
+      ATH_MSG_INFO("Set worker PID=" << workerPid << " free");
+      ATH_MSG_INFO("Still " << procReportPending << " pending reports");
+      processorWaitRequest.clear();
     }
   }
 
@@ -509,22 +524,26 @@ std::string EvtRangeScatterer::getNewRangeRequest(yampl::ISocket* socket2Process
   return strProcessorRequest;
 }
 
-void EvtRangeScatterer::pollFailedPidQueue(AthenaInterprocess::SharedQueue*  sharedFailedPidQueue
-					, yampl::ISocket* socket2Pilot
-					, int& procReportPending)
+pid_t EvtRangeScatterer::pollFailedPidQueue(AthenaInterprocess::SharedQueue* sharedFailedPidQueue
+					    , yampl::ISocket* socket2Pilot
+					    , int& procReportPending)
 {
-  pid_t pid;
-  if(sharedFailedPidQueue->try_receive_basic<pid_t>(pid)) {
+  pid_t pid{0};
+  if(sharedFailedPidQueue->try_receive_basic<pid_t>(pid)
+     && pid!=-1) {
     ATH_MSG_INFO("Procesor with PID=" << pid << " has failed!");
-    if(m_pid2RangeID.find(pid)!=m_pid2RangeID.end()) {
+    auto itPid = m_pid2RangeID.find(pid);
+    if(itPid!=m_pid2RangeID.end()) {
       ATH_MSG_WARNING("The failed RangeID = " << m_pid2RangeID[pid] << " will be reported to Pilot");
 
       std::string errorStr("ERR_ATHENAMP_PROCESS " + m_pid2RangeID[pid] + ": Failed to process event range");
       void* errorMessage = malloc(errorStr.size());
       memcpy(errorMessage,errorStr.data(),errorStr.size());
       socket2Pilot->send(errorMessage,errorStr.size());
+      --procReportPending;
+      m_pid2RangeID.erase(pid);
     }
-    procReportPending--;
     ATH_MSG_INFO("Reports pending: " << procReportPending);
   } 
+  return pid;
 }
diff --git a/Control/AthenaMPTools/src/EvtRangeScatterer.h b/Control/AthenaMPTools/src/EvtRangeScatterer.h
index b7b40e03f13db840ddbb7cca59005f2a15a9dca7..2b8a617e6dc3c5db5ae2d8d6a452f77660fa66c2 100644
--- a/Control/AthenaMPTools/src/EvtRangeScatterer.h
+++ b/Control/AthenaMPTools/src/EvtRangeScatterer.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 ATHENAMPTOOLS_TOKENSCATTERER_H
@@ -56,9 +56,9 @@ class EvtRangeScatterer final : public AthenaMPToolBase
 				 , int& procReportPending);
 
   // Poll the failed PID queue to see if any of the Processors has failed
-  void pollFailedPidQueue(AthenaInterprocess::SharedQueue*  sharedFailedPidQueue
-			  , yampl::ISocket* socket2Pilot
-			  , int& procReportPending);
+  pid_t pollFailedPidQueue(AthenaInterprocess::SharedQueue*  sharedFailedPidQueue
+			   , yampl::ISocket* socket2Pilot
+			   , int& procReportPending);
 
   StringProperty           m_processorChannel;
   StringProperty           m_eventRangeChannel;
diff --git a/Control/AthenaPython/CMakeLists.txt b/Control/AthenaPython/CMakeLists.txt
index 460c29c03f8317b7b19d6a67d53f07553d71b1cb..d4d3634330401e20ca0c7e5c0ac41049639d152d 100644
--- a/Control/AthenaPython/CMakeLists.txt
+++ b/Control/AthenaPython/CMakeLists.txt
@@ -7,6 +7,7 @@ atlas_subdir( AthenaPython )
 find_package( Python COMPONENTS Development )
 find_package( ROOT COMPONENTS Core PyROOT ROOTTPython
    cppyy${Python_VERSION_MAJOR}_${Python_VERSION_MINOR} )
+find_package( future )
 
 # Component(s) in the package:
 atlas_add_library( AthenaPython
diff --git a/Control/CxxUtils/CxxUtils/ConcurrentRangeMap.h b/Control/CxxUtils/CxxUtils/ConcurrentRangeMap.h
index b4aaaef30ceeedca30744ec356b91638a8894281..b7b0a3c8292862c2aa9e9bd4f6e88dc89cb2e59a 100644
--- a/Control/CxxUtils/CxxUtils/ConcurrentRangeMap.h
+++ b/Control/CxxUtils/CxxUtils/ConcurrentRangeMap.h
@@ -390,7 +390,7 @@ public:
 
   /**
    * @brief Update all range objects.
-   * @param rangeUpater Functional to call on each range object.
+   * @param rangeUpdater Functional to call on each range object.
    * @param ctx Execution context.
    *
    * This will iterate through the list of entries and call @c rangeUpdater
diff --git a/Control/CxxUtils/CxxUtils/MurmurHash2.h b/Control/CxxUtils/CxxUtils/MurmurHash2.h
index f07a1e86b92b6dcddc2f35764665f46c8fd7ea23..27169c86d279e0165b62516a0309d6a121ad1560 100644
--- a/Control/CxxUtils/CxxUtils/MurmurHash2.h
+++ b/Control/CxxUtils/CxxUtils/MurmurHash2.h
@@ -1,7 +1,4 @@
 // 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
-*/
 /*
  * Public domain; see below.
  */
@@ -21,7 +18,7 @@
 
 //-----------------------------------------------------------------------------
 // MurmurHash2 was written by Austin Appleby, and is placed in the public
-
+// domain. The author hereby disclaims copyright to this source code.
 
 //-----------------------------------------------------------------------------
 // Platform-specific functions and macros
diff --git a/Control/CxxUtils/Root/MurmurHash2.cxx b/Control/CxxUtils/Root/MurmurHash2.cxx
index 64d27e4a11857983c5d298e2edb52bad07347586..4311c5b2a00e11f9e7282b00d041d5822a863799 100644
--- a/Control/CxxUtils/Root/MurmurHash2.cxx
+++ b/Control/CxxUtils/Root/MurmurHash2.cxx
@@ -1,6 +1,3 @@
-/*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-*/
 /*
  * Public domain; see below.
  */
@@ -16,6 +13,7 @@
 
 //-----------------------------------------------------------------------------
 // MurmurHash2 was written by Austin Appleby, and is placed in the public
+// domain. The author hereby disclaims copyright to this source code.
 
 // Note - This code makes a few assumptions about how your machine behaves -
 
diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx
index bd14c1b9e88c3ac564aea0d78ff255503fcc4b38..59cafdc5ecef4adf6ce329dbbf5af9daa6e39d85 100644
--- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx
+++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx
@@ -13,10 +13,15 @@
 // PerfMonComps includes
 #include "PerfMonMTSvc.h"
 #include "PerfMonUtils.h"  // borrow from existing code
+#include "SemiDetMisc.h"   // borrow from existing code
 
 // STD includes
 #include <algorithm>
 
+// Boost includes
+#include "boost/format.hpp"
+#include "boost/filesystem.hpp"
+
 /*
  * Constructor
  */
@@ -137,7 +142,7 @@ void PerfMonMTSvc::startAud(const std::string& stepName, const std::string& comp
     if (!m_doComponentLevelMonitoring) return;
 
     // Start component auditing
-    auto ctx = Gaudi::Hive::currentContext(); 
+    auto ctx = Gaudi::Hive::currentContext();
     startCompAud(stepName, compName, ctx);
   }
 }
@@ -155,7 +160,7 @@ void PerfMonMTSvc::stopAud(const std::string& stepName, const std::string& compN
     if (!m_doComponentLevelMonitoring) return;
 
     // Stop component auditing
-    auto ctx = Gaudi::Hive::currentContext(); 
+    auto ctx = Gaudi::Hive::currentContext();
     stopCompAud(stepName, compName, ctx);
   }
 }
@@ -207,8 +212,8 @@ void PerfMonMTSvc::startCompAud(const std::string& stepName, const std::string&
   // Generate State
   PMonMT::StepComp currentState = generate_state(stepName, compName);
 
-  // Check if this is the first time calling if so create the mesurement data if not use the existing one. 
-  // Metrics are collected per slot then aggregated before reporting 
+  // Check if this is the first time calling if so create the mesurement data if not use the existing one.
+  // Metrics are collected per slot then aggregated before reporting
   data_map_t& compLevelDataMap = m_compLevelDataMapVec[ctx.valid() ? ctx.slot() : 0];
   if(compLevelDataMap.find(currentState) == compLevelDataMap.end()) {
     compLevelDataMap[currentState] = new PMonMT::MeasurementData();
@@ -312,6 +317,33 @@ bool PerfMonMTSvc::isPower(uint64_t input, uint64_t base) {
   return (input == 1);
 }
 
+/*
+ * Helper finction to estimate CPU efficiency
+ */
+int PerfMonMTSvc::getCpuEfficiency() const {
+
+  // In AthenaMT only the event-loop is executed concurrently
+  // In this metric, we scale the event-loop wall-time by
+  // the number of slots to take the concurrency into account
+  // Then we divide the total cpu-time by this number
+  // It's A metric not THE metric...
+
+  const float totalCpuTime =
+   m_snapshotData[CONFIGURE].getDeltaCPU()  +
+   m_snapshotData[INITIALIZE].getDeltaCPU() +
+   m_snapshotData[EXECUTE].getDeltaCPU()    +
+   m_snapshotData[FINALIZE].getDeltaCPU();
+
+  const float scaledWallTime =
+   m_snapshotData[CONFIGURE].getDeltaWall()  * 1. +
+   m_snapshotData[INITIALIZE].getDeltaWall() * 1. +
+   m_snapshotData[EXECUTE].getDeltaWall()    * m_numberOfSlots +
+   m_snapshotData[FINALIZE].getDeltaWall()   * 1.;
+
+  return ( scaledWallTime > 0 ? totalCpuTime / scaledWallTime * 100. : 0 );
+
+}
+
 /*
  * Report the results to the log and the JSON file
  */
@@ -345,6 +377,7 @@ void PerfMonMTSvc::report2Log() {
   // Summary and system information
   report2Log_Summary();
   report2Log_CpuInfo();
+  report2Log_EnvInfo();
 }
 
 /*
@@ -377,7 +410,7 @@ void PerfMonMTSvc::report2Log_ComponentLevel() {
   ATH_MSG_INFO("                             Component Level Monitoring                                ");
   ATH_MSG_INFO("=======================================================================================");
 
-  ATH_MSG_INFO(format("%1% %|15t|%2% %|25t|%3% %|40t|%4% %|55t|%5% %|75t|%6%") % "Step" % "Count" % "CPU Time [ms]" % 
+  ATH_MSG_INFO(format("%1% %|15t|%2% %|25t|%3% %|40t|%4% %|55t|%5% %|75t|%6%") % "Step" % "Count" % "CPU Time [ms]" %
                "Vmem [kB]" % "Malloc [kB]" % "Component");
 
   ATH_MSG_INFO("---------------------------------------------------------------------------------------");
@@ -408,7 +441,7 @@ void PerfMonMTSvc::report2Log_ComponentLevel() {
                    it.second->getCallCount() % it.second->getDeltaCPU() % it.second->getDeltaVmem() %
                    it.second->getDeltaMalloc() % it.first.compName);
     }
-    if(counter>0) { 
+    if(counter>0) {
       ATH_MSG_INFO("=======================================================================================");
     }
   }
@@ -426,8 +459,8 @@ void PerfMonMTSvc::report2Log_EventLevel_instant() const {
   long pss = m_eventLevelData.getEventLevelPss(m_eventCounter);
   long swap = m_eventLevelData.getEventLevelSwap(m_eventCounter);
 
-  ATH_MSG_INFO("Event [" << std::setw(5) << m_eventCounter << "] CPU Time: " << scaleTime(cpu_time) << 
-               ", Wall Time: " <<  scaleTime(wall_time) << ", Vmem: " << scaleMem(vmem) << 
+  ATH_MSG_INFO("Event [" << std::setw(5) << m_eventCounter << "] CPU Time: " << scaleTime(cpu_time) <<
+               ", Wall Time: " <<  scaleTime(wall_time) << ", Vmem: " << scaleMem(vmem) <<
                ", Rss: " << scaleMem(rss) << ", Pss: " << scaleMem(pss) << ", Swap: " << scaleMem(swap));
 }
 
@@ -438,8 +471,8 @@ void PerfMonMTSvc::report2Log_EventLevel() {
   using boost::format;
 
   ATH_MSG_INFO("                                Event Level Monitoring                                 ");
-  ATH_MSG_INFO("                 (Only first " << m_eventLoopMsgLimit.toString() <<
-               " measurements are explicitly printed)");
+  ATH_MSG_INFO("        (Only the first " << m_eventLoopMsgLimit.toString() <<
+               " and the last measurements are explicitly printed)");
   ATH_MSG_INFO("=======================================================================================");
 
   ATH_MSG_INFO(format("%1% %|16t|%2% %|28t|%3% %|40t|%4% %|52t|%5% %|64t|%6% %|76t|%7%") % "Event" % "CPU [s]" %
@@ -448,14 +481,19 @@ void PerfMonMTSvc::report2Log_EventLevel() {
   ATH_MSG_INFO("---------------------------------------------------------------------------------------");
 
   m_eventLoopMsgCounter = 0; // reset counter
+  unsigned long nMeasurements = m_eventLevelData.getNMeasurements();
 
   for (const auto& it : m_eventLevelData.getEventLevelData()) {
-    if(m_eventLoopMsgCounter < m_eventLoopMsgLimit) {
+    // Print
+    if(m_eventLoopMsgCounter < m_eventLoopMsgLimit || m_eventLoopMsgCounter == nMeasurements - 1) {
+      if(m_eventLoopMsgCounter > m_eventLoopMsgLimit) {
+        ATH_MSG_INFO(format("%|=87|") % "...");
+      }
       ATH_MSG_INFO(format("%1% %|16t|%2$.2f %|28t|%3$.2f %|40t|%4% %|52t|%5% %|64t|%6% %|76t|%7%") % it.first %
                    (it.second.cpu_time * 0.001) % (it.second.wall_time * 0.001) % it.second.mem_stats.at("vmem") %
                    it.second.mem_stats.at("rss") % it.second.mem_stats.at("pss") % it.second.mem_stats.at("swap"));
-      m_eventLoopMsgCounter++;
     }
+    m_eventLoopMsgCounter++;
     // Add to leak estimate
     if (it.first >= 25) {
       m_fit_vmem.addPoint(it.first, it.second.mem_stats.at("vmem"));
@@ -471,7 +509,7 @@ void PerfMonMTSvc::report2Log_EventLevel() {
 void PerfMonMTSvc::report2Log_Summary() {
   using boost::format;
 
-  ATH_MSG_INFO("                                 Snaphots Summary                                      ");
+  ATH_MSG_INFO("                                Snapshots Summary                                      ");
   ATH_MSG_INFO("=======================================================================================");
 
   ATH_MSG_INFO(format("%1% %|13t|%2% %|25t|%3% %|37t|%4% %|44t|%5% %|55t|%6% %|66t|%7% %|77t|%8%") % "Step" %
@@ -495,6 +533,7 @@ void PerfMonMTSvc::report2Log_Summary() {
                (m_snapshotData[EXECUTE].getDeltaCPU() / m_eventCounter));
   ATH_MSG_INFO(format("%1% %|35t|%2$.3f ") % "Events per second:" %
                (m_eventCounter / m_snapshotData[EXECUTE].getDeltaWall() * 1000.));
+  ATH_MSG_INFO(format("%1% %|35t|%2% ") % "CPU utilization efficiency [%]:" % getCpuEfficiency());
 
   if (m_doEventLoopMonitoring) {
     ATH_MSG_INFO("***************************************************************************************");
@@ -523,10 +562,28 @@ void PerfMonMTSvc::report2Log_CpuInfo() const {
 
   ATH_MSG_INFO(format("%1% %|34t|%2% ") % "CPU Model:" % get_cpu_model_info());
   ATH_MSG_INFO(format("%1% %|35t|%2% ") % "Number of Available Cores:" % get_cpu_core_info());
+  ATH_MSG_INFO(format("%1% %|35t|%2% ") % "Total Memory:" % scaleMem(get_memory_info()));
 
   ATH_MSG_INFO("=======================================================================================");
 }
 
+/*
+ * Report run-time enviroment information
+ */
+void PerfMonMTSvc::report2Log_EnvInfo() const {
+  using boost::format;
+  using boost::filesystem::path;
+
+  ATH_MSG_INFO("                               Environment Information                                 ");
+  ATH_MSG_INFO("=======================================================================================");
+
+  ATH_MSG_INFO(format("%1% %|35t|%2% ") % "Malloc Library:" % path(PMonSD::symb2lib("malloc")).filename().string());
+  ATH_MSG_INFO(format("%1% %|35t|%2% ") % "Math Library:" % path(PMonSD::symb2lib("atan2")).filename().string());
+
+  ATH_MSG_INFO("=======================================================================================");
+
+}
+
 /*
  * Report data to JSON
  */
@@ -569,7 +626,7 @@ void PerfMonMTSvc::report2JsonFile() {
  * Report summary data to JSON
  */
 void PerfMonMTSvc::report2JsonFile_Summary(nlohmann::json& j) const {
-  
+
   // Report snapshot level results
   for(int i=0; i < NSNAPSHOTS; i++){
 
@@ -617,29 +674,43 @@ void PerfMonMTSvc::report2JsonFile_Summary(nlohmann::json& j) const {
   // Report Sys info
   const std::string cpuModel = get_cpu_model_info();
   const int coreNum = get_cpu_core_info();
+  const long totMem = get_memory_info();
 
   j["summary"]["sysInfo"] = {{"cpuModel", cpuModel},
-                             {"coreNum", coreNum}};
+                             {"coreNum", coreNum},
+                             {"totMem", totMem}};
+
+  // Report Enviroment info
+  const std::string mallocLib = boost::filesystem::path(PMonSD::symb2lib("malloc")).filename().string();
+  const std::string mathLib = boost::filesystem::path(PMonSD::symb2lib("atan2")).filename().string();
+
+  j["summary"]["envInfo"] = {{"mallocLib", mallocLib},
+                             {"mathLib", mathLib}};
+
+  // Report CPU utilization efficiency;
+  const int cpuUtilEff = getCpuEfficiency();
+  j["summary"]["misc"] = {{"cpuUtilEff", cpuUtilEff}};
+
 }
 
 void PerfMonMTSvc::report2JsonFile_ComponentLevel(nlohmann::json& j) const {
 
   for (const auto& dataMapPerStep : m_stdoutVec_serial) {
-    
+
     for(const auto& meas : dataMapPerStep){
 
       const std::string step = meas.first.stepName;
-      const std::string component = meas.first.compName; 
+      const std::string component = meas.first.compName;
       const uint64_t count = meas.second->getCallCount();
       const double cpuTime = meas.second->getDeltaCPU();
-      const long vmem  = meas.second->getDeltaVmem(); 
+      const long vmem  = meas.second->getDeltaVmem();
       const int mall = meas.second->getDeltaMalloc();
 
       j["componentLevel"][step][component] = {{"count", count},
                                               {"cpuTime", cpuTime},
                                               {"vmem", vmem},
                                               {"malloc", mall}};
-    }    
+    }
 
   }
 
@@ -648,7 +719,7 @@ void PerfMonMTSvc::report2JsonFile_ComponentLevel(nlohmann::json& j) const {
 void PerfMonMTSvc::report2JsonFile_EventLevel(nlohmann::json& j) const {
 
   for (const auto& it : m_eventLevelData.getEventLevelData()) {
-    
+
     const uint64_t event = it.first;
     const double cpuTime = it.second.cpu_time;
     const double wallTime = it.second.wall_time;
@@ -724,7 +795,7 @@ void PerfMonMTSvc::divideData2Steps() {
 std::string PerfMonMTSvc::scaleTime(double timeMeas) const {
   // Not a huge fan of this, we should eventually unify the types
   // Just want to be explicit about what's happening
-  long ms = (long) timeMeas; 
+  long ms = (long) timeMeas;
 
   // Compute hrs and offset
   auto hrs = ms / 3600000;
@@ -739,13 +810,18 @@ std::string PerfMonMTSvc::scaleTime(double timeMeas) const {
   // Primarily care about H:M:S
   std::stringstream ss;
   ss.fill('0');
-  ss << std::setw(2) << hrs << "h" << 
-        std::setw(2) << mins << "m" << 
+  ss << std::setw(2) << hrs << "h" <<
+        std::setw(2) << mins << "m" <<
         std::setw(2) << secs << "s";
   return ss.str();
 }
 
 std::string PerfMonMTSvc::scaleMem(long memMeas) const {
+  // The memory measurements should be positive
+  // Only delta(A,B) can go negative but this method
+  // is not used for those cases, at least for now
+  if (memMeas<0) return "NA";
+
   std::ostringstream ss;
   ss << std::fixed;
   ss << std::setprecision(2);
@@ -789,43 +865,48 @@ std::string PerfMonMTSvc::scaleMem(long memMeas) const {
 /*
  * Collect some hardware information
  */
-std::string PerfMonMTSvc::get_cpu_model_info() const {
-  std::string cpu_model;
-
-  std::ifstream file("/proc/cpuinfo");
-  std::string line;
-  if (file.is_open()) {
-    std::string delimiter = ":";
-    while (getline(file, line)) {
-      std::string key = line.substr(0, line.find(delimiter));
-      if (key == "model name	") {
-        cpu_model = line.substr(line.find(delimiter) + 1, line.length());
-        break;
+std::string PerfMonMTSvc::get_info_from_file(const std::string& fileName,
+                                             const std::string& fieldName) const {
+  // Helper function to read files of type Key : Value
+  // Returns the last instance if there are multiple matches
+  // This is because we use this method to get the processor count
+  std::string result{""};
+
+  std::ifstream file{fileName};
+  std::string line{""};
+
+  while (std::getline(file, line)) {
+    if (line.empty()) continue;
+    size_t splitIdx = line.find(":");
+    if (splitIdx != std::string::npos) {
+      std::string val = line.substr(splitIdx + 1);
+      if (val.empty()) continue;
+      if (line.size() >= fieldName.size() &&
+          line.compare(0, fieldName.size(), fieldName) == 0) {
+        result = val;
       }
     }
-    file.close();
-    return cpu_model;
-  } else {
-    return "Unable to open /proc/cpuinfo";
   }
+
+  file.close();
+
+  return result;
+}
+
+std::string PerfMonMTSvc::get_cpu_model_info() const {
+  return get_info_from_file("/proc/cpuinfo","model name") +
+         get_info_from_file("/proc/cpuinfo","cache size");
 }
 
 int PerfMonMTSvc::get_cpu_core_info() const {
-  int logical_core_num = 0;
-
-  std::ifstream file("/proc/cpuinfo");
-  std::string line;
-  if (file.is_open()) {
-    std::string delimiter = ":";
-    while (getline(file, line)) {
-      std::string key = line.substr(0, line.find(delimiter));
-      if (key == "processor	") {
-        logical_core_num++;
-      }
-    }
-    file.close();
-    return logical_core_num;
-  } else {
-    return -1;
-  }
+  std::string val = get_info_from_file("/proc/cpuinfo","processor");
+  if (val.empty()) return 0;
+  return std::stoi(val) + 1;
+}
+
+long PerfMonMTSvc::get_memory_info() const {
+  std::string val = get_info_from_file("/proc/meminfo","MemTotal");
+  if (val.empty()) return 0;
+  val = val.substr(0, val.size() - 3);  // strip the trailing kB
+  return std::stol(val);
 }
diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h
index d825d8a6a1b282488a3ff80001ffbe350a62f500..b432a7484918ea7c8aea91cd5c5c8cae30375edf 100644
--- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h
+++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h
@@ -28,8 +28,6 @@
 #include <iomanip>
 #include <nlohmann/json.hpp>
 
-#include "boost/format.hpp"
-
 // Other Libraries
 #include <algorithm>
 #include <cmath>
@@ -86,6 +84,7 @@ class PerfMonMTSvc : virtual public IPerfMonMTSvc, virtual public IIncidentListe
   void report2Log_EventLevel();
   void report2Log_Summary();  // make it const
   void report2Log_CpuInfo() const;
+  void report2Log_EnvInfo() const;
 
   /// Report to the JSON File
   void report2JsonFile();
@@ -104,8 +103,12 @@ class PerfMonMTSvc : virtual public IPerfMonMTSvc, virtual public IIncidentListe
 
   bool isCheckPoint();
 
+  /// A few helper methods to get system information
+  /// These should be carried to PerfMonMTUtils at some point
+  std::string get_info_from_file(const std::string& fileName, const std::string& fieldName) const;
   std::string get_cpu_model_info() const;
   int get_cpu_core_info() const;
+  long get_memory_info() const;
 
   PMonMT::StepComp generate_state(const std::string& stepName, const std::string& compName) const;
 
@@ -196,6 +199,9 @@ class PerfMonMTSvc : virtual public IPerfMonMTSvc, virtual public IIncidentListe
   PerfMon::LinFitSglPass m_fit_vmem;
   PerfMon::LinFitSglPass m_fit_pss;
 
+  // Estimate CPU efficiency
+  int getCpuEfficiency() const;
+
 };  // class PerfMonMTSvc
 
 #endif  // PERFMONCOMPS_PERFMONMTSVC_H
diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTUtils.h b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTUtils.h
index 2b592779bd74a260f3e934ad866936450b5f584d..26b0cdb49c0730ca1dc988634b35109dcb7296a8 100644
--- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTUtils.h
+++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTUtils.h
@@ -191,6 +191,8 @@ struct MeasurementData {
 
   event_meas_map_t getEventLevelData() const { return m_eventLevel_delta_map; }
 
+  unsigned long getNMeasurements() const { return m_eventLevel_delta_map.size(); }
+
   double getEventLevelCpuTime(unsigned long long event_count) const {
     return m_eventLevel_delta_map.at(event_count).cpu_time;
   }
diff --git a/Control/SGTools/src/DataStore.cxx b/Control/SGTools/src/DataStore.cxx
index d7e596184fb368da9ba7d40bc25b212a6e792d9d..125bf7a485f4cac2c772ecb60188e7fdf01e268f 100755
--- a/Control/SGTools/src/DataStore.cxx
+++ b/Control/SGTools/src/DataStore.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 "SGTools/DataStore.h"
@@ -208,12 +208,17 @@ DataStore::removeProxy(DataProxy* proxy, bool forceRemove, bool hard)
     int index = it->second.first;
     sc = StatusCode::SUCCESS;
 
+    // Remove primary entry.
     m_keyMap.erase (it);
     if (storeIter != m_storeMap.end()) {
       if (1 == storeIter->second.erase(name)) {
         proxy->release();
       }
     }
+    else {
+      // A dummy proxy.
+      proxy->release();
+    }
 
     // Remove all symlinks too.
     for (CLID symclid : clids) 
diff --git a/Control/SGTools/test/DataStore_test.cxx b/Control/SGTools/test/DataStore_test.cxx
index ce081b63da65389d5c81a2cd9bd4c8851113ffe9..2223c6dc42755a78c549fafc33090e7b7fd30447 100644
--- a/Control/SGTools/test/DataStore_test.cxx
+++ b/Control/SGTools/test/DataStore_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 DataStore_test.cxx
  * @author scott snyder <snyder@bnl.gov>
@@ -512,6 +510,24 @@ void test_dummy ATLAS_NOT_THREAD_SAFE ()
   assert (dp2->clID() == 456);
   assert (dp2->name() == "dp2");
   assert (dp2->refCount() == 1);
+
+  SG::StringPool::sgkey_t sgkey3 = pool.stringToKey ("dp3", 456);
+  SG::DataProxy* dp3 = make_proxy (0, "", sgkey3);
+  assert (store.addToStore (0, dp3).isSuccess());
+  assert (dp3->refCount() == 1);
+  assert (store.proxy_exact (sgkey3) == dp3);
+
+  dp1->addRef();
+  dp2->addRef();
+  dp3->addRef();
+  assert (dp1->refCount() == 2);
+  assert (dp2->refCount() == 2);
+  assert (dp3->refCount() == 2);
+
+  store.clearStore (true, false, nullptr);
+  assert (dp1->refCount() == 1);
+  assert (dp2->refCount() == 1);
+  assert (dp3->refCount() == 1);
 }
 
 
diff --git a/Control/StoreGateBindings/python/Bindings.py b/Control/StoreGateBindings/python/Bindings.py
index 07d8c9b46fd535518d3ff5fd6992be3c07a04fb1..9797e0490a0b5680d9a634963ee8259d10f35c4c 100644
--- a/Control/StoreGateBindings/python/Bindings.py
+++ b/Control/StoreGateBindings/python/Bindings.py
@@ -85,7 +85,7 @@ def _setup():
             ret = py_sg_getitem(self, str(key).encode())
         except LookupError as err:
             raise KeyError(str(err))
-        if ret and hasattr(ret,'setStore') and not ret.hasStore():
+        if ret and hasattr(ret,'setStore') and hasattr(ret,'hasStore') and not ret.hasStore():
             if not hasattr(ret,'trackIndices') or ret.trackIndices():
                 if py_sg_contains (self, 'SG::IConstAuxStore', key + 'Aux.'):
                     aux = py_retrieve (self, 'SG::IConstAuxStore', key + 'Aux.')
diff --git a/Control/xAODRootAccess/Root/Init.cxx b/Control/xAODRootAccess/Root/Init.cxx
index 2b0f02b4374b66cdf588af0ed0e83978701c3f55..3375db647492e61f2a104b5b2bf68d15c7c1be15 100644
--- a/Control/xAODRootAccess/Root/Init.cxx
+++ b/Control/xAODRootAccess/Root/Init.cxx
@@ -74,7 +74,8 @@ namespace xAOD {
             "xAOD::TauJet_v1",
             "xAOD::PFO_v1",
             "xAOD::TrigElectron_v1",
-            "xAOD::L2CombinedMuon_v1"}) {
+            "xAOD::L2CombinedMuon_v1",
+            "xAOD::Particle_v1"}) {
         // silently ignore missing classes, because this gets used in
         // all projects, and not all projects contain all xAOD classes
         static constexpr Bool_t LOAD = kTRUE;
diff --git a/Database/APR/RootStorageSvc/src/RootTreeContainer.h b/Database/APR/RootStorageSvc/src/RootTreeContainer.h
index 106e01a0dab679736d7107869324cf289c176efb..cc72b055ed769e3f75e087f041c4e922a34d4758 100755
--- a/Database/APR/RootStorageSvc/src/RootTreeContainer.h
+++ b/Database/APR/RootStorageSvc/src/RootTreeContainer.h
@@ -18,6 +18,7 @@
 // Framework include files
 #include "StorageSvc/DbDatabase.h"
 #include "StorageSvc/DbContainerImp.h"
+#include "RootAuxDynIO/RootAuxDynIO.h"
 
 #include <map>
 #include <vector>
@@ -72,7 +73,7 @@ namespace pool  {
       // extra variables used by Aux dynamic
       size_t            rows_written = 0;
       // AuxDyn reader if used by this branch
-      IRootAuxDynReader*aux_reader = nullptr;
+      std::unique_ptr<IRootAuxDynReader> aux_reader;
       int               aux_iostore_IFoffset = -1;
       bool              is_basic_type = false;
       bool              written = false;
diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py b/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py
index de15a350b0e8945e522dd06ac2f2268a2ae3323a..8779b2921140672bfffeb0aa8187ef9381036860 100644
--- a/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py
+++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py
@@ -2,6 +2,50 @@
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
+from AthenaKernel.EventIdOverrideConfig import EvtIdModifierSvcCfg
+
+def EventSelectorAthenaPoolCfg(configFlags):
+    result=ComponentAccumulator()
+    EventSelectorAthenaPool=CompFactory.EventSelectorAthenaPool
+    evSel=EventSelectorAthenaPool("EventSelector",
+                                  InputCollections = configFlags.Input.Files,
+                                  SkipEvents=configFlags.Exec.SkipEvents)
+    if configFlags.Input.OverrideRunNumber:
+        if not configFlags.Input.RunAndLumiOverrideList:
+            DataRunNumber = -1
+            FirstLB = 1
+            InitialTimeStamp = 1
+            OldRunNumber = -1
+            if configFlags.Digitization.DataRunNumber>0:
+                # Behaviour for Digitization jobs using DataRunNumber
+                DataRunNumber = configFlags.Digitization.DataRunNumber
+                FirstLB = 1
+                InitialTimeStamp = configFlags.IOVDb.RunToTimestampDict.get(DataRunNumber, 1) # TODO fix repeated configuration
+                if not configFlags.Sim.DoFullChain:
+                    OldRunNumber = configFlags.Input.RunNumber[0] # CHECK this should be the Run Number from the HITS file
+            elif configFlags.Input.RunNumber:
+                # Behaviour for Simulation jobs
+                DataRunNumber = configFlags.Input.RunNumber[0]
+                FirstLB = configFlags.Input.LumiBlockNumber[0]
+                InitialTimeStamp = configFlags.Input.TimeStamp[0]
+            assert DataRunNumber >= 0, (
+                "configFlags.Input.OverrideRunNumber was True, but provided DataRunNumber (%d) is negative. "
+                "Use a real run number from data." % DataRunNumber)
+            evSel.OverrideRunNumber = configFlags.Input.OverrideRunNumber
+            evSel.RunNumber = DataRunNumber
+            evSel.FirstLB = FirstLB
+            evSel.InitialTimeStamp = InitialTimeStamp # Necessary to avoid a crash
+            if hasattr(evSel, "OverrideRunNumberFromInput"):
+                evSel.OverrideRunNumberFromInput = configFlags.Input.OverrideRunNumber
+            if OldRunNumber > 0:
+                evSel.OldRunNumber = OldRunNumber
+        else:
+            # Behaviour for Digitization jobs using RunAndLumiOverrideList
+            pass
+        result.merge(EvtIdModifierSvcCfg(configFlags))
+    result.addService(evSel)
+    return result
+
 
 def PoolReadCfg(configFlags):
     """
@@ -70,17 +114,15 @@ def PoolReadCfg(configFlags):
                                                    IsSecondary=True,
                                                    InputCollections=filenamesSecondary)
             result.addService(secondarySel)
+        result.addService(evSel)
     else:
         # We have only primary inputs
         apaps=AthenaPoolAddressProviderSvc()
         result.addService(apaps)
         result.addService(ProxyProviderSvc(ProviderNames=[apaps.getFullJobOptName(),])) #No service handle yet???
+        result.merge(EventSelectorAthenaPoolCfg(configFlags))
+        evSel = result.getService("EventSelector")
 
-        evSel=EventSelectorAthenaPool("EventSelector", 
-                                      InputCollections = filenames, 
-                                      SkipEvents=configFlags.Exec.SkipEvents)
-
-    result.addService(evSel)
     result.setAppProperty("EvtSel",evSel.getFullJobOptName())
 
     #(possibly) missing: MetaDataSvc
diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx
index 51518beb0b8e2e606c9035ca0ac1d3604c3f71a9..2134f4c0206d5143858950e51956791ec7b9a0c7 100644
--- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx
+++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx
@@ -424,7 +424,7 @@ StatusCode AthenaPoolCnvSvc::commitOutput(const std::string& outputConnectionSpe
 		   && m_outputStreamingTool[m_streamServer]->isServer()) {
       auto& streamingTool = m_outputStreamingTool[m_streamServer];
       // Clear object to get Placements for all objects in a Stream
-      char* placementStr = nullptr;
+      const char* placementStr = nullptr;
       int num = -1;
       StatusCode sc = streamingTool->clearObject(&placementStr, num);
       if (sc.isSuccess() && placementStr != nullptr && strlen(placementStr) > 6 && num > 0) {
@@ -778,7 +778,7 @@ Token* AthenaPoolCnvSvc::registerForWrite(Placement* placement, const void* obj,
          return(nullptr);
       }
       // Get Token back from Server
-      char* tokenStr = nullptr;
+      const char* tokenStr = nullptr;
       int num = -1;
       sc = m_outputStreamingTool[streamClient]->clearObject(&tokenStr, num);
       while (sc.isRecoverable()) {
@@ -893,7 +893,7 @@ void AthenaPoolCnvSvc::setObjPtr(void*& obj, const Token* token) {
       }
    }
    if (!m_inputStreamingTool.empty() && m_inputStreamingTool->isClient()) {
-      ATH_MSG_VERBOSE("Requesting object for: " << token->toString());
+      ATH_MSG_VERBOSE("Requesting remote object for: " << token->toString());
       if (!m_inputStreamingTool->lockObject(token->toString().c_str()).isSuccess()) {
          ATH_MSG_ERROR("Failed to lock Data for " << token->toString());
          obj = nullptr;
@@ -979,7 +979,7 @@ StatusCode AthenaPoolCnvSvc::createAddress(long svcType,
          return(StatusCode::FAILURE);
       }
       token = new Token();
-      token->fromString(static_cast<char*>(buffer)); buffer = nullptr;
+      token->fromString(static_cast<const char*>(buffer)); buffer = nullptr;
       if (token->classID() == Guid::null()) {
          delete token; token = nullptr;
       }
@@ -1118,7 +1118,7 @@ StatusCode AthenaPoolCnvSvc::readData() {
    if (m_inputStreamingTool.empty()) {
       return(StatusCode::FAILURE);
    }
-   char* tokenStr = nullptr;
+   const char* tokenStr = nullptr;
    int num = -1;
    StatusCode sc = m_inputStreamingTool->clearObject(&tokenStr, num);
    if (sc.isSuccess() && tokenStr != nullptr && strlen(tokenStr) > 0 && num > 0) {
@@ -1200,7 +1200,7 @@ StatusCode AthenaPoolCnvSvc::abortSharedWrClients(int client_n)
       if (client_n >= 0) {
          sc = streamingTool->lockObject("ABORT", client_n);
       }
-      char* dummy;
+      const char* dummy;
       sc = streamingTool->clearObject(&dummy, client_n);
       while (sc.isRecoverable()) {
          sc = streamingTool->clearObject(&dummy, client_n);
diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AuxDiscoverySvc.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AuxDiscoverySvc.cxx
index a45a0580a3a83c880eaf70f54706fe686a1c5bde..643354ddd27f40fb52ed5b972b63035a4e3c39b0 100644
--- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AuxDiscoverySvc.cxx
+++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AuxDiscoverySvc.cxx
@@ -166,25 +166,25 @@ StatusCode AuxDiscoverySvc::receiveStore(const IAthenaSerializeSvc* serSvc, cons
       return(StatusCode::SUCCESS);
    }
    Guid classId;
-   classId.fromString(static_cast<char*>(buffer));
+   classId.fromString(static_cast<const char*>(buffer));
    if (!ipcTool->getObject(&buffer, nbytes, num).isSuccess() || nbytes == 0) {
       return(StatusCode::FAILURE);
    }
-   const std::string contName = std::string(static_cast<char*>(buffer));
+   const std::string contName = std::string(static_cast<const char*>(buffer));
    if (classId != Guid::null() && this->getAuxStore(obj, classId, contName)) {
-      void* attrName = nullptr;
-      void* typeName = nullptr;
-      void* elemName = nullptr;
+      void* nameData = nullptr;
       // StreamingTool owns buffer, will stay around until last dynamic attribute is copied
-      while (ipcTool->getObject(&attrName, nbytes, num).isSuccess() && nbytes > 0 &&
-	      ipcTool->getObject(&typeName, nbytes, num).isSuccess() && nbytes > 0 &&
-	      ipcTool->getObject(&elemName, nbytes, num).isSuccess() && nbytes > 0) {
+      while (ipcTool->getObject(&nameData, nbytes, num).isSuccess() && nbytes > 0) {
+         const char* del1 = static_cast<const char*>(memchr(nameData, '\n', nbytes));
+         const char* del2 = static_cast<const char*>(memchr(del1 + 1, '\n', nbytes - (del1 - static_cast<const char*>(nameData) - 1)));
+         const std::string dataStr(static_cast<const char*>(nameData));
+         const std::string& attrName = dataStr.substr(0, del1 - static_cast<const char*>(nameData));
+         const std::string& typeName = dataStr.substr(del1 - static_cast<const char*>(nameData) + 1, del2 - del1 - 1);
+         const std::string& elemName = dataStr.substr(del2 - static_cast<const char*>(nameData) + 1);
          if (ipcTool->getObject(&buffer, nbytes, num).isSuccess()) {
-            SG::auxid_t auxid = this->getAuxID(static_cast<char*>(attrName),
-	            static_cast<char*>(elemName),
-	            static_cast<char*>(typeName));
+            SG::auxid_t auxid = this->getAuxID(attrName, elemName, typeName);
             if (auxid != SG::null_auxid) {
-              const RootType type(std::string(static_cast<char*>(typeName)));
+              const RootType type(typeName);
               void* dynAttr = nullptr;
               if (type.IsFundamental()) {
                 dynAttr = new char[nbytes];
@@ -218,12 +218,8 @@ StatusCode AuxDiscoverySvc::sendStore(const IAthenaSerializeSvc* serSvc,
       }
    }
    for (SG::auxid_set_t::const_iterator iter = auxIDs.begin(), last = auxIDs.end(); iter != last; iter++) {
-      const std::string& attrName = this->getAttrName(*iter);
-      const std::string& typeName = this->getTypeName(*iter);
-      const std::string& elemName = this->getElemName(*iter);
-      if (!ipcTool->putObject(attrName.c_str(), attrName.size() + 1, num).isSuccess() ||
-	      !ipcTool->putObject(typeName.c_str(), typeName.size() + 1, num).isSuccess() ||
-	      !ipcTool->putObject(elemName.c_str(), elemName.size() + 1, num).isSuccess()) {
+      const std::string& dataStr = this->getAttrName(*iter) + "\n" + this->getTypeName(*iter) + "\n" + this->getElemName(*iter);
+      if (!ipcTool->putObject(dataStr.c_str(), dataStr.size() + 1, num).isSuccess()) {
          return(StatusCode::FAILURE);
       }
       const std::type_info* tip = this->getType(*iter);
diff --git a/Database/AthenaPOOL/AthenaPoolUtilities/share/post_tpcnvtest.sh b/Database/AthenaPOOL/AthenaPoolUtilities/share/post_tpcnvtest.sh
index b016ef4abbb835af4b1d273e43347ef0c9cdf57e..ffcc54830bdbb514ac911dbc24f355610b1ddbf2 100755
--- a/Database/AthenaPOOL/AthenaPoolUtilities/share/post_tpcnvtest.sh
+++ b/Database/AthenaPOOL/AthenaPoolUtilities/share/post_tpcnvtest.sh
@@ -1,8 +1,8 @@
 #!/bin/sh
 #/** @file post.sh
-# @brief sh script that check the return code of an executable and compares 
+# @brief sh script that check the return code of an executable and compares
 # its output with a reference (if available).
-# @param test_name 
+# @param test_name
 #
 # @author Paolo Calafiura <pcalafiura@lbl.gov> - ATLAS Collaboration.
 # $Id: post_check.sh,v 1.32 2009-05-06 18:10:12 ssnyder Exp $
@@ -248,11 +248,13 @@ PP="$PP"'|WARNING: new xAOD variables '
 # From MuonCondAlg.
 PP="$PP"'|Empty temporary A-line container'
 
+# Warnings from mini-projects, not holding all the EDM classes.
+PP="$PP"'|^RootAuxDynReader::init.*Could not find auxid for'
 
 test=$1
 if [ -z "$testStatus" ]; then
     echo "post.sh> Warning: athena exit status is not available "
-else 
+else
     # check exit status
     joblog=${test}.log
     if [ -r ${test}-SKIPPED ]; then
@@ -316,4 +318,3 @@ fi
 joblog=${test}.log
 
 exit $testStatus
-
diff --git a/Database/AthenaRoot/RootAuxDynIO/RootAuxDynIO/RootAuxDynIO.h b/Database/AthenaRoot/RootAuxDynIO/RootAuxDynIO/RootAuxDynIO.h
index 5fee81018ec3facdd06e197b57dcce6ae9a1e103..02c896cda5fd46435f40cd35efb93b0ffa906b17 100644
--- a/Database/AthenaRoot/RootAuxDynIO/RootAuxDynIO/RootAuxDynIO.h
+++ b/Database/AthenaRoot/RootAuxDynIO/RootAuxDynIO/RootAuxDynIO.h
@@ -29,9 +29,9 @@ namespace RootAuxDynIO {
    * @brief Crate RootAuxDynReader for a given TBranch
    * @param branch TBranch in which AuxStore objects are
 
-   Will return nullptr in case of problems
+   Will return null in case of problems
    */ 
-   IRootAuxDynReader*  getReaderForBranch(TBranch *branch);
+   std::unique_ptr<IRootAuxDynReader>  getReaderForBranch(TBranch *branch);
   
  /**
    * @brief Construct branch name for a given dynamic attribute
diff --git a/Database/AthenaRoot/RootAuxDynIO/src/RootAuxDynReader.cxx b/Database/AthenaRoot/RootAuxDynIO/src/RootAuxDynReader.cxx
index 224d7755bfed3730111c9f359bb70906d89622a3..bd6d4b85da946b24b94e15ed564d4117b1328f5c 100644
--- a/Database/AthenaRoot/RootAuxDynIO/src/RootAuxDynReader.cxx
+++ b/Database/AthenaRoot/RootAuxDynIO/src/RootAuxDynReader.cxx
@@ -174,7 +174,7 @@ namespace RootAuxDynIO
    }
 
    
-   IRootAuxDynReader*
+   std::unique_ptr<IRootAuxDynReader>
    getReaderForBranch(TBranch *branch)
    {
       if( isAuxDynBranch(branch) ) {
@@ -188,7 +188,7 @@ namespace RootAuxDynIO
          TClass *storeTC = tc->GetBaseClass("SG::IAuxStoreHolder");
          if( storeTC ) {  
             int store_holder_offset = tc->GetBaseClassOffset( storeTC );
-            return new RootAuxDynReader(branch, store_holder_offset);
+            return std::make_unique<RootAuxDynReader>(branch, store_holder_offset);
          }
       }
       return nullptr;
diff --git a/Event/xAOD/xAODBTaggingAthenaPool/test/xAODBTaggingAthenaPool_21.0.79_test.py b/Event/xAOD/xAODBTaggingAthenaPool/test/xAODBTaggingAthenaPool_21.0.79_test.py
index 1586a515aae1dfa369c3250a60d6e65c6f36b43e..5dbe62db82c8ddfa0cc6bb6cb32e7a4ea4782882 100755
--- a/Event/xAOD/xAODBTaggingAthenaPool/test/xAODBTaggingAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODBTaggingAthenaPool/test/xAODBTaggingAthenaPool_21.0.79_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::BTaggingAuxContainer_v1
diff --git a/Event/xAOD/xAODCaloEventAthenaPool/CMakeLists.txt b/Event/xAOD/xAODCaloEventAthenaPool/CMakeLists.txt
index c9651a3619579e8522eb4e3bffe3dda5f2f9d5c2..5901acedf5bb5eed03cd14439426dc95880890f7 100644
--- a/Event/xAOD/xAODCaloEventAthenaPool/CMakeLists.txt
+++ b/Event/xAOD/xAODCaloEventAthenaPool/CMakeLists.txt
@@ -26,6 +26,12 @@ atlas_add_poolcnv_library( xAODCaloEventAthenaPoolPoolCnv
 atlas_install_joboptions( share/*.py )
 atlas_install_scripts( test/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 
+# In AthAnalysis xAOD::CaloCluster doesn't know about its CaloCell link. Which
+# makes the converter tests fail in that project...
+if( XAOD_ANALYSIS )
+   return()
+endif()
+
 # Set up (a) test(s) for the converter(s):
 find_package( AthenaPoolUtilitiesTest )
 
diff --git a/Event/xAOD/xAODCaloEventAthenaPool/test/xAODCaloEventAthenaPool_20.1.7.2_test.py b/Event/xAOD/xAODCaloEventAthenaPool/test/xAODCaloEventAthenaPool_20.1.7.2_test.py
index 2e4154e6f8708821b2188c28e720b72c0c577b3a..5d39af506619fc6d8ce975fce0573895d0fb1c9e 100755
--- a/Event/xAOD/xAODCaloEventAthenaPool/test/xAODCaloEventAthenaPool_20.1.7.2_test.py
+++ b/Event/xAOD/xAODCaloEventAthenaPool/test/xAODCaloEventAthenaPool_20.1.7.2_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-20.1.7.2/AOD-20.1.7.2-full.pool.root'
     keys = [
         #xAOD::CaloCluster
diff --git a/Event/xAOD/xAODCaloEventAthenaPool/test/xAODCaloEventAthenaPool_21.0.79_test.py b/Event/xAOD/xAODCaloEventAthenaPool/test/xAODCaloEventAthenaPool_21.0.79_test.py
index 2f7e4720ba467a38b793b5339e120cf7628f438f..2bd06fe7ecc13fcc98159cee0af5fd6fb1485227 100755
--- a/Event/xAOD/xAODCaloEventAthenaPool/test/xAODCaloEventAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODCaloEventAthenaPool/test/xAODCaloEventAthenaPool_21.0.79_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::CaloCluster
diff --git a/Event/xAOD/xAODEgammaAthenaPool/test/xAODEgammaAthenaPool_20.1.7.2_test.py b/Event/xAOD/xAODEgammaAthenaPool/test/xAODEgammaAthenaPool_20.1.7.2_test.py
index 1a002c879aa1b5c3a44f061e5c658886408ebfce..56410043ddac05499e1132e590cdd184d51c1c62 100755
--- a/Event/xAOD/xAODEgammaAthenaPool/test/xAODEgammaAthenaPool_20.1.7.2_test.py
+++ b/Event/xAOD/xAODEgammaAthenaPool/test/xAODEgammaAthenaPool_20.1.7.2_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-20.1.7.2/AOD-20.1.7.2-full.pool.root'
     keys = [
         #xAOD::ElectronAuxContainer
diff --git a/Event/xAOD/xAODEgammaAthenaPool/test/xAODEgammaAthenaPool_21.0.79_test.py b/Event/xAOD/xAODEgammaAthenaPool/test/xAODEgammaAthenaPool_21.0.79_test.py
index 6d1e56c27f7471cd176adda7111c1885365f6cb6..7321ff27d18312e80adbb073599a9e7982370122 100755
--- a/Event/xAOD/xAODEgammaAthenaPool/test/xAODEgammaAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODEgammaAthenaPool/test/xAODEgammaAthenaPool_21.0.79_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::ElectronAuxContainer_v3
diff --git a/Event/xAOD/xAODJetAthenaPool/test/xAODJetAthenaPool_20.7.2.2_test.py b/Event/xAOD/xAODJetAthenaPool/test/xAODJetAthenaPool_20.7.2.2_test.py
index ce7b77031206319da6d9fbfac3ad138f3b9bfc8f..3f28b32a09b6eb0318d1eb9df392fe47d1e4a089 100755
--- a/Event/xAOD/xAODJetAthenaPool/test/xAODJetAthenaPool_20.7.2.2_test.py
+++ b/Event/xAOD/xAODJetAthenaPool/test/xAODJetAthenaPool_20.7.2.2_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-20.7.2.2/AOD-20.7.2.2-full.pool.root'
     keys = [
         #xAOD::JetTrigAuxContainer_v2
diff --git a/Event/xAOD/xAODJetAthenaPool/test/xAODJetAthenaPool_21.0.79_test.py b/Event/xAOD/xAODJetAthenaPool/test/xAODJetAthenaPool_21.0.79_test.py
index 98994b79d3bd046ad8f3c17035d254ff0c99656e..8fe437f40e5a319865d797249eb492532a4b4b44 100755
--- a/Event/xAOD/xAODJetAthenaPool/test/xAODJetAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODJetAthenaPool/test/xAODJetAthenaPool_21.0.79_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::JetTrigAuxContainer_v2
diff --git a/Event/xAOD/xAODMissingETAthenaPool/test/xAODMissingETAthenaPool_20.1.7.2_test.py b/Event/xAOD/xAODMissingETAthenaPool/test/xAODMissingETAthenaPool_20.1.7.2_test.py
index d933826d07db2910580b61f48f585389c6d06673..eb457c8a619c26a9a2ec662217378adb5819e042 100755
--- a/Event/xAOD/xAODMissingETAthenaPool/test/xAODMissingETAthenaPool_20.1.7.2_test.py
+++ b/Event/xAOD/xAODMissingETAthenaPool/test/xAODMissingETAthenaPool_20.1.7.2_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-20.1.7.2/AOD-20.1.7.2-full.pool.root'
     keys = [
         #xAOD::MissingETAssociationMap
diff --git a/Event/xAOD/xAODMissingETAthenaPool/test/xAODMissingETAthenaPool_21.0.79_test.py b/Event/xAOD/xAODMissingETAthenaPool/test/xAODMissingETAthenaPool_21.0.79_test.py
index f43f7b83428de67aec5ec387c0e06b53167e21e6..3b2e3aad5648b4586d8974274ee11be4fbbd114a 100755
--- a/Event/xAOD/xAODMissingETAthenaPool/test/xAODMissingETAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODMissingETAthenaPool/test/xAODMissingETAthenaPool_21.0.79_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::MissingETAuxAssociationMap_v2
diff --git a/Event/xAOD/xAODMuonAthenaPool/CMakeLists.txt b/Event/xAOD/xAODMuonAthenaPool/CMakeLists.txt
index 353c84b01d8fb00e4c460f3258bff8c38329a5e3..9c8f759fcd66f1ecb68f82e564090c1b8a97667a 100644
--- a/Event/xAOD/xAODMuonAthenaPool/CMakeLists.txt
+++ b/Event/xAOD/xAODMuonAthenaPool/CMakeLists.txt
@@ -25,6 +25,12 @@ atlas_add_poolcnv_library( xAODMuonAthenaPoolPoolCnv
 atlas_install_joboptions( share/*.py )
 atlas_install_scripts( test/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 
+# In AthAnalysis xAOD::Muon doesn't know about its MuonSegment link. Which
+# makes the converter tests fail in that project...
+if( XAOD_ANALYSIS )
+   return()
+endif()
+
 # Set up (a) test(s) for the converter(s):
 find_package( AthenaPoolUtilitiesTest )
 
diff --git a/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_20.1.7.2_test.py b/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_20.1.7.2_test.py
index 0b989d4954b64599f82cfc380e395dec528b5aa1..d2748c20b966e3334f5667c2e9e02a810dfa28bf 100755
--- a/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_20.1.7.2_test.py
+++ b/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_20.1.7.2_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-20.1.7.2/AOD-20.1.7.2-full.pool.root'
     keys = [
         #Muons...
diff --git a/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_20.7.2.2_test.py b/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_20.7.2.2_test.py
index cc7882cc2a83d372fcf454278d7c798728de93bd..b732ce2c7a97d6736d7dd299ee0d3e0c708b8c0c 100755
--- a/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_20.7.2.2_test.py
+++ b/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_20.7.2.2_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-20.7.2.2/AOD-20.7.2.2-full.pool.root'
     keys = [
         #xAOD::MuonAuxContainer_v2
diff --git a/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_20.7.9.9_test.py b/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_20.7.9.9_test.py
index 35210998e699087a468ddd8f5b06a1a7e6f0605d..784da1fbdb695fc06067b96c1094a6a6eabdf75e 100755
--- a/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_20.7.9.9_test.py
+++ b/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_20.7.9.9_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-20.7.9.9/AOD-20.7.9.9-full.pool.root'
     keys = [
         #xAOD::MuonAuxContainer_v4
diff --git a/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_21.0.79_test.py b/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_21.0.79_test.py
index 742918ebc9beb69965302fed65419742b3a9e1b3..95cf862fec0af841db18f523c5c55e2eee7f5221 100755
--- a/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_21.0.79_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::MuonAuxContainer_v4
diff --git a/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_master-20190911_test.py b/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_master-20190911_test.py
index 70a4d1ae5123035dff28f3f43a7a6ba8a2ec629b..81a183add39e9ac01f99d7b86489a3e628c10250 100755
--- a/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_master-20190911_test.py
+++ b/Event/xAOD/xAODMuonAthenaPool/test/xAODMuonAthenaPool_master-20190911_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-master-20190911/AOD-master-20190911-full.pool.root'
     keys = [
         #xAOD::MuonAuxContainer_v5
diff --git a/Event/xAOD/xAODMuonCnv/src/MuonSegmentCnvAlg.h b/Event/xAOD/xAODMuonCnv/src/MuonSegmentCnvAlg.h
index ed64557d5427f86fba0719898f608ed8953fc11e..08f850428c44d1f42e4180662798fa65efbf10dc 100644
--- a/Event/xAOD/xAODMuonCnv/src/MuonSegmentCnvAlg.h
+++ b/Event/xAOD/xAODMuonCnv/src/MuonSegmentCnvAlg.h
@@ -36,7 +36,7 @@ namespace xAODMaker {
 
    private:
      // the following segments do NOT contain MuGirl segments
-     SG::ReadHandleKey<Trk::SegmentCollection> m_muonSegmentLocation{this,"SegmentContainerName","MuonSegments"};
+     SG::ReadHandleKey<Trk::SegmentCollection> m_muonSegmentLocation{this,"SegmentContainerName","TrackMuonSegments"};
      SG::WriteHandleKey<xAOD::MuonSegmentContainer> m_xaodContainerName{this,"xAODContainerName","MuonSegments"};
 
      ToolHandle<xAODMaker::IMuonSegmentConverterTool> m_muonSegmentConverterTool{this,"MuonSegmentConverterTool","Muon::MuonSegmentConverterTool/MuonSegmentConverterTool"};
diff --git a/Event/xAOD/xAODPFlowAthenaPool/test/xAODPFlowAthenaPool_21.0.79_test.py b/Event/xAOD/xAODPFlowAthenaPool/test/xAODPFlowAthenaPool_21.0.79_test.py
index a3d3f81fa19f93da8190294cac437f14f96a7c72..3a2042e8dd8f47f5084c05dfd978ad21f7813f22 100755
--- a/Event/xAOD/xAODPFlowAthenaPool/test/xAODPFlowAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODPFlowAthenaPool/test/xAODPFlowAthenaPool_21.0.79_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::PFOAuxContainer_v1
diff --git a/Event/xAOD/xAODParticleEventAthenaPool/test/xAODParticleAthenaPool_21.0.79_test.py b/Event/xAOD/xAODParticleEventAthenaPool/test/xAODParticleAthenaPool_21.0.79_test.py
index eaaf9cc1d31ca0478855941277bf98dc91b017ba..67fad4ce1b7c25a472fad730927dc34b3ac552f1 100755
--- a/Event/xAOD/xAODParticleEventAthenaPool/test/xAODParticleAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODParticleEventAthenaPool/test/xAODParticleAthenaPool_21.0.79_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::ParticleAuxContainer_v1
diff --git a/Event/xAOD/xAODTauAthenaPool/test/xAODTauAthenaPool_20.1.7.2_test.py b/Event/xAOD/xAODTauAthenaPool/test/xAODTauAthenaPool_20.1.7.2_test.py
index 8b2bbfeb04767ef744464ef3bebf111a1ac48e3d..32ed933c6642dc476145dc12d77e5e34d71af5bc 100755
--- a/Event/xAOD/xAODTauAthenaPool/test/xAODTauAthenaPool_20.1.7.2_test.py
+++ b/Event/xAOD/xAODTauAthenaPool/test/xAODTauAthenaPool_20.1.7.2_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-20.1.7.2/AOD-20.1.7.2-full.pool.root'
     keys = [
         #xAOD::TauJetAuxContainer
diff --git a/Event/xAOD/xAODTauAthenaPool/test/xAODTauAthenaPool_20.7.2.2_test.py b/Event/xAOD/xAODTauAthenaPool/test/xAODTauAthenaPool_20.7.2.2_test.py
index dae8e87fa0d6f06e7c2528da2517d9bd6679a3c8..1a7a0f7667c175cf98233b96c1c053d31a868a67 100755
--- a/Event/xAOD/xAODTauAthenaPool/test/xAODTauAthenaPool_20.7.2.2_test.py
+++ b/Event/xAOD/xAODTauAthenaPool/test/xAODTauAthenaPool_20.7.2.2_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-20.7.2.2/AOD-20.7.2.2-full.pool.root'
     keys = [
         #xAOD::DiTauJetAuxContainer_v1
diff --git a/Event/xAOD/xAODTauAthenaPool/test/xAODTauAthenaPool_21.0.79_test.py b/Event/xAOD/xAODTauAthenaPool/test/xAODTauAthenaPool_21.0.79_test.py
index a65bbb30733d1edce03179bc48e1a596ec69df24..2248314778861a709e01045f615b914b5e3b07dd 100755
--- a/Event/xAOD/xAODTauAthenaPool/test/xAODTauAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODTauAthenaPool/test/xAODTauAthenaPool_21.0.79_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::DiTauJetAuxContainer_v1
diff --git a/Event/xAOD/xAODTrackingAthenaPool/CMakeLists.txt b/Event/xAOD/xAODTrackingAthenaPool/CMakeLists.txt
index dd31c801fa8220ba98d3f937e6fb01e77865c414..de3f338d3359b554551fecc25f01eeaf79c49330 100644
--- a/Event/xAOD/xAODTrackingAthenaPool/CMakeLists.txt
+++ b/Event/xAOD/xAODTrackingAthenaPool/CMakeLists.txt
@@ -37,6 +37,12 @@ atlas_add_poolcnv_library( xAODTrackingAthenaPoolPoolCnv
 atlas_install_joboptions( share/*.py )
 atlas_install_scripts( test/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 
+# In AthAnalysis xAOD::TrackParticle doesn't know about its Trk::Track link.
+# Which makes the converter tests fail in that project...
+if( XAOD_ANALYSIS )
+   return()
+endif()
+
 # Set up (a) test(s) for the converter(s):
 find_package( AthenaPoolUtilitiesTest )
 
diff --git a/Event/xAOD/xAODTrigCaloAthenaPool/test/xAODTrigCaloAthenaPool_20.0.0.3_test.py b/Event/xAOD/xAODTrigCaloAthenaPool/test/xAODTrigCaloAthenaPool_20.0.0.3_test.py
index 91c4eb7011bba12f2597d127a9625130bf099da1..4c854f1614d086f8e36eeba9fb69a64a1db9be6c 100755
--- a/Event/xAOD/xAODTrigCaloAthenaPool/test/xAODTrigCaloAthenaPool_20.0.0.3_test.py
+++ b/Event/xAOD/xAODTrigCaloAthenaPool/test/xAODTrigCaloAthenaPool_20.0.0.3_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-20.0.0.3/AOD-20.0.0.3-full.pool.root'
     keys = [
         #xAOD::TrigCaloClusterAuxContainer_v1
diff --git a/Event/xAOD/xAODTrigCaloAthenaPool/test/xAODTrigCaloAthenaPool_21.0.79_test.py b/Event/xAOD/xAODTrigCaloAthenaPool/test/xAODTrigCaloAthenaPool_21.0.79_test.py
index 3687da81dbeed9ba870d4aa3505fe0226687c84c..5596c4ad8c9cd18507318f2dd7044db0aad27a1a 100755
--- a/Event/xAOD/xAODTrigCaloAthenaPool/test/xAODTrigCaloAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODTrigCaloAthenaPool/test/xAODTrigCaloAthenaPool_21.0.79_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::CaloClusterTrigAuxContainer_v1
diff --git a/Event/xAOD/xAODTrigEgammaAthenaPool/test/xAODTrigEgammaAthenaPool_21.0.79_test.py b/Event/xAOD/xAODTrigEgammaAthenaPool/test/xAODTrigEgammaAthenaPool_21.0.79_test.py
index 7564d3e52771a3eec6b32a62351e4ba3c8e1c4a5..8e88594ce85d119ea648b1ef671e4e0ad9b19dff 100755
--- a/Event/xAOD/xAODTrigEgammaAthenaPool/test/xAODTrigEgammaAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODTrigEgammaAthenaPool/test/xAODTrigEgammaAthenaPool_21.0.79_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::ElectronTrigAuxContainer_v1
diff --git a/Event/xAOD/xAODTrigMissingETAthenaPool/test/xAODTrigMissingETAthenaPool_21.0.79_test.py b/Event/xAOD/xAODTrigMissingETAthenaPool/test/xAODTrigMissingETAthenaPool_21.0.79_test.py
index 658ee021b7aef76e392f9f6050dd98cff9961714..05e7b59a195c2a4df7ec75c9ddfd6797593ae2d6 100755
--- a/Event/xAOD/xAODTrigMissingETAthenaPool/test/xAODTrigMissingETAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODTrigMissingETAthenaPool/test/xAODTrigMissingETAthenaPool_21.0.79_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::TrigMissingETAuxContainer_v1
diff --git a/Event/xAOD/xAODTrigMuonAthenaPool/test/xAODTrigMuonAthenaPool_20.1.7.2_test.py b/Event/xAOD/xAODTrigMuonAthenaPool/test/xAODTrigMuonAthenaPool_20.1.7.2_test.py
index a728cd13361608125123ea102fca4c6f2847a673..31b049dbc6e70b224fda458efc04875133e45ce5 100755
--- a/Event/xAOD/xAODTrigMuonAthenaPool/test/xAODTrigMuonAthenaPool_20.1.7.2_test.py
+++ b/Event/xAOD/xAODTrigMuonAthenaPool/test/xAODTrigMuonAthenaPool_20.1.7.2_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-20.1.7.2/AOD-20.1.7.2-full.pool.root'
     keys = [
         #xAOD::L2CombinedMuonAuxContainer
diff --git a/Event/xAOD/xAODTrigMuonAthenaPool/test/xAODTrigMuonAthenaPool_21.0.79_test.py b/Event/xAOD/xAODTrigMuonAthenaPool/test/xAODTrigMuonAthenaPool_21.0.79_test.py
index 0e157b4bf1af1bdd0e924929872bbc56c339fb06..296f9eeb42912dce21501d4d6ffa8f35f6a6db89 100755
--- a/Event/xAOD/xAODTrigMuonAthenaPool/test/xAODTrigMuonAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODTrigMuonAthenaPool/test/xAODTrigMuonAthenaPool_21.0.79_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::L2CombinedMuonAuxContainer_v1
diff --git a/Event/xAOD/xAODTrigMuonCnv/src/MuonFeatureCnvTestAlg.cxx b/Event/xAOD/xAODTrigMuonCnv/src/MuonFeatureCnvTestAlg.cxx
index ee4b285cf5568bef201764acf674fdf1fdde681f..b80b57a647604b8e09df97c0592a15649c820fed 100644
--- a/Event/xAOD/xAODTrigMuonCnv/src/MuonFeatureCnvTestAlg.cxx
+++ b/Event/xAOD/xAODTrigMuonCnv/src/MuonFeatureCnvTestAlg.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 "MuonFeatureCnvTestAlg.h"
@@ -29,12 +29,6 @@ StatusCode MuonFeatureCnvTestAlg::initialize() {
     return StatusCode::SUCCESS;
 }
 
-StatusCode MuonFeatureCnvTestAlg::finalize() {
-    
-    // Return gracefully:
-    return StatusCode::SUCCESS;
-}
-
 StatusCode MuonFeatureCnvTestAlg::execute() {
 
   // Retrieve MuonFeatureContainer
diff --git a/Event/xAOD/xAODTrigMuonCnv/src/MuonFeatureCnvTestAlg.h b/Event/xAOD/xAODTrigMuonCnv/src/MuonFeatureCnvTestAlg.h
index e495f0ad92135317e570beb8f2b5bb1beabbb633..e994db39493cd5645363d58cf11864b7d3ef3ec6 100644
--- a/Event/xAOD/xAODTrigMuonCnv/src/MuonFeatureCnvTestAlg.h
+++ b/Event/xAOD/xAODTrigMuonCnv/src/MuonFeatureCnvTestAlg.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
 */
 
 //
@@ -34,8 +34,6 @@ class MuonFeatureCnvTestAlg : public AthAlgorithm {
         
         /// Function initialising the algorithm
         virtual StatusCode initialize();
-        /// Function initialising the algorithm
-        virtual StatusCode finalize();
         /// Function executing the algorithm
         virtual StatusCode execute();
 
diff --git a/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoCnvTestAlg.cxx b/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoCnvTestAlg.cxx
index 453039354bb26b86274c78711d64286b97205c80..feeebc4c9f533e4ece89b15531c550583a80d44e 100644
--- a/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoCnvTestAlg.cxx
+++ b/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoCnvTestAlg.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 "TrigMuonEFInfoCnvTestAlg.h"
@@ -35,12 +35,6 @@ StatusCode TrigMuonEFInfoCnvTestAlg::initialize() {
     return StatusCode::SUCCESS;
 }
 
-StatusCode TrigMuonEFInfoCnvTestAlg::finalize() {
-    
-    // Return gracefully:
-    return StatusCode::SUCCESS;
-}
-
 StatusCode TrigMuonEFInfoCnvTestAlg::execute() {
 
   // Retrieve the TrigMuonEFInfoContainer
diff --git a/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoCnvTestAlg.h b/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoCnvTestAlg.h
index 4f11662daad3f6412ef40256715cb8a0a19b874d..d381e7e9ad095206c3e144e48f6b44aadec5c14c 100644
--- a/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoCnvTestAlg.h
+++ b/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoCnvTestAlg.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
 */
 
 //
@@ -43,8 +43,6 @@ class TrigMuonEFInfoCnvTestAlg : public AthAlgorithm {
         
         /// Function initialising the algorithm
         virtual StatusCode initialize();
-        /// Function initialising the algorithm
-        virtual StatusCode finalize();
         /// Function executing the algorithm
         virtual StatusCode execute();
 
diff --git a/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoToMuonCnvTool.cxx b/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoToMuonCnvTool.cxx
index 7d13d09ee0094b5f164d3e47c262f65b922bf90a..ab8623d436c4b9c1ecb177075221e72a123a0c9e 100644
--- a/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoToMuonCnvTool.cxx
+++ b/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoToMuonCnvTool.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,13 +26,6 @@ TrigMuonEFInfoToMuonCnvTool::TrigMuonEFInfoToMuonCnvTool(const std::string& type
   declareProperty( "xAODEFInDetTrackParticleContainerName", m_inDetTrackParticles = "EFInDetTrackParticles" );   
 }
 
-/**
- * Destructor - nothing to do so far.
- */
-TrigMuonEFInfoToMuonCnvTool::~TrigMuonEFInfoToMuonCnvTool() {
-    
-}
-
 /**
  * Initialize the tool
  */
@@ -45,13 +38,6 @@ StatusCode TrigMuonEFInfoToMuonCnvTool::initialize() {
     return StatusCode::SUCCESS;
 }
 
-/**
- * Finalize the tool
- */
-StatusCode TrigMuonEFInfoToMuonCnvTool::finalize() {
-    return StatusCode::SUCCESS;
-}
-
 /**
  * Convert input TrigMuonEFInfo object into multuple xAOD::Muon objects.
  * The xAOD::Muon objects are stored into the MuonContainer passed to the function.
diff --git a/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoToMuonCnvTool.h b/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoToMuonCnvTool.h
index 7bd1eff060d8a3b2344df1aa5372c6e95d23d400..7a1ac63fd1a7fe0e5c1d10ed4c7034fd14586746 100644
--- a/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoToMuonCnvTool.h
+++ b/Event/xAOD/xAODTrigMuonCnv/src/TrigMuonEFInfoToMuonCnvTool.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,14 +30,11 @@ public:
     TrigMuonEFInfoToMuonCnvTool(const std::string& type, const std::string& name, const IInterface* parent);
     
     /// Destructor
-    virtual ~TrigMuonEFInfoToMuonCnvTool();
+    virtual ~TrigMuonEFInfoToMuonCnvTool()=default;
     
     /// initialize the tool
     virtual StatusCode initialize() override;
     
-    /// finalize the tool
-    virtual StatusCode finalize() override;
-    
     /// Convert a single TrigMuonEFInfo object into (maybe multiple) xAOD::Muon objects.
     virtual StatusCode convertTrigMuonEFInfo(const TrigMuonEFInfo& efinfo,
                                                  xAOD::MuonContainer& muoncontainer,
diff --git a/Event/xAOD/xAODTriggerAthenaPool/test/xAODTriggerAthenaPool_20.1.7.2_test.py b/Event/xAOD/xAODTriggerAthenaPool/test/xAODTriggerAthenaPool_20.1.7.2_test.py
index 476752fdba8e029a9290089ed6814087fe37a982..67e184e1ae59c911499c048078135c2d8be51bf9 100755
--- a/Event/xAOD/xAODTriggerAthenaPool/test/xAODTriggerAthenaPool_20.1.7.2_test.py
+++ b/Event/xAOD/xAODTriggerAthenaPool/test/xAODTriggerAthenaPool_20.1.7.2_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-20.1.7.2/AOD-20.1.7.2-full.pool.root'
     keys = [
         #EmTauRoI
diff --git a/Event/xAOD/xAODTriggerAthenaPool/test/xAODTriggerAthenaPool_master-20190911_test.py b/Event/xAOD/xAODTriggerAthenaPool/test/xAODTriggerAthenaPool_master-20190911_test.py
index 7f2c7e0ceb2d2277624fbc47753adcfe88e384a2..ff34d84ada5681786e6af3d93e892623ee015ae6 100755
--- a/Event/xAOD/xAODTriggerAthenaPool/test/xAODTriggerAthenaPool_master-20190911_test.py
+++ b/Event/xAOD/xAODTriggerAthenaPool/test/xAODTriggerAthenaPool_master-20190911_test.py
@@ -3,10 +3,14 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
     infile = 'aod/AOD-master-20190911/AOD-master-20190911-full.pool.root'
     keys = [
         #EmTauRoI_v2
diff --git a/Event/xAOD/xAODTruthAthenaPool/test/xAODTruthAthenaPool_21.0.79_test.py b/Event/xAOD/xAODTruthAthenaPool/test/xAODTruthAthenaPool_21.0.79_test.py
index 0f6816c00729dbce9fe0819189ab505c2c4aeb88..22c15e5c3052972d52c8f0ce758862c46a45dc97 100755
--- a/Event/xAOD/xAODTruthAthenaPool/test/xAODTruthAthenaPool_21.0.79_test.py
+++ b/Event/xAOD/xAODTruthAthenaPool/test/xAODTruthAthenaPool_21.0.79_test.py
@@ -3,11 +3,15 @@
 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 """
 
+import ROOT
 from AthenaPoolUtilities.TPCnvTestConfig import TPCnvTest
 
 if __name__ == "__main__":
-    infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
 
+    # Force-load some dictionaries. Needed to work around ROOT-10940.
+    ROOT.xAOD.CaloCluster()
+
+    infile = 'aod/AOD-21.0.79/AOD-21.0.79-full.pool.root'
     keys = [
         #xAOD::TruthEventAuxContainer_v1
         'TruthEvents',
@@ -19,4 +23,4 @@ if __name__ == "__main__":
         'TruthVertices',
     ]
 
-    TPCnvTest(infile, keys)#, useGeoModelSvc=True, doLAr=True, doTile=True)
+    TPCnvTest(infile, keys)
diff --git a/Generators/EvgenJobTransforms/CMakeLists.txt b/Generators/EvgenJobTransforms/CMakeLists.txt
index 8736b66f00e777de4bf9cb00187f38ead37cc1dd..4b9ece4430687013a03c91c8206d29422ae6a1cc 100644
--- a/Generators/EvgenJobTransforms/CMakeLists.txt
+++ b/Generators/EvgenJobTransforms/CMakeLists.txt
@@ -6,4 +6,4 @@ atlas_subdir( EvgenJobTransforms )
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/*.py )
-atlas_install_runtime( scripts/*.py )
+atlas_install_runtime( scripts/*.py share/file/*.txt )
diff --git a/Generators/EvgenJobTransforms/scripts/Gen_tf.py b/Generators/EvgenJobTransforms/scripts/Gen_tf.py
index ee7ba47953fc365169ecc3d885a77fe4fc6f68dc..91bd3d84c4f45c409a972e7c78cbb5e7351df3d1 100755
--- a/Generators/EvgenJobTransforms/scripts/Gen_tf.py
+++ b/Generators/EvgenJobTransforms/scripts/Gen_tf.py
@@ -118,19 +118,39 @@ class EvgenExecutor(athenaExecutor):
         # copy config files to cwd
         FIRST_DIR = (os.environ['JOBOPTSEARCHPATH']).split(":")[0]
         configFiles = [f for f in os.listdir(FIRST_DIR) if ( "GRID" in f)]
+        confFile=None
         if len(configFiles) == 1:
             confFile =  os.path.join(FIRST_DIR, configFiles[0])
             expand_if_archive(confFile)
             msg.info('Configuration input found: %s' % confFile)
         elif len(configFiles) >1:
-            msg.error("Too many *GRID* config files, please check = '%s'" % dsidparam) 
+            msg.info("more then one gridpack ! ")
+            if "--ecmEnergy" in str(sys.argv[1:]):
+               ener=str(sys.argv[1:]).split("ecmEnergy",1)[1]
+               energy=str(ener)[:4].strip(" =0\']")
+               printfunc("Should be used gridpack for energy "+energy)
+            else:
+               energy="13"
+            for x in configFiles:
+                gridS="mc_"+energy+"TeV"
+                printfunc("Gridpack should start from "+gridS) 
+                if x.startswith(gridS):
+                   confFile = os.path.join(FIRST_DIR, x)
+                   msg.info("using gridpack = "+confFile)
+            if confFile is None:
+               msg.error("No *GRID* config files, for requested energy = '%s'  please check = '%s'" %(energy,dsidparam))
+            
+        if confFile is not None:
+           expand_if_archive(confFile)
+#       os.system("cp %s ." % confFile)
+           printfunc("Configuration input gridpack found " + confFile)
 
         #Expand if a tarball is found in local directory
         loc_files = os.listdir(os.getcwd())
-        for loc_file in loc_files: 
-            expand_if_archive(loc_file)
-            
-            
+        for loc_file in loc_files:
+            if "GRID" not in loc_file:  
+               expand_if_archive(loc_file)
+
         ## Expand tarball input event and generator conf files, if provided
         if "inputGeneratorFile" in self._trf.argdict:
 #           expand_if_archive(self._trf.argdict["inputGeneratorFile"].value)
@@ -159,6 +179,10 @@ def getTransform():
     if "--outputEVNTFile" in str(sys.argv[1:]):
        exeSet.add(EvgenExecutor(name="generate", skeleton="EvgenJobTransforms/skel.GENtoEVGEN.py", inData=["inNULL"], outData=["EVNT", "EVNT_Pre", "TXT" ]))
        msg.info("Output EVNT file")
+    elif "--outputYODAFile" in str(sys.argv[1:]):
+       exeSet.add(EvgenExecutor(name="generate", skeleton="EvgenJobTransforms/skel.GENtoEVGEN.py", inData=["inNULL"], outData=["outNULL", "TXT" 
+]))
+       msg.info("Output EVNT file")
     elif "--outputTXTFile" in str(sys.argv[1:]):
        exeSet.add(EvgenExecutor(name="generate", skeleton="EvgenJobTransforms/skel.GENtoTXT.py", inData=["inNULL"], outData=["TXT"]))
        msg.info("Output TXT file")
diff --git a/Generators/EvgenJobTransforms/share/skel.GENtoEVGEN.py b/Generators/EvgenJobTransforms/share/skel.GENtoEVGEN.py
index 6b5c098e20033b925f879010112b2b4ab249d3f2..beae3cff24499a542319a792018901e63376cd93 100644
--- a/Generators/EvgenJobTransforms/share/skel.GENtoEVGEN.py
+++ b/Generators/EvgenJobTransforms/share/skel.GENtoEVGEN.py
@@ -79,11 +79,21 @@ if hasattr(runArgs, "runNumber"):
 
 if hasattr(runArgs, "inputGenConfFile"):
    raise RuntimeError("inputGenConfFile is invalid !! Gridpacks and config. files/links to be put into DSID directory ")
+
+if hasattr(runArgs, "inputGeneratorFile"):
+   evgenLog.info("inputGeneratorFile used " + runArgs.inputGeneratorFile)
+ 
+if hasattr(runArgs, "outputYODAFile"):
+    evgenLog.info("outputYODAFile specified " + runArgs.outputYODAFile)
  
 ## Ensure that an output name has been given
 # TODO: Allow generation without writing an output file (if outputEVNTFile is None)?
 if not hasattr(runArgs, "outputEVNTFile") and not hasattr(runArgs, "outputEVNT_PreFile"):
-    raise RuntimeError("No output evgen EVNT or EVNT_Pre file provided.")
+    if hasattr(runArgs, "outputYODAFile"):
+        evgenLog.info("No outputEVNTFile specified but outputYODAFile is used")
+        evgenLog.info("Will run GENtoEVGEN without saving the output EVNT file, asuming a valid outputYODAFile will be produced")
+    else:
+        raise RuntimeError("No output evgen EVNT or EVNT_Pre file provided.")
 
 ## Ensure that mandatory args have been supplied (complain before processing the includes)
 if not hasattr(runArgs, "ecmEnergy"):
@@ -166,6 +176,8 @@ if hasattr(runArgs, "rivetAnas"):
     anaSeq += Rivet_i()
     anaSeq.Rivet_i.Analyses = runArgs.rivetAnas
     anaSeq.Rivet_i.DoRootHistos = True
+    if hasattr(runArgs, "outputYODAFile"):
+      anaSeq.Rivet_i.HistoFile = runArgs.outputYODAFile
 
 ##==============================================================
 ## Pre- and main config parsing
@@ -249,6 +261,9 @@ include(jofile)
 ## Announce start of JO checking
 evgenLog.debug("****************** CHECKING EVGEN CONFIGURATION *****************")
 
+if hasattr(runArgs,'inputGeneratorFile') and int(evgenConfig.inputFilesPerJob) == 0 : 
+   evgenConfig.inputFilesPerJob = 1 
+
 ## Print out options
 for opt in str(evgenConfig).split(os.linesep):
     evgenLog.info(opt)
@@ -311,15 +326,29 @@ rounding = 0
 if hasattr(runArgs,'inputGeneratorFile') and ',' in runArgs.inputGeneratorFile:   multiInput = runArgs.inputGeneratorFile.count(',')+1
 else:
    multiInput = 0
-   
-if evgenConfig.nEventsPerJob < 1:
-    raise RunTimeError("evgenConfig.nEventsPerJob must be at least 1")
+
+# check if default nEventsPerJob used 
+if not evgenConfig.nEventsPerJob:
+    evgenLog.info('#############################################################')
+    evgenLog.info(' !!!! no nEventsPerJob set !!!  The default 10000 used. !!! ') 
+    evgenLog.info('#############################################################')
+else:
+    evgenLog.info(' nEventsPerJob set to ' + str(evgenConfig.nEventsPerJob)  )
+
+if evgenConfig.minevents > 0 :
+    raise RuntimeError("evgenConfig.minevents is obsolete and should be removed from the JOs")
+elif evgenConfig.nEventsPerJob > 100000:
+    raise RuntimeError("evgenConfig.nEventsPerJob can be max. 100000")
 else:
     allowed_nEventsPerJob_lt1000 = [1, 2, 5, 10, 20, 25, 50, 100, 200, 500, 1000]
     msg = "evgenConfig.nEventsPerJob = %d: " % evgenConfig.nEventsPerJob
 
-    if evgenConfig.nEventsPerJob >= 1000 and evgenConfig.nEventsPerJob % 1000 != 0 and 10000 % evgenConfig.nEventsPerJob != 0 :
-           msg += "nEventsPerJob in range >= 1K must be a multiple of 1K and a divisor of 10K"
+    if evgenConfig.nEventsPerJob >= 1000 and evgenConfig.nEventsPerJob <=10000 and (evgenConfig.nEventsPerJob % 1000 != 0 or 10000 % 
+evgenConfig.nEventsPerJob != 0) :
+           msg += "nEventsPerJob in range [1K, 10K] must be a multiple of 1K and a divisor of 10K"
+           raise RuntimeError(msg)
+    elif evgenConfig.nEventsPerJob > 10000  and evgenConfig.nEventsPerJob % 10000 != 0:
+           msg += "nEventsPerJob >10K must be a multiple of 10K"
            raise RuntimeError(msg)
     elif evgenConfig.nEventsPerJob < 1000 and evgenConfig.nEventsPerJob not in allowed_nEventsPerJob_lt1000:
            msg += "nEventsPerJob in range <= 1000 must be one of %s" % allowed_nEventsPerJob_lt1000
@@ -331,9 +360,9 @@ else:
 if evgenConfig.keywords:
     ## Get the allowed keywords file from the JO package if possibe
     # TODO: Make the package name configurable
-    kwfile = "EvgenJobTransforms/evgenkeywords.txt"
+    kwfile = "evgenkeywords.txt"
     kwpath = None
-    for p in os.environ["JOBOPTSEARCHPATH"].split(":"):
+    for p in os.environ["DATAPATH"].split(":"):
         kwpath = os.path.join(p, kwfile)
         if os.path.exists(kwpath):
             break
@@ -356,15 +385,15 @@ if evgenConfig.keywords:
             if officialJO:
                 sys.exit(1)
     else:
-        evgenLog.warning("Could not find evgenkeywords.txt file %s in $JOBOPTSEARCHPATH" % kwfile)
+        evgenLog.warning("Could not find evgenkeywords.txt file %s in DATAPATH" % kwfile )
 
 ## Check that the L1 and L2 keywords pairs are in the list of allowed words pairs (and exit if processing an official JO)
 if evgenConfig.categories:
     ## Get the allowed categories file from the JO package if possibe
     # TODO: Make the package name configurable
-    lkwfile = "EvgenJobTransforms/CategoryList.txt"
+    lkwfile = "CategoryList.txt"
     lkwpath = None
-    for p in os.environ["JOBOPTSEARCHPATH"].split(":"):
+    for p in os.environ["DATAPATH"].split(":"):
         lkwpath = os.path.join(p, lkwfile)
         if os.path.exists(lkwpath):
             break
@@ -397,7 +426,7 @@ if evgenConfig.categories:
                if officialJO:
                    sys.exit(1)
     else:
-        evgenLog.warning("Could not find CategoryList.txt file %s in $JOBOPTSEARCHPATH" % lkwfile)
+        evgenLog.warning("Could not find CategoryList.txt file %s in $DATAPATH" % lkwfile)
 
 ## Configure POOL streaming to the output EVNT format file
 from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
@@ -465,6 +494,38 @@ if hasattr(testSeq, "TestHepMC") and not gens_testhepmc(evgenConfig.generators):
     evgenLog.info("Removing TestHepMC sanity checker")
     del testSeq.TestHepMC
 
+##=============================================================
+## Check release number
+##=============================================================
+# Function to check blacklist (from Spyros'es logParser.py)
+def checkBlackList(relFlavour,cache,generatorName) :
+    isError = None
+    with open('/cvmfs/atlas.cern.ch/repo/sw/Generators/MC16JobOptions/common/BlackList_caches.txt') as bfile:
+        for line in bfile.readlines():
+            if not line.strip():
+                continue
+            # Blacklisted release flavours
+            badRelFlav=line.split(',')[0].strip()
+            # Blacklisted caches
+            badCache=line.split(',')[1].strip()
+            # Blacklisted generators
+            badGens=line.split(',')[2].strip()
+            
+            used_gens = ','.join(generatorName)
+            #Match Generator and release type e.g. AtlasProduction, MCProd
+            if relFlavour==badRelFlav and cache==badCache and re.search(badGens,used_gens) is not None:
+                if badGens=="": badGens="all generators"
+                isError=relFlavour+","+cache+" is blacklisted for " + badGens
+                return isError
+    return isError
+## Announce start of JO checkingrelease number checking
+evgenLog.debug("****************** CHECKING RELEASE IS NOT BLACKLISTED *****************")
+rel = os.popen("echo $AtlasVersion").read()
+rel = rel.strip()
+errorBL = checkBlackList("AthGeneration",rel,gennames)
+if (errorBL): 
+   raise RuntimeError("This run is blacklisted for this generator, please use a different one !! "+ errorBL)  
+#    evgenLog.warning("This run is blacklisted for this generator, please use a different one !! "+ errorBL )
 
 ##==============================================================
 ## Handling of a post-include/exec args at the end of standard configuration
@@ -659,12 +720,6 @@ else:
         raise RuntimeError("evgenConfig.inputfilecheck specified in %s, but generators %s do not require an input file" %
                            (runArgs.jobConfig, str(gennames)))
 
-## Check conf files, as above but for a different command line arg, and with omission allowed
-if hasattr(runArgs, "inputGenConfFile") and runArgs.inputGenConfFile != "NONE":
-    if evgenConfig.inputconfcheck and not re.search(evgenConfig.inputconfcheck, runArgs.inputGenConfFile):
-        raise RuntimeError("inputGenConfFile=%s is incompatible with inputconfcheck (%s) in %s" %
-                           (runArgs.inputGenConfFile, evgenConfig.inputconfcheck, runArgs.jobConfig))
-
 ## Do the aux-file copying
 if evgenConfig.auxfiles:
     from PyJobTransformsCore.trfutil import get_files
@@ -683,6 +738,19 @@ def _checkattr(attr, required=False):
         return False
     return True
 
+if hasattr(runArgs, "outputTXTFile"):
+    # counting the number of events in LHE output
+    with open(eventsFile) as f:
+        contents = f.read()
+        count_ev = contents.count("<event>")
+    printfunc("MetaData: %s = %s" % ("Number of produced LHE events ", count_ev))
+elif hasattr(runArgs, "inputGeneratorFile"):
+    # counting the number of events in LHE output
+    with open(eventsFile) as f:
+        contents = f.read()
+        count_ev = contents.count("<event>")
+    printfunc("MetaData: %s = %s" % ("Number of input LHE events ", count_ev))
+
 if _checkattr("description", required=True):
     msg = evgenConfig.description
     if _checkattr("notes"):
diff --git a/Generators/EvgenJobTransforms/share/skel.GENtoTXT.py b/Generators/EvgenJobTransforms/share/skel.GENtoTXT.py
index db20bad83f6800d2c1d4ca612d37abf33551d9b3..f213345143a1056cebded25142d47a36413e41dd 100644
--- a/Generators/EvgenJobTransforms/share/skel.GENtoTXT.py
+++ b/Generators/EvgenJobTransforms/share/skel.GENtoTXT.py
@@ -33,7 +33,7 @@ testSeq = acam.athMasterSeq.EvgenTestSeq
 ## NOTE: LogicalExpressionFilter is an algorithm, not a sequence
 from EvgenProdTools.LogicalExpressionFilter import LogicalExpressionFilter
 acam.athMasterSeq += LogicalExpressionFilter("EvgenFilterSeq")
-filtSeq = acam.athMsterSeq.EvgenFilterSeq
+filtSeq = acam.athMasterSeq.EvgenFilterSeq
 topSeq = acas.AlgSequence()
 anaSeq = topSeq
 topSeq += acas.AlgSequence("EvgenPostSeq")
@@ -61,7 +61,7 @@ jobproperties.AthenaCommonFlags.AllowIgnoreConfigError = False
 
 ## Set up a standard logger
 from AthenaCommon.Logging import logging
-evgenLog = logging.getLogger('Gen_tf_txt')
+evgenLog = logging.getLogger('Gen_tf')
 
 ##==============================================================
 ## Run arg handling
@@ -155,7 +155,7 @@ def OutputTXTFile():
 ## Only permit one jobConfig argument for evgen: does more than one _ever_ make sense?
 
 if len(runArgs.jobConfig) != 1:
-    evgenLog.info("runArgs.jobConfig %s ", % runArgs.jobConfig)
+    evgenLog.info("runArgs.jobConfig " +  runArgs.jobConfig)
     evgenLog.error("You must supply one and only one jobConfig file argument. It has to start from mc. and end with .py")
     sys.exit(1)
 
@@ -169,7 +169,7 @@ evgenLog.info("dsid " + dsid)
 jofiles = [f for f in os.listdir(FIRST_DIR) if (f.startswith('mc') and f.endswith('.py'))]
 ## Only permit one JO file in each dsid folder
 if len(jofiles) !=1:
-    evgenLog.info("runArgs.jobConfig wrong %s ", % runArgs.jobConfig)
+    evgenLog.info("runArgs.jobConfig wrong " + runArgs.jobConfig)
     evgenLog.error("You must supply one and only one jobOption file in DSID directory. It has to start with mc. and end with .py")
     sys.exit(1)
 jofile = jofiles[0]
@@ -277,21 +277,14 @@ rounding = 0
 if hasattr(runArgs,'inputGeneratorFile') and ',' in runArgs.inputGeneratorFile:   multiInput = runArgs.inputGeneratorFile.count(',')+1
 else:
    multiInput = 0
+
+
    
 if evgenConfig.nEventsPerJob < 1:
-    raise RunTimeError("evgenConfig.nEventsPerJob must be at least 0")
-else:
-    allowed_nEventsPerJob_lt1000 = [1, 2, 5, 10, 20, 25, 50, 100, 200, 500, 1000]
-    msg = "evgenConfig.nEventsPerJob = %d: " % evgenConfig.nEventsPerJob
-
-    if evgenConfig.nEventsPerJob >= 1000 and evgenConfig.nEventsPerJob % 1000 != 0 and 10000 % evgenConfig.nEventsPerJob != 0:
-           msg += "nEventsPerJob in range >= 1000 must be a multiple of 1000 and a divisor of 10000"
-           raise RuntimeError(msg)
-    elif evgenConfig.nEventsPerJob < 1000 and evgenConfig.nEventsPerJob not in allowed_nEventsPerJob_lt1000:
-           msg += "nEventsPerJob in range <= 1000 must be one of %s" % allowed_nEventsPerJob_lt1000
-           raise RuntimeError(msg)
-    postSeq.CountHepMC.RequestedOutput = evgenConfig.nEventsPerJob if runArgs.maxEvents == -1  else runArgs.maxEvents
-    evgenLog.info('Requested output events '+str(postSeq.CountHepMC.RequestedOutput))
+    raise RunTimeError("evgenConfig.nEventsPerJob must be at least 1")
+else: 
+    evgenLog.info("evgenConfig.nEventsPerJob = {}, but only {} (dummy) event(s) will be generated by Pythia8 for lhe-only production".format(evgenConfig.nEventsPerJob, postSeq.CountHepMC.RequestedOutput))
+### NB: postSeq.CountHepMC.RequestedOutput is set to 1 in LHEonly.py
 
 ## Check that the keywords list is not empty:
 if not evgenConfig.keywords:
@@ -373,6 +366,9 @@ if evgenConfig.categories:
         evgenLog.warning("Could not find CategoryList.txt file %s in $JOBOPTSEARCHPATH" % lkwfile)
 
 ## Set the run numbers
+dsid = os.path.basename(runArgs.jobConfig[0])
+if not dsid.isdigit():
+    dsid = "999999"
 svcMgr.EventSelector.RunNumber = int(dsid)
 
 ## Include information about generators in metadata
@@ -398,6 +394,39 @@ include("EvgenJobTransforms/Generate_ecmenergies.py")
 ## Process random seed arg and pass to generators
 include("EvgenJobTransforms/Generate_randomseeds.py")
 
+##=============================================================
+## Check release number
+##=============================================================
+# Function to check blacklist (from Spyros'es logParser.py)
+def checkBlackList(relFlavour,cache,generatorName) :
+    isError = None
+    with open('/cvmfs/atlas.cern.ch/repo/sw/Generators/MC16JobOptions/common/BlackList_caches.txt') as bfile:
+        for line in bfile.readlines():
+            if not line.strip():
+                continue
+            # Blacklisted release flavours
+            badRelFlav=line.split(',')[0].strip()
+            # Blacklisted caches
+            badCache=line.split(',')[1].strip()
+            # Blacklisted generators
+            badGens=line.split(',')[2].strip()
+
+            used_gens = ','.join(generatorName)
+            #Match Generator and release type e.g. AtlasProduction, MCProd
+            if relFlavour==badRelFlav and cache==badCache and re.search(badGens,used_gens) is not None:
+                if badGens=="": badGens="all generators"
+                isError=relFlavour+","+cache+" is blacklisted for " + badGens
+                return isError  
+    return isError
+## Announce start of JO checkingrelease nimber checking
+evgenLog.debug("****************** CHECKING RELEASE IS NOT BLACKLISTED *****************")
+rel = os.popen("echo $AtlasVersion").read()
+rel = rel.strip()
+errorBL = checkBlackList("AthGeneration",rel,gennames)
+if (errorBL):
+#   evgenLog.warning("This run is blacklisted for this generator, please use a different one !! "+ errorBL )
+   raise RuntimeError("This run is blacklisted for this generator, please use a different one !! "+ errorBL)
+
 ## Add special config option (extended model info for BSM scenarios)
 svcMgr.TagInfoMgr.ExtraTagValuePairs += ["specialConfiguration", evgenConfig.specialConfig ]
 
@@ -595,12 +624,6 @@ else:
         raise RuntimeError("evgenConfig.inputfilecheck specified in %s, but generators %s do not require an input file" %
                            (runArgs.jobConfig, str(gennames)))
 
-## Check conf files, as above but for a different command line arg, and with omission allowed
-if hasattr(runArgs, "inputGenConfFile") and runArgs.inputGenConfFile != "NONE":
-    if evgenConfig.inputconfcheck and not re.search(evgenConfig.inputconfcheck, runArgs.inputGenConfFile):
-        raise RuntimeError("inputGenConfFile=%s is incompatible with inputconfcheck (%s) in %s" %
-                           (runArgs.inputGenConfFile, evgenConfig.inputconfcheck, runArgs.jobConfig))
-
 ## Do the aux-file copying
 if evgenConfig.auxfiles:
     from PyJobTransformsCore.trfutil import get_files
diff --git a/Generators/EvgenProdTools/src/CountHepMC.cxx b/Generators/EvgenProdTools/src/CountHepMC.cxx
index 3e40238d18041fad0e974735e8723de730e375df..4f9d5a38afba435e9b9ff3281ead41293aee38b4 100644
--- a/Generators/EvgenProdTools/src/CountHepMC.cxx
+++ b/Generators/EvgenProdTools/src/CountHepMC.cxx
@@ -14,6 +14,7 @@
 #include "AthenaKernel/errorcheck.h"
 #include "EventInfo/EventInfo.h"
 #include "EventInfo/EventID.h"
+#include "EventInfo/EventType.h"
 #include <cmath>
 #include <cassert>
 
@@ -95,7 +96,7 @@ else{
     }
   }
 
-if (m_corRunNumber) {
+  if (m_corRunNumber) {
     // Change the EventID in the eventinfo header
     const EventInfo* pInputEvt(0);
     ATH_MSG_INFO("Set new run number called !!" << m_newRunNumber);
@@ -106,6 +107,13 @@ if (m_corRunNumber) {
       eventID->set_run_number(m_newRunNumber);
       ATH_MSG_INFO("Set new run number" << m_newRunNumber);
       ATH_MSG_DEBUG("Set new run number in event_ID");
+
+      // also set the MC channel number
+      EventType* event_type = const_cast<EventType*>(pInputEvt->event_type());
+      ATH_MSG_INFO("got event_type !! " );
+      event_type->set_mc_channel_number(m_newRunNumber);
+      ATH_MSG_INFO("Set new MC channel number" << event_type->mc_channel_number());
+      ATH_MSG_DEBUG("Set new mc_channel_number in event_type");
     } else {
       ATH_MSG_ERROR("No EventInfo object found");
       return StatusCode::SUCCESS;
diff --git a/Generators/Herwig7_i/CMakeLists.txt b/Generators/Herwig7_i/CMakeLists.txt
index 65d4fb39621a199f1057fb30f3634c46106b51b2..3c9ed90737ddbc198c9f6eb862c279fb941fc234 100644
--- a/Generators/Herwig7_i/CMakeLists.txt
+++ b/Generators/Herwig7_i/CMakeLists.txt
@@ -8,13 +8,17 @@ find_package( Boost )
 find_package( Herwig3 COMPONENTS HerwigAPI )
 find_package( ThePEG )
 find_package( GSL )
-# find_package( OpenLoops )
-find_package( VBFNLO )
+find_package( OpenLoops )
+# find_package( VBFNLO )
 find_package( hepmc3 )
 
 # Remove the --as-needed linker flags:
 atlas_disable_as_needed()
 
+# Add extra flag for H7 versions >=7.2
+set( _extraDefs )
+list( APPEND _extraDefs -DHWVER_IS_72=1 )
+
 # Component(s) in the package:
 if (HEPMC3_USE)
 atlas_add_component( Herwig7_i
@@ -32,14 +36,15 @@ else()
 atlas_add_component( Herwig7_i
    Herwig7_i/*.h src/*.cxx src/components/*.cxx
    INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HERWIG3_INCLUDE_DIRS}
-   ${THEPEG_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS} ${VBFNLO_INCLUDE_DIRS}
+   ${THEPEG_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS} ${OPENLOOPS_INCLUDE_DIRS}
    DEFINITIONS -DHWVERSION=\"${HERWIG3_LCGVERSION}\"
    -DHWVER_IS_72=\"${HW3_VER_IS_72}\"
    LINK_LIBRARIES ${HERWIG3_LIBRARIES}  ${Boost_LIBRARIES} 
-   ${THEPEG_LIBRARIES} ${GSL_LIBRARIES} ${VBFNLO_LIBRARIES}
+   ${THEPEG_LIBRARIES} ${GSL_LIBRARIES} ${OPENLOOPS_LIBRARIES}
    GeneratorModulesLib EventInfo GaudiKernel PathResolver AtlasHepMCLib )
 endif()
-# ${OPENLOOPS_INCLUDE_DIRS} ${OPENLOOPS_LIBRARIES}
+
+# ${VBFNLO_INCLUDE_DIRS} ${VBFNLO_LIBRARIES}
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
@@ -50,3 +55,5 @@ atlas_install_runtime( share/file/*.pdt share/file/*.dat )
 set( Herwig7Environment_DIR ${CMAKE_CURRENT_SOURCE_DIR}
    CACHE PATH "Location of Herwig7Environment.cmake" )
 find_package( Herwig7Environment )
+
+
diff --git a/Generators/Herwig7_i/python/Herwig72ConfigLHEF.py b/Generators/Herwig7_i/python/Herwig72ConfigLHEF.py
new file mode 100644
index 0000000000000000000000000000000000000000..4ca4153d04472b6f7ab5f7cd614d0d3886d67e98
--- /dev/null
+++ b/Generators/Herwig7_i/python/Herwig72ConfigLHEF.py
@@ -0,0 +1,293 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+## \file Herwig7ConfigLHEF.py
+## \brief Configuration class for showering LHE files from MG5_aMC@NLO or PowhegBox
+## \author Daniel Rauch (daniel.rauch@desy.de)
+
+import os
+
+import Herwig7Config as hw7Config
+import Herwig7Control as hw7Control
+import Herwig7Utils as hw7Utils
+
+
+## Configuration class for showering LHE files from MG5_aMC@NLO or PowhegBox
+##
+## Example JobOptions are available in [`examples/LHEF`](https://svnweb.cern.ch/trac/atlasoff/browser/Generators/Herwig7_i/trunk/examples/LHEF) and [`tests/athenaLHEF/jobOptions`](https://svnweb.cern.ch/trac/atlasoff/browser/Generators/Herwig7_i/trunk/tests/athenaLHEF/jobOptions).
+## 
+##
+## Process Setup and Generator Configuration
+## =========================================
+##
+## The LHE files have to follow a specific naming scheme which is detailed
+## [here](https://twiki.cern.ch/twiki/bin/view/AtlasProtected/PreparingLesHouchesEven).
+## The name of the LHE file is added as the command line parameter `--inputGeneratorFile`
+## to the `Generate_tf.py` command and can be accessed using the variable
+## `runArgs.inputGeneratorFile` in the JobOptions where they can be passed to the
+## functions [lhef_mg5amc_commands](\ref Herwig7ConfigLHEF::Hw7ConfigLHEF#lhef_mg5amc_commands)
+## or [lhef_powhegbox_commands](\ref Herwig7ConfigLHEF::Hw7ConfigLHEF#lhef_powhegbox_commands)
+## in order to communicate the LHE file names to %Herwig7, e.g.
+## 
+## \code{.py}
+## generator.lhef_mg5amc_commands(lhe_filename=runArgs.inputGeneratorFile, me_pdf_order="NLO")
+## \endcode
+## 
+## or
+## 
+## \code{.py}
+## generator.lhef_powhegbox_commands(lhe_filename=runArgs.inputGeneratorFile, me_pdf_order="NLO")
+## \endcode
+##
+##
+## Event Generation
+## ================
+##
+## To trigger the actual running of %Herwig7 in Athena please end the JobOptions with
+## 
+## \code{.py}
+## # run the generator
+## generator.run()
+## \endcode
+##
+## More specifically, the `run()` function triggers the creation of the %Herwig7 input
+## file and the preparation of the run (i.e. the `Herwig read` step).
+## This means, that no %Herwig7 settings should be modified after calling the
+## `run()` function because the changed settings would not be applied during the
+## event generation.
+##
+class Hw72ConfigLHEF(hw7Config.Hw7Config):
+
+
+  def __init__(self, genSeq, runArgs, run_name="Herwig", beams="pp"):
+
+    beams = beams.upper()
+    if beams not in ["EE", "EP" , "PP"]:
+      raise RuntimeError(hw7Utils.ansi_format_error("Parameter 'beams' must be one of the following: ['EE', 'EP' , 'PP']"))
+
+    ## provide variables initialized by the parent class
+    super(Hw72ConfigLHEF, self).__init__(genSeq, runArgs, run_name)
+
+    self.beams = beams
+
+    self.set_lhef_mg5amc_commands = False
+    self.set_lhef_powhegbox_commands = False
+
+
+  def local_pre_commands(self):
+
+    return """
+## ============================================
+## Local Pre-Commands from Herwig7ConfigLHEF.py
+## ============================================
+
+# > no local pre-commands at the moment
+"""
+
+
+  def local_post_commands(self):
+
+    return """
+## =============================================
+## Local Post-Commands from Herwig7ConfigLHEF.py
+## =============================================
+
+saverun {} /Herwig/Generators/EventGenerator
+""".format(self.run_name)
+
+
+
+  ## High-level function for triggering the process setup and the event generation.
+  ##
+  ## \warning Please do not modify the generator configuration in the job options after calling the `run()` function as
+  ##          the modified settings would not be applied in the event generation
+  ##
+  def run(self):
+
+    ## add default settings if they were not overwritten in the JobOptions
+
+    self.default_commands += self.beam_commands()
+    self.default_commands += self.random_seed_commands()
+    
+    if not self.set_printout_commands:
+      self.default_commands += self.printout_commands()
+    if not self.set_physics_parameter_commands:
+      self.default_commands += self.physics_parameter_commands()
+    if not self.set_technical_parameter_commands:
+      self.default_commands += self.technical_parameter_commands()
+
+    ## check for configuration errors
+
+    if self.set_lhef_mg5amc_commands and self.set_lhef_powhegbox_commands:
+      raise RuntimeError(hw7Utils.ansi_format_error("Please do not use both 'lhef_mg5amc_commands()' and 'lhef_powhegbox_commands()' at the same time!"))
+    if not self.set_lhef_mg5amc_commands and not self.set_lhef_powhegbox_commands:
+      raise RuntimeError(hw7Utils.ansi_format_error("Please use either 'lhef_mg5amc_commands()' or 'lhef_powhegbox_commands()' in the JobOptions!"))
+
+    ## do read and run step in one go
+
+    hw7Control.run(self)
+
+
+  ## Sets up reading of events from an LHE file
+  ##
+  ## \param usespin Use the spin of tau leptons from the LHE file (spins of other particles are ignored anyways)
+  ## \param usepwghlhereader Uses a different LHE reader, which is able to propagte multiple event weights
+  def __lhef_commands(self, lhe_filename="events.lhe", me_pdf_order="NLO", usespin=True, usepwghlhereader=False):
+
+    if me_pdf_order not in ["LO", "NLO"]:
+      raise RuntimeError(hw7Utils.ansi_format_error("Herwig7ConfigLHEF.py:__lhef_commands: Parameter 'me_pdf_order' must either be 'LO' or 'NLO'!"))
+
+    if lhe_filename.endswith(".tar.gz"): # athena will decompress the LHE file for us
+      lhe_filename = lhe_filename.replace(".tar.gz", ".events")
+      if not os.path.isfile(lhe_filename):
+        raise RuntimeError(hw7Utils.ansi_format_error("Herwig7ConfigLHEF.py:__lhef_commands: Could not find decompressed LHE file '{}'!".format(lhe_filename)))
+
+    momentum_treatment = ""
+    beam_commands = ""
+    if self.beams == "EE":
+      momentum_treatment = "Accept"
+    elif self.beams == "EP":
+      momentum_treatment = "RescaleEnergy"
+      beam_commands = """
+## Set the PDF for the LHE reader
+# set /Herwig/EventHandlers/LHEReader:PDFA /Herwig/Partons/Hard{MEPDFOrder}PDF
+""".format(MEPDFOrder = me_pdf_order)
+    elif self.beams == "PP":
+      momentum_treatment = "RescaleEnergy"
+      beam_commands = """
+## Set the PDF for the LHE reader
+# set /Herwig/EventHandlers/LHEReader:PDFA /Herwig/Partons/Hard{MEPDFOrder}PDF
+# set /Herwig/EventHandlers/LHEReader:PDFB /Herwig/Partons/Hard{MEPDFOrder}PDF
+""".format(MEPDFOrder = me_pdf_order)
+
+    pwg_reader_lib = "library powhegHerwig.so" 
+
+
+    self.commands += """
+## ----------------------------
+## Read in Events from LHE File
+## ----------------------------
+
+## Create the Handler and Reader
+{PwgReaderLib}
+library LesHouches.so
+create ThePEG::{PwgReader}LesHouchesFileReader /Herwig/EventHandlers/LHEReader
+create ThePEG::LesHouchesEventHandler /Herwig/EventHandlers/LHEHandler
+
+## Set LHE filename
+set /Herwig/EventHandlers/LHEReader:FileName {FileName}
+
+## Setup LHE event handler and LHE reader
+set /Herwig/Generators/EventGenerator:EventHandler /Herwig/EventHandlers/LHEHandler
+insert /Herwig/EventHandlers/LHEHandler:LesHouchesReaders 0 /Herwig/EventHandlers/LHEReader
+set /Herwig/EventHandlers/LHEHandler:PartonExtractor /Herwig/Partons/{Beams}Extractor
+set /Herwig/EventHandlers/LHEHandler:CascadeHandler /Herwig/Shower/ShowerHandler
+set /Herwig/EventHandlers/LHEHandler:HadronizationHandler /Herwig/Hadronization/ClusterHadHandler
+set /Herwig/EventHandlers/LHEHandler:DecayHandler /Herwig/Decays/DecayHandler
+set /Herwig/EventHandlers/LHEHandler:WeightNormalization CrossSection
+set /Herwig/EventHandlers/LHEHandler:WeightOption VarNegWeight
+set /Herwig/EventHandlers/LHEReader:IncludeSpin {IncludeSpin}
+set /Herwig/EventHandlers/LHEReader:MomentumTreatment {MomentumTreatment}
+set /Herwig/EventHandlers/LHEReader:AllowedToReOpen No
+
+## Parton shower settings
+set /Herwig/Shower/ShowerHandler:MaxPtIsMuF Yes
+set /Herwig/Shower/ShowerHandler:RestrictPhasespace Yes
+# treatment of wide angle radiation
+set /Herwig/Shower/PartnerFinder:PartnerMethod Random
+set /Herwig/Shower/PartnerFinder:ScaleChoice Partner
+
+## Don't use any cuts on LHE files
+create ThePEG::Cuts /Herwig/Cuts/NoCuts
+set /Herwig/EventHandlers/LHEReader:Cuts /Herwig/Cuts/NoCuts
+
+{BeamCommands}
+""".format(FileName = lhe_filename,
+           PwgReaderLib = pwg_reader_lib if usepwghlhereader is True else "",
+           PwgReader = "powheg" if usepwghlhereader is True else "",
+           Beams = self.beams,
+           IncludeSpin = "Yes" if usespin is True else "No",
+           MomentumTreatment = momentum_treatment,
+           BeamCommands = beam_commands)
+
+
+  ## Commands specific to showering of events produced with MG5_aMC@NLO
+  ##
+  ## \param[in] lhe_filename name of the LHE file that is to be showered
+  ## \param[in] me_pdf_order order (either `LO` or `NLO`) of the matrix element PDF.
+  ##                         This has to be consistent with the PDF used in the
+  ##                         hard process generation and the PDF set with
+  ##                         generator.me_pdf_commands.
+  ##
+  ## The reason for these specific settings is that for MC@NLO-like matching schemes
+  ## the subtraction of the parton shower contribution in the hard process and the
+  ## parton shower settings have to be consistent in order to recover the
+  ## correct terms at the NLO.
+  ##
+  ## For showering of previously existing LHE files
+  ##
+  ##     generator.lhef_powhegbox_commands(lhe_filename=runArgs.inputGeneratorFile)
+  ##
+  ## will work.
+  ##
+  def lhef_mg5amc_commands(self, lhe_filename="events.lhe", me_pdf_order="NLO", usespin=True):
+
+    if me_pdf_order not in ["LO", "NLO"]:
+      raise RuntimeError(hw7Utils.ansi_format_error("Herwig7ConfigLHEF.py:lhef_mg5amc_commands: Parameter 'me_pdf_order' must either be 'LO' or 'NLO'!"))
+
+    self.set_lhef_mg5amc_commands = True
+
+    self.__lhef_commands(lhe_filename, me_pdf_order, usespin)
+
+    self.commands += """
+## Commands specific to showering of events produced with MG5_aMC@NLO
+set /Herwig/Shower/KinematicsReconstructor:ReconstructionOption General
+set /Herwig/Shower/KinematicsReconstructor:InitialInitialBoostOption LongTransBoost
+set /Herwig/Shower/KinematicsReconstructor:InitialStateReconOption Rapidity
+# this option is not available anymore in Herwig 7.2:
+# set /Herwig/Shower/KinematicsReconstructor:FinalStateReconOption Default
+set /Herwig/Shower/ShowerHandler:SpinCorrelations No
+"""
+
+
+  ## Commands specific to showering of events produced with PowhegBox
+  ##
+  ## \param[in] lhe_filename name of the LHE file that is to be showered
+  ## \param[in] me_pdf_order order (either `LO` or `NLO`) of the matrix element PDF.
+  ##                         This has to be consistent with the PDF used in the
+  ##                         hard process generation and the PDF set with
+  ##                         generator.me_pdf_commands.
+  ## \param[in] usespin 
+  ## \param[in] usepwghlhereader 
+  ##
+  ## Specifying the LHE file name with
+  ##
+  ##     generator.lhef_powhegbox_commands(lhe_filename=runArgs.inputGeneratorFile)
+  ## 
+  ## should work both for showering existing LHE files as well as for on-the-fly (OTF)
+  ## running of PowhegBox and %Herwig7.
+  ##
+  ## Since for OTF running the LHE file generated by PowhegBox is usually
+  ## called `PowhegOTF._1.events` using
+  ##
+  ##     generator.lhef_powhegbox_commands(lhe_filename="PowhegOTF._1.events")
+  ## 
+  ## will normally also work in this case. If a different name for the LHE file
+  ## generated by PowhegBox is specified with the `--outputTXTFile` argument to
+  ## `Generate_tf.py` then `PowhegControl` will update the value of
+  ## `runArgs.inputGeneratorFile` accordingly and
+  ##
+  ##     generator.lhef_powhegbox_commands(lhe_filename=runArgs.inputGeneratorFile)
+  ##
+  ## should still work.
+  ##
+  ## If you want to use the pwglhereader, needed to propagte multiple event weights
+  ## you need to use a gridpack contains the powhegHerwig.so 
+  ## 
+  def lhef_powhegbox_commands(self, lhe_filename="events.lhe", me_pdf_order="NLO", usespin=True, usepwhglhereader=False):
+
+    if me_pdf_order not in ["LO", "NLO"]:
+      raise RuntimeError(hw7Utils.ansi_format_error("Herwig7ConfigLHEF.py:lhef_powhegbox_commands: Parameter 'me_pdf_order' must either be 'LO' or 'NLO'!"))
+
+    self.set_lhef_powhegbox_commands = True
+
+    self.__lhef_commands(lhe_filename, me_pdf_order, usespin, usepwhglhereader)
diff --git a/Generators/Herwig7_i/python/Herwig7Config.py b/Generators/Herwig7_i/python/Herwig7Config.py
index 31255e346973772ef2a7d7a3583156b58307b872..5c283c879b28ece5594c0f1531b3cf317c1274ff 100644
--- a/Generators/Herwig7_i/python/Herwig7Config.py
+++ b/Generators/Herwig7_i/python/Herwig7Config.py
@@ -25,11 +25,11 @@ class Hw7Config(object):
     self.set_printout_commands            = False
     self.set_physics_parameter_commands   = False
     self.set_technical_parameter_commands = False
+    self.use_PDGparams = False
 
     self.default_commands = hw7Utils.ConfigurationCommands()
     self.commands         = hw7Utils.ConfigurationCommands()
 
-
   ## \brief Commands applied to all configuration classes before commands from the JobOptions
   ## \todo  Remove `AngularOrdered` settungs once they are included in %Herwig7 by default
   def global_pre_commands(self):
@@ -38,19 +38,6 @@ class Hw7Config(object):
 ## Global Pre-Commands from Herwig7Config.py
 ## =========================================
 
-## fix for global default settings until released with Herwig7 itself
-set /Herwig/Shower/GtoQQbarSplitFn:AngularOrdered Yes
-set /Herwig/Shower/GammatoQQbarSplitFn:AngularOrdered Yes
-
-## fix for GeV-mass photon radiation until released with Herwig7 itself
-set /Herwig/Shower/GammatoQQbarSudakov:Alpha /Herwig/Shower/AlphaQED
-
-## fix for initial-state (backward evolution) splitting (AGENE-1384)
-set /Herwig/Shower/QtoGammaQSudakov:Alpha /Herwig/Shower/AlphaQED
-
-## fix for QED lepton radiation scale (ATLMCPROD-5138)
-set /Herwig/Shower/LtoLGammaSudakov:pTmin 0.000001
-
 ## ensure JetFinder uses AntiKt with R=0.4
 set /Herwig/Cuts/JetFinder:Variant AntiKt
 set /Herwig/Cuts/JetFinder:ConeRadius 0.4
@@ -121,28 +108,63 @@ set /Herwig/Generators/EventGenerator:EventHandler:LuminosityFunction:Energy {}
   def printout_commands(self):
 
     self.set_printout_commands = True
-
+    
     return("""
+
 ## Verbosity and printout settings
 set /Herwig/Generators/EventGenerator:DebugLevel 1
 set /Herwig/Generators/EventGenerator:PrintEvent 2
 set /Herwig/Generators/EventGenerator:UseStdout Yes
 set /Herwig/Generators/EventGenerator:NumberOfEvents 1000000000
-set /Herwig/Generators/EventGenerator:MaxErrors 1000000
+set /Herwig/Generators/EventGenerator:MaxErrors 500
 
 ## Make sampler print out cross sections for each subprocess
 set /Herwig/Samplers/Sampler:Verbose Yes
 """)
 
+    ## Before there were used the ATLAS MC15 default parameters for particle masses and widths and Weinberg angle
+    ##
+    ## As specified in https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/McProductionCommonParametersMC15
+    ## Now the PDG API is used to set the parameters via the python file Generators/EvgenProdTools/python/physics_parameters.py that generates the dictionary offline_dict.py with the parameters
 
-  ## ATLAS MC15 default parameters for particle masses and widths and Weinberg angle
-  ##
-  ## As specified in https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/McProductionCommonParametersMC15
   def physics_parameter_commands(self):
+    if self.use_PDGparams:
+       paramlist = []
+       self.physics_parameter_commands = True
+    
+       paramlist.append("## Masses and widths: PDG 2019 values")
+    
+    ## Load the dictionary and extract the values of the variables that were defined here before (top quark, W and Z boson)
+       from EvgenProdTools.offline_dict import parameters
+       for k,v in parameters.items():
+         if k == 'particles':
+           for key,value in v.items():
+             if int(key) == 24:
+               paramlist.append("set /Herwig/Particles/"+value['name']+"+:NominalMass "+value['mass'])
+               paramlist.append("set /Herwig/Particles/"+value['name']+"+:Width "+value['width'])
+               paramlist.append("set /Herwig/Particles/"+value['name']+"-:NominalMass "+value['mass'])
+               paramlist.append("set /Herwig/Particles/"+value['name']+"-:Width "+value['width'])
+             if int(key) == 23:
+               paramlist.append("set /Herwig/Particles/"+value['name']+"0:NominalMass "+value['mass'])
+               paramlist.append("set /Herwig/Particles/"+value['name']+"0:Width "+value['width'])
+             if int(key) == 6:
+               paramlist.append("set /Herwig/Particles/"+value['name']+"bar:NominalMass "+value['mass'])
+               paramlist.append("set /Herwig/Particles/"+value['name']+"bar:Width "+value['width'])         
+               paramlist.append("set /Herwig/Particles/"+value['name']+":NominalMass "+value['mass'])
+               paramlist.append("set /Herwig/Particles/"+value['name']+":Width "+value['width'])
+   
+    ## Take the value of sin2thetaW from the EW_parameters dictionary      
+         if k == 'EW_parameters':
+           for key,value in v.items():
+             if key[2] == "Sin2ThetaW":
+               paramlist.append("set /Herwig/Model:EW/"+str(key[2])+" "+str(value))
+       paramstring = '\n'.join(paramlist)
+       return(paramstring)
 
-    self.physics_parameter_commands = True
+    else:
+       self.physics_parameter_commands = True
 
-    return("""
+       return("""
 ## Masses and widths: PDG 2010 values (except TOP mass; kept at PDG2007)
 set /Herwig/Particles/t:NominalMass 172.5*GeV
 set /Herwig/Particles/tbar:NominalMass 172.5*GeV
@@ -157,7 +179,6 @@ set /Herwig/Particles/Z0:Width 2.4952*GeV
 set /Herwig/Model:EW/Sin2ThetaW 0.23113
 """)
 
-
   def technical_parameter_commands(self):
 
     self.set_technical_parameter_commands = True
@@ -168,10 +189,6 @@ set /Herwig/Particles/pomeron:PDF /Herwig/Partons/NoPDF
 
 ## Set long-lived particles stable
 set /Herwig/Decays/DecayHandler:MaxLifeTime 10*mm
-
-# Turn off intermediate photons inserted explicitly into the event record with an incorrect life length in the pi0 -> e+e-e+e- decay mode 
-# This is the default from H++ 2.6.1
-set /Herwig/Decays/PScalar4f:GenerateIntermediates 0
 """)
 
 
@@ -291,7 +308,7 @@ set /Herwig/Partons/RemnantPDF:MaxFlav {}
   ## \param[in] ps_tune_name name identifying the PS/hadronization tune
   ## \param[in] ue_tune_name name identifying the UE/MPI tune
   ## \return    Nothing, adds the corresponding commands directly to the generator configuration object
-  def tune_commands(self, ps_tune_name = "H7-PS-MMHT2014LO", ue_tune_name = "H7-UE-MMHT"):
+  def tune_commands(self, ps_tune_name = "H7-PS-MMHT2014LO", ue_tune_name = "H7.1-Default"):
 
     cmds = """
 ## -------------
@@ -299,7 +316,7 @@ set /Herwig/Partons/RemnantPDF:MaxFlav {}
 ## -------------
 """
     self.commands += cmds
-    self.ps_tune_commands(tune_name = ps_tune_name)
+    # self.ps_tune_commands(tune_name = ps_tune_name) # the name of the default PS tune may be obsolete
     self.ue_tune_commands(tune_name = ue_tune_name)
 
 
@@ -337,15 +354,15 @@ set /Herwig/Partons/RemnantPDF:MaxFlav {}
   ##
   ## \param[in] tune_name name identifying the UE/MPI tune
   ## \return    Nothing, adds the corresponding commands directly to the generator configuration object
-  def ue_tune_commands(self, tune_name = "H7-UE-MMHT"):
+  def ue_tune_commands(self, tune_name = "H7.1-Default"):
 
     cmds = """
 ## Underlying event tune settings
 """
 
-    if tune_name == "H7-UE-MMHT":
+    if tune_name == "H7.1-Default":
       cmds += """
-# > The underlying event tune "H7-UE-MMHT" is already
+# > The underlying event tune "H7.1-Default" is already
 # > configured in Herwig7 via the default settings.
 """
     # elif tune_name == "some-other-name":
@@ -399,7 +416,7 @@ set /Herwig/Particles/pomeron:PDF /Herwig/Partons/PomeronPDF
 
 # Technical parameters for this run
 set /Herwig/Generators/EventGenerator:EventHandler:Sampler:Ntry 100000
-set /Herwig/Generators/EventGenerator:MaxErrors 100000
+set /Herwig/Generators/EventGenerator:MaxErrors 500
 
 # MPI doesn't work
 # TODO: Is this a problem?
@@ -433,5 +450,3 @@ set /Herwig/Particles/pbar-:PDF /Herwig/Partons/BudnevPDF
 set /Herwig/Generators/EventGenerator:EventHandler:CascadeHandler:MPIHandler NULL
 
 """
-
-
diff --git a/Generators/Herwig7_i/src/Herwig7.cxx b/Generators/Herwig7_i/src/Herwig7.cxx
index 26cf4046333141863bc6ead18e08f79fa8d388fd..1204b9744e9a6d40fd8cb925d6425812bfc9b610 100644
--- a/Generators/Herwig7_i/src/Herwig7.cxx
+++ b/Generators/Herwig7_i/src/Herwig7.cxx
@@ -33,6 +33,53 @@
 #include "boost/thread/thread.hpp"
 #include "boost/filesystem.hpp"
 #include "boost/algorithm/string.hpp"
+#include "boost/foreach.hpp"
+#define foreach BOOST_FOREACH
+
+
+// Setup HepMC traits definition for ThePEG's converter to work
+#include "ThePEG/Vectors/HepMCConverter.h"
+#ifdef HWVER_IS_72
+namespace ThePEG {
+  template<>
+  struct HepMCTraits<HepMC::GenEvent>
+    : public HepMCTraitsBase<HepMC::GenEvent,
+                             HepMC::GenParticle,
+                             HepMC::GenParticle *,
+                             HepMC::GenVertex,
+                             HepMC::GenVertex *,
+                             HepMC::Polarization,
+                             HepMC::PdfInfo>
+  {
+    static bool hasUnits() {
+      #ifdef HEPMC_HAS_UNITS
+      return true;
+      #else
+      return false;
+      #endif
+    }
+  };
+}
+#else
+namespace ThePEG {
+  template<>
+  struct HepMCTraits<HepMC::GenEvent>
+    : public HepMCTraitsBase<HepMC::GenEvent,
+                            HepMC::GenParticle,
+                             HepMC::GenVertex,
+                             HepMC::Polarization,
+                             HepMC::PdfInfo>
+  {
+    static bool hasUnits() {
+      #ifdef HEPMC_HAS_UNITS
+      return true;
+      #else
+      return false;
+      #endif
+    }
+  };
+}
+#endif
 
 void   convert_to_HepMC(const ThePEG::Event & m_event, HepMC::GenEvent & evt, bool nocopies,ThePEG::Energy eunit, ThePEG::Length lunit);
 
diff --git a/Generators/Starlight_i/CMakeLists.txt b/Generators/Starlight_i/CMakeLists.txt
index 8dfb8fbf4e65aecb9dd092a6cf2c7f108640d4ab..018b4756c1ab9f2e816ea18e7fe63c0dfafe4c0f 100644
--- a/Generators/Starlight_i/CMakeLists.txt
+++ b/Generators/Starlight_i/CMakeLists.txt
@@ -27,4 +27,7 @@ atlas_add_component( Starlight_i
    LINK_LIBRARIES Starlight_iLib )
 
 # Install files from the package:
-atlas_install_joboptions( share/*.py )
+atlas_install_joboptions( share/common/*.py 
+                          share/example/*.py )
+
+
diff --git a/Generators/Starlight_i/share/common/Starlight_Common.py b/Generators/Starlight_i/share/common/Starlight_Common.py
new file mode 100644
index 0000000000000000000000000000000000000000..e6e724e814df2c24d7d8cd606ea95677de3abbf6
--- /dev/null
+++ b/Generators/Starlight_i/share/common/Starlight_Common.py
@@ -0,0 +1,13 @@
+from Starlight_i.Starlight_iConf import Starlight_i
+genSeq += Starlight_i("Starlight")
+genSeq.Starlight.McEventKey = "GEN_EVENT"
+
+evgenConfig.generators += ["Starlight"]
+
+## Extra stream persistency
+## 2101 == EventInfo, 133273 == MCTruth (HepMC)
+from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
+_evgenstream = AthenaPoolOutputStream("StreamEVGEN")
+_evgenstream.ItemList = ["2101#*","133273#GEN_EVENT"]
+del _evgenstream
+
diff --git a/Generators/Starlight_i/share/starlight.example.joboption.py b/Generators/Starlight_i/share/example/starlight.example.joboption.py
similarity index 100%
rename from Generators/Starlight_i/share/starlight.example.joboption.py
rename to Generators/Starlight_i/share/example/starlight.example.joboption.py
diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.cxx b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.cxx
index 14c8adee43aff44937b00d8b5374f88333dfeb45..83f609f0ff60418b42ad264571659974c3ad4622 100644
--- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.cxx
+++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.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
 */
 
 //////////////////////////////////////////////////////////////////////////
@@ -22,7 +22,6 @@
 // Geometry Stuff
 #include "Identifier/Identifier.h"
 #include "AtlasDetDescr/AtlasDetectorID.h"
-#include "AtlasDetDescr/AtlasDetectorID.h"
 #include "InDetIdentifier/PixelID.h"
 #include "InDetIdentifier/SCT_ID.h"
 #include "InDetIdentifier/TRT_ID.h"
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.cxx
index ab3922e10fe143d2f30efffdb3d5ef158140217b..56ba586a369221a0f29db47e9608f53496b88328 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.cxx
@@ -1,11 +1,10 @@
 /*
-  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 "TTrainedNetwork.h"
 #include <iostream>
 
-#include <iostream>
 #include <vector>
 
 using namespace std;
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/errors/trainNN.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/errors/trainNN.cxx
index 6e9fb23a9721caa7c1ece89f29fc1469468ce048..465e41bbb1c874bbe5bd07e969e455b5cd8b25c1 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/errors/trainNN.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/errors/trainNN.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 <TChain.h>
@@ -22,8 +22,6 @@
 
 #include "../TTrainedNetwork.h"
 
-#include <iostream>
-
 #include "TMatrixD.h"
 #include "TVectorD.h"
 #include "trainNN.h"
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/number/trainNN.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/number/trainNN.cxx
index a9db60f15ac8a0433be45ec95a096463e130ebc9..87a17f6e1efdc83f50bbb5033c694673adefa974 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/number/trainNN.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/number/trainNN.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 <TTree.h>
@@ -21,8 +21,6 @@
 #include "../TTrainedNetwork.h"
 #include "TChain.h"
 
-#include <iostream>
-
 #include "TMatrixD.h"
 #include "TVectorD.h"
 #include "trainNN.h"
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/positions/trainNN.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/positions/trainNN.cxx
index 1e744717bfa17befe685837c72443467e740f56d..843d149a19e3e09522e86ce14de9751a6ababeb7 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/positions/trainNN.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/positions/trainNN.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 <TTree.h>
@@ -22,8 +22,6 @@
 
 #include "../TTrainedNetwork.h"
 
-#include <iostream>
-
 #include "TMatrixD.h"
 #include "TVectorD.h"
 #include "trainNN.h"
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/validateNNnum.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/validateNNnum.cxx
index 51702260c6ad2acbf759b17ec3923db40c892625..122f20e7df5e0ee3414a44f9f7acd245b0cf3f2b 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/validateNNnum.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/validateNNnum.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 <TTree.h>
@@ -21,7 +21,6 @@
 
 #include "../TTrainedNetwork.h"
 
-#include <iostream>
 #include <sstream>
 #include "TMatrixD.h"
 #include "TVectorD.h"
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/writeNtuple.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/writeNtuple.C
index 893b9c7cbfed3cae80a7f3b90b62fa1c53982c24..35d94bcdebd599e3959137be509f7bd4b8f8ec18 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/writeNtuple.C
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/writeNtuple.C
@@ -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
 */
 
 #define writeNtuple_cxx
@@ -9,7 +9,6 @@
 #include <TCanvas.h>
 #include <TTree.h>
 #include <TFile.h>
-#include <TCanvas.h>
 #include <TH1F.h>
 #include <TLegend.h>
 #include <iostream>
@@ -26,8 +25,6 @@
 
 #include "../TTrainedNetwork.h"
 
-#include <iostream>
-
 #include "TMatrixD.h"
 #include "TVectorD.h"
 //#include "trainNN.h"
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/run2/src/PixMapOverlayWriter.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/run2/src/PixMapOverlayWriter.cxx
index f313a1bff54c25f90990ed85cbb207ca951951f8..e1995693d209149ff98f6da787510dedd764d1d3 100644
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/run2/src/PixMapOverlayWriter.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/run2/src/PixMapOverlayWriter.cxx
@@ -7,7 +7,6 @@
 #include "PixelConditionsData/SpecialPixelMap.h"
 #include "PixelConditionsTools/ISpecialPixelMapSvc.h"
 #include "AthenaPoolUtilities/CondAttrListCollection.h" 
-#include "PixelConditionsTools/ISpecialPixelMapSvc.h"
 
 // geometry
 #include "InDetIdentifier/PixelID.h"
diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/makeplots.cpp b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/makeplots.cpp
index 7eb4f4b2fe560df1b68f2ce8048b0c4c65749cff..4ed60ab1059fdea728a9dc750df7a7a054b4c686 100644
--- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/makeplots.cpp
+++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/share/makeplots.cpp
@@ -19,7 +19,6 @@
 #include <TLine.h>
 #include <TLegend.h>
 #include <TLegendEntry.h>
-#include <THStack.h>
 #include <TEventList.h>
 #include <TPad.h>
 #include <TPaveText.h>
diff --git a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/src/TRT_StrawStatus.cxx b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/src/TRT_StrawStatus.cxx
index 83ec8b08bd3ce8602b3c26ca133b2f30595ac830..cf21c217211f20680e7682a9a2e5fddd94d94a7e 100644
--- a/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/src/TRT_StrawStatus.cxx
+++ b/InnerDetector/InDetCalibAlgs/TRT_CalibAlgs/src/TRT_StrawStatus.cxx
@@ -16,7 +16,6 @@
 
 #include "TrkTrack/Track.h"
 #include "TrkTrack/TrackCollection.h"
-#include "InDetPrepRawData/TRT_DriftCircle.h"
 
 #include "xAODEventInfo/EventInfo.h"
 
diff --git a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/FillAlignTRTHits.cxx b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/FillAlignTRTHits.cxx
index 1db966294169f598ec92986a55999598e58e31bb..ebb9ea397e5adec83640e984a8e1c20481d3d357 100755
--- a/InnerDetector/InDetCalibTools/TRT_CalibTools/src/FillAlignTRTHits.cxx
+++ b/InnerDetector/InDetCalibTools/TRT_CalibTools/src/FillAlignTRTHits.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
 */
 
 /********************************************************************
@@ -21,7 +21,6 @@ PURPOSE: Tool
 #include "FillAlignTRTHits.h"
 #include "TRT_CalibData/TrackInfo.h"
 #include "TrkTrack/Track.h"
-#include "TrkParameters/TrackParameters.h"
 #include "TrkEventPrimitives/LocalParameters.h"
 #include "EventPrimitives/EventPrimitives.h"
 #include "TrkRIO_OnTrack/RIO_OnTrack.h"
diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/TRT_BSErrContainer_p1.h b/InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/TRT_BSErrContainer_p1.h
index 7419411281b4b04068d7f2bd03a7307e15b5ca88..855645a4a8b53e7145b901af85bc382c6ae7e93c 100644
--- a/InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/TRT_BSErrContainer_p1.h
+++ b/InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/TRT_BSErrContainer_p1.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
 */
 
 /***************************************************************************
@@ -14,7 +14,6 @@
 #include <stdint.h>
 #include "AthContainers/DataVector.h"
 #include "AthenaKernel/CLASS_DEF.h"
-#include <stdint.h>
 
 typedef DataVector<std::pair<uint8_t, uint32_t> > TRT_BSErrContainer_p1; // <type, index>
 
diff --git a/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_AlignDbSvc.cxx b/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_AlignDbSvc.cxx
index d33b6115896169da2f587d6923d76508ed4b2132..690d72008c538d9bb8480592ec867b124b59fe49 100755
--- a/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_AlignDbSvc.cxx
+++ b/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_AlignDbSvc.cxx
@@ -23,7 +23,6 @@
 #include "TRT_ReadoutGeometry/TRT_DetectorManager.h"
 
 #include "TRT_ConditionsData/FloatArrayStore.h"
-#include "TRT_ReadoutGeometry/TRT_DetectorManager.h"
 #include "AthenaKernel/IOVSvcDefs.h"
 
 // Amg
diff --git a/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_DCS_ConditionsSvc.h b/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_DCS_ConditionsSvc.h
index 0749d168c0052793223d59d3451fbe1c15197558..d83190a2638bc47397b270b7e24fb734a904e83c 100755
--- a/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_DCS_ConditionsSvc.h
+++ b/InnerDetector/InDetConditions/TRT_ConditionsServices/src/TRT_DCS_ConditionsSvc.h
@@ -15,7 +15,6 @@
 #include "CxxUtils/checker_macros.h"
 #include "TRT_ConditionsServices/ITRT_DCS_ConditionsSvc.h"
 #include "TRT_ConditionsServices/ITRT_ConditionsSvc.h"
-#include "AthenaBaseComps/AthService.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ICondSvc.h"
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/ServicesTracker.cxx b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/ServicesTracker.cxx
index f43b215dd2563de7350ab2824e10d20e9c34bfea..9bc3c8c479001c5898df9b391a7944bc77ab91c1 100644
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/ServicesTracker.cxx
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/ServicesTracker.cxx
@@ -13,7 +13,6 @@
 #include "InDetServMatGeoModel/ConvertStaveServices.h"
 
 #include <map>
-#include <iostream>
 
 #include <iostream>  // for DEBUG only
 using namespace std;
diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/TRT_LayerBuilder.cxx b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/TRT_LayerBuilder.cxx
index 4821bdba4e4a5f817d51606b1defdcb7569adbe2..50d448df154f77c52b969836c88dbad1d8992d38 100755
--- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/TRT_LayerBuilder.cxx
+++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/TRT_LayerBuilder.cxx
@@ -22,7 +22,6 @@
 #include "TrkDetDescrUtils/BinnedArray2D.h"
 #include "TrkDetDescrUtils/BinnedArray1D.h"
 #include "TrkDetDescrUtils/BinUtility.h"
-#include "TrkDetDescrUtils/BinUtility.h"
 // GeoPrimitives
 #include "GeoPrimitives/GeoPrimitivesHelpers.h"
 #include "GeoPrimitives/GeoPrimitivesToStringConverter.h"
diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/TRT_LayerBuilderCond.cxx b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/TRT_LayerBuilderCond.cxx
index 874a6a622ddb6988d26e670610eaa94e5dcedc7c..832f106603ec294f960b5781a0396f1e0a221f5b 100755
--- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/TRT_LayerBuilderCond.cxx
+++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/TRT_LayerBuilderCond.cxx
@@ -22,7 +22,6 @@
 #include "TrkDetDescrUtils/BinnedArray2D.h"
 #include "TrkDetDescrUtils/BinnedArray1D.h"
 #include "TrkDetDescrUtils/BinUtility.h"
-#include "TrkDetDescrUtils/BinUtility.h"
 // GeoPrimitives
 #include "GeoPrimitives/GeoPrimitivesHelpers.h"
 #include "GeoPrimitives/GeoPrimitivesToStringConverter.h"
diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelLayer.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelLayer.cxx
index 5c8be1c4430fdc464efef932526d8a9e4ead7cca..63330a7192e262c15bb4e8651a581dd427390072 100644
--- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelLayer.cxx
+++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelLayer.cxx
@@ -29,7 +29,6 @@
 #include "GeoModelKernel/GeoTransform.h"
 
 #include "GeoModelKernel/GeoTubs.h"
-#include "GeoModelKernel/GeoPhysVol.h"
 #include "GaudiKernel/SystemOfUnits.h"
 
 #include <sstream>
diff --git a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_BaseElement.cxx b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_BaseElement.cxx
index d438c6eccc8f111d24dcca3c3556eb0a826d55f9..17cc25a65907cceb104480d6e5c64662da8b6f25 100755
--- a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_BaseElement.cxx
+++ b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_BaseElement.cxx
@@ -11,7 +11,6 @@
 #include "GeoModelUtilities/GeoAlignmentStore.h"
 #include "GeoPrimitives/CLHEPtoEigenConverter.h"
 
-#include "GeoModelUtilities/GeoAlignmentStore.h"
 #include "InDetIdentifier/TRT_ID.h"
 
 #include <vector>
diff --git a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_EndcapElement.cxx b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_EndcapElement.cxx
index 122ae59933a35c0244ed35951ff4a0837d65a036..7b857eac6d450fdf72db9e64a4287a6628f77672 100755
--- a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_EndcapElement.cxx
+++ b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_EndcapElement.cxx
@@ -22,8 +22,6 @@
 #include "TRT_ConditionsData/ExpandedIdentifier.h"
 #include "TRT_ConditionsData/StrawDxContainer.h"
 
-#include "GeoModelUtilities/GeoAlignmentStore.h"
-
 namespace InDetDD {
 
 TRT_EndcapElement::TRT_EndcapElement(const GeoVFullPhysVol* volume,
diff --git a/InnerDetector/InDetDigitization/BCM_Digitization/src/BCM_DigitizationTool.cxx b/InnerDetector/InDetDigitization/BCM_Digitization/src/BCM_DigitizationTool.cxx
index 6f65b86848d6175e63440697fdf30b4b1ec68bbf..a0e27bc23205b86e1dcc7645a3237c4112b6c88e 100644
--- a/InnerDetector/InDetDigitization/BCM_Digitization/src/BCM_DigitizationTool.cxx
+++ b/InnerDetector/InDetDigitization/BCM_Digitization/src/BCM_DigitizationTool.cxx
@@ -17,8 +17,6 @@
 #include "xAODEventInfo/EventInfo.h"             // NEW EDM
 #include "xAODEventInfo/EventAuxInfo.h"          // NEW EDM
 
-#include "CLHEP/Random/RandomEngine.h"
-
 //----------------------------------------------------------------------
 // Constructor with parameters:
 //----------------------------------------------------------------------
diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx
index 1764ddfdd4b64c6246263e717060557a8eb7eb68..0f2051120e6227e975a61e3ec58c1f24cabbd45c 100644
--- a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx
+++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx
@@ -30,7 +30,6 @@
 
 // Pile-up
 
-#include "InDetReadoutGeometry/SiDetectorDesign.h"
 #include "PixelReadoutGeometry/PixelModuleDesign.h"
 
 // Fatras
diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/SiSmearedDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/SiSmearedDigitizationTool.cxx
index 470093020a18f52c403cf0e22a69848c6b2054eb..48cbc95c5b24877dc3f07b99a9cb2ea5b1e0dabc 100644
--- a/InnerDetector/InDetDigitization/FastSiDigitization/src/SiSmearedDigitizationTool.cxx
+++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/SiSmearedDigitizationTool.cxx
@@ -35,7 +35,6 @@
 // Pile-up
 #include "PileUpTools/PileUpMergeSvc.h"
 
-#include "InDetReadoutGeometry/SiDetectorDesign.h"
 #include "PixelReadoutGeometry/PixelModuleDesign.h"
 #include "SCT_ReadoutGeometry/SCT_ModuleSideDesign.h"
 #include "SCT_ReadoutGeometry/SCT_BarrelModuleSideDesign.h"
diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h
index adb5b1a68d522f00a43125a20f7633f560b32876..849cb7cacb3666f65d56ca14d3451789ea0c6f03 100644
--- a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h
+++ b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h
@@ -19,7 +19,6 @@
 #include "HitManagement/TimedHitPtr.h"
 #include "SiDigitization/SiChargedDiodeCollection.h"
 #include "InDetReadoutGeometry/SiDetectorElement.h"
-#include "SiDigitization/SiChargedDiodeCollection.h"
 #include "PixelReadoutGeometry/PixelModuleDesign.h"
 #include "SiPropertiesTool/ISiPropertiesTool.h"
 
diff --git a/InnerDetector/InDetEventCnv/InDetEventTPCnv/InDetEventTPCnv/InDetEventTPCnvDict.h b/InnerDetector/InDetEventCnv/InDetEventTPCnv/InDetEventTPCnv/InDetEventTPCnvDict.h
index 4a8d1785c30049eafd6c3fffbd7a0460fb3d69ef..3483029751408f6fcf520a6b313bc4c76d8fad69 100644
--- a/InnerDetector/InDetEventCnv/InDetEventTPCnv/InDetEventTPCnv/InDetEventTPCnvDict.h
+++ b/InnerDetector/InDetEventCnv/InDetEventTPCnv/InDetEventTPCnv/InDetEventTPCnvDict.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 INDETEVENTTPCNV_INDETEVENTTPCNVDICT_H
@@ -28,11 +28,9 @@
 #include "InDetEventTPCnv/PixelClusterContainer_p3.h"
 #include "InDetEventTPCnv/SCT_ClusterContainer_p2.h"
 #include "InDetEventTPCnv/SCT_ClusterContainer_p3.h"
-#include "InDetEventTPCnv/PixelClusterContainer_tlp1.h"
 #include "InDetEventTPCnv/SCT_ClusterContainer_tlp1.h"
 #include "InDetEventTPCnv/TRT_DriftCircleContainer_tlp1.h"
 #include "InDetEventTPCnv/InDetPrepRawData/PixelGangedClusterAmbiguities_p1.h"
-#include "InDetEventTPCnv/TRT_DriftCircleContainer_tlp1.h"
 #include "InDetEventTPCnv/InDetCompetingRIOsOnTrack/CompetingPixelClustersOnTrack_p1.h"
 #include "InDetEventTPCnv/InDetCompetingRIOsOnTrack/CompetingSCT_ClustersOnTrack_p1.h"
 #include "InDetEventTPCnv/InDetCompetingRIOsOnTrack/CompetingTRT_DriftCirclesOnTrack_p1.h"
diff --git a/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/InDetEventTPCnv.cxx b/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/InDetEventTPCnv.cxx
index c828f40b610cfbfea281cef6568acd78ae3a0d6f..70eb5c3ffcf72d50df6ca31d9d1eafa1dcd75fb4 100644
--- a/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/InDetEventTPCnv.cxx
+++ b/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/InDetEventTPCnv.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
 */
 
 // generate the T/P converter entries
@@ -22,11 +22,9 @@
 #include "InDetEventTPCnv/PixelClusterContainer_p2.h"
 #include "InDetEventTPCnv/PixelClusterContainer_p3.h"
 #include "InDetEventTPCnv/SCT_ClusterContainer_p2.h"
-#include "InDetEventTPCnv/PixelClusterContainer_tlp1.h"
 #include "InDetEventTPCnv/SCT_ClusterContainer_tlp1.h"
 #include "InDetEventTPCnv/TRT_DriftCircleContainer_tlp1.h"
 #include "InDetEventTPCnv/InDetPrepRawData/PixelGangedClusterAmbiguities_p1.h"
-#include "InDetEventTPCnv/TRT_DriftCircleContainer_tlp1.h"
 #include "InDetEventTPCnv/InDetCompetingRIOsOnTrack/CompetingPixelClustersOnTrack_p1.h"
 #include "InDetEventTPCnv/InDetCompetingRIOsOnTrack/CompetingSCT_ClustersOnTrack_p1.h"
 #include "InDetEventTPCnv/InDetCompetingRIOsOnTrack/CompetingTRT_DriftCirclesOnTrack_p1.h"
diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx
index 93cc1a051d1674e4770654dc5b8a8200e0a975fa..f25ae994aea041185dc8e43a7a5bb598406d1aaa 100644
--- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx
+++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx
@@ -1040,14 +1040,24 @@ void  PixelPrepDataToxAOD::addNNTruthInfo(  xAOD::TrackMeasurementValidation* xp
       
       auto particle = siHit.particleLink();
       pdgid[hitNumber]   = particle->pdg_id();
-      truep[hitNumber]  = particle->momentum().rho();
-      if ( particle->production_vertex() ){
-        auto vertex =  particle->production_vertex();
+      HepMC::FourVector mom=particle->momentum();
+      truep[hitNumber]  = std::sqrt(mom.x()*mom.x()+mom.y()*mom.y()+mom.z()*mom.z());
+      auto vertex =  particle->production_vertex();
+//AV Please note that taking the first particle as a mother is ambiguous.
+#ifdef HEPMC3
+      if ( vertex && vertex->particles_in().size()>0){
+        auto mother_of_particle=vertex->particles_in().at(0);             
+        motherBarcode[hitNumber] =  HepMC::barcode(mother_of_particle);
+        motherPdgid[hitNumber]    = mother_of_particle->pdg_id();
+      }
+#else
+      if ( vertex ){
         if( vertex->particles_in_const_begin() !=  vertex->particles_in_const_end() ){
           motherBarcode[hitNumber] =  (*vertex->particles_in_const_begin())->barcode();
           motherPdgid[hitNumber]    =  (*vertex->particles_in_const_begin())->pdg_id();
         }
       }
+#endif
     }
     chargeDep[hitNumber] = siHit.energyLoss() ;
     
diff --git a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py
index bf315e2c2a919dbaacbf93edc77c14200d5de215..7b9068cff2f8200fdbb2a69e38a4ab9049548b90 100644
--- a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py
+++ b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py
@@ -1192,13 +1192,18 @@ class nnCutLargeD0Threshold(InDetFlagsJobProperty):
   allowedTypes = ['float']
   StoredValue  = -1.0
 
+class writeSeedValNtuple(InDetFlagsJobProperty):
+    """Turn writing of seed validation ntuple on and off"""
+    statusOn     = True
+    allowedTypes = ['bool']
+    StoredValue  = False
+
 class doTRTPIDNN(InDetFlagsJobProperty): 
   """calculate NN-based TRT electron probability""" 
   statusOn     = True 
   allowedTypes = ['bool']
   StoredValue  = True
 
-
 ##-----------------------------------------------------------------------------
 ## 2nd step
 ## Definition of the InDet flag container
@@ -2794,6 +2799,7 @@ _list_InDetJobProperties = [Enabled,
                             doDigitalROTCreation,
                             nnCutLargeD0Threshold,
                             useMuForTRTErrorScaling,
+                            writeSeedValNtuple,
                             doTRTPIDNN
                            ]
 for j in _list_InDetJobProperties: 
diff --git a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py
index 761913acf116c19969b1f994c19b59084829ef5d..1512c01c43b28e5e753f5b0d082193c059730c30 100644
--- a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py
+++ b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py
@@ -325,6 +325,10 @@ def getNnClusterizationFactory(name='NnClusterizationFactory', **kwargs) :
     useTTrainedNetworks = InDetFlags.useNNTTrainedNetworks()
     from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as geoFlags
     do_runI = geoFlags.Run() not in ["RUN2", "RUN3"]
+
+    if do_runI and not useTTrainedNetworks:
+      log.debug("useNNTTrainedNetworks must be True for Run I. Contact CTIDE for questions.")
+      useTTrainedNetworks = True
     
     if useTTrainedNetworks :
       log.debug("Setting up TTrainedNetworks")
diff --git a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
index 64b02d8db7904188de6f18f391deb15ecb961391..5a6650eeed510b01cd74cd0bc154b1e76490dcc0 100644
--- a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
+++ b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
@@ -61,7 +61,10 @@ class  ConfiguredNewTrackingSiPattern:
       #
       # ------------------------------------------------------------
 
+      doSeedMakerValidation = InDetFlags.writeSeedValNtuple()
+
       if InDetFlags.doSiSPSeededTrackFinder():
+
          #
          # --- Space points seeds maker, use different ones for cosmics and collisions
          #
@@ -95,6 +98,17 @@ class  ConfiguredNewTrackingSiPattern:
                                                                SpacePointsOverlapName = InDetKeys.OverlapSpacePoints(),
                                                                radMax                 = NewTrackingCuts.radMax(),
                                                                RapidityCut            = NewTrackingCuts.maxEta())
+
+         if doSeedMakerValidation:
+
+           InDetSiSpacePointsSeedMaker.WriteNtuple = True
+
+           from AthenaCommon.AppMgr import ServiceMgr
+           if not hasattr(ServiceMgr, 'THistSvc'):
+             from GaudiSvc.GaudiSvcConf import THistSvc
+             ServiceMgr += THistSvc()
+
+           ServiceMgr.THistSvc.Output  = ["valNtuples DATAFILE='SeedMakerValidation.root' OPT='RECREATE'"]
             
          if NewTrackingCuts.mode() == "Offline" or InDetFlags.doHeavyIon() or  NewTrackingCuts.mode() == "ForwardTracks":
             InDetSiSpacePointsSeedMaker.maxdImpactPPS = NewTrackingCuts.maxdImpactPPSSeeds()
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
index 0af2fb4750b9db2589a326d02cf2a08f6da20b8f..65e66dd9831ebb4e5232de55dd9b92af032585d8 100644
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
@@ -551,7 +551,6 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
   //if ( newLowStatFlag ) {    }
   //if ( newLumiBlockFlag() ) {    }
   if ( newRunFlag() ) {  
-
     //if user environment specified we don't want to book new histograms at every run boundary
     //we instead want one histogram per job
     if(m_histosBooked!=0 && AthenaMonManager::environment()==AthenaMonManager::user) return StatusCode::SUCCESS;
@@ -593,28 +592,37 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
     //###############
  
     
-    m_nhits_per_event = TH1F_LW::create("Nhits_per_event","Number of hits per event",1024,-0.5,1023.5);  
+    m_nhits_per_event = TH1F_LW::create("Nhits_per_event","Number of hits per event", 1024, -0.5, 1023.5);  
     RegisterHisto(al_mon,m_nhits_per_event) ;  
     m_nhits_per_event->GetXaxis()->SetTitle("Number of Hits on Tracks per Event"); 
-    m_nhits_per_event->GetYaxis()->SetTitle("Number of Events"); 
-    m_ntrk = TH1F_LW::create("ntracks","Number of Tracks",m_NTracksRange+1, -0.5, m_NTracksRange+0.5);
+    m_nhits_per_event->GetYaxis()->SetTitle("Number of Events");
+ 
+    m_ntrk = TH1F_LW::create("ntracks","Number of Tracks", m_NTracksRange+1, -0.5, m_NTracksRange+0.5);
     RegisterHisto(al_mon,m_ntrk);
+    m_ntrk->GetXaxis()->SetTitle("Number of Tracks");
+    m_ntrk->GetYaxis()->SetTitle("Number of Events");
+
     m_ngtrk = TH1F_LW::create("ngtracks","Number of Good Tracks",m_NTracksRange+1, -0.5, m_NTracksRange+0.5);
     RegisterHisto(al_mon,m_ngtrk);
-    m_nhits_per_track = TH1F_LW::create("Nhits_per_track","Number of hits per track",101,-0.5, 100.5);  
+    m_ngtrk->GetXaxis()->SetTitle("Number of Good Tracks");
+    m_ngtrk->GetYaxis()->SetTitle("Number of Events");
+
+    m_nhits_per_track = TH1F_LW::create("Nhits_per_track","Number of hits per track", 101, -0.5, 100.5);  
     RegisterHisto(al_mon,m_nhits_per_track) ; 
     m_nhits_per_track->GetXaxis()->SetTitle("Number of Hits per Track"); 
     m_nhits_per_track->GetYaxis()->SetTitle("Number of Tracks"); 
  
-    m_npixhits_per_track_barrel = TH1F_LW::create("Npixhits_per_track_barrel","Number of pixhits per track (Barrel)",14,-0.5,13.5);  
+    m_npixhits_per_track_barrel = TH1F_LW::create("Npixhits_per_track_barrel","Number of pixhits per track (Barrel)", 14,-0.5,13.5);  
     RegisterHisto(al_mon,m_npixhits_per_track_barrel) ;  
     m_npixhits_per_track_barrel->GetXaxis()->SetTitle("Number of Pixel Hits per Track in Barrel"); 
     m_npixhits_per_track_barrel->GetYaxis()->SetTitle("Number of Tracks"); 
-    m_nscthits_per_track_barrel = TH1F_LW::create("Nscthits_per_track_barrel","Number of scthits per track (Barrel)",30,-0.5,29.5);  
+
+    m_nscthits_per_track_barrel = TH1F_LW::create("Nscthits_per_track_barrel","Number of scthits per track (Barrel)", 30,-0.5,29.5);  
     RegisterHisto(al_mon,m_nscthits_per_track_barrel) ;  
     m_nscthits_per_track_barrel->GetXaxis()->SetTitle("Number of SCT Hits per Track in Barrel"); 
     m_nscthits_per_track_barrel->GetYaxis()->SetTitle("Number of Tracks"); 
-    m_ntrthits_per_track_barrel = TH1F_LW::create("Ntrthits_per_track_barrel","Number of trthits per track (Barrel)",100,-0.5,99.5);  
+
+    m_ntrthits_per_track_barrel = TH1F_LW::create("Ntrthits_per_track_barrel","Number of trthits per track (Barrel)", 100,-0.5,99.5);  
     RegisterHisto(al_mon,m_ntrthits_per_track_barrel) ; 
     m_ntrthits_per_track_barrel->GetXaxis()->SetTitle("Number of TRT Hits per Track in Barrel"); 
     m_ntrthits_per_track_barrel->GetYaxis()->SetTitle("Number of Tracks");   
@@ -623,10 +631,12 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
     RegisterHisto(al_mon,m_npixhits_per_track_eca) ;  
     m_npixhits_per_track_eca->GetXaxis()->SetTitle("Number of Pixel Hits per Track in ECA"); 
     m_npixhits_per_track_eca->GetYaxis()->SetTitle("Number of Tracks"); 
+
     m_nscthits_per_track_eca = TH1F_LW::create("Nscthits_per_track_eca","Number of scthits per track (Eca)",30,-0.5,29.5);  
     RegisterHisto(al_mon,m_nscthits_per_track_eca) ;  
     m_nscthits_per_track_eca->GetXaxis()->SetTitle("Number of SCT Hits per Track in ECA"); 
     m_nscthits_per_track_eca->GetYaxis()->SetTitle("Number of Tracks"); 
+
     m_ntrthits_per_track_eca = TH1F_LW::create("Ntrthits_per_track_eca","Number of trthits per track (Eca)",100,-0.5,99.5);  
     RegisterHisto(al_mon,m_ntrthits_per_track_eca) ;   
     m_ntrthits_per_track_eca->GetXaxis()->SetTitle("Number of TRT Hits per Track in ECA"); 
@@ -636,10 +646,12 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
     RegisterHisto(al_mon,m_npixhits_per_track_ecc) ;  
     m_npixhits_per_track_ecc->GetXaxis()->SetTitle("Number of Pixel Hits per Track in ECC"); 
     m_npixhits_per_track_ecc->GetYaxis()->SetTitle("Number of Tracks"); 
+
     m_nscthits_per_track_ecc = TH1F_LW::create("Nscthits_per_track_ecc","Number of scthits per track (Ecc)",30,-0.5,29.5);  
     RegisterHisto(al_mon,m_nscthits_per_track_ecc) ;  
     m_nscthits_per_track_ecc->GetXaxis()->SetTitle("Number of SCT Hits per Track in ECC"); 
     m_nscthits_per_track_ecc->GetYaxis()->SetTitle("Number of Tracks"); 
+
     m_ntrthits_per_track_ecc = TH1F_LW::create("Ntrthits_per_track_ecc","Number of trthits per track (Ecc)",100,-0.5,99.5);  
     RegisterHisto(al_mon,m_ntrthits_per_track_ecc) ;    
     m_ntrthits_per_track_ecc->GetXaxis()->SetTitle("Number of TRT Hits per Track in ECC"); 
@@ -648,30 +660,34 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
     ///////////////////////////////////////////////////////////////////////////////////////////////////
     //Monitoring plots shown in the dqm web page
     ///////////////////////////////////////////////////////////////////////////////////////////////////
-    m_chi2oDoF = TH1F_LW::create("chi2oDoF","chi2oDoF",100,0,10);  
+    m_chi2oDoF = TH1F_LW::create("chi2oDoF","chi2oDoF", 100, 0., 10.);  
     RegisterHisto(al_mon,m_chi2oDoF) ;  
     m_chi2oDoF->GetXaxis()->SetTitle("Track #chi^{2} / NDoF"); 
     m_chi2oDoF->GetYaxis()->SetTitle("Number of Tracks");  
-    m_eta = TH1F_LW::create("eta","eta",100,-m_etaRange,m_etaRange);  
+
+    m_eta = TH1F_LW::create("eta","eta", 80,-m_etaRange,m_etaRange);  
     RegisterHisto(al_mon_ls,m_eta) ;  
     m_eta->GetXaxis()->SetTitle("Track #eta"); 
-    m_eta->GetYaxis()->SetTitle("Number of Tracks"); 
-    m_phi = TH1F_LW::create("phi","phi",100,0,2*M_PI);  m_phi->SetMinimum(0);
+    m_eta->GetYaxis()->SetTitle("Number of Tracks");
+ 
+    m_phi = TH1F_LW::create("phi","phi", 80, 0,2*M_PI);  
     RegisterHisto(al_mon_ls,m_phi) ;  
+    m_phi->SetMinimum(0);
     m_phi->GetXaxis()->SetTitle("Track #phi"); 
     m_phi->GetYaxis()->SetTitle("Number of Tracks");  
-    m_d0_bscorr = TH1F_LW::create("d0_bscorr","d0 (corrected for beamspot); [mm]",400,-m_d0BsRange,m_d0BsRange);  
+
+    m_d0_bscorr = TH1F_LW::create("d0_bscorr","d0 (corrected for beamspot); d0 [mm]",200,-m_d0BsRange,m_d0BsRange);  
     RegisterHisto(al_mon_ls,m_d0_bscorr) ;  
     
     m_z0 = TH1F_LW::create("z0","z0;[mm]",100,-m_z0Range,m_z0Range);  
     RegisterHisto(al_mon,m_z0) ;  
     m_z0sintheta = TH1F_LW::create("z0sintheta","z0sintheta",100,-m_z0Range,m_z0Range);  
     RegisterHisto(al_mon,m_z0sintheta) ;  
+
     m_d0 = TH1F_LW::create("d0","d0;[mm]",400,-m_d0Range,m_d0Range);  
     RegisterHisto(al_mon,m_d0) ;  
     
 
-    
     m_npixhits_per_track = TH1F_LW::create("Npixhits_per_track","Number of pixhits per track",14,-0.5,13.5);  
     RegisterHisto(al_mon_ls,m_npixhits_per_track) ;  
     m_npixhits_per_track->GetXaxis()->SetTitle("Number of Pixel Hits per Track"); 
@@ -750,8 +766,6 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
     m_trk_pT_asym_ecc = TH1F_LW::create("trk_pT_asym_ecc","Track Charge Asymmetry versus pT (Endcap C) ",50,0,100);
     RegisterHisto(al_mon,m_trk_pT_asym_ecc);
     
-    
-    
 
     if(m_extendedPlots){
       
@@ -781,7 +795,7 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       RegisterHisto(al_mon, m_trk_pT_vs_eta_eca     );
 
       m_trk_d0_barrel  = TH1F_LW::create("trk_d0_barrel","Impact parameter: all tracks (Barrel); d_{0} [mm]",100, -m_d0Range, m_d0Range);
-      m_trk_d0c_barrel = TH1F_LW::create("trk_d0c_barrel","Impact parameter (corrected for vertex): all tracks (Barrel)",100, -5, 5);  
+      m_trk_d0c_barrel = TH1F_LW::create("trk_d0c_barrel","Impact parameter (corrected for vertex): all tracks (Barrel)",100, -4., 4.);  
       m_trk_z0_barrel  = TH1F_LW::create("trk_z0_barrel","Track z0: all tracks (Barrel)",100, -m_z0Range, m_z0Range);
       m_trk_d0_eca     = TH1F_LW::create("trk_d0_eca","Impact parameter: all tracks (Endcap A)",100, -m_d0Range, m_d0Range);
       m_trk_d0c_eca    = TH1F_LW::create("trk_d0c_eca","Impact parameter (corrected for vertex): all tracks  (Endcap A)",100, -m_d0Range, m_d0Range);  
@@ -808,8 +822,6 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       m_trk_chi2Prob = new TProfile("trk_chi2Prob","chi2Prob versus eta",100,-m_etaRange,m_etaRange,-5,5);  
       RegisterHisto(al_mon,m_trk_chi2Prob) ;
 
-    
-
       
       //Detailed IP Plots. All the PV Corrected are broken and need to be fixed.
       m_trk_d0_barrel_zoomin = TH1F_LW::create("trk_d0_barrel_zoomin","Impact parameter: all tracks (Barrel)",100,-5,5);
@@ -887,7 +899,6 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       
       
       
-      
       //PV corrected plots. Broken. 
       m_d0_pvcorr = TH1F_LW::create("d0_pvcorr","d0 (corrected for primVtx); [mm]",400,-m_d0Range,m_d0Range);  
       RegisterHisto(al_mon,m_d0_pvcorr) ; 
@@ -939,32 +950,32 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       m_trk_chi2ProbDist->GetYaxis()->SetTitle("Number of Tracks");
       RegisterHisto(al_mon,m_trk_chi2ProbDist) ;
       
-      m_errCotTheta = TH1F_LW::create("errCotTheta","Error of CotTheta",50,0,0.02);
+      m_errCotTheta = TH1F_LW::create("errCotTheta","Error of CotTheta", 40, 0, 0.02);
       RegisterHisto(al_mon,m_errCotTheta);  
       m_errCotTheta->GetXaxis()->SetTitle("Track #Delta(cot(#theta))"); 
       m_errCotTheta->GetYaxis()->SetTitle("Number of Tracks"); 
       
-      m_errCotThetaVsD0BS = new TH2F("errCotThetaVsD0BS","Error of CotTheta vs d0BS",-m_d0BsRange,m_d0BsRange,40,50,0 ,0.02);
+      m_errCotThetaVsD0BS = new TH2F("errCotThetaVsD0BS","Error of CotTheta vs d0BS", 50, -m_d0BsRange, m_d0BsRange, 40, 0. ,0.02);
       RegisterHisto(al_mon,m_errCotThetaVsD0BS) ;  
       m_errCotThetaVsD0BS->GetXaxis()->SetTitle("d0 (mm)"); 
       m_errCotThetaVsD0BS->GetYaxis()->SetTitle("Track #Delta(cot(#theta))"); 
 
-      m_errCotThetaVsPt = new TH2F("errCotThetaVsPt","Error of CotTheta vs Pt",50,0,40,50,0 ,0.02);
+      m_errCotThetaVsPt = new TH2F("errCotThetaVsPt","Error of CotTheta vs Pt",50,0,40, 40, 0. ,0.02);
       RegisterHisto(al_mon,m_errCotThetaVsPt) ;  
       m_errCotThetaVsPt->GetXaxis()->SetTitle("Pt (GeV/c)"); 
       m_errCotThetaVsPt->GetYaxis()->SetTitle("Track #Delta(cot(#theta))"); 
        
-      m_errCotThetaVsP = new TH2F("errCotThetaVsP","Error of CotTheta vs P",50,0,40,50,0 ,0.02);
+      m_errCotThetaVsP = new TH2F("errCotThetaVsP","Error of CotTheta vs P",50,0,40, 40, 0. ,0.02);
       RegisterHisto(al_mon,m_errCotThetaVsP) ;  
       m_errCotThetaVsP->GetXaxis()->SetTitle("P (GeV/c)"); 
       m_errCotThetaVsP->GetYaxis()->SetTitle("Track #Delta(cot(#theta))"); 
       
-      m_errCotThetaVsPhi = new TH2F("errCotThetaVsPhi","Error of CotTheta vs Phi",50,0,2*M_PI,50, 0 ,0.02);
+      m_errCotThetaVsPhi = new TH2F("errCotThetaVsPhi","Error of CotTheta vs Phi",50,0,2*M_PI, 40, 0. ,0.02);
       RegisterHisto(al_mon,m_errCotThetaVsPhi) ;  
       m_errCotThetaVsPhi->GetXaxis()->SetTitle("#phi0"); 
       m_errCotThetaVsPhi->GetYaxis()->SetTitle("Track #Delta(cot(#theta))"); 
       
-      m_errCotThetaVsEta = new TH2F("errCotThetaVsEta","Error of CotTheta vs Eta",50,-3., 3.,50, 0 ,0.02);
+      m_errCotThetaVsEta = new TH2F("errCotThetaVsEta","Error of CotTheta vs Eta",50,-3., 3., 40, 0. ,0.02);
       RegisterHisto(al_mon,m_errCotThetaVsEta) ;  
       m_errCotThetaVsEta->GetXaxis()->SetTitle("#eta"); 
       m_errCotThetaVsEta->GetYaxis()->SetTitle("Track #Delta(cot(#theta))"); 
@@ -973,12 +984,12 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       RegisterHisto(al_mon,m_errTheta);  
       m_errTheta->GetXaxis()->SetTitle("Track #Delta(#theta)"); 
       m_errTheta->GetYaxis()->SetTitle("Number of Tracks"); 
-    
+
       m_errThetaVsD0BS = new TH2F("errThetaVsD0BS","Error of Theta vs d0BS",50,-m_d0BsRange,m_d0BsRange,50,0 ,0.02);
       RegisterHisto(al_mon,m_errThetaVsD0BS) ;  
       m_errThetaVsD0BS->GetXaxis()->SetTitle("d0 (mm)"); 
       m_errThetaVsD0BS->GetYaxis()->SetTitle("Track #delta(#theta)");
-      
+
       m_errThetaVsPt = new TH2F("errThetaVsPt","Error of Theta vs Pt",50,0,50,50,0 ,0.02);
       RegisterHisto(al_mon,m_errThetaVsPt) ;  
       m_errThetaVsPt->GetXaxis()->SetTitle("Pt (GeV/c)"); 
@@ -1134,7 +1145,7 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       RegisterHisto(al_mon,m_PtVsPhi0Neg);
       m_PtVsPhi0Neg->GetXaxis()->SetTitle("#phi0 (rad)"); 
       m_PtVsPhi0Neg->GetYaxis()->SetTitle("Pt (GeV/c)");  
-      
+
       m_errPtVsEta = new TH2F("errPtVsEta", "Error of Pt Vs Eta", 50, -3., 3.,50, 0., 0.5);
       RegisterHisto(al_mon,m_errPtVsEta);
       m_errPtVsEta->GetXaxis()->SetTitle("#eta"); 
@@ -1188,7 +1199,7 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       m_QPtVsEta->GetXaxis()->SetTitle("#eta"); 
       RegisterHisto(al_mon,m_QPtVsEta);
       m_QPtVsEta->GetYaxis()->SetTitle("qPt (GeV)");  
-      
+
       //Plots to check the BeamSpot
       // versus Phi0
       m_D0bsVsPhi0 = new TH2F("D0bsVsPhi0", "d0_{bs} Vs #phi0 ", 50, 0, 2*M_PI, 400, -m_d0BsRange, m_d0BsRange);
@@ -1237,7 +1248,7 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       m_D0bsVsPtBarrel->GetXaxis()->SetTitle("qPt (GeV)"); 
       RegisterHisto(al_mon,m_D0bsVsPtBarrel);
       m_D0bsVsPtBarrel->GetYaxis()->SetTitle("d0_{bs} mm )");
-     
+
       //BeamSpot Position histos
       m_YBs_vs_XBs = new TH2F("YBs_vs_XBs","BeamSpot Position: y vs x",100, -0.9,-0.1, 100, -0.9,-0.1);
       RegisterHisto(al_mon,m_YBs_vs_XBs);
@@ -1307,7 +1318,7 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
       m_BeamSpotTiltY_vs_LumiBlock->GetYaxis()->SetRangeUser(-1,1);
         
     }
-    
+
     
     //These plots are broken. Have to be passed to the PVbiases tool
     m_trk_d0_wrtPV = TH1F_LW::create("d0_pvcorr_est","d0 (corrected for primVtx v2); [mm]",400,-0.2,0.2);  
@@ -1551,7 +1562,7 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
     m_eta_asym->GetYaxis()->SetTitle("(pos-neg)/(pos+neg)");   
 
 
-    
+
     // msg(MSG::INFO) << "lumiblock histos done " <<endmsg;
 
  
@@ -1559,27 +1570,27 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
 
     
     // lumiblock histos 
-    m_LumiBlock = TH1F_LW::create("LumiBlock","Lumi block",1024,-0.5,1023.5); 
+    m_LumiBlock = TH1F_LW::create("LumiBlock","Lumi block", 1024, -0.5, 1023.5); 
     RegisterHisto(al_mon,m_LumiBlock) ;
     m_LumiBlock->GetXaxis()->SetTitle("Lumi block ID"); 
     m_LumiBlock->GetYaxis()->SetTitle("# events");   
 
-    m_Tracks_per_LumiBlock = TH1F_LW::create("TracksPerLumiBlock","Tracks per Lumi block",1024,-0.5,1023.5); 
+    m_Tracks_per_LumiBlock = TH1F_LW::create("TracksPerLumiBlock","Tracks per Lumi block", 1024, -0.5, 1023.5); 
     RegisterHisto(al_mon,m_Tracks_per_LumiBlock) ;
     m_Tracks_per_LumiBlock->GetXaxis()->SetTitle("Lumi block ID"); 
     m_Tracks_per_LumiBlock->GetYaxis()->SetTitle("# tracks");   
 
-    m_NPIX_per_LumiBlock = TH1F_LW::create("NPixPerLumiBlock","N pixel hits per Lumi block",1024,-0.5,1023.5); 
+    m_NPIX_per_LumiBlock = TH1F_LW::create("NPixPerLumiBlock","N pixel hits per Lumi block", 1024, -0.5, 1023.5); 
     RegisterHisto(al_mon, m_NPIX_per_LumiBlock) ;
     m_NPIX_per_LumiBlock->GetXaxis()->SetTitle("Lumi block ID"); 
     m_NPIX_per_LumiBlock->GetYaxis()->SetTitle("# pixel hits");   
 
-    m_NSCT_per_LumiBlock = TH1F_LW::create("NSCTPerLumiBlock","N SCT hits per Lumi block",1024,-0.5,1023.5); 
+    m_NSCT_per_LumiBlock = TH1F_LW::create("NSCTPerLumiBlock","N SCT hits per Lumi block", 1024, -0.5, 1023.5); 
     RegisterHisto(al_mon, m_NSCT_per_LumiBlock) ;
     m_NSCT_per_LumiBlock->GetXaxis()->SetTitle("Lumi block ID"); 
     m_NSCT_per_LumiBlock->GetYaxis()->SetTitle("# SCT hits");   
 
-    m_NTRT_per_LumiBlock = TH1F_LW::create("NTRTPerLumiBlock","N TRT hits per Lumi block",1024,-0.5,1023.5); 
+    m_NTRT_per_LumiBlock = TH1F_LW::create("NTRTPerLumiBlock","N TRT hits per Lumi block", 1024, -0.5, 1023.5); 
     RegisterHisto(al_mon, m_NTRT_per_LumiBlock) ;
     m_NTRT_per_LumiBlock->GetXaxis()->SetTitle("Lumi block ID"); 
     m_NTRT_per_LumiBlock->GetYaxis()->SetTitle("# TRT hits");   
@@ -1587,7 +1598,7 @@ StatusCode IDAlignMonGenericTracks::bookHistograms()
     m_histosBooked++;
   }
   return StatusCode::SUCCESS;
-  
+
 }
 
 void IDAlignMonGenericTracks::RegisterHisto(MonGroup& mon, TH1F_LW* histo) {
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
index 18caef478a26e9cd81aa02a2f0027cd7cd654ce0..2cf31f6da2da4a224464f9732a8e6d5dd2b7162d 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
@@ -20,7 +20,6 @@
 #include "TMath.h"
 #include "TProfile2D.h"
 #include "TGraphErrors.h"
-#include "TF1.h"
 #include "TFitResult.h"
 #include "TFitResultPtr.h"
 
@@ -177,6 +176,9 @@ struct IDAlignMonResiduals::TRTEndcapHistograms{
 	TH2F* aveResVsPhiWheel[2]{};
 	TH2F* rmsResVsPhiWheel[2]{};
 
+	TH3F* resVsPhiWheelPos[2]{};
+	TH3F* resVsPhiWheelNeg[2]{};
+
 	/** Residual maps for low pT tracks separated by charge in the TRT Endcap */
 	TH3F* resVsRadiusWheelPos[2]{};
 	TH2F* aveResVsRadiusWheelPos[2]{};
@@ -184,6 +186,9 @@ struct IDAlignMonResiduals::TRTEndcapHistograms{
 	TH3F* resVsRadiusWheelNeg[2]{};
 	TH2F* aveResVsRadiusWheelNeg[2]{};
 	TH2F* rmsResVsRadiusWheelNeg[2]{};
+
+        // Residual vs pt and vs wheel in the endcap 
+	TH3F* resVsqPtWheel[2]{};
 };
 
 ////////////////////////////////////////
@@ -307,6 +312,7 @@ void IDAlignMonResiduals::InitializeHistograms()
 {
 
   m_totalEvents = 0;
+  m_hTotalTracks = 0;
   m_oldlumiblock = 0;
   m_sirescalcfailure =0;
   m_pix_eca_xresvsmodphidisk_3d = 0;
@@ -315,7 +321,7 @@ void IDAlignMonResiduals::InitializeHistograms()
   m_pix_ecc_yresvsmodphidisk_3d = 0;
   m_dbm_xresvsmodphi_2d = 0;
   m_sct_b_pullx_pt = 0;
-  m_sct_eca_pullx_pt = 0       ;
+  m_sct_eca_pullx_pt = 0;
   m_sct_ecc_pullx_pt = 0;
   m_sct_b0_xresvsmodetaphi_3d = 0;
   m_sct_b1_xresvsmodetaphi_3d = 0;
@@ -842,6 +848,9 @@ StatusCode IDAlignMonResiduals::bookHistograms()
       m_totalEvents  = new TH1F("TotalEvents","TotalEvents", 1, -0.5, 0.5);
       RegisterHisto(al_mon,m_totalEvents);
 
+      m_hTotalTracks  = new TH1F("TotalTracks","TotalTracks", 1, -0.5, 0.5);
+      RegisterHisto(al_mon,m_hTotalTracks);
+
       m_mu_perEvent = new TH1F("mu_perEvent","<#mu> per event", m_nBinsMuRange, m_muRangeMin, m_muRangeMax);
       RegisterHisto(al_mon,m_mu_perEvent);
     }
@@ -849,13 +858,17 @@ StatusCode IDAlignMonResiduals::bookHistograms()
 
     //All modules
     m_pix_b0_resXvsetaLumiBlock = new TProfile2D("pix_b0_resXvsetaLumiBlock","2D profile of X unbiased residuals vs IBL eta module per Lumi Block; LumiBlock;Module Eta",
-						 m_nBinsLB,m_LBRangeMin,m_LBRangeMax, 20,-10.5,9.5, m_minPIXResXFillRange,m_maxPIXResXFillRange);
+						 m_nBinsLB, m_LBRangeMin, m_LBRangeMax, 
+						 20, -10.5, 9.5, 
+						 m_minPIXResXFillRange, m_maxPIXResXFillRange);
     RegisterHisto(al_mon,m_pix_b0_resXvsetaLumiBlock);
 
     //Only planars
 
     m_pix_b0_resXvsetaLumiBlock_planars = new TProfile2D("pix_b0_resXvsetaLumiBlock_planars","2D profile of X unbiased residuals vs IBL eta module per Lumi Block;LumiBlock; Module Eta",
-							 m_nBinsLB,m_LBRangeMin,m_LBRangeMax, 12,-6.5,5.5, m_minPIXResXFillRange,m_maxPIXResXFillRange);
+							 m_nBinsLB,m_LBRangeMin,m_LBRangeMax, 
+							 12, -6.5, 5.5, 
+							 m_minPIXResXFillRange, m_maxPIXResXFillRange);
     RegisterHisto(al_mon,m_pix_b0_resXvsetaLumiBlock_planars);
 
 
@@ -935,7 +948,7 @@ StatusCode IDAlignMonResiduals::bookHistograms()
     RegisterHisto(al_mon,m_base_vs_LB_planars);
 
 
-    if(msgLvl(MSG::VERBOSE)) msg() << " INITIALIZED GENERALHISTOS FOR RESIDUALS "<< endmsg;
+    ATH_MSG_VERBOSE (" INITIALIZED GENERALHISTOS FOR RESIDUALS ");
     //PrintIBLGeometry();
     MakePIXBarrelHistograms (al_mon);
     MakePIXEndCapsHistograms(al_mon);
@@ -946,8 +959,9 @@ StatusCode IDAlignMonResiduals::bookHistograms()
     MakeTRTHistograms(al_mon);
 
     MakeSiliconHistograms(al_mon);
-    if(msgLvl(MSG::VERBOSE)) msg() << " INITIALIZED GENERALHISTOS FOR RESIDUALS "<< endmsg;
+    ATH_MSG_VERBOSE (" INITIALIZED GENERALHISTOS FOR RESIDUALS ");
     ++m_histosBooked;
+
   }
 
   ATH_MSG_VERBOSE(" Residual histograms booking COMPLETED");
@@ -1060,10 +1074,15 @@ StatusCode IDAlignMonResiduals::fillHistograms()
   SG::ReadHandle<xAOD::EventInfo> eventInfo (m_eventInfoKey, ctx);
 
   m_changedlumiblock = false;
-  m_lumiblock = eventInfo->lumiBlock();
-  if (m_lumiblock!=m_oldlumiblock){   //Changes every m_LBGranularity
-    m_oldlumiblock=m_lumiblock;
-    m_changedlumiblock=true;
+  if (eventInfo.isValid()) {
+    m_lumiblock = eventInfo->lumiBlock();
+    if (m_lumiblock!=m_oldlumiblock){   //Changes every m_LBGranularity
+      m_oldlumiblock=m_lumiblock;
+      m_changedlumiblock=true;
+    }
+  }
+  else {
+    ATH_MSG_DEBUG ("IDAlignMonResiduals::fillHistograms ** eventInfo retrieving failure");
   }
 
   if (!m_hasBeenCalledThisEvent){
@@ -1073,10 +1092,13 @@ StatusCode IDAlignMonResiduals::fillHistograms()
   else {
     m_mu = -999;
   }
+  ATH_MSG_DEBUG ("IDAlignMonResiduals::fillHistograms ** run number: " << eventInfo->runNumber() 
+		   << "  event number: " << eventInfo->eventNumber() 
+		   << "   lumiblock: " << m_lumiblock << "  mu: " << m_mu);
 
   if (m_extendedPlots){
     m_mu_perEvent->Fill(m_mu);
-    m_totalEvents->Fill(0);
+    m_totalEvents->Fill(0.);
   }
 
   float timeCor = 0.;
@@ -1094,15 +1116,18 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 
   SG::ReadHandle<TrackCollection> inputTracks{m_tracksName};
   if (not inputTracks.isValid()) {
-    ATH_MSG_DEBUG ("IDAlignMonResiduals::fillHistograms() -- " << m_tracksName.key() << " could not be retrieved");
+    ATH_MSG_WARNING ("IDAlignMonResiduals::fillHistograms ** " << m_tracksName.key() << " could not be retrieved");
     return StatusCode::RECOVERABLE;
   }
 
   const DataVector<Trk::Track>* tracks = m_trackSelection->selectTracks(inputTracks);
-  ATH_MSG_DEBUG ("IDAlignMonResiduals::fillHistograms() -- event: " << m_events
-		 << " with Track collection " << m_tracksName.key()
-		 << " has size =" << tracks->size());
-
+  ATH_MSG_DEBUG ("IDAlignMonResiduals::fillHistograms ** event: " << m_events
+		   << "  run: " << eventInfo->runNumber()
+		   << "  event: " << eventInfo->eventNumber()
+		   << "  LB: " << m_lumiblock
+		   << "  --> Track collection " << m_tracksName.key()
+		   << "  has size =" << tracks->size());
+  
   int nTracks = 0;
   int nHitsEvent = 0;
 
@@ -1111,8 +1136,8 @@ StatusCode IDAlignMonResiduals::fillHistograms()
     //need to get the Trk::Track object from which the TrackParticle object was created
     //this has the hit information
     const Trk::Track* track = *trackItr;
-    if(track == NULL){
-      ATH_MSG_WARNING("** IDAlignMonResiduals::fillHistograms ** No associated Trk::Track object found for track "<< nTracks);
+    if(track == nullptr){
+      ATH_MSG_DEBUG("** IDAlignMonResiduals::fillHistograms ** No associated Trk::Track object found for track "<< nTracks);
       continue;
     }
 
@@ -1136,6 +1161,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
     float trkpt      = -999;
     float trkqoverp2 = -999;
     float trketa_w   = -999;
+    bool countedTrack = false;
     
     if(m_extendedPlots) {
       trkqoverp2 =  track->perigeeParameters()->parameters()[Trk::qOverP]*fabs(track->perigeeParameters()->parameters()[Trk::qOverP])*1000000.;
@@ -1151,36 +1177,47 @@ StatusCode IDAlignMonResiduals::fillHistograms()
     }
     //looping over the hits of this track
     ATH_MSG_DEBUG ("** track " << nTracks << "/" << tracks->size() 
-		   << " pt: " <<  trkpt << "  eta: " << trketa_w << "   weight: " << hweight
-		   << " ** start looping on hits/TSOS ");
+		     << "  pt: " <<  trkpt 
+		     << "  eta: " << trketa_w 
+		     << "  weight: " << hweight
+		     << " ** start looping on hits/TSOS ** ");
     for (const Trk::TrackStateOnSurface* tsos : *track->trackStateOnSurfaces()) {
       ++nTSOS;
-      if (tsos == NULL) {
+      ATH_MSG_DEBUG (" ====> dealing with hit " << nTSOS << "/" << track->trackStateOnSurfaces()->size() << " of track: " << nTracks << "/" << tracks->size());
+      if (tsos == nullptr) {
 	ATH_MSG_DEBUG ("     TSOS (hit) = " << nTSOS << " is NULL ");
 	continue;
       }	
-      ATH_MSG_DEBUG ("** IDAlignMonResiduals::fillHistograms() ** track: " << nTracks << "  dealing with TSOS (hit) = " << nTSOS);
 
       //skipping outliers
+      ATH_MSG_DEBUG (" --> testing hit " << nTSOS << "/" << track->trackStateOnSurfaces()->size() << " to be measurement type");
       if(!tsos->type(Trk::TrackStateOnSurface::Measurement)) {
 	ATH_MSG_DEBUG ("Skipping TSOS " << nTSOS << " because it is an outlier (or the first TSOS on the track)");
 	continue;
       }
+
       const Trk::MeasurementBase* mesh =tsos->measurementOnTrack();
-      ATH_MSG_DEBUG ("Defined hit MeasurementBase for hit " << nTSOS);
+      ATH_MSG_DEBUG ( " --> Defined hit measurementOnTrack() for hit: " << nTSOS <<"/" << track->trackStateOnSurfaces()->size() << " of track " << nTracks);
+      if (!countedTrack) {
+	ATH_MSG_DEBUG ( " --> going to fill: m_hTotalTracks->Fill(0.) ");
+	// m_hTotalTracks->Fill(0.); // count only once
+	countedTrack = true;
+      }
 
       //Trk::RIO_OnTrack object contains information on the hit used to fit the track at this surface
+      ATH_MSG_DEBUG (" --> Going to retrive the Trk::RIO_OnTrack for hit " << nTSOS); 
       const Trk::RIO_OnTrack* hit = dynamic_cast <const Trk::RIO_OnTrack*>(mesh);
-      if (hit== NULL) {
+      if (hit == nullptr) {
 	//for some reason the first tsos has no associated hit - maybe because this contains the defining parameters?
-	if (nHits > 0 && msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No hit associated with TSOS "<< nTSOS << endmsg;
+	if (nHits > 0) ATH_MSG_DEBUG ("No hit associated with TSOS "<< nTSOS);
 	continue;
       }
 
+      ATH_MSG_DEBUG (" --> Going to retrive the track parameters of this TSOS: " << nTSOS); 
       const Trk::TrackParameters* trackParameter = tsos->trackParameters();
-      if(trackParameter==NULL) {
+      if(trackParameter== nullptr) {
 	//if no TrackParameters for TSOS we cannot define residuals
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Skipping TSOS " << nTSOS << " because does not have TrackParameters" << endmsg;
+	ATH_MSG_DEBUG (" Skipping TSOS " << nTSOS << " because it does not have TrackParameters");
 	continue;
       }
 
@@ -1189,10 +1226,10 @@ StatusCode IDAlignMonResiduals::fillHistograms()
       float incidencePhi = -999;
       float incidenceTheta = -999;
 
+      ATH_MSG_DEBUG (" --> going for hit->detectorElement() of hit " << nTSOS << "/" << track->trackStateOnSurfaces()->size());
       const Trk::TrkDetElementBase *de = hit->detectorElement(); //  rio is the measurment at a particular suface
-      const InDetDD::SiDetectorElement *side = dynamic_cast<const
-	InDetDD::SiDetectorElement *>(de);
-      if(side){
+      const InDetDD::SiDetectorElement *side = dynamic_cast<const InDetDD::SiDetectorElement *>(de);
+      if (side){
 	Amg::Vector3D mytrack = trackParameter->momentum(); // track parameters at that surface
 	Amg::Vector3D mynormal = side->normal();
 	Amg::Vector3D myphiax = side->phiAxis();
@@ -1206,12 +1243,13 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 
       const AmgSymMatrix(5)* TrackParCovariance = trackParameter ? trackParameter->covariance() : NULL;
 
-      if(TrackParCovariance==NULL) {
+      if( TrackParCovariance == nullptr) {
 	//if no MeasuredTrackParameters the hit will not have associated convariance error matrix and will not
 	//be able to define a pull or unbiased residual (errors needed for propagation)
 	ATH_MSG_DEBUG ("Skipping TSOS " << nTSOS << " because does not have MeasuredTrackParameters");
 	continue;
       }
+      ATH_MSG_DEBUG (" --> going to define residuals and everything of TSOS  #" << nTSOS << "/" << track->trackStateOnSurfaces()->size());
 
       float residualX = 9999.0;
       float residualY = 9999.0;
@@ -1251,14 +1289,14 @@ StatusCode IDAlignMonResiduals::fillHistograms()
       int ClusSize    = -999;
 
       const Identifier & hitId = hit->identify();
-      ATH_MSG_DEBUG ( "Defined  hit Identifier ");
+      ATH_MSG_DEBUG ( "Defining  hit Identifier ");
       if (m_idHelper->is_trt(hitId)) detType = 2;
       else if (m_idHelper->is_sct(hitId)) detType = 1;
       else  detType = 0;
 
       // TRT hits: detType = 2
       if(detType==2){ 
-	ATH_MSG_DEBUG("** IDAlignMonResiduals::fillHistograms() ** Hit is from the TRT, finding residuals... ");
+	ATH_MSG_DEBUG ("** IDAlignMonResiduals::fillHistograms() ** Hit is from the TRT, finding residuals... ");
 	bool isTubeHit = (mesh->localCovariance()(Trk::locX,Trk::locX) > 1.0) ? 1 : 0;
 	const Trk::TrackParameters* trackParameter = tsos->trackParameters();
 	float hitR = hit->localParameters()[Trk::driftRadius];
@@ -1285,7 +1323,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	  if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Cannot define unbiased parameters for hit, skipping it." << endmsg;
 	  continue;
 	}
-	if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found UnBiased TrackParameters" << endmsg;
+	ATH_MSG_DEBUG (" --> TRT UnBiased TrackParameters of hit " << nTSOS << " FOUND");
 	
 	float perdictR = trackParameterUnbiased->parameters()[Trk::locR];
 	
@@ -1304,7 +1342,7 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	  pullR = residualPull->pull()[Trk::locR];
 	}
 	else {
-	  if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " no covariance of the track parameters given, can not calc pull!" << endmsg;
+	  ATH_MSG_DEBUG (" no covariance of the track parameters given, can not calculate pull!");
 	}
 	
 	delete trackParameterUnbiased;
@@ -1317,17 +1355,17 @@ StatusCode IDAlignMonResiduals::fillHistograms()
 	const InDet::TRT_DriftCircle *RawDriftCircle(NULL);
 	
 	if (trtCircle!=NULL) {
-	  ATH_MSG_DEBUG("Getting RawDriftCircle");
+	  ATH_MSG_DEBUG(" --> Getting TRT RawDriftCircle");
 	  RawDriftCircle = dynamic_cast<const InDet::TRT_DriftCircle*>(trtCircle->prepRawData());
 	}
 	else {
 	  ATH_MSG_DEBUG("trtCircle is a NULL pointer");
 	}
 	
-	if ( trtCircle != NULL){
+	if ( trtCircle != nullptr){
 	  bool isValid;
 	  float leadingEdge = -999;
-	  if (RawDriftCircle != NULL) {
+	  if (RawDriftCircle != nullptr) {
 	    leadingEdge=RawDriftCircle->driftTime(isValid);
 	  }
 	  else {
@@ -4909,11 +4947,13 @@ void IDAlignMonResiduals::MakeTRTEndcapHistograms(MonGroup& al_mon){
       RegisterHisto(al_mon,m_trt_ec_hist->pullR_notube_pt[endcap]);
 
       /** Residuals vs pt per wheel */
-      for (int iWheel=0; iWheel < 40; iWheel++) {
-	m_trt_ec_hist->residualR_ptwheel[endcap][iWheel] = MakeProfile("trt_"+endcapName[endcap]+"_resvspt_wheel_"+intToString(iWheel),
+      for (int iWheel=0; iWheel < 40; iWheel++) { 
+	m_trt_ec_hist->residualR_ptwheel[endcap][iWheel] = MakeProfile("trt_ec_resVspt_wheel_"+intToString(iWheel)+"_"+endcapName[endcap],
 								       "Residual vs p_{T} for TRT "+endcapName[endcap]+" "+intToString(iWheel),
 								       m_nBinsPtRange, -m_PtRange, m_PtRange,
-								       m_minTRTResWindow, m_maxTRTResWindow, "Track p_{T} [GeV]","Residual [mm]");
+								       m_minTRTResWindow, m_maxTRTResWindow,
+								       "Track p_{T} [GeV]","Residual [mm]");
+	SetMinWindow(m_trt_ec_hist->residualR_ptwheel[endcap][iWheel], -0.025, 0.025);
 	RegisterHisto(al_mon,m_trt_ec_hist->residualR_ptwheel[endcap][iWheel]);
       }
       
@@ -4921,13 +4961,13 @@ void IDAlignMonResiduals::MakeTRTEndcapHistograms(MonGroup& al_mon){
       m_trt_ec_hist->residualR_mu[endcap] = MakeHist("trt_ec_residualR_mu_"+endcapName[endcap],
 						     "UnBiased Residual vs mu for TRT "+endcapName[endcap],
 						     m_nBinsMuRange, m_muRangeMin, m_muRangeMax,
-						     100, m_minTRTResWindow, m_maxTRTResWindow,
+						     50, m_minTRTResWindow, m_maxTRTResWindow,
 						     "#mu ","Residual [mm]"); 
       RegisterHisto(al_mon,m_trt_ec_hist->residualR_mu[endcap]);
       
       m_trt_ec_hist->pullR_mu[endcap] = MakeHist("trt_ec_pullR_mu_"+endcapName[endcap],"Unbiased residual pull vs mu for TRT "+endcapName[endcap],
 						 m_nBinsMuRange, m_muRangeMin, m_muRangeMax,
-						 100, -m_RangeOfPullHistos,m_RangeOfPullHistos,
+						 50, -m_RangeOfPullHistos,m_RangeOfPullHistos,
 						 "#mu","Pull");
       RegisterHisto(al_mon,m_trt_ec_hist->pullR_mu[endcap]);
     }
@@ -4940,50 +4980,80 @@ void IDAlignMonResiduals::MakeTRTEndcapHistograms(MonGroup& al_mon){
 						      32, -0.5, 31.5,
 						      50, m_minTRTResWindow, m_maxTRTResWindow);
       RegisterHisto(al_mon,m_trt_ec_hist->resVsPhiWheel[endcap]);
+
       m_trt_ec_hist->aveResVsPhiWheel[endcap] = MakeHist("trt_ec_aveResVsPhiWheel_"+endcapName[endcap],
 							 "Average Residual vs Phi Sector & Wheel for TRT "+endcapName[endcap],
 							 40, -0.5, 39.5,
 							 32, -0.5, 31.5,
 							 "End-cap 4-plane wheel","#phi Sector");
       RegisterHisto(al_mon,m_trt_ec_hist->aveResVsPhiWheel[endcap]);
+
       m_trt_ec_hist->rmsResVsPhiWheel[endcap] = MakeHist("trt_ec_rmsResVsPhiWheel_"+endcapName[endcap],"Residual RMS vs Phi Sector & Wheel for TRT "+endcapName[endcap],
 							 40, -0.5, 39.5,
 							 32, -0.5, 31.5,
 							 "End-cap 4-plane wheel","#phi Sector");
       RegisterHisto(al_mon,m_trt_ec_hist->rmsResVsPhiWheel[endcap]);
 
+      // same for positive and negative charged particles
+      m_trt_ec_hist->resVsPhiWheelPos[endcap] = new TH3F(("trt_ec_resVsPhiWheelPos_"+endcapName[endcap]).c_str(),
+						      ("Residual Distribution vs Phi Sector & Wheel for TRT "+endcapName[endcap]+" positive;Wheel;#phi sector;Residual [mm]").c_str(),
+						      40, -0.5, 39.5,
+						      32, -0.5, 31.5,
+						      50, m_minTRTResWindow, m_maxTRTResWindow);
+      RegisterHisto(al_mon,m_trt_ec_hist->resVsPhiWheelPos[endcap]);
+      m_trt_ec_hist->resVsPhiWheelNeg[endcap] = new TH3F(("trt_ec_resVsPhiWheelNeg_"+endcapName[endcap]).c_str(),
+						      ("Residual Distribution vs Phi Sector & Wheel for TRT "+endcapName[endcap]+" negative;Wheel;#phi sector;Residual [mm]").c_str(),
+						      40, -0.5, 39.5,
+						      32, -0.5, 31.5,
+						      50, m_minTRTResWindow, m_maxTRTResWindow);
+      RegisterHisto(al_mon,m_trt_ec_hist->resVsPhiWheelNeg[endcap]);
+
       /** Endcap Residual plots vs Radius & Wheel */
       m_trt_ec_hist->resVsRadiusWheelPos[endcap] = new TH3F(("trt_ec_resVsRadiusWheelPos_"+endcapName[endcap]).c_str(),
 							    ("Residual Distribution vs Wheel & Radius on Wheel for TRT "+endcapName[endcap]+";Wheel;Radius [mm]; Res [mm]").c_str(),
-							    40, -0.5, 39.5, 30, 644,1004/*these are the radius limits in mm according to TRT SW*/,
+							    40, -0.5, 39.5, 
+							    20, 644., 1004. /*these are the radius limits in mm according to TRT SW*/,
 							    50, m_minTRTResWindow, m_maxTRTResWindow);
       RegisterHisto(al_mon,m_trt_ec_hist->resVsRadiusWheelPos[endcap]);
       m_trt_ec_hist->aveResVsRadiusWheelPos[endcap] = MakeHist("trt_ec_aveResVsRadiusWheelPos_"+endcapName[endcap],
 							       "Average Residual vs Wheel & Radius on Wheel for TRT "+endcapName[endcap],
-							       40, -0.5, 39.5, 30, 644, 1004,
+							       40, -0.5, 39.5, 
+							       20, 644., 1004.,
 							       "Wheel Number","Radius on Wheel [mm]");
       RegisterHisto(al_mon,m_trt_ec_hist->aveResVsRadiusWheelPos[endcap]);
       m_trt_ec_hist->rmsResVsRadiusWheelPos[endcap] = MakeHist("trt_ec_rmsResVsRadiusWheelPos_"+endcapName[endcap],
 							       "Residual RMS vs Wheel & Radius on Wheel for TRT "+endcapName[endcap],
-							       40, -0.5, 39.5, 30, 644, 1004,
+							       40, -0.5, 39.5, 
+							       20, 644., 1004.,
 							       "Wheel Number","Radius on Wheel [mm]");
       RegisterHisto(al_mon,m_trt_ec_hist->rmsResVsRadiusWheelPos[endcap]);
       m_trt_ec_hist->resVsRadiusWheelNeg[endcap] = new TH3F(("trt_ec_resVsRadiusWheelNeg_"+endcapName[endcap]).c_str(),
 							    ("Residual Distribution vs Wheel & Radius on Wheel for TRT "+endcapName[endcap]+";Wheel;Radius [mm]; Res [mm]").c_str(),
-							    40, -0.5, 39.5, 30, 644, 1004/*these are the radius limits in mm according to TRT SW*/,
+							    40, -0.5, 39.5, 
+							    25, 644., 1004./*these are the radius limits in mm according to TRT SW*/,
 							    50, m_minTRTResWindow, m_maxTRTResWindow);
       RegisterHisto(al_mon,m_trt_ec_hist->resVsRadiusWheelNeg[endcap]);
       m_trt_ec_hist->aveResVsRadiusWheelNeg[endcap] = MakeHist("trt_ec_aveResVsRadiusWheelNeg_"+endcapName[endcap],
 							       "Average Residual vs Wheel & Radius on Wheel for TRT "+endcapName[endcap],
-							       40, -0.5, 39.5, 30, 644,1004,
+							       40, -0.5, 39.5, 
+							       20, 644., 1004.,
 							       "Wheel Number","Radius on Wheel [mm]");
       RegisterHisto(al_mon,m_trt_ec_hist->aveResVsRadiusWheelNeg[endcap]);
       m_trt_ec_hist->rmsResVsRadiusWheelNeg[endcap] = MakeHist("trt_ec_rmsResVsRadiusWheelNeg_"+endcapName[endcap],
 							       "Residual RMS vs Wheel & Radius on Wheel for TRT "+endcapName[endcap],
-							       40, -0.5, 39.5, 30, 644, 1004,
+							       40, -0.5, 39.5, 
+							       20, 644., 1004.,
 							       "Wheel Number","Radius on Wheel [mm]");
       RegisterHisto(al_mon,m_trt_ec_hist->rmsResVsRadiusWheelNeg[endcap]);
 
+      /** Endcap residual histograms vs q x pT & Wheel */ 
+      m_trt_ec_hist->resVsqPtWheel[endcap] = new TH3F(("trt_ec_resVsqPtWheel_"+endcapName[endcap]).c_str(),
+						      ("Residual Distribution vs Wheel & p_{T} for TRT "+endcapName[endcap]+";Wheel;q#timesp_{T} [GeV]; Res [mm]").c_str(),
+						      40, -0.5, 39.5,
+						      20, -m_PtRange, m_PtRange,
+						      50, m_minTRTResWindow, m_maxTRTResWindow);
+      RegisterHisto(al_mon,m_trt_ec_hist->resVsqPtWheel[endcap]);
+
       /** R(t) relation */
       m_trt_ec_hist->rt[endcap] = MakeHist("trt_ec_rt_"+endcapName[endcap],"rt relation for TRT "+endcapName[endcap], 100,-12.5,59.375,100,0,2,"leading edge [ns] corrected for t0 and EP ","dist from wire to track [mm]");
       RegisterHisto(al_mon,m_trt_ec_hist->rt[endcap]);
@@ -5257,7 +5327,7 @@ void IDAlignMonResiduals::fillTRTEndcapHistograms(int barrel_ec, int layer_or_wh
     if(m_extendedPlots){
       if (LE != -999) m_trt_ec_hist->rt[endcap] -> Fill(LE - EP - t0,fabs(perdictR), hweight);
       m_trt_ec_hist->residualR_pt[endcap]-> Fill(trkpt, residualR, hweight);
-      m_trt_ec_hist->residualR_ptwheel[endcap][layer_or_wheel]-> Fill(trkpt, residualR, hweight);
+      m_trt_ec_hist->residualR_ptwheel[endcap][getRing(layer_or_wheel,straw_layer)]-> Fill(trkpt, residualR, hweight);
       m_trt_ec_hist->pullR_pt[endcap]    -> Fill(trkpt, pullR    , hweight);
       if (!isTubeHit) m_trt_ec_hist->pullR_notube_pt[endcap] -> Fill(trkpt,pullR, hweight);
 
@@ -5278,22 +5348,29 @@ void IDAlignMonResiduals::fillTRTEndcapHistograms(int barrel_ec, int layer_or_wh
       }
     }
 
+
     // fill TH3F of ave residual vs phi & wheel
     if(m_extendedPlots){
-      m_trt_ec_hist->resVsPhiWheel[endcap]->Fill(getRing(layer_or_wheel,straw_layer),phi_module,residualR,hweight);
+      float theWheel  = static_cast<float>(getRing(layer_or_wheel,straw_layer));
+      float thePhiMod = static_cast<float>(phi_module);
+
+      m_trt_ec_hist->resVsPhiWheel[endcap]->Fill(theWheel, thePhiMod, residualR, hweight);
+
       // fill TH3F of ave residual vs wheel & radius vs charge & LOW PT ONLY
       ATH_MSG_DEBUG ("Going to fill m_trt_ec_hist->resVsRadiusWheelPos["<< endcap<<"] for pt: " << trkpt << "  hitGlobalR= " << hitGlobalR);
       if(fabs(trkpt) < m_maxPtEC){
 	int charge = (trkpt > 0 ? 1 : -1);
-	if (hitGlobalR != -9999)
-	  {
-	    if(charge > 0){
-	      m_trt_ec_hist->resVsRadiusWheelPos[endcap]->Fill(getRing(layer_or_wheel,straw_layer), hitGlobalR, residualR,hweight);
-	    }
-	    else{
-	      m_trt_ec_hist->resVsRadiusWheelNeg[endcap]->Fill(getRing(layer_or_wheel,straw_layer), hitGlobalR, residualR,hweight);
-	    }
+	if (hitGlobalR != -9999) {
+	  if(charge > 0){
+	    m_trt_ec_hist->resVsPhiWheelPos[endcap]   ->Fill(theWheel, thePhiMod,  residualR, hweight);
+	    m_trt_ec_hist->resVsRadiusWheelPos[endcap]->Fill(theWheel, hitGlobalR, residualR, hweight);
+	  }
+	  else{
+	    m_trt_ec_hist->resVsPhiWheelNeg[endcap]   ->Fill(theWheel, thePhiMod,  residualR, hweight);
+	    m_trt_ec_hist->resVsRadiusWheelNeg[endcap]->Fill(theWheel, hitGlobalR, residualR, hweight);
 	  }
+	} // radius known
+	m_trt_ec_hist->resVsqPtWheel[endcap]->Fill(theWheel, trkpt, residualR, hweight);
       }
     }
 
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h
index 954d79ff91da8ac79c6b4c0224a16cb906c2c2a0..b24017dd6b0c188e8af8d21d84b4dab31848b22c 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.h
@@ -215,6 +215,7 @@ class IDAlignMonResiduals : public ManagedMonitorToolBase
   //histograms
   
   TH1F* m_totalEvents{};
+  TH1F* m_hTotalTracks{};
   TH1F* m_sirescalcfailure{};
   std::vector<TH3F*> m_sct_b_Oxresxvsmodetaphi_3ds;
   std::vector<TH3F*> m_sct_b_Oyresxvsmodetaphi_3ds;
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h
index 7c086201a3eb74eb7e06872164e325a35d81ce29..b835250ad433a924491b1f8832c12cd5303ddaea 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.h
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/TrackSelectionTool.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 TRACKSELECTIONTOOL_H
@@ -20,7 +20,6 @@
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/Vertex.h"
 #include "xAODTracking/VertexContainer.h"
-#include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/TrackParticleContainer.h"
 #include <vector>
 
diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/EnhancedVertexMonitoring.C b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/EnhancedVertexMonitoring.C
index 84c1d7a20ff20ab60b7b28c60d2cefc4e6b253aa..5c8ac57619f185d4f5021583a20459e1d243847d 100755
--- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/EnhancedVertexMonitoring.C
+++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/EnhancedVertexMonitoring.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
 */
 
 // tope level executable
@@ -24,7 +24,6 @@
 #include "TGraphErrors.h"
 #include "TGraphAsymmErrors.h"
 #include "TMath.h"
-#include "TFile.h"
 
 #include "RealTrackTree.h"
 
diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/analyzeFiles.C_old b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/analyzeFiles.C_old
index c4fb3c3f3c524a14c9934690d0f67cc59e316d9c..6411695847caacd642ee90df14a958c6a81167ea 100644
--- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/analyzeFiles.C_old
+++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/analyzeFiles.C_old
@@ -16,17 +16,12 @@
 #include <TStyle.h>
 #include <TMatrixT.h>
 #include <TMinuit.h>
-#include <iostream>
 #include <TVirtualFitter.h>
 
 using namespace std;
 
 #include "RealTrackTree.h"
 #include "TApplication.h"
-#include "TFile.h"
-#include "TStyle.h"
-#include <iostream>
-#include "TString.h"
 #include "TChain.h"
 
 
diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPixelTool.cxx b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPixelTool.cxx
index 0c3dcdaa2b13ea01620189556f6b71abb2ac3375..a0092eb23dc3f3b4bb7ad1f4ef8032a163f4d81f 100755
--- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPixelTool.cxx
+++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPixelTool.cxx
@@ -33,7 +33,6 @@
 #include "TrkTrack/TrackCollection.h"            
 #include "InDetReadoutGeometry/SiDetectorElement.h"
 #include "InDetRIO_OnTrack/SiClusterOnTrack.h"
-#include "InDetPrepRawData/PixelClusterContainer.h"         
 #include "TrkTrackSummary/TrackSummary.h"
 
 #include "EventPrimitives/EventPrimitivesHelpers.h"
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZee.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZee.h
index ada717ab5ee623896879af8dffb033140fb9a0e2..9cd97cddc28b824ad9ff233b81d13570e2b80171 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZee.h
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZee.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 IDPerfMonZee_H
@@ -19,7 +19,6 @@
 #include "xAODEgamma/ElectronContainer.h"
 #include "xAODEgamma/Photon.h"
 #include "xAODEgamma/PhotonContainer.h"
-#include "xAODEgamma/PhotonContainer.h"
 #include "xAODCaloEvent/CaloCluster.h"
 #include "xAODCaloEvent/CaloClusterContainer.h"
 #include "xAODMissingET/MissingET.h"
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/AtlasStyle.C b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/AtlasStyle.C
index 790ef0be3cd9b75ad8b3165c2833a4cf8aa0d998..2836f3b984bb867218cc4a06f47621db85638cde 100644
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/AtlasStyle.C
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/AtlasStyle.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
 */
 
 #include <iostream>
@@ -92,16 +92,8 @@ TStyle * AtlasStyle()
 
 
 
-#include <iostream>
 #include <cmath>
 
-
-#include "TLine.h"
-#include "TLatex.h"
-#include "TMarker.h"
-#include "TPave.h"
-#include "TH1.h"
-
 void ATLAS_LABEL(Double_t x,Double_t y,Color_t color) 
 {
   TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); 
diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx b/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx
index a21c8c8b41dba29cacd77d04364fcb153c599b92..c458c6acb97a9081107ad264fdfa3c0ee96784b4 100644
--- a/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx
+++ b/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx
@@ -277,7 +277,7 @@ namespace OverlayTesting {
       return digit;
     }
 
-    bool initMcEventCollection(std::vector<HepMC::GenParticle*>& genPartList)
+    bool initMcEventCollection(std::vector<HepMC::GenParticlePtr>& genPartList)
     {
       // create dummy input McEventCollection with a name that
       // HepMcParticleLink knows about
@@ -286,7 +286,7 @@ namespace OverlayTesting {
       // Add a dummy GenEvent
       const int process_id1(20);
       const int event_number1(17);
-      inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1));
+      inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number1));
       HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
       populateGenEvent(ge1,-11,11,genPartList);
       populateGenEvent(ge1,-13,13,genPartList);
@@ -297,26 +297,26 @@ namespace OverlayTesting {
       return true;
     }
 
-    void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticle*>& genPartList)
+    void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticlePtr>& genPartList)
     {
-      CLHEP::HepLorentzVector myPos( 0.0, 0.0, 0.0, 0.0);
-      HepMC::GenVertex *myVertex = new HepMC::GenVertex( myPos, -1 );
+      HepMC::FourVector myPos( 0.0, 0.0, 0.0, 0.0);
+      HepMC::GenVertexPtr myVertex = HepMC::newGenVertexPtr( myPos, -1 );
       HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*CLHEP::TeV);
-      HepMC::GenParticle* inParticle1 = new HepMC::GenParticle(fourMomentum1, pdgid1, 2);
+      HepMC::GenParticlePtr inParticle1 = HepMC::newGenParticlePtr(fourMomentum1, pdgid1, 2);
       myVertex->add_particle_in(inParticle1);
       HepMC::FourVector fourMomentum2( 0.0, 0.0, -1.0, 1.0*CLHEP::TeV);
-      HepMC::GenParticle* inParticle2 = new HepMC::GenParticle(fourMomentum2, pdgid2, 2);
+      HepMC::GenParticlePtr inParticle2 = HepMC::newGenParticlePtr(fourMomentum2, pdgid2, 2);
       myVertex->add_particle_in(inParticle2);
       HepMC::FourVector fourMomentum3( 0.0, 1.0, 0.0, 1.0*CLHEP::TeV);
-      HepMC::GenParticle* inParticle3 = new HepMC::GenParticle(fourMomentum3, pdgid1, 1);
+      HepMC::GenParticlePtr inParticle3 = HepMC::newGenParticlePtr(fourMomentum3, pdgid1, 1);
       myVertex->add_particle_out(inParticle3);
       genPartList.push_back(inParticle3);
       HepMC::FourVector fourMomentum4( 0.0, -1.0, 0.0, 1.0*CLHEP::TeV);
-      HepMC::GenParticle* inParticle4 = new HepMC::GenParticle(fourMomentum4, pdgid2, 1);
+      HepMC::GenParticlePtr inParticle4 = HepMC::newGenParticlePtr(fourMomentum4, pdgid2, 1);
       myVertex->add_particle_out(inParticle4);
       genPartList.push_back(inParticle4);
       ge.add_vertex( myVertex );
-      ge.set_signal_process_vertex( myVertex );
+      HepMC::set_signal_process_vertex( &ge, myVertex );
       ge.set_beam_particles(inParticle1,inParticle2);
     }
 
diff --git a/InnerDetector/InDetRecAlgs/InDetTrackPRD_Association/InDetTrackPRD_Association/InDetTrackPRD_Association.h b/InnerDetector/InDetRecAlgs/InDetTrackPRD_Association/InDetTrackPRD_Association/InDetTrackPRD_Association.h
index 8881d2ef1d71d272b9cfbf36213e71171527e9f0..f06994c6bc2968dfa85b8d640931d28d541f90ba 100755
--- a/InnerDetector/InDetRecAlgs/InDetTrackPRD_Association/InDetTrackPRD_Association/InDetTrackPRD_Association.h
+++ b/InnerDetector/InDetRecAlgs/InDetTrackPRD_Association/InDetTrackPRD_Association/InDetTrackPRD_Association.h
@@ -1,7 +1,7 @@
 //Dear emacs, this is -*-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
 */
 
 
@@ -17,7 +17,6 @@
 #include "GaudiKernel/ToolHandle.h"
 #include "TrkToolInterfaces/IPRDtoTrackMapTool.h"
 #include "TrkEventUtils/PRDtoTrackMap.h"
-#include "TrkTrack/TrackCollection.h"
 
 namespace InDet {
 
diff --git a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/SiSPSeededTrackFinder.cxx b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/SiSPSeededTrackFinder.cxx
index c608055d1ec69bbe598261664aeb7cebda896c88..29a40a8ef8f88748669a7e2a3400dde1a1df633d 100644
--- a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/SiSPSeededTrackFinder.cxx
+++ b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/SiSPSeededTrackFinder.cxx
@@ -263,23 +263,39 @@ StatusCode InDet::SiSPSeededTrackFinder::newStrategy(const EventContext& ctx) co
   /// prepare a collection for the quality-sorted track canddiates
   std::multimap<double, Trk::Track*> qualitySortedTrackCandidates;
 
+  /// Get the value of the seed maker validation ntuple writing switch
+  bool doWriteNtuple = m_seedsmaker->getWriteNtupleBoolProperty();
+  long EvNumber = 0.;            //Event number variable to be used for the validation ntuple 
+
+  if (doWriteNtuple) {
+    SG::ReadHandle<xAOD::EventInfo> eventInfo(m_evtKey,ctx);
+    if(!eventInfo.isValid()) {EvNumber = -1.0;} else {EvNumber = eventInfo->eventNumber();}
+  }
+
   /// Loop through all seeds from the first pass and attempt to form track candidates
   while ((seed = m_seedsmaker->next(ctx, seedEventData))) {
+
     ++counter[kNSeeds];
     /// we only want to fill the Z histo with the first candidate for each seed. 
     bool firstTrack{true};
-    /// combinatorial track finding for one given seed 
-    std::list<Trk::Track*> trackList = m_trackmaker->getTracks(ctx, trackEventData, seed->spacePoints());
 
-    /// record found candidates
-    for (Trk::Track* t: trackList) {
-      qualitySortedTrackCandidates.insert(std::make_pair(-trackQuality(t), t));
-      /// For the first (highest quality) track from each seed, populate the vertex finding histograms 
-      if (firstTrack and not m_ITKGeometry) {
-        fillZHistogram(t, beamPosPerigee, numberHistogram, zWeightedHistogram, ptWeightedHistogram);
-      }
-      firstTrack = false;
-    }
+      /// copy all the tracks into trackList
+      std::list<Trk::Track*> trackList = m_trackmaker->getTracks(ctx, trackEventData, seed->spacePoints());
+      /// record track candidates found, using combinatorial track finding, from the given seed
+      for (Trk::Track* t: trackList) {
+
+        qualitySortedTrackCandidates.insert(std::make_pair(-trackQuality(t), t));
+
+        /// For the first (highest quality) track from each seed, populate the vertex finding histograms
+        if (firstTrack and not m_ITKGeometry) {
+          fillZHistogram(t, beamPosPerigee, numberHistogram, zWeightedHistogram, ptWeightedHistogram);
+        }
+        firstTrack = false;
+      }  
+      /// Call the ntuple writing method
+      if(doWriteNtuple) { m_seedsmaker->writeNtuple(seed, !trackList.empty() ? trackList.front() : nullptr, ISiSpacePointsSeedMaker::StripSeed, EvNumber) ; } 
+        
+
     if (counter[kNSeeds] >= m_maxNumberSeeds) {
       ERR = true;
       ++m_problemsTotal;
@@ -307,17 +323,24 @@ StatusCode InDet::SiSPSeededTrackFinder::newStrategy(const EventContext& ctx) co
 
   /// Again, loop over the newly found seeds and attempt to form track candidates
   while ((seed = m_seedsmaker->next(ctx, seedEventData))) {
+
     ++counter[kNSeeds];
-    /// insert the new tracks into the quality-sorted list
-    for (Trk::Track* t: m_trackmaker->getTracks(ctx, trackEventData, seed->spacePoints())) {
+
+    std::list<Trk::Track*> trackList = m_trackmaker->getTracks(ctx, trackEventData, seed->spacePoints());
+
+    for (Trk::Track* t: trackList) {
       qualitySortedTrackCandidates.insert(std::make_pair(-trackQuality(t), t));
     }
+
+    if(doWriteNtuple) { m_seedsmaker->writeNtuple(seed, !trackList.empty() ? trackList.front() : nullptr, ISiSpacePointsSeedMaker::PixelSeed, EvNumber); }
+
     if (counter[kNSeeds] >= m_maxNumberSeeds) {
       ERR = true;
       ++m_problemsTotal;
       break;
     }
   }
+
   m_trackmaker->endEvent(trackEventData);
 
   /// Remove shared tracks with worse quality
diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiTrackerSpacePointFinder.h b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiTrackerSpacePointFinder.h
index 5b08e6df375b14470f06f07c6991f7582b985604..4b90c2ebf9c209fcad06bcf32853786e1dd4e523 100755
--- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiTrackerSpacePointFinder.h
+++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiTrackerSpacePointFinder.h
@@ -24,7 +24,6 @@
 #include "TrkSpacePoint/SpacePoint.h"
 #include "TrkSpacePoint/SpacePointContainer.h"
 #include "TrkSpacePoint/SpacePointOverlapCollection.h"
-#include "StoreGate/ReadCondHandleKey.h"
 #include "BeamSpotConditionsData/BeamSpotData.h"
 
 #include "GaudiKernel/ToolHandle.h"
diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiSpacePointForSeed.h b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiSpacePointForSeed.h
index 2879259be2492d4be9d26985d895d7c1a440a07a..31d942ba06ef3a75870340a79fdbdff5c1e935e9 100644
--- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiSpacePointForSeed.h
+++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiSpacePointForSeed.h
@@ -46,6 +46,10 @@ namespace InDet {
     void set(const Trk::SpacePoint*const&,const float*,const float*);
     void setQuality(float);
     void setParam(const float&);
+    void setD0(const float&);
+    void setEta(const float&);
+    void setDZDR(const float&);
+    void setPt(const float&);
     void setScorePenalty(const float& par) {m_scorePenalty=par;}
 
     const Trk::SpacePoint* spacepoint; 
@@ -56,9 +60,13 @@ namespace InDet {
           float         phi() const {return atan2(m_y,m_x);}
     const float&       covr() const {return m_covr;}
     const float&       covz() const {return m_covz;}
+    const float&         d0() const {return m_d0;}
+    const float&        eta() const {return m_eta;}
     const float&      param() const {return m_param;} /// impact parameter
     const float&      scorePenalty() const {return m_scorePenalty;} /// penalty term in the seed score
     const float&    quality() const {return m_q ;}      /// quality of the best seed this candidate was seen on 
+    const float&       dzdr() const {return m_dzdr;}
+    const float&         Pt() const {return m_pt;}
     const Trk::Surface* sur() const {return m_su;}
     const Trk::Surface* sun() const {return m_sn;}
 
@@ -70,6 +78,10 @@ namespace InDet {
     float m_r   ; // radius       in beam system coordinates
     float m_covr; //
     float m_covz; //
+    float m_d0;
+    float m_eta;
+    float m_dzdr;
+    float m_pt;
     float m_param;  /// impact parameter
     float m_scorePenalty; /// penalty term in the seed score 
     float m_q   ;   /// quality of the best seed this candidate was seen on 
diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiSpacePointsProSeed.h b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiSpacePointsProSeed.h
index f7595db7d84cda3f30d5251d9a44b1cb80c1c5e7..1efc685eb9f419eee818b25de26f388ea6f4e0c1 100644
--- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiSpacePointsProSeed.h
+++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiSpacePointsProSeed.h
@@ -39,7 +39,15 @@ namespace InDet {
     SiSpacePointForSeed* spacepoint0() {return m_s0;}
     SiSpacePointForSeed* spacepoint1() {return m_s1;}
     SiSpacePointForSeed* spacepoint2() {return m_s2;}
+    const float&            d0() const {return m_d0;}
     const float&             z() const {return m_z ;}
+    const float&           eta() const {return m_eta;}
+    const float&            z1() const {return m_z1;}
+    const float&            z2() const {return m_z2;}
+    const float&            z3() const {return m_z3;}
+    const float&            r1() const {return m_r1;}
+    const float&            r2() const {return m_r2;}
+    const float&            r3() const {return m_r3;}
     const float&       quality() const {return m_q ;}
     
     void set(SiSpacePointForSeed*&,SiSpacePointForSeed*&,SiSpacePointForSeed*&,float);
@@ -49,11 +57,19 @@ namespace InDet {
 
   private:
     
-    SiSpacePointForSeed* m_s0;
-    SiSpacePointForSeed* m_s1;
-    SiSpacePointForSeed* m_s2;
-    float                m_z ;
-    float                m_q ;
+    SiSpacePointForSeed* m_s0  ;
+    SiSpacePointForSeed* m_s1  ;
+    SiSpacePointForSeed* m_s2  ;
+    float                m_d0  ;
+    float                m_z   ;
+    float                m_eta ;
+    float                m_z1  ;
+    float                m_z2  ;
+    float                m_z3  ;
+    float                m_r1  ;
+    float                m_r2  ;
+    float                m_r3  ;
+    float                m_q   ;
   };
 } // end of name space
 
diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiSpacePointForSeed.cxx b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiSpacePointForSeed.cxx
index b1716d8257d77e80418786459789834791f71b79..2701e4d01ee52bccd67ec1806d190f4ca6e0fa80 100644
--- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiSpacePointForSeed.cxx
+++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiSpacePointForSeed.cxx
@@ -21,6 +21,10 @@ namespace InDet {
     m_covr  = 0.;
     m_covz  = 0.;
     m_param = 0.;
+    m_d0    = 0.;
+    m_eta   = 0.;
+    m_dzdr  = 0.;
+    m_pt    = 0.;
     m_q     = 0.;
     m_su    = 0 ;
     m_sn    = 0 ;
@@ -38,6 +42,10 @@ namespace InDet {
       m_covr      = sp.m_covr    ;
       m_covz      = sp.m_covz    ;
       m_q         = sp.m_q       ;
+      m_dzdr      = sp.m_dzdr    ;
+      m_d0        = sp.m_d0      ;
+      m_eta       = sp.m_eta     ;
+      m_pt        = sp.m_pt      ;
       m_su        = sp.m_su      ;
       m_sn        = sp.m_sn      ;        
     }
@@ -47,13 +55,13 @@ namespace InDet {
   SiSpacePointForSeed::SiSpacePointForSeed
   (const Trk::SpacePoint*const& sp,const float* r) 
   {
-    set(sp,r); m_param = 0.;
+    set(sp,r); m_param = 0.;  
   }
 
   SiSpacePointForSeed::SiSpacePointForSeed
   (const Trk::SpacePoint*const& sp,const float* r,const float* sc) 
   {
-    set(sp,r,sc); m_param = 0.;
+    set(sp,r,sc); m_param = 0.; 
   }
 
   /////////////////////////////////////////////////////////////////////////////////
@@ -157,9 +165,30 @@ namespace InDet {
   {
     m_param = p;
   }
+
+  void SiSpacePointForSeed::setD0(const float& d0)
+  {
+    m_d0 = d0;
+  } 
+
+  void SiSpacePointForSeed::setEta(const float& eta)
+  {
+    m_eta = eta;
+  }
+
   void  SiSpacePointForSeed::setQuality(float q)
   {
     if(q <= m_q) m_q = q;
   }
+
+  void  SiSpacePointForSeed::setDZDR(const float& dzdr)
+  {
+    m_dzdr = dzdr;
+  }
+
+  void  SiSpacePointForSeed::setPt(const float& pt)
+  {
+    m_pt = pt;
+  }
  
 } // end of name space
diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiSpacePointsProSeed.cxx b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiSpacePointsProSeed.cxx
index 4894433ae64f4ca0d6a5e8f560d0c61080edb2ea..c300db866c1ef12d4bb80245ed6833d77e200823 100644
--- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiSpacePointsProSeed.cxx
+++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiSpacePointsProSeed.cxx
@@ -13,6 +13,8 @@ namespace InDet {
     m_s0 = 0 ;
     m_s1 = 0 ;
     m_s2 = 0 ;
+    m_d0 = 0.;
+    m_eta = 0.;
     m_z  = 0.;
     m_q  = 0.;
   }
@@ -22,7 +24,9 @@ namespace InDet {
   {
     if(&sp!=this) {
 
+      m_d0  = sp.m_d0;
       m_z   = sp.m_z ;
+      m_eta = sp.m_eta;
       m_q   = sp.m_q ;
       m_s0  = sp.m_s0;
       m_s1  = sp.m_s1;
@@ -101,7 +105,24 @@ namespace InDet {
     s.add(m_s0->spacepoint);
     s.add(m_s1->spacepoint);
     s.add(m_s2->spacepoint);
-    s.setZVertex(double(m_z)); 
+    s.setD0(m_s2->param());
+    s.setZVertex(double(m_z));
+    s.setEta(m_s2->eta()); 
+    s.setX1(m_s0->x());
+    s.setX2(m_s1->x());
+    s.setX3(m_s2->x());
+    s.setY1(m_s0->y());
+    s.setY2(m_s1->y());
+    s.setY3(m_s2->y());
+    s.setZ1(m_s0->z());
+    s.setZ2(m_s1->z());
+    s.setZ3(m_s2->z());
+    s.setR1(m_s0->radius());
+    s.setR2(m_s1->radius());
+    s.setR3(m_s2->radius());
+    s.setDZDR_B(m_s0->dzdr());
+    s.setDZDR_T(m_s2->dzdr());
+    s.setPt(m_s2->Pt()); 
     return true;
   }
 
diff --git a/InnerDetector/InDetRecEvent/SiSpacePointsSeed/SiSpacePointsSeed/SiSpacePointsSeed.h b/InnerDetector/InDetRecEvent/SiSpacePointsSeed/SiSpacePointsSeed/SiSpacePointsSeed.h
index b05bb2581cb2f5e1aa6b72ca657c1bfe1da0bb03..e0b293a8b7b36a705a01db5753de7db8613a09b9 100755
--- a/InnerDetector/InDetRecEvent/SiSpacePointsSeed/SiSpacePointsSeed/SiSpacePointsSeed.h
+++ b/InnerDetector/InDetRecEvent/SiSpacePointsSeed/SiSpacePointsSeed/SiSpacePointsSeed.h
@@ -47,9 +47,45 @@ namespace InDet {
     virtual ~SiSpacePointsSeed();
     void                                     erase();
     void                                     add(const Trk::SpacePoint*&);
+    void                                     setD0     (const double&);
     void                                     setZVertex(const double&);
+    void                                     setEta    (const double&);
+    void                                     setX1     (const double&);
+    void                                     setX2     (const double&);
+    void                                     setX3     (const double&);
+    void                                     setY1     (const double&);
+    void                                     setY2     (const double&);
+    void                                     setY3     (const double&);
+    void                                     setZ1     (const double&);
+    void                                     setZ2     (const double&);
+    void                                     setZ3     (const double&);
+    void                                     setR1     (const double&);
+    void                                     setR2     (const double&);
+    void                                     setR3     (const double&);
+    void                                     setDZDR_B (const double&);
+    void                                     setDZDR_T (const double&);
+    void                                     setPt     (const double&);
+
     const std::vector<const Trk::SpacePoint*>& spacePoints() const;
+    const double&                            d0         () const;
     const double&                            zVertex    () const;
+    const double&                            eta        () const;
+    const double&                            x1         () const;
+    const double&                            x2         () const;
+    const double&                            x3         () const;
+    const double&                            y1         () const;
+    const double&                            y2         () const;
+    const double&                            y3         () const;
+    const double&                            z1         () const;
+    const double&                            z2         () const;
+    const double&                            z3         () const;
+    const double&                            r1         () const;
+    const double&                            r2         () const;
+    const double&                            r3         () const;
+    const double&                            dzdr_b     () const;
+    const double&                            dzdr_t     () const;
+    const double&                            pt         () const;
+
     virtual MsgStream&    dump(MsgStream&    out) const ;
     virtual std::ostream& dump(std::ostream& out) const ;
     
@@ -60,7 +96,24 @@ namespace InDet {
   protected:
     
     std::vector<const Trk::SpacePoint*> m_spacepoints;
-    double                            m_zvertex    ;  
+    double                            m_d0         ;
+    double                            m_zvertex    ;
+    double                            m_eta        ;  
+    double                            m_x1         ;
+    double                            m_x2         ;
+    double                            m_x3         ;
+    double                            m_y1         ;
+    double                            m_y2         ;
+    double                            m_y3         ;
+    double                            m_z1         ;
+    double                            m_z2         ;
+    double                            m_z3         ;
+    double                            m_r1         ;
+    double                            m_r2         ;
+    double                            m_r3         ;
+    double                            m_dzdr_b     ;
+    double                            m_dzdr_t     ;
+    double                            m_pt         ;
   };
 
   MsgStream&    operator << (MsgStream&   ,const SiSpacePointsSeed&);
@@ -85,16 +138,186 @@ namespace InDet {
       m_spacepoints.push_back(p);
     }
 
+  inline void SiSpacePointsSeed::setD0(const double& d0)
+    {
+      m_d0 = d0;
+    }
+
   inline void SiSpacePointsSeed::setZVertex(const double& z) 
     {
       m_zvertex = z;
     }
 
+  inline void SiSpacePointsSeed::setEta(const double& eta)
+    {
+      m_eta = eta;
+    }
+
+  inline void SiSpacePointsSeed::setX1(const double& x1)
+    {
+      m_x1 = x1;
+    }
+
+  inline void SiSpacePointsSeed::setX2(const double& x2)
+    {
+      m_x2 = x2;
+    }
+
+  inline void SiSpacePointsSeed::setX3(const double& x3)
+    {
+      m_x3 = x3;
+    }
+
+  inline void SiSpacePointsSeed::setY1(const double& y1)
+    {
+      m_y1 = y1;
+    }
+
+  inline void SiSpacePointsSeed::setY2(const double& y2)
+    {
+      m_y2 = y2;
+    }
+
+  inline void SiSpacePointsSeed::setY3(const double& y3)
+    {
+      m_y3 = y3;
+    }
+
+  inline void SiSpacePointsSeed::setZ1(const double& z1)
+    {
+      m_z1 = z1;
+    }
+
+  inline void SiSpacePointsSeed::setZ2(const double& z2)
+    {
+      m_z2 = z2;
+    }
+
+  inline void SiSpacePointsSeed::setZ3(const double& z3)
+    {
+      m_z3 = z3;
+    }
+
+  inline void SiSpacePointsSeed::setR1(const double& r1)
+    {
+      m_r1 = r1;
+    }
+
+  inline void SiSpacePointsSeed::setR2(const double& r2)
+    {
+      m_r2 = r2;
+    }
+
+  inline void SiSpacePointsSeed::setR3(const double& r3)
+    {
+      m_r3 = r3;
+    }
+
+  inline void SiSpacePointsSeed::setDZDR_B(const double& dzdr)
+    {
+      m_dzdr_b = dzdr;
+    }
+
+  inline void SiSpacePointsSeed::setDZDR_T(const double& dzdr)
+    {
+      m_dzdr_t = dzdr;
+    }
+
+  inline void SiSpacePointsSeed::setPt(const double& pt)
+    {
+      m_pt = pt;
+    }
+
+  inline const double& SiSpacePointsSeed::d0() const
+    {
+      return m_d0;
+    }
+
   inline const double& SiSpacePointsSeed::zVertex() const 
     {
       return m_zvertex;
     }
+   
+  inline const double& SiSpacePointsSeed::eta() const
+    {
+      return m_eta;
+    }
+
+  inline const double& SiSpacePointsSeed::x1() const
+    {
+      return m_x1;
+    }
+
+  inline const double& SiSpacePointsSeed::x2() const
+    {
+      return m_x2;
+    }
+
+  inline const double& SiSpacePointsSeed::x3() const
+    {
+      return m_x3;
+    }
+
+  inline const double& SiSpacePointsSeed::y1() const
+    {
+      return m_y1;
+    }
+
+  inline const double& SiSpacePointsSeed::y2() const
+    {
+      return m_y2;
+    }
+
+  inline const double& SiSpacePointsSeed::y3() const
+    {
+      return m_y3;
+    }
+
+  inline const double& SiSpacePointsSeed::z1() const
+    {
+      return m_z1;
+    }
+
+  inline const double& SiSpacePointsSeed::z2() const
+    {
+      return m_z2;
+    }
+
+  inline const double& SiSpacePointsSeed::z3() const
+    {
+      return m_z3;
+    }
+
+  inline const double& SiSpacePointsSeed::r1() const
+    {
+      return m_r1;
+    }
+
+  inline const double& SiSpacePointsSeed::r2() const
+    {
+      return m_r2;
+    }
+
+  inline const double& SiSpacePointsSeed::r3() const
+    {
+      return m_r3;
+    }
+
+  inline const double& SiSpacePointsSeed::dzdr_b() const
+    {
+      return m_dzdr_b;
+    }
+
+  inline const double& SiSpacePointsSeed::dzdr_t() const
+    {
+      return m_dzdr_t;
+    }
   
+  inline const double& SiSpacePointsSeed::pt() const
+    {
+      return m_pt;
+    }
+
 } // end of name space
 
 #endif  // SiSpacePointsSeed_h
diff --git a/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingPixelClustersOnTrackTool.cxx b/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingPixelClustersOnTrackTool.cxx
index d842de5665b58cd8790befb205ac5b7bbc54a125..3a4653c433bf28f6699643c1790bfda37986c723 100755
--- a/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingPixelClustersOnTrackTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingPixelClustersOnTrackTool.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -20,7 +20,6 @@
 // data model
 #include "TrkEventPrimitives/LocalParameters.h"
 #include "InDetPrepRawData/PixelCluster.h"
-//#include "InDetCompetingRIOsOnTrack/CompetingPixelClustersOnTrack.h"
 //#include "TrkParameters/AtaStraightLine.h"
 //#include "TrkSurfaces/DiscSurface.h"
 //#include "TrkSurfaces/StraightLineSurface.h"
diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/InDetConversionFinderTools.h b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/InDetConversionFinderTools.h
index 213d4ad851f7c5de8f496dc3dab8447932d4cb02..e248ea6be1d8e0ad6ce8e618e640856d7dcb895c 100755
--- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/InDetConversionFinderTools.h
+++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/InDetConversionFinderTools.h
@@ -26,8 +26,6 @@
 #include "InDetConversionFinderTools/SingleTrackConversionTool.h"
 #include "InDetConversionFinderTools/ConversionFinderUtils.h"
 #include "InDetConversionFinderTools/VertexPointEstimator.h"
-#include "InDetConversionFinderTools/ConversionPostSelector.h"
-#include "InDetConversionFinderTools/SingleTrackConversionTool.h"
 #include "TrkToolInterfaces/ITrackSelectorTool.h"
 
 #include "TrkParticleBase/TrackParticleBaseCollection.h"
diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx
index b6c9dcd959080d20b164c66f6335eb8ab55b29ab..51e28aa3b52df046010e137a75dc75bdade030ec 100644
--- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx
@@ -25,9 +25,6 @@
 #include "TrkSurfaces/Surface.h"
 
 
-#include "TrkParameters/TrackParameters.h"
-
-
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/VertexContainer.h"
 
diff --git a/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/src/InDetIterativeSecVtxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/src/InDetIterativeSecVtxFinderTool.cxx
index 1996a73648c0eeb327c2c92ac62ccd718b251933..1c277493b25cdcd88d0d0076830b054760220d9f 100644
--- a/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/src/InDetIterativeSecVtxFinderTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/src/InDetIterativeSecVtxFinderTool.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>
 
@@ -42,7 +42,6 @@
 #include "VxVertex/VxTrackAtVertex.h"
 //#include "DataModel/DataVector.h"
 #include "AthContainers/DataVector.h"
-#include "TrkEventPrimitives/ParamDefs.h"
 #include "TrkVertexFitterInterfaces/IVertexFitter.h"
 
 #include "TrkTrackLink/ITrackLink.h"
diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx
index 03f1643f207b1ee109498273e81d8d09b6f83cfa..fa3ceb98a333a1cfb4131dffa93ba2a7a47c82c9 100755
--- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx
@@ -30,7 +30,6 @@
 #include "TrkVertexFitterInterfaces/IVertexSeedFinder.h"
 
 #include "AthContainers/DataVector.h"
-#include "TrkEventPrimitives/ParamDefs.h"
 #include "TrkVertexFitterInterfaces/IVertexFitter.h"
 #include "VxVertex/RecVertex.h"
 #include "VxVertex/VxTrackAtVertex.h"
diff --git a/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h b/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h
index e51088b9ea70576153422552b04365fde8c5bb68..d166e6712ccecee25e203df04d654c444cb07390 100644
--- a/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h
+++ b/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h
@@ -26,6 +26,8 @@
 
 class MsgStream;
 
+namespace Trk { class Track; }
+
 namespace InDet {
 
   class SiSpacePointsSeed;
@@ -126,7 +128,13 @@ namespace InDet {
       //@{
       virtual const SiSpacePointsSeed* next(const EventContext& ctx, SiSpacePointsSeedMakerEventData& data) const =0;
       //@}
-      
+
+      virtual void writeNtuple(const SiSpacePointsSeed* seed, const Trk::Track*, int seedType, long eventNumber) const =0;
+
+      virtual bool getWriteNtupleBoolProperty() const =0;
+     
+      enum seedType { StripSeed = 0, PixelSeed = 1 };
+ 
       ///////////////////////////////////////////////////////////////////
       /// @name Print internal tool parameters and status
       ///////////////////////////////////////////////////////////////////
diff --git a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx
index 92576b24e940045be8368db7c81e265c01a8bdfb..4be3ff0dc5b5d05f6d34415d35729fad2e017e82 100644
--- a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx
+++ b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx
@@ -19,7 +19,6 @@
 #include "SCT_ReadoutGeometry/SCT_DetectorManager.h"
 #include "PixelReadoutGeometry/PixelDetectorManager.h"
 #include "SiDetElementsRoadTool_xk/SiDetElementsComparison.h"
-#include "SiDetElementsRoadUtils_xk.h"
 #include "StoreGate/ReadCondHandle.h"
 #include "TrkPrepRawData/PrepRawData.h"
 #include "GaudiKernel/ContextSpecificPtr.h"
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ATLxk.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ATLxk.h
index adc213c8c9e3ad9cdbd30eb8e7ad3f0687607992..1fa659963e5f1f5d287c7fdc320dff37922da876 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ATLxk.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ATLxk.h
@@ -22,6 +22,9 @@
 #include "TrkSpacePoint/SpacePointContainer.h" 
 #include "TrkSpacePoint/SpacePointOverlapCollection.h"
 #include "TrkEventUtils/PRDtoTrackMap.h"
+#include "GaudiKernel/ITHistSvc.h"
+#include "TFile.h"
+#include "TTree.h"
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // MagField cache
@@ -35,6 +38,8 @@
 #include <vector>
 
 class MsgStream;
+//class TFile;
+//class TTree;
 
 namespace InDet {
 
@@ -117,7 +122,16 @@ namespace InDet {
     **/ 
     virtual const SiSpacePointsSeed* next(const EventContext& ctx, EventData& data) const override;
     //@}
-      
+     
+    /** This method is called by the SiSPSeededTrackFinder algorithm to fill ntuples for 
+    * seeds seen by the algorithm. seedType represents Pixel/SCT type seeds, where 0->SCT
+    * and 1->Pixel. givesTrack is determined by whether or not the given seed forms atleast 
+    * one track candidate. 0->No track candidate 1->At least one track Candidate
+    **/  
+    virtual void writeNtuple(const SiSpacePointsSeed* seed, const Trk::Track* track, int seedType, long eventNumber) const;
+
+    virtual bool getWriteNtupleBoolProperty() const;
+
     ///////////////////////////////////////////////////////////////////
     /// @name Print internal tool parameters and status
     ///////////////////////////////////////////////////////////////////
@@ -475,6 +489,47 @@ namespace InDet {
      * @return true if the seed is confirmed, false otherwise 
      **/ 
     bool isConfirmedSeed(const InDet::SiSpacePointForSeed* bottomSP, const InDet::SiSpacePointForSeed* topSP, float quality) const; 
+
+    ///Flag to write validation ntuples. Turned off by default
+    Gaudi::Property<bool> m_writeNtuple {this, "WriteNtuple", false, "Flag to write Validation Ntuples"};
+
+    ITHistSvc* m_thistSvc;
+
+    TFile* m_outputFile;
+    TTree* m_outputTree;
+
+    mutable std::mutex m_mutex;
+
+    mutable std::string          m_treeName               ATLAS_THREAD_SAFE;
+    mutable TString              m_treeFolder             ATLAS_THREAD_SAFE;
+
+    mutable float                  m_d0                   ATLAS_THREAD_SAFE;
+    mutable float                  m_z0                   ATLAS_THREAD_SAFE;
+    mutable float                  m_pt                   ATLAS_THREAD_SAFE;
+    mutable float                  m_eta                  ATLAS_THREAD_SAFE;
+    mutable double                 m_x1                   ATLAS_THREAD_SAFE;
+    mutable double                 m_x2                   ATLAS_THREAD_SAFE;
+    mutable double                 m_x3                   ATLAS_THREAD_SAFE;
+    mutable double                 m_y1                   ATLAS_THREAD_SAFE;
+    mutable double                 m_y2                   ATLAS_THREAD_SAFE;
+    mutable double                 m_y3                   ATLAS_THREAD_SAFE;
+    mutable double                 m_z1                   ATLAS_THREAD_SAFE;
+    mutable double                 m_z2                   ATLAS_THREAD_SAFE;
+    mutable double                 m_z3                   ATLAS_THREAD_SAFE;
+    mutable double                 m_r1                   ATLAS_THREAD_SAFE;
+    mutable double                 m_r2                   ATLAS_THREAD_SAFE;
+    mutable double                 m_r3                   ATLAS_THREAD_SAFE;
+    mutable float                  m_quality              ATLAS_THREAD_SAFE;
+    mutable int                    m_type                 ATLAS_THREAD_SAFE;
+    mutable int                    m_status               ATLAS_THREAD_SAFE;
+    mutable double                 m_dzdr_t               ATLAS_THREAD_SAFE;
+    mutable double                 m_dzdr_b               ATLAS_THREAD_SAFE;
+    mutable bool                   m_givesTrack           ATLAS_THREAD_SAFE;
+    mutable float                  m_trackD0              ATLAS_THREAD_SAFE;
+    mutable float                  m_trackZ0              ATLAS_THREAD_SAFE;
+    mutable float                  m_trackPt              ATLAS_THREAD_SAFE;
+    mutable float                  m_trackEta             ATLAS_THREAD_SAFE;
+    mutable long                   m_eventNumber          ATLAS_THREAD_SAFE;
   };
   
 } // end of name space
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_BeamGas.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_BeamGas.h
index ce9990ce62bc6bdb4e57e6fcb4eb9fd60e2bc2d7..5ec5f5ba0e188026fbf7c3392bf572e31c34c257 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_BeamGas.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_BeamGas.h
@@ -111,6 +111,10 @@ namespace InDet {
     virtual const SiSpacePointsSeed* next(const EventContext& ctx, EventData& data) const override;
     //@}
 
+    virtual void writeNtuple(const SiSpacePointsSeed* seed, const Trk::Track* track, int seedType, long EventNumber) const;
+
+    virtual bool getWriteNtupleBoolProperty() const;
+
     ///////////////////////////////////////////////////////////////////
     /// @name Print internal tool parameters and status
     ///////////////////////////////////////////////////////////////////
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Cosmic.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Cosmic.h
index 9dabc1d84ebd595e9e1f8782981421024749d37a..a72164353de5a6a4fcb42b0cb180baef1ae00f64 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Cosmic.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Cosmic.h
@@ -108,6 +108,10 @@ namespace InDet {
     virtual const SiSpacePointsSeed* next(const EventContext& ctx, EventData& data) const override;
     //@}
 
+    virtual void writeNtuple(const SiSpacePointsSeed* seed, const Trk::Track* track, int seedType, long eventNumber) const;
+
+    virtual bool getWriteNtupleBoolProperty() const;
+
     ///////////////////////////////////////////////////////////////////
     /// @name Print internal tool parameters and status
     ///////////////////////////////////////////////////////////////////
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_HeavyIon.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_HeavyIon.h
index 9dd38fd4534f4fb7dd7516d0848dcf7a5a57ec6d..19e54527894cc4aea3b8aa0081bdceed807fa5e8 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_HeavyIon.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_HeavyIon.h
@@ -109,6 +109,10 @@ namespace InDet {
     virtual const SiSpacePointsSeed* next(const EventContext& ctx, EventData& data) const override;
     //@}
 
+    virtual void writeNtuple(const SiSpacePointsSeed* seed, const Trk::Track* track, int seedType, long eventNumber) const;
+
+    virtual bool getWriteNtupleBoolProperty() const;
+
     ///////////////////////////////////////////////////////////////////
     /// @name Print internal tool parameters and status
     ///////////////////////////////////////////////////////////////////
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ITK.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ITK.h
index a744dc44eaffe614cf49581bd4266e889cc4e3bc..b922f7a3866bcd9914e51246ceb3a6b04b63a77c 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ITK.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ITK.h
@@ -111,6 +111,10 @@ namespace InDet {
     virtual const SiSpacePointsSeed* next(const EventContext& ctx, EventData& data) const override;
     //@}
 
+    virtual void writeNtuple(const SiSpacePointsSeed* seed, const Trk::Track* track, int seedType, long eventNumber) const;
+
+    virtual bool getWriteNtupleBoolProperty() const;
+
     ///////////////////////////////////////////////////////////////////
     /// @name Print internal tool parameters and status
     ///////////////////////////////////////////////////////////////////
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h
index aa55a92ed6df0439e219178e9227d51747fdefcc..153db9d6f5b34484a93bc48943399bd6bdbcb334 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h
@@ -109,6 +109,10 @@ namespace InDet {
     virtual const SiSpacePointsSeed* next(const EventContext& ctx, EventData& data) const override;
     //@}
 
+    virtual void writeNtuple(const SiSpacePointsSeed* seed, const Trk::Track* track, int seedType, long eventNumber) const;
+
+    virtual bool getWriteNtupleBoolProperty() const;
+
     ///////////////////////////////////////////////////////////////////
     /// @name Print internal tool parameters and status
     ///////////////////////////////////////////////////////////////////
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Trigger.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Trigger.h
index 92375cc65ee781215c9b2fced68f0e71674a7c4f..6ffa79a5ee931696fb52f7cc140765ee188607c0 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Trigger.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Trigger.h
@@ -107,6 +107,10 @@ namespace InDet {
     virtual const SiSpacePointsSeed* next(const EventContext& ctx, EventData& data) const override;
     //@}
 
+    virtual void writeNtuple(const SiSpacePointsSeed* seed, const Trk::Track* track, int seedType, long eventNumber) const;
+
+    virtual bool getWriteNtupleBoolProperty() const;
+
     ///////////////////////////////////////////////////////////////////
     /// @name Print internal tool parameters and status
     ///////////////////////////////////////////////////////////////////
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx
index b039fc6bae124713c6ff6dab8758677b4c80c9d4..36a72a60852a5a7ddf5c43bef85bc7f12fda1845 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx
@@ -16,6 +16,10 @@
 #include "InDetPrepRawData/SiCluster.h"
 #include "InDetReadoutGeometry/SiDetectorElement.h"
 
+#include "TrkTrack/Track.h"
+#include "TrkParameters/TrackParameters.h"
+
+#include "StoreGate/ReadCondHandle.h"
 #include <iomanip>
 #include <ostream>
 
@@ -25,7 +29,11 @@
 
 InDet::SiSpacePointsSeedMaker_ATLxk::SiSpacePointsSeedMaker_ATLxk
 (const std::string& t,const std::string& n,const IInterface* p)
-  : base_class(t, n, p)
+  : base_class(t, n, p),
+    m_thistSvc(nullptr),
+    m_outputTree(nullptr),
+    m_treeName(""),
+    m_treeFolder("/valNtuples/")
 {
 }
 
@@ -62,6 +70,46 @@ StatusCode InDet::SiSpacePointsSeedMaker_ATLxk::initialize()
     dump(data, msg(MSG::DEBUG));
   }
 
+  if (m_writeNtuple) {
+
+    ATH_CHECK( service("THistSvc",m_thistSvc)  );
+ 
+    m_treeName = (std::string("SeedTree_")+name());
+    std::replace( m_treeName.begin(), m_treeName.end(), '.', '_' );
+ 
+    m_outputTree = new TTree( m_treeName.c_str() , "SeedMakerValTool"); 
+
+    m_outputTree->Branch("eventNumber",    &m_eventNumber); 
+    m_outputTree->Branch("d0",             &m_d0);
+    m_outputTree->Branch("z0",             &m_z0);
+    m_outputTree->Branch("pt",             &m_pt);
+    m_outputTree->Branch("eta",            &m_eta);
+    m_outputTree->Branch("x1",             &m_x1);
+    m_outputTree->Branch("x2",             &m_x2);
+    m_outputTree->Branch("x3",             &m_x3);
+    m_outputTree->Branch("y1",             &m_y1);
+    m_outputTree->Branch("y2",             &m_y2);
+    m_outputTree->Branch("y3",             &m_y3);
+    m_outputTree->Branch("z1",             &m_z1);
+    m_outputTree->Branch("z2",             &m_z2);
+    m_outputTree->Branch("z3",             &m_z3);
+    m_outputTree->Branch("r1",             &m_r1);
+    m_outputTree->Branch("r2",             &m_r2);
+    m_outputTree->Branch("r3",             &m_r3);
+    m_outputTree->Branch("quality",        &m_quality);
+    m_outputTree->Branch("seedType",       &m_type);
+    m_outputTree->Branch("givesTrack",     &m_givesTrack);
+    m_outputTree->Branch("dzdr_b",  	   &m_dzdr_b);
+    m_outputTree->Branch("dzdr_t",         &m_dzdr_t);
+    m_outputTree->Branch("track_pt",       &m_trackPt);
+    m_outputTree->Branch("track_eta",      &m_trackEta);
+
+    TString fullTreeName = m_treeFolder + m_treeName;
+
+    ATH_CHECK(  m_thistSvc->regTree( fullTreeName.Data(), m_outputTree )  );
+
+  }
+
   return sc;
 }
 
@@ -147,6 +195,7 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::newEvent(const EventContext& ctx, Even
     // by the user for strip seeds
     data.maxSeedsPerSP = m_maxOneSizeSSS;
     data.keepAllConfirmedSeeds = m_alwaysKeepConfirmedStripSeeds;
+    
   } ///< end if-statement for iteration 0 
   else {  /// for the second iteration (PPP pass), don't redo the full init required the first time 
     data.r_first = 0;     ///< reset the first radial bin 
@@ -154,6 +203,7 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::newEvent(const EventContext& ctx, Even
     // by the user for pixel seeds
     data.maxSeedsPerSP = m_maxOneSizePPP;
     data.keepAllConfirmedSeeds = m_alwaysKeepConfirmedPixelSeeds;
+
     /// call fillLists to repopulate the candidate space points and exit 
     fillLists(data);
     return;
@@ -1767,6 +1817,7 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production3Sp
 	      if(z0 > zmax || z0 < zmin) continue;
         /// found a bottom SP candidate, write it into the data object
         data.SP[Nb] = (*iter_otherSP);
+        if(m_writeNtuple) data.SP[Nb]->setDZDR(dZdR);
         /// if we are exceeding the SP capacity of our data object,
         /// make it resize its vectors. Will add 50 slots by default,
         /// so rarely should happen more than once per event.  
@@ -1815,6 +1866,7 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production3Sp
  	      if(z0 > zmax || z0 < zmin) continue;
         /// add SP to the list
         data.SP[Nt] = (*iter_otherSP);
+        if (m_writeNtuple)  data.SP[Nt]->setDZDR(dZdR);
         /// if we are exceeding the SP capacity of our data object,
         /// make it resize its vectors. Will add 50 slots by default,
         /// so rarely should happen more than once per event.  
@@ -1904,6 +1956,11 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production3Sp
         
         /// average value of 1/tan(theta), approximate the slope at the location of the central space point
         float meanOneOverTanTheta = (Tzb+data.Tz[t])/2.; 
+        float theta = 0.;
+        if(m_writeNtuple){
+          /// theta estimate of the seed based on the average value of 1/tan(theta)
+          theta = atan(1./meanOneOverTanTheta);
+        }
         /// squared error on the difference in tan(theta) due to space point position errors. 
         float sigmaSquaredSpacePointErrors = Erb+data.Er[t]   /// pre-computed individual squared errors on 1/tan(theta) for the two segments 
                         + 2. * covz0 * data.R[t]*data.R[b]    /// mixed term with z-uncertainty on central SP
@@ -1956,7 +2013,6 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production3Sp
          * pt. This refines the cut applied above, following the same logic ("delta² - sigma² ?<=0")
          **/
         if (BSquare  > ipt2K*onePlusAsquare || remainingSquaredDelta*onePlusAsquare > BSquare*sigmaSquaredScatteringPtDependent) continue;
-
         /** This is an estimate of the transverse impact parameter. 
         * The reasoning is that, in the x-y frame with the central SP as origin and 
         * the x axis pointing away from the IP, we have for the distance between
@@ -1992,11 +2048,18 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production3Sp
           /// deviate from a straight line in r-z
           data.SP[t]->setScorePenalty(std::abs((Tzb-data.Tz[t])/(dr*sTzb2)));
           data.SP[t]->setParam(d0);
+
+          if(m_writeNtuple){
+            /// set parameters for ntuple writing
+            data.SP[t]->setEta(-log(tan(0.5*theta)));
+            data.SP[t]->setPt(std::sqrt(onePlusAsquare/BSquare)/(1000*data.K)); 
+          }
           /// record one possible seed candidate, sort by the curvature 
           data.CmSp.emplace_back(std::make_pair(B/std::sqrt(onePlusAsquare), data.SP[t]));
           /// store the transverse IP, will later be used as a quality estimator 
 
         }
+   
       }   ///< end loop over top space point candidates
       /// now apply further cleaning on the seed candidates for this central+bottom pair. 
       if (!data.CmSp.empty()) {
@@ -2006,6 +2069,7 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::production3Sp
     ///record seeds found in this run  
     fillSeeds(data);
     nseed += data.fillOneSeeds;
+   
   } ///< end loop over central SP 
 }
 
@@ -2386,6 +2450,7 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::newOneSeedWithCurvaturesComparison
 
 void InDet::SiSpacePointsSeedMaker_ATLxk::fillSeeds(EventData& data) const
 {
+
   data.fillOneSeeds = 0;
 
   std::multimap<float,InDet::SiSpacePointsProSeed*>::iterator it_firstSeedCandidate = data.mapOneSeeds_Pro.begin();
@@ -2442,6 +2507,7 @@ const InDet::SiSpacePointsSeed* InDet::SiSpacePointsSeedMaker_ATLxk::next(const
       }
       /// iterate until we find a valid seed satisfying certain quality cuts in set3 
     } while (!(*data.i_seed_Pro++).set3(data.seedOutput));
+
     /// then return this next seed candidate 
     return &data.seedOutput;
   } else {
@@ -2456,6 +2522,50 @@ const InDet::SiSpacePointsSeed* InDet::SiSpacePointsSeedMaker_ATLxk::next(const
   return nullptr;
 }
 
+///////////////////////////////////////////////////////////////////////////////////
+/// Method to write ntuple entries for an input seed
+///////////////////////////////////////////////////////////////////////////////////
+void InDet::SiSpacePointsSeedMaker_ATLxk::writeNtuple(const SiSpacePointsSeed* seed, const Trk::Track* track, int seedType, long eventNumber) const{
+  
+  if(m_writeNtuple) {
+    std::lock_guard<std::mutex> lock(m_mutex);
+
+    if(track != nullptr) {
+      m_trackPt = (track->trackParameters()->front()->pT())/1000.;
+      m_trackEta = std::abs(track->trackParameters()->front()->eta());
+    }
+    else {
+      m_trackPt = -1.;
+      m_trackEta = -1.; 
+    }
+    m_d0           =   seed->d0();
+    m_z0           =   seed->zVertex();
+    m_eta          =   seed->eta();
+    m_x1           =   seed->x1();
+    m_x2           =   seed->x2();
+    m_x3           =   seed->x3();
+    m_y1           =   seed->y1();
+    m_y2           =   seed->y2();
+    m_y3           =   seed->y3();      
+    m_z1           =   seed->z1();
+    m_z2           =   seed->z2();
+    m_z3           =   seed->z3();
+    m_r1           =   seed->r1();
+    m_r2           =   seed->r2();
+    m_r3           =   seed->r3();
+    m_type         =   seedType;
+    m_dzdr_b       =   seed->dzdr_b();
+    m_dzdr_t       =   seed->dzdr_t();
+    m_pt           =   seed->pt();
+    m_givesTrack   =   !(track == nullptr);
+    m_eventNumber  =   eventNumber;
+
+    m_outputTree->Fill();
+
+  }
+
+}
+
 bool InDet::SiSpacePointsSeedMaker_ATLxk::isZCompatible  
 (EventData& data, const float& Zv, const float& R, const float& T) const
 {
@@ -2562,3 +2672,7 @@ bool InDet::SiSpacePointsSeedMaker_ATLxk::isConfirmedSeed(const InDet::SiSpacePo
     /// PPS: the confirmation is the only quality modifier applied
     else return (quality < 0.); 
 }
+
+bool InDet::SiSpacePointsSeedMaker_ATLxk::getWriteNtupleBoolProperty() const{
+    return m_writeNtuple;
+} 
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx
index 2c7400366b8640c148bfd0a2b9bfc6a89e1d75c4..3ebae905d6da30034210aa09f9f44e5155a20c2b 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx
@@ -1216,3 +1216,10 @@ void InDet::SiSpacePointsSeedMaker_BeamGas::initializeEventData(EventData& data)
                   0, // sizeRFZV not used
                   false); // checkEta not used
 }
+
+void InDet::SiSpacePointsSeedMaker_BeamGas::writeNtuple(const SiSpacePointsSeed*, const Trk::Track*, int, long) const{
+}
+
+bool InDet::SiSpacePointsSeedMaker_BeamGas::getWriteNtupleBoolProperty() const{
+    return false;
+}
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Cosmic.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Cosmic.cxx
index bbfc2e54f2528a1547fd12462d1a121ff6416b98..d1ef2528e3d3cb6ae4e6d75486bb3b7efb3b68ab 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Cosmic.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Cosmic.cxx
@@ -1160,3 +1160,10 @@ void InDet::SiSpacePointsSeedMaker_Cosmic::initializeEventData(EventData& data)
                   0, // sizeRFZV not used
                   false); // checkEta not used
 }
+
+void InDet::SiSpacePointsSeedMaker_Cosmic::writeNtuple(const SiSpacePointsSeed*, const Trk::Track*, int, long) const{
+}
+
+bool InDet::SiSpacePointsSeedMaker_Cosmic::getWriteNtupleBoolProperty() const{
+    return false;
+}
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx
index 423b40ddfde67c2e3daebc184356c9adcdddd03c..297a3a60f3a2439a409b536a56f8cffc4ce9afcf 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx
@@ -1743,3 +1743,10 @@ void InDet::SiSpacePointsSeedMaker_HeavyIon::initializeEventData(EventData& data
                   SizeRFZV,
                   false); // checkEta not used
 }
+
+void InDet::SiSpacePointsSeedMaker_HeavyIon::writeNtuple(const SiSpacePointsSeed*, const Trk::Track*, int, long) const{
+}
+
+bool InDet::SiSpacePointsSeedMaker_HeavyIon::getWriteNtupleBoolProperty() const{
+    return false;
+}
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx
index acc9bb73cea63d1b0ced23e61bf19f2ecd54dd1b..aabcf9cd6415bb2a84e71e2240de0e839243c46f 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx
@@ -2077,3 +2077,10 @@ void InDet::SiSpacePointsSeedMaker_ITK::initializeEventData(EventData& data) con
                   SizeRFZV,
                   m_checketa);
 }
+
+void InDet::SiSpacePointsSeedMaker_ITK::writeNtuple(const SiSpacePointsSeed*, const Trk::Track*, int, long) const{
+}
+
+bool InDet::SiSpacePointsSeedMaker_ITK::getWriteNtupleBoolProperty() const{
+    return false;
+}
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx
index 3f075123c6b24a105e41f0ac216f349ea5da8248..b0fb2dc7cd742b17d4c6933749d32ff19ee8ed9f 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx
@@ -1184,3 +1184,10 @@ void InDet::SiSpacePointsSeedMaker_LowMomentum::initializeEventData(EventData& d
                   0, // sizeRFZV not used
                   false); // checkEta not used
 }
+
+void InDet::SiSpacePointsSeedMaker_LowMomentum::writeNtuple(const SiSpacePointsSeed*, const Trk::Track*, int, long) const{
+}
+
+bool InDet::SiSpacePointsSeedMaker_LowMomentum::getWriteNtupleBoolProperty() const{
+    return false;
+}
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
index 61db8694e7a55ebb3f8a1c656487686e2ce2e99c..4bae1bd01ec682005ac62d5b985699526de4d759 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
@@ -1664,3 +1664,10 @@ void InDet::SiSpacePointsSeedMaker_Trigger::initializeEventData(EventData& data)
                   SizeRFZV,
                   false); // checkEta not used
 }
+
+void InDet::SiSpacePointsSeedMaker_Trigger::writeNtuple(const SiSpacePointsSeed*, const Trk::Track*, int, long) const{
+}
+
+bool InDet::SiSpacePointsSeedMaker_Trigger::getWriteNtupleBoolProperty() const{
+    return false;
+}
diff --git a/InnerDetector/InDetRecTools/SiTrackMakerTool_xk/src/SiTrackMaker_xk.cxx b/InnerDetector/InDetRecTools/SiTrackMakerTool_xk/src/SiTrackMaker_xk.cxx
index ac26da25831ace94f4454b8eb03941a7b3a60bc9..8c775c0772e8400d898336a2d297db7b49139046 100644
--- a/InnerDetector/InDetRecTools/SiTrackMakerTool_xk/src/SiTrackMaker_xk.cxx
+++ b/InnerDetector/InDetRecTools/SiTrackMakerTool_xk/src/SiTrackMaker_xk.cxx
@@ -565,8 +565,8 @@ void InDet::SiTrackMaker_xk::newTrigEvent(const EventContext& ctx, SiTrackMakerE
   data.inputseeds() = 0;
   data.goodseeds()  = 0;
   data.findtracks() = 0;
-  for(int i=0; i!=SiCombinatorialTrackFinderData_xk::kNStatAllTypes; ++i) { for(int k = 0; k!=SiCombinatorialTrackFinderData_xk::kNSeedTypes; ++k) data.summaryStatAll()[i][k]; }
-  for(int i=0; i!=SiCombinatorialTrackFinderData_xk::kNStatEtaTypes; ++i) { for(int k = 0; k!=SiCombinatorialTrackFinderData_xk::kNSeedTypes; ++k) { for(int r=0; r!=SiCombinatorialTrackFinderData_xk::kNRapidityRanges; ++r) data.summaryStatUsedInTrack()[i][k][r]; } }
+  for(int i=0; i!=SiCombinatorialTrackFinderData_xk::kNStatAllTypes; ++i) { for(int k = 0; k!=SiCombinatorialTrackFinderData_xk::kNSeedTypes; ++k) data.summaryStatAll()[i][k] = 0.; }
+  for(int i=0; i!=SiCombinatorialTrackFinderData_xk::kNStatEtaTypes; ++i) { for(int k = 0; k!=SiCombinatorialTrackFinderData_xk::kNSeedTypes; ++k) { for(int r=0; r!=SiCombinatorialTrackFinderData_xk::kNRapidityRanges; ++r) data.summaryStatUsedInTrack()[i][k][r] = 0.; } }
 
 }
 
diff --git a/InnerDetector/InDetRecTools/TRT_DetElementsRoadTool_xk/TRT_DetElementsRoadTool_xk/TRT_DetElementsRoadMaker_xk.h b/InnerDetector/InDetRecTools/TRT_DetElementsRoadTool_xk/TRT_DetElementsRoadTool_xk/TRT_DetElementsRoadMaker_xk.h
index d796ec9c561793bf18d15d5e1ba07fb441054b1f..07029028690ef515afbc0f8e3147bf12043661ef 100755
--- a/InnerDetector/InDetRecTools/TRT_DetElementsRoadTool_xk/TRT_DetElementsRoadTool_xk/TRT_DetElementsRoadMaker_xk.h
+++ b/InnerDetector/InDetRecTools/TRT_DetElementsRoadTool_xk/TRT_DetElementsRoadTool_xk/TRT_DetElementsRoadMaker_xk.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
 */
 
 
@@ -24,7 +24,6 @@
 #include "GaudiKernel/AlgTool.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/MsgStream.h"
-#include "GaudiKernel/ServiceHandle.h"
 
 #include "StoreGate/ReadCondHandleKey.h"
 
diff --git a/InnerDetector/InDetRecTools/TRT_DriftCircleTool/src/TRT_DriftCircleToolCosmics.cxx b/InnerDetector/InDetRecTools/TRT_DriftCircleTool/src/TRT_DriftCircleToolCosmics.cxx
index 5dfd012a6a7b5402068ca9b3750dc5edf276de49..807d2a228dfdc0ad3be8d784e573abb8e0f8b48e 100755
--- a/InnerDetector/InDetRecTools/TRT_DriftCircleTool/src/TRT_DriftCircleToolCosmics.cxx
+++ b/InnerDetector/InDetRecTools/TRT_DriftCircleTool/src/TRT_DriftCircleToolCosmics.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -31,9 +31,6 @@
 
 #include "StoreGate/ReadHandle.h"
 
-#include "GeoPrimitives/GeoPrimitives.h"
-#include "EventPrimitives/EventPrimitives.h"
-
 #include "StoreGate/ReadCondHandle.h"
 ///////////////////////////////////////////////////////////////////
 // Constructior
diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/TRT_ElectronPidToolRun2.h b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/TRT_ElectronPidToolRun2.h
index aac420af67845254a12bfb9db73a7ca4de0678f0..a64507eec7077a02fef27d4ef6317062fa863074 100644
--- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/TRT_ElectronPidToolRun2.h
+++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/TRT_ElectronPidToolRun2.h
@@ -11,7 +11,6 @@
 
 #include "AthenaBaseComps/AthAlgTool.h"       // Exchange IN
 
-#include "AthenaBaseComps/AthAlgTool.h"
 #include "GaudiKernel/ITHistSvc.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "StoreGate/ReadCondHandleKey.h"
diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigAmbiguitySolver/src/InDetTrigAmbiguitySolver.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigAmbiguitySolver/src/InDetTrigAmbiguitySolver.cxx
index 2810f8fdac754f730f474f91a9eb1352c5da9fc3..036c664c57f52d363d5c9635317c399ae4cc43ec 100755
--- a/InnerDetector/InDetTrigRecAlgs/InDetTrigAmbiguitySolver/src/InDetTrigAmbiguitySolver.cxx
+++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigAmbiguitySolver/src/InDetTrigAmbiguitySolver.cxx
@@ -9,7 +9,6 @@
 #include "TrkTrack/Track.h"
 #include "TrkTrack/TrackCollection.h"
 #include "TrkEventUtils/PRDtoTrackMap.h"
-#include "TrkToolInterfaces/ITrackAmbiguityProcessorTool.h"
 #include "TrkEventPrimitives/FitQuality.h"
 #include "TrkParameters/TrackParameters.h"
 #include "TrigNavigation/NavigationCore.icc"
diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackResidualMonitor/src/TrigTrackResidualMonitor.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackResidualMonitor/src/TrigTrackResidualMonitor.cxx
index 8ceff5d7c5583d8f05db3bebe605bd374fe10600..99bcf295dc47f66634b5cb052d5600bebff93b93 100644
--- a/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackResidualMonitor/src/TrigTrackResidualMonitor.cxx
+++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigTrackResidualMonitor/src/TrigTrackResidualMonitor.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 "InDetTrigTrackResidualMonitor/TrigTrackResidualMonitor.h"
@@ -19,7 +19,6 @@
 #include "TrkParameters/TrackParameters.h"
 #include "TrkValTools/TrackDiff.h"
 #include "TrkEventPrimitives/TrackStateDefs.h"
-#include "TrkTrack/Track.h"
 #include "TrkSurfaces/Surface.h"
 #include "InDetIdentifier/SCT_ID.h"
 #include "InDetIdentifier/SiliconID.h"
diff --git a/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/SiTrigSPSeededTrackFinder/SiTrigSPSeededTrackFinder.h b/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/SiTrigSPSeededTrackFinder/SiTrigSPSeededTrackFinder.h
index 2ce82cb6394b6bf7a947c7ac00d731ac482befcf..ac36a7e433c7c8f0fa688c7402dfc947d568817c 100755
--- a/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/SiTrigSPSeededTrackFinder/SiTrigSPSeededTrackFinder.h
+++ b/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/SiTrigSPSeededTrackFinder/SiTrigSPSeededTrackFinder.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
 */
 
 /////////////////////////////////////////////////////////////////////////////
@@ -33,18 +33,14 @@
 
 //!< Trigger specific stuff
 #include "TrigInterfaces/FexAlgo.h"
-
 #include "TrkEventUtils/PRDtoTrackMap.h"
+#include "InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h"
+#include "InDetRecToolInterfaces/ISiZvertexMaker.h"
+#include "InDetRecToolInterfaces/ISiTrackMaker.h"
 
 //forward declarations
 class TrigTimer;
 
-namespace InDet {
-  class ISiSpacePointsSeedMaker;
-  class ISiZvertexMaker;
-  class ISiTrackMaker;
-}
-
 namespace InDet {
   
   //!< Class-algorithm for track finding in Pixels and SCT
diff --git a/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/src/components/SiTrigSPSeededTrackFinder_entries.cxx b/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/src/components/SiTrigSPSeededTrackFinder_entries.cxx
index 1e4aa94a9b8605521d0532776bf0dde7c4310533..81479d68bfd26558173fac109d12f577e3d77a6a 100644
--- a/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/src/components/SiTrigSPSeededTrackFinder_entries.cxx
+++ b/InnerDetector/InDetTrigRecAlgs/SiTrigSPSeededTrackFinder/src/components/SiTrigSPSeededTrackFinder_entries.cxx
@@ -1,10 +1,5 @@
 #include "SiTrigSPSeededTrackFinder/SiTrigSPSeededTrackFinder.h"
 
-#include "InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h"
-#include "InDetRecToolInterfaces/ISiZvertexMaker.h" 
-#include "InDetRecToolInterfaces/ISiTrackMaker.h" 
-#include "IRegionSelector/IRegSelSvc.h"
-
 using namespace InDet;
 
 DECLARE_COMPONENT( SiTrigSPSeededTrackFinder )
diff --git a/InnerDetector/InDetTrigRecAlgs/TRT_TrigTrackSegmentsFinder/src/components/TRT_TrigTrackSegmentsFinder_entries.cxx b/InnerDetector/InDetTrigRecAlgs/TRT_TrigTrackSegmentsFinder/src/components/TRT_TrigTrackSegmentsFinder_entries.cxx
index b1d7b62ed071c9697bec5aa953c44ea01dc97658..9149a6dd83cbf70f0eb6d0e3dadedae8c909043b 100644
--- a/InnerDetector/InDetTrigRecAlgs/TRT_TrigTrackSegmentsFinder/src/components/TRT_TrigTrackSegmentsFinder_entries.cxx
+++ b/InnerDetector/InDetTrigRecAlgs/TRT_TrigTrackSegmentsFinder/src/components/TRT_TrigTrackSegmentsFinder_entries.cxx
@@ -1,5 +1,4 @@
 #include "TRT_TrigTrackSegmentsFinder/TRT_TrigTrackSegmentsFinder.h"
-#include "IRegionSelector/IRegSelSvc.h"
 
 using namespace InDet;
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.h
index 608abd5e894d87483a0f2ed4c4c9af46e1a6a09d..453d5cf999c93d380b6f64da87def49cb49fc177 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Resolution.h
@@ -22,7 +22,6 @@
 #include "xAODTracking/TrackParticlexAODHelpers.h"
 #include "xAODTruth/TruthParticle.h"
 #include "AthenaBaseComps/AthAlgorithm.h"
-#include "InDetPlotBase.h"
 #include "InDetPhysValMonitoring/ResolutionHelper.h"
 
 #include "TFitResultPtr.h"
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
index 16e22d4e2da9c0aeb7b91b3a14c2d025a2091601..535fd48aa8e5c15ca250ec4464ecf5f1a97d85fa 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
@@ -23,7 +23,6 @@
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/TrackStateValidationContainer.h"
 #include "xAODTracking/TrackStateValidation.h"
-#include "xAODTracking/TrackStateValidationContainer.h"
 #include "xAODTracking/TrackParticleContainer.h"
 #include "xAODTruth/TruthParticle.h"
 #include "xAODTruth/TruthVertex.h"
diff --git a/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/TrackStatHelper.h b/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/TrackStatHelper.h
index d192e7d7d4440fc9ef9f0f2a082ed2bd70d6c25a..bdc5a1f51c32d00a832bec528d958e0d2b9d75a2 100755
--- a/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/TrackStatHelper.h
+++ b/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/TrackStatHelper.h
@@ -22,7 +22,6 @@
 #include "TrkToolInterfaces/IExtendedTrackSummaryTool.h"
 #include "TrkToolInterfaces/IPRDtoTrackMapTool.h"
 #include "TrkTruthData/TrackTruthCollection.h"
-#include "TrkTrack/TrackInfo.h"
 
 #include <vector>
 #include <string>
diff --git a/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx b/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx
index 4b3feda323344eea55c8022436aff5a02775f71a..4664cb5e275e4575194a1b0ba1952d8219a34906 100755
--- a/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx
+++ b/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx
@@ -68,8 +68,6 @@
 #include "AtlasHepMC/GenParticle.h"
 #include "TruthHelper/PileUpType.h"
 
-#include "IdDictDetDescr/IdDictManager.h" 
-
 
 
 
@@ -298,7 +296,7 @@ StatusCode InDet::InDetRecStatisticsAlg::execute(const EventContext &ctx)  const
     // apply pt, eta etc cuts to generated tracks
     // devide generated tracks into primary, truncated, secondary
 
-    std::vector <std::pair<HepMC::GenParticle *,int> > GenSignal;
+    std::vector <std::pair<HepMC::GenParticlePtr,int> > GenSignal;
     //     GenSignalPrimary, GenSignalTruncated, GenSignalSecondary;   
     unsigned int inTimeStart = 0;
     unsigned int inTimeEnd   = 0;
@@ -583,7 +581,7 @@ void InDet::InDetRecStatisticsAlg::selectRecSignal(const TrackCollection* RecCol
 // select charged, stable particles in allowed pt and eta range
 void InDet :: InDetRecStatisticsAlg ::
 selectGenSignal  (const McEventCollection* SimTracks, 
-		  std::vector <std::pair<HepMC::GenParticle *,int> > & GenSignal,
+		  std::vector <std::pair<HepMC::GenParticlePtr,int> > & GenSignal,
 		  unsigned int /*inTimeStart*/, unsigned int /*inTimeEnd*/,
                   InDet::InDetRecStatisticsAlg::CounterLocal &counter) const //'unused' compiler warning
 {
@@ -604,7 +602,11 @@ selectGenSignal  (const McEventCollection* SimTracks,
   for(unsigned int ievt=0; ievt<nb_mc_event; ++ievt)
     {
       const HepMC::GenEvent* genEvent = SimTracks->at(ievt);
-      counter.m_counter[kN_gen_tracks_processed] += ((SimTracks->at(ievt)))->particles_size();
+#ifdef HEPMC3
+      counter.m_counter[kN_gen_tracks_processed] += genEvent->particles().size();
+#else
+      counter.m_counter[kN_gen_tracks_processed] += genEvent->particles_size();
+#endif
       if (put && inTimeMBbegin != inTimeMBend) // if not, inTimeStart and End are untouched
 	{
 	  //if (genEvent == *inTimeMBbegin) inTimeStart = ievt;
diff --git a/InnerDetector/InDetValidation/InDetRecStatistics/src/TrackStatHelper.cxx b/InnerDetector/InDetValidation/InDetRecStatistics/src/TrackStatHelper.cxx
index 1f9d5946e2021f86942667d7808aa21c72f20054..4d283224b34a19825beb9f48ac04c0d5520211c2 100755
--- a/InnerDetector/InDetValidation/InDetRecStatistics/src/TrackStatHelper.cxx
+++ b/InnerDetector/InDetValidation/InDetRecStatistics/src/TrackStatHelper.cxx
@@ -407,7 +407,7 @@ void InDet::TrackStatHelper::addEvent(const TrackCollection              * recTr
   Eta = 0;
   Region = ETA_ALL;
   int classification=-999;
-  for (std::vector <std::pair<HepMC::GenParticle *,int> >::const_iterator truth = gen.begin(); truth != gen.end();  ++truth) {
+  for (auto truth = gen.begin(); truth != gen.end();  ++truth) {
     classification=-999; 
     bool inTimePileup = truth->second == 0
       || (truth->second >= (int)*inTimeStart && truth->second <= (int)*inTimeEnd);
@@ -494,7 +494,7 @@ void InDet::TrackStatHelper::addEvent(const TrackCollection              * recTr
   Region = ETA_ALL;
   classification=-999;
   
-  for (std::vector <std::pair<HepMC::GenParticle *,int> >::const_iterator truth = gen.begin(); truth != gen.end();  ++truth) 
+  for (auto truth = gen.begin(); truth != gen.end();  ++truth) 
     {
       if (truth->second != 0) // only signal event GenParticles
 	continue;
@@ -868,7 +868,7 @@ bool InDet::TrackStatHelper::PassTrackCuts(const Trk::TrackParameters *para) con
 
 }
 
-int InDet::TrackStatHelper::ClassifyParticle( const HepMC::GenParticle *particle, const double prob) const {
+int InDet::TrackStatHelper::ClassifyParticle( HepMC::ConstGenParticlePtr particle, const double prob) const {
 
   int partClass=-999;
 
diff --git a/MuonSpectrometer/Amdcsimrec/AmdcAth/AmdcAth/AmdcsimrecAthenaSvc.h b/MuonSpectrometer/Amdcsimrec/AmdcAth/AmdcAth/AmdcsimrecAthenaSvc.h
index b20b0c241d0b4d6ed4ca85cdcf97028955f3a123..b80c338f98637497ff169db18f137d9e1cb7bcf2 100755
--- a/MuonSpectrometer/Amdcsimrec/AmdcAth/AmdcAth/AmdcsimrecAthenaSvc.h
+++ b/MuonSpectrometer/Amdcsimrec/AmdcAth/AmdcAth/AmdcsimrecAthenaSvc.h
@@ -51,7 +51,6 @@ public:
    static const InterfaceID& interfaceID() { return IID_IAmdcsimrecAthenaSvc; }
 
    virtual StatusCode initialize();
-   virtual StatusCode finalize();
 
    virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface );
 
diff --git a/MuonSpectrometer/Amdcsimrec/AmdcAth/src/AmdcsimrecAthenaSvc.cxx b/MuonSpectrometer/Amdcsimrec/AmdcAth/src/AmdcsimrecAthenaSvc.cxx
index dc4189317622daa17fe2c2d4ce9ae8f18c243c31..57ee88cbbe69e3063ce92254d44a63809bc26a72 100755
--- a/MuonSpectrometer/Amdcsimrec/AmdcAth/src/AmdcsimrecAthenaSvc.cxx
+++ b/MuonSpectrometer/Amdcsimrec/AmdcAth/src/AmdcsimrecAthenaSvc.cxx
@@ -266,10 +266,7 @@ StatusCode AmdcsimrecAthenaSvc::initialize() {
   if ( m_EmergencyOut == 1 ) return StatusCode::FAILURE;
   return StatusCode::SUCCESS;
 }
- 
-/// Service finalisation
-StatusCode AmdcsimrecAthenaSvc::finalize(){return StatusCode::SUCCESS;}
- 
+
 StatusCode AmdcsimrecAthenaSvc::queryInterface( const InterfaceID& riid, void** ppvInterface ) {
   if ( IID_IAmdcsimrecAthenaSvc == riid )    {
     *ppvInterface = (AmdcsimrecAthenaSvc*)this;
diff --git a/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDb.h b/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDb.h
index e78595ec08fb2cf6602b86cc3006168ed36f764f..c8418f5d39e9691c258730e3f68f6f2bebe6f2c5 100755
--- a/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDb.h
+++ b/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDb.h
@@ -31,7 +31,6 @@ class AmdcDb final : public AthService, virtual public IRDBAccessSvc {
   static const InterfaceID& interfaceID() { return IID_IRDBAccessSvc; }
 
   virtual StatusCode initialize() override;
-  virtual StatusCode finalize() override;
 
   virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ) override;
 
diff --git a/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDb.cxx b/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDb.cxx
index ea84217fc16b42caa9e73770efbe1eb8b3c79ac0..bec013addc0ebcce2741704b31d5ae336aa1a5c8 100755
--- a/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDb.cxx
+++ b/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDb.cxx
@@ -195,9 +195,6 @@ StatusCode AmdcDb::DoUpdatedSvc()
   return StatusCode::SUCCESS;
 }
 
-/// Service finalisation
-StatusCode AmdcDb::finalize(){return StatusCode::SUCCESS;}
- 
 StatusCode AmdcDb::queryInterface(const InterfaceID& riid, void** ppvInterface)
 {
   if (IID_IRDBAccessSvc == riid)
diff --git a/MuonSpectrometer/Amdcsimrec/AmdcOracle/AmdcOracle/AmdcDumpOracle.h b/MuonSpectrometer/Amdcsimrec/AmdcOracle/AmdcOracle/AmdcDumpOracle.h
index bae89b19c50f5acc9df9edd517f5c7c1fe5c5a56..909af1d8f0d7871860ed4e0d55e81ccff57bd66d 100755
--- a/MuonSpectrometer/Amdcsimrec/AmdcOracle/AmdcOracle/AmdcDumpOracle.h
+++ b/MuonSpectrometer/Amdcsimrec/AmdcOracle/AmdcOracle/AmdcDumpOracle.h
@@ -29,8 +29,7 @@ public:
 ///////////////////////////////////
 
    StatusCode initialize();
-   StatusCode execute();
-   StatusCode finalize();
+   StatusCode execute(){return StatusCode::SUCCESS;}
 
 private:
 ///////////////////////////////////
diff --git a/MuonSpectrometer/Amdcsimrec/AmdcOracle/src/AmdcDumpOracle.cxx b/MuonSpectrometer/Amdcsimrec/AmdcOracle/src/AmdcDumpOracle.cxx
index 7df7f6d4a0adb8f1f9582390dc1461c38f8530df..b018dd56bebe0c9204f5ca420122ee1581d7a94e 100755
--- a/MuonSpectrometer/Amdcsimrec/AmdcOracle/src/AmdcDumpOracle.cxx
+++ b/MuonSpectrometer/Amdcsimrec/AmdcOracle/src/AmdcDumpOracle.cxx
@@ -374,10 +374,6 @@ StatusCode AmdcDumpOracle::DoIt()
 
 }
 
-StatusCode AmdcDumpOracle::execute() {return StatusCode::SUCCESS;}
- 
-StatusCode AmdcDumpOracle::finalize() {return StatusCode::SUCCESS;}
-
 void AmdcDumpOracle::DumpASZT( IRDBAccessSvc* pIRDBAccessSvc, std::string TagAdd, int& Kwarn,int& Kchck){
 
   std::string NameOfTheSet = "ASZT";
diff --git a/MuonSpectrometer/MuonCablings/CSCcabling/CSCcabling/CSCcablingSvc.h b/MuonSpectrometer/MuonCablings/CSCcabling/CSCcabling/CSCcablingSvc.h
index 88b2bc5d395a154b36711faa583777cf1a97d3a5..a4d8f93e69c8b47425607ac6ca88d54c1308288f 100755
--- a/MuonSpectrometer/MuonCablings/CSCcabling/CSCcabling/CSCcablingSvc.h
+++ b/MuonSpectrometer/MuonCablings/CSCcabling/CSCcabling/CSCcablingSvc.h
@@ -24,13 +24,12 @@ class CSCcablingSvc : public AthService, virtual public IInterface {
 public:
    
   CSCcablingSvc(const std::string& name,ISvcLocator* sl);
-  virtual ~CSCcablingSvc();
+  virtual ~CSCcablingSvc()=default;
 
   static const InterfaceID& interfaceID() { return IID_ICSCcablingSvc; }
   virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF);
 
   virtual StatusCode initialize(void);
-  virtual StatusCode finalize(void);  
 
   /** map offline ROD identifier to online ID */
   bool onlineId(const uint16_t subdetectorID, const uint16_t offlineID, uint32_t& rodId) const;
diff --git a/MuonSpectrometer/MuonCablings/CSCcabling/src/CSCcablingSvc.cxx b/MuonSpectrometer/MuonCablings/CSCcabling/src/CSCcablingSvc.cxx
index 9ab4c909ec53603c0f0bec4cfb1928d7a000f414..744a261245b113037250f5249d1e2dbce0cb3441 100755
--- a/MuonSpectrometer/MuonCablings/CSCcabling/src/CSCcablingSvc.cxx
+++ b/MuonSpectrometer/MuonCablings/CSCcabling/src/CSCcablingSvc.cxx
@@ -22,8 +22,6 @@ CSCcablingSvc::CSCcablingSvc(const std::string& name, ISvcLocator* sl)
   declareProperty("Run1Cabling", m_run1 = false);
 }
 
-CSCcablingSvc::~CSCcablingSvc() {}
-
 StatusCode CSCcablingSvc::queryInterface(const InterfaceID& riid, void** ppvIF) {
  
   if( IID_ICSCcablingSvc.versionMatch(riid) ) { 
@@ -73,10 +71,6 @@ StatusCode CSCcablingSvc::initialize() {
   return StatusCode::SUCCESS;
 }
 
-StatusCode CSCcablingSvc::finalize() { 
-  return StatusCode::SUCCESS;
-}
-
 /** map offline ROD identifier to online ID */
 bool CSCcablingSvc::onlineId(const uint16_t subDetectorID, const uint16_t offlineID, uint32_t& rodId) const {
 
diff --git a/MuonSpectrometer/MuonCablings/MuonCablingServers/MuonCablingServers/RPCcablingServerSvc.h b/MuonSpectrometer/MuonCablings/MuonCablingServers/MuonCablingServers/RPCcablingServerSvc.h
index ec9d0ac2b929bb3d60a78a71c0ba06bd090973dd..49d51af42e473fb33df51a2d6ed9a1909fd29820 100644
--- a/MuonSpectrometer/MuonCablings/MuonCablingServers/MuonCablingServers/RPCcablingServerSvc.h
+++ b/MuonSpectrometer/MuonCablings/MuonCablingServers/MuonCablingServers/RPCcablingServerSvc.h
@@ -30,11 +30,10 @@ class RPCcablingServerSvc : public AthService,
     public:
     // Constructor and other Service methods
     RPCcablingServerSvc(const std::string& name, ISvcLocator* svc);
-    virtual ~RPCcablingServerSvc() {}
+    virtual ~RPCcablingServerSvc()=default;
   
     virtual StatusCode queryInterface(const InterfaceID& riid,void** ppvIF) override;
     virtual StatusCode initialize(void) override;
-    virtual StatusCode finalize(void) override;
 
     // Interface implementation
     virtual StatusCode giveCabling(const IRPCcablingSvc*&) const override;
diff --git a/MuonSpectrometer/MuonCablings/MuonCablingServers/MuonCablingServers/TGCcablingServerSvc.h b/MuonSpectrometer/MuonCablings/MuonCablingServers/MuonCablingServers/TGCcablingServerSvc.h
index 1cee8a8785081d4d031e2ae5dfe693a6601ceba2..0b4e05f664ce0a6b7a11ab4e685bd1ddd85148a1 100644
--- a/MuonSpectrometer/MuonCablings/MuonCablingServers/MuonCablingServers/TGCcablingServerSvc.h
+++ b/MuonSpectrometer/MuonCablings/MuonCablingServers/MuonCablingServers/TGCcablingServerSvc.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 TGCcablingServerSvc_H
@@ -22,11 +22,9 @@ class TGCcablingServerSvc : public AthService,
     public:
     // Constructor and other Service methods
     TGCcablingServerSvc(const std::string& name, ISvcLocator* svc);
-    virtual ~TGCcablingServerSvc() {}
+    virtual ~TGCcablingServerSvc()=default;
   
     virtual StatusCode queryInterface(const InterfaceID& riid,void** ppvIF);
-    virtual StatusCode initialize(void);
-    virtual StatusCode finalize(void);
 
     // Interface implementation
     virtual StatusCode giveCabling( const ITGCcablingSvc*&) const;
diff --git a/MuonSpectrometer/MuonCablings/MuonCablingServers/src/RPCcablingServerSvc.cxx b/MuonSpectrometer/MuonCablings/MuonCablingServers/src/RPCcablingServerSvc.cxx
index 36bd4892cee8b43df798bc35c4b2a95ccf35fefe..b2594f9dd23fe9f0c25bf7dd5db8fff06af09937 100644
--- a/MuonSpectrometer/MuonCablings/MuonCablingServers/src/RPCcablingServerSvc.cxx
+++ b/MuonSpectrometer/MuonCablings/MuonCablingServers/src/RPCcablingServerSvc.cxx
@@ -57,11 +57,6 @@ RPCcablingServerSvc::initialize() {
     return StatusCode::SUCCESS;
 }
 
-StatusCode
-RPCcablingServerSvc::finalize() {
-    return StatusCode::SUCCESS;
-}
-
 StatusCode 
 RPCcablingServerSvc::giveCabling(const IRPCcablingSvc*& cabling) const {
 
diff --git a/MuonSpectrometer/MuonCablings/MuonCablingServers/src/TGCcablingServerSvc.cxx b/MuonSpectrometer/MuonCablings/MuonCablingServers/src/TGCcablingServerSvc.cxx
index c61391da535885dd3e09bdf2aa0384a442708efd..ab1e48ba39855f8b15937fe69c955ced466cd14f 100644
--- a/MuonSpectrometer/MuonCablings/MuonCablingServers/src/TGCcablingServerSvc.cxx
+++ b/MuonSpectrometer/MuonCablings/MuonCablingServers/src/TGCcablingServerSvc.cxx
@@ -30,17 +30,6 @@ TGCcablingServerSvc::queryInterface(const InterfaceID& riid, void** ppvIF)
     
     addRef();
     return StatusCode::SUCCESS;
-} 
-
-StatusCode
-TGCcablingServerSvc::initialize() 
-{
-    return StatusCode::SUCCESS;
-}
-
-StatusCode
-TGCcablingServerSvc::finalize() {
-    return StatusCode::SUCCESS;
 }
 
 StatusCode
diff --git a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MdtTestCabling.h b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MdtTestCabling.h
index dd353f1136418e3efce91886de881c9ed1b235c4..b640a47dd0d4ee71d432492912c6088371490aa6 100644
--- a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MdtTestCabling.h
+++ b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MdtTestCabling.h
@@ -29,10 +29,9 @@ class MdtTestCabling : public AthAlgorithm {
  public:
 
   MdtTestCabling(const std::string& name, ISvcLocator* pSvcLocator);
-  ~MdtTestCabling();
+  ~MdtTestCabling()=default;
 
   virtual StatusCode initialize();
-  virtual StatusCode finalize();
   virtual StatusCode execute();
 
  private:
diff --git a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MuonMDT_CablingAlg.h b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MuonMDT_CablingAlg.h
index ad704fbfd4c3c549555c16189928008c7372aa6f..57128e1b00cb1c3d94af1bd5bf4fb4c0e5182123 100644
--- a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MuonMDT_CablingAlg.h
+++ b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MuonMDT_CablingAlg.h
@@ -36,7 +36,6 @@ class MuonMDT_CablingAlg: public AthAlgorithm {
   virtual ~MuonMDT_CablingAlg() = default;
   virtual StatusCode initialize() override;
   virtual StatusCode execute() override;
-  virtual StatusCode finalize() override;
   
  private:
 
diff --git a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MuonMDT_CablingSvc.h b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MuonMDT_CablingSvc.h
index 27aadd9b9f9a28616fc9e0ed51bdb2ca46fe823b..183ce2895038b503876287f77b938270a9f30cb1 100644
--- a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MuonMDT_CablingSvc.h
+++ b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MuonMDT_CablingSvc.h
@@ -29,17 +29,9 @@ class MuonMDT_CablingSvc : public AthService ,
  public:
 
   MuonMDT_CablingSvc(const std::string& name,ISvcLocator* sl);
-  virtual ~MuonMDT_CablingSvc();
+  virtual ~MuonMDT_CablingSvc()=default;
   
   virtual StatusCode initialize() override;
-  virtual StatusCode finalize() override;
-
-  /** methods called at trigger stop/start */
-  //  virtual StatusCode start();
-  //  virtual StatusCode stop();
-
-  /** method for begin run transition */
-  //  virtual void handle(const Incident&);
 
   static const InterfaceID& interfaceID() { return IID_IMuonMDT_CablingSvc; }
 
diff --git a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MdtTestCabling.cxx b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MdtTestCabling.cxx
index 11ba99136ca32b068250b554bfeab477e5e79bf7..670fb574598276277389ec3052844a681c81f1cd 100644
--- a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MdtTestCabling.cxx
+++ b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MdtTestCabling.cxx
@@ -10,9 +10,6 @@ MdtTestCabling::MdtTestCabling(const std::string& name, ISvcLocator* pSvcLocator
 { 
 }
 
-MdtTestCabling::~MdtTestCabling() { }
-
-
 StatusCode MdtTestCabling::initialize()
 {
   ATH_CHECK( m_chronoSvc.retrieve() );
@@ -45,12 +42,6 @@ StatusCode MdtTestCabling::execute()
   return StatusCode::SUCCESS;
 }
 
-
-StatusCode MdtTestCabling::finalize()
-{
-  return StatusCode::SUCCESS;
-}
-
 /** test the map content */
 bool MdtTestCabling::testMap()
 {
diff --git a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingAlg.cxx b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingAlg.cxx
index 784b3d7596852b265de9fe3b05bc349a50d394d9..73be45980b2d829938b03947dade25430c30d8c5 100644
--- a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingAlg.cxx
+++ b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingAlg.cxx
@@ -286,10 +286,3 @@ StatusCode MuonMDT_CablingAlg::execute(){
   
   return StatusCode::SUCCESS;
 }
-
-
-StatusCode MuonMDT_CablingAlg::finalize(){
-  
-  ATH_MSG_DEBUG( "finalize " << name() );
-  return StatusCode::SUCCESS;
-}
diff --git a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingSvc.cxx b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingSvc.cxx
index d5f66c5c7d1db0d93b2f7d2073176274f389edfa..39e59a52958b4c5f7beefdd85a010862efcd8ba0 100644
--- a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingSvc.cxx
+++ b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingSvc.cxx
@@ -39,10 +39,6 @@ AthService(svcName,sl),
     declareProperty("doCalStreamInit",m_doCalStreamInit=false);
 }
 
-MuonMDT_CablingSvc::~MuonMDT_CablingSvc()
-    { }
-
-
 /** Initialization method */
 StatusCode MuonMDT_CablingSvc::initialize()
 {
@@ -149,14 +145,6 @@ StatusCode MuonMDT_CablingSvc::initialize()
     return sc;
 }
 
-/** Finalization method */
-StatusCode MuonMDT_CablingSvc::finalize()
-{
-   return StatusCode::SUCCESS;
-}
-
-
-
 // queryInterface 
 StatusCode MuonMDT_CablingSvc::queryInterface(const InterfaceID& riid, void** ppvIF) 
 { 
diff --git a/MuonSpectrometer/MuonCablings/TGCcabling/TGCcabling/TGCcablingSvc.h b/MuonSpectrometer/MuonCablings/TGCcabling/TGCcabling/TGCcablingSvc.h
index 261e0e58fef28b24cd35b0047218f61b5bf93248..a8db79c4c973081b1f8acb72a5298b385d99a05e 100755
--- a/MuonSpectrometer/MuonCablings/TGCcabling/TGCcabling/TGCcablingSvc.h
+++ b/MuonSpectrometer/MuonCablings/TGCcabling/TGCcabling/TGCcablingSvc.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
 */
 
 /***************************************************************************
@@ -34,7 +34,7 @@ class TGCcablingSvc : public ITGCcablingSvc
 {
 public:
   TGCcablingSvc (const std::string& name, ISvcLocator* svc);
-  virtual ~TGCcablingSvc (void);
+  virtual ~TGCcablingSvc()=default;
 
   static const InterfaceID& interfaceID() 
   {
diff --git a/MuonSpectrometer/MuonCablings/TGCcabling/src/TGCcablingSvc.cxx b/MuonSpectrometer/MuonCablings/TGCcabling/src/TGCcablingSvc.cxx
index a2279c279125a1258083bd8f2b154db21fddf293..3f3c10fec9d455030f8257a80e4f2e819bdfa303 100755
--- a/MuonSpectrometer/MuonCablings/TGCcabling/src/TGCcablingSvc.cxx
+++ b/MuonSpectrometer/MuonCablings/TGCcabling/src/TGCcablingSvc.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
 */
 
 /***************************************************************************
@@ -33,9 +33,6 @@ TGCcablingSvc::TGCcablingSvc (const std::string& name, ISvcLocator* svc)
   declareProperty("databasePPToSL",  m_databasePPToSL="PP2SL.db");
   declareProperty("databaseSLBToROD",m_databaseSLBToROD="SLB2ROD.db");
 }
-  
-TGCcablingSvc::~TGCcablingSvc (void)
-{}
 
 StatusCode  TGCcablingSvc::queryInterface(const InterfaceID& riid,void** ppvIF)
 {
diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtCsmCnv_p1.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtCsmCnv_p1.cxx
index 9696c744307951ca664db99066f372711d7b5b8c..52139bb24cbca925d57da56a46e0c435f92d4a6c 100644
--- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtCsmCnv_p1.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtCsmCnv_p1.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 "MuonRDO/MdtCsm.h"
@@ -15,6 +15,10 @@ MdtCsmCnv_p1::persToTrans(const MdtCsm_p1* persColl, MdtCsm* transColl, MsgStrea
                        persColl->m_SubDetId,
                        persColl->m_MrodId,
                        persColl->m_CsmId);
+  // The assignment above will leave *transColl as a view container.
+  // But it should own it's elements, so convert it back
+  // to an owning container.
+  transColl->clear (SG::OWN_ELEMENTS);
   
   // Invoke vector converter from the base template
   MdtCsm_Cnvp1_base_t::persToTrans( persColl, transColl, log );
diff --git a/MuonSpectrometer/MuonConfig/python/MuonReconstructionConfig.py b/MuonSpectrometer/MuonConfig/python/MuonReconstructionConfig.py
index 25fb367cb01d650fe3bab098588c9aa5af68ccdd..421518f5059fcbed3de60f0c4da432e730cf05e9 100644
--- a/MuonSpectrometer/MuonConfig/python/MuonReconstructionConfig.py
+++ b/MuonSpectrometer/MuonConfig/python/MuonReconstructionConfig.py
@@ -55,7 +55,7 @@ if __name__=="__main__":
     muon_edm_helper_svc = Muon__MuonEDMHelperSvc("MuonEDMHelperSvc")
     cfg.addService( muon_edm_helper_svc )
 
-    itemsToRecord = ["Trk::SegmentCollection#MuonSegments", "Trk::SegmentCollection#NCB_MuonSegments"]
+    itemsToRecord = ["Trk::SegmentCollection#TrackMuonSegments", "Trk::SegmentCollection#NCB_TrackMuonSegments"]
     itemsToRecord += ["TrackCollection#MuonSpectrometerTracks"] 
     SetupMuonStandaloneOutput(cfg, ConfigFlags, itemsToRecord)
     
diff --git a/MuonSpectrometer/MuonConfig/python/MuonSegmentFindingConfig.py b/MuonSpectrometer/MuonConfig/python/MuonSegmentFindingConfig.py
index ec455944705b5b92cac3f57571036f795402b326..ea0c9e213fc32bb377d9499ea4c7d934cafd197e 100644
--- a/MuonSpectrometer/MuonConfig/python/MuonSegmentFindingConfig.py
+++ b/MuonSpectrometer/MuonConfig/python/MuonSegmentFindingConfig.py
@@ -610,7 +610,7 @@ def MooSegmentFinderAlgCfg(flags, name = "MuonSegmentMaker",  **kwargs):
     # FIXME - this really shouldn't be set here! 
     kwargs.setdefault('TgcPrepDataContainer', 'TGC_MeasurementsAllBCs' if not flags.Muon.useTGCPriorNextBC and not flags.Muon.useTGCPriorNextBC else 'TGC_Measurements')
         
-    kwargs.setdefault('MuonSegmentOutputLocation', "ThirdChainSegments" if flags.Muon.segmentOrigin=="TruthTracking" else "MuonSegments")
+    kwargs.setdefault('MuonSegmentOutputLocation', "ThirdChainSegments" if flags.Muon.segmentOrigin=="TruthTracking" else "TrackMuonSegments")
 
     moo_segment_finder_alg = MooSegmentFinderAlg( name=name, **kwargs )
     moo_segment_finder_alg.Cardinality=10
@@ -645,7 +645,7 @@ def MooSegmentFinderAlg_NCBCfg(flags, name = "MuonSegmentMaker_NCB", **kwargs):
 
     # Now set other NCB properties
     kwargs.setdefault('MuonPatternCombinationLocation', "NCB_MuonHoughPatternCombinations" )
-    kwargs.setdefault('MuonSegmentOutputLocation', "NCB_MuonSegments" )
+    kwargs.setdefault('MuonSegmentOutputLocation', "NCB_TrackMuonSegments" )
     kwargs.setdefault('UseCSC', flags.Muon.doCSCs)
     kwargs.setdefault('UseMDT', False)
     kwargs.setdefault('UseRPC', False)
@@ -679,7 +679,7 @@ def MuonSegmentFindingCfg(flags, cardinality=1):
     result.merge(acc)
     return result
 
-if __name__=="__main__":                        
+if __name__=="__main__":
     # To run this, do e.g. 
     # python -m MuonConfig.MuonSegmentFindingConfig --run --threads=1
     from MuonConfig.MuonConfigUtils import SetupMuonStandaloneArguments, SetupMuonStandaloneConfigFlags, SetupMuonStandaloneOutput, SetupMuonStandaloneCA
@@ -707,13 +707,13 @@ if __name__=="__main__":
     pps = ProxyProviderSvc()
     ars=AddressRemappingSvc()
     pps.ProviderNames += [ 'AddressRemappingSvc' ]
-    ars.TypeKeyRenameMaps += [ '%s#%s->%s' % ("Trk::SegmentCollection", "MuonSegments", "MuonSegments_old") ]
-    ars.TypeKeyRenameMaps += [ '%s#%s->%s' % ("Trk::SegmentCollection", "MuonSegments_NCB", "MuonSegments_NCB_old") ]
-    
+    ars.TypeKeyRenameMaps += [ '%s#%s->%s' % ("Trk::SegmentCollection", "TrackMuonSegments", "TrackMuonSegments_old") ]
+    ars.TypeKeyRenameMaps += [ '%s#%s->%s' % ("Trk::SegmentCollection", "NCB_TrackMuonSegments", "NCB_TrackMuonSegments_old") ]
+
     cfg.addService(pps)
     cfg.addService(ars)
-    
-    itemsToRecord = ["Trk::SegmentCollection#MuonSegments", "Trk::SegmentCollection#NCB_MuonSegments"]
+
+    itemsToRecord = ["Trk::SegmentCollection#TrackMuonSegments", "Trk::SegmentCollection#NCB_TrackMuonSegments"]
     SetupMuonStandaloneOutput(cfg, ConfigFlags, itemsToRecord)
 
     # cfg.getService("StoreGateSvc").Dump = True
@@ -727,4 +727,3 @@ if __name__=="__main__":
         if not sc.isSuccess():
             import sys
             sys.exit("Execution failed")
-    
diff --git a/MuonSpectrometer/MuonConfig/python/MuonSegmentNameFixConfig.py b/MuonSpectrometer/MuonConfig/python/MuonSegmentNameFixConfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..c23d67428bcc3c7c9a4da17a4dd9b5e248325325
--- /dev/null
+++ b/MuonSpectrometer/MuonConfig/python/MuonSegmentNameFixConfig.py
@@ -0,0 +1,11 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+# This allows us to convert Run 2 ESD Trk::SegmentCollection "MuonSegments" to
+# Run 3 "TrackMuonSegments"
+def MuonSegmentNameFixCfg(flags):
+    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
+    cfg = ComponentAccumulator()
+    if 'Trk::SegmentCollection#MuonSegments' in flags.Input.TypedCollections:
+        from SGComps.AddressRemappingConfig import InputRenameCfg
+        cfg.merge(InputRenameCfg("Trk::SegmentCollection", "MuonSegments", "TrackMuonSegments"))
+    return cfg
diff --git a/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py b/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py
index c66983c0fca2ac6b9825996dbd71df01f2c775bc..3036fb462f03a61c0863ff80007afa59ca713421 100644
--- a/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py
+++ b/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py
@@ -527,7 +527,7 @@ def MuonTrackBuildingCfg(flags, name = "MuPatTrackBuilder"):
     track_steering = acc.getPrimary()
     result.merge(acc)
     
-    track_builder = MuPatTrackBuilder(name=name, TrackSteering = track_steering, MuonSegmentCollection="MuonSegments", SpectrometerTrackOutputLocation="MuonSpectrometerTracks" )
+    track_builder = MuPatTrackBuilder(name=name, TrackSteering = track_steering, MuonSegmentCollection="TrackMuonSegments", SpectrometerTrackOutputLocation="MuonSpectrometerTracks" )
 
     result.addEventAlgo( track_builder, primary=True )
     return result
diff --git a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h
index 78c837f4c1ddbcf5109caf4824e301e491239883..952a91b8bfed5000611884f6dcd6a907c706e868 100755
--- a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h
+++ b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.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 MUONGEOMODEL_MUONDETECTORCONDALG_H
@@ -26,8 +26,6 @@ public:
 
   virtual StatusCode initialize() override final;
   virtual StatusCode execute() override final;
-  virtual StatusCode finalize() override final;
-
 
 private:
   
diff --git a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx
index e250f0ccb68931ff04b0665fb79a8d648126678d..e49a2003963b41d5280171b497d3b34ddbabcd15 100755
--- a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx
+++ b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx
@@ -152,10 +152,3 @@ StatusCode MuonDetectorCondAlg::execute()
 
   return StatusCode::SUCCESS;
 }
-
-
-StatusCode MuonDetectorCondAlg::finalize()
-{
-  ATH_MSG_DEBUG( "finalize " << name() );
-  return StatusCode::SUCCESS;
- }
diff --git a/MuonSpectrometer/MuonGeoModelTest/MuonGeoModelTest/MuonGMTestOnPrd.h b/MuonSpectrometer/MuonGeoModelTest/MuonGeoModelTest/MuonGMTestOnPrd.h
index e01d1da1844cca403464d4796630550a5025a51b..31cf424fa8d78216e62a6ceb2331ff75710ede54 100644
--- a/MuonSpectrometer/MuonGeoModelTest/MuonGeoModelTest/MuonGMTestOnPrd.h
+++ b/MuonSpectrometer/MuonGeoModelTest/MuonGeoModelTest/MuonGMTestOnPrd.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
 */
 
 /***************************************************************************
@@ -25,24 +25,18 @@
 #include "Identifier/Identifier.h"
 #include "Identifier/IdentifierHash.h"
 
-
 class StoreGateSvc;
 class ActiveStoreSvc;
 
-
-//class MuonReadoutElement;
-
-
 class MuonGMTestOnPrd: public AthAlgorithm
 {
 public:
     
     MuonGMTestOnPrd(const std::string& name, ISvcLocator* pSvcLocator);
-    ~MuonGMTestOnPrd();
+    ~MuonGMTestOnPrd()=default;
     
     StatusCode	initialize();
     StatusCode 	execute();
-    StatusCode 	finalize();
 
 private:
 
diff --git a/MuonSpectrometer/MuonGeoModelTest/src/MuonGMTestOnPrd.cxx b/MuonSpectrometer/MuonGeoModelTest/src/MuonGMTestOnPrd.cxx
index 305cd04740737c5fffe5af52bd15b7519070a9a1..5edf1c4e2fbae18cf92642264b61cdd29da43c6e 100644
--- a/MuonSpectrometer/MuonGeoModelTest/src/MuonGMTestOnPrd.cxx
+++ b/MuonSpectrometer/MuonGeoModelTest/src/MuonGMTestOnPrd.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
 */
 
 /***************************************************************************
@@ -7,9 +7,6 @@
  -----------------------------------------
  ***************************************************************************/
 
-//<doc><file>	$Id: MuonGMTestOnPrd.cxx,v 1.8 2009-03-28 10:59:01 stefspa Exp $
-//<version>	$Name: not supported by cvs2svn $
-
 #include "GaudiKernel/MsgStream.h"
 #include "StoreGate/StoreGateSvc.h"
 
@@ -20,12 +17,6 @@
 #include "MuonReadoutGeometry/RpcReadoutElement.h"
 #include "MuonReadoutGeometry/CscReadoutElement.h"
 
-// #include "MuonPrepRawData/MdtPrepDataContainer.h"
-// #include "MuonPrepRawData/MdtPrepDataCollection.h"
-// #include "MuonPrepRawData/MdtPrepData.h"
-
-// #include "Identifier/Identifier.h"
-// #include "Identifier/IdentifierHash.h"
 #include "TrkDistortedSurfaces/SaggedLineSurface.h"
 
 MuonGMTestOnPrd::MuonGMTestOnPrd(const std::string& name, ISvcLocator* pSvcLocator)
@@ -48,9 +39,6 @@ MuonGMTestOnPrd::MuonGMTestOnPrd(const std::string& name, ISvcLocator* pSvcLocat
     declareProperty("doCheckMisal", m_check_misal );        
 }
 
-MuonGMTestOnPrd::~MuonGMTestOnPrd()
-{ }
-
 StatusCode
 MuonGMTestOnPrd::initialize()
 {
@@ -256,32 +244,9 @@ MuonGMTestOnPrd::execute()
         }
     }
 
-//     // Rpc
-//     Muon::RpcPrepDataContainer * rpcContainer;
-
-//     // Tgc 
-//     TgcPrepDataContainer * tgcContainer;
-//     if ( StatusCode::SUCCESS != p_EventStore->retrieve(tgcContainer, key) )
-//     {
-//         log<<MSG::ERROR<<"Cannot retrieve TGC PRD Container "<<endmsg;
-//         return StatusCode::FAILURE;
-//     }
-//     else
-//         log<<MSG::INFO<<"Retrieved TGC PRD Container with size = " << tgcContainer->size()<< endmsg;
-
-//     // Csc
-//     CscPrepDataContainer * cscContainer;
-    
     return StatusCode::SUCCESS;
 }
 
-StatusCode
-MuonGMTestOnPrd::finalize()
-{
-  ATH_MSG_DEBUG( "Finalizing"  );
-  return StatusCode::SUCCESS;
-}
-
 void MuonGMTestOnPrd::processMdtCollection(const Muon::MdtPrepDataCollection* mdtColl,
                                            Identifier& collid,
                                            IdentifierHash& collidh) const 
diff --git a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperSvc.h b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperSvc.h
index bd60bc1dd08ecf64fac1af39059003934da604e0..1fbecb12a5d93ed70a3a5f866f5eb7c052b72914 100644
--- a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperSvc.h
+++ b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperSvc.h
@@ -31,9 +31,6 @@ namespace Muon {
     /** @brief AlgTool initilize */
     virtual StatusCode initialize() override;
     
-    /** @brief AlgTool finalize */
-    virtual StatusCode finalize() override;
-    
     /** @brief print all fields to string */
     virtual std::string toString( const Identifier& id ) const override;
 
diff --git a/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperSvc.cxx b/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperSvc.cxx
index f114a40d93ccf7306f0d286cee2d9415c15db5ed..d111243a615fcdb3ea79f3aa8b7ba8bf53f01454 100644
--- a/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperSvc.cxx
+++ b/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperSvc.cxx
@@ -139,11 +139,6 @@ namespace Muon {
     return StatusCode::SUCCESS;
   }
 
-  StatusCode MuonIdHelperSvc::finalize() {
-    if( AthService::finalize().isFailure() ) return StatusCode::FAILURE;
-    return StatusCode::SUCCESS;
-  }
-
   int MuonIdHelperSvc::gasGap( const Identifier& id ) const {
     if( isRpc(id) ) {
       return m_rpcIdHelper->gasGap(id);
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandalone.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandalone.py
index bed770e06a53e2f156b0ee2129f4ca02d511e6b4..45f35c51658f98d35d90090f42c206f54c6329fb 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandalone.py
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandalone.py
@@ -66,7 +66,7 @@ def MooSegmentFinderAlg( name="MuonSegmentMaker",**kwargs ):
     kwargs.setdefault("SegmentFinder", getPublicToolClone("MuonSegmentFinder","MooSegmentFinder",
                                                           DoSummary=muonStandaloneFlags.printSummary()))
     kwargs.setdefault("MuonClusterSegmentFinderTool",getPublicTool("MuonClusterSegmentFinder"))
-    kwargs.setdefault("MuonSegmentOutputLocation", "MuonSegments")
+    kwargs.setdefault("MuonSegmentOutputLocation", "TrackMuonSegments")
     kwargs.setdefault("UseCSC", muonRecFlags.doCSCs())
     kwargs.setdefault("UseMDT", muonRecFlags.doMDTs())
     kwargs.setdefault("UseRPC", muonRecFlags.doRPCs())
@@ -94,8 +94,7 @@ def MooSegmentFinderNCBAlg( name="MuonSegmentMaker_NCB",**kwargs ):
                                                                                                  segmentTool = getPublicTool("CscSegmentUtilTool_NCB")) if MuonGeometryFlags.hasCSC() else ""),
                                                          DoMdtSegments=False,DoSegmentCombinations=False,DoSegmentCombinationCleaning=False))
     kwargs.setdefault("MuonPatternCombinationLocation", "NCB_MuonHoughPatternCombinations")
-    kwargs.setdefault("MuonSegmentOutputLocation", "NCB_MuonSegments")
-    kwargs.setdefault("MuonSegmentOutputLocation", "NCB_MuonSegments")
+    kwargs.setdefault("MuonSegmentOutputLocation", "NCB_TrackMuonSegments")
     kwargs.setdefault("UseCSC", muonRecFlags.doCSCs())
     kwargs.setdefault("UseMDT", False)
     kwargs.setdefault("UseRPC", False)
@@ -146,7 +145,7 @@ class MuonStandalone(ConfiguredMuonRec):
         super(MuonStandalone,self).configure(keys)
         if not self.isEnabled(): return
 
-        SegmentLocation = "MuonSegments"
+        SegmentLocation = "TrackMuonSegments"
         if muonStandaloneFlags.segmentOrigin == 'TruthTracking':
             SegmentLocation = "ThirdChainSegments"
 
@@ -189,7 +188,7 @@ class MuonStandalone(ConfiguredMuonRec):
             self.addAlg(MooSegmentFinderNCBAlg("MuonSegmentMaker_NCB"))
 
             if (not cfgKeyStore.isInInput ('xAOD::MuonSegmentContainer', 'MuonSegments_NCB')):
-                self.addAlg( CfgMgr.xAODMaker__MuonSegmentCnvAlg("MuonSegmentCnvAlg_NCB",SegmentContainerName="NCB_MuonSegments",xAODContainerName="NCB_MuonSegments") )
+                self.addAlg( CfgMgr.xAODMaker__MuonSegmentCnvAlg("MuonSegmentCnvAlg_NCB",SegmentContainerName="NCB_TrackMuonSegments",xAODContainerName="NCB_MuonSegments") )
 
         if (not cfgKeyStore.isInInput ('xAOD::MuonSegmentContainer', 'MuonSegments')):
             self.addAlg( CfgMgr.xAODMaker__MuonSegmentCnvAlg("MuonSegmentCnvAlg") )
@@ -200,13 +199,9 @@ class MuonStandalone(ConfiguredMuonRec):
         #
         # add the algorithm (which uses the MuonTrackSteering)
         # 
-        TrackBuilder = CfgMgr.MuPatTrackBuilder("MuPatTrackBuilder", TrackSteering = getPublicTool("MuonTrackSteering") )
+        TrackBuilder = CfgMgr.MuPatTrackBuilder("MuPatTrackBuilder", TrackSteering=getPublicTool("MuonTrackSteering"), SpectrometerTrackOutputLocation="MuonSpectrometerTracks", MuonSegmentCollection="TrackMuonSegments")
         self.addAlg( TrackBuilder )
-        
-        self.registerOutputKey("MuonSpectrometerTracks",   self.MuPatTrackBuilder, "SpectrometerTrackOutputLocation")
-        self.registerInputKey ("MuonSegments", self.MuPatTrackBuilder, "MuonSegmentCollection"   )
 
-        
         if muonStandaloneFlags.createTrackParticles():
             xAODTrackParticleCnvAlg = MuonStandaloneTrackParticleCnvAlg("MuonStandaloneTrackParticleCnvAlg")
             self.addAlg( xAODTrackParticleCnvAlg )
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecOutputItemList_jobOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecOutputItemList_jobOptions.py
index b9b149554ae0de20c6df3a7e7762816a7ad3dccb..20be4a64712d3c6efab76c7028bf6e36d0e59d55 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecOutputItemList_jobOptions.py
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecOutputItemList_jobOptions.py
@@ -82,8 +82,8 @@ if DetFlags.detdescr.Muon_on() and rec.doWriteESD():
    MuonESDList+=["RpcSectorLogicContainer#RPC_SECTORLOGIC"]
 
    # Segments
-   MuonESDList+=["Trk::SegmentCollection#MuonSegments"]
-   MuonESDList+=["Trk::SegmentCollection#NCB_MuonSegments"]
+   MuonESDList+=["Trk::SegmentCollection#TrackMuonSegments"]
+   MuonESDList+=["Trk::SegmentCollection#NCB_TrackMuonSegments"]
 
    # Tracks
    MuonESDList+=["TrackCollection#MuonSpectrometerTracks"] 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py
index 3ff7e1613a5e464a3c990bb5966613a540dca350..965de10bed2c6cf382c8416d243732183a0af1f0 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py
@@ -193,9 +193,6 @@ elif muonRecFlags.doCalib():
     from MuonRecExample import MuonAlignConfig
     from MuonCnvExample import setupMuonCalib
     setupMuonCalib()
-else:
-    logMuon.warning("Loading %s but not setting up any MuonCalibration or Ntuple" % __name__ )
-
 
 #--------------------------------------------------------------------------
 # Evaluate tracking performance
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.h
index 9d974f2d0fcb7aac2eef8700c6dd00c9926d1d37..8b9dd8c52d366ec2fe5db6555ec32c52347bd353 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MuonSegmentFinderAlg.h
@@ -106,11 +106,11 @@ class MuonSegmentFinderAlg : public AthReentrantAlgorithm {
         "Csc4dSegmentMaker/Csc4dSegmentMaker",
     };
 
-    // the following Trk::SegmentCollection MuonSegments are sttandard MuonSegments, the MuGirl segments are stored in MuonCreatorAlg.h
+    // the following Trk::SegmentCollection MuonSegments are standard MuonSegments, the MuGirl segments are stored in MuonCreatorAlg.h
     SG::WriteHandleKey<Trk::SegmentCollection> m_segmentCollectionKey{
         this,
         "SegmentCollectionName",
-        "MuonSegments",
+        "TrackMuonSegments",
         "Muon Segments",
     };
     SG::ReadHandleKey<Muon::CscPrepDataContainer> m_cscPrdsKey{
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/CMakeLists.txt
index 4dc59bec52a2862bd5b72822e44ab5fd365fa892..e985bf243958d3130cf854322d2dd43c43730d63 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/CMakeLists.txt
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/CMakeLists.txt
@@ -1,19 +1,15 @@
-################################################################################
-# Package: MdtSegmentT0Fitter
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( MdtSegmentT0Fitter )
 
 # External dependencies:
-find_package( ROOT COMPONENTS Minuit Core Tree MathCore Hist RIO pthread MathMore Minuit2 Matrix Physics HistPainter Rint )
+find_package( ROOT COMPONENTS Core MathCore Minuit2 )
 
 # Component(s) in the package:
 atlas_add_component( MdtSegmentT0Fitter
-                     src/*.cxx
-                     src/components/*.cxx
-                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel MdtCalibSvcLib TrkDriftCircleMath MdtCalibData MuonCalibToolsLib MuonReadoutGeometry MuonIdHelpersLib MuonPrepRawData MuonRIO_OnTrack MuonSegmentMakerInterfacesLib )
-
-# Install files from the package:
-atlas_install_headers( MdtSegmentT0Fitter )
+   MdtSegmentT0Fitter/*.h src/*.cxx src/components/*.cxx
+   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel MdtCalibSvcLib
+   TrkDriftCircleMath MdtCalibData MuonReadoutGeometry MuonPrepRawData
+   MuonRIO_OnTrack MuonSegmentMakerInterfacesLib )
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/src/MdtSegmentT0Fitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/src/MdtSegmentT0Fitter.cxx
index 5c9ab78eaacfed57406362fdb1933ddc59b855a5..e5a9311aec54c486c9c34a6d8b1c591d3c0f4cf6 100755
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/src/MdtSegmentT0Fitter.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/src/MdtSegmentT0Fitter.cxx
@@ -57,15 +57,15 @@ namespace TrkDriftCircleMath {
       FunctionToMinimize(const int used) : m_data(),m_used(used),m_t0Error() {}
       ~FunctionToMinimize() {m_data.clear();}
       double DoEval(const double* xx) const {
-        double ang = xx[0];  
+        double ang = xx[0];
         double b = xx[1];
         double t0 = xx[2];
-        
+
         double cosin = std::cos(ang);
         double sinus = std::sin(ang);
-        
+
         double fval = 0.;
-        // Add t0 constraint 
+        // Add t0 constraint
         if (m_t0Error == WEAK_TOPO_T0ERROR ) {
          fval += xx[2]*xx[2]/(1.0 *m_t0Error*m_t0Error);
         }
@@ -79,7 +79,7 @@ namespace TrkDriftCircleMath {
           double uppercut = m_data[i].rt->tUpper();
           double lowercut = m_data[i].rt->tLower();
           // Penalty for t<lowercut and t >uppercut
-          if (t> uppercut ) { // too large 
+          if (t> uppercut ) { // too large
             fval += (t-uppercut)* (t-uppercut)*0.1;
           } else if (t < 0 ) {// too small
             fval += (t-lowercut)*(t-lowercut)*0.1;
@@ -112,7 +112,7 @@ namespace TrkDriftCircleMath {
 
   MdtSegmentT0Fitter::MdtSegmentT0Fitter(const std::string& ty,const std::string& na,const IInterface* pa)
   : AthAlgTool(ty,na,pa),
-    DCSLFitter(), 
+    DCSLFitter(),
     m_ntotalCalls(0),
     m_npassedNHits(0),
     m_npassedSelectionConsistency(0),
@@ -121,14 +121,14 @@ namespace TrkDriftCircleMath {
     m_npassedMinuitFit(0) {
     declareInterface <IDCSLFitProvider> (this);
   }
-  
+
   StatusCode MdtSegmentT0Fitter::initialize() {
     ATH_CHECK(m_calibrationDbTool.retrieve());
     return StatusCode::SUCCESS;
   }
-  
+
   StatusCode MdtSegmentT0Fitter::finalize() {
-    
+
     double scaleFactor = m_ntotalCalls != 0 ? 1./(double)m_ntotalCalls : 1.;
 
     ATH_MSG_INFO( "Summarizing fitter statistics " << "\n"
@@ -140,15 +140,15 @@ namespace TrkDriftCircleMath {
                   << " Passed Fit       " << std::setw(10) << m_npassedMinuitFit << "   " << scaleFactor*m_npassedMinuitFit  );
     return StatusCode::SUCCESS;
   }
-  
-  
+
+
   /***********************************************************************************/
   /// RT function from Craig Blocker
   /// ok for now, possibly replace with actual RT function used to calibrate run
-  
+
   constexpr double T2R_A[] = {1.184169e-1, 3.32382e-2, 4.179808e-4, -5.012896e-6, 2.61497e-8, -7.800677e-11, 1.407393e-13, -1.516193e-16, 8.967997e-20, -2.238627e-23};
   constexpr double RCORR_A[] = {234.3413, -5.803375, 5.061677e-2, -1.994959e-4, 4.017433e-7, -3.975037e-10, 1.522393e-13};
-  
+
   double rcorr(const double tin) {
     double rc;
     if(tin < 16.) {
@@ -162,25 +162,25 @@ namespace TrkDriftCircleMath {
       }
     }
     rc = rc*1e-3;
-    
+
     return rc;
   }
-  
+
   double t2r(const double tin) {
     if(tin < 0.) return 0.;
     if(tin > MAX_DRIFT) return 20.;
-    
+
     double tpow = 1.;
     double rc = 0.;
     for(int j = 0; j < 10; j++) {
       rc += T2R_A[j]*tpow;
       tpow *= tin;
     }
-    
+
     rc -= rcorr(tin);
     return rc;
   }
-  
+
   /// derivatives of RT function, use to get errors
   double rcorrprime(const double tin) {
     double rc;
@@ -195,26 +195,26 @@ namespace TrkDriftCircleMath {
       }
     }
     rc = rc*1e-3;
-    
+
     return rc;
   }
-  
+
   double t2rprime(const double tin) {
     if(tin < 0.) return 0.;
     if(tin > MAX_DRIFT) return 20.;
-    
+
     double tpow = 1.;
     double rc = 0.;
     for(int j = 1; j < 10; j++) {
       rc += j*T2R_A[j]*tpow;
       tpow *= tin;
     }
-    
+
     rc -= rcorrprime(tin);
     return rc;
   }
-  
-  
+
+
   /// use a binary search to get rt-inverse from rt
   /// assumes the function is monotonic, obviously not true for these polynomial parametrizations for all t
   double r2t(const double r) {
@@ -225,7 +225,7 @@ namespace TrkDriftCircleMath {
     } else if(r>t2r(tb)) {
       return R2TSPURIOUS;
     }
-    
+
     int itr = 0;
     while (ta <= tb) {
       double tm  = (ta + tb) / 2;  // compute mid point.
@@ -239,13 +239,13 @@ namespace TrkDriftCircleMath {
       else if (r < rtm ) {
         tb = tm; // repeat search in bottom half.
       }
-      
+
       itr++;
       if(itr>50) return -1;
     }
     return -1;    // failed to find key
   }
-  
+
   double r2t_ext(std::vector<const MuonCalib::IRtRelation*> *rtpointers, double r, int i) {
     const MuonCalib::IRtRelation* rtrel = rtpointers->at(i);
     double ta = rtrel->tLower();
@@ -255,7 +255,7 @@ namespace TrkDriftCircleMath {
     } else if(r>rtrel->radius(tb)) {
       return R2TSPURIOUS;
     }
-    
+
     int itr = 0;
     while (ta <= tb) {
       double tm  = (ta + tb) / 2;  // compute mid point.
@@ -269,7 +269,7 @@ namespace TrkDriftCircleMath {
       else if (r < rtm ) {
         tb = tm; // repeat search in bottom half.
       }
-      
+
       itr++;
       if(itr>50) return -1;
     }
@@ -285,18 +285,12 @@ namespace TrkDriftCircleMath {
 
     if(m_trace) ATH_MSG_DEBUG("New seg: ");
 
-    ROOT::Math::Minimizer* minimum = new ROOT::Minuit2::Minuit2Minimizer("algoName");
-    minimum->SetMaxFunctionCalls(1000000);
-    minimum->SetTolerance(0.001);
-    minimum->SetPrintLevel(-1);
-    if(msgLvl(MSG::VERBOSE)) minimum->SetPrintLevel(1);
- 
     const DCOnTrackVec& dcs_keep = dcs;
 
     unsigned int N = dcs_keep.size();
 
     result.setT0Shift(-99999,-99999);
-    
+
     if(N<2) {
       return false;
     }
@@ -304,7 +298,7 @@ namespace TrkDriftCircleMath {
     if( selection.size() != N ) {
       ATH_MSG_ERROR("MdtSegmentT0Fitter.cxx:fit with t0 <bad HitSelection>");
       return false;
-    }  
+    }
     ++m_npassedSelectionConsistency;
     int used=0;
     for(unsigned int i=0;i<N;++i){
@@ -320,12 +314,12 @@ namespace TrkDriftCircleMath {
 
       //
       //     Copy driftcircles and reset the drift radii as they might have been overwritten
-      //     after a succesfull t0 fit 
-      // 
+      //     after a succesfull t0 fit
+      //
 
       DCOnTrackVec::const_iterator it = dcs.begin();
       DCOnTrackVec::const_iterator it_end = dcs.end();
-      
+
       DCOnTrackVec dcs_new;
       dcs_new.reserve(dcs.size());
       double chi2p = 0.;
@@ -346,7 +340,7 @@ namespace TrkDriftCircleMath {
         }
       }
       if(m_trace&&chi2p>0) ATH_MSG_DEBUG("NO Minuit Fit TOO few hits Chi2 penalty " << chi2p);
-      bool oldrefit = DCSLFitter::fit( result, line, dcs_new, selection ); 
+      bool oldrefit = DCSLFitter::fit( result, line, dcs_new, selection );
       chi2p += result.chi2();
 // add chi2 penalty for too large or too small driftTimes  t < 0 or t> t upper
       result.set(chi2p, result.ndof(),  result.dtheta(),  result.dy0());
@@ -356,15 +350,15 @@ namespace TrkDriftCircleMath {
       return oldrefit;
     } else {
       if(m_trace) ATH_MSG_DEBUG("FITTING FOR T0 N "<<N<<" used " << used);
-    } 
+    }
 
     ++m_npassedMinHits;
-    
+
     if (m_trace) {
       ATH_MSG_DEBUG(" in  MdtSegmentT0Fitter::fit with N dcs "<< N << " hit selection size " <<  selection.size());
       ATH_MSG_DEBUG("in fit "<<result.hasT0Shift()<< " " <<result.t0Shift());
     }
-    
+
     double Zc(0);
     double Yc(0);
     double S(0);
@@ -372,7 +366,7 @@ namespace TrkDriftCircleMath {
     double Sy(0);
     std::vector<double> y(N);
     std::vector<double> z(N);
-    std::vector<double> w(N); 
+    std::vector<double> w(N);
     std::vector<double> r(N);
     std::vector<double> dr(N);
     std::vector<double> t(N);
@@ -393,7 +387,7 @@ namespace TrkDriftCircleMath {
         y[ii] = it->y();
         z[ii] = it->x();
         r[ii] = std::abs(roto->driftRadius());
-        dr[ii] = it->dr(); 
+        dr[ii] = it->dr();
         const Muon::MdtPrepData *peerd;
         peerd = dynamic_cast<const Muon::MdtPrepData*>(roto->prepRawData());
         if(!peerd) {
@@ -405,7 +399,7 @@ namespace TrkDriftCircleMath {
         rtpointers[ii] = rtInfo->rt();
         t[ii] = roto->driftTime();
 
-	double newerror = m_scaleErrors ? it->drPrecise() : it->dr();        
+	double newerror = m_scaleErrors ? it->drPrecise() : it->dr();
 
         if( newerror > 0.) w[ii] = 1./(newerror);
         else w[ii] = 0.;
@@ -416,7 +410,7 @@ namespace TrkDriftCircleMath {
         }
 
         if(m_trace) ATH_MSG_DEBUG("DC:  (" << y[ii] << "," << z[ii] << ") R = " << r[ii] << " W " << w[ii] <<" t " <<t[ii]<< " id: "<<it->id()<<" sel " << selection[ii]);
-        
+
         if( selection[ii] == 0 ){
           S+=w[ii];
           Sz+= w[ii]*z[ii];
@@ -430,15 +424,15 @@ namespace TrkDriftCircleMath {
     const double inv_S = 1. / S;
     Zc = Sz*inv_S;
     Yc = Sy*inv_S;
-    
+
     if(m_trace) ATH_MSG_DEBUG("Yc " << Yc << " Zc " << Zc);
-    
+
     /// go to coordinates centered at the average of the hits
     for(unsigned int i=0;i<N;++i) {
       y[i]  -= Yc;
       z[i]  -= Zc;
     }
-    
+
     int selcount(0);
     DCOnTrackVec::const_iterator it = dcs_keep.begin();
     DCOnTrackVec::const_iterator it_end = dcs_keep.end();
@@ -448,13 +442,13 @@ namespace TrkDriftCircleMath {
     // tlower_i < ti - t0 < tupper_i
     double min_tlower=1e10;
     double max_tupper=-1e10;
-    
+
     double t0seed=0; // the average t0 of the hit
     double st0 = 0; // the std deviation of the hit t0s
     double min_t0 = 1e10; // the smallest t0 seen
     double tee0, tl, th;
-    
-    
+
+
     for(int ii=0 ;it!=it_end; ++it, ++ii ){
       if( selection[ii] == 0 ) {
         double r2tval = r2t_ext(&rtpointers,  r[ii], ii) ;
@@ -481,7 +475,7 @@ namespace TrkDriftCircleMath {
         minFunct.addCoords(z[ii], t[ii], y[ii], w[ii], r[ii], rtpointers[ii]);
 
         selcount++;
-      } 
+      }
     }
     t0seed /= selcount;
     st0 = st0/selcount - t0seed*t0seed;
@@ -493,7 +487,7 @@ namespace TrkDriftCircleMath {
     double theta = line.phi();
     double cosin = std::cos(theta);
     double sinus = std::sin(theta);
-    
+
     if ( sinus < 0.0 ) {
       sinus = -sinus;
       cosin = -cosin;
@@ -501,17 +495,17 @@ namespace TrkDriftCircleMath {
       cosin = -cosin;
     }
     if(m_trace) ATH_MSG_DEBUG("before fit theta "<<theta<<" sinus "<<sinus<< " cosin "<< cosin);
-    
+
     double d = line.y0() + Zc*sinus-Yc*cosin;
-    
+
     if(m_trace) {
       ATH_MSG_DEBUG(" line x y "<<line.position().x()<<" "<<line.position().y());
       ATH_MSG_DEBUG(" Zc Yc "<< Zc <<" "<<Yc);
       ATH_MSG_DEBUG(" line x0 y0 "<<line.x0()<<" "<<line.y0());
       ATH_MSG_DEBUG(" hit shift " << -Zc*sinus+Yc*cosin);
-    } 
+    }
 
-// Calculate signed radii 
+// Calculate signed radii
 
     int nml1p = 0;
     int nml2p = 0;
@@ -539,12 +533,12 @@ namespace TrkDriftCircleMath {
       if(m_trace) ATH_MSG_DEBUG("Combination rejected for positive radii ML1 " <<  nml1p << " ML2 " <<  nml2p << " negative radii ML1 " << nml1n << " ML " << nml2n << " used hits " << used << " t0 Error " << t0Error);
       it = dcs.begin();
       it_end = dcs.end();
-      double chi2p = 0.; 
+      double chi2p = 0.;
       DCOnTrackVec dcs_new;
       dcs_new.reserve(dcs.size());
       for(int i=0; it!=it_end; ++it, ++i ){
 	const DriftCircle* ds  = & dcs[i];
-        if(std::abs(ds->r()-ds->rot()->driftRadius())>m_dRTol && m_trace) ATH_MSG_DEBUG("Different radii on dc " << ds->r() << " rot " << ds->rot()->driftRadius());  
+        if(std::abs(ds->r()-ds->rot()->driftRadius())>m_dRTol && m_trace) ATH_MSG_DEBUG("Different radii on dc " << ds->r() << " rot " << ds->rot()->driftRadius());
 	DriftCircle dc_keep(ds->position(), ds->rot()->driftRadius(), ds->dr(), ds->drPrecise(), ds->state(), ds->id(), ds->index(),ds->rot() );
 	DCOnTrack dc_new(dc_keep, 0., 0.);
 	dc_new.state(dcs[i].state());
@@ -556,15 +550,15 @@ namespace TrkDriftCircleMath {
           double tLow = rtInfo->rt()->tLower();
           if(t<tLow) chi2p += (t-tLow)*(t-tLow)*0.1;
           if(t>tUp) chi2p += (t-tUp)*(t-tUp)*0.1;
-        } 
+        }
       }
       if(m_trace&&chi2p>0) ATH_MSG_DEBUG(" Rejected weak topology Chi2 penalty " << chi2p);
-      bool oldrefit = DCSLFitter::fit( result, line, dcs_new, selection ); 
+      bool oldrefit = DCSLFitter::fit( result, line, dcs_new, selection );
       chi2p += result.chi2();
 // add chi2 penalty for too large or too small driftTimes  t < 0 or t> t upper
       result.set( chi2p, result.ndof(),  result.dtheta(),  result.dy0() );
       return oldrefit;
-    }  // end rejection of weak topologies  
+    }  // end rejection of weak topologies
 
     if(m_trace) ATH_MSG_DEBUG("positive radii ML1 " <<  nml1p << " ML2 " <<  nml2p << " negative radii ML1 " << nml1n << " ML " << nml2n << " used hits " << used << " t0 Error " << t0Error);
 
@@ -572,20 +566,26 @@ namespace TrkDriftCircleMath {
     // starting point
     Double_t variable[3] = {theta,d,0};
     // if t0Seed value from outside use this
-    if(t0Seed > -999.) variable[2] = t0Seed; 
+    if(t0Seed > -999.) variable[2] = t0Seed;
+
+    ROOT::Minuit2::Minuit2Minimizer minimum("algoName");
+    minimum.SetMaxFunctionCalls(1000000);
+    minimum.SetTolerance(0.001);
+    minimum.SetPrintLevel(-1);
+    if(msgLvl(MSG::VERBOSE)) minimum.SetPrintLevel(1);
 
-    minimum->SetVariable(0,"a",variable[0], step[0]);
-    minimum->SetVariable(1,"b",variable[1], step[1]);
-    minimum->SetVariable(2,"t0",variable[2], step[2]);
+    minimum.SetVariable(0,"a",variable[0], step[0]);
+    minimum.SetVariable(1,"b",variable[1], step[1]);
+    minimum.SetVariable(2,"t0",variable[2], step[2]);
 
-    minimum->SetFunction(minFunct);
+    minimum.SetFunction(minFunct);
 
     // do the minimization
-    minimum->Minimize();
+    minimum.Minimize();
 
-    const double *results = minimum->X();
-    const double *errors = minimum->Errors();
-    ATH_MSG_DEBUG("Minimum: f(" << results[0] << "+-" << errors[0] << "," << results[1]<< "+-" << errors[1]<< "," << results[2] << "+-" << errors[2]<< "): " << minimum->MinValue());
+    const double *results = minimum.X();
+    const double *errors = minimum.Errors();
+    ATH_MSG_DEBUG("Minimum: f(" << results[0] << "+-" << errors[0] << "," << results[1]<< "+-" << errors[1]<< "," << results[2] << "+-" << errors[2]<< "): " << minimum.MinValue());
 
     ++m_npassedMinuitFit;
 
@@ -609,7 +609,7 @@ namespace TrkDriftCircleMath {
     double t0=results[2];
     double t0Err=errors[2];
     double dy0 = cosin * bErr - b * sinus * aErr;
-    
+
     double del_t;
     del_t = std::abs(rtpointers[0]->radius((t0+t0Err)) - rtpointers[0]->radius(t0)) ;
 
@@ -623,7 +623,7 @@ namespace TrkDriftCircleMath {
       msg() << MSG::DEBUG <<"COVAR  ";
       for(int it1=0; it1<3; it1++) {
         for(int it2=0; it2<3; it2++) {
-          msg() << MSG::DEBUG <<minimum->CovMatrix(it1,it2)<<" ";
+          msg() << MSG::DEBUG <<minimum.CovMatrix(it1,it2)<<" ";
         }
         msg() << MSG::DEBUG << endmsg;
       }
@@ -643,34 +643,34 @@ namespace TrkDriftCircleMath {
     it = dcs_keep.begin();
     it_end = dcs_keep.end();
     ATH_MSG_DEBUG("------NEW HITS------");
-    
+
     for(int i=0; it!=it_end; ++it, ++i ){
       double rad, drad;
-      
+
       double uppercut = rtpointers[i]->tUpper();
       double lowercut = rtpointers[i]->tLower();
       rad = rtpointers[i]->radius(t[i]-t0);
-      if(t[i]-t0<lowercut) rad = rtpointers[i]->radius(lowercut);     
-      if(t[i]-t0>uppercut) rad = rtpointers[i]->radius(uppercut);     
+      if(t[i]-t0<lowercut) rad = rtpointers[i]->radius(lowercut);
+      if(t[i]-t0>uppercut) rad = rtpointers[i]->radius(uppercut);
       if (w[i]==0) {
         ATH_MSG_WARNING("w[i]==0, continuing");
         continue;
       }
-      drad = 1.0/std::sqrt(w[i]) ; 
-      
+      drad = 1.0/std::sqrt(w[i]) ;
+
       yl = (y[i] -  tana*z[i] - b);
       if(m_trace) {
         ATH_MSG_DEBUG("i "<<i<<" ");
       }
-      
+
       double dth = -(sinus*y[i] + cosin*z[i])*dtheta;
       double residuals = std::abs(yl)/std::sqrt(1+tana*tana) - rad;
       if(m_trace) {
         ATH_MSG_DEBUG(" dth "<<dth<<" dy0 "<<dy0<<" del_t "<<del_t);
       }
-      
+
       double errorResiduals = std::hypot(dth, dy0, del_t);
-      
+
       // derivatives of the residual 'R'
       double deriv[3];
       // del R/del theta
@@ -679,13 +679,13 @@ namespace TrkDriftCircleMath {
       // del R / del b
       deriv[1] = sign(dd) * cosin ;
       // del R / del t0
-      
+
       deriv[2] = -1* rtpointers[i]->driftvelocity(t[i]-t0);
-      
+
       double covsq=0;
       for(int rr=0; rr<3; rr++) {
         for(int cc=0; cc<3; cc++) {
-          covsq += deriv[rr]*minimum->CovMatrix(rr,cc)* deriv[cc];
+          covsq += deriv[rr]*minimum.CovMatrix(rr,cc)* deriv[cc];
         }
       }
       if(m_trace) {
@@ -693,21 +693,21 @@ namespace TrkDriftCircleMath {
 	if( covsq < 0. ){
 	  for(int rr=0; rr<3; rr++) {
 	    for(int cc=0; cc<3; cc++) {
-	      double dot = deriv[rr]*minimum->CovMatrix(rr,cc)* deriv[cc];
-	      ATH_MSG_DEBUG(" adding term " << dot << " dev1 " << deriv[rr] << " cov " << minimum->CovMatrix(rr,cc) << " dev2 " << deriv[cc]);
+	      double dot = deriv[rr]*minimum.CovMatrix(rr,cc)* deriv[cc];
+	      ATH_MSG_DEBUG(" adding term " << dot << " dev1 " << deriv[rr] << " cov " << minimum.CovMatrix(rr,cc) << " dev2 " << deriv[cc]);
 	    }
 	  }
 	}
       }
       covsq = covsq > 0. ? std::sqrt(covsq) : 0.;
       const DriftCircle* ds  = & dcs_keep[i];
-      if (m_propagateErrors) drad = dr[i]; 
+      if (m_propagateErrors) drad = dr[i];
       DriftCircle dc_newrad(dcs_keep[i].position(), rad, drad, ds->state(), dcs_keep[i].id(), dcs_keep[i].index(),ds->rot() );
       DCOnTrack dc_new(dc_newrad, residuals, covsq);
       dc_new.state(dcs_keep[i].state());
-      
+
       if(m_trace) ATH_MSG_DEBUG("T0 Segment hit res "<<residuals<<" eres "<<errorResiduals<<" covsq "<<covsq<<" ri " << r[i]<<" ro "<<rad<<" drad "<<drad << " sel "<<selection[i]<< " inv error " << w[i]);
-      
+
       if( selection[i] == 0 ) {
         ++nhits;
         if (!m_propagateErrors) {
@@ -717,15 +717,15 @@ namespace TrkDriftCircleMath {
         }
         if(m_trace) ATH_MSG_DEBUG("T0 Segment hit res "<<residuals<<" eres "<<errorResiduals<<" covsq "<<covsq<<" ri " << r[i]<<" radius after t0 "<<rad<<" radius error "<< drad <<  " original error " << dr[i]);
 // Put chi2 penalty for drift times outside window
-        if (t[i]-t0> uppercut ) { // too large 
+        if (t[i]-t0> uppercut ) { // too large
 	  chi2  += (t[i]-t0-uppercut)* (t[i]-t0-uppercut)*0.1;
         }else if (t[i]-t0 < lowercut ) {// too small
 	  chi2 += ((t[i]-t0-lowercut)*(t[i]-t0-lowercut))*0.1;
         }
-      } 
+      }
       result.dcs().push_back( dc_new );
     }
-    
+
     double oldshift;
     oldshift = result.t0Shift();
     if(m_trace) ATH_MSG_DEBUG("end fit old "<<oldshift<< " new " <<t0);
@@ -750,6 +750,5 @@ namespace TrkDriftCircleMath {
     }
     return true;
   }
-  
-}
 
+}
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx
index 4bf8325d4afe37b624477a2d797723e8ce8902fd..d12909b845c2b736b8944b519f66c9a93d16f2ed 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx
@@ -58,9 +58,13 @@ namespace Muon {
   }
 
   StatusCode MuPatCandidateTool::finalize() {
+    return StatusCode::SUCCESS;
+  }
+
+  StatusCode MuPatCandidateTool::stop() {
 
     // Clean up all garbage now.
-    // If we leave it for the dtor, we may end up with dangling references
+    // If we leave it for later, we may end up with dangling references
     // to Surface objects that have already been deleted.
     for (CacheEntry& ent : m_cache) {
       ent.cleanUp();
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.h
index 9408b03df006abd7444dad72da8a6ba1340789d7..da0186c3a723ffc399ca305b01ae7c0405782c2b 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.h
@@ -65,13 +65,16 @@ namespace Muon {
     MuPatCandidateTool(const std::string&, const std::string&, const IInterface*);
     
     /** destructor */
-    ~MuPatCandidateTool() = default;
+    virtual ~MuPatCandidateTool() = default;
     
     /** initialize method, method taken from bass-class AlgTool */
-    StatusCode initialize();
+    virtual StatusCode initialize() override;
 
     /** finialize method, method taken from bass-class AlgTool */
-    StatusCode finalize();
+    virtual StatusCode finalize() override;
+
+    /** stop method, used to clean up garbage */
+    virtual StatusCode stop() override;
     
     /** @brief access to tool interface */
     static const InterfaceID& interfaceID() { return IID_MuPatCandidateTool; }
diff --git a/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h b/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h
index d755688f54de5668a14487f48a4b2c8f27dfb5a6..d919b8381b1cc45a8e57d17b510176576fabed2e 100644
--- a/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h
+++ b/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h
@@ -147,7 +147,7 @@ namespace Muon {
     ToolHandle<Trk::ITruthTrajectoryBuilder> m_truthTrajectoryBuilder{this,"TruthTrajectoryBuilder","Muon::MuonDecayTruthTrajectoryBuilder/MuonDecayTruthTrajectoryBuilder"};
 
     mutable TruthTree m_truthTree;
-    mutable std::vector<TruthTrajectory*> m_truthTrajectoriesToBeDeleted;
+    mutable std::vector<std::unique_ptr<TruthTrajectory> > m_truthTrajectoriesToBeDeleted;
     mutable std::map<int,int> m_barcodeMap; // map used to link barcode of TrackRecord particles/hits to 'final' state barcode
 
     Gaudi::Property<bool> m_manipulateBarCode{this,"ManipulateBarCode",false};
diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx
index c343b108ef4b51159869e2aea340876b05d83bca..e5e4cf377e319a9d5db1b722d4341f59368ef625 100644
--- a/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx
+++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonTrackTruthTool.cxx
@@ -156,13 +156,13 @@ namespace Muon {
       }
       ATH_MSG_VERBOSE(" found new particle with pdgid " << PDGCode << " in truth record, barcode " << barcode);
 
-      TruthTrajectory* truthTrajectory = 0;
+      std::unique_ptr<TruthTrajectory> truthTrajectory;
       // associate the muon truth with the gen event info
       if( genEvent ){
 	HepMC::GenParticle* genParticle = genEvent->barcode_to_particle( (*tr_it).GetBarCode() );
 	if( genParticle ){
-	  truthTrajectory = new TruthTrajectory();
-	  m_truthTrajectoryBuilder->buildTruthTrajectory(truthTrajectory,genParticle);
+	  truthTrajectory = std::make_unique<TruthTrajectory>();
+	  m_truthTrajectoryBuilder->buildTruthTrajectory(truthTrajectory.get(),genParticle);
 	  if( !truthTrajectory->empty() ){
 	    
 	    // always use barcode of the 'final' particle in chain in map
@@ -212,8 +212,8 @@ namespace Muon {
 	
       TruthTreeEntry& entry = m_truthTree[barcode];
       entry.truthTrack = &(*tr_it);
-      entry.truthTrajectory = truthTrajectory;
-      m_truthTrajectoriesToBeDeleted.push_back(truthTrajectory);
+      entry.truthTrajectory = truthTrajectory.get();
+      m_truthTrajectoriesToBeDeleted.push_back(std::move(truthTrajectory));
     }
     
     // add sim data collections
@@ -698,9 +698,6 @@ namespace Muon {
   void MuonTrackTruthTool::clear() const {
     m_truthTree.clear();
     m_barcodeMap.clear();
-    std::vector<TruthTrajectory*>::iterator dit = m_truthTrajectoriesToBeDeleted.begin();
-    std::vector<TruthTrajectory*>::iterator dit_end = m_truthTrajectoriesToBeDeleted.end();
-    for( ;dit!=dit_end;++dit ) delete *dit;
     m_truthTrajectoriesToBeDeleted.clear();
   }
 
diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx
index 1199406c5469d84c760a14048be2323c8a9b8e34..e531dc87f97a318010afcc347ecae3885dba3767 100644
--- a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx
+++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx
@@ -163,8 +163,10 @@ namespace Muon {
     // loop over chamber layers
     for( const auto& lay : ids ){
       // skip empty layers
-      Amg::Vector3D* firstPos  = 0;
-      Amg::Vector3D* secondPos = 0;
+      Amg::Vector3D firstPos  = Amg::Vector3D::Zero();
+      Amg::Vector3D secondPos = Amg::Vector3D::Zero();
+      bool firstPosSet = false;
+      bool secondPosSet = false;
       Identifier chId;
       int index = -1;
       uint8_t nprecLayers = 0;
@@ -218,14 +220,18 @@ namespace Muon {
 		if( isEndcap ) return fabs(p1.z()) < fabs(p2.z());
 		else           return p1.perp() < p2.perp();
 	      };
-	      if( !firstPos ) firstPos  = new Amg::Vector3D(gpos);
-	      else if( !secondPos ){
-		secondPos = new Amg::Vector3D(gpos);
-		if( isSmaller(*secondPos,*firstPos) ) std::swap(firstPos,secondPos);
+	      if( !firstPosSet ) {
+                firstPos  = gpos;
+                firstPosSet = true;
+              }
+	      else if( !secondPosSet ){
+		secondPos = gpos;
+                secondPosSet = true;
+		if( isSmaller(secondPos,firstPos) ) std::swap(firstPos,secondPos);
 	      }else{
 		// update position if we can increase the distance between the two positions
-		if( isSmaller(gpos,*firstPos) )       *firstPos  = gpos;
-		else if( isSmaller(*secondPos,gpos) ) *secondPos = gpos;
+		if( isSmaller(gpos,firstPos) )       firstPos  = gpos;
+		else if( isSmaller(secondPos,gpos) ) secondPos = gpos;
 	      }
 	    }
 	  }
@@ -238,14 +244,18 @@ namespace Muon {
 	      Amg::Vector3D locpos(0,pos->second.getdeposits()[0].second.ypos(),pos->second.getdeposits()[0].second.zpos());
 	      gpos=descriptor->localToGlobalCoords(locpos,m_idHelperSvc->cscIdHelper().elementID(id));
 	      ATH_MSG_DEBUG("got CSC global position "<<gpos);
-	      if( !firstPos ) firstPos  = new Amg::Vector3D(gpos);
-              else if( !secondPos ){
-                secondPos = new Amg::Vector3D(gpos);
-		if(secondPos->perp()<firstPos->perp()) std::swap(firstPos,secondPos);
+	      if( !firstPosSet ) {
+                firstPos  = gpos;
+                firstPosSet = true;
+              }
+              else if( !secondPosSet ){
+                secondPos = gpos;
+                secondPosSet = true;
+		if(secondPos.perp() < firstPos.perp()) std::swap(firstPos,secondPos);
 	      }
 	      else{
-		if( gpos.perp()<firstPos->perp() )       *firstPos  = gpos;
-                else if( secondPos->perp()<gpos.perp() ) *secondPos = gpos;
+		if( gpos.perp() < firstPos.perp() )       firstPos  = gpos;
+                else if( secondPos.perp() < gpos.perp() ) secondPos = gpos;
               }
 	    }
 	  }
@@ -272,16 +282,14 @@ namespace Muon {
 	  MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(chId);
 	  segment->setIdentifier(sector,chIndex,eta,technology);
 	}
-	if( firstPos && secondPos ){
-          Amg::Vector3D gpos = (*firstPos+*secondPos)/2.;
-          Amg::Vector3D gdir = (*firstPos-*secondPos).unit();
+	if( firstPosSet && secondPosSet ){
+          Amg::Vector3D gpos = (firstPos+secondPos)/2.;
+          Amg::Vector3D gdir = (firstPos-secondPos).unit();
 	  ATH_MSG_DEBUG(" got position : r " << gpos.perp() << " z " << gpos.z()
                         << "  and direction: theta " << gdir.theta() << " phi " << gdir.phi() );
           segment->setPosition(gpos.x(),gpos.y(),gpos.z());
           segment->setDirection(gdir.x(),gdir.y(),gdir.z());
 	}
-	delete firstPos;
-	delete secondPos;
       }
     }
   }
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.cxx
index e0760b9afdc0418e7cb787d1e0b9c0d7c9d0c262..e706b0081e1192924dda4912611b6273ea4c970d 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.cxx
@@ -10,7 +10,6 @@
 // PhysVal includes
 #include "MuonPhysValMonitoringTool.h"
 
-// FrameWork includes
 #include "GaudiKernel/IToolSvc.h"
 #include "xAODMuon/MuonContainer.h"
 #include "xAODMuon/MuonAuxContainer.h"
@@ -18,7 +17,6 @@
 #include "xAODMuon/SlowMuonContainer.h"
 #include "xAODMuon/SlowMuonAuxContainer.h"
 #include "xAODMuon/SlowMuon.h"
-
 #include "xAODTrigger/MuonRoI.h"
 #include "xAODTrigger/MuonRoIContainer.h"
 #include "xAODTrigMuon/L2StandAloneMuonContainer.h"
@@ -29,9 +27,6 @@
 #include "xAODTruth/TruthVertexContainer.h"
 #include "xAODTruth/TruthVertexAuxContainer.h"
 #include "MuonHistUtils/MuonEnumDefs.h"
-
-#include "MuonCombinedToolInterfaces/IMuonPrintingTool.h"
-
 #include "xAODCore/ShallowCopy.h"
 #include "xAODBase/IParticleHelpers.h"
 
@@ -71,8 +66,6 @@ MuonPhysValMonitoringTool::MuonPhysValMonitoringTool( const std::string& type,
   m_muonPrinter("Rec::MuonPrintingTool/MuonPrintingTool"),
   m_trigDec("Trig::TrigDecisionTool/TrigDecisionTool"),
   m_trackSelector("InDet::InDetDetailedTrackSelectorTool/MuonCombinedInDetDetailedTrackSelectorTool"),
-  // m_muonResonanceSelectionTool("MuonResonanceSelectionTool/MuonZSelectionTool"),
-  // m_muonResonancePairingTool("MuonResonancePairingTool/ZmumuResonancePairingTool"),
   m_oUnmatchedRecoMuonPlots(nullptr),
   m_oUnmatchedTruthMuonPlots(nullptr),
   m_oUnmatchedRecoMuonTrackPlots(nullptr),
@@ -83,20 +76,6 @@ MuonPhysValMonitoringTool::MuonPhysValMonitoringTool( const std::string& type,
   m_h_overview_Z_mass_ID(nullptr)
 {
   // default for muon chains
-
-  declareProperty( "IsData", m_isData = false );
-  declareProperty( "MuonContainerName", m_muonsName = "Muons" );
-  declareProperty( "SlowMuonContainerName", m_slowMuonsName = "SlowMuons" );
-  declareProperty( "MuonTruthParticleContainerName", m_muonsTruthName = "MuonTruthParticles" );
-
-  declareProperty( "TrackContainerName", m_tracksName);
-  declareProperty( "FwdTrackContainerName", m_fwdtracksName);
-  declareProperty( "MuonTrackContainerName", m_muonTracksName );
-  declareProperty( "MuonExtrapolatedTrackContainerName", m_muonExtrapolatedTracksName);
-  declareProperty( "MuonOnlyExtrapolatedTrackContainerName", m_muonMSOnlyExtrapolatedTracksName);
-  declareProperty( "MuonSegmentContainerName", m_muonSegmentsName);
-  declareProperty( "MuonTruthSegmentContainerName", m_muonSegmentsTruthName = "MuonTruthSegments" );
-  
   declareProperty( "TrackSelector", m_trackSelector);
   declareProperty( "IsoTool", m_isoTool );
   
@@ -107,24 +86,9 @@ MuonPhysValMonitoringTool::MuonPhysValMonitoringTool( const std::string& type,
   declareProperty( "SelectMuonCategories", m_selectMuonCategories );
   declareProperty( "DoBinnedResolutionPlots", m_doBinnedResolutionPlots = true);
 
-  declareProperty( "DoTrigMuonValidation", m_doTrigMuonValidation = false);
-  declareProperty( "DoTrigMuonL1Validation", m_doTrigMuonL1Validation = false);
-  declareProperty( "DoTrigMuonL2Validation", m_doTrigMuonL2Validation = false);
-  declareProperty( "DoTrigMuonEFValidation", m_doTrigMuonEFValidation = false);
-  declareProperty( "L1TrigMuonContainerName", m_muonL1TrigName = "LVL1MuonRoIs");
-  declareProperty( "L2SAMuonContainerName",m_muonL2SAName = "HLT_xAOD__L2StandAloneMuonContainer_MuonL2SAInfo");
-  declareProperty( "L2CBMuonContainerName",m_muonL2CBName = "HLT_xAOD__L2CombinedMuonContainer_MuonL2CBInfo");
-  declareProperty( "EFCombTrigMuonContainerName", m_muonEFCombTrigName = "HLT_xAOD__MuonContainer_MuonEFInfo");
-  declareProperty( "DoMuonTree", m_doMuonTree = false);
-
   m_SelectedAuthor = 0;
 }
 
-// Destructor
-///////////////
-MuonPhysValMonitoringTool::~MuonPhysValMonitoringTool()
-{}
-
 // Athena algtool's Hooks
 ////////////////////////////
 StatusCode MuonPhysValMonitoringTool::initialize()
@@ -239,6 +203,7 @@ StatusCode MuonPhysValMonitoringTool::bookHistograms()
   bool separateSAFMuons = true;
   if (m_slowMuonsName!="") separateSAFMuons = false; // no such muons in case of SlowMuon reco
   
+  std::string muonContainerName = m_muonsName.name();
   for (const auto category : m_selectMuonCategoriesStr) {
     std::string categoryPath = m_muonsName+"/"+category+"/";
     m_muonValidationPlots.push_back( new MuonValidationPlots(0, categoryPath,
@@ -255,7 +220,7 @@ StatusCode MuonPhysValMonitoringTool::bookHistograms()
     }
     if (m_muonTracksName!="") {
       m_muonMSTrackValidationPlots.push_back(new MuonTrackValidationPlots(0, categoryPath, "MSTrackParticles", m_isData));
-      if (!m_isData) m_oUnmatchedRecoMuonTrackPlots = new Muon::RecoMuonTrackPlotOrganizer(0, Form("%s/UnmatchedRecoMuonTracks/",m_muonsName.c_str()));
+      if (!m_isData) m_oUnmatchedRecoMuonTrackPlots = new Muon::RecoMuonTrackPlotOrganizer(0, Form("%s/UnmatchedRecoMuonTracks/",muonContainerName.c_str()));
     }
     if (m_muonExtrapolatedTracksName!="") m_muonMETrackValidationPlots.push_back(new MuonTrackValidationPlots(0, categoryPath, "METrackParticles", m_isData));
     if (m_muonMSOnlyExtrapolatedTracksName!="") m_muonMSOnlyMETrackValidationPlots.push_back(new MuonTrackValidationPlots(0, categoryPath, "MSOnlyMETrackParticles", m_isData));
@@ -269,13 +234,13 @@ StatusCode MuonPhysValMonitoringTool::bookHistograms()
     if (m_muonSegmentsName!="") {
       if (category!=theMuonCategories[ALL]) continue; //cannot identify the truth origin of segments...
       m_muonSegmentValidationPlots.push_back(new MuonSegmentValidationPlots(0, categoryPath, m_isData));
-      if (!m_isData) m_oUnmatchedRecoMuonSegmentPlots = new Muon::MuonSegmentPlots(0, Form("%s/UnmatchedRecoMuonSegments/",m_muonsName.c_str()));	    
+      if (!m_isData) m_oUnmatchedRecoMuonSegmentPlots = new Muon::MuonSegmentPlots(0, Form("%s/UnmatchedRecoMuonSegments/",muonContainerName.c_str()));
     }
   }
 
   if (!m_isData) {
-    m_oUnmatchedRecoMuonPlots = new Muon::RecoMuonPlotOrganizer(0, Form("%s/UnmatchedRecoMuons/",m_muonsName.c_str()));
-    m_oUnmatchedTruthMuonPlots = new Muon::TruthMuonPlotOrganizer(0, Form("%s/UnmatchedTruthMuons/",m_muonsName.c_str()));
+    m_oUnmatchedRecoMuonPlots = new Muon::RecoMuonPlotOrganizer(0, Form("%s/UnmatchedRecoMuons/",muonContainerName.c_str()));
+    m_oUnmatchedTruthMuonPlots = new Muon::TruthMuonPlotOrganizer(0, Form("%s/UnmatchedTruthMuons/",muonContainerName.c_str()));
   }   
 
   for (const auto plots : m_muonValidationPlots)                 bookValidationPlots(*plots).ignore();
@@ -295,37 +260,37 @@ StatusCode MuonPhysValMonitoringTool::bookHistograms()
     if (m_oUnmatchedRecoMuonSegmentPlots) bookValidationPlots(*m_oUnmatchedRecoMuonSegmentPlots).ignore();
   }
   //book overview hists
-  m_h_overview_Z_mass = new TH1F(Form("%s_Overview_Z_mass",m_muonsName.c_str()),"",20,76,106);
-  ATH_CHECK(regHist(m_h_overview_Z_mass,Form("%s/Overview",m_muonsName.c_str()),all));
-  m_h_overview_Z_mass_ME = new TH1F(Form("%s_Overview_Z_mass_ME",m_muonsName.c_str()),"",20,76,106);
-  ATH_CHECK(regHist(m_h_overview_Z_mass_ME,Form("%s/Overview",m_muonsName.c_str()),all));
-  m_h_overview_Z_mass_ID = new TH1F(Form("%s_Overview_Z_mass_ID",m_muonsName.c_str()),"",20,76,106);
-  ATH_CHECK(regHist(m_h_overview_Z_mass_ID,Form("%s/Overview",m_muonsName.c_str()),all));
+  m_h_overview_Z_mass = new TH1F(Form("%s_Overview_Z_mass",muonContainerName.c_str()),"",20,76,106);
+  ATH_CHECK(regHist(m_h_overview_Z_mass,Form("%s/Overview",muonContainerName.c_str()),all));
+  m_h_overview_Z_mass_ME = new TH1F(Form("%s_Overview_Z_mass_ME",muonContainerName.c_str()),"",20,76,106);
+  ATH_CHECK(regHist(m_h_overview_Z_mass_ME,Form("%s/Overview",muonContainerName.c_str()),all));
+  m_h_overview_Z_mass_ID = new TH1F(Form("%s_Overview_Z_mass_ID",muonContainerName.c_str()),"",20,76,106);
+  ATH_CHECK(regHist(m_h_overview_Z_mass_ID,Form("%s/Overview",muonContainerName.c_str()),all));
   
   m_h_overview_nObjects.clear();
-  m_h_overview_nObjects.push_back(new TH1F(Form("%s_Overview_N_perevent_truth_muons",m_muonsName.c_str()), "Number of truth Muons per event", 20, -0.5, 19.5));
-  m_h_overview_nObjects.push_back(new TH1F(Form("%s_Overview_N_perevent_muons",m_muonsName.c_str()), "Number of Muons per event", 20, -0.5, 19.5));
-  m_h_overview_nObjects.push_back(new TH1F(Form("%s_Overview_N_perevent_tracks",m_muonsName.c_str()), "Number of Tracks per event", 50, -0.5, 49.5));
-  m_h_overview_nObjects.push_back(new TH1F(Form("%s_Overview_N_perevent_truth_segments",m_muonsName.c_str()), "Number of truth Segments per event", 200, -0.5, 199.5));
-  m_h_overview_nObjects.push_back(new TH1F(Form("%s_Overview_N_perevent_segments",m_muonsName.c_str()), "Number of Segments per event", 200, -0.5, 199.5));
+  m_h_overview_nObjects.push_back(new TH1F(Form("%s_Overview_N_perevent_truth_muons",muonContainerName.c_str()), "Number of truth Muons per event", 20, -0.5, 19.5));
+  m_h_overview_nObjects.push_back(new TH1F(Form("%s_Overview_N_perevent_muons",muonContainerName.c_str()), "Number of Muons per event", 20, -0.5, 19.5));
+  m_h_overview_nObjects.push_back(new TH1F(Form("%s_Overview_N_perevent_tracks",muonContainerName.c_str()), "Number of Tracks per event", 50, -0.5, 49.5));
+  m_h_overview_nObjects.push_back(new TH1F(Form("%s_Overview_N_perevent_truth_segments",muonContainerName.c_str()), "Number of truth Segments per event", 200, -0.5, 199.5));
+  m_h_overview_nObjects.push_back(new TH1F(Form("%s_Overview_N_perevent_segments",muonContainerName.c_str()), "Number of Segments per event", 200, -0.5, 199.5));
   for (const auto hist : m_h_overview_nObjects) {
-    if (hist) ATH_CHECK(regHist(hist,Form("%s/Overview",m_muonsName.c_str()),all));
+    if (hist) ATH_CHECK(regHist(hist,Form("%s/Overview",muonContainerName.c_str()),all));
   }
 
-  m_h_overview_reco_category = new TH1F(Form("%s_Overview_reco_category",m_muonsName.c_str()),"",4,0,4); //prompt/in-flight/non-isolated/other
+  m_h_overview_reco_category = new TH1F(Form("%s_Overview_reco_category",muonContainerName.c_str()),"",4,0,4); //prompt/in-flight/non-isolated/other
   for (int i=1; i<4; i++) { //skip 'All'
     m_h_overview_reco_category->GetXaxis()->SetBinLabel(i,theMuonCategories[i].c_str());
   } m_h_overview_reco_category->GetXaxis()->SetBinLabel(4,"Other"); //of some other origin or fakes
-  ATH_CHECK(regHist(m_h_overview_reco_category,Form("%s/Overview",m_muonsName.c_str()),all));
+  ATH_CHECK(regHist(m_h_overview_reco_category,Form("%s/Overview",muonContainerName.c_str()),all));
 
   int nAuth = xAOD::Muon::NumberOfMuonAuthors;
   for (int i=1; i<4; i++) {
-    m_h_overview_reco_authors.push_back(new TH1F((m_muonsName+"_"+theMuonCategories[i]+"_reco_authors").c_str(),(m_muonsName+"_"+theMuonCategories[i]+"_reco_authors").c_str(),nAuth+1,-0.5,nAuth+0.5));
+    m_h_overview_reco_authors.push_back(new TH1F((m_muonsName+"_"+theMuonCategories[i]+"_reco_authors").c_str(),(muonContainerName+"_"+theMuonCategories[i]+"_reco_authors").c_str(),nAuth+1,-0.5,nAuth+0.5));
   }
-  m_h_overview_reco_authors.push_back(new TH1F((m_muonsName+"_Overview_Other_reco_authors").c_str(),(m_muonsName+"_Other_reco_authors").c_str(),nAuth+1,-0.5,nAuth+0.5));
+  m_h_overview_reco_authors.push_back(new TH1F((m_muonsName+"_Overview_Other_reco_authors").c_str(),(muonContainerName+"_Other_reco_authors").c_str(),nAuth+1,-0.5,nAuth+0.5));
   
   for (const auto hist : m_h_overview_reco_authors) {
-    if (hist) ATH_CHECK(regHist(hist,Form("%s/Overview",m_muonsName.c_str()),all));
+    if (hist) ATH_CHECK(regHist(hist,Form("%s/Overview",muonContainerName.c_str()),all));
   }
 
   return StatusCode::SUCCESS;
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.h
index 7af96ecbccbf0f0266dc905ed3080ea9214161c6..fa897be1a74edc61c80379c6c67a6181447f52c0 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.h
@@ -10,11 +10,6 @@
 #ifndef MUONPHYSVALMONITORING_MUONPHYSVALMONITORINGTOOL_H
 #define MUONPHYSVALMONITORING_MUONPHYSVALMONITORINGTOOL_H
 
-// STL includes
-#include <string>
-#include <vector>
-
-// FrameWork includes
 #include "GaudiKernel/ServiceHandle.h"
 #include "StoreGate/ReadHandleKey.h"
 #include "xAODTruth/TruthParticleContainer.h"
@@ -23,32 +18,23 @@
 #include "xAODTrigMuon/L2StandAloneMuon.h"
 #include "xAODTrigMuon/L2CombinedMuonContainer.h"
 #include "xAODTrigMuon/L2CombinedMuon.h"
-
 #include "xAODMuon/SlowMuon.h"
 #include "xAODEventInfo/EventInfo.h"
-
-// Tools
 #include "MuonAnalysisInterfaces/IMuonSelectionTool.h"
 #include "TrigDecisionTool/TrigDecisionTool.h"
 #include "TrkToolInterfaces/ITrackSelectorTool.h"
 #include "IsolationSelection/IIsolationSelectionTool.h"
-
-
-
-// Local includes
+#include "MuonCombinedToolInterfaces/IMuonPrintingTool.h"
 #include "AthenaMonitoring/ManagedMonitorToolBase.h"
-
-// Root includes
 #include "MuonValidationPlots.h"
 #include "TriggerMuonValidationPlots.h"
 #include "MuonTrackValidationPlots.h"
 #include "MuonSegmentValidationPlots.h"
 #include "SlowMuonValidationPlots.h"
 
-// Forward declaration
-namespace Rec {
-  class IMuonPrintingTool;
-}
+#include <string>
+#include <vector>
+
 namespace MuonPhysValMonitoring {
 
 class MuonPhysValMonitoringTool
@@ -67,7 +53,7 @@ class MuonPhysValMonitoringTool
 		  const IInterface* parent );
 
   /// Destructor: 
-  virtual ~MuonPhysValMonitoringTool(); 
+  virtual ~MuonPhysValMonitoringTool()=default;
 
   // Athena algtool's Hooks
   virtual StatusCode initialize();
@@ -124,26 +110,23 @@ class MuonPhysValMonitoringTool
   TH1F* findHistogram(std::vector<HistData> hists,std::string hnameTag,std::string hdirTag,std::string hNewName);
   void modifyHistogram(TH1* hist);
 
-  bool m_isData;
-
-
-
+  Gaudi::Property<bool> m_isData{this,"IsData",false};
 
   // Containers
-  std::string m_tracksName;
-  std::string m_fwdtracksName;
-  std::string m_muonsName;
-  std::string m_slowMuonsName;
-  std::string m_muonsTruthName;
-  std::string m_muonTracksName;
-  std::string m_muonExtrapolatedTracksName;
-  std::string m_muonMSOnlyExtrapolatedTracksName;
-  std::string m_muonSegmentsName;
-  std::string m_muonSegmentsTruthName;
-  std::string m_muonL1TrigName;
-  std::string m_muonL2SAName;
-  std::string m_muonL2CBName;
-  std::string m_muonEFCombTrigName;
+  Gaudi::Property<std::string> m_tracksName{this,"TrackContainerName",""};
+  Gaudi::Property<std::string> m_fwdtracksName{this,"FwdTrackContainerName",""};
+  Gaudi::Property<std::string> m_muonsName{this,"MuonContainerName","Muons"};
+  Gaudi::Property<std::string> m_slowMuonsName{this,"SlowMuonContainerName","SlowMuons"};
+  Gaudi::Property<std::string> m_muonsTruthName{this,"MuonTruthParticleContainerName","MuonTruthParticles"};
+  Gaudi::Property<std::string> m_muonTracksName{this,"MuonTrackContainerName",""};
+  Gaudi::Property<std::string> m_muonExtrapolatedTracksName{this,"MuonExtrapolatedTrackContainerName",""};
+  Gaudi::Property<std::string> m_muonMSOnlyExtrapolatedTracksName{this,"MuonOnlyExtrapolatedTrackContainerName",""};
+  Gaudi::Property<std::string> m_muonSegmentsName{this,"MuonSegmentContainerName",""};
+  Gaudi::Property<std::string> m_muonSegmentsTruthName{this,"MuonTruthSegmentContainerName","MuonTruthSegments"};
+  Gaudi::Property<std::string> m_muonL1TrigName{this,"L1TrigMuonContainerName","LVL1MuonRoIs"};
+  Gaudi::Property<std::string> m_muonL2SAName{this,"L2SAMuonContainerName","HLT_xAOD__L2StandAloneMuonContainer_MuonL2SAInfo"};
+  Gaudi::Property<std::string> m_muonL2CBName{this,"L2CBMuonContainerName","HLT_xAOD__L2CombinedMuonContainer_MuonL2CBInfo"};
+  Gaudi::Property<std::string> m_muonEFCombTrigName{this,"EFCombTrigMuonContainerName","HLT_xAOD__MuonContainer_MuonEFInfo"};
 
   SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this,"EventInfo","EventInfo","event info"};
 
@@ -158,13 +141,11 @@ class MuonPhysValMonitoringTool
   int m_SelectedAuthor;
   std::vector<unsigned int> m_selectMuonCategories;  
   bool m_doBinnedResolutionPlots;
-  bool m_doTrigMuonValidation;
-  bool m_doTrigMuonL1Validation;
-  bool m_doTrigMuonL2Validation;
-  bool m_doTrigMuonEFValidation;
-  bool m_doMuonTree;
-
-
+  Gaudi::Property<bool> m_doTrigMuonValidation{this,"DoTrigMuonValidation",false};
+  Gaudi::Property<bool> m_doTrigMuonL1Validation{this,"DoTrigMuonL1Validation",false};
+  Gaudi::Property<bool> m_doTrigMuonL2Validation{this,"DoTrigMuonL2Validation",false};
+  Gaudi::Property<bool> m_doTrigMuonEFValidation{this,"DoTrigMuonEFValidation",false};
+  Gaudi::Property<bool> m_doMuonTree{this,"DoMuonTree",false};
   
   // Tools
   ToolHandle<CP::IMuonSelectionTool> m_muonSelectionTool;
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/CscRawDataMonitoring/CSCSegmValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/CscRawDataMonitoring/CSCSegmValAlg.h
index e13ed2a63f064da249da9691e3213b8f5e315503..ceebb0af9f3270f1599e5feaf3112a6e532c23d0 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/CscRawDataMonitoring/CSCSegmValAlg.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/CscRawDataMonitoring/CSCSegmValAlg.h
@@ -90,7 +90,7 @@ class CSCSegmValAlg : public ManagedMonitorToolBase {
   std::vector<std::string> m_sampSelTriggers;
   bool m_doEvtSel;
 
-  SG::ReadHandleKey<Trk::SegmentCollection> m_segmKey{this,"SegmentKey","MuonSegments","muon segments"};
+  SG::ReadHandleKey<Trk::SegmentCollection> m_segmKey{this,"SegmentKey","TrackMuonSegments","muon segments"};
   double m_segmSlope;
 
   bool m_debuglevel;           //!< private member to control debug messages
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/CscRawDataMonitoring/CSCSegmValMonAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/CscRawDataMonitoring/CSCSegmValMonAlg.h
index 54a68b8bf31d1f13c2927ddadc747f6459ca7f79..7567d39993d676057d4d980ed379cc6763742d4c 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/CscRawDataMonitoring/CSCSegmValMonAlg.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/CscRawDataMonitoring/CSCSegmValMonAlg.h
@@ -58,7 +58,7 @@ class CSCSegmValMonAlg : public AthMonitorAlgorithm {
     "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", 
     "Handle to the service providing the IMuonEDMHelperSvc interface" };
   ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
-  SG::ReadHandleKey<Trk::SegmentCollection> m_segmKey{this,"SegmentKey","MuonSegments","muon segments"};
+  SG::ReadHandleKey<Trk::SegmentCollection> m_segmKey{this,"SegmentKey","TrackMuonSegments","muon segments"};
 
   Gaudi::Property<std::vector<std::string>> m_sampSelTriggers{this,"EventSelTriggers",{}};
   Gaudi::Property<bool> m_doEvtSel{this,"DoEventSelection",false};
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/python/CscMonitoringESD_Alg.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/python/CscMonitoringESD_Alg.py
index 2935361e463889f699ba13efe3127453a0876409..a87f507615eb08f2822507a1dd548b97b431c2af 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/python/CscMonitoringESD_Alg.py
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/python/CscMonitoringESD_Alg.py
@@ -24,6 +24,10 @@ def CscMonitoringESD_AlgConfig(inputFlags):
     from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
     result.merge(MuonGeoModelCfg(inputFlags))
    
+    # Fixup for R21 ESD
+    from MuonConfig.MuonSegmentNameFixConfig import MuonSegmentNameFixCfg
+    result.merge(MuonSegmentNameFixCfg(inputFlags))
+
     # The following class will make a sequence, configure algorithms, and link
     # them to GenericMonitoringTools
     from AthenaMonitoring import AthMonitorCfgHelper
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/share/CSCMon_jobOptions.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/share/CSCMon_jobOptions.py
index fa5864cfefeb99b224a463d132a6e860749b09fc..4cd3a3f39cda88546f84c7b328a756311025dc9f 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/share/CSCMon_jobOptions.py
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/share/CSCMon_jobOptions.py
@@ -36,8 +36,6 @@ def getInputFiles(dir, AODHLTP):
 # Input files
 ##############################
 
-#AODir = ['/raid01/venkat/dataset/data/csc/2011/mcpskim/data10_7TeV.*.phys*', 'data10_7TeV*DESD_ZMUMU*']
-#AODir2 = ['/raid01/jveatch/data/dataset/CSCMon/data11_7TeV.00189751.physics_Muons.recon.DESD_ZMUMU.f405_m716_f405', 'data11_7TeV*DESD_ZMUMU*']
 AODir2=['/afs/cern.ch/work/p/panagoul/CSC_data', 'data15_13TeV.00280950*']
 
 CSCInputFiles = []
@@ -262,7 +260,7 @@ if doCSCSegm:
   ## trigger-aware monitoring: sample seletion triggers (express stream menu physics_pp_v2)
   evtSelectionTriggers = [  "L1_MU10", "L1_MU15", "EF_mu20_muCombTag_NoEF", "EF_mu15", "EF_mu15_mu10_EFFS", "EF_2mu10", "EF_2mu10_loose" ]
 
-  CSCSegmValAlg = CSCSegmValAlg ( name = "CSCSegmValAlg", SegmentKey = "MuonSegments",
+  CSCSegmValAlg = CSCSegmValAlg ( name = "CSCSegmValAlg",
     TrigDecisionTool = ToolSvc.TrigDecisionTool, DoEventSelection = False, EventSelTriggers = evtSelectionTriggers,
     SegmentSlopeCut = 0.07, ClusterStatus = clusStatWords)
 
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/share/CscRawESD_MonitoringOptions.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/share/CscRawESD_MonitoringOptions.py
index a4879b152c0e712f15426a4555a3e1da35b445e0..abac9f678a9e17d1ea6a22260746fc8b1f8f5f92 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/share/CscRawESD_MonitoringOptions.py
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/share/CscRawESD_MonitoringOptions.py
@@ -87,8 +87,6 @@ topSequence += cscesdRawMonMan
 # CSC Segment Monitoring
 #---------------------------------------------------------------
 from CscRawDataMonitoring.CscRawDataMonitoringConf import CSCSegmValAlg
-#from MuonDQAMonFlags.MuonDQAFlags import MuonDQAFlags as MuonDQAFlags
-#MuonDQAFlags.doMuonSegmMon = True
 
 ## TDT instance (this should be done already?)
 if(DQMonFlags.useTrigger() and hasattr(ToolSvc, DQMonFlags.nameTrigDecTool())):
@@ -106,8 +104,6 @@ clusStatWords = [ "Unspoiled", "Simple", "Edge", "MultiPeak", "Narrow",
 evtSelectionTriggers = [  "L1_MU10", "L1_MU15", "EF_mu20_muCombTag_NoEF", "EF_mu15", "EF_mu15_mu10_EFFS", "EF_2mu10", "EF_2mu10_loose" ]
 
 CSCSegmESDValAlg = CSCSegmValAlg ( name = "CSCSegmValAlg", 
-                                   SegmentKey = "MuonSegments",
-                                   #TrigDecisionTool = ToolSvc.TrigDecisionTool, 
                                    DoEventSelection = False, 
                                    EventSelTriggers = evtSelectionTriggers,
                                    SegmentSlopeCut = 0.07, 
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/src/CSCSegmValMonAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/src/CSCSegmValMonAlg.cxx
index 9f5c01e880cda2e8595fa584648e297ef1b65337..bef9f5e11911487dc0f7f8ef8522939487b34d91 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/src/CSCSegmValMonAlg.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/src/CSCSegmValMonAlg.cxx
@@ -76,6 +76,10 @@ StatusCode CSCSegmValMonAlg::fillHistograms(const EventContext& ctx) const{
     }
 
     SG::ReadHandle<Trk::SegmentCollection> segments(m_segmKey, ctx);
+    if (!segments.isValid()) {
+      ATH_MSG_ERROR("Could not retrieve Trk::SegmentCollection "<<m_segmKey.key());
+      return StatusCode::FAILURE;
+    }
 
     if ( segments->empty() ){
       ATH_MSG_DEBUG( "      Segm Collection is Empty, done...    ");
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonAlg.h
index 351fe161c323b061716617ff55421104266ac38b..1da9dddb88bd4442eb85b4a9d79dda6704b39936 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonAlg.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonAlg.h
@@ -160,7 +160,7 @@ class MdtRawDataMonAlg: public AthMonitorAlgorithm {
 
   bool m_atlas_ready;
 
-  SG::ReadHandleKey<Trk::SegmentCollection> m_segm_type{this,"Eff_segm_type","MuonSegments","muon segments"};
+  SG::ReadHandleKey<Trk::SegmentCollection> m_segm_type{this,"Eff_segm_type","TrackMuonSegments","muon segments"};
 
   std::string returnString(int i) const{
     std::stringstream ss;
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataValAlg.h
index ccac9d53b25db4f80e28dd674fa7038caa0abc8e..6df5cbf4b05fb445d1d8a42950328b2cd0b072ab 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataValAlg.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataValAlg.h
@@ -176,7 +176,7 @@ class MdtRawDataValAlg: public ManagedMonitorToolBase {
   uint32_t m_firstTime;
   int m_numberOfEvents;
 
-  SG::ReadHandleKey<Trk::SegmentCollection> m_segm_type{this,"Eff_segm_type","MuonSegments","muon segments"};
+  SG::ReadHandleKey<Trk::SegmentCollection> m_segm_type{this,"Eff_segm_type","TrackMuonSegments","muon segments"};
 
   std::string returnString(int i){
     std::stringstream ss;
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/python/MDTMonitorAlgorithm.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/python/MDTMonitorAlgorithm.py
index 25a11b32020662d7f42680ab56cc24d4b85e8660..5ed3d6ce704a5eba8f875cdf5c5a2fc8d22f5f5b 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/python/MDTMonitorAlgorithm.py
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/python/MDTMonitorAlgorithm.py
@@ -27,6 +27,10 @@ def MdtMonitoringConfig(inputFlags):
     from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
     result.merge(MuonGeoModelCfg(inputFlags))
 
+    # Fixup for R21 ESD
+    from MuonConfig.MuonSegmentNameFixConfig import MuonSegmentNameFixCfg
+    result.merge(MuonSegmentNameFixCfg(inputFlags))
+
     # The following class will make a sequence, configure algorithms, and link
     # them to GenericMonitoringTools
     from AthenaMonitoring import AthMonitorCfgHelper
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx
index cf5c608a021e56b1da4c7f653b2821b241144a45..0b53e7916360d692dcac85b9c58933271266110f 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx
@@ -528,8 +528,7 @@ StatusCode MdtRawDataMonAlg::fillHistograms(const EventContext& ctx) const
   }   //m_doMdtESD==true
 
   SG::ReadHandle<Trk::SegmentCollection> segms(m_segm_type, ctx);
-  if (!segms.isValid())
-  {
+  if (!segms.isValid()) {
     ATH_MSG_ERROR("evtStore() does not contain mdt segms Collection with name " << m_segm_type);
     return StatusCode::FAILURE;
   }
diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisAlgorithmsTest.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisAlgorithmsTest.py
index 5d99638fa074f9ba76fab67d9d16cbeafeff43da..262068810cf1a7150f89e3550d7f483630762a20 100644
--- a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisAlgorithmsTest.py
+++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisAlgorithmsTest.py
@@ -58,36 +58,40 @@ def makeOverlapSequence (dataType) :
                            outputName = 'AnalysisJets_%SYS%' )
     algSeq += jetSequence
 
+    # TODO: disabled for now
     # Include, and then set up the tau analysis algorithm sequence:
-    from TauAnalysisAlgorithms.TauAnalysisSequence import makeTauAnalysisSequence
-    tauSequence = makeTauAnalysisSequence( dataType, 'Tight' )
-    tauSequence.configure( inputName = 'TauJets',
-                           outputName = 'AnalysisTauJets_%SYS%' )
-    algSeq += tauSequence
+    # from TauAnalysisAlgorithms.TauAnalysisSequence import makeTauAnalysisSequence
+    # tauSequence = makeTauAnalysisSequence( dataType, 'Tight' )
+    # tauSequence.configure( inputName = 'TauJets',
+    #                        outputName = 'AnalysisTauJets_%SYS%' )
+    # algSeq += tauSequence
 
     # Include, and then set up the overlap analysis algorithm sequence:
     from AsgAnalysisAlgorithms.OverlapAnalysisSequence import \
         makeOverlapAnalysisSequence
-    overlapSequence = makeOverlapAnalysisSequence( dataType, doMuPFJetOR=True, enableCutflow=True )
+    overlapSequence = makeOverlapAnalysisSequence( dataType, doMuPFJetOR=True, doTaus=False, enableCutflow=True )
     overlapSequence.configure(
         inputName = {
             'electrons' : 'AnalysisElectrons_%SYS%',
             'photons'   : 'AnalysisPhotons_%SYS%',
             'muons'     : 'AnalysisMuons_%SYS%',
             'jets'      : 'AnalysisJets_%SYS%',
-            'taus'      : 'AnalysisTauJets_%SYS%' },
+            # 'taus'      : 'AnalysisTauJets_%SYS%'
+        },
         outputName = {
             'electrons' : 'AnalysisElectronsOR_%SYS%',
             'photons'   : 'AnalysisPhotonsOR_%SYS%',
             'muons'     : 'AnalysisMuonsOR_%SYS%',
             'jets'      : 'AnalysisJetsOR_%SYS%',
-            'taus'      : 'AnalysisTauJetsOR_%SYS%' },
+            # 'taus'      : 'AnalysisTauJetsOR_%SYS%'
+        },
         affectingSystematics = {
             'electrons' : electronSequence.affectingSystematics(),
             'photons'   : photonSequence.affectingSystematics(),
             'muons'     : muonSequence.affectingSystematics(),
             'jets'      : jetSequence.affectingSystematics(),
-            'taus'      : tauSequence.affectingSystematics() } )
+            # 'taus'      : tauSequence.affectingSystematics()
+        } )
     algSeq += overlapSequence
 
     # Set up an ntuple to check the job with:
@@ -123,12 +127,13 @@ def makeOverlapSequence (dataType) :
         'AnalysisJetsOR_%SYS%.eta -> jet_OR_%SYS%_eta',
         'AnalysisJetsOR_%SYS%.phi -> jet_OR_%SYS%_phi',
         'AnalysisJetsOR_%SYS%.pt  -> jet_OR_%SYS%_pt',
-        'AnalysisTauJets_%SYS%.eta -> tau_%SYS%_eta',
-        'AnalysisTauJets_%SYS%.phi -> tau_%SYS%_phi',
-        'AnalysisTauJets_%SYS%.pt  -> tau_%SYS%_pt',
-        'AnalysisTauJetsOR_%SYS%.eta -> tau_OR_%SYS%_eta',
-        'AnalysisTauJetsOR_%SYS%.phi -> tau_OR_%SYS%_phi',
-        'AnalysisTauJetsOR_%SYS%.pt  -> tau_OR_%SYS%_pt' ]
+        # 'AnalysisTauJets_%SYS%.eta -> tau_%SYS%_eta',
+        # 'AnalysisTauJets_%SYS%.phi -> tau_%SYS%_phi',
+        # 'AnalysisTauJets_%SYS%.pt  -> tau_%SYS%_pt',
+        # 'AnalysisTauJetsOR_%SYS%.eta -> tau_OR_%SYS%_eta',
+        # 'AnalysisTauJetsOR_%SYS%.phi -> tau_OR_%SYS%_phi',
+        # 'AnalysisTauJetsOR_%SYS%.pt  -> tau_OR_%SYS%_pt'
+    ]
     ntupleMaker.systematicsRegex = '.*'
     algSeq += ntupleMaker
     treeFiller = createAlgorithm( 'CP::TreeFillerAlg', 'TreeFiller' )
diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_jobOptions.py
index 6fd7280dd7e3aa9d5025957cb8cf76e5696a6427..854852047c069959fe65bc74352b5442f337f5dc 100644
--- a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_jobOptions.py
+++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/EventAlgorithmsTest_jobOptions.py
@@ -22,11 +22,15 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA',
              "afii": 'ASG_TEST_FILE_MC_AFII'}
 
 # Set up the reading of the input file:
-import AthenaRootComps.ReadAthenaxAODHybrid
+import AthenaPoolCnvSvc.ReadAthenaPool
 theApp.EvtMax = 500
 testFile = os.getenv ( inputfile[dataType] )
 svcMgr.EventSelector.InputCollections = [testFile]
 
+# Needed for filtering, Athena only for now
+from EventBookkeeperTools.CutFlowHelpers import CreateCutFlowSvc
+CreateCutFlowSvc(svcName="CutFlowSvc", seq=athAlgSeq, addMetaDataToAllOutputFiles=False)
+
 from AsgAnalysisAlgorithms.AsgAnalysisAlgorithmsTest import makeEventAlgorithmsSequence
 algSeq = makeEventAlgorithmsSequence (dataType)
 print( algSeq ) # For debugging
diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_jobOptions.py
index bae994afbe052c6f5d68d2b823096e6b3a2e2b56..5bff87b56399699893d321c85d4d80d75158a99f 100644
--- a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_jobOptions.py
+++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/GeneratorAlgorithmsTest_jobOptions.py
@@ -21,7 +21,7 @@ inputfile = {"mc":   'ASG_TEST_FILE_MC',
              "afii": 'ASG_TEST_FILE_MC_AFII'}
 
 # Set up the reading of the input file:
-import AthenaRootComps.ReadAthenaxAODHybrid
+import AthenaPoolCnvSvc.ReadAthenaPool
 theApp.EvtMax = 500
 testFile = os.getenv ( inputfile[dataType] )
 svcMgr.EventSelector.InputCollections = [testFile]
diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_jobOptions.py
index 607ba7885078694ae82c31f5ff87df886f7a275e..b631c30461a94e4d48243c946742646401543157 100644
--- a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_jobOptions.py
+++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/share/OverlapAlgorithmsTest_jobOptions.py
@@ -22,11 +22,15 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA',
              "afii": 'ASG_TEST_FILE_MC_AFII'}
 
 # Set up the reading of the input file:
-import AthenaRootComps.ReadAthenaxAODHybrid
+import AthenaPoolCnvSvc.ReadAthenaPool
 theApp.EvtMax = 500
 testFile = os.getenv ( inputfile[dataType] )
 svcMgr.EventSelector.InputCollections = [testFile]
 
+# Needed for filtering, Athena only for now
+from EventBookkeeperTools.CutFlowHelpers import CreateCutFlowSvc
+CreateCutFlowSvc(svcName="CutFlowSvc", seq=athAlgSeq, addMetaDataToAllOutputFiles=False)
+
 from AsgAnalysisAlgorithms.AsgAnalysisAlgorithmsTest import makeOverlapSequence
 algSeq = makeOverlapSequence (dataType)
 print( algSeq ) # For debugging
diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/PhotonAnalysisSequence.py b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/PhotonAnalysisSequence.py
index 9c9826c5cd9d50164b8bb753c94135be5c7d000e..b9da8fa196c474b7a218f26e442adc803a657ce9 100644
--- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/PhotonAnalysisSequence.py
+++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/PhotonAnalysisSequence.py
@@ -146,6 +146,7 @@ def makePhotonAnalysisSequence( dataType, workingPoint,
         alg.isolationCorrectionTool.IsMC = 1
         pass
     seq.append( alg, inputPropName = 'egammas', outputPropName = 'egammasOut',
+                affectingSystematics = '(^PH_Iso_.*)',
                 stageName = 'selection' )
 
     # Set up the isolation selection algorithm:
@@ -165,11 +166,9 @@ def makePhotonAnalysisSequence( dataType, workingPoint,
     addPrivateTool( alg, 'efficiencyCorrectionTool',
                     'AsgPhotonEfficiencyCorrectionTool' )
     alg.scaleFactorDecoration = 'effSF' + postfix
-    alg.efficiencyCorrectionTool.MapFilePath = \
-        'PhotonEfficiencyCorrection/2015_2017/rel21.2/Winter2018_Prerec_v1/map0.txt'
     if dataType == 'afii':
         alg.efficiencyCorrectionTool.ForceDataType = \
-          PATCore.ParticleDataType.Fast
+          PATCore.ParticleDataType.Full  # no AFII ID SFs for now
     elif dataType == 'mc':
         alg.efficiencyCorrectionTool.ForceDataType = \
           PATCore.ParticleDataType.Full
diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_eljob.py b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_eljob.py
index bbf680455ce301c37cc9a1900daa50095b940a88..d4d268597b2e9545437c87a350a68b0eb2bcf524 100755
--- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_eljob.py
+++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_eljob.py
@@ -57,7 +57,7 @@ job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 )
 
 from EgammaAnalysisAlgorithms.EgammaAnalysisAlgorithmsTest import makeSequence
 algSeq = makeSequence (dataType)
-print algSeq # For debugging
+print (algSeq) # For debugging
 for alg in algSeq :
     job.algsAdd( alg )
     pass
diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_jobOptions.py
index a3124542462fc69bae67417dc84bcfd103872c54..8f04fdf374a02166b5ab6d60f0e262e65c0fe4d9 100644
--- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_jobOptions.py
+++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/share/EgammaAnalysisAlgorithmsTest_jobOptions.py
@@ -22,7 +22,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA',
              "afii": 'ASG_TEST_FILE_MC_AFII'}
 
 # Set up the reading of the input file:
-import AthenaRootComps.ReadAthenaxAODHybrid
+import AthenaPoolCnvSvc.ReadAthenaPool
 theApp.EvtMax = 500
 testFile = os.getenv ( inputfile[dataType] )
 svcMgr.EventSelector.InputCollections = [testFile]
diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisSequence.py b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisSequence.py
index d37732da0a3a7f206e6e85cda3704960e4cf1886..bcde16d17fe49ced497ba64e697ea8822fe23c53 100644
--- a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisSequence.py
+++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisSequence.py
@@ -5,7 +5,7 @@ from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool
 
 def makeFTagAnalysisSequence( seq, dataType, jetCollection,
                               btagWP = "FixedCutBEff_77",
-                              btagger = "MV2c10",
+                              btagger = "DL1r",
                               postfix = "",
                               preselection=None,
                               kinematicSelection = False,
@@ -46,14 +46,12 @@ def makeFTagAnalysisSequence( seq, dataType, jetCollection,
     if legacyRecommendations:
         # Remove b-tagging calibration from the container name
         btIndex = jetCollection.find('_BTagging')
-        if btIndex != -1:
-            jetCollection = jetCollection[:btIndex]
+        if btIndex == -1:
+            jetCollection += '_BTagging201903'
 
-        # CDI file
-        # https://twiki.cern.ch/twiki/bin/view/AtlasProtected/BTagCalibrationRecommendationsRelease21
-        bTagCalibFile = "xAODBTaggingEfficiency/13TeV/2017-21-13TeV-MC16-CDI-2019-07-30_v1.root"
-    else:
-        bTagCalibFile = "xAODBTaggingEfficiency/13TeV/2020-21-13TeV-MC16-CDI-2020-03-11_Sh228_v3.root"
+    # CDI file
+    # https://twiki.cern.ch/twiki/bin/view/AtlasProtected/BTagCalibrationRecommendationsRelease21
+    bTagCalibFile = "xAODBTaggingEfficiency/13TeV/2020-21-13TeV-MC16-CDI-2020-03-11_Sh228_v3.root"
 
     # # Create the analysis algorithm sequence object:
     # seq = AnaAlgSequence( "FTagAnalysisSequence" )
diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_eljob.py b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_eljob.py
index 88fa5e90944501caddf663f369d0d09ef3293f1b..de0ab5b219d0c55eac2eeb1786dcd3491caab3fd 100755
--- a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_eljob.py
+++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_eljob.py
@@ -24,11 +24,6 @@ parser.add_option( '-u', '--unit-test', dest='unit_test',
 import ROOT
 ROOT.xAOD.Init().ignore()
 
-# this forces the jet algorithms dictionary to be loaded before
-# anything else, which works around some strange dictionary issues I
-# don't understand.
-ROOT.CP.JetCalibrationAlg ("dummy", None)
-
 # ideally we'd run over all of them, but we don't have a mechanism to
 # configure per-sample right now
 
diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_jobOptions.py
index d776511c9ce836af6904492b3a9ead502ac8774d..e6f6f0aeca8eed87cc251bb3d19921291b20ec50 100644
--- a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_jobOptions.py
+++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/share/FTagAnalysisAlgorithmsTest_jobOptions.py
@@ -22,7 +22,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA',
              "afii": 'ASG_TEST_FILE_MC_AFII'}
 
 # Set up the reading of the input file:
-import AthenaRootComps.ReadAthenaxAODHybrid
+import AthenaPoolCnvSvc.ReadAthenaPool
 theApp.EvtMax = 500
 testFile = os.getenv ( inputfile[dataType] )
 svcMgr.EventSelector.InputCollections = [testFile]
diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py
index 5dae4f300888839fc01a6e0268a3b097dfb5ceca..067fbc6631489b4827c56c9a3068f72c48abac1c 100644
--- a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py
+++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py
@@ -161,9 +161,9 @@ def makeJetAnalysisSequence( dataType, jetCollection, postfix = '',
 
 def makeSmallRJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollection,
                                    jetInput, postfix = '', 
-                                   runJvtUpdate = True, runFJvtUpdate = True,
-                                   runJvtSelection = True, runFJvtSelection = True,
-                                   runJvtEfficiency = True, runFJvtEfficiency = True,
+                                   runJvtUpdate = False, runFJvtUpdate = False,
+                                   runJvtSelection = True, runFJvtSelection = False,
+                                   runJvtEfficiency = True, runFJvtEfficiency = False,
                                    reduction = "Global", JEROption = "Simple"):
     """Add algorithms for the R=0.4 jets.
 
@@ -240,6 +240,7 @@ def makeSmallRJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollect
     if runJvtUpdate :
         alg = createAlgorithm( 'CP::JvtUpdateAlg', 'JvtUpdateAlg'+postfix )
         addPrivateTool( alg, 'jvtTool', 'JetVertexTaggerTool' )
+        alg.jvtTool.JetContainer = jetCollection
         seq.append( alg, inputPropName = 'jets', outputPropName = 'jetsOut', stageName = 'selection' )
 
     if runFJvtUpdate :
@@ -266,6 +267,7 @@ def makeSmallRJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollect
             alg.efficiencyTool.SFFile = 'JetJvtEfficiency/Moriond2018/JvtSFFile_EMTopoJets.root'
             alg.efficiencyTool.MaxPtForJvt = 120e3
         alg.efficiencyTool.WorkingPoint = 'Tight' if jetInput == 'EMPFlow' else 'Medium'
+        alg.truthJetCollection = 'AntiKt4TruthDressedWZJets'
         alg.selection = 'jvt_selection'
         alg.scaleFactorDecoration = 'jvt_effSF_%SYS%'
         alg.scaleFactorDecorationRegex = jvtSysts
@@ -285,6 +287,7 @@ def makeSmallRJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollect
         addPrivateTool( alg, 'efficiencyTool', 'CP::JetJvtEfficiency' )
         alg.efficiencyTool.SFFile = 'JetJvtEfficiency/Moriond2018/fJvtSFFile.root'
         alg.efficiencyTool.WorkingPoint = 'Tight'
+        alg.truthJetCollection = 'AntiKt4TruthDressedWZJets'
         alg.dofJVT = True
         alg.fJVTStatus = 'passFJVT,as_char'
         alg.selection = 'fjvt_selection'
diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetJvtAnalysisSequence.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetJvtAnalysisSequence.py
index 8ebee22a2ab30f3bd48b25d641f3792a9ca7dcc7..17f5dda46dcfa955326924f86ef360be85d8d5b2 100644
--- a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetJvtAnalysisSequence.py
+++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetJvtAnalysisSequence.py
@@ -6,7 +6,7 @@ from AnaAlgorithm.DualUseConfig import createAlgorithm
 
 def makeJetJvtAnalysisSequence( dataType, jetCollection,
                                 preselection = '',
-                                disableFJvt = False,
+                                enableFJvt = False,
                                 globalSF = True,
                                 runSelection = True,
                                 enableCutflow = False ):
@@ -15,7 +15,7 @@ def makeJetJvtAnalysisSequence( dataType, jetCollection,
     Keyword arguments:
       dataType -- The data type to run on ("data", "mc" or "afii")
       jetCollection -- The jet container to run on
-      disableFJvt -- Whether to disable forward JVT calculations
+      enableFJvt -- Whether to enable forward JVT calculations
       globalSF -- Whether to calculate per event scale factors
       runSelection -- Whether to run selection
       enableCutflow -- Whether or not to dump the cutflow
@@ -37,7 +37,7 @@ def makeJetJvtAnalysisSequence( dataType, jetCollection,
 
     # Set up the per-event jet efficiency scale factor calculation algorithm
     if dataType != 'data' and globalSF:
-        from JetAnalysisSequence import jvtSysts, fjvtSysts
+        from .JetAnalysisSequence import jvtSysts, fjvtSysts
 
         alg = createAlgorithm( 'CP::AsgEventScaleFactorAlg', 'JvtEventScaleFactorAlg' )
         alg.preselection = preselection + '&&no_jvt' if preselection else 'no_jvt'
@@ -50,7 +50,7 @@ def makeJetJvtAnalysisSequence( dataType, jetCollection,
                     inputPropName = { 'jets' : 'particles',
                                       'eventInfo' : 'eventInfo' } )
 
-        if not disableFJvt:
+        if enableFJvt:
             alg = createAlgorithm( 'CP::AsgEventScaleFactorAlg', 'ForwardJvtEventScaleFactorAlg' )
             alg.preselection = preselection + '&&no_fjvt' if preselection else 'no_fjvt'
             alg.scaleFactorInputDecoration = 'fjvt_effSF_%SYS%'
@@ -66,7 +66,7 @@ def makeJetJvtAnalysisSequence( dataType, jetCollection,
         cutlist.append('jvt_selection')
         cutlength.append(1)
 
-        if not disableFJvt:
+        if enableFJvt:
             cutlist.append('fjvt_selection')
             cutlength.append(1)
 
diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_eljob.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_eljob.py
index 235132a94ae57cba540028959bd13e6fde8f0638..768ae197a9d900dc462e352195e414065bd52bca 100755
--- a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_eljob.py
+++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_eljob.py
@@ -24,11 +24,6 @@ parser.add_option( '-u', '--unit-test', dest='unit_test',
 import ROOT
 ROOT.xAOD.Init().ignore()
 
-# this forces the jet algorithms dictionary to be loaded before
-# anything else, which works around some strange dictionary issues I
-# don't understand.
-ROOT.CP.JetCalibrationAlg ("dummy", None)
-
 # ideally we'd run over all of them, but we don't have a mechanism to
 # configure per-sample right now
 
diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py
index aaaa35b50e71246da7cecd99244f33dc529cf5b8..f1a8f48865b2a47cb47d76ceb6541911767d0876 100644
--- a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py
+++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_EMTopo_jobOptions.py
@@ -24,7 +24,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA',
 jetContainer = "AntiKt4EMTopoJets"
 
 # Set up the reading of the input file:
-import AthenaRootComps.ReadAthenaxAODHybrid
+import AthenaPoolCnvSvc.ReadAthenaPool
 theApp.EvtMax = 500
 testFile = os.getenv ( inputfile[dataType] )
 svcMgr.EventSelector.InputCollections = [testFile]
diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_eljob.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_eljob.py
index 3d1660911813dade2fa8ac48ad87a5ad87386338..d51cbab9119323bd67961074e3756e0166391dfa 100755
--- a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_eljob.py
+++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_eljob.py
@@ -24,11 +24,6 @@ parser.add_option( '-u', '--unit-test', dest='unit_test',
 import ROOT
 ROOT.xAOD.Init().ignore()
 
-# this forces the jet algorithms dictionary to be loaded before
-# anything else, which works around some strange dictionary issues I
-# don't understand.
-ROOT.CP.JetCalibrationAlg ("dummy", None)
-
 # ideally we'd run over all of them, but we don't have a mechanism to
 # configure per-sample right now
 
diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py
index 3ad9c2a04f1a72d51511a256cfbb6b496166b731..de9ba9c438964bea1c539784e1bc42b0cee36ce8 100644
--- a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py
+++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/share/JetAnalysisAlgorithmsTest_PFlow_jobOptions.py
@@ -24,7 +24,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA',
 jetContainer = "AntiKt4EMTopoJets"
 
 # Set up the reading of the input file:
-import AthenaRootComps.ReadAthenaxAODHybrid
+import AthenaPoolCnvSvc.ReadAthenaPool
 theApp.EvtMax = 500
 testFile = os.getenv ( inputfile[dataType] )
 svcMgr.EventSelector.InputCollections = [testFile]
diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithmsDict.h
index 751f56e8171afc57f916267267c5cc3ffb60dc2f..06f150d36f6feea8d8b4e33c9b5c5fd5bf959d01 100644
--- a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithmsDict.h
+++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithmsDict.h
@@ -11,6 +11,5 @@
 #include <MetAnalysisAlgorithms/MetBuilderAlg.h>
 #include <MetAnalysisAlgorithms/MetMakerAlg.h>
 #include <MetAnalysisAlgorithms/MetSignificanceAlg.h>
-#include <MetAnalysisAlgorithms/MetSystematicsAlg.h>
 
 #endif
diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetMakerAlg.h b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetMakerAlg.h
index da7cab77319412a73a3100b56b4b5b4f7a43882d..7bf2b28ef695af5a800f2f5625e25439f53a99d0 100644
--- a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetMakerAlg.h
+++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetMakerAlg.h
@@ -14,6 +14,7 @@
 #include <SystematicsHandles/SysWriteHandle.h>
 #include <SystematicsHandles/SysListHandle.h>
 #include <METInterface/IMETMaker.h>
+#include <METInterface/IMETSystematicsTool.h>
 
 #include <xAODBase/IParticleContainer.h>
 #include <xAODMissingET/MissingETContainer.h>
@@ -47,10 +48,14 @@ namespace CP
     
 
 
-    /// \brief the smearing tool
+    /// \brief the maker tool
   private:
     ToolHandle<IMETMaker> m_makerTool;
 
+    /// \brief the systematics tool
+  private:
+    ToolHandle<IMETSystematicsTool> m_systematicsTool;
+
     /// \brief the name of the core MissingETContainer
   private:
     std::string m_metCoreName;
diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetSystematicsAlg.h b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetSystematicsAlg.h
deleted file mode 100644
index cba1d161ef4467072008872141b653956d32489b..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/MetSystematicsAlg.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-*/
-
-/// @author Nils Krumnack
-
-
-
-#ifndef MET_ANALYSIS_ALGORITHMS__MET_SYSTEMATICS_ALG_H
-#define MET_ANALYSIS_ALGORITHMS__MET_SYSTEMATICS_ALG_H
-
-#include <AnaAlgorithm/AnaAlgorithm.h>
-#include <SystematicsHandles/SysCopyHandle.h>
-#include <SystematicsHandles/SysListHandle.h>
-#include <METInterface/IMETSystematicsTool.h>
-#include <xAODMissingET/MissingETContainer.h>
-
-namespace CP
-{
-  /// \brief an algorithm for calling \ref IMetCalibrationAndSmearingTool
-
-  class MetSystematicsAlg final : public EL::AnaAlgorithm
-  {
-    /// \brief the standard constructor
-  public:
-    MetSystematicsAlg (const std::string& name, 
-                 ISvcLocator* pSvcLocator);
-
-
-  public:
-    StatusCode initialize () override;
-
-  public:
-    StatusCode execute () override;
-    
-
-
-    /// \brief the smearing tool
-  private:
-    ToolHandle<IMETSystematicsTool> m_systematicsTool;
-
-    /// \brief the systematics list we run
-  private:
-    SysListHandle m_systematicsList {this};
-
-    /// \brief the met collection we run on
-  private:
-    SysCopyHandle<xAOD::MissingETContainer> m_metHandle {
-      this, "met", "MissingET_%SYS%", "the met collection we run on"};
-
-    /// \brief the key for the soft term
-  private:
-    std::string m_softTerm {"PVSoftTrk"};
-  };
-}
-
-#endif
diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/selection.xml
index c83c888c5044aabdc2ad83858b67ec1222229d77..fc4f787b3d677aa2ab605602d5d5a4a0ab11b4c5 100644
--- a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/selection.xml
+++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/MetAnalysisAlgorithms/selection.xml
@@ -3,6 +3,5 @@
    <class name="CP::MetBuilderAlg" />
    <class name="CP::MetMakerAlg" />
    <class name="CP::MetSignificanceAlg" />
-   <class name="CP::MetSystematicsAlg" />
 
 </lcgdict>
diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetMakerAlg.cxx b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetMakerAlg.cxx
index c5e0191f2e24906412c46369447e5436c00ba90f..e6b9c054e30cf7f5953e031ccfb8b32c4052fa1d 100644
--- a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetMakerAlg.cxx
+++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetMakerAlg.cxx
@@ -26,8 +26,10 @@ namespace CP
                      ISvcLocator* pSvcLocator)
     : AnaAlgorithm (name, pSvcLocator)
     , m_makerTool ("METMaker", this)
+    , m_systematicsTool ("", this)
   {
     declareProperty ("makerTool", m_makerTool, "the METMaker tool we apply");
+    declareProperty ("systematicsTool", m_systematicsTool, "the systematics tool we apply");
     declareProperty ("metCore", m_metCoreName, "the name of the core MissingETContainer");
     declareProperty ("metAssociation", m_metAssociationName, "the name of the core MissingETContainer");
     declareProperty ("electronsKey", m_electronsKey, "the key for the electrons");
@@ -46,6 +48,7 @@ namespace CP
   initialize ()
   {
     ANA_CHECK (m_makerTool.retrieve());
+
     for (auto* handle : {&m_electronsHandle, &m_photonsHandle,
                          &m_muonsHandle, &m_tausHandle, &m_invisHandle}) {
       if (*handle) {
@@ -54,6 +57,13 @@ namespace CP
     }
     m_systematicsList.addHandle (m_jetsHandle);
     m_systematicsList.addHandle (m_metHandle);
+
+    if (!m_systematicsTool.empty())
+    {
+      ANA_CHECK (m_systematicsTool.retrieve());
+      ANA_CHECK (m_systematicsList.addAffectingSystematics (m_systematicsTool->affectingSystematics()));
+    }
+
     ANA_CHECK (m_systematicsList.initialize());
 
     return StatusCode::SUCCESS;
@@ -122,6 +132,25 @@ namespace CP
           ANA_CHECK (m_makerTool->rebuildJetMET (m_jetsKey, m_softTermKey, met.get(), jets, metcore, &metHelper, m_doJetJVT));
         }
 
+        // Systematics
+        if (!m_systematicsTool.empty())
+        {
+          ANA_CHECK (m_systematicsTool->applySystematicVariation (sys));
+
+          xAOD::MissingET *softTerm = (*met)[m_softTermKey];
+          if (softTerm == nullptr)
+          {
+            ANA_MSG_ERROR ("failed to find MET soft-term \"" << m_softTermKey << "\"");
+            return StatusCode::FAILURE;
+          }
+
+          // This returns a `CorrectionCode`, so in principle this could
+          // return an `OutOfValidity` result, but I have no idea what
+          // that would mean or how to handle it, so I'm implicitly
+          // converting it into a `FAILURE` instead.
+          ANA_CHECK (m_systematicsTool->applyCorrection (*softTerm, &metHelper));
+        }
+
         ANA_CHECK (m_metHandle.record (std::move (met), std::move (aux), sys));
         return StatusCode::SUCCESS;
       });
diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetSystematicsAlg.cxx b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetSystematicsAlg.cxx
deleted file mode 100644
index 1e255b6581d66bc07cda3bfc34b1b94bc59cff90..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/Root/MetSystematicsAlg.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
-*/
-
-/// @author Nils Krumnack
-
-
-
-//
-// includes
-//
-
-#include <MetAnalysisAlgorithms/MetSystematicsAlg.h>
-
-#include <xAODMissingET/MissingETAuxContainer.h>
-
-//
-// method implementations
-//
-
-namespace CP
-{
-  MetSystematicsAlg ::
-  MetSystematicsAlg (const std::string& name, 
-                     ISvcLocator* pSvcLocator)
-    : AnaAlgorithm (name, pSvcLocator)
-    , m_systematicsTool ("met::METSystematicsTool", this)
-  {
-    declareProperty ("systematicsTool", m_systematicsTool, "the systematics tool we apply");
-    declareProperty ("softTerm", m_softTerm, "the key for the soft term");
-  }
-
-
-
-  StatusCode MetSystematicsAlg ::
-  initialize ()
-  {
-    ANA_CHECK (m_systematicsTool.retrieve());
-    m_systematicsList.addHandle (m_metHandle);
-    ANA_CHECK (m_systematicsList.addAffectingSystematics (m_systematicsTool->affectingSystematics()));
-    ANA_CHECK (m_systematicsList.initialize());
-    return StatusCode::SUCCESS;
-  }
-
-
-
-  StatusCode MetSystematicsAlg ::
-  execute ()
-  {
-    return m_systematicsList.foreach ([&] (const CP::SystematicSet& sys) -> StatusCode {
-        ANA_CHECK (m_systematicsTool->applySystematicVariation (sys));
-
-        xAOD::MissingETContainer *met {};
-        ANA_CHECK (m_metHandle.getCopy (met, sys));
-
-        xAOD::MissingET *softTerm = (*met)[m_softTerm];
-        if (softTerm == nullptr)
-        {
-          ANA_MSG_ERROR ("failed to find MET soft-term \"" << m_softTerm << "\"");
-          return StatusCode::FAILURE;
-        }
-
-        // This returns a `CorrectionCode`, so in principle this could
-        // return an `OutOfValidity` result, but I have no idea what
-        // that would mean or how to handle it, so I'm implicitly
-        // converting it into a `FAILURE` instead.
-        ANA_CHECK (m_systematicsTool->applyCorrection (*softTerm));
-
-        return StatusCode::SUCCESS;
-      });
-  }
-}
diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/python/MetAnalysisSequence.py b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/python/MetAnalysisSequence.py
index a20926c5c835ec62b6471c6ea8c1027b3ebcd6b2..aeb244ea391ac58209941b3226e1de8999871fb8 100644
--- a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/python/MetAnalysisSequence.py
+++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/python/MetAnalysisSequence.py
@@ -6,8 +6,8 @@ from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool
 
 def makeMetAnalysisSequence( dataType, metSuffix,
                              postfix = '',
-                             useFJVT = True,
-                             treatPUJets = True ):
+                             useFJVT = False,
+                             treatPUJets = False ):
     """Create a met analysis algorithm sequence
 
     After creating the sequence object, it needs to be configured with a call
@@ -60,6 +60,8 @@ def makeMetAnalysisSequence( dataType, metSuffix,
     alg.makerTool.DoPFlow = 'PFlow' in metSuffix
     if useFJVT:
         alg.makerTool.JetRejectionDec = 'passFJVT'
+    if dataType != "data" :
+        addPrivateTool( alg, 'systematicsTool', 'met::METSystematicsTool' )
     alg.metCore = 'MET_Core_' + metSuffix
     alg.metAssociation = 'METAssoc_' + metSuffix
     seq.append( alg,
@@ -72,13 +74,6 @@ def makeMetAnalysisSequence( dataType, metSuffix,
                 outputPropName = 'met',
                 affectingSystematics = '(^MET_.*)' )
 
-    if dataType != "data" :
-        alg = createAlgorithm( 'CP::MetSystematicsAlg', 'MetSystematicsAlg' + postfix )
-        addPrivateTool( alg, 'systematicsTool', 'met::METSystematicsTool' )
-        seq.append( alg, inputPropName = 'met',
-                    affectingSystematics = '(^MET_.*)' )
-        pass
-
     # Set up the met builder algorithm:
     alg = createAlgorithm( 'CP::MetBuilderAlg', 'MetBuilderAlg' + postfix )
     seq.append( alg, inputPropName = 'met' )
diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_jobOptions.py
index 0c13735ea0bf6be6cedecbb4fe0f65449ccbe184..6b949c02f98ef5d4e8ce3867b6b27c0b1a990069 100644
--- a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_jobOptions.py
+++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/share/MetAnalysisAlgorithmsTest_jobOptions.py
@@ -22,7 +22,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA',
              "afii": 'ASG_TEST_FILE_MC_AFII'}
 
 # Set up the reading of the input file:
-import AthenaRootComps.ReadAthenaxAODHybrid
+import AthenaPoolCnvSvc.ReadAthenaPool
 theApp.EvtMax = 500
 testFile = os.getenv ( inputfile[dataType] )
 svcMgr.EventSelector.InputCollections = [testFile]
diff --git a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/src/components/MetAnalysisAlgorithms_entries.cxx b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/src/components/MetAnalysisAlgorithms_entries.cxx
index 7e058bc2cb473822da377afd10e96924bca6bde5..566a3a6924a2759e414fcfaab3b985793242f99b 100644
--- a/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/src/components/MetAnalysisAlgorithms_entries.cxx
+++ b/PhysicsAnalysis/Algorithms/MetAnalysisAlgorithms/src/components/MetAnalysisAlgorithms_entries.cxx
@@ -3,10 +3,8 @@
 #include <MetAnalysisAlgorithms/MetBuilderAlg.h>
 #include <MetAnalysisAlgorithms/MetMakerAlg.h>
 #include <MetAnalysisAlgorithms/MetSignificanceAlg.h>
-#include <MetAnalysisAlgorithms/MetSystematicsAlg.h>
 
 DECLARE_COMPONENT (CP::MetBuilderAlg)
 DECLARE_COMPONENT (CP::MetMakerAlg)
 DECLARE_COMPONENT (CP::MetSignificanceAlg)
-DECLARE_COMPONENT (CP::MetSystematicsAlg)
 
diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_jobOptions.py
index 1bf25efdc24a8a4d28f77962420cbaf068d9f68c..de5537baa5464ee125893eb254d3bebd9d35e804 100644
--- a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_jobOptions.py
+++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/share/MuonAnalysisAlgorithmsTest_jobOptions.py
@@ -1,47 +1,31 @@
-# 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 Nils Krumnack, Will Buttinger
+# @author Nils Krumnack
 
-#User options, which can be set from command line after a "-" character
-#athena MuonAnalysisAlgorithmsTest_jobOptions.py - --myOption ...
+# User options, which can be set from command line after a "-" character
+# athena MuonAnalysisAlgorithmsTest_jobOptions.py - --myOption ...
 from AthenaCommon.AthArgumentParser import AthArgumentParser
 athArgsParser = AthArgumentParser()
-athArgsParser.add_argument("--data-type",action="store",dest="data_type",
-                           default="data",
-                           help="Type of data to run over. Valid options are data, mc, afii")
-athArgsParser.add_argument("--write-xaod",action="store",dest="write_xaod",
-                           default=False,
-                           help="Specify if you want xaod writing to happen (which means slower access mode for now)")
+athArgsParser.add_argument("--data-type", action = "store", dest = "data_type",
+                           default = "data",
+                           help = "Type of input to run over. Valid options are 'data', 'mc', 'afii'")
 athArgs = athArgsParser.parse_args()
 
-
-if athArgs.write_xaod:
-    #currently we must use POOLAccess mode when writing an xAOD
-    jps.AthenaCommonFlags.AccessMode = "POOLAccess"
-else:
-    #ClassAccess is much faster than POOLAccess
-    jps.AthenaCommonFlags.AccessMode = "ClassAccess"
-
 dataType = athArgs.data_type
+if not dataType in ["data", "mc", "afii"] :
+    raise Exception ("invalid data type: " + dataType)
 
-# Set up a histogram/tree output file for the job:
-jps.AthenaCommonFlags.HistOutputs = ["ANALYSIS:MuonAnalysisAlgorithmsTest." + dataType + ".hist.root"]
-svcMgr.THistSvc.MaxFileSize=-1 #make job run faster by disabling file size check
-
-#set a default file and number of events to process
-#can override with standard athena command line options (--evtMax and --filesInput)
-jps.AthenaCommonFlags.EvtMax = 500
-
-if dataType=="data":
-    testFile = os.getenv ('ASG_TEST_FILE_DATA')
-elif dataType=="mc":
-    testFile = os.getenv ('ASG_TEST_FILE_MC')
-elif dataType=="afii":
-    testFile = os.getenv ('ASG_TEST_FILE_MC_AFII')
-
-jps.AthenaCommonFlags.FilesInput = [testFile]
+print("Running on data type: " + dataType)
 
+inputfile = {"data": 'ASG_TEST_FILE_DATA',
+             "mc":   'ASG_TEST_FILE_MC',
+             "afii": 'ASG_TEST_FILE_MC_AFII'}
 
+# Set up the reading of the input file:
+import AthenaPoolCnvSvc.ReadAthenaPool
+theApp.EvtMax = 500
+testFile = os.getenv ( inputfile[dataType] )
+svcMgr.EventSelector.InputCollections = [testFile]
 
 from MuonAnalysisAlgorithms.MuonAnalysisAlgorithmsTest import makeSequence
 algSeq = makeSequence (dataType)
@@ -50,17 +34,11 @@ print (algSeq) # For debugging
 # Add all algorithms from the sequence to the job.
 athAlgSeq += algSeq
 
-# Write a mini-xAOD if requested:
-if athArgs.write_xaod:
-    from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
-    minixAOD = MSMgr.NewPoolRootStream( 'AAOD_MUON',
-                   FileName = 'MuonAnalysisAlgorithmsTest.AAOD_MUON.pool.root' )
-    minixAOD.AddItem(
-        [ 'xAOD::EventInfo#EventInfo',
-     'xAOD::EventAuxInfo#EventInfoAux.-',
-     'xAOD::MuonContainer#AnalysisMuons_NOSYS',
-     'xAOD::AuxContainerBase#AnalysisMuons_NOSYSAux.eta.phi.pt' ] )
-
+# Set up a histogram output file for the job:
+ServiceMgr += CfgMgr.THistSvc()
+ServiceMgr.THistSvc.Output += [
+    "ANALYSIS DATAFILE='MuonAnalysisAlgorithmsTest." + dataType + ".hist.root' OPT='RECREATE'"
+    ]
 
 # Reduce the printout from Athena:
 include( "AthAnalysisBaseComps/SuppressLogging.py" )
diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/CMakeLists.txt b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/CMakeLists.txt
index f9e3e98448df02cc3ba627edec40730950e01cc7..58a12d090108bc15595babf16edc57143954dd63 100644
--- a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/CMakeLists.txt
+++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/CMakeLists.txt
@@ -29,27 +29,28 @@ atlas_install_joboptions( share/*_jobOptions.py )
 atlas_install_scripts( share/*_eljob.py )
 atlas_install_data( data/*.conf )
 
-if( XAOD_STANDALONE )
-   atlas_add_test( testJobData
-      SCRIPT TauAnalysisAlgorithmsTest_eljob.py --data-type data --unit-test
-      PROPERTIES TIMEOUT 600 )
-   # atlas_add_test( testJobFullSim    #testJobFullSim and testJobFastSim are temporarily removed awaiting TauTruthMatchigToolMigration (ATLASG-1548) 
-   #    SCRIPT TauAnalysisAlgorithmsTest_eljob.py --data-type mc --unit-test
-   #    PROPERTIES TIMEOUT 600 )
-   # atlas_add_test( testJobFastSim
-   #    SCRIPT TauAnalysisAlgorithmsTest_eljob.py --data-type afii --unit-test
-   #    PROPERTIES TIMEOUT 600 )
-else()
-   atlas_add_test( testJobData
-      SCRIPT athena.py
-      TauAnalysisAlgorithms/TauAnalysisAlgorithmsTest_jobOptions.py - --data-type data
-      PROPERTIES TIMEOUT 600 )
-   atlas_add_test( testJobFullSim
-      SCRIPT athena.py
-      TauAnalysisAlgorithms/TauAnalysisAlgorithmsTest_jobOptions.py - --data-type mc
-      PROPERTIES TIMEOUT 600 )
-   atlas_add_test( testJobFastSim
-      SCRIPT athena.py
-      TauAnalysisAlgorithms/TauAnalysisAlgorithmsTest_jobOptions.py - --data-type afii
-      PROPERTIES TIMEOUT 600 )
-endif()
+# Temporarily disabled
+# if( XAOD_STANDALONE )
+#    atlas_add_test( testJobData
+#       SCRIPT TauAnalysisAlgorithmsTest_eljob.py --data-type data --unit-test
+#       PROPERTIES TIMEOUT 600 )
+#    atlas_add_test( testJobFullSim
+#       SCRIPT TauAnalysisAlgorithmsTest_eljob.py --data-type mc --unit-test
+#       PROPERTIES TIMEOUT 600 )
+#    atlas_add_test( testJobFastSim
+#       SCRIPT TauAnalysisAlgorithmsTest_eljob.py --data-type afii --unit-test
+#       PROPERTIES TIMEOUT 600 )
+# else()
+#    atlas_add_test( testJobData
+#       SCRIPT athena.py
+#       TauAnalysisAlgorithms/TauAnalysisAlgorithmsTest_jobOptions.py - --data-type data
+#       PROPERTIES TIMEOUT 600 )
+#    atlas_add_test( testJobFullSim
+#       SCRIPT athena.py
+#       TauAnalysisAlgorithms/TauAnalysisAlgorithmsTest_jobOptions.py - --data-type mc
+#       PROPERTIES TIMEOUT 600 )
+#    atlas_add_test( testJobFastSim
+#       SCRIPT athena.py
+#       TauAnalysisAlgorithms/TauAnalysisAlgorithmsTest_jobOptions.py - --data-type afii
+#       PROPERTIES TIMEOUT 600 )
+# endif()
diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_jobOptions.py
index a83dc7c63755f389daeeb51e20156201bb3e1ad5..d15a7339611f865c7c1bf3aadb46c652e8638ac8 100644
--- a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_jobOptions.py
+++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/share/TauAnalysisAlgorithmsTest_jobOptions.py
@@ -22,7 +22,7 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA',
              "afii": 'ASG_TEST_FILE_MC_AFII'}
 
 # Set up the reading of the input file:
-import AthenaRootComps.ReadAthenaxAODHybrid
+import AthenaPoolCnvSvc.ReadAthenaPool
 theApp.EvtMax = 500
 testFile = os.getenv ( inputfile[dataType] )
 svcMgr.EventSelector.InputCollections = [testFile]
diff --git a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_jobOptions.py b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_jobOptions.py
index 8bd9e31e5eb4b798448388462af016c6fe7bc6d3..3a0ab8d7e39fb1aa66a71bfecc7aac6f63815dcc 100644
--- a/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_jobOptions.py
+++ b/PhysicsAnalysis/Algorithms/TriggerAnalysisAlgorithms/share/TriggerAlgorithmsTest_jobOptions.py
@@ -22,11 +22,15 @@ inputfile = {"data": 'ASG_TEST_FILE_DATA',
              "afii": 'ASG_TEST_FILE_MC_AFII'}
 
 # Set up the reading of the input file:
-import AthenaRootComps.ReadAthenaxAODHybrid
+import AthenaPoolCnvSvc.ReadAthenaPool
 theApp.EvtMax = 500
 testFile = os.getenv ( inputfile[dataType] )
 svcMgr.EventSelector.InputCollections = [testFile]
 
+# Needed for filtering, Athena only for now
+from EventBookkeeperTools.CutFlowHelpers import CreateCutFlowSvc
+CreateCutFlowSvc(svcName="CutFlowSvc", seq=athAlgSeq, addMetaDataToAllOutputFiles=False)
+
 from TriggerAnalysisAlgorithms.TriggerAnalysisAlgorithmsTest import makeSequence
 algSeq = makeSequence (dataType)
 print (algSeq) # For debugging
diff --git a/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingAlg.cxx b/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingAlg.cxx
index f5ad85275d7fda499fa4e9ee13f2a4490c6a552c..d6d72da87982a4abb8a35dd320160e5c23f6f5d5 100644
--- a/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingAlg.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingAlg.cxx
@@ -14,7 +14,6 @@
 
 // FrameWork includes
 #include "Gaudi/Property.h"
-#include "GaudiKernel/IJobOptionsSvc.h"
 #include "DerivationFrameworkInterfaces/IAugmentationTool.h"
 
 ///////////////////////////////////////////////////////////////////
@@ -101,22 +100,22 @@ StatusCode ParticleSortingAlg::initialize()
   if (m_setInCollKey) {
     ATH_MSG_DEBUG( "Setting property" << m_inCollKey
                    << " of private tool with name: '" << fullToolName << "'" );
-    ATH_CHECK( m_jos->addPropertyToCatalogue (fullToolName,m_inCollKey) );
+    m_jos->set (fullToolName + "." + m_inCollKey.name(), m_inCollKey.toString());
   }
   if (m_setOutCollKey) {
     ATH_MSG_DEBUG( "Setting property" << m_outCollKey
                    << " of private tool with name: '" << fullToolName << "'" );
-    ATH_CHECK( m_jos->addPropertyToCatalogue (fullToolName,m_outCollKey) );
+    m_jos->set (fullToolName + "." + m_outCollKey.name(), m_outCollKey.toString());
   }
   if (m_setSortVar) {
     ATH_MSG_DEBUG( "Setting property" << m_sortVar
                    << " of private tool with name: '" << fullToolName << "'" );
-    ATH_CHECK( m_jos->addPropertyToCatalogue (fullToolName,m_sortVar) );
+    m_jos->set (fullToolName + "." + m_sortVar.name(), m_sortVar.toString());
   }
   if (m_setSortDescending) {
     ATH_MSG_DEBUG( "Setting property" << m_sortDescending
                    << " of private tool with name: '" << fullToolName << "'" );
-    ATH_CHECK( m_jos->addPropertyToCatalogue (fullToolName,m_sortDescending) );
+    m_jos->set (fullToolName + "." + m_sortDescending.name(),  m_sortDescending.toString());
   }
   ATH_MSG_DEBUG( "Done setting properties of the tool");
 
diff --git a/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingAlg.h b/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingAlg.h
index 763f04c952cab1305f4467bf3595943579326178..dd83b6bd8df2b55be88f0a6b689eb63cba482585 100644
--- a/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingAlg.h
+++ b/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingAlg.h
@@ -12,6 +12,7 @@
 #define EVENTUTILS_PARTICLESORTINGALG_H 1
 
 // FrameWork includes
+#include "Gaudi/Interfaces/IOptionsSvc.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "AthenaBaseComps/AthAlgorithm.h"
@@ -20,7 +21,6 @@
 #include <string>
 
 // Forward declarations
-class IJobOptionsSvc;
 namespace DerivationFramework {
   class IAugmentationTool;
 }
@@ -43,13 +43,13 @@ class ParticleSortingAlg
   virtual ~ParticleSortingAlg();
 
   /// Athena algorithm's initalize hook
-  virtual StatusCode  initialize();
+  virtual StatusCode initialize() override;
 
   /// Athena algorithm's execute hook
-  virtual StatusCode  execute();
+  virtual StatusCode execute() override;
 
   /// Athena algorithm's finalize hook
-  virtual StatusCode  finalize();
+  virtual StatusCode finalize() override;
 
 
 private:
@@ -75,7 +75,7 @@ private:
  private:
   /// The job options service (will be used to forward this algs properties to
   /// the private tool)
-  ServiceHandle<IJobOptionsSvc> m_jos;
+  ServiceHandle<Gaudi::Interfaces::IOptionsSvc> m_jos;
 
   /// The ToolHandle to the private ParticleSortingTool
   ToolHandle<DerivationFramework::IAugmentationTool> m_tool;
diff --git a/PhysicsAnalysis/D2PDMaker/src/D2PDParticleCombiner.cxx b/PhysicsAnalysis/D2PDMaker/src/D2PDParticleCombiner.cxx
index b4cab570b04eadde6f9613d34c41ed57a85abd26..a4425d30e16d8cce5239197b91c0bd04dba1e014 100644
--- a/PhysicsAnalysis/D2PDMaker/src/D2PDParticleCombiner.cxx
+++ b/PhysicsAnalysis/D2PDMaker/src/D2PDParticleCombiner.cxx
@@ -1385,13 +1385,13 @@ bool D2PDParticleCombiner::mcTruthSelections( const CompositeParticle* compPart
     {
       // Get the GenParticle from the TruthParticle
       const TruthParticle* part = (*partItr);
-      const HepMC::GenParticle* genPart = part->genParticle();
+      auto genPart = part->genParticle();
       const int pdgID = genPart->pdg_id();
       
       // Now, get the origin of this generated particle
       McEventCollection::const_iterator mcEventItr = m_mcEventColl->begin();
-      const int primaryBarcode = genPart->barcode()%1000000;
-      const HepMC::GenParticle* primaryPart = (*mcEventItr)->barcode_to_particle(primaryBarcode);
+      const int primaryBarcode = HepMC::barcode(genPart)%1000000;
+      auto primaryPart = HepMC::barcode_to_particle((*mcEventItr),primaryBarcode);
 
       // Check that we really have the primaryPart
       if ( !primaryPart )
@@ -1401,7 +1401,7 @@ bool D2PDParticleCombiner::mcTruthSelections( const CompositeParticle* compPart
         }
 
       // Now get the production vertex
-      const HepMC::GenVertex*  prodVert = primaryPart->production_vertex();
+      auto  prodVert = primaryPart->production_vertex();
       if ( !prodVert )
         {
           ATH_MSG_WARNING ( "Could not get the ProductionVertex... skipping!" );
@@ -1409,7 +1409,11 @@ bool D2PDParticleCombiner::mcTruthSelections( const CompositeParticle* compPart
         }
 
       // Check that we have only one mother
+#ifdef HEPMC3
+      if ( prodVert->particles_in().size() > 1 )
+#else
       if ( prodVert->particles_in_size() > 1 )
+#endif
         {
           ATH_MSG_WARNING ( "The ProductionVertex has more than one incomming particles... skipping!" );
           return true;
@@ -1418,21 +1422,24 @@ bool D2PDParticleCombiner::mcTruthSelections( const CompositeParticle* compPart
 
       // Loop over the mother particles
       // Make sure that we ignore bremsstrahlung and decays into itself
-      const HepMC::GenVertex* originVert = prodVert ;
-      //const HepMC::GenVertex* tmpVert(0);
+      auto originVert = prodVert;
       int originPdgID = pdgID;
       int originBarcode(0);
       int counter(0);
       do
         {
           ++counter;
+#ifdef HEPMC3
+          for ( auto mother: originVert->particles_in()) {
+#else
           HepMC::GenVertex::particles_in_const_iterator motherItr    = originVert->particles_in_const_begin();
           HepMC::GenVertex::particles_in_const_iterator motherItrEnd = originVert->particles_in_const_end();
-          for ( ; motherItr != motherItrEnd; ++motherItr )
-            {	     
-              originPdgID   = (*motherItr)->pdg_id();
-              originVert    = (*motherItr)->production_vertex();
-              originBarcode = (*motherItr)->barcode();
+          for ( ; motherItr != motherItrEnd; ++motherItr ) {
+              auto mother=*motherItr;
+#endif
+              originPdgID   = mother->pdg_id();
+              originVert    = mother->production_vertex();
+              originBarcode = HepMC::barcode(mother);
             }
 
           // Protect against infinite loop
@@ -1441,7 +1448,7 @@ bool D2PDParticleCombiner::mcTruthSelections( const CompositeParticle* compPart
               ATH_MSG_WARNING ( "Stuck in an infinite while loop... breaking out!" );
               break;
             }
-        } while ( abs(originPdgID) == abs(pdgID) && originVert != 0 );
+        } while ( std::abs(originPdgID) == std::abs(pdgID) && originVert );
 
       // Attach the PDG_ID and barcode of the origin particle to the vectors
       pdgIDList.push_back( originPdgID );
diff --git a/PhysicsAnalysis/D2PDMaker/src/D2PDTruthParticleSelector.cxx b/PhysicsAnalysis/D2PDMaker/src/D2PDTruthParticleSelector.cxx
index e9649d21776517d8546bfbd6759788130cd8a84b..1e655dc0d91747c5fc31d9957c8945ccd0608287 100644
--- a/PhysicsAnalysis/D2PDMaker/src/D2PDTruthParticleSelector.cxx
+++ b/PhysicsAnalysis/D2PDMaker/src/D2PDTruthParticleSelector.cxx
@@ -297,14 +297,11 @@ StatusCode D2PDTruthParticleSelector::processObject( const TruthParticle* part,
           if( genPart->end_vertex() )
             {
               int barcode = HepMC::barcode(genPart);
-              auto childItrBegin =    genPart->end_vertex()->particles_begin(HepMC::children);
-              auto childItrEnd = genPart->end_vertex()->particles_end(HepMC::children);
-              for (auto childItr=childItrBegin; childItr!=childItrEnd; ++childItr )
+              for (auto child: *(genPart->end_vertex()))
                 {
-                  auto child = (*childItr);
                   if( child->pdg_id() == pdgID
-                      && child->barcode() != barcode
-                      && child->barcode() < 200000 )
+                      && HepMC::barcode(child) != barcode
+                      && HepMC::barcode(child) < 200000 )
                     {
                       isPassed = false;
                     }
@@ -605,17 +602,14 @@ bool D2PDTruthParticleSelector::getDaughters( HepMC::ConstGenParticlePtr genPart
   if( genPart->end_vertex() )
     {
       int pdgID   = genPart->pdg_id();
-      int barcode = genPart->barcode();
+      int barcode = HepMC::barcode(genPart);
 
       // Loop over all children
-      auto childItrBegin = genPart->end_vertex()->particles_begin(HepMC::children);
-      auto  childItrEnd = genPart->end_vertex()->particles_end(HepMC::children);
-      for (auto childItr=childItrBegin; childItr != childItrEnd; ++childItr )
+      for (auto child: *(genPart->end_vertex()))
         {
-          auto child = (*childItr);
           if( child->pdg_id() == pdgID
-              && child->barcode() != barcode
-              && child->barcode() < 200000 )
+              && HepMC::barcode(child) != barcode
+              && HepMC::barcode(child) < 200000 )
             {
               return getDaughters( child, daughters );
             }
diff --git a/PhysicsAnalysis/D3PDMaker/D3PDMakerConfig/python/egammaD3PD.py b/PhysicsAnalysis/D3PDMaker/D3PDMakerConfig/python/egammaD3PD.py
index 29bf2a9878c535195860bc009e0cfedcea3d6c2b..4e13f4f8639febd796576bb14c07e11ca2643b5d 100644
--- a/PhysicsAnalysis/D3PDMaker/D3PDMakerConfig/python/egammaD3PD.py
+++ b/PhysicsAnalysis/D3PDMaker/D3PDMakerConfig/python/egammaD3PD.py
@@ -205,18 +205,10 @@ class MergeElectrons (PyAthena.Alg):
         sg.record (enew, 'AllElectrons')
         cfgKeyStore.addTransient ('xAOD::ElectronContainer', 'AllElectrons')
 
-        #e1 = sg['StacoMuonCollection']
-        e1 = sg.retrieve (ROOT.DataVector(ROOT.xAOD.Electron_v1), 'AllElectrons')
-        #if e1.size() > 0:
-        #    reg = ROOT.SG.AuxTypeRegistry.instance()
-        #    auxids = list(e1[0].getAuxIDs())
-        #    auxids = [(reg.getName(id), id) for id in auxids]
-        #    auxids.sort()
-        #    print 'aaa', auxids
-        # if e2.size() > 0:
-        #     acc = ROOT.SG.AuxElement.TypelessConstAccessor ('Loose')
-        #     print 'bbb2', acc.isAvailable(e2[0])
-
+        # Make sure these aux variables are defined at this point.
+        ROOT.xAOD.ElectronAuxContainer()
+        ROOT.xAOD.CaloClusterAuxContainer()
+               
         return StatusCode.Success
         
 
diff --git a/PhysicsAnalysis/D3PDMaker/D3PDMakerConfig/share/AODToEgammaD3PD.py b/PhysicsAnalysis/D3PDMaker/D3PDMakerConfig/share/AODToEgammaD3PD.py
index dfa8e02ffd393d1475db8f6d90137207f9bfb8b0..f573679f8666fcb201473dbfe902a3c052718074 100644
--- a/PhysicsAnalysis/D3PDMaker/D3PDMakerConfig/share/AODToEgammaD3PD.py
+++ b/PhysicsAnalysis/D3PDMaker/D3PDMakerConfig/share/AODToEgammaD3PD.py
@@ -57,6 +57,9 @@ muonRecFlags.doMSVertex.set_Value_and_Lock( False )
 
 #from xAODJetCnv import ParticleJetCompatibility
 
+
+include( "RecExCommon/RecExCommon_topOptions.py" )
+
 # Block loading conditions folders we won't need.
 blocked_folders = [
     '/CALO/Identifier/CaloTTOnAttrIdMapAtlas',
@@ -80,5 +83,3 @@ for f in blocked_folders:
     conddb.blockFolder (f)
 
 
-include( "RecExCommon/RecExCommon_topOptions.py" )
-
diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexFillerTool.cxx
index 453e1dc2558771524b006a1f3ed765c29c23623a..852510d414746aeb4dce117f1185c610c42c1f1a 100644
--- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexFillerTool.cxx
+++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/GenVertexFillerTool.cxx
@@ -67,7 +67,7 @@ StatusCode GenVertexFillerTool::fill (const HepMC::GenVertex& p)
   *m_x = pos.x();
   *m_y = pos.y();
   *m_z = pos.z();
-  *m_barcode = p.barcode();
+  *m_barcode = HepMC::barcode(p);
   if (m_do_id) *m_id = p.id();
 
   return StatusCode::SUCCESS;
diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/JetFullTruthTag.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/JetFullTruthTag.cxx
index 71d853c66ec4ef2e56e9a0c0aaab8e8381f08dc6..3d01e45b521df0ef75ba6329857e424bf0681483 100644
--- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/JetFullTruthTag.cxx
+++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/JetFullTruthTag.cxx
@@ -63,36 +63,35 @@ StatusCode JetFullTruthTag::fill (const Jet& p)
     // We have an McEventCollection
     for (McEventCollection::const_iterator currentGenEventIter = mcCollection->begin();
          currentGenEventIter!=mcCollection->end(); ++currentGenEventIter) {
-      for (HepMC::GenEvent::particle_const_iterator currentGenParticleIter= (*currentGenEventIter)->particles_begin(); 
-           currentGenParticleIter!= (*currentGenEventIter)->particles_end(); ++currentGenParticleIter) {
+      for (auto currentGenParticle: *(*currentGenEventIter)) {
 
         // Grab the PDGID, used both for partons and hadrons
-        pdgid = (*currentGenParticleIter)->pdg_id();
+        pdgid = currentGenParticle->pdg_id();
 
         // Parton labeling section...
-        if((*currentGenParticleIter)->momentum().e()>=Emax && (*currentGenParticleIter)->momentum().perp()>m_min_parton_pt){
-          if( abs(pdgid)<=21 && // Should be a parton
-              abs(pdgid)!=6 && // Should not be a top
-              (abs(pdgid)==15 || abs(pdgid)<=10 || abs(pdgid)>16) && // Not a lepton
-              abs(pdgid)!=0){ // not an unrecognized thingy
+        if(currentGenParticle->momentum().e()>=Emax && currentGenParticle->momentum().perp()>m_min_parton_pt){
+          if( std::abs(pdgid)<=21 && // Should be a parton
+              std::abs(pdgid)!=6 && // Should not be a top
+              (std::abs(pdgid)==15 || std::abs(pdgid)<=10 || std::abs(pdgid)>16) && // Not a lepton
+              std::abs(pdgid)!=0){ // not an unrecognized thingy
  
-            dR2 = std::pow( std::acos( std::cos( p.phi() - (*currentGenParticleIter)->momentum().phi() ) ) , 2 );
-            dR2 += std::pow( p.eta()-(*currentGenParticleIter)->momentum().eta() , 2 );
+            dR2 = std::pow( std::acos( std::cos( p.phi() - currentGenParticle->momentum().phi() ) ) , 2 );
+            dR2 += std::pow( p.eta()-currentGenParticle->momentum().eta() , 2 );
         
             if(dR2<=m_partonMatch_dr*m_partonMatch_dr){ // We have a winner
-              Emax=(*currentGenParticleIter)->momentum().e();
-              *m_partonFlavor = (*currentGenParticleIter)->pdg_id();
+              Emax=currentGenParticle->momentum().e();
+              *m_partonFlavor = currentGenParticle->pdg_id();
               *m_partonDR = static_cast<float> (dR2);
             } // Outside of dR
           } // Wrong PDG ID
         } // Low energy
 
         // Hadron labeling section
-        if ((HepPID::isHadron (pdgid) || abs(pdgid)==15) && ((*currentGenParticleIter)->momentum().perp()>m_min_hadron_pt)){
+        if ((HepPID::isHadron (pdgid) || std::abs(pdgid)==15) && (currentGenParticle->momentum().perp()>m_min_hadron_pt)){
 
           // Check on DR match
-          dR2 = std::pow( std::acos( std::cos( p.phi() - (*currentGenParticleIter)->momentum().phi() ) ) , 2 );
-          dR2 += std::pow( p.eta()-(*currentGenParticleIter)->momentum().eta() , 2 );
+          dR2 = std::pow( std::acos( std::cos( p.phi() - currentGenParticle->momentum().phi() ) ) , 2 );
+          dR2 += std::pow( p.eta()-currentGenParticle->momentum().eta() , 2 );
 
           if( dR2<=m_hadronMatch_dr*m_hadronMatch_dr ){
             // Strict ordering bottom up - 0 -> tau -> c -> b
diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.cxx
index 321da3fb40d22fd7e91481051d2330e77a4527e6..73736615c56aa677721ee043e9f6d9886176b23e 100644
--- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.cxx
+++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.cxx
@@ -64,35 +64,35 @@ StatusCode TruthLeptonNearbyAssociationTool::fill (const TruthParticle& p)
     // We have an McEventCollection
     for (McEventCollection::const_iterator currentGenEventIter = mcCollection->begin();
          currentGenEventIter!=mcCollection->end(); ++currentGenEventIter) {
-      for (HepMC::GenEvent::particle_const_iterator currentGenParticleIter= (*currentGenEventIter)->particles_begin(); 
-           currentGenParticleIter!= (*currentGenEventIter)->particles_end(); ++currentGenParticleIter) {
-        if (!(*currentGenParticleIter)) continue;
-        if ((*currentGenParticleIter)->status()!=1) continue;
-        if ((*currentGenParticleIter)->barcode()==p.barcode()) continue; // The same particle twice!
 
-        dR2 = p.phi() - (*currentGenParticleIter)->momentum().phi();
+      for (auto currentGenParticle: *(*currentGenEventIter)) {
+        if (!currentGenParticle) continue;
+        if (currentGenParticle->status()!=1) continue;
+        if (HepMC::barcode(currentGenParticle)==p.barcode()) continue; // The same particle twice!
+
+        dR2 = p.phi() - currentGenParticle->momentum().phi();
         if (dR2>M_PI) dR2-=2.*M_PI;
         else if (dR2<-M_PI) dR2+=2.*M_PI;
 
-        dR2 = std::pow(dR2,2)+std::pow(p.eta()-(*currentGenParticleIter)->momentum().eta(),2);
+        dR2 = std::pow(dR2,2)+std::pow(p.eta()-currentGenParticle->momentum().eta(),2);
 
         if (dR2>=0.09) continue; // Save a little time
 
         // Isolation section - exclude neutrinos
-        if (!MC::PID::isNeutrino( (*currentGenParticleIter)->pdg_id() ) ){
-          *m_iso03 = (*m_iso03)+(*currentGenParticleIter)->momentum().perp();
-          if (dR2<0.04) *m_iso02 = (*m_iso02)+(*currentGenParticleIter)->momentum().perp();
+        if (!MC::PID::isNeutrino( currentGenParticle->pdg_id() ) ){
+          *m_iso03 = (*m_iso03)+currentGenParticle->momentum().perp();
+          if (dR2<0.04) *m_iso02 = (*m_iso02)+currentGenParticle->momentum().perp();
         }
 
         // Dressing section
-        if ((*currentGenParticleIter)->pdg_id()!=22) continue; // Only photons
-        if (dR2>=0.01) continue; // Only DR<0.1
+        if (currentGenParticle->pdg_id()!=22) continue; // Only photons
+        if (dR2>=0.01) continue; // Only DR<0.1 //AV this is a magic number.
 
-        real_parent = std::fabs(get_real_parent( *currentGenParticleIter ));
+        real_parent = std::abs(get_real_parent( currentGenParticle ));
         if (real_parent>=26 || real_parent==15) continue; // Veto hadron parents
 
-        dressed_4mom += CLHEP::HepLorentzVector((*currentGenParticleIter)->momentum().x(),(*currentGenParticleIter)->momentum().y(),
-                                                (*currentGenParticleIter)->momentum().z(),(*currentGenParticleIter)->momentum().t());
+        dressed_4mom += CLHEP::HepLorentzVector(currentGenParticle->momentum().x(),currentGenParticle->momentum().y(),
+                                                currentGenParticle->momentum().z(),currentGenParticle->momentum().t());
 
       } // Loop over particles
     } // Loop over events
@@ -106,20 +106,30 @@ StatusCode TruthLeptonNearbyAssociationTool::fill (const TruthParticle& p)
   return StatusCode::SUCCESS;
 }
 
-int TruthLeptonNearbyAssociationTool::get_real_parent( HepMC::GenParticle * p , int depth ) const
+int TruthLeptonNearbyAssociationTool::get_real_parent( HepMC::GenParticlePtr p , int depth ) const
 {
   if (depth>10) return 0;
-  if (!p->production_vertex()) return 0;
 
   // Work assuming one parent...
-  HepMC::GenVertex::particle_iterator itrPar = p->production_vertex()->particles_begin(HepMC::parents);
-  if ( !(*itrPar) ) return 0;  // parent didn't exist
+//AV This algorithm is ambiguous as it assumesnot more than one parent per particle.
+//AV In HepMC2 this could be wrong more often than expected.
+
+  auto prodvertex = p->production_vertex();
+  if ( !prodvertex ) return 0;  // parent didn't exist
+#ifdef HEPMC3
+  if (!prodvertex->particles_in().size()) return 0;
+  auto parentparticle=prodvertex->particles_in()[0];
+#else
+  if (!prodvertex->particles_in_size()) return 0;
+  auto parentparticle=*(prodvertex->particles_begin(HepMC::parents));
+#endif
+  if ( !parentparticle ) return 0;  // parent didn't exist
 
   // Not a photon - return the parent
-  if ((*itrPar)->pdg_id()!=22) return (*itrPar)->pdg_id();
+  if (parentparticle->pdg_id()!=22) return parentparticle->pdg_id();
 
   // Photon - iterate
-  return get_real_parent( *itrPar , depth+1 );
+  return get_real_parent( parentparticle , depth+1 );
 }
 
 } // namespace D3PD
diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.h
index 32b8f875f9382d71b9443a28379fa3e8f5e78b3e..1a637ac595b650796fdd636a54cbf567800e9399 100644
--- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.h
+++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonNearbyAssociationTool.h
@@ -59,7 +59,7 @@ private:
   float *m_iso02;
   float *m_iso03;
 
-  int get_real_parent( HepMC::GenParticle * , int depth=0 ) const;
+  int get_real_parent( HepMC::GenParticlePtr , int depth=0 ) const;
 
 };
 
diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.cxx
index 9e452a53e7966a3a4c298548f1b1698199ae3d53..dd1514279573cd4976369d58032919cc615187bc 100644
--- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.cxx
+++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.cxx
@@ -84,9 +84,9 @@ TruthLeptonParentAssociationTool::reset (const TruthParticle& p)
   return StatusCode::SUCCESS;
 }
 
-void TruthLeptonParentAssociationTool::addLeptonParent(const HepMC::GenParticle* part) {
+void TruthLeptonParentAssociationTool::addLeptonParent(HepMC::ConstGenParticlePtr part) {
 
-  HepMC::GenVertex* begvx = part->production_vertex();
+  auto begvx = part->production_vertex();
   if(!begvx){ // no parents
     return;
   }
@@ -95,22 +95,27 @@ void TruthLeptonParentAssociationTool::addLeptonParent(const HepMC::GenParticle*
   if (begvx==part->end_vertex()) return;
 
   // More complex loop catch
-  if ( find(m_barcode_trace.begin(),m_barcode_trace.end(),begvx->barcode()) != m_barcode_trace.end()){
+  if ( find(m_barcode_trace.begin(),m_barcode_trace.end(),HepMC::barcode(begvx)) != m_barcode_trace.end()){
     ATH_MSG_DEBUG( "Found a loop (a la Sherpa sample).  Backing out." );
     return;
   }
-  m_barcode_trace.push_back(begvx->barcode());
+  m_barcode_trace.push_back(HepMC::barcode(begvx));
 
   // Loop over the parents of this particle.
+#ifdef HEPMC3
+  auto itrPar = begvx->particles_in().begin();
+  auto endPar = begvx->particles_in().end();
+#else  
   HepMC::GenVertex::particle_iterator itrPar = begvx->particles_begin(HepMC::parents);
   HepMC::GenVertex::particle_iterator endPar = begvx->particles_end(HepMC::parents);
+#endif
   int n_iter=0;
   for(;itrPar!=endPar; ++itrPar){
     if ( !(*itrPar) ) continue;  // parent didn't exist
     n_iter++;
     if (n_iter>2) break; // No point in trying - this vertex does not have a quantum meaning...
 
-    int pdg = abs((*itrPar)->pdg_id());
+    int pdg = std::abs((*itrPar)->pdg_id());
 
     if ( (31<pdg && pdg<38) || // BSM Higgs / W' / Z' / etc
          pdg==39 ||
@@ -125,7 +130,7 @@ void TruthLeptonParentAssociationTool::addLeptonParent(const HepMC::GenParticle*
          (pdg == 15 && !m_primary_is_tau) || // Tau
          HepPID::isHadron (pdg) // from a hadron!
         ){
-      m_parent_barcodes.push_back( (*itrPar)->barcode() ); 
+      m_parent_barcodes.push_back( HepMC::barcode(*itrPar) ); 
     } else { // Will get to here if we are coming from the same lepton again
       addLeptonParent( *itrPar );
     } // End of catch on PDG ID
diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.h
index 70ffc405c6179a7dc756f2540b36b9cc5c33cfc3..53bb0bf6dbb528deca8404fd2dbe99027fd2d53b 100644
--- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.h
+++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthLeptonParentAssociationTool.h
@@ -59,7 +59,7 @@ public:
 private:
 
   /// Function for association to a specific lepton 
-  void addLeptonParent(const HepMC::GenParticle*);
+  void addLeptonParent(HepMC::ConstGenParticlePtr);
 
   /// TruthParticle iterator
   std::vector<const TruthParticle*> m_parents;
diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.cxx
index 953fd2cf260d64cd42212fbafd6d580df71bc060..ad77365a6b8bb95325ba41658fc6eb3a29d17376 100644
--- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.cxx
+++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.cxx
@@ -78,25 +78,23 @@ TruthTauDecayAssociationTool::reset (const TruthParticle& p)
   return StatusCode::SUCCESS;
 }
 
-void TruthTauDecayAssociationTool::addStableDaughters(const HepMC::GenParticle* part) {
+void TruthTauDecayAssociationTool::addStableDaughters(HepMC::ConstGenParticlePtr part) {
   // Sanity check
   if (!part) return;
 
-  HepMC::GenVertex* endvx = part->end_vertex();
+  auto endvx = part->end_vertex();
   if(!endvx){ // no children
-    if ( part && part->status()==1 ) m_tau_prod_barcodes.push_back( part->barcode() );
+    if ( part && part->status()==1 ) m_tau_prod_barcodes.push_back( HepMC::barcode(part) );
     return;
   }
 
   // Loop over the parents of this particle.
-  HepMC::GenVertex::particle_iterator itrChild = endvx->particles_begin(HepMC::children);
-  HepMC::GenVertex::particle_iterator endChild = endvx->particles_end(HepMC::children);
-  for(;itrChild!=endChild; ++itrChild){
-    if ( (*itrChild) && (*itrChild)->status()==1 ){
+  for(auto Child: *endvx){
+    if ( (Child) && (Child)->status()==1 ){
       // Found a stable child!
-      m_tau_prod_barcodes.push_back( (*itrChild)->barcode() );
-    } else if ( (*itrChild) ){
-      addStableDaughters( (*itrChild) );
+      m_tau_prod_barcodes.push_back( HepMC::barcode(Child) );
+    } else if ( (Child) ){
+      addStableDaughters( (Child) );
     }
   } // End loop over children
 
diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.h b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.h
index bfb6b361fe698bdbf7dbe184f584b2316e4f74e5..a56845e22d96cd19fc041dc478e37da7257a6db6 100644
--- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.h
+++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthTauDecayAssociationTool.h
@@ -59,7 +59,7 @@ public:
 private:
 
   /// Function for association to a specific tau 
-  void addStableDaughters(const HepMC::GenParticle*);
+  void addStableDaughters(HepMC::ConstGenParticlePtr);
 
   /// TruthParticle iterator
   std::vector<const TruthParticle*> m_tau_prods;
diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/CorrectionClusterD3PDObject.py b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/CorrectionClusterD3PDObject.py
index 2528bbe8c2e414d4bbe56bd8c6228cc2b510f484..1efcd7c3c021e1ba0d1c847dc58d087de6e2966d 100644
--- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/CorrectionClusterD3PDObject.py
+++ b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/CorrectionClusterD3PDObject.py
@@ -12,6 +12,7 @@
 from D3PDMakerCoreComps.D3PDObject    import make_SGDataVector_D3PDObject
 from egammaD3PDAnalysis.TileGapConfig import TileGapConfig
 from D3PDMakerCoreComps.D3PDObject    import DeferArg
+from D3PDMakerCoreComps.resolveSGKey  import resolveSGKey # noqa: F401
 import EventCommonD3PDMaker
 import D3PDMakerCoreComps
 import CaloD3PDMaker
diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/ElectronD3PDObject.py b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/ElectronD3PDObject.py
index b0df9756add61c847cd62f4553852f78da7f40d2..42c49237a45bfec8aceb3c434669b851d210dd8e 100644
--- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/ElectronD3PDObject.py
+++ b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/ElectronD3PDObject.py
@@ -15,6 +15,7 @@ from D3PDMakerCoreComps.D3PDObject          import DeferArg
 from D3PDMakerCoreComps.SimpleAssociation   import SimpleAssociation
 from D3PDMakerCoreComps.IndexMultiAssociation import IndexMultiAssociation
 from D3PDMakerCoreComps.resolveSGKey        import testSGKey
+from D3PDMakerCoreComps.resolveSGKey        import resolveSGKey # noqa: F401
 from D3PDMakerConfig.D3PDMakerFlags         import D3PDMakerFlags
 from RecExConfig.RecFlags                   import rec
 import egammaD3PDMaker
diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/PhotonD3PDObject.py b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/PhotonD3PDObject.py
index fbf504ce8a1cf20e37085bac4469c387ea1968bd..81757134e46add9fd704287d00251aa63e6936f1 100644
--- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/PhotonD3PDObject.py
+++ b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/PhotonD3PDObject.py
@@ -14,6 +14,7 @@ from D3PDMakerCoreComps.D3PDObject           import DeferArg
 from D3PDMakerCoreComps.SimpleAssociation    import SimpleAssociation
 from D3PDMakerConfig.D3PDMakerFlags          import D3PDMakerFlags
 from D3PDMakerCoreComps.resolveSGKey         import testSGKey
+from D3PDMakerCoreComps.resolveSGKey         import resolveSGKey # noqa: F401
 from TrackD3PDMaker.xAODTrackSummaryFiller   import xAODTrackSummaryFiller
 from D3PDMakerCoreComps.ContainedVectorMultiAssociation import ContainedVectorMultiAssociation
 from RecExConfig.RecFlags                    import rec
diff --git a/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithm.h b/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithm.h
index 84cc10421356fe87a9ff613ce1c05c8163af2b8b..cb76231dc30f5a40cc42a15e15b0c0a04b7f29a7 100644
--- a/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithm.h
+++ b/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithm.h
@@ -61,12 +61,7 @@ namespace EL
   /// currently be done with a \ref `EL::Algorithm` since it neither
   /// knows about incidents, nor has all the virtual methods that were
   /// available before.
-  ///
-  /// \todo It might be nice to make this actually dual-use at some
-  /// point, but since there seems little interest in a dual-use
-  /// algorithm that is on the back-burner.  There are some
-  /// conditional compilation directives here and there, but it was
-  /// never tested for dual-use (or even in-athena compilation).
+
 
   class AnaAlgorithm
 #ifdef XAOD_STANDALONE
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/AntiKt2LCTopoJetsCPContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/AntiKt2LCTopoJetsCPContent.py
index 0cfdc2899869749953553a9c21741bd4fb7e112e..a297308e633821b34dfa83cc9235a6fcee15b48e 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/AntiKt2LCTopoJetsCPContent.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/AntiKt2LCTopoJetsCPContent.py
@@ -4,7 +4,7 @@ AntiKt2LCTopoJetsCPContent = [
 "Kt4LCTopoOriginEventShape",
 "Kt4LCTopoOriginEventShapeAux.Density",
 "AntiKt2LCTopoJets",
-"AntiKt2LCTopoJetsAux.pt.eta.phi.m.JetConstitScaleMomentum_pt.JetConstitScaleMomentum_eta.JetConstitScaleMomentum_phi.JetConstitScaleMomentum_m.NumTrkPt500.SumPtTrkPt500.EnergyPerSampling.ActiveArea4vec_eta.ActiveArea4vec_m.ActiveArea4vec_phi.ActiveArea4vec_pt.DetectorEta.DetectorY.FracSamplingMax.FracSamplingMaxIndex.GhostTrack.Jvt.JVFCorr.JvtRpt.NumTrkPt1000.TrackWidthPt1000.GhostMuonSegmentCount.PartonTruthLabelID.ConeTruthLabelID.HadronConeExclExtendedTruthLabelID.HadronConeExclTruthLabelID.TrueFlavor.Timing",
+"AntiKt2LCTopoJetsAux.pt.eta.phi.m.JetConstitScaleMomentum_pt.JetConstitScaleMomentum_eta.JetConstitScaleMomentum_phi.JetConstitScaleMomentum_m.NumTrkPt500.SumPtTrkPt500.EnergyPerSampling.ActiveArea4vec_eta.ActiveArea4vec_m.ActiveArea4vec_phi.ActiveArea4vec_pt.DetectorEta.DetectorY.FracSamplingMax.FracSamplingMaxIndex.GhostTrack.Jvt.JVFCorr.JvtRpt.NumTrkPt1000.TrackWidthPt1000.GhostMuonSegmentCount.PartonTruthLabelID.ConeTruthLabelID.HadronConeExclExtendedTruthLabelID.HadronConeExclTruthLabelID.TrueFlavor.Timing.EMFrac.HECFrac.AverageLArQF.NegativeE.LArQuality.HECQuality",
 "MET_Track",
 "MET_TrackAux.name.mpx.mpy",
 "PrimaryVertices",
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/AntiKt6LCTopoJetsCPContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/AntiKt6LCTopoJetsCPContent.py
index c88b609afbe6629269b1636751d0ea0476694fd9..1dd1e51247f3dc3848c114da903c8f64e1be7bd6 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/AntiKt6LCTopoJetsCPContent.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/AntiKt6LCTopoJetsCPContent.py
@@ -4,7 +4,7 @@ AntiKt6LCTopoJetsCPContent = [
 "Kt4LCTopoOriginEventShape",
 "Kt4LCTopoOriginEventShapeAux.Density",
 "AntiKt6LCTopoJets",
-"AntiKt6LCTopoJetsAux.pt.eta.phi.m.JetConstitScaleMomentum_pt.JetConstitScaleMomentum_eta.JetConstitScaleMomentum_phi.JetConstitScaleMomentum_m.NumTrkPt500.SumPtTrkPt500.EnergyPerSampling.ActiveArea4vec_eta.ActiveArea4vec_m.ActiveArea4vec_phi.ActiveArea4vec_pt.DetectorEta.DetectorY.FracSamplingMax.FracSamplingMaxIndex.GhostTrack.Jvt.JVFCorr.JvtRpt.NumTrkPt1000.TrackWidthPt1000.GhostMuonSegmentCount.PartonTruthLabelID.ConeTruthLabelID.HadronConeExclExtendedTruthLabelID.HadronConeExclTruthLabelID.TrueFlavor.Timing",
+"AntiKt6LCTopoJetsAux.pt.eta.phi.m.JetConstitScaleMomentum_pt.JetConstitScaleMomentum_eta.JetConstitScaleMomentum_phi.JetConstitScaleMomentum_m.NumTrkPt500.SumPtTrkPt500.EnergyPerSampling.ActiveArea4vec_eta.ActiveArea4vec_m.ActiveArea4vec_phi.ActiveArea4vec_pt.DetectorEta.DetectorY.FracSamplingMax.FracSamplingMaxIndex.GhostTrack.Jvt.JVFCorr.JvtRpt.NumTrkPt1000.TrackWidthPt1000.GhostMuonSegmentCount.PartonTruthLabelID.ConeTruthLabelID.HadronConeExclExtendedTruthLabelID.HadronConeExclTruthLabelID.TrueFlavor.Timing.EMFrac.HECFrac.AverageLArQF.NegativeE.LArQuality.HECQuality",
 "MET_Track",
 "MET_TrackAux.name.mpx.mpy",
 "PrimaryVertices",
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/CMakeLists.txt
index 1cff0de860dccf00883eeaf3d730fab3e0747a29..fbe51bc9e84ae03ce248cdd4e7bdb09d2be9e088 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/CMakeLists.txt
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/CMakeLists.txt
@@ -9,7 +9,7 @@ find_package( ROOT COMPONENTS Core MathCore )
 # Component(s) in the package:
 #the library is used by the MCP software https://gitlab.cern.ch/atlas-mcp/MuonPerformanceAnalysis
 atlas_add_library( DerivationFrameworkMuonsLib
-   DerivationFrameworkMuons/*.h src/*.cxx src/components/*.cxx
+   DerivationFrameworkMuons/*.h src/*.cxx
    PUBLIC_HEADERS DerivationFrameworkMuons
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
    LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools AthContainers AthenaBaseComps AthenaKernel CaloEvent CaloGeoHelpers DerivationFrameworkInterfaces ExpressionEvaluationLib FourMomUtils GaudiKernel ICaloTrkMuIdTools InDetTrackSelectionToolLib MCTruthClassifierLib RecoToolInterfaces TrigDecisionToolLib TrigMuonMatchingLib TrkExInterfaces TrkParameters TrkSurfaces muonEvent xAODBase xAODCaloEvent xAODEventInfo xAODJet xAODMuon xAODPrimitives xAODTracking xAODTruth )
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/CMakeLists.txt
index ca06985255b764a063706588123a5fee269f361f..1498568361a382adabbbe0d7d0d968a0b6e735fe 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/CMakeLists.txt
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/CMakeLists.txt
@@ -4,7 +4,7 @@
 atlas_subdir( ElectronPhotonShowerShapeFudgeTool )
 
 # External dependencies:
-find_package( ROOT COMPONENTS Core MathCore Hist Graph RIO )
+find_package( ROOT COMPONENTS Core MathCore Hist Graf RIO )
 
 # Component(s) in the package:
 atlas_add_library( ElectronPhotonShowerShapeFudgeToolLib
diff --git a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/Root/AsgPhotonEfficiencyCorrectionTool.cxx b/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/Root/AsgPhotonEfficiencyCorrectionTool.cxx
index 23923003e442d5483e6a00eba2985ab319177853..a3178fe0f472f69390f168cc72d3b2db9240623e 100644
--- a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/Root/AsgPhotonEfficiencyCorrectionTool.cxx
+++ b/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/Root/AsgPhotonEfficiencyCorrectionTool.cxx
@@ -64,7 +64,7 @@ AsgPhotonEfficiencyCorrectionTool::AsgPhotonEfficiencyCorrectionTool( std::strin
   declareProperty( "CorrectionFileNameUnconv", m_corrFileNameUnconv="",
                    "File that stores the correction factors for simulation for unconverted photons");
 				   
-  declareProperty("MapFilePath", m_mapFile = "" ,
+  declareProperty("MapFilePath", m_mapFile = "PhotonEfficiencyCorrection/2015_2018/rel21.2/Summer2020_Rec_v1/map1.txt",
                   "Full path to the map file");  
 				  
   declareProperty( "ForceDataType", m_dataTypeOverwrite=-1,
diff --git a/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondAlg.cxx b/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondAlg.cxx
index d355ea90553dd55f57501cb71b20376ccc09f3b7..c44cbab6be97bf0ca31f30df7acdd49076b7e087 100644
--- a/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondAlg.cxx
+++ b/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondAlg.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
 */
 /*
  *   */
@@ -560,6 +560,7 @@ namespace Analysis {
                 TObjArray * toa = dynamic_cast<TObjArray*>(hPointer.get());
                 if (toa) {
                   ATH_MSG_DEBUG("#BTAG# The TObjArray to build the input variables of BDT for " << tagger<< " is valid");
+                  toa->SetOwner (true);
                   std::vector<std::string> inputVars; inputVars.clear();
                   std::string commaSepVars="";
                   TObjString *tos= nullptr;
diff --git a/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency/Root/BTaggingTruthTaggingTool.cxx b/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency/Root/BTaggingTruthTaggingTool.cxx
index 3f728ee3f1a855b1239591f4d9259e53427203ad..3d864fa7a1fcb290bf8cc4235c528c7a9dcb062b 100644
--- a/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency/Root/BTaggingTruthTaggingTool.cxx
+++ b/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency/Root/BTaggingTruthTaggingTool.cxx
@@ -1126,7 +1126,6 @@ StatusCode BTaggingTruthTaggingTool::getDirectTaggedJets(TRFinfo &trfinf,std::ve
 
 
 double BTaggingTruthTaggingTool::getEvtSF(TRFinfo &trfinf,int sys){
-  ANA_CHECK_SET_TYPE (StatusCode);
   double SF = 1.;
   std::vector<bool> is_tagged;
   ANA_CHECK_THROW( getDirectTaggedJets(trfinf,is_tagged) );
diff --git a/PhysicsAnalysis/PATJobTransforms/share/skeleton.ESDtoDPD_tf.py b/PhysicsAnalysis/PATJobTransforms/share/skeleton.ESDtoDPD_tf.py
index 995cee0bfd60bfe61a4e65fe48f4f969bd67b948..db29173e9193e713298b5f8886df6a2c054fa10d 100644
--- a/PhysicsAnalysis/PATJobTransforms/share/skeleton.ESDtoDPD_tf.py
+++ b/PhysicsAnalysis/PATJobTransforms/share/skeleton.ESDtoDPD_tf.py
@@ -38,19 +38,25 @@ rec.DPDMakerScripts.append(SetupOutputDPDs(runArgs,listOfFlags))
 
 rec.OutputFileNameForRecoStep="ESDtoDPD"
 
+# New-style config
+from AthenaConfiguration.AllConfigFlags import ConfigFlags
+
 ## Input
 if hasattr(runArgs,"inputFile"): athenaCommonFlags.FilesInput.set_Value_and_Lock( runArgs.inputFile )
 if hasattr(runArgs,"inputBSFile"):
     globalflags.InputFormat.set_Value_and_Lock('bytestream')
     athenaCommonFlags.BSRDOInput.set_Value_and_Lock( runArgs.inputBSFile )
+    ConfigFlags.Input.Files = athenaCommonFlags.BSRDOInput()
 if hasattr(runArgs,"inputRDOFile"):
     rec.readRDO.set_Value_and_Lock( True )
     globalflags.InputFormat.set_Value_and_Lock('pool')
     athenaCommonFlags.PoolRDOInput.set_Value_and_Lock( runArgs.inputRDOFile )
+    ConfigFlags.Input.Files = athenaCommonFlags.PoolRDOInput()
 if hasattr(runArgs,"inputESDFile"):
     globalflags.InputFormat.set_Value_and_Lock('pool')
     rec.readESD.set_Value_and_Lock( True )
     athenaCommonFlags.PoolESDInput.set_Value_and_Lock( runArgs.inputESDFile )
+    ConfigFlags.Input.Files = athenaCommonFlags.PoolESDInput()
 if hasattr(runArgs,"inputTAGFile"):
     rec.readTAG.set_Value_and_Lock( True )
     rec.readESD.set_Value_and_Lock( True )
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/DESDM_IDALIGN.py b/PhysicsAnalysis/PrimaryDPDMaker/share/DESDM_IDALIGN.py
index 178a553d4897a8ed8b118dba3a537b8042a6be33..1b900146981e8c2c672882481cc1205817dc0063 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/share/DESDM_IDALIGN.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/share/DESDM_IDALIGN.py
@@ -153,8 +153,8 @@ outList = CfgItemList( 'IDALIGN',
     'xAOD::TrigNavigationAuxInfo#TrigNavigationAux.',
     'xAOD::TrigDecision#xTrigDecision',
     'xAOD::JetEtRoI#LVL1JetEtRoI',
-    'Trk::SegmentCollection#MuonSegments',
-    'Trk::SegmentCollection#NCB_MuonSegments',
+    'Trk::SegmentCollection#TrackMuonSegments',
+    'Trk::SegmentCollection#NCB_TrackMuonSegments',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMPFlowAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMTopoAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4LCTopoAux.',
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/DESD_DEDX.py b/PhysicsAnalysis/PrimaryDPDMaker/share/DESD_DEDX.py
index b0cd14500f25833560ca663c5f87e351cbfb5726..95d0fdbf71a1f727dffcc18e8d325d3a2d2e0f0c 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/share/DESD_DEDX.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/share/DESD_DEDX.py
@@ -152,8 +152,8 @@ outList = CfgItemList( 'DEDX',
     'xAOD::TrigNavigationAuxInfo#TrigNavigationAux.',
     'xAOD::TrigDecision#xTrigDecision',
     'xAOD::JetEtRoI#LVL1JetEtRoI',
-    'Trk::SegmentCollection#MuonSegments',
-    'Trk::SegmentCollection#NCB_MuonSegments',
+    'Trk::SegmentCollection#TrackMuonSegments',
+    'Trk::SegmentCollection#NCB_TrackMuonSegments',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMPFlowAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMTopoAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4LCTopoAux.',
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDESDM_MS.py b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDESDM_MS.py
index ad5c959959a81636c7265d95f0449310a5369bd6..a7b01fe321f85c3a0723cc18b503aacdae2080d4 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDESDM_MS.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDESDM_MS.py
@@ -344,7 +344,7 @@ AlignmentTriggerMuonStream.AddItem(["Muon::TgcPrepDataContainer#*"])
 AlignmentTriggerMuonStream.AddItem(["Muon::CscPrepDataContainer#*"])
 AlignmentTriggerMuonStream.AddItem(["Muon::MdtPrepDataContainer#*"])
 #Alignment
-AlignmentTriggerMuonStream.AddItem(["Trk::SegmentCollection#MuonSegments"])
+AlignmentTriggerMuonStream.AddItem(["Trk::SegmentCollection#TrackMuonSegments"])
 AlignmentTriggerMuonStream.AddItem(["xAOD::VertexContainer#PrimaryVertices"])
 AlignmentTriggerMuonStream.AddItem(["xAOD::VertexAuxContainer#PrimaryVerticesAux.-vxTrackAtVertex.-MvfFitInfo.-isInitialized.-VTAV"])
 AlignmentTriggerMuonStream.AddItem(["TrackCollection#MuonSpectrometerTracks"])
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_AllCells.py b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_AllCells.py
index 92370c88d5d037fde1235d5083abb7bfbf9f90c2..8925dacd9863e91fe0395f0c984df528c334119d 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_AllCells.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_AllCells.py
@@ -152,8 +152,8 @@ outList = CfgItemList( 'ALLCELLS',
     'xAOD::TrigNavigationAuxInfo#TrigNavigationAux.',
     'xAOD::TrigDecision#xTrigDecision',
     'xAOD::JetEtRoI#LVL1JetEtRoI',
-    'Trk::SegmentCollection#MuonSegments',
-    'Trk::SegmentCollection#NCB_MuonSegments',
+    'Trk::SegmentCollection#TrackMuonSegments',
+    'Trk::SegmentCollection#NCB_TrackMuonSegments',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMPFlowAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMTopoAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4LCTopoAux.',
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_EGamma.py b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_EGamma.py
index 873ea275292f6a9908f400d994e874f08530393a..0500c707c20068418d8b012c9ea25e5e1a8926a1 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_EGamma.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_EGamma.py
@@ -369,8 +369,8 @@ outList = CfgItemList( 'EGAMMA',
     'xAOD::TrigNavigationAuxInfo#TrigNavigationAux.',
     'xAOD::TrigDecision#xTrigDecision',
     'xAOD::JetEtRoI#LVL1JetEtRoI',
-    'Trk::SegmentCollection#MuonSegments',
-    'Trk::SegmentCollection#NCB_MuonSegments',
+    'Trk::SegmentCollection#TrackMuonSegments',
+    'Trk::SegmentCollection#NCB_TrackMuonSegments',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMPFlowAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMTopoAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4LCTopoAux.',
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_EOverP.py b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_EOverP.py
index 32a9cd5799e55cb02e324e21ea67b58a77e5ec10..0d6c6aa615fad538623c0c304f24ffde163180d2 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_EOverP.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_EOverP.py
@@ -167,8 +167,8 @@ outList = CfgItemList( 'EOVERP',
     'xAOD::TrigNavigationAuxInfo#TrigNavigationAux.',
     'xAOD::TrigDecision#xTrigDecision',
     'xAOD::JetEtRoI#LVL1JetEtRoI',
-    'Trk::SegmentCollection#MuonSegments',
-    'Trk::SegmentCollection#NCB_MuonSegments',
+    'Trk::SegmentCollection#TrackMuonSegments',
+    'Trk::SegmentCollection#NCB_TrackMuonSegments',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMPFlowAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMTopoAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4LCTopoAux.',
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_Jet.py b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_Jet.py
index 6821fb98a2a6bd80fc811fb5cc7f07655c493339..15d33cdef8320fd21741a349f0823a819835c0ba 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_Jet.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_Jet.py
@@ -291,8 +291,8 @@ outList = CfgItemList( 'CALJET',
     'xAOD::TrigNavigationAuxInfo#TrigNavigationAux.',
     'xAOD::TrigDecision#xTrigDecision',
     'xAOD::JetEtRoI#LVL1JetEtRoI',
-    'Trk::SegmentCollection#MuonSegments',
-    'Trk::SegmentCollection#NCB_MuonSegments',
+    'Trk::SegmentCollection#TrackMuonSegments',
+    'Trk::SegmentCollection#NCB_TrackMuonSegments',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMPFlowAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMTopoAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4LCTopoAux.',
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_PhotonJet.py b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_PhotonJet.py
index abf3d52003fa9f20a05c379a8f0475ca9e48f396..d965f339be0c331fc3218f96a185fdcf0550795c 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_PhotonJet.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_PhotonJet.py
@@ -119,8 +119,8 @@ outList = CfgItemList( 'PHOJET',
     'xAOD::TrigNavigationAuxInfo#TrigNavigationAux.',
     'xAOD::TrigDecision#xTrigDecision',
     'xAOD::JetEtRoI#LVL1JetEtRoI',
-    'Trk::SegmentCollection#MuonSegments',
-    'Trk::SegmentCollection#NCB_MuonSegments',
+    'Trk::SegmentCollection#TrackMuonSegments',
+    'Trk::SegmentCollection#NCB_TrackMuonSegments',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMPFlowAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMTopoAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4LCTopoAux.',
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_SGLEL.py b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_SGLEL.py
index 0f143aff04297f108361abad00ce2009db0a7fb6..5c64c8c8bc808901b93ea108b768e625e0b16edb 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_SGLEL.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_SGLEL.py
@@ -119,8 +119,8 @@ outList = CfgItemList( 'SGLEL',
     'xAOD::TrigNavigationAuxInfo#TrigNavigationAux.',
     'xAOD::TrigDecision#xTrigDecision',
     'xAOD::JetEtRoI#LVL1JetEtRoI',
-    'Trk::SegmentCollection#MuonSegments',
-    'Trk::SegmentCollection#NCB_MuonSegments',
+    'Trk::SegmentCollection#TrackMuonSegments',
+    'Trk::SegmentCollection#NCB_TrackMuonSegments',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMPFlowAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMTopoAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4LCTopoAux.',
diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_TtbarMuon.py b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_TtbarMuon.py
index b0867f88fef0d64acf48517d7b1766cb8c5df8de..190c826e3e5a292f5eab8350f2650bcdbb3d4bc9 100644
--- a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_TtbarMuon.py
+++ b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_TtbarMuon.py
@@ -165,8 +165,8 @@ outList = CfgItemList( 'SLTTMU',
     'xAOD::TrigNavigationAuxInfo#TrigNavigationAux.',
     'xAOD::TrigDecision#xTrigDecision',
     'xAOD::JetEtRoI#LVL1JetEtRoI',
-    'Trk::SegmentCollection#MuonSegments',
-    'Trk::SegmentCollection#NCB_MuonSegments',
+    'Trk::SegmentCollection#TrackMuonSegments',
+    'Trk::SegmentCollection#NCB_TrackMuonSegments',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMPFlowAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMTopoAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4LCTopoAux.',
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDPD_HIPs.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDPD_HIPs.py
index 4c9c35e07be4ee08f3ced719ad8951530da714cb..773475f23e848c4e6474a1174b4c0412d225391a 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDPD_HIPs.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDPD_HIPs.py
@@ -117,8 +117,8 @@ outList = CfgItemList( 'HIPsStream',
     'xAOD::TrigNavigationAuxInfo#TrigNavigationAux.',
     'xAOD::TrigDecision#xTrigDecision',
     'xAOD::JetEtRoI#LVL1JetEtRoI',
-    'Trk::SegmentCollection#MuonSegments',
-    'Trk::SegmentCollection#NCB_MuonSegments',
+    'Trk::SegmentCollection#TrackMuonSegments',
+    'Trk::SegmentCollection#NCB_TrackMuonSegments',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMPFlowAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4EMTopoAux.',
     'xAOD::MissingETAuxAssociationMap#METAssoc_AntiKt4LCTopoAux.',
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TopObjectSelection.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TopObjectSelection.cxx
index 2430e825e7a9119a554b1dcb0bfec77f6652e589..784e2854a250c6ed2bd5ef65705b5279c4951d54 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TopObjectSelection.cxx
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/TopObjectSelection.cxx
@@ -523,8 +523,7 @@ namespace top {
                  "TopObjectSelection::applySelectionPreOverlapRemovalLargeRJets() failed to retrieve large R jets");
 
       for (auto jetPtr : *jets) {
-        //char decoration = m_largeJetSelection->passSelection(*jetPtr);
-        char decoration = '0';
+        char decoration = m_largeJetSelection->passSelection(*jetPtr);
         jetPtr->auxdecor<char>(m_passPreORSelection) = decoration;
         jetPtr->auxdecor<char>(m_ORToolDecoration) = decoration * 2;
         if (m_doLooseCuts) {
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/JetObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/JetObjectCollectionMaker.cxx
index 244d7303f5916148a2f54993846f4c1ad419f37c..ac997ed1b6ecdad7cf9dc05e6decdc85c229ef9f 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/JetObjectCollectionMaker.cxx
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/JetObjectCollectionMaker.cxx
@@ -249,17 +249,15 @@ namespace top {
     if (m_config->jetSubstructureName() == "SubjetMaker") m_jetSubstructure.reset(new top::SubjetMaker);
 
     ///-- Large R jet truth labeling --///
-//    m_jetTruthLabelingTool = nullptr;
-//    if (m_config->isMC() && m_config->useLargeRJets()) {
-//      m_jetTruthLabelingTool = std::unique_ptr<JetTruthLabelingTool>(new JetTruthLabelingTool("JetTruthLabeling"));
-//      // For DAOD_PHYS we need to pass few more arguments as it uses TRUTH3
-//      if (m_config->getDerivationStream() == "PHYS") {
-//        top::check(m_jetTruthLabelingTool->setProperty("UseTRUTH3", true), "Failed to set UseTRUTH3 for m_jetTruthLabelingTool");
-//        top::check(m_jetTruthLabelingTool->setProperty("TruthBosonContainerName", "TruthBoson"), "Failed to set truth container name for m_jetTruthLabelingTool");
-//        top::check(m_jetTruthLabelingTool->setProperty("TruthTopQuarkContainerName", "TruthTop"), "Failed to set truth container name for m_jetTruthLabelingTool");
-//      }
-//      top::check(m_jetTruthLabelingTool->initialize(), "Failed to initialize m_jetTruthLabelingTool");
-//    }
+    m_jetTruthLabelingTool = nullptr;
+    if (m_config->isMC() && m_config->useLargeRJets()) {
+      m_jetTruthLabelingTool = std::unique_ptr<JetTruthLabelingTool>(new JetTruthLabelingTool("JetTruthLabeling"));
+      // For DAOD_PHYS we need to pass few more arguments as it uses TRUTH3
+      top::check(m_jetTruthLabelingTool->setProperty("UseTRUTH3", true), "Failed to set UseTRUTH3 for m_jetTruthLabelingTool");
+      top::check(m_jetTruthLabelingTool->setProperty("TruthBosonContainerName", "TruthBoson"), "Failed to set truth container name for m_jetTruthLabelingTool");
+      top::check(m_jetTruthLabelingTool->setProperty("TruthTopQuarkContainerName", "TruthTop"), "Failed to set truth container name for m_jetTruthLabelingTool");
+      top::check(m_jetTruthLabelingTool->initialize(), "Failed to initialize m_jetTruthLabelingTool");
+   }
 
     // set the systematics list
     m_config->systematicsJets(specifiedSystematics());
@@ -383,7 +381,13 @@ namespace top {
 
     ///-- Apply calibration --///
     ///-- Calibrate jet container --///
-    top::check(m_jetCalibrationTool->applyCalibration(*(shallow_xaod_copy.first)), "Failed to applyCalibration");
+    if (isLargeR) {
+      top::check(m_jetCalibrationToolLargeR->applyCalibration(*(shallow_xaod_copy.first)),
+          "Failed to do applyCalibration on large-R jets");
+    } else {
+      top::check(m_jetCalibrationTool->applyCalibration(*(shallow_xaod_copy.first)),
+          "Failed to do applyCalibration on small-R jets");
+    }
 
     ///-- Loop over the xAOD Container --///
     for (const auto jet : *(shallow_xaod_copy.first)) {
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/SpclMcValidationTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/SpclMcValidationTool.cxx
index 2bf794a86ecfbaf6e3c102ab77368fe7f6ac43da..f75434c6f5d251fabb679221acad5828f8adf6be 100755
--- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/SpclMcValidationTool.cxx
+++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/SpclMcValidationTool.cxx
@@ -160,7 +160,7 @@ SpclMcValidationTool::executeTool( const McEventCollection* mcEvents,
     const TruthParticle * mc = *itrPart;
     auto hepMc = mc->genParticle();
 
-    if ( hepMc->momentum() != mc->hlv() ) {
+    if ( hepMc->momentum() != HepMC::FourVector(mc->hlv().x(),mc->hlv().y(),mc->hlv().z(),mc->hlv().t()) ) {
       ATH_MSG_ERROR("TruthParticle and GenParticle-link don't have same 4-mom !!");
       return StatusCode::FAILURE;
     }
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthParticleCnvTool.cxx b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthParticleCnvTool.cxx
index b4211ce14cbac77e95c486619a0d794613a30a1c..3809895e0a676218767df771ae6428ef0e9e34d0 100755
--- a/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthParticleCnvTool.cxx
+++ b/PhysicsAnalysis/TruthParticleID/McParticleTools/src/TruthParticleCnvTool.cxx
@@ -265,11 +265,7 @@ TruthParticleCnvTool::convert( const McEventCollection * mcCollection,
   /// Create a map to enhance access between GenParticles and TruthParticles
   TruthParticleContainer::Map_t bcToMcPart = container->m_particles;
 
-  const HepMC::GenEvent::particle_const_iterator itrEnd = evt->particles_end();
-  for ( HepMC::GenEvent::particle_const_iterator itrPart=evt->particles_begin();
-	itrPart != itrEnd;
-	++itrPart ) {
-    const HepMC::GenParticle * hepMcPart = (*itrPart);
+  for (auto hepMcPart: *evt) {
 
     TruthParticle * mcPart = new TruthParticle( hepMcPart, container );
     container->push_back( mcPart );
@@ -285,7 +281,7 @@ TruthParticleCnvTool::convert( const McEventCollection * mcCollection,
       ATH_MSG_ERROR("TruthParticle is not wrapping the GenParticle : " 
 		    << HepMC::barcode(hepMcPart) << " !!");
     }
-    //bcToMcPart[ hepMcPart->barcoade() ] = mcPart;
+    //bcToMcPart[ hepMcPart->barcode() ] = mcPart;
     HepMcParticleLink mcLink( HepMC::barcode(hepMcPart), genEventIndex, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION, sg ); // FIXME assuming that we are using the hard-scatter McEventCollection - would need to pass this info as an argument to the convert function.
     bcToMcPart[ mcLink.compress() ] = mcPart;
 
diff --git a/Projects/Athena/CMakeLists.txt b/Projects/Athena/CMakeLists.txt
index 7ebc708d1a567c7a5fbcd541d4103cadb0f25d9d..807280b7e7cb85821cc381eaa080bb03e85a1c8a 100644
--- a/Projects/Athena/CMakeLists.txt
+++ b/Projects/Athena/CMakeLists.txt
@@ -76,6 +76,7 @@ if( AtlasHIP_FOUND )
 endif()
 
 # Find some auxiliary packages:
+find_package( Frontier_Client )
 find_package( Doxygen )
 find_package( PNG )
 find_package( VDT )
diff --git a/Reconstruction/Jet/JetRec/JetRec/PseudoJetContainer.h b/Reconstruction/Jet/JetRec/JetRec/PseudoJetContainer.h
index b4b47d1ef4fe0ac9af206022ff93a42d455311d6..ff826d001bd6b699cc92a761b3fe7d37030963c7 100644
--- a/Reconstruction/Jet/JetRec/JetRec/PseudoJetContainer.h
+++ b/Reconstruction/Jet/JetRec/JetRec/PseudoJetContainer.h
@@ -40,6 +40,7 @@
 #include <vector>
 #include <string>
 #include <set>
+#include <memory>
 
 typedef std::vector<fastjet::PseudoJet> PseudoJetVector;
 
@@ -51,12 +52,10 @@ public:
 
   // Constructor from a ConstituentExtractor and vector<PseudoJet>
   // PseudoJet OWNS their ConstituentExtractors
-  PseudoJetContainer(const IConstituentExtractor* c, 
+  PseudoJetContainer(std::unique_ptr<const IConstituentExtractor> c, 
                      const std::vector<PseudoJet> & vecPJ,
                      bool debug=false);
 
-  ~PseudoJetContainer();
-
   // fill xAOD jet with constit&ghosts extracted from final PSeudoJet
   bool extractConstituents(xAOD::Jet&, const std::vector<PseudoJet>&) const;
   bool extractConstituents(xAOD::Jet& jet, const PseudoJet &finalPJ) const;
@@ -103,8 +102,8 @@ private:
   struct ExtractorRange {
     ExtractorRange(unsigned int lo, 
                    unsigned int hi, 
-                   const IConstituentExtractor* e):
-      m_lo(lo), m_hi(hi), m_e(e){
+                   std::unique_ptr<const IConstituentExtractor> e):
+      m_lo(lo), m_hi(hi), m_e(std::move(e)){
     }
 
     ExtractorRange(const ExtractorRange& other)
@@ -125,19 +124,14 @@ private:
       swap(*this, other);
       return *this;
     }
-      
-           
-    ~ExtractorRange(){
-      delete m_e;
-    } 
     
     ExtractorRange bump(int step) const {
-      return ExtractorRange(m_lo + step, m_hi + step, m_e->clone());
+      return ExtractorRange(m_lo + step, m_hi + step, std::unique_ptr<const IConstituentExtractor>(m_e->clone()));
     }
 
     int m_lo;
     int m_hi;
-    const IConstituentExtractor* m_e;
+    std::unique_ptr<const IConstituentExtractor> m_e{};
   };
 
   std::vector<ExtractorRange> m_extractorRanges;
@@ -146,7 +140,7 @@ private:
   // created by the creating PseudoJetGetter. We need to keep track
   // of the empty extractors to fill zero information (such as 0 counts)
   // into the jets.
-  std::set<const IConstituentExtractor*> m_emptyExtractors;
+  std::set<std::unique_ptr<const IConstituentExtractor>> m_emptyExtractors;
 
   mutable bool m_debug{false};
 };
diff --git a/Reconstruction/Jet/JetRec/Root/JetByVertexFinder.cxx b/Reconstruction/Jet/JetRec/Root/JetByVertexFinder.cxx
index 37803539ab0ec570a48950566b495a01c3ac07a9..0c4cabcd51bcc34121a322208de7731b65be79b5 100644
--- a/Reconstruction/Jet/JetRec/Root/JetByVertexFinder.cxx
+++ b/Reconstruction/Jet/JetRec/Root/JetByVertexFinder.cxx
@@ -84,9 +84,7 @@ int JetByVertexFinder::find_(const PseudoJetContainer& cont,
   string sinp0 = xAOD::JetInput::typeName(inputtype);
   ATH_MSG_DEBUG("  Input type: " << sinp0);
 
-  // FIXME - bypass const of cont parameter
-  PseudoJetContainer content = cont;
-  const std::vector<PseudoJet>* vpj = content.casVectorPseudoJet();
+  const std::vector<PseudoJet>* vpj = cont.casVectorPseudoJet();
 
   std::vector<PseudoJetVector> psjvectors;
   std::vector<const Vertex*> vertices;
diff --git a/Reconstruction/Jet/JetRec/Root/PseudoJetContainer.cxx b/Reconstruction/Jet/JetRec/Root/PseudoJetContainer.cxx
index 104ede8af881a909bd41bf4e0db60d62b93fa1d8..7536c404f364cb6e118e7ab1084a971092275a2b 100644
--- a/Reconstruction/Jet/JetRec/Root/PseudoJetContainer.cxx
+++ b/Reconstruction/Jet/JetRec/Root/PseudoJetContainer.cxx
@@ -20,15 +20,15 @@ using fastjet::PseudoJet;
 PseudoJetContainer::PseudoJetContainer() {
   checkInvariants("PseudoJetContainer()");
 }
-  
-PseudoJetContainer::PseudoJetContainer(const IConstituentExtractor* c,
+
+PseudoJetContainer::PseudoJetContainer(std::unique_ptr<const IConstituentExtractor> c,
                                        const std::vector<PseudoJet> & vecPJ,
                                        bool debug){
 
   m_debug = debug;
   
   if (vecPJ.empty()){
-    m_emptyExtractors.insert(c);
+    m_emptyExtractors.insert(std::move(c));
     return;
   }
 
@@ -37,21 +37,12 @@ PseudoJetContainer::PseudoJetContainer(const IConstituentExtractor* c,
 
   // the limits of the Extractor index range correposnd to the 
   // numbering of the EDM objects in th extractors.
-  m_extractorRanges.push_back(ExtractorRange(0, 
-                                             vecPJ.back().user_index(), 
-                                             c));
+  m_extractorRanges.emplace_back(0, 
+                                 vecPJ.back().user_index(), 
+                                 std::move(c));
   if (m_debug){checkInvariants("PseudoJetContainer(vcPJ, c)");}
 }
 
-
-PseudoJetContainer::~PseudoJetContainer()
-{
-  for (const IConstituentExtractor* e : m_emptyExtractors) {
-    delete e;
-  }
-}
-
-
 bool
 PseudoJetContainer::extractConstituents(xAOD::Jet& jet, 
                                         const std::vector<PseudoJet>& inConstits) const
@@ -69,12 +60,12 @@ PseudoJetContainer::extractConstituents(xAOD::Jet& jet,
   // to the extractor is received. But an empty list is used 
   // by the extractors to fill zeros into the jet.
   for(const auto& er : m_extractorRanges){
-    sorter.emplace(er.m_e, std::vector<int>{});
+    sorter.emplace(er.m_e.get(), std::vector<int>{});
   }
 
   // see header file for explanation of empty extractors.
   for(const auto& e : m_emptyExtractors){
-    sorter.emplace(e, std::vector<int>{});
+    sorter.emplace(e.get(), std::vector<int>{});
   }
 
   // check whether inputs are lgal if m_debug == true
@@ -100,7 +91,7 @@ PseudoJetContainer::extractConstituents(xAOD::Jet& jet,
 
     if(e == m_extractorRanges.end()){return false;}
    
-    sorter[(*e).m_e].push_back(pj_ind - (*e).m_lo);
+    sorter[(*e).m_e.get()].push_back(pj_ind - (*e).m_lo);
   }
 
   // send the jet to the each extractor with a vector of EDM
@@ -145,7 +136,7 @@ void PseudoJetContainer::append(const PseudoJetContainer* other) {
                    pj.set_user_index(pj.user_index() + offset);return pj;}
                  );
 
-  for(auto e : other->m_emptyExtractors){m_emptyExtractors.insert(e->clone());}
+  for(const auto &e : other->m_emptyExtractors){m_emptyExtractors.emplace(e->clone());}
 
   if (m_debug){checkInvariants("append()");}
 }
@@ -166,7 +157,7 @@ std::string PseudoJetContainer::toString(int level, int extLevel) const {
     oss << "\n Extractor dump: \n";
     for(const auto& er : m_extractorRanges){
       oss << "Extractor at [" ;
-      oss << er.m_e;
+      oss << er.m_e.get();
       oss << "]\n";
       oss << er.m_e->toString(extLevel) << '\n';
     }
diff --git a/Reconstruction/Jet/JetRec/src/MuonSegmentPseudoJetAlgorithm.cxx b/Reconstruction/Jet/JetRec/src/MuonSegmentPseudoJetAlgorithm.cxx
index 16eee29f7331cf88a2c519ecfda1fa63b8cba547..3fa800047b8c5fe8beebda4682df35743471622b 100644
--- a/Reconstruction/Jet/JetRec/src/MuonSegmentPseudoJetAlgorithm.cxx
+++ b/Reconstruction/Jet/JetRec/src/MuonSegmentPseudoJetAlgorithm.cxx
@@ -43,7 +43,7 @@ StatusCode MuonSegmentPseudoJetAlgorithm::execute(const EventContext& ctx) const
   ATH_MSG_DEBUG("Created extractor: "  << extractor->toString(0));
 
   // Put the PseudoJetContainer together
-  auto pjcont = std::make_unique<PseudoJetContainer>(extractor.release(), vpj);
+  auto pjcont = std::make_unique<PseudoJetContainer>(std::move(extractor), vpj);
   
   auto outcoll = SG::makeHandle<PseudoJetContainer>(m_outcoll,ctx);
   ATH_MSG_DEBUG("New PseudoJetContainer size " << pjcont->size());
diff --git a/Reconstruction/Jet/JetRec/src/PseudoJetAlgorithm.cxx b/Reconstruction/Jet/JetRec/src/PseudoJetAlgorithm.cxx
index 25f09cf804f95bd51e21a85c5e13c156add0c7b1..92ece334c49ac54e57668ffca6cebb75fc269eab 100644
--- a/Reconstruction/Jet/JetRec/src/PseudoJetAlgorithm.cxx
+++ b/Reconstruction/Jet/JetRec/src/PseudoJetAlgorithm.cxx
@@ -81,7 +81,7 @@ std::unique_ptr<PseudoJetContainer> PseudoJetAlgorithm::createPJContainer(const
   }
   
   // Put the PseudoJetContainer together
-  auto pjcont = std::make_unique<PseudoJetContainer>(extractor.release(), vpj);
+  auto pjcont = std::make_unique<PseudoJetContainer>(std::move(extractor), vpj);
   ATH_MSG_DEBUG("New PseudoJetContainer size " << pjcont->size());
 
   return pjcont;
diff --git a/Reconstruction/Jet/JetRec/test/PseudoJetContainerOfflineTest.cxx b/Reconstruction/Jet/JetRec/test/PseudoJetContainerOfflineTest.cxx
index 1015c929096c2fb9d8c415785d9c16575308f529..fc5c97f6feb8b1c9d4a1aa04effc271ce4243c53 100644
--- a/Reconstruction/Jet/JetRec/test/PseudoJetContainerOfflineTest.cxx
+++ b/Reconstruction/Jet/JetRec/test/PseudoJetContainerOfflineTest.cxx
@@ -77,8 +77,8 @@ protected:
   std::vector<PseudoJet> m_pjVec0;
   std::vector<PseudoJet> m_pjVec1;
 
-  IParticleExtractor* m_pExtractor_noghost;
-  IParticleExtractor* m_pExtractor_ghost;
+  std::unique_ptr<const IParticleExtractor> m_pExtractor_noghost{};
+  std::unique_ptr<const IParticleExtractor> m_pExtractor_ghost{};
 
   Jet* m_testjet0;
   Jet* m_testjet1;
@@ -103,7 +103,7 @@ TEST_F(PseudoJetContainerOfflineTest, test_noghost) {
 
 
   // create the PseudoContainer
-  PseudoJetContainer psc(m_pExtractor_noghost, m_pjVec0);
+  PseudoJetContainer psc(std::move(m_pExtractor_noghost), m_pjVec0);
 
   // check the pseudojet accessors
   // EXPECT_TRUE(psc.asVectorPseudoJet() == m_pjVec0);  
@@ -134,7 +134,7 @@ TEST_F(PseudoJetContainerOfflineTest, test_ghost) {
   // The jet containers have a JetAuxContainer, and are stored in the test store
 
   // create the PseudoContainer
-  PseudoJetContainer psc(m_pExtractor_ghost, m_pjVec0);
+  PseudoJetContainer psc(std::move(m_pExtractor_ghost), m_pjVec0);
 
   // check the pseudojet accessors
   // EXPECT_TRUE(psc.asVectorPseudoJet() == m_pjVec0);  
@@ -171,8 +171,8 @@ TEST_F(PseudoJetContainerOfflineTest, test_append) {
   bool debug{false};
   
   // create the PseudoContainers
-  PseudoJetContainer psc0(m_pExtractor_noghost, m_pjVec0);
-  PseudoJetContainer psc1(m_pExtractor_ghost, m_pjVec1);
+  PseudoJetContainer psc0(std::move(m_pExtractor_noghost), m_pjVec0);
+  PseudoJetContainer psc1(std::move(m_pExtractor_ghost), m_pjVec1);
 
   psc0.append(&psc1);
 
diff --git a/Reconstruction/Jet/JetRec/test/PseudoJetContainerTriggerTest.cxx b/Reconstruction/Jet/JetRec/test/PseudoJetContainerTriggerTest.cxx
index 17119ffe7482a67bb45873b84f828eff2aa1e930..df243563d2b0d4f1b00313da844f64a90f7acbb0 100644
--- a/Reconstruction/Jet/JetRec/test/PseudoJetContainerTriggerTest.cxx
+++ b/Reconstruction/Jet/JetRec/test/PseudoJetContainerTriggerTest.cxx
@@ -82,8 +82,8 @@ protected:
   std::vector<PseudoJet> m_pjVec0;
   std::vector<PseudoJet> m_pjVec1;
 
-  IParticleExtractor* m_pExtractor_noghost;
-  IParticleExtractor* m_pExtractor_ghost;
+  std::unique_ptr<const IParticleExtractor> m_pExtractor_noghost{};
+  std::unique_ptr<const IParticleExtractor> m_pExtractor_ghost{};
 
   Jet* m_testjet0;
   Jet* m_testjet1;
@@ -108,7 +108,7 @@ TEST_F(PseudoJetContainerTriggerTest, test_noghost) {
 
 
   // create the PseudoContainer
-  PseudoJetContainer psc(m_pExtractor_noghost, m_pjVec0);
+  PseudoJetContainer psc(std::move(m_pExtractor_noghost), m_pjVec0);
 
   // check the pseudojet accessors
   EXPECT_TRUE(*psc.casVectorPseudoJet() == m_pjVec0);
@@ -138,7 +138,7 @@ TEST_F(PseudoJetContainerTriggerTest, test_ghost) {
   // The jet containers have a JetAuxContainer, and are stored in the test store
 
   // create the PseudoContainer
-  PseudoJetContainer psc(m_pExtractor_ghost, m_pjVec0);
+  PseudoJetContainer psc(std::move(m_pExtractor_ghost), m_pjVec0);
 
   // check the pseudojet accessors
   EXPECT_TRUE(*psc.casVectorPseudoJet() == m_pjVec0);
@@ -174,8 +174,8 @@ TEST_F(PseudoJetContainerTriggerTest, test_append) {
   bool debug{true};
   
   // create the PseudoContainers
-  PseudoJetContainer psc0(m_pExtractor_noghost, m_pjVec0);
-  PseudoJetContainer psc1(m_pExtractor_ghost, m_pjVec1);
+  PseudoJetContainer psc0(std::move(m_pExtractor_noghost), m_pjVec0);
+  PseudoJetContainer psc1(std::move(m_pExtractor_ghost), m_pjVec1);
 
   psc0.append(&psc1);
 
diff --git a/Reconstruction/Jet/JetRec/test/testHelpers.h b/Reconstruction/Jet/JetRec/test/testHelpers.h
index 80164291001230365bdf04986c38d3aab9b7a920..ad264b0c51f44690f96c16e27eb4e90785141734 100644
--- a/Reconstruction/Jet/JetRec/test/testHelpers.h
+++ b/Reconstruction/Jet/JetRec/test/testHelpers.h
@@ -19,6 +19,7 @@
 
 #include <iostream>
 #include <sstream>
+#include <memory>
 
 int JetContainerIndex (0);
 
@@ -80,15 +81,14 @@ struct IPtoPSConverter{
   }
 };
 
-IParticleExtractor* makeExtractor(const xAOD::IParticleContainer* iparticles,
+std::unique_ptr<const IParticleExtractor> makeExtractor(const xAOD::IParticleContainer* iparticles,
                                   bool isGhost, bool isTrigger=false){
   
   // Create an Extractor
   std::string label("EMTopo");
-  IParticleExtractor* extractor = new IParticleExtractor(iparticles,
-                                                         label,
-                                                         isGhost,
-                                                         isTrigger);
-  return extractor;
+  return std::make_unique<const IParticleExtractor>(iparticles,
+                                                    label,
+                                                    isGhost,
+                                                    isTrigger);
 }
 
diff --git a/Reconstruction/Jet/JetUncertainties/JetUncertainties/UncertaintyEnum.h b/Reconstruction/Jet/JetUncertainties/JetUncertainties/UncertaintyEnum.h
index 3433aaa688ec444a38d06b8d228731cc899de9af..74dea8c24814ed6a84d7c473c8a1e9d7b4ceb6af 100644
--- a/Reconstruction/Jet/JetUncertainties/JetUncertainties/UncertaintyEnum.h
+++ b/Reconstruction/Jet/JetUncertainties/JetUncertainties/UncertaintyEnum.h
@@ -91,7 +91,7 @@ namespace CompScaleVar
     {
         // Error state
         UNKNOWN=0,      // Failure/unset/etc
-        
+
         // Scale uncertainties
         FourVec,        // The full jet 4-vector
         Pt,             // The jet pT
@@ -106,7 +106,7 @@ namespace CompScaleVar
         C2Beta1,        // The value of C_2^{beta=1} (ECF ratio)
         Qw,             // The value of Qw
         TagScaleFactor, // Tagging efficiency SF
-        
+
         // Resolution uncertainties
         MassRes,        // The jet mass resolution, relative
         MassResAbs,     // The jet mass resolution, absolute
@@ -212,6 +212,14 @@ namespace JetTopology
     TypeEnum stringToEnum(const TString type);
 }
 
+// Unset the TRUE and FALSE macros, defined in a custom way on macOS 11.
+#ifdef TRUE
+#  undef TRUE
+#endif
+#ifdef FALSE
+#  undef FALSE
+#endif
+
 namespace ExtendedBool
 {
     enum TypeEnum
diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.h b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.h
index dbebf292802289456f03abf500cf0d5d62604492..5e1c2c3386c9490f59d52fb03832821cbd0b4870 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.h
@@ -20,7 +20,7 @@
 
 #include <string>
 
-// uses (further down the call chain) the MuPatHitTool that has a mutable cache of pointers to-be-deleted and the end of the event
+// uses (further down the call chain) the MuPatHitTool that has a mutable cache of pointers to-be-deleted at the end of the event
 // thus, currently, the MuonCombinedInDetExtensionAlg cannot become an AthReentrantAlgorithm
 class MuonCombinedInDetExtensionAlg : public AthAlgorithm {
   public:
@@ -92,12 +92,11 @@ class MuonCombinedInDetExtensionAlg : public AthAlgorithm {
         "MuGirlMETracks",
         "ME track collection",
     };
-    // these are the MuGirl segments inputs
     SG::WriteHandleKey<Trk::SegmentCollection> m_segments{
         this,
         "SegmentCollection",
-        "MuGirlSegments",
-        "Segment collection",
+        "",
+        "specify segment collection",
     };
 
     Gaudi::Property<bool> m_usePRDs{this, "usePRDs", false};
diff --git a/Reconstruction/MuonIdentification/MuonCombinedConfig/python/MuonCombinedReconstructionConfig.py b/Reconstruction/MuonIdentification/MuonCombinedConfig/python/MuonCombinedReconstructionConfig.py
index 3ba9de7e4146939ecfd4614fe47d9f952912f96a..eee23de4e0d06bd323116d8d09ba4b8377ef434c 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedConfig/python/MuonCombinedReconstructionConfig.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedConfig/python/MuonCombinedReconstructionConfig.py
@@ -32,7 +32,6 @@ def MuonCaloTagAlgCfg(flags, name="MuonCaloTagAlg",**kwargs):
     kwargs.setdefault("TagMap","caloTagMap")
     kwargs.setdefault("CombinedTrackCollection","")
     kwargs.setdefault("METrackCollection","")
-    kwargs.setdefault("SegmentCollection","")
     kwargs.setdefault("HasCSC", flags.Detector.GeometryCSC )
     kwargs.setdefault("HasSTgc", flags.Detector.GeometrysTGC )
     kwargs.setdefault("HasMM", flags.Detector.GeometryMM )
@@ -111,6 +110,7 @@ def MuonInsideOutRecoAlgCfg(flags, name="MuonInsideOutRecoAlg", **kwargs ):
     kwargs.setdefault("HasSTgc", flags.Detector.GeometrysTGC )
     kwargs.setdefault("HasMM", flags.Detector.GeometryMM )
     kwargs.setdefault("TagMap","muGirlTagMap")
+    kwargs.setdefault("SegmentCollection","MuGirlSegments")
     alg = CompFactory.MuonCombinedInDetExtensionAlg(name,**kwargs)
     result.addEventAlgo( alg, primary=True )
     return result
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
index 3baeb10f2c1ec4949e29650d94ba3c2b29395028..7bfa7f169bb606ceb36caee7801b84d0c5f46b8c 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
@@ -15,24 +15,12 @@ from InDetRecExample.InDetKeys import InDetKeys
 from InDetRecExample.InDetJobProperties import InDetFlags
 from TriggerJobOpts.TriggerFlags import TriggerFlags
 
-def MuonCombinedInDetExtensionAlg(name="MuonCombinedInDetExtensionAlg",**kwargs):
-    tools = []
-    if muonCombinedRecFlags.doCaloTrkMuId():
-        tools.append(getPublicTool("MuonCaloTagTool"))
-        kwargs.setdefault("TagMap", "caloTagMap" )
-    kwargs.setdefault("MuonCombinedInDetExtensionTools", tools )
-    kwargs.setdefault("HasCSC", MuonGeometryFlags.hasCSC() )
-    kwargs.setdefault("HasSTgc", MuonGeometryFlags.hasSTGC() )
-    kwargs.setdefault("HasMM", MuonGeometryFlags.hasMM() )
-    return CfgMgr.MuonCombinedInDetExtensionAlg(name,**kwargs)
-
 def MuonCaloTagAlg(name="MuonCaloTagAlg",**kwargs):
     tools = [getPublicTool("MuonCaloTagTool")]
     kwargs.setdefault("MuonCombinedInDetExtensionTools", tools )
     kwargs.setdefault("TagMap","caloTagMap")
     kwargs.setdefault("CombinedTrackCollection","")
     kwargs.setdefault("METrackCollection","")
-    kwargs.setdefault("SegmentCollection","")
     kwargs.setdefault("HasCSC", MuonGeometryFlags.hasCSC() )
     kwargs.setdefault("HasSTgc", MuonGeometryFlags.hasSTGC() )
     kwargs.setdefault("HasMM", MuonGeometryFlags.hasMM() )
@@ -45,13 +33,11 @@ def MuonCaloTagAlg_LRT(name="MuonCaloTagAlg_LRT", **kwargs):
     kwargs.setdefault("InDetCandidateLocation", MuonCbKeys.InDetTrackParticlesLargeD0())  
     kwargs.setdefault("CombinedTrackCollection","")
     kwargs.setdefault("METrackCollection","")
-    kwargs.setdefault("SegmentCollection","")
     kwargs.setdefault("HasCSC", MuonGeometryFlags.hasCSC() )
     kwargs.setdefault("HasSTgc", MuonGeometryFlags.hasSTGC() )
     kwargs.setdefault("HasMM", MuonGeometryFlags.hasMM() )
     return CfgMgr.MuonCombinedInDetExtensionAlg(name,**kwargs)
 
-
 def MuonSegmentTagAlg( name="MuonSegmentTagAlg", **kwargs ):
     kwargs.setdefault("MuonSegmentTagTool", getPublicTool("MuonSegmentTagTool") )
     return CfgMgr.MuonSegmentTagAlg(name,**kwargs)
@@ -63,7 +49,6 @@ def MuonSegmentTagAlg_LRT( name="MuonSegmentTagAlg_LRT", **kwargs ):
     kwargs.setdefault("MuonSegmentLocation","MuonSegments")
     return CfgMgr.MuonSegmentTagAlg(name,**kwargs)
 
-                                                                        
 def MuonInsideOutRecoAlg( name="MuonInsideOutRecoAlg", **kwargs ):
     tools = [getPublicTool("MuonInsideOutRecoTool") ]
     kwargs.setdefault("MuonCombinedInDetExtensionTools", tools )
@@ -72,9 +57,9 @@ def MuonInsideOutRecoAlg( name="MuonInsideOutRecoAlg", **kwargs ):
     kwargs.setdefault("HasSTgc", MuonGeometryFlags.hasSTGC() )
     kwargs.setdefault("HasMM", MuonGeometryFlags.hasMM() )
     kwargs.setdefault("TagMap","muGirlTagMap")
+    kwargs.setdefault("SegmentCollection","MuGirlSegments")
     return CfgMgr.MuonCombinedInDetExtensionAlg(name,**kwargs)
 
-
 def MuGirlAlg_LRT( name="MuGirlAlg_LRT", **kwargs ):
     tools = [getPublicTool("MuonInsideOutRecoTool") ]
     kwargs.setdefault("MuonCombinedInDetExtensionTools", tools )
@@ -88,11 +73,7 @@ def MuGirlAlg_LRT( name="MuGirlAlg_LRT", **kwargs ):
     kwargs.setdefault("CombinedTrackCollection",MuonCbKeys.MuGirlMuonsLargeD0())
     kwargs.setdefault("InDetCandidateLocation",MuonCbKeys.InDetTrackParticlesLargeD0())
     return CfgMgr.MuonCombinedInDetExtensionAlg(name,**kwargs)
-    
 
-                                  
-                               
-                                 
 def MuGirlStauAlg(name="MuGirlStauAlg",**kwargs):
     tools = [getPublicTool("MuonStauRecoTool")]
     kwargs.setdefault("MuonCombinedInDetExtensionTools", tools )
diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx
index c7b1a3d09ba8d3df48284b05e9af61b338e7f3f2..1b5f4ffa97ac0caa4a20181906fe83dee7855429 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx
@@ -788,7 +788,8 @@ namespace MuonCombined {
     if( tracks.size() == 1 ) return true;
 
     // more than 1 track call ambiguity solver and select first track
-    TrackCollection* resolvedTracks=m_trackAmbibuityResolver->process(&tracks);
+    std::unique_ptr<TrackCollection> resolvedTracks
+      (m_trackAmbibuityResolver->process(&tracks));
     Trk::Track* selectedTrack = resolvedTracks->front();
 
     // get candidate
diff --git a/Reconstruction/RecBackground/RecBackgroundAlgs/RecBackgroundAlgs/BeamBackgroundFiller.h b/Reconstruction/RecBackground/RecBackgroundAlgs/RecBackgroundAlgs/BeamBackgroundFiller.h
index a1ab60154fd0731ffaac183c8b5fb11c74f39f66..3fc5e5a9b5af406459428cfa0ffca9c98150325e 100644
--- a/Reconstruction/RecBackground/RecBackgroundAlgs/RecBackgroundAlgs/BeamBackgroundFiller.h
+++ b/Reconstruction/RecBackground/RecBackgroundAlgs/RecBackgroundAlgs/BeamBackgroundFiller.h
@@ -64,10 +64,10 @@ private:
   void PrintMatchMatrix() {};
 
   /** ReadHandleKey for Trk::SegmentCollection from CSC */
-  SG::ReadHandleKey<Trk::SegmentCollection> m_cscSegmentContainerReadHandleKey{this,"cscSegmentContainerKey","NCB_MuonSegments","ReadHandleKey for Trk::SegmentCollection from CSC"};
+  SG::ReadHandleKey<Trk::SegmentCollection> m_cscSegmentContainerReadHandleKey{this,"cscSegmentContainerKey","NCB_TrackMuonSegments","ReadHandleKey for Trk::SegmentCollection from CSC"};
 
   /** ReadHandleKey for Trk::SegmentCollection from MDT */
-  SG::ReadHandleKey<Trk::SegmentCollection> m_mdtSegmentContainerReadHandleKey{this,"mdtSegmentContainerKey","MuonSegments","ReadHandleKey for Trk::SegmentCollection from MDT"};
+  SG::ReadHandleKey<Trk::SegmentCollection> m_mdtSegmentContainerReadHandleKey{this,"mdtSegmentContainerKey","TrackMuonSegments","ReadHandleKey for Trk::SegmentCollection from MDT"};
 
   /** ReadHandleKey for CaloClusterContainer */
   SG::ReadHandleKey<xAOD::CaloClusterContainer> m_caloClusterContainerReadHandleKey{this,"caloClusterContainerKey","CaloCalTopoClusters","ReadHandleKey for CaloClusterContainer"};
diff --git a/Reconstruction/RecBackground/RecBackgroundAlgs/share/RecBackground_jobOptions.py b/Reconstruction/RecBackground/RecBackgroundAlgs/share/RecBackground_jobOptions.py
index 9937ad41a639135cb5d12da4e485fbd455f787ce..df66e6a5dd4fec3a3300eafc18090faebbdc5c6d 100644
--- a/Reconstruction/RecBackground/RecBackgroundAlgs/share/RecBackground_jobOptions.py
+++ b/Reconstruction/RecBackground/RecBackgroundAlgs/share/RecBackground_jobOptions.py
@@ -8,7 +8,7 @@ if rec.doInDet() and rec.doMuon() and rec.doCalo() and \
     DetFlags.detdescr.Muon_on() and DetFlags.detdescr.Calo_on() and DetFlags.detdescr.ID_on() :
   include ("LArCellRec/LArCollisionTime_jobOptions.py")
   from RecBackgroundAlgs.RecBackgroundAlgsConf import BeamBackgroundFiller
-  BeamBackgroundFiller=BeamBackgroundFiller(cscSegmentContainerKey=("NCB_MuonSegments" if MuonGeometryFlags.hasCSC() else ""))
+  BeamBackgroundFiller=BeamBackgroundFiller(cscSegmentContainerKey=("NCB_TrackMuonSegments" if MuonGeometryFlags.hasCSC() else ""))
   topSequence+=BeamBackgroundFiller
 
   from BCM_BackgroundAlgs.BCM_BackgroundAlgsConf import BcmCollisionTimeAlg
diff --git a/Reconstruction/iPat/iPatInterfaces/iPatInterfaces/ITruthParameters.h b/Reconstruction/iPat/iPatInterfaces/iPatInterfaces/ITruthParameters.h
index 234ef43245caa278e7ccb0944c1aa7e2ef5bd36e..6581ddaab17876c2e139070ccab5bb10bf6ad939 100755
--- a/Reconstruction/iPat/iPatInterfaces/iPatInterfaces/ITruthParameters.h
+++ b/Reconstruction/iPat/iPatInterfaces/iPatInterfaces/ITruthParameters.h
@@ -44,7 +44,7 @@ public:
      
     /**ITruthParameters interface:
        obtain PerigeeParameters corresponding to a simulated particle from a HepMC GenParticle */
-    virtual const PerigeeParameters*	perigeeParameters(const HepMC::GenParticle&	particle,
+    virtual const PerigeeParameters*	perigeeParameters(HepMC::ConstGenParticlePtr	particle,
 							  const Amg::Vector3D&		vertex) = 0;
        
     /**ITruthParameters interface: 
@@ -53,7 +53,7 @@ public:
            
     /**ITruthParameters interface: 
        obtain TrackParameters corresponding to a simulated particle from a HepMC GenParticle */
-    virtual const TrackParameters*	trackParameters(const HepMC::GenParticle& particle) = 0;
+    virtual const TrackParameters*	trackParameters(HepMC::ConstGenParticlePtr particle) = 0;
 };
 
 #endif // IPATINTERFACES_ITRUTHPARAMETERS_H
diff --git a/Reconstruction/iPat/iPatRecExample/share/iPatRec_jobOptions.py b/Reconstruction/iPat/iPatRecExample/share/iPatRec_jobOptions.py
index d65f219d642c4df446fed7e3cebe140e50e09270..5465f4a2cf49067c0e55f796672d9eee1887f204 100755
--- a/Reconstruction/iPat/iPatRecExample/share/iPatRec_jobOptions.py
+++ b/Reconstruction/iPat/iPatRecExample/share/iPatRec_jobOptions.py
@@ -89,14 +89,6 @@ if DetFlags.detdescr.ID_on() and (DetFlags.haveRIO.pixel_on() or DetFlags.haveRI
     ToolSvc += TrackFollower(name = 'TrackFollower',
                              TRT_Recon = "TRT_Recon/TRT_Recon")
     
-    # include the RegionSelector service
-    if DetFlags.haveRIO.TRT_on():
-        from AthenaCommon.AppMgr import ServiceMgr
-        # from RegionSelector.RegSelSvcDefault import RegSelSvcDefault
-        # iPatRegSelSvc  = RegSelSvcDefault()
-        # iPatRegSelSvc.enableTRT = True
-        # ServiceMgr += iPatRegSelSvc
-
     # -------------------------------------------------------------
     # Algorithm Private Options: iPatRec
     # -------------------------------------------------------------
diff --git a/Reconstruction/iPat/iPatTruthTrajectory/iPatTruthTrajectory/TruthParameters.h b/Reconstruction/iPat/iPatTruthTrajectory/iPatTruthTrajectory/TruthParameters.h
index 963db93f57debe7ec3a7937ed454e4806697e543..2fd6367c4ceae113ba9ef7d4d2422ba194c66fe3 100755
--- a/Reconstruction/iPat/iPatTruthTrajectory/iPatTruthTrajectory/TruthParameters.h
+++ b/Reconstruction/iPat/iPatTruthTrajectory/iPatTruthTrajectory/TruthParameters.h
@@ -10,7 +10,7 @@
 #ifndef IPATTRUTHTRAJECTORY_TRUTHPARAMETERS_H
 #define IPATTRUTHTRAJECTORY_TRUTHPARAMETERS_H
 
-//<<<<<< INCLUDES                                                       >>>>>>
+//INCLUDES
 
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "AtlasHepMC/GenParticle.h"
@@ -20,7 +20,7 @@
 #include "iPatInterfaces/ITruthParameters.h"
 #include "iPatTrackParameters/PerigeeParameters.h"
 
-//<<<<<< CLASS DECLARATIONS                                             >>>>>>
+//CLASS DECLARATIONS
 
 class ITruthSelector;
 namespace Trk  { class IIntersector; }
@@ -39,14 +39,14 @@ public:
     StatusCode			finalize();
 
     const PerigeeParameters*	perigeeParameters(int barcode, const Amg::Vector3D& vertex);
-    const PerigeeParameters*	perigeeParameters(const HepMC::GenParticle& particle,
+    const PerigeeParameters*	perigeeParameters(HepMC::ConstGenParticlePtr particle,
 						  const Amg::Vector3D& vertex);
     const TrackParameters*	trackParameters(int barcode);
-    const TrackParameters*	trackParameters(const HepMC::GenParticle& particle);
+    const TrackParameters*	trackParameters(HepMC::ConstGenParticlePtr particle);
   
 private:
-    const HepMC::GenParticle*	findParticle(int barcode);
-    void			trackFromParticle(const HepMC::GenParticle& particle);
+    HepMC::ConstGenParticlePtr	findParticle(int barcode);
+    void			trackFromParticle(HepMC::ConstGenParticlePtr particle);
 
 
     // configuration: tools etc
diff --git a/Reconstruction/iPat/iPatTruthTrajectory/src/TruthParameters.cxx b/Reconstruction/iPat/iPatTruthTrajectory/src/TruthParameters.cxx
index 46396ea1d7fd6442f17cb2d3c6bce2dc0824231e..f7f25e06724ce9c2216ce4f66b2f8365b2c1e80e 100755
--- a/Reconstruction/iPat/iPatTruthTrajectory/src/TruthParameters.cxx
+++ b/Reconstruction/iPat/iPatTruthTrajectory/src/TruthParameters.cxx
@@ -7,7 +7,7 @@
  particle, either from its barcode or from a HepMC GenParticle.
 ***************************************************************************/
 
-//<<<<<< INCLUDES                                                       >>>>>>
+//INCLUDES
 
 #include <cmath>
 #include "GaudiKernel/IPartPropSvc.h"
@@ -17,7 +17,7 @@
 #include "GenInterfaces/ITruthSelector.h"
 #include "iPatTruthTrajectory/TruthParameters.h"
 
-//<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
+//CLASS STRUCTURE INITIALIZATION
 
 TruthParameters::TruthParameters (const std::string&	type,
 				  const std::string&	name, 
@@ -39,11 +39,11 @@ TruthParameters::~TruthParameters (void)
 
 //<<<<<< PRIVATE MEMBER FUNCTION DEFINITIONS>>>>>>
 
-const HepMC::GenParticle*
+HepMC::ConstGenParticlePtr
 TruthParameters::findParticle (int barCode)
 {
     // protect against real data, fakes ...
-    const HepMC::GenParticle* particle = 0;
+    HepMC::ConstGenParticlePtr particle{nullptr};
     if (barCode == 0) return particle;
   
     // retrieve McEventCollection (from truthSelector to give G3/4 simulation independence)
@@ -56,26 +56,26 @@ TruthParameters::findParticle (int barCode)
 }
 
 void
-TruthParameters::trackFromParticle(const HepMC::GenParticle& particle)
+TruthParameters::trackFromParticle(HepMC::ConstGenParticlePtr particle)
 {
     // protect against missing production_vertex
-    if (! particle.production_vertex()) return;
+    if (! particle->production_vertex()) return;
 
     // ensure known particle
     m_intersection		=  0;
-    int	pdgCode			=  particle.pdg_id();
+    int	pdgCode			=  particle->pdg_id();
     if (! m_particleDataTable->particle(std::abs(pdgCode))) return;
 
     // fill intersection, qOverP
-    Amg::Vector3D position( particle.production_vertex()->position().x(),
-			    particle.production_vertex()->position().y(),
-			    particle.production_vertex()->position().z());
-    m_qOverP			=  1./std::sqrt(particle.momentum().px()*particle.momentum().px() +
-						particle.momentum().py()*particle.momentum().py() +
-						particle.momentum().pz()*particle.momentum().pz());
-    Amg::Vector3D direction( m_qOverP*particle.momentum().px(),
-			     m_qOverP*particle.momentum().py(),
-			     m_qOverP*particle.momentum().pz());
+    Amg::Vector3D position( particle->production_vertex()->position().x(),
+			    particle->production_vertex()->position().y(),
+			    particle->production_vertex()->position().z());
+    m_qOverP			=  1./std::sqrt(particle->momentum().px()*particle->momentum().px() +
+						particle->momentum().py()*particle->momentum().py() +
+						particle->momentum().pz()*particle->momentum().pz());
+    Amg::Vector3D direction( m_qOverP*particle->momentum().px(),
+			     m_qOverP*particle->momentum().py(),
+			     m_qOverP*particle->momentum().pz());
     m_intersection		=  new Trk::TrackSurfaceIntersection(position,direction,0.);
 	
     // fill trackParameters
@@ -94,7 +94,7 @@ TruthParameters::trackFromParticle(const HepMC::GenParticle& particle)
     m_trackParameters.fill(position,cosPhi,sinPhi,sinThetaInv*cosTheta,sinThetaInv*m_qOverP);
 }
 
-//<<<<<< PUBLIC MEMBER FUNCTION DEFINITIONS                             >>>>>>
+// PUBLIC MEMBER FUNCTION DEFINITIONS
 
 StatusCode
 TruthParameters::initialize()
@@ -143,9 +143,9 @@ TruthParameters::finalize()
 const PerigeeParameters*
 TruthParameters::perigeeParameters (int barCode, const Amg::Vector3D& vertex)
 {
-    const HepMC::GenParticle* particle = findParticle(barCode);
+    auto particle = findParticle(barCode);
     if (! particle)		return 0;
-    trackFromParticle(*particle);
+    trackFromParticle(particle);
     if (! m_intersection)	return 0;
 
     Trk::PerigeeSurface surface(vertex);
@@ -181,7 +181,7 @@ TruthParameters::perigeeParameters (int barCode, const Amg::Vector3D& vertex)
 }
 
 const PerigeeParameters*
-TruthParameters::perigeeParameters (const HepMC::GenParticle& particle, const Amg::Vector3D& vertex)
+TruthParameters::perigeeParameters (HepMC::ConstGenParticlePtr particle, const Amg::Vector3D& vertex)
 {
     trackFromParticle(particle);
     if (! m_intersection)	return 0;
@@ -220,16 +220,16 @@ TruthParameters::perigeeParameters (const HepMC::GenParticle& particle, const Am
 const TrackParameters*
 TruthParameters::trackParameters (int barCode)
 {
-    const HepMC::GenParticle* particle = findParticle(barCode);
+    auto particle = findParticle(barCode);
     if (! particle)		return 0;
-    trackFromParticle(*particle);
+    trackFromParticle(particle);
     if (! m_intersection)	return 0;
     delete m_intersection;
     return &m_trackParameters;
 }
 
 const TrackParameters*
-TruthParameters::trackParameters (const HepMC::GenParticle& particle)
+TruthParameters::trackParameters (HepMC::ConstGenParticlePtr particle)
 {
     trackFromParticle(particle);
     if (! m_intersection)	return 0;
diff --git a/Simulation/Digitization/python/DigitizationConfigFlags.py b/Simulation/Digitization/python/DigitizationConfigFlags.py
index 9bd2e33ff737f667d4c49bc24e0e364e21fda3ee..b89326551cc61149148edab42e7e275e486888b8 100644
--- a/Simulation/Digitization/python/DigitizationConfigFlags.py
+++ b/Simulation/Digitization/python/DigitizationConfigFlags.py
@@ -140,9 +140,6 @@ def createDigitizationCfgFlags():
     flags.addFlag("Digitization.PU.NumberOfCavern", 0.0)
     # Repeating pattern to determine which events to simulate when using Stepping Cache
     flags.addFlag("Digitization.PU.SignalPatternForSteppingCache", [])
-    # Configure EvtIdModifierSvc with a list of dictionaries of the form:
-    # {'run': 152166, 'lb': 202, 'starttstamp': 1269948352889940910, 'dt': 104.496, 'evts': 1, 'mu': 0.005, 'force_new': False}
-    flags.addFlag("Digitization.PU.RunAndLumiOverrideList", [])
     
     return flags
 
diff --git a/Simulation/Digitization/python/DigitizationParametersConfig.py b/Simulation/Digitization/python/DigitizationParametersConfig.py
index 87f1fc7848f82c7dd1a44dd9e4050abce941e975..07779269ecc5c26c723cc13d89d36e9cec0f9cd1 100644
--- a/Simulation/Digitization/python/DigitizationParametersConfig.py
+++ b/Simulation/Digitization/python/DigitizationParametersConfig.py
@@ -1,27 +1,13 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
+from AthenaKernel.EventIdOverrideConfig import getMinMaxRunNumbers
 from AthenaCommon.Logging import logging
 logDigitizationWriteMetadata = logging.getLogger( 'DigitizationParametersConfig' )
 
-myRunNumber = 0
-myEndRunNumber = 2147483647 # the max run number
-
-def getRunNumberRangeForOutputMetadata(ConfigFlags):
-    myRunNumber = ConfigFlags.Input.RunNumber[0]
-    myEndRunNumber = 2147483647 # the max run number
-
-    if myRunNumber > 0 :
-        logDigitizationWriteMetadata.info('Found Run Number %s in hits file metadata.', str(myRunNumber) )
-        myEndRunNumber = myRunNumber+1 # got a reasonable run number so set end run to be the next run after this one.
-    else :
-        logDigitizationWriteMetadata.info('Found unexpected Run Number %s in hits file metadata. Not overriding RunNumber to match hits file for this job.', str(myRunNumber) )
-        myRunNumber = 0
-    return myRunNumber, myEndRunNumber
-
 def writeDigitizationMetadata(ConfigFlags):
     from IOVDbMetaDataTools import ParameterDbFiller
     dbFiller = ParameterDbFiller.ParameterDbFiller()
-    myRunNumber, myEndRunNumber = getRunNumberRangeForOutputMetadata(ConfigFlags)
+    myRunNumber, myEndRunNumber = getMinMaxRunNumbers(ConfigFlags)
     logDigitizationWriteMetadata.debug('ParameterDbFiller BeginRun = %s', str(myRunNumber) )
     dbFiller.setBeginRun(myRunNumber)
     logDigitizationWriteMetadata.debug('ParameterDbFiller EndRun   = %s', str(myEndRunNumber) )
diff --git a/Simulation/Digitization/python/PileUpConfigNew.py b/Simulation/Digitization/python/PileUpConfigNew.py
index 72194f7b362e3679e982a3a2e75ee9e8a38c3c21..691d9ed1002194e7a242bad98b926ca2bb68073f 100644
--- a/Simulation/Digitization/python/PileUpConfigNew.py
+++ b/Simulation/Digitization/python/PileUpConfigNew.py
@@ -311,7 +311,7 @@ def PileUpEventLoopMgrCfg(flags, name="PileUpEventLoopMgr", **kwargs):
     kwargs.setdefault("firstXing", flags.Digitization.PU.InitialBunchCrossing)
     kwargs.setdefault("lastXing", flags.Digitization.PU.FinalBunchCrossing)
 
-    if flags.Digitization.PU.RunAndLumiOverrideList:
+    if flags.Input.RunAndLumiOverrideList:
         kwargs.setdefault("MaxMinBiasCollPerXing", maxNevtsPerXing(flags))
         acc.merge(LumiProfileSvcCfg(flags))
         kwargs.setdefault("BeamLuminosity", acc.getService("LumiProfileSvc"))
diff --git a/Simulation/Digitization/python/RunDependentConfigNew.py b/Simulation/Digitization/python/RunDependentConfigNew.py
index 8aa31ec86093535dd3e094d90c7bae1e60fa1c11..84273ffbe66029ffeb4b2bd167866876494a117b 100644
--- a/Simulation/Digitization/python/RunDependentConfigNew.py
+++ b/Simulation/Digitization/python/RunDependentConfigNew.py
@@ -8,74 +8,10 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
 
 # Auxiliary
-def add_modifier(run_nbr=None, evt_nbr=None, time_stamp=None, lbk_nbr=None, nevts=1):
-    
-    if run_nbr is None:
-        modify_run_nbr = 0
-        run_nbr = 0
-    else:
-        modify_run_nbr = 1
-
-    if evt_nbr is None:
-        modify_evt_nbr = 0
-        evt_nbr = 0
-    else:
-        modify_evt_nbr = 1
-
-    if time_stamp is None:
-        modify_time_stamp = 0
-        time_stamp = 0
-    else:
-        modify_time_stamp = 1
-
-    if lbk_nbr is None:
-        modify_lbk_nbr = 0
-        lbk_nbr = 0
-    else:
-        modify_lbk_nbr = 1
-
-    mod_bit = int(0b0000
-                  | (modify_run_nbr << 0)
-                  | (modify_evt_nbr << 1)
-                  | (modify_time_stamp << 2)
-                  | (modify_lbk_nbr << 3))
-
-    return [run_nbr, evt_nbr, time_stamp, lbk_nbr, nevts, mod_bit]
-
-
-def buildListOfModifiers(flags):
-    # migrated from RunDMCFlags.py
-    Modifiers = []
-    pDicts = flags.Digitization.PU.RunAndLumiOverrideList
-    DataRunNumber = flags.Digitization.DataRunNumber
-    
-    if pDicts:
-        for el in pDicts:
-            evt_nbr = el.get("evt_nbr", None)
-            Modifiers += add_modifier(run_nbr=el["run"], evt_nbr=evt_nbr, time_stamp=el["starttstamp"], lbk_nbr=el["lb"], nevts=el["evts"])
-    elif DataRunNumber:
-        assert DataRunNumber >= 0, (
-            "flags.Digitization.DataRunNumber %d is negative. "
-            "Use a real run number from data." % DataRunNumber)
-        
-        # Using event numbers to avoid "some very large number" setting
-        totalNumber = 1000000
-        if flags.Exec.MaxEvents > 0:
-            totalNumber = flags.Exec.MaxEvents + 1
-        if flags.Exec.SkipEvents > 0:
-            totalNumber += flags.Exec.SkipEvents
-            
-        InitialTimeStamp = flags.Sim.RunToTimestampDict.get(DataRunNumber, 1)
-
-        FirstLB = 1
-        Modifiers += add_modifier(run_nbr=DataRunNumber, lbk_nbr=FirstLB, time_stamp=InitialTimeStamp, nevts=totalNumber)
-    return Modifiers
-
-
 def maxNevtsPerXing(flags):
     """Return the largest minbias pileup value, for PileUpEvtLoopMgr caches"""
     # migrated from DigitizationFlags.py
-    pDicts = flags.Digitization.PU.RunAndLumiOverrideList
+    pDicts = flags.Input.RunAndLumiOverrideList
     return max(element["mu"] for element in pDicts)
 
 
@@ -83,7 +19,7 @@ def runLumiListAndScaleFactorLists(flags):
     # migrated from DigitizationFlags.py
     runLumiList = []
     scaleFactorList = []
-    pDicts = flags.Digitization.PU.RunAndLumiOverrideList
+    pDicts = flags.Input.RunAndLumiOverrideList
     MaxCollisionsPerXing = maxNevtsPerXing(flags)
     for element in pDicts:
         run = element["run"]
@@ -99,22 +35,6 @@ def runLumiListAndScaleFactorLists(flags):
 
 
 # Config
-def EvtIdModifierSvcCfg(flags, name="EvtIdModifierSvc", **kwargs):
-    acc = ComponentAccumulator()
-    
-    if flags.Sim.DoFullChain:
-        kwargs.setdefault("EvtStoreName", "OriginalEvent_SG")
-    else:
-        kwargs.setdefault("EvtStoreName", "StoreGateSvc")
-
-    Modifiers = buildListOfModifiers(flags)
-    if len(Modifiers) > 0:
-        kwargs.setdefault("Modifiers", Modifiers)
-
-    acc.addService(CompFactory.EvtIdModifierSvc(name, **kwargs), create=True)
-    return acc
-
-
 def LumiProfileSvcCfg(flags, name="LumiProfileSvc", **kwargs):
     acc = ComponentAccumulator()
     runLumiList, scaleFactorList = runLumiListAndScaleFactorLists(flags)
diff --git a/Simulation/Digitization/test/DigitizationPUConfigNew_test.py b/Simulation/Digitization/test/DigitizationPUConfigNew_test.py
index 74545bff07333b3b15196f3829c88466c493d4b1..6f34bdafd0d2e2a8c7c2002fc436b7aa1579cb9b 100755
--- a/Simulation/Digitization/test/DigitizationPUConfigNew_test.py
+++ b/Simulation/Digitization/test/DigitizationPUConfigNew_test.py
@@ -126,7 +126,7 @@ ConfigFlags.Tile.correctTime = False
 ConfigFlags.lock()
 
 # test this flag
-ConfigFlags.Sim.RunToTimestampDict
+ConfigFlags.IOVDb.RunToTimestampDict
 
 # Core components
 acc = MainServicesCfg(ConfigFlags)
diff --git a/Simulation/G4Atlas/G4AtlasApps/python/G4Atlas_MetadataNew.py b/Simulation/G4Atlas/G4AtlasApps/python/G4Atlas_MetadataNew.py
index f075b62cf8440aee82b94af16c38f39da67b2ae6..d37613c34c0b8952b1469fed909df6e694e4072e 100644
--- a/Simulation/G4Atlas/G4AtlasApps/python/G4Atlas_MetadataNew.py
+++ b/Simulation/G4Atlas/G4AtlasApps/python/G4Atlas_MetadataNew.py
@@ -2,6 +2,7 @@
 
 ### This module contains functions which may need to peek at the input file metadata
 
+from AthenaKernel.EventIdOverrideConfig import getMinMaxRunNumbers
 ## Get the logger
 from AthenaCommon.Logging import logging
 simMDlog = logging.getLogger('Sim_Metadata')
@@ -26,7 +27,6 @@ def fillAtlasMetadata(ConfigFlags, dbFiller):
 
     #---------  
     ## Simulated detector flags: add each enabled detector to the simulatedDetectors list
-    from AthenaCommon.DetFlags import DetFlags  # noqa: F401
     simDets = []
     for det in ['Pixel','SCT','TRT','BCM','Lucid','ZDC','ALFA','AFP','FwdRegion','LAr','HGTD','Tile','MDT','CSC','TGC','RPC','MM','sTGC','Truth','LVL1']:
         attrname = "Detector.Geometry"+det
@@ -50,22 +50,10 @@ def fillISFMetadata(dbFiller):
     dbFiller.addSimParam('Simulator', ISF_Flags.Simulator())
 
 
-def getRunNumberRangeForOutputMetadata(ConfigFlags):
-    myRunNumber = ConfigFlags.Input.RunNumber[0]
-    myEndRunNumber = 2147483647 # the max run number
-
-    #if myRunNumber > 0 :
-    #    simMDlog.info('Found Run Number %s in hits file metadata.', str(myRunNumber) )
-    #    myEndRunNumber = myRunNumber+1 # got a reasonable run number so set end run to be the next run after this one.
-    #else :
-    #    simMDlog.info('Found unexpected Run Number %s in hits file metadata. Not overriding RunNumber to match hits file for this job.', str(myRunNumber) )
-    #    myRunNumber = 0
-    return myRunNumber, myEndRunNumber
-
 def writeSimulationParametersMetadata(ConfigFlags):
     from IOVDbMetaDataTools import ParameterDbFiller
     dbFiller = ParameterDbFiller.ParameterDbFiller()
-    myRunNumber, myEndRunNumber = getRunNumberRangeForOutputMetadata(ConfigFlags)
+    myRunNumber, myEndRunNumber = getMinMaxRunNumbers(ConfigFlags)
     simMDlog.debug('ParameterDbFiller BeginRun = %s', str(myRunNumber) )
     dbFiller.setBeginRun(myRunNumber)
     simMDlog.debug('ParameterDbFiller EndRun   = %s', str(myEndRunNumber) )
diff --git a/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py b/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py
index 764ce875c6dadf879dd6f4d1b3c600975974bd28..c9eac2b62a4cc30e34da8dbaa1de78da71a564b0 100644
--- a/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py
+++ b/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py
@@ -127,14 +127,6 @@ def createSimConfigFlags():
     scf.addFlag("Sim.Fatras.GaussianMixtureModel", True) # use Gaussian mixture model for Multiple Scattering
     scf.addFlag("Sim.Fatras.BetheHeitlerScale", 1.) # scale to Bethe-Heitler contribution
 
-    # Run dependent simulation
-    # map from runNumber to timestamp; migrated from RunDMCFlags.py
-    def getRunToTimestampDict():
-        # this wrapper is intended to avoid an initial import
-        from G4AtlasApps.RunToTimestampData import RunToTimestampDict
-        return RunToTimestampDict
-    scf.addFlag("Sim.RunToTimestampDict", lambda prevFlags: getRunToTimestampDict())
-
     scf.addFlag("Sim.BeamPipeCut", 100.0)
     scf.addFlag("Sim.TightMuonStepping", False)
 
diff --git a/Simulation/G4Atlas/G4AtlasTests/src/TruthTestTool.cxx b/Simulation/G4Atlas/G4AtlasTests/src/TruthTestTool.cxx
index a5dac7b791caa2292e377df2d7dd6a2a152d0c1b..454f5bf9adb2078eea289a38cdfa212d01f89421 100644
--- a/Simulation/G4Atlas/G4AtlasTests/src/TruthTestTool.cxx
+++ b/Simulation/G4Atlas/G4AtlasTests/src/TruthTestTool.cxx
@@ -224,7 +224,6 @@ StatusCode TruthTestTool::processEvent()
       }
 
       int npart_prim=0, npart_sec=0;
-      HepMC::GenEvent::particle_const_iterator currentGenParticleIter;
       for (auto currentGenParticle: *(*currentGenEventIter)) {
 
         const HepMC::FourVector mom = currentGenParticle->momentum();
@@ -284,8 +283,9 @@ StatusCode TruthTestTool::processEvent()
         m_particle_type->Fill( particleType );
 
         if ( HepMC::barcode(currentGenParticle)<200000 ) {
-          m_p_gen->Fill( mom.rho() );
-          m_log_p_gen->Fill( log(mom.rho()) );
+          double momentum=std::sqrt(mom.x()*mom.x()+mom.y()*mom.y()+mom.z()*mom.z());
+          m_p_gen->Fill( momentum );
+          m_log_p_gen->Fill( std::log(momentum) );
           m_eta_gen->Fill( mom.eta() );
           m_phi_gen->Fill( mom.phi() );
           ++npart_prim;
diff --git a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigNew.py b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigNew.py
index 2031035e3a0fb7e3ff0395edf11c841679c7460d..5085814f5c9819e58bda06d424f6aec7f0e79b62 100644
--- a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigNew.py
+++ b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigNew.py
@@ -33,7 +33,7 @@ def DefaultSimSelectorCfg(flags, name="ISF_DefaultSimSelector", **kwargs):
 
 def DefaultParticleKillerSelectorCfg(flags, name="ISF_DefaultParticleKillerSelector", **kwargs):
     acc = ParticleKillerSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_ParticleKillerSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.ParticleKiller)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -43,7 +43,7 @@ def DefaultParticleKillerSelectorCfg(flags, name="ISF_DefaultParticleKillerSelec
 def PileupParticleKillerSelectorCfg(flags, name="ISF_PileupParticleKillerSelector", **kwargs):
     acc = ParticleKillerSvcCfg(flags)
     kwargs.setdefault("PileupBCID", [1])
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_ParticleKillerSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.ParticleKiller)
     acc.addPublicTool(CompFactory.ISF.KinematicPileupSimSelector(name, **kwargs))
@@ -52,7 +52,7 @@ def PileupParticleKillerSelectorCfg(flags, name="ISF_PileupParticleKillerSelecto
 
 def DefaultGeant4SelectorCfg(flags, name="ISF_DefaultGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -61,7 +61,7 @@ def DefaultGeant4SelectorCfg(flags, name="ISF_DefaultGeant4Selector", **kwargs):
 
 def DefaultAFIIGeant4SelectorCfg(flags, name="ISF_DefaultAFIIGeant4Selector", **kwargs):
     acc = AFIIGeant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     acc.merge(DefaultGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -69,7 +69,7 @@ def DefaultAFIIGeant4SelectorCfg(flags, name="ISF_DefaultAFIIGeant4Selector", **
 
 def DefaultLongLivedGeant4SelectorCfg(flags, name="ISF_DefaultLongLivedGeant4Selector", **kwargs):
     acc = LongLivedGeant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_LongLivedGeant4SimSvc"))
     acc.merge(DefaultGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -77,7 +77,7 @@ def DefaultLongLivedGeant4SelectorCfg(flags, name="ISF_DefaultLongLivedGeant4Sel
 
 def DefaultAFII_QS_Geant4SelectorCfg(flags, name="ISF_DefaultAFII_QS_Geant4Selector", **kwargs):
     acc = AFII_QS_Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFII_QS_Geant4SimSvc"))
     acc.merge(DefaultGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -85,7 +85,7 @@ def DefaultAFII_QS_Geant4SelectorCfg(flags, name="ISF_DefaultAFII_QS_Geant4Selec
 
 def FullGeant4SelectorCfg(flags, name="ISF_FullGeant4Selector", **kwargs):
     acc = ComponentAccumulator()
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         acc.merge(FullGeant4SimCfg(flags))
         kwargs.setdefault("Simulator", acc.getService("ISF_FullGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
@@ -95,7 +95,7 @@ def FullGeant4SelectorCfg(flags, name="ISF_FullGeant4Selector", **kwargs):
 
 def PassBackGeant4SelectorCfg(flags, name="ISF_PassBackGeant4Selector", **kwargs):
     acc = PassBackGeant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_PassBackGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -104,7 +104,7 @@ def PassBackGeant4SelectorCfg(flags, name="ISF_PassBackGeant4Selector", **kwargs
 
 def DefaultFastCaloSimSelectorCfg(flags, name="ISF_DefaultFastCaloSimSelector", **kwargs):
     acc = FastCaloSimSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastCaloSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSim)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -113,7 +113,7 @@ def DefaultFastCaloSimSelectorCfg(flags, name="ISF_DefaultFastCaloSimSelector",
 
 def DefaultLegacyAFIIFastCaloSimSelectorCfg(flags, name="ISF_DefaultLegacyAFIIFastCaloSimSelector", **kwargs):
     acc = LegacyAFIIFastCaloSimSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_LegacyAFIIFastCaloSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSim)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -122,7 +122,7 @@ def DefaultLegacyAFIIFastCaloSimSelectorCfg(flags, name="ISF_DefaultLegacyAFIIFa
 
 def DefaultFastCaloSimV2SelectorCfg(flags, name="ISF_DefaultFastCaloSimV2Selector", **kwargs):
     acc = FastCaloSimV2SvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastCaloSimSvcV2"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSimV2)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -131,7 +131,7 @@ def DefaultFastCaloSimV2SelectorCfg(flags, name="ISF_DefaultFastCaloSimV2Selecto
 
 def DefaultDNNCaloSimSelectorCfg(flags, name="ISF_DefaultDNNCaloSimSelector", **kwargs):
     acc = DNNCaloSimSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_DNNCaloSimSvc"))
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
     return acc
@@ -140,7 +140,7 @@ def DefaultDNNCaloSimSelectorCfg(flags, name="ISF_DefaultDNNCaloSimSelector", **
 def FastHitConvAlgFastCaloSimSelectorCfg(flags, name="ISF_FastHitConvAlgFastCaloSimSelector", **kwargs):
     acc = ComponentAccumulator()
     acc.merge(FastHitConvAlgFastCaloSimSvcCfg(flags))
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastHitConvAlgFastCaloSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSim)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -150,7 +150,7 @@ def FastHitConvAlgFastCaloSimSelectorCfg(flags, name="ISF_FastHitConvAlgFastCalo
 def FastHitConvAlgLegacyAFIIFastCaloSimSelectorCfg(flags, name="ISF_FastHitConvAlgLegacyAFIIFastCaloSimSelector", **kwargs):
     acc = ComponentAccumulator()
     acc.merge(FastHitConvAlgLegacyAFIIFastCaloSimSvcCfg(flags))
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastHitConvAlgLegacyAFIIFastCaloSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSim)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -159,7 +159,7 @@ def FastHitConvAlgLegacyAFIIFastCaloSimSelectorCfg(flags, name="ISF_FastHitConvA
 
 def DefaultFatrasSelectorCfg(flags, name="ISF_DefaultFatrasSelector", **kwargs):
     acc = fatrasSimServiceIDCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Fatras)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -169,7 +169,7 @@ def DefaultFatrasSelectorCfg(flags, name="ISF_DefaultFatrasSelector", **kwargs):
 def DefaultFatrasNewExtrapolationSelectorCfg(flags, name="ISF_DefaultFatrasNewExtrapolationSelector", **kwargs):
     acc = ComponentAccumulator()
     acc.merge(fatrasNewExtrapolationSimServiceIDCfg(flags))
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasNewExtrapolationSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Fatras)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -178,7 +178,7 @@ def DefaultFatrasNewExtrapolationSelectorCfg(flags, name="ISF_DefaultFatrasNewEx
 
 def DefaultParametricSimulationSelectorCfg(flags, name="ISF_DefaultParametricSimulationSelector", **kwargs):
     acc = ComponentAccumulator()
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", "ISF_ParametricSimSvc") # TODO
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Parametric)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -196,7 +196,7 @@ def FatrasPileupSelectorCfg(flags, name="ISF_FatrasPileupSelector", **kwargs):
     acc = ComponentAccumulator()
     acc.merge(fatrasPileupSimServiceIDCfg(flags))
     kwargs.setdefault("PileupBCID", [1])
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasPileupSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FatrasPileup)
     acc.merge(PileupSimSelectorCfg(flags, name, **kwargs))
@@ -210,7 +210,7 @@ def FatrasPileupSelectorCfg(flags, name="ISF_FatrasPileupSelector", **kwargs):
 def FastCaloSimPileupSelectorCfg(flags, name="ISF_FastCaloSimPileupSelector", **kwargs):
     acc = FastCaloSimPileupSvcCfg(flags)
     kwargs.setdefault("PileupBCID"  , flags.Sim.FastChain.BCID)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastCaloSimPileupSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSimPileup)
     acc.merge(PileupSimSelectorCfg(flags, name, **kwargs))
@@ -220,7 +220,7 @@ def FastCaloSimPileupSelectorCfg(flags, name="ISF_FastCaloSimPileupSelector", **
 def FastCaloSimPileupOTSelectorCfg(flags, name="ISF_FastCaloSimPileupOTSelector", **kwargs):
     acc = FastCaloSimPileupOTSvcCfg(flags)
     kwargs.setdefault("PileupBCID", flags.Sim.FastChain.BCID)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastCaloSimPileupOTSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSimPileup)
     acc.merge(PileupSimSelectorCfg(flags, name, **kwargs))
@@ -231,7 +231,7 @@ def FastCaloSimPileupOTSelectorCfg(flags, name="ISF_FastCaloSimPileupOTSelector"
 def ElectronGeant4SelectorCfg(flags, name="ISF_ElectronGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
     kwargs.setdefault("ParticlePDG", 11)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
@@ -241,7 +241,7 @@ def ElectronGeant4SelectorCfg(flags, name="ISF_ElectronGeant4Selector", **kwargs
 def NeutralGeant4SelectorCfg(flags, name="ISF_NeutralGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
     kwargs.setdefault("Charge", 0)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
@@ -252,7 +252,7 @@ def ProtonAFIIGeant4SelectorCfg(flags, name="ISF_ProtonAFIIGeant4Selector", **kw
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxMom", 750)
     kwargs.setdefault("ParticlePDG", 2212)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
@@ -261,7 +261,7 @@ def ProtonAFIIGeant4SelectorCfg(flags, name="ISF_ProtonAFIIGeant4Selector", **kw
 
 def ProtonAFII_QS_Geant4SelectorCfg(flags, name="ISF_ProtonAFII_QS_Geant4Selector", **kwargs):
     acc = AFII_QS_Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFII_QS_Geant4SimSvc"))
     acc.merge(ProtonAFIIGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -271,7 +271,7 @@ def PionAFIIGeant4SelectorCfg(flags, name="ISF_PionAFIIGeant4Selector", **kwargs
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxMom", 200)
     kwargs.setdefault("ParticlePDG", 211)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
@@ -282,7 +282,7 @@ def PionG4FastCaloGeant4Selector(flags, name="ISF_PionG4FastCaloGeant4Selector",
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxEkin", 200)
     kwargs.setdefault("ParticlePDG", 211)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
     return acc
@@ -292,7 +292,7 @@ def ProtonG4FastCaloGeant4Selector(flags, name="ISF_ProtonG4FastCaloGeant4Select
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxEkin", 400)
     kwargs.setdefault("ParticlePDG", 2212)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
     return acc
@@ -302,7 +302,7 @@ def NeutronG4FastCaloGeant4Selector(flags, name="ISF_NeutronG4FastCaloGeant4Sele
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxEkin", 400)
     kwargs.setdefault("ParticlePDG", 2112)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
     return acc
@@ -312,7 +312,7 @@ def ChargedKaonG4FastCaloGeant4Selector(flags, name="ISF_ChargedKaonG4FastCaloGe
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxEkin", 400)
     kwargs.setdefault("ParticlePDG", 321)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
     return acc
@@ -322,7 +322,7 @@ def KLongG4FastCaloGeant4Selector(flags, name="ISF_KLongG4FastCaloGeant4Selector
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxEkin", 400)
     kwargs.setdefault("ParticlePDG", 130)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
     return acc
@@ -330,7 +330,7 @@ def KLongG4FastCaloGeant4Selector(flags, name="ISF_KLongG4FastCaloGeant4Selector
 
 def PionAFII_QS_Geant4SelectorCfg(flags, name="ISF_PionAFII_QS_Geant4Selector", **kwargs):
     acc = AFII_QS_Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFII_QS_Geant4SimSvc"))
     acc.merge(PionAFIIGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -340,7 +340,7 @@ def ChargedKaonAFIIGeant4SelectorCfg(flags, name="ISF_ChargedKaonAFIIGeant4Selec
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxMom", 750)
     kwargs.setdefault("ParticlePDG", 321)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
@@ -349,7 +349,7 @@ def ChargedKaonAFIIGeant4SelectorCfg(flags, name="ISF_ChargedKaonAFIIGeant4Selec
 
 def ChargedKaonAFII_QS_Geant4SelectorCfg(flags, name="ISF_ChargedKaonAFII_QS_Geant4Selector", **kwargs):
     acc = AFII_QS_Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFII_QS_Geant4SimSvc"))
     acc.merge(ChargedKaonAFIIGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -359,7 +359,7 @@ def KLongAFIIGeant4SelectorCfg(flags, name="ISF_KLongAFIIGeant4Selector", **kwar
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxMom", 750)
     kwargs.setdefault("ParticlePDG", 130)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
@@ -368,7 +368,7 @@ def KLongAFIIGeant4SelectorCfg(flags, name="ISF_KLongAFIIGeant4Selector", **kwar
 
 def KLongAFII_QS_Geant4SelectorCfg(flags, name="ISF_KLongAFII_QS_Geant4Selector", **kwargs):
     acc = AFII_QS_Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFII_QS_Geant4SimSvc"))
     acc.merge(KLongAFIIGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -383,7 +383,7 @@ def MuonSelectorCfg(flags, name="ISF_MuonSelector", **kwargs):
 
 def MuonGeant4SelectorCfg(flags, name="ISF_MuonGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(MuonSelectorCfg(flags, name, **kwargs))
@@ -392,7 +392,7 @@ def MuonGeant4SelectorCfg(flags, name="ISF_MuonGeant4Selector", **kwargs):
 
 def MuonAFIIGeant4SelectorCfg(flags, name="ISF_MuonAFIIGeant4Selector", **kwargs):
     acc = AFIIGeant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(MuonGeant4SelectorCfg(flags, name, **kwargs))
@@ -401,7 +401,7 @@ def MuonAFIIGeant4SelectorCfg(flags, name="ISF_MuonAFIIGeant4Selector", **kwargs
 
 def MuonAFII_QS_Geant4SelectorCfg(flags, name="ISF_MuonAFII_QS_Geant4Selector", **kwargs):
     acc = AFII_QS_Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFII_QS_Geant4SimSvc"))
     acc.merge(MuonGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -409,7 +409,7 @@ def MuonAFII_QS_Geant4SelectorCfg(flags, name="ISF_MuonAFII_QS_Geant4Selector",
 
 def MuonFatrasSelectorCfg(flags, name="ISF_MuonFatrasSelector", **kwargs):
     acc = fatrasSimServiceIDCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Fatras)
     acc.merge(MuonSelectorCfg(flags, name, **kwargs))
@@ -419,7 +419,7 @@ def MuonFatrasSelectorCfg(flags, name="ISF_MuonFatrasSelector", **kwargs):
 def MuonFatrasPileupSelectorCfg(flags, name="ISF_MuonFatrasPileupSelector", **kwargs):
     acc = ComponentAccumulator()
     acc.merge(fatrasPileupSimServiceIDCfg(flags))
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasPileupSimSvc"))
     kwargs.setdefault("PileupBCID", [1])
     kwargs.setdefault("ParticlePDG", 13)
@@ -430,7 +430,7 @@ def MuonFatrasPileupSelectorCfg(flags, name="ISF_MuonFatrasPileupSelector", **kw
 
 def WithinEta5FastCaloSimSelectorCfg(flags, name="ISF_WithinEta5FastCaloSimSelector", **kwargs):
     acc = FastCaloSimSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastCaloSimSvc"))
     kwargs.setdefault("MinPosEta", -5.0)
     kwargs.setdefault("MaxPosEta",  5.0)
@@ -441,7 +441,7 @@ def WithinEta5FastCaloSimSelectorCfg(flags, name="ISF_WithinEta5FastCaloSimSelec
 
 def EtaGreater5ParticleKillerSimSelectorCfg(flags, name="ISF_EtaGreater5ParticleKillerSimSelector", **kwargs):
     acc = ParticleKillerSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_ParticleKillerSvc"))
     kwargs.setdefault("MinPosEta", -5.0)
     kwargs.setdefault("MaxPosEta",  5.0)
@@ -453,7 +453,7 @@ def EtaGreater5ParticleKillerSimSelectorCfg(flags, name="ISF_EtaGreater5Particle
 
 def EtaGreater5PileupParticleKillerSimSelectorCfg(flags, name="ISF_EtaGreater5PileupParticleKillerSimSelector", **kwargs):
     acc = ParticleKillerSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_ParticleKillerSvc"))
     kwargs.setdefault("MinPosEta", -5.0)
     kwargs.setdefault("MaxPosEta",  5.0)
@@ -476,7 +476,7 @@ def PhotonConeSelectorCfg(flags, name="ISF_PhotonConeSelector", **kwargs):
 
 def PhotonConeFatrasSelectorCfg(flags, name="ISF_PhotonConeFatrasSelector", **kwargs):
     acc = fatrasSimServiceIDCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Fatras)
     acc.merge(PhotonConeSelectorCfg(flags, name, **kwargs))
@@ -485,7 +485,7 @@ def PhotonConeFatrasSelectorCfg(flags, name="ISF_PhotonConeFatrasSelector", **kw
 
 def PhotonConeGeant4SelectorCfg(flags, name="ISF_PhotonConeGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(PhotonConeSelectorCfg(flags, name, **kwargs))
@@ -508,7 +508,7 @@ def HiggsLeptonsConeSimSelectorCfg(flags, name="ISF_HiggsLeptonsConeSimSelector"
 
 def HiggsLeptonsConeGeant4SelectorCfg(flags, name="ISF_HiggsLeptonsConeGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(HiggsLeptonsConeSimSelectorCfg(flags, name, **kwargs))
@@ -530,7 +530,7 @@ def HiggsLeptonsConeGeant4CaloSelectorCfg(flags, name="ISF_HiggsLeptonsConeGeant
 
 def WLeptonsConeGeant4SelectorCfg(flags, name="ISF_WLeptonsConeGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     kwargs.setdefault("ConeCreatorMinPt", 0.)
@@ -548,7 +548,7 @@ def ZLeptonsDirectionConeGeant4SelectorCfg(flags, name="ISF_ZLeptonsDirectionCon
     # this selector picks all particles with a mometum direction
     # within DeltaR<ConeSize relative to the Z decay lepton directions
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     kwargs.setdefault("ConeCreatorMinPt", 0.)
@@ -571,7 +571,7 @@ def ZLeptonsPositionConeGeant4SelectorCfg(flags, name="ISF_ZLeptonsPositionConeG
 
 def JPsiLeptonsConeGeant4SelectorCfg(flags, name="ISF_JPsiLeptonsConeGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     kwargs.setdefault("ConeCreatorMinPt", 0.)
@@ -603,7 +603,7 @@ def BHadronProductsSimSelectorCfg(flags, name="ISF_BHadronProductsSimSelector",
 
 def BHadronProductsGeant4SelectorCfg(flags, name="ISF_BHadronProductsGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(BHadronProductsSimSelectorCfg(flags, name, **kwargs))
@@ -612,7 +612,7 @@ def BHadronProductsGeant4SelectorCfg(flags, name="ISF_BHadronProductsGeant4Selec
 
 def BHadronProductsFatrasSelectorCfg(flags, name="ISF_BHadronProductsFatrasSelector", **kwargs):
     acc = fatrasSimServiceIDCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Fatras)
     acc.merge(BHadronProductsSimSelectorCfg(flags, name, **kwargs))
@@ -631,7 +631,7 @@ def TauProductsSimSelectorCfg(flags, name="ISF_TauProductsSimSelector", **kwargs
 
 def TauProductsGeant4SelectorCfg(flags, name="ISF_TauProductsGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(TauProductsSimSelectorCfg(flags, name, **kwargs))
@@ -650,7 +650,7 @@ def ZProductsSimSelectorCfg(flags, name="ISF_ZProductsSimSelector", **kwargs):
 
 def ZProductsGeant4SelectorCfg(flags, name="ISF_ZProductsGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(ZProductsSimSelectorCfg(flags, name, **kwargs))
@@ -661,7 +661,7 @@ def ZProductsGeant4SelectorCfg(flags, name="ISF_ZProductsGeant4Selector", **kwar
 def SubDetStickyGeant4SimSelectorCfg(flags, name="ISF_SubDetStickyGeant4SimSelector", **kwargs):
     acc = Geant4SimCfg(flags)
     kwargs.setdefault("RequiresUnchangedGeoID", True)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("PrevSimSvc", acc.getService("ISFG4SimSvc"))
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
@@ -673,7 +673,7 @@ def GlobalStickyGeant4SimSelectorCfg(flags, name="ISF_GlobalStickyGeant4SimSelec
     acc = Geant4SimCfg(flags)
     kwargs.setdefault("PrevSimSvc", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("RequiresUnchangedGeoID", False)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.HistorySimSelector(name, **kwargs))
diff --git a/Simulation/SimuJobTransforms/python/ISF_Skeleton.py b/Simulation/SimuJobTransforms/python/ISF_Skeleton.py
index 2073c899f0841d11da52eeab6d73c25c56d03328..a5396254fdfac73601ac399282fb06c025982481 100644
--- a/Simulation/SimuJobTransforms/python/ISF_Skeleton.py
+++ b/Simulation/SimuJobTransforms/python/ISF_Skeleton.py
@@ -4,44 +4,6 @@ import sys
 from PyJobTransforms.CommonRunArgsToFlags import commonRunArgsToFlags
 from OverlayConfiguration.OverlayHelpers import accFromFragment
 
-# based on https://acode-browser1.usatlas.bnl.gov/lxr/source/athena/Control/AthenaServices/python/Configurables.py#0247
-def EvtIdModifierSvc_add_modifier(svc,
-        run_nbr=None, evt_nbr=None, time_stamp=None, lbk_nbr=None,
-        nevts=1):
-    if run_nbr is None:
-        modify_run_nbr = 0
-        run_nbr = 0
-    else:
-        modify_run_nbr = 1
-
-
-    if evt_nbr is None:
-        modify_evt_nbr = 0
-        evt_nbr = 0
-    else:
-        modify_evt_nbr = 1
-
-    if time_stamp is None:
-        modify_time_stamp = 0
-        time_stamp = 0
-    else:
-        modify_time_stamp = 1
-
-    if lbk_nbr is None:
-        modify_lbk_nbr = 0
-        lbk_nbr = 0
-    else:
-        modify_lbk_nbr = 1
-
-    mod_bit = int(0b0000
-                | (modify_run_nbr << 0)
-                | (modify_evt_nbr << 1)
-                | (modify_time_stamp << 2)
-                | (modify_lbk_nbr << 3))
-
-    svc.Modifiers += [run_nbr, evt_nbr, time_stamp, lbk_nbr,
-                    nevts, mod_bit]
-
 def defaultSimulationFlags(ConfigFlags):
     """Fill default simulation flags"""
     # TODO: how to autoconfigure those
@@ -137,6 +99,8 @@ def fromRunArgs(runArgs):
 
     if hasattr(runArgs, 'DataRunNumber'):
         ConfigFlags.Input.RunNumber = [runArgs.DataRunNumber] # is it updating?
+        ConfigFlags.Input.OverrideRunNumber = True
+        ConfigFlags.Input.LumiBlockNumber = [1] # dummy value
 
     if hasattr(runArgs, 'outputHITSFile'):
         ConfigFlags.Sim.PhysicsList = runArgs.physicsList
@@ -180,26 +144,6 @@ def fromRunArgs(runArgs):
     from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg
     cfg.merge(PoolReadCfg(ConfigFlags))
     cfg.merge(PoolWriteCfg(ConfigFlags))
-    # todo its own cfg ...
-    #todo check evtMax=-1 works with this method
-    myRunNumber = 284500
-    myFirstLB = 1
-    myInitialTimeStamp = 1446539185
-    from AthenaConfiguration.ComponentFactory import CompFactory
-    evtIdModifierSvc = CompFactory.EvtIdModifierSvc(EvtStoreName="StoreGateSvc")
-    iovDbMetaDataTool = CompFactory.IOVDbMetaDataTool()
-    iovDbMetaDataTool.MinMaxRunNumbers = [myRunNumber, 2147483647]
-    cfg.addPublicTool(iovDbMetaDataTool)
-    EvtIdModifierSvc_add_modifier(evtIdModifierSvc, run_nbr=myRunNumber, lbk_nbr=myFirstLB, time_stamp=myInitialTimeStamp, nevts=evtMax)
-    eventSelector = cfg.getService("EventSelector")
-    eventSelector.OverrideRunNumber = True
-    eventSelector.RunNumber = myRunNumber
-    eventSelector.FirstLB = myFirstLB
-    eventSelector.InitialTimeStamp = myInitialTimeStamp # Necessary to avoid a crash
-    if hasattr(eventSelector, "OverrideRunNumberFromInput"):
-        eventSelector.OverrideRunNumberFromInput = True
-    cfg.addService(evtIdModifierSvc, create=True)
-    # ... up to here?
 
     # add BeamEffectsAlg
     from BeamEffects.BeamEffectsAlgConfig import BeamEffectsAlgCfg
diff --git a/TileCalorimeter/TileTrackingGeometry/CMakeLists.txt b/TileCalorimeter/TileTrackingGeometry/CMakeLists.txt
index fc4d3393492d3b88163b17f4fb51bbbc7ce82f85..1f77414b14b76c701e2a388073a77af04d3a4042 100644
--- a/TileCalorimeter/TileTrackingGeometry/CMakeLists.txt
+++ b/TileCalorimeter/TileTrackingGeometry/CMakeLists.txt
@@ -11,7 +11,7 @@ atlas_add_component( TileTrackingGeometry
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${GEOMODELCORE_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${GEOMODELCORE_LIBRARIES} AthenaBaseComps GaudiKernel TrkDetDescrInterfaces CaloDetDescrLib StoreGateLib TileDetDescr TrkDetDescrGeoModelCnv TrkDetDescrUtils TrkGeometry TrkSurfaces TrkVolumes CaloTrackingGeometryLib )
+                     LINK_LIBRARIES ${GEOMODELCORE_LIBRARIES} AthenaBaseComps GaudiKernel TrkDetDescrInterfaces CaloDetDescrLib StoreGateLib TileDetDescr TrkDetDescrGeoModelCnv TrkDetDescrUtils TrkGeometry TrkSurfaces TrkVolumes CaloTrackingGeometryLib CxxUtils )
 
 # Install files from the package:
 atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/TileCalorimeter/TileTrackingGeometry/TileTrackingGeometry/TileVolumeBuilder.h b/TileCalorimeter/TileTrackingGeometry/TileTrackingGeometry/TileVolumeBuilder.h
index 863678fc4fdaf6f3c53990712e1f7afe986b2f02..bd3a93c594e189ff4f1b7fb5e550a0a8f8ebbbbd 100755
--- a/TileCalorimeter/TileTrackingGeometry/TileTrackingGeometry/TileVolumeBuilder.h
+++ b/TileCalorimeter/TileTrackingGeometry/TileTrackingGeometry/TileVolumeBuilder.h
@@ -12,11 +12,15 @@
 // Gaudi
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "GaudiKernel/ToolHandle.h"
+#include "CxxUtils/checker_macros.h"
 // Trk
 #include "TrkDetDescrInterfaces/ITrackingVolumeBuilder.h"
 #include "CaloTrackingGeometry/ICaloSurfaceBuilder.h"
+#include "TrkGeometry/Material.h"
 // STL
 #include <vector>
+#include <memory>
+#include <mutex>
 
 class TileDetDescrManager;
 class CaloDetDescrManager;
@@ -70,6 +74,8 @@ namespace Tile {
       void printInfo(GeoPVConstLink pv) const;
       void printChildren(GeoPVConstLink pv, int igen, Amg::Transform3D trIn) const;
 
+      void throwIntoGarbage (std::unique_ptr<Trk::Material> mat) const;
+
       const TileDetDescrManager*                        m_tileMgr;                        //!< Calo DetDescrMgr
       std::string                                       m_tileMgrLocation;                //!< Location of the CaloDetDescrMgr
        
@@ -84,6 +90,8 @@ namespace Tile {
       
       bool                             m_forceSymmetry;              //!< forces volume symmetry between negative/positive part
 
+      mutable std::mutex m_garbageMutex;
+      mutable std::vector<std::unique_ptr<Trk::Material> > m_garbage ATLAS_THREAD_SAFE;
   };
   
 } // end of namespace
diff --git a/TileCalorimeter/TileTrackingGeometry/src/TileVolumeBuilder.cxx b/TileCalorimeter/TileTrackingGeometry/src/TileVolumeBuilder.cxx
index ca6732cc16d8bfbd893ecdf86c5104ec51e553fb..6e09f563e3a7fb8fa2766b5a81b7a0648fb58d6d 100755
--- a/TileCalorimeter/TileTrackingGeometry/src/TileVolumeBuilder.cxx
+++ b/TileCalorimeter/TileTrackingGeometry/src/TileVolumeBuilder.cxx
@@ -185,8 +185,8 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking
   std::vector<std::pair<const Trk::Surface*,const Trk::Surface*> > exitSurf  = m_surfBuilder->exitSurfaces();
   
   // averaged material properties 
-  const Trk::Material* barrelProperties = new Trk::Material(22.7, 212., 45.8, 21.4, 0.0062);
-  const Trk::Material* extendedBarrelProperties = new Trk::Material(22.7, 210., 45.8, 21.4, 0.0062);
+  auto barrelProperties = std::make_unique<Trk::Material>(22.7, 212., 45.8, 21.4, 0.0062);
+  auto extendedBarrelProperties = std::make_unique<Trk::Material>(22.7, 210., 45.8, 21.4, 0.0062);
   // material properties with layer encoding - to be defined later 
   const Trk::BinnedMaterial* barrelMaterialBinned = 0;
   const Trk::BinnedMaterial* extendedMaterialBinned = 0;
@@ -201,10 +201,10 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking
   // layer material can be adjusted here
   std::vector<Trk::IdentifiedMaterial> matTB; 
   int baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 12;
-  matTB.emplace_back(barrelProperties,0);
-  matTB.emplace_back(barrelProperties,baseID);
-  matTB.emplace_back(barrelProperties,baseID+1);
-  matTB.emplace_back(barrelProperties,baseID+2);
+  matTB.emplace_back(barrelProperties.get(),0);
+  matTB.emplace_back(barrelProperties.get(),baseID);
+  matTB.emplace_back(barrelProperties.get(),baseID+1);
+  matTB.emplace_back(barrelProperties.get(),baseID+2);
   
   // material index 
   std::vector<size_t> ltb{0,1,2,3};
@@ -212,10 +212,10 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking
   // layer material can be adjusted here
   std::vector<Trk::IdentifiedMaterial> matETB; 
   baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 18;
-  matETB.emplace_back(extendedBarrelProperties,0);
-  matETB.emplace_back(extendedBarrelProperties,baseID);
-  matETB.emplace_back(extendedBarrelProperties,baseID+1);
-  matETB.emplace_back(extendedBarrelProperties,baseID+2);
+  matETB.emplace_back(extendedBarrelProperties.get(),0);
+  matETB.emplace_back(extendedBarrelProperties.get(),baseID);
+  matETB.emplace_back(extendedBarrelProperties.get(),baseID+1);
+  matETB.emplace_back(extendedBarrelProperties.get(),baseID+2);
 
   // layer material can be adjusted here
   //Trk::MaterialProperties barrelFingerGapProperties = Trk::MaterialProperties(1., 130./0.35, 0.003*pow(0.35,3),30.);
@@ -292,7 +292,7 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking
 	    steps.push_back(depth);
 	    Trk::BinUtility* rBU = new Trk::BinUtility(steps, Trk::open, Trk::binR);
 	    
-	    barrelMaterialBinned = new Trk::BinnedMaterial(barrelProperties,rBU,ltb,matTB);
+	    barrelMaterialBinned = new Trk::BinnedMaterial(barrelProperties.get(),rBU,ltb,matTB);
             
 	    tileBarrel = new Trk::AlignableTrackingVolume(0,align,                          
 							  tileBarrelBounds,
@@ -356,7 +356,7 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking
 	    steps.push_back(tileExtendedBounds->outerRadius());
 	    Trk::BinUtility* eBU = new Trk::BinUtility(steps, Trk::open, Trk::binR);
 	    
-	    extendedMaterialBinned = new Trk::BinnedMaterial(extendedBarrelProperties,eBU,ltb,matETB);
+	    extendedMaterialBinned = new Trk::BinnedMaterial(extendedBarrelProperties.get(),eBU,ltb,matETB);
 	    
 	    tileExtendedTrackingVolume = new Trk::AlignableTrackingVolume(new Amg::Transform3D(Amg::Translation3D(childPosition)),
 									  align,
@@ -381,7 +381,7 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking
 	      steps.push_back(tileExtendedBounds->outerRadius());
 	      Trk::BinUtility* eBU = new Trk::BinUtility(steps, Trk::open, Trk::binR);
 	      
-	      extendedMaterialBinned = new Trk::BinnedMaterial(extendedBarrelProperties,eBU,ltb,matETB);
+	      extendedMaterialBinned = new Trk::BinnedMaterial(extendedBarrelProperties.get(),eBU,ltb,matETB);
 	      
 	      tileExtendedTrackingVolume = new Trk::AlignableTrackingVolume(new Amg::Transform3D(Amg::Translation3D(childPosition)),
 									    align,
@@ -441,9 +441,9 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking
   std::vector<Trk::IdentifiedMaterial> matITC;
   // layer material can be adjusted here
   baseID = Trk::GeometrySignature(Trk::Calo)*1000;
-  matITC.emplace_back(barrelProperties,baseID+15);
-  matITC.emplace_back(barrelProperties,baseID+16);
-  matITC.emplace_back(barrelProperties,baseID+17);
+  matITC.emplace_back(barrelProperties.get(),baseID+15);
+  matITC.emplace_back(barrelProperties.get(),baseID+16);
+  matITC.emplace_back(barrelProperties.get(),baseID+17);
 
   // ITCPlug1
   double p1Z = 0.5*(plug1Z-plug1hZ+tileExtZ);
@@ -462,8 +462,8 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking
   std::vector<float> bpsteps{float(plug1R), float(tileBarrelBounds->outerRadius())};
   Trk::BinUtility* rBU = new Trk::BinUtility(bpsteps, Trk::open, Trk::binR);
   Trk::BinUtility* rBUc = rBU->clone();
-  const Trk::BinnedMaterial* plug1MatPos = new Trk::BinnedMaterial(barrelProperties,rBU,dummylay,matITC);
-  const Trk::BinnedMaterial* plug1MatNeg = new Trk::BinnedMaterial(barrelProperties,rBUc,dummylay,matITC);
+  const Trk::BinnedMaterial* plug1MatPos = new Trk::BinnedMaterial(barrelProperties.get(),rBU,dummylay,matITC);
+  const Trk::BinnedMaterial* plug1MatNeg = new Trk::BinnedMaterial(barrelProperties.get(),rBUc,dummylay,matITC);
 
   Amg::Transform3D* align=0;      
 
@@ -497,8 +497,8 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking
   std::vector<float> p2steps{float(plug2R), float(plug1R)};
   Trk::BinUtility* p2BU = new Trk::BinUtility(p2steps, Trk::open, Trk::binR);
   Trk::BinUtility* p2BUc = p2BU->clone();
-  const Trk::BinnedMaterial* plug2MatPos = new Trk::BinnedMaterial(barrelProperties,p2BU,p2lay,matITC);
-  const Trk::BinnedMaterial* plug2MatNeg = new Trk::BinnedMaterial(barrelProperties,p2BUc,p2lay,matITC);
+  const Trk::BinnedMaterial* plug2MatPos = new Trk::BinnedMaterial(barrelProperties.get(),p2BU,p2lay,matITC);
+  const Trk::BinnedMaterial* plug2MatNeg = new Trk::BinnedMaterial(barrelProperties.get(),p2BUc,p2lay,matITC);
       
   Trk::AlignableTrackingVolume* itcPlug2Pos = new Trk::AlignableTrackingVolume(itcP2PosTransform, align,
 									       itcPlug2Bounds,
@@ -530,7 +530,7 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking
   std::vector<size_t> glay(1,2);
   std::vector<float> gsteps{float(gapi-gapBounds->halflengthZ()), float(gapi+gapBounds->halflengthZ())};
   Trk::BinUtility* gp = new Trk::BinUtility(gsteps, Trk::open, Trk::binZ);
-  const Trk::BinnedMaterial* gpMat = new Trk::BinnedMaterial(barrelProperties,gp,glay,matITC);
+  const Trk::BinnedMaterial* gpMat = new Trk::BinnedMaterial(barrelProperties.get(),gp,glay,matITC);
       
   Trk::AlignableTrackingVolume* gapPos = new Trk::AlignableTrackingVolume(gapPosTransform, align,
 									  gapBounds,
@@ -540,7 +540,7 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking
 
   std::vector<float> nsteps{float(-gapi-gapBounds->halflengthZ()), float(-gapi+gapBounds->halflengthZ())};
   Trk::BinUtility* gn = new Trk::BinUtility(nsteps, Trk::open, Trk::binZ);
-  const Trk::BinnedMaterial* gnMat = new Trk::BinnedMaterial(barrelProperties,gn,glay,matITC);
+  const Trk::BinnedMaterial* gnMat = new Trk::BinnedMaterial(barrelProperties.get(),gn,glay,matITC);
       
   Trk::AlignableTrackingVolume* gapNeg = new Trk::AlignableTrackingVolume(gapNegTransform, align,
 									  gapBounds->clone(),
@@ -795,6 +795,9 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking
     printCheckResult(msg(MSG::DEBUG), tileGirder);
   } // end of detailed output
 
+  throwIntoGarbage (std::move (barrelProperties));
+  throwIntoGarbage (std::move (extendedBarrelProperties));
+
   return tileTrackingVolumes;
 }
 
@@ -857,3 +860,10 @@ void Tile::TileVolumeBuilder::printChildren(const PVConstLink pv,int igen, Amg::
   }  
    
 }
+
+
+void Tile::TileVolumeBuilder::throwIntoGarbage (std::unique_ptr<Trk::Material> mat) const
+{
+  std::scoped_lock lock (m_garbageMutex);
+  m_garbage.push_back (std::move (mat));
+}
diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsExtrapolationAlg.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsExtrapolationAlg.h
index d87153490dbf123def419f9078d6f3bbf0970b07..88776414085941ce55990d390f6005a22da8048e 100755
--- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsExtrapolationAlg.h
+++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsExtrapolationAlg.h
@@ -25,7 +25,7 @@
 namespace Acts {
   class TrackingGeometry;
   namespace detail {
-    class Step;
+    struct Step;
   }
 }
 
diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/IActsPropStepRootWriterSvc.h b/Tracking/Acts/ActsGeometry/ActsGeometry/IActsPropStepRootWriterSvc.h
index abcde5cd7fa2e8cce3768000d2ecf431f497f3e2..e7653a923bcfffd8928e58b70cd9df17cc2c7984 100644
--- a/Tracking/Acts/ActsGeometry/ActsGeometry/IActsPropStepRootWriterSvc.h
+++ b/Tracking/Acts/ActsGeometry/ActsGeometry/IActsPropStepRootWriterSvc.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 ACTSGEOMETRY_IACTSPROPSTEPROOTWRITERSVC_H
@@ -10,7 +10,7 @@
 
 namespace Acts {
   namespace detail {
-    class Step;
+    struct Step;
   }
 }
 
diff --git a/Tracking/Acts/ActsGeometry/src/ActsPropStepRootWriterSvc.cxx b/Tracking/Acts/ActsGeometry/src/ActsPropStepRootWriterSvc.cxx
index 6229793ec97c2e20f0f6de51dfa8761f43da190f..5e8c33835bd5ab150553a839494de1da941f59da 100644
--- a/Tracking/Acts/ActsGeometry/src/ActsPropStepRootWriterSvc.cxx
+++ b/Tracking/Acts/ActsGeometry/src/ActsPropStepRootWriterSvc.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
 */
 
 #include "ActsGeometry/ActsPropStepRootWriterSvc.h"
@@ -120,8 +120,6 @@ ActsPropStepRootWriterSvc::writeThread()
 void
 ActsPropStepRootWriterSvc::doWrite(const StepVector& steps, size_t evtNum)
 {
-  using ag = Acts::GeometryIdentifier;
-
   m_eventNum = evtNum;
   m_s_pX.clear();
   m_s_pY.clear();
diff --git a/Tracking/TrkEvent/TrkPatternParameters/TrkPatternParameters/PatternTrackParameters.h b/Tracking/TrkEvent/TrkPatternParameters/TrkPatternParameters/PatternTrackParameters.h
index 977d9bfda6ff21e27c2a007747609fd2c61b622f..846dcd8416053b7511cc86ca73310457f45698ad 100755
--- a/Tracking/TrkEvent/TrkPatternParameters/TrkPatternParameters/PatternTrackParameters.h
+++ b/Tracking/TrkEvent/TrkPatternParameters/TrkPatternParameters/PatternTrackParameters.h
@@ -206,7 +206,7 @@ namespace Trk {
   inline void PatternTrackParameters::setParameters
     (const Surface* s,const double* p)
     {
-      m_surface.reset(s->isFree() ? s->clone() : s);
+      m_surface.reset(s && s->isFree() ? s->clone() : s);
       m_parameters[ 0] = p[ 0];
       m_parameters[ 1] = p[ 1];
       m_parameters[ 2] = p[ 2];
@@ -250,7 +250,7 @@ namespace Trk {
   inline void PatternTrackParameters::setParametersWithCovariance
     (const Surface* s,const double* p,const double* c)
     {
-      m_surface.reset(s->isFree() ? s->clone() : s);
+      m_surface.reset(s && s->isFree() ? s->clone() : s);
       m_parameters[ 0] = p[ 0];
       m_parameters[ 1] = p[ 1];
       m_parameters[ 2] = p[ 2];
diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthToTrack.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthToTrack.h
index ff2438d11c26c3bfb67a77c661bd0f8eba823351..2e0801ba13a2cfc9328bf94593425365eabe9026 100644
--- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthToTrack.h
+++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthToTrack.h
@@ -51,7 +51,7 @@ namespace Trk {
      *  object. (Wrapping it into a smart pointer may be the most
      *  convenient way to make sure the memory is freed.)
      */
-    virtual const Trk::TrackParameters* makeProdVertexParameters(const HepMC::GenParticle* part) const = 0;
+    virtual const Trk::TrackParameters* makeProdVertexParameters(HepMC::ConstGenParticlePtr part) const = 0;
     virtual const Trk::TrackParameters* makeProdVertexParameters(const xAOD::TruthParticle* part) const = 0;
 
     /** This function extrapolates track to the perigee, and returns
@@ -61,7 +61,7 @@ namespace Trk {
      * operator new.  The caller is responsible for deletion of the
      * object.
      */
-    virtual const Trk::TrackParameters* makePerigeeParameters(const HepMC::GenParticle* part) const = 0;
+    virtual const Trk::TrackParameters* makePerigeeParameters(HepMC::ConstGenParticlePtr part) const = 0;
     virtual const Trk::TrackParameters* makePerigeeParameters(const xAOD::TruthParticle* part) const = 0;
 
   };
diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthTrajectoryBuilder.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthTrajectoryBuilder.h
index 61e708ffe730eb9a70a435936e12d8ac139059b4..b67b81d0c43d85216fcf404bb4a09a483a980364 100644
--- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthTrajectoryBuilder.h
+++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITruthTrajectoryBuilder.h
@@ -29,13 +29,13 @@ namespace Trk {
     /** Build a TruthTrajectory this particle belongs to.  
      *  The result may be an empty TruthTrajectory (in case input did not pass the cuts).
      */
-    virtual void buildTruthTrajectory(TruthTrajectory *result, const HepMC::GenParticle *input) const = 0;
+    virtual void buildTruthTrajectory(TruthTrajectory *result, HepMC::ConstGenParticlePtr input) const = 0;
 
     /** Previous particle on the truth trajectory or 0 */
-    virtual const HepMC::GenParticle *getMother(const HepMC::GenParticle *part) const = 0;
+    virtual HepMC::ConstGenParticlePtr getMother(HepMC::ConstGenParticlePtr part) const = 0;
 
     /** Next particle on the truth trajectory or 0 */
-    virtual const HepMC::GenParticle *getDaughter(const HepMC::GenParticle *part) const = 0;
+    virtual HepMC::ConstGenParticlePtr getDaughter(HepMC::ConstGenParticlePtr part) const = 0;
   };
   
 } // namespace Trk
diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/src/DecayInFlyTruthTrajectoryBuilder.cxx b/Tracking/TrkTools/TrkTruthCreatorTools/src/DecayInFlyTruthTrajectoryBuilder.cxx
index 9e25de02879fa589d7d07209f5d99d36d73505c4..6752fe0d1b6a73086382770d40aaf903573d5b5a 100644
--- a/Tracking/TrkTools/TrkTruthCreatorTools/src/DecayInFlyTruthTrajectoryBuilder.cxx
+++ b/Tracking/TrkTools/TrkTruthCreatorTools/src/DecayInFlyTruthTrajectoryBuilder.cxx
@@ -71,34 +71,32 @@ buildTruthTrajectory(TruthTrajectory *result, HepMC::ConstGenParticlePtr input)
 DecayInFlyTruthTrajectoryBuilder::MotherDaughter
 DecayInFlyTruthTrajectoryBuilder::truthTrajectoryCuts(HepMC::ConstGenVertexPtr vtx) const
 {
-  HepMC::GenParticlePtr mother{nullptr};
-  HepMC::GenParticlePtr daughter{nullptr};
-  // only truth vertices with 1 incoming particle
+  HepMC::ConstGenParticlePtr mother{nullptr};
+  HepMC::ConstGenParticlePtr daughter{nullptr};
+     // only truth vertices with 1 incoming particle     
+      // Restrict to quasi-elastic processes (e.g. brems, delta-rays, pi->pi+Delta).
+      // 
+      // Require not more than 2 outgoing particles. Note that
+      // delta-rays for primary==electron is a special case, because we have two
+      // outgoing particles with the same PDG id.  The "correct" one
+      // is that with the higher energy (NOT pt).
+      // 
+      // allow 1 outgoing to cover possible vertexes from interaction in detector material
 #ifdef HEPMC3
-  if(vtx && (vtx->particles_in().size() == 1)) {
+  if(vtx && (vtx->particles_in().size() == 1) && (vtx->particles_out().size() <= 2)  ) {
 
     mother = vtx->particles_in().front();
 #else 
-  if(vtx && (vtx->particles_in_size() == 1)) {
+  if(vtx && (vtx->particles_in_size() == 1) && (vtx->particles_out_size() <= 2) ) {
 
     mother = *vtx->particles_in_const_begin();
 #endif    
     // Allow status code 1 and 2.  E.g. a pion that produced a long track can decay  outside of InDet and have status==2.
     if( mother && (mother->status() < 3) ) {
-    
-      // Restrict to quasi-elastic processes (e.g. brems, delta-rays, pi->pi+Delta).
-      // 
-      // Require not more than 2 outgoing particles. Note that
-      // delta-rays for primary==electron is a special case, because we have two
-      // outgoing particles with the same PDG id.  The "correct" one
-      // is that with the higher energy (NOT pt).
-      // 
-      // allow 1 outgoing to cover possible vertexes from interaction in detector material
-      if (vtx->particles_out_size() <= 2) {
 
 	int num_passed_cuts = 0;
-	HepMC::GenParticlePtr passed_cuts{nullptr};
-	for(HepMC::GenParticlePtr candidate: *vtx){
+	HepMC::ConstGenParticlePtr passed_cuts{nullptr};
+	for(HepMC::ConstGenParticlePtr candidate: *vtx){
 	  if(candidate->pdg_id() == mother->pdg_id()) {
 
 	    if(passed_cuts && (mother->pdg_id() == 11)) { // second negative electron is a special case
@@ -121,8 +119,6 @@ DecayInFlyTruthTrajectoryBuilder::truthTrajectoryCuts(HepMC::ConstGenVertexPtr v
 	if(num_passed_cuts==1) { // disallow hadronic pi->N*pi etc.
 	  daughter = passed_cuts;
 	}
-
-      } // if (vtx->particles_out_size() <= 2)
     } // if( mother && (mother->status() == 1) )
   }
   
diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx b/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx
index e560005102d3c15c47fc65608d53cfdb865f4dab..04e2724ff88ce47df8cfa86cb09da857d20beca7 100755
--- a/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx
+++ b/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx
@@ -165,7 +165,7 @@ buildDetailedTrackTruth(DetailedTrackTruthCollection *output,
       const TruthTrajectory& t = i->second.trajectory();
       msg(MSG::VERBOSE)<<"Particles on the trajectory:\n";
       for(unsigned k=0; k<t.size(); ++k) {
-	msg(MSG::VERBOSE)<<*t[k]<<"\n";
+	msg(MSG::VERBOSE)<<t[k]<<"\n";
       }
       msg(MSG::VERBOSE)<<"\n"<<endmsg;
     }
@@ -353,12 +353,12 @@ void DetailedTrackTruthBuilder::addTrack(DetailedTrackTruthCollection *output,
   while(!seeds.empty()) {
     HepMcParticleLink link = *seeds.begin();
     Sprout current_sprout;
-    std::queue<const HepMC::GenParticle*> tmp;
+    std::queue<HepMC::ConstGenParticlePtr> tmp;
     ExtendedEventIndex eventIndex(link, proxy);
     const HepMC::GenParticle *current = link.cptr();
 
     do {
-      HepMcParticleLink curlink( eventIndex.makeLink(current->barcode(), proxy));
+      HepMcParticleLink curlink( eventIndex.makeLink(HepMC::barcode(current), proxy));
 
       // remove the current particle from the list of particles to consider (if it is still there)
       seeds.erase(curlink);
@@ -410,7 +410,7 @@ void DetailedTrackTruthBuilder::addTrack(DetailedTrackTruthCollection *output,
     // This may add only hits that are *not* on the current track.
     // Thus no need to update stats track and stats common.
 
-    const HepMC::GenParticle* current = *s->second.begin();
+    auto current = *s->second.begin();
     while( (current = m_truthTrajBuilder->getDaughter(current)) ) {
       s->second.push_front(current);
     }
diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/IPRD_TruthTrajectoryBuilder.h b/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/IPRD_TruthTrajectoryBuilder.h
index 309d14623515dc70d45915a2e352ff3a53dfc5f3..58365fe2213370bbc6ecbf7fcab59b5ccf588974 100644
--- a/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/IPRD_TruthTrajectoryBuilder.h
+++ b/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/IPRD_TruthTrajectoryBuilder.h
@@ -38,7 +38,7 @@ namespace Trk {
        static const InterfaceID& interfaceID() { return IID_IPRD_TruthTrajectoryBuilder; }
 
        /** return a vector of PrepRawData trajectories - uses internal cache**/
-       virtual const std::map< const HepMC::GenParticle*, PRD_TruthTrajectory >& truthTrajectories() const = 0;
+       virtual const std::map< HepMC::ConstGenParticlePtr, PRD_TruthTrajectory >& truthTrajectories() const = 0;
        
        /** Event refresh - can't be an IIncident, because it has to run after PRD creation and PRD truth creation */
        virtual StatusCode refreshEvent() = 0;       
diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/PRD_TruthTrajectory.h b/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/PRD_TruthTrajectory.h
index 21ff251f2e43dd3129747a08aa3ed830668a7b0f..2d3a9df02060a658c868595598f4fd0bfacf4c3e 100644
--- a/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/PRD_TruthTrajectory.h
+++ b/Tracking/TrkTruthTracks/TrkTruthTrackInterfaces/TrkTruthTrackInterfaces/PRD_TruthTrajectory.h
@@ -28,7 +28,7 @@ namespace Trk {
       
      /**  public members */ 
      std::vector<const Trk::PrepRawData* > prds;
-     const HepMC::GenParticle*             genParticle;
+     HepMC::ConstGenParticlePtr             genParticle;
      size_t                                nDoF;
 
      /** defualt constructor */
@@ -39,7 +39,7 @@ namespace Trk {
      
      /** fast constructor */
      PRD_TruthTrajectory( const std::vector<const Trk::PrepRawData* >& prdVec,
-                          const HepMC::GenParticle* gP    = 0,
+                          HepMC::ConstGenParticlePtr gP    = nullptr,
                           size_t numberOfDegreesOfFreedom = 0) :
       prds(prdVec),
       genParticle(gP),
diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.cxx b/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.cxx
index 7b60f9c4c5d8753febe9c5c73af442944d4b9255..628c472caefaa02c3d55093692e67009b69c79e7 100644
--- a/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.cxx
+++ b/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.cxx
@@ -97,7 +97,7 @@ StatusCode Trk::PRD_TruthTrajectoryBuilder::refreshEvent()  {
    
 }
 
-const std::map< const HepMC::GenParticle*, Trk::PRD_TruthTrajectory >& Trk::PRD_TruthTrajectoryBuilder::truthTrajectories() const {
+const std::map<HepMC::ConstGenParticlePtr, Trk::PRD_TruthTrajectory >& Trk::PRD_TruthTrajectoryBuilder::truthTrajectories() const {
     // ndof
     size_t ndofTotal = 0;
     size_t ndof      = 0;
@@ -111,7 +111,7 @@ const std::map< const HepMC::GenParticle*, Trk::PRD_TruthTrajectory >& Trk::PRD_
         PRD_MultiTruthCollection::const_iterator prdMtCIterE = (*pmtCollIter)->end();
         for ( ; prdMtCIter != prdMtCIterE; ++ prdMtCIter ){
             // check if entry exists and if   
-            const HepMC::GenParticle* curGenP       = (*prdMtCIter).second;
+            auto curGenP       = (*prdMtCIter).second;
             Identifier                curIdentifier = (*prdMtCIter).first;
             // apply the min pT cut 
             if ( curGenP->momentum().perp() < m_minPt ) continue;
@@ -123,7 +123,7 @@ const std::map< const HepMC::GenParticle*, Trk::PRD_TruthTrajectory >& Trk::PRD_
             // stuff it into the trajectory if you found a PRD
             if (prd){
                 // try to find the entry for this GenParticle 
-                std::map< const HepMC::GenParticle*, PRD_TruthTrajectory >::iterator prdTrajIter = m_gpPrdTruthTrajectories.find(curGenP);
+                auto prdTrajIter = m_gpPrdTruthTrajectories.find(curGenP);
                 if ( prdTrajIter ==  m_gpPrdTruthTrajectories.end() ){
                     // first PRD associated to this: create PRD_TruthTrajectory object
                     Trk::PRD_TruthTrajectory newPrdTruthTrajectory;
@@ -147,8 +147,8 @@ const std::map< const HepMC::GenParticle*, Trk::PRD_TruthTrajectory >& Trk::PRD_
     }
     // PART 2 --------------------------------------------------------------------------------------------------------
     // loop through the provided list of manipulators ( sorter is included )
-    std::map< const HepMC::GenParticle*, PRD_TruthTrajectory >::iterator prdTruthTrajIter  = m_gpPrdTruthTrajectories.begin();
-    std::map< const HepMC::GenParticle*, PRD_TruthTrajectory >::iterator prdTruthTrajIterE = m_gpPrdTruthTrajectories.end();
+    auto prdTruthTrajIter  = m_gpPrdTruthTrajectories.begin();
+    auto prdTruthTrajIterE = m_gpPrdTruthTrajectories.end();
     for ( ; prdTruthTrajIter != prdTruthTrajIterE; ++prdTruthTrajIter ){
     //std::cout << "sorting, barcode: " << prdTruthTrajIter->first->barcode() << std::endl;
         if ( m_prdTruthTrajectoryManipulators.size() ){
diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.h b/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.h
index 3199d6c9ed38d7c6ef22da7037ba8be0badc7f4f..6112ea9f8370335480e1159fdd42d94f4b5d20e1 100644
--- a/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.h
+++ b/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/PRD_TruthTrajectoryBuilder.h
@@ -53,7 +53,7 @@ namespace Trk {
        StatusCode  finalize();
 
        /** return a vector of PrepRawData trajectories - uses internal cache**/
-       const std::map< const HepMC::GenParticle*, PRD_TruthTrajectory >& truthTrajectories() const;
+       const std::map< HepMC::ConstGenParticlePtr, PRD_TruthTrajectory >& truthTrajectories() const;
 
        /** Event refresh - can't be an IIncident, because it has to run after PRD creation and PRD truth creation */
        StatusCode refreshEvent();
@@ -71,7 +71,7 @@ namespace Trk {
         
 	Gaudi::Property<double>                             m_minPt {this,"MinimumPt",400.,"minimum pT to be even considered"};
 	Gaudi::Property<bool>                               m_geantinos {this,"Geantinos",false,"Track geantinos or not"};
-        mutable std::map< const HepMC::GenParticle*, PRD_TruthTrajectory > m_gpPrdTruthTrajectories; //!< the cache for the return (cleared by Incident)
+        mutable std::map< HepMC::ConstGenParticlePtr, PRD_TruthTrajectory > m_gpPrdTruthTrajectories; //!< the cache for the return (cleared by Incident)
         
   };
 
diff --git a/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/TruthTrackBuilder.cxx b/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/TruthTrackBuilder.cxx
index 1940d483abe38acde00dfa9fac5bbdf5ed0def2d..bda9841b728f682f5bd609f57985ca033fcab1db 100644
--- a/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/TruthTrackBuilder.cxx
+++ b/Tracking/TrkTruthTracks/TrkTruthTrackTools/src/TruthTrackBuilder.cxx
@@ -130,7 +130,7 @@ Trk::Track* Trk::TruthTrackBuilder::createTrack(const PRD_TruthTrajectory& prdTr
     ATH_MSG_VERBOSE("The PRD Truth trajectory contains " << prdTraj.prds.size() << " PRDs.");
 
     // get the associated GenParticle
-    const HepMC::GenParticle* genPart = prdTraj.genParticle;
+    auto genPart = prdTraj.genParticle;
     if (!genPart) {
         ATH_MSG_WARNING("No GenParticle associated to this PRD_TruthTrajectory. Ignoring track creation.");
         return 0;
diff --git a/Tracking/TrkValidation/TrkValAlgs/TrkValAlgs/TrackValidationNtupleWriter.h b/Tracking/TrkValidation/TrkValAlgs/TrkValAlgs/TrackValidationNtupleWriter.h
index b5fe26995e4d217a39997ba7531c8584abfe75c0..98e06ad91b6e7c9d0bc09fea08d34bfe6a6b2c50 100644
--- a/Tracking/TrkValidation/TrkValAlgs/TrkValAlgs/TrackValidationNtupleWriter.h
+++ b/Tracking/TrkValidation/TrkValAlgs/TrkValAlgs/TrackValidationNtupleWriter.h
@@ -96,7 +96,7 @@ protected:
   bool                      m_doTruth;                     //!< Switch to turn on / off truth
   bool                      m_doTrackParticle;             //!  Switch to turn on/pff recording track particle trees into Ntuple 
 
-  const HepMC::GenParticle* m_visibleParticleWithoutTruth; //!< cludge to treat G4's "fake fakes"
+  HepMC::GenParticlePtr m_visibleParticleWithoutTruth; //!< cludge to treat G4's "fake fakes"
   std::vector<unsigned int>           m_nTrackTreeRecords;
   std::vector<TTree*>       m_trees;                 //!< Pointer to the NTuple trees (one for each input track collection)
   TTree*                    m_eventLinkTree;         //!< pointer to event-wise ntuple trees (one for all input track collections + truth)
diff --git a/Tracking/TrkValidation/TrkValAlgs/src/RecMomentumQualityValidation.cxx b/Tracking/TrkValidation/TrkValAlgs/src/RecMomentumQualityValidation.cxx
index 6b6d9248f5e57bb4e1b122ba8f078fe6b1438938..9e37c70845e06b7bed5f0c87947a3954c6bf2e8f 100644
--- a/Tracking/TrkValidation/TrkValAlgs/src/RecMomentumQualityValidation.cxx
+++ b/Tracking/TrkValidation/TrkValAlgs/src/RecMomentumQualityValidation.cxx
@@ -135,7 +135,7 @@ StatusCode Trk::RecMomentumQualityValidation::execute()
 
       // find matching truth particle
       const TrackTruth* trackTruth = 0;
-      const HepMC::GenParticle* genParticle = 0;
+      HepMC::ConstGenParticlePtr genParticle{nullptr};
       TrackTruthCollection::const_iterator truthIterator 
         = trackTruthCollection->find( trackIterator - (*trackCollection).begin() );
       if ( truthIterator == trackTruthCollection->end() ){
diff --git a/Tracking/TrkValidation/TrkValAlgs/src/TrackValidationNtupleWriter.cxx b/Tracking/TrkValidation/TrkValAlgs/src/TrackValidationNtupleWriter.cxx
index d24e097589807a0d3a9daac874f4d3879ceb6f05..7ebe04335e8ef9c62bcd553ed5aee2ffe5f405af 100644
--- a/Tracking/TrkValidation/TrkValAlgs/src/TrackValidationNtupleWriter.cxx
+++ b/Tracking/TrkValidation/TrkValAlgs/src/TrackValidationNtupleWriter.cxx
@@ -219,7 +219,7 @@ StatusCode Trk::TrackValidationNtupleWriter::initialize() {
         sc = m_truthNtupleTool->initBranches(m_trackTruthClassifiers, include_jets, m_inputTrackCollection);
         if (sc.isFailure()) return sc;
 
-        m_visibleParticleWithoutTruth = new HepMC::GenParticle(HepLorentzVector(), 0);
+        m_visibleParticleWithoutTruth = HepMC::newGenParticlePtr(HepMC::FourVector(), 0);
 
     } // if truth is activated
 
@@ -332,7 +332,7 @@ StatusCode Trk::TrackValidationNtupleWriter::execute() {
 
     unsigned int nTruthTreeRecordsAtCurrentEvent = 0;
     std::vector<Trk::ValidationTrackTruthData>  truthData;
-    std::vector<const HepMC::GenParticle*>*  selecParticles = 0;
+    std::vector<HepMC::ConstGenParticlePtr>*  selecParticles = nullptr;
     //std::vector<const Trk::TrackParameters*> extrapolatedTruthPerigees;
     //std::vector<std::vector<unsigned int> >  classifications;
     std::vector< Trk::GenParticleJet >*      genParticleJets = 0;
@@ -377,7 +377,7 @@ StatusCode Trk::TrackValidationNtupleWriter::execute() {
                 if ( genParticle->production_vertex() )
                   {
                     generatedTrackPerigee = m_truthToTrack->makePerigeeParameters( genParticle );
-                    if (generatedTrackPerigee == NULL && genParticle->barcode() > 1000000 ) {
+                    if (generatedTrackPerigee == NULL && HepMC::barcode(genParticle) > 1000000 ) {
                       ATH_MSG_DEBUG ("No perigee available for interacting truth particle."
                                      <<" -> This is OK for particles from the TrackRecord, but probably"
                                      <<" a bug for production vertex particles.");
@@ -389,7 +389,7 @@ StatusCode Trk::TrackValidationNtupleWriter::execute() {
                 partData.classifications.reserve(m_trackTruthClassifiers.size());
                 for (unsigned int toolIndex = 0 ; toolIndex < m_trackTruthClassifiers.size(); ++toolIndex ) 
                   {
-                    partData.classifications.push_back(m_trackTruthClassifiers[toolIndex]->classify(*genParticle));
+                    partData.classifications.push_back(m_trackTruthClassifiers[toolIndex]->classify(genParticle));
                   }
                 // resize the truth to track vectors to the number of input track collections:
                 partData.truthToTrackIndices.resize(m_inputTrackCollection.size());
@@ -594,7 +594,7 @@ StatusCode Trk::TrackValidationNtupleWriter::writeTrackData(unsigned int trackCo
             if (m_doTruth){
                 // find matching truth particle
                 const TrackTruth* trackTruth = 0;
-                const HepMC::GenParticle* genParticle = 0;
+                HepMC::ConstGenParticlePtr genParticle{nullptr};
                 TrackTruthCollection::const_iterator truthIterator = trackTruthCollection->find( trackIterator - (*tracks).begin() );
                 if ( truthIterator == trackTruthCollection->end() ){
                   ATH_MSG_DEBUG ("No matching truth particle found for track");
diff --git a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleJetFinder.h b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleJetFinder.h
index fde30d484a15d4eae8a98ffd6076812fb75f75a6..b16a3ab46f3cd913d025816a6b43ca4a7d291c06 100644
--- a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleJetFinder.h
+++ b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleJetFinder.h
@@ -47,7 +47,7 @@ class IGenParticleJetFinder : virtual public IAlgTool {
         This method is a factory, i.e. vector ownership is given back and
         on failure condition returns NULL. */
     virtual std::vector< Trk::GenParticleJet >*  jetMCFinder
-      (std::vector <const HepMC::GenParticle *>& ) const=0;
+      (std::vector <HepMC::ConstGenParticlePtr>& ) const=0;
 
   };
 
diff --git a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleSelector.h b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleSelector.h
index 0e58912b073fef1eaf5768fab0b5e74f0144cf9e..ac8d6b138ee49476ea77a7ee7a8f76f287db502b 100644
--- a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleSelector.h
+++ b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/IGenParticleSelector.h
@@ -33,7 +33,7 @@ class IGenParticleSelector : virtual public IAlgTool {
     static const InterfaceID& interfaceID();
     
     /** explain */
-    virtual std::vector<const HepMC::GenParticle *>*
+    virtual std::vector<HepMC::ConstGenParticlePtr>*
       selectGenSignal (const McEventCollection*) const=0;
   };
 
diff --git a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITrackTruthClassifier.h b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITrackTruthClassifier.h
index 56af45805d4908631248bcf821940a35cc15f72e..c557707b4470598e37cbd1be70f552b56d4d0b07 100644
--- a/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITrackTruthClassifier.h
+++ b/Tracking/TrkValidation/TrkValInterfaces/TrkValInterfaces/ITrackTruthClassifier.h
@@ -33,9 +33,9 @@ class ITrackTruthClassifier : virtual public IAlgTool {
     
     /** explain */
     virtual void initClassification(const McEventCollection&,
-                                    const std::vector<const HepMC::GenParticle *>*) const=0;
+                                    const std::vector<HepMC::ConstGenParticlePtr>*) const=0;
 
-    virtual unsigned int classify(const HepMC::GenParticle&) const = 0;
+    virtual unsigned int classify(HepMC::ConstGenParticlePtr) const = 0;
 
     virtual std::string nameOfClassifier() const = 0;
 
diff --git a/Tracking/TrkValidation/TrkValTools/TrkValTools/PrimaryTruthClassifier.h b/Tracking/TrkValidation/TrkValTools/TrkValTools/PrimaryTruthClassifier.h
index 496e2a09b8d731a26b207b1bac57f719ce27d894..c3eaf26f51fe65482bef104106a649cd2bcb0271 100644
--- a/Tracking/TrkValidation/TrkValTools/TrkValTools/PrimaryTruthClassifier.h
+++ b/Tracking/TrkValidation/TrkValTools/TrkValTools/PrimaryTruthClassifier.h
@@ -18,6 +18,7 @@
 #include "TrkValEvent/TruthClassificationDefs.h"
 
 #include "AtlasHepMC/GenParticle.h"
+#include "AtlasHepMC/SimpleVector.h"
 
 namespace Trk {
 
@@ -40,9 +41,9 @@ namespace Trk {
 
       /** explain */
       virtual void initClassification(const McEventCollection&,
-                                      const std::vector<const HepMC::GenParticle *>*) const;
+                                      const std::vector<HepMC::ConstGenParticlePtr>*) const;
 
-      virtual unsigned int classify(const HepMC::GenParticle&) const;
+      virtual unsigned int classify(HepMC::ConstGenParticlePtr) const;
 
       virtual std::string nameOfClassifier() const;
 
diff --git a/Tracking/TrkValidation/TrkValTools/src/PrimaryTruthClassifier.cxx b/Tracking/TrkValidation/TrkValTools/src/PrimaryTruthClassifier.cxx
index bd344c64e57067554318fcfd02eb0fcffc5a2dae..01c8f65d5657651eef274a69af00fb87f0d0351e 100644
--- a/Tracking/TrkValidation/TrkValTools/src/PrimaryTruthClassifier.cxx
+++ b/Tracking/TrkValidation/TrkValTools/src/PrimaryTruthClassifier.cxx
@@ -53,7 +53,7 @@ StatusCode Trk::PrimaryTruthClassifier::finalize() {
 
 void Trk::PrimaryTruthClassifier::initClassification
 (const McEventCollection& /*SimTracks*/,
- const std::vector<const HepMC::GenParticle *>* /*genSignal*/) const {
+ const std::vector<HepMC::ConstGenParticlePtr>* /*genSignal*/) const {
 
   // nothing to prepare as local data at start of collection analysis
   return;
@@ -62,7 +62,7 @@ void Trk::PrimaryTruthClassifier::initClassification
 //////////////////////////////////////////
 // classification from InDetRecStatistics
 //////////////////////////////////////////
-unsigned int Trk::PrimaryTruthClassifier::classify(const HepMC::GenParticle& genParticle) const {
+unsigned int Trk::PrimaryTruthClassifier::classify(HepMC::ConstGenParticlePtr genParticle) const {
 
  
   /* note on using HepMC::FourVector/3Vector against HepGeom::Point3D<double>: The versions from HepMC2 do not know
@@ -74,17 +74,17 @@ unsigned int Trk::PrimaryTruthClassifier::classify(const HepMC::GenParticle& gen
   bool  secondary=false;
   bool  truncated=false;
 
-  if (genParticle.production_vertex()) {
-    HepMC::FourVector      startVertex = genParticle.production_vertex()->position();
+  if (genParticle->production_vertex()) {
+    HepMC::FourVector      startVertex = genParticle->production_vertex()->position();
 
     // primary vertex inside innermost layer?
     if ( fabs(startVertex.perp()) < m_maxRStartPrimary 
          && fabs(startVertex.z()) < m_maxZStartPrimary)
       {
-        if (genParticle.end_vertex() == 0) {  
+        if (genParticle->end_vertex() == 0) {  
           primary=true;
         } else {
-          HepMC::FourVector endVertex = genParticle.end_vertex()->position();
+          HepMC::FourVector endVertex = genParticle->end_vertex()->position();
           if (  endVertex.perp()         > m_minREndPrimary 
                 || fabs(startVertex.z()) > m_minZEndPrimary)
             primary=true; else truncated = true;
@@ -93,10 +93,10 @@ unsigned int Trk::PrimaryTruthClassifier::classify(const HepMC::GenParticle& gen
     else if ( startVertex.perp()    <  m_maxRStartSecondary && 
               fabs(startVertex.z()) <  m_maxZStartSecondary)
       {
-        if (genParticle.end_vertex() == 0) {  
+        if (genParticle->end_vertex() == 0) {  
           secondary=true;
         } else {
-          HepMC::FourVector endVertex = genParticle.end_vertex()->position();
+          HepMC::FourVector endVertex = genParticle->end_vertex()->position();
           if (endVertex.perp()            > m_minREndSecondary
               || fabs(endVertex.z())      > m_minZEndSecondary) {
             secondary=true;
@@ -108,8 +108,7 @@ unsigned int Trk::PrimaryTruthClassifier::classify(const HepMC::GenParticle& gen
   if (truncated) return Trk::TruthClassification::Truncated;
   if (secondary) return Trk::TruthClassification::Secondary;
   if (primary) return Trk::TruthClassification::Primary;
-  ATH_MSG_DEBUG ( "Could not classify this particle: " 
-        << genParticle );
+  ATH_MSG_DEBUG ( "Could not classify this particle: " << genParticle );
   return Trk::TruthClassification::OutsideClassification;
 
 }
diff --git a/Tracking/TrkValidation/TrkVertexFitterValidationUtils/src/TrkPriVxPurityTool.cxx b/Tracking/TrkValidation/TrkVertexFitterValidationUtils/src/TrkPriVxPurityTool.cxx
index b0effec98c423cf4b5e65be44ff9108ef912bbe8..9a9d2eb64510eb8f5ecc197099a56e8900f46d8e 100755
--- a/Tracking/TrkValidation/TrkVertexFitterValidationUtils/src/TrkPriVxPurityTool.cxx
+++ b/Tracking/TrkValidation/TrkVertexFitterValidationUtils/src/TrkPriVxPurityTool.cxx
@@ -79,36 +79,47 @@ namespace Trk {
 //getting the signal event itself
                 McEventCollection::const_iterator it = mcCollection->begin();
                 const HepMC::GenEvent* genEvent= ( *it );
+#ifdef HEPMC3
+                if( genEvent->vertices().empty() ) {
+                  ATH_MSG_DEBUG( "No vertices found in first GenEvent" );
+                  return 0;
+                }
+               auto pv = genEvent->vertices()[0];
+#else
 //        std::cout<<"The ID of the first event of the collection: "<<genEvent->event_number()<<std::endl;
                 if( genEvent->vertices_empty() ) {
                   ATH_MSG_DEBUG( "No vertices found in first GenEvent" );
                   return 0;
                 }
+               auto pv = *(genEvent->vertices_begin());
+#endif
 
 //analysing the MC event to create PV candidate
 //first finding the vertex of primary pp interaction
-                HepMC::GenEvent::vertex_const_iterator pv = genEvent->vertices_begin();
 
 //and storing its position
-                CLHEP::HepLorentzVector pv_pos ( ( *pv )->position().x(),
-                                          ( *pv )->position().y(),
-                                          ( *pv )->position().z(),
-                                          ( *pv )->position().t() );
+                CLHEP::HepLorentzVector pv_pos ( pv ->position().x(),
+                                          pv ->position().y(),
+                                          pv ->position().z(),
+                                          pv ->position().t() );
                 double pv_r = pv_pos.perp();
                 double pv_z = pv_pos.z();
 
 // storing all the ids of vertices reasonably close to the primary one.
 // here the region of interest is selected.
-                std::map<int,HepMC::GenVertex *> vertex_ids;
-
-                for ( HepMC::GenEvent::vertex_const_iterator i = genEvent->vertices_begin();
-                      i != genEvent->vertices_end()  ;++i ) {
-                    CLHEP::HepLorentzVector lv_pos ( ( *i )->position().x(),
-                                              ( *i )->position().y(),
-                                              ( *i )->position().z(),
-                                              ( *i )->position().t() );
-                    if ( fabs ( lv_pos.perp() - pv_r ) <m_r_tol  && fabs ( lv_pos.z() - pv_z ) <m_z_tol ) {
-                        vertex_ids[ ( *i )->barcode() ]= ( *i );
+                std::map<int,HepMC::ConstGenVertexPtr> vertex_ids;
+#ifdef HEPMC3
+                for (auto vtx: genEvent->vertices()){
+#else
+                for ( HepMC::GenEvent::vertex_const_iterator i = genEvent->vertices_begin(); i != genEvent->vertices_end()  ;++i ) {
+                    auto vtx=*i;
+#endif
+                    CLHEP::HepLorentzVector lv_pos ( vtx->position().x(),
+                                              vtx->position().y(),
+                                              vtx->position().z(),
+                                              vtx->position().t() );
+                    if ( std::abs ( lv_pos.perp() - pv_r ) <m_r_tol  && std::abs ( lv_pos.z() - pv_z ) <m_z_tol ) {
+                        vertex_ids[ HepMC::barcode(vtx) ]= vtx;
                     }//end of accepted vertices check
                 }//end  of loop over all the vertices
 
@@ -128,7 +139,6 @@ namespace Trk {
 //looping over the tracks to find those matched to the GenParticle originating from signal PV
                 std::vector<Trk::VxTrackAtVertex *>::const_iterator vt = tracks->begin();
                 std::vector<Trk::VxTrackAtVertex *>::const_iterator ve = tracks->end();
-//         unsigned int total_size = 0;
                 unsigned int n_failed = 0;
                 std::vector<double> in_weights ( 0 );
                 std::vector<double> out_weights ( 0 );
@@ -147,7 +157,6 @@ namespace Trk {
                             // get to the original track particle
                             LinkToTrackParticleBase * tr_part = dynamic_cast< LinkToTrackParticleBase * > ( origLink );
                             if ( tr_part !=0  && tr_part->isValid()) {
-//                 ++total_size;
                 
 
                                 std::map< Rec::TrackParticleTruthKey, TrackParticleTruth>::const_iterator ttItr = trackParticleTruthCollection->end();
@@ -166,22 +175,22 @@ namespace Trk {
 
                                 if (ttItr != trackParticleTruthCollection->end() ) {
                                     const HepMcParticleLink& particleLink = ttItr->second.particleLink();
-                                    const HepMC::GenParticle* genParticle = particleLink.cptr();
+                                    HepMC::ConstGenParticlePtr genParticle = particleLink.cptr();
 
-                                    if(genParticle !=0) {
-                                        HepMC::GenEvent * tpEvent = genParticle->parent_event();
+                                    if(genParticle) {
+                                        auto tpEvent = genParticle->parent_event();
                                         if(tpEvent==genEvent) { 
-                                            const HepMC::GenVertex * pVertex(0);
-                                            if (genParticle!=0) pVertex = genParticle->production_vertex();
-                                            if ( pVertex != 0 ) {
+                                            HepMC::ConstGenVertexPtr pVertex{nullptr};
+                                            if (genParticle) pVertex = genParticle->production_vertex();
+                                            if ( pVertex) {
                                                 int link_pid = genParticle->pdg_id();
                                                 bool primary_track = false;
                                                 bool secondary_track = false;
                   
 //loop over the particles until decision is really taken
                                                 do {
-                                                    int tvrt_code = pVertex->barcode();
-                                                    std::map<int, HepMC::GenVertex *>::const_iterator idf_res = vertex_ids.find ( tvrt_code );
+                                                    int tvrt_code = HepMC::barcode(pVertex);
+                                                    auto idf_res = vertex_ids.find ( tvrt_code );
 
 //for the HepMcParticle Link, the signal event has an index 0.
 // tagging on it
@@ -193,11 +202,19 @@ namespace Trk {
 //this vertex is not from the central region.
 //checking whether it is a bremsstrahlung
 //if so, propagating track to its origin, otherwise rejecting it completely.
+#ifdef HEPMC3
+                                                        if ( pVertex->particles_in().size() == 1 ) {
+#else
                                                         if ( pVertex->particles_in_size() == 1 ) {
+#endif
 // one mother particle: is it a brem of some kind?
-                                                            HepMC::GenVertex::particles_in_const_iterator inp = pVertex->particles_in_const_begin() ;
-                                                            HepMC::GenVertex * tmpVertex_loc = ( *inp )->production_vertex();
-                                                            if ( ( *inp )->pdg_id() == link_pid  && tmpVertex_loc) {
+#ifdef HEPMC3
+                                                            auto inp = pVertex->particles_in()[0] ;
+#else
+                                                            auto inp =*(pVertex->particles_in_const_begin()) ;
+#endif
+                                                            auto tmpVertex_loc = inp ->production_vertex();
+                                                            if ( inp ->pdg_id() == link_pid  && tmpVertex_loc) {
 // seems like a brem (this can be generator/simulation dependent unfortunately)
 // continue iterating
                                                                 pVertex = tmpVertex_loc;
diff --git a/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveVertexFitter.cxx b/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveVertexFitter.cxx
index 1409b9518c1a6ca6a6298a41457d18c125e3adcc..d2bae3fc02167f13e27c3ab71d9c14d3108e3483 100755
--- a/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveVertexFitter.cxx
+++ b/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveVertexFitter.cxx
@@ -560,7 +560,7 @@ namespace Trk
     const std::vector<const Trk::NeutralParameters*>& neutralPerigeeList,
     const xAOD::Vertex& constraint) const
   {
-    return _fit(perigeeList,neutralPerigeeList,constraint,Amg::Vector3D(),true);
+    return _fit(perigeeList,neutralPerigeeList,constraint,Amg::Vector3D::Zero(),true);
   }
 
   xAOD::Vertex*
diff --git a/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TriggerJetBuildTool.cxx b/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TriggerJetBuildTool.cxx
index 14e591edb494cd13d48f22d522e2c1fa2164aa61..b17a79d563e94a2641bd909ce0856e995f8d2c24 100644
--- a/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TriggerJetBuildTool.cxx
+++ b/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TriggerJetBuildTool.cxx
@@ -144,10 +144,10 @@ void TriggerJetBuildTool::prime(const xAOD::IParticleContainer* inputs){
   ATH_MSG_DEBUG("Entering prime(), call " << ++m_nprime);
 
   constexpr bool isGhost = false;
-  IParticleExtractor* extractor = new IParticleExtractor(inputs,
-                                                         m_concreteTypeStr,
-                                                         isGhost,
-                                                         m_isTrigger);
+  auto extractor = std::make_unique<const IParticleExtractor>(inputs,
+                                                             m_concreteTypeStr,
+                                                             isGhost,
+                                                             m_isTrigger);
 
   
   ATH_MSG_DEBUG("No of IParticle inputs: " << inputs->size());
@@ -180,7 +180,7 @@ void TriggerJetBuildTool::prime(const xAOD::IParticleContainer* inputs){
                 
                 
 
-  PseudoJetContainer pjc(extractor, vpj);
+  PseudoJetContainer pjc(std::move(extractor), vpj);
   m_inContainer.append(&pjc);
 }
 
@@ -194,10 +194,10 @@ void TriggerJetBuildTool::primeGhost(const xAOD::IParticleContainer* inputs, std
   ATH_MSG_DEBUG("Entering primeGhost(), call " << ++m_nprime);
 
   constexpr bool isGhost = true;
-  IParticleExtractor* extractor = new IParticleExtractor(inputs,
-                                                         ghostlabel,
-                                                         isGhost,
-                                                         m_isTrigger);
+  auto extractor = std::make_unique<const IParticleExtractor>(inputs,
+                                                              ghostlabel,
+                                                              isGhost,
+                                                              m_isTrigger);
 
   
   ATH_MSG_DEBUG("No of ghost IParticle inputs: " << inputs->size());
@@ -231,7 +231,7 @@ void TriggerJetBuildTool::primeGhost(const xAOD::IParticleContainer* inputs, std
                 
                 
 
-  PseudoJetContainer pjc(extractor, vpj);
+  PseudoJetContainer pjc(std::move(extractor), vpj);
   m_inContainer.append(&pjc);
 }
 
diff --git a/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TriggerPseudoJetGetter2.cxx b/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TriggerPseudoJetGetter2.cxx
index 0e4f80cdc59b453b562036de2296eba82e0971df..f3b9126a4d96cd9a1b2602a0d3b0301c575e0241 100644
--- a/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TriggerPseudoJetGetter2.cxx
+++ b/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TriggerPseudoJetGetter2.cxx
@@ -37,9 +37,9 @@ void TriggerPseudoJetGetter2::prime(const xAOD::CaloClusterContainer* inputs) {
   // to determine the function used to select the incomming IParticles.
 
   constexpr bool isGhost = false;
-  IConstituentExtractor* extractor = new IParticleExtractor(inputs,
-                                                            m_label,
-                                                            isGhost);
+  auto extractor = std::make_unique<const IParticleExtractor>(inputs,
+                                                              m_label,
+                                                              isGhost);
   
   constexpr bool noRejection = true;
   std::vector<fastjet::PseudoJet> vpj = 
@@ -48,7 +48,7 @@ void TriggerPseudoJetGetter2::prime(const xAOD::CaloClusterContainer* inputs) {
                                                 m_noNegE,
                                                 noRejection);
   
-  auto ppjc(std::make_unique<const PseudoJetContainer>(extractor, vpj));
+  auto ppjc(std::make_unique<const PseudoJetContainer>(std::move(extractor), vpj));
   m_pseudoJetContainer.swap(ppjc);
 }
 
diff --git a/Trigger/TrigAlgorithms/TrigPartialEventBuilding/src/RoIPEBInfoWriterTool.h b/Trigger/TrigAlgorithms/TrigPartialEventBuilding/src/RoIPEBInfoWriterTool.h
index 66ed0062b6c5d307a14cbdde3dcde3aa0107df36..073a1e3b4fcf503562c0e07de957e4a5a6f829bc 100644
--- a/Trigger/TrigAlgorithms/TrigPartialEventBuilding/src/RoIPEBInfoWriterTool.h
+++ b/Trigger/TrigAlgorithms/TrigPartialEventBuilding/src/RoIPEBInfoWriterTool.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 TrigPartialEventBuilding_RoIPEBInfoWriterTool_h
@@ -7,7 +7,6 @@
 
 #include "TrigPartialEventBuilding/PEBInfoWriterToolBase.h"
 #include "IRegionSelector/RegSelEnums.h"
-#include "IRegionSelector/IRegSelSvc.h"
 #include "IRegionSelector/IRegSelTool.h"
 
 /** @class RoIPEBInfoWriterTool
diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TrigDataAccessATLFAST.cxx b/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TrigDataAccessATLFAST.cxx
deleted file mode 100644
index a237fa318f8b1e1c22c5da6a59a6ed40694c45e0..0000000000000000000000000000000000000000
--- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TrigDataAccessATLFAST.cxx
+++ /dev/null
@@ -1,636 +0,0 @@
-/*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-*/
-
-
-// ********************************************************************
-//
-// NAME:     TrigDataAccessATLFAST.cxx
-// PACKAGE:  Trigger/TrigAlgorithms/TrigT2CaloCommon
-//
-// AUTHOR:   Denis Oliveira Damazio
-//
-// REFERENCES: This will provide infrastructure for the Tools
-//		to perform their algorithms
-//
-// ********************************************************************
-
-#include "GaudiKernel/MsgStream.h"
-
-#include "CaloIdentifier/LArEM_ID.h"
-#include "LArRecEvent/LArCell.h"
-#include "LArRecEvent/LArFebEnergyCollection.h"
-
-#include "CaloIdentifier/LArEM_ID.h"
-#include "CaloEvent/CaloCluster.h"
-#include "CaloGeoHelpers/CaloSampling.h"
-
-#include "LArRawUtils/LArRoI_Map.h"
-#include "IRegionSelector/IRegSelSvc.h"
-
-#include "TrigDataAccessATLFAST.h"
-
-#include "AthenaPoolUtilities/AthenaAttributeList.h"
-
-#include "TrigSteeringEvent/TrigRoiDescriptor.h"
-
-// Event Incident to get EventInfo
-#include "GaudiKernel/IIncidentSvc.h"
-#include "EventInfo/EventInfo.h"
-#include "EventInfo/EventID.h"
-
-ATLAS_NO_CHECK_FILE_THREAD_SAFETY;  // legacy trigger code
-
-// Initialize method for all tools
-// Retrieval of all Tools to be used during run
-StatusCode TrigDataAccessATLFAST::initialize()
-{
-
-        ATH_MSG_DEBUG("in initialize() by TrigDataAccessATLFAST");
-
-	// Some tools are necessary for the Algorithm to run
-	// The RegionSelector is being retrieved here
-        if( (m_pRegionSelector.retrieve()).isFailure() ) {
-	  ATH_MSG_FATAL("Unable to retrieve RegionSelector Service");
-	  return StatusCode::FAILURE;
-	}
-
-	// Reserve vectors space to avoid online memory allocation
-	// Limits to be studied
-	m_rIds.reserve(30);
-	m_vrodid32.reserve(30);
-	m_tile.push_back(0);
-// Event handling
-	IIncidentSvc* p_incSvc;
-	if ( service("IncidentSvc",p_incSvc, true).isFailure() ) {
-	  ATH_MSG_ERROR("Unable to get the IncidentSvc");
-	}else{
-	p_incSvc->addListener(this, "BeginEvent",100);
-	}
-	// Method not called yet
-	m_iov_called=false;
-	// Register function for the detector store
-        const DataHandle<AthenaAttributeList> febrodmap;
-	if ( detStore()->regFcn(&ITrigDataAccess::beginRunHandle,
-		(ITrigDataAccess*)this,
-				 febrodmap, "/LAR/Identifier/FebRodMap", true).isFailure() ) { //FIXME hardcoded database folder name
-	  ATH_MSG_ERROR(" Can't regFnc with Condition ");
-	  return StatusCode::FAILURE;
-        }
-	// Just to the Missing Et slice
-        if ( m_usefullcoll ) {
-	IRegSelSvc* regSelSvc = &(*m_pRegionSelector);
-	if ( detStore()->regFcn(&IRegSelSvc::handle,
-		regSelSvc,
-		&ITrigDataAccess::beginRunHandle_RegSelSvc,
-		(ITrigDataAccess*)this,true).isFailure() ) {
-	  ATH_MSG_ERROR(" Can't regFnc with Condition");
-	  return StatusCode::FAILURE;
-	}
-          m_rIdsem0.reserve(12288);
-          m_rIdsem1.reserve(300);
-          m_rIdsem2.reserve(300);
-          m_rIdsem3.reserve(300);
-          m_rIdshec.reserve(4352);
-          m_rIdshec0.reserve(300);
-          m_rIdshec1.reserve(300);
-          m_rIdshec2.reserve(300);
-          m_rIdsfcalhad0.reserve(256);
-          m_rIdsfcalhad1.reserve(128);
-          m_rIdsfcalem0.reserve(300);
-          m_rIdstile.reserve(300);
-          m_vrodid32lar.reserve(300);
-          m_vrodid32em.reserve(724);
-          m_vrodid32hec.reserve(72);
-          m_vrodid32hec0.reserve(24);
-          m_vrodid32hec1.reserve(24);
-          m_vrodid32hec2.reserve(24);
-          m_vrodid32fcalem.reserve(8);
-          m_vrodid32fcalhad.reserve(6);
-          m_vrodid32tile.reserve(300);
-	} // end of m_usefullcoll
-
-	return StatusCode::SUCCESS;
-} // End of initialize
-
-StatusCode TrigDataAccessATLFAST::beginRunHandle(IOVSVC_CALLBACK_ARGS){
-	// The ByteStreamCnv (Through LArTT_Selector needs a map of the
-	// RoIs, being retrieved here
-	if(toolSvc()->retrieveTool("LArRoI_Map",m_roiMap).isFailure()) {
-	  ATH_MSG_FATAL("Could not find LArRoI_Map");
-	  return StatusCode::FAILURE;
-	} // End of if LArRoI_Map
-
-#ifdef DOBYTESTREAMCNV
-        //m_datablock.reserve(350);
-	m_larcell = new LArCellCont();
-	if ( (m_larcell->initialize()).isFailure() ){
-	  ATH_MSG_FATAL("Could not init larcell");
-        }
-        m_sel= new LArTT_Selector<LArCellCont>(m_roiMap,m_larcell);
-        if(m_usefullcoll){
-          m_selem = new LArTT_Selector<LArCellCont>(m_roiMap,m_larcell);
-          m_selhec = new LArTT_Selector<LArCellCont>(m_roiMap,m_larcell);
-          m_selfcalhad = new LArTT_Selector<LArCellCont>(m_roiMap,m_larcell);
-          m_selfcalem = new LArTT_Selector<LArCellCont>(m_roiMap,m_larcell);
-        }
-	m_tilecell = new TileCellCont();
-        if ( (m_tilecell->initialize()).isFailure() ){
-	  ATH_MSG_FATAL("Could not init tilecell");
-        }
-        //m_febcoll = new LArFebEnergyCollection();
-	if(m_usefullcoll){
-	  ATH_MSG_DEBUG("Preparing the full collections");
-          if ( m_rIdsem0.size() != 0 ) m_rIdsem0.clear();
-          if ( m_rIdsem1.size() != 0 ) m_rIdsem1.clear();
-          if ( m_rIdsem2.size() != 0 ) m_rIdsem2.clear();
-          if ( m_rIdsem3.size() != 0 ) m_rIdsem3.clear();
-          if ( m_rIdshec.size() != 0 ) m_rIdshec.clear();
-          if ( m_rIdshec0.size() != 0 ) m_rIdshec0.clear();
-          if ( m_rIdshec1.size() != 0 ) m_rIdshec1.clear();
-          if ( m_rIdsfcalhad0.size() != 0 ) m_rIdsfcalhad0.clear();
-          if ( m_rIdsfcalhad1.size() != 0 ) m_rIdsfcalhad1.clear();
-          if ( m_rIdsfcalem0.size() != 0 ) m_rIdsfcalem0.clear();
-          if ( m_rIdstile.size() != 0 ) m_rIdstile.clear();
-	} // End of m_usefullcoll
-#endif
-	m_iov_called=true;
-	return StatusCode::SUCCESS;
-}
-
-
-
-StatusCode TrigDataAccessATLFAST::beginRunHandle_RegSelSvc(IOVSVC_CALLBACK_ARGS){
-	  if(m_usefullcoll){
-	    ATH_MSG_DEBUG("Finalizing Preparation of full collections");
-	  //	  TrigRoiDescriptor tmproi( 0, -4.8, 4.8, 0, -M_PI, M_PI, 0, 0, 0 );
-	  TrigRoiDescriptor tmproi( true );  /// give it true during the constructor, you get a full scan RoI
-
-	  //          const double mineta = -4.8;
-	  //          const double maxeta = 4.8;
-	  //          const double minphi = -M_PI;
-	  //          const double maxphi = M_PI;
-	  //           // TTEM 
-	  //           m_pRegionSelector->DetROBIDListUint(TTEM,-1,mineta,maxeta,minphi,maxphi,m_vrodid32em);
-	  //           // TTHEC
-	  //           m_pRegionSelector->DetROBIDListUint(TTHEC,0,mineta,maxeta,minphi,maxphi,m_vrodid32hec0);
-	  //           m_pRegionSelector->DetROBIDListUint(TTHEC,1,mineta,maxeta,minphi,maxphi,m_vrodid32hec1);
-	  //           m_pRegionSelector->DetROBIDListUint(TTHEC,2,mineta,maxeta,minphi,maxphi,m_vrodid32hec2);
-	  //           // FCALHAD
-	  //           m_pRegionSelector->DetROBIDListUint(FCALHAD,-1,mineta,maxeta,minphi,maxphi,m_vrodid32fcalhad);
-	  //           m_pRegionSelector->DetROBIDListUint(FCALEM,-1,mineta,maxeta,minphi,maxphi,m_vrodid32fcalem);
-	  //           // TILE
-	  //           m_pRegionSelector->DetROBIDListUint(TILE,mineta,maxeta,minphi,maxphi,m_vrodid32tile);
-	  //           m_vrodid32lar.insert(m_vrodid32lar.end(),m_vrodid32em.begin(),m_vrodid32em.end());
-	  //           m_vrodid32hec.insert(m_vrodid32hec.end(),m_vrodid32hec0.begin(),m_vrodid32hec0.end());
-	  //           m_vrodid32lar.insert(m_vrodid32lar.end(),m_vrodid32fcalhad.begin(),m_vrodid32fcalhad.end());
-	  //           m_vrodid32lar.insert(m_vrodid32lar.end(),m_vrodid32fcalem.begin(),m_vrodid32fcalem.end());
-	  //           m_vrodid32lar.insert(m_vrodid32lar.end(),m_vrodid32hec.begin(),m_vrodid32hec.end());
-	  //           m_pRegionSelector->DetHashIDList(TTEM,0,mineta,maxeta,minphi,maxphi,&m_rIdsem0);
-	  //           m_pRegionSelector->DetHashIDList(TTEM,1,mineta,maxeta,minphi,maxphi,&m_rIdsem1);
-	  //           m_pRegionSelector->DetHashIDList(TTEM,2,mineta,maxeta,minphi,maxphi,&m_rIdsem2);
-	  //           m_pRegionSelector->DetHashIDList(TTEM,3,mineta,maxeta,minphi,maxphi,&m_rIdsem3);
-	  //           m_pRegionSelector->DetHashIDList(TTHEC,0,mineta,maxeta,minphi,maxphi,&m_rIdshec0);
-	  //           m_pRegionSelector->DetHashIDList(TTHEC,1,mineta,maxeta,minphi,maxphi,&m_rIdshec1);
-	  //           m_pRegionSelector->DetHashIDList(TTHEC,2,mineta,maxeta,minphi,maxphi,&m_rIdshec2);
-	  //           m_pRegionSelector->DetHashIDList(FCALHAD,0,mineta,maxeta,minphi,maxphi,&m_rIdsfcalhad0);
-	  //           m_pRegionSelector->DetHashIDList(FCALHAD,1,mineta,maxeta,minphi,maxphi,&m_rIdsfcalhad1);
-	  //           m_pRegionSelector->DetHashIDList(FCALEM,0,mineta,maxeta,minphi,maxphi,&m_rIdsfcalem0);
-	  //           m_pRegionSelector->DetHashIDList(TILE,mineta,maxeta,minphi,maxphi,&m_rIdstile);
-	  
-
-	  m_pRegionSelector->DetROBIDListUint(TTEM,-1, tmproi, m_vrodid32em);
-          // TTHEC
-          m_pRegionSelector->DetROBIDListUint(TTHEC,0, tmproi, m_vrodid32hec0);
-          m_pRegionSelector->DetROBIDListUint(TTHEC,1, tmproi, m_vrodid32hec1);
-          m_pRegionSelector->DetROBIDListUint(TTHEC,2, tmproi, m_vrodid32hec2);
-          // FCALHAD
-          m_pRegionSelector->DetROBIDListUint(FCALHAD,-1, tmproi, m_vrodid32fcalhad);
-          m_pRegionSelector->DetROBIDListUint(FCALEM,-1,  tmproi, m_vrodid32fcalem);
-          // TILE
-          m_pRegionSelector->DetROBIDListUint(TILE, tmproi, m_vrodid32tile);
-          m_vrodid32lar.insert(m_vrodid32lar.end(),m_vrodid32em.begin(),m_vrodid32em.end());
-          m_vrodid32hec.insert(m_vrodid32hec.end(),m_vrodid32hec0.begin(),m_vrodid32hec0.end());
-	  m_vrodid32lar.insert(m_vrodid32lar.end(),m_vrodid32fcalhad.begin(),m_vrodid32fcalhad.end());
-          m_vrodid32lar.insert(m_vrodid32lar.end(),m_vrodid32fcalem.begin(),m_vrodid32fcalem.end());
-          m_vrodid32lar.insert(m_vrodid32lar.end(),m_vrodid32hec.begin(),m_vrodid32hec.end());
-          m_pRegionSelector->DetHashIDList(TTEM,0, tmproi, m_rIdsem0);
-          m_pRegionSelector->DetHashIDList(TTEM,1, tmproi, m_rIdsem1);
-          m_pRegionSelector->DetHashIDList(TTEM,2, tmproi, m_rIdsem2);
-          m_pRegionSelector->DetHashIDList(TTEM,3, tmproi, m_rIdsem3);
-          m_pRegionSelector->DetHashIDList(TTHEC,0, tmproi, m_rIdshec0);
-          m_pRegionSelector->DetHashIDList(TTHEC,1, tmproi, m_rIdshec1);
-          m_pRegionSelector->DetHashIDList(TTHEC,2, tmproi, m_rIdshec2);
-          m_pRegionSelector->DetHashIDList(FCALHAD,0, tmproi, m_rIdsfcalhad0);
-          m_pRegionSelector->DetHashIDList(FCALHAD,1, tmproi, m_rIdsfcalhad1);
-	  m_pRegionSelector->DetHashIDList(FCALEM,0, tmproi, m_rIdsfcalem0);
-          m_pRegionSelector->DetHashIDList(TILE, tmproi,  m_rIdstile);
-      
-
-          // TTEM 
-          m_rIdsem0.insert(m_rIdsem0.end(),m_rIdsem1.begin(),m_rIdsem1.end());
-          m_rIdsem0.insert(m_rIdsem0.end(),m_rIdsem2.begin(),m_rIdsem2.end());
-          m_rIdsem0.insert(m_rIdsem0.end(),m_rIdsem3.begin(),m_rIdsem3.end());
-          // TTHEC
-          m_rIdshec.insert(m_rIdshec.end(),m_rIdshec0.begin(),m_rIdshec0.end());
-          m_rIdshec.insert(m_rIdshec.end(),m_rIdshec1.begin(),m_rIdshec1.end());
-          m_rIdshec.insert(m_rIdshec.end(),m_rIdshec2.begin(),m_rIdshec2.end());
-          // FCALHAD
-          m_rIdsfcalhad0.insert(m_rIdsfcalhad0.end(),m_rIdsfcalhad1.begin(),m_rIdsfcalhad1.end());
-
-          m_selem->setRoIs(m_rIdsem0);
-          m_selhec->setRoIs(m_rIdshec);
-          m_selfcalhad->setRoIs(m_rIdsfcalhad0);
-          m_selfcalem->setRoIs(m_rIdsfcalem0);
-	} // End of m_usefullcoll
-	return StatusCode::SUCCESS;
-}
-
-// Finalize method for all tools
-StatusCode TrigDataAccessATLFAST::finalize(){
-        if (msgLvl(MSG::DEBUG)) {
-          ATH_MSG_INFO( "in finalize() by TrigDataAccess" );
-	}
-#ifdef DOBYTESTREAMCNV
-	if ( m_iov_called ){
-        if ( (m_larcell->finalize()).isFailure() ){
-	  ATH_MSG_FATAL("Could not finish larcell");
-        }
-        delete m_larcell;
-        if ( (m_tilecell->finalize()).isFailure() ){
-	  ATH_MSG_FATAL("Could not finish tilecell");
-        }
-        delete m_tilecell;
-        delete m_sel;
-	if(m_usefullcoll){
-         delete m_selem;
-         delete m_selhec;
-         delete m_selfcalhad;
-         delete m_selfcalem;
-	}
-	}
-#endif
-	return StatusCode::SUCCESS;
-
-} // End of finalize
-
-// This should be run to provide ByteStreamCnv with rodid's to
-// look up for. addROBData only works in athenaMT
-void TrigDataAccessATLFAST::RegionSelectorRobID (const int sampling,
-						 const IRoiDescriptor& roi,
-						 const DETID detid, bool /*fetchROBs*/) {
-        // Clears up m_vrodid32
-        if ( m_vrodid32.size() != 0 ) m_vrodid32.clear();
-        if ( detid != TILE ){
-	  m_pRegionSelector->DetROBIDListUint(detid,sampling, roi, m_vrodid32);
-        }
-        else { // TILE does not need sample
-	  m_pRegionSelector->DetROBIDListUint(detid, roi, m_vrodid32);
-        }
-	if (msgLvl(MSG::DEBUG)) {
-          ATH_MSG_DEBUG( "m_vrodid32.size() = " << m_vrodid32.size() );
-	  for(unsigned int i = 0 ; i < m_vrodid32.size() ; i++)
-            ATH_MSG_DEBUG( "m_vrodid32[" << i << "]=" << m_vrodid32[i] );
-	}
-}  // End of RegionSelectorRobID
-
-
-// This code should load m_listID with Detectors ID
-// Should this return a flag in case of failure?
-void TrigDataAccessATLFAST::RegionSelectorListID (const int sampling,
-						  const IRoiDescriptor& roi, const DETID detid) {
-        // Clears up m_rIds
-        if ( m_rIds.size() != 0 ) m_rIds.clear();
-  
-        if ( detid != TILE ){
-	  m_pRegionSelector->DetHashIDList(detid,sampling, roi, m_rIds);
-	}
-        else{ // TILE does not need sample
-	  m_pRegionSelector->DetHashIDList(detid, roi, m_rIds);					   
-	}
-	
-	if (msgLvl(MSG::DEBUG)) {
-          ATH_MSG_DEBUG( "m_rIds.size() = " << m_rIds.size() );
-	  for(unsigned int i = 0; i < m_rIds.size() ; i++)
-            ATH_MSG_DEBUG( "m_rIds[" << i << "]=" << m_rIds[i] );
-	}	
-} // End of RegionSelectorListID
-
-
-
-
-
-// This method should load all the infrastructure for the offline
-// Collection of cells. The iterators m_iBegin, m_iEnd and m_it
-// will have the cells Collection to be used by the Algorithm
-StatusCode TrigDataAccessATLFAST::LoadCollections (
-		LArTT_Selector<LArCellCont>::const_iterator& Begin,
-		LArTT_Selector<LArCellCont>::const_iterator& End,
-		const unsigned int /*sample*/, bool /*prepare*/) {
-        if (msgLvl(MSG::DEBUG)) {
-          ATH_MSG_DEBUG( "m_rIds.size() in LoadColl = " << m_rIds.size() );
-	  for(unsigned int i = 0 ; i < m_rIds.size() ; i++)
-            ATH_MSG_DEBUG( "m_rIds[" << i << "]=" << m_rIds[i] );
-	}
-
-	Begin=End;
-
-	const DataHandle<CaloCellContainer> cells;
-	if (evtStore()->retrieve(cells,"AllCalo").isFailure()) {
-	  ATH_MSG_ERROR("Could not find AllCalo container");
-	  return StatusCode::FAILURE;
-        } // End of if StoreGateSvc
-
-        int rodidx = 0;
-        for (size_t i = 0; i < m_vrodid32.size(); ++i){
-		// Find the collection to fill
-		const std::vector<LArCellCollection*>::const_iterator it =
-			(m_larcell->find(m_vrodid32[rodidx]));
-/*
-        	LArCellCollection* col =
-			*(m_larcell->find(m_vrodid32[rodidx]));
-*/
-		if ( it != m_larcell->end() ) { // Alread decoded collection
-		LArCellCollection *col = *it;
-		// Fills from the container
-		fillColl(cells,*col);
-        	// if (col->size() == 0) return StatusCode::FAILURE;
-		}
-		rodidx++;
-
-  	} // End of for through RobFrags
-
-        // These iterators can be used by every Tool
-        m_sel->setRoIs(m_rIds);
-        Begin = m_sel->begin();
-        End   = m_sel->end();
-	if (msgLvl(MSG::DEBUG)) {
-	  LArTT_Selector<LArCellCont>::const_iterator it;
-	  for ( it=Begin; it != End; ++it ){
-            ATH_MSG_DEBUG( "Eta: " << (*it)->eta()
-                           << "; Phi: " << (*it)->phi() <<
-                           "; Energy: " << (*it)->energy() );
-	  } // End of for printout cells
-	}
-	return StatusCode::SUCCESS;
-} // End of method
-StatusCode TrigDataAccessATLFAST::LoadCollections (
-                TileCellCollection::const_iterator& Begin,
-                TileCellCollection::const_iterator& End,
-                const unsigned int sample, bool /*prepare*/){
-
-	const DataHandle<CaloCellContainer> cells;
-	if (evtStore()->retrieve(cells,"AllCalo").isFailure()) {
-	  ATH_MSG_ERROR("Could not find AllCalo container");
-	  return StatusCode::FAILURE;
-        } // End of if StoreGateSvc
-
-	int i = sample;
-	Begin=End;
-	//for (size_t i = 0; i < m_listID.size(); ++i){
-		m_tile[0] = m_tilecell->find_rod(m_rIds[i]);
-		// Find the collection to fill
-                TileCellCollection* col = NULL;
-		col = *(m_tilecell->find(m_rIds[i]));
-		if ( col != NULL ) {
-		fillColl(cells,*col);
-                Begin = col->begin();
-                End = col->end();
-		}
-
-        //} // End of for through RobFrags
-
-	if (msgLvl(MSG::DEBUG)) {
-	  TileCellCollection::const_iterator itt = Begin;
-	  for (itt=Begin;itt!=End;++itt){
-            ATH_MSG_DEBUG( "Eta: " << (*itt)->eta()
-                           << "; Phi: " << (*itt)->phi() <<
-                           "; Energy: " << (*itt)->energy() << 
-                           "; Hash Id: " << (*itt)->caloDDE()->calo_hash() );
-	  } // End of for printout cells
-	}
-        return StatusCode::SUCCESS;
-
-} // End of LoadCollections
-
-// This method does not make sense for ATLFAST
-StatusCode TrigDataAccessATLFAST::LoadCollections (
-                LArFebEnergyCollection::const_iterator& /*Begin*/,
-                LArFebEnergyCollection::const_iterator& /*End*/,
-                const unsigned int /*sample*/, bool /*prepare*/){
-
-/*
-	m_robFrags.clear();
-        m_robDataProvider->getROBData(m_vrodid32,m_robFrags);
-
-        //int rodidx = 0;
-	LArFebEnergyCollection* m_febcoll;
-        m_febcoll = new LArFebEnergyCollection();
-        for (size_t i = 0; i < m_robFrags.size(); ++i){
-                m_lardecoder->check_valid(m_robFrags[i],msg());
-                //m_datablock.clear();
-                // Get Rod Data and size of fragment
-                const uint32_t* roddata1 = 0;
-                m_robFrags[i]->rod_data(roddata1);
-                size_t roddatasize = m_robFrags[i]->rod_ndata();
-                if (roddatasize < 3) {
-                        ATH_MSG_FATAL( "Error reading bytestream"<<
-                           "event: Empty ROD block (less than 3 words)" );
-                        return StatusCode::FAILURE;
-                } // End of if small size
-                m_lardecoder->setRobFrag(m_robFrags[i]);
-                m_lardecoder->fillCollectionHLTFeb(roddata1,roddatasize,*m_febcoll);
-                // if (col->size() == 0) return StatusCode::FAILURE;
-
-        } // End of for through RobFrags
-        // These iterators can be used by every Tool
-        Begin = m_febcoll->begin();
-        End   = m_febcoll->end();
-
-#ifndef NDEBUG
-        for(LArFebEnergyCollection::const_iterator it = Begin; 
-              it!=End; ++it){
-              ATH_MSG_DEBUG( " Feb ID = " << (*it)->getFebId() 
-                       << " Feb Ex = " << (*it)->getFebEx()
-                       << " Feb Ey = " << (*it)->getFebEy() 
-                       << " Feb Ez = " << (*it)->getFebEz() );
-        }
-#endif
-*/
-        return StatusCode::SUCCESS;
-
-} // End of LoadCollections
-
-StatusCode TrigDataAccessATLFAST::LoadFullCollections (
-                LArTT_Selector<LArCellCont>::const_iterator& Begin,
-                LArTT_Selector<LArCellCont>::const_iterator& End,
-                const DETID /*detid*/, bool /*prepare*/) {
-
-        if (msgLvl(MSG::DEBUG)) {
-          ATH_MSG_DEBUG( "m_rIds.size() in LoadColl = " << m_rIds.size() );
-	  for(unsigned int i = 0 ; i < m_rIds.size() ; i++)
-            ATH_MSG_DEBUG( "m_rIds[" << i << "]=" << m_rIds[i] );
-	}
-
-        Begin=End;
-
-        const DataHandle<CaloCellContainer> cells;
-        if (evtStore()->retrieve(cells,"AllCalo").isFailure()) {
-	  ATH_MSG_ERROR("Could not find AllCalo container");
-	  return StatusCode::FAILURE;
-        } // End of if StoreGateSvc
-
-        int rodidx = 0;
-        for (size_t i = 0; i < m_vrodid32lar.size(); ++i){
-           const std::vector<LArCellCollection*>::const_iterator it =
-                   (m_larcell->find(m_vrodid32lar[rodidx]));
-          if (it != m_larcell->end() ) {
-              LArCellCollection *col = *it;
-              fillColl(cells,*col);
-          }
-                rodidx++;
-        } // End of for through RobFrags
-
-
-	if (msgLvl(MSG::DEBUG)) {
-	  int i=0;
-	  LArTT_Selector<LArCellCont>::const_iterator it;
-	  for ( it=Begin; it != End; ++it ){
-            ATH_MSG_DEBUG( "Eta: " << (*it)->eta()
-                           << "; Phi: " << (*it)->phi() <<
-                           "; Energy: " << (*it)->energy() );
-	    i++;
-	  } // End of for printout cells
-	}
-        return StatusCode::SUCCESS;
-} // End of method
-StatusCode TrigDataAccessATLFAST::LoadFullCollections (
-                TileCellCollection::const_iterator& Begin,
-                TileCellCollection::const_iterator& End,
-                const unsigned int sample, bool /*prepare*/){
-
-        const DataHandle<CaloCellContainer> cells;
-        if (evtStore()->retrieve(cells,"AllCalo").isFailure()) {
-	  ATH_MSG_ERROR("Could not find AllCalo container");
-	    return StatusCode::FAILURE;
-        } // End of if StoreGateSvc
-
-
-        int i = sample;
-        Begin=End;
-                m_tile[0] = m_tilecell->find_rod(m_rIdstile[i]);
-                // Find the collection to fill
-                TileCellCollection* col = NULL;
-                col = *(m_tilecell->find(m_rIdstile[i]));
-                if( col!=NULL){
-                  fillColl(cells,*col);
-                  Begin = col->begin();
-                  End = col->end();
-                }
-
-	if (msgLvl(MSG::DEBUG)) {
-	  TileCellCollection::const_iterator itt = Begin;
-	  for (itt=Begin;itt!=End;++itt){
-            ATH_MSG_DEBUG( "Eta: " << (*itt)->eta()
-                           << "; Phi: " << (*itt)->phi() <<
-                           "; Energy: " << (*itt)->energy() <<
-                           "; Hash Id: " << (*itt)->caloDDE()->calo_hash() );
-	  } // End of for printout cells
-	}
-        return StatusCode::SUCCESS;
-
-} // End of LoadCollections
-
-// The following method does not make sense to ATLFAST
-StatusCode TrigDataAccessATLFAST::LoadFullCollections (
-                LArFebEnergyCollection::const_iterator& /*Begin*/,
-                LArFebEnergyCollection::const_iterator& /*End*/,
-                const DETID /*detid*/, bool /*prepare*/){
-
-
-/*
-	m_robFrags.clear();
-        switch (detid) {
-           case TTEM:
-             m_robDataProvider->getROBData(m_vrodid32em,m_robFrags);
-             break;
-           case TTHEC:
-             m_robDataProvider->getROBData(m_vrodid32hec0,m_robFrags);
-             break;
-           case FCALEM:
-             m_robDataProvider->getROBData(m_vrodid32fcalem,m_robFrags);
-             break;
-           case FCALHAD:
-             m_robDataProvider->getROBData(m_vrodid32fcalhad,m_robFrags);
-             break;
-           default:
-             break;
-        }
-
-        LArFebEnergyCollection* m_febcoll;
-        m_febcoll = new LArFebEnergyCollection();
-
-        for( size_t i=0; i< m_robFrags.size(); ++i){
-                m_lardecoder->check_valid(m_robFrags[i],msg());
-                const uint32_t* roddata1 = 0;
-                m_robFrags[i]->rod_data(roddata1);
-                size_t roddatasize = m_robFrags[i]->rod_ndata();
-                if(roddatasize < 3) {
-                       ATH_MSG_FATAL( "Error reading bytestream " <<
-                                  "event: Empty ROD block (less than 3 words)" );
-                       return StatusCode::FAILURE;
-                }
-                m_lardecoder->setRobFrag(m_robFrags[i]);
-                m_lardecoder->fillCollectionHLTFeb(roddata1,roddatasize,*m_febcoll);
-        }
-
-        Begin = m_febcoll->begin();
-        End = m_febcoll->end();
-        std::cout << "This is the detectorID = " << detid << std::endl;
-        std::cout << "This is the febcoll size = " << m_febcoll->size() << std::endl;
-
-#ifndef NDEBUG
-        for(LArFebEnergyCollection::const_iterator it = Begin;
-              it!=End; ++it){
-              ATH_MSG_DEBUG( " Feb ID = " << (*it)->getFebId()
-                       << " Feb Ex = " << (*it)->getFebEx()
-                       << " Feb Ey = " << (*it)->getFebEy()
-                       << " Feb Ez = " << (*it)->getFebEz() );
-        }
-#endif
-*/
-        return StatusCode::SUCCESS;
-
-} // End of LoadFullCollections
-
-// The following method does not make sense to ATLFAST
-StatusCode TrigDataAccessATLFAST::LoadFullCollections (
-                TileL2Container::const_iterator& /*Begin*/,
-                TileL2Container::const_iterator& /*End*/){
-        return StatusCode::SUCCESS;
-
-} // End of LoadFullCollections
-
-// handle events (beginEvent only) to prepare containers
-void TrigDataAccessATLFAST::handle(const Incident & inc ) {
-  m_larcell->eventNumber(inc.context().eventID().event_number());
-}
-
-template<class T>
-void TrigDataAccessATLFAST::fillColl(const DataHandle<CaloCellContainer>& input, T& output){
-	typedef typename T::iterator IT;
-	IT it,end;
-	it=  output.begin();
-	end= output.end();
-	for( ; it!= end; ++it ) {
-		if ( (*it)->caloDDE() != NULL ) {
-		  IdentifierHash id = (*it)->caloDDE()->calo_hash();
-		  const CaloCell* cell = NULL;
-		  cell = input->findCell(id);
-		  if ( cell != NULL ) (*it)->setEnergy(cell->energy()+1.0);
-		}
-	}
-}
-
-
-
diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TrigDataAccessATLFAST.h b/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TrigDataAccessATLFAST.h
deleted file mode 100644
index 2b68f8b2fc52ba037e081f9dadad899c43b23a11..0000000000000000000000000000000000000000
--- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TrigDataAccessATLFAST.h
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-*/
-
-/********************************************************************
- 
- NAME:     TrigDataAccessATLFAST.h
- PACKAGE:  Trigger/TrigAlgorithms/TrigT2CaloCommon
- 
- AUTHOR:   Denis Oliveira Damazio
-
- PURPOSE:  Tool designed to perform data access to
-           Calorimeter cells. It does not perform
-           ByteStream conversion. Just uses the ATLFast
-	   CaloCellContainer AllCalo. It is, however,
-           driven by Region of Interest (in eta/phi)
-           definition.
- *******************************************************************/
-
-#ifndef TRIGT2CALOCOMMONATLFAST_TRIGDATAACCESS_H 
-#define TRIGT2CALOCOMMONATLFAST_TRIGDATAACCESS_H
-
-#include "GaudiKernel/IAlgTool.h"
-#include "AthenaBaseComps/AthAlgTool.h"
-#include "GaudiKernel/IProperty.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "GaudiKernel/ServiceHandle.h"
-
-#include "StoreGate/DataHandle.h"
-#include "CaloIdentifier/CaloIdManager.h"
-#include "TrigTimeAlgs/TrigTimerSvc.h"
-
-#include "TrigT2CaloCommon/ITrigDataAccess.h"
-#include "Identifier/IdentifierHash.h"
-
-#include "LArRecEvent/LArCellCollection.h"
-#include "LArRecEvent/LArFebEnergyCollection.h"
-
-#include "TileEvent/TileCell.h"
-
-#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h"
-#include "LArByteStream/LArRodDecoder.h"
-#include "TileByteStream/TileROD_Decoder.h"
-
-#include "TrigT2CaloCommon/T2GeometryTool.h"
-#include "TrigT2CaloCommon/T2Calibration.h"
-#include "CaloGeoHelpers/CaloSampling.h"
-#include "eformat/old/util.h"
-
-#include "GaudiKernel/IIncidentListener.h"
-#include "GaudiKernel/Incident.h"
-
-#include "TrigSteeringEvent/TrigRoiDescriptor.h"
-
-#include "CxxUtils/phihelper.h"
-
-#include "CxxUtils/checker_macros.h"
-ATLAS_NO_CHECK_FILE_THREAD_SAFETY;  // legacy trigger code
-
-class IRegSelSvc;
-// class ITrigRegionSelector;
-class LArRoI_Map;
-class IROBDataProviderSvc;
-class T2CaloConfig;
-
-/** Class that provides access to data for
-    Calorimeter LVL2 Algorithms */
-class TrigDataAccessATLFAST: virtual public ITrigDataAccess, public AthAlgTool,
-	virtual public IIncidentListener {
-  public:
-    /** Real Constructor */
-    TrigDataAccessATLFAST(const std::string & type, const std::string & name,
-                 const IInterface* parent) : AthAlgTool(type,name,parent),
-		 m_pRegionSelector("RegSelSvc/RegSelSvc","TrigDataAccess"){
-	declareInterface<ITrigDataAccess>(this); 
-	declareProperty("RegSelSvc",m_pRegionSelector,"Region Selector Service access");
-	// New property for MET slice
-        declareProperty("loadFullCollections",  m_usefullcoll=false);
-    }
-    /** Destructor */
-    virtual ~TrigDataAccessATLFAST() { }
-
-
-    /** The same function should initialize all internal Tools
-    */
-    StatusCode initialize();
-    /** Finalize */
-    StatusCode finalize();
-    /** handle to init a new event */
-    void handle (const Incident& );
-    /** begin run handle for conditions */
-    StatusCode beginRunHandle(IOVSVC_CALLBACK_ARGS);
-    /** begin run handle for conditions and RegSelSvc */
-    StatusCode beginRunHandle_RegSelSvc(IOVSVC_CALLBACK_ARGS);
-
-    /** Expose list of ROBs */
-
-    void ROBList( const IRoiDescriptor& /* roi */,
-		  std::vector<uint32_t>& /*vec*/){ }
-
-    /// obsolete
-    void ROBList( const double /* etamin */, const double /*etamax*/,
-		  const double /*phimin*/, const double /*phimax*/,
-		  std::vector<uint32_t>& /*vec*/){ }
-
-
-  protected:
-    // methods for tools
-    // The two methods below could be united in a single one
-    // They load this class with the list of ROBs to be looked after
-    // By default TTEM is requested but TTHEC and TILE may also be used.
-
-    void RegionSelectorListID (const int sampling, const IRoiDescriptor& roi,
-			       const DETID detid=TTEM);    
-   
-    void RegionSelectorRobID (const int sampling,  const IRoiDescriptor& roi,
-			      const DETID detid=TTEM, bool fetchROBs = true);
-    
-    /** 
-        * @brief Region Selector Input. Prepare internal tables
-        * with online/offline Identifiers used in ByteStream
-        * Conversion and data iterators (to Calorimeter Cells).
-        * @param[in] sampling layer (not used for TileCal).
-        * @param[in] IRoiDescriptor for Region of Interest definition.
-        * @param[in] DETID which can be TTEM (default), TTHEC, TILE.
-         */
-    virtual inline void RegionSelector(const int sampling, const IRoiDescriptor& roi, const DETID detid=TTEM){
-      RegionSelectorListID(sampling, roi, detid);
-      RegionSelectorRobID (sampling, roi, detid);
-    };
-
-    
-    /// obsolete
-
-    /** 
-        * @brief Region Selector Input. Prepare internal tables
-        * with online/offline Identifiers used in ByteStream
-        * Conversion and data iterators (to Calorimeter Cells).
-        * @param[in] sampling layer (not used for TileCal).
-        * @param[in] etamin/etamax for Region of Interest definition.
-        * @param[in] phimin/phimax for Region of Interest definition.
-        * @param[in] DETID which can be TTEM (default), TTHEC, TILE.
-         */
-    void RegionSelectorListID (const int sampling, 
-			       const double etamin, const double etamax, 
-			       const double phimin, const double phimax,
-			       const DETID detid=TTEM) { 
-      TrigRoiDescriptor roi( 0.5*(etamin+etamax), etamin, etamax, CxxUtils::phiMean(phimin,phimax), phimin, phimax);
-      RegionSelectorListID(sampling, roi, detid);
-    }
-    
-    void RegionSelectorRobID (const int sampling, const double etamin,
-			      const double etamax, const double phimin, const double phimax,
-			      const DETID detid=TTEM, bool /* fetchROBs*/ = true) { 
-      TrigRoiDescriptor roi( 0.5*(etamin+etamax), etamin, etamax, CxxUtils::phiMean(phimin,phimax), phimin, phimax);
-      RegionSelectorRobID(sampling, roi, detid);
-    }
-
-    /// obsolete methods ///
-    virtual inline void RegionSelector(const int sampling, 
-				       const double etamin, const double etamax, 
-				       const double phimin, const double phimax,
-				       const DETID detid=TTEM){
-      TrigRoiDescriptor roi( 0.5*(etamin+etamax), etamin, etamax, CxxUtils::phiMean(phimin,phimax), phimin, phimax);
-      RegionSelector(sampling, roi, detid);
-    };
-	
-       /** 
-        * @brief LoadCollections fetches data via ROBDataProvider
-        * and really provides ByteStream Conversion by calling 
-        * detector specific (LAr or Tile) ByteStream Conversion
-        * Tools within RoI as defined in the above method.
-        * @param[out] LArTT_Selector<LArCellCont> outputs
-        *       begin, end interator to LArCells.
-        * @param[in] sample (deprecated) maintained for compatibility.
-        * @param[in] prepare if container should be prepared or
-        *       considered as already existing (multilayer HEC or Tile
-        *       access).
-        */
-    StatusCode LoadCollections (
-	LArTT_Selector<LArCellCont>::const_iterator&,
-	LArTT_Selector<LArCellCont>::const_iterator&,
-	const unsigned int sample = 0, bool prepare=true );
-	/** 
-        * @brief LoadCollections fetches data via ROBDataProvider
-        * and really provides ByteStream Conversion by calling 
-        * detector specific (LAr or Tile) ByteStream Conversion
-        * Tools within RoI as defined in the above method.
-        * @param[out] TileCellCollection::const_iterator outputs
-        *       begin, end interator to TileCells.
-        * @param[in] sample (deprecated) maintained for compatibility.
-        * @param[in] prepare if container should be prepared or
-        *       considered as already existing (multilayer HEC or Tile
-        *       access).
-        */
-    StatusCode LoadCollections (
-	TileCellCollection::const_iterator&,
-	TileCellCollection::const_iterator&,
-	const unsigned int sample = 0, bool prepare=true);
-        /** MBTS collection */
-    StatusCode LoadMBTS(TileCellCollection::const_iterator&,
-                TileCellCollection::const_iterator&){
-	return StatusCode::SUCCESS; }
-        /** Load Zdc Collection */
-    StatusCode LoadZdcCollection(ZdcRawChannelCollection::const_iterator&,
-                ZdcRawChannelCollection::const_iterator&){
-	return StatusCode::SUCCESS; }
-
-	/** 
-        * @brief LoadCollections fetches data via ROBDataProvider
-        * and really provides ByteStream Conversion by calling 
-        * detector specific (LAr or Tile) ByteStream Conversion
-        * Tools within RoI as defined in the above method.
-        * @param[out] LArFebEnergyCollection::const_iterator outputs
-        *       begin, end interator to LArFebEnergy Collections.
-        * @param[in] sample (deprecated) maintained for compatibility.
-        * @param[in] prepare if container should be prepared or
-        *       considered as already existing (multilayer HEC or Tile
-        *       access).
-        */
-    StatusCode LoadCollections (
-	LArFebEnergyCollection::const_iterator&,
-	LArFebEnergyCollection::const_iterator&,
-	const unsigned int sample = 0, bool prepare=true);
-        /** 
-        * @brief Loads the full collection for the missing et computation
-        */
-    StatusCode LoadFullCollections (
-        LArTT_Selector<LArCellCont>::const_iterator&,
-        LArTT_Selector<LArCellCont>::const_iterator&,
-        DETID detid, bool prepare=true );
-        /** 
-        * @brief Loads the full collection for the missing et computation
-        */
-    StatusCode LoadFullCollections (
-        TileCellCollection::const_iterator&,
-        TileCellCollection::const_iterator&,
-        const unsigned int sample = 0, bool prepare=true );
-        /** 
-        * @brief Loads the full collection for the missing et computation
-        */
-
-    StatusCode LoadFullCollections (
-        LArFebEnergyCollection::const_iterator&,
-        LArFebEnergyCollection::const_iterator&,
-        DETID detid, bool prepare=true );
-        /**
-        * @brief Loads the full collection for the missing et computation
-        */
-    StatusCode LoadFullCollections (
-                TileL2Container::const_iterator& Begin,
-                TileL2Container::const_iterator& End);
-        /**
-        * @brief Loads the full collection fast
-        */
-    StatusCode LoadFullCollections (
-                CaloCellContainer::const_iterator&,
-                CaloCellContainer::const_iterator&){
-                return StatusCode::SUCCESS; }
-	/** Number of Tile Calorimeter modules found in
-        * the Region of Interest */
-    unsigned int TileContSize ( void ) { return m_rIds.size(); } 
-	/** Number of Tile Calorimeter modules found in
-        * the Region of Interest MET case -> All Calo*/
-    unsigned int TileFullContSize ( void ) { return m_rIdstile.size(); }
-	/** Error reporting */
-	uint32_t report_error ( void ) { return 0x0; }
-    
-    /** RegSelSvc handle */
-    ServiceHandle<IRegSelSvc>         m_pRegionSelector;
-    /** LArRoI_Map used by LArTT_Selector */
-    const LArRoI_Map*            m_roiMap;           
-
-	/** iterators to LArCells type depending on
-	access way (IDC or Cont) */
-	LArTT_Selector<LArCellCont>* m_sel;
-        LArTT_Selector<LArCellCont>* m_sellarfull;
-        LArTT_Selector<LArCellCont>* m_selem;
-        LArTT_Selector<LArCellCont>* m_selhec;
-        LArTT_Selector<LArCellCont>* m_selfcalhad;
-        LArTT_Selector<LArCellCont>* m_selfcalem;
-	/** LArCellCont pointer - has collections of LArCells */
-	LArCellCont* m_larcell;
-	/** TileCellCont pointer - has collections of TileCells */
-	TileCellCont* m_tilecell;
-	/** Input DataBlock to pre-allocate memory space for
-	ROBFragment to be decoded */
-	//std::vector<uint32_t> m_datablock;
-//        LArFebEnergyCollection* m_febcoll;
-
-
-    // Objects that the Tools should not worry about
-  private:
-        /** method to fill collection with container information */
-        template<class T>
-        void fillColl(const DataHandle<CaloCellContainer>& input, T& output);
-        /** fill vector with all RodIds and Hash Id's in initialize */
-        bool m_usefullcoll;
-	/** List of Hash Id's to be fetched for a given RoI. */
-	std::vector<IdentifierHash> m_rIds;
-        std::vector<IdentifierHash> m_rIdsem0;
-        std::vector<IdentifierHash> m_rIdsem1;
-        std::vector<IdentifierHash> m_rIdsem2;
-        std::vector<IdentifierHash> m_rIdsem3;
-        std::vector<IdentifierHash> m_rIdshec;
-        std::vector<IdentifierHash> m_rIdshec0;
-        std::vector<IdentifierHash> m_rIdshec1;
-        std::vector<IdentifierHash> m_rIdshec2;
-        std::vector<IdentifierHash> m_rIdsfcalhad0;
-        std::vector<IdentifierHash> m_rIdsfcalhad1;
-        std::vector<IdentifierHash> m_rIdsfcalem0;
-        std::vector<IdentifierHash> m_rIdstile;
-	/** List of RodIds to be fetched for a given RoI. */
-	std::vector<uint32_t> m_vrodid32;
-        std::vector<uint32_t> m_vrodid32lar;
-        std::vector<uint32_t> m_vrodid32em;
-        std::vector<uint32_t> m_vrodid32hec;
-        std::vector<uint32_t> m_vrodid32hec0;
-        std::vector<uint32_t> m_vrodid32hec1;
-        std::vector<uint32_t> m_vrodid32hec2;
-        std::vector<uint32_t> m_vrodid32fcalem;
-        std::vector<uint32_t> m_vrodid32fcalhad;
-        std::vector<uint32_t> m_vrodid32tile;
-	/** List of Detector ID (needed for London Schema - TileCal)
-	    elements for offline like data organization (module
-	    ID for TileCal, TTsample ID for LAr).
-	*/
-	std::vector<int> m_listID;
-	/** space for Tile Calorimeter Identifier */
-	std::vector<unsigned int> m_tile;
-	/** check whether iov method was called */
-	bool m_iov_called;
-};
-
-#endif
diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/components/TrigT2CaloCommon_entries.cxx b/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/components/TrigT2CaloCommon_entries.cxx
index 21f494b12ab0e4712cad7f2c9fb825a20963a9dd..c7c1a055c1dddecf75c951f3619810f6f6f7d6cc 100644
--- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/components/TrigT2CaloCommon_entries.cxx
+++ b/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/components/TrigT2CaloCommon_entries.cxx
@@ -1,13 +1,11 @@
 #include "TrigT2CaloCommon/T2GeometryTool.h"
 #include "../TrigDataAccess.h"
-#include "../TrigDataAccessATLFAST.h"
 #include "../TrigCaloDataAccessSvc.h"
 #include "../TestCaloDataAccess.h"
 #include "../CompareCells.h"
 
 DECLARE_COMPONENT( T2GeometryTool )
 DECLARE_COMPONENT( TrigDataAccess )
-DECLARE_COMPONENT( TrigDataAccessATLFAST )
 DECLARE_COMPONENT( TrigCaloDataAccessSvc)
 DECLARE_COMPONENT( TestCaloDataAccess )
 DECLARE_COMPONENT( CompareCells )
diff --git a/Trigger/TrigAlgorithms/TrigT2CaloEgamma/src/T2CaloEgammaReFastAlgo.cxx b/Trigger/TrigAlgorithms/TrigT2CaloEgamma/src/T2CaloEgammaReFastAlgo.cxx
index eb09ae61f4675602702e39ab0a11241b87d52c1c..e92b6df15cd386b2695f327e10fc89001ca288c0 100644
--- a/Trigger/TrigAlgorithms/TrigT2CaloEgamma/src/T2CaloEgammaReFastAlgo.cxx
+++ b/Trigger/TrigAlgorithms/TrigT2CaloEgamma/src/T2CaloEgammaReFastAlgo.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
 */
 
 /*
@@ -25,14 +25,12 @@
 class ISvcLocator;
 
 T2CaloEgammaReFastAlgo::T2CaloEgammaReFastAlgo(const std::string& name, ISvcLocator* pSvcLocator) :
-    AthReentrantAlgorithm(name, pSvcLocator),
-    m_regionSelector("RegSelSvc", name)
+    AthReentrantAlgorithm(name, pSvcLocator)
 {}
 
 StatusCode T2CaloEgammaReFastAlgo::initialize()
 {
   m_emAlgTools.retrieve().ignore();
-  ATH_CHECK(m_regionSelector.retrieve());
   ATH_CHECK(m_clusterContainerKey.initialize());
   ATH_CHECK(m_roiCollectionKey.initialize());
   ATH_CHECK( m_bcidAvgKey.initialize() );
diff --git a/Trigger/TrigAlgorithms/TrigT2CaloEgamma/src/T2CaloEgammaReFastAlgo.h b/Trigger/TrigAlgorithms/TrigT2CaloEgamma/src/T2CaloEgammaReFastAlgo.h
index e0691b9ff2193eacac08fd2878822df73ecb0179..962ae5af0f5a47d078da33c257750701ac7bbe00 100644
--- a/Trigger/TrigAlgorithms/TrigT2CaloEgamma/src/T2CaloEgammaReFastAlgo.h
+++ b/Trigger/TrigAlgorithms/TrigT2CaloEgamma/src/T2CaloEgammaReFastAlgo.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
 */
 
 /**
@@ -19,7 +19,6 @@
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "AthenaBaseComps/AthReentrantAlgorithm.h"
-#include "IRegionSelector/IRegSelSvc.h"
 #include "StoreGate/ReadHandleKey.h"
 #include "StoreGate/WriteHandleKey.h"
 #include "CaloEvent/CaloBCIDAverage.h"
@@ -47,8 +46,6 @@ class T2CaloEgammaReFastAlgo : public AthReentrantAlgorithm {
     // float calculateZ0(const float etaLayer1, const float etaLayer2);
   
   private:
-    ServiceHandle<IRegSelSvc> m_regionSelector;
-  
     // Properties:
     Gaudi::Property<float> m_l1eta{this, "L1ForceEta", -10.0, "Forced LVL1 eta"};
     Gaudi::Property<float> m_l1phi{this, "L1ForcePhi", -10.0, "Forced LVL1 phi"};
diff --git a/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauRecConfigMT.py b/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauRecConfigMT.py
index 675072af2226e0ae88fd28ed38f59bd530a1422a..9a180e97add0c35167c6e956d0f83977976300ae 100644
--- a/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauRecConfigMT.py
+++ b/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauRecConfigMT.py
@@ -1,7 +1,7 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from TrigTauRec.TrigTauRecConf import TrigTauRecMergedMT
-from TrigTauRec.TrigTauRecMonitoring import tauMonitoringCaloOnly
+from TrigTauRec.TrigTauRecMonitoring import tauMonitoringCaloOnly, tauMonitoringCaloOnlyMVA, tauMonitoringPreselection, tauMonitoringPrecision, tauMonitoringPrecisionMVA
 
 class TrigTauRecMerged_TauCaloOnly (TrigTauRecMergedMT) :
 
@@ -45,7 +45,9 @@ class TrigTauRecMerged_TauCaloOnlyMVA (TrigTauRecMergedMT) :
 
         def __init__(self, name = "TrigTauRecMerged_TauCaloOnlyMVA"):
             super( TrigTauRecMerged_TauCaloOnlyMVA , self ).__init__( name )
-
+            self.MonTool = tauMonitoringCaloOnlyMVA()
+            self._mytools = [] 
+          
             import TrigTauRec.TrigTauAlgorithmsHolder as taualgs
             tools = []
 
@@ -84,8 +86,9 @@ class TrigTauRecMerged_TauPreselection (TrigTauRecMergedMT) :
         __slots__ = [ '_mytools']
         def __init__(self, name = "TrigTauRecMerged_TauPreselection"):
             super( TrigTauRecMerged_TauPreselection , self ).__init__( name )
+            self.MonTool = tauMonitoringPreselection()
             self._mytools = []
-            
+             
             import TrigTauRec.TrigTauAlgorithmsHolder as taualgs
             tools = []
 
@@ -129,6 +132,7 @@ class TrigTauRecMerged_TauPrecision (TrigTauRecMergedMT) :
         __slots__ = [ '_mytools']
         def __init__(self, name = "TrigTauRecMerged_TauPrecision"):
             super( TrigTauRecMerged_TauPrecision , self ).__init__( name )
+            self.MonTool = tauMonitoringPrecision()
             self._mytools = []
 
             import TrigTauRec.TrigTauAlgorithmsHolder as taualgs
@@ -189,6 +193,7 @@ class TrigTauRecMerged_TauPrecisionMVA (TrigTauRecMergedMT) :
         def __init__(self, name = "TrigTauRecMerged_TauPrecisionMVA", doMVATES=False, doTrackBDT=False, doRNN=False):
         
             super( TrigTauRecMerged_TauPrecisionMVA , self ).__init__( name )
+            self.MonTool = tauMonitoringPrecisionMVA()
 
             import TrigTauRec.TrigTauAlgorithmsHolder as taualgs
             tools = []
diff --git a/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauRecMonitoring.py b/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauRecMonitoring.py
index f47473bbe10f544d24bab72e75e9f41225203b21..ec25963ae296c32601107da55fdd91f9be1ce392 100644
--- a/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauRecMonitoring.py
+++ b/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauRecMonitoring.py
@@ -107,6 +107,147 @@ class TrigTauRecValidationMonitoring(TrigTauRecOnlineMonitoring):
 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
 
 def tauMonitoringCaloOnly():
+   monTool = GenericMonitoringTool('MonTool')
+   monTool.defineHistogram('EtaL1', path='EXPERT', type='TH1F', title="L1 RoI Eta; L1 RoI Eta; nRoIs", xbins=51, xmin=-2.55, xmax=2.55)
+   monTool.defineHistogram('nRoI_EFTauCells', path='EXPERT', type='TH1F', title="EF N RoI cells; N Cells; nRoIs", xbins=100, xmin=0., xmax=6000.)
+   monTool.defineHistogram('dPhiEFTau_RoI', path='EXPERT', type='TH1F', title="diff EF vs RoI phi ; Dphi; nRoIs", xbins=100, xmin=-0.4, xmax=0.4)
+   monTool.defineHistogram('dEtaEFTau_RoI', path='EXPERT', type='TH1F', title="diff EF vs RoI eta ; Deta; nRoIs", xbins=80, xmin=-0.4, xmax=0.4)
+   monTool.defineHistogram('dEtaEFTau_RoI, dPhiEFTau_RoI', path='EXPERT', type='TH2F', title="dEta vs dPhi in TrigTauRec FEX; Delta-eta; Delta-phi",
+                                                           xbins=40 , xmin=-0.2, xmax=0.2,
+                                                           ybins=40 , ymin=-0.2, ymax=0.2)
+   monTool.defineHistogram('EMRadius', path='EXPERT', type='TH1F', title="EF EMRadius; EM radius; nRoIs", xbins=50, xmin=-0.1, xmax=1.)
+   monTool.defineHistogram('HadRadius', path='EXPERT', type='TH1F', title="EF HadRadius; Had radius; nRoIs", xbins=50, xmin=-0.1, xmax=1.)
+   monTool.defineHistogram('EtHad, EtEm', path='EXPERT', type='TH2F', title="EF Et had vs Em in TrigTauRecMerged FEX; Et Had (at EM scale) [GeV]; Et EM (at EM scale) [GeV]",
+                                                xbins=30, xmin=0., xmax=150.,
+                                                ybins=30, ymin=0., ymax=150.)
+   monTool.defineHistogram('EMFrac', path='EXPERT', type='TH1F', title="EM Fraction;EM Fraction;nRoIs", xbins=70, xmin=-0.1, xmax=1.3)
+   monTool.defineHistogram('IsoFrac', path='EXPERT', type='TH1F', title="Isolation Fraction;Isolation Fraction; nRoIs", xbins=80, xmin=-0.4, xmax=1.2)
+   monTool.defineHistogram('centFrac', path='EXPERT', type='TH1F', title="EF central Fraction;central Fraction; nRoIs", xbins=80, xmin=-0.4, xmax=1.2)
+   monTool.defineHistogram('nCand', path='EXPERT', type='TH1F', title="Number of tau candidates;Number of tau candidates; nevents", xbins=10, xmin=-1.0, xmax=9.)
+   monTool.defineHistogram('PhiL1', path='EXPERT', type='TH1F', title="L1 RoI Phi; L1 RoI Phi; nRoIs", xbins=65, xmin=-3.1415936-0.098174/2., xmax=3.1415936+0.098174/2.)
+   monTool.defineHistogram('EtaL1', path='EXPERT', type='TH1F', title="L1 RoI Eta; L1 RoI Eta; nRoIs", xbins=51, xmin=-2.55, xmax=2.55)
+   monTool.defineHistogram('EtaL1, PhiL1', path='EXPERT', type='TH2F', title="L1 ROI Eta vs Phi in TrigTauRecMerged FEX; #eta; #phi",
+                                           xbins=51, xmin=-2.55, xmax=2.55,
+                                           ybins=65, ymin=-3.1415936-0.098174/2., ymax=3.1415936+0.098174/2.)
+   monTool.defineHistogram('EtaEF, PhiEF', path='EXPERT', type='TH2F', title="EF ROI Eta vs Phi in TrigTauRecMerged FEX; #eta; #phi",
+                                           xbins=51, xmin=-2.55, xmax=2.55,
+                                           ybins=65, ymin=-3.1415936-0.098174/2., ymax=3.1415936+0.098174/2.)
+   return monTool
+
+
+def tauMonitoringCaloOnlyMVA():
+   monTool = GenericMonitoringTool('MonTool')
+   monTool.defineHistogram('EtaL1', path='EXPERT', type='TH1F', title="L1 RoI Eta; L1 RoI Eta; nRoIs", xbins=51, xmin=-2.55, xmax=2.55)
+   monTool.defineHistogram('nRoI_EFTauCells', path='EXPERT', type='TH1F', title="EF N RoI cells; N Cells; nRoIs", xbins=100, xmin=0., xmax=6000.)
+   monTool.defineHistogram('EMRadius', path='EXPERT', type='TH1F', title="EF EMRadius; EM radius; nRoIs", xbins=50, xmin=-0.1, xmax=1.)
+   monTool.defineHistogram('HadRadius', path='EXPERT', type='TH1F', title="EF HadRadius; Had radius; nRoIs", xbins=50, xmin=-0.1, xmax=1.)
+   monTool.defineHistogram('EtHad, EtEm', path='EXPERT', type='TH2F', title="EF Et had vs Em in TrigTauRecMerged FEX; Et Had (at EM scale) [GeV]; Et EM (at EM scale) [GeV]",
+                                                xbins=30, xmin=0., xmax=150.,
+                                                ybins=30, ymin=0., ymax=150.)
+   monTool.defineHistogram('EMFrac', path='EXPERT', type='TH1F', title="EM Fraction;EM Fraction;nRoIs", xbins=70, xmin=-0.1, xmax=1.3)
+   monTool.defineHistogram('IsoFrac', path='EXPERT', type='TH1F', title="Isolation Fraction;Isolation Fraction; nRoIs", xbins=80, xmin=-0.4, xmax=1.2)
+   monTool.defineHistogram('centFrac', path='EXPERT', type='TH1F', title="EF central Fraction;central Fraction; nRoIs", xbins=80, xmin=-0.4, xmax=1.2)
+   monTool.defineHistogram('nCand', path='EXPERT', type='TH1F', title="Number of tau candidates;Number of tau candidates; nevents", xbins=10, xmin=-1.0, xmax=9.)
+   monTool.defineHistogram('PhiL1', path='EXPERT', type='TH1F', title="L1 RoI Phi; L1 RoI Phi; nRoIs", xbins=65, xmin=-3.1415936-0.098174/2., xmax=3.1415936+0.098174/2.)
+   monTool.defineHistogram('EtaL1', path='EXPERT', type='TH1F', title="L1 RoI Eta; L1 RoI Eta; nRoIs", xbins=51, xmin=-2.55, xmax=2.55)
+   monTool.defineHistogram('EtaL1, PhiL1', path='EXPERT', type='TH2F', title="L1 ROI Eta vs Phi in TrigTauRecMerged FEX; #eta; #phi",
+                                           xbins=51, xmin=-2.55, xmax=2.55,
+                                           ybins=65, ymin=-3.1415936-0.098174/2., ymax=3.1415936+0.098174/2.)
+   monTool.defineHistogram('EtaEF, PhiEF', path='EXPERT', type='TH2F', title="EF ROI Eta vs Phi in TrigTauRecMerged FEX; #eta; #phi",
+                                           xbins=51, xmin=-2.55, xmax=2.55,
+                                           ybins=65, ymin=-3.1415936-0.098174/2., ymax=3.1415936+0.098174/2.)
+   return monTool
+
+
+def tauMonitoringPreselection():
+
+   monTool = GenericMonitoringTool('MonTool')
+   monTool.defineHistogram('EtaL1', path='EXPERT', type='TH1F', title="L1 RoI Eta; L1 RoI Eta; nRoIs", xbins=51, xmin=-2.55, xmax=2.55)
+   monTool.defineHistogram('nRoI_EFTauCells', path='EXPERT', type='TH1F', title="EF N RoI cells; N Cells; nRoIs", xbins=100, xmin=0., xmax=6000.)
+   monTool.defineHistogram('nRoI_EFTauTracks', path='EXPERT', type='TH1F', title="EF N RoI Tracks; N Tracks; nRoIs", xbins=17, xmin=-2.0, xmax=15.)
+   monTool.defineHistogram('dPhiEFTau_RoI', path='EXPERT', type='TH1F', title="diff EF vs RoI phi ; Dphi; nRoIs", xbins=100, xmin=-0.4, xmax=0.4)
+   monTool.defineHistogram('dEtaEFTau_RoI', path='EXPERT', type='TH1F', title="diff EF vs RoI eta ; Deta; nRoIs", xbins=80, xmin=-0.4, xmax=0.4)
+   monTool.defineHistogram('dEtaEFTau_RoI, dPhiEFTau_RoI', path='EXPERT', type='TH2F', title="dEta vs dPhi in TrigTauRec FEX; Delta-eta; Delta-phi",
+                                                           xbins=40 , xmin=-0.2, xmax=0.2,
+                                                           ybins=40 , ymin=-0.2, ymax=0.2)
+   monTool.defineHistogram('EMRadius', path='EXPERT', type='TH1F', title="EF EMRadius; EM radius; nRoIs", xbins=50, xmin=-0.1, xmax=1.)
+   monTool.defineHistogram('HadRadius', path='EXPERT', type='TH1F', title="EF HadRadius; Had radius; nRoIs", xbins=50, xmin=-0.1, xmax=1.)
+   monTool.defineHistogram('EtHad, EtEm', path='EXPERT', type='TH2F', title="EF Et had vs Em in TrigTauRecMerged FEX; Et Had (at EM scale) [GeV]; Et EM (at EM scale) [GeV]",
+                                                xbins=30, xmin=0., xmax=150.,
+                                                ybins=30, ymin=0., ymax=150.)
+   monTool.defineHistogram('EMFrac', path='EXPERT', type='TH1F', title="EM Fraction;EM Fraction;nRoIs", xbins=70, xmin=-0.1, xmax=1.3)
+   monTool.defineHistogram('IsoFrac', path='EXPERT', type='TH1F', title="Isolation Fraction;Isolation Fraction; nRoIs", xbins=80, xmin=-0.4, xmax=1.2)
+   monTool.defineHistogram('centFrac', path='EXPERT', type='TH1F', title="EF central Fraction;central Fraction; nRoIs", xbins=80, xmin=-0.4, xmax=1.2)
+   monTool.defineHistogram('nWideTrk', path='EXPERT', type='TH1F', title="EF N Wide Tracks;N Wide Tracks; nRoIs", xbins=17, xmin=-2.0, xmax=15.)
+   monTool.defineHistogram('ipSigLeadTrk', path='EXPERT', type='TH1F', title="EF IPsig Leading Track;iIPsig Leading Track; nRoIs", xbins=100, xmin=-50., xmax=50)
+   monTool.defineHistogram('trFlightPathSig', path='EXPERT', type='TH1F', title="EF Flightpath sig Track;Flightpath sig Track; nRoIs", xbins=100, xmin=-20., xmax=40)
+   monTool.defineHistogram('massTrkSys', path='EXPERT', type='TH1F', title="EF Mass Trk Sys;Mass Trk Sys [GeV]; nRoIs", xbins=100, xmin=0., xmax=50.)
+   monTool.defineHistogram('dRmax', path='EXPERT', type='TH1F', title="EF dR max;dR max; nRoIs", xbins=50, xmin=-0., xmax=0.25)
+   monTool.defineHistogram('NTrk', path='EXPERT', type='TH1F', title="Number of tracks;Number of tracks; nRoIs", xbins=17, xmin=-2.0, xmax=15.)
+   monTool.defineHistogram('TrkAvgDist', path='EXPERT', type='TH1F', title="Track Average Distance; TrkAvgDist; nRoIs", xbins=41, xmin=-0.01, xmax=0.4)
+   monTool.defineHistogram('EtovPtLead', path='EXPERT', type='TH1F', title="Et over lead track Pt; EtovPtLead; nRoIs", xbins=41, xmin=-0.5, xmax=20.0)
+   monTool.defineHistogram('PSSFraction', path='EXPERT', type='TH1F', title="EF Presampler strip energy fraction;PSS energy fraction; nRoIs", xbins=50, xmin=-0.5, xmax=1.)
+   monTool.defineHistogram('EMPOverTrkSysP', path='EXPERT', type='TH1F', title="EF EMP over TrkSysP;EMP over TrkSysP; nRoIs", xbins=41, xmin=-0.5, xmax=20.0)
+   monTool.defineHistogram('ChPiEMEOverCaloEME', path='EXPERT', type='TH1F', title="EF EM energy of charged pions over calorimetric EM energy;ChPiEME over CaloEME; nRoIs", xbins=40, xmin=-20., xmax=20.)
+   monTool.defineHistogram('innerTrkAvgDist', path='EXPERT', type='TH1F', title="EF inner track average distance; innerTrkAvgDist; nRoIs", xbins=40, xmin=-0.05, xmax=0.5)
+   monTool.defineHistogram('nCand', path='EXPERT', type='TH1F', title="Number of tau candidates;Number of tau candidates; nevents", xbins=10, xmin=-1.0, xmax=9.)
+   monTool.defineHistogram('PhiL1', path='EXPERT', type='TH1F', title="L1 RoI Phi; L1 RoI Phi; nRoIs", xbins=65, xmin=-3.1415936-0.098174/2., xmax=3.1415936+0.098174/2.)
+   monTool.defineHistogram('EtaL1', path='EXPERT', type='TH1F', title="L1 RoI Eta; L1 RoI Eta; nRoIs", xbins=51, xmin=-2.55, xmax=2.55)
+   monTool.defineHistogram('EtaL1, PhiL1', path='EXPERT', type='TH2F', title="L1 ROI Eta vs Phi in TrigTauRecMerged FEX; #eta; #phi",
+                                           xbins=51, xmin=-2.55, xmax=2.55,
+                                           ybins=65, ymin=-3.1415936-0.098174/2., ymax=3.1415936+0.098174/2.)
+   monTool.defineHistogram('EtaEF, PhiEF', path='EXPERT', type='TH2F', title="EF ROI Eta vs Phi in TrigTauRecMerged FEX; #eta; #phi",
+                                           xbins=51, xmin=-2.55, xmax=2.55,
+                                           ybins=65, ymin=-3.1415936-0.098174/2., ymax=3.1415936+0.098174/2.)
+
+   return monTool
+
+
+def tauMonitoringPrecision():
+
+   monTool = GenericMonitoringTool('MonTool')
+   monTool.defineHistogram('EtaL1', path='EXPERT', type='TH1F', title="L1 RoI Eta; L1 RoI Eta; nRoIs", xbins=51, xmin=-2.55, xmax=2.55)
+   monTool.defineHistogram('nRoI_EFTauCells', path='EXPERT', type='TH1F', title="EF N RoI cells; N Cells; nRoIs", xbins=100, xmin=0., xmax=6000.)
+   monTool.defineHistogram('nRoI_EFTauTracks', path='EXPERT', type='TH1F', title="EF N RoI Tracks; N Tracks; nRoIs", xbins=17, xmin=-2.0, xmax=15.)
+   monTool.defineHistogram('dPhiEFTau_RoI', path='EXPERT', type='TH1F', title="diff EF vs RoI phi ; Dphi; nRoIs", xbins=100, xmin=-0.4, xmax=0.4)
+   monTool.defineHistogram('dEtaEFTau_RoI', path='EXPERT', type='TH1F', title="diff EF vs RoI eta ; Deta; nRoIs", xbins=80, xmin=-0.4, xmax=0.4)
+   monTool.defineHistogram('dEtaEFTau_RoI, dPhiEFTau_RoI', path='EXPERT', type='TH2F', title="dEta vs dPhi in TrigTauRec FEX; Delta-eta; Delta-phi",
+                                                           xbins=40 , xmin=-0.2, xmax=0.2,
+                                                           ybins=40 , ymin=-0.2, ymax=0.2)
+   monTool.defineHistogram('EMRadius', path='EXPERT', type='TH1F', title="EF EMRadius; EM radius; nRoIs", xbins=50, xmin=-0.1, xmax=1.)
+   monTool.defineHistogram('HadRadius', path='EXPERT', type='TH1F', title="EF HadRadius; Had radius; nRoIs", xbins=50, xmin=-0.1, xmax=1.)
+   monTool.defineHistogram('EtHad, EtEm', path='EXPERT', type='TH2F', title="EF Et had vs Em in TrigTauRecMerged FEX; Et Had (at EM scale) [GeV]; Et EM (at EM scale) [GeV]",
+                                                xbins=30, xmin=0., xmax=150.,
+                                                ybins=30, ymin=0., ymax=150.)
+   monTool.defineHistogram('EMFrac', path='EXPERT', type='TH1F', title="EM Fraction;EM Fraction;nRoIs", xbins=70, xmin=-0.1, xmax=1.3)
+   monTool.defineHistogram('IsoFrac', path='EXPERT', type='TH1F', title="Isolation Fraction;Isolation Fraction; nRoIs", xbins=80, xmin=-0.4, xmax=1.2)
+   monTool.defineHistogram('centFrac', path='EXPERT', type='TH1F', title="EF central Fraction;central Fraction; nRoIs", xbins=80, xmin=-0.4, xmax=1.2)
+   monTool.defineHistogram('nWideTrk', path='EXPERT', type='TH1F', title="EF N Wide Tracks;N Wide Tracks; nRoIs", xbins=17, xmin=-2.0, xmax=15.)
+   monTool.defineHistogram('ipSigLeadTrk', path='EXPERT', type='TH1F', title="EF IPsig Leading Track;iIPsig Leading Track; nRoIs", xbins=100, xmin=-50., xmax=50)
+   monTool.defineHistogram('trFlightPathSig', path='EXPERT', type='TH1F', title="EF Flightpath sig Track;Flightpath sig Track; nRoIs", xbins=100, xmin=-20., xmax=40)
+   monTool.defineHistogram('massTrkSys', path='EXPERT', type='TH1F', title="EF Mass Trk Sys;Mass Trk Sys [GeV]; nRoIs", xbins=100, xmin=0., xmax=50.)
+   monTool.defineHistogram('dRmax', path='EXPERT', type='TH1F', title="EF dR max;dR max; nRoIs", xbins=50, xmin=-0., xmax=0.25)
+   monTool.defineHistogram('NTrk', path='EXPERT', type='TH1F', title="Number of tracks;Number of tracks; nRoIs", xbins=17, xmin=-2.0, xmax=15.)
+   monTool.defineHistogram('TrkAvgDist', path='EXPERT', type='TH1F', title="Track Average Distance; TrkAvgDist; nRoIs", xbins=41, xmin=-0.01, xmax=0.4)
+   monTool.defineHistogram('EtovPtLead', path='EXPERT', type='TH1F', title="Et over lead track Pt; EtovPtLead; nRoIs", xbins=41, xmin=-0.5, xmax=20.0)
+   monTool.defineHistogram('PSSFraction', path='EXPERT', type='TH1F', title="EF Presampler strip energy fraction;PSS energy fraction; nRoIs", xbins=50, xmin=-0.5, xmax=1.)
+   monTool.defineHistogram('EMPOverTrkSysP', path='EXPERT', type='TH1F', title="EF EMP over TrkSysP;EMP over TrkSysP; nRoIs", xbins=41, xmin=-0.5, xmax=20.0)
+   monTool.defineHistogram('ChPiEMEOverCaloEME', path='EXPERT', type='TH1F', title="EF EM energy of charged pions over calorimetric EM energy;ChPiEME over CaloEME; nRoIs", xbins=40, xmin=-20., xmax=20.)
+   monTool.defineHistogram('innerTrkAvgDist', path='EXPERT', type='TH1F', title="EF inner track average distance; innerTrkAvgDist; nRoIs", xbins=40, xmin=-0.05, xmax=0.5)
+   monTool.defineHistogram('nCand', path='EXPERT', type='TH1F', title="Number of tau candidates;Number of tau candidates; nevents", xbins=10, xmin=-1.0, xmax=9.)
+   monTool.defineHistogram('PhiL1', path='EXPERT', type='TH1F', title="L1 RoI Phi; L1 RoI Phi; nRoIs", xbins=65, xmin=-3.1415936-0.098174/2., xmax=3.1415936+0.098174/2.)
+   monTool.defineHistogram('EtaL1', path='EXPERT', type='TH1F', title="L1 RoI Eta; L1 RoI Eta; nRoIs", xbins=51, xmin=-2.55, xmax=2.55)
+   monTool.defineHistogram('EtaL1, PhiL1', path='EXPERT', type='TH2F', title="L1 ROI Eta vs Phi in TrigTauRecMerged FEX; #eta; #phi",
+                                           xbins=51, xmin=-2.55, xmax=2.55,
+                                           ybins=65, ymin=-3.1415936-0.098174/2., ymax=3.1415936+0.098174/2.)
+   monTool.defineHistogram('EtaEF, PhiEF', path='EXPERT', type='TH2F', title="EF ROI Eta vs Phi in TrigTauRecMerged FEX; #eta; #phi",
+                                           xbins=51, xmin=-2.55, xmax=2.55,
+                                           ybins=65, ymin=-3.1415936-0.098174/2., ymax=3.1415936+0.098174/2.)
+
+   return monTool
+
+
+def tauMonitoringPrecisionMVA():
    monTool = GenericMonitoringTool('MonTool')
    monTool.defineHistogram('EtaL1', path='EXPERT', type='TH1F', title="L1 RoI Eta; L1 RoI Eta; nRoIs", xbins=51, xmin=-2.55, xmax=2.55)
    monTool.defineHistogram('nRoI_EFTauCells', path='EXPERT', type='TH1F', title="EF N RoI cells; N Cells; nRoIs", xbins=100, xmin=0., xmax=6000.)
@@ -145,6 +286,9 @@ def tauMonitoringCaloOnly():
    monTool.defineHistogram('EtaEF, PhiEF', path='EXPERT', type='TH2F', title="EF ROI Eta vs Phi in TrigTauRecMerged FEX; #eta; #phi",
                                            xbins=51, xmin=-2.55, xmax=2.55,
                                            ybins=65, ymin=-3.1415936-0.098174/2., ymax=3.1415936+0.098174/2.)
+
    return monTool
 
 
+
+
diff --git a/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMergedMT.cxx b/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMergedMT.cxx
index e160628d31864c0a176b1d339d678733e0f6f983..db507b9092fc7c38ed33cf4622bd1c11929ab77d 100644
--- a/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMergedMT.cxx
+++ b/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMergedMT.cxx
@@ -117,7 +117,7 @@ StatusCode TrigTauRecMergedMT::execute(const EventContext& ctx) const
   auto dEta               = Monitored::Scalar<float>("dEtaEFTau_RoI",    -10.);
   auto dPhi               = Monitored::Scalar<float>("dPhiEFTau_RoI",    -10.);
   auto emRadius           = Monitored::Scalar<float>("EMRadius", -0.099);
-  auto hadRadius          = Monitored::Scalar<float>("EMRadius", -0.099);
+  auto hadRadius          = Monitored::Scalar<float>("HadRadius", -0.099);
   auto EtFinal            = Monitored::Scalar<float>("EtFinal", 0.);
   auto Et                 = Monitored::Scalar<float>("Et", 0.);
   auto EtHad              = Monitored::Scalar<float>("EtHad",-10.);
@@ -125,12 +125,12 @@ StatusCode TrigTauRecMergedMT::execute(const EventContext& ctx) const
   auto EMFrac             = Monitored::Scalar<float>("EMFrac",-10.);
   auto IsoFrac            = Monitored::Scalar<float>("IsoFrac",-1.);
   auto centFrac           = Monitored::Scalar<float>("centFrac",-10.);
-  auto nWideTrk           = Monitored::Scalar<int>("EF_nWideTrk",0);
+  auto nWideTrk           = Monitored::Scalar<int>("nWideTrk",-10);
   auto ipSigLeadTrk       = Monitored::Scalar<float>("ipSigLeadTrk",-1000.);
   auto trFlightPathSig    = Monitored::Scalar<float>("trFlightPathSig",-10.);
   auto massTrkSys         = Monitored::Scalar<float>("massTrkSys",-10.);
   auto dRmax              = Monitored::Scalar<float>("dRmax",-10.);
-  auto numTrack           = Monitored::Scalar<int>("EF_NTrk", -10);
+  auto numTrack           = Monitored::Scalar<int>("NTrk", -10);
   auto trkAvgDist         = Monitored::Scalar<float>("TrkAvgDist",-1.0);
   auto etovPtLead         = Monitored::Scalar<float>("EtovPtLead",-10.);
   auto PSSFraction        = Monitored::Scalar<float>("PSSFraction",-999.9);
diff --git a/Trigger/TrigAnalysis/TrigAnalysisExamples/src/TriggerAnalysisHelper.h b/Trigger/TrigAnalysis/TrigAnalysisExamples/src/TriggerAnalysisHelper.h
index eac981dbb7df70857d383570f0094fdaa861ae41..f0dbf91cb7ba87d5c712277abc34a07d21e4396c 100644
--- a/Trigger/TrigAnalysis/TrigAnalysisExamples/src/TriggerAnalysisHelper.h
+++ b/Trigger/TrigAnalysis/TrigAnalysisExamples/src/TriggerAnalysisHelper.h
@@ -124,7 +124,7 @@ namespace Trig{
             std::vector<Feature<T> > vectorOfFeatures = features.get<T>(key);
             ATH_MSG_INFO(chainName << " has " << features.get<T>().size() << " T features ");
             // Loop over the features of type T
-            for( const Trig::Feature<T> feature : vectorOfFeatures ) {
+            for( const Trig::Feature<T>& feature : vectorOfFeatures ) {
                 printFeatureAndTEInfo<T>(feature);
             } // End loop over the features
         }
@@ -146,13 +146,13 @@ namespace Trig{
                 std::vector< Trig::Feature <T1> > feature1 = comb.get<T1>(key1);
                 ATH_MSG_INFO("COMB Combination has " << feature1.size() << " T1 features "); 
 
-                for(const Trig::Feature<T1> feat1:feature1){
+                for(const Trig::Feature<T1>& feat1:feature1){
                     printFeatureAndTEInfo<T1>(feat1);
                 }
 
                 std::vector< Trig::Feature <T2> > feature2 = comb.get<T2>(key2);
                 ATH_MSG_INFO("COMB Combination has " << feature2.size() << " T2 features ");
-                for(const Trig::Feature<T2> feat2:feature2){
+                for(const Trig::Feature<T2>& feat2:feature2){
                     printFeatureAndTEInfo<T2>(feat2);
                 }
             }
@@ -165,7 +165,7 @@ namespace Trig{
             FeatureContainer features = m_trigDecisionTool->features( chainName, condition);
             std::vector<Feature<T> > vectorOfFeatures = features.get<T>(key);
             // Loop over the features of type T
-            for( const Trig::Feature<T> feature : vectorOfFeatures ) {
+            for( const Trig::Feature<T>& feature : vectorOfFeatures ) {
                 const T *cont=feature.cptr(); //Get pointer to container of type T
                 const xAOD::TrigPassBits *bits=(m_trigDecisionTool->ancestor<xAOD::TrigPassBits>(feature.te())).cptr();
                 if(!bits) 
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/CMakeLists.txt b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/CMakeLists.txt
index a0bcc2ad47607ed47dc789051d7689a37e94a5b0..e1a73b62b6721839382b2ab7332e1db3dd0bb8d4 100644
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/CMakeLists.txt
+++ b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/CMakeLists.txt
@@ -22,8 +22,7 @@ atlas_add_component( TrigEgammaAnalysisTools
    LINK_LIBRARIES AsgTools AthenaBaseComps AthenaMonitoringLib TrigEgammaAnalysisToolsLib xAODEgamma )
 
 # Install files from the package:
-atlas_install_python_modules( python/TrigEgamma*.py )
-atlas_install_joboptions( share/test*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_generic( share/trigEgammaDQ.py share/get_trigEgammaDQ.sh 
    DESTINATION share
    EXECUTABLE )
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaAnalysisToolsConfig.py b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaAnalysisToolsConfig.py
index e9cba421f6d3d988f0a9ed2a5eb768d41b0f74de..c914e5a011650905431fa3b3ff144a062b32fc96 100644
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaAnalysisToolsConfig.py
+++ b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaAnalysisToolsConfig.py
@@ -8,25 +8,19 @@ from TrigEgammaAnalysisTools import TrigEgammaAnalysisToolsConf
 from AthenaCommon import CfgMgr
 from AthenaCommon.AppMgr import ToolSvc
 
-from egammaRec.Factories import PublicToolFactory,FcnWrapper,AlgFactory, getPropertyValue 
+from egammaRec.Factories import PublicToolFactory
 
 import PyUtils.RootUtils as ru
 ROOT = ru.import_root()
 import cppyy
 cppyy.load_library('libElectronPhotonSelectorToolsDict')
-from ROOT import LikeEnum
-from ROOT import egammaPID
 
 # Following loads the online selectors
 from TrigEgammaHypo.TrigEgammaPidTools import ElectronPidTools
 from TrigEgammaHypo.TrigEgammaPidTools import PhotonPidTools
-from TrigEgammaHypo.TrigEgammaPidTools import ElectronToolName
 ElectronPidTools()
 PhotonPidTools()
 
-from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElectronIsEMSelector, AsgElectronLikelihoodTool
-from ElectronPhotonSelectorTools.ElectronIsEMSelectorMapping import ElectronIsEMMap,electronPIDmenu
-
 # Offline selectors -- taken from latest conf
 LooseElectronSelector             = CfgMgr.AsgElectronIsEMSelector("T0HLTLooseElectronSelector")
 MediumElectronSelector            = CfgMgr.AsgElectronIsEMSelector("T0HLTMediumElectronSelector")
@@ -67,7 +61,7 @@ LuminosityCondAlgOnlineDefault (suffix = 'Online')
 IneffLabels=["ClusterEtaRange","ConversionMatch","ClusterHadronicLeakage","ClusterMiddleEnergy","ClusterMiddleEratio37","ClusterMiddleEratio33","ClusterMiddleWidth","f3","ClusterStripsEratio","ClusterStripsDeltaEmax2","ClusterStripsDeltaE","ClusterStripsWtot","ClusterStripsFracm","ClusterStripsWeta1c","empty14","ClusterStripsDEmaxs1","TrackBlayer","TrackPixel","TrackSi","TrackA0","TrackMatchEta","TrackMatchPhi","TrackMatchEoverP","TrackTRTeProbabilityHT_Electron","TrackTRThits","TrackTRTratio","TrackTRTratio90","TrackA0Tight","TrackMatchEtaTight","Isolation","ClusterIsolation","TrackIsolation","No Track","No Cluster","No Object"]
 
 from TrigEgammaAnalysisTools.TrigEgammaProbelist import monitoring_mam, monitoring_electron, monitoring_photon 
-from TrigEgammaAnalysisTools.TrigEgammaProbelist import monitoringTP_electron, monitoringTP_electronZee, monitoringTP_electronJpsiee 
+from TrigEgammaAnalysisTools.TrigEgammaProbelist import monitoringTP_electron,  monitoringTP_electronJpsiee 
 
 from TrigEgammaMatchingTool.TrigEgammaMatchingToolConf import Trig__TrigEgammaMatchingTool
 
@@ -197,9 +191,6 @@ TrigEgammaNavAnalysisTool = PublicToolFactory(TrigEgammaAnalysisToolsConf.TrigEg
 #############################################################################################
 # Functions
 
-# Function to return triggerlist tools
-def getAllTools():
-    return [TrigEgammaNavZeeTPCounts(),TrigEgammaNavZeeTPEff(),TrigEgammaNavZeeTPIneff(),TrigEgammaNavZeeTPRes(),]
 
 
 def setRunFlag( runFlag ):
@@ -230,12 +221,6 @@ def setRunFlag( runFlag ):
 
 
 
-# The main algorithm
-# Add triggerlist tools to ToolHandleArray 
-TrigEgammaAnalysisAlg = AlgFactory(TrigEgammaAnalysisToolsConf.TrigEgammaAnalysisAlg, 
-        name='TrigEgammaAnalysisAlg',
-        Tools = FcnWrapper(getAllTools),
-        )
 
 
 
@@ -246,10 +231,7 @@ def getEventSelectionTool(runFlag):
   from TrigEgammaEmulationTool.TrigEgammaEmulationPidToolsConfig import getEgammaIsEMSelectorCaloOnly, \
                                                                         getElectronIsEMSelector,\
                                                                         getEgammaLikelihoodSelectorCaloOnly, \
-                                                                        getElectronLikelihoodSelector2015,\
                                                                         getElectronLikelihoodSelectorNoD0
-  from AthenaCommon import CfgMgr
-  from AthenaCommon.AppMgr import ToolSvc
   # create all selector list. Here, the order is matter. Please check the 
   
   setRunFlag(runFlag)
@@ -277,7 +259,7 @@ def getEventSelectionTool(runFlag):
           ElectronKey = 'Electrons',
           MatchTool = EgammaMatchTool,
           PlotTool=TrigEgammaPlotTool,
-          EmulationTool=EmulationTool, # The emulation must be on in this tool.
+          #EmulationTool=EmulationTool, # The emulation must be on in this tool.
           doEmulation=True,
           Tools=[],
           isEMResultNames=["Tight","Medium","Loose"],
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaMonToolConfig.py b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaMonToolConfig.py
deleted file mode 100644
index 96f9961fb6f56b6b84ac8bcfbd7c4374e8223c38..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaMonToolConfig.py
+++ /dev/null
@@ -1,95 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-def TrigEgammaMonTool():
-    #from AthenaCommon.AppMgr import ToolSvc
-    from TrigEgammaAnalysisTools.TrigEgammaAnalysisToolsConfig import TrigEgammaNavAnalysisTool,TrigEgammaNavTPAnalysisTool,TrigEgammaNavTPJpsieeAnalysisTool
-    from TrigEgammaAnalysisTools.TrigEgammaAnalysisToolsConfig import TrigEgammaPlotTool
-    from TrigEgammaAnalysisTools.TrigEgammaProbelist import monitoring_mam, monitoring_electron, monitoring_photon 
-    from TrigEgammaAnalysisTools.TrigEgammaProbelist import monitoringTP_electron, monitoringTP_electronZee, monitoringTP_electronJpsiee 
-
-
-    #Define the base path for all histograms
-    basePath = '/HLT/Egamma'
-    
-    tagItems     = ['HLT_e24_lhmedium_iloose_L1EM18VH',
-                    'HLT_e24_lhmedium_iloose_L1EM20VH',
-                    'HLT_e24_lhtight_iloose',
-                    'HLT_e26_lhtight_iloose',
-                    # Primary cut-based electron triggers
-                    'HLT_e24_medium_iloose_L1EM18VH',
-                    'HLT_e24_medium_iloose_L1EM20VH',
-                    'HLT_e24_tight_iloose',
-                    'HLT_e26_tight_iloose']
-
-    JpsitagItems = ['HLT_e5_tight_e4_etcut',
-                    'HLT_e9_tight_e4_etcut',
-                    'HLT_e14_tight_e4_etcut',
-                    'HLT_e9_etcut_e5_tight',
-                    'HLT_e14_etcut_e5_tight',
-                    # Primary cut-based electron triggers
-                    'HLT_e5_tight_e4_etcut_Jpsiee',
-                    'HLT_e9_tight_e4_etcut_Jpsiee',
-                    'HLT_e14_tight_e4_etcut_Jpsiee',
-                    'HLT_e9_etcut_e5_tight_Jpsiee',
-                    'HLT_e14_etcut_e5_tight_Jpsiee']
-
-    #Configure the TrigEgammaPlotTool
-    PlotTool = TrigEgammaPlotTool.copy(name="TrigEgammaPlotTool",
-            DirectoryPath=basePath,
-            MaM=monitoring_mam,
-            Efficiency=["eff_et","eff_eta","eff_mu"],
-            Distribution=["et","eta","d0","d0sig"],
-            Resolution=["res_et","res_eta","res_Rhad","res_Rphi","res_Reta"])
-
-    #Configure emulation tools
-    #from TrigEgammaEmulationTool.TrigEgammaEmulationToolConfig import TrigEgammaEmulationTool
-    #EmulationPhotonTool     = TrigEgammaEmulationTool.copy( TriggerList = monitoring_photon          , name = "EmulationPhotonTool"     )
-    #EmulationElectronTool   = TrigEgammaEmulationTool.copy( TriggerList = monitoring_electron        , name = "EmulationElectronTool"   )
-    #EmulationTPElectronTool = TrigEgammaEmulationTool.copy( TriggerList = monitoringTP_electron      , name = "EmulationTPElectronTool" )
-    #EmulationJpsieeTool     = TrigEgammaEmulationTool.copy( TriggerList = monitoringTP_electronJpsiee, name = "EmulationJpsieeTool"     )
-
-
-    ElectronAnalysis = TrigEgammaNavAnalysisTool(name='NavElectronAnalysis',
-            Analysis='Electrons',
-            PlotTool=PlotTool,
-            TriggerList=monitoring_electron,
-            File="",
-            #doEmulation=True,
-            #EmulationTool=EmulationElectronTool,
-            OutputLevel=0,DetailedHistograms=False)
-    PhotonAnalysis = TrigEgammaNavAnalysisTool(name='NavPhotonAnalysis',
-            Analysis='Photons',
-            PlotTool=PlotTool,
-            TriggerList=monitoring_photon,
-            File="",
-            #doEmulation=True,
-            #EmulationTool=EmulationPhotonTool,
-            OutputLevel=0,DetailedHistograms=False)
-    TPAnalysis = TrigEgammaNavTPAnalysisTool(name='NavTPAnalysis',
-            Analysis='Zee',
-            PlotTool=PlotTool,
-            TriggerList=monitoringTP_electron,
-            File="",
-            TagTriggerList=tagItems,
-            #doEmulation=True,
-            #EmulationTool=EmulationTPElectronTool,
-            RemoveCrack=False,
-            OutputLevel=0,DetailedHistograms=False)
-    JpsiTPAnalysis = TrigEgammaNavTPJpsieeAnalysisTool(name='NavTPJpsieeAnalysis',
-                                                        Analysis='Jpsiee',
-                                                        PlotTool=PlotTool,
-                                                        TriggerList=monitoringTP_electronJpsiee,
-                                                        File="",
-                                                        #doEmulation=True,
-                                                        #EmulationTool=EmulationJpsieeTool,
-                                                        TagTriggerList= JpsitagItems)
-
-    from TrigEgammaAnalysisTools.TrigEgammaAnalysisToolsConf import TrigEgammaMonTool
-    TrigEgammaMonTool = TrigEgammaMonTool( name = "HLTEgammaMon", 
-            histoPathBase=basePath,
-            Tools=[
-                "TrigEgammaNavAnalysisTool/NavPhotonAnalysis",
-                "TrigEgammaNavAnalysisTool/NavElectronAnalysis",
-                "TrigEgammaNavTPAnalysisTool/NavTPAnalysis",
-                "TrigEgammaNavTPAnalysisTool/NavTPJpsieeAnalysis"])
-    #ToolSvc += TrigEgammaMonTool
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaMonToolConfig50ns.py b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaMonToolConfig50ns.py
deleted file mode 100644
index 7af1f7b52df49d14e7f0dfbf8a7e3b67b9ed0e47..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaMonToolConfig50ns.py
+++ /dev/null
@@ -1,112 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-def TrigEgammaMonTool():
-    #from AthenaCommon.AppMgr import ToolSvc
-    from AthenaCommon import CfgMgr
-    from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElectronIsEMSelector
-    from ElectronPhotonSelectorTools.ElectronIsEMSelectorMapping import ElectronIsEMMap,electronPIDmenu
-    from TrigEgammaAnalysisTools.TrigEgammaAnalysisToolsConfig import TrigEgammaNavAnalysisTool,TrigEgammaNavTPAnalysisTool,TrigEgammaNavTPJpsieeAnalysisTool
-    from TrigEgammaAnalysisTools.TrigEgammaProbelist import default,defaultJpsi # to import probelist
-    #from TrigHLTMonitoring.HLTMonTriggerList import hltmonList # import MaM trigger list, not available!!!!
-   
-    # Import full trigger menu, requires setup of both MC and Physics
-    # Makes available all possible triggers which can be in any dataset
-    # Set final list from triggers available in data
-    import TriggerMenu.menu.Physics_pp_v5 as physics_menu
-    from TriggerJobOpts.TriggerFlags import TriggerFlags
-
-    # Offline selectors -- taken from latest conf
-    # Offline tunes for 50 ns
-    LooseElectronSelector=CfgMgr.AsgElectronIsEMSelector("LooseElectron50nsSelector")
-    LooseElectronSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20150429/ElectronIsEMLooseSelectorCutDefs.conf"
-    ToolSvc+=LooseElectronSelector
-    MediumElectronSelector=CfgMgr.AsgElectronIsEMSelector("MediumElectron50nsSelector")
-    MediumElectronSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20150429/ElectronIsEMMediumSelectorCutDefs.conf"
-    ToolSvc+=MediumElectronSelector
-    TightElectronSelector=CfgMgr.AsgElectronIsEMSelector("TightElectron50nsSelector")
-    TightElectronSelector.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20150429/ElectronIsEMTightSelectorCutDefs.conf"
-    ToolSvc+=TightElectronSelector
-
-    LooseLHSelector=CfgMgr.AsgElectronLikelihoodTool("LooseLH50nsSelector")
-    LooseLHSelector.ConfigFile="ElectronPhotonSelectorTools/offline/mc15_20150429/ElectronLikelihoodLooseOfflineConfig2015.conf"
-    ToolSvc+=LooseLHSelector
-    MediumLHSelector=CfgMgr.AsgElectronLikelihoodTool("MediumLH50nsSelector")
-    MediumLHSelector.ConfigFile="ElectronPhotonSelectorTools/offline/mc15_20150429/ElectronLikelihoodMediumOfflineConfig2015.conf"
-    ToolSvc+=MediumLHSelector
-    TightLHSelector=CfgMgr.AsgElectronLikelihoodTool("TightLH50nsSelector")
-    TightLHSelector.ConfigFile="ElectronPhotonSelectorTools/offline/mc15_20150429/ElectronLikelihoodTightOfflineConfig2015.conf"
-    ToolSvc+=TightLHSelector
-
-    physics_menu.setupMenu()
-    egammaMenu = TriggerFlags.EgammaSlice.signatures()
-    egammaChains = []
-    l1Items = []
-    addItems = []
-    for egchain in egammaMenu:
-        egammaChains.append(egchain[0])
-        l1Items.append(egchain[1])
-        addItems.append(egchain[3])
-    # Set list to full menu
-    #probelist = egammaChains
-    probelist = default
-    Jpsiprobelist = defaultJpsi
-    #probelist=['e5_loose_idperf','e5_lhloose_idperf','e0_perf_L1EM15','g0_perf_L1EM15']
-
-    basePath = '/HLT/Egamma/'
-    tagItems = ['e24_lhmedium_iloose_L1EM18VH',
-        'e24_lhmedium_iloose_L1EM20VH',
-        'e24_lhtight_iloose',
-        'e26_lhtight_iloose',
-        # Primary cut-based electron triggers
-        'e24_medium_iloose_L1EM18VH',
-        'e24_medium_iloose_L1EM20VH',
-        'e24_tight_iloose',
-        'e26_tight_iloose']
-
-    JpsitagItems = ['e5_tight_e4_etcut',
-                    'e9_tight_e4_etcut',
-                    'e14_tight_e4_etcut',
-                    'e9_etcut_e5_tight',
-                    'e14_etcut_e5_tight',
-                    # Primary cut-based electron triggers
-                    'e5_tight_e4_etcut_Jpsiee',
-                    'e9_tight_e4_etcut_Jpsiee',
-                    'e14_tight_e4_etcut_Jpsiee',
-                    'e9_etcut_e5_tight_Jpsiee',
-                    'e14_etcut_e5_tight_Jpsiee']
-    Analysis = TrigEgammaNavAnalysisTool(name='NavAnalysis',
-            DirectoryPath=basePath+'Analysis',
-            TriggerList=probelist, 
-            ElectronIsEMSelector =[TightElectronSelector,MediumElectronSelector,LooseElectronSelector],
-            ElectronLikelihoodTool =[TightLHSelector,MediumLHSelector,LooseLHSelector], 
-            File="",
-            OutputLevel=0,DetailedHistograms=False)
-    TPAnalysis = TrigEgammaNavTPAnalysisTool(name='NavTPAnalysis',
-            DirectoryPath=basePath+'TPAnalysis',
-            TriggerList=probelist, 
-            ElectronIsEMSelector =[TightElectronSelector,MediumElectronSelector,LooseElectronSelector],
-            ElectronLikelihoodTool =[TightLHSelector,MediumLHSelector,LooseLHSelector], 
-            File="",
-            TagTriggerList=tagItems,
-            RemoveCrack=False,
-            OutputLevel=0,DetailedHistograms=True)
-    JpsiTPAnalysis = TrigEgammaNavTPJpsieeAnalysisTool(name='NavTPJpsieeAnalysis',
-                                                        DirectoryPath=basePath+'TPJpsieeAnalysis',
-                                                        TriggerList=Jpsiprobelist,
-                                                        File="",
-                                                        TagTriggerList= JpsitagItems,
-                                                        RemoveCrack=True,
-                                                        ZeeLowerMass=2,
-                                                        ZeeUpperMass=5,
-                                                        OfflineTagMinEt=5,
-                                                        OfflineProbeMinEt=5,
-                                                        OutputLevel=0,
-                                                        DetailedHistograms=False,
-                                                        doJpsiee=True)
-    from TrigEgammaAnalysisTools.TrigEgammaAnalysisToolsConf import TrigEgammaMonTool
-    TrigEgammaMonTool = TrigEgammaMonTool( name = "TrigEgammaMonTool", 
-            histoPathBase=basePath,
-            Tools=["TrigEgammaNavAnalysisTool/NavAnalysis",
-                "TrigEgammaNavTPAnalysisTool/NavTPAnalysis",
-                "TrigEgammaNavTPAnalysisTool/NavTPJpsieeAnalysis"])
-    #ToolSvc += TrigEgammaMonTool
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaPhysValMonToolConfig.py b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaPhysValMonToolConfig.py
deleted file mode 100644
index 9ef1c9d4453136a3f8f9b270a1e4232cdd119011..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaPhysValMonToolConfig.py
+++ /dev/null
@@ -1,94 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-def TrigEgammaPhysValMonTool():
-    #from AthenaCommon.AppMgr import ToolSvc
-    from TrigEgammaAnalysisTools.TrigEgammaAnalysisToolsConfig import TrigEgammaEmulationTool
-    from TrigEgammaAnalysisTools.TrigEgammaAnalysisToolsConfig import TrigEgammaNavAnalysisTool,TrigEgammaNavTPAnalysisTool, TrigEgammaNavNtuple, TrigEgammaNavTPNtuple
-    from TrigEgammaAnalysisTools.TrigEgammaProbelist import default, probeListLowMidPtPhysicsTriggers # to import probelist
-    
-    #from TrigHLTMonitoring.HLTMonTriggerList import hltmonList # import MaM trigger list not available!!!!
-    import TriggerMenu.menu.Physics_pp_v5 as physics_menu
-    import TriggerMenu.menu.MC_pp_v5 as mc_menu
-    from TriggerJobOpts.TriggerFlags import TriggerFlags
-
-   
-    physics_menu.setupMenu()
-    mc_menu.setupMenu()
-    egammaMenu = TriggerFlags.EgammaSlice.signatures()
-    egammaChains = []
-    l1Items = []
-    addItems = []
-    for egchain in egammaMenu:
-        egammaChains.append(egchain[0])
-        l1Items.append(egchain[1])
-        addItems.append(egchain[3])
-    # Set list to full menu
-    #probelist = egammaChains
-    probelist = default
-    #probelist = list(set(default+probeListLowMidPtPhysicsTriggers))
-    
-
-    basePath = 'Trigger/HLT/Egamma/'
-    tagItems = [
-        'e24_lhmedium_iloose_L1EM18VH',
-        'e24_lhmedium_iloose_L1EM20VH',
-        'e24_lhtight_iloose'
-        'e26_lhtight_iloose',
-        #Primary cut-based electron triggers
-        'e24_medium_iloose_L1EM18VH',
-        'e24_medium_iloose_L1EM20VH',
-        'e24_tight_iloose',
-        'e26_tight_iloose'
-        ]
-    Analysis = TrigEgammaNavAnalysisTool(name='NavAnalysis',
-            DirectoryPath=basePath+'Analysis',
-            TriggerList=probelist, 
-            File="PhysVal")
-    
-    TPAnalysis = TrigEgammaNavTPAnalysisTool(name='NavTPAnalysis',
-            DirectoryPath=basePath+'TPAnalysis',
-            TriggerList=probelist, 
-            File="PhysVal",
-            TagTriggerList=tagItems,
-            OutputLevel=0)
- 
-    Emulation = TrigEgammaEmulationTool("Emulation",TriggerList=probelist)
- 
-
-    Ntuple    = TrigEgammaNavNtuple(name="NavNtuple",
-            DirectoryPath=basePath+'Ntuple',
-            TriggerList=probelist,
-            DoOfflineDump=False,
-            ForcePidSelection=True,
-            ForceProbeIsolation=False,
-            ForceEtThreshold=True,
-            RemoveCrack=True,
-            #ForceFilterSelection=False,
-            #ElectronFilterType="Tight",
-            File="PhysVal",
-            OutputLevel=0)
-
-   
-    TPNtuple  = TrigEgammaNavTPNtuple(name="NavTPNtuple",
-            DirectoryPath=basePath+'TPNtuple',
-            TriggerList=probelist,
-            File="PhysVal",
-            TagTriggerList=tagItems,
-            OutputLevel=0)
-
-
-    from TrigEgammaAnalysisTools.TrigEgammaAnalysisToolsConf import TrigEgammaPhysValMonTool
-    TrigEgammaPhysValMonTool = TrigEgammaPhysValMonTool( name = "TrigEgammaPhysValMonTool", 
-            histoPathBase=basePath,
-            Tools=[
-                "TrigEgammaNavAnalysisTool/NavAnalysis",
-                "TrigEgammaNavTPAnalysisTool/NavTPAnalysis",
-                "TrigEgammaEmulationTool/Emulation",
-                "TrigEgammaNavNtuple/NavNtuple",
-                "TrigEgammaNavTPNtuple/NavTPNtuple"
-                ])
-
-    #ToolSvc += TrigEgammaPhysValMonTool
-
-
-
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaProbelist.py b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaProbelist.py
index be86a3aa05aee9ad112d55350dde2e3caac6bb9c..ed20ee82f66c29ccb882c6ea16c9f6c61b4514cc 100644
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaProbelist.py
+++ b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/python/TrigEgammaProbelist.py
@@ -9,132 +9,132 @@
 
 #Tag items
 triggerTags = [ 
-  'HLT_e24_lhmedium_iloose_L1EM18VH',
-  'HLT_e24_lhmedium_iloose_L1EM20VH',
-  'HLT_e24_lhtight_iloose',
-  'HLT_e26_lhtight_iloose',
-  # Primary cut-based electron triggers
-  'HLT_e24_medium_iloose_L1EM18VH',
-  'HLT_e24_medium_iloose_L1EM20VH',
-  'HLT_e24_tight_iloose',
-  'HLT_e26_tight_iloose'
-]
+        'HLT_e24_lhmedium_iloose_L1EM18VH',
+        'HLT_e24_lhmedium_iloose_L1EM20VH',
+        'HLT_e24_lhtight_iloose',
+        'HLT_e26_lhtight_iloose',
+        # Primary cut-based electron triggers
+        'HLT_e24_medium_iloose_L1EM18VH',
+        'HLT_e24_medium_iloose_L1EM20VH',
+        'HLT_e24_tight_iloose',
+        'HLT_e26_tight_iloose'
+        ]
 
 
 monitoring_mam = {
-  'primary_single_ele'      : 'HLT_e26_lhtight_iloose',
-  'primary_single_cut_ele'  : 'HLT_e24_tight_iloose',
-  'primary_single_pho'      : 'HLT_g120_loose'}
+        'primary_single_ele'      : 'HLT_e26_lhtight_iloose',
+        'primary_single_cut_ele'  : 'HLT_e24_tight_iloose',
+        'primary_single_pho'      : 'HLT_g120_loose'}
 
 # L1 Items
 monitoring_L1Calo = [
-  'L1_EM20VH',
-  'L1_EM20VHI']
+        'L1_EM20VH',
+        'L1_EM20VHI']
 
 # High pt electron triggers that cannot be monitored with TP Analysis
 monitoring_electron=[
-  'HLT_e60_lhmedium',
-  'HLT_e60_medium',
-  'HLT_e120_lhloose',
-  'HLT_e120_loose',
-  'HLT_e140_lhloose'
-]
+        'HLT_e60_lhmedium',
+        'HLT_e60_medium',
+        'HLT_e120_lhloose',
+        'HLT_e120_loose',
+        'HLT_e140_lhloose'
+        ]
 
 # Full list of monitoring for photons
 monitoring_photon=[
-  'HLT_g25_loose',
-  'HLT_g35_loose',
-  "HLT_g25_medium",
-  "HLT_g35_medium",
-  'HLT_g20_tight',
-  'HLT_g120_loose',
-  'HLT_g140_loose'
-]
+        'HLT_g25_loose',
+        'HLT_g35_loose',
+        "HLT_g25_medium",
+        "HLT_g35_medium",
+        'HLT_g20_tight',
+        'HLT_g120_loose',
+        'HLT_g140_loose'
+        ]
 
 # Lowest single electron triggers for TP analysis
 monitoringTP_electron =[
-  'HLT_e24_lhmedium_L1EM18VH',
-  'HLT_e24_lhmedium_L1EM20VH',
-  'HLT_e24_medium_L1EM20VH',
-  'HLT_e24_lhmedium_iloose',
-  'HLT_e24_medium_iloose',
-  'HLT_e24_lhmedium_nod0_iloose',
-  'HLT_e24_lhtight_iloose',
-  'HLT_e24_tight_iloose',
-  'HLT_e26_lhtight_iloose',
-  'HLT_e26_lhtight_nod0_iloose',
-  'HLT_e26_lhtight_nod0_ivarloose',
-  'HLT_e26_lhtight_nod0_ringer_iloose',
-  'HLT_e26_lhtight_nod0_ringer_ivarloose',
-  'HLT_e28_lhtight_nod0_iloose',
-]
+        'HLT_e24_lhmedium_L1EM18VH',
+        'HLT_e24_lhmedium_L1EM20VH',
+        'HLT_e24_medium_L1EM20VH',
+        'HLT_e24_lhmedium_iloose',
+        'HLT_e24_medium_iloose',
+        'HLT_e24_lhmedium_nod0_iloose',
+        'HLT_e24_lhtight_iloose',
+        'HLT_e24_tight_iloose',
+        'HLT_e26_lhtight_iloose',
+        'HLT_e26_lhtight_nod0_iloose',
+        'HLT_e26_lhtight_nod0_ivarloose',
+        'HLT_e26_lhtight_nod0_ringer_iloose',
+        'HLT_e26_lhtight_nod0_ringer_ivarloose',
+        'HLT_e28_lhtight_nod0_iloose',
+        ]
 
 #Zee TP triggers
 monitoringTP_electronZee = [
-  'HLT_e24_lhtight_L1EM20VH_e15_etcut_Zee',
-  'HLT_e26_lhtight_e15_etcut_Zee',
-]
+        'HLT_e24_lhtight_L1EM20VH_e15_etcut_Zee',
+        'HLT_e26_lhtight_e15_etcut_Zee',
+        ]
 
 #Jpsiee TP triggers
 monitoringTP_electronJpsiee = [
-  "HLT_e5_loose",
-  "HLT_e5_lhloose",
-  "HLT_e5_vloose",
-  "HLT_e5_lhvloose",
-]
+        "HLT_e5_loose",
+        "HLT_e5_lhloose",
+        "HLT_e5_vloose",
+        "HLT_e5_lhvloose",
+        ]
 
 default = [
-  'HLT_e24_lhmedium_iloose_L1EM18VH',# Primary LH electron triggers
-  'HLT_e24_lhmedium_iloose_L1EM20VH',
-  'HLT_e24_lhtight_iloose',
-  'HLT_e24_lhtight_iloose_L1EM20VH',
-  'HLT_e26_lhtight_iloose',
-  'HLT_e26_lhtight_smooth_iloose',
-  'HLT_e60_lhmedium',
-  'HLT_e120_lhloose',
-  'HLT_e140_lhloose',
-  # Primary cut-based electron triggers
-  'HLT_e24_medium_iloose_L1EM18VH',
-  'HLT_e24_medium_iloose_L1EM20VH',
-  'HLT_e24_tight_iloose',
-  'HLT_e26_tight_iloose',
-  'HLT_e60_medium',
-  'HLT_e120_loose',
-  'HLT_e140_loose',
-  # Non-isolated
-  'HLT_e24_lhmedium_L1EM18VH',
-  'HLT_e24_medium_L1EM18VH',
-  'HLT_e24_lhtight_L1EM20VH',
-  'HLT_e24_tight_L1EM20VH',
-  'HLT_e24_lhmedium_L1EM20VHI',
-  # Single photon
-  'HLT_g120_loose',
-  'HLT_g140_loose',
-  # Suppporting triggers for alignment studies / LH ineffiency
-  'HLT_e24_lhmedium_cutd0dphideta_iloose_L1EM18VH',
-  'HLT_e24_lhmedium_nod0_iloose_L1EM18VH',
-  'HLT_e24_lhmedium_nodeta_iloose_L1EM18VH',
-  'HLT_e24_lhmedium_nodphires_iloose_L1EM18VH',
-  'HLT_e24_lhmedium_cutd0dphideta_iloose_L1EM20VH',
-  'HLT_e24_lhmedium_nod0_iloose_L1EM20VH',
-  'HLT_e24_lhmedium_nodeta_iloose_L1EM20VH',
-  'HLT_e24_lhmedium_nodphires_iloose_L1EM20VH',
-  'HLT_e24_lhmedium_iloose_HLTCalo_L1EM18VH',
-  'HLT_e24_lhmedium_iloose_HLTCalo_L1EM20VH',
-  'HLT_e24_lhmedium_iloose_L2EFCalo_L1EM18VH',
-  'HLT_e24_lhmedium_iloose_L2EFCalo_L1EM20VH',
-  'HLT_e26_lhtight_cutd0dphideta_iloose',
-  'HLT_e26_lhtight_iloose_HLTCalo',
-  'HLT_e26_lhtight_iloose_L2EFCalo',
-  'HLT_e24_lhtight_iloose_HLTCalo_L1EM20VH',
-  'HLT_e24_lhtight_iloose_L2EFCalo_L1EM20VH',
-  'HLT_e60_lhmedium_HLTCalo',
-  'HLT_e60_lhmedium_L2EFCalo',
-  'HLT_e60_lhmedium_nod0',
-  'HLT_e60_lhmedium_cutd0dphideta',
-  # Supporting trigger for background
-  #'HLT_e24_vloose_L1EM18VH', 
-  #'HLT_e24_vloose_L1EM20VH',  
+        'HLT_e24_lhmedium_iloose_L1EM18VH',# Primary LH electron triggers
+        'HLT_e24_lhmedium_iloose_L1EM20VH',
+        'HLT_e24_lhtight_iloose',
+        'HLT_e24_lhtight_iloose_L1EM20VH',
+        'HLT_e26_lhtight_iloose',
+        'HLT_e26_lhtight_smooth_iloose',
+        'HLT_e60_lhmedium',
+        'HLT_e120_lhloose',
+        'HLT_e140_lhloose',
+        # Primary cut-based electron triggers
+        'HLT_e24_medium_iloose_L1EM18VH',
+        'HLT_e24_medium_iloose_L1EM20VH',
+        'HLT_e24_tight_iloose',
+        'HLT_e26_tight_iloose',
+        'HLT_e60_medium',
+        'HLT_e120_loose',
+        'HLT_e140_loose',
+        # Non-isolated
+        'HLT_e24_lhmedium_L1EM18VH',
+        'HLT_e24_medium_L1EM18VH',
+        'HLT_e24_lhtight_L1EM20VH',
+        'HLT_e24_tight_L1EM20VH',
+        'HLT_e24_lhmedium_L1EM20VHI',
+        # Single photon
+        'HLT_g120_loose',
+        'HLT_g140_loose',
+        # Suppporting triggers for alignment studies / LH ineffiency
+        'HLT_e24_lhmedium_cutd0dphideta_iloose_L1EM18VH',
+        'HLT_e24_lhmedium_nod0_iloose_L1EM18VH',
+        'HLT_e24_lhmedium_nodeta_iloose_L1EM18VH',
+        'HLT_e24_lhmedium_nodphires_iloose_L1EM18VH',
+        'HLT_e24_lhmedium_cutd0dphideta_iloose_L1EM20VH',
+        'HLT_e24_lhmedium_nod0_iloose_L1EM20VH',
+        'HLT_e24_lhmedium_nodeta_iloose_L1EM20VH',
+        'HLT_e24_lhmedium_nodphires_iloose_L1EM20VH',
+        'HLT_e24_lhmedium_iloose_HLTCalo_L1EM18VH',
+        'HLT_e24_lhmedium_iloose_HLTCalo_L1EM20VH',
+        'HLT_e24_lhmedium_iloose_L2EFCalo_L1EM18VH',
+        'HLT_e24_lhmedium_iloose_L2EFCalo_L1EM20VH',
+        'HLT_e26_lhtight_cutd0dphideta_iloose',
+        'HLT_e26_lhtight_iloose_HLTCalo',
+        'HLT_e26_lhtight_iloose_L2EFCalo',
+        'HLT_e24_lhtight_iloose_HLTCalo_L1EM20VH',
+        'HLT_e24_lhtight_iloose_L2EFCalo_L1EM20VH',
+        'HLT_e60_lhmedium_HLTCalo',
+        'HLT_e60_lhmedium_L2EFCalo',
+        'HLT_e60_lhmedium_nod0',
+        'HLT_e60_lhmedium_cutd0dphideta',
+        # Supporting trigger for background
+        #'HLT_e24_vloose_L1EM18VH', 
+#'HLT_e24_vloose_L1EM20VH',  
   #'HLT_e24_lhvloose_L1EM18VH', 
   #'HLT_e24_lhvloose_L1EM20VH',  
   #'HLT_e26_lhvloose_L1EM20VH',
@@ -150,7 +150,7 @@ default = [
   'HLT_e17_loose_L1EM15',
   'HLT_e17_lhloose_L1EM15',
   'HLT_e13_etcut_trkcut',
-	# Rerun mode for photon
+        # Rerun mode for photon
   # Performance and supporting triggers 
   #"HLT_g0_perf_L1EM3_EMPTY",
   #"HLT_e0_perf_L1EM3_EMPTY",
@@ -193,190 +193,190 @@ default = [
 # Samples to run - Zee and a background such as dijet or JF17 or any JF sample
 
 probeListLowMidPtSupportingTriggers = [
-	"HLT_e0_L2Star_perf_L1EM15",
-	"HLT_e0_L2Star_perf_L1EM3",
-	"HLT_e0_perf_L1EM15",
-	"HLT_e0_perf_L1EM3",
-	"HLT_e10_etcut_L1EM7",
-	"HLT_e13_etcut_L1EM10_W-MT25",
-	"HLT_e13_etcut_L1EM10_W-MT30",
-	"HLT_e13_etcut_L1W-NOMATCH",
-	"HLT_e13_etcut_L1W-NOMATCH_W-05RO-XEEMHT",
-	"HLT_e13_etcut_trkcut",
-	"HLT_e14_etcut",
-	"HLT_e17_etcut_L1EM15",
-	"HLT_e17_etcut_L2StarA_L1EM15",
-	"HLT_e17_etcut_L2StarB_L1EM15",
-	"HLT_e17_etcut_L2StarC_L1EM15",
-	"HLT_e17_etcut_L2Star_idperf_L1EM15",
-	"HLT_e17_etcut_idperf_L1EM15",
-	"HLT_e18_etcut_L1EM15_W-MT35",
-	"HLT_e18_etcut_trkcut",
-	"HLT_e20_etcut_L1EM12",
-	"HLT_e30_etcut_L1EM15",
-	"HLT_e3_etcut",
-	"HLT_e3_etcut_L1EM3_EMPTY",
-	"HLT_e4_etcut",
-	"HLT_e5_etcut",
-	"HLT_e9_etcut",
-  "HLT_e24_etcut",
-  "HLT_e25_etcut_L1EM15",
-]
+        "HLT_e0_L2Star_perf_L1EM15",
+        "HLT_e0_L2Star_perf_L1EM3",
+        "HLT_e0_perf_L1EM15",
+        "HLT_e0_perf_L1EM3",
+        "HLT_e10_etcut_L1EM7",
+        "HLT_e13_etcut_L1EM10_W-MT25",
+        "HLT_e13_etcut_L1EM10_W-MT30",
+        "HLT_e13_etcut_L1W-NOMATCH",
+        "HLT_e13_etcut_L1W-NOMATCH_W-05RO-XEEMHT",
+        "HLT_e13_etcut_trkcut",
+        "HLT_e14_etcut",
+        "HLT_e17_etcut_L1EM15",
+        "HLT_e17_etcut_L2StarA_L1EM15",
+        "HLT_e17_etcut_L2StarB_L1EM15",
+        "HLT_e17_etcut_L2StarC_L1EM15",
+        "HLT_e17_etcut_L2Star_idperf_L1EM15",
+        "HLT_e17_etcut_idperf_L1EM15",
+        "HLT_e18_etcut_L1EM15_W-MT35",
+        "HLT_e18_etcut_trkcut",
+        "HLT_e20_etcut_L1EM12",
+        "HLT_e30_etcut_L1EM15",
+        "HLT_e3_etcut",
+        "HLT_e3_etcut_L1EM3_EMPTY",
+        "HLT_e4_etcut",
+        "HLT_e5_etcut",
+        "HLT_e9_etcut",
+        "HLT_e24_etcut",
+        "HLT_e25_etcut_L1EM15",
+        ]
 
 # ProbeList 2 Low/mid pt physics triggers
 # EmulationTool,Eff,Counts,Perf
 # Samples to run Zee and any background sample dijet, JFXX
 probeListLowMidPtPhysicsTriggers = [
-	"HLT_e10_lhvloose_L1EM7",
-	"HLT_e10_vloose_L1EM7",
-	"HLT_e12_lhloose",
-	"HLT_e12_loose",
-	"HLT_e12_lhvloose_L1EM10VH",
-	"HLT_e12_vloose_L1EM10VH",
-	"HLT_e15_lhloose_L1EM13VH",
-	"HLT_e15_lhvloose_L1EM13VH",
-	"HLT_e15_lhvloose_L1EM7",
-	"HLT_e15_loose_L1EM13VH",
-	"HLT_e15_vloose_L1EM13VH",
-	"HLT_e15_vloose_L1EM7",
-	"HLT_e17_lhloose",
-	"HLT_e17_lhmedium",
-	"HLT_e17_lhmedium_iloose",
-	"HLT_e17_lhvloose",
-	"HLT_e17_loose",
-	"HLT_e17_medium",
-	"HLT_e17_medium_iloose",
-	"HLT_e17_vloose",
-	"HLT_e20_lhmedium",
-	"HLT_e20_lhvloose",
-	"HLT_e20_medium",
-	"HLT_e20_vloose",
-	"HLT_e20_vloose_L1EM12",
-	"HLT_e24_lhmedium_L1EM15VH",
-	"HLT_e24_lhmedium_L1EM18VH",
-	"HLT_e24_lhmedium_iloose_L1EM18VH",
-	"HLT_e24_lhmedium_iloose_L1EM20VH",
-	"HLT_e24_lhtight_iloose",
-	"HLT_e24_lhvloose_L1EM18VH",
-	"HLT_e24_lhvloose_L1EM20VH",
-	"HLT_e24_medium_L1EM15VH",
-	"HLT_e24_medium_L1EM18VH",
-	"HLT_e24_medium_iloose_L1EM18VH",
-	"HLT_e24_medium_iloose_L1EM20VH",
-	"HLT_e24_tight_L1EM20VH",
-	"HLT_e24_tight_iloose",
-	"HLT_e24_vloose_L1EM18VH",
-	"HLT_e24_vloose_L1EM20VH",
-	"HLT_e25_lhvloose_L1EM15",
-	"HLT_e25_vloose_L1EM15",
-	"HLT_e26_lhtight_iloose",
-	"HLT_e26_lhvloose_L1EM20VH",
-	"HLT_e26_tight_iloose",
-	"HLT_e26_vloose_L1EM20VH",
-	"HLT_e30_lhvloose_L1EM15",
-	"HLT_e30_vloose_L1EM15",
-]
+        "HLT_e10_lhvloose_L1EM7",
+        "HLT_e10_vloose_L1EM7",
+        "HLT_e12_lhloose",
+        "HLT_e12_loose",
+        "HLT_e12_lhvloose_L1EM10VH",
+        "HLT_e12_vloose_L1EM10VH",
+        "HLT_e15_lhloose_L1EM13VH",
+        "HLT_e15_lhvloose_L1EM13VH",
+        "HLT_e15_lhvloose_L1EM7",
+        "HLT_e15_loose_L1EM13VH",
+        "HLT_e15_vloose_L1EM13VH",
+        "HLT_e15_vloose_L1EM7",
+        "HLT_e17_lhloose",
+        "HLT_e17_lhmedium",
+        "HLT_e17_lhmedium_iloose",
+        "HLT_e17_lhvloose",
+        "HLT_e17_loose",
+        "HLT_e17_medium",
+        "HLT_e17_medium_iloose",
+        "HLT_e17_vloose",
+        "HLT_e20_lhmedium",
+        "HLT_e20_lhvloose",
+        "HLT_e20_medium",
+        "HLT_e20_vloose",
+        "HLT_e20_vloose_L1EM12",
+        "HLT_e24_lhmedium_L1EM15VH",
+        "HLT_e24_lhmedium_L1EM18VH",
+        "HLT_e24_lhmedium_iloose_L1EM18VH",
+        "HLT_e24_lhmedium_iloose_L1EM20VH",
+        "HLT_e24_lhtight_iloose",
+        "HLT_e24_lhvloose_L1EM18VH",
+        "HLT_e24_lhvloose_L1EM20VH",
+        "HLT_e24_medium_L1EM15VH",
+        "HLT_e24_medium_L1EM18VH",
+        "HLT_e24_medium_iloose_L1EM18VH",
+        "HLT_e24_medium_iloose_L1EM20VH",
+        "HLT_e24_tight_L1EM20VH",
+        "HLT_e24_tight_iloose",
+        "HLT_e24_vloose_L1EM18VH",
+        "HLT_e24_vloose_L1EM20VH",
+        "HLT_e25_lhvloose_L1EM15",
+        "HLT_e25_vloose_L1EM15",
+        "HLT_e26_lhtight_iloose",
+        "HLT_e26_lhvloose_L1EM20VH",
+        "HLT_e26_tight_iloose",
+        "HLT_e26_vloose_L1EM20VH",
+        "HLT_e30_lhvloose_L1EM15",
+        "HLT_e30_vloose_L1EM15",
+        ]
 
 # Compare LHTrigger to IsEMTrigger
 probeListLHTriggers = [
-  "HLT_e10_lhvloose_L1EM7",
-  "HLT_e12_lhloose",
-  "HLT_e17_lhloose",
-  "HLT_e17_lhmedium",
-  "HLT_e17_lhmedium_iloose",
-  "HLT_e17_lhvloose",
-  "HLT_e20_lhmedium",
-  "HLT_e20_lhvloose",
-  "HLT_e24_lhtight_iloose",
-  "HLT_e26_lhtight_iloose",
-  "HLT_e30_lhvloose_L1EM15",
-  "HLT_e60_lhmedium",
-]
+        "HLT_e10_lhvloose_L1EM7",
+        "HLT_e12_lhloose",
+        "HLT_e17_lhloose",
+        "HLT_e17_lhmedium",
+        "HLT_e17_lhmedium_iloose",
+        "HLT_e17_lhvloose",
+        "HLT_e20_lhmedium",
+        "HLT_e20_lhvloose",
+        "HLT_e24_lhtight_iloose",
+        "HLT_e26_lhtight_iloose",
+        "HLT_e30_lhvloose_L1EM15",
+        "HLT_e60_lhmedium",
+        ]
 
 # Compare with LH trigger above
 probeListIsEMTriggers = [
-  "HLT_e10_vloose_L1EM7",
-  "HLT_e12_loose",
-  "HLT_e17_loose",
-	"HLT_e17_medium",
-	"HLT_e17_medium_iloose",
-  "HLT_e17_vloose",
-	"HLT_e20_medium",
-	"HLT_e20_vloose",
-  "HLT_e24_tight_iloose",
-  "HLT_e26_tight_iloose",
-  "HLT_e30_vloose_L1EM15",
-  "HLT_e60_medium",
-]
+        "HLT_e10_vloose_L1EM7",
+        "HLT_e12_loose",
+        "HLT_e17_loose",
+        "HLT_e17_medium",
+        "HLT_e17_medium_iloose",
+        "HLT_e17_vloose",
+        "HLT_e20_medium",
+        "HLT_e20_vloose",
+        "HLT_e24_tight_iloose",
+        "HLT_e26_tight_iloose",
+        "HLT_e30_vloose_L1EM15",
+        "HLT_e60_medium",
+        ]
 
 # Compare with same items without L1 seed
 probeListAltL1Seeds = [
-	"HLT_e12_lhloose_L1EM10VH",
-  "HLT_e12_loose_L1EM10VH",
-  "HLT_e17_lhloose_L1EM15",
-  "HLT_e17_loose_L1EM15",
-  "HLT_e20_lhvloose_L1EM12",
-  "HLT_e24_lhtight_L1EM20VH",
-	"HLT_e24_lhtight_iloose_L1EM20VH",
-	"HLT_e24_tight_iloose_L1EM20VH",
-	"HLT_e24_tight_iloose_etisem_L1EM20VH",
-]
+        "HLT_e12_lhloose_L1EM10VH",
+        "HLT_e12_loose_L1EM10VH",
+        "HLT_e17_lhloose_L1EM15",
+        "HLT_e17_loose_L1EM15",
+        "HLT_e20_lhvloose_L1EM12",
+        "HLT_e24_lhtight_L1EM20VH",
+        "HLT_e24_lhtight_iloose_L1EM20VH",
+        "HLT_e24_tight_iloose_L1EM20VH",
+        "HLT_e24_tight_iloose_etisem_L1EM20VH",
+        ]
 
 # Special triggers for hlt id performance
 probeListPerfTriggers = [
-	"HLT_e24_lhmedium_L2Star_idperf_L1EM20VH",
-	"HLT_e24_lhmedium_idperf_L1EM20VH",
-  "HLT_e24_medium1_L2Star_idperf_L1EM18VH",
-  "HLT_e24_medium1_idperf_L1EM18VH",
-  "HLT_e24_medium_L2Star_idperf_L1EM20VH",
-  "HLT_e24_medium_idperf_L1EM20VH",
-]
+        "HLT_e24_lhmedium_L2Star_idperf_L1EM20VH",
+        "HLT_e24_lhmedium_idperf_L1EM20VH",
+        "HLT_e24_medium1_L2Star_idperf_L1EM18VH",
+        "HLT_e24_medium1_idperf_L1EM18VH",
+        "HLT_e24_medium_L2Star_idperf_L1EM20VH",
+        "HLT_e24_medium_idperf_L1EM20VH",
+        ]
 
 # Run1 tracking triggers, for rate estimates
 # Compare with same triggers w/o L2StarA
 probeListRun1TrkTriggers = [
-  "HLT_e24_lhmedium_iloose_L2StarA_L1EM20VH",
-  "HLT_e24_medium1_iloose_L2StarA_L1EM18VH",
-  "HLT_e24_medium_iloose_L2StarA_L1EM20VH",
-]
+        "HLT_e24_lhmedium_iloose_L2StarA_L1EM20VH",
+        "HLT_e24_medium1_iloose_L2StarA_L1EM18VH",
+        "HLT_e24_medium_iloose_L2StarA_L1EM20VH",
+        ]
 
 # Run1 Pid, compare with same Run2 items
 probeListRun1PidTriggers = [
-	"HLT_e24_medium1_L1EM18VH",
-	"HLT_e24_medium1_iloose_L1EM18VH",
-	"HLT_e24_tight1_iloose",
-	"HLT_e24_tight1_iloose_L1EM20VH",
-  "HLT_e26_tight1_iloose",
-]
+        "HLT_e24_medium1_L1EM18VH",
+        "HLT_e24_medium1_iloose_L1EM18VH",
+        "HLT_e24_tight1_iloose",
+        "HLT_e24_tight1_iloose_L1EM20VH",
+        "HLT_e26_tight1_iloose",
+        ]
 
 # To be compared with the default items
 probeListMisalignmentTriggers = [
-	"HLT_e24_lhmedium_cutd0dphideta_L1EM18VH",
-	"HLT_e24_lhmedium_cutd0dphideta_iloose_L1EM18VH",
-	"HLT_e24_lhmedium_cutd0dphideta_iloose_L1EM20VH",
-	"HLT_e24_lhmedium_nod0_L1EM18VH",
-	"HLT_e24_lhmedium_nod0_iloose_L1EM18VH",
-	"HLT_e24_lhmedium_nodeta_L1EM18VH",
-	"HLT_e24_lhmedium_nodeta_iloose_L1EM18VH",
-	"HLT_e24_lhmedium_nodphires_L1EM18VH",
-	"HLT_e24_lhmedium_nodphires_iloose_L1EM18VH",
-	"HLT_e24_lhtight_cutd0dphideta_iloose",
-	"HLT_e24_lhtight_cutd0dphideta_iloose_L1EM20VH",
-  "HLT_e26_lhtight_cutd0dphideta_iloose",
-  "HLT_e60_lhmedium_cutd0dphideta",
-]
+        "HLT_e24_lhmedium_cutd0dphideta_L1EM18VH",
+        "HLT_e24_lhmedium_cutd0dphideta_iloose_L1EM18VH",
+        "HLT_e24_lhmedium_cutd0dphideta_iloose_L1EM20VH",
+        "HLT_e24_lhmedium_nod0_L1EM18VH",
+        "HLT_e24_lhmedium_nod0_iloose_L1EM18VH",
+        "HLT_e24_lhmedium_nodeta_L1EM18VH",
+        "HLT_e24_lhmedium_nodeta_iloose_L1EM18VH",
+        "HLT_e24_lhmedium_nodphires_L1EM18VH",
+        "HLT_e24_lhmedium_nodphires_iloose_L1EM18VH",
+        "HLT_e24_lhtight_cutd0dphideta_iloose",
+        "HLT_e24_lhtight_cutd0dphideta_iloose_L1EM20VH",
+        "HLT_e26_lhtight_cutd0dphideta_iloose",
+        "HLT_e60_lhmedium_cutd0dphideta",
+        ]
 
 # Compare with default items
 probeListAltSequence = [
-	"HLT_e24_lhmedium_iloose_HLTCalo_L1EM18VH",
-	"HLT_e24_lhmedium_iloose_HLTCalo_L1EM20VH",
-	"HLT_e24_lhtight_iloose_HLTCalo",
-	"HLT_e24_lhtight_iloose_HLTCalo_L1EM20VH",
-  "HLT_e24_lhtight_iloose_L2EFCalo_L1EM20VH",
-  "HLT_e24_tight_iloose_HLTCalo_L1EM20VH",
-  "HLT_e24_tight_iloose_L2EFCalo_L1EM20VH",
-  "HLT_e26_lhtight_iloose_HLTCalo",
-]
+        "HLT_e24_lhmedium_iloose_HLTCalo_L1EM18VH",
+        "HLT_e24_lhmedium_iloose_HLTCalo_L1EM20VH",
+        "HLT_e24_lhtight_iloose_HLTCalo",
+        "HLT_e24_lhtight_iloose_HLTCalo_L1EM20VH",
+        "HLT_e24_lhtight_iloose_L2EFCalo_L1EM20VH",
+        "HLT_e24_tight_iloose_HLTCalo_L1EM20VH",
+        "HLT_e24_tight_iloose_L2EFCalo_L1EM20VH",
+        "HLT_e26_lhtight_iloose_HLTCalo",
+        ]
 
 #ProbeList 3 High pt triggers
 #Should run with Zprime and / or WPrime samples
@@ -387,164 +387,164 @@ probeListAltSequence = [
 
 # Etcut Trigger list
 probeListHighPtSupportingTriggers = [
-	"HLT_e100_etcut",
-	"HLT_e120_etcut",
-	"HLT_e40_etcut_L1EM15",
-	"HLT_e60_etcut",
-	"HLT_e80_etcut",
-	"HLT_e50_etcut_L1EM15",
-]
+        "HLT_e100_etcut",
+        "HLT_e120_etcut",
+        "HLT_e40_etcut_L1EM15",
+        "HLT_e60_etcut",
+        "HLT_e80_etcut",
+        "HLT_e50_etcut_L1EM15",
+        ]
 
 # The Primary Trigger List
 probeListHighPtPhysicsTriggers = [
-	"HLT_e120_lhloose",
-	"HLT_e120_lhloose_HLTCalo",
-	"HLT_e120_lhvloose",
-	"HLT_e120_loose",
-	"HLT_e120_loose1",
-	"HLT_e120_vloose",
-	"HLT_e140_lhloose",
-	"HLT_e140_lhloose_HLTCalo",
-	"HLT_e140_loose",
-	"HLT_e40_lhvloose_L1EM15",
-	"HLT_e40_vloose_L1EM15",
-	"HLT_e50_lhvloose_L1EM15",
-	"HLT_e50_vloose_L1EM15",
-	"HLT_e60_lhloose",
-	"HLT_e60_lhmedium",
-	"HLT_e60_lhmedium_HLTCalo",
-	"HLT_e60_lhmedium_cutd0dphideta",
-	"HLT_e60_lhvloose",
-	"HLT_e60_loose",
-	"HLT_e60_medium",
-	"HLT_e60_medium1",
-	"HLT_e60_vloose",
-	"HLT_e70_lhloose",
-	"HLT_e70_lhvloose",
-	"HLT_e70_loose",
-	"HLT_e70_vloose",
-	"HLT_e80_lhvloose",
-	"HLT_e80_vloose",
-]
+        "HLT_e120_lhloose",
+        "HLT_e120_lhloose_HLTCalo",
+        "HLT_e120_lhvloose",
+        "HLT_e120_loose",
+        "HLT_e120_loose1",
+        "HLT_e120_vloose",
+        "HLT_e140_lhloose",
+        "HLT_e140_lhloose_HLTCalo",
+        "HLT_e140_loose",
+        "HLT_e40_lhvloose_L1EM15",
+        "HLT_e40_vloose_L1EM15",
+        "HLT_e50_lhvloose_L1EM15",
+        "HLT_e50_vloose_L1EM15",
+        "HLT_e60_lhloose",
+        "HLT_e60_lhmedium",
+        "HLT_e60_lhmedium_HLTCalo",
+        "HLT_e60_lhmedium_cutd0dphideta",
+        "HLT_e60_lhvloose",
+        "HLT_e60_loose",
+        "HLT_e60_medium",
+        "HLT_e60_medium1",
+        "HLT_e60_vloose",
+        "HLT_e70_lhloose",
+        "HLT_e70_lhvloose",
+        "HLT_e70_loose",
+        "HLT_e70_vloose",
+        "HLT_e80_lhvloose",
+        "HLT_e80_vloose",
+        ]
 
 # ProbeList 4 Photon triggers
 # EmulationTool,Perf
 # Sample ggH125 and background dijet / JFXX
 
 probeListPhotonTriggers = [
-	"HLT_g0_hiptrt_L1EM18VH",
-	"HLT_g0_hiptrt_L1EM20VH",
-	"HLT_g0_hiptrt_L1EM20VHI",
-	"HLT_g0_hiptrt_L1EM22VHI",
-	"HLT_g0_perf_L1EM15",
-	"HLT_g0_perf_L1EM3",
-	"HLT_g100_loose",
-	"HLT_g10_etcut",
-	"HLT_g10_loose",
-	"HLT_g10_medium",
-	"HLT_g120_loose",
-	"HLT_g120_loose1",
-	"HLT_g120_loose_HLTCalo",
-	"HLT_g140_loose",
-	"HLT_g15_loose",
-	"HLT_g15_loose_L1EM3",
-	"HLT_g15_loose_L1EM7",
-	"HLT_g200_etcut",
-	"HLT_g20_etcut_L1EM12",
-	"HLT_g20_loose",
-	"HLT_g20_loose_L1EM12",
-	"HLT_g20_loose_L1EM15",
-	"HLT_g20_tight",
-	"HLT_g25_loose",
-	"HLT_g25_loose_L1EM15",
-	"HLT_g25_medium",
-	"HLT_g35_loose",
-	"HLT_g35_loose_L1EM15",
-	"HLT_g35_loose_L1EM15_g25_loose_L1EM15",
-	"HLT_g35_loose_g25_loose",
-	"HLT_g35_medium",
-	"HLT_g3_etcut",
-	"HLT_g3_etcut_L1EM3_EMPTY",
-	"HLT_g40_loose_L1EM15",
-	"HLT_g40_tight",
-	"HLT_g45_loose_L1EM15",
-	"HLT_g45_tight",
-	"HLT_g50_loose",
-	"HLT_g50_loose_L1EM15",
-	"HLT_g60_loose",
-	"HLT_g60_loose_L1EM15VH",
-	"HLT_g70_loose",
-	"HLT_g80_loose",
-]
+        "HLT_g0_hiptrt_L1EM18VH",
+        "HLT_g0_hiptrt_L1EM20VH",
+        "HLT_g0_hiptrt_L1EM20VHI",
+        "HLT_g0_hiptrt_L1EM22VHI",
+        "HLT_g0_perf_L1EM15",
+        "HLT_g0_perf_L1EM3",
+        "HLT_g100_loose",
+        "HLT_g10_etcut",
+        "HLT_g10_loose",
+        "HLT_g10_medium",
+        "HLT_g120_loose",
+        "HLT_g120_loose1",
+        "HLT_g120_loose_HLTCalo",
+        "HLT_g140_loose",
+        "HLT_g15_loose",
+        "HLT_g15_loose_L1EM3",
+        "HLT_g15_loose_L1EM7",
+        "HLT_g200_etcut",
+        "HLT_g20_etcut_L1EM12",
+        "HLT_g20_loose",
+        "HLT_g20_loose_L1EM12",
+        "HLT_g20_loose_L1EM15",
+        "HLT_g20_tight",
+        "HLT_g25_loose",
+        "HLT_g25_loose_L1EM15",
+        "HLT_g25_medium",
+        "HLT_g35_loose",
+        "HLT_g35_loose_L1EM15",
+        "HLT_g35_loose_L1EM15_g25_loose_L1EM15",
+        "HLT_g35_loose_g25_loose",
+        "HLT_g35_medium",
+        "HLT_g3_etcut",
+        "HLT_g3_etcut_L1EM3_EMPTY",
+        "HLT_g40_loose_L1EM15",
+        "HLT_g40_tight",
+        "HLT_g45_loose_L1EM15",
+        "HLT_g45_tight",
+        "HLT_g50_loose",
+        "HLT_g50_loose_L1EM15",
+        "HLT_g60_loose",
+        "HLT_g60_loose_L1EM15VH",
+        "HLT_g70_loose",
+        "HLT_g80_loose",
+        ]
 
 defaultJpsi=[
-  "HLT_e5_loose",
-  "HLT_e5_lhloose",
-  "HLT_e5_vloose",
-  "HLT_e5_lhvloose",
-]
+        "HLT_e5_loose",
+        "HLT_e5_lhloose",
+        "HLT_e5_vloose",
+        "HLT_e5_lhvloose",
+        ]
 
 
 # Lowest single electron triggers for TP analysis
 monitoringTP_electron_extra =[
-  'HLT_e24_lhmedium_L1EM18VH',
-  'HLT_e24_lhmedium_nod0_L1EM18VH',
-  'HLT_e24_lhmedium_nod0_L1EM20VH',
-  'HLT_e24_medium_nod0_L1EM20VH',
-  'HLT_e24_lhmedium_iloose',
-  'HLT_e24_medium_iloose',
-  'HLT_e24_lhmedium_nod0_iloose',
-  'HLT_e24_lhtight_nod0_iloose',
-  'HLT_e24_lhmedium_nod0_ivarloose',
-  'HLT_e24_lhtight_nod0_ivarloose',
-  'HLT_e24_lhtight_iloose',
-  'HLT_e24_tight_iloose',
-  'HLT_e26_lhtight_iloose',
-  'HLT_e26_lhtight_nod0_iloose',
-  'HLT_e26_lhtight_nod0_ivarloose',
-  'HLT_e24_lhmedium_nod0_ringer_L1EM20VH',
-  'HLT_e24_lhmedium_nod0_ringer_iloose',
-  'HLT_e24_lhtight_nod0_ringer_iloose',
-  'HLT_e24_lhmedium_nod0_ringer_ivarloose',
-  'HLT_e24_lhtight_nod0_ringer_ivarloose',
-  'HLT_e26_lhtight_nod0_ringer_iloose',
-  'HLT_e26_lhtight_nod0_ringer_ivarloose',
-  'HLT_e28_lhtight_nod0_iloose',
-  'HLT_e28_lhtight_nod0_ringer_iloose',
-  'HLT_e28_lhtight_nod0_ringer_ivarloose',
-]
+        'HLT_e24_lhmedium_L1EM18VH',
+        'HLT_e24_lhmedium_nod0_L1EM18VH',
+        'HLT_e24_lhmedium_nod0_L1EM20VH',
+        'HLT_e24_medium_nod0_L1EM20VH',
+        'HLT_e24_lhmedium_iloose',
+        'HLT_e24_medium_iloose',
+        'HLT_e24_lhmedium_nod0_iloose',
+        'HLT_e24_lhtight_nod0_iloose',
+        'HLT_e24_lhmedium_nod0_ivarloose',
+        'HLT_e24_lhtight_nod0_ivarloose',
+        'HLT_e24_lhtight_iloose',
+        'HLT_e24_tight_iloose',
+        'HLT_e26_lhtight_iloose',
+        'HLT_e26_lhtight_nod0_iloose',
+        'HLT_e26_lhtight_nod0_ivarloose',
+        'HLT_e24_lhmedium_nod0_ringer_L1EM20VH',
+        'HLT_e24_lhmedium_nod0_ringer_iloose',
+        'HLT_e24_lhtight_nod0_ringer_iloose',
+        'HLT_e24_lhmedium_nod0_ringer_ivarloose',
+        'HLT_e24_lhtight_nod0_ringer_ivarloose',
+        'HLT_e26_lhtight_nod0_ringer_iloose',
+        'HLT_e26_lhtight_nod0_ringer_ivarloose',
+        'HLT_e28_lhtight_nod0_iloose',
+        'HLT_e28_lhtight_nod0_ringer_iloose',
+        'HLT_e28_lhtight_nod0_ringer_ivarloose',
+        ]
 
 
 ### Make supproting trigger list for the emulation e/g tool
 supportingTriggerList = probeListLowMidPtSupportingTriggers+probeListHighPtSupportingTriggers
 # Update the supporting list with very loose chains. This will be used in data collisin matches
 for trig in probeListLowMidPtPhysicsTriggers+probeListHighPtPhysicsTriggers:
-  if 'vloose' in trig:  supportingTriggerList.append(trig)
+    if 'vloose' in trig:  supportingTriggerList.append(trig)
 
 supportingTriggerList.extend( [
-  'HLT_e24_lhvloose_nod0_L1EM20VH',
-  'HLT_e26_lhvloose_nod0_L1EM20VH',
-  'HLT_e28_lhvloose_nod0_L1EM20VH',
-  'HLT_e140_lhvloose_nod0',
-  'HLT_e10_lhvloose_nod0_L1EM7',
-  'HLT_e10_lhvloose_nod0_L1EM7',
-  'HLT_e15_lhvloose_nod0_L1EM7',
-  'HLT_e20_lhvloose_nod0_L1EM12',
-  'HLT_e25_lhvloose_nod0_L1EM15',
-  'HLT_e30_lhvloose_nod0_L1EM15',
-  'HLT_e40_lhvloose_nod0_L1EM15',
-  'HLT_e50_lhvloose_nod0_L1EM15',
-  'HLT_e70_lhvloose_nod0',
-  'HLT_e80_lhvloose_nod0',
-  'HLT_e100_lhvloose_nod0',
-  'HLT_e120_lhvloose_nod0',
-  'HLT_e5_lhvloose_nod0',
-  'HLT_e12_lhvloose_nod0_L1EM10VH',
-  'HLT_e17_lhvloose_nod0',
-  'HLT_e20_lhvloose_nod0',
-  'HLT_e40_lhvloose_nod0',
-  'HLT_e60_lhvloose_nod0',
-] )
+    'HLT_e24_lhvloose_nod0_L1EM20VH',
+    'HLT_e26_lhvloose_nod0_L1EM20VH',
+    'HLT_e28_lhvloose_nod0_L1EM20VH',
+    'HLT_e140_lhvloose_nod0',
+    'HLT_e10_lhvloose_nod0_L1EM7',
+    'HLT_e10_lhvloose_nod0_L1EM7',
+    'HLT_e15_lhvloose_nod0_L1EM7',
+    'HLT_e20_lhvloose_nod0_L1EM12',
+    'HLT_e25_lhvloose_nod0_L1EM15',
+    'HLT_e30_lhvloose_nod0_L1EM15',
+    'HLT_e40_lhvloose_nod0_L1EM15',
+    'HLT_e50_lhvloose_nod0_L1EM15',
+    'HLT_e70_lhvloose_nod0',
+    'HLT_e80_lhvloose_nod0',
+    'HLT_e100_lhvloose_nod0',
+    'HLT_e120_lhvloose_nod0',
+    'HLT_e5_lhvloose_nod0',
+    'HLT_e12_lhvloose_nod0_L1EM10VH',
+    'HLT_e17_lhvloose_nod0',
+    'HLT_e20_lhvloose_nod0',
+    'HLT_e40_lhvloose_nod0',
+    'HLT_e60_lhvloose_nod0',
+    ] )
 
 
 
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/share/testTrigEgammaAnalysisTools.py b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/share/testTrigEgammaAnalysisTools.py
deleted file mode 100755
index 763707849410d0aec5a9e25fd905a847ef097379..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/share/testTrigEgammaAnalysisTools.py
+++ /dev/null
@@ -1,117 +0,0 @@
-# Job options for standalone and Tier0 running of AnalysisTools 
-# Authors: 
-# Ryan Mackenzie White <ryan.white@cern.ch>
-# 
-# Tool and algorithm configuration done using egamma Factories
-# Default configurations found in TrigEgammaAnalysisToolsConfig
-
-# To run
-# athena -l DEBUG -c "DIR='/afs/cern.ch/work/j/jolopezl/datasets/valid1.147406.PowhegPythia8_AZNLO_Zee.recon.AOD.e3099_s2578_r6220_tid05203475_00'" -c "NOV=50" test_ZeeElectronLowPtSupportingTrigAnalysis.py
-# where NOV is the number of events to run
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-from RecExConfig.RecFlags import rec
-from RecExConfig.RecAlgsFlags import recAlgs
-from AthenaCommon.AppMgr import ToolSvc
-
-import os
-
-#print 'Set some variables for job'
-dirtouse = str()
-
-finallist=[]
-
-if 'FILE' in dir() :
-     finallist.append(FILE)
-elif 'DIR' in dir() :
-     dirtouse=DIR       
-     while( dirtouse.endswith('/') ) :
-          dirtouse= dirtouse.rstrip('/')
-     listfiles=os.listdir(dirtouse)
-     for ll in listfiles:
-          finallist.append(dirtouse+'/'+ll)
-
-if 'NOV' in dir():
-    nov=NOV
-else :
-    nov=-1
-
-if 'RTT' in dir():
-    rttfile='root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/rtt/prod/rtt/'+RTT+'/x86_64-slc6-gcc49-opt/offline/TrigEgammaValidation/RDOtoAOD_MC_transform_Zee_25ns_pileup/AOD.Zee.25ns.pileup.pool.root'
-    finallist.append(rttfile)
-
-if 'GRL' in dir():
-    grl=GRL
-
-
-athenaCommonFlags.FilesInput=finallist
-athenaCommonFlags.EvtMax=nov
-rec.readAOD=True
-# switch off detectors
-rec.doForwardDet=False
-rec.doInDet=False
-rec.doCalo=False
-rec.doMuon=False
-rec.doEgamma=False
-rec.doTrigger = True; recAlgs.doTrigger=False # disable trigger (maybe necessary if detectors switched off)
-rec.doMuon=False
-rec.doMuonCombined=False
-rec.doWriteAOD=True
-rec.doWriteESD=False
-rec.doDPD=False
-rec.doTruth=False
-
-# autoconfiguration might trigger undesired feature
-rec.doESD.set_Value_and_Lock(False) # uncomment if do not run ESD making algorithms
-rec.doWriteESD.set_Value_and_Lock(False) # uncomment if do not write ESD
-rec.doAOD.set_Value_and_Lock(True) # uncomment if do not run AOD making algorithms
-rec.doWriteAOD.set_Value_and_Lock(True) # uncomment if do not write AOD
-rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if do not write TAG
-
-# main jobOption
-include ("RecExCommon/RecExCommon_topOptions.py")
-MessageSvc.debugLimit = 20000000
-MessageSvc.infoLimit  = 20000000
-# TDT
-from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
-ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" )
-ToolSvc.TrigDecisionTool.TrigDecisionKey='xTrigDecision'
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-
-# Use GRL selection 
-if 'GRL' in dir():
-    # Configure the goodrunslist selector tool
-    from GoodRunsLists.GoodRunsListsConf import *
-    ToolSvc += GoodRunsListSelectorTool() 
-    GoodRunsListSelectorTool.GoodRunsListVec = [grl]
-    GoodRunsListSelectorTool.OutputLevel = DEBUG
-    from AthenaCommon.AlgSequence import AlgSequence,AthSequencer
-    topSequence = AlgSequence()
-    seq = AthSequencer("AthMasterSeq")
-    from GoodRunsListsUser.GoodRunsListsUserConf import *
-    seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
-    seq.GRLTriggerAlg1.GoodRunsListArray = ['PHYS_StandardGRL_All_Good']        ## pick up correct name from inside xml file!
-
-from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-topSequence += AthenaMonManager( "HLTMonManager")
-HLTMonManager = topSequence.HLTMonManager
-
-################ Mon Tools #################
-#Global HLTMonTool
-
-from TrigHLTMonitoring.TrigHLTMonitoringConf import HLTMonTool
-HLTMon = HLTMonTool(name               = 'HLTMon',
-               histoPathBase      = "HLT");
-
-#ToolSvc += HLTMon;
-HLTMonManager.AthenaMonTools += [ HLTMon ];
-    
-from TrigEgammaAnalysisTools import TrigEgammaMonToolConfig
-HLTEgammaMon = TrigEgammaMonToolConfig.TrigEgammaMonTool()
-HLTMonManager.AthenaMonTools += [ HLTEgammaMon ]
-HLTMonManager.FileKey = "GLOBAL"
-
-
-    
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/share/testTrigEgammaAnalysisToolsGRL.py b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/share/testTrigEgammaAnalysisToolsGRL.py
deleted file mode 100755
index cb574e9530c73aca90ff1cd1c5632b68f6860cfd..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/share/testTrigEgammaAnalysisToolsGRL.py
+++ /dev/null
@@ -1,200 +0,0 @@
-# Job options for standalone and Tier0 running of AnalysisTools 
-# Authors: 
-# Ryan Mackenzie White <ryan.white@cern.ch>
-# 
-# Tool and algorithm configuration done using egamma Factories
-# Default configurations found in TrigEgammaAnalysisToolsConfig
-
-# To run
-# athena -l DEBUG -c "DIR='/afs/cern.ch/work/j/jolopezl/datasets/valid1.147406.PowhegPythia8_AZNLO_Zee.recon.AOD.e3099_s2578_r6220_tid05203475_00'" -c "NOV=50" test_ZeeElectronLowPtSupportingTrigAnalysis.py
-# where NOV is the number of events to run
-
-from AthenaCommon.GlobalFlags import globalflags
-globalflags.ConditionsTag="CONDBR2-BLKPA-2014-00"
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-from RecExConfig.RecFlags import rec
-from RecExConfig.RecAlgsFlags import recAlgs
-from InDetRecExample.InDetJobProperties import InDetFlags
-InDetFlags.doSecVertexFinder.set_Value_and_Lock(False)
-from AthenaCommon.AppMgr import ToolSvc
-
-import os
-
-# Use the parser
-import argparse
-#print 'Setup parser'
-parser = argparse.ArgumentParser()
-#parser.add_argument("--file", action="store",help="input file name")
-#parser.add_argument("--dirname", action="store",help="input directory")
-#parser.add_argument("--nev",default=-1,action=store,type=int,help="number of events to process")
-#parser.add_argument("--output",default="Validation",action=store,help="output file name")
-#parser.add_argument("--t0",default=False,action=store_true,help="run T0 monitoring")
-#parser.add_argument("--tagTrigger",default="e26_lhtight_iloose",action=store,help="Tag trigger to TP")
-#parser.add_argument("--useMCMenu",default=False,action=store_true,help="Use MC menu to generate trigger list")
-#parser.add_argument("--usePhysicsMenu",default=False,action=store_true,help="Use MC menu to generate trigger list")
-
-#print 'Set some variables for job'
-dirtouse = str()
-
-finallist=[]
-#print 'Now parser'
-#args = parser.parse_args()
-#print 'Now setup filelist'
-#finallist.append(args.file)
-#print 'Or set the directory'
-#dirtouse=args.dirname
-#nov=args.nev
-#while( dirtouse.endswith('/') ) :
-#    dirtouse= dirtouse.rstrip('/')
-#    listfiles=os.listdir(dirtouse)
-#    for ll in listfiles:
-#        finallist.append(dirtouse+'/'+ll)
-#outputName = args.output
-#tagItem = args.Tagtrigger
-
-if 'FILE' in dir() :
-     finallist.append(FILE)
-elif 'DIR' in dir() :
-     dirtouse=DIR       
-     while( dirtouse.endswith('/') ) :
-          dirtouse= dirtouse.rstrip('/')
-     listfiles=os.listdir(dirtouse)
-     for ll in listfiles:
-          finallist.append(dirtouse+'/'+ll)
-
-if 'NOV' in dir():
-    nov=NOV
-else :
-    nov=-1
-
-if 'OUTPUT' in dir():
-    outputName = OUTPUT
-elif 'DOTIER0' in dir():
-    outputName = ''
-else:
-    outputName = 'Validation'
-
-if('TAG' in dir()):
-    tagItem = TAG 
-else: 
-    tagItem = 'e26_tight_iloose'
-
-
-athenaCommonFlags.FilesInput=finallist
-athenaCommonFlags.EvtMax=nov
-#athenaCommonFlags.EvtMax=-1
-rec.readAOD=True
-# switch off detectors
-rec.doForwardDet=False
-rec.doInDet=False
-rec.doCalo=False
-rec.doMuon=False
-rec.doEgamma=False
-rec.doTrigger = True; recAlgs.doTrigger=False # disable trigger (maybe necessary if detectors switched off)
-rec.doMuon=False
-rec.doMuonCombined=False
-rec.doWriteAOD=False
-rec.doWriteESD=False
-rec.doDPD=False
-rec.doTruth=False
-
-
-# autoconfiguration might trigger undesired feature
-rec.doESD.set_Value_and_Lock(False) # uncomment if do not run ESD making algorithms
-rec.doWriteESD.set_Value_and_Lock(False) # uncomment if do not write ESD
-rec.doAOD.set_Value_and_Lock(False) # uncomment if do not run AOD making algorithms
-rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if do not write AOD
-rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if do not write TAG
-
-# main jobOption
-include ("RecExCommon/RecExCommon_topOptions.py")
-
-# TDT
-from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
-ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" )
-ToolSvc.TrigDecisionTool.TrigDecisionKey='xTrigDecision'
-
-# Configure the goodrunslist selector tool
-from GoodRunsLists.GoodRunsListsConf import *
-ToolSvc += GoodRunsListSelectorTool() 
-GoodRunsListSelectorTool.GoodRunsListVec = ['data15_13TeV.periodAllYear_DetStatus-v63-pro18-01_DQDefects-00-01-02_PHYS_StandardGRL_All_Good.xml']
-GoodRunsListSelectorTool.OutputLevel = DEBUG
-# Set base path for monitoring/validation tools        
-basePath = '/HLT/Egamma/'
-
-if 'DOTIER0' in dir():
-    from AthenaCommon.AlgSequence import AlgSequence,AthSequencer
-    topSequence = AlgSequence()
-    seq = AthSequencer("AthMasterSeq")
-    from GoodRunsListsUser.GoodRunsListsUserConf import *
-    seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
-    seq.GRLTriggerAlg1.GoodRunsListArray = ['PHYS_StandardGRL_All_Good']        ## pick up correct name from inside xml file!
-    
-    from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-    topSequence += AthenaMonManager( "HLTMonManager")
-    HLTMonManager = topSequence.HLTMonManager
-
-    ################ Mon Tools #################
-
-    #Global HLTMonTool
-
-    from TrigHLTMonitoring.TrigHLTMonitoringConf import HLTMonTool
-    HLTMon = HLTMonTool(name               = 'HLTMon',
-                   histoPathBase      = "HLT");
-
-
-    #ToolSvc += HLTMon;
-    HLTMonManager.AthenaMonTools += [ HLTMon ];
-    
-    from TrigEgammaAnalysisTools import TrigEgammaMonToolConfig
-    TrigEgammaMonTool = TrigEgammaMonToolConfig.TrigEgammaMonTool()
-    HLTMonManager.AthenaMonTools += [ TrigEgammaMonTool ]
-    HLTMonManager.FileKey = "GLOBAL"
-
-elif 'DO50ns' in dir():
-    from AthenaCommon.AlgSequence import AlgSequence,AthSequencer
-    topSequence = AlgSequence()
-    seq = AthSequencer("AthMasterSeq")
-    from GoodRunsListsUser.GoodRunsListsUserConf import *
-    seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
-    seq.GRLTriggerAlg1.GoodRunsListArray = ['PHYS_StandardGRL_All_Good']        ## pick up correct name from inside xml file!
-
-    from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-    topSequence += AthenaMonManager( "HLTMonManager")
-    HLTMonManager = topSequence.HLTMonManager
-
-    ################ Mon Tools #################
-
-    #Global HLTMonTool
-
-    from TrigHLTMonitoring.TrigHLTMonitoringConf import HLTMonTool
-    HLTMon = HLTMonTool(name               = 'HLTMon',
-                   histoPathBase      = "HLT");
-
-
-    #ToolSvc += HLTMon;
-    HLTMonManager.AthenaMonTools += [ HLTMon ];
-    
-    from TrigEgammaAnalysisTools import TrigEgammaMonToolConfig50ns
-    TrigEgammaMonTool = TrigEgammaMonToolConfig50ns.TrigEgammaMonTool()
-    HLTMonManager.AthenaMonTools += [ TrigEgammaMonTool ]
-    HLTMonManager.FileKey = "GLOBAL"
-elif 'DOPHYSVAL' in dir():
-    from AthenaCommon.AlgSequence import AlgSequence
-    topSequence = AlgSequence()
-    
-    from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-    monMan= AthenaMonManager( "PhysValMonManager")
-    monMan.FileKey = "PhysVal"
-    topSequence += monMan
-
-    from GaudiSvc.GaudiSvcConf import THistSvc
-    ServiceMgr += THistSvc()
-    
-    ServiceMgr.THistSvc.Output += ["PhysVal DATAFILE='PhysVal.root' OPT='RECREATE'"]
-    from TrigEgammaAnalysisTools import TrigEgammaPhysValMonToolConfig
-    TrigEgammaPhysValMonToolConfig.TrigEgammaPhysValMonTool()
-    monMan.AthenaMonTools += [ "TrigEgammaPhysValMonTool" ]
-else:
-   print "No job configured, options DOPHYSVAL=True or DOTIER0=True" 
-    
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/share/testTrigEgammaAnalysisTools_emulator.py b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/share/testTrigEgammaAnalysisTools_emulator.py
deleted file mode 100644
index d935bbb645d21ee20a9cba0f024667550a5fbdc8..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/share/testTrigEgammaAnalysisTools_emulator.py
+++ /dev/null
@@ -1,250 +0,0 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-
-####################################################################################################
-# Job options for standalone and Tier0 running of AnalysisTools 
-# Authors: 
-# Ryan Mackenzie White <ryan.white@cern.ch>
-# Joao Victor Pinto    <jodafons@cern.ch>
-# 
-# Tool and algorithm configuration done using egamma Factories
-#
-# To run
-# athena -l DEBUG -c "DIR='/afs/cern.ch/work/j/jolopezl/datasets/\
-#                     valid1.147406.PowhegPythia8_AZNLO_Zee.recon.AOD.e3099_s2578_r6220_tid05203475_00'" 
-#                 -c "NOV=50" test_ZeeElectronLowPtSupportingTrigAnalysis.py
-# where NOV is the number of events to run
-####################################################################################################
-
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-from RecExConfig.RecFlags import rec
-from RecExConfig.RecAlgsFlags import recAlgs
-from AthenaCommon.AppMgr import ToolSvc
-import os
-
-# Define triggers for tagging 
-tagList = ['HLT_e24_lhtight_nod0_ivarloose',
-           'HLT_e26_lhtight_nod0_ivarloose',
-           'HLT_e28_lhtight_nod0_ivarloose']
-
-triggerList_commissioning_v1 = [
-          
-         # standard monitoring chains
-         #'HLT_e17_lhvloose_nod0_L1EM15VHI',
-         'HLT_e17_lhvloose_nod0',
-         'HLT_e26_lhloose_nod0',
-         'HLT_e26_lhmedium_nod0',
-         #'HLT_e26_lhtight_nod0',
-         #'HLT_e26_lhtight_nod0_ivarloose',
-         'HLT_e28_lhtight_nod0_ivarloose',
-         'HLT_e60_lhmedium_nod0_L1EM24VHI',
-         'HLT_e140_lhloose_nod0_L1EM24VHI',
-         # ringer chains for the commissioning...
-         #'HLT_e17_lhvloose_nod0_ringer_L1EM15VHI',
-         'HLT_e17_lhvloose_nod0_ringer',
-         'HLT_e26_lhloose_nod0_ringer',
-         'HLT_e26_lhmedium_nod0_ringer',
-         #'HLT_e26_lhtight_nod0_ringer',
-         #'HLT_e26_lhtight_nod0_ringer_ivarloose',
-         'HLT_e28_lhtight_nod0_ringer_ivarloose',
-         'HLT_e60_lhmedium_nod0_ringer_L1EM24VHI',
-         'HLT_e140_lhloose_nod0_ringer_L1EM24VHI',
-    ]
-
-
-triggerList_monitoring_v1 = [
-         # standard monitoring chains
-         'HLT_e17_lhvloose_nod0_L1EM15VHI',
-         'HLT_e26_lhtight_nod0_ivarloose',
-         'HLT_e28_lhtight_nod0_icaloloose',
-         'HLT_e60_lhmedium_nod0_L1EM24VHI',
-         'HLT_e140_lhloose_nod0_L1EM24VHI',
-         # no ringer chains for pos-commissioning...
-         'HLT_e17_lhvloose_nod0_noringer_L1EM15VHI',
-         'HLT_e26_lhtight_nod0_noringer_ivarloose',
-         'HLT_e28_lhtight_nod0_noringer_ivarloose',
-         'HLT_e60_lhmedium_nod0_noringer_L1EM24VHI',
-         'HLT_e140_lhloose_nod0_noringer_L1EM24VHI',
-
-      ]
-
-
-triggerList = triggerList_monitoring_v1
-
-doGRL=False
-doEmulation=True
-DetailedHistograms=False
-####################################################################################################
-dirtouse = str()
-finallist=[]
-grllist=[]
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as acf
-from glob import glob
-
-if ('FILE' in dir()):
-    acf.FilesInput=[FILE]
-elif ('DIR' in dir()):
-    inputFiles = glob(DIR+'*')
-    acf.FilesInput=inputFiles
-if 'NOV' in dir():
-    nov=NOV
-else :
-    nov=500
-if 'GRL' in dir():
-  grllist.append(GRL)
-else:
-  #grllist.append('/afs/cern.ch/work/j/jodafons/public/data/data15_13TeV.periodAllYear_DetStatus-v79-repro20-02_DQDefects-00-02-02_PHYS_StandardGRL_All_Good_25ns.xml')
-  #grllist.append('data15_13TeV.periodAllYear_DetStatus-v79-repro20-02_DQDefects-00-02-02_PHYS_StandardGRL_All_Good_25ns.xml')
-  #grllist.append('/afs/cern.ch/work/j/jodafons/public/data/data16_13TeV.periodAllYear_DetStatus-v81-pro20-10_DQDefects-00-02-02_PHYS_StandardGRL_All_Good_25ns.xml')
-  #grllist.append('data16_13TeV.periodAllYear_DetStatus-v81-pro20-10_DQDefects-00-02-02_PHYS_StandardGRL_All_Good_25ns.xml')
-  grllist.append('data17_13TeV.periodAllYear_DetStatus-v92-pro21-05_Unknown_PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim.xml')
-
-####################################################################################################
-
-acf.EvtMax=nov
-rec.readAOD=True
-# switch off detectors
-rec.doForwardDet=False
-rec.doInDet=False
-rec.doCalo=False
-rec.doMuon=False
-rec.doEgamma=False
-rec.doTrigger=True
-recAlgs.doTrigger=False # disable trigger (maybe necessary if detectors switched off)
-rec.doMuon=False
-rec.doMuonCombined=False
-rec.doWriteAOD=True
-rec.doWriteESD=False
-rec.doDPD=False
-rec.doTruth=False
-# autoconfiguration might trigger undesired feature
-rec.doESD.set_Value_and_Lock(False)      # uncomment if do not run ESD making algorithms
-rec.doWriteESD.set_Value_and_Lock(False) # uncomment if do not write ESD
-rec.doAOD.set_Value_and_Lock(True)       # uncomment if do not run AOD making algorithms
-rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if do not write AOD
-rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if do not write TAG
-
-# main jobOption
-include ("RecExCommon/RecExCommon_topOptions.py")
-MessageSvc.debugLimit = 20000000
-MessageSvc.infoLimit  = 20000000
-
-# Add Trigger Decision Tool 
-from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
-tdt = Trig__TrigDecisionTool( "TrigDecisionTool" )
-tdt.TrigDecisionKey='xTrigDecision'
-tdt.Navigation.ReadonlyHolders=True
-ToolSvc+=tdt
-
-try:
-  include ("AthenaMonitoring/DataQualityInit_jobOptions.py")
-except Exception:
-  treatException("Could not load AthenaMonitoring/DataQualityInit_jobOptions.py")
-
-
-
-
-# Call top sequence
-from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
-topSequence = AlgSequence()
-
-
-##################################### GRL Tools ##########################################
-# Good Run List (GRL)
-if doGRL:
-    from PyUtils.MetaReaderPeeker import metadata
-    try:
-        if metadata['eventTypes'][0] == 'IS_DATA':
-            from GoodRunsLists.GoodRunsListsConf import *
-            ToolSvc += GoodRunsListSelectorTool()
-            GoodRunsListSelectorTool.GoodRunsListVec = grllist
-            from GoodRunsListsUser.GoodRunsListsUserConf import *
-            seq = AthSequencer("AthFilterSeq")
-            seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
-            #seq.GRLTriggerAlg1.GoodRunsListArray = ['PHYS_StandardGRL_All_Good_25ns']
-            seq.GRLTriggerAlg1.GoodRunsListArray = [grllist[0].replace('.xml','')]
-    except:
-        print("GRL not available!")
-  
-##################################### Mon Tools ##########################################
-
-from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-topSequence += AthenaMonManager( "HLTMonManager")
-HLTMonManager = topSequence.HLTMonManager
-################ Mon Tools #################
-#Global HLTMonTool
-from TrigHLTMonitoring.TrigHLTMonitoringConf import HLTMonTool
-HLTMon = HLTMonTool(name  = 'HLTMon', histoPathBase = "HLT");
-ToolSvc += HLTMon;
-HLTMonManager.AthenaMonTools += [ "HLTMonTool/HLTMon" ];
-
-####################################################################################################
-#Define the base path for all histograms
-
-
-
-basePath = '/HLT/Egamma'
-#Configure the TrigEgammaPlotTool
-from TrigEgammaAnalysisTools.TrigEgammaAnalysisToolsConfig import TrigEgammaNavTPAnalysisTool, TrigEgammaPlotTool, EfficiencyTool, DistTool, ResolutionTool
-from TrigEgammaAnalysisTools.TrigEgammaProbelist           import monitoring_mam, monitoring_electron, monitoring_photon 
-from TrigEgammaAnalysisTools.TrigEgammaProbelist           import probeListLowMidPtSupportingTriggers, probeListHighPtSupportingTriggers
-
-PlotTool = TrigEgammaPlotTool.copy( name="TrigEgammaPlotTool",
-                                    DirectoryPath=basePath,
-                                    MaM=monitoring_mam,
-                                    Efficiency=[],
-                                    Distribution=[],
-                                    Resolution=[])
-
-EffTool = EfficiencyTool.copy(name="EfficiencyTool",
-                              PlotTool=PlotTool,
-                              isEMResultNames=["Tight","Medium","Loose"],
-                              LHResultNames=["LHTight","LHMedium","LHLoose"],
-                              OutputLevel=0)
-
-
-
-####################################################################################################
-from TrigEgammaEmulationTool.TrigEgammaEmulationToolConfig import TrigEgammaEmulationTool
-from TrigEgammaEmulationTool.TrigEgammaEmulationEFConfig   import EgammaEFElectronDefaultEmulator,EgammaEFElectronNoD0Emulator
-from TriggerJobOpts.TriggerFlags import TriggerFlags
-
-# Force this emulation selector path
-TriggerFlags.EgammaSlice.pidVersion.set_Value_and_Lock("ElectronPhotonSelectorTools/trigger/rel21_20170217/")
-TriggerFlags.EgammaSlice.ringerVersion.set_Value_and_Lock("RingerSelectorTools/TrigL2_20170505_v6")
-
-EmulationElectronTool = TrigEgammaEmulationTool.copy( name="TrigEgammaEmulationTool",
-                                                      TriggerList = triggerList,
-                                                      DoL2ElectronFex=True,
-                                                      DoEFCaloPid=False,
-                                                      DoRinger=True,
-                                                      OutputLevel=0)
-
-####################################################################################################
-
-AnalysisTool = TrigEgammaNavTPAnalysisTool( name = "TrigEgammaNavTPAnalysisTool",
-                                            Analysis='Zee',
-                                            PlotTool=PlotTool,
-                                            Tools=[EffTool],
-                                            OfflineTagSelector='Tight', # 1=tight, 2=medium, 3=loose
-                                            OfflineProbeSelector='Loose', 
-                                            DefaultProbePid='LHMedium',
-                                            doEmulation=doEmulation,
-                                            DetailedHistograms=DetailedHistograms,
-                                            EmulationTool=EmulationElectronTool,
-                                            TPTrigger=False,
-                                            RemoveCrack=False,
-                                            TagTriggerList=tagList,
-                                            TriggerList=triggerList,
-                                            OutputLevel=0)
-
-####################################################################################################
-Tools=['TrigEgammaNavTPAnalysisTool/TrigEgammaNavTPAnalysisTool']
-from TrigEgammaAnalysisTools.TrigEgammaAnalysisToolsConf import TrigEgammaMonTool
-TrigEgammaMonTool = TrigEgammaMonTool( name = "HLTEgammaMon", histoPathBase=basePath, Tools=Tools)
-ToolSvc += TrigEgammaMonTool
-HLTMonManager.AthenaMonTools += [ "TrigEgammaMonTool/HLTEgammaMon" ]
-HLTMonManager.FileKey = "GLOBAL"
-ToolSvc.TrigDecisionTool.Navigation.OutputLevel = WARNING
-####################################################################################################
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/share/testTrigEgammaEventSelectionTool.py b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/share/testTrigEgammaEventSelectionTool.py
deleted file mode 100644
index ba72df178c83f6d1e99bf66c96169841bb2868a5..0000000000000000000000000000000000000000
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/share/testTrigEgammaEventSelectionTool.py
+++ /dev/null
@@ -1,195 +0,0 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-
-# Job options for standalone and Tier0 running of AnalysisTools 
-# Authors: 
-# Ryan Mackenzie White <ryan.white@cern.ch>
-# 
-# Tool and algorithm configuration done using egamma Factories
-# Default configurations found in TrigEgammaAnalysisToolsConfig
-#
-# To run
-# athena -l DEBUG -c "DIR='/afs/cern.ch/work/j/jolopezl/datasets/valid1.147406.PowhegPythia8_AZNLO_Zee.recon.AOD.e3099_s2578_r6220_tid05203475_00'" 
-#                 -c "NOV=50" test_ZeeElectronLowPtSupportingTrigAnalysis.py
-# where NOV is the number of events to run
-
-from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
-from RecExConfig.RecFlags import rec
-from RecExConfig.RecAlgsFlags import recAlgs
-from AthenaCommon.AppMgr import ToolSvc
-import os
-
-doZ=True
-doFakes=True
-
-# Define triggers for tagging 
-triggerTags     = ['HLT_e24_lhtight_nod0_ivarloose',
-                   'HLT_e26_lhtight_nod0_ivarloose',
-                   'HLT_e28_lhtight_nod0_ivarloose']
-
-triggerList = [
-         # standard monitoring chains
-         'HLT_e26_lhtight_nod0_ivarloose',
-         'HLT_e28_lhtight_nod0_ivarloose',
-         'HLT_e60_lhmedium_nod0_L1EM24VHI',
-         # no ringer chains for pos-commissioning...
-         'HLT_e26_lhtight_nod0_noringer_ivarloose_L1EM22VHI',
-         'HLT_e28_lhtight_nod0_noringer_ivarloose', # get real TDT
-         'HLT_e28_lhtight_nod0_noringer_ivarloose_L1EM24VHI',
-         'HLT_e60_lhmedium_nod0_noringer_L1EM24VHI',
-      ]
-
-
-
-#print 'Set some variables for job'
-dirtouse = str()
-finallist=[]
-
-if 'FILE' in dir() :
-     finallist.append(FILE)
-
-if 'DIR' in dir() :
-     dirtouse=DIR      
-     print 'DIR = ',dirtouse
-     while( dirtouse.endswith('/') ) :
-          dirtouse= dirtouse.rstrip('/')
-     listfiles=os.listdir(dirtouse)
-     for ll in listfiles:
-          finallist.append(dirtouse+'/'+ll)
-
-if 'NOV' in dir():
-    nov=NOV
-else :
-    nov=-1
-
-
-print  finallist 
-athenaCommonFlags.FilesInput=finallist
-athenaCommonFlags.EvtMax=nov
-rec.readAOD=True
-# switch off detectors
-rec.doForwardDet=False
-rec.doInDet=False
-rec.doCalo=False
-rec.doMuon=False
-rec.doEgamma=False
-rec.doTrigger = True; recAlgs.doTrigger=False # disable trigger (maybe necessary if detectors switched off)
-rec.doMuon=False
-rec.doAOD=False
-rec.doMuonCombined=False
-rec.doWriteAOD=False
-rec.doWriteESD=False
-rec.doDPD=False
-rec.doTruth=False
-
-# autoconfiguration might trigger undesired feature
-rec.doESD.set_Value_and_Lock(False) # uncomment if do not run ESD making algorithms
-rec.doWriteESD.set_Value_and_Lock(False) # uncomment if do not write ESD
-rec.doAOD.set_Value_and_Lock(True) # uncomment if do not run AOD making algorithms
-rec.doWriteAOD.set_Value_and_Lock(False) # uncomment if do not write AOD
-rec.doWriteTAG.set_Value_and_Lock(False) # uncomment if do not write TAG
-
-# main jobOption
-include ("RecExCommon/RecExCommon_topOptions.py")
-MessageSvc.debugLimit = 20000000
-MessageSvc.infoLimit  = 20000000
-# TDT
-from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
-tdt = Trig__TrigDecisionTool( "TrigDecisionTool" )
-tdt.TrigDecisionKey='xTrigDecision'
-tdt.Navigation.ReadonlyHolders=True
-ToolSvc+=tdt
-
-try:
-  include ("AthenaMonitoring/DataQualityInit_jobOptions.py")
-except Exception:
-  treatException("Could not load AthenaMonitoring/DataQualityInit_jobOptions.py")
-
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-
-from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
-topSequence += AthenaMonManager( "HLTMonManager")
-HLTMonManager = topSequence.HLTMonManager
-
-################ Mon Tools #################
-#Global HLTMonTool
-
-from TrigHLTMonitoring.TrigHLTMonitoringConf import HLTMonTool
-HLTMon = HLTMonTool(name  = 'HLTMon', histoPathBase = "HLT");
-
-ToolSvc += HLTMon;
-HLTMonManager.AthenaMonTools += [ "HLTMonTool/HLTMon" ];
-    
-from TrigEgammaAnalysisTools.TrigEgammaAnalysisToolsConfig import TrigEgammaPlotTool, getEventSelectionTool
-#Define the base path for all histograms
-basePath = '/HLT/Physval'
-
-#Configure the TrigEgammaPlotTool
-PlotTool = TrigEgammaPlotTool.copy( name="TrigEgammaPlotTool",
-                                    DirectoryPath=basePath,
-                                    #MaM=monitoring_mam,
-                                    Efficiency=[],
-                                    Distribution=[],
-                                    Resolution=[])
-
-TrigEgammaEventSelection = getEventSelectionTool()
-
-####################################################################################################
-
-from TrigEgammaEmulationTool.TrigEgammaEmulationToolConfig import TrigEgammaEmulationTool
-from TrigEgammaEmulationTool.TrigEgammaEmulationEFConfig   import EgammaEFElectronDefaultEmulator,EgammaEFElectronNoD0Emulator
-from TriggerJobOpts.TriggerFlags import TriggerFlags
-
-# Force this emulation selector path
-TriggerFlags.EgammaSlice.pidVersion.set_Value_and_Lock("ElectronPhotonSelectorTools/trigger/rel21_20170217/")
-TriggerFlags.EgammaSlice.ringerVersion.set_Value_and_Lock("RingerSelectorTools/TrigL2_20170505_v6")
-
-EmulationElectronTool = TrigEgammaEmulationTool.copy( name="TrigEgammaEmulationTool",
-                                                      TriggerList = triggerList,
-                                                      DoL2ElectronFex=True,
-                                                      DoEFCaloPid=False,
-                                                      DoRinger=True,
-                                                      OutputLevel=0)
-
-####################################################################################################
-
-
-Tool = TrigEgammaEventSelection( name='EventSelection',
-                              Analysis='Probes',
-                              PlotTool=PlotTool,
-                              EmulationTool=EmulationElectronTool,
-                              File="",
-                              OutputLevel=0,
-                              DetailedHistograms=False,
-                              isEMResultNames=["Tight","Medium","Loose"],
-                              LHResultNames=["LHTight","LHMedium","LHLoose"],
-                              ZeeLowerMass=80,
-                              ZeeUpperMass=100,
-                              OfflineTagSelector='Tight', # 1=tight, 2=medium, 3=loose
-                              OfflineProbeSelector='Loose', 
-                              ForceProbePid=False, 
-                              OppositeCharge=True,
-                              OfflineTagMinEt=25,
-                              TagTriggerList=triggerTags,
-                              SelectionZ=doZ,
-                              SelectionFakes=doFakes,
-                              ApplyMinimalTrigger=False,
-                              DetailedDataLevel=2,
-                              DumpTags=False,
-                              TriggerList=triggerList)
-
-Tools=['TrigEgammaEventSelection/EventSelection']
-
-from TrigEgammaAnalysisTools.TrigEgammaAnalysisToolsConf import TrigEgammaMonTool
-TrigEgammaMonTool = TrigEgammaMonTool( name = "HLTEgammaMon", 
-                                       histoPathBase=basePath,
-                                       Tools=Tools)
-
-ToolSvc += TrigEgammaMonTool
-
-#TrigEgammaMonToolConfig.TrigEgammaMonTool()
-HLTMonManager.AthenaMonTools += [ "TrigEgammaMonTool/HLTEgammaMon" ]
-HLTMonManager.FileKey = "GLOBAL"
-
-
-    
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata-chains-run3.dat b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata-chains-run3.dat
index 8e7fca7ed1571531c6e1ccd8048fafb0c9945c07..deae3973b76bd8181dc2f076692ffdb31009eaaa 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata-chains-run3.dat
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata-chains-run3.dat
@@ -19,19 +19,14 @@ testChains = {
     "HLT_mu28_ivarmedium_L1MU20:HLT_IDTrack_MuonIso_FTF:HLT_Roi_MuonIso",
     "HLT_mu28_ivarmedium_L1MU20:HLT_IDTrack_MuonIso_IDTrig:HLT_Roi_MuonIso",
  
-    "HLT_e5_etcut_L1EM3:HLT_IDTrack_Electron_FTF",  
-    "HLT_e5_etcut_L1EM3:HLT_IDTrack_Electron_IDTrig", 
-    "HLT_e17_lhvloose_nod0_L1EM15VH:HLT_IDTrack_Electron_FTF",  
+    "HLT_e5_etcut_L1EM3:HLT_IDTrack_Electron_FTF:HLT_Roi_FastElectron",  
+    "HLT_e5_etcut_L1EM3:HLT_IDTrack_Electron_IDTrig",
+    "HLT_e17_lhvloose_nod0_L1EM15VH:HLT_IDTrack_Electron_FTF:HLT_Roi_FastElectron",
     "HLT_e17_lhvloose_nod0_L1EM15VH:HLT_IDTrack_Electron_IDTrig", 
  
-    "HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_TauCore_FTF",
     "HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_TauCore_FTF:HLT_Roi_TauCore",
-    "HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_TauIso_FTF",
     "HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_TauIso_FTF:HLT_Roi_TauIso",
-    "HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_Tau_FTF",
-    "HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_Tau_FTF:HLT_TAURoI",
-    "HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_Tau_IDTrig",
-    "HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_Tau_IDTrig:HLT_TAURoI",
+    "HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_Tau_IDTrig:HLT_Roi_TauIso",
 
     "HLT_j45_subjesgscIS_ftf_boffperf_split_L1J20:HLT_IDTrack_Bjet_FTF",
     "HLT_j45_subjesgscIS_ftf_boffperf_split_L1J20:HLT_IDTrack_Bjet_IDTrig",
diff --git a/Trigger/TrigConfiguration/TrigConfDBConnection/CMakeLists.txt b/Trigger/TrigConfiguration/TrigConfDBConnection/CMakeLists.txt
deleted file mode 100644
index bbecfb58a95c808f466e7a349123df2aadcbb68f..0000000000000000000000000000000000000000
--- a/Trigger/TrigConfiguration/TrigConfDBConnection/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-
-# Declare the package name:
-atlas_subdir( TrigConfDBConnection )
-
-# External dependencies:
-find_package( Frontier_Client )
-find_package( Python COMPONENTS Development )
-find_package( Boost COMPONENTS filesystem thread system
-              OPTIONAL_COMPONENTS python${Python_VERSION_MAJOR}${Python_VERSION_MINOR} )
-
-# Component(s) in the package:
-atlas_add_library( TrigConfDBConnection
-                   src/*.cxx
-                   PUBLIC_HEADERS TrigConfDBConnection
-                   PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${FRONTIER_CLIENT_INCLUDE_DIRS} ${Python_INCLUDE_DIRS}
-                   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${FRONTIER_CLIENT_LIBRARIES} ${Python_LIBRARIES} )
-
-atlas_add_library( TrigConfDBFrontier
-                   src/*.cxx
-                   PUBLIC_HEADERS TrigConfDBConnection
-                   PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${FRONTIER_CLIENT_INCLUDE_DIRS} ${Python_INCLUDE_DIRS}
-                   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${FRONTIER_CLIENT_LIBRARIES} ${Python_LIBRARIES} )
-
-
-atlas_add_executable( TriggerFrontierClientTest
-                      src/exe/TriggerFrontierClientTest.cxx
-                      INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${FRONTIER_CLIENT_INCLUDE_DIRS} ${Python_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${Boost_LIBRARIES} ${FRONTIER_CLIENT_LIBRARIES} ${Python_LIBRARIES} TrigConfDBConnection )
-
-# Install files from the package:
-atlas_install_python_modules( python/*.py
-                              POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/Trigger/TrigConfiguration/TrigConfDBConnection/TrigConfDBConnection/HelloWorld.h b/Trigger/TrigConfiguration/TrigConfDBConnection/TrigConfDBConnection/HelloWorld.h
deleted file mode 100644
index 4e035cbc1b8a1cfa24d8e0f59e1e9233cf9b71f6..0000000000000000000000000000000000000000
--- a/Trigger/TrigConfiguration/TrigConfDBConnection/TrigConfDBConnection/HelloWorld.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef HelloWorld_h
-#define HelloWorld_h
-
-#include <string>
-
-class HelloWorld {
-public:
-   HelloWorld();
-   HelloWorld(const std::string& s);
-   virtual ~HelloWorld();
-
-   void greetings();
-   void setGreetings(const std::string& s);
-   void setStrPtr(const std::string* p);
-
-private:
-
-   std::string m_message;
-
-};
-
-#endif
diff --git a/Trigger/TrigConfiguration/TrigConfDBConnection/python/__init__.py b/Trigger/TrigConfiguration/TrigConfDBConnection/python/__init__.py
deleted file mode 100644
index fb371954d109441dbb60525991778e35647f9173..0000000000000000000000000000000000000000
--- a/Trigger/TrigConfiguration/TrigConfDBConnection/python/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-
diff --git a/Trigger/TrigConfiguration/TrigConfDBConnection/python/frontier_client.py b/Trigger/TrigConfiguration/TrigConfDBConnection/python/frontier_client.py
deleted file mode 100755
index deab009a818491e31e5a36a43c5ca76fb939f60b..0000000000000000000000000000000000000000
--- a/Trigger/TrigConfiguration/TrigConfDBConnection/python/frontier_client.py
+++ /dev/null
@@ -1,124 +0,0 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-
-from libTrigConfDBFrontier import Session as _Session
-from libTrigConfDBFrontier import AnyData as __AnyData
-
-import libTrigConfDBFrontier as libF
-import sys
-
-class AnyData(__AnyData):
-    def __str__(self):
-        return "%s %s" % (self.type(), self.getString() )
-
-
-class Session:
-
-    def __getattr__(self,name):
-        # forward all calls to self.__session
-        if name in dir(self.__session):
-            return getattr(self.__session,name)
-        raise AttributeError("Session instance does not attribute %s" % name)
-
-    def __init__(self, conn):
-        self.__fieldNames = []
-        self.__fieldTypeStr = []
-        self.__fieldType = []
-        self.__numberOfFields = 0
-        self.__records = []
-        self.__session = _Session(conn)
-
-    def getData(self, requests):
-        self.__session.getData(requests)
-        self.__getHeader()
-        self.__getAllFields()
-        
-
-    def getHeader(self):
-        return (self.__fieldNames,self.__fieldTypeStr)
-
-
-    def getRecords(self):
-        return self.__records
-
-
-    def getRecords2(self):
-        return ( self.__mapRecord(record) for record in self.__records )
-
-
-    def __mapRecord(self,record):
-        return tuple( [ t(r) for (r,t) in zip(record,self.__fieldType) ] )
-        
-
-
-    def printHeader(self):
-        for i, (fname, ftype) in enumerate(zip(self.__fieldNames,self.__fieldTypeStr)):
-            print("%2i :  %-20s %-10s" % (i+1, fname, ftype))
-
-
-    def printRecords(self):
-        for i,record in enumerate(self.getRecords()):
-            print("record %4i :  %r" % (i+1, record))
-
-
-    def printRecords2(self):
-        for i,record in enumerate(self.getRecords2()):
-            print("record %4i :  %r" % (i+1, record))
-
-
-    def getNumberOfFields(self):
-        return self.__numberOfFields
-
-
-    def __getHeader(self):
-        self.__fieldNames = []
-        self.__fieldTypeStr = []
-        self.__fieldType = []
-        self.__numberOfFields = 0
-        # jump to start
-        self.__session.setCurrentLoad(1)
-        # read first field and move 
-        self.__session.next()
-        # and then the rest
-        while not self.isEOR():
-            self.__fieldNames     += [self.__session.assignString()]
-            self.__fieldTypeStr     += [self.__session.assignString()]
-            if self.__fieldTypeStr[-1].startswith("NUMBER"):
-                if ",0" in self.__fieldTypeStr[-1]:
-                    self.__fieldType += [int]
-                else:
-                    self.__fieldType += [float]
-            elif self.__fieldTypeStr[-1].startswith("VARCHAR"):
-                self.__fieldType += [str]
-            else:
-                self.__fieldType += [str]
-            self.__numberOfFields += 1
-
-
-    def __getAllFields(self):
-        self.__records = []
-
-        ad = AnyData()
-        while self.next():
-            record = tuple()
-            for k in range(self.__numberOfFields):
-                self.getAnyData(ad)
-                if   ad.type()==libF.BLOB_TYPE_INT4:        record += (ad.getInt(),)
-                elif ad.type()==libF.BLOB_TYPE_INT8:        record += (ad.getLongLong(),)
-                elif ad.type()==libF.BLOB_TYPE_FLOAT:       record += (ad.getFloat(),)
-                elif ad.type()==libF.BLOB_TYPE_DOUBLE:      record += (ad.getDouble(),)
-                elif ad.type()==libF.BLOB_TYPE_TIME:        record += (ad.getLongLong(),)
-                elif ad.type()==libF.BLOB_TYPE_ARRAY_BYTE:
-                    if not ad.getRawStrP():        record += ('NULL',)
-                    elif (ad.getRawStrS() == 0):   record += ('',)
-                    else:                          record += ('%s' % libF.str_escape_quota(ad.getString()),)
-                else: 
-                    print("Error: unknown typeId %d" % ad.type())
-                    sys.exit(1)
-                ad.clean()
-
-            self.__records += [record]
-            ad.clean()
-
-        if not self.isEOF():
-            print("Error: must be EOF here")
-            sys.exit(1)
diff --git a/Trigger/TrigConfiguration/TrigConfDBConnection/src/Bindings.cxx b/Trigger/TrigConfiguration/TrigConfDBConnection/src/Bindings.cxx
deleted file mode 100644
index 8be99d2cec61d9eac86371eebfee4a6bb26f5625..0000000000000000000000000000000000000000
--- a/Trigger/TrigConfiguration/TrigConfDBConnection/src/Bindings.cxx
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include <boost/python.hpp>
-
-#include "frontier_client/frontier-cpp.h"
-#include <iostream>
-
-namespace {
-   std::string escape_list="\\\'";
-   std::string
-   str_escape_quota(const std::string& str_orig) {
-      std::string str(str_orig);
-      std::string::size_type pos = 0;
-      for(;;) {
-         pos=str.find_first_of(escape_list,pos);
-         if(pos==str.npos) break;
-         str.insert(pos,1,'\\');    
-         pos+=2;
-      }
-      return str;
-   }
-}
-
-
-void getData(frontier::Session& s, const boost::python::list& l) {
-   typedef std::vector<const frontier::Request*> RequestList;
-   typedef std::vector<const frontier::Request*> RequestValueTypoe;
-
-   RequestList cl;
-
-   PyObject *obj_ptr = l.ptr();
-   boost::python::handle<> obj_iter(PyObject_GetIter(obj_ptr));
-   for(std::size_t i=0;;i++) {
-      boost::python::handle<> 
-         py_elem_hdl(boost::python::allow_null(PyIter_Next(obj_iter.get())));
-      
-      if (PyErr_Occurred()) boost::python::throw_error_already_set();
-      if (!py_elem_hdl.get()) break; // end of iteration
-
-      boost::python::object py_elem_obj(py_elem_hdl);
-      boost::python::extract<const frontier::Request*> elem_proxy(py_elem_obj);
-
-      bool success = elem_proxy.check();
-      if (success) {
-         cl.push_back(elem_proxy());
-      } else if (i == 0) {
-         break;
-      } else {
-         PyErr_SetString(PyExc_TypeError, "All items must be of same type.");
-         boost::python::throw_error_already_set();
-      }
-   }
-   s.getData(cl);
-}
-
-// // Determine if obj_ptr can be converted in a QString
-//   static void* convertible(PyObject* obj_ptr)
-//     {
-//       if (!PyString_Check(obj_ptr)) return 0;
-//       return obj_ptr;
-//     }
-
-
-PyObject*
-assignString(frontier::Session& s) {
-   std::string fieldvalue;
-   s.assignString(&fieldvalue);
-   return PyUnicode_FromString(fieldvalue.c_str());
-}
-
-
-frontier::AnyData anydata;
-
-boost::python::object class_anydata;
-
-// frontier::AnyData
-// getAnyData1(frontier::Session& s, int not_eor) {
-//    s.getAnyData(&anydata, not_eor);
-//    return anydata; 
-// }
-
-// frontier::AnyData
-// getAnyData11(frontier::Session& s) { return getAnyData1(s,1); }
-
-int
-getAnyData2(frontier::Session & s, frontier::AnyData & anydata, int not_eor) {
-   return s.getAnyData(&anydata, not_eor);
-}
-
-int
-getAnyData21(frontier::Session & s, frontier::AnyData & anydata) { return getAnyData2(s, anydata, 1); }
-
-
-PyObject*
-getString(frontier::AnyData& data) {
-   std::string* str = data.getString();
-   if(str==0) return 0;
-   return PyUnicode_FromString(data.getString()->c_str());
-}
-
-
-enum BLOB_TYPE {
-   BLOB_TYPE_BYTE       = 0,
-   BLOB_TYPE_INT4       = 1,
-   BLOB_TYPE_INT8       = 2,
-   BLOB_TYPE_FLOAT      = 3,
-   BLOB_TYPE_DOUBLE     = 4,
-   BLOB_TYPE_TIME       = 5,
-   BLOB_TYPE_ARRAY_BYTE = 6,
-   BLOB_TYPE_EOR        = 7,
-   BLOB_TYPE_NONE       = (1<<7),
-   BLOB_BIT_NULL        = (1<<7)
-};
-
-
-BOOST_PYTHON_MODULE(libTrigConfDBFrontier)
-{
-   using namespace boost::python;
-
-   /***
-    * function frontier::init
-    ***/
-   int (*init1)() = &frontier::init;
-   int (*init2)(const std::string&, const std::string&) = &frontier::init;
-
-   def("init", init1, "Initializes frontier client.");
-   def("init", init2, 
-       "Initializes frontier client. \nloglevel can can be 'nolog', 'error', 'info' or 'warning' (which are equivalent), or anything else (treated as 'debug')",
-       args("logfilename", "loglevel"));
-   def("str_escape_quota", str_escape_quota, "add \\ before any \\\'", args("string"));
-   def("getFieldTypeName", frontier::getFieldTypeName, "returns string representation of field type", args("BLOB_TYPE"));
-
-
-   /***
-    * class frontier::Connection
-    ***/
-   class_<frontier::Connection>("Connection", init<const std::string&, const std::string*>("Connection with server url and proxy url", args("self","serverurl","proxyurl")) )
-      .def(init<const std::string&>("Connection with server url.", args("self","serverurl")))
-      .def(init<const std::list<std::string>&, const std::list<std::string>&>("Connection with list of server urls and list of proxy urls",args("self","serverurl","proxyurl")))
-      .def("setReload", &frontier::Connection::setReload)
-      .def("setDefaultParams", &frontier::Connection::setDefaultParams)
-      ;
-
-
-   /***
-    * To do the list wrapping we have two choices:
-    *   * wrap them with class_<> ourself or
-    *   * write to_python_converter() and some wrappers to extract<data> from python. 
-    * Our goal is to get to the working prototype as soon as we can. So in simplistic (a) approach 
-    * A full flexed wrapper is long and expensive, e.g. http://cci.lbl.gov/cctbx_sources/scitbx/array_family/boost_python/flex_wrapper.h
-    ***/
-
-
-   /***
-    * class frontier::Session
-    ***/
-
-   //BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getAnyData_overloads, frontier::Session::getAnyData, 1, 2)
-   //BOOST_PYTHON_FUNCTION_OVERLOADS(getAnyData2_overloads, getAnyData2, 2, 3)
-      //    int (*init1)() = &frontier::init;
-      //    int (*init2)(const std::string&, const std::string&) = &frontier::init;
-
-
-   class_<frontier::Session>("Session", init<frontier::Connection*>() )
-      .def("getData", &getData)
-      .def("next", &frontier::Session::next)
-      .def("isEOR", &frontier::Session::isEOR)
-      .def("isEOF", &frontier::Session::isEOF)
-      .def("assignString", &assignString)
-      .def("getNumberOfRecords", &frontier::Session::getNumberOfRecords)
-      .def("getRecNum", &frontier::Session::getRecNum)
-      .def("setCurrentLoad", &frontier::Session::setCurrentLoad,
-           "Each Request generates a payload. Payload numbers started with 1.\nSo, to get data for the first Request call setCurrentLoad(1)",
-           args("self","n"))
-      .def("getAnyData", &frontier::Session::getAnyData)
-//       .def("getAnyData", &getAnyData1)
-//       .def("getAnyData", &getAnyData11)
-      .def("getAnyData", &getAnyData2)
-      .def("getAnyData", &getAnyData21)
-      ;
-
-   /***
-    * enum frontier::BLOB_TYPE
-    ***/
-   enum_<BLOB_TYPE>("BLOB_TYPE")
-      .value("BLOB_TYPE_BYTE",       BLOB_TYPE_BYTE      )
-      .value("BLOB_TYPE_INT4",       BLOB_TYPE_INT4      )
-      .value("BLOB_TYPE_INT8",       BLOB_TYPE_INT8      )
-      .value("BLOB_TYPE_FLOAT",      BLOB_TYPE_FLOAT     )
-      .value("BLOB_TYPE_DOUBLE",     BLOB_TYPE_DOUBLE    )
-      .value("BLOB_TYPE_TIME",       BLOB_TYPE_TIME      )
-      .value("BLOB_TYPE_ARRAY_BYTE", BLOB_TYPE_ARRAY_BYTE)
-      .value("BLOB_TYPE_EOR",        BLOB_TYPE_EOR       )
-      .value("BLOB_TYPE_NONE",       BLOB_TYPE_NONE      )
-      .value("BLOB_BIT_NULL",        BLOB_BIT_NULL       )
-      .export_values()
-      ;
-
-   /***
-    * enum frontier::encoding_t
-    ***/
-   enum_<frontier::encoding_t>("encoding_t")
-      .value("BLOB", frontier::BLOB)
-      .export_values()
-      ;
-
-   /***
-    * class frontier::AnyData
-    ***/
-   class_anydata = class_<frontier::AnyData>("AnyData")
-      .def("type",       &frontier::AnyData::type,        "type of data field")
-      .def("getRawI8",   &frontier::AnyData::getRawI8,    "type long long")
-      .def("getRawD",    &frontier::AnyData::getRawD,     "type double")
-      .def("getRawStrP", &frontier::AnyData::getRawStrP,  "type string")
-      .def("getRawStrS", &frontier::AnyData::getRawStrS,  "type unsigned int")
-      .def("getRawI4",   &frontier::AnyData::getRawI4,    "type int")
-      .def("getRawF",    &frontier::AnyData::getRawF,     "type float")
-      .def("getRawB",    &frontier::AnyData::getRawB,     "type char")
-      .def("getInt",     &frontier::AnyData::getInt,      "cast to type int")
-      .def("getLongLong",&frontier::AnyData::getLongLong, "cast to type long long")
-      .def("getFloat",   &frontier::AnyData::getFloat,    "cast to type float")
-      .def("getDouble",  &frontier::AnyData::getDouble,   "cast to type double")
-      .def("getString",  &getString,                      "cast to type string")
-      .def("clean",      &frontier::AnyData::clean,       "clean data")
-      ;
-
-   /***
-    * class frontier::Request
-    ***/
-   object class_req = class_<frontier::Request>("Request", init<const std::string&, frontier::encoding_t>() )
-      .def("addKey", &frontier::Request::addKey, "", args("self", "key", "value"))
-      .def("encodeParam", &frontier::Request::encodeParam, "", args("value"))
-      .def("setRetrieveZipLevel", &frontier::Request::setRetrieveZipLevel,
-           "Set the zip level of retrieved data\nlevel 0 is off, level 1 is fast, level 5 is normal, level 9 is best\ndefault is 5",
-           args("level"))
-      .staticmethod("encodeParam")
-      .staticmethod("setRetrieveZipLevel")
-      ;
-
-
-
-}
diff --git a/Trigger/TrigConfiguration/TrigConfDBConnection/src/HelloWorld.cxx b/Trigger/TrigConfiguration/TrigConfDBConnection/src/HelloWorld.cxx
deleted file mode 100644
index 95fa07a932bb84f509c0867d778f02a7ed4a8789..0000000000000000000000000000000000000000
--- a/Trigger/TrigConfiguration/TrigConfDBConnection/src/HelloWorld.cxx
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "TrigConfDBConnection/HelloWorld.h"
-
-#include <iostream>
-
-HelloWorld::HelloWorld() :
-   m_message("")
-{}
-
-
-HelloWorld::HelloWorld(const std::string& s) :
-   m_message(s)
-{}
-
-
-HelloWorld::~HelloWorld()
-{}
-
-
-void
-HelloWorld::greetings()
-{
-   std::cout << m_message << std::endl;
-}
-
-
-void
-HelloWorld::setGreetings(const std::string& s) {
-   m_message = s;
-}
-
-
-void
-HelloWorld::setStrPtr(const std::string* p) {
-   m_message = *p;
-}
-
-
diff --git a/Trigger/TrigConfiguration/TrigConfDBConnection/src/HelloWorldBindings.cxx b/Trigger/TrigConfiguration/TrigConfDBConnection/src/HelloWorldBindings.cxx
deleted file mode 100644
index 3afedf181c3852203e7688e432de53677c802527..0000000000000000000000000000000000000000
--- a/Trigger/TrigConfiguration/TrigConfDBConnection/src/HelloWorldBindings.cxx
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include <boost/python.hpp>
-
-#include "TrigConfDBConnection/HelloWorld.h"
-
-
-BOOST_PYTHON_MODULE(hello_world)
-{
-   using namespace boost::python;
-   class_<HelloWorld>("HelloWorld", init<std::string>() )
-      .def("greetings", &HelloWorld::greetings)
-      .def("setGreetings", &HelloWorld::setGreetings)
-      .def("setStrPtr", &HelloWorld::setStrPtr)
-      ;
-}
diff --git a/Trigger/TrigConfiguration/TrigConfDBConnection/src/exe/TriggerFrontierClientTest.cxx b/Trigger/TrigConfiguration/TrigConfDBConnection/src/exe/TriggerFrontierClientTest.cxx
deleted file mode 100644
index 12cb6ad5174d008726cdba13715555db0af1aa19..0000000000000000000000000000000000000000
--- a/Trigger/TrigConfiguration/TrigConfDBConnection/src/exe/TriggerFrontierClientTest.cxx
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * frontier client test C++ main program that can load any query
- * 
- * Author: Sergey Kosyakov
- *
- * $Id: TriggerFrontierClientTest.cxx 696788 2015-09-25 09:17:58Z czodrows $
- *
- * Copyright (c) 2009, FERMI NATIONAL ACCELERATOR LABORATORY
- * All rights reserved. 
- *
- * For details of the Fermitools (BSD) license see Fermilab-2009.txt or
- *  http://fermitools.fnal.gov/about/terms.html
- *
- */
-#include "frontier_client/frontier-cpp.h"
-#include "frontier_client/FrontierException.hpp"
-
-#include <iostream>
-#include <fstream>
-#include <stdexcept>
-#include <cstdlib>
-#include <cstring>
-
-#include <unistd.h>
-
-static std::string escape_list="\\\'";
-static std::string req_data="frontier_request:1:DEFAULT";
-
-static void str_escape_quota(std::string *str) {
-   std::string::size_type pos = 0;
-   while(1) {
-      pos=str->find_first_of(escape_list,pos);
-      if(pos==str->npos) return;
-      //std::cout<<"pos="<<pos<<'\n';
-      str->insert(pos,1,'\\');    
-      pos+=2;
-   }
-}
-
- 
-static void print_usage(char **argv) {
-   std::cout<<"Usage: \n"<<argv[0]<<" -h\n\tPrint this info\n";
-   std::cout<<"\n"<<argv[0]<<" [-r] [-n] [-c N] [-F N] [-f file_name]\n";
-   std::cout<<"  if -f file_name is missing, reads query from stdin\n";
-   std::cout<<"  [-r] means to force a reload\n";
-   std::cout<<"  [-n] means do not print data\n";
-   std::cout<<"  [-c N] repeat the query N count times\n";
-   std::cout<<"  [-F N] fork after Nth repitition\n";
-}
- 
-
-
-int main(int argc, char **argv) {
-   //char vc;
-   int vi;
-   long long vl;
-   float vf;
-   double vd;
-   std::string stringBuf;
-   std::string *vs=&stringBuf;
-   frontier::AnyData ad;
-   char *file_name=0;
-   int do_reload=0;
-   int do_print=1;
-   int repeat_count=1;
-   int fork_count=0;
-   int idx;
-   std::string sql("");
-  
-   try {
-      frontier::init();
-
-      // check for -h
-      for(int arg_ind=1; arg_ind<argc; arg_ind++)
-         if(strcmp(argv[arg_ind],"-h")==0) {
-            print_usage(argv);
-            return 0;
-         }
-      
-
-      for(int arg_ind=1; arg_ind<argc; arg_ind++) {
-
-         const char* arg = argv[arg_ind];
-
-         if(strcmp(arg,"-r")==0) {
-            do_reload=1;
-            continue;
-         }
-         
-         if(strcmp(arg,"-n")==0) {
-            do_print=0;
-            continue;
-         }
-
-         if(strcmp(arg,"-c")==0) {
-            if(argc==++arg_ind) {
-               std::cerr << "No number specified after -c option\n";
-               return 2;
-            }
-            sscanf(argv[arg_ind],"%d",&repeat_count);
-            continue;
-         }
-
-         if(strcmp(arg,"-F")==0) {
-            if(argc==++arg_ind) {
-               std::cerr << "No number specified after -F option\n";
-               return 2;
-            }
-            sscanf(argv[arg_ind],"%d",&fork_count);
-            continue;
-         }
-
-         if(strcmp(arg,"-f")==0) {
-            if(argc==++arg_ind) {
-               std::cerr << "No file name specified after -f option\n";
-               return 2;
-            }
-            file_name=argv[arg_ind];
-            continue;
-         }
-      }
-     
-      std::ifstream in_file;
-      if(file_name) {
-         in_file.open(file_name);
-         if(!in_file.is_open()) {
-            std::cerr << "Can not open file " << file_name << '\n';
-            return 2;
-         }
-      }
-
-      while(1) {
-         std::string tmp;      
-         if(file_name) {
-            if(!in_file.good()) break;
-            std::getline(in_file,tmp,'\n');
-         } else {
-            if(!std::cin.good()) break;
-            std::getline(std::cin,tmp,'\n');       
-         }
-         sql += tmp;
-      }
-      if(file_name) {in_file.close();}
-
-      std::cout<<"Entered:\n"<<sql<<'\n';
-    
-      std::string param=frontier::Request::encodeParam(sql);
-      std::cout<<"Param ["<<param<<"]\n";
-          
-      std::list<std::string> serverList;
-      //serverList.push_back("http://lxfs6043.cern.ch:8080/Frontier3D");
-      std::list<std::string> proxyList;
-      //frontier::DataSource ds(serverList, proxyList);
-      frontier::Connection con(serverList, proxyList);
-
-      for(idx=0;idx<repeat_count;idx++) {
-         if((fork_count>0)&&(idx==fork_count))
-            fork();
-
-         frontier::Session ses(&con);
-         con.setReload(do_reload);
-
-         frontier::Request req(req_data,frontier::BLOB);
-         req.addKey("p1",param);
-
-         std::vector<const frontier::Request*> vrq;
-         vrq.push_back(&req);
-         ses.getData(vrq);
-
-         ses.setCurrentLoad(1);
-      
-         int field_num=0;
-         
-         std::cout<<"\nObject fields:\n";
-         
-         ses.next();
-         // MetaData consists of one record with filed names.
-         // Let's go over all fields:
-         std::string name,type;
-      
-         while(!ses.isEOR()) {
-            ses.assignString(&name);
-            ses.assignString(&type);
-            ++field_num;
-            std::cout<<field_num<<" "<<(name)<<" "<<(type)<<std::endl;
-         }
-
-
-         // SECOND TIME
-//          ses.setCurrentLoad(1);
-//          field_num=0;
-//          std::cout<<"\nObject fields:\n";
-//          ses.next();
-//          while(!ses.isEOR()) {
-//             ses.assignString(&name);
-//             ses.assignString(&type);
-//             ++field_num;
-//             std::cout<<field_num<<" "<<(name)<<" "<<(type)<<std::endl;
-//          }
-         // END SECOND TIME
-
-
-
-	   
-         int nrec=ses.getNumberOfRecords();
-         std::cout<<"\nResult contains "<< nrec<<" objects.\n";
-	  
-         while(ses.next()) {
-            if(!do_print)continue;
-            for(int k=0;k<field_num;k++) {
-               ses.getAnyData(&ad);
-               switch(ad.type()) {
-                  //case frontier::BLOB_TYPE_BYTE:       vc=ses.getByte(); break;
-               case frontier::BLOB_TYPE_INT4:       
-                  vi=ad.getInt(); 
-                  std::cout<<vi; 
-                  break;
-               case frontier::BLOB_TYPE_INT8:       
-                  vl=ad.getLongLong(); 
-                  std::cout<<vl; 
-                  break;
-               case frontier::BLOB_TYPE_FLOAT:      
-                  vf=ad.getFloat(); 
-                  std::cout<<vf; 
-                  break;
-               case frontier::BLOB_TYPE_DOUBLE:     
-                  vd=ad.getDouble(); 
-                  std::cout<<vd; 
-                  break;
-               case frontier::BLOB_TYPE_TIME:       
-                  vl=ad.getLongLong(); 
-                  std::cout<<vl; 
-                  break;
-               case frontier::BLOB_TYPE_ARRAY_BYTE: 
-                  if(!ad.getRawStrP()) {
-                     std::cout<<"NULL";
-                  }
-                  else if (ad.getRawStrS() == 0)
-                     std::cout<<"''"; 
-                  else if (ad.getRawStrS() > 1000)
-                     std::cout<<'('<<ad.getRawStrS()<<" byte blob)"; 
-                  else {
-                     vs=ad.getString(); 
-                     str_escape_quota(vs);
-                     std::cout<<'\''<<(*vs)<<'\''<<'('<<ad.getRawStrS()<<')'; 
-                  }
-                  break;	  
-               default: 
-                  std::cout<<"Error: unknown typeId "<<((int)(ad.type()))<<"\n"; 
-                  exit(1);
-               }
-               if(k+1<field_num) {
-                  std::cout<<" ";
-               }
-               ad.clean();
-            }
-            ad.clean();
-            std::cout<<std::endl;
-         }
-         if(!ses.isEOF()) {
-            std::cout<<"Error: must be EOF here\n";
-            exit(1);
-         }
-      }
-   }
-   catch(const frontier::ConfigurationError& e) {
-      std::cout << "Frontier configuration error caught: " << e.what() << std::endl;
-      exit(1);
-   }
-   catch(const frontier::FrontierException& e) {
-      std::cout << "Frontier exception caught: " << e.what() << std::endl;
-      exit(1);
-   }
-   catch(std::exception& e) {
-      std::cout << "Error: " << e.what() << "\n";
-      exit(1);
-   }
-   catch(...) {
-      std::cout << "Unknown exception\n";
-      exit(1);
-   }
-
-   return 0;
-}
diff --git a/Trigger/TrigConfiguration/TrigConfDBConnection/test/testFrontierClient.py b/Trigger/TrigConfiguration/TrigConfDBConnection/test/testFrontierClient.py
deleted file mode 100755
index f8cdd8aa3d1e8256a6b42edb8faa01b52077a806..0000000000000000000000000000000000000000
--- a/Trigger/TrigConfiguration/TrigConfDBConnection/test/testFrontierClient.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-def main(sql, doReload):
-
-    (ALL, VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL) = range(7)
-    from AthenaCommon.Logging import logging
-    log = logging.getLogger( "TrigConfigSvcUtils.py" )
-    log.setLevel(VERBOSE)
-
-    connection = "TRIGGERDBREPR"
-
-    from TriggerJobOpts.TriggerFlags import TriggerFlags as tf
-    tf.triggerUseFrontier = True
-
-    from TrigConfigSvc.TrigConfigSvcUtils import interpretConnection
-    connectionParameters = interpretConnection(connection)
-
-    print "Connection: ", connectionParameters
-
-    from TrigConfDBConnection import frontier_client as fc
-
-    fc.init("testFrontier.log","debug")
-
-    conn = fc.Connection(connectionParameters['url'])
-
-    session = fc.Session(conn)
-
-    conn.setReload(doReload)
-
-    req = fc.Request("frontier_request:1:DEFAULT", fc.encoding_t.BLOB)
-    param = fc.Request.encodeParam(sql)
-    req.addKey("p1",param)
-
-    session.getData([req])
-
-    session.printHeader()
-
-    nfield = session.getNumberOfFields()
-    print "\nNumber of fields:", nfield, "\n"
-
-    
-    nrec = session.getNumberOfRecords()
-    print "\nResult contains", nrec, "objects.\n"
-
-    session.printRecords2()
-
-    return 0
-
-
-
-if __name__=="__main__":
-    from sys import exit
-
-    doReload = True
-    sql = "select distinct SM.SMT_ID, SM.SMT_NAME, SM.SMT_VERSION, SM.SMT_COMMENT, SM.SMT_ORIGIN, SM.SMT_USERNAME, SM.SMT_STATUS from ATLAS_CONF_TRIGGER_REPR.SUPER_MASTER_TABLE SM"
-    
-    exit(main(sql=sql, doReload=doReload))
-    
diff --git a/Trigger/TrigConfiguration/TrigConfDBConnection/test/testHelloWorld.py b/Trigger/TrigConfiguration/TrigConfDBConnection/test/testHelloWorld.py
deleted file mode 100755
index 6b3f554ff81c514254325d45b20eabdee16da96f..0000000000000000000000000000000000000000
--- a/Trigger/TrigConfiguration/TrigConfDBConnection/test/testHelloWorld.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-
-def main():
-    from TrigConfDBConnection import frontier_client as fc
-
-    hw = fc.HelloWorld("Hello world!")
-
-    hw.greetings()
-    
-    hw.setGreetings("Hello universe!")
-    
-    hw.greetings()
-
-    hw.setStrPtr("Hello All!")
-    
-    hw.greetings()
-
-    return 0
-
-if __name__=="__main__":
-    from sys import exit
-    exit(main())
-    
diff --git a/Trigger/TrigConfiguration/TrigConfDBConnection/test/testquery.txt b/Trigger/TrigConfiguration/TrigConfDBConnection/test/testquery.txt
deleted file mode 100644
index b23d24255d683187567a20d7427dd43412ba4244..0000000000000000000000000000000000000000
--- a/Trigger/TrigConfiguration/TrigConfDBConnection/test/testquery.txt
+++ /dev/null
@@ -1 +0,0 @@
-select distinct SM.SMT_ID, SM.SMT_NAME, SM.SMT_VERSION, SM.SMT_COMMENT, SM.SMT_ORIGIN, SM.SMT_USERNAME, SM.SMT_STATUS from ATLAS_CONF_TRIGGER_REPR.SUPER_MASTER_TABLE SM
diff --git a/Trigger/TrigConfiguration/TrigConfStorage/src/L1TopoMenuLoader.cxx b/Trigger/TrigConfiguration/TrigConfStorage/src/L1TopoMenuLoader.cxx
index 769f8dbaec292d0e81f371776b2a86852395c93d..34183f582c52b94075bf4464e998791cb423d204 100644
--- a/Trigger/TrigConfiguration/TrigConfStorage/src/L1TopoMenuLoader.cxx
+++ b/Trigger/TrigConfiguration/TrigConfStorage/src/L1TopoMenuLoader.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 "L1TopoMenuLoader.h"
@@ -702,14 +702,12 @@ bool TrigConf::L1TopoMenuLoader::loadTopoConfig( TXC::L1TopoMenu& tcaTarget) {
       fillQuery(query0.get(), attList0);
       coral::ICursor& cursor0 = query0->execute();
 
-      TXC::L1TopoConfigGlobal* l1topoconfigglobal = new TXC::L1TopoConfigGlobal();
       while(cursor0.next()){
          const coral::AttributeList& row0 = cursor0.currentRow();
 
          string tc_name = row0["TC.TC_NAME"].data<string>();
          string tc_value = row0["TC.TC_VALUE"].data<string>();
 
-         l1topoconfigglobal->addTopoConfigElement(tc_name,tc_value);
          tcaTarget.addL1TopoConfigGlobal(TXC::TopoConfigElement(tc_name,tc_value));
       }
 
diff --git a/Trigger/TrigConfiguration/TrigConfStorage/src/LogicExpression.cxx b/Trigger/TrigConfiguration/TrigConfStorage/src/LogicExpression.cxx
index 1f077490875a2a50d844ff1fec3e4860d5727399..385a070811f7358a3a4066f82ee2819c21c76abb 100755
--- a/Trigger/TrigConfiguration/TrigConfStorage/src/LogicExpression.cxx
+++ b/Trigger/TrigConfiguration/TrigConfStorage/src/LogicExpression.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 "./LogicExpression.h"
@@ -25,7 +25,9 @@ LogicExpression::LogicExpression(const std::string& name, std::ostream & o)
 {}
 
 
-LogicExpression::~LogicExpression() {}
+LogicExpression::~LogicExpression()
+{
+}
 
 
 bool
@@ -295,6 +297,9 @@ LogicExpression::print(const std::string& indent) const {
 void
 LogicExpression::clear() {
    m_State = kELEMENT;
+   for (LogicExpression* e : m_SubLogics) {
+     delete e;
+   }
    m_SubLogics.clear();
    m_Element = "";
 }
diff --git a/Trigger/TrigConfiguration/TrigConfStorage/src/ThresholdConfigLoader.cxx b/Trigger/TrigConfiguration/TrigConfStorage/src/ThresholdConfigLoader.cxx
index 40d7d496d29bbf57e59dbcd825ce1d108e2f981b..1a136dd22ac8cb86b94d742e3cd73d09c7995976 100755
--- a/Trigger/TrigConfiguration/TrigConfStorage/src/ThresholdConfigLoader.cxx
+++ b/Trigger/TrigConfiguration/TrigConfStorage/src/ThresholdConfigLoader.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 "./ThresholdConfigLoader.h"
@@ -416,7 +416,7 @@ bool TrigConf::ThresholdConfigLoader::load( ThresholdConfig& thrConfig ) {
             //tt->setNumberofValues(numberofvalues);
             // trigger thresholds sorted by type
             thrConfig.addTriggerThreshold(tt);
-            tt = new TriggerThreshold();
+            tt = nullptr;
          }
 
          nRowsLoop2 = row["TT.L1TT_ID"].data<int>();
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfFrontier.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfFrontier.py
index 0af22a9bbeb2f3a7dba0397b3a87bfbbb56f8a16..bf9554b7d67ccef00976a697c4dff72579f7984c 100755
--- a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfFrontier.py
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfFrontier.py
@@ -1,28 +1,11 @@
 #!/usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-
-from __future__ import print_function
-
-from future import standard_library
-standard_library.install_aliases()
-from builtins import map
-from builtins import str
-from builtins import zip
-from builtins import object
 from AthenaCommon.Logging import logging
 import time
 import sys
 
 
-# useFrontierClient 
-# True: one uses the python bindings of frontier_client from the TrigConfDBConnection package
-# False: one uses a purely python-based implementation
-useFrontierClient = False
-
-
 def getServerUrls(frontier_servers):
     """
     turns
@@ -66,29 +49,9 @@ def getFrontierCursor(url, schema, loglevel = logging.INFO):
         return None
     else:
         log.info(f"Will use Frontier server at {url}")
-    if useFrontierClient:
-        log.info("Using frontier_client from TrigConfDBConnection")
-        return FrontierCursor2( url = url, schema = schema)
-    else:
-        log.info("Using a pure python implementation of frontier")
-        return FrontierCursor( url = url, schema = schema)
+
+    return FrontierCursor( url = url, schema = schema)
         
-# used by FrontierCursor2
-def resolvebindvars(query, bindvars):
-    """Replaces the bound variables :xyz with a ? in the query and
-    adding the value behind a : at the end"""
-    log = logging.getLogger( "TrigConfFrontier.py" )
-    log.info("Query: %s", query)
-    log.info("bound variables: %r", bindvars)
-    import re
-    varsextract = re.findall(':([A-z0-9]*)',query)
-    values = list(map(bindvars.get, varsextract))
-    log.debug("Resolving bound variable %r with %r", varsextract,values)
-    appendix = ":".join([str(v) for v in values])
-    queryWithQuestionMarks = re.sub(':[A-z0-9]*','?', query)
-    query = queryWithQuestionMarks + ':' + appendix
-    log.info("Resolved query new style: %s", query)
-    return query
 
 # used by FrontierCursor
 def replacebindvars(query, bindvars):
@@ -109,76 +72,6 @@ def replacebindvars(query, bindvars):
     return query
 
 
-            
-
-
-class FrontierCursor2(object):
-    def __init__(self, url, schema, refreshFlag=False):
-        log = logging.getLogger( "TrigConfFrontier.py" )
-        self.url = url
-        self.schema = schema
-        self.refreshFlag = refreshFlag
-        from TrigConfDBConnection import frontier_client as fc
-        fc.init("PyFrontier","debug")
-        log.debug("Frontier URL      : %s", self.url)
-        log.debug("Schema            : %s", self.schema)
-        log.debug("Refresh cache     : %s", self.refreshFlag)
-
-
-    def execute(self, query, bindvars={}):
-        if len(bindvars)>0:
-            query = resolvebindvars(query,bindvars)
-            
-        from TrigConfDBConnection import frontier_client as fc
-        log = logging.getLogger( "TrigConfFrontier.py" )
-        log.debug("Executing query : %s", query)
-
-        conn = fc.Connection(self.url)
-        session = fc.Session(conn)
-
-        doReload = self.refreshFlag
-        conn.setReload(doReload)
-        
-        queryStart = time.localtime()
-        log.debug("Query started: %s", time.strftime("%m/%d/%y %H:%M:%S %Z", queryStart))
-
-        t1 = time.time()
-        req = fc.Request("frontier_request:1:DEFAULT", fc.encoding_t.BLOB)
-        param = fc.Request.encodeParam(query)
-        req.addKey("p1",param)
-        
-        session.getData([req])
-        t2 = time.time()
-
-        #session.printHeader()
-        
-        #nfield = session.getNumberOfFields()
-        #print ("\nNumber of fields:", nfield, "\n")
-    
-        #nrec = session.getNumberOfRecords()
-        #print ("\nResult contains", nrec, "objects.\n")
-        
-        #session.printRecords2()
-        queryEnd = time.localtime()
-        
-        self.result = [r for r in session.getRecords2()]
-        log.debug("Query ended: %s", time.strftime("%m/%d/%y %H:%M:%S %Z", queryEnd))
-        log.debug("Query time: %s seconds", (t2-t1))
-        log.debug("Result size: %i entries", len(self.result))
-            
-    def fetchall(self):
-        return self.result
-
-    def __str__(self):
-        s =  "FrontierCursor2:\n"
-        s += "Using Frontier URL: %s\n" % self.url
-        s += "Schema: %s\n" % self.schema
-        s += "Refresh cache:  %s" % self.refreshFlag
-        return s
-
-
-
-    
 class FrontierCursor(object):
     def __init__(self, url, schema, refreshFlag=False, doDecode=True, retrieveZiplevel="zip"):
         self.url = url + "/Frontier"
@@ -202,7 +95,7 @@ class FrontierCursor(object):
         log.debug("Refresh cache : %s", self.refreshFlag)
         log.debug("Query         : %s", query)
         
-        import base64, zlib, urllib.request, urllib.error, urllib.parse, time
+        import base64, zlib, urllib.request, urllib.error, urllib.parse
 
         self.result = None
 
@@ -338,11 +231,6 @@ def testQuery(query, bindvars):
         return 1
     return 0
 
-
-def testBindVarResolution(query, bindvars):
-    resolvebindvars(query, bindvars)
-    return 0
-
     
 if __name__=="__main__":
     log = logging.getLogger( "TrigConfFrontier.py" )
@@ -352,6 +240,5 @@ if __name__=="__main__":
     query = "select distinct HPS.HPS_NAME from ATLAS_CONF_TRIGGER_RUN2_MC.HLT_PRESCALE_SET HPS where HPS.HPS_ID = :psk"
     bindvars = { "psk": 260 }
 
-    res = testBindVarResolution(query, bindvars) # query resolution for c++ frontier client
-    res = max(res, testQuery(query, bindvars)) # pure python frontier query
+    res = testQuery(query, bindvars)  # pure python frontier query
     sys.exit(res)
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AllJetsGrouper.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AllJetsGrouper.h
index 47cdba67e25b3dad7025dcccf721bae6d73f2e9d..ee90f693005753a07f5bdbc5faff623a626cc9ae 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AllJetsGrouper.h
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AllJetsGrouper.h
@@ -10,13 +10,13 @@
 class AllJetsGrouper: public IJetGrouper{
  public:
   AllJetsGrouper();
-  AllJetsGrouper(const HypoJetIter& b, const HypoJetIter& e);
+  AllJetsGrouper(const HypoJetCIter& b, const HypoJetCIter& e);
   AllJetsGrouper(const HypoJetVector&);
   
   std::vector<HypoJetGroupVector> group(HypoJetIter&,
 					HypoJetIter&) const override;
   
-  virtual std::optional<HypoJetGroupVector> next() override;
+  virtual std::optional<HypoJetVector> next() override;
   
   std::string getName() const override; 
   std::string toString() const override;
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/CombinationsGrouper.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/CombinationsGrouper.h
index 57f5f57d3a091299d112f793eaee4943df6a2a16..7f573fbb795ea22a97b6bb03b914fb4915cd9f47 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/CombinationsGrouper.h
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/CombinationsGrouper.h
@@ -22,7 +22,7 @@ class CombinationsGrouper: public IJetGrouper{
   
   std::vector<HypoJetGroupVector> group(HypoJetIter&,
 					HypoJetIter&) const override;
-  std::optional<HypoJetGroupVector> next() override;
+  std::optional<HypoJetVector> next() override;
 
   std::string getName() const override; 
   std::string toString() const override;
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/IJetGrouper.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/IJetGrouper.h
index 5830516dece0a3cebb3cfb0e2a479cd43f06e47e..02ff057f2e8891bf767fb075bbe8e16726376c93 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/IJetGrouper.h
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/IJetGrouper.h
@@ -25,7 +25,7 @@ class IJetGrouper{
    */
   virtual std::vector<HypoJetGroupVector> group(HypoJetIter&,
 						HypoJetIter&) const = 0;
-  virtual std::optional<HypoJetGroupVector> next() = 0;
+  virtual std::optional<HypoJetVector> next() = 0;
   virtual std::string toString() const = 0; 
   virtual std::string getName() const = 0; 
 };
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/IndexedJetsGrouper.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/IndexedJetsGrouper.h
index e26d29639fe834fea8aefe375a13160799005102..670478e06c8757ec3717334fc8dc4b4908ae1507 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/IndexedJetsGrouper.h
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/IndexedJetsGrouper.h
@@ -36,7 +36,7 @@ public:
   std::vector<HypoJetGroupVector>
   group(HypoJetIter&, HypoJetIter&) const override;
   
-  std::optional<HypoJetGroupVector> next() override;
+  std::optional<HypoJetVector> next() override;
       
   std::string getName() const override;
   std::string toString() const override;
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/SingleJetGrouper.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/SingleJetGrouper.h
index 5d0b474276c72be54531855b3e134cd85978b2a1..11323f411f1a5cb63ef8e677daa9ec7f2e446925 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/SingleJetGrouper.h
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/SingleJetGrouper.h
@@ -16,13 +16,13 @@ class SingleJetGrouper: public IJetGrouper{
   std::vector<HypoJetGroupVector> group(HypoJetIter&,
 					HypoJetIter&) const override;
 
-  std::optional<HypoJetGroupVector> next() override;
+  std::optional<HypoJetVector> next() override;
   std::string getName() const override; 
   std::string toString() const override;
 
 private:
-  HypoJetVector m_jets;
-  std::size_t m_size;
+  HypoJetVector m_jets{};
+  std::size_t m_size{0};
   std::size_t m_index{0};
 };
 #endif
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ChainLabelParser.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ChainLabelParser.py
index ae90f265012bb6015ad65fad5e4455c31b3aa237..94504552e8862f4e05cf6cb60ed5adf572026ceb 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ChainLabelParser.py
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ChainLabelParser.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
 from __future__ import absolute_import
 
@@ -304,18 +304,12 @@ class ChainLabelParser(object):
             print('error, stack size', len(self.tree), 'expected 2')
             print(self.state_history)
             
-        if len(self.tree[0].children) != 1:
-            error = True
-            print('error, top node has %d cdildren, expected 1' % (
-                len(self.tree[0].children)))
 
         final_state = 'end_scenario'
         if self.state != final_state:
             error = True
             print('error: final state is %s, expected %s' % (self.state,
                                                              final_state))
-        # print 'tree dump:'
-        # print self.tree[0].dump()
         print('parse', end=' ')
         if not error:
             print('succeeded')
@@ -331,8 +325,8 @@ class ChainLabelParser(object):
         for c in self.tree[0].children:
             c.tree_top = True
 
-        # for now (02/01/2019), no reco. First tree is only tree is hypo
-        return self.tree[0].children[0]
+        # return hypo forest (>= 1 trees)
+        return self.tree[0].children
 
 def _test(s):
     from TrigHLTJetHypo.ChainLabelParser import ChainLabelParser
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterFastReduction.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterFastReduction.py
index 656f8236623fa0ee0a1a2347685f7bbf6e05ff69..7fa8f35d5a57ca42da7929c193fdc88781fdb5d8 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterFastReduction.py
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ConditionsToolSetterFastReduction.py
@@ -5,8 +5,8 @@ from a hypo tree."""
 
 from __future__ import print_function
 
-
-from AthenaConfiguration.ComponentFactory import CompFactory
+from TrigHLTJetHypo.FastReductionAlgToolFactory import (
+    FastReductionAlgToolFactory,)
 
 from collections import defaultdict
 
@@ -14,7 +14,7 @@ from AthenaCommon.Logging import logging
 log = logging.getLogger( 'ConditionsToolSetterFastReduction' )
 
 def is_leaf(node):
-    return node.scenario in  ('simple', 'etaet', 'dijet', 'qjet')
+    return node.scenario in  ('simple', 'etaet', 'dijet', 'qjet', 'agg')
 
 
 def is_inner(node):
@@ -26,35 +26,11 @@ class ConditionsToolSetterFastReduction(object):
 
     """Visitor to set instantiated AlgTools to a jet hypo tree"""
 
-    JetMoments = {
-        'emfrac'  : 'EMFrac',
-        'hecfrac' : 'HECFrac',
-    }
 
     def __init__(self):
 
-        # for simple, use TrigJetConditionConfig_etaet. Needs to be
-        # completed because simple can conain any single jet condition
-        self.tool_factories = {
-            'eta': [CompFactory.TrigJetConditionConfig_abs_eta, 0], 
-            'peta': [CompFactory.TrigJetConditionConfig_signed_eta, 0],
-            'neta': [CompFactory.TrigJetConditionConfig_signed_eta, 0],
-            'et': [CompFactory.TrigJetConditionConfig_et, 0],
-            'djmass': [CompFactory.TrigJetConditionConfig_dijet_mass, 0],
-            'djdphi': [CompFactory.TrigJetConditionConfig_dijet_dphi, 0],
-            'djdeta': [CompFactory.TrigJetConditionConfig_dijet_deta, 0],
-            'qjmass': [CompFactory.TrigJetConditionConfig_qjet_mass, 0],
-            'smc': [CompFactory.TrigJetConditionConfig_smc, 0],
-            'jvt': [CompFactory.TrigJetConditionConfig_jvt, 0],
-            'all': [CompFactory.TrigJetConditionConfig_acceptAll, 0],
-            'capacitychecked':
-            [CompFactory.TrigJetConditionConfig_capacitychecked, 0],
-            'fastreduction': [CompFactory.TrigJetHypoToolConfig_fastreduction, 0],
-            'helper': [CompFactory.TrigJetHypoToolHelperMT, 0],
-            }
-        for var in self.JetMoments:
-            self.tool_factories['mom'+var] = [CompFactory.TrigJetConditionConfig_moment, 0]
-
+        self.algToolFactory = FastReductionAlgToolFactory()
+ 
         # map conaining parent child ids for the node
         self.treeMap = {0: 0}
 
@@ -70,19 +46,63 @@ class ConditionsToolSetterFastReduction(object):
             self._set_conditions(cn)
 
 
- 
-    def _get_tool_instance(self, key, extra=''):
-   
-        klass = self.tool_factories[key][0]
-        sn = self.tool_factories[key][1]
+    def _make_el_condition_tools(self, conf_dict):
+        """conf_dict: a dict containing names of elemental conditions 
+        and min, max valies. These will be used to instantiate
+        conditon building AlgTools, one for eac conditon 
+
+        for 2j80_2j60, the dictionaries are:
+        {'et': {'min': '80000.0', 'max': 'inf'}, 
+        'eta': {'min': '0.0', 'max': '3.2'}}
+
+        and 
+
+
+        {'et': {'min': '60000.0', 'max': 'inf'}, 
+        'eta': {'min': '0.0', 'max': '3.2'}})
+        
+        """
+
+        condition_tools = [] # a list of AlgTools that build elemental Conds.
         
-        name = '%s_%d_fn' % (key, sn)
-        if extra: name += '_' + extra
-        tool = klass(name=name)            
-        self.tool_factories[key][1] += 1
-        return tool
+        for k, v in conf_dict.items(): # loop over elemental conditions
+            # k in the condition name, v contains its min, max values.
+
+            # create the AlgTool that will build the elemental condition
+            condition_tool = self.algToolFactory(k) 
+            for lim, val in v.items():  # lim: min, max
+                setattr(condition_tool, lim, val)
+
+            # SPECIAL CASE: Moment tool needs the name of the
+            # moment as well as the min. max cuts:
+            if (k.startswith ('mom')):
+                moment = k[len('mom'):]
+                if moment in self.JetMoments:
+                    condition_tool.moment = self.JetMoments[moment]
+                else: raise RuntimeError('%s not supported' % (moment))
+
+            # END SPECIAL CASE
+
+            condition_tools.append(condition_tool)
+
+        return condition_tools
 
+    
     def _make_compound_condition_tools(self, node):
+        """For each element of  node.conf_attrs, construct a 
+        CapacityChecledCondition. Example for chain HLT_2j80_3j60_L1J15:
+
+        First leaf node has 
+        conf_attrs [1]:
+        (defaultdict(<class 'dict'>, {
+        'et': {'min': '80000.0', 'max': 'inf'}, 
+        'eta': {'min': '0.0', 'max': '3.2'}}), 2)
+
+        Second leaf node has 
+        conf_attrs [1]:
+        (defaultdict(<class 'dict'>, {'et': {'min': '60000.0', 'max': 'inf'}, 
+        'eta': {'min': '0.0', 'max': '3.2'}}), 3)
+        """
 
         #  compound_condition_tools:
         # elemental condition maker AlgToolshelper by the compound condition
@@ -99,43 +119,49 @@ class ConditionsToolSetterFastReduction(object):
                 cpi = node.chainpartinds[i][0]
                 assert mult == node.chainpartinds[i][1]
                     
-                
-            condition_tools = [] # elemental conditions for this compounnd ct.
-            for k, v in c.items(): # loop over elemental conditions
-                condition_tool = self._get_tool_instance(k)
-                for lim, val in v.items():  # lim: min, max
-                    setattr(condition_tool, lim, val)
-
-                # SPECIAL CASE: Moment tool needs the name of the
-                # moment as well as the min. max cuts:
-                if (k.startswith ('mom')):
-                    moment = k[len('mom'):]
-                    if moment in self.JetMoments:
-                        condition_tool.moment = self.JetMoments[moment]
-                    else: raise RuntimeError('%s not supported' % (moment))
-
-                # END SPECIAL CASE
-
-                condition_tools.append(condition_tool)
 
+            el_condition_tools = self._make_el_condition_tools(c)
+ 
             # create capacitychecked condition from elemental condition
-            condition_tool =self._get_tool_instance('capacitychecked')
+            condition_tool =self.algToolFactory('capacitychecked')
 
             if cpi:
 
                 # convert label from string to int for more efficient
                 # processing in C++ land.
                 condition_tool.chainPartInd = int(cpi[len('leg'):])
-            else:
-                condition_tool.chainPartInd = 0
             
-            condition_tool.conditionMakers = condition_tools
+            condition_tool.conditionMakers = el_condition_tools
             condition_tool.multiplicity = mult
             # add capacitychecked condition to list
             outer_condition_tools.append(condition_tool)
             
         return outer_condition_tools
 
+    
+    def _make_filter_tool(self, node):
+        """Condtion filters use a list of CompoundCondition containing
+        single jet elemental conditions  select a subset of the reco
+        jets to send to the a Condition"""
+        
+        el_condition_tools = []
+        for fc, mult in node.filter_conditions:
+            assert len(fc) == 1  # 1 elemental condition
+            assert mult == 1
+            el_condition_tools.extend(self._make_el_condition_tools(fc))
+
+        if not el_condition_tools:
+            el_condition_tools.append(self.algToolFactory('all'))
+
+        capacitychecked_condition_tool = self.algToolFactory(
+            'capacitychecked')
+
+        capacitychecked_condition_tool.conditionMakers = el_condition_tools
+        capacitychecked_condition_tool.multiplicity = 1
+        
+        return capacitychecked_condition_tool
+    
+
     def _mod_leaf(self, node):
         """ Add Condition tools to For a leaf node."""
 
@@ -155,36 +181,47 @@ class ConditionsToolSetterFastReduction(object):
         node.compound_condition_tools = self._make_compound_condition_tools(
             node)
 
-    def report(self):
-        wid = max(len(k) for k in self.tool_factories.keys())
-        rep = '\n%s: ' % self.__class__.__name__
-
-        rep += '\n'.join(
-            ['%s: %d' % (k.ljust(wid), v[1])
-             for k, v in self.tool_factories.items()])
-
-        return rep
+        # make condition builder AlgTools for the condition filters.
+        # condition filters select subsets of the input jets to present
+        # to a condition,
+        
+        node.filter_tool = self._make_filter_tool(node)
 
+    
+        # if node.scenario == 'agg':
+        #     print (node)
+        #    assert False
+            
+    def report(self):
+        return str(self.algToolFactory)
+   
     def _fill_tree_map(self, node, tmap):
         tmap[node.node_id] = node.parent_id
         for cn in node.children:
             self._fill_tree_map(cn, tmap)
 
             
-    def _fill_conditions_map(self, node, cmap):
+    def _fill_conditions_map(self, node, cmap, fmap):
         if is_leaf(node):
 
             assert (len(node.compound_condition_tools) == 1)
             cmap[node.node_id] = node.compound_condition_tools[0]
-
+            fmap[node.node_id] = node.filter_tool
+            
         else:
             # must have a tool for Gaudi to instantiate in
-            cmap[node.node_id] = self._get_tool_instance('capacitychecked')
-            cmap[node.node_id].conditionMakers = [self._get_tool_instance('all')]
+            cmap[node.node_id] = self.algToolFactory('capacitychecked')
+            cmap[node.node_id].conditionMakers = [self.algToolFactory('all')]
             cmap[node.node_id].multiplicity = 1
+
+            fmap[node.node_id] = self.algToolFactory('capacitychecked')
+            fmap[node.node_id].conditionMakers = [self.algToolFactory('all')]
+            fmap[node.node_id].multiplicity = 1
+
+            
         
         for cn in node.children:
-            self._fill_conditions_map(cn, cmap)
+            self._fill_conditions_map(cn, cmap, fmap)
 
 
     def _map_2_vec(self, amap):
@@ -225,25 +262,21 @@ class ConditionsToolSetterFastReduction(object):
         self._fill_tree_map(tree, tree_map)
 
         for k, v in tree_map.items():
-            log.debug("Tree map debug ", str(k), str(v))
+            log.debug("Tree map debug %s %s", str(k), str(v))
             
         treeVec = self._map_2_vec(tree_map)
 
         conditionsMap = {}
-        self._fill_conditions_map(tree, conditionsMap)
+        filterConditionsMap = {}
+        self._fill_conditions_map(tree, conditionsMap, filterConditionsMap)
         conditionsVec = self._map_2_vec(conditionsMap)
+        filterConditionsVec = self._map_2_vec(filterConditionsMap)
                
         # make a config tool and provide it with condition makers
-        config_tool = self._get_tool_instance('fastreduction')
+        config_tool = self.algToolFactory('fastreduction')
         config_tool.conditionMakers = conditionsVec
+        config_tool.filtConditionsMakers = filterConditionsVec
         config_tool.treeVector = treeVec
-
-        nodestr = 'n%dp%d' % (tree.node_id, tree.parent_id)
-        helper_tool = self._get_tool_instance('helper', extra=nodestr)
-        helper_tool.HypoConfigurer = config_tool
-        helper_tool.node_id = tree.node_id
-        helper_tool.parent_id = tree.parent_id
-
-        self.tool = helper_tool
-
-        print (self.tool)
+        self.config_tool = config_tool
+        
+        print (self.config_tool)
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/FastReductionAlgToolFactory.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/FastReductionAlgToolFactory.py
new file mode 100644
index 0000000000000000000000000000000000000000..4a115d09f08ca07cce5e41379a4d625a2f37e3fb
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/FastReductionAlgToolFactory.py
@@ -0,0 +1,63 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+"""Instantiator for AlgTools needed by the FastReduction."""
+
+from AthenaConfiguration.ComponentFactory import CompFactory
+
+class FastReductionAlgToolFactory:
+
+    def __init__(self):
+        
+        self.tool_factories = {
+            'eta': [CompFactory.TrigJetConditionConfig_abs_eta, 0], 
+            'peta': [CompFactory.TrigJetConditionConfig_signed_eta, 0],
+            'neta': [CompFactory.TrigJetConditionConfig_signed_eta, 0],
+            'et': [CompFactory.TrigJetConditionConfig_et, 0],
+            'djmass': [CompFactory.TrigJetConditionConfig_dijet_mass, 0],
+            'djdphi': [CompFactory.TrigJetConditionConfig_dijet_dphi, 0],
+            'djdeta': [CompFactory.TrigJetConditionConfig_dijet_deta, 0],
+            'qjmass': [CompFactory.TrigJetConditionConfig_qjet_mass, 0],
+            'smc': [CompFactory.TrigJetConditionConfig_smc, 0],
+            'jvt': [CompFactory.TrigJetConditionConfig_jvt, 0],
+            'ht': [CompFactory.TrigJetConditionConfig_htfr, 0],
+            'all': [CompFactory.TrigJetConditionConfig_acceptAll, 0],
+            'capacitychecked':
+            [CompFactory.TrigJetConditionConfig_capacitychecked, 0],
+            'fastreduction': [CompFactory.TrigJetHypoToolConfig_fastreduction, 0],
+            'helper': [CompFactory.TrigJetHypoToolHelperNoGrouper, 0],
+            }
+
+
+        jetMoments = {
+            'emfrac'  : 'EMFrac',
+            'hecfrac' : 'HECFrac',
+        }
+
+        for var in jetMoments:
+            self.tool_factories['mom'+var] = [
+                CompFactory.TrigJetConditionConfig_moment, 0]
+
+
+    def __call__(self, key, extra=''):
+   
+        klass = self.tool_factories[key][0]
+        sn = self.tool_factories[key][1]
+        
+        name = '%s_%d_fn' % (key, sn)
+        if extra: name += '_' + extra
+        tool = klass(name=name)            
+        self.tool_factories[key][1] += 1
+        return tool
+
+    
+    def __str__(self):
+        wid = max(len(k) for k in self.tool_factories.keys())
+        rep = '\n%s: ' % self.__class__.__name__
+        
+        rep += '\n'.join(
+            ['%s: %d' % (k.ljust(wid), v[1])
+             for k, v in self.tool_factories.items()])
+
+        return rep
+
+    
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigJetHypoToolConfig.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigJetHypoToolConfig.py
index 431a17d5877d26550cdcc4e0487bb84d50a97e90..f25a8d84c87e215517950c01d71ca09d1e1eca3e 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigJetHypoToolConfig.py
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigJetHypoToolConfig.py
@@ -8,7 +8,9 @@ from TrigHLTJetHypo.ConditionsToolSetterFastReduction import (
     ConditionsToolSetterFastReduction,
 )
 
-from TrigHLTJetHypo.ConditionsToolSetterHT import ConditionsToolSetterHT
+from TrigHLTJetHypo.FastReductionAlgToolFactory import (
+    FastReductionAlgToolFactory,
+    )
 
 from  TrigHLTJetHypo.chainDict2jetLabel import chainDict2jetLabel
 
@@ -20,14 +22,8 @@ from TrigHLTJetHypo.NodeSplitterVisitor import NodeSplitterVisitor
 from AthenaCommon.Logging import logging
 log = logging.getLogger( 'TrigJetHypoToolConfig' )
 
-def  trigJetHypoToolHelperFromDict_(
-        chain_label, # simple([(260et,320eta490, leg000)])
-        chain_name, # HLT_j260_320eta490_L1J75_31ETA49
-        toolSetter=None):
-
-    parser = ChainLabelParser(chain_label, debug=False)
+def  tree2tools(rootless_tree, toolSetter):
 
-    rootless_tree = parser.parse()
     
     # add a root node so that split simple nodes cann connect.
     tree = Node('root')
@@ -53,18 +49,38 @@ def  trigJetHypoToolHelperFromDict_(
     # chain name in run 2 dicts were missing the 'HLT_' prefix
     # but it seems it is necessary to run the hypos in AthenaMT ?...?
 
-    if not chain_name.startswith('HLT_'):
-        chain_name = 'HLT_' + chain_name
+    toolSetter.mod(tree)
 
-    log.info('trigJetHypoToolFromDict chain_name %s', chain_name)
+    return tree  # used by debug tools
 
-    toolSetter.mod(tree)
-    tool = toolSetter.tool
 
-    log.debug(toolSetter.report())
+def  nodeForestFromChainLabel(
+        chain_label, # simple([(260et,320eta490, leg000)])
+        chain_name,): # HLT_j260_320eta490_L1J75_31ETA49
+    
+    parser = ChainLabelParser(chain_label, debug=False)
+
+    return parser.parse()
+   
+def trigJetHypoToolHelperFromDict_(
+        chain_label,  # simple([(260et,320eta490, leg000)])
+        chain_name,):  # HLT_j260_320eta490_L1J75_31ETA49
+
+    
+    node_forest =  nodeForestFromChainLabel(chain_label,
+                                            chain_name)
+
+    algToolFactory = FastReductionAlgToolFactory()
+    helper_tool = algToolFactory('helper')
 
-    return tool
+    for tree in node_forest:
+        toolSetter = ConditionsToolSetterFastReduction()
+        tree2tools(tree, toolSetter)
+        helper_tool.HypoConfigurers.append(toolSetter.config_tool)   
 
+        log.debug(toolSetter.report())
+    
+    return helper_tool
 
 def  trigJetHypoToolHelperFromDict(chain_dict):
     """Produce  a jet trigger hypo tool helper from a chainDict
@@ -91,15 +107,9 @@ def  trigJetHypoToolHelperFromDict(chain_dict):
 
     chain_name = chain_dict['chainName']
 
-    toolSetter = None
-    if 'agg' in chain_name:
-        toolSetter=ConditionsToolSetterHT()
-    else:
-        toolSetter=ConditionsToolSetterFastReduction()
 
     return trigJetHypoToolHelperFromDict_(chain_label,
-                                          chain_name,
-                                          toolSetter)
+                                          chain_name)
 
 
 def  trigJetHypoToolFromDict_(chain_dict, hypo_tool, debug=False):
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDict2jetLabel.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDict2jetLabel.py
index d01c48a6395663499eab149a73489f913a6efa31..b78bc88bce17470aa5b38a99c154a10e8a8fc974 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDict2jetLabel.py
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDict2jetLabel.py
@@ -297,9 +297,9 @@ def _make_agg_label(chain_parts, leg_label):
 
     argvals['leg_label'] = leg_label
     result =  """
-    ht([(%(htlo).0fht, %(leg_label)s)
+    agg([(%(htlo).0fht, %(leg_label)s)
         (%(etlo).0fet)
-        (%(etalo).0feta%(etahi).0f)
+    (%(etalo).0feta%(etahi).0f)
     ])"""  % argvals
     print (result)
     return result
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/jetlabel_tester.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/jetlabel_tester.py
index 5741fdbf50b80b3bb1970d75d172f0b7aa5c9e49..5f7e255371c058f0142b155c96b2ce4d290b609c 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/jetlabel_tester.py
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/jetlabel_tester.py
@@ -4,39 +4,35 @@ from __future__ import print_function
 
 
 from ChainLabelParser import ChainLabelParser
-from  TrigHLTJetHypo.treeVisitors import TreeParameterExpander
-from  TrigHLTJetHypo.ConditionsToolSetterFastReduction import (
-    ConditionsToolSetterFastReduction,)
 
-def compile(label, setter, expand=False, do_dump=False, do_print=False):
+def compile(label, do_dump=False, do_print=False):
     print ('compile:',  label)
 
     parser = ChainLabelParser(label, debug=False)
-    tree = parser.parse()
+    forest = parser.parse()
 
-    tree.set_ids(node_id=0, parent_id=0)
+    print ('forest has %d' % len(forest),' tree(s)\n')
     
-    
-    if expand:
-        visitor = TreeParameterExpander()
-        tree.accept(visitor)
+    for i, tree in enumerate(forest):
 
-        if setter is not None:
-            setter.mod(tree)
+        print ('tree ', i, '\n')
 
-    print ('compile: tree.scenario', tree.scenario)
+        tree.set_ids(node_id=0, parent_id=0)
+    
+    
+        print ('compile: tree.scenario', tree.scenario)
 
         
         
-    if do_print:
-        print ('\nnode dumping top node only:\n')
-        print (tree)
+        if do_print:
+            print ('\nnode dumping top node only:\n')
+            print (tree)
 
-    if do_dump:
-        print ('\nnode dump tree:\n')
-        print (tree.dump())
+        if do_dump:
+            print ('\nnode dump tree:\n')
+            print (tree.dump())
         
-    return tree
+    return forest
 
 def compile_(label, setter=None, expand=True, do_dump=False, do_print=False):
     compile(label, setter, expand, do_dump)
@@ -65,11 +61,5 @@ if __name__ == '__main__':
     print('index', index)
     label = test_strings[index]
 
-    setter = ConditionsToolSetterFastReduction('toolSetterFastReduction')
-    
-    tree = compile(label, setter=setter,  expand=True, do_dump=True)
+    tree = compile(label, do_dump=True)
 
-    print ('tvec: %s' % str(setter.tool))
-    print ('svec: %s' % setter.shared)
-    print ('conditionsVec [%d]: %s' % (len(setter.conditionsVec),
-                                       str(setter.conditionsVec)))
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/node.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/node.py
index 7b75c37525d04072399faa426506afecf2c9919d..9bc459c46b581f42844a33fecf5078a172767305 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/node.py
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/node.py
@@ -29,11 +29,14 @@ class Node(object):
 
         # filled in by a CondtionsTollSetter:
         self.compound_condition_tools = [] 
-        # self.tool = None
-        # self.compound_condition_tools = []
-        # self.tree_top kludge carensure top level tools get chain name
-        # as Tool name
         self.chainpartinds = []
+
+        # Condition objects may have filters
+        # eg HT may have an et filter. Filters are made up of conditions
+        # and are used to form jet subsets.
+        self.filter_conditions = []
+        self.filter_tool = None
+        
         self.tree_top = False
         self.tool = None
         
@@ -91,11 +94,17 @@ class Node(object):
         for ca in self.conf_attrs:
             s.append(indent + str(ca))
         
-            # this attribute added by flow network setter tool
-            s.append(indent + 'compound_condition_tools [%d]' % len(
-                self.compound_condition_tools))
+        s.append(indent + 'filter_conditions [%d]:' % (
+            len(self.filter_conditions),))
+                 
+        for fc in self.filter_conditions:
+            s.append(indent + str(fc))
+
+        s.append(indent + 'compoundConditionTools [%d]:' % len(
+            self.compound_condition_tools))
+
+        s.append(indent + 'filter_tool :' + str(self.filter_tool))
 
-        s.append(indent + 'AlgTool: %s' % str(self.tool))
         s.append(indent + 'No of children: %d\n' % len(self.children))
 
         return s
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/testChainDictMaker.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/testChainDictMaker.py
index 21a0691446e324f9bfe6078a2373c848803a3c4e..468d7427418a5a15dce45fadf38d254f76dc888e 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/testChainDictMaker.py
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/testChainDictMaker.py
@@ -11,7 +11,14 @@ from TriggerMenuMT.HLTMenuConfig.Menu.ChainDefInMenu import ChainProp
 from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import dictFromChainName
 
 from chainDict2jetLabel import chainDict2jetLabel 
-from TrigJetHypoToolConfig import trigJetHypoToolFromDict
+from TrigJetHypoToolConfig import (trigJetHypoToolFromDict,
+                                   nodeForestFromChainLabel,
+                                   tree2tools,)
+
+from TrigHLTJetHypo.ConditionsToolSetterFastReduction import (
+    ConditionsToolSetterFastReduction,
+)
+
 
 def testChainDictMaker():
 
@@ -43,7 +50,7 @@ def testChainDictMaker():
 
         ChainProp(name='HLT_j0_aggSEP1000htSEP30etSEP0eta320_L1J20',
                   groups=SingleJetGroup),
-
+        
         # ChainProp(name='HLT_j70_j50 _0eta490_invm1000j50_dphi20_deta40_L1J20',
         #          l1SeedThresholds=['FSNOSEED']*2,
         #          groups=MultiJetGroup),
@@ -70,6 +77,25 @@ if __name__ == '__main__':
         print (chainDict2jetLabel(d[1]))
         print ()
 
+        
+    print ('\n node trees:\n')
+    
+    for d in dicts:
+        print (d[0])
+        label = chainDict2jetLabel(d[1])
+        chain_name = d[1]['chainName']
+
+
+        forest = nodeForestFromChainLabel(label, chain_name)
+
+        for tree in forest:
+            toolSetter=ConditionsToolSetterFastReduction()
+            
+            print (tree2tools(rootless_tree=tree,
+                              toolSetter=toolSetter).dump())
+        print ()
+        
+
     print ('\nMaking TrigJetHypoTool for each dictiomary\n')
     for d in dicts:
         print (d[0])
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/test_cases.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/test_cases.py
index 9dcb9f045f6477c56ba8b902133991ecd2ff663a..65ac32fc280af6f27d4170903559dd467554dde6 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/test_cases.py
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/test_cases.py
@@ -128,7 +128,20 @@ test_strings = [
                                  combgen([] 
                                          dijet([(71djmass91)])
                                          simple([(12et)(13et)])))))""",
- 
+    # forest
+    """simple
+    (
+        [(50et, 500neta, leg000)(50et, peta500, leg000)]
+    )
+    dijet
+    (
+        [(34mass, 26djdphi, leg000)]
+        simple
+        (
+            [(10et, 0eta320, leg000)(20et, 0eta320, leg000)]
+        )
+    )"""
+    
 ]
 
 
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py
index 3133ab0191dbd3fb0f113c2a1f41fb9d3330eb66..a91db097e259da63274c673568464df9de136b9c 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py
@@ -34,13 +34,15 @@ def defaultParameters(parameter, default=''):  # default if parameter unknown
                 'smchi': 'inf',                
                 'jvtlo': '0',
                 'jvthi': 'inf',
+                'htlo' : '1000.',
+                'hthi' : 'inf',
     }
 
     if parameter.startswith('mom'):
         parameter = 'momCuts'
 
     if parameter not in  defaults:
-        print ('defaultParameters: unknown parameter, tryurning default ',
+        print ('defaultParameters: unknown parameter, returning default ',
                parameter)
 
     return defaults.get(parameter, default)
@@ -284,6 +286,47 @@ class TreeParameterExpander_simple(object):
         return '%s: ' % self.__class__.__name__ + '\n'.join(self.msgs) 
 
 
+class TreeParameterExpander_agg(object):
+    """Convert parameter string into duction holding low, high window
+        cut vals, as for the  'simple' scenario. Then place conditions
+        not in the agg list in the filters dict. These conditions wil be used
+        to select the subset of the jet collection to be presented to the agg
+        conditions."""
+
+    agg_conditions = ('ht',)
+    
+    def __init__(self):
+        self.msgs = []
+
+    def mod(self, node):
+
+        simple_expander = TreeParameterExpander_simple()
+        simple_expander.mod(node)
+
+        # example conf_attrs:
+        # conf_attrs [3]:
+        # (defaultdict(<class 'dict'>,
+        #              {'ht': {'min': '1000000.0', 'max': 'inf'}}), 1)
+        # (defaultdict(<class 'dict'>,
+        #              {'et': {'min': '30000.0', 'max': 'inf'}}), 1)
+        # (defaultdict(<class 'dict'>,
+        #             {'eta': {'min': '0.0', 'max': '3.2'}}), 1)
+
+
+        for ca in node.conf_attrs:
+            assert len(ca) == 2  # (dict, mult)
+            assert len(ca[0]) == 1  # one entry in dict
+            ca_keys = ca[0].keys()
+            cond_name = list(ca_keys)[0]
+            if cond_name not in self.agg_conditions:
+                node.filter_conditions.append(ca)
+        for fc in node.filter_conditions:
+            node.conf_attrs.remove(fc)
+
+    def report(self):
+        return '%s: ' % self.__class__.__name__ + '\n'.join(self.msgs) 
+
+
 class TreeParameterExpander_dijet(object):
     """Convert parameter string into tuples holding low, high window
     cut vals. Specialistaion for the dijet scenario
@@ -360,7 +403,7 @@ class TreeParameterExpander(object):
         'z': TreeParameterExpander_null,
         'root': TreeParameterExpander_null,
         'simple': TreeParameterExpander_simple,
-        'ht': TreeParameterExpander_simple,
+        'agg': TreeParameterExpander_agg,
         'dijet': TreeParameterExpander_dijet,
         'qjet': TreeParameterExpander_simple,
         'all': TreeParameterExpander_all,
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/ConditionFilter.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/ConditionFilter.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..04d82ce07394bcbf32635acd2e172bdd4b60b813
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/ConditionFilter.cxx
@@ -0,0 +1,57 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include <algorithm>
+
+#include "./ConditionFilter.h"
+
+ConditionFilter::ConditionFilter(ConditionPtrs& conditions):
+  m_conditions(std::move(conditions)) {
+}
+
+struct FilterPred{
+  FilterPred(const ConditionPtr& cptr,
+	     const std::unique_ptr<ITrigJetHypoInfoCollector>& collector):
+    m_cptr(cptr), m_collector(collector) {
+  }
+
+  bool operator() (pHypoJet pjet) {
+    auto hjv = HypoJetVector{pjet};
+    return m_cptr->isSatisfied(hjv, m_collector);
+  }
+
+  const ConditionPtr& m_cptr;
+  const std::unique_ptr<ITrigJetHypoInfoCollector>& m_collector;
+};
+
+HypoJetVector
+ConditionFilter::filter (const HypoJetCIter& begin,
+			 const HypoJetCIter& end,
+			 const std::unique_ptr<ITrigJetHypoInfoCollector>& collector) const {
+
+  HypoJetVector in (begin, end);
+  auto new_end = in.end();
+  
+  for (const auto& cptr : m_conditions) {
+    new_end = std::partition(in.begin(),
+			 new_end,
+			 FilterPred(cptr, collector));
+  }
+  
+  return HypoJetVector(in.begin(), new_end);
+}
+
+std::string ConditionFilter::toString() const {
+  std::stringstream ss;
+  const void* address = static_cast<const void*>(this);
+  ss << "ConditionFilter: (" << address << ")\n"
+     << "Conditions [" << m_conditions.size() << "]:\n";
+  for (const auto& c : m_conditions) {
+     ss << " " << c->toString() << "\n\n";
+   }
+
+  return ss.str();
+}
+
+	   
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/ConditionFilter.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/ConditionFilter.h
new file mode 100644
index 0000000000000000000000000000000000000000..3911c3f5ff322a8c2d88407e9f8888d0e74fc20d
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/ConditionFilter.h
@@ -0,0 +1,27 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TRIGHLTJETHYPO_CONDITIONFILTER_H
+#define TRIGHLTJETHYPO_CONDITIONFILTER_H
+
+#include "./CapacityCheckedConditionsDefs.h"
+
+class ConditionFilter {
+ public:
+  ConditionFilter(ConditionPtrs&);
+
+  // find the subset of jets which satisfy a sequence of conditions
+  HypoJetVector filter (const HypoJetCIter& b,
+			const HypoJetCIter& e,
+			const std::unique_ptr<ITrigJetHypoInfoCollector>&
+			) const;
+  
+  std::string toString() const;  
+ private:
+  ConditionPtrs m_conditions;
+
+  
+};
+
+#endif
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReducer.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReducer.cxx
index 7e174e07d330c3df6b6781fd99feba301e4039f6..05dafc68253b9d7ca0ab55d6707ae87dd9e214ab 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReducer.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReducer.cxx
@@ -3,6 +3,7 @@
 */
 
 #include "./FastReducer.h"
+#include "./GrouperByCapacityFactory.h"
 #include "./ITrigJetHypoInfoCollector.h"
 
 #include <map>
@@ -36,13 +37,14 @@ struct IndexVecComp{
 };
 
 
-FastReducer::FastReducer(const HypoJetGroupCIter& groups_b,
-                         const HypoJetGroupCIter& groups_e,
+FastReducer::FastReducer(const HypoJetCIter& jets_b,
+                         const HypoJetCIter& jets_e,
                          const ConditionPtrs& conditions,
+			 const ConditionFilters& filters,
                          const Tree& tree,
                          xAODJetCollector& jetCollector,
                          const Collector& collector):
-  m_conditions(conditions),  m_tree(tree) {
+  m_conditions(conditions),  m_conditionFilters(filters), m_tree(tree) {
 
   // create an empty vector of indices of satisfying jet groups
   // for each Condition.
@@ -52,8 +54,8 @@ FastReducer::FastReducer(const HypoJetGroupCIter& groups_b,
   }
 
 
-  if(!findInitialJetGroups(groups_b,
-			   groups_e,
+  if(!findInitialJetGroups(jets_b,
+			   jets_e,
 			   collector)){
     if(collector){
       collector->collect("FastReducer early return",
@@ -162,57 +164,57 @@ void FastReducer::collectLeafJets(xAODJetCollector& jetCollector,
 }
 
 
-bool FastReducer::findInitialJetGroups(const HypoJetGroupCIter& groups_b,
-				       const HypoJetGroupCIter& groups_e,
+bool FastReducer::findInitialJetGroups(const HypoJetCIter& jets_b,
+				       const HypoJetCIter& jets_e,
 				       const Collector& collector) {
   
 
   /*
-    Will now test the incoming jet groups against the leaf conditions.
+    Will now test the incoming jets against the leaf conditions.
   */
 
   std::size_t ijg{0};
   auto leaves = m_tree.leaves();
 
-  for(auto iter = groups_b; iter != groups_e; ++iter){
-    auto jg = *iter;
-    
-    if(jg.size() != 1){
-      collector->collect("FastReducer", "Initial jet group size != 1");
-      return false;
-    }
-    
-    // if a jet group satisfies a condition, note the fact,
-    // and store it by index
-    bool jg_used{false};
+  // if a jet group satisfies a condition, note the fact,
+  // and store it by index
+
+  for(const auto& leaf: leaves){
+
+    auto& filter = m_conditionFilters[leaf];
+    auto filtered_jets = filter->filter(jets_b, jets_e, collector);
+
+    recordFiltering(leaf, jets_e-jets_b, filtered_jets.size(), collector);
+
     
-    auto cur_jg = m_jgIndAllocator(std::vector<std::size_t>{ijg});
-    for(const auto& leaf: leaves){
-      
-      m_testedBy[leaf].insert(cur_jg);
+    auto grouper = grouperByCapacityFactory(m_conditions[leaf]->capacity(),
+					    filtered_jets.begin(),
+					    filtered_jets.end());
+
+    while(true){
+      auto ojg = grouper->next();
+      if (!ojg.has_value()) {break;}
+
+      auto jg = *ojg;
+      auto jg_ind = m_jgRegister.record(jg);
+      m_testedBy[leaf].insert(jg_ind);
       if (m_conditions[leaf]->isSatisfied(jg, collector)){
-	jg_used= true;
-	if(collector){recordJetGroup(cur_jg, jg, collector);}
+	if(collector){recordJetGroup(jg_ind, jg, collector);}
 	// do the following for each satisfied condition ...
-	m_satisfiedBy[leaf].push_back(cur_jg);
+	m_satisfiedBy[leaf].push_back(jg_ind);
+	m_jg2elemjgs[jg_ind] =  std::vector<std::size_t>{jg_ind};
+	m_indJetGroup.emplace(jg_ind, jg);
+	++ijg;
       }
     }
-    
-    if(jg_used){
-      m_jg2elemjgs[cur_jg] =  std::vector<std::size_t>{cur_jg};
-      m_indJetGroup.emplace(cur_jg, jg);
-      ++ijg;
-    }
-    
   }
-  
+    
   if(collector){
     for(const auto& p : m_indJetGroup){
       recordJetGroup(p.first, p.second, collector);
     }
   }
-
-
+  
   // check all leaf conditions are satisfied
   for (const auto& i : leaves) {
     if (!capacitySatisfied(i, collector)) {
@@ -220,47 +222,9 @@ bool FastReducer::findInitialJetGroups(const HypoJetGroupCIter& groups_b,
     }
   }
   
-  /*
-    For the special but important case where all leaf nodes have
-    the root node as a parent, check that there are enough jets
-    to pass the hypo. This prevents doing a long calculation 
-    to discover that the hypo will fail. For example, if the chain
-    requires 10j40, and there are 5 jets that pass the condition,
-    each condition will be satisfied by th 5 jets, and 5^10 combinations
-    will be attempted in th seach for a successful combination. As there
-    are only 5 jets involved, such a combination does not exist.
-
-    Such trees have a tree vector with all entries == 0.
-
-    This check cannot be applied in the general case. For example,
-    if the root condition requires 4 jets, and has three children,
-    two of which are leaf nodes, while the other is not, then the
-    check will fail the event as no jets have yet ben assigned to the
-    second child, while the full popagation through the tree may pass the
-    event.
-
-    A possible way to tighten the chck would be to forbid children to be
-    separated from thir parent by more than 1 generation.
-  */
-
-  if (std::all_of(m_tree.cbegin(),
-		  m_tree.cend(),
-		  [](std::size_t i){return i == 0;})) {
-    
-    if (m_conditions[0]->capacity() > ijg) {
-      
-      if (collector){
-	collector->collect("FastReducer", "too few children. root capacity "
-			   + std::to_string(m_conditions[0]->capacity()) +
-			   " no of children: " + std::to_string(ijg));
-      }
-
-      return false;
-    }
-  }
-  
   return true;
 }  
+  
 
 bool FastReducer::propagateJetGroups(const Collector& collector){
   
@@ -395,18 +359,20 @@ bool FastReducer::propagate_(std::size_t child,
     }
 
     HypoJetVector jg;
-
+    for(const auto& i : elem_jgs){
+      jg.push_back(m_indJetGroup.at(i)[0]);  // why [0]? assume elemental jg has size 1
+    }
+    
     // obtain an index for the new jet group.
-    auto cur_jg = m_jgIndAllocator(elem_jgs);
+    // auto cur_jg = m_jgIndAllocator(elem_jgs);
+    auto cur_jg = m_jgRegister.record(jg);
     if(m_testedBy[par].find(cur_jg) != m_testedBy[par].end()){
       next = jg_product.next(collector);
       continue;
     }
     m_testedBy[par].insert(cur_jg);
 	
-    for(const auto& i : elem_jgs){
-      jg.push_back(m_indJetGroup.at(i)[0]);  // why [0]? assume elemental jg has size 1
-    }
+
 
     if (m_conditions[par]->isSatisfied(jg, collector)){// par is a tree ind.
 
@@ -526,6 +492,22 @@ void FastReducer::recordJetGroup(std::size_t ind,
   collector->collect(ss0.str(), ss1.str());
 }
 
+void FastReducer::recordFiltering(std::size_t leaf_ind,
+				  std::size_t n_injets,
+				  int n_filteredjets,
+				  const Collector& collector) const {
+
+  if(!collector) {return;}
+  
+  std::stringstream ss0;
+  ss0  << "FastReducer filtering Condition index: "  << leaf_ind;
+  
+  std::stringstream ss1;
+  ss1  << "n jets. in: " << n_injets << " filtered: " << n_filteredjets << '\n';
+  
+  collector->collect(ss0.str(), ss1.str());
+}
+
 bool FastReducer::pass() const { return m_pass; }
 
 
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReducer.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReducer.h
index 7f3d1191fdd18e53c32bec702fa71b4bd4c992fb..99a374e9093c7235748d6ebd3eac69d0654bcdeb 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReducer.h
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReducer.h
@@ -11,7 +11,10 @@
 #include "./JetGroupIndAllocator.h"
 #include "./xAODJetCollector.h"
 #include "./ITrigJetHypoInfoCollector.h"
+#include "./JetGroupRegister.h"
+#include "./ConditionFilter.h"
 #include <string>
+#include <map>
 
 using TreeVec = std::vector<std::size_t>;
 using IDJetGroup = std::map<std::size_t, HypoJetVector>;
@@ -22,14 +25,16 @@ typedef std::unique_ptr<ITrigJetHypoInfoCollector> Collector;
 */
 
 using JetGroupInd2ElemInds = std::map<int, std::vector<std::size_t>>;
+using  ConditionFilters = std::vector<std::unique_ptr<ConditionFilter>>;
 
 
 class FastReducer {
  public:
 
-  FastReducer(const HypoJetGroupCIter& groups_b,
-              const HypoJetGroupCIter& groups_e,
+  FastReducer(const HypoJetCIter& jets_b,
+              const HypoJetCIter& jets_e,
               const ConditionPtrs& conditionObjects,
+	      const ConditionFilters& conditionFilters,
               const Tree& conditionsTree,
               xAODJetCollector& jetCollector,
               const Collector& collector);
@@ -45,8 +50,12 @@ class FastReducer {
 
  private:
 
+  // conditions owned by the matcher
   const ConditionPtrs& m_conditions;
 
+  // conditionFilters owned by the matcher
+  const ConditionFilters& m_conditionFilters;
+
   /** tree structure for Conditions objects.
    The conditions tree gives relations among conditions (eg parent-child
    and siblings-of)
@@ -75,15 +84,16 @@ class FastReducer {
 
   HypoJetVector m_passingJets;
 
-  JetGroupIndAllocator m_jgIndAllocator;
-  
+  //  JetGroupIndAllocator m_jgIndAllocator;
+
+  JetGroupRegister m_jgRegister;
   /** set up the data structures for propagation. Propagation is the
    act of combining jet groups satisfying children
    in preparration for testing against parent conditions.
   */
   
-  bool findInitialJetGroups(const HypoJetGroupCIter& groups_b,
-			    const HypoJetGroupCIter& groups_e,
+  bool findInitialJetGroups(const HypoJetCIter& jets_b,
+			    const HypoJetCIter& jets_e,
 			    const Collector& collector);
   
   
@@ -102,6 +112,11 @@ class FastReducer {
 		      const HypoJetVector& jg,
 		      const Collector& collector) const;
 
+  void recordFiltering(std::size_t leaf_ind,
+		       std::size_t n_inputjets,
+		       int n_filteredjets,
+		       const Collector& collector) const;
+
   void collectLeafJets(xAODJetCollector& jetCollector,
 		       const Collector& collector) const;
 
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.cxx
index 81c85760c25499854dc9501ee5a2bc411c41a7a8..d30fb5d240ad9692cea125c2d7fa3d7ee02b7515 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.cxx
@@ -10,9 +10,11 @@
 #include <algorithm>
 #include <sstream>
 
-FastReductionMatcher::FastReductionMatcher(ConditionPtrs conditions,
+FastReductionMatcher::FastReductionMatcher(ConditionPtrs& conditions,
+					   ConditionFilters& filters,
 					   const Tree& tree):
   m_conditions(std::move(conditions)),
+  m_conditionFilters(std::move(filters)),
   m_tree(tree){
 
   for (const auto& il : m_tree.leaves()){
@@ -20,12 +22,16 @@ FastReductionMatcher::FastReductionMatcher(ConditionPtrs conditions,
       throw std::runtime_error("Tree leaf condition  but not from ChainPart");
     }
   }
+  if (filters.size() != conditions.size()) {
+    throw std::runtime_error("Conditions and ConditionFilters sequence sizes differ");
+  }
+
 }
 	 
 
 std::optional<bool>
-FastReductionMatcher::match(const HypoJetGroupCIter& groups_b,
-			    const HypoJetGroupCIter& groups_e,
+FastReductionMatcher::match(const HypoJetCIter& jets_b,
+			    const HypoJetCIter& jets_e,
 			    xAODJetCollector& jetCollector,
 			    const std::unique_ptr<ITrigJetHypoInfoCollector>& collector,
 			    bool) const {
@@ -43,9 +49,10 @@ FastReductionMatcher::match(const HypoJetGroupCIter& groups_b,
    */
 
 
-  FastReducer reducer(groups_b,
-                      groups_e,
+  FastReducer reducer(jets_b,
+                      jets_e,
                       m_conditions,
+		      m_conditionFilters,
                       m_tree,
                       jetCollector,
                       collector);
@@ -68,5 +75,17 @@ std::string FastReductionMatcher::toString() const {
     ss << sc <<": "<< c->toString() + '\n';
   }
 
+  ss << "FastReductionMatcher ConditionFilters ["
+     << m_conditionFilters.size() << "]: \n";
+
+
+  count = 0;
+  for(const auto& c : m_conditionFilters){
+    auto sc = std::to_string(count++);
+    sc.insert(sc.begin(), 3-sc.length(), ' ');
+    ss << sc <<": "<< c->toString() + '\n';
+  }
+  
+
   return ss.str();
 }
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.h
index 9b1e68b8a6ff7639cc816a945e1b359d5f4863a1..ec33356e024576cf22ddc1e62731fcd26166086f 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.h
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.h
@@ -6,17 +6,21 @@
 #define TRIGHLTJETHYPO_FASTREDUCTIONMATCHER_H
 
 
-#include "./IGroupsMatcherMT.h"
+#include "./IJetsMatcherMT.h"
 #include "./CapacityCheckedConditionsDefs.h"
+#include "./ConditionFilter.h"
 #include "./Tree.h"
 
 using TreeVec = std::vector<std::size_t>;
 class ITrigJetHypoInfoCollector;
 
-class FastReductionMatcher: public IGroupsMatcherMT {
+using  ConditionFilters = std::vector<std::unique_ptr<ConditionFilter>>;
+
+class FastReductionMatcher: public IJetsMatcherMT {
  public:
 
-  FastReductionMatcher(ConditionPtrs,
+  FastReductionMatcher(ConditionPtrs&,
+		       ConditionFilters&,
 		       const Tree&);
 
 
@@ -30,8 +34,8 @@ class FastReductionMatcher: public IGroupsMatcherMT {
   */
   
   virtual std::optional<bool>
-    match(const HypoJetGroupCIter& groups_b,
-	  const HypoJetGroupCIter& groups_e,
+    match(const HypoJetCIter& jets_b,
+	  const HypoJetCIter& jets_e,
 	  xAODJetCollector&,
 	  const std::unique_ptr<ITrigJetHypoInfoCollector>& collector,
 	  bool
@@ -42,7 +46,7 @@ class FastReductionMatcher: public IGroupsMatcherMT {
  private:
 
   ConditionPtrs m_conditions;
-
+  std::vector<std::unique_ptr<ConditionFilter>> m_conditionFilters;
   /** tree structure for Conditions objects.
    The conditions tree gives relations among conditions (eg parent-child
    and siblings-of)
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/GrouperByCapacityFactory.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/GrouperByCapacityFactory.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..f2c7e5b8269880a05227b1b85b07b79086734b15
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/GrouperByCapacityFactory.cxx
@@ -0,0 +1,28 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "GrouperByCapacityFactory.h"
+#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/AllJetsGrouper.h"
+#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/SingleJetGrouper.h"
+#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CombinationsGrouper.h"
+
+
+std::unique_ptr<IJetGrouper> grouperByCapacityFactory(unsigned int cap,
+						      const HypoJetCIter& b,
+						      const HypoJetCIter& e){
+
+  std::unique_ptr<IJetGrouper> pGrouper(nullptr);
+  
+  if (cap == 0) {
+    throw std::runtime_error("groupByMultFactory - attempting ctrct grouper with mult == 0");
+  } else if (cap == 1) {
+    pGrouper.reset(new SingleJetGrouper(b, e));
+  } else if (cap == std::numeric_limits<int>::max()) {
+    pGrouper.reset(new AllJetsGrouper(b, e));
+  } else {
+    pGrouper.reset(new CombinationsGrouper(cap, b, e));
+  }
+
+  return pGrouper;
+}
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/GrouperByCapacityFactory.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/GrouperByCapacityFactory.h
new file mode 100644
index 0000000000000000000000000000000000000000..cf227df628d251b9a7fdba13eef6215ad561d0b3
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/GrouperByCapacityFactory.h
@@ -0,0 +1,15 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TRIGHLTJETHYPO_GROUPERBYCAPACITYFACTORY_H
+#define TRIGHLTJETHYPO_GROUPERBYCAPACITYFACTORY_H
+
+#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJetGrouper.h"
+#include <memory>
+
+std::unique_ptr<IJetGrouper> grouperByCapacityFactory(unsigned int capacity,
+						      const HypoJetCIter& b,
+						      const HypoJetCIter& e);
+
+#endif
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionFastReduction.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionFastReduction.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..639cb3f465d48009d3e006303399f707e037bb14
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionFastReduction.cxx
@@ -0,0 +1,64 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "./HTConditionFastReduction.h"
+#include "./ITrigJetHypoInfoCollector.h"
+#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/HypoJetDefs.h"
+
+#include <sstream>
+#include <cmath>
+#include <algorithm>
+#include <numeric>
+
+HTConditionFastReduction::HTConditionFastReduction(double ht_min,
+						   double ht_max):
+  m_htMin(ht_min), m_htMax(ht_max) {
+}
+
+
+bool
+HTConditionFastReduction::isSatisfied(const HypoJetVector& ips,
+				      const std::unique_ptr<ITrigJetHypoInfoCollector>& collector) const {
+  
+  auto htsum =  std::accumulate(ips.begin(),
+				ips.end(),
+				0.0,
+				[](double sum, const pHypoJet& jp){
+				  return sum + jp->et();});
+  bool pass = htsum > m_htMin;
+  
+  if(collector){
+    std::stringstream ss0;
+    const void* address = static_cast<const void*>(this);
+    ss0 << "HTCondition: (" << address << ") Sum(et) "
+	<< htsum << " "
+	<< std::boolalpha << pass <<  " jet group: \n";
+    
+    std::stringstream ss1;
+    
+    for(const auto& ip : ips){
+      address = static_cast<const void*>(ip.get());
+      ss1 << "    "  << address << " " << ip->eta() << " e " << ip->e() << '\n';
+    }
+    ss1 << '\n';
+    collector -> collect(ss0.str(), ss1.str());
+  }
+  
+  return pass;
+  
+}
+    
+
+std::string HTConditionFastReduction::toString() const {
+  std::stringstream ss;
+  ss << "HTConditionFastReduction: htMin: "
+     << m_htMin;
+
+  
+
+  ss <<'\n';
+
+  return ss.str();
+}
+
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionFastReduction.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionFastReduction.h
new file mode 100644
index 0000000000000000000000000000000000000000..ec67e2b76765ff91b59731fd1e98bc5a65b803f6
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionFastReduction.h
@@ -0,0 +1,54 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TRIGHLTJETHYPO_HTCONDITIONFASTREDUCTION_H
+#define TRIGHLTJETHYPO_HTCONDITIONFASTREDUCTION_H
+
+/********************************************************************
+ *
+ * NAME:     HTConditionFastReduction.h
+ * PACKAGE:  Trigger/TrigHypothesis/TrigHLTJetHypo
+ *
+ * AUTHOR:   P. Sherwood
+ *********************************************************************/
+
+#include "./IConditionMT.h"
+
+#include <string>
+#include <limits>
+// #include <memory>
+
+namespace HypoJet{
+  class IJet;
+}
+
+
+class ITrigJetHypoInfoCollector;
+
+class HTConditionFastReduction: public IConditionMT{
+ public:
+
+  
+  HTConditionFastReduction(double htMin, double htMax);
+
+  
+  ~HTConditionFastReduction() override {}
+
+  bool isSatisfied(const HypoJetVector&,
+                   const std::unique_ptr<ITrigJetHypoInfoCollector>&) const override;
+
+  std::string toString() const override;
+  virtual unsigned int capacity() const override {return s_capacity;}
+
+ private:
+  
+  double m_htMin;
+  double m_htMax;
+  
+  const static  unsigned int s_capacity{std::numeric_limits<int>::max()};
+  
+  
+};
+
+#endif
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/IJetsMatcherMT.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/IJetsMatcherMT.h
new file mode 100644
index 0000000000000000000000000000000000000000..14e38d363cb60af5be01e958a94173098a078835
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/IJetsMatcherMT.h
@@ -0,0 +1,43 @@
+
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TRIGHLTJETHYPO_IJETSMATCHERMT_H
+#define TRIGHLTJETHYPO_IJETSMATCHERMT_H
+/********************************************************************
+ *
+ * NAME:     IJetsMatcherMT.h
+ * PACKAGE:  Trigger/TrigHypothesis/TrigHLTJetHypo
+ *
+ * AUTHOR:   P. Sherwood
+ * CREATED:  March 21, 2015
+ *           
+ *
+ *  PABC for matching gropups of jets with Conditions.
+ *********************************************************************/
+
+#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJet.h"
+#include "./ConditionsDefsMT.h"
+#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/HypoJetDefs.h"
+#include <string>
+
+class ITrigJetHypoInfoCollector;
+class xAODJetCollector;
+
+class IJetsMatcherMT{
+ public:
+
+  virtual ~IJetsMatcherMT(){}
+  virtual std::optional<bool> match(const HypoJetCIter&,
+				    const HypoJetCIter&,
+				    xAODJetCollector&,
+				    const std::unique_ptr<ITrigJetHypoInfoCollector>&,
+				    bool debug=false) const = 0;
+  
+  virtual std::string toString() const = 0;
+};
+
+#endif
+
+
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/ITrigJetHypoToolNoGrouperConfig.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/ITrigJetHypoToolNoGrouperConfig.h
new file mode 100644
index 0000000000000000000000000000000000000000..c2b5b1974a991558ae91dbc002615f4db760cbbe
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/ITrigJetHypoToolNoGrouperConfig.h
@@ -0,0 +1,53 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+#ifndef TRIGHLTJETHYPO_ITRIGJETHYPOTOOLNOGROUPERCONFIG_H
+#define TRIGHLTJETHYPO_ITRIGJETHYPOTOOLNOGROUPERCONFIG_H
+
+
+#include "GaudiKernel/IAlgTool.h"
+#include "./ConditionsDefsMT.h"
+#include "./IJetsMatcherMT.h"
+#include "./ConditionFilter.h"
+
+#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerBridge.h"
+#include <optional>
+
+class ITrigJetHypoToolNoGrouperConfig : virtual public ::IAlgTool {
+  /** PABC (Pure Abstract Base Class) for JetHypoTool Condiguration classes.
+   TrigJetHypoToolHelperMT is a general purpose class to run
+   parts of a jet hypo. The Condiguration tools supply them
+   with the components according to the hypo scenario. */
+public:
+  DeclareInterfaceID(ITrigJetHypoToolNoGrouperConfig, 1, 0);
+  virtual ~ITrigJetHypoToolNoGrouperConfig(){};
+
+
+  /** check the input values */
+  virtual StatusCode checkVals()  const = 0;
+
+
+  /** Provide cleaner objects to sdiscard "dirty" jets before preocessing. */
+  virtual std::vector<std::shared_ptr<ICleaner>> getCleaners() const = 0;
+
+  /** return an object that tests jet group - Conditions matching */
+  virtual std::unique_ptr<IJetsMatcherMT> getMatcher() const = 0;
+
+  /** return the Conditions (which check whether a jet group satisfies one
+      or more requirements 
+  */
+   virtual std::optional<ConditionsMT> getConditions() const = 0;
+
+  /** return the ConditionFilters. These reduce the input jet collection
+      before it is passed to a Condition. Example: HT conditions sometimes
+      need and eta - Et filtered vector on which to do the Et sum.
+  */
+  
+  virtual std::vector<std::unique_ptr<ConditionFilter>>
+  getConditionFilters() const = 0;
+
+  /*( Gives the minimum number of jets the helper using this Confiog
+   class will require to pass the event. */
+  virtual std::size_t requiresNJets() const =0;
+};
+#endif
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/JetGroupRegister.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/JetGroupRegister.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..aa873c6764c6436bf7bcb5166bea714bd63f0505
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/JetGroupRegister.cxx
@@ -0,0 +1,20 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "./JetGroupRegister.h"
+
+std::size_t JetGroupRegister::record(HypoJetVector v){
+
+  std::sort(v.begin(), v.end(), HypoJetLess());
+  
+  auto it = m_reg.find(v);
+  
+  if (it == m_reg.end()){
+    auto new_ind = m_reg.size();
+    m_reg[v] = new_ind;
+    return new_ind;
+  } else {
+    return it->second;
+  }
+}
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/JetGroupRegister.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/JetGroupRegister.h
new file mode 100644
index 0000000000000000000000000000000000000000..7ca0aec6c1a2911ceb30990af1f7ec071ea3bd53
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/JetGroupRegister.h
@@ -0,0 +1,44 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TRIGHLTJETHYPO_JETGROUPREGISTER_H
+#define TRIGHLTJETHYPO_JETGROUPREGISTER_H
+
+#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/HypoJetDefs.h"
+
+#include <map>
+#include <algorithm>
+
+// maintain a register of ordered vectors HypoJets 
+
+struct HypoJetLess{
+  bool operator() (const HypoJetVector::value_type& l,
+		   const HypoJetVector::value_type& r) const {
+    return l.get() < r.get();
+  }
+};
+
+struct HypoJetVectorLess{
+  bool operator() (const HypoJetVector& l,
+		   const HypoJetVector& r) const {
+    
+    return std::lexicographical_compare(l.begin(),
+					l.end(),
+					r.begin(),
+					r.end(),
+					HypoJetLess());
+  }
+};
+
+
+class JetGroupRegister {
+ public:
+
+  std::size_t record(HypoJetVector v);  // copy vector
+
+ private:
+  std::map<HypoJetVector, std::size_t, HypoJetVectorLess> m_reg;
+    
+};
+#endif
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AllJetsGrouper.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AllJetsGrouper.cxx
index fcbfca501e77312285ce97dd51b1eae48480a0a6..17a701f3e9ff70af4eaaf14ba875be3f997dc7dd 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AllJetsGrouper.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AllJetsGrouper.cxx
@@ -7,8 +7,8 @@
 
 AllJetsGrouper:: AllJetsGrouper(){}
 
-AllJetsGrouper:: AllJetsGrouper(const HypoJetIter& b,
-				const HypoJetIter& e): m_jets(b, e){
+AllJetsGrouper:: AllJetsGrouper(const HypoJetCIter& b,
+				const HypoJetCIter& e): m_jets(b, e){
 }
 
 AllJetsGrouper:: AllJetsGrouper(const HypoJetVector& jets): m_jets{jets}{
@@ -23,14 +23,13 @@ std::vector<HypoJetGroupVector> AllJetsGrouper::group(HypoJetIter& begin,
   return std::vector<HypoJetGroupVector>{hjgv};
 }
 
-std::optional<HypoJetGroupVector> AllJetsGrouper::next(){
+std::optional<HypoJetVector> AllJetsGrouper::next(){
   if (m_done){
-    return std::optional<HypoJetGroupVector>();
+    return std::optional<HypoJetVector>();
   }
   
-  HypoJetGroupVector hjgv{HypoJetVector(m_jets)};
   m_done = true;
-  return std::make_optional<HypoJetGroupVector>(hjgv);
+  return std::make_optional<HypoJetVector>(m_jets);
 }
 
 std::string AllJetsGrouper::getName() const {
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/CombinationsGrouper.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/CombinationsGrouper.cxx
index e05b643e00c4e575c5bb3d70fa1dfebe2b2d97d8..31a4a8e367312fe38416e5d6d17df0a693ff3f35 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/CombinationsGrouper.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/CombinationsGrouper.cxx
@@ -46,7 +46,7 @@ CombinationsGrouper::group(HypoJetIter& begin, HypoJetIter& end) const {
   return std::vector<HypoJetGroupVector>{hjgv};
 }
 
-std::optional<HypoJetGroupVector>
+std::optional<HypoJetVector>
 CombinationsGrouper::next() {
   HypoJetGroupVector hjgv;
   
@@ -56,13 +56,13 @@ CombinationsGrouper::next() {
   
   auto combs = combgen.next();
   if (combs.second == false){
-    std::optional<HypoJetGroupVector>();
+    std::optional<HypoJetVector>();
   }
   
   HypoJetVector v;
   for(auto i : combs.first){ v.push_back(*(m_jets.begin() + i));}
   
-  return std::make_optional<HypoJetGroupVector>(hjgv);
+  return std::make_optional<HypoJetVector>(v);
 }
 
 std::string CombinationsGrouper::getName() const {
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/IndexedJetsGrouper.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/IndexedJetsGrouper.cxx
index 1abd209d030ccaf7b58acdac5423e6240711ba41..c905fc57409af698e93725b38b1b06482154c114 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/IndexedJetsGrouper.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/IndexedJetsGrouper.cxx
@@ -78,7 +78,7 @@ IndexedJetsGrouper::group(HypoJetIter& begin, HypoJetIter& end) const{
 }
 
 
-std::optional<HypoJetGroupVector>
+std::optional<HypoJetVector>
 IndexedJetsGrouper::next(){
 
   // exhausts after a single group
@@ -86,14 +86,13 @@ IndexedJetsGrouper::next(){
   // check if there are enough jets find the highest (last, as the vector is
   // ordered) and see if it lies within the jet vector
 
-  if (m_done) { return std::optional<HypoJetGroupVector>(); }
-  if (m_indices.empty()) { return std::optional<HypoJetGroupVector>(); }
+  if (m_done) { return std::optional<HypoJetVector>(); }
+  if (m_indices.empty()) { return std::optional<HypoJetVector>(); }
   
-  auto hjgv = HypoJetGroupVector();
   auto last_jet_pos =  m_indices.back();
   if (m_jets.size() <= last_jet_pos) {
     m_done = true;
-    return std::optional<HypoJetGroupVector>();
+    return std::optional<HypoJetVector>();
   }
   
   // sort jets by descending Et
@@ -103,13 +102,12 @@ IndexedJetsGrouper::next(){
                      DescendingEt());
   
   // place the jets at positions in the index vector into the inner vector
-  HypoJetVector inner;
-  for (auto i : m_indices){inner.push_back(*(m_jets.begin() + i));}
+  HypoJetVector hjv;
+  for (auto i : m_indices){hjv.push_back(*(m_jets.begin() + i));}
   
   // push the inner vector into the outer vector
-  hjgv.push_back(inner);
   m_done = true;
-  return std::make_optional<HypoJetGroupVector>(hjgv);
+  return std::make_optional<HypoJetVector>(hjv);
 }
 
 
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/SingleJetGrouper.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/SingleJetGrouper.cxx
index 80441003fc073e648cd432ff0d7c48e109d87be8..54de42f78560c4de5b97cbcb7d5a0723ef670be2 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/SingleJetGrouper.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/SingleJetGrouper.cxx
@@ -7,12 +7,13 @@
 
 SingleJetGrouper::SingleJetGrouper(){}
 
-SingleJetGrouper::SingleJetGrouper(const HypoJetVector& v): m_jets(v){
+SingleJetGrouper::SingleJetGrouper(const HypoJetVector& v):
+  m_jets(v), m_size{v.size()}{
 }
 
 SingleJetGrouper::SingleJetGrouper(const HypoJetCIter& b,
 				   const HypoJetCIter& e):
-  m_jets(b, e){
+  m_jets(b, e), m_size{m_jets.size()}{
 }
 
 std::vector<HypoJetGroupVector> SingleJetGrouper::group(HypoJetIter& begin,
@@ -28,15 +29,14 @@ std::vector<HypoJetGroupVector> SingleJetGrouper::group(HypoJetIter& begin,
   return std::vector<HypoJetGroupVector>{hjgv};
 }
 
-std::optional<HypoJetGroupVector>
+std::optional<HypoJetVector>
 SingleJetGrouper::next() {
   if (m_index == m_size){
-    return std::optional<HypoJetGroupVector>();
+    return std::optional<HypoJetVector>();
   }
   
-  HypoJetGroupVector result;
-  result.push_back(HypoJetVector{m_jets[m_index++]});
-  return std::make_optional<HypoJetGroupVector>(result);
+  HypoJetVector result{m_jets[m_index++]};
+  return std::make_optional<HypoJetVector>(result);
 }
 
 std::string SingleJetGrouper::getName() const {
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_capacitychecked.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_capacitychecked.h
index 77e0dcb6c7aaf661b561d70f7cdfdfb7a3d14d82..3daf31fa69706ea59502e8944f255b60ec6529f6 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_capacitychecked.h
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_capacitychecked.h
@@ -37,9 +37,9 @@ public extends<AthAlgTool, ITrigJetCapacityCheckedConditionConfig> {
 
   
 
-  Gaudi::Property<std::size_t> m_chainPartInd {this,
+  Gaudi::Property<int> m_chainPartInd {this,
     "chainPartInd",
-    {0},
+    {-1},
     "identifier for chain leg - used to group jets for jet hypo clients "};
 
 
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_htfr.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_htfr.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..6f0878909c7b731b1e49c1c0bb84099afe874ca6
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_htfr.cxx
@@ -0,0 +1,49 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+/*
+  Instantiator for Htfr Conditions
+ */
+#include "TrigJetConditionConfig_htfr.h"
+#include "GaudiKernel/StatusCode.h"
+#include "./HTConditionFastReduction.h"
+#include "./ArgStrToDouble.h"
+
+TrigJetConditionConfig_htfr::TrigJetConditionConfig_htfr(const std::string& type,
+                                                 const std::string& name,
+                                                 const IInterface* parent) :
+  base_class(type, name, parent){
+
+}
+
+
+StatusCode TrigJetConditionConfig_htfr::initialize() {
+  CHECK(checkVals());
+
+  return StatusCode::SUCCESS;
+}
+
+
+ConditionMT TrigJetConditionConfig_htfr::getCondition() const {
+  auto a2d = ArgStrToDouble();
+  return std::make_unique<HTConditionFastReduction>(a2d(m_min), a2d(m_max));
+}
+
+
+StatusCode TrigJetConditionConfig_htfr::checkVals() const {
+    auto a2d = ArgStrToDouble();
+  if (a2d(m_min) > a2d(m_max)){
+    ATH_MSG_ERROR("htMin > htMax");
+    return StatusCode::FAILURE;
+  }
+  return StatusCode::SUCCESS;
+}
+
+bool TrigJetConditionConfig_htfr::addToCapacity(std::size_t) {
+  return false;
+}
+
+std::size_t TrigJetConditionConfig_htfr::capacity() const {
+  return getCondition()->capacity();
+}
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_htfr.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_htfr.h
new file mode 100644
index 0000000000000000000000000000000000000000..8f2f9ec067943a5c9819a24c7f47f766fd576e87
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetConditionConfig_htfr.h
@@ -0,0 +1,45 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TRIGJETCONDITIONCONFIG_HTFR_H
+#define TRIGJETCONDITIONCONFIG_HTFR_H
+
+/*
+Condiguration AlgTool for ht conditions to be run in FastReduction
+PS 
+*/
+
+#include "ITrigJetConditionConfig.h"
+#include "./ConditionsDefsMT.h"
+#include "AthenaBaseComps/AthAlgTool.h"
+
+#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h"
+
+class TrigJetConditionConfig_htfr:
+public extends<AthAlgTool, ITrigJetConditionConfig> {
+
+ public:
+  
+  TrigJetConditionConfig_htfr(const std::string& type,
+			      const std::string& name,
+			      const IInterface* parent);
+
+  virtual StatusCode initialize() override;
+  virtual ConditionMT getCondition() const override;
+
+  virtual bool addToCapacity(std::size_t) override;
+  virtual std::size_t capacity() const override;
+
+ private:
+
+
+  Gaudi::Property<std::string>
+    m_min{this, "min", {}, "min HT"};
+
+  Gaudi::Property<std::string>
+    m_max{this, "max", {}, "max HT"};
+
+  StatusCode checkVals()  const;
+};
+#endif
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_fastreduction.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_fastreduction.cxx
index c819ee3580b170c7d76d5fd5fe25f403a6890a10..eb8b9b40796aa7dd45122ea4ef6325f2c4024a44 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_fastreduction.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_fastreduction.cxx
@@ -9,12 +9,12 @@
 
 #include "./conditionsFactoryMT.h"
 
-#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/SingleJetGrouper.h"
 #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/xAODJetAsIJetFactory.h"
 #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerFactory.h"
 #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/TrigHLTJetHypoHelper2.h"
-#include "./groupsMatcherFactoryMT.h"
 #include "./CapacityCheckedCondition.h"
+#include "./FastReductionMatcher.h"
+#include "./Tree.h"
 
 #include "TrigCompositeUtils/TrigCompositeUtils.h"
 
@@ -134,29 +134,49 @@ TrigJetHypoToolConfig_fastreduction::getConditions() const {
   return std::make_optional<ConditionsMT>(std::move(conditions));
 }
 
+
+std::vector<std::unique_ptr<ConditionFilter>>
+TrigJetHypoToolConfig_fastreduction::getConditionFilters() const {
+
+  auto filters = std::vector<std::unique_ptr<ConditionFilter>>();
+  
+  for(const auto& cm : m_filtConditionMakers){
+    ConditionPtrs filterConditions;  // will contain a single Condition
+    filterConditions.push_back(std::move(cm->getCapacityCheckedCondition()));
+    auto cf = std::make_unique<ConditionFilter>(filterConditions);
+    filters.push_back(std::move(cf));
+  }
+  
+  return filters;
+}
+
 // following function not used for treeless hypos
 std::size_t
 TrigJetHypoToolConfig_fastreduction::requiresNJets() const {
   return 0;
 }
 
- 
-std::unique_ptr<IJetGrouper>
-TrigJetHypoToolConfig_fastreduction::getJetGrouper() const {
-  return std::make_unique<SingleJetGrouper>();
-}
 
-std::unique_ptr<IGroupsMatcherMT>
+std::unique_ptr<IJetsMatcherMT>
 TrigJetHypoToolConfig_fastreduction::getMatcher () const {
 
   auto opt_conds = getCapacityCheckedConditions();
 
   if(!opt_conds.has_value()){
-    return std::unique_ptr<IGroupsMatcherMT>(nullptr);
+    return std::unique_ptr<IJetsMatcherMT>(nullptr);
   }
 
-  return groupsMatcherFactoryMT_FastReduction(std::move(*opt_conds),
-					      m_treeVec);
+  auto matcher =  std::unique_ptr<IJetsMatcherMT>();
+  //  matcher.reset(new FastReductionMatcher(std::move(*opt_conds),
+  //					 Tree(m_treeVec)));
+
+  auto conditions = std::move(*opt_conds);
+  auto filters = getConditionFilters();
+  auto fpm = new FastReductionMatcher(conditions,
+				      filters,
+				      Tree(m_treeVec));
+  matcher.reset(fpm);
+  return matcher;
 }
 
 StatusCode TrigJetHypoToolConfig_fastreduction::checkVals() const {
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_fastreduction.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_fastreduction.h
index 26a33fe89d6c5d78534ddfbd548e17c318e5e9e3..91622b23b5508e43bbb39d322e47f981670e0117 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_fastreduction.h
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_fastreduction.h
@@ -13,22 +13,23 @@
  *********************************************************************/
 
 
-#include "ITrigJetHypoToolConfig.h"
+#include "ITrigJetHypoToolNoGrouperConfig.h"
 #include "./CapacityCheckedConditionsDefs.h"
 #include "TrigCompositeUtils/HLTIdentifier.h"
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "TrigCompositeUtils/TrigCompositeUtils.h"
 #include "AthenaMonitoringKernel/GenericMonitoringTool.h"
 
+#include "./IJetsMatcherMT.h"
 #include "./ConditionsDefsMT.h"
 #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ICleaner.h"
-#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJetGrouper.h"
 #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerBridge.h"
 #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h"
 #include "./ITrigJetCapacityCheckedConditionConfig.h"
+#include "./ConditionFilter.h"
 
 class TrigJetHypoToolConfig_fastreduction:
-public extends<AthAlgTool, ITrigJetHypoToolConfig> {
+public extends<AthAlgTool, ITrigJetHypoToolNoGrouperConfig> {
 
  public:
   
@@ -39,17 +40,24 @@ public extends<AthAlgTool, ITrigJetHypoToolConfig> {
 
   virtual StatusCode initialize() override;
   virtual std::vector<std::shared_ptr<ICleaner>> getCleaners() const override;
-  virtual std::unique_ptr<IJetGrouper> getJetGrouper() const override;
-  virtual std::unique_ptr<IGroupsMatcherMT> getMatcher() const override;
+  virtual std::unique_ptr<IJetsMatcherMT> getMatcher() const override;
   virtual std::optional<ConditionsMT> getConditions() const override;
+
+  virtual std::vector<std::unique_ptr<ConditionFilter>>
+  getConditionFilters() const override;
+
   virtual std::size_t requiresNJets() const override;
   virtual StatusCode checkVals() const override;
 
 
  private:
   ToolHandleArray<ITrigJetCapacityCheckedConditionConfig> m_conditionMakers{
-    this, "conditionMakers", {}, "hypo tree node to conditiionMaker map"};
+    this, "conditionMakers", {}, "hypo tree Condition builder AlgTools"};
 
+  ToolHandleArray<ITrigJetCapacityCheckedConditionConfig> m_filtConditionMakers{
+    this, "filtConditionsMakers", {},
+    "hypo tree Condition builder AlgTools for Condition filters"};
+  
   Gaudi::Property<std::vector<std::size_t>> m_treeVec{
     this, "treeVector", {}, "integer sequence representation of jet hypo tree"};
 
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolHelperNoGrouper.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolHelperNoGrouper.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..b73271b5df7334b340ffc2a199aff9580c220374
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolHelperNoGrouper.cxx
@@ -0,0 +1,141 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "./TrigJetHypoToolHelperNoGrouper.h"
+#include "./ITrigJetHypoInfoCollector.h"
+#include "./xAODJetCollector.h"
+#include "./JetTrigTimer.h"
+#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerFactory.h"
+#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/xAODJetAsIJet.h"  // TLorentzVec
+#include "./nodeIDPrinter.h"
+#include "./DebugInfoCollector.h"
+#include <algorithm>
+#include <sstream>
+
+TrigJetHypoToolHelperNoGrouper::TrigJetHypoToolHelperNoGrouper(const std::string& type,
+							       const std::string& name,
+							       const IInterface* parent) :
+  base_class(type, name, parent){
+}
+
+StatusCode TrigJetHypoToolHelperNoGrouper::initialize() {
+
+  for (const auto& config : m_configs) {
+    m_matchers.push_back(std::move(config->getMatcher()));
+  }
+		  
+  return StatusCode::SUCCESS;
+}
+
+void
+TrigJetHypoToolHelperNoGrouper::collectData(const std::string& exetime,
+					    const std::unique_ptr<ITrigJetHypoInfoCollector>& collector,
+					    const std::optional<bool>& pass) const {
+  if(!collector){return;}
+  auto helperInfo = nodeIDPrinter("TrigJetHypoToolHelperNoGrouper",
+                                  pass,
+                                  exetime
+                                  );
+  
+  collector->collect(name(), helperInfo);
+}
+
+
+bool
+TrigJetHypoToolHelperNoGrouper::pass(HypoJetVector& jets,
+				     xAODJetCollector& jetCollector,
+				     const std::unique_ptr<ITrigJetHypoInfoCollector>& collector) const {
+  
+  if(collector){
+    std::stringstream ss;
+    ss <<  "No of jets " + std::to_string(jets.size()) + '\n';
+    ss << jets; 
+    collector->collect(name(), ss.str());
+  }
+
+  JetTrigTimer timer;
+  timer.start();
+  
+  if(jets.empty()){   
+    timer.stop();
+    bool pass = false;
+    collectData(timer.readAndReset(), collector, pass);
+    return pass;
+  }
+
+  // jet cleaning
+  HypoJetIter jets_begin = jets.begin(); 
+  HypoJetIter jets_end = jets.end(); 
+  for(auto cleaner: m_cleaners){
+    jets_end = std::partition(jets_begin,
+			      jets_end,
+			      [cleaner](const pHypoJet& j){
+				return cleaner->select(j);}
+			      );
+  }
+
+  // see if matchers pass. Each matcher conatains a FastReducer tree.
+  // if  > matcher, this means the conditions of different trees may
+  // share jets.
+  bool pass = true;
+  for (const auto& matcher : m_matchers){
+    auto matcher_pass = matcher->match(jets_begin,
+				       jets_end,
+				       jetCollector,
+				       collector);
+    if (!matcher_pass.has_value()) {
+      ATH_MSG_ERROR("Matcher cannot determine result. Config error?");
+      return false;
+    }
+
+    if (!(*matcher_pass)){
+      pass = false;
+      break;
+    }
+  }
+  
+  timer.stop();
+  collectData(timer.readAndReset(), collector, pass);
+
+  return pass;
+}
+
+std::string TrigJetHypoToolHelperNoGrouper::toString() const {
+  
+  
+  std::stringstream ss;
+  ss << name();
+  
+  ss << "Cleaners:\n No of cleaners: "  << m_cleaners.size() << '\n';
+  
+  for(auto cleaner : m_cleaners) {
+    ss << cleaner->toString() 
+       << '\n';
+  }
+  
+  ss << "\nMatchers [" << m_matchers.size() << "]:\n\n";
+  unsigned int imatcher{0};
+  for (const auto & matcher : m_matchers) {
+    ss << "matcher " << imatcher++ << '\n';
+    ss << matcher -> toString();
+  }
+  
+  return ss.str();
+}
+
+
+StatusCode
+TrigJetHypoToolHelperNoGrouper::getDescription(ITrigJetHypoInfoCollector& c) const {
+  c.collect(name(), toString());
+  return StatusCode::SUCCESS;
+}
+
+
+std::size_t TrigJetHypoToolHelperNoGrouper::requiresNJets() const {
+  return m_configs[0]->requiresNJets();
+}
+
+
+
+
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolHelperNoGrouper.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolHelperNoGrouper.h
new file mode 100644
index 0000000000000000000000000000000000000000..c398770e741ab74022aa9f21b63b895bcbc52fe0
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolHelperNoGrouper.h
@@ -0,0 +1,82 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TRIGHLTJETHYPO_TRIGJETHYPOHELPERNOGROUPER_H
+#define TRIGHLTJETHYPO_TRIGJETHYPOHELPERNOGROUPER_H
+
+/**
+ * A configurable helper class to implement Jet Trigger algorithms.
+ * Initial jet removal from incomming container is done using the ICleaner predicates.
+ * The surviving jets are grouped into subsets by the IJetGroup object.
+ *
+ * The IMatcher objector owns a set of Conditions objects. 
+ * The Matcher determines 
+ * whether the container of jet groups satisfies the Conditions. If so,
+ * the event passes, otherwise it fails.
+ *
+ */
+
+#include <vector>
+#include <memory>
+#include "AthenaBaseComps/AthAlgTool.h"
+#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ICleanerTool.h"
+#include "./IJetsMatcherMT.h"
+#include "./ConditionsDefsMT.h"
+
+#include "TrigHLTJetHypo/ITrigJetHypoToolHelperMT.h"
+#include "ITrigJetHypoToolNoGrouperConfig.h"
+
+class ITrigJetHypoInfoCollector;
+class xAODJetCollector;
+
+class TrigJetHypoToolHelperNoGrouper:
+public extends<AthAlgTool, ITrigJetHypoToolHelperMT> {
+
+ public:
+  TrigJetHypoToolHelperNoGrouper(const std::string& type,
+                          const std::string& name,
+                          const IInterface* parent);
+
+  StatusCode initialize() override;
+  virtual bool
+
+    // pass - tests wethewr a jet collection passes cuts, and collects
+    // information about the decision.
+    pass(HypoJetVector&,
+	 xAODJetCollector&,
+	 const std::unique_ptr<ITrigJetHypoInfoCollector>&) const override;
+  
+  virtual std::size_t requiresNJets() const override;
+  
+  virtual StatusCode getDescription(ITrigJetHypoInfoCollector&) const override;
+
+ private:
+
+  // Object that matches jet groups with Conditions
+  std::vector<std::unique_ptr<IJetsMatcherMT>> m_matchers;
+
+  // Bridge objects to ICleaner predicate function objects to allow polymorphic
+  // pointers to be used with the STL (pass by value).
+  ToolHandleArray<ICleanerTool> m_cleaners;
+
+  ///////////////////////////////
+
+ // Used to generate helper objects foe TrigHLTJetHelper
+ // from user supplied values
+ ToolHandleArray<ITrigJetHypoToolNoGrouperConfig> m_configs {
+   this, "HypoConfigurers", {},
+   "Configurers to set up TrigJetHypoHelperNoGrouper"}; 
+
+  Gaudi::Property<bool>
+  m_debug {this, "debug", false, "instantantiate helpers with this debug flag"};
+  
+
+ void collectData(const std::string& exetime,
+                  const std::unique_ptr<ITrigJetHypoInfoCollector>&,
+                  const std::optional<bool>& pass) const;
+
+ virtual std::string toString() const override;
+};
+
+#endif
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx
index d573062d7aae581e9e1356d5d313398a4319eac6..3f1141a4035749d5517fefe64a0c84ef5742ac0a 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx
@@ -42,17 +42,18 @@ TrigJetHypoToolMT::~TrigJetHypoToolMT(){
 }
 
 StatusCode TrigJetHypoToolMT::initialize(){
-  DebugInfoCollector collector(name());
-  CHECK(m_helper->getDescription(collector));
-  auto s = collector.toString();
-  
-  for(const auto& l : lineSplitter(s)){
-    ATH_MSG_INFO(l);
-  }
-  
+
   if (m_visitDebug){
-    collector.write();
+
+    DebugInfoCollector collector(name());
+    CHECK(m_helper->getDescription(collector));
+    auto s = collector.toString();
+  
+    for(const auto& l : lineSplitter(s)){
+      ATH_MSG_INFO(l);
+    }
   }
+
   return StatusCode::SUCCESS;
 }
 
@@ -75,7 +76,7 @@ TrigJetHypoToolMT::decide(const xAOD::JetContainer* jets,
 
   std::unique_ptr<ITrigJetHypoInfoCollector> infocollector(nullptr);
   if(m_visitDebug){
-    auto collectorName = name() + std::to_string(m_eventSN->getSN());
+    auto collectorName = name() + "_" + std::to_string(m_eventSN->getSN());
     infocollector.reset(new  DebugInfoCollector(collectorName));
   }
   
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx
index 2ef7d1045234acf52559225a1bf2dc2a29c6fe95..4974748f7260026bcd956dea9e4ad01c8ba1b568 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx
@@ -20,6 +20,7 @@
 #include "../TrigJetConditionConfig_signed_eta.h"
 #include "../TrigJetConditionConfig_et.h"
 #include "../TrigJetConditionConfig_ht.h"
+#include "../TrigJetConditionConfig_htfr.h"
 #include "../TrigJetConditionConfig_dijet_mass.h"
 #include "../TrigJetConditionConfig_dijet_dphi.h"
 #include "../TrigJetConditionConfig_dijet_deta.h"
@@ -34,6 +35,7 @@
 //
 #include "../TrigJetHypoToolMT.h"
 #include "../TrigJetHypoToolHelperMT.h"
+#include "../TrigJetHypoToolHelperNoGrouper.h"
 #include "../TrigJetTLAHypoAlgMT.h"
 #include "../TrigJetTLAHypoToolMT.h"
 #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/BasicCleanerTool.h"
@@ -64,6 +66,7 @@ DECLARE_COMPONENT(TrigJetConditionConfig_signed_eta)
 DECLARE_COMPONENT(TrigJetConditionConfig_abs_eta)
 DECLARE_COMPONENT(TrigJetConditionConfig_et)
 DECLARE_COMPONENT(TrigJetConditionConfig_ht)
+DECLARE_COMPONENT(TrigJetConditionConfig_htfr)
 DECLARE_COMPONENT(TrigJetConditionConfig_dijet_mass)
 DECLARE_COMPONENT(TrigJetConditionConfig_dijet_deta)
 DECLARE_COMPONENT(TrigJetConditionConfig_dijet_dphi)
@@ -80,6 +83,7 @@ DECLARE_COMPONENT(TrigJetHypoToolMT)
 DECLARE_COMPONENT(TrigJetTLAHypoAlgMT)
 DECLARE_COMPONENT(TrigJetTLAHypoToolMT)
 DECLARE_COMPONENT(TrigJetHypoToolHelperMT)
+DECLARE_COMPONENT(TrigJetHypoToolHelperNoGrouper)
 
 DECLARE_COMPONENT(BasicCleanerTool)
 DECLARE_COMPONENT(AntiCleanerTool)
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/groupsMatcherFactoryMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/groupsMatcherFactoryMT.cxx
index b34ebadffb584129d617aa6e72c7055113d2bee4..c7baef98e498f0081b9b07af021e768b1e972e8b 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/groupsMatcherFactoryMT.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/groupsMatcherFactoryMT.cxx
@@ -17,17 +17,6 @@ groupsMatcherFactoryMT_SingleCondition (ConditionsMT&& conditions){
 }
 
 
-std::unique_ptr<IGroupsMatcherMT> 
-groupsMatcherFactoryMT_FastReduction (ConditionPtrs&& conditions,
-				      const std::vector<std::size_t>& treeVec){
-  
-  if (conditions.size() == 1) {
-    return std::make_unique<SingleConditionMatcherMT>(std::move(conditions[0]));
-  } else {
-    return std::make_unique<FastReductionMatcher>(std::move(conditions),
-						  treeVec);
-  } 
-}
 
 
 
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/groupsMatcherFactoryMT.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/groupsMatcherFactoryMT.h
index b91b74c3df2786e801e0cf1f1c410097ed48a22b..cde9b776796e6d9c13459c6fc01563578aff7720 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/groupsMatcherFactoryMT.h
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/groupsMatcherFactoryMT.h
@@ -16,7 +16,4 @@ groupsMatcherFactoryMT_SingleCondition(ConditionsMT&&);
 std::unique_ptr<IGroupsMatcherMT>
 groupsMatcherFactoryMT_MaxBipartite(ConditionsMT&&);
 
-std::unique_ptr<IGroupsMatcherMT>
-groupsMatcherFactoryMT_FastReduction(ConditionPtrs&&,
-				     const std::vector<std::size_t>& treeVec);
 #endif
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/nodeIDPrinter.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/nodeIDPrinter.cxx
index 063bf9f17d6d80c485c0f2c5e3e43f385f773374..860b45ee76ad050b3d204912d8d35e91669d9315 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/nodeIDPrinter.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/nodeIDPrinter.cxx
@@ -18,6 +18,17 @@ std::string nodeIDPrinter(const std::string& name,
   return ss.str();
 }
 
+std::string nodeIDPrinter(const std::string& name,
+                          bool pass,
+                          const std::string& timerStr){
+
+  std::stringstream ss;
+  ss << "name(): " << name <<"  pass: " <<std::boolalpha << pass << " "
+     << timerStr << '\n';
+
+  return ss.str();
+}
+
 std::string nodeIDPrinter(const std::string& name,
                           int nodeID,
                           int parentID,
@@ -34,6 +45,21 @@ std::string nodeIDPrinter(const std::string& name,
   return ss.str();
 }
 
+std::string nodeIDPrinter(const std::string& name,
+                          const std::optional<bool>& pass,
+                          const std::string& timerStr){
+  if(pass.has_value()){
+    return nodeIDPrinter(name, *pass, timerStr);
+  }
+
+  
+  std::stringstream ss;
+  
+  ss << "name(): " << name << " pass: " << "ERROR " <<timerStr << '\n';
+
+  return ss.str();
+}
+
 std::string nodeIDPrinter(const std::string& name,
                           int nodeID,
                           int parentID){
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/nodeIDPrinter.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/nodeIDPrinter.h
index 8b56fae12ccd10a8bde06911184c4960ff69636d..4fae2817f05b42c6d63213e704239b56fc5aff4c 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/nodeIDPrinter.h
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/nodeIDPrinter.h
@@ -25,6 +25,10 @@ std::string nodeIDPrinter(const std::string& name,
                           const std::optional<bool>& pass,
                           const std::string& time="");
 
+std::string nodeIDPrinter(const std::string& name,
+                          const std::optional<bool>& pass,
+                          const std::string& time);
+
 
 std::string nodeIDPrinter(const std::string& name,
                           int nodeID,
diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMufastHypoTool.cxx b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMufastHypoTool.cxx
index d975a6c2cfd41ac389d3779d84e28da055980d44..602d47ce93aa70f0168e75fcac792631c02249d9 100644
--- a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMufastHypoTool.cxx
+++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMufastHypoTool.cxx
@@ -322,18 +322,17 @@ StatusCode TrigMufastHypoTool::inclusiveSelection(std::vector<TrigMufastHypoTool
 StatusCode TrigMufastHypoTool::multiplicitySelection(std::vector<TrigMufastHypoTool::MuonClusterInfo>& toolInput) const{
 
    HLT::Index2DVec passingSelection( m_ptBins.size() );
-   size_t elementIndex{ 0 };
 
    for ( size_t cutIndex=0; cutIndex < m_ptBins.size(); ++cutIndex ) {
+      size_t elementIndex{ 0 };
       for ( auto& i: toolInput ) {
 
 	if(!m_acceptAll && m_applyOR && !i.passOR) {
 	  ATH_MSG_DEBUG("skip due to overap, DecisionID " << m_decisionId );
+	  elementIndex++;
 	  continue;
 	}
 
-	elementIndex = &i - &toolInput.front();
-
          // If muon event has difference DecisionID, it shouldn't apply.
          if ( TrigCompositeUtils::passed( m_decisionId.numeric(), i.previousDecisionIDs ) ) {
             if ( decideOnSingleObject( i, cutIndex ) == true ) {
@@ -345,6 +344,7 @@ StatusCode TrigMufastHypoTool::multiplicitySelection(std::vector<TrigMufastHypoT
          } else {
             ATH_MSG_DEBUG("Not match DecisionID " << m_decisionId );
          }
+         elementIndex++;
       }
 
       // If no object passes the selection, multipul selection should stop.
diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigmuCombHypoTool.cxx b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigmuCombHypoTool.cxx
index dc4323fef1c0fed9a47ec5d35e2d9a774edfe370..78c4ede0260031c7e3075f2d7a412f8f1547ef77 100644
--- a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigmuCombHypoTool.cxx
+++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigmuCombHypoTool.cxx
@@ -275,18 +275,17 @@ StatusCode TrigmuCombHypoTool::inclusiveSelection(std::vector<TrigmuCombHypoTool
 StatusCode TrigmuCombHypoTool::multiplicitySelection(std::vector<TrigmuCombHypoTool::CombinedMuonInfo>& input) const
 {
    HLT::Index2DVec passingSelection( m_ptBins.size() );
-   size_t elementIndex{ 0 };
 
    for ( size_t cutIndex=0; cutIndex < m_ptBins.size(); ++cutIndex ) {
+      size_t elementIndex{ 0 };
       for ( auto& i: input ) {
 
 	if(!m_acceptAll && m_applyOR && !i.passOR) {
 	  ATH_MSG_DEBUG("skip due to overap, DecisionID " << m_decisionId );
+	  elementIndex++;
 	  continue;
 	}
 
-	elementIndex = &i - &input.front();
-
          // If muon event has difference DecisionID, it shouldn't apply.
          if ( TrigCompositeUtils::passed( m_decisionId.numeric(), i.previousDecisionIDs ) ) {
             if ( decideOnSingleObject( i, cutIndex ) == true ) {
@@ -298,6 +297,7 @@ StatusCode TrigmuCombHypoTool::multiplicitySelection(std::vector<TrigmuCombHypoT
          } else {
             ATH_MSG_DEBUG("Not match DecisionID " << m_decisionId );
          }
+         elementIndex++;
       }
 
       // If no object passes the selection, multipul selection should stop.
diff --git a/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.cxx b/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.cxx
index 890651d8809413cd852e3b32e6741f3ad622525a..78a8f419f534aaf810c79565d47bb44e004a2b11 100644
--- a/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.cxx
+++ b/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.cxx
@@ -38,6 +38,9 @@ LVL1CTP::ResultBuilder::ResultBuilder( const std::string& type,
 
 LVL1CTP::ResultBuilder::~ResultBuilder() {
    delete m_ctpDataFormat;
+   for(auto & x : m_internalTrigger) {
+      delete x.second;
+   }
 }
 
 
@@ -78,10 +81,10 @@ LVL1CTP::ResultBuilder::createTriggerConfigMaps(const ConfigSource & cfgSrc) con
       }
 
       // build map of name to ctp thresholds
-      m_thrConfigMap = new ThresholdMap( cfgSrc.l1menu() );
+      m_thrConfigMap = std::make_unique<ThresholdMap>( cfgSrc.l1menu() );
 
       // build map of name to ctp items
-      m_itemConfigMap = new ItemMap( cfgSrc.l1menu() );
+      m_itemConfigMap = std::make_unique<ItemMap>( cfgSrc.l1menu() );
 
    } else if( cfgSrc.ctpConfig() != nullptr ) {
 
@@ -102,9 +105,9 @@ LVL1CTP::ResultBuilder::createTriggerConfigMaps(const ConfigSource & cfgSrc) con
          m_internalTrigger[ rndm->name() ] = rndm;
       }
 
-      m_thrConfigMap = new ThresholdMap( cfgSrc.ctpConfig()->menu().thresholdVector());
+      m_thrConfigMap = std::make_unique<ThresholdMap>( cfgSrc.ctpConfig()->menu().thresholdVector());
 
-      m_itemConfigMap = new ItemMap( cfgSrc.ctpConfig()->menu().itemVector(), 
+      m_itemConfigMap = std::make_unique<ItemMap>( cfgSrc.ctpConfig()->menu().itemVector(),
                                      cfgSrc.ctpConfig()->prescaleSet() );
    } else {
       ATH_MSG_FATAL("No L1 trigger menu was provided");
diff --git a/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.h b/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.h
index a211285f9b046af562b1646066a8f7dcb87da868..3694457bd1e839f1bb5fe7dfc0ec2cd2e9b4fafa 100644
--- a/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.h
+++ b/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.h
@@ -95,8 +95,8 @@ namespace LVL1CTP {
       std::vector<std::string> firedItems(const std::vector<uint32_t>& triggerWords) const;
 
       // configuration information
-      mutable ThresholdMap*         m_thrConfigMap ATLAS_THREAD_SAFE { nullptr };    //!< Map between threshold objects and their CTP-internal description
-      mutable ItemMap*              m_itemConfigMap ATLAS_THREAD_SAFE { nullptr };   //!< Map between item objects and their CTP-internal description
+      mutable std::unique_ptr<ThresholdMap>         m_thrConfigMap ATLAS_THREAD_SAFE { nullptr };    //!< Map between threshold objects and their CTP-internal description
+      mutable std::unique_ptr<ItemMap>              m_itemConfigMap ATLAS_THREAD_SAFE { nullptr };   //!< Map between item objects and their CTP-internal description
       mutable InternalTriggerMap    m_internalTrigger ATLAS_THREAD_SAFE;             //!< internal triggers BGRP and RNDM
       unsigned int                  m_ctpVersionNumber { 4 };      //!< CTP data format version (4 in most of Run 2 and in Run 3) 
       CTPdataformatVersion*         m_ctpDataFormat { nullptr };   //!< CTP data format details
diff --git a/Trigger/TrigTools/TrigInDetConfig/python/EFIDTracking.py b/Trigger/TrigTools/TrigInDetConfig/python/EFIDTracking.py
index 4a87c9fe72e51f729f2fdfbc8946d87ea87a12ac..a66a496281f26f26b3c81367469a0cc7875df75b 100644
--- a/Trigger/TrigTools/TrigInDetConfig/python/EFIDTracking.py
+++ b/Trigger/TrigTools/TrigInDetConfig/python/EFIDTracking.py
@@ -1,242 +1,147 @@
-#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 #
-#           Setup of precision tracking
+#           Setup of offline pattern recognition tracking for ID Trigger
+#Heavily inspired by the offline version:
+#https://gitlab.cern.ch/atlas/athena/blob/master/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
 
 from __future__ import print_function
 
 from AthenaCommon.Include import include
 include.block("InDetTrigRecExample/EFInDetConfig.py")
 include("InDetTrigRecExample/InDetTrigRec_jobOptions.py") # this is needed to get InDetTrigFlags
-#from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags
 
 from AthenaCommon.Logging import logging 
 log = logging.getLogger("EFIDTracking")
 
-#Start using already decided naming conventions
-#TODO: remap might not be needed in the end once this is consistent with FTF configuration
-#def remap_signature( signature ):
-#   if signature == 'electron':
-#       return 'Electron'
-#   else:
-#        return signature
-
-#def makeInDetPrecisionTracking( whichSignature, verifier = False, inputFTFtracks='TrigFastTrackFinder_Tracks', outputTrackPrefixName = "HLT_ID", rois = 'EMViewRoIs' ):
-#  doTRTextension = False 
-#  ptAlgs = [] #List containing all the precision tracking algorithms hence every new added alg has to be appended to the list
-
-
-  #-----------------------------------------------------------------------------
-  #                        Naming conventions
-
-
-
-
-
-  #-----------------------------------------------------------------------------
-  #                        Verifying input data for the algorithms
-  
-  #If run in views need to check data dependancies!
-  #NOTE: this seems necessary only when PT is called from a different view than FTF otherwise causes stalls
-#  if verifier:
-#         verifier.DataObjects += [  ( 'InDet::PixelGangedClusterAmbiguities' , 'StoreGateSvc+TrigPixelClusterAmbiguitiesMap' ),
-#                                  ( 'TrackCollection' , 'StoreGateSvc+' + inputFTFtracks ) ] 
-      
-  
-  #-----------------------------------------------------------------------------
-  #                        Pattern recognition stage
-#def __init__(self, InputCollections = None, ResolvedTrackCollectionKey = None, SiSPSeededTrackCollectionKey = None , NewTrackingCuts = None, TrackCollectionKeys=[] , TrackCollectionTruthKeys=[]):
-
-#Start using already decided naming conventions
-#TODO: remap might not be needed in the end once this is consistent with FTF configuration
-#TODO unify with PT remap
-#def remap_signature( signature ):
-#   if signature == 'electron':
-#       return 'Electron'
-#   else:
-#        return signature
 
+#Create a view verifier for necessary data collections
+def get_idtrig_view_verifier(name):
+   import AthenaCommon.CfgMgr as CfgMgr
+   from AthenaCommon.GlobalFlags import globalflags
+   from .InDetTrigCollectionKeys import  TrigPixelKeys, TrigSCTKeys
+   from InDetRecExample.InDetKeys import InDetKeys
+   from TrigInDetConfig.TrigInDetConfig import InDetCacheNames
+   viewDataVerifier = CfgMgr.AthViews__ViewDataVerifier( name )
+   viewDataVerifier.DataObjects = [
+                                     ( 'InDet::SCT_ClusterContainer',   TrigSCTKeys.Clusters ),
+                                     ( 'InDet::PixelClusterContainer',  TrigPixelKeys.Clusters ),
+                                     ( 'SpacePointContainer',           TrigSCTKeys.SpacePoints ),
+                                     ( 'SpacePointContainer',           TrigPixelKeys.SpacePoints ),
+                                     ( 'SpacePointOverlapCollection',   'StoreGateSvc+OverlapSpacePoints' ),
+                                     ( 'InDet::PixelGangedClusterAmbiguities' , 'StoreGateSvc+TrigPixelClusterAmbiguitiesMap' )
+                                     ]
+   
+   viewDataVerifier.DataObjects += [( 'InDet::PixelClusterContainerCache' , InDetCacheNames.Pixel_ClusterKey ),
+                                   ( 'PixelRDO_Cache' , InDetCacheNames.PixRDOCacheKey ),
+                                   ( 'InDet::SCT_ClusterContainerCache' , InDetCacheNames.SCT_ClusterKey ),
+                                   ( 'SCT_RDO_Cache' , InDetCacheNames.SCTRDOCacheKey ),
+                                   ( 'SpacePointCache' , InDetCacheNames.SpacePointCachePix ),
+                                   ( 'SpacePointCache' , InDetCacheNames.SpacePointCacheSCT ),
+                                   ( 'IDCInDetBSErrContainer_Cache' , InDetCacheNames.PixBSErrCacheKey ),
+                                   ( 'IDCInDetBSErrContainer_Cache' , InDetCacheNames.SCTBSErrCacheKey ),
+                                   ( 'IDCInDetBSErrContainer_Cache' , InDetCacheNames.SCTFlaggedCondCacheKey ),
+                                   ( 'IDCInDetBSErrContainer',        'StoreGateSvc+SCT_FlaggedCondData' ),
+                                   ( 'IDCInDetBSErrContainer',        'StoreGateSvc+SCT_FlaggedCondData_TRIG' ),
+                                   ( 'IDCInDetBSErrContainer',        'StoreGateSvc+SCT_ByteStreamErrs' ),
+                                   ( 'IDCInDetBSErrContainer',        'StoreGateSvc+PixelByteStreamErrs' ),
+                                   ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ),
+                                   ( 'TagInfo' , 'DetectorStore+ProcessingTags' )]
+   
+   # Load RDOs if we aren't loading bytestream
+   from AthenaCommon.AlgSequence import AlgSequence
+   topSequence = AlgSequence()
+   
+   topSequence.SGInputLoader.Load += [ ( 'TagInfo' , 'DetectorStore+ProcessingTags' ) ]
+   
+   if not globalflags.InputFormat.is_bytestream():
+     viewDataVerifier.DataObjects +=   [( 'PixelRDO_Container' , InDetKeys.PixelRDOs() ),
+                                        ( 'SCT_RDO_Container' , InDetKeys.SCT_RDOs() ),
+                                        ( 'IDCInDetBSErrContainer' , InDetKeys.PixelByteStreamErrs() ),
+                                        ( 'IDCInDetBSErrContainer' , InDetKeys.SCT_ByteStreamErrs() ), 
+                                        ( 'IDCInDetBSErrContainer',  'StoreGateSvc+SCT_FlaggedCondData' ),
+                                        ]
+   #   topSequence.SGInputLoader.Load += [( 'PixelRDO_Container' , InDetKeys.PixelRDOs() ),
+   #                                      ( 'SCT_RDO_Container' , InDetKeys.SCT_RDOs() ),
+   #                                      ( 'IDCInDetBSErrContainer' , InDetKeys.PixelByteStreamErrs() ),
+   #                                      ( 'IDCInDetBSErrContainer' , InDetKeys.SCT_ByteStreamErrs() )]
+   
+   return viewDataVerifier
+
+
+#Temporary fix before we port offline cuts to trigger code, we are using offline configuration
+def remapToOffline( name ):
+   if name == 'cosmics':
+      return 'Cosmic'
+   else:
+       return name
+
+def makeInDetPatternRecognition( config, verifier = 'IDTrigViewDataVerifier'  ):
+      viewAlgs = [] #list of all algs running in this module
 
-def makeInDetPatternRecognition( whichSignature, rois = 'EMViewRoIs', InputCollections=None,  NewTrackingCuts = None ):
-      from InDetRecExample.InDetJobProperties import InDetFlags
-      #Global keys/names for collections 
-      from InDetRecExample.InDetKeys          import InDetKeys #FIXME: to be replaced with Trig keys?
-      from .InDetTrigCollectionKeys import  TrigPixelKeys, TrigSCTKeys
+      #Load necessary data
+      dataVerifier = None
+      #FIXME: Should not be necessary
+      if verifier:
+         dataVerifier = get_idtrig_view_verifier(verifier+config.name)
+         viewAlgs.append( dataVerifier )
 
-      from AthenaCommon.DetFlags import DetFlags
 
-      from AthenaCommon.AppMgr import ToolSvc
+      #FIXME: For now id setup but eventually port parameters into ConfigSetting in TrigInDetConfig pkg
+      from InDetRecExample.ConfiguredNewTrackingCuts import ConfiguredNewTrackingCuts
+      from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags
+      offName = remapToOffline( config.name )
+      trackingCuts = ConfiguredNewTrackingCuts( offName ) #FIXME: replace cosmic 
+      trackingCuts.__indetflags = InDetTrigFlags
 
-      prefix     = 'InDetTrigMT'
-      suffix =  '_%s'%whichSignature if whichSignature else '' 
-      #Final output track collection
-      #SiSPSeededTrackCollectionKey = "SiSPSeededTracks_%s"%whichSignature 
-      outEFIDTracks             = "HLT_IDTrkTrack_%s_%s"         %( whichSignature, 'EFID')
-      outEFIDTrackParticles     = "HLT_IDTrack_%s_%s"            %( whichSignature, 'EFID')
+      #TODO: to be taken from config info
+      #prefix     = 'InDetTrigMT'
+      #suffix     = '_%s'%whichSignature if whichSignature else '' 
 
+      #outEFIDTracks             = "HLT_IDTrkTrack_%s_%s"         %( whichSignature, 'EFID')
+      #outEFIDTrackParticles     = "HLT_IDTrack_%s_%s"            %( whichSignature, 'EFID')
 
 
-      viewAlgs = [] #list of all algs running in this module
-      #
       # --- decide if use the association tool
-      #
       #FIXME: Make the same decision as offline (based on the tracking cuts)?
-      #if (len(InputCollections) > 0) and (NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or NewTrackingCuts.mode() == "LargeD0" or NewTrackingCuts.mode() == "LowPtLargeD0" or NewTrackingCuts.mode() == "BeamGas" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "ForwardSLHCTracks"  or NewTrackingCuts.mode() == "Disappearing" or NewTrackingCuts.mode() == "VeryForwardSLHCTracks" or NewTrackingCuts.mode() == "SLHCConversionFinding"):
-
-      #Why not use association tool? what are the cases when not needed?
+      #Are all of these needed?
+      #if (len(InputCollections) > 0) and (trackingCuts.mode() == "LowPt" or trackingCuts.mode() == "VeryLowPt" or trackingCuts.mode() == "LargeD0" or trackingCuts.mode() == "LowPtLargeD0" or trackingCuts.mode() == "BeamGas" or trackingCuts.mode() == "ForwardTracks" or trackingCuts.mode() == "ForwardSLHCTracks"  or trackingCuts.mode() == "Disappearing" or trackingCuts.mode() == "VeryForwardSLHCTracks" or trackingCuts.mode() == "SLHCConversionFinding"):
       #usePrdAssociationTool = True
       #else:
-      usePrdAssociationTool = False
-
-
-      import InDetRecExample.TrackingCommon as TrackingCommon
+      usePrdAssociationTool = False #Keep false for now
+      #Do we actually need it?
       if usePrdAssociationTool:
+         from .InDetTrigCommon import prdAssociation_builder
          print ('Running SiSPseedTrackFinder!')
-         #FIXME: switch to naming based on tracking
+         InputCollections = None #Dummy atm
+         prdAssociation = prdAssociation_builder( InputCollections )
+         viewAlgs.append( prdAssociation )
 
-         #FIXME: If so:
-         # 1] Get a new association tool
-         #associationTool = TrackingCommon.getInDetTrigPRDtoTrackMapToolGangedPixels(),
 
-         # 2] Use the ganged pixel from here?
-         #from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigPrdAssociationTool
-
-         # 3] Create the new one as in offline tracking:
-         InDetTrigPrdAssociation = TrackingCommon.getInDetTrackPRD_Association(namePrefix     = prefix,
-                                                                               nameSuffix     = suffix,
-                                                                               TracksName     = list(InputCollections))#This is readHandle #What input collection Thought there are no tracks at this point??! 
-         # 4] if so do I use normal or ganged?
-         #from InDetAssociationTools.InDetAssociationToolsConf import InDet__InDetPRD_AssociationToolGangedPixels
-         #InDetTrigPrdAssociationl = InDet__InDetPRD_AssociationToolGangedPixels(name = "%sPrdAssociationTool%s"%(prefix,suffix),
-         #                                                                          PixelClusterAmbiguitiesMapName = TrigPixelKeys.PRDtoTrackMap )
-         viewAlgs.append( InDetTrigPrdAssociation )
+      #-----------------------------------------------------------------------------
+      #                      Track building stage
 
 
       #FIXME? use trigger flags?
+      # What are the instances when we don't need this?
       #if InDetFlags.doSiSPSeededTrackFinder():
-      doSiSPSeededTrackFinder = True
+      doSiSPSeededTrackFinder = True #True by default to test this
       if doSiSPSeededTrackFinder:
          print ('Running SiSPseedTrackFinder!')
 
-         #FIXME: Need to add different options based on the 
-         from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker
-
-
-         InDetSiSpacePointsSeedMaker = SiSpacePointsSeedMaker (      name                   = "%sInDetSpSeedsMaker%s"%(prefix, suffix), #+NewTrackingCuts.extension(),
-                                                                     pTmin                  = NewTrackingCuts.minPT(),
-                                                                     maxdImpact             = NewTrackingCuts.maxPrimaryImpact(),
-                                                                     maxZ                   = NewTrackingCuts.maxZImpact(),
-                                                                     minZ                   = -NewTrackingCuts.maxZImpact(),
-                                                                     usePixel               = NewTrackingCuts.usePixel(),
-                                                                     SpacePointsPixelName   = TrigPixelKeys.SpacePoints,
-                                                                     # useSCT                 = NewTrackingCuts.useSCT(),
-                                                                     useSCT                 = (NewTrackingCuts.useSCT() and NewTrackingCuts.useSCTSeeding()),
-                                                                     SpacePointsSCTName     = TrigSCTKeys.SpacePoints,
-                                                                     # useOverlapSpCollection = NewTrackingCuts.useSCT(),
-                                                                     useOverlapSpCollection = (NewTrackingCuts.useSCT() and NewTrackingCuts.useSCTSeeding()),
-                                                                     SpacePointsOverlapName = InDetKeys.OverlapSpacePoints(),
-                                                                     radMax                 = NewTrackingCuts.radMax(),
-                                                                     RapidityCut            = NewTrackingCuts.maxEta())
-
-         ToolSvc += InDetSiSpacePointsSeedMaker
-         #FIXME consider specific settings here
-         #if NewTrackingCuts.mode() == "Offline" or InDetFlags.doHeavyIon() or  NewTrackingCuts.mode() == "ForwardTracks":
-         #        InDetSiSpacePointsSeedMaker.maxdImpactPPS = NewTrackingCuts.maxdImpactPPSSeeds()
-         #        InDetSiSpacePointsSeedMaker.maxdImpactSSS = NewTrackingCuts.maxdImpactSSSSeeds()
-
-         if usePrdAssociationTool:
-         #   # not all classes have that property !!!
-            InDetSiSpacePointsSeedMaker.PRDtoTrackMap      = TrigPixelKeys.PRDtoTrackMap #InDetTrigPrdAssociationTool
-
-         #if not InDetFlags.doCosmics():
-         #   InDetSiSpacePointsSeedMaker.maxRadius1         = 0.75*NewTrackingCuts.radMax()
-         #   InDetSiSpacePointsSeedMaker.maxRadius2         = NewTrackingCuts.radMax()
-         #   InDetSiSpacePointsSeedMaker.maxRadius3         = NewTrackingCuts.radMax()
-         #if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
-         #   try :
-         #      InDetSiSpacePointsSeedMaker.pTmax              = NewTrackingCuts.maxPT()
-         #   except:
-         #      pass 
-         #   InDetSiSpacePointsSeedMaker.mindRadius         = 4.0
-         #if NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode() == "SLHCConversionFinding":
-         #   InDetSiSpacePointsSeedMaker.minRadius1         = 0
-         #   InDetSiSpacePointsSeedMaker.minRadius2         = 0
-         #   InDetSiSpacePointsSeedMaker.minRadius3         = 0
-         #   InDetSiSpacePointsSeedMaker.maxRadius1         =1000.*Units.mm
-         #   InDetSiSpacePointsSeedMaker.maxRadius2         =1000.*Units.mm
-         #   InDetSiSpacePointsSeedMaker.maxRadius3         =1000.*Units.mm
-         #if NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "VeryForwardSLHCTracks":
-         #   InDetSiSpacePointsSeedMaker.checkEta           = True
-         #   InDetSiSpacePointsSeedMaker.etaMin             = NewTrackingCuts.minEta()
-         #   InDetSiSpacePointsSeedMaker.etaMax             = NewTrackingCuts.maxEta()
-         #   InDetSiSpacePointsSeedMaker.RapidityCut        = NewTrackingCuts.maxEta()
-         #if NewTrackingCuts.mode() == "DBM":
-         #   InDetSiSpacePointsSeedMaker.etaMin             = NewTrackingCuts.minEta()
-         #   InDetSiSpacePointsSeedMaker.etaMax             = NewTrackingCuts.maxEta()
-         #   InDetSiSpacePointsSeedMaker.useDBM = True
- 
-
-
-         #Z finder for the vtx
-         #
-         # --- Z-coordinates primary vertices finder (only for collisions)
-         #
-         if InDetFlags.useZvertexTool() and NewTrackingCuts.mode() != "DBM":
-            from SiZvertexTool_xk.SiZvertexTool_xkConf import InDet__SiZvertexMaker_xk
-            InDetZvertexMaker = InDet__SiZvertexMaker_xk(name          = '%sInDetZvertexMaker%s'%(prefix,suffix),
-                                                         Zmax          = NewTrackingCuts.maxZImpact(),
-                                                         Zmin          = -NewTrackingCuts.maxZImpact(),
-                                                         minRatio      = 0.17) # not default
-            InDetZvertexMaker.SeedMakerTool = InDetSiSpacePointsSeedMaker
-
-            if InDetFlags.doHeavyIon():
-               InDetZvertexMaker.HistSize = 2000
-               ###InDetZvertexMaker.minContent = 200 
-               InDetZvertexMaker.minContent = 30
-               
-            ToolSvc += InDetZvertexMaker
-            #if (InDetFlags.doPrintConfigurables()):
-            #   printfunc (InDetZvertexMaker)
-
-         else:
-            InDetZvertexMaker = None
-
-         #
-      #   # --- SCT and Pixel detector elements road builder
-      #   #
-         #FIXME which propagator
-         # 1] 
-         from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigPropagator
-
-         # 2] How about offline
-
-         from SiDetElementsRoadTool_xk.SiDetElementsRoadTool_xkConf import InDet__SiDetElementsRoadMaker_xk
-         InDetSiDetElementsRoadMaker = InDet__SiDetElementsRoadMaker_xk(name               = '%sInDetSiRoadMaker%s'%(prefix,suffix),#+NewTrackingCuts.extension(),
-                                                                        PropagatorTool     = InDetTrigPropagator,#InDetPatternPropagator,
-                                                                        usePixel           = NewTrackingCuts.usePixel(),
-                                                                        PixManagerLocation = InDetKeys.PixelManager(),
-                                                                        useSCT             = NewTrackingCuts.useSCT(), 
-                                                                        SCTManagerLocation = InDetKeys.SCT_Manager(), #FIXME change the name?        
-                                                                        RoadWidth          = NewTrackingCuts.RoadWidth())
-
-         ToolSvc += InDetSiDetElementsRoadMaker
-         #if (InDetFlags.doPrintConfigurables()):
-         #   printfunc (     InDetSiDetElementsRoadMaker)
-         # Condition algorithm for InDet__SiDetElementsRoadMaker_xk
+         from AthenaCommon.DetFlags import DetFlags 
+         # --- Loading Pixel, SCT conditions
          if DetFlags.haveRIO.pixel_on():
-         #FIXME:
-         #pixelOn = True
-         #if pixelOn:
-             # Condition algorithm for SiCombinatorialTrackFinder_xk
             from AthenaCommon.AlgSequence import AthSequencer
             condSeq = AthSequencer("AthCondSeq")
             if not hasattr(condSeq, "InDetSiDetElementBoundaryLinksPixelCondAlg"):
-                from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiDetElementBoundaryLinksCondAlg_xk
-                condSeq += InDet__SiDetElementBoundaryLinksCondAlg_xk(name     = "InDetSiDetElementBoundaryLinksPixelCondAlg",
-                                                                      ReadKey  = "PixelDetectorElementCollection",
-                                                                      WriteKey = "PixelDetElementBoundaryLinks_xk",
-                                                                      UsePixelDetectorManager = True)
+               from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiDetElementBoundaryLinksCondAlg_xk
+               condSeq += InDet__SiDetElementBoundaryLinksCondAlg_xk(name     = "InDetSiDetElementBoundaryLinksPixelCondAlg",
+                                                                     ReadKey  = "PixelDetectorElementCollection",
+                                                                     WriteKey = "PixelDetElementBoundaryLinks_xk",)
+
 
-         if NewTrackingCuts.useSCT():
+
+         if trackingCuts.useSCT():
             from AthenaCommon.AlgSequence import AthSequencer
             condSeq = AthSequencer("AthCondSeq")
             if not hasattr(condSeq, "InDet__SiDetElementsRoadCondAlg_xk"):
@@ -245,223 +150,88 @@ def makeInDetPatternRecognition( whichSignature, rois = 'EMViewRoIs', InputColle
 
             if not hasattr(condSeq, "InDetSiDetElementBoundaryLinksSCTCondAlg"):
                from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiDetElementBoundaryLinksCondAlg_xk
-               condSeq += InDet__SiDetElementBoundaryLinksCondAlg_xk(name = "InDetSiDetElementBoundaryLinksSCTCondAlg",
-                                                                     ReadKey = "SCT_DetectorElementCollection",
-                                                                     WriteKey = "SCT_DetElementBoundaryLinks_xk")
-
-
-      #   #
-      #   # --- Local track finding using sdCaloSeededSSSpace point seed
-      #   #
-      #   # @TODO ensure that PRD association map is used if usePrdAssociationTool is set
-         is_dbm = InDetFlags.doDBMstandalone() or NewTrackingCuts.extension()=='DBM'
-         rot_creator_digital = TrackingCommon.getInDetRotCreatorDigital() if not is_dbm else TrackingCommon.getInDetRotCreatorDBM()
-
-
-         from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigSCTConditionsSummaryTool, InDetTrigPatternUpdator
-
-         from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiCombinatorialTrackFinder_xk
-         track_finder = InDet__SiCombinatorialTrackFinder_xk(name                  = '%sInDetSiComTrackFinder%s'%(prefix,suffix),#+NewTrackingCuts.extension(),
-                                                             PropagatorTool        = InDetTrigPropagator,#InDetPatternPropagator,
-                                                             UpdatorTool           = InDetTrigPatternUpdator,#InDetPatternUpdator,
-                                                             SctSummaryTool        = InDetTrigSCTConditionsSummaryTool,
-                                                             RIOonTrackTool        = rot_creator_digital,
-                                                             usePixel              = DetFlags.haveRIO.pixel_on(),
-                                                             useSCT                = DetFlags.haveRIO.SCT_on() if not is_dbm else False,
-                                                             PixelClusterContainer = TrigPixelKeys.Clusters,#InDetKeys.PixelClusters(),
-                                                             SCT_ClusterContainer  = TrigSCTKeys.Clusters )#InDetKeys.SCT_Clusters())
-
-         ToolSvc += track_finder
-         if is_dbm :
-            track_finder.MagneticFieldMode     = "NoField"
-            track_finder.TrackQualityCut       = 9.3
-
-         
-         #track_finder.SctSummaryTool = InDetTrigSCTConditionsSummaryTool
-         #if (DetFlags.haveRIO.SCT_on()):
-         #   track_finder.SctSummaryTool = InDetSCT_ConditionsSummaryTool
-         #else:
-         #   track_finder.SctSummaryTool = None
-
-      #   ToolSvc += track_finder
-
-         useBremMode = NewTrackingCuts.mode() == "Offline" or NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode() == "DBM"
-         from SiTrackMakerTool_xk.SiTrackMakerTool_xkConf import InDet__SiTrackMaker_xk as SiTrackMaker
-         InDetSiTrackMaker = SiTrackMaker(name                          = '%sInDetSiTrackMaker%s'%(prefix,suffix),#+NewTrackingCuts.extension(),
-                                          useSCT                        = NewTrackingCuts.useSCT(),
-                                          usePixel                      = NewTrackingCuts.usePixel(),
-                                          RoadTool                      = InDetSiDetElementsRoadMaker,
-                                          CombinatorialTrackFinder      = track_finder,
-                                          pTmin                         = NewTrackingCuts.minPT(),
-                                          pTminBrem                     = NewTrackingCuts.minPTBrem(),
-                                          pTminSSS                      = InDetFlags.pT_SSScut(),
-                                          nClustersMin                  = NewTrackingCuts.minClusters(),
-                                          nHolesMax                     = NewTrackingCuts.nHolesMax(),
-                                          nHolesGapMax                  = NewTrackingCuts.nHolesGapMax(),
-                                          SeedsFilterLevel              = NewTrackingCuts.seedFilterLevel(),
-                                          Xi2max                        = NewTrackingCuts.Xi2max(),
-                                          Xi2maxNoAdd                   = NewTrackingCuts.Xi2maxNoAdd(),
-                                          nWeightedClustersMin          = NewTrackingCuts.nWeightedClustersMin(),
-                                          CosmicTrack                   = InDetFlags.doCosmics(),
-                                          Xi2maxMultiTracks             = NewTrackingCuts.Xi2max(), # was 3.
-                                          useSSSseedsFilter             = InDetFlags.doSSSfilter(),
-                                          doMultiTracksProd             = True,
-                                          useBremModel                  = InDetFlags.doBremRecovery() and useBremMode, # only for NewTracking the brem is debugged !!!
-                                          doCaloSeededBrem              = InDetFlags.doCaloSeededBrem(),
-                                          doHadCaloSeedSSS              = InDetFlags.doHadCaloSeededSSS(),
-                                          phiWidth                      = NewTrackingCuts.phiWidthBrem(),
-                                          etaWidth                      = NewTrackingCuts.etaWidthBrem(),
-                                          InputClusterContainerName     = InDetKeys.CaloClusterROIContainer(), # "InDetCaloClusterROIs" 
-                                          InputHadClusterContainerName  = InDetKeys.HadCaloClusterROIContainer(), # "InDetCaloClusterROIs" 
-                                          UseAssociationTool            = usePrdAssociationTool)
-
-         ToolSvc += InDetSiTrackMaker
-
-      #FIXME: do only cosmics for now, but change later
-      #   if NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "VeryForwardSLHCTracks" :
-      #      InDetSiTrackMaker.ITKGeometry = True
-
-      #   if NewTrackingCuts.mode() == "DBM":
-      #      InDetSiTrackMaker.MagneticFieldMode = "NoField"
-      #      InDetSiTrackMaker.useBremModel = False
-      #      InDetSiTrackMaker.doMultiTracksProd = False
-      #      InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'       
-      #      InDetSiTrackMaker.pTminSSS = -1
-      #      InDetSiTrackMaker.CosmicTrack = False
-      #      InDetSiTrackMaker.useSSSseedsFilter = False
-      #      InDetSiTrackMaker.doCaloSeededBrem = False
-      #      InDetSiTrackMaker.doHadCaloSeedSSS = False
-
-         #elif InDetFlags.doCosmics():
-         #  InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_Cosmic'
-         InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_Cosmic'
+               condSeq += InDet__SiDetElementBoundaryLinksCondAlg_xk(name     = "InDetSiDetElementBoundaryLinksSCTCondAlg",
+                                                                  ReadKey  = "SCT_DetectorElementCollection",
+                                                                  WriteKey = "SCT_DetElementBoundaryLinks_xk")
+            #-------------------------------------------------------
+
+
+         from .InDetTrigCommon import siSPSeededTrackFinder_builder, get_full_name
+         siSPSeededTrackFinder = siSPSeededTrackFinder_builder( name                  = get_full_name( 'siSPSeededTrackFinder', config.name ),
+                                                                outputTracks          = config.PT.trkTracksPT(),  # config.EFID.trkTracksEFID(), ##outEFIDTracks, 
+                                                                trackingCuts          = trackingCuts,
+                                                                usePrdAssociationTool = usePrdAssociationTool,
+                                                                nameSuffix            = config.name )
+
+         print(siSPSeededTrackFinder)
+         viewAlgs.append( siSPSeededTrackFinder )
+      #-----------------------------------------------------------------------------
+      #                      Track particle conversion algorithm (for pattern rec.)
+      #                        atm disabled but might be useful later for debugging
       #
-      #   elif InDetFlags.doHeavyIon():
-      #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_HeavyIon'
-      #   
-      #   elif NewTrackingCuts.mode() == "LowPt":
-      #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LowMomentum'
-
-      #   elif NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
-      #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryLowMomentum'           
-
-      #   elif NewTrackingCuts.mode() == "BeamGas":
-      #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_BeamGas'
- 
-      #   elif NewTrackingCuts.mode() == "ForwardTracks":
-      #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardTracks'
-
-      #   elif NewTrackingCuts.mode() == "ForwardSLHCTracks":
-      #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardSLHCTracks'
-
-      #   elif NewTrackingCuts.mode() == "VeryForwardSLHCTracks": 
-      #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryForwardSLHCTracks' 
-
-      #   elif NewTrackingCuts.mode() == "SLHCConversionFinding":
-      #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_SLHCConversionTracks'
-
-      #   elif NewTrackingCuts.mode() == "LargeD0" or NewTrackingCuts.mode() == "LowPtLargeD0":
-      #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LargeD0'
-      #  
-      #   else:
-      #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'
-      #           
-         if InDetFlags.doStoreTrackSeeds():
-              from SeedToTrackConversionTool.SeedToTrackConversionToolConf import InDet__SeedToTrackConversionTool
-              InDet_SeedToTrackConversion = InDet__SeedToTrackConversionTool(name       = "%sInDet_SeedToTrackConversion%s"%(prefix, suffix),
-                                                                             OutputName = InDetKeys.SiSPSeedSegments()+NewTrackingCuts.extension())
-              InDetSiTrackMaker.SeedToTrackConversion = InDet_SeedToTrackConversion
-              InDetSiTrackMaker.SeedSegmentsWrite = True
-
-      #   #InDetSiTrackMaker.OutputLevel = VERBOSE             
-      #   ToolSvc += InDetSiTrackMaker
-      #   if (InDetFlags.doPrintConfigurables()):
-      #      printfunc (InDetSiTrackMaker)
-      #   #
-      #   # set output track collection name
-      #  #
-      #   self.__SiTrackCollection = SiSPSeededTrackCollectionKey
-      #   #
-      #   # --- Setup Track finder using space points seeds
-      #   #
-
-         #FIXME: which summary tool to use??
-         # trackSummaryTool = TrackingCommon.getInDetTrackSummaryToolNoHoleSearch()
-         #ToolSvc += trackSummaryTool
-         from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigTrackSummaryTool
-
-
-         from SiSPSeededTrackFinder.SiSPSeededTrackFinderConf import InDet__SiSPSeededTrackFinder
-         InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinder(name                 = '%sInDetSiSpTrackFinder%s'%(prefix, suffix),# +NewTrackingCuts.extension(),
-                                                                    TrackTool           = InDetSiTrackMaker,
-                                                                    PRDtoTrackMap       = TrigPixelKeys.PRDtoTrackMap if usePrdAssociationTool else '',
-                                                                    SpacePointsPixelName= TrigPixelKeys.SpacePoints,
-                                                                    SpacePointsSCTName  = TrigSCTKeys.SpacePoints,
-                                                                    TrackSummaryTool    = InDetTrigTrackSummaryTool,
-                                                                    TracksLocation      = outEFIDTracks,
-                                                                    SeedsTool           = InDetSiSpacePointsSeedMaker,
-                                                                    useZvertexTool      = InDetFlags.useZvertexTool(),
-                                                                    ZvertexTool         = InDetZvertexMaker )
-
-         if NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks":
-                                                                    InDetSiSPSeededTrackFinder.useNewStrategy     = False
-                                                                    InDetSiSPSeededTrackFinder.useMBTSTimeDiff    = InDetFlags.useMBTSTimeDiff()
-                                                                    InDetSiSPSeededTrackFinder.useZBoundFinding   = False
-      #    if InDetFlags.doHeavyIon() :
-      #     InDetSiSPSeededTrackFinder.FreeClustersCut = 2 #Heavy Ion optimization from Igor
-         else:
-                                                                    InDetSiSPSeededTrackFinder.useZvertexTool      = InDetFlags.useZvertexTool() and NewTrackingCuts.mode() != "DBM"
-                                                                    InDetSiSPSeededTrackFinder.useNewStrategy      = InDetFlags.useNewSiSPSeededTF() and NewTrackingCuts.mode() != "DBM"
-                                                                    InDetSiSPSeededTrackFinder.useMBTSTimeDiff     = InDetFlags.useMBTSTimeDiff()
-                                                                    InDetSiSPSeededTrackFinder.useZBoundFinding    = NewTrackingCuts.doZBoundary() and NewTrackingCuts.mode() != "DBM"   
-
-
-
-         
-         viewAlgs.append( InDetSiSPSeededTrackFinder )
-         
-         #for alg in viewAlgs:
-         #   print alg
-
-      #    if InDetFlags.doHeavyIon() :
-      #     InDetSiSPSeededTrackFinder.FreeClustersCut = 2 #Heavy Ion optimization from Igor
-
-      #   #InDetSiSPSeededTrackFinder.OutputLevel =VERBOSE 
-      #   topSequence += InDetSiSPSeededTrackFinder
-      #   if (InDetFlags.doPrintConfigurables()):
-      #      printfunc (InDetSiSPSeededTrackFinder)
-
-      #   if not InDetFlags.doSGDeletion():
-      #      if InDetFlags.doTruth():
-      #         #
-      #         # set up the truth info for this container
-      #         #
-      #         include ("InDetRecExample/ConfiguredInDetTrackTruth.py")
-      #         InDetTracksTruth = ConfiguredInDetTrackTruth(self.__SiTrackCollection,
-      #                                                      self.__SiTrackCollection+"DetailedTruth",
-      #                                                      self.__SiTrackCollection+"TruthCollection")
-      #         #
-      #         # add final output for statistics
-      #         #
-      #         TrackCollectionKeys      += [ InDetTracksTruth.Tracks() ]
-      #         TrackCollectionTruthKeys += [ InDetTracksTruth.TracksTruth() ]
-      #      else:
-      #         TrackCollectionKeys      += [ self.__SiTrackCollection ]
-      #         
-
-
-      #Convert final track collection to xAOD track particles
-      from .InDetTrigCommon import getTrackParticleCnv  
-      viewAlgs.append( getTrackParticleCnv( prefix, suffix + "_EFID", outEFIDTracks, outEFIDTrackParticles ) )
-
-
-      #print viewAlgs
-      #print 'VIEWS!', len(viewAlgs)
-      #print(len(viewAlgs))
-
-      return  viewAlgs
-
-  #-----------------------------------------------------------------------------
-  #                        Ambiguity solving stage
-      #TODO:
-
+      #from .InDetTrigCommon import trackParticleCnv_builder
+      #trackParticleCnvAlg = trackParticleCnv_builder(name                 = get_full_name( 'xAODParticleCreatorAlg',config.name + '_EFID' ), 
+      #                                               config               = config,
+      #                                               inTrackCollectionKey = config.PT.trkTracksPT(),#config.EFID.trkTracksEFID(),
+      #                                               outTrackParticlesKey = config.EFID.tracksEFID( doRecord = config.isRecordable),
+      #                                               )
+
+      #-----------------------------------------------------------------------------
+      #                      Precision algorithms
+
+      #Verifier should not be necessary when both patt. rec. and PT runs in the same view -> None
+      #Also provides particle cnv alg inside
+      precisionAlgs = makePrecisionInDetPatternRecognition(config      = config,
+                                                           inputTracks = config.PT.trkTracksPT(), #config.EFID.trkTracksEFID(),
+                                                           verifier    = None )
+
+
+      viewAlgs += precisionAlgs
+
+
+      return  viewAlgs, dataVerifier
+
+
+#TODO: potentially  unify with makeInDetPrecisionTracking in the InDetPT.py?
+#TODO better name?
+def makePrecisionInDetPatternRecognition( config, inputTracks,verifier = None ):
+   ptAlgs = [] #List containing all the precision tracking algorithms hence every new added alg has to be appended to the list
+   
+   #-----------------------------------------------------------------------------
+   #                        Verifying input data for the algorithms
+   if verifier:
+     verifier.DataObjects += [ #( 'InDet::PixelGangedClusterAmbiguities' , 'StoreGateSvc+' + TrigPixelKeys.PixelClusterAmbiguitiesMap ),
+                               ( 'TrackCollection' , 'StoreGateSvc+' + inputTracks )]
+   
+   
+   #-----------------------------------------------------------------------------
+   #                        Ambiguity solving stage
+   from .InDetTrigCommon import ambiguityScoreAlg_builder, ambiguitySolverAlg_builder, get_full_name, get_scoremap_name
+   
+   ambiguityScoreAlg = ambiguityScoreAlg_builder( name                  = get_full_name(  core = 'TrkAmbiguityScore', suffix  = config.name ),
+                                                  config                = config,
+                                                  inputTrackCollection  = inputTracks,
+                                                  outputTrackScoreMap   = get_scoremap_name( config.name ), #Map of tracks and their scores
+                                                 )
+   ptAlgs.append( ambiguityScoreAlg )
+   
+   #FIXME: these alg internally don't expect EFID setting (but FTF), have to take into consideration
+   ambiguitySolverAlg = ambiguitySolverAlg_builder( name                  = get_full_name( core = 'TrkAmbiguitySolver', suffix = config.name ),
+                                                    config                = config,
+                                                    inputTrackScoreMap    = get_scoremap_name( config.name ), #Map of tracks and their scores, 
+                                                    outputTrackCollection = config.PT.trkTracksPT()+"_Amb" )  #FIXME: for now keep PT but if TRT added this will ahve to become intermediate collection
+
+   ptAlgs.append( ambiguitySolverAlg )
+   
+   #-----------------------------------------------------------------------------
+   #                      Track particle conversion algorithm
+   from .InDetTrigCommon import trackParticleCnv_builder
+   trackParticleCnvAlg = trackParticleCnv_builder(name                 = get_full_name( 'xAODParticleCreatorAlg',config.name + '_IDTrig' ), 
+                                                  config               = config,
+                                                  inTrackCollectionKey = config.PT.trkTracksPT()+"_Amb",
+                                                  outTrackParticlesKey = config.PT.tracksPT( doRecord = config.isRecordable),
+                                                  )
+   
+   ptAlgs.append( trackParticleCnvAlg )
+
+   return ptAlgs
diff --git a/Trigger/TrigTools/TrigInDetConfig/python/InDetPT.py b/Trigger/TrigTools/TrigInDetConfig/python/InDetPT.py
index f5b47cfafcb5fbfad24c163b5f1b91427914aa78..8be9a444754c6556090b2de3dd72bafd17848a13 100644
--- a/Trigger/TrigTools/TrigInDetConfig/python/InDetPT.py
+++ b/Trigger/TrigTools/TrigInDetConfig/python/InDetPT.py
@@ -27,29 +27,24 @@ def makeInDetPrecisionTracking( config = None,
 
   #-----------------------------------------------------------------------------
   #                        Naming conventions
+  doTRT = config.PT.setting.doTRT
 
   algNamePrefix = "InDetTrigMT" 
   #Add suffix to the algorithms
   signature =  "_{}".format( config.name )
-  
-  #Name settings for output Tracks/TrackParticles
-  #This first part is for ambiguity solver tracks
-  nameAmbiTrackCollection = config.PT.trkTracksAS() 
-  
-  #Tracks from TRT extension
-  nameExtTrackCollection = config.PT.trkTracksTE() 
 
-  outPTTracks             = config.PT.trkTracksPT()
-  outPTTrackParticles     = config.PT.tracksPT( doRecord = config.isRecordable )
+
+  #Name settings for output Tracks/TrackParticles
+  outTrkTracks        = config.PT.trkTracksPT() #Final output Track collection
+  outTrackParticles   = config.PT.tracksPT( doRecord = config.isRecordable ) #Final output xAOD::TrackParticle collection
+  ambiTrackCollection = config.PT.trkTracksAS()  #Ambiguity solver tracks
 
   #Atm there are mainly two output track collections one from ambiguity solver stage and one from trt,
   #we want to have the output name of the track collection the same whether TRT was run or not,
   #Therefore, we have to adapt output names of the algorithm which produces last collection
   #However, this condition should be handled internally in configuration of the algs once TRT is configured with builders as well
-  if config.PT.setting.doTRT:
-     nameExtTrackCollection = outPTTracks
-  else:
-     nameAmbiTrackCollection = outPTTracks
+  if not doTRT:
+     ambiTrackCollection = outTrkTracks
 
   #-----------------------------------------------------------------------------
   #                        Verifying input data for the algorithms
@@ -77,7 +72,7 @@ def makeInDetPrecisionTracking( config = None,
   
   #Obsolete, will be eventually replaced
   #Note: keep Parameter_config!
-  if config.PT.setting.doTRT:
+  if doTRT:
       if "electron" in config.name  or "tau" in config.name:
          trigTrackSummaryTool.TRT_ElectronPidTool = InDetTrigTRT_ElectronPidTool
 
@@ -91,21 +86,27 @@ def makeInDetPrecisionTracking( config = None,
 
   #-----------------------------------------------------------------------------
   #                        Ambiguity solving stage
-  from .InDetTrigCommon import ambiguityScoreAlg_builder, ambiguitySolverAlg_builder, get_full_name
+  from .InDetTrigCommon import ambiguityScoreAlg_builder, ambiguitySolverAlg_builder, get_full_name,  get_scoremap_name
   ambSolvingStageAlgs = [
-                           ambiguityScoreAlg_builder( name   = get_full_name(  core = 'TrkAmbiguityScore', suffix  = config.name ),
-                                                      config = config ),
-
-                           ambiguitySolverAlg_builder( name   = get_full_name( core = 'TrkAmbiguitySolver', suffix = config.name ),
-                                                       config = config )
+                           ambiguityScoreAlg_builder( name                  = get_full_name(  core = 'TrkAmbiguityScore', suffix  = config.name ),
+                                                      config                = config,
+                                                      inputTrackCollection  = config.FT.trkTracksFTF(),
+                                                      outputTrackScoreMap   = get_scoremap_name( config.name ), #Map of tracks and their scores
+                                                    ),
+  
+                           ambiguitySolverAlg_builder( name                  = get_full_name( core = 'TrkAmbiguitySolver', suffix = config.name ),
+                                                       config                = config,
+                                                       inputTrackScoreMap    = get_scoremap_name( config.name ), #Map of tracks and their scores, 
+                                                       outputTrackCollection = ambiTrackCollection  )
                         ]
+   
 
   #Loading the alg to the sequence
   ptAlgs.extend( ambSolvingStageAlgs )
 
   from InDetTrigRecExample.InDetTrigConfigRecLoadTools import  InDetTrigExtrapolator
   #TODO:implement builders and getters for TRT (WIP)
-  if config.PT.setting.doTRT:
+  if doTRT:
 
             #-----------------------------------------------------------------------------
             #                        TRT data preparation
@@ -228,7 +229,7 @@ def makeInDetPrecisionTracking( config = None,
  
             from TRT_TrackExtensionAlg.TRT_TrackExtensionAlgConf import InDet__TRT_TrackExtensionAlg
             InDetTrigTRTextensionAlg = InDet__TRT_TrackExtensionAlg( name = "%sTrackExtensionAlg%s"%(algNamePrefix, signature),
-                                                            InputTracksLocation    = nameAmbiTrackCollection,
+                                                            InputTracksLocation    = ambiTrackCollection,
                                                             TrackExtensionTool     = InDetTrigTRTExtensionTool,
                                                             ExtendedTracksLocation = 'ExtendedTrackMap'
                                                              )
@@ -265,10 +266,10 @@ def makeInDetPrecisionTracking( config = None,
             from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigTrackFitter
             from InDetExtensionProcessor.InDetExtensionProcessorConf import InDet__InDetExtensionProcessor   
             InDetTrigExtensionProcessor = InDet__InDetExtensionProcessor (name               = "%sExtensionProcessor%s"%(algNamePrefix, signature),
-                                                                          TrackName          = nameAmbiTrackCollection,
+                                                                          TrackName          = ambiTrackCollection,
                                                                           #Cosmics           = InDetFlags.doCosmics(),
                                                                           ExtensionMap       = 'ExtendedTrackMap',
-                                                                          NewTrackName       = nameExtTrackCollection,
+                                                                          NewTrackName       = outTrkTracks,
                                                                           TrackFitter        = InDetTrigTrackFitter,
                                                                           TrackSummaryTool   = SummaryTool_config,
                                                                           ScoringTool        = InDetTrigExtScoringTool, #TODO do I provide the same tool as for ambiguity solver?
@@ -290,8 +291,8 @@ def makeInDetPrecisionTracking( config = None,
   from .InDetTrigCommon import trackParticleCnv_builder
   trackParticleCnvAlg = trackParticleCnv_builder(name                 = get_full_name( 'xAODParticleCreatorAlg',config.name + '_IDTrig' ), #IDTrig suffix signifies that this is for precision tracking
                                                  config               = config,
-                                                 inTrackCollectionKey = outPTTracks,
-                                                 outTrackParticlesKey = outPTTrackParticles,
+                                                 inTrackCollectionKey = outTrkTracks,
+                                                 outTrackParticlesKey = outTrackParticles,
                                                  )
   log.debug(trackParticleCnvAlg)
   ptAlgs.append(trackParticleCnvAlg)
@@ -302,8 +303,8 @@ def makeInDetPrecisionTracking( config = None,
   
   #Potentialy other algs with more collections? 
   #Might Drop the list in the end and keep just one output key
-  nameTrackCollections =[ outPTTracks ]
-  nameTrackParticles =  [ outPTTrackParticles ]
+  nameTrackCollections =[ outTrkTracks ]
+  nameTrackParticles =  [ outTrackParticles ]
 
   
   #Return list of Track keys, TrackParticle keys, and PT algs
diff --git a/Trigger/TrigTools/TrigInDetConfig/python/InDetTrigCommon.py b/Trigger/TrigTools/TrigInDetConfig/python/InDetTrigCommon.py
index 3bba5355014c5e658a4bfd9455537b5082c79e7d..4f4fe1ffa3c794ef1cbf547e5576800e6dc40a3d 100644
--- a/Trigger/TrigTools/TrigInDetConfig/python/InDetTrigCommon.py
+++ b/Trigger/TrigTools/TrigInDetConfig/python/InDetTrigCommon.py
@@ -34,7 +34,7 @@ def get_full_name( core, suffix ):
 
 #Retrieve name of the score map
 #Map of Tracks and floats (representing score of a given track)
-def get_scoredmap( suffix ):
+def get_scoremap_name( suffix ):
    return "ScoredMap{}".format(suffix)
 
 
@@ -48,6 +48,10 @@ def trackSummaryTool_getter( doTRT ):
    else:
       return InDetTrigTrackSummaryTool
 
+def trigPropagator_getter():
+   from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigPropagator
+   return InDetTrigPropagator
+
 #--------------------------------------------------------------------------------------
 
 
@@ -305,25 +309,15 @@ def ambiguityProcessorTool_builder( name, config):
 
 
 from TrkAmbiguitySolver.TrkAmbiguitySolverConf import Trk__TrkAmbiguitySolver
-def ambiguitySolverAlg_builder(name, config):
-
-      #Get correct name for the ouput TrkTrack collection
-      def getTrackOutput():
-         #If we are also applying TRT then this collection is just intermediate
-         if config.PT.setting.doTRT:
-            return  config.PT.trkTracksAS() #"%s%sTrkTrack%s" %('HLT_ID', 'AmbSol', get_name_suffix( config.name() ))
-         #Otherwise use final collection name
-         else:
-            return  config.PT.trkTracksPT()
+def ambiguitySolverAlg_builder(name, config, inputTrackScoreMap, outputTrackCollection):
 
-      #-----------------------
       #Set/Get subtools
       ambiguityProcessor = ambiguityProcessorTool_builder( name   = get_full_name( 'AmbiguityProcessor', config.name),
                                                            config = config )
 
       return Trk__TrkAmbiguitySolver( name               = name,
-                                      TrackInput         = get_scoredmap( get_name_suffix(config.name )),
-                                      TrackOutput        = getTrackOutput(),
+                                      TrackInput         = inputTrackScoreMap,
+                                      TrackOutput        = outputTrackCollection,
                                       AmbiguityProcessor = ambiguityProcessor
                                     )
 
@@ -354,7 +348,7 @@ def ambiguityScoreProcessorTool_builder( name, config):
 
 
 from TrkAmbiguitySolver.TrkAmbiguitySolverConf import Trk__TrkAmbiguityScore
-def ambiguityScoreAlg_builder(name, config):
+def ambiguityScoreAlg_builder(name, config, inputTrackCollection, outputTrackScoreMap ):
       #Alg loops over provided tracks and calls subtool(TrkAmbigutyScoreProcessor) to assign scores for each one of them
 
       #-----------------------
@@ -363,10 +357,369 @@ def ambiguityScoreAlg_builder(name, config):
       #                                                               config = config )
 
       return Trk__TrkAmbiguityScore(   name                    = name,
-                                       TrackInput              = [ config.FT.trkTracksFTF()  ],
-                                       TrackOutput             = get_scoredmap( get_name_suffix( config.name ) ),
+                                       TrackInput              = [ inputTrackCollection ], #[ config.FT.trkTracksFTF()  ], 
+                                       TrackOutput             = outputTrackScoreMap,  #get_scoredmap( get_name_suffix( config.name ) ),
                                        #Disable processor, see: https://gitlab.cern.ch/atlas/athena/-/merge_requests/36431
                                        AmbiguityScoreProcessor = None, #ambiguityScoreProcessor,
-                                    )
+                                   )
+
+#-------------------------------------------------------------------------------------------------
+#                       Alg/Tools for offline pattern recognition tracking
+
+@makePublicTool
+def siSpacePointsSeedMakerTool_builder(name, trackingCuts, usePrdAssociationTool ):
+   from InDetRecExample.InDetKeys  import  InDetKeys
+   from .InDetTrigCollectionKeys   import  TrigPixelKeys, TrigSCTKeys
+   from InDetRecExample.InDetJobProperties import InDetFlags
+
+   kwargs = {}
+   kwargs = setDefaults( kwargs,
+                         pTmin                  = trackingCuts.minPT(),
+                         maxdImpact             = trackingCuts.maxPrimaryImpact(),
+                         maxZ                   = trackingCuts.maxZImpact(),
+                         minZ                   = -trackingCuts.maxZImpact(),
+                         usePixel               = trackingCuts.usePixel(),
+                         SpacePointsPixelName   = TrigPixelKeys.SpacePoints,
+                         useSCT                 = (trackingCuts.useSCT() and trackingCuts.useSCTSeeding()),
+                         SpacePointsSCTName     = TrigSCTKeys.SpacePoints,
+                         useOverlapSpCollection = (trackingCuts.useSCT() and trackingCuts.useSCTSeeding()),
+                         SpacePointsOverlapName = InDetKeys.OverlapSpacePoints(), #Switch to trigger flags?
+                         radMax                 = trackingCuts.radMax(),
+                         RapidityCut            = trackingCuts.maxEta())
+                       
+   
+   #Change/add tracking  parameters based on the different tracking mode
+   if trackingCuts.mode() == "Offline" or InDetFlags.doHeavyIon() or  trackingCuts.mode() == "ForwardTracks":
+      kwargs = setDefaults( kwargs,
+                            maxdImpactPPS = trackingCuts.maxdImpactPPSSeeds(),
+                            maxdImpactSSS = trackingCuts.maxdImpactSSSSeeds())
+   
+   if usePrdAssociationTool:
+   # not all classes have that property !!!
+      kwargs = setDefaults( kwargs,
+                            PRDtoTrackMap      = TrigPixelKeys.PRDtoTrackMap)
+
+   #FIXME: switch to TrigFlags?
+   if not InDetFlags.doCosmics():
+      kwargs = setDefaults( kwargs,
+                            maxRadius1     = 0.75*trackingCuts.radMax(),
+                            maxRadius2     = trackingCuts.radMax(),
+                            maxRadius3     = trackingCuts.radMax())
+
+   #FIXME add later if needed
+   #if trackingCuts.mode() == "LowPt" or trackingCuts.mode() == "VeryLowPt" or (trackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
+   #   try :
+   #      InDetSiSpacePointsSeedMaker.pTmax              = trackingCuts.maxPT()
+   #   except:
+   #      pass 
+   #   InDetSiSpacePointsSeedMaker.mindRadius         = 4.0
+   #
+   #if trackingCuts.mode() == "SLHC" or trackingCuts.mode() == "SLHCConversionFinding":
+   #   InDetSiSpacePointsSeedMaker.minRadius1         = 0
+   #   InDetSiSpacePointsSeedMaker.minRadius2         = 0
+   #   InDetSiSpacePointsSeedMaker.minRadius3         = 0
+   #   InDetSiSpacePointsSeedMaker.maxRadius1         =1000.*Units.mm
+   #   InDetSiSpacePointsSeedMaker.maxRadius2         =1000.*Units.mm
+   #   InDetSiSpacePointsSeedMaker.maxRadius3         =1000.*Units.mm
+   #
+   #if trackingCuts.mode() == "ForwardTracks" or trackingCuts.mode() == "ForwardSLHCTracks" or trackingCuts.mode() == "VeryForwardSLHCTracks":
+   #   InDetSiSpacePointsSeedMaker.checkEta           = True
+   #   InDetSiSpacePointsSeedMaker.etaMin             = trackingCuts.minEta()
+   #   InDetSiSpacePointsSeedMaker.etaMax             = trackingCuts.maxEta()
+   #   InDetSiSpacePointsSeedMaker.RapidityCut        = trackingCuts.maxEta()
+   #
+   #if trackingCuts.mode() == "DBM":
+   #   InDetSiSpacePointsSeedMaker.etaMin             = trackingCuts.minEta()
+   #   InDetSiSpacePointsSeedMaker.etaMax             = trackingCuts.maxEta()
+   #   InDetSiSpacePointsSeedMaker.useDBM = True
+   
+   
+   from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker
+   return SiSpacePointsSeedMaker ( name    =  name,
+                                   **kwargs)
+
+
+
+
+@makePublicTool
+def zVertexMakerTool_builder(name, trackingCuts, seedMakerTool ):
+   from InDetRecExample.InDetJobProperties import InDetFlags
+   
+   kwargs = {}
+   
+   #Prepare default parameter settings for the tool
+   kwargs = setDefaults( kwargs,
+                         Zmax          = trackingCuts.maxZImpact(),
+                         Zmin          = -trackingCuts.maxZImpact(),
+                         minRatio      = 0.17,
+                         SeedMakerTool = seedMakerTool )
+   
+   
+   if InDetFlags.doHeavyIon():
+      kwargs = setDefaults( kwargs,
+                            HistSize   = 2000,
+                            minContent = 30)
+   
+   from SiZvertexTool_xk.SiZvertexTool_xkConf import InDet__SiZvertexMaker_xk
+   return InDet__SiZvertexMaker_xk(name  = name,
+                                   **kwargs)
+
+   
+
+
+def prdAssociation_builder( InputCollections ):
+   import InDetRecExample.TrackingCommon as TrackingCommon
+   #FIXME: If so:
+   # 1] Get a new association tool
+   #associationTool = TrackingCommon.getInDetTrigPRDtoTrackMapToolGangedPixels(),
+   
+   # 2] Use the ganged pixel from here?
+   #from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigPrdAssociationTool
+   
+   # 3] Create the new one as in offline tracking?:
+   prefix     = 'TrigInDet'
+   suffix     = ''#NewTrackingCuts.extension()
+   return TrackingCommon.getInDetTrackPRD_Association(namePrefix   = prefix,
+                                                      nameSuffix   = suffix,
+                                                      TracksName   = list(InputCollections))#This is readHandle #What input collection Thought there are no tracks at this point??!     
+   # 4] if so do I use normal or ganged?
+   #from InDetAssociationTools.InDetAssociationToolsConf import InDet__InDetPRD_AssociationToolGangedPixels
+   #InDetTrigPrdAssociationl = InDet__InDetPRD_AssociationToolGangedPixels(name = "%sPrdAssociationTool%s"%(prefix,suffix),
+   #                                                                          PixelClusterAmbiguitiesMapName = TrigPixelKeys.PRDtoTrackMap )
+
+@makePublicTool
+def siDetectorElementRoadMakerTool_builder( name, trackingCuts ):
+   from InDetRecExample.InDetKeys  import  InDetKeys 
+   
+   #Are we happy with this propagator?
+   from SiDetElementsRoadTool_xk.SiDetElementsRoadTool_xkConf import InDet__SiDetElementsRoadMaker_xk
+   return  InDet__SiDetElementsRoadMaker_xk(name               = name,
+                                            PropagatorTool     = trigPropagator_getter(),
+                                            usePixel           = trackingCuts.usePixel(),
+                                            PixManagerLocation = InDetKeys.PixelManager(), #FIXME: InDetTrigKeys?
+                                            useSCT             = trackingCuts.useSCT(), 
+                                            SCTManagerLocation = InDetKeys.SCT_Manager(),  #FIXME InDetTrigKeys?
+                                            RoadWidth          = trackingCuts.RoadWidth())
 
 
+
+@makePublicTool
+def siCombinatorialTrackFinderTool_builder( name, trackingCuts ):
+   from .InDetTrigCollectionKeys   import TrigPixelKeys, TrigSCTKeys
+   from AthenaCommon.DetFlags      import DetFlags
+   from InDetRecExample.InDetJobProperties import InDetFlags
+   import InDetRecExample.TrackingCommon as TrackingCommon
+
+   #FIXME: quick hack to try running ID, remove later
+   DetFlags.ID_setOn()
+   
+   #Are we happy with these settings?
+   from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigSCTConditionsSummaryTool, InDetTrigPatternUpdator
+   # @TODO ensure that PRD association map is used if usePrdAssociationTool is set
+   
+   kwargs = {}
+   #Prepare default parameter settings for the tool
+   kwargs = setDefaults( kwargs,
+                         PropagatorTool        = trigPropagator_getter(),
+                         UpdatorTool           = InDetTrigPatternUpdator,
+                         SctSummaryTool        = InDetTrigSCTConditionsSummaryTool, #Any reason for this to be turned off? None,
+                         RIOonTrackTool        = TrackingCommon.getInDetRotCreatorDigital(),
+                         usePixel              = DetFlags.haveRIO.pixel_on(),
+                         useSCT                = DetFlags.haveRIO.SCT_on(),
+                         PixelClusterContainer = TrigPixelKeys.Clusters,
+                         SCT_ClusterContainer  = TrigSCTKeys.Clusters)
+   
+   #FIXME: Use TriggerFlags instead?
+   if InDetFlags.doDBMstandalone() or trackingCuts.extension() =='DBM':
+      kwargs = setDefaults( kwargs,
+                            MagneticFieldMode     = "NoField",
+                            TrackQualityCut       = 9.3,
+                            useSCT                =  False,
+                            RIOonTrackTool        = TrackingCommon.getInDetRotCreatorDBM(),
+                            )
+   
+   
+   #Add SCT condition summary if specified
+   #FIXME: Use TriggerFlags instead?
+   #if (DetFlags.haveRIO.SCT_on()):
+   #   kwargs = setDefaults( kwargs,
+   #                         SctSummaryTool = InDetTrigSCTConditionsSummaryTool )
+   
+   from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiCombinatorialTrackFinder_xk
+   return InDet__SiCombinatorialTrackFinder_xk(name  = name,
+                                               **kwargs)
+   
+
+@makePublicTool
+def siTrackMakerTool_builder( name, siDetElementsRoadMakerTool, trackFinderTool, trackingCuts, usePrdAssociationTool ):
+   from InDetRecExample.InDetJobProperties import InDetFlags
+   from InDetRecExample.InDetKeys          import InDetKeys 
+   
+   trackPatternRecoInfo = 'SiSPSeededFinder'
+   if InDetFlags.doCosmics():
+      trackPatternRecoInfo = 'SiSpacePointsSeedMaker_Cosmic'
+   
+   elif InDetFlags.doHeavyIon():
+     trackPatternRecoInfo = 'SiSpacePointsSeedMaker_HeavyIon'
+   
+   elif trackingCuts.mode() == "LowPt":
+     trackPatternRecoInfo = 'SiSpacePointsSeedMaker_LowMomentum'
+   
+   elif trackingCuts.mode() == "VeryLowPt" or (trackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
+     trackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryLowMomentum'           
+   
+   elif trackingCuts.mode() == "BeamGas":
+     trackPatternRecoInfo = 'SiSpacePointsSeedMaker_BeamGas'
+   
+   elif trackingCuts.mode() == "ForwardTracks":
+     trackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardTracks'
+   
+   elif trackingCuts.mode() == "ForwardSLHCTracks":
+     trackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardSLHCTracks'
+   
+   elif trackingCuts.mode() == "VeryForwardSLHCTracks": 
+     trackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryForwardSLHCTracks' 
+   
+   elif trackingCuts.mode() == "SLHCConversionFinding":
+     trackPatternRecoInfo = 'SiSpacePointsSeedMaker_SLHCConversionTracks'
+   
+   elif trackingCuts.mode() == "LargeD0" or trackingCuts.mode() == "LowPtLargeD0":
+     trackPatternRecoInfo = 'SiSpacePointsSeedMaker_LargeD0'
+   
+   useBremMode = trackingCuts.mode() == "Offline" or trackingCuts.mode() == "SLHC" or trackingCuts.mode() == "DBM"
+   
+   kwargs = {}
+   #Prepare default parameter settings for the tool
+   kwargs = setDefaults( kwargs,
+                         useSCT                        = trackingCuts.useSCT(),
+                         usePixel                      = trackingCuts.usePixel(),
+                         RoadTool                      = siDetElementsRoadMakerTool,
+                         CombinatorialTrackFinder      = trackFinderTool,
+                         pTmin                         = trackingCuts.minPT(),
+                         pTminBrem                     = trackingCuts.minPTBrem(),
+                         pTminSSS                      = InDetFlags.pT_SSScut(),
+                         nClustersMin                  = trackingCuts.minClusters(),
+                         nHolesMax                     = trackingCuts.nHolesMax(),
+                         nHolesGapMax                  = trackingCuts.nHolesGapMax(),
+                         SeedsFilterLevel              = trackingCuts.seedFilterLevel(),
+                         Xi2max                        = trackingCuts.Xi2max(),
+                         Xi2maxNoAdd                   = trackingCuts.Xi2maxNoAdd(),
+                         nWeightedClustersMin          = trackingCuts.nWeightedClustersMin(),
+                         CosmicTrack                   = InDetFlags.doCosmics(),
+                         Xi2maxMultiTracks             = trackingCuts.Xi2max(), # was 3.
+                         useSSSseedsFilter             = InDetFlags.doSSSfilter(),
+                         doMultiTracksProd             = True,
+                         useBremModel                  = InDetFlags.doBremRecovery() and useBremMode, # only for NewTracking the brem is debugged !!!
+                         doCaloSeededBrem              = InDetFlags.doCaloSeededBrem(),
+                         doHadCaloSeedSSS              = InDetFlags.doHadCaloSeededSSS(),
+                         phiWidth                      = trackingCuts.phiWidthBrem(),
+                         etaWidth                      = trackingCuts.etaWidthBrem(),
+                         InputClusterContainerName     = InDetKeys.CaloClusterROIContainer(), 
+                         InputHadClusterContainerName  = InDetKeys.HadCaloClusterROIContainer(), 
+                         TrackPatternRecoInfo          = trackPatternRecoInfo,
+                         UseAssociationTool            = usePrdAssociationTool)
+   
+   
+   #Change the parameters based on the tracking cuts
+   if trackingCuts.mode() == "SLHC" or trackingCuts.mode() == "ForwardSLHCTracks" or trackingCuts.mode() == "VeryForwardSLHCTracks" :
+      kwargs = setDefaults( kwargs,
+                            ITKGeometry = True )
+   
+   if trackingCuts.mode() == "DBM":
+      kwargs = setDefaults( kwargs,
+                            MagneticFieldMode = "NoField",
+                            useBremModel = False,
+                            doMultiTracksProd = False,
+                            pTminSSS = -1,
+                            CosmicTrack = False,
+                            useSSSseedsFilter = False,
+                            doCaloSeededBrem = False,
+                            doHadCaloSeedSSS = False)
+   
+   if InDetFlags.doStoreTrackSeeds():
+      from SeedToTrackConversionTool.SeedToTrackConversionToolConf import InDet__SeedToTrackConversionTool
+      InDet_SeedToTrackConversion = InDet__SeedToTrackConversionTool(name       = "InDet_SeedToTrackConversion"+trackingCuts.extension(),
+                                                                     OutputName = InDetKeys.SiSPSeedSegments()+trackingCuts.extension())
+      kwargs = setDefaults( kwargs,
+                            SeedToTrackConversion = InDet_SeedToTrackConversion,
+                            SeedSegmentsWrite = True )
+   
+   
+   
+   from SiTrackMakerTool_xk.SiTrackMakerTool_xkConf import InDet__SiTrackMaker_xk
+   return  InDet__SiTrackMaker_xk(name = name,
+                                  **kwargs)
+
+
+
+def siSPSeededTrackFinder_builder( name, outputTracks, trackingCuts, usePrdAssociationTool, nameSuffix ):
+   from .InDetTrigCollectionKeys           import TrigPixelKeys, TrigSCTKeys
+   from InDetRecExample.InDetJobProperties import InDetFlags
+
+
+   
+   #Load subtools of the TrackFinder
+   siSpacePointsSeedMakerTool = siSpacePointsSeedMakerTool_builder(name                  = get_full_name( 'siSPSeedMaker', nameSuffix),
+                                                                   trackingCuts          = trackingCuts,
+                                                                   usePrdAssociationTool = usePrdAssociationTool )
+   
+   # --- Z-coordinates primary vertices finder (only for collisions)
+   zVertexMakerTool = None
+   #FIXME:Switch to trig flags?
+   if InDetFlags.useZvertexTool() and trackingCuts.mode() != "DBM":
+      print('Running z-vertex maker')
+      zVertexMakerTool =  zVertexMakerTool_builder(name, trackingCuts, siSpacePointsSeedMakerTool )
+   
+   # --- SCT and Pixel detector elements road builder
+   siDetectorElementRoadMaker = siDetectorElementRoadMakerTool_builder( name         = get_full_name( 'SiDetectorElementRoadMaker', nameSuffix),
+                                                                        trackingCuts = trackingCuts )
+   
+   # --- Local track finding using sdCaloSeededSSSpace point seed
+   siCombinatorialTrackFinderTool = siCombinatorialTrackFinderTool_builder( name         = get_full_name( 'SiCombinatorialTrackFinder', nameSuffix),
+                                                                            trackingCuts = trackingCuts)
+
+
+   siTrackMakerTool =  siTrackMakerTool_builder( name                       = get_full_name( 'siTrackMaker', nameSuffix),
+                                                 siDetElementsRoadMakerTool = siDetectorElementRoadMaker,
+                                                 trackFinderTool            = siCombinatorialTrackFinderTool,
+                                                 trackingCuts               = trackingCuts,
+                                                 usePrdAssociationTool      = usePrdAssociationTool)
+
+   #-----------------------------------------------------
+   #  Configure parameters
+
+   kwargs = {}
+   #Prepare default parameter settings for the tool
+   kwargs = setDefaults( kwargs,
+                         TrackTool           = siTrackMakerTool,
+                         PRDtoTrackMap       = TrigPixelKeys.PRDtoTrackMap if usePrdAssociationTool else '', #TODO: if prd is enabled this needs to be tested
+                         SpacePointsPixelName= TrigPixelKeys.SpacePoints,
+                         SpacePointsSCTName  = TrigSCTKeys.SpacePoints,
+                         TrackSummaryTool    = trackSummaryTool_getter(doTRT=False), #TODO: x-check whether we need different config
+                         TracksLocation      = outputTracks, #outEFIDTracks,
+                         SeedsTool           = siSpacePointsSeedMakerTool,
+                         ZvertexTool         = zVertexMakerTool, 
+                         useZvertexTool      = InDetFlags.useZvertexTool() and trackingCuts.mode() != "DBM",
+                         useNewStrategy      = InDetFlags.useNewSiSPSeededTF() and trackingCuts.mode() != "DBM",
+                         useMBTSTimeDiff     = InDetFlags.useMBTSTimeDiff(),
+                         useZBoundFinding    = trackingCuts.doZBoundary() and trackingCuts.mode() != "DBM" )
+   
+   
+   #Specific tracking settings 
+   if trackingCuts.mode() == "ForwardSLHCTracks" or trackingCuts.mode() == "ForwardTracks":
+      kwargs = setDefaults( kwargs,
+                            useNewStrategy     = False,
+                            useMBTSTimeDiff    = InDetFlags.useMBTSTimeDiff(),
+                            useZBoundFinding   = False,
+                            useZvertexTool     = InDetFlags.useZvertexTool() )
+   
+      if InDetFlags.doHeavyIon():
+            kwargs = setDefaults( kwargs, FreeClustersCut = 2) #Heavy Ion optimization from Igor
+
+   #-----------------------------------------------------
+
+
+   from SiSPSeededTrackFinder.SiSPSeededTrackFinderConf import InDet__SiSPSeededTrackFinder
+   return InDet__SiSPSeededTrackFinder(name = name,
+                                    **kwargs )
+
diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
index 40d01fee50f0a4107690bc8a087749f823630fd0..3006e7252de8b40bca2e66ac3ca3f7f8a8feec24 100644
--- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
@@ -1350,6 +1350,16 @@ HLT_g35_loose_mu18_L1EM24VHI:
     7: 2
 HLT_g35_medium_g25_medium_L12EM20VH:
   eventCount: 0
+HLT_g35_tight_icalotight_mu15noL1_mu2noL1_L1EM22VHI:
+  eventCount: 0
+  stepCounts:
+    0: 5
+    1: 5
+    2: 5
+  stepFeatures:
+    0: 10
+    1: 10
+    2: 11
 HLT_g35_tight_icalotight_mu18noL1_L1EM22VHI:
   eventCount: 0
   stepCounts:
@@ -1469,7 +1479,7 @@ HLT_j0_aggSEP500htSEP30etSEP0eta320_L1J20:
   stepCounts:
     0: 1
   stepFeatures:
-    0: 50
+    0: 5
 HLT_j0_perf_L1J12_EMPTY:
   eventCount: 0
 HLT_j0_vbenfSEP30etSEP34mass35SEP50fbet_L1J20:
diff --git a/Trigger/TrigValidation/TrigInDetValidation/CMakeLists.txt b/Trigger/TrigValidation/TrigInDetValidation/CMakeLists.txt
index 5fa71b2c2ec42a75a808900e1018207f3bc9d64a..bb8602ea3856257191dbf96f54f977ea51460590 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/CMakeLists.txt
+++ b/Trigger/TrigValidation/TrigInDetValidation/CMakeLists.txt
@@ -17,5 +17,5 @@ atlas_install_scripts( scripts/TIDA*.py test/test*.py POST_BUILD_CMD ${ATLAS_FLA
 # Unit test for python test scripts:
 atlas_add_test( TrigValSteeringUT
                 SCRIPT trigvalsteering-unit-tester.py ${CMAKE_CURRENT_SOURCE_DIR}/test
-                PROPERTIES TIMEOUT 1200
+                PROPERTIES TIMEOUT 600
                 POST_EXEC_SCRIPT nopost.sh )
diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/comparitor.json b/Trigger/TrigValidation/TrigInDetValidation/share/comparitor.json
index 8f92f4e743e5f5ce3685c29bac62d1937bdd9910..d924fee9e7f313267622fe8257784af5b7b53095 100644
--- a/Trigger/TrigValidation/TrigInDetValidation/share/comparitor.json
+++ b/Trigger/TrigValidation/TrigInDetValidation/share/comparitor.json
@@ -27,7 +27,7 @@
         "chains" : "HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_TauCore_FTF:HLT_Roi_TauCore HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_TauIso_FTF:HLT_Roi_TauIso"
     },
     "EFtau":{ 
-        "chains" : "HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_TauIso_FTF:HLT_Roi_TauIso HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_Tau_IDTrig:HLT_TauIso"
+        "chains" : "HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_TauIso_FTF:HLT_Roi_TauIso HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_Tau_IDTrig:HLT_Roi_TauIso"
     },
     "L2bjet":{ 
         "chains" : "HLT_j45_subjesgscIS_ftf_boffperf_split_L1J20:HLT_IDTrack_Bjet_FTF"
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu40.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu40.py
index eb28cde6636c16bbf1cf04552dd7a33a0f83399b..d15e4aa40811099f3f00afea99519ba5623109bb 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu40.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu40.py
@@ -29,6 +29,8 @@ Slices  = ['muon','electron','tau','bjet','fsjet']
 Events  = 4000
 Threads = 8 
 Slots   = 8
+Release = "current"
+
 Input   = 'ttbar_ID'    # defined in TrigValTools/share/TrigValInputs.json  
 
 Jobs = [ ( "Offline",     " TIDAdata-run3-offline.dat      -r Offline -o data-hists-offline.root" ),
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_old.py
deleted file mode 100755
index 63ce3daf22f0f5555c6faecdbe0972d78a501cf5..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_old.py
+++ /dev/null
@@ -1,127 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for all_ttbar_pu80
-# art-type: grid
-# art-include: master/Athena
-# art-input-nfiles: 3
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['muon','electron','tau','bjet']
-rdo2aod.max_events = 4000 
-rdo2aod.threads = 8 
-rdo2aod.concurrent_events = 8
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-rdo2aod.input = 'ttbar_pu80'   # defined in TrigValTools/share/TrigValInputs.json  
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3-offline.dat -r Offline -f data-hists.root -b Test_bin.dat '
-    test.check_steps.append(rdict)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2muon','L2','muon')
-comp.test='ttbar'
-test.check_steps.append(comp)
- 
- 
-comp2=TrigInDetCompStep('Comp_EFmuon','EF','muon')
-comp2.test='ttbar'
-test.check_steps.append(comp2)
-
-
-comp3=TrigInDetCompStep('Comp_L2bjet','L2','bjet')
-comp3.test='ttbar'
-test.check_steps.append(comp3)
-
-comp4=TrigInDetCompStep('Comp_EFbjet','EF','bjet')
-comp4.test='ttbar'
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2tau','L2','tau')
-comp5.test='ttbar'
-test.check_steps.append(comp5)
-
-comp6=TrigInDetCompStep('Comp_EFtau','EF','tau')
-comp6.test='ttbar'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2ele','L2','electron')
-comp7.test='ttbar'
-test.check_steps.append(comp7)
-
-comp8=TrigInDetCompStep('Comp_EFele','EF','electron')
-comp8.test='ttbar'
-test.check_steps.append(comp8)
-
-comp9=TrigInDetCompStep('Comp_L2FS','L2','FS')
-comp9.test='ttbar'
-test.check_steps.append(comp9)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_short_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_short_old.py
deleted file mode 100755
index 83941ab6bf6ae82c2385e6add222b8c00dca8636..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_short_old.py
+++ /dev/null
@@ -1,127 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for all_ttbar_pu80_short
-# art-type: grid
-# art-include: master/Athena
-# art-input-nfiles: 3
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['muon','electron','tau','bjet']
-rdo2aod.max_events = 1000 
-rdo2aod.threads = 8 
-rdo2aod.concurrent_events = 8
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-rdo2aod.input = 'ttbar_pu80'   # defined in TrigValTools/share/TrigValInputs.json  
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3-offline.dat -r Offline -f data-hists.root -b Test_bin.dat '
-    test.check_steps.append(rdict)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2muon','L2','muon')
-comp.test='ttbar'
-test.check_steps.append(comp)
- 
- 
-comp2=TrigInDetCompStep('Comp_EFmuon','EF','muon')
-comp2.test='ttbar'
-test.check_steps.append(comp2)
-
-
-comp3=TrigInDetCompStep('Comp_L2bjet','L2','bjet')
-comp3.test='ttbar'
-test.check_steps.append(comp3)
-
-comp4=TrigInDetCompStep('Comp_EFbjet','EF','bjet')
-comp4.test='ttbar'
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2tau','L2','tau')
-comp5.test='ttbar'
-test.check_steps.append(comp5)
-
-comp6=TrigInDetCompStep('Comp_EFtau','EF','tau')
-comp6.test='ttbar'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2ele','L2','electron')
-comp7.test='ttbar'
-test.check_steps.append(comp7)
-
-comp8=TrigInDetCompStep('Comp_EFele','EF','electron')
-comp8.test='ttbar'
-test.check_steps.append(comp8)
-
-comp9=TrigInDetCompStep('Comp_L2FS','L2','FS')
-comp9.test='ttbar'
-test.check_steps.append(comp9)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_st_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_st_old.py
deleted file mode 100755
index 357cde750984cdc18b769e4256d537793c757001..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_st_old.py
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for all_ttbar_pu80_st
-# art-type: grid
-# art-include: master/Athena
-# art-input-nfiles: 3
-# art-athena-mt: 4
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['muon','electron','tau','bjet']
-rdo2aod.max_events = 1000 
-rdo2aod.threads = 1 
-rdo2aod.concurrent_events = 1 
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-rdo2aod.input = 'ttbar_pu80'   # defined in TrigValTools/share/TrigValInputs.json  
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3-offline.dat -r Offline -f data-hists.root -b Test_bin.dat '
-    test.check_steps.append(rdict)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2muon','L2','muon')
-comp.test='ttbar'
-test.check_steps.append(comp)
- 
- 
-comp2=TrigInDetCompStep('Comp_EFmuon','EF','muon')
-comp2.test='ttbar'
-test.check_steps.append(comp2)
-
-
-comp3=TrigInDetCompStep('Comp_L2bjet','L2','bjet')
-comp3.test='ttbar'
-test.check_steps.append(comp3)
-
-comp4=TrigInDetCompStep('Comp_EFbjet','EF','bjet')
-comp4.test='ttbar'
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2tau','L2','tau')
-comp5.test='ttbar'
-test.check_steps.append(comp5)
-
-comp6=TrigInDetCompStep('Comp_EFtau','EF','tau')
-comp6.test='ttbar'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2ele','L2','electron')
-comp7.test='ttbar'
-test.check_steps.append(comp7)
-
-comp8=TrigInDetCompStep('Comp_EFele','EF','electron')
-comp8.test='ttbar'
-test.check_steps.append(comp8)
-
-comp9=TrigInDetCompStep('Comp_L2FS','L2','FS')
-comp9.test='ttbar'
-test.check_steps.append(comp9)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_nopps_pu40_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_nopps_pu40_old.py
deleted file mode 100755
index f014eae0bec7dbb9a74ac77c1e05889e9e41e7d8..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_nopps_pu40_old.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for bjet_pu40_mt
-# art-type: grid
-# art-include: master/Athena
-# art-input-nfiles: 3
-# art-athena-mt: 4
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# art-output: cost-perCall
-# art-output: cost-perEvent
-# art-output: cost-perCall-chain
-# art-output: cost-perEvent-chain
-# art-output: *.dat 
-
-import os
-os.system("echo 'ftf = findAlgorithm(topSequence, \"TrigFastTrackFinder__jet\")' > dopps.py")
-os.system("echo 'ftf.TripletDoPPS=False' >> dopps.py")
-
-Slices = ['bjet']
-RunEF   = True
-Events  = 4000
-Threads = 8 
-Slots   = 8
-postinclude_file = 'dopps.py'
-Input = 'ttbar_ID'    # defined in TrigValTools/share/TrigValInputs.json  
-
-TrackReference = [ 'Truth', 'Offline' ]
-
-
-from AthenaCommon.Include import include 
-include("TrigInDetValidation/TrigInDetValidation_OldBase.py")
-
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_pu40_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_pu40_old.py
deleted file mode 100755
index 3aa3e95ad34f152e099e44661458610dd6d7e3a1..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_bjet_pu40_old.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for bjet_pu40_mt
-# art-type: grid
-# art-include: master/Athena
-# art-input-nfiles: 3
-# art-athena-mt: 4
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# art-output: cost-perCall
-# art-output: cost-perEvent
-# art-output: cost-perCall-chain
-# art-output: cost-perEvent-chain
-# art-output: *.dat 
-
-Slices = ['bjet']
-RunEF   = True
-Events  = 4000
-Threads = 8 
-Slots   = 8
-Input = 'ttbar_ID'    # defined in TrigValTools/share/TrigValInputs.json  
-
-TrackReference = [ 'Truth', 'Offline' ]
-
-
-from AthenaCommon.Include import include 
-include("TrigInDetValidation/TrigInDetValidation_OldBase.py")
-
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_jpsiee_pu40_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_jpsiee_pu40_old.py
deleted file mode 100755
index 3995c8d3cec0116958651a5fba22e3f6d4d05ab5..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_jpsiee_pu40_old.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for el_Jpsiee_pu40
-# art-type: grid
-# art-include: master/Athena
-# art-input: mc15_13TeV.129190.Pythia8_AU2CTEQ6L1_ppToJpsie3e3.recon.RDO.e3802_s2608_s2183_r7042
-# art-input-nfiles: 16
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['electron']
-rdo2aod.max_events = 8000 
-rdo2aod.threads = 8
-rdo2aod.concurrent_events = 8
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-if local:
-    rdo2aod.input = 'Jpsiee_pu40'     # defined in TrigValTools/share/TrigValInputs.json  
-else:
-    rdo2aod.input = ''
-    rdo2aod.args += '--inputRDOFile=$ArtInFile '
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3.dat -f data-hists.root -p 11 -b Test_bin.dat '
-    test.check_steps.append(rdict)
-    rdict2 = TrigInDetdictStep('TrigInDetDict2')
-    rdict2.args='TIDAdata-run3-offline.dat -r Offline  -f data-hists-offline.root -b Test_bin.dat '
-    test.check_steps.append(rdict2)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2ele','L2','electron')
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep('Comp_EFele','EF','electron')
-test.check_steps.append(comp2)
-
-comp3=TrigInDetCompStep('Comp_L2eleLowpt','L2','electron',lowpt=True)
-test.check_steps.append(comp3)
-
-comp4=TrigInDetCompStep('Comp_EFeleLowpt','EF','electron',lowpt=True)
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2ele_off','L2','electron')
-comp5.type = 'offline'
-test.check_steps.append(comp5)
-  
-comp6=TrigInDetCompStep('Comp_EFele_off','EF','electron')
-comp6.type = 'offline'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2eleLowpt_off','L2','electron',lowpt=True)
-comp7.type = 'offline'
-test.check_steps.append(comp7)
-
-comp8=TrigInDetCompStep('Comp_EFeleLowpt_off','EF','electron',lowpt=True)
-comp8.type = 'offline'
-test.check_steps.append(comp8)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_singlee_7-80_larged0_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_singlee_7-80_larged0_old.py
deleted file mode 100755
index 976ed85fa7dc9439a468bcfc0055da09251d173c..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_singlee_7-80_larged0_old.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for el_singlee_7-80_larged0
-# art-type: grid
-# art-include: master/Athena
-# art-input: mc15_13TeV.159053.ParticleGenerator_e_Et7to80_vertxy20.recon.RDO.e3603_s2726_r7728
-# art-input-nfiles: 10
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['electron']
-rdo2aod.max_events = 20000 
-rdo2aod.threads = 8
-rdo2aod.concurrent_events = 8
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-if local:
-    rdo2aod.input = 'Single_el_larged0'    # defined in TrigValTools/share/TrigValInputs.json  
-else:
-    rdo2aod.input = ''
-    rdo2aod.args += '--inputRDOFile=$ArtInFile '
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3-larged0-el.dat -f data-hists.root -p 11 -b Test_bin_larged0.dat '
-    test.check_steps.append(rdict)
-    rdict2 = TrigInDetdictStep('TrigInDetDict2')
-    rdict2.args='TIDAdata-run3-offline-larged0-el.dat -r Offline  -f data-hists-offline.root -b Test_bin_larged0.dat '
-    test.check_steps.append(rdict2)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2ele','L2','electron')
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep('Comp_EFele','EF','electron')
-test.check_steps.append(comp2)
-
-comp3=TrigInDetCompStep('Comp_L2eleLowpt','L2','electron',lowpt=True)
-test.check_steps.append(comp3)
-
-comp4=TrigInDetCompStep('Comp_EFeleLowpt','EF','electron',lowpt=True)
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2ele_off','L2','electron')
-comp5.type = 'offline'
-test.check_steps.append(comp5)
-  
-comp6=TrigInDetCompStep('Comp_EFele_off','EF','electron')
-comp6.type = 'offline'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2eleLowpt_off','L2','electron',lowpt=True)
-comp7.type = 'offline'
-test.check_steps.append(comp7)
-
-comp8=TrigInDetCompStep('Comp_EFeleLowpt_off','EF','electron',lowpt=True)
-comp8.type = 'offline'
-test.check_steps.append(comp8)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_singlee_7-80_larged0_pu_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_singlee_7-80_larged0_pu_old.py
deleted file mode 100755
index ed1cd1d3eb8078519d7d371e27c5a37600f5e5ae..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_singlee_7-80_larged0_pu_old.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for el_singlee_7-80_larged0_pu
-# art-type: grid
-# art-include: master/Athena
-# art-input: mc15_13TeV.159053.ParticleGenerator_e_Et7to80_vertxy20.recon.RDO.e3603_s2726_r7772
-# art-input-nfiles: 10
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['electron']
-rdo2aod.max_events = 20000 
-rdo2aod.threads = 8
-rdo2aod.concurrent_events = 8
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-if local:
-    rdo2aod.input = 'Single_el_larged0_pu'    # defined in TrigValTools/share/TrigValInputs.json  
-else:
-    rdo2aod.input = ''
-    rdo2aod.args += '--inputRDOFile=$ArtInFile '
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3-larged0-el.dat -f data-hists.root -p 11 -b Test_bin_larged0.dat '
-    test.check_steps.append(rdict)
-    rdict2 = TrigInDetdictStep('TrigInDetDict2')
-    rdict2.args='TIDAdata-run3-offline-larged0-el.dat -r Offline  -f data-hists-offline.root -b Test_bin_larged0.dat '
-    test.check_steps.append(rdict2)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2ele','L2','electron')
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep('Comp_EFele','EF','electron')
-test.check_steps.append(comp2)
-
-comp3=TrigInDetCompStep('Comp_L2eleLowpt','L2','electron',lowpt=True)
-test.check_steps.append(comp3)
-
-comp4=TrigInDetCompStep('Comp_EFeleLowpt','EF','electron',lowpt=True)
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2ele_off','L2','electron')
-comp5.type = 'offline'
-test.check_steps.append(comp5)
-  
-comp6=TrigInDetCompStep('Comp_EFele_off','EF','electron')
-comp6.type = 'offline'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2eleLowpt_off','L2','electron',lowpt=True)
-comp7.type = 'offline'
-test.check_steps.append(comp7)
-
-comp8=TrigInDetCompStep('Comp_EFeleLowpt_off','EF','electron',lowpt=True)
-comp8.type = 'offline'
-test.check_steps.append(comp8)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_singlee_7-80_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_singlee_7-80_old.py
deleted file mode 100755
index 50bf73e3b53187e1dbfa7bc37eb00485b603cba9..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_singlee_7-80_old.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for el_singlee_7-80
-# art-type: grid
-# art-include: master/Athena
-# art-input: mc15_13TeV.159010.ParticleGenerator_e_Et7to80.recon.RDO.e1948_s2726_r7728
-# art-input-nfiles: 10
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['electron']
-rdo2aod.max_events = 20000 
-rdo2aod.threads = 8
-rdo2aod.concurrent_events = 8
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-if local:
-    rdo2aod.input = 'Single_el'     # defined in TrigValTools/share/TrigValInputs.json  
-else:
-    rdo2aod.input = ''
-    rdo2aod.args += '--inputRDOFile=$ArtInFile '
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3.dat -f data-hists.root -p 11 -b Test_bin.dat '
-    test.check_steps.append(rdict)
-    rdict2 = TrigInDetdictStep('TrigInDetDict2')
-    rdict2.args='TIDAdata-run3-offline.dat -r Offline  -f data-hists-offline.root -b Test_bin.dat '
-    test.check_steps.append(rdict2)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2ele','L2','electron')
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep('Comp_EFele','EF','electron')
-test.check_steps.append(comp2)
-
-comp3=TrigInDetCompStep('Comp_L2eleLowpt','L2','electron',lowpt=True)
-test.check_steps.append(comp3)
-
-comp4=TrigInDetCompStep('Comp_EFeleLowpt','EF','electron',lowpt=True)
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2ele_off','L2','electron')
-comp5.type = 'offline'
-test.check_steps.append(comp5)
-  
-comp6=TrigInDetCompStep('Comp_EFele_off','EF','electron')
-comp6.type = 'offline'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2eleLowpt_off','L2','electron',lowpt=True)
-comp7.type = 'offline'
-test.check_steps.append(comp7)
-
-comp8=TrigInDetCompStep('Comp_EFeleLowpt_off','EF','electron',lowpt=True)
-comp8.type = 'offline'
-test.check_steps.append(comp8)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_singlee_7-80_pu40_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_singlee_7-80_pu40_old.py
deleted file mode 100755
index f9da6ad43467c4bf4a34df53a4d1cc66fbce894e..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_singlee_7-80_pu40_old.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for el_singlee_7-80_pu40
-# art-type: grid
-# art-include: master/Athena
-# art-input: mc15_13TeV.159010.ParticleGenerator_e_Et7to80.recon.RDO.e1948_s2726_r7728
-# art-input-nfiles: 10
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['electron']
-rdo2aod.max_events = 20000 
-rdo2aod.threads = 8
-rdo2aod.concurrent_events = 8
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-if local:
-    rdo2aod.input = 'Single_el_pu'    # defined in TrigValTools/share/TrigValInputs.json  
-else:
-    rdo2aod.input = ''
-    rdo2aod.args += '--inputRDOFile=$ArtInFile '
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3.dat -f data-hists.root -p 11 -b Test_bin.dat '
-    test.check_steps.append(rdict)
-    rdict2 = TrigInDetdictStep('TrigInDetDict2')
-    rdict2.args='TIDAdata-run3-offline.dat -r Offline  -f data-hists-offline.root -b Test_bin.dat '
-    test.check_steps.append(rdict2)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2ele','L2','electron')
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep('Comp_EFele','EF','electron')
-test.check_steps.append(comp2)
-
-comp3=TrigInDetCompStep('Comp_L2eleLowpt','L2','electron',lowpt=True)
-test.check_steps.append(comp3)
-
-comp4=TrigInDetCompStep('Comp_EFeleLowpt','EF','electron',lowpt=True)
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2ele_off','L2','electron')
-comp5.type = 'offline'
-test.check_steps.append(comp5)
-  
-comp6=TrigInDetCompStep('Comp_EFele_off','EF','electron')
-comp6.type = 'offline'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2eleLowpt_off','L2','electron',lowpt=True)
-comp7.type = 'offline'
-test.check_steps.append(comp7)
-
-comp8=TrigInDetCompStep('Comp_EFeleLowpt_off','EF','electron',lowpt=True)
-comp8.type = 'offline'
-test.check_steps.append(comp8)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40.py
index 4dadf400dbda2eb95c4990ac984ecfefe6b4bc56..1dce5e61cef882bf5fd18cb60fa16a2a5a70b9b1 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40.py
@@ -32,7 +32,8 @@ Events  = 16000
 Threads = 8 
 Slots   = 8
 Input   = 'Zee_pu40'    # defined in TrigValTools/share/TrigValInputs.json
-GridFiles=True
+Release = "current"
+GridFiles = True
 
 Jobs = [ ( "Truth",       " TIDAdata-run3.dat                    -o data-hists.root -p 11" ),
          ( "Offline",     " TIDAdata-run3-offline.dat -r Offline -o data-hists-offline.root" ) ]
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40_old.py
deleted file mode 100755
index 82997b99273faf2d89b559a4baa9b1e511146430..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40_old.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for el_zee_pu40
-# art-type: grid
-# art-include: master/Athena
-# art-input: mc15_13TeV.361106.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zee.recon.RDO.e3601_s2665_s2183_r7191
-# art-input-nfiles: 8
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['electron']
-rdo2aod.max_events = 16000 
-rdo2aod.threads = 8
-rdo2aod.concurrent_events = 8
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-if local:
-    rdo2aod.input = 'Zee_pu40'      # defined in TrigValTools/share/TrigValInputs.json  
-else:
-    rdo2aod.input = ''
-    rdo2aod.args += '--inputRDOFile=$ArtInFile '
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3.dat -f data-hists.root -p 11 -b Test_bin.dat '
-    test.check_steps.append(rdict)
-    rdict2 = TrigInDetdictStep('TrigInDetDict2')
-    rdict2.args='TIDAdata-run3-offline.dat -r Offline  -f data-hists-offline.root -b Test_bin.dat '
-    test.check_steps.append(rdict2)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2ele','L2','electron')
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep('Comp_EFele','EF','electron')
-test.check_steps.append(comp2)
-
-comp3=TrigInDetCompStep('Comp_L2eleLowpt','L2','electron',lowpt=True)
-test.check_steps.append(comp3)
-
-comp4=TrigInDetCompStep('Comp_EFeleLowpt','EF','electron',lowpt=True)
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2ele_off','L2','electron')
-comp5.type = 'offline'
-test.check_steps.append(comp5)
-  
-comp6=TrigInDetCompStep('Comp_EFele_off','EF','electron')
-comp6.type = 'offline'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2eleLowpt_off','L2','electron',lowpt=True)
-comp7.type = 'offline'
-test.check_steps.append(comp7)
-
-comp8=TrigInDetCompStep('Comp_EFeleLowpt_off','EF','electron',lowpt=True)
-comp8.type = 'offline'
-test.check_steps.append(comp8)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40_short_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40_short_old.py
deleted file mode 100755
index b7b997ecba6e7ebd9fe9a1271aee1393ea8f0400..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40_short_old.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for el_zee_pu40_short
-# art-type: grid
-# art-include: master/Athena
-# art-input: mc15_13TeV.361106.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zee.recon.RDO.e3601_s2665_s2183_r7191
-# art-input-nfiles: 8
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['electron']
-rdo2aod.max_events = 8000 
-rdo2aod.threads = 8
-rdo2aod.concurrent_events = 8
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-if local:
-    rdo2aod.input = 'Zee_pu40'      # defined in TrigValTools/share/TrigValInputs.json  
-else:
-    rdo2aod.input = ''
-    rdo2aod.args += '--inputRDOFile=$ArtInFile '
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3.dat -f data-hists.root -p 11 -b Test_bin.dat '
-    test.check_steps.append(rdict)
-    rdict2 = TrigInDetdictStep('TrigInDetDict2')
-    rdict2.args='TIDAdata-run3-offline.dat -r Offline  -f data-hists-offline.root -b Test_bin.dat '
-    test.check_steps.append(rdict2)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2ele','L2','electron')
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep('Comp_EFele','EF','electron')
-test.check_steps.append(comp2)
-
-comp3=TrigInDetCompStep('Comp_L2eleLowpt','L2','electron',lowpt=True)
-test.check_steps.append(comp3)
-
-comp4=TrigInDetCompStep('Comp_EFeleLowpt','EF','electron',lowpt=True)
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2ele_off','L2','electron')
-comp5.type = 'offline'
-test.check_steps.append(comp5)
-  
-comp6=TrigInDetCompStep('Comp_EFele_off','EF','electron')
-comp6.type = 'offline'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2eleLowpt_off','L2','electron',lowpt=True)
-comp7.type = 'offline'
-test.check_steps.append(comp7)
-
-comp8=TrigInDetCompStep('Comp_EFeleLowpt_off','EF','electron',lowpt=True)
-comp8.type = 'offline'
-test.check_steps.append(comp8)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40_st.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40_st.py
index 829ea474af30c64c9fc1561e945219fb857ad15e..fc93fd30b0354043d4e7900279f2e0c2ba013551 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40_st.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40_st.py
@@ -32,7 +32,8 @@ Events  = 8000
 Threads = 1 
 Slots   = 1
 Input   = 'Zee_pu40'    # defined in TrigValTools/share/TrigValInputs.json
-GridFiles=True
+Release = "current"
+GridFiles = True
 
 Jobs = [ ( "Truth",       " TIDAdata-run3.dat                    -o data-hists.root -p 11" ),
          ( "Offline",     " TIDAdata-run3-offline.dat -r Offline -o data-hists-offline.root" ) ]
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40_st_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40_st_old.py
deleted file mode 100755
index 23ec19ec16f292d1bef0b8492a4f9ad80a903e67..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_el_zee_pu40_st_old.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for el_zee_pu40_st
-# art-type: grid
-# art-include: master/Athena
-# art-input: mc15_13TeV.361106.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zee.recon.RDO.e3601_s2665_s2183_r7191
-# art-input-nfiles: 8
-# art-athena-mt: 4
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['electron']
-rdo2aod.max_events = 8000 
-rdo2aod.threads = 1 # TODO: change to 4
-rdo2aod.concurrent_events = 1 # TODO: change to 4
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-if local:
-    rdo2aod.input = 'Zee_pu40'      # defined in TrigValTools/share/TrigValInputs.json  
-else:
-    rdo2aod.input = ''
-    rdo2aod.args += '--inputRDOFile=$ArtInFile '
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3.dat -f data-hists.root -p 11 -b Test_bin.dat '
-    test.check_steps.append(rdict)
-    rdict2 = TrigInDetdictStep('TrigInDetDict2')
-    rdict2.args='TIDAdata-run3-offline.dat -r Offline  -f data-hists-offline.root -b Test_bin.dat '
-    test.check_steps.append(rdict2)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2ele','L2','electron')
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep('Comp_EFele','EF','electron')
-test.check_steps.append(comp2)
-
-comp3=TrigInDetCompStep('Comp_L2eleLowpt','L2','electron',lowpt=True)
-test.check_steps.append(comp3)
-
-comp4=TrigInDetCompStep('Comp_EFeleLowpt','EF','electron',lowpt=True)
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2ele_off','L2','electron')
-comp5.type = 'offline'
-test.check_steps.append(comp5)
-  
-comp6=TrigInDetCompStep('Comp_EFele_off','EF','electron')
-comp6.type = 'offline'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2eleLowpt_off','L2','electron',lowpt=True)
-comp7.type = 'offline'
-test.check_steps.append(comp7)
-
-comp8=TrigInDetCompStep('Comp_EFeleLowpt_off','EF','electron',lowpt=True)
-comp8.type = 'offline'
-test.check_steps.append(comp8)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml_pu40_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml_pu40_old.py
deleted file mode 100755
index c7d0df17463a66d36d605815c902f3e55851bffc..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml_pu40_old.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for fsjet_ml_pu40
-# art-type: grid
-# art-include: master/Athena
-# art-input-nfiles: 3
-# art-athena-mt: 4
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# art-output: cost-perCall
-# art-output: cost-perEvent
-# art-output: cost-perCall-chain
-# art-output: cost-perEvent-chain
-# art-output: *.dat 
-
-
-Slices  = ['fsjet']
-RunEF   = False
-Events  = 2000 
-Threads = 1 
-Slots   = 1 # what about the mt: 4 art directive ? nfiles: 3 ?
-Input   = 'ttbar'    # defined in TrigValTools/share/TrigValInputs.json  
-
-postinclude_file = 'TIDAml_extensions.py'
-
-TrackReference = [ 'Truth', 'Offline' ]
-
-
-from AthenaCommon.Include import include 
-include("TrigInDetValidation/TrigInDetValidation_OldBase.py")
-
-
- 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_pu40_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_pu40_old.py
deleted file mode 100755
index 706271f7e05556a53520cbde9adbeda7d56251d4..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_pu40_old.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for fsjet_pu40
-# art-type: grid
-# art-include: master/Athena
-# art-input-nfiles: 3
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# art-output: cost-perCall
-# art-output: cost-perEvent
-# art-output: cost-perCall-chain
-# art-output: cost-perEvent-chain
-# art-output: *.dat 
-
-
-Slices  = ['fsjet']
-RunEF   = False
-Events  = 2000 
-Threads = 8 
-Slots   = 8
-Input   = 'ttbar'    # defined in TrigValTools/share/TrigValInputs.json  
-
-TrackReference = [ 'Truth', 'Offline' ]
-
-
-from AthenaCommon.Include import include 
-include("TrigInDetValidation/TrigInDetValidation_OldBase.py")
-
-
- 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_pu40_st_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_pu40_st_old.py
deleted file mode 100755
index eaac4d29a2ba9600fcc1f590432570ab2e599169..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_pu40_st_old.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for fsjet_pu40_st
-# art-type: grid
-# art-include: master/Athena
-# art-input-nfiles: 3
-# art-athena-mt: 4
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# art-output: cost-perCall
-# art-output: cost-perEvent
-# art-output: cost-perCall-chain
-# art-output: cost-perEvent-chain
-# art-output: *.dat 
-
-
-Slices  = ['fsjet']
-RunEF   = False
-Events  = 2000 
-Threads = 1 
-Slots   = 1 # what about the mt: 4 art directive ? nfiles: 3 ?
-Input   = 'ttbar'    # defined in TrigValTools/share/TrigValInputs.json  
-
-TrackReference = [ 'Truth', 'Offline' ]
-
-
-from AthenaCommon.Include import include 
-include("TrigInDetValidation/TrigInDetValidation_OldBase.py")
-
-
- 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_minbias_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_minbias_old.py
deleted file mode 100755
index ed5c049f98d09b1949ca74d3360ce8024accca6e..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_minbias_old.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env python
-
-
-# art-description: art job for minbias
-# art-type: grid
-# art-include: master/Athena
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# art-athena-nfiles: 4
-# art-athena-mt: 8
-# art-memory: 4096
-# 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: HLT*
-# art-output: times*
-# art-output: cost-perCall
-# art-output: cost-perEvent
-# art-output: cost-perCall-chain
-# art-output: cost-perEvent-chain
-# art-output: *.dat 
-
-
-Slices  = ['minbias']
-RunEF   = False
-Events  = 8000 
-Threads = 8 
-Slots   = 8
-Input   = 'minbias'    # defined in TrigValTools/share/TrigValInputs.json  
-
-TrackReference = [ 'Truth', 'Offline' ]
-
-
-from AthenaCommon.Include import include 
-include("TrigInDetValidation/TrigInDetValidation_OldBase.py")
-
-
- 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_bphys_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_bphys_old.py
deleted file mode 100755
index 81e88a51941ff80f336322c2c05a9606414c47f4..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_bphys_old.py
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for mu_bphys
-# art-type: grid
-# art-include: master/Athena
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['muon']
-rdo2aod.max_events = 6000 
-rdo2aod.threads = 8
-rdo2aod.concurrent_events = 8
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-rdo2aod.input = 'Bphys_JpsiPhi'    # defined in TrigValTools/share/TrigValInputs.json  
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3.dat -f data-hists.root -p 13 -b Test_bin.dat '
-    test.check_steps.append(rdict)
-    rdict2 = TrigInDetdictStep('TrigInDetDict2')
-    rdict2.args='TIDAdata-run3-offline.dat -r Offline  -f data-hists-offline.root -b Test_bin.dat '
-    test.check_steps.append(rdict2)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2muon','L2','muon')
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep('Comp_EFmuon','EF','muon')
-test.check_steps.append(comp2)
-
-comp3=TrigInDetCompStep('Comp_L2muonLowpt','L2','muon',lowpt=True)
-test.check_steps.append(comp3)
-  
-comp4=TrigInDetCompStep('Comp_EFmuonLowpt','EF','muon',lowpt=True)
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2muon_off','L2','muon')
-comp5.type = 'offline'
-test.check_steps.append(comp5)
-  
-comp6=TrigInDetCompStep('Comp_EFmuon_off','EF','muon')
-comp6.type = 'offline'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2muonLowpt_off','L2','muon',lowpt=True)
-comp7.type = 'offline'
-test.check_steps.append(comp7)
-  
-comp8=TrigInDetCompStep('Comp_EFmuonLowpt_off','EF','muon',lowpt=True)
-comp8.type = 'offline'
-test.check_steps.append(comp8)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_singlemu_larged0_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_singlemu_larged0_old.py
deleted file mode 100755
index ae31227820186cecf50eac94168c7979e7872aae..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_singlemu_larged0_old.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for mu_singlemu_larged0_pu
-# art-type: grid
-# art-include: master/Athena
-# art-input: mc15_13TeV.107237.ParticleGenerator_mu_Pt4to100_vertxy20.recon.RDO.e3603_s2726_r7772
-# art-input-nfiles: 10
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['muon']
-rdo2aod.max_events = 20000 
-rdo2aod.threads = 8
-rdo2aod.concurrent_events = 8
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-if local:
-    rdo2aod.input = 'Single_mu_larged0_pu'    # defined in TrigValTools/share/TrigValInputs.json  
-else:
-    rdo2aod.input = ''
-    rdo2aod.args += '--inputRDOFile=$ArtInFile '
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3-larged0.dat -f data-hists.root -p 13 -b Test_bin_larged0.dat '
-    test.check_steps.append(rdict)
-    rdict2 = TrigInDetdictStep('TrigInDetDict2')
-    rdict2.args='TIDAdata-run3-offline-larged0.dat -r Offline  -f data-hists-offline.root -b Test_bin_larged0.dat '
-    test.check_steps.append(rdict2)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2muon','L2','muon')
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep('Comp_EFmuon','EF','muon')
-test.check_steps.append(comp2)
-
-comp3=TrigInDetCompStep('Comp_L2muonLowpt','L2','muon',lowpt=True)
-test.check_steps.append(comp3)
-  
-comp4=TrigInDetCompStep('Comp_EFmuonLowpt','EF','muon',lowpt=True)
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2muon_off','L2','muon')
-comp5.type = 'offline'
-test.check_steps.append(comp5)
-  
-comp6=TrigInDetCompStep('Comp_EFmuon_off','EF','muon')
-comp6.type = 'offline'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2muonLowpt_off','L2','muon',lowpt=True)
-comp7.type = 'offline'
-test.check_steps.append(comp7)
-  
-comp8=TrigInDetCompStep('Comp_EFmuonLowpt_off','EF','muon',lowpt=True)
-comp8.type = 'offline'
-test.check_steps.append(comp8)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_singlemu_larged0_pu_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_singlemu_larged0_pu_old.py
deleted file mode 100755
index a3cc45d3f8fd5cec0252577123a27f3dd5b24090..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_singlemu_larged0_pu_old.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for mu_singlemu_larged0_pu
-# art-type: grid
-# art-include: master/Athena
-# art-input: mc15_13TeV.107237.ParticleGenerator_mu_Pt4to100_vertxy20.recon.RDO.e3603_s2726_r7728
-# art-input-nfiles: 10
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['muon']
-rdo2aod.max_events = 20000 
-rdo2aod.threads = 8
-rdo2aod.concurrent_events = 8
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-if local:
-    rdo2aod.input = 'Single_mu_larged0'    # defined in TrigValTools/share/TrigValInputs.json  
-else:
-    rdo2aod.input = ''
-    rdo2aod.args += '--inputRDOFile=$ArtInFile '
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3-larged0.dat -f data-hists.root -p 13 -b Test_bin_larged0.dat '
-    test.check_steps.append(rdict)
-    rdict2 = TrigInDetdictStep('TrigInDetDict2')
-    rdict2.args='TIDAdata-run3-offline-larged0.dat -r Offline  -f data-hists-offline.root -b Test_bin_larged0.dat '
-    test.check_steps.append(rdict2)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2muon','L2','muon')
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep('Comp_EFmuon','EF','muon')
-test.check_steps.append(comp2)
-
-comp3=TrigInDetCompStep('Comp_L2muonLowpt','L2','muon',lowpt=True)
-test.check_steps.append(comp3)
-  
-comp4=TrigInDetCompStep('Comp_EFmuonLowpt','EF','muon',lowpt=True)
-test.check_steps.append(comp4)
-
-comp5=TrigInDetCompStep('Comp_L2muon_off','L2','muon')
-comp5.type = 'offline'
-test.check_steps.append(comp5)
-  
-comp6=TrigInDetCompStep('Comp_EFmuon_off','EF','muon')
-comp6.type = 'offline'
-test.check_steps.append(comp6)
-
-comp7=TrigInDetCompStep('Comp_L2muonLowpt_off','L2','muon',lowpt=True)
-comp7.type = 'offline'
-test.check_steps.append(comp7)
-  
-comp8=TrigInDetCompStep('Comp_EFmuonLowpt_off','EF','muon',lowpt=True)
-comp8.type = 'offline'
-test.check_steps.append(comp8)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_build_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_build_old.py
deleted file mode 100755
index be5e11daf8705ecc2be04de4ea879fbfd42c80ae..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_build_old.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for mu_Zmumu_pu40_build
-# art-type: build
-# art-include: master/Athena
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print ("-x             don't run athena or post post-processing, only plotting")
-    print ("-p             run post-processing, even if -x is set")
-
-
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-        
-from TrigValTools.TrigValSteering import Test, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['muon']
-rdo2aod.max_events = 100 # TODO: 2000 events
-rdo2aod.threads = 1 # TODO: change to 4
-rdo2aod.concurrent_events = 1 # TODO: change to 4
-rdo2aod.perfmon = False
-rdo2aod.input = 'Zmumu_pu40'   # defined in TrigValTools/share/TrigValInputs.json  
-
-
-test = Test.Test()
-test.art_type = 'build'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3.dat -f data-hists.root -p 13 -b Test_bin.dat '
-    test.check_steps.append(rdict)
- 
-
-# Now the comparitor steps
-comp=TrigInDetCompStep( 'Comp_L2muon', 'L2', 'muon' )
-comp.flag = 'L2muon'
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep( 'Comp_EFmuon', 'EF', 'muon' )
-comp2.flag = 'EFmuon'
-test.check_steps.append(comp2)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_old.py
deleted file mode 100755
index 39175be7de87f8b15a6ac49b65567517990e11a1..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_old.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for mu_Zmumu_pu40
-# art-type: grid
-# art-include: master/Athena
-# art-input: mc15_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.RDO.e3601_s2576_s2132_r7143
-# art-input-nfiles: 4
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# art-output: cost-perCall
-# art-output: cost-perEvent
-# art-output: cost-perCall-chain
-# art-output: cost-perEvent-chain
-# art-output: *.dat 
-
-
-Slices  = ['muon']
-RunEF   = True
-Events  = 8000 
-Threads = 8 
-Slots   = 8
-Input   = 'Zmumu_pu40'    # defined in TrigValTools/share/TrigValInputs.json
-GridFiles=True
-
-Args = " -p 13 "
-TrackReference = [ 'Truth', 'Offline' ]
-Lowpt          = [ False, True ] 
-
-from AthenaCommon.Include import include 
-include("TrigInDetValidation/TrigInDetValidation_OldBase.py")
-
-
- 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_short_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_short_old.py
deleted file mode 100755
index 73924c0f5e9ad522b78f6ac88ae8bfe76562c06a..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_short_old.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for mu_Zmumu_pu40
-# art-type: grid
-# art-include: master/Athena
-# art-input: mc15_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.RDO.e3601_s2576_s2132_r7143
-# art-input-nfiles: 4
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# art-output: cost-perCall
-# art-output: cost-perEvent
-# art-output: cost-perCall-chain
-# art-output: cost-perEvent-chain
-# art-output: *.dat 
-
-
-Slices  = ['muon']
-RunEF   = True
-Events  = 2000 
-Threads = 8 
-Slots   = 8
-Input   = 'Zmumu_pu40'    # defined in TrigValTools/share/TrigValInputs.json
-GridFiles=True
-
-Args = " -p 13 "
-TrackReference = [ 'Truth', 'Offline' ]
-Lowpt          = [ False, True ] 
-
-from AthenaCommon.Include import include 
-include("TrigInDetValidation/TrigInDetValidation_OldBase.py")
-
-
- 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_st_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_st_old.py
deleted file mode 100755
index 146fda5462f1c3921e1731c35cb6bc58e5268470..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_st_old.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for mu_Zmumu_pu40_st
-# art-type: grid
-# art-include: master/Athena
-# art-input: mc15_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.RDO.e3601_s2576_s2132_r7143
-# art-input-nfiles: 4
-# art-athena-mt: 4
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# art-output: cost-perCall
-# art-output: cost-perEvent
-# art-output: cost-perCall-chain
-# art-output: cost-perEvent-chain
-# art-output: *.dat 
-
-
-Slices  = ['muon']
-RunEF   = True
-Events  = 2000 
-Threads = 1 
-Slots   = 1
-Input   = 'Zmumu_pu40'    # defined in TrigValTools/share/TrigValInputs.json
-GridFiles=True
-
-Args = " -p 13 "
-TrackReference = [ 'Truth', 'Offline' ]
-Lowpt          = [ False, True ] 
-
-from AthenaCommon.Include import include 
-include("TrigInDetValidation/TrigInDetValidation_OldBase.py")
-
-
- 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46.py
index d743d196d530c52dbced10ef105eff12f5306626..cc6b814541c1c3f4903e00cd62083fc7e049cec5 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46.py
@@ -29,6 +29,7 @@ Slices  = ['tau']
 Events  = 6000
 Threads = 8 
 Slots   = 8
+Release = "current"
 Input   = 'Ztautau_pu46'    # defined in TrigValTools/share/TrigValInputs.json  
 
 Jobs = [ ( "Offline",  " TIDAdata-run3-offline.dat -r Offline -o data-hists-offline.root" ),
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46_old.py
deleted file mode 100755
index b96643db6aefd7e5e764b5109b6a8858ba5f65a0..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46_old.py
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for mu_ztautau_pu46
-# art-type: grid
-# art-include: master/Athena
-# art-athena-mt: 8
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['tau']
-rdo2aod.max_events = 6000 
-rdo2aod.threads = 8
-rdo2aod.concurrent_events = 8
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-rdo2aod.input = 'Ztautau_pu46'    # defined in TrigValTools/share/TrigValInputs.json  
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3.dat -f data-hists.root -b Test_bin.dat '
-    test.check_steps.append(rdict)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2tau','L2','tau')
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep('Comp_EFtau','EF','tau')
-test.check_steps.append(comp2)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46_st.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46_st.py
index 27f1c21df5be3d59ef050d260a21a173bdcddcda..abd7eda34e4f69c1a019c406fac766bdb4f47726 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46_st.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46_st.py
@@ -29,6 +29,7 @@ Slices  = ['tau']
 Events  = 6000
 Threads = 1 
 Slots   = 1
+Release = "current"
 Input   = 'Ztautau_pu46'    # defined in TrigValTools/share/TrigValInputs.json  
 
 Jobs = [ ( "Offline",  " TIDAdata-run3-offline.dat -r Offline -o data-hists-offline.root" ),
diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46_st_old.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46_st_old.py
deleted file mode 100755
index 2eed16f432114929b6ced9dee0ef2f39fe45a9fd..0000000000000000000000000000000000000000
--- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_tau_ztautau_pu46_st_old.py
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/env python
-
-# art-description: art job for mu_ztautau_pu46_st
-# art-type: grid
-# art-include: master/Athena
-# art-athena-mt: 4
-# art-memory: 4096
-# art-html: https://idtrigger-val.web.cern.ch/idtrigger-val/TIDAWeb/TIDAart/?jobdir=
-# 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: HLT*
-# art-output: times*
-# 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, CheckSteps
-from TrigInDetValidation.TrigInDetOldArtSteps import TrigInDetReco, TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep
-
-import sys,getopt
-
-try:
-    opts, args = getopt.getopt(sys.argv[1:],"lxp",["local"])
-except getopt.GetoptError:
-    print("Usage:  ")
-    print("-l(--local)    run locally with input file from art eos grid-input")
-    print("-x             don't run athena or post post-processing, only plotting")
-    print("-p             run post-processing, even if -x is set")
-
-
-local=False
-exclude=False
-postproc=False
-for opt,arg in opts:
-    if opt in ("-l", "--local"):
-        local=True
-    if opt=="-x":
-        exclude=True
-    if opt=="-p":
-        postproc=True
-
-
-rdo2aod = TrigInDetReco()
-rdo2aod.slices = ['tau']
-rdo2aod.max_events = 6000 
-rdo2aod.threads = 1
-rdo2aod.concurrent_events = 1
-rdo2aod.perfmon = False
-rdo2aod.timeout = 18*3600
-rdo2aod.input = 'Ztautau_pu46'    # defined in TrigValTools/share/TrigValInputs.json  
-
-
-test = Test.Test()
-test.art_type = 'grid'
-if (not exclude):
-    test.exec_steps = [rdo2aod]
-    test.exec_steps.append(TrigInDetAna()) # Run analysis to produce TrkNtuple
-    test.check_steps = CheckSteps.default_check_steps(test)
-
- 
-# Run Tidardict
-if ((not exclude) or postproc ):
-    rdict = TrigInDetdictStep()
-    rdict.args='TIDAdata-run3.dat -f data-hists.root -b Test_bin.dat '
-    test.check_steps.append(rdict)
-
- 
-# Now the comparitor steps
-comp=TrigInDetCompStep('Comp_L2tau','L2','tau')
-test.check_steps.append(comp)
-  
-comp2=TrigInDetCompStep('Comp_EFtau','EF','tau')
-test.check_steps.append(comp2)
-
-# CPU cost steps
-cpucost=TrigInDetCpuCostStep('CpuCostStep1', ftf_times=False)
-test.check_steps.append(cpucost)
-
-cpucost2=TrigInDetCpuCostStep('CpuCostStep2')
-test.check_steps.append(cpucost2)
-
-import sys
-sys.exit(test.run())
diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
index 571575bba8b21bcd209ca1dee45c2257cb1f3f7f..1bbb99ec0c345bb5e0554ca413206b2ef229c0b9 100644
--- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
@@ -318,12 +318,6 @@ HLT_cscmon_CSCPEB_L1All:
     0: 20
 HLT_e12_lhloose_2mu10_L12MU10:
   eventCount: 0
-  stepCounts:
-    0: 1
-    1: 1
-  stepFeatures:
-    0: 2
-    1: 5
 HLT_e140_lhloose_L1EM22VHI:
   eventCount: 0
 HLT_e140_lhloose_nod0_L1EM22VHI:
@@ -614,6 +608,8 @@ HLT_g35_loose_mu18_L1EM24VHI:
   eventCount: 0
 HLT_g35_medium_g25_medium_L12EM20VH:
   eventCount: 0
+HLT_g35_tight_icalotight_mu15noL1_mu2noL1_L1EM22VHI:
+  eventCount: 0
 HLT_g35_tight_icalotight_mu18noL1_L1EM22VHI:
   eventCount: 0
 HLT_g3_loose_LArPEB_L1EM3:
diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py
index c407db4b658485536a5bdf01b7bb292a8b7ea4ce..c2a0d7f5437dd1ce957cfdd950caa17c1918bb9c 100644
--- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py
+++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py
@@ -510,8 +510,8 @@ TriggerHLTListRun3 = [
 
     # MinBias
 
-    ('xAOD::TrackParticleContainer#HLT_IDTrack_MinBias_FTF',                 'BS ESD AODFULL', 'MinBias', 'inViews:TrkView'),
-    ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_MinBias_FTFAux.',          'BS ESD AODFULL', 'MinBias'),
+    ('xAOD::TrackParticleContainer#HLT_IDTrack_MinBias_IDTrig',                 'BS ESD AODFULL', 'MinBias', 'inViews:TrkView'),
+    ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_MinBias_IDTrigAux.',          'BS ESD AODFULL', 'MinBias'),
 
 
     # Cosmic
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Modifiers.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Modifiers.py
index 3c5cc3f12863ac97e07e620f8571ce102ebc820e..9c3462731bdba6c9c21e3ca1801c839b79a2f268 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/Modifiers.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Modifiers.py
@@ -494,33 +494,8 @@ class optimizeChainOrder(_modifier):
             topSequence.TrigSteer_HLT.ExecutionOrderStrategy.order=[ 'name:.+beamspot.+',
                                                                     'name:.+j.+',
                                                                     'name:.+2tau.+',
-                                                                    'name:.+tau.+'  ]
-
-class disablePixels(_modifier):
-    """
-    Turns off pixels in region selector
-    """
-    def postSetup(self):
-        svcMgr.RegSelSvc.enablePixel=False
-
-class disableSCTBarrel(_modifier):
-    """
-    Turns off SCT Barrel in region selector and badly mapped ROB
-    """
-    def postSetup(self):
-        svcMgr.RegSelSvc.DeleteSiRobList=range(0x210000,0x21000a+1)+range(0x210100,0x21010a+1)+range(0x220000,0x22000a+1)+range(0x220100,0x22010a+1)+[0x240005]
-
-class disableIBL(_modifier):
-    """
-    Turn off IBL from readout
-    """
-
-    def postSetup(self):
-        import TrigInDetValidation.InDetModules as IDM
-        pixel_barrel_layer1_hashes = IDM.getHashes(IDM.getLayer(IDM.getBarrel(IDM.Pixel),0))
-        svcMgr.RegSelSvc.DeletePixelHashList=pixel_barrel_layer1_hashes
-        svcMgr.ROBDataProviderSvc.ignoreROB=[1310848, 1310849, 1310850, 1310851, 1310899, 1310944, 1310913, 1310946, 1310929, 1310912, 1310914, 1310736, 1310737, 1310738, 1310739, 1310752, 1310753, 1310754, 1310755, 1310883, 1310897, 1310930, 1310896, 1310898, 1310768, 1310769, 1310770, 1310771, 1310784, 1310785, 1310786, 1310787, 1310867, 1310931, 1310881, 1310880, 1310882, 1310800, 1310801, 1310802, 1310803, 1310816, 1310817, 1310818, 1310819, 1310915, 1310865, 1310864, 1310945, 1310928, 1310866, 1310832, 1310833, 1310834, 1310835, 1310947]
 
+                                                                    'name:.+tau.+'  ]
 class disableIBLInTracking(_modifier):
     """
     Turn off IBL in tracking algorithms (data still available for PEB etc)
@@ -1395,21 +1370,6 @@ class LumiFromSqlite(_modifier):
                 folders += [f]
         svcMgr.IOVDbSvc.Folders = folders
 
-class LumiRegionZmax168(_modifier):
-    """
-    decrease the size (equivalent of 3*sigma_z) of luminous region for ID tracking to 168 mm
-    """
-    def preSetup(self):
-        from InDetTrigRecExample.ConfiguredNewTrackingTrigCuts import L2IDTrackingCuts
-        from AthenaCommon.SystemOfUnits import mm
-        L2IDTrackingCuts.setRegSelZmax(168* mm)
-
-    def postSetup(self):
-        from AthenaCommon.AlgSequence import AlgSequence
-        topSequence = AlgSequence()
-        RegSelSvc=topSequence.allConfigurables.get("RegSelSvcDefault")
-        from AthenaCommon.SystemOfUnits import mm
-        RegSelSvc.DeltaZ = 168* mm
 
 class useDynamicAlignFolders(_modifier):
     """
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py
index 40450fa9998b3def017ca34a8cc045f310cb818d..43ec20c30fb5ffa9e840dd82a8b584ad1f46a390 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py
@@ -206,6 +206,10 @@ def createTriggerFlags():
     # name of the trigger menu
     flags.addFlag('Trigger.triggerMenuSetup', 'LS2_v1')
 
+    # modify the slection of chains that are run (default run all), see more in GenerateMenuMT_newJO
+
+    flags.addFlag('Trigger.triggerMenuModifier', ['all'])
+
     # name of the trigger menu
     flags.addFlag('Trigger.generateMenuDiagnostics', False)
 
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone_newJO.py b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone_newJO.py
index b524cd9622b49b5fa48baa5602963cb029ac25c1..30d9e06a9dc23637fb55a9b431076cc345c068b9 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone_newJO.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone_newJO.py
@@ -1,5 +1,5 @@
 #
-#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 #
 
 from AthenaConfiguration.ComponentAccumulator import CompFactory
@@ -7,29 +7,29 @@ from AthenaConfiguration.MainServicesConfig import MainServicesCfg
 from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags
 
 from AthenaCommon.Configurable import Configurable
-Configurable.configurableRun3Behavior=1
+Configurable.configurableRun3Behavior = 1
 
 
 flags.Detector.GeometryPixel = True
-flags.Detector.GeometrySCT   = True
-flags.Detector.GeometryTRT   = True
-flags.Detector.GeometryID    = True
+flags.Detector.GeometrySCT = True
+flags.Detector.GeometryTRT = True
+flags.Detector.GeometryID = True
 flags.Detector.GeometryBpipe = True
 flags.Detector.GeometryCavern = False
 flags.Detector.GeometryPixel = True
-flags.Detector.GeometrySCT   = True
-flags.Detector.GeometryTRT   = True
+flags.Detector.GeometrySCT = True
+flags.Detector.GeometryTRT = True
 
-flags.Detector.GeometryLAr   = True
-flags.Detector.GeometryTile  = True
-flags.Detector.GeometryMDT   = True
-flags.Detector.GeometryTGC   = True
-flags.Detector.GeometryCSC   = True
-flags.Detector.GeometryRPC   = True
+flags.Detector.GeometryLAr = True
+flags.Detector.GeometryTile = True
+flags.Detector.GeometryMDT = True
+flags.Detector.GeometryTGC = True
+flags.Detector.GeometryCSC = True
+flags.Detector.GeometryRPC = True
 
 
 flags.Detector.RecoPixel = True
-flags.Detector.RecoSCT   = True
+flags.Detector.RecoSCT = True
 
 
 # Output configuration - currently testing offline workflow
@@ -44,17 +44,17 @@ flags.Scheduler.ShowDataFlow = True
 flags.Scheduler.ShowControlFlow = True
 flags.Scheduler.EnableVerboseViews = True
 
-flags.Exec.MaxEvents=50
+flags.Exec.MaxEvents = 50
 flags.Input.isMC = False
-flags.Common.isOnline=True
-flags.IOVDb.GlobalTag="CONDBR2-HLTP-2018-01"
+flags.Common.isOnline = True
+flags.IOVDb.GlobalTag = "CONDBR2-HLTP-2018-01"
 
 
-flags.Concurrency.NumThreads=1
-flags.Concurrency.NumConcurrentEvents=1
+flags.Concurrency.NumThreads = 1
+flags.Concurrency.NumConcurrentEvents = 1
 
-flags.InDet.useSctDCS=False
-flags.InDet.usePixelDCS=False
+flags.InDet.useSctDCS = False
+flags.InDet.usePixelDCS = False
 
 # command line handling
 # options that are defined in: AthConfigFlags are handled here
@@ -65,37 +65,36 @@ flags.fillFromArgs(parser=parser)
 flags.lock()
 
 
-from AthenaCommon.Constants import INFO,DEBUG,WARNING
-acc = MainServicesCfg( flags )
+from AthenaCommon.Constants import INFO, DEBUG, WARNING
+acc = MainServicesCfg(flags)
 acc.getService('AvalancheSchedulerSvc').VerboseSubSlots = True
 
 # this delcares to the scheduer that EventInfo object is produced
-acc.addEventAlgo( CompFactory.SGInputLoader( Load = [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] ),
-                      "AthAlgSeq" )
+acc.addEventAlgo(CompFactory.SGInputLoader(Load=[('xAOD::EventInfo', 'StoreGateSvc+EventInfo')]), "AthAlgSeq")
 
 
 from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
-acc.merge(ByteStreamReadCfg( flags ))
+acc.merge(ByteStreamReadCfg(flags))
 
 
 from TriggerJobOpts.TriggerHistSvcConfig import TriggerHistSvcConfig
-acc.merge(TriggerHistSvcConfig( flags ))
+acc.merge(TriggerHistSvcConfig(flags))
 
 
 from TriggerMenuMT.HLTMenuConfig.Menu.GenerateMenuMT_newJO import generateMenu as generateHLTMenu
 from TriggerJobOpts.TriggerConfig import triggerRunCfg
-acc.merge( triggerRunCfg( flags, seqName = "AthMasterSeq", menu=generateHLTMenu ) )
+acc.merge(triggerRunCfg(flags, seqName="AthMasterSeq", menu=generateHLTMenu))
 
 from RegionSelector.RegSelConfig import regSelCfg
-acc.merge( regSelCfg( flags ) )
+acc.merge(regSelCfg(flags))
 
 # The L1 presacles do not get created in the avoce menu setup
 from TrigConfigSvc.TrigConfigSvcCfg import createL1PrescalesFileFromMenu
 createL1PrescalesFileFromMenu(flags)
 
 
-acc.getEventAlgo( "TrigSignatureMoniMT" ).OutputLevel=DEBUG
-acc.getEventAlgo( "L1Decoder" ).ctpUnpacker.UseTBPBits=True # test setup
+acc.getEventAlgo("TrigSignatureMoniMT").OutputLevel = DEBUG
+acc.getEventAlgo("L1Decoder").ctpUnpacker.UseTBPBits = True # test setup
 
 
 
@@ -116,10 +115,10 @@ acc.foreach_component("*HLTTop/*GenericMonitoringTool*").OutputLevel = WARNING #
 acc.printConfig(withDetails=False, summariseProps=True, printDefaults=True)
 
 
-fname = "runHLT_standalone_newJO.pkl"
-print( "Storing config in the file {}".format( fname ) )
-with open(fname, "wb") as p:
-    acc.store( p )
+fName = "runHLT_standalone_newJO.pkl"
+print("Storing config in the file {}".format(fName))
+with open(fName, "wb") as p:
+    acc.store(p)
     p.close()
 status = acc.run()
 if status.isFailure():
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
index 6c4a49f123ef6ae1440a745938efb5a6485c3b67..d10b30487f711a3476dcb0c1aad258ebbe51bd9e 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
@@ -17,7 +17,7 @@ def mergeChainDefs(listOfChainDefs, chainDict):
 
     strategy = chainDict["mergingStrategy"]
     offset = chainDict["mergingOffset"]
-    log.info("%s: Combine by using %s merging", chainDict['chainName'], strategy)
+    log.info("[mergeChainDefs] %s: Combine by using %s merging", chainDict['chainName'], strategy)
 
     if strategy=="parallel":
         return mergeParallel(listOfChainDefs,  offset)
@@ -30,7 +30,7 @@ def mergeChainDefs(listOfChainDefs, chainDict):
         for ich,cConfig in enumerate(listOfChainDefs):
             chain_ag = cConfig.alignmentGroups[0]
             if chain_ag not in ordering:
-                log.error("Alignment group %s can't be auto-merged because it's not in the grouping list!",chain_ag)
+                log.error("[mergeChainDefs] Alignment group %s can't be auto-merged because it's not in the grouping list!",chain_ag)
             if chain_ag in merging_dict:
                 merging_dict[chain_ag] += [ich]
             else:
@@ -53,7 +53,7 @@ def mergeChainDefs(listOfChainDefs, chainDict):
             
         
     else:
-        log.error("Merging failed for %s. Merging strategy '%s' not known.", (listOfChainDefs, strategy))
+        log.error("[mergeChainDefs] Merging failed for %s. Merging strategy '%s' not known.", (listOfChainDefs, strategy))
         return -1
 
 
@@ -61,8 +61,9 @@ def mergeChainDefs(listOfChainDefs, chainDict):
 def mergeParallel(chainDefList, offset):
 
     if offset != -1:
-        log.error("Offset for parallel merging not implemented.")
-        
+        log.error("[mergeParallel] Offset for parallel merging not implemented.")
+        raise Exception("[mergeParallel] Cannot merge this chain, exiting.")
+
     allSteps = []
     nSteps = []
     chainName = ''
@@ -73,17 +74,18 @@ def mergeParallel(chainDefList, offset):
         if chainName == '':
             chainName = cConfig.name
         elif chainName != cConfig.name:
-            log.error("Something is wrong with the combined chain name: cConfig.name = %s while chainName = %s", cConfig.name, chainName)
-        
+            log.error("[mergeParallel] Something is wrong with the combined chain name: cConfig.name = %s while chainName = %s", cConfig.name, chainName)
+            raise Exception("[mergeParallel] Cannot merge this chain, exiting.")
         allSteps.append(cConfig.steps)
         nSteps.append(len(cConfig.steps))
         l1Thresholds.extend(cConfig.vseeds)
         if len(cConfig.alignmentGroups) > 1:
-            log.error("Merging an already merged chain? This is odd! %s",cConfig.alignmentGroups)
+            log.error("[mergeParallel] Parallel merging an already merged chain? This is odd! %s",cConfig.alignmentGroups)
+            raise Exception("[mergeParallel] Complicated situation currently unimplemented. exiting.")
         elif len(cConfig.alignmentGroups) == 1:
             alignmentGroups.append(cConfig.alignmentGroups[0])
         else: 
-            log.info("Alignment groups are empty for this combined chain - if this is not _newJO, this is not ok!")
+            log.info("[mergeParallel] Alignment groups are empty for this combined chain - if this is not _newJO, this is not ok!")
     import itertools
     if 'zip_longest' in dir(itertools):
         from itertools import zip_longest
@@ -93,17 +95,20 @@ def mergeParallel(chainDefList, offset):
     orderedSteps = list(zip_longest(*allSteps))
 
     combChainSteps =[]
-    log.debug("len(orderedSteps): %d", len(orderedSteps))
+    log.debug("[mergeParallel] len(orderedSteps): %d", len(orderedSteps))
+    for chain_index in range(len(chainDefList)):
+        log.debug('[mergeParallel] Chain object to merge (i.e. chainDef) %s', chainDefList[chain_index])
+
     for step_index, steps in enumerate(orderedSteps):
         mySteps = list(steps)
-        log.debug("Merging step counter %d", step_index+1)
-        combStep = makeCombinedStep(mySteps, step_index+1, chainDefList)
+        log.debug("[mergeParallel] Merging step counter %d", step_index+1)
+        combStep = makeCombinedStep(mySteps, step_index+1, chainDefList, orderedSteps, combChainSteps)
         combChainSteps.append(combStep)
                                   
     combinedChainDef = Chain(chainName, ChainSteps=combChainSteps, L1Thresholds=l1Thresholds, 
                                 nSteps = nSteps, alignmentGroups = alignmentGroups)
 
-    log.debug("Parallel merged chain %s with these steps:", chainName)
+    log.debug("[mergeParallel] Parallel merged chain %s with these steps:", chainName)
     for step in combinedChainDef.steps:
         log.debug('\n   %s', step)
 
@@ -114,65 +119,180 @@ def getEmptySeqName(stepName, chain_index, step_number, alignGroup):
     if re.search('^Step[0-9]_',stepName):
         stepName = stepName[6:]
 
-    seqName = 'Empty'+ alignGroup +'Seq'+str(step_number)+ '_'+ stepName + '_leg' + str(chain_index)
+    seqName = 'Empty'+ alignGroup +'Seq'+str(step_number)+ '_'+ stepName
     return seqName
 
 
-def getEmptyMenuSequence(flags, name):
-    return EmptyMenuSequence(name)
+def getEmptyMenuSequence(flags, name, mergeUsingFeature = False):
+    return EmptyMenuSequence(name, mergeUsingFeature = mergeUsingFeature)
 
+def getMultiplicityPerLeg(multiplicities):
+    mult_per_leg = []
+    for mult in multiplicities:
+        if mult == 1: 
+            mult_per_leg += ['1']
+        elif mult > 1: 
+            mult_per_leg += ['N']
+        else: 
+            raise Exception("[serial_zip] multiplicity not an expected value: %s",mult) 
+    return mult_per_leg
+
+def isFullScanRoI(inputL1Nav):
+    fsRoIList = ['HLTNav_L1FSNOSEED','HLTNav_L1MET','HLTNav_L1J']
+    if inputL1Nav in fsRoIList:
+        return True
+    else:
+        return False
+
+def noPrecedingStepsPreMerge(newsteps,chain_index,ileg):
+    for step in newsteps:
+        seq = step[chain_index].sequences[ileg]
+        if type(seq).__name__ == 'EmptyMenuSequence':
+            continue
+        else:
+            #if there's a non-empty sequence in a step before, there is clearly a
+            #preceding step in this chain.
+            return False
+    return True
+
+def noPrecedingStepsPostMerge(newsteps, ileg):
+    for step in newsteps:
+        seq = step.sequences[ileg]
+        if type(seq).__name__ == 'EmptyMenuSequence':
+            continue
+        else:
+            #if there's a non-empty sequence in a step before, there is clearly a
+            #preceding step in this chain.
+            return False
+    return True
+        
 
 def serial_zip(allSteps, chainName, chainDefList):
-    n_chains = len(allSteps)
+
+    legs_per_part = [len(cd.steps[0].multiplicity) for cd in chainDefList]
+    n_parts = len(allSteps)
+    log.debug('[serial_zip] configuring chain with %d parts with multiplicities %s', n_parts, legs_per_part)
     newsteps = []
-    for chain_index, chainsteps in enumerate(allSteps):
-        for step_index, step in enumerate(chainsteps):
-            log.debug('chain_index: %s step_index: %s', chain_index, step_index)
-            # create list of correct length
-            stepList = [None]*n_chains
-            
+
+    doBonusDebug = False
+
+    for chain_index, chainSteps in enumerate(allSteps): #per-part (horizontal) iteration
+        for step_index, step in enumerate(chainSteps):  #serial step iteration
+            log.debug('[serial_zip] chain_index: %s step_index: %s', chain_index, step_index)
+            # create list of correct length (chainSteps in parallel)
+            stepList = [None]*n_parts
+
             # put the step from the current sub-chain into the right place
             stepList[chain_index] = step
-            log.debug('Put step: %s', step.name)
+            log.debug('[serial_zip] Put step: %s', step.name)
 
-            # all other steps should contain an empty sequence
-            for step_index2, emptyStep in enumerate(stepList):
+            # all other chain parts' steps should contain an empty sequence
+            for chain_index2, (emptyStep, nLegs) in enumerate(zip(stepList,legs_per_part)): #more per-leg iteration
                 if emptyStep is None:
-                    seqName = getEmptySeqName(step.name, chain_index, step_index+1, chainDefList[0].alignmentGroups[0])
-                    emptySeq =  RecoFragmentsPool.retrieve(getEmptyMenuSequence, flags=None, name=seqName)
-                    stepList[step_index2] = ChainStep( seqName, Sequences=[emptySeq], chainDicts=step.stepDicts)            
-            
+                    mult_per_leg = getMultiplicityPerLeg(chainDefList[chain_index2].steps[0].multiplicity)
+
+                    #this WILL NOT work for jets!
+                    step_mult = []
+                    emptyChainDicts = []
+                    if chain_index2 < chain_index:
+                        emptyChainDicts = allSteps[chain_index2][-1].stepDicts
+                    else:
+                        emptyChainDicts = allSteps[chain_index2][0].stepDicts
+
+                    sigNames = []
+                    for emptyChainDict in emptyChainDicts:
+                        if isFullScanRoI(chainDefList[chain_index2].L1decisions[0]):
+                            sigNames +=[emptyChainDict['chainParts'][0]['signature']+'FS']
+                        else:
+                            sigNames +=[emptyChainDict['chainParts'][0]['signature']]
+
+                    seqMultName = '_'.join([mult+sigName for mult, sigName in zip(mult_per_leg,sigNames)])
+                    seqStepName = 'Empty' + chainDefList[chain_index].alignmentGroups[0]+'Align'+str(step_index+1)+'_'+seqMultName
+
+                    seqNames = [getEmptySeqName(emptyChainDicts[iSeq]['signature'], chain_index, step_index+1, chainDefList[chain_index].alignmentGroups[0]) for iSeq in range(nLegs)]
+                    if doBonusDebug:                        
+                        log.debug("[serial_zip] step name for this leg: %s", seqStepName)
+                        log.debug("[serial_zip] created empty sequence(s): %s", seqNames)
+                        log.debug("[serial_zip] L1decisions %s ", chainDefList[chain_index2].L1decisions)
+
+                    emptySequences = []
+                    for ileg in range(nLegs):
+                        if isFullScanRoI(chainDefList[chain_index2].L1decisions[0]) and noPrecedingStepsPreMerge(newsteps,chain_index2, ileg):
+                            log.debug("[serial_zip] adding FS empty sequence with mergeUsingFeature = False ")
+                            emptySequences += [RecoFragmentsPool.retrieve(getEmptyMenuSequence, flags=None, name=seqNames[ileg]+"FS", mergeUsingFeature = False)]
+                        elif isFullScanRoI(chainDefList[chain_index2].L1decisions[0]):
+                            log.debug("[serial_zip] adding FS empty sequence with mergeUsingFeature = True ")
+                            emptySequences += [RecoFragmentsPool.retrieve(getEmptyMenuSequence, flags=None, name=seqNames[ileg]+"FS", mergeUsingFeature = True)]
+                        else:
+                            log.debug("[serial_zip] adding non-FS empty sequence")
+                            emptySequences += [RecoFragmentsPool.retrieve(getEmptyMenuSequence, flags=None, name=seqNames[ileg])]
+
+                    #this WILL NOT work for jets!
+                    step_mult = []
+                    emptyChainDicts = []
+                    if chain_index2 < chain_index:
+                        emptyChainDicts = allSteps[chain_index2][-1].stepDicts
+                    else:
+                        emptyChainDicts = allSteps[chain_index2][0].stepDicts
+
+                    if doBonusDebug:
+                        log.debug("[serial_zip] emptyChainDicts %s",emptyChainDicts)
+
+                    if len(emptySequences) != len(emptyChainDicts):
+                        log.error("[serial_zip] different number of empty sequences/legs %d to stepDicts %d", len(emptySequences), len(emptyChainDicts))
+                        raise Exception("[serial_zip] Cannot create this chain step, exiting.")
+
+                    for sd in emptyChainDicts:
+                        if len(sd['chainParts']) != 1:
+                            log.error("[serial_zip] stepDict chainParts has length != 1 within a leg! %s",sd)
+                            raise Exception("[serial_zip] Cannot create this chain step, exiting.")
+                        step_mult += [int(sd['chainParts'][0]['multiplicity'])] 
+
+                    if len(emptySequences) != len(step_mult):
+                        log.error("[serial_zip] different number of empty sequences/legs %d to multiplicities %d", len(emptySequences), len(step_mult))
+                        raise Exception("[serial_zip] Cannot create this chain step, exiting.")
+
+                    if doBonusDebug:
+                        log.debug('[serial_zip] step multiplicity %s',step_mult)
+
+                    stepList[chain_index2] = ChainStep( seqStepName, Sequences=emptySequences,
+                                                  multiplicity = step_mult, chainDicts=emptyChainDicts,
+                                                  isEmpty = True)
+
             newsteps.append(stepList)
     log.debug('After serial_zip')
     for s in newsteps:
         log.debug( ', '.join(map(str, [step.name for step in s]) ) )
     return newsteps
 
+
 def mergeSerial(chainDefList):
     allSteps = []
     nSteps = []
     chainName = ''
     l1Thresholds = []
     alignmentGroups = []
-    log.debug('Merge chainDefList:')
+    log.debug('[mergeSerial] Merge chainDefList:')
     log.debug(chainDefList)
 
     for cConfig in chainDefList:
+
         if chainName == '':
             chainName = cConfig.name
         elif chainName != cConfig.name:
-            log.error("Something is wrong with the combined chain name: cConfig.name = %s while chainName = %s", cConfig.name, chainName)
-            
+            log.error("[mergeSerial] Something is wrong with the combined chain name: cConfig.name = %s while chainName = %s", cConfig.name, chainName)
+            raise Exception("[mergeSerial] Cannot merge this chain, exiting.")
+
         allSteps.append(cConfig.steps)
         nSteps.append(len(cConfig.steps))
         l1Thresholds.extend(cConfig.vseeds)
-        if len(cConfig.alignmentGroups) > 1:
-            log.error("Merging an already merged chain? This is odd! %s",cConfig.alignmentGroups)
-        alignmentGroups.append(cConfig.alignmentGroups[0])
+        alignmentGroups.extend(cConfig.alignmentGroups)
 
-    serialSteps = serial_zip(allSteps, chainName,chainDefList)
+    serialSteps = serial_zip(allSteps, chainName, chainDefList)
     mySerialSteps = deepcopy(serialSteps)
     combChainSteps =[]
+    for chain_index in range(len(chainDefList)):
+        log.debug('[mergeSerial] Chain object to merge (i.e. chainDef) %s', chainDefList[chain_index])
     for step_index, steps in enumerate(mySerialSteps):
         mySteps = list(steps)
         combStep = makeCombinedStep(mySteps, step_index+1, chainDefList)
@@ -181,78 +301,112 @@ def mergeSerial(chainDefList):
     # check if all chain parts have the same number of steps
     sameNSteps = all(x==nSteps[0] for x in nSteps) 
     if sameNSteps is True:
-        log.info("All chain parts have the same number of steps")
+        log.info("[mergeSerial] All chain parts have the same number of steps")
     else:
-        log.info("Have to deal with uneven number of chain steps, there might be none's appearing in sequence list => to be fixed")
+        log.info("[mergeSerial] Have to deal with uneven number of chain steps, there might be none's appearing in sequence list => to be fixed")
                                   
     combinedChainDef = Chain(chainName, ChainSteps=combChainSteps, L1Thresholds=l1Thresholds,
                                nSteps = nSteps, alignmentGroups = alignmentGroups)
 
-    log.debug("Serial merged chain %s with these steps:", chainName)
+    log.debug("[mergeSerial] Serial merged chain %s with these steps:", chainName)
     for step in combinedChainDef.steps:
         log.debug('   %s', step)
 
     return combinedChainDef
 
 
-def makeCombinedStep(steps, stepNumber, chainDefList):
+def makeCombinedStep(parallel_steps, stepNumber, chainDefList, allSteps = [], currentChainSteps = []):
     from TrigCompositeUtils.TrigCompositeUtils import legName
     stepName = 'merged' #we will renumber all steps after chains are aligned #Step' + str(stepNumber)
     stepSeq = []
     stepMult = []
-    log.verbose(" steps %s ", steps)
+    log.verbose("[makeCombinedStep] steps %s ", parallel_steps)
     stepDicts = []
     comboHypoTools = []
     comboHypo = None
 
     # this function only makes sense if we are merging steps corresponding to the chains in the chainDefList
-    assert len(chainDefList)==len(steps), "makeCombinedStep: Length of chain defs %d does not match length of steps to merge %d" % (len(chainDefList), len(steps))
+    assert len(chainDefList)==len(parallel_steps), "[makeCombinedStep] makeCombinedStep: Length of chain defs %d does not match length of steps to merge %d" % (len(chainDefList), len(allSteps))
     
-    for chain_index, step in enumerate(steps):
+    leg_counter = 0
+  
+    for chain_index, step in enumerate(parallel_steps): #this is a horizontal merge!
         if step is None:
             # this happens for merging chains with different numbers of steps, we need to "pad" out with empty sequences to propogate the decisions
-            currentStepName = "Step" + str(stepNumber) + "_Empty" + str(chain_index)
-            seqName = getEmptySeqName(currentStepName, chain_index, stepNumber, chainDefList[0].alignmentGroups[0])
-            log.debug("  step %s,  empty sequence %s", currentStepName, seqName)
-            emptySeq = RecoFragmentsPool.retrieve(getEmptyMenuSequence, flags=None, name=seqName)
+            # all other chain parts' steps should contain an empty sequence
 
-            stepSeq.append(emptySeq)
-            stepMult.append(1)
+            new_stepDict = deepcopy(chainDefList[chain_index].steps[-1].stepDicts[-1])
+            
+            seqName = getEmptySeqName(new_stepDict['signature'], chain_index, stepNumber, chainDefList[0].alignmentGroups[0])
+
+            currentStepName = ''
+            if isFullScanRoI(chainDefList[chain_index].L1decisions[0]):
+                if noPrecedingStepsPostMerge(currentChainSteps, chain_index):
+                    stepSeq.append(RecoFragmentsPool.retrieve(getEmptyMenuSequence, flags=None, name=seqName+"FS", mergeUsingFeature = False))
+                else:
+                    stepSeq.append(RecoFragmentsPool.retrieve(getEmptyMenuSequence, flags=None, name=seqName+'FS', mergeUsingFeature = True))
+                currentStepName = 'Empty' + chainDefList[chain_index].alignmentGroups[0]+'Align'+str(stepNumber)+'_'+new_stepDict['chainParts'][0]['multiplicity']+new_stepDict['signature']+'FS'
+            else:
+                stepSeq.append(RecoFragmentsPool.retrieve(getEmptyMenuSequence, flags=None, name=seqName))
+                currentStepName = 'Empty' + chainDefList[chain_index].alignmentGroups[0]+'Align'+str(stepNumber)+'_'+new_stepDict['chainParts'][0]['multiplicity']+new_stepDict['signature']
+
+            log.debug("[makeCombinedStep]  step %s,  empty sequence %s", currentStepName, seqName)
+
+            #stepNumber is indexed from 1, need the previous step indexed from 0, so do - 2
+            prev_step_mult = int(currentChainSteps[stepNumber-2].multiplicity[chain_index])
+            stepMult.append(prev_step_mult)
             # we need a chain dict here, use the one corresponding to this leg of the chain
-            stepDicts.append(deepcopy(chainDefList[chain_index].steps[-1].stepDicts[-1]))
+            oldLegName = new_stepDict['chainName']
+            if re.search('^leg[0-9]{3}_',oldLegName):
+                oldLegName = oldLegName[7:]
+            new_stepDict['chainName'] = legName(oldLegName,leg_counter)
+            stepDicts.append(new_stepDict)
+            leg_counter += 1
         else:
             # Standard step, append it to the combined step
-            log.debug("  step %s, multiplicity  = %s", step.name, str(step.multiplicity))
+            log.debug("[makeCombinedStep]  step %s, multiplicity  = %s", step.name, str(step.multiplicity))
             if len(step.sequences):
-                log.debug("      with sequences = %s", ' '.join(map(str, [seq.name for seq in step.sequences])))
+                log.debug("[makeCombinedStep]    with sequences = %s", ' '.join(map(str, [seq.name for seq in step.sequences])))
 
             # this function only works if the input chains are single-object chains (one menu seuqnce)
             if len(step.sequences) > 1:
-                log.error("More than one menu sequence found in combined chain!!")
+                log.debug("[makeCombinedStep] combining in an already combined chain")
+
             comboHypo = step.comboHypoCfg
             currentStepName = step.name
-            #remove redundant instances of StepN_
+            #remove redundant instances of StepN_ and merged_ (happens when merging already merged chains)
             if re.search('^Step[0-9]_',currentStepName):
                 currentStepName = currentStepName[6:]
-
-            if len(step.sequences):
-                seq = step.sequences[0]
-                stepSeq.append(seq)
+            if re.search('^merged_',currentStepName):
+                currentStepName = currentStepName[7:]
+            stepSeq.extend(step.sequences)
             # set the multiplicity of all the legs 
-            stepMult.append(sum(step.multiplicity))
+            if len(step.multiplicity) == 0:
+                stepMult.append(0)
+            else:
+                stepMult.extend(step.multiplicity)
             comboHypoTools.extend(step.comboToolConfs)
             # update the chain dict list for the combined step with the chain dict from this step
-            stepDicts += deepcopy(step.stepDicts)
+            log.debug('[makeCombinedStep] adding step dictionaries %s',step.stepDicts)
+            
+            for new_stepDict in deepcopy(step.stepDicts):
+                oldLegName = new_stepDict['chainName']
+                if re.search('^leg[0-9]{3}_',oldLegName):
+                    oldLegName = oldLegName[7:]
+                new_stepDict['chainName'] = legName(oldLegName,leg_counter)
+                log.debug("[makeCombinedStep] stepDict naming old: %s, new: %s", oldLegName, new_stepDict['chainName'])
+                stepDicts.append(new_stepDict)
+                leg_counter += 1
 
 
         # the step naming for combined chains needs to be revisted!!
         stepName += '_' + currentStepName
+        log.debug('[makeCombinedStep] current step name %s',stepName)
         # for merged steps, we need to update the name to add the leg name
-        stepDicts[-1]['chainName'] = legName(stepDicts[-1]['chainName'], chain_index)
         
     comboHypoTools = list(set(comboHypoTools))
     theChainStep = ChainStep(stepName, Sequences=stepSeq, multiplicity=stepMult, chainDicts=stepDicts, comboHypoCfg=comboHypo, comboToolConfs=comboHypoTools) 
-    log.info("Merged step: \n %s", theChainStep)
+    log.info("[makeCombinedStep] Merged step: \n %s", theChainStep)
   
     
     return theChainStep
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
index b4674557188ccdb593075f10ee510797d10c6bd1..deb952c1f7cf58c7827d1d8dade4e0a1acc55821 100755
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
@@ -307,7 +307,7 @@ class GenerateMenuMT(object, metaclass=Singleton):
                   alignedChainConfig = menuAlignment.single_align(chainDict, chainConfig)
                   TriggerConfigHLT.registerChain( chainDict, alignedChainConfig )
 
-              elif len(alignmentGroups) == 2:
+              elif len(alignmentGroups) >= 2:
                   alignedChainConfig = menuAlignment.multi_align(chainDict, chainConfig, lengthOfChainConfigs)
                   TriggerConfigHLT.registerChain( chainDict, alignedChainConfig )              
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py
index 1ce863f74f56e8347093529a4d0ed8473d65ed26..d9622d9f6758f88d5dadf371cce7a3670b4474dc 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py
@@ -35,11 +35,28 @@ def obtainChainsOfMenu(flags):
     return setupMenuModule.setupMenu(flags)
 
 
+def acceptChain(chainDict, whichSignatures):
+    """
+    Helper to accept chains to be part of the menu depending on their name or which signatures they belong to.
 
+    If the keyword "all" is present all chains that are in the menu are accepted.
+    If the keyword "emptyMenu" is present other keywords are checked.
+      They can be name of signature: e.g. Muon or name of chain(s) HLT_j50_L1J30
+    Leaving the "emptyMenu" keyword only results in no chains that are configured. As a consequence would cause an issue somewhere downstream.
+    """
+    if "all" in whichSignatures:
+        return True
+    if "emptyMenu" in whichSignatures:
+        if chainDict["chainName"] in whichSignatures:  #explicit list of chains specified
+            return True
+        if all( [ sig in whichSignatures for sig in chainDict['signatures'] ]): # all signatures for the chain are mentioned 
+            return True
+    return False
 
 def generateMenu(flags):
     """
     Using flags generate appropriate Control Flow Graph wiht all HLT algorithms
+    
     """
 
     # convert to chainDefs
@@ -75,7 +92,8 @@ def generateMenu(flags):
         for chain in chains:
             # TODO topo threshold
             mainChainDict = dictFromChainName( chain )
-            
+            if not acceptChain( mainChainDict, flags.Trigger.triggerMenuModifier ):
+                continue
             counter += 1
             mainChainDict['chainCounter'] = counter
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
index 1821f9279060881a01c797833c7af6d69d52d729..1e1dc9f132aa5745a19e1b4cb497c74251896e81 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
@@ -425,7 +425,7 @@ def setupMenu():
 #        ChainProp(name='HLT_e9_lhvloose_mu20_mu8noL1_L1MU20', l1SeedThresholds=['EM3','MU20','FSNOSEED'], stream=[PhysicsStream], groups=EgammaMuonGroup),
 #        ChainProp(name='HLT_g35_loose_mu15_mu2noL1_L1EM22VHI', l1SeedThresholds=['EM22VHI','MU6','FSNOSEED'], stream=[PhysicsStream], groups=EgammaMuonGroup),
         ChainProp(name='HLT_g35_tight_icalotight_mu18noL1_L1EM22VHI', l1SeedThresholds=['EM22VHI','FSNOSEED'], stream=[PhysicsStream], groups=EgammaMuonGroup),
-        #        ChainProp(name='HLT_g35_tight_icalotight_mu15noL1_mu2noL1_L1EM22VHI', l1SeedThresholds=['EM22VHI','FSNOSEED','FSNOSEED'], stream=[PhysicsStream], groups=EgammaMuonGroup),
+        ChainProp(name='HLT_g35_tight_icalotight_mu15noL1_mu2noL1_L1EM22VHI', l1SeedThresholds=['EM22VHI','FSNOSEED','FSNOSEED'], stream=[PhysicsStream], groups=EgammaMuonGroup),
     
     ]
     TriggerFlags.HeavyIonSlice.signatures  = TriggerFlags.HeavyIonSlice.signatures() + []
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index 023c5dcc0011f223216a66b2f2da763cb4965a92..95c607bf26690336021fccfffd89a60765f08ab1 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -355,10 +355,11 @@ class EmptyMenuSequence(object):
     """ Class to emulate reco sequences with no Hypo"""
     """ By construction it has no Hypo;"""
     
-    def __init__(self, the_name):
+    def __init__(self, the_name, mergeUsingFeature = False):
         self._name = the_name
         Maker = CompFactory.InputMakerForRoI("IM"+the_name)
         Maker.RoITool = CompFactory.ViewCreatorInitialROITool()
+        Maker.mergeUsingFeature = mergeUsingFeature
         self._maker       = InputMakerNode( Alg = Maker )
         self._seed=''
         self._sequence    = Node( Alg = seqAND(the_name, [Maker]))
@@ -740,6 +741,9 @@ class CFSequence(object):
         the filter is connected only once (to avoid multiple DH links)
         """
         log.debug("CFSequence: connect Filter %s with %d menuSequences of step %s, using %d connections", compName(self.filter.Alg), len(self.step.sequences), self.step.name, len(connections))
+        log.debug("   --- sequences: ")
+        for seq in self.step.sequences:
+            log.debug(seq)
         if len(connections) == 0:
             log.error("ERROR, no filter outputs are set!")
 
@@ -789,19 +793,24 @@ class StepComponent(object):
 # next:  can we remove multiplicity array, if it can be retrieved from the ChainDict?
 class ChainStep(object):
     """Class to describe one step of a chain; if multiplicity is greater than 1, the step is combo/combined.  Set one multiplicity value per sequence"""
-    def __init__(self, name,  Sequences=[], multiplicity=[1], chainDicts=[], comboHypoCfg=ComboHypoCfg, comboToolConfs=[]):
+    def __init__(self, name,  Sequences=[], multiplicity=[1], chainDicts=[], comboHypoCfg=ComboHypoCfg, comboToolConfs=[], isEmpty = False):
 
         # include cases of emtpy steps with multiplicity = [] or multiplicity=[0,0,0///]
         if sum(multiplicity)==0:
             multiplicity=[]
         else:
             # sanity check on inputs, excluding empty steps
+            if len(chainDicts) != len(multiplicity):
+                log.error("[ChainStep] Sequences: %s",Sequences)
+                log.error("[ChainStep] chainDicts: %s",chainDicts)
+                log.error("[ChainStep] multiplicity: %s",multiplicity)
+                raise RuntimeError("[ChainStep] Tried to configure a ChainStep %s with %i multiplicity and %i dictionaries. These lists must have the same size" % (name, len(multiplicity), len(chainDicts)) )
+            
             if len(Sequences) != len(multiplicity):
+                log.error("[ChainStep] Sequences: %s",Sequences)
+                log.error("[ChainStep] multiplicities: %s",multiplicity)
                 raise RuntimeError("Tried to configure a ChainStep %s with %i Sequences and %i multiplicities. These lists must have the same size" % (name, len(Sequences), len(multiplicity)) )
-
-            if len(Sequences) != len(chainDicts):
-                raise RuntimeError("Tried to configure a ChainStep %s with %i Sequences and %i dictionaries. These lists must have the same size" % (name, len(Sequences), len(chainDicts)) )
-
+ 
         self.name = name
         self.sequences=Sequences
         self.multiplicity = multiplicity
@@ -809,7 +818,7 @@ class ChainStep(object):
         self.comboToolConfs=comboToolConfs
         self.stepDicts = chainDicts # one dict per leg
         self.isCombo=sum(multiplicity)>1
-        self.isEmpty=sum(multiplicity)==0
+        self.isEmpty=(sum(multiplicity)==0 or isEmpty)
         self.combo=None
         if self.isCombo:
             self.makeCombo()
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasMenuSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasMenuSequences.py
index a23cf16951fa24f720879285b293a57f77e80044..de19773da588783308b0c735e9ec0fc6fb8f9a9c 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasMenuSequences.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasMenuSequences.py
@@ -5,10 +5,10 @@ from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence
 from AthenaCommon.CFElements import parOR
 from AthenaCommon.CFElements import seqAND
 from TrigInDetConfig.InDetSetup import makeInDetAlgs
+from TrigInDetConfig.EFIDTracking import makeInDetPatternRecognition
 from TrigEDMConfig.TriggerEDMRun3 import recordable
 from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
 from DecisionHandling.DecisionHandlingConf import ViewCreatorInitialROITool
-from AthenaCommon.GlobalFlags import globalflags
 from TrigInDetConfig.ConfigSettings import getInDetTrigConfig
 
 
@@ -55,7 +55,8 @@ def MinBiasSPSequence():
     idTrigConfig = getInDetTrigConfig('minBias')
     idAlgs, verifier = makeInDetAlgs(config=idTrigConfig, 
                                      rois=spInputMakerAlg.InViewRoIs, 
-                                     viewVerifier='SPViewDataVerifier')
+                                     viewVerifier='SPViewDataVerifier', 
+                                     doFTF=False)
     verifier.DataObjects += [('TrigRoiDescriptorCollection', 'StoreGateSvc+InputRoI'),
                              ('SCT_ID', 'DetectorStore+SCT_ID'),
                              ('PixelID', 'DetectorStore+PixelID'),
@@ -68,7 +69,9 @@ def MinBiasSPSequence():
                                        ('PixelID', 'DetectorStore+PixelID'),
                                        ('TagInfo', 'DetectorStore+ProcessingTags')]
 
-    spAlgsList = idAlgs[:-2]
+#    spAlgsList = idAlgs[:-2]
+    spAlgsList = idAlgs
+
 
     spCount = TrigCountSpacePointsMT()
     spCount.SpacePointsKey = recordable("HLT_SpacePointCounts")
@@ -104,28 +107,16 @@ def MinBiasTrkSequence():
         # prepare algorithms to run in views, first,
         # inform scheduler that input data is available in parent view (has to be done by hand)
         idTrigConfig = getInDetTrigConfig('minBias')
-        idAlgs, verifier = makeInDetAlgs(config=idTrigConfig, rois=trkInputMakerAlg.InViewRoIs, viewVerifier='TrkrecoSeqDataVerifier')
-        verifier.DataObjects += [('TrigRoiDescriptorCollection', 'StoreGateSvc+InputRoI'),
-                                 ('IDCInDetBSErrContainer', 'StoreGateSvc+SCT_FlaggedCondData_TRIG'),
-                                 ('InDet::SCT_ClusterContainer', 'StoreGateSvc+SCT_TrigClusters'),
-                                 ('SpacePointContainer', 'StoreGateSvc+SCT_TrigSpacePoints'),
-                                 ('InDet::PixelClusterContainer', 'StoreGateSvc+PixelTrigClusters'),
-                                 ('SpacePointContainer', 'StoreGateSvc+PixelTrigSpacePoints')]
-
-        if globalflags.InputFormat.is_bytestream():
-          verifier.DataObjects += [('IDCInDetBSErrContainer', 'StoreGateSvc+PixelByteStreamErrs'),
-                                   ('IDCInDetBSErrContainer', 'StoreGateSvc+SCT_ByteStreamErrs')]
-
 
-        trkList = idAlgs[-2:] # FTF and Track to xAOD::TrackParticle conversion alg
+        algs,_ = makeInDetPatternRecognition(idTrigConfig, verifier='VDVMinBiasIDTracking')
         trackCountHypo = TrackCountHypoAlgMT()
         trackCountHypo.trackCountKey = recordable("HLT_TrackCount")
-        trackCountHypo.tracksKey = recordable("HLT_IDTrack_MinBias_FTF")
+        trackCountHypo.tracksKey = recordable("HLT_IDTrack_MinBias_IDTrig")
 
         from TrigMinBias.TrackCountMonitoringMT import TrackCountMonitoring
         trackCountHypo.MonTool = TrackCountMonitoring()
 
-        trkRecoSeq = parOR("TrkrecoSeq", [verifier]+trkList)
+        trkRecoSeq = parOR("TrkrecoSeq", algs)
         trkSequence = seqAND("TrkSequence", [trkInputMakerAlg, trkRecoSeq])
         trkInputMakerAlg.ViewNodeName = trkRecoSeq.name()
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py
index b3de9157559cc1648a4db88bee753dc14310914f..bfffeaf4b4e5a4c5ceb21736da6681281642be36 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py
@@ -613,7 +613,7 @@ def muEFSARecoSequence( RoIs, name ):
       Cleaner.PullCutPhi = 3
       SegmentFinder.TrackCleaner = Cleaner
       
-      theSegmentFinderAlg = CfgMgr.MuonSegmentFinderAlg( "TrigMuonSegmentMaker_"+name,SegmentCollectionName="MuonSegments",
+      theSegmentFinderAlg = CfgMgr.MuonSegmentFinderAlg( "TrigMuonSegmentMaker_"+name,
                                                        MuonPatternCalibration = CfgGetter.getPublicTool("MuonPatternCalibration"), 
                                                        MuonPatternSegmentMaker = CfgGetter.getPublicTool("MuonPatternSegmentMaker"), 
                                                        MuonTruthSummaryTool = None)
@@ -630,7 +630,7 @@ def muEFSARecoSequence( RoIs, name ):
     theSegmentFinderAlg = MooSegmentFinderAlg("TrigMuonSegmentMaker_"+name)
 
   from MuonSegmentTrackMaker.MuonTrackMakerAlgsMonitoring import MuPatTrackBuilderMonitoring
-  TrackBuilder = CfgMgr.MuPatTrackBuilder("TrigMuPatTrackBuilder_"+name ,MuonSegmentCollection = "MuonSegments", 
+  TrackBuilder = CfgMgr.MuPatTrackBuilder("TrigMuPatTrackBuilder_"+name ,MuonSegmentCollection = "TrackMuonSegments", 
                                           TrackSteering=CfgGetter.getPublicToolClone("TrigMuonTrackSteering", "MuonTrackSteering"), 
                                           MonTool = MuPatTrackBuilderMonitoring("MuPatTrackBuilderMonitoringSA_"+name))
   xAODTrackParticleCnvAlg = MuonStandaloneTrackParticleCnvAlg("TrigMuonStandaloneTrackParticleCnvAlg_"+name)
@@ -846,7 +846,7 @@ def muEFInsideOutRecoSequence(RoIs, name):
         Cleaner.PullCutPhi = 3
         SegmentFinder.TrackCleaner = Cleaner
       
-        theSegmentFinderAlg = CfgMgr.MuonSegmentFinderAlg( "TrigMuonSegmentMaker_"+name,SegmentCollectionName="MuonSegments",
+        theSegmentFinderAlg = CfgMgr.MuonSegmentFinderAlg( "TrigMuonSegmentMaker_"+name,
                                                            MuonPatternCalibration = CfgGetter.getPublicTool("MuonPatternCalibration"), 
                                                            MuonPatternSegmentMaker = CfgGetter.getPublicTool("MuonPatternSegmentMaker"), 
                                                            MuonTruthSummaryTool = None)